Skip to content

Commit

Permalink
Merge remote-tracking branch 'Upstream/develop' into develop-28
Browse files Browse the repository at this point in the history
  • Loading branch information
aspangaro committed Jun 8, 2015
2 parents 1d1f19b + 9b7982b commit 592d124
Show file tree
Hide file tree
Showing 50 changed files with 1,443 additions and 468 deletions.
2 changes: 1 addition & 1 deletion htdocs/admin/company.php
Expand Up @@ -385,7 +385,7 @@
}
else
{
print '<img height="30" src="'.DOL_URL_ROOT.'/theme/common/nophoto.jpg">';
print '<img height="30" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.jpg">';
}
print '</td></tr></table>';
print '</td></tr>';
Expand Down
4 changes: 2 additions & 2 deletions htdocs/comm/propal.php
Expand Up @@ -2340,7 +2340,7 @@

$ref = dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/'));
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/').'([^\-])+');
$file = $fileparams['fullname'];

// Define output language
Expand All @@ -2365,7 +2365,7 @@
dol_print_error($db, $result);
exit();
}
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/'));
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/').'([^\-])+');
$file = $fileparams['fullname'];
}

Expand Down
33 changes: 25 additions & 8 deletions htdocs/comm/propal/list.php
Expand Up @@ -56,6 +56,7 @@
$search_societe=GETPOST('search_societe','alpha');
$search_montant_ht=GETPOST('search_montant_ht','alpha');
$search_author=GETPOST('search_author','alpha');
$search_product_category=GETPOST('search_product_category','int');
$search_town=GETPOST('search_town','alpha');
$viewstatut=$db->escape(GETPOST('viewstatut'));
$object_statut=$db->escape(GETPOST('propal_statut'));
Expand Down Expand Up @@ -91,6 +92,7 @@
$search_societe='';
$search_montant_ht='';
$search_author='';
$search_product_category='';
$search_town='';
$year='';
$month='';
Expand Down Expand Up @@ -145,14 +147,15 @@
$limit = $conf->liste_limit;


if (! $sall) $sql = 'SELECT';
else $sql = 'SELECT DISTINCT';
$sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
$sql.= ' s.rowid, s.nom as name, s.town, s.client, s.code_client,';
$sql.= ' p.rowid as propalid, p.note_private, p.total_ht, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,';
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " sc.fk_soc, sc.fk_user,";
$sql.= ' u.login';
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'propal as p';
if ($sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'propaldet as pd ON p.rowid=pd.fk_propal';
if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'propaldet as pd ON p.rowid=pd.fk_propal';
if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON p.fk_user_author = u.rowid';
// We'll need this table joined to the select in order to filter by sale
if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
Expand Down Expand Up @@ -190,7 +193,8 @@
if ($sall) {
$sql .= natural_search(array('s.nom', 'p.note_private', 'p.note_public', 'pd.description'), $sall);
}
if ($socid) $sql.= ' AND s.rowid = '.$socid;
if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$search_product_category;
if ($socid > 0) $sql.= ' AND s.rowid = '.$socid;
if ($viewstatut <> '')
{
$sql.= ' AND p.fk_statut IN ('.$viewstatut.')';
Expand Down Expand Up @@ -223,7 +227,7 @@
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}

//print $sql;

$sql.= $db->plimit($limit + 1,$offset);
$result=$db->query($sql);
Expand Down Expand Up @@ -265,15 +269,28 @@
if ($user->rights->societe->client->voir || $socid)
{
$langs->load("commercial");
$moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': ';
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': ';
$moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user);
$moreforfilter.=' &nbsp; &nbsp; &nbsp; ';
$moreforfilter.='</div>';
}
// If the user can view prospects other than his'
if ($user->rights->societe->client->voir || $socid)
{
$moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': ';
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': ';
$moreforfilter.=$form->select_dolusers($search_user,'search_user',1);
$moreforfilter.='</div>';
}
// If the user can view prospects other than his'
if ($conf->categorie->enabled && $user->rights->produit->lire)
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1);
$moreforfilter.='</div>';
}
if (! empty($moreforfilter))
{
Expand Down
5 changes: 2 additions & 3 deletions htdocs/commande/card.php
Expand Up @@ -2,7 +2,7 @@
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
Expand Down Expand Up @@ -2334,7 +2334,6 @@

$ref = dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/'));
$file = $fileparams['fullname'];

// Define output language
Expand All @@ -2359,7 +2358,7 @@
dol_print_error($db, $result);
exit();
}
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/'));
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'([^\-])+');
$file = $fileparams['fullname'];
}

