From d3182c684eba528422caa7df99394b3058b4d6b3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 8 Oct 2022 03:28:07 +0200 Subject: [PATCH 01/14] Prepare 16.0.1 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 3e4b6187fb4..c8978db3778 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -34,7 +34,7 @@ if (!defined('DOL_APPLICATION_TITLE')) { define('DOL_APPLICATION_TITLE', 'Dolibarr'); } if (!defined('DOL_VERSION')) { - define('DOL_VERSION', '16.0.0'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c + define('DOL_VERSION', '16.0.1'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c } if (!defined('EURO')) { From 79422979a926d058653c5977533a8dd7d2021da7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 8 Oct 2022 03:34:11 +0200 Subject: [PATCH 02/14] Doc --- ChangeLog | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/ChangeLog b/ChangeLog index caa0b928f93..54b721ff443 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,84 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 16.0.1 compared to 16.0.0 ***** + +FIX: #16476 on massaction the pdf generation is not using the t… +FIX: #21416 Filter tag no-categorie in members +FIX: #21543 +FIX: #21799 inactive companies shall not be selectable for new proposals, orders and invoices +FIX: #21859 Don't show html balise on list for private/public note +FIX: #22164 +FIX: #22241 +FIX: #22263 Accountancy - Account number expected in place of a rowid on parent account on export +FIX: #22264 Accountancy - Translation on chart of accounts export +FIX: #22265 Accountancy - Account number expected in place of a rowid on export +FIX: #22334 +FIX: #22360 +FIX: #22379 creating events on supplier order +FIX: #22382 Error on length of supplier reference +FIX: #22386 IBAN not mandatory for International Export Countries +FIX: #22440 Lang Key "UserAccountNotDefined" is missing +FIX: #22482 +FIX: #22507 +FIX: Accountancy - Some manuals operations are displayed in subledger +FIX: API reception return error 500 +FIX: avoid override initial message ($this instead $object) +FIX: avoid some warnings (php8+) +FIX: Bad backtopage and CSRF on link for ticket message +FIX: bad closing select +FIX: broken feature, wrong fk_parent_line after cloning object +FIX: Column label +FIX: compatibility if javascript not actived +FIX: compatibility with Mysql <= 5.7 +FIX: contact deletion: execute trigger before really deleting +FIX: CronJob sendBackup +FIX: CSRF + lost value of constant after use save button +FIX: CSS +FIX: data integrity for llx_delivery table +FIX: default value for partnership status +FIX: deletion of the MO_CHILD link +FIX: Dictionary - Display error on cache_vatrates +FIX: Dolibarr#16476 version 2a +FIX: Duplicate creation of invoice when closing shipment linked to order +FIX: Duplicate in list when filtering on categories +FIX: extrafields with value '0' was '' +FIX: filters lost when sorting on productMargin and customerMargins +FIX: fk_expedition in $line can be usefull for triggers +FIX: Import in upgrade when using a socialnetwork field. +FIX: input hidden with fk_product of line on mo production can be usefull +FIX: inventory code must be different at each transation +FIX: inventory total columns +FIX: Issue #16476 on massaction the pdf generation is not using the thirdparty language settings +FIX: Linked object agenda card +FIX: missing check if category module is enabled +FIX: missing check if incoice as a payment (wrong status) +FIX: missing class "societe" when create another object with workflow +FIX: missing error message if image size too large +FIX: Missing reposition +FIX: missing the management of a constant in the Ticket config +FIX: Missing token in different URLs links +FIX: @ must be allowed into dol_eval to allow rules including external module string 'abc@def' +FIX: - php V8 get number doc saphir +FIX: - php V8 propal index last draft +FIX: Preview button position on documents list (case when the file is too long) +FIX: Project - on global view, missing display of ref customer +FIX: Protection against bad value into accurancy setup +FIX: reading of trackid in emailcollector (when on recipient suffix) +FIX: recruitment linked files +FIX: Remove use of code we should not have +FIX: Restore the option MAIN_OPTIMIZEFORTEXTBROWSER +FIX: Rich text is not diplayed +FIX: same thing in deleteline +FIX: Supplier Reference is lost when page breaks +FIX: support of array parameters in "add to bookmark" feature. +FIX: Test that web dir is correct in install +FIX: the shipment PDF was using the full size logo instead of small +FIX: Token Error : delete stock transfer +FIX: ToOfferALinkForOnlinePayment not translated +FIX: tooltip of technical tables added of a module +FIX: wrong result check when update expensereport line + ***** ChangeLog for 16.0.0 compared to 15.0.0 ***** From a1e5e754db3c6f499d47434e0496031278e42e3e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 9 Oct 2022 17:57:48 +0200 Subject: [PATCH 03/14] Doc --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 54b721ff443..0c9e93454f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -281,6 +281,7 @@ Following changes may create regressions for some external modules, but were nec * Method fetch_all of DolResource has been renamed into fetchAll() to match naming conventions. * The hook 'upgrade' and 'doUpgrade2" has been renamed 'doUpgradeBefore' and 'doUpgradeAfterDB'. A new trigger 'doUpgradeAfterFiles' has been introduced. * The context hook 'suppliercard' when on the supplier tab of a thirdparty has been renamed into 'thirdpartysupplier' +* Because the module Resources highly linked to the Agenda module, the menu for Resources module has been moved into top menu Agenda. ***** ChangeLog for 15.0.3 compared to 15.0.2 ***** From 7e8073735848513d7d9a9be133ee78f9882da3ae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 10 Oct 2022 00:57:50 +0200 Subject: [PATCH 04/14] css --- htdocs/compta/bank/various_payment/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 3bb6435be0d..15cc3faf7bc 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -405,7 +405,7 @@ if ($action == 'create') { // Amount print ''; print $form->editfieldkey('Amount', 'amount', '', $object, 0, 'string', '', 1).''; - print ''; + print ''; print ''; // Bank From fca08dbf2342e15d36399ff0430c2acd885e6de2 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 11 Oct 2022 08:00:25 +0200 Subject: [PATCH 05/14] FIX missing quote --- htdocs/contrat/class/contrat.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 5a882a4e68e..f8ffa809a86 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1703,8 +1703,8 @@ class Contrat extends CommonObject $total_localtax1 = $tabprice[9]; $total_localtax2 = $tabprice[10]; - $localtax1_type = $localtaxes_type[0]; - $localtax2_type = $localtaxes_type[2]; + $localtax1_type = (empty($localtaxes_type[0]) ? '' : $localtaxes_type[0]); + $localtax2_type = (empty($localtaxes_type[2]) ? '' : $localtaxes_type[2]); // TODO A virer // Anciens indicateurs: $price, $remise (a ne plus utiliser) @@ -1737,8 +1737,8 @@ class Contrat extends CommonObject $sql .= ",tva_tx = ".((float) price2num($tvatx)); $sql .= ",localtax1_tx = ".((float) price2num($localtax1tx)); $sql .= ",localtax2_tx = ".((float) price2num($localtax2tx)); - $sql .= ",localtax1_type='".$this->db->escape($localtax1_type); - $sql .= ",localtax2_type='".$this->db->escape($localtax2_type); + $sql .= ",localtax1_type='".$this->db->escape($localtax1_type)."'"; + $sql .= ",localtax2_type='".$this->db->escape($localtax2_type)."'"; $sql .= ", total_ht = ".((float) price2num($total_ht)); $sql .= ", total_tva = ".((float) price2num($total_tva)); $sql .= ", total_localtax1 = ".((float) price2num($total_localtax1)); From ba94bc146f19e2019d33fcb2c91e580bffb552c8 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 11 Oct 2022 10:00:23 +0200 Subject: [PATCH 06/14] FIX: supplier price update: missing error reporting --- htdocs/fourn/class/fournisseur.product.class.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index ea5dc639a5e..ca557e027dc 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -419,7 +419,11 @@ class ProductFournisseur extends Product $productfournisseurprice->array_options[$key] = $value; } $res = $productfournisseurprice->update($user); - if ($res < 0) $error++; + if ($res < 0) { + $this->error = $productfournisseurprice->error; + $this->errors = $productfournisseurprice->errors; + $error++; + } } } } @@ -506,6 +510,7 @@ class ProductFournisseur extends Product if ($resql) { $this->product_fourn_price_id = $this->db->last_insert_id(MAIN_DB_PREFIX."product_fournisseur_price"); } else { + $this->error = $this->db->lasterror(); $error++; } @@ -518,7 +523,11 @@ class ProductFournisseur extends Product $productfournisseurprice->array_options[$key] = $value; } $res = $productfournisseurprice->update($user); - if ($res < 0) $error++; + if ($res < 0) { + $this->error = $productfournisseurprice->error; + $this->errors = $productfournisseurprice->errors; + $error++; + } } } } From bfd33c91572e76c538ec51e6e465d93a46bdb913 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 11 Oct 2022 13:45:29 +0200 Subject: [PATCH 07/14] Fix migration when table llx_asset is missing --- README.md | 2 +- .../install/mysql/migration/15.0.0-16.0.0.sql | 45 +++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c476f14a8cc..826955aef92 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ If you don't have time to install it yourself, you can try some commercial 'read Dolibarr supports upgrading, usually without the need for any (commercial) support (depending on if you use any commercial extensions). It supports upgrading all the way from any version after 2.8 without breakage. This is unique in the ERP ecosystem and a benefit our users highly appreciate! - At first make a backup of your Dolibarr files & then [see](https://wiki.dolibarr.org/index.php/Installation_-_Upgrade#Upgrade_Dolibarr) -- Check that your installed PHP version is supported by the new version [see PHP support](./doc/phpmatrix.md). +- Check that your installed PHP version is supported by the new version [see PHP support](https://wiki.dolibarr.org/index.php/Releases). - Overwrite all old files from 'dolibarr' directory with files provided into the new version's package. - At first next access, Dolibarr will redirect you to the "install/" page to follow the upgrade process.  If an `install.lock` file exists to lock any other upgrade process, the application will ask you to remove the file manually (you should find the `install.lock` file in the directory used to store generated and uploaded documents, in most cases, it is the directory called "*documents*"). diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 6d9aebf934f..795726bd89c 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -365,7 +365,52 @@ ALTER TABLE llx_bank_account ADD COLUMN pti_in_ctti smallint DEFAULT 0 AFTER dom -- Set default ticket type to OTHER if no default exists UPDATE llx_c_ticket_type SET use_default=1 WHERE code='OTHER' AND NOT EXISTS(SELECT * FROM (SELECT * FROM llx_c_ticket_type) AS t WHERE use_default=1); + -- Assets - New module + +CREATE TABLE llx_asset( + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, + ref varchar(128) NOT NULL, + entity integer DEFAULT 1 NOT NULL, + label varchar(255), + + fk_asset_model integer, + + reversal_amount_ht double(24,8), + acquisition_value_ht double(24,8) DEFAULT NULL, + recovered_vat double(24,8), + + reversal_date date, + + date_acquisition date NOT NULL, + date_start date NOT NULL, + + qty real DEFAULT 1 NOT NULL, + + acquisition_type smallint DEFAULT 0 NOT NULL, + asset_type smallint DEFAULT 0 NOT NULL, + + not_depreciated integer DEFAULT 0, + + disposal_date date, + disposal_amount_ht double(24,8), + fk_disposal_type integer, + disposal_depreciated integer DEFAULT 0, + disposal_subject_to_vat integer DEFAULT 0, + + note_public text, + note_private text, + + date_creation datetime NOT NULL, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + fk_user_creat integer NOT NULL, + fk_user_modif integer, + last_main_doc varchar(255), + import_key varchar(14), + model_pdf varchar(255), + status integer NOT NULL +) ENGINE=innodb; + ALTER TABLE llx_asset DROP FOREIGN KEY fk_asset_asset_type; ALTER TABLE llx_asset DROP INDEX idx_asset_fk_asset_type; From 66c6d1927b872b4fef50d2e336194bb8d69bc198 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 11 Oct 2022 16:46:08 +0200 Subject: [PATCH 08/14] Fix duplicate invoice created --- 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 714320fbf1c..d5e44f4afed 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4220,7 +4220,7 @@ abstract class CommonObject $nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct - if ($nb_rows_affected >= 0) { + if ($nb_rows_affected > 0) { if (empty($trigkey)) { // Try to guess trigkey (for backward compatibility, now we should have trigkey defined into the call of setStatus) if ($this->element == 'supplier_proposal' && $status == 2) { From 7ebda11ad05f76735288c4c7ce353738b77a2571 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 11 Oct 2022 22:08:26 +0200 Subject: [PATCH 09/14] Fix search in TakePOS --- htdocs/langs/en_US/errors.lang | 1 + htdocs/takepos/admin/terminal.php | 2 +- htdocs/takepos/index.php | 17 +++++++++-------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 8c5e7562b8b..afcbe76e828 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -14,6 +14,7 @@ ErrorLoginAlreadyExists=Login %s already exists. ErrorGroupAlreadyExists=Group %s already exists. ErrorEmailAlreadyExists=Email %s already exists. ErrorRecordNotFound=Record not found. +ErrorRecordNotFoundShort=Not found ErrorFailToCopyFile=Failed to copy file '%s' into '%s'. ErrorFailToCopyDir=Failed to copy directory '%s' into '%s'. ErrorFailToRenameFile=Failed to rename file '%s' into '%s'. diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index 4645f5d9cf2..b2d2b87ced0 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -363,7 +363,7 @@ $htmltext .= ''; print '
'; print load_fiche_titre($langs->trans('FreeLegalTextOnInvoices'), '', ''); -print '
'; +print '
'; print ''; print ''; print ''; diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index b567ff5fee9..2dda7872743 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -585,7 +585,9 @@ function New() { * return {void} */ function Search2(keyCodeForEnter, moreorless) { - console.log("Search2 Call ajax search to replace products keyCodeForEnter="+keyCodeForEnter); + var eventKeyCode = window.event.keyCode; + + console.log("Search2 Call ajax search to replace products keyCodeForEnter="+keyCodeForEnter+", eventKeyCode="+eventKeyCode); var search_term = $('#search').val(); var search_start = 0; @@ -608,20 +610,19 @@ function Search2(keyCodeForEnter, moreorless) { } var search = false; - var eventKeyCode = window.event.keyCode; - if (keyCodeForEnter == '' || eventKeyCode == keyCodeForEnter) { + if (keyCodeForEnter != '' || eventKeyCode == keyCodeForEnter) { search = true; } if (search === true) { - - // temporization time to give time to type + // if a timer has been already started (search2_timer is a global js variable), we cancel it now + // we click onto another key, we will restart another timer just after if (search2_timer) { clearTimeout(search2_timer); } + // temporization time to give time to type search2_timer = setTimeout(function(){ - pageproducts = 0; jQuery(".wrapper2 .catwatermark").hide(); var nbsearchresults = 0; @@ -693,8 +694,8 @@ function Search2(keyCodeForEnter, moreorless) { if (data.length == 0) { $('#search').val('load('errors'); - echo dol_escape_js($langs->trans("ErrorRecordNotFound")); - ?>'); + echo dol_escape_js($langs->transnoentitiesnoconv("ErrorRecordNotFoundShort")); + ?> ('+search_term+')'); $('#search').select(); } else ClearSearch(); From 77898ab4566b56bf473fed5e32350220ce8bdf2e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Oct 2022 11:52:33 +0200 Subject: [PATCH 10/14] Fix f... option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS (do not use this!) --- htdocs/accountancy/admin/index.php | 3 +++ htdocs/accountancy/journal/purchasesjournal.php | 4 ++-- htdocs/accountancy/supplier/list.php | 2 +- htdocs/compta/journal/purchasesjournal.php | 4 ++-- htdocs/core/class/commoninvoice.class.php | 6 +++--- htdocs/core/class/discount.class.php | 2 +- htdocs/core/class/html.form.class.php | 2 +- htdocs/fourn/commande/card.php | 2 +- htdocs/fourn/facture/card.php | 2 +- htdocs/supplier_proposal/card.php | 2 +- 10 files changed, 16 insertions(+), 13 deletions(-) diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index af569e08ae3..c32148b81fc 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -265,6 +265,9 @@ if (!$user->admin) { if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { print '
' . $langs->trans("ConstantIsOn", "FACTURE_DEPOSITS_ARE_JUST_PAYMENTS") . '
'; } + if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { + print '
' . $langs->trans("ConstantIsOn", "FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS") . '
'; + } if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { print '
' . $langs->trans("ConstantIsOn", "ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY") . '
'; } diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index f2d7721ca90..c175889357c 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -133,7 +133,7 @@ if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { $sql .= " WHERE f.fk_statut > 0"; $sql .= " AND fd.fk_code_ventilation > 0"; $sql .= " AND f.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy -if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { +if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { $sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_SITUATION.")"; } else { $sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_DEPOSIT.",".FactureFournisseur::TYPE_SITUATION.")"; @@ -754,7 +754,7 @@ if (empty($action) || $action == 'view') { $exportlink = ''; $builddate = dol_now(); $description = $langs->trans("DescJournalOnlyBindedVisible").'
'; - if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { $description .= $langs->trans("DepositsAreNotIncluded"); } else { $description .= $langs->trans("DepositsAreIncluded"); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index d14beb84cc2..4593541e87a 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -342,7 +342,7 @@ if (strlen(trim($search_country))) { if (strlen(trim($search_tvaintra))) { $sql .= natural_search("s.tva_intra", $search_tvaintra); } -if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { +if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { $sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_SITUATION.")"; } else { $sql .= " AND f.type IN (".FactureFournisseur::TYPE_STANDARD.",".FactureFournisseur::TYPE_REPLACEMENT.",".FactureFournisseur::TYPE_CREDIT_NOTE.",".FactureFournisseur::TYPE_DEPOSIT.",".FactureFournisseur::TYPE_SITUATION.")"; diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php index ea320007f4d..8646fccc359 100644 --- a/htdocs/compta/journal/purchasesjournal.php +++ b/htdocs/compta/journal/purchasesjournal.php @@ -94,7 +94,7 @@ $periodlink = ''; $exportlink = ''; $builddate = dol_now(); $description = $langs->trans("DescPurchasesJournal").'
'; -if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { +if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { $description .= $langs->trans("DepositsAreNotIncluded"); } else { $description .= $langs->trans("DepositsAreIncluded"); @@ -118,7 +118,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product"; $sql .= " JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = fd.fk_facture_fourn"; $sql .= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; $sql .= " WHERE f.fk_statut > 0 AND f.entity IN (".getEntity('invoice').")"; -if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { +if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { $sql .= " AND f.type IN (0,1,2)"; } else { $sql .= " AND f.type IN (0,1,2,3)"; diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index bed28c63035..72c8a3c2b9c 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -169,7 +169,7 @@ abstract class CommonInvoice extends CommonObject /** * Return amount (with tax) of all deposits invoices used by invoice. * Should always be empty, except if option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is on for sale invoices (not recommended), - * of FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS is on for purchase invoices (not recommended). + * of FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS is on for purchase invoices (not recommended). * * @param int $multicurrency Return multicurrency_amount instead of amount * @return float <0 and set ->error if KO, Sum of deposits amount otherwise @@ -177,7 +177,7 @@ abstract class CommonInvoice extends CommonObject public function getSumDepositsUsed($multicurrency = 0) { /*if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') { - // FACTURE_DEPOSITS_ARE_JUST_PAYMENTS was never supported for purchase invoice, so we can return 0 with no need of SQL for this case. + // FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS was never supported for purchase invoice, so we can return 0 with no need of SQL for this case. return 0.0; }*/ @@ -373,7 +373,7 @@ abstract class CommonInvoice extends CommonObject $sql = "SELECT rc.amount_ttc as amount, rc.multicurrency_amount_ttc as multicurrency_amount, rc.datec as date, f.ref as ref, rc.description as type"; $sql .= ' FROM '.$this->db->prefix().'societe_remise_except as rc, '.$this->db->prefix().'facture_fourn as f'; $sql .= ' WHERE rc.fk_invoice_supplier_source=f.rowid AND rc.fk_invoice_supplier = '.((int) $this->id); - $sql .= ' AND (f.type = 2 OR f.type = 0 OR f.type = 3)'; // Find discount coming from credit note or excess received or deposits (payments from deposits are always null except if FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is set) + $sql .= ' AND (f.type = 2 OR f.type = 0 OR f.type = 3)'; // Find discount coming from credit note or excess received or deposits (payments from deposits are always null except if FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS is set) } if ($sql) { diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index dff1383a629..052d5ae7e1c 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -559,7 +559,7 @@ class DiscountAbsolute /** * Return amount (with tax) of all deposits invoices used by invoice as a payment. - * Should always be empty, except if option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is on (not recommended). + * Should always be empty, except if option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS or FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS is on (not recommended). * * @param CommonInvoice $invoice Object invoice (customer of supplier) * @param int $multicurrency 1=Return multicurrency_amount instead of amount. TODO Add a mode multicurrency = -1 to return array with amount + multicurrency amount diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index dffde749fbe..107cf07c23d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5701,7 +5701,7 @@ class Form print ''; print '
'; if (!empty($discount_type)) { - if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { if (!$filter || $filter == "fk_invoice_supplier_source IS NULL") { $translationKey = 'HasAbsoluteDiscountFromSupplier'; // If we want deposit to be substracted to payments only and not to total of final invoice } else { diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 449ef19176a..3b0f4fdb6e5 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2097,7 +2097,7 @@ if ($action == 'create') { print '
'; // Relative and absolute discounts - if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { $filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice } else { diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index a1fa9a0c0e6..c0ff43083eb 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2628,7 +2628,7 @@ if ($action == 'create') { } $resteapayeraffiche = $resteapayer; - if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { // Never use this + if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { // Never use this $filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice } else { diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 09f12d70e4a..399d1271037 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1600,7 +1600,7 @@ if ($action == 'create') { print '
'.$langs->trans("Parameters").''.$langs->trans('Value').'
'; // Relative and absolute discounts - if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { $filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice } else { From 020d3dcbe5acc5ce2473c6f9a4d738109c4bbb70 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Oct 2022 12:14:04 +0200 Subject: [PATCH 11/14] Fix f... option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS (do not use this!) --- htdocs/accountancy/journal/variousjournal.php | 3 + .../facture/class/facturestats.class.php | 17 ++- htdocs/compta/facture/prelevement.php | 4 +- htdocs/compta/localtax/quadri_detail.php | 3 + htdocs/compta/resultat/clientfourn.php | 7 +- htdocs/compta/resultat/index.php | 7 +- htdocs/compta/resultat/result.php | 5 +- htdocs/compta/stats/byratecountry.php | 9 +- htdocs/compta/stats/cabyprodserv.php | 1 - htdocs/compta/tva/clients.php | 3 + htdocs/compta/tva/index.php | 3 + htdocs/compta/tva/quadri_detail.php | 3 + htdocs/core/lib/tax.lib.php | 112 ++++++++++++++---- 13 files changed, 138 insertions(+), 39 deletions(-) diff --git a/htdocs/accountancy/journal/variousjournal.php b/htdocs/accountancy/journal/variousjournal.php index 32a4adb3569..099ceb1542c 100644 --- a/htdocs/accountancy/journal/variousjournal.php +++ b/htdocs/accountancy/journal/variousjournal.php @@ -201,6 +201,9 @@ if ($object->nature == 2 || $object->nature == 3) { } else { $description .= $langs->trans("DepositsAreIncluded"); } + if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { + $description .= $langs->trans("SupplierDepositsAreNotIncluded"); + } } $listofchoices = array('notyet' => $langs->trans("NotYetInGeneralLedger"), 'already' => $langs->trans("AlreadyInGeneralLedger")); diff --git a/htdocs/compta/facture/class/facturestats.class.php b/htdocs/compta/facture/class/facturestats.class.php index 522fe9aa2e2..55ae05ff0a5 100644 --- a/htdocs/compta/facture/class/facturestats.class.php +++ b/htdocs/compta/facture/class/facturestats.class.php @@ -97,10 +97,19 @@ class FactureStats extends Stats if ($this->userid > 0) { $this->where .= ' AND f.fk_user_author = '.((int) $this->userid); } - if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { - $this->where .= " AND f.type IN (0,1,2,5)"; - } else { - $this->where .= " AND f.type IN (0,1,2,3,5)"; + if ($mode == 'customer') { + if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + $this->where .= " AND f.type IN (0,1,2,5)"; + } else { + $this->where .= " AND f.type IN (0,1,2,3,5)"; + } + } + if ($mode == 'supplier') { + if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { + $this->where .= " AND f.type IN (0,1,2,5)"; + } else { + $this->where .= " AND f.type IN (0,1,2,3,5)"; + } } if ($typentid) { diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 5a10c2055c0..45844ce0c54 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -253,7 +253,7 @@ if ($object->id > 0) { $resteapayeraffiche = $resteapayer; if ($type == 'bank-transfer') { - if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { // Never use this + if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { // Not recommended $filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice } else { @@ -266,7 +266,7 @@ if ($object->id > 0) { $absolute_discount = price2num($absolute_discount, 'MT'); $absolute_creditnote = price2num($absolute_creditnote, 'MT'); } else { - if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { // Not recommended $filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice $filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice } else { diff --git a/htdocs/compta/localtax/quadri_detail.php b/htdocs/compta/localtax/quadri_detail.php index 969376209eb..0f283a6d849 100644 --- a/htdocs/compta/localtax/quadri_detail.php +++ b/htdocs/compta/localtax/quadri_detail.php @@ -193,6 +193,9 @@ if ($conf->global->TAX_MODE_SELL_SERVICE == 'payment') $description.='
'.$lan if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { $description.='
'.$langs->trans("DepositsAreNotIncluded"); } +if (! empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { + $description.='
'.$langs->trans("SupplierDepositsAreNotIncluded"); +} */ if (!empty($conf->global->MAIN_MODULE_ACCOUNTING)) { $description .= $langs->trans("ThisIsAnEstimatedValue"); diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index e0b2f2823a6..f4babff9572 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -188,6 +188,9 @@ if ($modecompta == "CREANCES-DETTES") { } else { $description .= $langs->trans("DepositsAreIncluded"); } + if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { + $description .= $langs->trans("SupplierDepositsAreNotIncluded"); + } $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } elseif ($modecompta == "RECETTES-DEPENSES") { @@ -636,7 +639,7 @@ if ($modecompta == 'BOOKKEEPING') { $sql .= ", ".MAIN_DB_PREFIX."facture_fourn as f"; $sql .= " WHERE f.fk_soc = s.rowid"; $sql .= " AND f.fk_statut IN (1,2)"; - if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { $sql .= " AND f.type IN (0,1,2)"; } else { $sql .= " AND f.type IN (0,1,2,3)"; @@ -1340,7 +1343,7 @@ if ($modecompta == 'BOOKKEEPING') { $sql = "SELECT date_format(f.datef,'%Y-%m') as dm, sum(f.total_tva) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; $sql .= " WHERE f.fk_statut IN (1,2)"; - if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { $sql .= " AND f.type IN (0,1,2)"; } else { $sql .= " AND f.type IN (0,1,2,3)"; diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 9272cb3838a..9a25e516657 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -164,6 +164,9 @@ if ($modecompta == 'CREANCES-DETTES') { } else { $description .= "
".$langs->trans("DepositsAreIncluded"); } + if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { + $description .= $langs->trans("SupplierDepositsAreNotIncluded"); + } $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } elseif ($modecompta == "RECETTES-DEPENSES") { @@ -329,7 +332,7 @@ if (isModEnabled('facture') && ($modecompta == 'CREANCES-DETTES' || $modecompta $sql = "SELECT sum(f.total_ht) as amount_ht, sum(f.total_ttc) as amount_ttc, date_format(f.datef,'%Y-%m') as dm"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; $sql .= " WHERE f.fk_statut IN (1,2)"; - if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { $sql .= " AND f.type IN (0,1,2)"; } else { $sql .= " AND f.type IN (0,1,2,3)"; @@ -437,7 +440,7 @@ if (isModEnabled('tax') && ($modecompta == 'CREANCES-DETTES' || $modecompta == " $sql = "SELECT sum(f.total_tva) as amount, date_format(f.datef,'%Y-%m') as dm"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; $sql .= " WHERE f.fk_statut IN (1,2)"; - if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { $sql .= " AND f.type IN (0,1,2)"; } else { $sql .= " AND f.type IN (0,1,2,3)"; diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index c4c42a130ad..540009ebd95 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -204,6 +204,9 @@ if ($modecompta == "CREANCES-DETTES") { } else { $description .= $langs->trans("DepositsAreIncluded"); } + if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { + $description .= $langs->trans("SupplierDepositsAreNotIncluded"); + } $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } elseif ($modecompta == "RECETTES-DEPENSES") { @@ -230,8 +233,6 @@ if ($modecompta == "CREANCES-DETTES") { $exportlink = ''; $description = $langs->trans("RulesResultBookkeepingPersonalized"); $description .= ' ('.$langs->trans("SeePageForSetup", DOL_URL_ROOT.'/accountancy/admin/categories_list.php?search_country_id='.$mysoc->country_id.'&mainmenu=accountancy&leftmenu=accountancy_admin', $langs->transnoentitiesnoconv("Accountancy").' / '.$langs->transnoentitiesnoconv("Setup").' / '.$langs->transnoentitiesnoconv("AccountingCategory")).')'; - //if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); - //else $description.= $langs->trans("DepositsAreIncluded"); $builddate = dol_now(); } diff --git a/htdocs/compta/stats/byratecountry.php b/htdocs/compta/stats/byratecountry.php index 86a547204f7..eaec1761117 100644 --- a/htdocs/compta/stats/byratecountry.php +++ b/htdocs/compta/stats/byratecountry.php @@ -224,7 +224,9 @@ if ($conf->global->TAX_MODE_SELL_SERVICE == 'payment') { if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { $description .= '
'.$langs->trans("DepositsAreNotIncluded"); } - +if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { + $description .= $langs->trans("SupplierDepositsAreNotIncluded"); +} // Customers invoices $elementcust = $langs->trans("CustomersInvoices"); $productcust = $langs->trans("ProductOrService"); @@ -255,6 +257,9 @@ if ($modecompta == "CREANCES-DETTES") { } else { $description .= $langs->trans("DepositsAreIncluded"); } + if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { + $description .= $langs->trans("SupplierDepositsAreNotIncluded"); + } $builddate = dol_now(); } elseif ($modecompta == "RECETTES-DEPENSES") { @@ -405,7 +410,7 @@ if ($modecompta == 'CREANCES-DETTES') { $sql2 .= " WHERE ff.datef >= '".$db->idate($date_start)."'"; $sql2 .= " AND ff.datef <= '".$db->idate($date_end)."'"; $sql .= " AND ff.fk_statut in (1,2)"; - if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { $sql .= " AND ff.type IN (0,1,2,5)"; } else { $sql .= " AND ff.type IN (0,1,2,3,5)"; diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 152c6ac0442..b8f6327ccd5 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -246,7 +246,6 @@ if ($modecompta == "CREANCES-DETTES") { } else { $description .= $langs->trans("DepositsAreIncluded"); } - $builddate = dol_now(); } elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("TurnoverCollected").', '.$langs->trans("ByProductsAndServices"); diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index f7b860cd792..a4e6e74cce7 100644 --- a/htdocs/compta/tva/clients.php +++ b/htdocs/compta/tva/clients.php @@ -153,6 +153,9 @@ if ($conf->global->TAX_MODE_SELL_SERVICE == 'payment') { if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { $description .= '
'.$langs->trans("DepositsAreNotIncluded"); } +if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { + $description .= $langs->trans("SupplierDepositsAreNotIncluded"); +} if (!empty($conf->global->MAIN_MODULE_ACCOUNTING)) { $description .= '
'.$langs->trans("ThisIsAnEstimatedValue"); } diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index 16b24361160..f0efe305d8c 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -211,6 +211,9 @@ if ($conf->global->TAX_MODE_SELL_SERVICE == 'payment') { if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { $description .= '
'.$langs->trans("DepositsAreNotIncluded"); } +if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { + $description .= $langs->trans("SupplierDepositsAreNotIncluded"); +} if (!empty($conf->global->MAIN_MODULE_ACCOUNTING)) { $description .= '
'.$langs->trans("ThisIsAnEstimatedValue"); } diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index 15c45d6055b..dc7e868d52c 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -163,6 +163,9 @@ if ($conf->global->TAX_MODE_SELL_SERVICE == 'payment') { if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { $description .= '
'.$langs->trans("DepositsAreNotIncluded"); } +if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { + $description .= $langs->trans("SupplierDepositsAreNotIncluded"); +} if (!empty($conf->global->MAIN_MODULE_ACCOUNTING)) { $description .= '
'.$langs->trans("ThisIsAnEstimatedValue"); } diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php index a0602dfd74e..29ced3591a1 100644 --- a/htdocs/core/lib/tax.lib.php +++ b/htdocs/core/lib/tax.lib.php @@ -174,10 +174,18 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid"; $sql .= " WHERE f.entity IN (".getEntity($invoicetable).")"; $sql .= " AND f.fk_statut in (1,2)"; // Validated or paid (partially or completely) - if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { - $sql .= " AND f.type IN (0,1,2,5)"; + if ($direction == 'buy') { + if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { + $sql .= " AND f.type IN (0,1,2,5)"; + } else { + $sql .= " AND f.type IN (0,1,2,3,5)"; + } } else { - $sql .= " AND f.type IN (0,1,2,3,5)"; + if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + $sql .= " AND f.type IN (0,1,2,5)"; + } else { + $sql .= " AND f.type IN (0,1,2,3,5)"; + } } $sql .= " AND f.rowid = d.".$fk_facture; $sql .= " AND s.rowid = f.fk_soc"; @@ -222,10 +230,18 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid"; $sql .= " WHERE f.entity IN (".getEntity($invoicetable).")"; $sql .= " AND f.fk_statut in (1,2)"; // Paid (partially or completely) - if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { - $sql .= " AND f.type IN (0,1,2,5)"; + if ($direction == 'buy') { + if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { + $sql .= " AND f.type IN (0,1,2,5)"; + } else { + $sql .= " AND f.type IN (0,1,2,3,5)"; + } } else { - $sql .= " AND f.type IN (0,1,2,3,5)"; + if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + $sql .= " AND f.type IN (0,1,2,5)"; + } else { + $sql .= " AND f.type IN (0,1,2,3,5)"; + } } $sql .= " AND f.rowid = d.".$fk_facture; $sql .= " AND s.rowid = f.fk_soc"; @@ -359,10 +375,18 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid"; $sql .= " WHERE f.entity IN (".getEntity($invoicetable).")"; $sql .= " AND f.fk_statut in (1,2)"; // Validated or paid (partially or completely) - if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { - $sql .= " AND f.type IN (0,1,2,5)"; + if ($direction == 'buy') { + if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { + $sql .= " AND f.type IN (0,1,2,5)"; + } else { + $sql .= " AND f.type IN (0,1,2,3,5)"; + } } else { - $sql .= " AND f.type IN (0,1,2,3,5)"; + if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + $sql .= " AND f.type IN (0,1,2,5)"; + } else { + $sql .= " AND f.type IN (0,1,2,3,5)"; + } } $sql .= " AND f.rowid = d.".$fk_facture; $sql .= " AND s.rowid = f.fk_soc"; @@ -407,10 +431,18 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid"; $sql .= " WHERE f.entity IN (".getEntity($invoicetable).")"; $sql .= " AND f.fk_statut in (1,2)"; // Paid (partially or completely) - if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { - $sql .= " AND f.type IN (0,1,2,5)"; + if ($direction == 'buy') { + if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { + $sql .= " AND f.type IN (0,1,2,5)"; + } else { + $sql .= " AND f.type IN (0,1,2,3,5)"; + } } else { - $sql .= " AND f.type IN (0,1,2,3,5)"; + if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + $sql .= " AND f.type IN (0,1,2,5)"; + } else { + $sql .= " AND f.type IN (0,1,2,3,5)"; + } } $sql .= " AND f.rowid = d.".$fk_facture; $sql .= " AND s.rowid = f.fk_soc"; @@ -730,10 +762,18 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid"; $sql .= " WHERE f.entity IN (".getEntity($invoicetable).")"; $sql .= " AND f.fk_statut in (1,2)"; // Validated or paid (partially or completely) - if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { - $sql .= " AND f.type IN (0,1,2,5)"; + if ($direction == 'buy') { + if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { + $sql .= " AND f.type IN (0,1,2,5)"; + } else { + $sql .= " AND f.type IN (0,1,2,3,5)"; + } } else { - $sql .= " AND f.type IN (0,1,2,3,5)"; + if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + $sql .= " AND f.type IN (0,1,2,5)"; + } else { + $sql .= " AND f.type IN (0,1,2,3,5)"; + } } if ($y && $m) { $sql .= " AND f.datef >= '".$db->idate(dol_get_first_day($y, $m, false))."'"; @@ -776,10 +816,18 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid"; $sql .= " WHERE f.entity IN (".getEntity($invoicetable).")"; $sql .= " AND f.fk_statut in (1,2)"; // Paid (partially or completely) - if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { - $sql .= " AND f.type IN (0,1,2,5)"; + if ($direction == 'buy') { + if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { + $sql .= " AND f.type IN (0,1,2,5)"; + } else { + $sql .= " AND f.type IN (0,1,2,3,5)"; + } } else { - $sql .= " AND f.type IN (0,1,2,3,5)"; + if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + $sql .= " AND f.type IN (0,1,2,5)"; + } else { + $sql .= " AND f.type IN (0,1,2,3,5)"; + } } if ($y && $m) { $sql .= " AND pa.datep >= '".$db->idate(dol_get_first_day($y, $m, false))."'"; @@ -915,10 +963,18 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid"; $sql .= " WHERE f.entity IN (".getEntity($invoicetable).")"; $sql .= " AND f.fk_statut in (1,2)"; // Validated or paid (partially or completely) - if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { - $sql .= " AND f.type IN (0,1,2,5)"; + if ($direction == 'buy') { + if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { + $sql .= " AND f.type IN (0,1,2,5)"; + } else { + $sql .= " AND f.type IN (0,1,2,3,5)"; + } } else { - $sql .= " AND f.type IN (0,1,2,3,5)"; + if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + $sql .= " AND f.type IN (0,1,2,5)"; + } else { + $sql .= " AND f.type IN (0,1,2,3,5)"; + } } if ($y && $m) { $sql .= " AND f.datef >= '".$db->idate(dol_get_first_day($y, $m, false))."'"; @@ -961,10 +1017,18 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid"; $sql .= " WHERE f.entity IN (".getEntity($invoicetable).")"; $sql .= " AND f.fk_statut in (1,2)"; // Paid (partially or completely) - if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { - $sql .= " AND f.type IN (0,1,2,5)"; + if ($direction == 'buy') { + if (!empty($conf->global->FACTURE_SUPPLIER_DEPOSITS_ARE_JUST_PAYMENTS)) { + $sql .= " AND f.type IN (0,1,2,5)"; + } else { + $sql .= " AND f.type IN (0,1,2,3,5)"; + } } else { - $sql .= " AND f.type IN (0,1,2,3,5)"; + if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + $sql .= " AND f.type IN (0,1,2,5)"; + } else { + $sql .= " AND f.type IN (0,1,2,3,5)"; + } } if ($y && $m) { $sql .= " AND pa.datep >= '".$db->idate(dol_get_first_day($y, $m, false))."'"; From 4cf294f14a3d961a0ac303c57ea13f94abf26510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 12 Oct 2022 13:42:47 +0200 Subject: [PATCH 12/14] typo --- htdocs/core/modules/modFacture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 9eac5d7b5e7..2cc4b1f7429 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -239,7 +239,7 @@ class modFacture extends DolibarrModules 'f.ref' => 'InvoiceRef*', 'f.ref_ext' => 'ExternalRef', 'f.ref_int' => 'ExternalRef', - 'f.ref_client' => 'CutomerRef', + 'f.ref_client' => 'CustomerRef', 'f.type' => 'Type*', 'f.fk_soc' => 'Customer*', 'f.datec' => 'InvoiceDateCreation', From 541b4e0b64cbb0ecdf95bc1dc66089a0bb5ab788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 12 Oct 2022 13:49:04 +0200 Subject: [PATCH 13/14] Update modFacture.class.php --- htdocs/core/modules/modFacture.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 2cc4b1f7429..23b9ea85639 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2021 Alexandre Spangaro + * Copyright (C) 2022 Frédéric France * * 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 @@ -352,7 +353,7 @@ class modFacture extends DolibarrModules ) ); - //Import Supplier Invoice Lines + // Import Invoice Lines $r++; $this->import_code[$r] = $this->rights_class.'_'.$r; $this->import_label[$r] = "InvoiceLine"; // Translation key From 374e56d93855f3bb052921607c2a55eb98b23596 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 13 Oct 2022 00:50:55 +0200 Subject: [PATCH 14/14] FIX #22538 --- htdocs/install/mysql/tables/llx_establishment.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/tables/llx_establishment.sql b/htdocs/install/mysql/tables/llx_establishment.sql index 7159a53059c..0e951e93c5a 100644 --- a/htdocs/install/mysql/tables/llx_establishment.sql +++ b/htdocs/install/mysql/tables/llx_establishment.sql @@ -22,6 +22,7 @@ CREATE TABLE llx_establishment ( rowid integer NOT NULL auto_increment PRIMARY KEY, entity integer NOT NULL DEFAULT 1, + label varchar(255), ref varchar(30), name varchar(128), address varchar(255),