From efb93278966dacae2e0e325e28db884be261f9d3 Mon Sep 17 00:00:00 2001 From: lvessiller-opendsi Date: Mon, 12 May 2025 20:09:16 +0200 Subject: [PATCH 01/28] FIX local taxes text in object line view mode (#34103) --- htdocs/core/tpl/objectline_view.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index e26193a932b..8e429eecd8b 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -305,10 +305,10 @@ $positiverates = ''; if (price2num($line->tva_tx)) { $positiverates .= ($positiverates ? '/' : '').price2num($line->tva_tx); } -if (price2num($line->total_localtax1)) { +if (price2num($line->localtax1_tx)) { $positiverates .= ($positiverates ? '/' : '').price2num($line->localtax1_tx); } -if (price2num($line->total_localtax2)) { +if (price2num($line->localtax2_tx)) { $positiverates .= ($positiverates ? '/' : '').price2num($line->localtax2_tx); } if (empty($positiverates)) { From 3b3f3fa29beee727283465b537ea9a76f7d510f3 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Sat, 17 May 2025 14:05:42 +0200 Subject: [PATCH 02/28] FIX: product suplier tab: last modif date column was wrongly dependant of module barcode (#34170) * FIX: product suplier tab: last modif date column was wrongly dependant of module barcode * FIX: product suplier tab: last modif date column was wrongly dependant of module barcode, part 2 --- htdocs/product/fournisseurs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 455fbeea600..8516ef2f787 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -959,7 +959,7 @@ END; 'pfp.barcode'=>array('label'=>$langs->trans("BarcodeValue"), 'enabled' => isModEnabled('barcode'), 'checked'=>0, 'position'=>16), 'pfp.packaging'=>array('label'=>$langs->trans("PackagingForThisProduct"), 'enabled' => getDolGlobalInt('PRODUCT_USE_SUPPLIER_PACKAGING'), 'checked'=>0, 'position'=>17), 'pfp.status'=>array('label'=>$langs->trans("Status"), 'enabled' => 1, 'checked'=>0, 'position'=>40), - 'pfp.tms'=>array('label'=>$langs->trans("DateModification"), 'enabled' => isModEnabled('barcode'), 'checked'=>1, 'position'=>50), + 'pfp.tms'=>array('label'=>$langs->trans("DateModification"), 'enabled' => 1, 'checked'=>1, 'position'=>50), ); // fetch optionals attributes and labels From 491ecaccfe4c476257766d00ea4c43b42c1b88b5 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 20 May 2025 20:32:08 +0200 Subject: [PATCH 03/28] FIX: asset depreciation: division by zero (#34218) --- htdocs/asset/class/asset.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index a9763e4fcd6..876600fe448 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -999,7 +999,7 @@ class Asset extends CommonObject //----------------------------------------------------- $nb_days_in_year = !empty($conf->global->ASSET_DEPRECIATION_DURATION_PER_YEAR) ? $conf->global->ASSET_DEPRECIATION_DURATION_PER_YEAR : 365; $nb_days_in_month = !empty($conf->global->ASSET_DEPRECIATION_DURATION_PER_MONTH) ? $conf->global->ASSET_DEPRECIATION_DURATION_PER_MONTH : 30; - $period_amount = (double) price2num($depreciation_period_amount / $fields['duration'], 'MT'); + $period_amount = (float) ($fields['duration'] > 0 ? price2num($depreciation_period_amount / $fields['duration'], 'MT') : 0); $first_period_found = false; $first_period_date = isset($begin_period) && $begin_period > $fiscal_period_start ? $begin_period : $fiscal_period_start; From de40214a09c908d76bbe2b8f552d924c98ac332e Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Tue, 20 May 2025 20:33:31 +0200 Subject: [PATCH 04/28] fix: multi filter journal in accountancy/bookkeeping/list.php and in export (#34217) * fix: filter journal IN * fix: filter journal IN --- htdocs/accountancy/bookkeeping/list.php | 2 +- htdocs/accountancy/class/bookkeeping.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 6337b50f85f..026d2e5b4c9 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -676,7 +676,7 @@ if (count($filter) > 0) { } elseif ($key == 't.reconciled_option') { $sqlwhere[] = 't.lettering_code IS NULL'; } elseif ($key == 't.code_journal' && !empty($value)) { - $sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1); + $sqlwhere[] = natural_search("t.code_journal", join(',', $value), 4, 1); } else { $sqlwhere[] = natural_search($key, $value, 0, 1); } diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 021eabe999e..69d2fba04cd 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1053,7 +1053,7 @@ class BookKeeping extends CommonObject $sqlwhere[] = natural_search($key, $value, 1, 1); } elseif ($key == 't.code_journal' && !empty($value)) { if (is_array($value)) { - $sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1); + $sqlwhere[] = natural_search("t.code_journal", join(',', $value), 4, 1); } else { $sqlwhere[] = natural_search("t.code_journal", $value, 3, 1); } From 4c6955017f6816516dcb4b50b16eb1618929f1b1 Mon Sep 17 00:00:00 2001 From: atm-lucas <121817516+atm-lucasmantegari@users.noreply.github.com> Date: Tue, 20 May 2025 21:47:08 +0200 Subject: [PATCH 05/28] Adding mapping to module rights (#34212) --- htdocs/user/class/user.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index c7feb5d408e..3b383a50be3 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -718,6 +718,7 @@ class User extends CommonObject 'mo' => 'mrp', 'order' => 'commande', 'produit' => 'product', + 'productlot' => 'produit', 'project' => 'projet', 'propale' => 'propal', 'shipping' => 'expedition', From 819c3fd08aee1d86d8c482dc73a94517b5366b94 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 20 May 2025 22:42:34 +0200 Subject: [PATCH 06/28] FIX: accountancy: bad filter on custom account groups (#34205) --- htdocs/accountancy/bookkeeping/export.php | 2 +- htdocs/accountancy/bookkeeping/list.php | 2 +- htdocs/accountancy/bookkeeping/listbyaccount.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/export.php b/htdocs/accountancy/bookkeeping/export.php index e7c97b475b9..665111dc394 100644 --- a/htdocs/accountancy/bookkeeping/export.php +++ b/htdocs/accountancy/bookkeeping/export.php @@ -348,7 +348,7 @@ if (empty($reshook)) { $listofaccountsforgroup2 = array(); if (is_array($listofaccountsforgroup)) { foreach ($listofaccountsforgroup as $tmpval) { - $listofaccountsforgroup2[] = "'".$db->escape($tmpval['id'])."'"; + $listofaccountsforgroup2[] = "'".$db->escape($tmpval['account_number'])."'"; } } $filter['t.search_accounting_code_in'] = join(',', $listofaccountsforgroup2); diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 4583e58fd07..8f67c0ae5a7 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -332,7 +332,7 @@ if (empty($reshook)) { $listofaccountsforgroup2 = array(); if (is_array($listofaccountsforgroup)) { foreach ($listofaccountsforgroup as $tmpval) { - $listofaccountsforgroup2[] = "'".$db->escape($tmpval['id'])."'"; + $listofaccountsforgroup2[] = "'".$db->escape($tmpval['account_number'])."'"; } } $filter['t.search_accounting_code_in'] = join(',', $listofaccountsforgroup2); diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index abdf358ccfc..9ef69b2897a 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -291,7 +291,7 @@ if (empty($reshook)) { $listofaccountsforgroup2 = array(); if (is_array($listofaccountsforgroup)) { foreach ($listofaccountsforgroup as $tmpval) { - $listofaccountsforgroup2[] = "'".$db->escape($tmpval['id'])."'"; + $listofaccountsforgroup2[] = "'".$db->escape($tmpval['account_number'])."'"; } } $filter['t.search_accounting_code_in'] = join(',', $listofaccountsforgroup2); From b47e6abdf59b1a5eba4f14e4f22c2fcccc3eeed4 Mon Sep 17 00:00:00 2001 From: atm-corentin <165782689+atm-corentin@users.noreply.github.com> Date: Thu, 22 May 2025 17:33:57 +0200 Subject: [PATCH 07/28] fix issue when you approve holidays from massaction it does not set date approval (#34231) --- htdocs/core/actions_massactions.inc.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 94e39d68610..3583036a89f 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1631,6 +1631,8 @@ if (!$error && ($massaction == 'approveleave' || ($action == 'approveleave' && $ $objecttmp->date_valid = dol_now(); $objecttmp->fk_user_valid = $user->id; + $objecttmp->date_approval = dol_now(); + $objecttmp->fk_user_approve = $user->id; $objecttmp->status = Holiday::STATUS_APPROVED; $objecttmp->statut = $objecttmp->status; // deprecated From 51e4ce05c9eea9fb4e8a634d27e8afcf09b9e5d7 Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Thu, 22 May 2025 17:40:41 +0200 Subject: [PATCH 08/28] FIX: mandatory extrafelds on lines are not checked (#34228) * FIX: mandatory extrafelds on lines are not checked * FIX: mandatory extrafelds on lines are not checked --- htdocs/comm/propal/class/propal.class.php | 26 +++++++++++++--- htdocs/compta/facture/class/facture.class.php | 31 +++++++++++++++---- .../class/fournisseur.commande.class.php | 2 ++ .../fourn/class/fournisseur.facture.class.php | 15 +++++++-- 4 files changed, 62 insertions(+), 12 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index c2825ff1830..3577ff5f68e 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -4443,8 +4443,17 @@ class PropaleLigne extends CommonObjectLine // End call triggers } - $this->db->commit(); - return 1; + if (!$error) { + $this->db->commit(); + return 1; + } + + foreach ($this->errors as $errmsg) { + dol_syslog(get_class($this)."::insert ".$errmsg, LOG_ERR); + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); + } + $this->db->rollback(); + return -1 * $error; } else { $this->error = $this->db->error()." sql=".$sql; $this->db->rollback(); @@ -4650,8 +4659,17 @@ class PropaleLigne extends CommonObjectLine // End call triggers } - $this->db->commit(); - return 1; + if (!$error) { + $this->db->commit(); + return 1; + } + + foreach ($this->errors as $errmsg) { + dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); + } + $this->db->rollback(); + return -1 * $error; } else { $this->error = $this->db->error(); $this->db->rollback(); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index d7c9191a0f5..4ed4c96a4a0 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -6409,7 +6409,7 @@ class FactureLigne extends CommonInvoiceLine // If fk_remise_except is defined, the discount is linked to the invoice // which flags it as "consumed". - if ($this->fk_remise_except) { + if ($this->fk_remise_except && empty($error)) { $discount = new DiscountAbsolute($this->db); $result = $discount->fetch($this->fk_remise_except); if ($result >= 0) { @@ -6446,7 +6446,7 @@ class FactureLigne extends CommonInvoiceLine } } - if (!$notrigger) { + if (!$notrigger && empty($error)) { // Call trigger $result = $this->call_trigger('LINEBILL_INSERT', $user); if ($result < 0) { @@ -6456,8 +6456,17 @@ class FactureLigne extends CommonInvoiceLine // End call triggers } - $this->db->commit(); - return $this->id; + if (!$error) { + $this->db->commit(); + return $this->id; + } + + foreach ($this->errors as $errmsg) { + dol_syslog(get_class($this)."::insert ".$errmsg, LOG_ERR); + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); + } + $this->db->rollback(); + return -1 * $error; } else { $this->error = $this->db->lasterror(); $this->db->rollback(); @@ -6628,8 +6637,18 @@ class FactureLigne extends CommonInvoiceLine } // End call triggers } - $this->db->commit(); - return 1; + + if (!$error) { + $this->db->commit(); + return 1; + } + + foreach ($this->errors as $errmsg) { + dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); + } + $this->db->rollback(); + return -1 * $error; } else { $this->error = $this->db->error(); $this->db->rollback(); diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index de27129124a..15bad54c10d 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3026,6 +3026,8 @@ class CommandeFournisseur extends CommonOrder $this->db->commit(); return $result; } else { + $this->errors[] = $this->line->error; + $this->errors = array_merge($this->errors, $this->line->errors); $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index f02b938b3b3..7939e10b9a2 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2439,6 +2439,7 @@ class FactureFournisseur extends CommonInvoice if ($res < 1) { $this->errors[] = $line->error; + $this->errors = array_merge($this->errors, $line->errors); } else { // Update total price into invoice record $res = $this->update_price('1', 'auto', 0, $this->thirdparty); @@ -4093,8 +4094,18 @@ class SupplierInvoiceLine extends CommonObjectLine // End call triggers } - $this->db->commit(); - return $this->id; + if (!$error) { + $this->db->commit(); + return $this->id; + } + + foreach ($this->errors as $errmsg) { + dol_syslog(get_class($this)."::insert ".$errmsg, LOG_ERR); + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); + } + + $this->db->rollback(); + return -1 * $error; } else { $this->error = $this->db->error(); $this->db->rollback(); From 09c672661cbc1278489725ab1b18f3f8c116c40d Mon Sep 17 00:00:00 2001 From: atm-corentin <165782689+atm-corentin@users.noreply.github.com> Date: Thu, 22 May 2025 17:44:10 +0200 Subject: [PATCH 09/28] fix issue when you try to attach of file on form ticket (#34227) --- htdocs/ticket/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index cb048260fda..cd1d68d7326 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -189,7 +189,7 @@ if (empty($reshook)) { $action = 'view'; } - if (($action == 'add' || ($action == 'update' && $object->status < Ticket::STATUS_CLOSED)) && $permissiontoadd) { + if (($action == 'add' && GETPOST('save', 'alpha') || ($action == 'update' && $object->status < Ticket::STATUS_CLOSED)) && $permissiontoadd) { $ifErrorAction = $action == 'add' ? 'create' : 'edit'; if ($action == 'add') $object->track_id = null; $error = 0; From cfc766ebbefa6c9c31e1116a407ca112b825f11b Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Thu, 22 May 2025 19:29:49 +0200 Subject: [PATCH 10/28] FIX: accountancy general ledger: last total not shown if last account group shown has only one entry (#34251) --- .../accountancy/bookkeeping/listbyaccount.php | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 9ef69b2897a..d582ab2778f 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -932,6 +932,21 @@ $sous_total_credit = 0; $totalarray['val']['totaldebit'] = 0; $totalarray['val']['totalcredit'] = 0; +$colspan = 0; // colspan before field 'label of operation' +$colspanend = 3; // colspan after debit/credit +if (!empty($arrayfields['t.piece_num']['checked'])) { $colspan++; } +if (!empty($arrayfields['t.code_journal']['checked'])) { $colspan++; } +if (!empty($arrayfields['t.doc_date']['checked'])) { $colspan++; } +if (!empty($arrayfields['t.doc_ref']['checked'])) { $colspan++; } +if (!empty($arrayfields['t.label_operation']['checked'])) { $colspan++; } +if (!empty($arrayfields['t.date_export']['checked'])) { $colspanend++; } +if (!empty($arrayfields['t.date_validated']['checked'])) { $colspanend++; } +if (!empty($arrayfields['t.lettering_code']['checked'])) { $colspanend++; } +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + $colspan++; + $colspanend--; +} + while ($i < min($num, $limit)) { $line = $object->lines[$i]; @@ -945,21 +960,6 @@ while ($i < min($num, $limit)) { } //if (empty($accountg)) $accountg = '-'; - $colspan = 0; // colspan before field 'label of operation' - $colspanend = 3; // colspan after debit/credit - if (!empty($arrayfields['t.piece_num']['checked'])) { $colspan++; } - if (!empty($arrayfields['t.code_journal']['checked'])) { $colspan++; } - if (!empty($arrayfields['t.doc_date']['checked'])) { $colspan++; } - if (!empty($arrayfields['t.doc_ref']['checked'])) { $colspan++; } - if (!empty($arrayfields['t.label_operation']['checked'])) { $colspan++; } - if (!empty($arrayfields['t.date_export']['checked'])) { $colspanend++; } - if (!empty($arrayfields['t.date_validated']['checked'])) { $colspanend++; } - if (!empty($arrayfields['t.lettering_code']['checked'])) { $colspanend++; } - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - $colspan++; - $colspanend--; - } - // Is it a break ? if ($accountg != $displayed_account_number || !isset($displayed_account_number)) { // Show a subtotal by accounting account @@ -1027,8 +1027,6 @@ while ($i < min($num, $limit)) { //if (empty($displayed_account_number)) $displayed_account_number='-'; $sous_total_debit = 0; $sous_total_credit = 0; - - $colspan = 0; } print ''; From a42593db0dd3323369b60c5588f7f7f200b9e6ad Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Thu, 22 May 2025 21:17:58 +0200 Subject: [PATCH 11/28] FIX: asset depreciation: php warnings (#34219) --- htdocs/asset/class/assetdepreciationoptions.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/asset/class/assetdepreciationoptions.class.php b/htdocs/asset/class/assetdepreciationoptions.class.php index 8d52fa1a6a4..6eec3f8033f 100644 --- a/htdocs/asset/class/assetdepreciationoptions.class.php +++ b/htdocs/asset/class/assetdepreciationoptions.class.php @@ -165,7 +165,7 @@ class AssetDepreciationOptions extends CommonObject // Unset required option (notnull) if field disabled if (!empty($field_info['enabled_field'])) { $info = explode(':', $field_info['enabled_field']); - if ($this->deprecation_options[$info[0]][$info[1]] != $info[2] && isset($this->fields[$field_key]['notnull'])) { + if (!empty($this->deprecation_options[$info[0]][$info[1]]) && $this->deprecation_options[$info[0]][$info[1]] != $info[2] && isset($this->fields[$field_key]['notnull'])) { unset($this->fields[$field_key]['notnull']); } } @@ -285,7 +285,7 @@ class AssetDepreciationOptions extends CommonObject foreach ($this->deprecation_options_fields as $mode_key => $mode_info) { if (!empty($mode_info['enabled_field'])) { $info = explode(':', $mode_info['enabled_field']); - if ($deprecation_options[$info[0]][$info[1]] != $info[2]) { + if (!empty($this->deprecation_options[$info[0]][$info[1]]) && $deprecation_options[$info[0]][$info[1]] != $info[2]) { unset($deprecation_options[$info[0]][$info[1]]); } } @@ -356,7 +356,7 @@ class AssetDepreciationOptions extends CommonObject foreach ($this->deprecation_options_fields as $mode_key => $mode_info) { if (!empty($mode_info['enabled_field'])) { $info = explode(':', $mode_info['enabled_field']); - if ($deprecation_options[$info[0]][$info[1]] != $info[2]) { + if (!empty($this->deprecation_options[$info[0]][$info[1]]) && $deprecation_options[$info[0]][$info[1]] != $info[2]) { unset($deprecation_options[$info[0]][$info[1]]); } } @@ -469,7 +469,7 @@ class AssetDepreciationOptions extends CommonObject if (!$error && !empty($this->deprecation_options[$mode_key])) { if (!empty($mode_info['enabled_field'])) { $info = explode(':', $mode_info['enabled_field']); - if ($this->deprecation_options[$info[0]][$info[1]] != $info[2]) { + if (!empty($this->deprecation_options[$info[0]][$info[1]]) && $this->deprecation_options[$info[0]][$info[1]] != $info[2]) { continue; } } From 2e8aac35b7d7022467053a624c307ab893acfc33 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 25 May 2025 20:12:08 +0200 Subject: [PATCH 12/28] FIX mass assignement of sale representative --- htdocs/core/actions_massactions.inc.php | 4 ++-- htdocs/core/tpl/massactions_pre.tpl.php | 2 +- htdocs/langs/en_US/main.lang | 2 +- htdocs/societe/list.php | 5 ++++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 1245dd241b7..b228019df5a 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -778,7 +778,7 @@ if (!$error && $massaction == 'cancelorders') { continue; } - if ($cmd->statut != Commande::STATUS_VALIDATED) { + if ($cmd->status != Commande::STATUS_VALIDATED) { $langs->load('errors'); setEventMessages($langs->trans("ErrorObjectMustHaveStatusValidToBeCanceled", $cmd->ref), null, 'errors'); $error++; @@ -1613,7 +1613,7 @@ if (!$error && $action == 'confirm_edit_value_extrafields' && $confirm == 'yes' } } -if (!$error && ($massaction == 'affectcommercial' || ($action == 'affectcommercial' && $confirm == 'yes')) && $permissiontoadd) { +if (!$error && ($massaction == 'assignsalerepresentative' || ($action == 'assignsalerepresentative' && $confirm == 'yes')) && $permissiontoadd) { $db->begin(); $objecttmp = new $objectclass($db); diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index 2c88eefc570..8d91902c215 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -429,7 +429,7 @@ if ($massaction == 'presetcommercial') { 'name' => 'affectedcommercial', 'label' => $form->editfieldkey('AllocateCommercial', 'commercial_id', '', $object, 0), 'value' => $form->multiselectarray('commercial', $userlist, null, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0, '', '', '', 1)); - print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmAllocateCommercial"), $langs->trans("ConfirmAllocateCommercialQuestion", count($toselect)), "affectcommercial", $formquestion, 1, 0, 200, 500, 1); + print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmAllocateCommercial"), $langs->trans("ConfirmAllocateCommercialQuestion", count($toselect)), "assignsalerepresentative", $formquestion, 1, 0, 200, 500, 1); } if ($massaction == 'unsetcommercial') { $formquestion = array(); diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index d1bfdbc017b..b720bcb7e0b 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1249,7 +1249,7 @@ ConfirmAllocateCommercial=Assign sales representative confirmation ConfirmUnallocateCommercial=Are you sure you want to unassign the sales representative(s) from all selected thirdparties? ConfirmAllocateCommercialQuestion=Are you sure you want to assign the %s selected record(s)? ConfirmUnallocateCommercialQuestion=Are you sure you want to unassign the selected %s record(s)? -CommercialsAffected=Sales representatives assigned +CommercialsAffected=%s sales representatives assigned CommercialAffected=Sales representative assigned CommercialsDisaffected=Sales representatives unlinked CommercialDisaffected=Sales representative unlinked diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 31a24f56e96..e07fcd8cda6 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1213,7 +1213,9 @@ if ($optioncss != '') { } print ''; print ''; -print ''; +if (empty($massaction)) { + print ''; +} print ''; print ''; //print ''; @@ -1238,6 +1240,7 @@ foreach (array(1, 2, 3, 4, 5, 6) as $key) { $label = $langs->transnoentities("ProfId".$key.$mysoc->country_code); $textprofid[$key] = ''; if ($label != "ProfId".$key.$mysoc->country_code) { // Get only text between () + $reg = array(); if (preg_match('/\((.*)\)/i', $label, $reg)) { $label = $reg[1]; } From 27371b639db23f352d4e50cc14078aab9e9dd43f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 25 May 2025 20:13:14 +0200 Subject: [PATCH 13/28] Fix js protection --- htdocs/core/class/html.form.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 7bcc63791cd..f5c2527bd68 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5900,16 +5900,16 @@ class Form $formconfirm .= ' resizable: false, - height: "' . $height . '", - width: "' . $width . '", + height: \'' . ((int) $height) . '\', + width: \'' . ((int) $width) . '\', modal: true, closeOnEscape: false, buttons: { "' . dol_escape_js($langs->transnoentities($labelbuttonyes)) . '": function() { var options = "token=' . urlencode(newToken()) . '"; var inputok = ' . json_encode($inputok) . '; /* List of fields into form */ - var page = "' . dol_escape_js(!empty($page) ? $page : '') . '"; - var pageyes = "' . dol_escape_js(!empty($pageyes) ? $pageyes : '') . '"; + var page = \'' . dol_escape_js(!empty($page) ? $page : '') . '\'; + var pageyes = \'' . dol_escape_js(!empty($pageyes) ? $pageyes : '') . '\'; if (inputok.length > 0) { $.each(inputok, function(i, inputname) { From 5771b6bd1fcb1b9b41e7f1cf95bc6b6acc12f730 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 25 May 2025 20:24:33 +0200 Subject: [PATCH 14/28] Trans --- htdocs/langs/en_US/admin.lang | 2 +- htdocs/langs/fr_FR/admin.lang | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index f3f4c1fc75c..fff8ad06e8f 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2125,7 +2125,7 @@ UserHasNoPermissions=This user has no permissions defined TypeCdr=Use "None" if the date of payment term is date of invoice plus a delta in days (delta is field "%s")
Use "At end of month", if, after delta, the date must be increased to reach the end of month (+ an optional "%s" in days)
Use "Current/Next" to have payment term date being the first Nth of the month after delta (delta is field "%s", N is stored into field "%s") BaseCurrency=Reference currency of the company (go into setup of company to change this) WarningNoteModuleInvoiceForFrenchLaw=This module %s is compliant with French laws (Loi Finance 2016). -WarningNoteModulePOSForFrenchLaw=This module %s is compliant with French laws (Loi Finance 2016) because module Non Reversible Logs is automatically activated. +WarningNoteModulePOSForFrenchLaw=This module %s is technically compliant with French laws (Loi Finance 2016) because module Non Reversible Logs is automatically activated. You must however obtain an attestation or a certificate to be allow to us it. Contact your webhosting provider, your integrator or reseller. WarningInstallationMayBecomeNotCompliantWithLaw=You are trying to install module %s that is an external module. Activating an external module means you trust the publisher of that module and that you are sure that this module does not adversely impact the behavior of your application, and is compliant with laws of your country (%s). If the module introduces an illegal feature, you become responsible for the use of illegal software. WarningExperimentalFeatureInvoiceSituationNeedToUpgradeToProgressiveMode=If you are using the experimental mode for situation invoices, you will need to update your data to switch from the experimental mode to the official mode. You can contact a partner to help you with this task. A list of preferred partners is available by following this link MAIN_PDF_MARGIN_LEFT=Left margin on PDF diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 27d9c09e632..451706a8deb 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -2131,7 +2131,7 @@ UserHasNoPermissions=Cet utilisateur n'a pas de permission définie TypeCdr=Utilisez "Aucune" si la date du terme de paiement est la date de la facture plus un delta en jours (delta est le champ "%s")
Utilisez "À la fin du mois", si, après le delta, la date doit être augmentée pour atteindre la fin du mois (+ un optionnel "%s" en jours)
Utilisez "Courant/Suivant" pour que la date du terme de paiement soit la premier Nième jour du mois après le delta (le delta est le champ "%s", N est stocké dans le champ "%s") BaseCurrency=Devise par défaut de votre société/institution (Voir Accueil > configuration > Société/Institution) WarningNoteModuleInvoiceForFrenchLaw=Ce module %s permet d'être conforme aux lois françaises (Loi Finance 2016 par exemple). -WarningNoteModulePOSForFrenchLaw=Le module %s est conforme à la législation française ( Loi Finance 2016 ) car les logs non réversibles sont automatiquement activés. +WarningNoteModulePOSForFrenchLaw=Le module %s est conforme techniquement à la législation française ( Loi Finance 2016 ) car les logs non réversibles sont automatiquement activés. WarningInstallationMayBecomeNotCompliantWithLaw=Vous tentez d'installer le module %s qui est un module externe. L'activation d'un module externe signifie que vous faites confiance à l'éditeur du module et que vous êtes sûr que ce module ne modifie pas négativement le comportement de votre application et est conforme aux lois de votre pays (%s). Si le module apporte une fonctionnalité illégale, vous devenez responsable pour l'utilisation d'un logiciel illégal. WarningExperimentalFeatureInvoiceSituationNeedToUpgradeToProgressiveMode=Si vous utilisez le mode expérimental pour les factures de situation, vous devrez mettre à jour vos données pour passer du mode expérimental au mode officiel. Vous pouvez contacter un partenaire pour vous aider avec cette tâche. Une liste de partenaires privilégiés est disponible en suivant ce lien MAIN_PDF_MARGIN_LEFT=Marge gauche sur les PDF From 4fb79ba8a1ab79cf42f10cb0e5548e2eb6cc97c5 Mon Sep 17 00:00:00 2001 From: William Mead Date: Tue, 27 May 2025 15:57:48 +0200 Subject: [PATCH 15/28] FIX API expense report line comments (v18+) (#34297) * Fixed API expense report line comments * Added contributor details --- htdocs/api/class/api.class.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 364d6415e83..664b054ebc5 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Laurent Destailleur * Copyright (C) 2020 Frédéric France + * Copyright (C) 2025 William Mead * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -174,14 +175,6 @@ class DolibarrApi unset($object->stats_mrptoconsume); unset($object->stats_mrptoproduce); - unset($object->element); - unset($object->element_for_permission); - unset($object->fk_element); - unset($object->table_element); - unset($object->table_element_line); - unset($object->class_element_line); - unset($object->picto); - unset($object->fieldsforcombobox); unset($object->regeximgext); @@ -202,10 +195,18 @@ class DolibarrApi unset($object->prefix_comm); - if (!isset($object->table_element) || $object->table_element != 'ticket') { + if (!isset($object->table_element) || ! in_array($object->table_element, array('expensereport_det', 'ticket'))) { unset($object->comments); } + unset($object->element); + unset($object->element_for_permission); + unset($object->fk_element); + unset($object->table_element); + unset($object->table_element_line); + unset($object->class_element_line); + unset($object->picto); + // Remove the $oldcopy property because it is not supported by the JSON // encoder. The following error is generated when trying to serialize // it: "Error encoding/decoding JSON: Type is not supported" From 4e95aab6b5a9879df601dc3eb4d9b0d895ff9284 Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Tue, 27 May 2025 15:58:28 +0200 Subject: [PATCH 16/28] fix: On Clone Invoice, ref_customer is not clean (#34296) --- htdocs/compta/facture/class/facture.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 4ed4c96a4a0..3b66ea86e28 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1294,6 +1294,7 @@ class Facture extends CommonInvoice $object->date_modification = ''; $object->date_validation = ''; $object->ref_client = ''; + $object->ref_customer = ''; $object->close_code = ''; $object->close_note = ''; if (getDolGlobalInt('MAIN_DONT_KEEP_NOTE_ON_CLONING') == 1) { From de4990a0fd34c2662ab4d01ac1d29a1a4c1fcb3e Mon Sep 17 00:00:00 2001 From: atm-irvine <165771178+atm-irvine@users.noreply.github.com> Date: Tue, 27 May 2025 16:04:25 +0200 Subject: [PATCH 17/28] Fix fatal error by validating array key type before using in empty() (#34295) --- htdocs/comm/action/class/actioncomm.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index d198de99b1a..5eca0fd136f 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1239,6 +1239,9 @@ class ActionComm extends CommonObject if (!is_array($val)) { // For backward compatibility when val=id $val = array('id' => $val); } + if (!isset($val['id']) || !is_scalar($val['id'])) { + continue; + } if (!empty($already_inserted[$val['id']])) { continue; } From 85d3678948d04e6f3f7368e9f8bbc31841ee995a Mon Sep 17 00:00:00 2001 From: atm-irvine <165771178+atm-irvine@users.noreply.github.com> Date: Tue, 27 May 2025 19:16:39 +0200 Subject: [PATCH 18/28] FIX : Remove useless amp; after & (#34288) --- htdocs/societe/messaging.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/societe/messaging.php b/htdocs/societe/messaging.php index 310a844efbd..1d234902fc5 100644 --- a/htdocs/societe/messaging.php +++ b/htdocs/societe/messaging.php @@ -169,10 +169,10 @@ $out = ''; $permok = $user->hasRight('agenda', 'myactions', 'create'); if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { if (is_object($objthirdparty) && get_class($objthirdparty) == 'Societe') { - $out .= '&originid='.$objthirdparty->id.($objthirdparty->id > 0 ? '&socid='.$objthirdparty->id : '').'&backtopage='.urlencode($_SERVER['PHP_SELF'].($objthirdparty->id > 0 ? '?socid='.$objthirdparty->id : '')); + $out .= '&originid='.$objthirdparty->id.($objthirdparty->id > 0 ? '&socid='.$objthirdparty->id : '').'&backtopage='.urlencode($_SERVER['PHP_SELF'].($objthirdparty->id > 0 ? '?socid='.$objthirdparty->id : '')); } - $out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : ''); - $out .= '&datep='.dol_print_date(dol_now(), 'dayhourlog', 'tzuserrel'); + $out .= (!empty($objcon->id) ? '&contactid='.$objcon->id : ''); + $out .= '&datep='.dol_print_date(dol_now(), 'dayhourlog', 'tzuserrel'); } $morehtmlright = ''; From 0961b0259168d78aee461dccb47c4af1677a22e1 Mon Sep 17 00:00:00 2001 From: atm-irvine <165771178+atm-irvine@users.noreply.github.com> Date: Tue, 27 May 2025 19:17:40 +0200 Subject: [PATCH 19/28] FIX : Tmparray string not array (#34287) --- htdocs/core/tpl/document_actions_post_headers.tpl.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/document_actions_post_headers.tpl.php b/htdocs/core/tpl/document_actions_post_headers.tpl.php index 31c19e08a7c..39e1eeecce0 100644 --- a/htdocs/core/tpl/document_actions_post_headers.tpl.php +++ b/htdocs/core/tpl/document_actions_post_headers.tpl.php @@ -152,8 +152,13 @@ $tmparray = $formfile->form_attach_new_file( 2 ); -$formToUploadAFile = $tmparray['formToUploadAFile']; -$formToAddALink = $tmparray['formToAddALink']; +$formToUploadAFile = ''; +$formToAddALink = ''; + +if (is_array($tmparray) && !empty($tmparray)) { + $formToUploadAFile = $tmparray['formToUploadAFile']; + $formToAddALink = $tmparray['formToAddALink']; +} // List of document From 8f5889b987bfd8345b00825fc7b6ae310a64b8a8 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 27 May 2025 19:27:33 +0200 Subject: [PATCH 20/28] Fix api_members.class.php (#34272) Fix request_data format --- htdocs/adherents/class/api_members.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index a82b5adae05..668c0f74088 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -355,7 +355,7 @@ class Members extends DolibarrApi /** * Create member object * - * @param array $request_data Request data + * @param array $request_data Request data * @phan-param ?array $request_data * @phpstan-param ?array $request_data * @return int ID of member From cd72d947b1dfe09a5eebe35e45278db34787b9e1 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Tue, 27 May 2025 19:28:05 +0200 Subject: [PATCH 21/28] FIX: add payment to bank (#34263) --- htdocs/compta/paiement/class/paiement.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index f21b81f9fa0..b5015aad71d 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -426,8 +426,8 @@ class Paiement extends CommonObject } } - $totalamount = (float) price2num($totalamount); - $totalamount_converted = (float) price2num($totalamount_converted); + $totalamount = (float) price2num($totalamount, 'MT'); + $totalamount_converted = (float) price2num($totalamount_converted, 'MT'); // Check parameters if (empty($totalamount) && empty($atleastonepaymentnotnull)) { // We accept negative amounts for withdraw reject but not empty arrays From 3ec16bdb649b23a025360991767a525d968a43a8 Mon Sep 17 00:00:00 2001 From: atm-irvine <165771178+atm-irvine@users.noreply.github.com> Date: Tue, 27 May 2025 19:29:32 +0200 Subject: [PATCH 22/28] FIX : Missing ol in no escape tags (#34261) --- 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 f03eb738104..0b075958b47 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2144,7 +2144,7 @@ function dolPrintPassword($s) function dol_escape_htmltag($stringtoescape, $keepb = 0, $keepn = 0, $noescapetags = '', $escapeonlyhtmltags = 0, $cleanalsojavascript = 0) { if ($noescapetags == 'common') { - $noescapetags = 'html,body,a,b,em,hr,i,u,ul,li,br,div,img,font,p,span,strong,table,tr,td,th,tbody,h1,h2,h3,h4,h5,h6,h7,h8,h9'; + $noescapetags = 'html,body,a,b,em,hr,i,u,ul,ol,li,br,div,img,font,p,span,strong,table,tr,td,th,tbody,h1,h2,h3,h4,h5,h6,h7,h8,h9'; // Add also html5 tags $noescapetags .= ',header,footer,nav,section,menu,menuitem'; } From 97a26b96b0ac748038d70be079d93e611d4898a7 Mon Sep 17 00:00:00 2001 From: atm-irvine <165771178+atm-irvine@users.noreply.github.com> Date: Tue, 27 May 2025 19:30:09 +0200 Subject: [PATCH 23/28] fix(ticket): on card, id 20 was clearly entered (#34259) --- htdocs/ticket/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 9a1299478d8..78ba45374ff 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -926,7 +926,7 @@ if ($action == 'create' || $action == 'presend') { $morehtmlref .= '
'; $morehtmlref .= ''; $morehtmlref .= ''; - $morehtmlref .= ''; + $morehtmlref .= ''; $morehtmlref .= ''; $morehtmlref .= ''; $morehtmlref .= ''; From fe4b1ff34dd5fbafca706271cf41109d7f0dfaec Mon Sep 17 00:00:00 2001 From: ThomasNgr-OpenDSI Date: Tue, 27 May 2025 20:16:41 +0200 Subject: [PATCH 24/28] =?UTF-8?q?FIX=20modification=20de=20dates=20de=20pi?= =?UTF-8?q?=C3=A8ces=20comptables=20sur=20plusieurs=20entit=C3=A9s=20diff?= =?UTF-8?q?=C3=A9rentes=20(#34226)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/accountancy/class/bookkeeping.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index db98ac28177..fc210f0310e 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1399,6 +1399,7 @@ class BookKeeping extends CommonObject */ public function updateByMvt($piece_num = '', $field = '', $value = '', $mode = '') { + global $conf; $error = 0; $this->db->begin(); @@ -1406,6 +1407,7 @@ class BookKeeping extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element.$mode; $sql .= " SET ".$field." = ".(is_numeric($value) ? ((float) $value) : "'".$this->db->escape($value)."'"); $sql .= " WHERE piece_num = ".((int) $piece_num); + $sql .= " AND entity = " . ((int) $conf->entity); $resql = $this->db->query($sql); From d2d95900198b201dbc287d1f0b023107595b5c6d Mon Sep 17 00:00:00 2001 From: Eric - CAP-REL <1468823+rycks@users.noreply.github.com> Date: Tue, 27 May 2025 21:16:38 +0200 Subject: [PATCH 25/28] Fix to make protection ok when no stock and (#34207) STOCK_ALLOW_NEGATIVE_TRANSFER on Co-authored-by: Laurent Destailleur --- htdocs/comm/action/class/actioncomm.class.php | 133 +++++++++--------- 1 file changed, 69 insertions(+), 64 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index f75bf073e1e..575fc307d0d 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -2519,82 +2519,87 @@ class ActionComm extends CommonObject // Load event $res = $this->fetch($actionCommReminder->fk_actioncomm); - if ($res > 0) $res = $this->fetch_thirdparty(); if ($res > 0) { - // PREPARE EMAIL - $errormesg = ''; + $res2 = $this->fetch_thirdparty(); + if ($res2 >= 0) { + // PREPARE EMAIL + $errormesg = ''; - // Make substitution in email content - $substitutionarray = getCommonSubstitutionArray($langs, 0, '', $this); + // Make substitution in email content + $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $this); - complete_substitutions_array($substitutionarray, $langs, $this); + complete_substitutions_array($substitutionarray, $langs, $this); - // Content - $sendContent = make_substitutions($langs->trans($arraymessage->content), $substitutionarray); + // Content + $sendContent = make_substitutions($langs->trans($arraymessage->content), $substitutionarray); - //Topic - $sendTopic = (!empty($arraymessage->topic)) ? $arraymessage->topic : html_entity_decode($langs->transnoentities('EventReminder')); + //Topic + $sendTopic = (!empty($arraymessage->topic)) ? $arraymessage->topic : html_entity_decode($langs->transnoentities('EventReminder')); - // Recipient - $recipient = new User($this->db); - $res = $recipient->fetch($actionCommReminder->fk_user); - if ($res > 0) { - if (!empty($recipient->email)) { - $to = $recipient->email; + // Recipient + $recipient = new User($this->db); + $res = $recipient->fetch($actionCommReminder->fk_user); + if ($res > 0) { + if (!empty($recipient->email)) { + $to = $recipient->email; + } else { + $errormesg = "Failed to send remind to user id=".$actionCommReminder->fk_user.". No email defined for user."; + $error++; + } } else { - $errormesg = "Failed to send remind to user id=".$actionCommReminder->fk_user.". No email defined for user."; + $errormesg = "Failed to load recipient with user id=".$actionCommReminder->fk_user; $error++; } + + // Sender + $from = getDolGlobalString('MAIN_MAIL_EMAIL_FROM'); + if (empty($from)) { + $errormesg = "Failed to get sender into global setup MAIN_MAIL_EMAIL_FROM"; + $error++; + } + + if (!$error) { + // Errors Recipient + $errors_to = getDolGlobalString('MAIN_MAIL_ERRORS_TO'); + + // Mail Creation + $cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, array(), array(), array(), '', "", 0, 1, $errors_to, '', '', '', '', ''); + + // Sending Mail + if ($cMailFile->sendfile()) { + $nbMailSend++; + } else { + $errormesg = 'Failed to send email to: '.$to.' '.$cMailFile->error.implode(',', $cMailFile->errors); + $error++; + } + } + + if (!$error) { + $actionCommReminder->status = $actionCommReminder::STATUS_DONE; + + $res = $actionCommReminder->update($user); + if ($res < 0) { + $errorsMsg[] = "Failed to update status to done of ActionComm Reminder"; + $error++; + break; // This is to avoid to have this error on all the selected email. If we fails here for one record, it may fails for others. We must solve first. + } + } else { + $actionCommReminder->status = $actionCommReminder::STATUS_ERROR; + $actionCommReminder->lasterror = dol_trunc($errormesg, 128, 'right', 'UTF-8', 1); + + $res = $actionCommReminder->update($user); + if ($res < 0) { + $errorsMsg[] = "Failed to update status to error of ActionComm Reminder"; + $error++; + break; // This is to avoid to have this error on all the selected email. If we fails here for one record, it may fails for others. We must solve first. + } else { + $errorsMsg[] = $errormesg; + } + } } else { - $errormesg = "Failed to load recipient with user id=".$actionCommReminder->fk_user; + $errorsMsg[] = 'Failed to fetch record thirdparty on actioncomm with ID = '.$actionCommReminder->fk_actioncomm; $error++; } - - // Sender - $from = getDolGlobalString('MAIN_MAIL_EMAIL_FROM'); - if (empty($from)) { - $errormesg = "Failed to get sender into global setup MAIN_MAIL_EMAIL_FROM"; - $error++; - } - - if (!$error) { - // Errors Recipient - $errors_to = getDolGlobalString('MAIN_MAIL_ERRORS_TO'); - - // Mail Creation - $cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, array(), array(), array(), '', "", 0, 1, $errors_to, '', '', '', '', ''); - - // Sending Mail - if ($cMailFile->sendfile()) { - $nbMailSend++; - } else { - $errormesg = 'Failed to send email to: '.$to.' '.$cMailFile->error.join(',', $cMailFile->errors); - $error++; - } - } - - if (!$error) { - $actionCommReminder->status = $actionCommReminder::STATUS_DONE; - - $res = $actionCommReminder->update($user); - if ($res < 0) { - $errorsMsg[] = "Failed to update status to done of ActionComm Reminder"; - $error++; - break; // This is to avoid to have this error on all the selected email. If we fails here for one record, it may fails for others. We must solve first. - } - } else { - $actionCommReminder->status = $actionCommReminder::STATUS_ERROR; - $actionCommReminder->lasterror = dol_trunc($errormesg, 128, 'right', 'UTF-8', 1); - - $res = $actionCommReminder->update($user); - if ($res < 0) { - $errorsMsg[] = "Failed to update status to error of ActionComm Reminder"; - $error++; - break; // This is to avoid to have this error on all the selected email. If we fails here for one record, it may fails for others. We must solve first. - } else { - $errorsMsg[] = $errormesg; - } - } } else { $errorsMsg[] = 'Failed to fetch record actioncomm with ID = '.$actionCommReminder->fk_actioncomm; $error++; From 26bcc944cf6035d97477a65a74b20b2406a16a60 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 27 May 2025 21:23:16 +0200 Subject: [PATCH 26/28] FIX: projects: go back to edit view after cloning (#34221) * FIX: projects: go back to edit view after cloning * FIX: projects: go back to edit view after cloning --- htdocs/projet/card.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 6bd1de90ffb..70760678b9e 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -496,14 +496,11 @@ if (empty($reshook)) { // Load new object $newobject = new Project($db); $newobject->fetch($result); - $newobject->fetch_optionals(); - $newobject->fetch_thirdparty(); // Load new object - $object = $newobject; - $action = 'view'; - $comefromclone = true; setEventMessages($langs->trans("ProjectCreatedInDolibarr", $newobject->ref), "", 'mesgs'); - //var_dump($newobject); exit; + + header('Location: '.$_SERVER['PHP_SELF'].'?id='.$result.'&action=edit&comefromclone=1'); + exit; } } From 1d07ed22c06bbe3dc24092d060841456a48147e5 Mon Sep 17 00:00:00 2001 From: Sami Filali <139965072+samifilali@users.noreply.github.com> Date: Tue, 27 May 2025 21:51:09 +0200 Subject: [PATCH 27/28] update "enabled" to 1 for fk_emailcollector fields (#34192) --- htdocs/emailcollector/class/emailcollectoraction.class.php | 2 +- htdocs/emailcollector/class/emailcollectorfilter.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollectoraction.class.php b/htdocs/emailcollector/class/emailcollectoraction.class.php index 198d5ed878f..3d58c5e154a 100644 --- a/htdocs/emailcollector/class/emailcollectoraction.class.php +++ b/htdocs/emailcollector/class/emailcollectoraction.class.php @@ -73,7 +73,7 @@ class EmailCollectorAction extends CommonObject */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), - 'fk_emailcollector' => array('type' => 'integer', 'label' => 'Id of emailcollector', 'enabled' => 0, 'visible' => 0, 'foreignkey' => 'emailcollector.rowid', 'position' => 0,), + 'fk_emailcollector' => array('type' => 'integer', 'label' => 'Id of emailcollector', 'enabled' => 1, 'visible' => 0, 'foreignkey' => 'emailcollector.rowid', 'position' => 0,), 'type' => array('type' => 'varchar(128)', 'label' => 'Type', 'enabled' => 1, 'visible' => 1, 'position' => 10, 'notnull' => 1, 'index' => 1), 'actionparam' => array('type' => 'text', 'label' => 'ParamForAction', 'enabled' => 1, 'visible' => 1, 'position' => 40, 'notnull' => -1), 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -2, 'position' => 500, 'notnull' => 1,), diff --git a/htdocs/emailcollector/class/emailcollectorfilter.class.php b/htdocs/emailcollector/class/emailcollectorfilter.class.php index dc32722847e..bbe47138cc8 100644 --- a/htdocs/emailcollector/class/emailcollectorfilter.class.php +++ b/htdocs/emailcollector/class/emailcollectorfilter.class.php @@ -75,7 +75,7 @@ class EmailCollectorFilter extends CommonObject */ public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'position' => 1, 'notnull' => 1, 'index' => 1, 'comment' => "Id",), - 'fk_emailcollector' => array('type' => 'integer', 'label' => 'Id of emailcollector', 'enabled' => 0, 'visible' => 0, 'foreignkey' => 'emailcollector.rowid', 'position' => 0), + 'fk_emailcollector' => array('type' => 'integer', 'label' => 'Id of emailcollector', 'enabled' => 1, 'visible' => 0, 'foreignkey' => 'emailcollector.rowid', 'position' => 0), 'type' => array('type' => 'varchar(128)', 'label' => 'Type', 'enabled' => 1, 'visible' => 1, 'position' => 10, 'notnull' => 1,), 'rulevalue' => array('type' => 'varchar(255)', 'label' => 'ValueOfRule', 'enabled' => 1, 'visible' => 1, 'position' => 30, 'notnull' => -1, 'help' => "Value of Rule",), 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -2, 'position' => 500, 'notnull' => 1,), From a151e3d7b582afff65249caa46d31ddd5fe30eb9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Jun 2025 00:10:36 +0200 Subject: [PATCH 28/28] Fix url for barcode of profile should use securekey. --- htdocs/public/users/view.php | 10 +++++++++- htdocs/viewimage.php | 26 ++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/htdocs/public/users/view.php b/htdocs/public/users/view.php index 94c94a778f7..c28f16455e9 100644 --- a/htdocs/public/users/view.php +++ b/htdocs/public/users/view.php @@ -307,6 +307,7 @@ if (getDolGlobalString('USER_IMAGE_PUBLIC_INTERFACE')) { print ''; } +// url for the download .vcf file link $urlforqrcode = $object->getOnlineVirtualCardUrl('vcard'); $socialnetworksdict = getArrayOfSocialNetworks(); @@ -319,10 +320,17 @@ if ($showbarcode) { $filename = $v->buildVCardString($object, $company, $langs, '', $outdir); + $encodedsecurekey = dol_hash($conf->file->instance_unique_id.'uservirtualcard'.$object->id.'-'.$object->login, 'md5'); + if (isModEnabled('multicompany')) { + $entity_qr = '&entity='.((int) $conf->entity); + } else { + $entity_qr = ''; + } + print '
'; print '
'; //print ''; - print ''; + print ''; print '
'; print '
'; } diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index 899fffa181b..1be3dc656b8 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -353,14 +353,32 @@ if ($modulepart == 'barcode') { $reg = array(); if (preg_match('/^virtualcard_([^_]+)_(\d+)\.vcf$/', $code, $reg)) { $vcffile = ''; - if ($reg[1] == 'user') { + $id = 0; + $login = ''; + if ($reg[1] == 'user' && (int) $reg[2] > 0) { $vcffile = $conf->user->dir_temp.'/'.$code; - } elseif ($reg[1] == 'contact') { + $id = (int) $reg[2]; + $tmpuser = new User($db); + $tmpuser->fetch($id); + $login = $tmpuser->login; + } elseif ($reg[1] == 'contact' && (int) $reg[2] > 0) { $vcffile = $conf->contact->dir_temp.'/'.$code; + $id = (int) $reg[2]; } - if ($vcffile) { - $code = file_get_contents($vcffile); + $code = ''; + if ($vcffile && $id) { + // Case of use of viewimage to get the barcode for user pubic profile, + // we must check the securekey that protet against forging url + if ($reg[1] == 'user' && (int) $reg[2] > 0) { + $encodedsecurekey = dol_hash($conf->file->instance_unique_id.'uservirtualcard'.$id.'-'.$login, 'md5'); + if ($encodedsecurekey != GETPOST('securekey')) { + $code = 'badvalueforsecurekey'; + } + } + if (empty($code)) { + $code = file_get_contents($vcffile); + } } }