Expand Down
6 changes: 3 additions & 3 deletions htdocs/compta/facture.php
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
Expand Down Expand Up @@ -3821,7 +3821,7 @@

$ref = dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/'));
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/').'([^\-])+');
$file = $fileparams['fullname'];

// Define output language
Expand All @@ -3846,7 +3846,7 @@
dol_print_error($db, $result);
exit();
}
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/'));
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/').'([^\-])+');
$file = $fileparams['fullname'];
}

Expand Down
33 changes: 30 additions & 3 deletions htdocs/core/actions_extrafields.inc.php
@@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2011-2012 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2011-2015 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -148,7 +148,21 @@
}
}

$result=$extrafields->addExtraField($_POST['attrname'],$_POST['label'],$_POST['type'],$_POST['pos'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0),$default_value,$params,(GETPOST('alwayseditable')?1:0));
$result=$extrafields->addExtraField(
GETPOST('attrname'),
GETPOST('label'),
GETPOST('type'),
GETPOST('pos'),
$extrasize,
$elementtype,
(GETPOST('unique')?1:0),
(GETPOST('required')?1:0),
$default_value,
$params,
(GETPOST('alwayseditable')?1:0),
(GETPOST('perms')?GETPOST('perms'):''),
(GETPOST('list')?1:0)
);
if ($result > 0)
{
setEventMessage($langs->trans('SetupSaved'));
Expand Down Expand Up @@ -285,7 +299,20 @@
$params['options'][$key] = $value;
}
}
$result=$extrafields->update($_POST['attrname'],$_POST['label'],$_POST['type'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0),$pos,$params,(GETPOST('alwayseditable')?1:0));
$result=$extrafields->update(
GETPOST('attrname'),
GETPOST('label'),
GETPOST('type'),
$extrasize,
$elementtype,
(GETPOST('unique')?1:0),
(GETPOST('required')?1:0),
$pos,
$params,
(GETPOST('alwayseditable')?1:0),
(GETPOST('perms')?GETPOST('perms'):''),
(GETPOST('list')?1:0)
);
if ($result > 0)
{
setEventMessage($langs->trans('SetupSaved'));
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/class/CMailFile.class.php
Expand Up @@ -37,7 +37,7 @@
class CMailFile
{
var $subject; // Topic: Subject of email
var $addr_from; // From: Label and EMail of sender (must include '<>'). For example '<myemail@mydomain.com>' or 'John Doe <myemail@mydomain.com>' or '<myemail+trackingid@mydomain.com>')
var $addr_from; // From: Label and EMail of sender (must include '<>'). For example '<myemail@example.com>' or 'John Doe <myemail@example.com>' or '<myemail+trackingid@example.com>')
// Sender: Who send the email ("Sender" has sent emails on behalf of "From").
// Use it when the "From" is an email of a domain that is a SPF protected domain, and sending smtp server is not this domain. In such case, use for Sender an email of the protected domain.
// Return-Path: Email where to send bounds.
Expand Down Expand Up @@ -387,7 +387,7 @@ function sendfile()
// If Windows, sendmail_from must be defined
if (isset($_SERVER["WINDIR"]))
{
if (empty($this->addr_from)) $this->addr_from = 'robot@mydomain.com';
if (empty($this->addr_from)) $this->addr_from = 'robot@example.com';
@ini_set('sendmail_from',$this->getValidAddress($this->addr_from,2));
}

Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/conf.class.php
Expand Up @@ -404,7 +404,7 @@ function setValues($db)
$this->css = "/theme/".$this->theme."/style.css.php";

// conf->email_from = email pour envoi par dolibarr des mails automatiques
$this->email_from = "robot@domain.com";
$this->email_from = "robot@example.com";
if (! empty($this->global->MAIN_MAIL_EMAIL_FROM)) $this->email_from = $this->global->MAIN_MAIL_EMAIL_FROM;

// conf->notification->email_from = email pour envoi par Dolibarr des notifications
Expand Down
25 changes: 15 additions & 10 deletions htdocs/core/class/html.form.class.php
Expand Up @@ -4357,16 +4357,18 @@ static function selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_la
global $conf, $langs;

// Do we want a multiselect ?
$multiselect = 0;
if (preg_match('/^multi/',$htmlname)) $multiselect = 1;
//$jsbeautify = 0;
//if (preg_match('/^multi/',$htmlname)) $jsbeautify = 1;
$jsbeautify = 1;

if ($value_as_key) $array=array_combine($array, $array);

$out='';

// Add code for jquery to use multiselect
if ($addjscombo && empty($conf->dol_use_jmobile) && $multiselect)
if ($addjscombo && empty($conf->dol_use_jmobile) && $jsbeautify)
{
$minLengthToAutocomplete=0;
$tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT')?constant('REQUIRE_JQUERY_MULTISELECT'):'select2':$conf->global->MAIN_USE_JQUERY_MULTISELECT;
$out.='<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
<script type="text/javascript">
Expand Down Expand Up @@ -4964,7 +4966,7 @@ function select_export_model($selected='',$htmlname='exportmodelid',$type='',$us
* @param string $paramid Name of parameter to use to name the id into the URL link
* @param string $morehtml More html content to output just before the nav bar
* @param int $shownav Show Condition (navigation is shown if value is 1)
* @param string $fieldid Nom du champ en base a utiliser pour select next et previous
* @param string $fieldid Nom du champ en base a utiliser pour select next et previous (we make the select max and min on this field)
* @param string $fieldref Nom du champ objet ref (object->ref) a utiliser pour select next et previous
* @param string $morehtmlref Code html supplementaire a afficher apres ref
* @param string $moreparam More param to add in nav link url.
Expand All @@ -4990,7 +4992,7 @@ function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$f
//print "xx".$previous_ref."x".$next_ref;
//if ($previous_ref || $next_ref || $morehtml) {
//$ret.='<table class="nobordernopadding" width="100%"><tr class="nobordernopadding"><td class="nobordernopadding">';
$ret.='<div style="vertical-align: middle"><div class="inline-block floatleft refid">';
$ret.='<div style="vertical-align: middle"><div class="inline-block floatleft refid'.(($shownav && ($previous_ref || $next_ref))?' refidpadding':'').'">';
//}

$ret.=dol_htmlentities($object->$fieldref);
Expand Down Expand Up @@ -5120,19 +5122,22 @@ static function showphoto($modulepart, $object, $width=100, $height=0, $caneditf
}
else
{
$nophoto='/theme/common/nophoto.jpg';
$nophoto='/public/theme/common/nophoto.jpg';
if (in_array($modulepart,array('userphoto','contact'))) // For module thar are "physical" users
{
$nophoto='/theme/common/user_anonymous.png';
if ($object->gender == 'man') $nophoto='/theme/common/user_man.png';
if ($object->gender == 'woman') $nophoto='/theme/common/user_woman.png';
$nophoto='/public/theme/common/user_anonymous.png';
if ($object->gender == 'man') $nophoto='/public/theme/common/user_man.png';
if ($object->gender == 'woman') $nophoto='/public/theme/common/user_woman.png';
}

if (! empty($conf->gravatar->enabled) && $email)
{
/**
* @see https://gravatar.com/site/implement/images/php/
*/
global $dolibarr_main_url_root;
$ret.='<!-- Put link to gravatar -->';
$ret.='<img class="photo'.$modulepart.'" alt="Photo found on Gravatar" title="Photo Gravatar.com - email '.$email.'" border="0"'.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="http://www.gravatar.com/avatar/'.dol_hash($email,3).'?s='.$width.'&d='.urlencode(dol_buildpath($nophoto,2)).'">'; // gravatar need md5 hash
$ret.='<img class="photo'.$modulepart.'" alt="Gravatar avatar" title="'.$email.' Gravatar avatar" border="0"'.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="https://www.gravatar.com/avatar/'.dol_hash(strtolower(trim($email)),3).'?s='.$width.'&d='.urlencode(dol_buildpath($nophoto,2)).'">'; // gravatar need md5 hash
}
else
{
Expand Down
10 changes: 5 additions & 5 deletions htdocs/core/lib/admin.lib.php
Expand Up @@ -1084,18 +1084,18 @@ function form_constantes($tableau,$strictw3c=0)
if ($const == 'ADHERENT_MAILMAN_URL')
{
print '. '.$langs->trans("Example").': <a href="#" id="exampleclick1">'.img_down().'</a><br>';
//print 'http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&subscribees=%EMAIL%&send_welcome_msg_to_this_batch=1';
//print 'http://lists.exampe.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&subscribees=%EMAIL%&send_welcome_msg_to_this_batch=1';
print '<div id="example1" class="hidden">';
print 'http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members/add?subscribees_upload=%EMAIL%&amp;adminpw=%MAILMAN_ADMINPW%&amp;subscribe_or_invite=0&amp;send_welcome_msg_to_this_batch=0&amp;notification_to_list_owner=0';
print 'http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members/add?subscribees_upload=%EMAIL%&amp;adminpw=%MAILMAN_ADMINPW%&amp;subscribe_or_invite=0&amp;send_welcome_msg_to_this_batch=0&amp;notification_to_list_owner=0';
print '</div>';
}
if ($const == 'ADHERENT_MAILMAN_UNSUB_URL')
{
print '. '.$langs->trans("Example").': <a href="#" id="exampleclick2">'.img_down().'</a><br>';
print '<div id="example2" class="hidden">';
print 'http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members/remove?unsubscribees_upload=%EMAIL%&amp;adminpw=%MAILMAN_ADMINPW%&amp;send_unsub_ack_to_this_batch=0&amp;send_unsub_notifications_to_list_owner=0';
print 'http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members/remove?unsubscribees_upload=%EMAIL%&amp;adminpw=%MAILMAN_ADMINPW%&amp;send_unsub_ack_to_this_batch=0&amp;send_unsub_notifications_to_list_owner=0';
print '</div>';
//print 'http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members/remove?adminpw=%MAILMAN_ADMINPW%&unsubscribees=%EMAIL%';
//print 'http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members/remove?adminpw=%MAILMAN_ADMINPW%&unsubscribees=%EMAIL%';
}
if ($const == 'ADHERENT_MAILMAN_LISTS')
{
Expand All @@ -1106,7 +1106,7 @@ function form_constantes($tableau,$strictw3c=0)
print 'TYPE:Type1:mymailmanlist1,TYPE:Type2:mymailmanlist2<br>';
if ($conf->categorie->enabled) print 'CATEG:Categ1:mymailmanlist1,CATEG:Categ2:mymailmanlist2<br>';
print '</div>';
//print 'http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members/remove?adminpw=%MAILMAN_ADMINPW%&unsubscribees=%EMAIL%';
//print 'http://lists.example.com/cgi-bin/mailman/admin/%LISTE%/members/remove?adminpw=%MAILMAN_ADMINPW%&unsubscribees=%EMAIL%';
}

print "</td>\n";
Expand Down

0 comments on commit 592d124

Please sign in to comment.