From 2ba7c075742c299131ba1e86a73dea6577125cc5 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio Date: Mon, 9 Jul 2018 17:34:31 +0200 Subject: [PATCH 01/13] FIX: propal: correctly preset project when creating with origin/originid --- htdocs/comm/propal/card.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index e0a4c19c9cb..9a1c2dcb54f 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -74,6 +74,7 @@ $originid = GETPOST('originid', 'int'); $confirm = GETPOST('confirm', 'alpha'); $lineid = GETPOST('lineid', 'int'); $contactid = GETPOST('contactid','int'); +$projectid = GETPOST('projectid','int'); // PDF $hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); @@ -1310,7 +1311,7 @@ if ($action == 'create') } $objectsrc->fetch_thirdparty(); - $projectid = (! empty($objectsrc->fk_project) ? $objectsrc->fk_project : ''); + $projectid = (! empty($objectsrc->fk_project) ? $objectsrc->fk_project : 0); $ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : ''); $ref_int = (! empty($objectsrc->ref_int) ? $objectsrc->ref_int : ''); @@ -1478,9 +1479,6 @@ if ($action == 'create') // Project if (! empty($conf->projet->enabled) && $socid > 0) { - $projectid = GETPOST('projectid')?GETPOST('projectid'):0; - if ($origin == 'project') $projectid = ($originid ? $originid : 0); - $langs->load("projects"); print ''; print '' . $langs->trans("Project") . ''; From 103c7e6d066ad7a0754e6db85a93e8ac4b7252e6 Mon Sep 17 00:00:00 2001 From: gauthier Date: Wed, 11 Jul 2018 09:51:36 +0200 Subject: [PATCH 02/13] FIX : page must always be 0 when we search (to avoid case : when we're on page 3 and we're looking for a precise thirdparty, we stay on page 3 and nothing's displaied) --- htdocs/comm/propal/list.php | 4 +++- htdocs/commande/list.php | 4 +++- htdocs/compta/facture/list.php | 4 +++- htdocs/fourn/commande/list.php | 4 +++- htdocs/fourn/facture/list.php | 4 +++- htdocs/societe/list.php | 4 +++- htdocs/supplier_proposal/list.php | 4 +++- 7 files changed, 21 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 72491e90e3e..fe35c2bc4e8 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -83,12 +83,14 @@ $mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg")); $search_day=GETPOST("search_day","int"); $search_month=GETPOST("search_month","int"); $search_year=GETPOST("search_year","int"); +$search_btn=GETPOST('button_search','alpha'); +$search_remove_btn=GETPOST('button_removefilter','alpha'); $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); -if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn)) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 6284e53aa5c..6e57b55b2c7 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -74,6 +74,8 @@ $search_total_ht=GETPOST('search_total_ht','alpha'); $optioncss = GETPOST('optioncss','alpha'); $billed = GETPOST('billed','int'); $viewstatut=GETPOST('viewstatut'); +$search_btn=GETPOST('button_search','alpha'); +$search_remove_btn=GETPOST('button_removefilter','alpha'); // Security check $id = (GETPOST('orderid')?GETPOST('orderid','int'):GETPOST('id','int')); @@ -86,7 +88,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); -if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn)) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 994f1d93569..1e857abfa7e 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -93,6 +93,8 @@ $year = GETPOST('year','int'); $day_lim = GETPOST('day_lim','int'); $month_lim = GETPOST('month_lim','int'); $year_lim = GETPOST('year_lim','int'); +$search_btn=GETPOST('button_search','alpha'); +$search_remove_btn=GETPOST('button_removefilter','alpha'); $option = GETPOST('option'); if ($option == 'late') { @@ -104,7 +106,7 @@ $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); -if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn)) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; if (! $sortorder && ! empty($conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER) && $search_status == 1) $sortorder=$conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER; if (! $sortorder) $sortorder='DESC'; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 4d5f2999943..1bb52d8ae48 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -85,6 +85,8 @@ $search_total_ttc=GETPOST('search_total_ttc','alpha'); $optioncss = GETPOST('optioncss','alpha'); $billed = GETPOST('billed','int'); $search_project_ref=GETPOST('search_project_ref','alpha'); +$search_btn=GETPOST('button_search','alpha'); +$search_remove_btn=GETPOST('button_removefilter','alpha'); $page = GETPOST('page','int'); $sortorder = GETPOST('sortorder','alpha'); @@ -105,7 +107,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); -if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn)) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index a602badfb05..960fac83216 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -99,6 +99,8 @@ $day_lim = GETPOST('day_lim','int'); $month_lim = GETPOST('month_lim','int'); $year_lim = GETPOST('year_lim','int'); $toselect = GETPOST('toselect', 'array'); +$search_btn=GETPOST('button_search','alpha'); +$search_remove_btn=GETPOST('button_removefilter','alpha'); $option = GETPOST('option'); if ($option == 'late') { @@ -110,7 +112,7 @@ $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page=GETPOST("page",'int'); -if ($page == -1 || $page == null) { $page = 0 ; } +if ($page == -1 || $page == null || !empty($search_btn) || !empty($search_remove_btn)) { $page = 0 ; } $offset = $limit * $page ; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 3d56fa9401a..b3f070124a6 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -82,6 +82,8 @@ $search_type=GETPOST('search_type','alpha'); $search_level_from = GETPOST("search_level_from","alpha"); $search_level_to = GETPOST("search_level_to","alpha"); $search_stcomm=GETPOST('search_stcomm','int'); +$search_btn=GETPOST('button_search','alpha'); +$search_remove_btn=GETPOST('button_removefilter','alpha'); $type=GETPOST('type'); $optioncss=GETPOST('optioncss','alpha'); @@ -95,7 +97,7 @@ $sortorder=GETPOST("sortorder",'alpha'); $page=GETPOST("page",'int'); if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="s.nom"; -if (empty($page) || $page == -1) { $page = 0; } +if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn)) { $page = 0; } $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 4240ca72a08..c1267fce72a 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -73,6 +73,8 @@ $search_montant_vat=GETPOST('search_montant_vat','alpha'); $search_montant_ttc=GETPOST('search_montant_ttc','alpha'); $search_status=GETPOST('viewstatut','alpha')?GETPOST('viewstatut','alpha'):GETPOST('search_status','int'); $object_statut=$db->escape(GETPOST('supplier_proposal_statut')); +$search_btn=GETPOST('button_search','alpha'); +$search_remove_btn=GETPOST('button_removefilter','alpha'); $sall=GETPOST('sall', 'alphanohtml'); $mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg")); @@ -85,7 +87,7 @@ $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); -if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn)) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; From 80ff7fa86f34d11c9facedac8bab3b3250b91b53 Mon Sep 17 00:00:00 2001 From: gauthier Date: Wed, 11 Jul 2018 15:18:30 +0200 Subject: [PATCH 03/13] FIX : case when we valid form with keyboard --- htdocs/comm/propal/list.php | 2 +- htdocs/commande/list.php | 2 +- htdocs/compta/facture/list.php | 2 +- htdocs/fourn/commande/list.php | 2 +- htdocs/fourn/facture/list.php | 2 +- htdocs/societe/list.php | 2 +- htdocs/supplier_proposal/list.php | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index fe35c2bc4e8..52a712ab043 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -90,7 +90,7 @@ $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); -if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn)) { $page = 0; } // If $page is not defined, or '' or -1 +if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 6e57b55b2c7..db1b7554e4f 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -88,7 +88,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); -if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn)) { $page = 0; } // If $page is not defined, or '' or -1 +if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 1e857abfa7e..859889966eb 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -106,7 +106,7 @@ $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); -if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn)) { $page = 0; } // If $page is not defined, or '' or -1 +if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; if (! $sortorder && ! empty($conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER) && $search_status == 1) $sortorder=$conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER; if (! $sortorder) $sortorder='DESC'; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 1bb52d8ae48..d1b8cdcdcaf 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -107,7 +107,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); -if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn)) { $page = 0; } // If $page is not defined, or '' or -1 +if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 960fac83216..5ba2a2b9779 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -112,7 +112,7 @@ $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page=GETPOST("page",'int'); -if ($page == -1 || $page == null || !empty($search_btn) || !empty($search_remove_btn)) { $page = 0 ; } +if ($page == -1 || $page == null || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0 ; } $offset = $limit * $page ; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index b3f070124a6..3f011d588f5 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -97,7 +97,7 @@ $sortorder=GETPOST("sortorder",'alpha'); $page=GETPOST("page",'int'); if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="s.nom"; -if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn)) { $page = 0; } +if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0; } $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index c1267fce72a..cf492137330 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -87,7 +87,7 @@ $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); -if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn)) { $page = 0; } // If $page is not defined, or '' or -1 +if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; From 7dada7ae8e2c020cda81d614c96d694c7d1f99da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 29 Jul 2018 09:15:42 +0200 Subject: [PATCH 04/13] fix #8820 --- htdocs/product/reassort.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index e3983344cff..70dce7470cd 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -134,7 +134,7 @@ if (dol_strlen($type)) $sql.= " AND p.fk_product_type <> '1'"; } } -if ($sref) $sql.= natural_search('p.ref', $ref); +if ($sref) $sql.= natural_search('p.ref', $sref); if ($sbarcode) $sql.= natural_search('p.barcode', $sbarcode); if ($snom) $sql.= natural_search('p.label', $snom); if (! empty($tosell)) $sql.= " AND p.tosell = ".$tosell; From b9a44fc76bbe4fe4f84f8fdfe0b41ab278b82fe3 Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Tue, 31 Jul 2018 12:15:18 +0200 Subject: [PATCH 05/13] FIX : Wrong position of firstname lastname --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d9c86dd45f4..7b8d110802c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5856,7 +5856,7 @@ function dolGetFirstLastname($firstname,$lastname,$nameorder=-1) $ret=''; // If order not defined, we use the setup if ($nameorder < 0) $nameorder=$conf->global->MAIN_FIRSTNAME_NAME_POSITION; - if ($nameorder && ((string) $nameorder != '2')) + if (empty($nameorder) && ((string) $nameorder != '2')) { $ret.=$firstname; if ($firstname && $lastname) $ret.=' '; From 4ddca02bb9d86d3e6abfdfe2cb4a75359e9e3582 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Tue, 31 Jul 2018 14:58:33 +0200 Subject: [PATCH 06/13] fix situation line's total --- htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/core/lib/pdf.lib.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 3de5ae96458..e0b6d1d81bc 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4834,7 +4834,7 @@ class FactureLigne extends CommonInvoiceLine $resql = $this->db->query($sql); if ($resql && $resql->num_rows > 0) { $res = $this->db->fetch_array($resql); - return $res['situation_percent']; + return floatval($res['situation_percent']); } else { $this->error = $this->db->error(); dol_syslog(get_class($this) . "::select Error " . $this->error, LOG_ERR); diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index cb061bc9f2e..234c0cc7e34 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1899,13 +1899,13 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0) { $prev_progress = 0; $progress = 1; - if (method_exists($object, 'get_prev_progress')) + if (method_exists($object->lines[$i], 'get_prev_progress')) { $prev_progress = $object->lines[$i]->get_prev_progress($object->id); $progress = ($object->lines[$i]->situation_percent - $prev_progress) / 100; } $result.=price($sign * ($total_ht/($object->lines[$i]->situation_percent/100)) * $progress, 0, $outputlangs); - } + } else $result.=price($sign * $total_ht, 0, $outputlangs); } From ceb85cfa45d60cb987a3ef5271cd11fef844d99d Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Tue, 31 Jul 2018 17:29:08 +0200 Subject: [PATCH 07/13] fix : odt project and task extrafields management --- .../doc/doc_generic_project_odt.modules.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index e050bf8e3eb..c2258f9ba97 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -130,12 +130,9 @@ class doc_generic_project_odt extends ModelePDFProjects $array_key.'_statut'=>$object->getLibStatut() ); - // Retrieve extrafields - $extrafieldkey=$object->element; - require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $extrafields = new ExtraFields($this->db); - $extralabels = $extrafields->fetch_name_optionals_label($extrafieldkey,true); + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element,true); $object->fetch_optionals($object->id,$extralabels); $resarray = $this->fill_substitutionarray_with_extrafields($object,$resarray,$extrafields,$array_key,$outputlangs); @@ -154,7 +151,7 @@ class doc_generic_project_odt extends ModelePDFProjects { global $conf; - return array( + $resarray = array( 'task_ref'=>$task->ref, 'task_fk_project'=>$task->fk_project, 'task_projectref'=>$task->projectref, @@ -170,6 +167,16 @@ class doc_generic_project_odt extends ModelePDFProjects 'task_note_private'=>$task->note_private, 'task_note_public'=>$task->note_public ); + + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + $extrafields = new ExtraFields($this->db); + $extralabels = $extrafields->fetch_name_optionals_label($task->table_element,true); + $task->fetch_optionals($task->id,$extralabels); + + $resarray = $this->fill_substitutionarray_with_extrafields($task,$resarray,$extrafields,'task',$outputlangs); + + return $resarray; + } /** From 70adfb135dc332c30a225b1412fd1e50f71f2992 Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Fri, 3 Aug 2018 09:51:29 +0200 Subject: [PATCH 08/13] FIX : Missing behavior --- htdocs/core/lib/functions.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7b8d110802c..28a31507733 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5855,8 +5855,8 @@ function dolGetFirstLastname($firstname,$lastname,$nameorder=-1) $ret=''; // If order not defined, we use the setup - if ($nameorder < 0) $nameorder=$conf->global->MAIN_FIRSTNAME_NAME_POSITION; - if (empty($nameorder) && ((string) $nameorder != '2')) + if ($nameorder < 0) $nameorder=empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION); + if ($nameorder && ((string) $nameorder != '2')) { $ret.=$firstname; if ($firstname && $lastname) $ret.=' '; From 615ed115343b4f49345a30589e45759d1ee3721d Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Fri, 3 Aug 2018 17:09:58 +0200 Subject: [PATCH 09/13] fix bad use of test_sql_and_script_inject return int not value tested --- htdocs/core/class/html.form.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 776c04bfc41..5c7091ba6e3 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1070,7 +1070,11 @@ class Form $outarray=array(); // Clean $filter that may contains sql conditions so sql code - if (function_exists('test_sql_and_script_inject')) $filter = test_sql_and_script_inject($filter, 3); + if (function_exists('test_sql_and_script_inject')) { + if (test_sql_and_script_inject($filter, 3)>0) { + $filter =''; + } + } // On recherche les societes $sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.client, s.fournisseur, s.code_client, s.code_fournisseur"; From 74d05da149655e29933b689881d0881833203b7c Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Mon, 6 Aug 2018 11:28:34 +0200 Subject: [PATCH 10/13] fix : display if error --- htdocs/holiday/card.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index b19f63e0ab3..348edcac1e7 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -452,10 +452,15 @@ if ($action == 'confirm_valid') $newSolde = $soldeActuel - ($nbopenedday * $object->getConfCP('nbHolidayDeducted')); // On ajoute la modification dans le LOG - $object->addLogCP($user->id, $object->fk_user, $langs->transnoentitiesnoconv("Holidays"), $newSolde, $object->fk_type); - + $result=$object->addLogCP($user->id, $object->fk_user, $langs->transnoentitiesnoconv("Holidays"), $newSolde, $object->fk_type); + if ($result<0) { + setEventMessages(null, $object->errors,'errors'); + } // Mise à jour du solde - $object->updateSoldeCP($object->fk_user, $newSolde, $object->fk_type); + $result=$object->updateSoldeCP($object->fk_user, $newSolde, $object->fk_type); + if ($result<0) { + setEventMessages(null, $object->errors,'errors'); + } // To $destinataire = new User($db); From d8d54d246c5cc64cf0699efbf6aeef73b7d89dcd Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Fri, 10 Aug 2018 15:05:21 +0200 Subject: [PATCH 11/13] FIX : Pagination on withdraw request list --- htdocs/compta/prelevement/create.php | 30 +++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index cd3aebf62f4..af49e849e9f 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -47,7 +47,10 @@ $result = restrictedArea($user, 'prelevement', '', '', 'bons'); $action = GETPOST('action','alpha'); $mode = GETPOST('mode','alpha')?GETPOST('mode','alpha'):'real'; $format = GETPOST('format','aZ09'); - +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; +$page = GETPOST("page",'int'); +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +$offset = $limit * $page; /* * Actions @@ -196,13 +199,33 @@ $sql.= " AND pfd.traite = 0"; $sql.= " AND pfd.fk_facture = f.rowid"; if ($socid) $sql.= " AND f.fk_soc = ".$socid; +$nbtotalofrecords = ''; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} + +$sql.= $db->plimit($limit+1,$offset); + $resql=$db->query($sql); if ($resql) { $num = $db->num_rows($resql); $i = 0; - print load_fiche_titre($langs->trans("InvoiceWaitingWithdraw").($num > 0?' ('.$num.')':''),'',''); + $param=''; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); + if($socid) $param .= '&socid='.urlencode($socid); + if($option) $param .= "&option=".urlencode($option); + + if(! empty($page) && $num <= $nbtotalofrecords) $page = 0; + + print '
'; + print ''; + print ''; + + print_barre_liste($langs->trans("InvoiceWaitingWithdraw"),$page,$_SERVER['PHP_SELF'],$param,'','','',$num,$nbtotalofrecords,'title_accountancy.png',0,'','', $limit); print ''; print ''; @@ -219,7 +242,7 @@ if ($resql) require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; $bac = new CompanyBankAccount($db); - while ($i < $num && $i < 20) + while ($i < $num && $i < $limit) { $obj = $db->fetch_object($resql); @@ -260,6 +283,7 @@ if ($resql) } else print ''; print "
'.$langs->trans("None").'
"; + print "
"; print "
\n"; } else From 391230babcc097772bad8edfc560a779c4b0408b Mon Sep 17 00:00:00 2001 From: gauthier Date: Fri, 10 Aug 2018 15:39:49 +0200 Subject: [PATCH 12/13] FIX : global $mysoc missing (to avoid php notice on lines 279, 280 & 281) --- htdocs/core/modules/modService.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index 7a9a3f4df3f..7302ebc673b 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -42,7 +42,7 @@ class modService extends DolibarrModules */ function __construct($db) { - global $conf; + global $conf, $mysoc; $this->db = $db; $this->numero = 53; From 6954ab00f9ada8e986af9594e210034652e834f6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 12 Aug 2018 18:11:27 +0200 Subject: [PATCH 13/13] Update functions.lib.php --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 28a31507733..f27c1fbf0a0 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5855,7 +5855,7 @@ function dolGetFirstLastname($firstname,$lastname,$nameorder=-1) $ret=''; // If order not defined, we use the setup - if ($nameorder < 0) $nameorder=empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION); + if ($nameorder < 0) $nameorder=(empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?1:0); if ($nameorder && ((string) $nameorder != '2')) { $ret.=$firstname;