From ee7e394ebf8a2b0d68fcf4785746e826822b20e3 Mon Sep 17 00:00:00 2001 From: Milen Karaganski Date: Thu, 8 Dec 2022 20:22:41 +0200 Subject: [PATCH 1/6] FIX|Fix [#23075] Wrong invoice unit price when billing Project task spent time --- htdocs/projet/tasks/time.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index cf2de5bef28..888bd4fb50b 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -462,7 +462,7 @@ if ($action == 'confirm_generateinvoice') { foreach ($arrayoftasks as $userid => $value) { $fuser->fetch($userid); - //$pu_ht = $value['timespent'] * $fuser->thm; + $pu_ht = $fuser->thm; $username = $fuser->getFullName($langs); // Define qty per hour From 811e24fd7c9fdb2fdaba3de42b7391dd7cab54e8 Mon Sep 17 00:00:00 2001 From: Milen Karaganski Date: Sat, 10 Dec 2022 21:15:00 +0200 Subject: [PATCH 2/6] Change to define unit price from timespent data instead from the user hourly rate --- htdocs/projet/tasks/time.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 888bd4fb50b..debfb427111 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -469,10 +469,15 @@ if ($action == 'confirm_generateinvoice') { $qtyhour = $value['timespent'] / 3600; $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); + /* // If no unit price known if (empty($pu_ht)) { $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); } + */ + + //Unit price + $pu_ht = price2num(($value['totalvaluetodivideby3600'] / $value['timespent']), 'MU'); // Add lines $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_ht, round($qtyhour / $prodDurationHours, 2), $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); From b8755bcf65a7282907049a3b34d48f202fcd8771 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 12 Dec 2022 10:39:24 +0100 Subject: [PATCH 3/6] fix parameters order --- htdocs/reception/class/reception.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 7244fdcb60b..0f9293a18cd 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1779,7 +1779,7 @@ class Reception extends CommonObject // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record $inventorycode = ''; - $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionUnClassifyCloseddInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', $obj->fk_origin_stock, $inventorycode); + $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionUnClassifyCloseddInDolibarr", $numref), $this->db->jdate($obj->eatby), '', $this->db->jdate($obj->sellby), $obj->batch, $obj->fk_origin_stock, $inventorycode); if ($result < 0) { $this->error = $mouvS->error; $this->errors = $mouvS->errors; @@ -1911,7 +1911,7 @@ class Reception extends CommonObject // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record $inventorycode = ''; - $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionBackToDraftInDolibarr", $this->ref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, '', 0, $inventorycode); + $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionBackToDraftInDolibarr", $this->ref), '', $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, 0, $inventorycode); if ($result < 0) { $this->error = $mouvS->error; $this->errors = $mouvS->errors; From c134090321f8cfe64866bf0b123911f7c0e06e2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 12 Dec 2022 10:44:34 +0100 Subject: [PATCH 4/6] fix parameters order --- htdocs/reception/class/reception.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 0f9293a18cd..6ced6d601da 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1779,7 +1779,7 @@ class Reception extends CommonObject // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record $inventorycode = ''; - $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionUnClassifyCloseddInDolibarr", $numref), $this->db->jdate($obj->eatby), '', $this->db->jdate($obj->sellby), $obj->batch, $obj->fk_origin_stock, $inventorycode); + $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->cost_price, $langs->trans("ReceptionUnClassifyCloseddInDolibarr", $numref), '', $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, $obj->fk_origin_stock, $inventorycode); if ($result < 0) { $this->error = $mouvS->error; $this->errors = $mouvS->errors; From d98c998b8eb50e7a2c8716977161a768d5a3cd12 Mon Sep 17 00:00:00 2001 From: Quentin-Seekness <72733832+Quentin-Seekness@users.noreply.github.com> Date: Tue, 13 Dec 2022 11:26:53 +0100 Subject: [PATCH 5/6] Adding filter parameters Adding filter parameters in addMoreActionsButtonsList Hook --- htdocs/accountancy/bookkeeping/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 44a7906fe36..d6234b3d8ac 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -874,7 +874,7 @@ if (count($filter)) { $buttonLabel = $langs->trans("ExportList"); } -$parameters = array(); +$parameters = array('param' => $param); $reshook = $hookmanager->executeHooks('addMoreActionsButtonsList', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); From 1d8cf1b44ff314ea446a9f4e9335a3952417a65c Mon Sep 17 00:00:00 2001 From: Quentin-Seekness <72733832+Quentin-Seekness@users.noreply.github.com> Date: Tue, 13 Dec 2022 11:29:28 +0100 Subject: [PATCH 6/6] Add filter params --- htdocs/accountancy/bookkeeping/listbyaccount.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 6cd80d7c1aa..db0b3981246 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -602,7 +602,7 @@ print ''; print ''; print ''; -$parameters = array(); +$parameters = array('param' => $param); $reshook = $hookmanager->executeHooks('addMoreActionsButtonsList', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');