From d0508d557b92468b694f89fa1dec88bda9c8f9b6 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 30 Sep 2021 14:56:02 +0200 Subject: [PATCH 1/6] fix: checkbox for line selection between supplier order and supplier invoice was infective --- htdocs/fourn/facture/card.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index c063e636a91..690c232cb64 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -668,6 +668,7 @@ if (empty($reshook)) elseif ($action == 'add' && $usercancreate) { if ($socid > 0) $object->socid = GETPOST('socid', 'int'); + $selectedLines = GETPOST('toselect', 'array'); $db->begin(); @@ -980,6 +981,8 @@ if (empty($reshook)) $num = count($lines); for ($i = 0; $i < $num; $i++) // TODO handle subprice < 0 { + if (!in_array($lines[$i]->id, $selectedLines)) continue; // Skip unselected lines + $desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle); $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0); @@ -2239,9 +2242,6 @@ if ($action == 'create') print ''; print ''; - print "\n"; - - // Show origin lines if (is_object($objectsrc)) { @@ -2256,6 +2256,8 @@ if ($action == 'create') print ''; } + + print "\n"; } else { From 6d00097c896ac40360dd0186949184f2ea8ed095 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 30 Sep 2021 16:37:52 +0200 Subject: [PATCH 2/6] fix --- htdocs/fourn/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 690c232cb64..778c1db1aaf 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2252,7 +2252,7 @@ if ($action == 'create') print ''; - $objectsrc->printOriginLinesList(); + $objectsrc->printOriginLinesList('', $selectedLines); print '
'; } From 157112758b297ace525aa1d056efd23797dd47ae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 30 Sep 2021 20:14:59 +0200 Subject: [PATCH 3/6] Fix phpcs --- htdocs/comm/action/class/actioncomm.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index ff30f16b8dd..e5b8ff0f49c 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -788,9 +788,7 @@ class ActionComm extends CommonObject } $this->db->free($resql); - } - else - { + } else { $this->error = $this->db->lasterror(); return -1; } From 1c56f65c27c293ab9551cc23d63f8550adce97c3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Oct 2021 11:49:49 +0200 Subject: [PATCH 4/6] Fix missing migration instruction --- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index cb466f94b10..cf4b5747684 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -37,6 +37,7 @@ ALTER TABLE llx_prelevement_bons ADD COLUMN type varchar(16) DEFAULT 'debit-orde ALTER TABLE llx_prelevement_facture CHANGE COLUMN fk_facture_foun fk_facture_fourn integer NULL; +ALTER TABLE llx_prelevement_facture_demande ADD COLUMN fk_facture_fourn INTEGER NULL; ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture (fk_facture); ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture_fourn (fk_facture_fourn); From 10f0434116ee3898a8e6b41cdb8f8f4c0958ae37 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Oct 2021 15:30:19 +0200 Subject: [PATCH 5/6] Update card.php --- htdocs/fourn/facture/card.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 778c1db1aaf..e4aeae07581 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -981,8 +981,10 @@ if (empty($reshook)) $num = count($lines); for ($i = 0; $i < $num; $i++) // TODO handle subprice < 0 { - if (!in_array($lines[$i]->id, $selectedLines)) continue; // Skip unselected lines - + if (!in_array($lines[$i]->id, $selectedLines)) { + continue; // Skip unselected lines + } + $desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle); $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0); From 5910d100217c88ab6ac854c0ff17094bfbed67bd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Oct 2021 10:43:50 +0200 Subject: [PATCH 6/6] Add hidden option to allow to fix corrupted situations --- htdocs/compta/paiement/card.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index bc62064dc82..a90a52c4e20 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -443,11 +443,13 @@ if ($resql) print ''.$invoice->getLibStatut(5, $alreadypayed).''; print "\n"; - if ($objp->paye == 1) // If at least one invoice is paid, disable delete - { + + // If at least one invoice is paid, disable delete. INVOICE_CAN_DELETE_PAYMENT_EVEN_IF_INVOICE_CLOSED Can be use for maintenance purpose. Never use this in production + if ($objp->paye == 1 && empty($conf->global->INVOICE_CAN_DELETE_PAYMENT_EVEN_IF_INVOICE_CLOSED)) { $disable_delete = 1; $title_button = dol_escape_htmltag($langs->transnoentitiesnoconv("CantRemovePaymentWithOneInvoicePaid")); } + $total = $total + $objp->amount; $i++; }