From 56d78cf12a4e57ab23868ce7caf9eda017727fa0 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Wed, 12 May 2021 11:02:27 +0200 Subject: [PATCH 01/11] FIX missing town and zip filter in contract list sql request --- htdocs/contrat/list.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index a7b5114501f..96754e639fd 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -256,6 +256,8 @@ if ($search_email) $sql .= natural_search('s.email', $search_email); if ($search_contract) $sql .= natural_search(array('c.rowid', 'c.ref'), $search_contract); if (!empty($search_ref_customer)) $sql .= natural_search(array('c.ref_customer'), $search_ref_customer); if (!empty($search_ref_supplier)) $sql .= natural_search(array('c.ref_supplier'), $search_ref_supplier); +if ($search_zip) $sql .= natural_search(array('s.zip'), $search_zip); +if ($search_town) $sql .= natural_search(array('s.town'), $search_town); if ($search_sale > 0) { $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; From 90d159fbc3b9755201fde87ee19beb257b462b34 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Tue, 18 May 2021 14:58:46 +0200 Subject: [PATCH 02/11] FIX : Missing hook in cibles.php (for mailing) --- htdocs/comm/mailing/cibles.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 8bfa82260b9..bf4b2e3d39c 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -66,6 +66,8 @@ $modulesdir = dolGetModulesDirs('/mailings'); $object = new Mailing($db); $result = $object->fetch($id); +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('ciblescard', 'globalcard')); /* * Actions @@ -471,6 +473,10 @@ if ($object->fetch($id) >= 0) } } // End foreach dir + $parameters = array(); + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print ''; print '

'; From 57732d4265f36bfb1c80c50c8ad9c39b3819a1f1 Mon Sep 17 00:00:00 2001 From: gmilad <61253440+gmilad@users.noreply.github.com> Date: Tue, 18 May 2021 19:45:15 +0200 Subject: [PATCH 03/11] Fix issue #17608 for branch 10 Fix issue #17608 for branch 10 --- htdocs/admin/translation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index 2a9983d95b1..1a3fa4d4122 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -200,7 +200,7 @@ if ($action == 'delete') $form = new Form($db); $formadmin = new FormAdmin($db); -$wikihelp='EN:Setup|FR:Paramétrage|ES:Configuración'; +$wikihelp = 'EN:Setup_Translation|FR:Paramétrage_Traduction|ES:Configuración_Traducción'; llxHeader('', $langs->trans("Setup"), $wikihelp); $param='&mode='.$mode; From 4bb18db90516bd71c43685c71131b3a1742af23d Mon Sep 17 00:00:00 2001 From: gmilad <61253440+gmilad@users.noreply.github.com> Date: Tue, 18 May 2021 19:53:35 +0200 Subject: [PATCH 04/11] Fix issue #17608 for branch 11 Fix issue #17608 for branch 11 --- htdocs/admin/translation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index c641be11a59..23c2a69c127 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -197,7 +197,7 @@ if ($action == 'delete') $form = new Form($db); $formadmin = new FormAdmin($db); -$wikihelp = 'EN:Setup|FR:Paramétrage|ES:Configuración'; +$wikihelp = 'EN:Setup_Translation|FR:Paramétrage_Traduction|ES:Configuración_Traducción'; llxHeader('', $langs->trans("Setup"), $wikihelp); $param = '&mode='.$mode; From e2e6d4ba14434f52b8385bbbca5580250c6e3cc9 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Wed, 19 May 2021 14:29:46 +0200 Subject: [PATCH 05/11] FIX keep special code on supplier order lines for external modules --- htdocs/fourn/commande/card.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 0b7eb338b69..ef127e84811 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1239,6 +1239,8 @@ if (empty($reshook)) $tva_tx = get_default_tva($soc, $mysoc, $lines[$i]->fk_product, $product_fourn_price_id); } + $object->special_code = $lines[$i]->special_code; + $result = $object->addline( $desc, $lines[$i]->subprice, From 67cab8c1f2538ef7cc6af384dbedb374cbfb64d5 Mon Sep 17 00:00:00 2001 From: r3dge Date: Fri, 21 May 2021 16:01:04 +0200 Subject: [PATCH 06/11] bug fix : replacing orders by donations and setting required field to allow post action in rest API for url donations. See issue #17700 --- htdocs/don/class/api_donations.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/don/class/api_donations.class.php b/htdocs/don/class/api_donations.class.php index 18a8563fd89..5f70ee82a2e 100644 --- a/htdocs/don/class/api_donations.class.php +++ b/htdocs/don/class/api_donations.class.php @@ -33,7 +33,7 @@ class Donations extends DolibarrApi * @var array $FIELDS Mandatory fields, checked when create and update object */ static $FIELDS = array( - 'socid' + 'amount' ); /** @@ -193,7 +193,7 @@ class Donations extends DolibarrApi }*/ if ($this->don->create(DolibarrApiAccess::$user) < 0) { - throw new RestException(500, "Error creating order", array_merge(array($this->don->error), $this->don->errors)); + throw new RestException(500, "Error creating donation", array_merge(array($this->don->error), $this->don->errors)); } return $this->don->id; @@ -355,7 +355,7 @@ class Donations extends DolibarrApi private function _validate($data) { $don = array(); - foreach (Orders::$FIELDS as $field) { + foreach (Donations::$FIELDS as $field) { if (!isset($data[$field])) throw new RestException(400, $field." field missing"); $don[$field] = $data[$field]; From f81136231a2250e1f4767f1c0285848b8cbc73bf Mon Sep 17 00:00:00 2001 From: r3dge Date: Sun, 23 May 2021 18:09:10 +0200 Subject: [PATCH 07/11] fixing PUT request for donation update --- htdocs/don/class/api_donations.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/don/class/api_donations.class.php b/htdocs/don/class/api_donations.class.php index 5f70ee82a2e..1a17f6ff94c 100644 --- a/htdocs/don/class/api_donations.class.php +++ b/htdocs/don/class/api_donations.class.php @@ -302,7 +302,7 @@ class Donations extends DolibarrApi throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - $result = $this->don->valid(DolibarrApiAccess::$user, $idwarehouse, $notrigger); + $result = $this->don->valid_promesse($id, DolibarrApiAccess::$user->id, $notrigger); if ($result == 0) { throw new RestException(304, 'Error nothing done. May be object is already validated'); } From 647997af2815c04111ea4e1831230e28f7a34364 Mon Sep 17 00:00:00 2001 From: r3dge Date: Sun, 23 May 2021 18:15:00 +0200 Subject: [PATCH 08/11] fixing error on date --- htdocs/don/class/don.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 0717870ac42..9396f3a718a 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -390,7 +390,7 @@ class Don extends CommonObject $sql .= ", phone"; $sql .= ", phone_mobile"; $sql .= ") VALUES ("; - $sql .= "'".$this->db->idate($now)."'"; + $sql .= "'".$this->db->idate($this->date)."'"; $sql .= ", ".$conf->entity; $sql .= ", ".price2num($this->amount); $sql .= ", ".($this->modepaymentid ? $this->modepaymentid : "null"); From 7d223beae53e05c5b671f745110ffdd231779b36 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 24 May 2021 12:51:58 +0200 Subject: [PATCH 09/11] fix: export balance with doublequote --- htdocs/accountancy/bookkeeping/balance.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 6c15fd6615c..664f659fb46 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -158,11 +158,11 @@ if ($action == 'export_csv') foreach ($object->lines as $line) { - print length_accountg($line->numero_compte).$sep; - print $object->get_compte_desc($line->numero_compte).$sep; - print price($line->debit).$sep; - print price($line->credit).$sep; - print price($line->debit - $line->credit).$sep; + print '"'.length_accountg($line->numero_compte).'"'.$sep; + print '"'.$object->get_compte_desc($line->numero_compte).'"'.$sep; + print '"'.price($line->debit).'"'.$sep; + print '"'.price($line->credit).'"'.$sep; + print '"'.price($line->debit - $line->credit).'"'.$sep; print "\n"; } From 71b35ef0e5be758b3faddfa7650916adc73d1536 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 May 2021 12:11:06 +0200 Subject: [PATCH 10/11] Fix regression - can't reset parent company --- htdocs/societe/class/societe.class.php | 33 +++++++++++++++----------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 591809389d4..47105bf9068 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3111,24 +3111,29 @@ class Societe extends CommonObject public function set_parent($id) { // phpcs:enable + dol_syslog(get_class($this).'::set_parent', LOG_DEBUG); + if ($this->id) { // Check if the id we want to add as parent has not already one parent that is the current id we try to update - $sameparent = $this->validateFamilyTree($id, $this->id, 0); - if ($sameparent < 0) { - return -1; - } elseif ($sameparent == 1) { - setEventMessages('ParentCompanyToAddIsAlreadyAChildOfModifiedCompany', null, 'warnings'); - return -1; - } else { - $sql = 'UPDATE '.MAIN_DB_PREFIX.'societe SET parent = '.($id > 0 ? $id : 'null').' WHERE rowid = '.((int) $this->id); - dol_syslog(get_class($this).'::set_parent', LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) { - $this->parent = $id; - return 1; - } else { + if ($id > 0) { + $sameparent = $this->validateFamilyTree($id, $this->id, 0); + if ($sameparent < 0) { return -1; } + if ($sameparent == 1) { + setEventMessages('ParentCompanyToAddIsAlreadyAChildOfModifiedCompany', null, 'warnings'); + return -1; + } + } + + $sql = 'UPDATE '.MAIN_DB_PREFIX.'societe SET parent = '.($id > 0 ? $id : 'null').' WHERE rowid = '.((int) $this->id); + + $resql = $this->db->query($sql); + if ($resql) { + $this->parent = $id; + return 1; + } else { + return -1; } } else { return -1; From 0d31db0ba5bb88d6d47f6e4c5719f4a06414b02f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 May 2021 20:11:46 +0200 Subject: [PATCH 11/11] Update don.class.php --- htdocs/don/class/don.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 9396f3a718a..3e0e300930d 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -390,7 +390,7 @@ class Don extends CommonObject $sql .= ", phone"; $sql .= ", phone_mobile"; $sql .= ") VALUES ("; - $sql .= "'".$this->db->idate($this->date)."'"; + $sql .= "'".$this->db->idate($this->date ? $this->date : $now)."'"; $sql .= ", ".$conf->entity; $sql .= ", ".price2num($this->amount); $sql .= ", ".($this->modepaymentid ? $this->modepaymentid : "null");