From e0a3756c6e00948aab2b8bd79c870b9359773901 Mon Sep 17 00:00:00 2001 From: lvessiller-opendsi Date: Wed, 30 Oct 2024 23:35:39 +0100 Subject: [PATCH 01/16] FIX update status on create supplier order for trigger (#31642) --- htdocs/fourn/class/fournisseur.commande.class.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 49948ebba06d1..50a5ca627579d 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1291,6 +1291,8 @@ public function create($user, $notrigger = 0) { global $langs, $conf, $hookmanager; + $this->oldcopy = dol_clone($this, 2); + $this->db->begin(); $error = 0; @@ -1322,6 +1324,8 @@ public function create($user, $notrigger = 0) // We set order into draft status $this->brouillon = 1; + $this->statut = self::STATUS_DRAFT; + $this->status = self::STATUS_DRAFT; $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseur ("; $sql .= "ref"; @@ -1410,6 +1414,8 @@ public function create($user, $notrigger = 0) ); if ($result < 0) { dol_syslog(get_class($this)."::create ".$this->error, LOG_WARNING); // do not use dol_print_error here as it may be a functionnal error + $this->statut = $this->oldcopy->statut; + $this->status = $this->oldcopy->status; $this->db->rollback(); return -1; } @@ -1463,6 +1469,8 @@ public function create($user, $notrigger = 0) // Call trigger $result = $this->call_trigger('ORDER_SUPPLIER_CREATE', $user); if ($result < 0) { + $this->statut = $this->oldcopy->statut; + $this->status = $this->oldcopy->status; $this->db->rollback(); return -1; } @@ -1473,12 +1481,16 @@ public function create($user, $notrigger = 0) return $this->id; } else { $this->error = $this->db->lasterror(); + $this->statut = $this->oldcopy->statut; + $this->status = $this->oldcopy->status; $this->db->rollback(); return -2; } } } else { $this->error = $this->db->lasterror(); + $this->statut = $this->oldcopy->statut; + $this->status = $this->oldcopy->status; $this->db->rollback(); return -1; } From 8a55e2f6a4fde700485776d7eed4e482daba0742 Mon Sep 17 00:00:00 2001 From: lvessiller-opendsi Date: Fri, 8 Nov 2024 17:51:44 +0100 Subject: [PATCH 02/16] FIX old copy not needed in supplier order create method (#31733) --- htdocs/fourn/class/fournisseur.commande.class.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 50a5ca627579d..020b551f99a6b 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1291,8 +1291,6 @@ public function create($user, $notrigger = 0) { global $langs, $conf, $hookmanager; - $this->oldcopy = dol_clone($this, 2); - $this->db->begin(); $error = 0; @@ -1324,7 +1322,7 @@ public function create($user, $notrigger = 0) // We set order into draft status $this->brouillon = 1; - $this->statut = self::STATUS_DRAFT; + $this->statut = self::STATUS_DRAFT; // deprecated $this->status = self::STATUS_DRAFT; $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseur ("; @@ -1414,8 +1412,6 @@ public function create($user, $notrigger = 0) ); if ($result < 0) { dol_syslog(get_class($this)."::create ".$this->error, LOG_WARNING); // do not use dol_print_error here as it may be a functionnal error - $this->statut = $this->oldcopy->statut; - $this->status = $this->oldcopy->status; $this->db->rollback(); return -1; } @@ -1469,8 +1465,6 @@ public function create($user, $notrigger = 0) // Call trigger $result = $this->call_trigger('ORDER_SUPPLIER_CREATE', $user); if ($result < 0) { - $this->statut = $this->oldcopy->statut; - $this->status = $this->oldcopy->status; $this->db->rollback(); return -1; } @@ -1481,16 +1475,12 @@ public function create($user, $notrigger = 0) return $this->id; } else { $this->error = $this->db->lasterror(); - $this->statut = $this->oldcopy->statut; - $this->status = $this->oldcopy->status; $this->db->rollback(); return -2; } } } else { $this->error = $this->db->lasterror(); - $this->statut = $this->oldcopy->statut; - $this->status = $this->oldcopy->status; $this->db->rollback(); return -1; } From d3b9a83055ec691b8350972f1ce47692958be331 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Nov 2024 10:56:14 +0100 Subject: [PATCH 03/16] Fix changelog --- ChangeLog | 133 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) diff --git a/ChangeLog b/ChangeLog index d9dc46ca7c492..e498cf311215e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,139 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 18.0.6 compared to 18.0.5 ***** +FIX: 16.0 - parent company gets emptied when updating a third party from the card in edit mode (#28269) +FIX: 16.0 - the e-mail templates configured in the notification module are not used if the recipient is a fixed e-mail address (#29407) +FIX: 17.0: $num doesn't take trigger-modified newref into account, leading to inconsistencies if BILL_SUPPLIER_VALIDATE changes the invoice's ref (#28684) +FIX: 17.0: fatal when updating recurring supplier invoice line with php8 ($remise_percent is '' instead of 0) (#31713) +FIX: 17.0: supplier invoice template card: buyer and seller swapped in VAT-related function calls (probably a copy-paste from customer invoice templates) (#31446) +FIX: #24265 regression cannot see all product on takepos (#28753) +FIX: #25853 Thirdparty Massaction (#25868) +FIX: #28205 +FIX: #28251 Fixing subpermission name on api_multicurrencies.class.php (#28252) +FIX: #28369 +FIX: #28518 (#28520) +FIX: #28978 FIX: #28976 +FIX: #29029 Impossible to delete an order line +FIX: #29114 Missing contact term in intervention +FIX: #29114 Translate contact term in intervention +FIX: #29439 incomplete API return (#29796) +FIX: #29496 filtering a record should not hide its child not filtered +FIX: #30010 Use conf TICKET_MESSAGE_MAIL_INTRO instead of translation key (#30081) +FIX: #30274 Add the include before executing dolibarr_set_const (#30320) +FIX: #30467 +FIX: #30768 allocate the correct invoice_line_id to the element timespent (#30769) +FIX: Accountancy export with file or not +FIX: Accountancy - Generate entries of expense report with localtax (#30411) +FIX: Accountancy - Not trunc id_import +FIX: accounting FEC import (Issue #28306) (#29414) +FIX: Add new hidden conf "DISABLE_QTY_OVERWRITTEN" (#28523) +FIX: Add same security test whe nuploading files from API than from GUI (#31114) +FIX: Amount of localtaxes in foreign currency was wrong on screen and PDF +FIX: an error in a complex else condition +FIX: ASSET: annual depreciation starting year (Again ;-)) #26084 (#30040) +FIX: avoid error "Column 'entity' in where clause is ambiguous" (#28270) +FIX: avoid from re-initializing array result on nested hook getEntity (#30626) +FIX: avoid php warnings (#29247) +FIX: avoid to delete "lock" and "unlock" files +FIX: avoid Unknown column 'pfp.ref_fourn' (#28145) +FIX: background color for enabled modules (#29378) +FIX: Backport fix fatal error on price with some truncating setup +FIX: Backport page inventory.php from v18 to fix pagination bugs causing data loss (#29688) +FIX: back to page on error in contact card (#29627) +FIX: Bad calculation of $nbtotalofrecord (#30183) +FIX: box_actions.php still uses fk_user_done which no longer exists (#31190) +FIX: can validate shipment without stock movement (#31780) +FIX: Condition on newDateLimReglement +FIX: Conflict with autoload (#30399) +FIX: const WORKFLOW_RECEPTION_CLASSIFY_NEWD_INVOICE (#31601) +FIX: contact/address title is always "New Contact/Address" even if the contact/address already exists (#29581) +FIX: Display the date according to user language on subsitutions (#29510) +FIX: Display the real_PMP on inventory when its value is equal to 0 (#22291) +FIX: Don't display column when it's out of date (#28271) +FIX: email templates for expense report not visible +FIX: Error mesg show untranslated extrafield name (#30227) +FIX: Error message overwrited when a error occurs during update of product multilangs (#30841) +FIX: Error When cloning fourn price no default value for tva_tx (#28368) +FIX: executeHooks $object default value (#29647) +FIX: expedition PDF models using units labels (#30358) +FIX: Extrafield following between rec invoice and classic invoice (#31445) +FIX: fatal error on loading pictures in attached documents of an event (#30553) +FIX: fatal error Unsupported operand types when recording load payment +FIX: Fix bug select columns and acces to the public ticket list from the public ticket card (case when we have connected to another client before, the track id stocked in session overwrite the new track id from the public ticket card) (#31000) +FIX: Fix create shipping with product who have negative stocks on warehouse but the negative stock transfert is allowed (#26217) +FIX: Fix save directory for invoice ODT and multientities +FIX: group by qty in product margin tab (#29853) +FIX: Hierarchy Employee view do not filter on employee = 1 (#29496) +FIX: if you call fetchLines several times, your $object->lines contains duplicates (#31167) +FIX: If you have no stock of your product, an error is displayed when you delete the reception. (#31504) +FIX: incorrect page numbering in PDF #29458 (#29476) +FIX: inventoryDeletePermission id define twice +FIX: issue on action set condition in particular when you set a deposi… (#31518) +FIX: issue to get the right files exported in Quadratrus export.php (#30004) +FIX: lang output for sales representative on PDF (#30469) +FIX: late order search option (#30692) and propal (#30687) +FIX: lettering (auto) for invoice deposit with company discount (#29633) +FIX: made invalid code shape error more user friendly (#29498) +FIX: Merge of thirdparties must also move uploaded files +FIX: missing entity parameter for ajax_constantonoff +FIX: missing hide "new" button where "product" or "service" module are disable +FIX: mo cloning (#29686) +FIX: modification date from label in accounting bookkeeping list (#30038) +FIX: Move the trigger for delete order line before the SQL request +FIX: multiple problems with multicompany +FIX: mysql error during dump for enable sandbox M999999 (#31116) +FIX: notification: error 500 in fixed emails due to a bad copy/paste (#29580) +FIX: notification module: for supplier orders (any of the 3 triggers), user can choose an e-mail template in conf, but the conf is not used when sending the notification (#28216) +FIX: Not qualified lines for reception (#29473) +FIX: not redirtect when error occurs on updating card (#29388) +FIX: Not trancate the multicurrency rate shown on cards (even if the global MAIN_MAX_DECIMALS_SHOWN is set to 0) (#28211) +FIX: on change ref for bank account attachement are lost (#30529) +FIX: Option MAIN_DOC_USE_TIMING can be a string with date format +FIX: orders to bill menu (#30179) +FIX: Payment on customer invoice - Remove accountid in url if empty for apply default value (#28156) +FIX: PDF Fatal error : Backport fix from #23972 +FIX: PDF Translations Extrafields +FIX: permission on payment file of a tax +FIX: php8: Fatal when empty $tmpvat is an empty string (no silent conversion to '0' when used in arithmetic operations) (#29451) +FIX: PHP 8 warning on output of successful cronjob (#29922) +FIX: PHP exception on getSpecialCode (#29646) +FIX: php warning global conf (#29478) +FIX: pos: invoice date incorrectly set beacause of timezome mismatches (reverts #36e91da) (#30184) +FIX: public project form return an error if SOCIETE_EMAIL_UNIQUE (#29942) +FIX: purge files cron: php warnings when rest module enabled (#30919) +FIX: PUT /thirdparties/{id} and PUT /contacts/{id} should throw exception if update returns < 0 (#29596) +FIX: Regression #29340 +FIX: Repair the replenishment list (#29336) +FIX: REPLENISH MANY FOURN WHEN ORDER ALREADY CREATE (#29710) +FIX: round capital societe (#29211) +FIX: search and add extrafields to tasks when conf disabled (#29542) +FIX: show preview pdf list expensereport (#31694) +FIX: sometimes a string type instead integer is return, why ? +FIX: Special code is now transmitted by args only in order supplier (#28546) (#28619) +FIX: SQL syntax error in DDLUpdateField +FIX: subscription must be editable when accounting isn't reconciled (#28469) +FIX: substitutions THIRDPARTY_XXX are not available for actioncomm reminders (#31385) +FIX: Supplier Order search on date valid (#30448) +FIX: supplier price duplicate entry on update supplier product ref (#29290) +FIX: syntax error +FIX: TakePOS | Add product / Delete line of existing invoice +FIX: Ticket new message notification sent twice +FIX: transfer in accountancy for expense reports. +FIX: Unsigned propal having signing date (#29825) +FIX: Update asset.class.php +FIX: update date_echeance of supplier invoices when we update invoice date in the past (#29886) +FIX: use $conf->browser->os instead +FIX: use price() to display qty on a product's stats tab to avoid showing too many decimals when rounding errors are possible (#31165) +FIX: User List - Function is show in wrong column when module HRM enabled (#30186) +fix: when invoice is created by WORKFLOW_ORDER_AUTOCREATE_INVOICE on ORDER_NEW, the invoice must have the default bank account of the thirdparty is it's empty on order (#29462) +FIX: when qty is not an integer, apply price() (#31138) +FIX: Wrong currency shown in TakePOS payment page +FIX: wrong shortcut key for macintosh +FIX: wrong sql request with product category filter +FIX: wrong stock permission number + + ***** ChangeLog for 18.0.5 compared to 18.0.4 ***** FIX: 17.0: deprecated field should only be a fallback FIX: 17.0 - php8 warnings: test for $field existence before checking if it is null or empty From d5add8aa49d84fb847ccfee6301711785ddc55e4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Nov 2024 10:56:56 +0100 Subject: [PATCH 04/16] typo --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e498cf311215e..cffd1e583bc61 100644 --- a/ChangeLog +++ b/ChangeLog @@ -87,7 +87,7 @@ FIX: mysql error during dump for enable sandbox M999999 (#31116) FIX: notification: error 500 in fixed emails due to a bad copy/paste (#29580) FIX: notification module: for supplier orders (any of the 3 triggers), user can choose an e-mail template in conf, but the conf is not used when sending the notification (#28216) FIX: Not qualified lines for reception (#29473) -FIX: not redirtect when error occurs on updating card (#29388) +FIX: not redirect when error occurs on updating card (#29388) FIX: Not trancate the multicurrency rate shown on cards (even if the global MAIN_MAX_DECIMALS_SHOWN is set to 0) (#28211) FIX: on change ref for bank account attachement are lost (#30529) FIX: Option MAIN_DOC_USE_TIMING can be a string with date format From 29ef86a245740b93b96147cf5bf6a783b24c5c3f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Nov 2024 11:51:32 +0100 Subject: [PATCH 05/16] Typo --- ChangeLog | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index cffd1e583bc61..ce5766b2013b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -29,7 +29,7 @@ FIX: Accountancy - Generate entries of expense report with localtax (#30411) FIX: Accountancy - Not trunc id_import FIX: accounting FEC import (Issue #28306) (#29414) FIX: Add new hidden conf "DISABLE_QTY_OVERWRITTEN" (#28523) -FIX: Add same security test whe nuploading files from API than from GUI (#31114) +FIX: Add same security test when uploading files from API than from GUI (#31114) FIX: Amount of localtaxes in foreign currency was wrong on screen and PDF FIX: an error in a complex else condition FIX: ASSET: annual depreciation starting year (Again ;-)) #26084 (#30040) @@ -49,19 +49,19 @@ FIX: Condition on newDateLimReglement FIX: Conflict with autoload (#30399) FIX: const WORKFLOW_RECEPTION_CLASSIFY_NEWD_INVOICE (#31601) FIX: contact/address title is always "New Contact/Address" even if the contact/address already exists (#29581) -FIX: Display the date according to user language on subsitutions (#29510) +FIX: Display the date according to user language on substitutions (#29510) FIX: Display the real_PMP on inventory when its value is equal to 0 (#22291) FIX: Don't display column when it's out of date (#28271) FIX: email templates for expense report not visible FIX: Error mesg show untranslated extrafield name (#30227) -FIX: Error message overwrited when a error occurs during update of product multilangs (#30841) +FIX: Error message overwrote when a error occurs during update of product multilangs (#30841) FIX: Error When cloning fourn price no default value for tva_tx (#28368) FIX: executeHooks $object default value (#29647) FIX: expedition PDF models using units labels (#30358) FIX: Extrafield following between rec invoice and classic invoice (#31445) FIX: fatal error on loading pictures in attached documents of an event (#30553) FIX: fatal error Unsupported operand types when recording load payment -FIX: Fix bug select columns and acces to the public ticket list from the public ticket card (case when we have connected to another client before, the track id stocked in session overwrite the new track id from the public ticket card) (#31000) +FIX: Fix bug select columns and access to the public ticket list from the public ticket card (case when we have connected to another client before, the track id stocked in session overwrite the new track id from the public ticket card) (#31000) FIX: Fix create shipping with product who have negative stocks on warehouse but the negative stock transfert is allowed (#26217) FIX: Fix save directory for invoice ODT and multientities FIX: group by qty in product margin tab (#29853) @@ -89,7 +89,7 @@ FIX: notification module: for supplier orders (any of the 3 triggers), user can FIX: Not qualified lines for reception (#29473) FIX: not redirect when error occurs on updating card (#29388) FIX: Not trancate the multicurrency rate shown on cards (even if the global MAIN_MAX_DECIMALS_SHOWN is set to 0) (#28211) -FIX: on change ref for bank account attachement are lost (#30529) +FIX: on change ref for bank account attachment are lost (#30529) FIX: Option MAIN_DOC_USE_TIMING can be a string with date format FIX: orders to bill menu (#30179) FIX: Payment on customer invoice - Remove accountid in url if empty for apply default value (#28156) @@ -100,7 +100,7 @@ FIX: php8: Fatal when empty $tmpvat is an empty string (no silent conversion to FIX: PHP 8 warning on output of successful cronjob (#29922) FIX: PHP exception on getSpecialCode (#29646) FIX: php warning global conf (#29478) -FIX: pos: invoice date incorrectly set beacause of timezome mismatches (reverts #36e91da) (#30184) +FIX: pos: invoice date incorrectly set because of timezome mismatches (reverts #36e91da) (#30184) FIX: public project form return an error if SOCIETE_EMAIL_UNIQUE (#29942) FIX: purge files cron: php warnings when rest module enabled (#30919) FIX: PUT /thirdparties/{id} and PUT /contacts/{id} should throw exception if update returns < 0 (#29596) @@ -499,7 +499,7 @@ NEW: No overwrite of optionals during put() contact NEW: Notifications: add Customer Order delivered (ORDER_NEW) in module Notification NEW: Notifications: for Sign or Refused Propal from Online Page NEW: Now we can edit amount on VAT and salaries clone action -NEW: only get openned contact from liste_contact function, to not have acces to closed contact as mail receiver +NEW: only get openned contact from liste_contact function, to not have access to closed contact as mail receiver NEW: Option to manage deposit slips for more payment modes (not only NEW: Option to show column for field and line selection on the left NEW: Orders: add sub total in order list det @@ -2744,7 +2744,7 @@ NEW: add quick dropdown menu in top right menu (experimental with MAIN_USE_TOP_M NEW: add region in export companies and contacts NEW: add rights on margin info on invoice list NEW: add search param for close date on order list -NEW: add show preview for mail attachement on form mail +NEW: add show preview for mail attachment on form mail NEW: add State/Province origin for products NEW: add the workflow interaction close intervention on closing ticket NEW: add tracking number in list and search_all items @@ -4129,7 +4129,7 @@ FIX: access to public interface when origin email has an alias. FIX: Alias name is not into the email recipient label. FIX: allow standalone credit note even if no invoice FIX: an admin can not access his own permissions after enabling advanced permissions -FIX: Attachement of linked files on ticket when sending a message +FIX: Attachment of linked files on ticket when sending a message FIX: avoid non numeric warning FIX: Bad currency var used in stripe for connect FIX: Bad list of ticket on public interface for ticket emailcollector @@ -4925,7 +4925,7 @@ NEW: hidden option to define an invoice template for each invoice type NEW: Highlight lines on lists when they are checked NEW: Notification module support expense report+holiday validation and approval NEW: On customer/supplier card, add simple tooltip to amount boxes -NEW: Page to check if the operations/items created between two dates have attached item(s) and possibility to download all attachements +NEW: Page to check if the operations/items created between two dates have attached item(s) and possibility to download all attachments NEW: possibility to add all rights of all modules in one time NEW: redirect if only one result on global search on card NEW: Permission to ignore price min @@ -6369,7 +6369,7 @@ NEW: No external check of version without explicit click in about page. NEW: ODT docs for USER USERGROUP CONTRACT and PRODUCT class NEW: odt usergroup NEW: On invoices generated by template, we save if invoice come from a source template. -NEW: option to copy into attachement files of events, files send by mail (with auto event creation) +NEW: option to copy into attachment files of events, files send by mail (with auto event creation) NEW: PDF with numbertoword NEW: Permit multiple file upload in linked documents NEW: PHP 7.1 compatibility From 792ff4044effcf84c9e4496e8599b90118ef0c14 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Nov 2024 12:08:46 +0100 Subject: [PATCH 06/16] Typo --- ChangeLog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ce5766b2013b6..a222f2206ba9a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -62,7 +62,7 @@ FIX: Extrafield following between rec invoice and classic invoice (#31445) FIX: fatal error on loading pictures in attached documents of an event (#30553) FIX: fatal error Unsupported operand types when recording load payment FIX: Fix bug select columns and access to the public ticket list from the public ticket card (case when we have connected to another client before, the track id stocked in session overwrite the new track id from the public ticket card) (#31000) -FIX: Fix create shipping with product who have negative stocks on warehouse but the negative stock transfert is allowed (#26217) +FIX: Fix create shipping with product who have negative stocks on warehouse but the negative stock transfer is allowed (#26217) FIX: Fix save directory for invoice ODT and multientities FIX: group by qty in product margin tab (#29853) FIX: Hierarchy Employee view do not filter on employee = 1 (#29496) @@ -499,7 +499,7 @@ NEW: No overwrite of optionals during put() contact NEW: Notifications: add Customer Order delivered (ORDER_NEW) in module Notification NEW: Notifications: for Sign or Refused Propal from Online Page NEW: Now we can edit amount on VAT and salaries clone action -NEW: only get openned contact from liste_contact function, to not have access to closed contact as mail receiver +NEW: only get open contact from liste_contact function, to not have access to closed contact as mail receiver NEW: Option to manage deposit slips for more payment modes (not only NEW: Option to show column for field and line selection on the left NEW: Orders: add sub total in order list det From 67c2a48fc9862f31f215da4f4e0be0d6c3ce7abf Mon Sep 17 00:00:00 2001 From: Eric - CAP-REL <1468823+rycks@users.noreply.github.com> Date: Wed, 13 Nov 2024 12:39:10 +0100 Subject: [PATCH 07/16] Add missing extrafields on strato pdf model (#31790) * undef var * add main extrafields on object * remove dev debug sorry ! --------- Co-authored-by: Laurent Destailleur --- .../contract/doc/pdf_strato.modules.php | 18 ++++++++++++++++-- .../core/modules/contract/modules_contract.php | 1 + 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index fe6f77b9b9ac4..5283418997894 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -7,6 +7,7 @@ * Copyright (C) 2013-2020 Philippe Grand * Copyright (C) 2015 Marcos García * Copyright (C) 2018-2020 Frédéric France + * Copyright (C) 2024 Éric Seigne * * 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 @@ -300,11 +301,24 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $tab_top_newpage = (!getDolGlobalInt('MAIN_PDF_DONOTREPEAT_HEAD') ? 42 : 10); // Display notes - if (!empty($object->note_public)) { + $notetoshow = empty($object->note_public) ? '' : $object->note_public; + + // Extrafields in note + $extranote = $this->getExtrafieldsInHtml($object, $outputlangs); + if (!empty($extranote)) { + $notetoshow = dol_concatdesc($notetoshow, $extranote); + } + + if (!empty($notetoshow)) { $tab_top -= 2; + $substitutionarray = pdf_getSubstitutionArray($outputlangs, null, $object); + complete_substitutions_array($substitutionarray, $outputlangs, $object); + $notetoshow = make_substitutions($notetoshow, $substitutionarray, $outputlangs); + $notetoshow = convertBackOfficeMediasLinksToPublicLinks($notetoshow); + $pdf->SetFont('', '', $default_font_size - 1); - $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($object->note_public), 0, 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc - 1, $tab_top - 1, dol_htmlentitiesbr($notetoshow), 0, 1); $nexY = $pdf->GetY(); $height_note = $nexY - $tab_top; diff --git a/htdocs/core/modules/contract/modules_contract.php b/htdocs/core/modules/contract/modules_contract.php index 577ec4be5d961..2089736b5c28c 100644 --- a/htdocs/core/modules/contract/modules_contract.php +++ b/htdocs/core/modules/contract/modules_contract.php @@ -41,6 +41,7 @@ abstract class ModelePDFContract extends CommonDocGenerator * @var string Error code (or message) */ public $error = ''; + public $posxdesc; // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps From 93f23fe452c20d75d87c220b5fdee1559f092534 Mon Sep 17 00:00:00 2001 From: thomas-Ngr Date: Wed, 13 Nov 2024 16:18:08 +0100 Subject: [PATCH 08/16] ODF : fix : escape specials chars in IF ELSE ENDIF $key (#31796) * ODF : fix : escape specials chars in IF ELSE ENDIF $key * fix missing brackets * add delimiter to preg_quote --------- Co-authored-by: Brice Werry --- htdocs/includes/odtphp/Segment.php | 4 ++-- htdocs/includes/odtphp/odf.php | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/includes/odtphp/Segment.php b/htdocs/includes/odtphp/Segment.php index ca8797ba577ca..f8539e6187c3b 100644 --- a/htdocs/includes/odtphp/Segment.php +++ b/htdocs/includes/odtphp/Segment.php @@ -117,14 +117,14 @@ public function merge() // Remove the IF tag $this->xml = str_replace('[!-- IF '.$key.' --]', '', $this->xml); // Remove everything between the ELSE tag (if it exists) and the ENDIF tag - $reg = '@(\[!--\sELSE\s' . $key . '\s--\](.*))?\[!--\sENDIF\s' . $key . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy + $reg = '@(\[!--\sELSE\s' . preg_quote($key, '@') . '\s--\](.*))?\[!--\sENDIF\s' . preg_quote($key, '@') . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy $this->xml = preg_replace($reg, '', $this->xml); } // Else the value is false, then two cases: no ELSE and we're done, or there is at least one place where there is an ELSE clause, then we replace it else { // Find all conditional blocks for this variable: from IF to ELSE and to ENDIF - $reg = '@\[!--\sIF\s' . $key . '\s--\](.*)(\[!--\sELSE\s' . $key . '\s--\](.*))?\[!--\sENDIF\s' . $key . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy + $reg = '@\[!--\sIF\s' . preg_quote($key, '@') . '\s--\](.*)(\[!--\sELSE\s' . preg_quote($key, '@') . '\s--\](.*))?\[!--\sENDIF\s' . preg_quote($key, '@') . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy preg_match_all($reg, $this->xml, $matches, PREG_SET_ORDER); foreach($matches as $match) { // For each match, if there is an ELSE clause, we replace the whole block by the value in the ELSE clause if (!empty($match[3])) $this->xml = str_replace($match[0], $match[3], $this->xml); diff --git a/htdocs/includes/odtphp/odf.php b/htdocs/includes/odtphp/odf.php index b780b550b6d51..019d162be0009 100644 --- a/htdocs/includes/odtphp/odf.php +++ b/htdocs/includes/odtphp/odf.php @@ -539,7 +539,8 @@ private function _moveRowSegments() private function _parse($type='content') { // Search all tags fou into condition to complete $this->vars, so we will proceed all tests even if not defined - $reg='@\[!--\sIF\s([{}a-zA-Z0-9\.\,_]+)\s--\]@smU'; + $reg='@\[!--\sIF\s([\[\]{}a-zA-Z0-9\.\,_]+)\s--\]@smU'; + $matches = array(); preg_match_all($reg, $this->contentXml, $matches, PREG_SET_ORDER); //var_dump($this->vars);exit; @@ -564,7 +565,7 @@ private function _parse($type='content') // Remove the IF tag $this->contentXml = str_replace('[!-- IF '.$key.' --]', '', $this->contentXml); // Remove everything between the ELSE tag (if it exists) and the ENDIF tag - $reg = '@(\[!--\sELSE\s' . $key . '\s--\](.*))?\[!--\sENDIF\s' . $key . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy + $reg = '@(\[!--\sELSE\s' . preg_quote($key, '@') . '\s--\](.*))?\[!--\sENDIF\s' . preg_quote($key, '@') . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy $this->contentXml = preg_replace($reg, '', $this->contentXml); /*if ($sav != $this->contentXml) { @@ -578,7 +579,7 @@ private function _parse($type='content') //dol_syslog("Var ".$key." is not defined, we remove the IF, ELSE and ENDIF "); //$sav=$this->contentXml; // Find all conditional blocks for this variable: from IF to ELSE and to ENDIF - $reg = '@\[!--\sIF\s' . $key . '\s--\](.*)(\[!--\sELSE\s' . $key . '\s--\](.*))?\[!--\sENDIF\s' . $key . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy + $reg = '@\[!--\sIF\s' . preg_quote($key, '@') . '\s--\](.*)(\[!--\sELSE\s' . preg_quote($key, '@') . '\s--\](.*))?\[!--\sENDIF\s' . preg_quote($key, '@') . '\s--\]@smU'; // U modifier = all quantifiers are non-greedy preg_match_all($reg, $this->contentXml, $matches, PREG_SET_ORDER); foreach($matches as $match) { // For each match, if there is an ELSE clause, we replace the whole block by the value in the ELSE clause if (!empty($match[3])) $this->contentXml = str_replace($match[0], $match[3], $this->contentXml); From dccde49388c7385c1a9954e73e3c0a471e0278d7 Mon Sep 17 00:00:00 2001 From: lvessiller-opendsi Date: Wed, 13 Nov 2024 21:31:22 +0100 Subject: [PATCH 09/16] FIX calculate start date of cloned task from cloned project (#31799) * FIX calculate start date of cloned task from cloned project * Fix wrong strat comment --- htdocs/projet/class/task.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 94f04c401fe5a..d54e2080cf62d 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1984,15 +1984,15 @@ public function createFromClone(User $user, $fromid, $project_id, $parent_task_i $projectstatic = new Project($this->db); $projectstatic->fetch($ori_project_id); - //Origin project strat date - $orign_project_dt_start = $projectstatic->date_start; + // Origin project start date + $orign_project_dt_start = (!isset($projectstatic->date_start) || $projectstatic->date_start == '') ? $projectstatic->date_c : $projectstatic->date_start; - //Calcultate new task start date with difference between origin proj start date and origin task start date + // Calculate new task start date with difference between origin proj start date and origin task start date if (!empty($clone_task->date_start)) { $clone_task->date_start = $now + $clone_task->date_start - $orign_project_dt_start; } - //Calcultate new task end date with difference between origin proj end date and origin task end date + // Calculate new task end date with difference between origin proj start date and origin task end date if (!empty($clone_task->date_end)) { $clone_task->date_end = $now + $clone_task->date_end - $orign_project_dt_start; } From 4feb9def4ee0f5100e2dce1c3d0a429e03ca81d5 Mon Sep 17 00:00:00 2001 From: MaximilienR-easya <122890855+MaximilienR-easya@users.noreply.github.com> Date: Wed, 13 Nov 2024 22:52:42 +0100 Subject: [PATCH 10/16] Fix Preview present even when there is no corresponding file (#30585) * Fix cas de previews de fichier non existant * another way to detect missing or missnamed file than using file_exists function --- htdocs/comm/card.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index e49beb53e0d95..8b4949cd770bc 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -868,9 +868,9 @@ $filedir = $conf->propal->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { - $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + $file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); } - if (is_array($file_list)) { + if (is_array($file_list) && !empty($file_list)) { // Defined relative dir to DOL_DATA_ROOT $relativedir = ''; if ($filedir) { @@ -980,9 +980,9 @@ $filedir = $conf->commande->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { - $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + $file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); } - if (is_array($file_list)) { + if (is_array($file_list) && !empty($file_list)) { // Defined relative dir to DOL_DATA_ROOT $relativedir = ''; if ($filedir) { @@ -1074,9 +1074,9 @@ $filedir = $conf->expedition->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { - $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + $file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); } - if (is_array($file_list)) { + if (is_array($file_list) && !empty($file_list)) { // Defined relative dir to DOL_DATA_ROOT $relativedir = ''; if ($filedir) { @@ -1180,9 +1180,9 @@ $filedir = $conf->contrat->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { - $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + $file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); } - if (is_array($file_list)) { + if (is_array($file_list) && !empty($file_list)) { // Defined relative dir to DOL_DATA_ROOT $relativedir = ''; if ($filedir) { @@ -1271,9 +1271,9 @@ $filedir = $conf->ficheinter->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { - $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + $file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); } - if (is_array($file_list)) { + if (is_array($file_list) && !empty($file_list)) { // Defined relative dir to DOL_DATA_ROOT $relativedir = ''; if ($filedir) { @@ -1471,9 +1471,9 @@ $filedir = $conf->facture->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref); $file_list = null; if (!empty($filedir)) { - $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); + $file_list = dol_dir_list($filedir, 'files', 0, dol_sanitizeFileName($objp->ref).'.pdf', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC); } - if (is_array($file_list)) { + if (is_array($file_list) && !empty($file_list)) { // Defined relative dir to DOL_DATA_ROOT $relativedir = ''; if ($filedir) { From ce9a1b36618beac106cdc4eaa9dfe83d61396096 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Fri, 15 Nov 2024 14:10:35 +0100 Subject: [PATCH 11/16] FIX: swiftmailer: correctly set errors-to header (#31826) --- htdocs/core/class/CMailFile.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index db8b30ed2497a..319969bbd188c 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -577,7 +577,7 @@ public function __construct($subject, $to, $from, $msg, $filename_list = array() if (!empty($this->errors_to)) { try { - $headers->addTextHeader('Errors-To', $this->getArrayAddress($this->errors_to)); + $headers->addTextHeader('Errors-To', $this->getValidAddress($this->errors_to, 0)); } catch (Exception $e) { $this->errors[] = $e->getMessage(); } @@ -644,7 +644,6 @@ public function __construct($subject, $to, $from, $msg, $filename_list = array() $this->errors[] = $e->getMessage(); } } - //if (!empty($this->errors_to)) $this->message->setErrorsTo($this->getArrayAddress($this->errors_to)); if (isset($this->deliveryreceipt) && $this->deliveryreceipt == 1) { try { $this->message->setReadReceiptTo($this->getArrayAddress($this->addr_from)); From 230eee4ead39a888c9e684bce9295a0da639eb74 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Fri, 15 Nov 2024 23:31:12 +0100 Subject: [PATCH 12/16] FIX issue #28222 Edit date extrafield diplayed on all on lines (#31914) * FIX issue #28222 Edit date extrafield diplayed on all on lines * wrong id --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 8c5a84c9120b8..905d8cbc2c518 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8329,7 +8329,7 @@ public function showOptionals($extrafields, $mode = 'view', $params = null, $key } } $datekey = $keyprefix.'options_'.$key.$keysuffix; - $value = (GETPOSTISSET($datekey)) ? dol_mktime(12, 0, 0, GETPOST($datekey.'month', 'int', 3), GETPOST($datekey.'day', 'int', 3), GETPOST($datekey.'year', 'int', 3)) : $datenotinstring; + $value = (GETPOSTISSET($datekey) && $this->id == GETPOST('elrowid', 'int')) ? dol_mktime(12, 0, 0, GETPOST($datekey.'month', 'int', 3), GETPOST($datekey.'day', 'int', 3), GETPOST($datekey.'year', 'int', 3)) : $datenotinstring; } if (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('datetime'))) { $datenotinstring = null; From bab49d66c5e7a9a542cc532decc6d8e1a856379d Mon Sep 17 00:00:00 2001 From: William Mead Date: Fri, 15 Nov 2024 23:36:54 +0100 Subject: [PATCH 13/16] Backported default ticket type fix (#31912) --- htdocs/core/class/html.formticket.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 47f9c6d0778d8..9ccf2517a5233 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -753,7 +753,7 @@ public function selectTypesTickets($selected = '', $htmlname = 'tickettype', $fi print ' selected="selected"'; } elseif (in_array($id, $selected)) { print ' selected="selected"'; - } elseif ($arraytypes['use_default'] == "1" && !$selected && !$empty) { + } elseif ($arraytypes['use_default'] == "1" && empty($selected)) { print ' selected="selected"'; } From 038f8d5dff24376b25dbeaf1b6e127779eab965c Mon Sep 17 00:00:00 2001 From: William Mead Date: Fri, 15 Nov 2024 23:44:08 +0100 Subject: [PATCH 14/16] Backported default ticket severity fix (#31908) --- htdocs/core/class/html.formticket.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 9ccf2517a5233..f30da8bc8b051 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -1199,7 +1199,7 @@ public function selectSeveritiesTickets($selected = '', $htmlname = 'ticketsever print ' selected="selected"'; } elseif (isset($selected) && $selected == $id) { print ' selected="selected"'; - } elseif ($arrayseverities['use_default'] == "1" && !$selected && !$empty) { + } elseif ($arrayseverities['use_default'] == "1" && empty($selected)) { print ' selected="selected"'; } From d0323fa27d9c704503f6d97b5679de2d5dbf64a4 Mon Sep 17 00:00:00 2001 From: kkhelifa-opendsi Date: Fri, 15 Nov 2024 23:53:04 +0100 Subject: [PATCH 15/16] FIX : Update on a sold line of bank entrie set the type to empty, now it's fixed #22539 (#31888) --- htdocs/compta/bank/line.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index d8517391e177b..74fecf8ecbba6 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -163,7 +163,8 @@ $sql .= " SET "; // Always opened if (GETPOSTISSET('value')) { - $sql .= " fk_type='".$db->escape(GETPOST('value'))."',"; + $type = GETPOST('value'); + $sql .= " fk_type='".$db->escape(empty($type) && $object->fk_type == 'SOLD' ? 'SOLD' : $type)."',"; } if (GETPOSTISSET('num_chq')) { $sql .= " num_chq='".$db->escape(GETPOST("num_chq"))."',"; From 976399c2d9840386be879ac2e16e4e4259efbf73 Mon Sep 17 00:00:00 2001 From: "Thomas C." <56068416+Thomas905@users.noreply.github.com> Date: Sat, 16 Nov 2024 10:57:03 +0100 Subject: [PATCH 16/16] fix (#31683) --- htdocs/core/lib/company.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 82e42792144a8..2146f00ba664d 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -2193,7 +2193,7 @@ function show_subsidiaries($conf, $langs, $db, $object) $i = -1; - $sql = "SELECT s.rowid, s.client, s.fournisseur, s.nom as name, s.name_alias, s.email, s.address, s.zip, s.town, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.canvas"; + $sql = "SELECT s.rowid, s.client, s.fournisseur, s.nom as name, s.name_alias, s.email, s.address, s.zip, s.town, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.canvas, s.status"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " WHERE s.parent = ".((int) $object->id); $sql .= " AND s.entity IN (".getEntity('societe').")"; @@ -2233,6 +2233,7 @@ function show_subsidiaries($conf, $langs, $db, $object) $socstatic->canvas = $obj->canvas; $socstatic->client = $obj->client; $socstatic->fournisseur = $obj->fournisseur; + $socstatic->status = $obj->status; print '';