From d8c51e712dc1783432ec3b2bb80adb4783385214 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Wed, 12 Apr 2023 10:17:13 +0200 Subject: [PATCH 1/7] FIX reassortlot search categorie + add inihook --- htdocs/product/reassortlot.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index 65e69b91384..437b698435e 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -88,6 +88,8 @@ if ($user->socid) { } $result = restrictedArea($user, 'produit|service', 0, 'product&product'); +$hookmanager->initHooks(array('reassortlotlist')); + /* * Actions @@ -135,11 +137,11 @@ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot as e on ps.fk_entrepot = e.rowid' $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_batch as pb on pb.fk_product_stock = ps.rowid'; // Detail for each lot on each warehouse $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot as pl on pl.fk_product = p.rowid AND pl.batch = pb.batch'; // Link on unique key // We'll need this table joined to the select in order to filter by categ -if ($search_categ) { +if ($search_categ > 0) { $sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp"; } $sql .= " WHERE p.entity IN (".getEntity('product').")"; -if ($search_categ) { +if ($search_categ > 0) { $sql .= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ } if ($sall) { @@ -178,7 +180,7 @@ if ($fourn_id > 0) { $sql .= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".((int) $fourn_id); } // Insert categ filter -if ($search_categ) { +if ($search_categ > 0) { $sql .= " AND cp.fk_categorie = ".((int) $search_categ); } if ($search_warehouse) { @@ -277,7 +279,7 @@ if ($resql) { if ($search_sale) { $param .= "&search_sale=".urlencode($search_sale); } - if ($search_categ) { + if ($search_categ > 0) { $param .= "&search_categ=".urlencode($search_categ); } /*if ($eatby) $param.="&eatby=".$eatby; From bfe7cd76c273efaa5d3320fa306ae72b0c4b1784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Courtier?= Date: Tue, 9 May 2023 17:12:09 +0200 Subject: [PATCH 2/7] FIX: No error message because $price_ht_devise is equal to 0 if not fill because of price2num --- htdocs/supplier_proposal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 8d100370a00..072e1bfdf5b 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -586,7 +586,7 @@ if (empty($reshook)) { $error++; } - if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && GETPOST('price_ht') === '' && GETPOST('price_ttc') === '' && $price_ht_devise === '') { // Unit price can be 0 but not ''. Also price can be negative for proposal. + if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && GETPOST('price_ht') === '' && GETPOST('price_ttc') === '' && GETPOST('multicurrency_price_ht') === '') { // Unit price can be 0 but not ''. Also price can be negative for proposal. setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPrice")), null, 'errors'); $error++; } From 07bec30c32b9a758ed01fd7d55ff47e4961ed504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Courtier?= Date: Thu, 11 May 2023 11:10:33 +0200 Subject: [PATCH 3/7] FIX: Task events not displayed --- htdocs/projet/tasks/task.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index f163af75cae..6fb8f07d0a6 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -644,8 +644,7 @@ if ($id > 0 || !empty($ref)) { // List of actions on element include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; $formactions = new FormActions($db); - $defaultthirdpartyid = $socid > 0 ? $socid : $object->project->socid; - $formactions->showactions($object, 'task', $defaultthirdpartyid, 1, '', 10, 'withproject='.$withproject); + $formactions->showactions($object, 'project_task', 0, 1, '', 10, 'withproject='.$withproject); print ''; } From 0531f9a8535e5488f3f66369edfbde9f3fae3e16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Courtier?= Date: Wed, 17 May 2023 10:56:15 +0200 Subject: [PATCH 4/7] FIX: Missing error message display on insertExtrafields() --- htdocs/fichinter/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index ab08d5c04f8..7d8e1583c2d 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -721,6 +721,7 @@ if (empty($reshook)) { // Actions on extra fields $result = $object->insertExtraFields('INTERVENTION_MODIFY'); if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); $error++; } } From 8fa581f9368bee2dc840f731220daede3670c8bb Mon Sep 17 00:00:00 2001 From: daraelmin Date: Wed, 17 May 2023 22:59:51 +0200 Subject: [PATCH 5/7] FIX #24798 Deleting member subscription is not possible object subscription has no getfullname method, it's in adherent class --- .../interface_50_modAgenda_ActionsAuto.class.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index d0597f617fb..dd02bd6a4ca 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -732,12 +732,20 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'MEMBER_SUBSCRIPTION_DELETE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "members")); + + $member = $this->context['member']; + if (!is_object($member)) { // This should not happen but it happen when deleting a subscription from adherents/subscription/card.php + dol_syslog("Execute a trigger MEMBER_SUBSCRIPTION_CREATE with context key 'member' not an object"); + include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; + $member = new Adherent($this->db); + $member->fetch($object->fk_adherent); + } if (empty($object->actionmsg2)) { - $object->actionmsg2 = $langs->transnoentities("MemberSubscriptionDeletedInDolibarr", $object->ref, $object->getFullName($langs)); + $object->actionmsg2 = $langs->transnoentities("MemberSubscriptionDeletedInDolibarr", $object->ref, $member->getFullName($langs)); } - $object->actionmsg = $langs->transnoentities("MemberSubscriptionDeletedInDolibarr", $object->ref, $object->getFullName($langs)); - $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs); + $object->actionmsg = $langs->transnoentities("MemberSubscriptionDeletedInDolibarr", $object->ref, $member->getFullName($langs)); + $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$member->getFullName($langs); $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type; $object->actionmsg .= "\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount; $object->actionmsg .= "\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start, 'day').' - '.dol_print_date($object->last_subscription_date_end, 'day'); From b70676cc1ffc80b79a87362260d6211934e3016b Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 17 May 2023 21:47:51 +0000 Subject: [PATCH 6/7] Fixing style errors. --- .../core/triggers/interface_50_modAgenda_ActionsAuto.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index dd02bd6a4ca..0824cbfafda 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -732,7 +732,7 @@ class InterfaceActionsAuto extends DolibarrTriggers } elseif ($action == 'MEMBER_SUBSCRIPTION_DELETE') { // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "members")); - + $member = $this->context['member']; if (!is_object($member)) { // This should not happen but it happen when deleting a subscription from adherents/subscription/card.php dol_syslog("Execute a trigger MEMBER_SUBSCRIPTION_CREATE with context key 'member' not an object"); From a9f86d94ea54e4df0f4b4e0c068d44b21d85c7f4 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 20 May 2023 08:11:39 +0200 Subject: [PATCH 7/7] FIX - Remove warning on lettering - Impossible to write in ledger v16 v17 v18 --- htdocs/accountancy/journal/bankjournal.php | 8 +------- htdocs/accountancy/journal/purchasesjournal.php | 8 +------- htdocs/accountancy/journal/sellsjournal.php | 9 +-------- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 85c9551b7ec..23af16b1f52 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -4,7 +4,7 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin * Copyright (C) 2013 Christophe Battarel - * Copyright (C) 2013-2021 Alexandre Spangaro + * Copyright (C) 2013-2023 Alexandre Spangaro * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2017-2021 Frédéric France @@ -797,12 +797,6 @@ if (!$error && $action == 'writebookkeeping') { require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php'; $lettering_static = new Lettering($db); $nb_lettering = $lettering_static->bookkeepingLetteringAll(array($bookkeeping->id)); - - if ($nb_lettering < 0) { - $error++; - $errorforline++; - setEventMessages($lettering_static->error, $lettering_static->errors, 'errors'); - } } } } diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 5f4182762dc..3567decc81a 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -3,7 +3,7 @@ * Copyright (C) 2007-2010 Jean Heimburger * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2013-2021 Alexandre Spangaro + * Copyright (C) 2013-2023 Alexandre Spangaro * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2018 Frédéric France @@ -380,12 +380,6 @@ if ($action == 'writebookkeeping') { require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php'; $lettering_static = new Lettering($db); $nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id), 'supplier_invoice'); - - if ($nb_lettering < 0) { - $error++; - $errorforline++; - setEventMessages($lettering_static->error, $lettering_static->errors, 'errors'); - } } } } diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index bc223fa8d93..1d1b3b102f2 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -4,7 +4,7 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin * Copyright (C) 2013 Christophe Battarel - * Copyright (C) 2013-2021 Alexandre Spangaro + * Copyright (C) 2013-2023 Alexandre Spangaro * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2014 Raphaël Doursenaud @@ -393,13 +393,6 @@ if ($action == 'writebookkeeping') { require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php'; $lettering_static = new Lettering($db); $nb_lettering = $lettering_static->bookkeepingLettering(array($bookkeeping->id), 'customer_invoice'); - - if ($nb_lettering < 0) { - $error++; - $errorforline++; - $errorforinvoice[$key] = 'other'; - setEventMessages($lettering_static->error, $lettering_static->errors, 'errors'); - } } } }