From 23974daca47aee42dc14cf45e518b58fcaa6a3ee Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Fri, 1 Aug 2014 09:57:08 +0200 Subject: [PATCH 1/5] Fix : shipping list SQL request was not filtering on shipping element --- htdocs/expedition/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/index.php b/htdocs/expedition/index.php index 33082aa9193..b567773bc69 100644 --- a/htdocs/expedition/index.php +++ b/htdocs/expedition/index.php @@ -67,7 +67,7 @@ $sql = "SELECT e.rowid, e.ref"; $sql.= ", s.nom, s.rowid as socid"; $sql.= ", c.ref as commande_ref, c.rowid as commande_id"; $sql.= " FROM ".MAIN_DB_PREFIX."expedition as e"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target AND el.targettype = 'shipping'"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc"; if (!$user->rights->societe->client->voir && !$socid) From 139dfa5b80ff82ef5acb128e303b298cef3caf22 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 1 Aug 2014 15:05:43 +0200 Subject: [PATCH 2/5] Fix : Fusion PDF button on unpaid invoice is no more displayed --- ChangeLog | 1 + htdocs/core/class/html.formfile.class.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c042efef003..e47d53211c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.5.5 compared to 3.5.4 ***** Fix: [ bug #1523 ] suite bug #1334 : filtre et ordre de tri conjoints ne s'appliquent pas. +Fix: Fusion PDF button on unpaid invoice is no more displayed ***** ChangeLog for 3.5.4 compared to 3.5.3 ***** Fix: Hide title of event when agenda module disabled. diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index d2cba220bcf..24365c6199a 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -509,7 +509,7 @@ class FormFile $genbutton.= ' '.img_warning($langs->transnoentitiesnoconv("WarningNoDocumentModelActivated")); } if (! $allowgenifempty && ! is_array($modellist) && empty($modellist) && empty($conf->dol_no_mouse_hover) && $modulepart != 'unpaid') $genbutton=''; - if (empty($modellist) && ! $showempty) $genbutton=''; + if (empty($modellist) && ! $showempty && $modulepart != 'unpaid') $genbutton=''; $out.= $genbutton; $out.= ''; From 44f06bef2272fa3ff219a2210b27fda6f9dea806 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 1 Aug 2014 15:21:29 +0200 Subject: [PATCH 3/5] Unpaid invoice launch fusion PDF action even if it is only search (with enter keyboard input instead of lens click) --- ChangeLog | 1 + htdocs/compta/facture/impayees.php | 3 ++- htdocs/core/class/html.formfile.class.php | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index e47d53211c7..0f260470db4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.5.5 compared to 3.5.4 ***** Fix: [ bug #1523 ] suite bug #1334 : filtre et ordre de tri conjoints ne s'appliquent pas. Fix: Fusion PDF button on unpaid invoice is no more displayed +Fix: Unpaid invoice launch fusion PDF action even if it is only search (with enter keyboard input instead of lens click) ***** ChangeLog for 3.5.4 compared to 3.5.3 ***** Fix: Hide title of event when agenda module disabled. diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php index fe16e03b6c6..57fc4e9b529 100644 --- a/htdocs/compta/facture/impayees.php +++ b/htdocs/compta/facture/impayees.php @@ -37,6 +37,7 @@ $langs->load("bills"); $id = (GETPOST('facid','int') ? GETPOST('facid','int') : GETPOST('id','int')); $action = GETPOST('action','alpha'); $option = GETPOST('option'); +$builddoc_generatebutton=GETPOST('builddoc_generatebutton'); // Security check if ($user->societe_id) $socid=$user->societe_id; @@ -50,7 +51,7 @@ if (! $user->rights->societe->client->voir || $socid) $diroutputpdf.='/private/' * Action */ -if ($action == "builddoc" && $user->rights->facture->lire && ! GETPOST('button_search')) +if ($action == "builddoc" && $user->rights->facture->lire && ! GETPOST('button_search') && !empty($builddoc_generatebutton)) { if (is_array($_POST['toGenerate'])) { diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 24365c6199a..88a931a3d8a 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -499,7 +499,7 @@ class FormFile // Button $addcolumforpicto=($delallowed || $printer || $morepicto); $out.= ''; - $genbutton = ' Date: Mon, 4 Aug 2014 10:44:19 +0200 Subject: [PATCH 4/5] Fix: Field must be invisible --- htdocs/user/fiche.php | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index d9ff9c7c71d..108619f66ae 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -1879,19 +1879,23 @@ else print "\n"; // Accountancy code - print ""; - print ''.$langs->trans("AccountancyCode").''; - print ''; - if ($caneditfield) + if (! empty($conf->global->USER_ENABLE_ACCOUNTANCY_CODE)) // For the moment field is not used so must not appeared. { - print ''; + print ""; + print ''.$langs->trans("AccountancyCode").''; + print ''; + if ($caneditfield) + { + print ''; + } + else + { + print ''; + print $object->accountancy_code; + } + print ''; + print ""; } - else - { - print ''; - print $object->accountancy_code; - } - print ''; // Status print ''.$langs->trans("Status").''; From 6a61587085f4fae34d9ce8bd1ea8b125486087b9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Jul 2014 13:07:53 +0200 Subject: [PATCH 5/5] Try a fix when timezone string is not standard Conflicts: htdocs/includes/adodbtime/adodb-time.inc.php --- htdocs/core/js/dst.js | 21 +++++++++++---------- htdocs/core/lib/functions.lib.php | 22 +++++++++++++++------- htdocs/main.inc.php | 5 ++++- 3 files changed, 30 insertions(+), 18 deletions(-) diff --git a/htdocs/core/js/dst.js b/htdocs/core/js/dst.js index 5335906dc77..c22f83aec21 100644 --- a/htdocs/core/js/dst.js +++ b/htdocs/core/js/dst.js @@ -1,4 +1,4 @@ -// Copyright (C) 2011-2012 Laurent Destailleur +// Copyright (C) 2011-2014 Laurent Destailleur // Copyright (C) 2011-2012 Regis Houssin // // This program is free software; you can redistribute it and/or modify @@ -18,7 +18,8 @@ // // \file htdocs/core/js/dst.js -// \brief File that include javascript functions for detect user tz, dst_observed, dst_first, dst_second +// \brief File that include javascript functions for detect user tz, tz_string, dst_observed, dst_first, dst_second, +// screenwidth and screenheight // $(document).ready(function () { @@ -39,22 +40,22 @@ $(document).ready(function () { dst = "1"; // daylight savings time is observed } var now=new Date(); - var tz=now.toTimeString().match(/\(.*\)/); + var tz=now.toTimeString().match(/\(.*\)/); // now.toTimeString may return "12:39:59 GMT+0200 (CEST)" //alert('date=' + now + ' string=' + now.toTimeString()); var dst_first=DisplayDstSwitchDates('first'); var dst_second=DisplayDstSwitchDates('second'); //alert(dst); - $('#tz').val(std_time_offset); // returns TZ - // tz is null with IE + $('#tz').val(std_time_offset); // returns TZ + // tz is null with IE if (tz != null) { $('#tz_string').val(tz[0].replace('(','').replace(')','')); // returns TZ string } - $('#dst_observed').val(dst); // returns if DST is observed on summer - $('#dst_first').val(dst_first); // returns DST first switch in year - $('#dst_second').val(dst_second); // returns DST second switch in year + $('#dst_observed').val(dst); // returns if DST is observed on summer + $('#dst_first').val(dst_first); // returns DST first switch in year + $('#dst_second').val(dst_second); // returns DST second switch in year // Detect and save screen resolution - $('#screenwidth').val($(window).width()); // returns width of browser viewport - $('#screenheight').val($(window).height()); // returns width of browser viewport + $('#screenwidth').val($(window).width()); // returns width of browser viewport + $('#screenheight').val($(window).height()); // returns width of browser viewport }); function DisplayDstSwitchDates(firstsecond) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index db5de85015d..f6a901f3d3d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -871,7 +871,7 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e if (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i',$time,$reg) || preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i',$time,$reg)) { - // This part of code should not be used. + // This part of code should not be used. TODO Remove this. dol_syslog("Functions.lib::dol_print_date function call with deprecated value of time in page ".$_SERVER["PHP_SELF"], LOG_WARNING); // Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' or 'YYYYMMDDHHMMSS' $syear = (! empty($reg[1]) ? $reg[1] : ''); @@ -889,7 +889,7 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e // Date is a timestamps if ($time < 100000000000) // Protection against bad date values { - $ret=adodb_strftime($format,$time+$offsettz+$offsetdst,$to_gmt); + $ret=adodb_strftime($format,$time+$offsettz+$offsetdst,$to_gmt); // TODO Remove this } else $ret='Bad value '.$time.' for date'; } @@ -897,7 +897,7 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e if (preg_match('/__b__/i',$format)) { // Here ret is string in PHP setup language (strftime was used). Now we convert to $outputlangs. - $month=adodb_strftime('%m',$time+$offsettz+$offsetdst); + $month=adodb_strftime('%m',$time+$offsettz+$offsetdst); // TODO Remove this if ($encodetooutput) { $monthtext=$outputlangs->transnoentities('Month'.$month); @@ -916,7 +916,7 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e } if (preg_match('/__a__/i',$format)) { - $w=adodb_strftime('%w',$time+$offsettz+$offsetdst); + $w=adodb_strftime('%w',$time+$offsettz+$offsetdst); // TODO Remove this $dayweek=$outputlangs->transnoentitiesnoconv('Day'.$w); $ret=str_replace('__A__',$dayweek,$ret); $ret=str_replace('__a__',dol_substr($dayweek,0,3),$ret); @@ -1029,8 +1029,16 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1) } else if ($gm === 'user') { - $default_timezone=(empty($_SESSION["dol_tz_string"])?'UTC':$_SESSION["dol_tz_string"]); - $localtz = new DateTimeZone($default_timezone); + // We use dol_tz_string first because it contains dst. + $default_timezone=(empty($_SESSION["dol_tz_string"])?@date_default_timezone_get():$_SESSION["dol_tz_string"]); + 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(); + } } else $localtz = new DateTimeZone('UTC'); $dt = new DateTime(null,$localtz); @@ -4533,4 +4541,4 @@ function natural_search($fields, $value) return " AND " . ($end > 1? '(' : '') . $res; } -?> \ No newline at end of file +?> diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 45ddc3d8734..ba12febd3d4 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -446,6 +446,9 @@ if (! defined('NOLOGIN')) $dol_authmode=$conf->authmode; // This properties is defined only when logged, to say what mode was successfully used $dol_tz=$_POST["tz"]; $dol_tz_string=$_POST["tz_string"]; + $dol_tz_string=preg_replace('\s*\(.+\)$','',$dol_tz_string); + $dol_tz_string=preg_replace(',','/',$dol_tz_string); + $dol_tz_string=preg_replace('\s','_',$dol_tz_string); $dol_dst=0; if (isset($_POST["dst_first"]) && isset($_POST["dst_second"])) { @@ -1880,4 +1883,4 @@ if (! function_exists("llxFooter")) } } -?> \ No newline at end of file +?>