diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index 6d1a5c57cf6..52de58b80b8 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -236,7 +236,7 @@ foreach($listofnotifiedevents as $notifiedevent) $s=''; // Do not use type="email" here, we must be able to enter a list of email with , separator. $arrayemail=explode(',', $value); $showwarning=0; - foreach($arrayemail as $key=>$valuedet) + foreach($arrayemail as $keydet => $valuedet) { $valuedet=trim($valuedet); if (! empty($valuedet) && ! isValidEmail($valuedet, 1)) $showwarning++; diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index 4d234e266e8..52ef490ceae 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -458,7 +458,7 @@ if ($mode == 'searchkey') //print 'param='.$param.' $_SERVER["PHP_SELF"]='.$_SERVER["PHP_SELF"].' num='.$num.' page='.$page.' nbtotalofrecords='.$nbtotalofrecords." sortfield=".$sortfield." sortorder=".$sortorder; $title = $langs->trans("TranslationKeySearch"); if ($nbtotalofrecords > 0) $title.=' ('.$nbtotalofrecords.' / '.$nbtotalofrecordswithoutfilters.' - '.$nbtotaloffiles.' '.$langs->trans("Files").')'; - print print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, '', '', $limit)."\n"; + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, '', '', $limit); print ''; print ''; @@ -466,7 +466,7 @@ if ($mode == 'searchkey') print '
| '; if (! empty($arrayfields['a.percent']['checked'])) { print ' | '; - print $formactions->form_select_status_action('formaction', $status, 1, 'status', 1, 2); + $formactions->form_select_status_action('formaction', $status, 1, 'status', 1, 2); print ajax_combobox('selectstatus'); print ' | '; } diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index ba0e24ddaab..5f951362be7 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -135,7 +135,8 @@ class box_graph_invoices_permonth extends ModeleBoxes $data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth); $filenamenb = $dir."/".$prefix."invoicesnbinyear-".$endyear.".png"; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$endyear.'.png'; + // default value for customer mode + $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$endyear.'.png'; if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessuppliernbinyear-'.$endyear.'.png'; $px1 = new DolGraph(); @@ -180,7 +181,8 @@ class box_graph_invoices_permonth extends ModeleBoxes $data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth); $filenamenb = $dir."/".$prefix."invoicesamountinyear-".$endyear.".png"; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountinyear-'.$endyear.'.png'; + // default value for customer mode + $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountinyear-'.$endyear.'.png'; if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessupplieramountinyear-'.$endyear.'.png'; $px2 = new DolGraph(); diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index 4393e9db790..6d65ea7f534 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -132,7 +132,8 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth); $filenamenb = $dir."/".$prefix."invoicessuppliernbinyear-".$year.".png"; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$year.'.png'; + // default value for customer mode + $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesnbinyear-'.$year.'.png'; if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessuppliernbinyear-'.$year.'.png'; $px1 = new DolGraph(); @@ -143,7 +144,8 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $px1->SetData($data1); unset($data1); - $i=$startyear;$legend=array(); + $i=$startyear; + $legend=array(); while ($i <= $endyear) { if ($startmonth != 1) @@ -177,7 +179,8 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth); $filenamenb = $dir."/".$prefix."invoicessupplieramountinyear-".$year.".png"; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountinyear-'.$year.'.png'; + // default value for customer mode + $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountinyear-'.$year.'.png'; if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessupplieramountinyear-'.$year.'.png'; $px2 = new DolGraph(); diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index 6e5bf253832..53952bb437b 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -135,7 +135,8 @@ class box_graph_orders_permonth extends ModeleBoxes $data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth); $filenamenb = $dir."/".$prefix."ordersnbinyear-".$endyear.".png"; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$endyear.'.png'; + // default value for customer mode + $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$endyear.'.png'; if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersnbinyear-'.$endyear.'.png'; $px1 = new DolGraph(); @@ -144,7 +145,8 @@ class box_graph_orders_permonth extends ModeleBoxes { $px1->SetData($data1); unset($data1); - $i=$startyear;$legend=array(); + $i=$startyear; + $legend=array(); while ($i <= $endyear) { if ($startmonth != 1) @@ -178,7 +180,8 @@ class box_graph_orders_permonth extends ModeleBoxes $data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth); $filenamenb = $dir."/".$prefix."ordersamountinyear-".$endyear.".png"; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$endyear.'.png'; + // default value for customer mode + $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$endyear.'.png'; if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersamountinyear-'.$endyear.'.png'; $px2 = new DolGraph(); diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index 443f374346d..911ac7a91b1 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -134,7 +134,8 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes $data1 = $stats->getNbByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth); $filenamenb = $dir."/".$prefix."orderssuppliernbinyear-".$endyear.".png"; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$endyear.'.png'; + // default value for customer mode + $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$endyear.'.png'; if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=orderssuppliernbinyear-'.$endyear.'.png'; $px1 = new DolGraph(); @@ -143,7 +144,8 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes { $px1->SetData($data1); unset($data1); - $i=$startyear;$legend=array(); + $i=$startyear; + $legend=array(); while ($i <= $endyear) { if ($startmonth != 1) @@ -177,7 +179,8 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes $data2 = $stats->getAmountByMonthWithPrevYear($endyear, $startyear, (GETPOST('action', 'aZ09')==$refreshaction?-1:(3600*24)), ($WIDTH<300?2:0), $startmonth); $filenamenb = $dir."/".$prefix."orderssupplieramountinyear-".$endyear.".png"; - if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$endyear.'.png'; + // default value for customer mode + $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$endyear.'.png'; if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=orderssupplieramountinyear-'.$endyear.'.png'; $px2 = new DolGraph(); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index afecdeeb234..f0c57cda966 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1991,56 +1991,48 @@ function dol_mktime($hour, $minute, $second, $month, $day, $year, $gm = false, $ if ($second< 0 || $second > 60) return ''; } - if (method_exists('DateTime', 'getTimestamp')) + if (empty($gm) || $gm === 'server') { - if (empty($gm) || $gm === 'server') - { - $default_timezone=@date_default_timezone_get(); // Example 'Europe/Berlin' + $default_timezone=@date_default_timezone_get(); // Example 'Europe/Berlin' + $localtz = new DateTimeZone($default_timezone); + } + elseif ($gm === 'user') + { + // We use dol_tz_string first because it is more reliable. + $default_timezone=(empty($_SESSION["dol_tz_string"])?@date_default_timezone_get():$_SESSION["dol_tz_string"]); // Example 'Europe/Berlin' + try { $localtz = new DateTimeZone($default_timezone); } - elseif ($gm === 'user') + catch(Exception $e) { - // We use dol_tz_string first because it is more reliable. - $default_timezone=(empty($_SESSION["dol_tz_string"])?@date_default_timezone_get():$_SESSION["dol_tz_string"]); // Example 'Europe/Berlin' - try { - $localtz = new DateTimeZone($default_timezone); - } - catch(Exception $e) - { - dol_syslog("Warning dol_tz_string contains an invalid value ".$_SESSION["dol_tz_string"], LOG_WARNING); - $default_timezone=@date_default_timezone_get(); - } + dol_syslog("Warning dol_tz_string contains an invalid value ".$_SESSION["dol_tz_string"], LOG_WARNING); + $default_timezone=@date_default_timezone_get(); } - elseif (strrpos($gm, "tz,") !== false) - { - $timezone=str_replace("tz,", "", $gm); // Example 'tz,Europe/Berlin' - try - { - $localtz = new DateTimeZone($timezone); - } - catch(Exception $e) - { - dol_syslog("Warning passed timezone contains an invalid value ".$timezone, LOG_WARNING); - } - } - - if (empty($localtz)) { - $localtz = new DateTimeZone('UTC'); - } - //var_dump($localtz); - //var_dump($year.'-'.$month.'-'.$day.'-'.$hour.'-'.$minute); - $dt = new DateTime(null, $localtz); - $dt->setDate((int) $year, (int) $month, (int) $day); - $dt->setTime((int) $hour, (int) $minute, (int) $second); - $date=$dt->getTimestamp(); // should include daylight saving time - //var_dump($date); - return $date; } - else + elseif (strrpos($gm, "tz,") !== false) { - dol_print_error('', 'PHP version must be 5.4+'); - return ''; + $timezone=str_replace("tz,", "", $gm); // Example 'tz,Europe/Berlin' + try + { + $localtz = new DateTimeZone($timezone); + } + catch(Exception $e) + { + dol_syslog("Warning passed timezone contains an invalid value ".$timezone, LOG_WARNING); + } } + + if (empty($localtz)) { + $localtz = new DateTimeZone('UTC'); + } + //var_dump($localtz); + //var_dump($year.'-'.$month.'-'.$day.'-'.$hour.'-'.$minute); + $dt = new DateTime(null, $localtz); + $dt->setDate((int) $year, (int) $month, (int) $day); + $dt->setTime((int) $hour, (int) $minute, (int) $second); + $date=$dt->getTimestamp(); // should include daylight saving time + //var_dump($date); + return $date; } diff --git a/htdocs/core/modules/mailings/advthirdparties.modules.php b/htdocs/core/modules/mailings/advthirdparties.modules.php index 581fca03f8b..558744d87e8 100644 --- a/htdocs/core/modules/mailings/advthirdparties.modules.php +++ b/htdocs/core/modules/mailings/advthirdparties.modules.php @@ -31,6 +31,10 @@ class mailing_advthirdparties extends MailingTargets public $require_admin=0; public $require_module=array("none"); // This module should not be displayed as Selector in mailling + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto='company'; /** diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php index aa951426a12..b3687e4f603 100644 --- a/htdocs/core/modules/mailings/contacts1.modules.php +++ b/htdocs/core/modules/mailings/contacts1.modules.php @@ -37,6 +37,10 @@ class mailing_contacts1 extends MailingTargets public $desc='Contacts of thirdparties (prospects, customers, suppliers...)'; public $require_module=array("societe"); // Module mailing actif si modules require_module actifs public $require_admin=0; // Module mailing actif pour user admin ou non + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto='contact'; /** diff --git a/htdocs/core/modules/mailings/example.modules.php b/htdocs/core/modules/mailings/example.modules.php index a96457c2625..88af802ecfe 100644 --- a/htdocs/core/modules/mailings/example.modules.php +++ b/htdocs/core/modules/mailings/example.modules.php @@ -36,6 +36,10 @@ class mailing_example extends MailingTargets public $tooltip='MyTooltipLangKey'; public $require_module=array(); + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto=''; /** diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php index 43d6ae08213..ae0dff89b76 100644 --- a/htdocs/core/modules/mailings/fraise.modules.php +++ b/htdocs/core/modules/mailings/fraise.modules.php @@ -40,6 +40,10 @@ class mailing_fraise extends MailingTargets public $require_admin=0; public $require_module=array('adherent'); + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto='user'; /** diff --git a/htdocs/core/modules/mailings/pomme.modules.php b/htdocs/core/modules/mailings/pomme.modules.php index 970339e4dbb..8d55bd86adc 100644 --- a/htdocs/core/modules/mailings/pomme.modules.php +++ b/htdocs/core/modules/mailings/pomme.modules.php @@ -35,6 +35,10 @@ class mailing_pomme extends MailingTargets public $desc='Dolibarr users with emails'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e public $require_module=array(); // Module mailing actif si modules require_module actifs public $require_admin=1; // Module mailing actif pour user admin ou non + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto='user'; /** diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index 68cb49e10d9..e0c148e4f9f 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -30,6 +30,10 @@ class mailing_thirdparties extends MailingTargets public $require_admin=0; public $require_module=array("societe"); // This module allows to select by categories must be also enabled if category module is not activated + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto='company'; /** diff --git a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php index 75dc4b9499b..7e3b468fc6d 100644 --- a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php +++ b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php @@ -28,6 +28,10 @@ class mailing_thirdparties_services_expired extends MailingTargets public $require_admin=0; public $require_module=array('contrat'); + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto='company'; /** diff --git a/htdocs/core/modules/mailings/xinputfile.modules.php b/htdocs/core/modules/mailings/xinputfile.modules.php index 4987c9ebc17..a69800230b1 100644 --- a/htdocs/core/modules/mailings/xinputfile.modules.php +++ b/htdocs/core/modules/mailings/xinputfile.modules.php @@ -35,6 +35,10 @@ class mailing_xinputfile extends MailingTargets public $desc='EMails from a file'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e public $require_module=array(); // Module mailing actif si modules require_module actifs public $require_admin=0; // Module mailing actif pour user admin ou non + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto='generic'; public $tooltip='UseFormatFileEmailToTarget'; diff --git a/htdocs/core/modules/mailings/xinputuser.modules.php b/htdocs/core/modules/mailings/xinputuser.modules.php index 8d4ecf0b72e..7014f5f894d 100644 --- a/htdocs/core/modules/mailings/xinputuser.modules.php +++ b/htdocs/core/modules/mailings/xinputuser.modules.php @@ -35,6 +35,10 @@ class mailing_xinputuser extends MailingTargets public $desc='EMails input by user'; // Libelle utilise si aucune traduction pour MailingModuleDescXXX ou XXX=name trouv�e public $require_module=array(); // Module mailing actif si modules require_module actifs public $require_admin=0; // Module mailing actif pour user admin ou non + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto='generic'; public $tooltip='UseFormatInputEmailToTarget'; diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index eeef6ab34e5..1477f4d65f3 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.php @@ -37,6 +37,10 @@ class printing_printgcp extends PrintingDriver { public $name = 'printgcp'; public $desc = 'PrintGCPDesc'; + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto = 'printer'; public $active = 'PRINTING_PRINTGCP'; public $conf = array(); diff --git a/htdocs/core/modules/printing/printipp.modules.php b/htdocs/core/modules/printing/printipp.modules.php index 1d76fe6f574..37659cec199 100644 --- a/htdocs/core/modules/printing/printipp.modules.php +++ b/htdocs/core/modules/printing/printipp.modules.php @@ -32,6 +32,10 @@ class printing_printipp extends PrintingDriver { public $name = 'printipp'; public $desc = 'PrintIPPDesc'; + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ public $picto = 'printer'; public $active = 'PRINTING_PRINTIPP'; public $conf = array(); diff --git a/htdocs/don/card.php b/htdocs/don/card.php index b804f3c7a46..bc3d8302afa 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -564,7 +564,7 @@ if (! empty($id) && $action == 'edit') } // Payment mode print "
| ".$langs->trans("PaymentMode")." | \n"; - if ($object->modepaymentid) $selected = $object->modepaymentid; + if ($object->mode_reglement_id) $selected = $object->mode_reglement_id; else $selected = ''; $form->select_types_paiements($selected, 'modepayment', 'CRDT', 0, 1); print " |
| ".$langs->trans("PaymentMode")." | "; - $form->form_modes_reglement(null, $object->modepaymentid, 'none'); + $form->form_modes_reglement(null, $object->mode_reglement_id, 'none'); print " |