From 742d0e37eeadf40c7b01475f5a90b2986777b2d0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 5 Oct 2014 12:54:51 +0200 Subject: [PATCH 01/10] Fix: Bad month return by function --- htdocs/core/lib/date.lib.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 78551dac105..39d3e6ffa7b 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -518,8 +518,8 @@ function dol_get_last_day($year,$month=12,$gm=false) * @param int $day Day * @param int $month Month * @param int $year Year - * @param int $gm False = Return date to compare with server TZ, True to compare with GM date. - * @return array year,month, week,first_day,prev_year,prev_month,prev_day + * @param int $gm False or 0 or 'server' = Return date to compare with server TZ, True or 1 to compare with GM date. + * @return array year,month,week,first_day,prev_year,prev_month,prev_day */ function dol_get_first_day_week($day,$month,$year,$gm=false) { @@ -542,7 +542,7 @@ function dol_get_first_day_week($day,$month,$year,$gm=false) $tmpday = date($tmparray[0])-$seconds; $tmpday = date("d",$tmpday); - //Check first day of week is form this month or not + //Check first day of week is in same month than current day or not if ($tmpday>$day) { $prev_month = $month-1; @@ -559,15 +559,17 @@ function dol_get_first_day_week($day,$month,$year,$gm=false) $prev_month = $month; $prev_year = $year; } + $tmpmonth = $prev_month; + $tmpyear = $prev_year; - //Get first day of next week + //Get first day of next week $tmptime=dol_mktime(12,0,0,$month,$tmpday,$year,1,0); $tmptime-=24*60*60*7; $tmparray=dol_getdate($tmptime,true); $prev_day = $tmparray['mday']; - //Check first day of week is form this month or not - if ($prev_day>$tmpday) + //Check prev day of week is in same month than first day or not + if ($prev_day > $tmpday) { $prev_month = $month-1; $prev_year = $year; @@ -579,9 +581,9 @@ function dol_get_first_day_week($day,$month,$year,$gm=false) } } - $week = date("W",dol_mktime(0,0,0,$month,$tmpday,$year,$gm)); + $week = date("W",dol_mktime(0,0,0,$tmpmonth,$tmpday,$tmpyear,$gm)); - return array('year' => $year, 'month' => $month, 'week' => $week, 'first_day' => $tmpday, 'prev_year' => $prev_year, 'prev_month' => $prev_month, 'prev_day' => $prev_day); + return array('year' => $year, 'month' => $month, 'week' => $week, 'first_day' => $tmpday, 'first_month' => $tmpmonth, 'first_year' => $tmpyear, 'prev_year' => $prev_year, 'prev_month' => $prev_month, 'prev_day' => $prev_day); } /** From c73f4a14ee9d62e8f6a9d4ab8ef502932ae4f36d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 5 Oct 2014 16:17:09 +0200 Subject: [PATCH 02/10] Fix: Bad days returned by function --- htdocs/comm/action/index.php | 51 ++++++++++++++---------------------- 1 file changed, 20 insertions(+), 31 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index efe47defd92..e518b05ded6 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -184,18 +184,19 @@ if ($action=='show_week') $prev_month = $prev['prev_month']; $prev_day = $prev['prev_day']; $first_day = $prev['first_day']; - + $first_month= $prev['first_month']; + $first_year = $prev['first_year']; $week = $prev['week']; $day = (int) $day; - $next = dol_get_next_week($day, $week, $month, $year); + $next = dol_get_next_week($first_day, $week, $first_month, $first_year); $next_year = $next['year']; $next_month = $next['month']; $next_day = $next['day']; // Define firstdaytoshow and lastdaytoshow - $firstdaytoshow=dol_mktime(0,0,0,$prev_month,$first_day,$prev_year); - $lastdaytoshow=dol_mktime(0,0,0,$next_month,$next_day,$next_year); + $firstdaytoshow=dol_mktime(0,0,0,$first_month,$first_day,$first_year); + $lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 7, 'd'); $max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year)); @@ -870,39 +871,27 @@ elseif ($action == 'show_week') // View by week } echo " \n"; - // In loops, tmpday contains day nb in current month (can be zero or negative for days of previous month) - //var_dump($eventarray); - //print $tmpday; - echo " \n"; for($iter_day = 0; $iter_day < 7; $iter_day++) { - if(($tmpday <= $max_day_in_month)) - { - // Show days of the current week - $curtime = dol_mktime(0, 0, 0, $month, $tmpday, $year); + // Show days of the current week + $curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd'); + $tmparray = dol_getdate($curtime,'fast'); + $tmpday = $tmparray['mday']; + $tmpmonth = $tmparray['mon']; + $tmpyear = $tmparray['year']; - $style='cal_current_month'; - if ($iter_day == 6) $style.=' cal_other_month_right'; - $today=0; - $todayarray=dol_getdate($now,'fast'); - if ($todayarray['mday']==$tmpday && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1; - if ($today) $style='cal_today'; + $style='cal_current_month'; + if ($iter_day == 6) $style.=' cal_other_month_right'; + $today=0; + $todayarray=dol_getdate($now,'fast'); + if ($todayarray['mday']==$tmpday && $todayarray['mon']==$tmpmonth && $todayarray['year']==$tmpyear) $today=1; + if ($today) $style='cal_today'; - echo ' '; - show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300); - echo " \n"; - } - else - { - $style='cal_current_month'; - if ($iter_day == 6) $style.=' cal_other_month_right'; - echo ' '; - show_day_events($db, $tmpday - $max_day_in_month, $next_month, $next_year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300); - echo "\n"; - } - $tmpday++; + echo ' '; + show_day_events($db, $tmpday, $tmpmonth, $tmpyear, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300); + echo " \n"; } echo " \n"; From 692881bf5998e06b6fd9adf1ecc830c39b1220c7 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 6 Oct 2014 09:06:25 +0200 Subject: [PATCH 03/10] Fix: missing $ismultientitymanaged --- htdocs/contrat/class/contrat.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 073ef7bd0f5..6cf04c10522 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1,12 +1,12 @@ * Copyright (C) 2004-2012 Destailleur Laurent - * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2008 Raphael Bertrand * Copyright (C) 2010-2013 Juanjo Menent - * Copyright (C) 2013 Christophe Battarel - * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013 Christophe Battarel + * Copyright (C) 2013 Florian Henry * * 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 @@ -41,6 +41,7 @@ class Contrat extends CommonObject public $table_element='contrat'; public $table_element_line='contratdet'; public $fk_element='fk_contrat'; + protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe var $id; var $ref; From 48072c58d796789edbdfca6091c00d0eb7e8b913 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Mon, 6 Oct 2014 10:05:27 +0200 Subject: [PATCH 04/10] Fix bug 1588 : relative discount not working anymore --- htdocs/core/tpl/objectline_create.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 68613492df8..a51a6505416 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -203,7 +203,7 @@ else { "> - remise_client); ?>" name="remise_percent">% + remise_percent); ?>" name="remise_percent">% Date: Mon, 6 Oct 2014 13:28:07 +0200 Subject: [PATCH 05/10] Missing reprogramming task into GUI for cron module. Without this, a new task is never executed (because without datenextrun defined) --- htdocs/cron/card.php | 15 ++++++++++++--- htdocs/cron/list.php | 15 +++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index 4857523aaf5..dd30e67afab 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -95,9 +95,18 @@ if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->ex } else { - if ($object->lastresult > 0) setEventMessage($langs->trans("JobFinished"),'warnings'); - else setEventMessage($langs->trans("JobFinished"),'mesgs'); - $action=''; + $res = $object->reprogram_jobs($user->login); + if ($res > 0) + { + if ($object->lastresult > 0) setEventMessage($langs->trans("JobFinished"),'warnings'); + else setEventMessage($langs->trans("JobFinished"),'mesgs'); + $action=''; + } + else + { + setEventMessage($object->error,'errors'); + $action=''; + } } } diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 19a0d5cc3b1..28f16c1ad55 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -100,6 +100,21 @@ if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->ex if ($result < 0) { setEventMessage($object->error,'errors'); } + else + { + $res = $object->reprogram_jobs($user->login); + if ($res > 0) + { + if ($object->lastresult > 0) setEventMessage($langs->trans("JobFinished"),'warnings'); + else setEventMessage($langs->trans("JobFinished"),'mesgs'); + $action=''; + } + else + { + setEventMessage($object->error,'errors'); + $action=''; + } + } header("Location: ".DOL_URL_ROOT.'/cron/list.php?status=-1'); // Make a call to avoid to run twice job when using back exit; From 4fd67d725ab2d634dc0a1f66f3a508a158eabbbf Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Mon, 6 Oct 2014 10:05:27 +0200 Subject: [PATCH 06/10] Fix bug 1588 : relative discount not working anymore --- htdocs/core/tpl/objectline_create.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 68613492df8..a51a6505416 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -203,7 +203,7 @@ else { "> - remise_client); ?>" name="remise_percent">% + remise_percent); ?>" name="remise_percent">% Date: Sat, 11 Oct 2014 23:55:10 +0200 Subject: [PATCH 07/10] Fix: ErrorBadValueForParamNotAString error message in price customer multiprice --- htdocs/product/price.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index b208cba1c7e..856a68face6 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -365,10 +365,14 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) { // Prix mini print '' . $langs->trans("MinPrice") . ' ' . $i . ''; - if ($object->multiprices_base_type ["$i"] == 'TTC') { - print price($object->multiprices_min_ttc ["$i"]) . ' ' . $langs->trans($object->multiprices_base_type ["$i"]); - } else { - print price($object->multiprices_min ["$i"]) . ' ' . $langs->trans($object->multiprices_base_type ["$i"]); + if (empty($object->multiprices_base_type["$i"])) $object->multiprices_base_type["$i"]="HT"; + if ($object->multiprices_base_type["$i"] == 'TTC') + { + print price($object->multiprices_min_ttc["$i"]) . ' ' . $langs->trans($object->multiprices_base_type["$i"]); + } + else + { + print price($object->multiprices_min["$i"]) . ' ' . $langs->trans($object->multiprices_base_type["$i"]); } print ''; From c184253951cfa64952d5ee6399472611255ecf22 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Oct 2014 23:56:45 +0200 Subject: [PATCH 08/10] Update doc --- ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index 294fc64ff5a..90067f92312 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,11 @@ English Dolibarr ChangeLog -------------------------------------------------------------- + +***** ChangeLog for 3.6.2 compared to 3.6.1 ***** +- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice + + ***** ChangeLog for 3.6.1 compared to 3.6.* ***** For users: - Fix: Can upload files on services. From ac2ff5c6044ad1524579e986c8129e256f693385 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 12 Oct 2014 01:40:18 +0200 Subject: [PATCH 09/10] Update logs --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 90067f92312..a4e7edc94dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,7 +5,7 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice - +- Fix: bug 1588 : relative discount ***** ChangeLog for 3.6.1 compared to 3.6.* ***** For users: From c30f13a03d9f9bba6f390b8ab5bf583629379e89 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 12 Oct 2014 02:07:50 +0200 Subject: [PATCH 10/10] Fix: label of input method not translated. --- ChangeLog | 1 + htdocs/fourn/class/fournisseur.commande.class.php | 15 +++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index a4e7edc94dd..12694302fda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice - Fix: bug 1588 : relative discount +- Fix: label of input method not tranlated. ***** ChangeLog for 3.6.1 compared to 3.6.* ***** For users: diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 155c8111f81..3aa9d77f5de 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2016,7 +2016,8 @@ class CommandeFournisseur extends CommonOrder } /** - * Returns the translated input method + * Returns the translated input method of object (defined if $this->methode_commande_id > 0). + * This function make a sql request to get translation. No cache yet, try to not use it inside a loop. * * @return string */ @@ -2026,21 +2027,19 @@ class CommandeFournisseur extends CommonOrder if ($this->methode_commande_id > 0) { - $sql = "SELECT rowid, code, libelle"; + $sql = "SELECT rowid, code, libelle as label"; $sql.= " FROM ".MAIN_DB_PREFIX.'c_input_method'; $sql.= " WHERE active=1 AND rowid = ".$db->escape($this->methode_commande_id); $query = $db->query($sql); - if ($query && $db->num_rows($query)) { - $result = $db->fetch_object($query); + $obj = $db->fetch_object($query); - $string = $langs->trans($result->code); - - if ($string == $result->code) + $string = $langs->trans($obj->code); + if ($string == $obj->code) { - $string = $obj->libelle != '-' ? $obj->libelle : ''; + $string = $obj->label != '-' ? $obj->label : ''; } return $string;