From 6e1702c1a5c40e486bc8dfa3af757bbd23a92b4d Mon Sep 17 00:00:00 2001 From: John Botella Date: Mon, 17 Aug 2020 15:00:31 +0200 Subject: [PATCH 01/23] Fix infinite fetch object linked loop --- htdocs/core/lib/pdf.lib.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 1d9d218f7af..3c6bf0765ed 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2127,8 +2127,13 @@ function pdf_getLinkedObjects($object,$outputlangs) // We concat this record info into fields xxx_value. title is overwrote. if (empty($object->linkedObjects['commande']) && $object->element != 'commande') // There is not already a link to order and object is not the order, so we show also info with order { - $elementobject->fetchObjectLinked(); - if (! empty($elementobject->linkedObjects['commande'])) $order = reset($elementobject->linkedObjects['commande']); + $elementobject->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0); + if (! empty($elementobject->linkedObjectsIds['commande'])){ + dol_include_once('/commande/commande.class.php'); + $order = new Commande($object->db); + $ret = $order->fetch(reset($elementobject->linkedObjectsIds['commande'])); + if ($ret < 1){ $order=null; } + } } if (! is_object($order)) { From b4d2bf98fa84547e916ef1b19b4427d9cb73c9e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 20 Aug 2020 12:14:40 +0200 Subject: [PATCH 02/23] Use of undefined constant state - assumed 'state' --- htdocs/includes/OAuth/Common/Storage/DoliStorage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/includes/OAuth/Common/Storage/DoliStorage.php b/htdocs/includes/OAuth/Common/Storage/DoliStorage.php index 463afe194db..f0383fdf06f 100644 --- a/htdocs/includes/OAuth/Common/Storage/DoliStorage.php +++ b/htdocs/includes/OAuth/Common/Storage/DoliStorage.php @@ -242,7 +242,7 @@ class DoliStorage implements TokenStorageInterface $sql.= " WHERE service='".$this->db->escape($service)."'"; $resql = $this->db->query($sql); $result = $this->db->fetch_array($resql); - $states[$service] = $result[state]; + $states[$service] = $result['state']; $this->states[$service] = $states[$service]; return is_array($states) From eba4d44c81c4b0f7f7dea8268af519e6566c1902 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 20 Aug 2020 20:24:00 +0200 Subject: [PATCH 03/23] Fix Stripe icon in balance list --- htdocs/societe/paymentmodes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 0de15ef9481..b29a3073c85 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -1331,7 +1331,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' // List of Stripe payment modes if (!empty($conf->stripe->enabled) && !empty($conf->stripeconnect->enabled) && $object->fournisseur && !empty($stripesupplieracc)) { - print load_fiche_titre($langs->trans('StripeBalance').($stripesupplieracc ? ' (Stripe connection with StripeConnect account '.$stripesupplieracc.')' : ' (Stripe connection with keys from Stripe module setup)'), $morehtmlright, ''); + print load_fiche_titre($langs->trans('StripeBalance').($stripesupplieracc ? ' (Stripe connection with StripeConnect account '.$stripesupplieracc.')' : ' (Stripe connection with keys from Stripe module setup)'), $morehtmlright, 'stripe-s'); $balance = \Stripe\Balance::retrieve(array("stripe_account" => $stripesupplieracc)); print ''."\n"; print ''; From 142ce7c03f810d1fd70aeff8673d2db2f6fe6158 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 21 Aug 2020 04:58:21 +0200 Subject: [PATCH 04/23] Fix Missing language key --- htdocs/product/fournisseurs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 563fb881152..9140de09513 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -42,7 +42,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_expression.cl require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; if (!empty($conf->barcode->enabled)) dol_include_once('/core/class/html.formbarcode.class.php'); // Load translation files required by the page -$langs->loadLangs(array('products', 'suppliers', 'bills', 'margins')); +$langs->loadLangs(array('products', 'suppliers', 'bills', 'margins', 'stocks')); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); From bd5e35c15f91b8ce1993447be2cf9e2f6b74a8cd Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 21 Aug 2020 05:00:38 +0200 Subject: [PATCH 05/23] Fix Missing language key --- htdocs/langs/en_US/main.lang | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 8f79f9525ec..6d2892cddad 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1071,4 +1071,5 @@ SwitchInEditModeToAddTranslation=Switch in edit mode to add translations for thi NotUsedForThisCustomer=Not used for this customer AmountMustBePositive=Amount must be positive ByStatus=By status -InformationMessage=Information \ No newline at end of file +InformationMessage=Information +Used=Used From 881a9b7c047468b743ce9578038673d3aeb93adc Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 21 Aug 2020 05:10:19 +0200 Subject: [PATCH 06/23] Fix Missing language key on rights --- htdocs/langs/en_US/admin.lang | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 90b95883673..73991c172cb 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -851,6 +851,7 @@ Permission773=Delete expense reports Permission774=Read all expense reports (even for user not subordinates) Permission775=Approve expense reports Permission776=Pay expense reports +Permission777=Read expense reports of everybody Permission779=Export expense reports Permission1001=Read stocks Permission1002=Create/modify warehouses @@ -2011,4 +2012,4 @@ MeasuringUnitTypeDesc=Use here a value like "size", "surface", "volume", "weight MeasuringScaleDesc=The scale is the number of places you have to move the decimal part to match the default reference unit. For "time" unit type, it is the number of seconds. Values between 80 and 99 are reserved values. TemplateAdded=Template added TemplateUpdated=Template updated -TemplateDeleted=Template deleted \ No newline at end of file +TemplateDeleted=Template deleted From 646d5cc9c89f1c4ad9511319d52f7448d5db5747 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 21 Aug 2020 05:19:57 +0200 Subject: [PATCH 07/23] Fix Missing language key on rights --- htdocs/langs/en_US/admin.lang | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 73991c172cb..acfc58b7ad2 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -839,6 +839,10 @@ Permission532=Create/modify services Permission534=Delete services Permission536=See/manage hidden services Permission538=Export services +Permission561=Read bank transfer payment orders +Permission562=Create/modify a bank transfer payment order +Permission563=Send/Transmit bank transfer payment order +Permission564=Record Debits/Rejects of bank transfer payment order Permission650=Read Bills of Materials Permission651=Create/Update Bills of Materials Permission652=Delete Bills of Materials From dd87362ce372a985903e6d0c861b3ec3286d0f78 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 21 Aug 2020 05:20:53 +0200 Subject: [PATCH 08/23] Fix Missing language key on rights --- htdocs/langs/en_US/admin.lang | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index acfc58b7ad2..1e72900bd12 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -846,6 +846,9 @@ Permission564=Record Debits/Rejects of bank transfer payment order Permission650=Read Bills of Materials Permission651=Create/Update Bills of Materials Permission652=Delete Bills of Materials +Permission660=Read Manufacturing Order +Permission661=Create/Update Manufacturing Order +Permission662=Delete Manufacturing Order Permission701=Read donations Permission702=Create/modify donations Permission703=Delete donations From 76315fa6ac559b6ebc6dac89141da9e0142840b3 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 21 Aug 2020 05:22:31 +0200 Subject: [PATCH 09/23] Fix Missing language key on rights --- htdocs/langs/en_US/admin.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 1e72900bd12..af561bf89c1 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -911,6 +911,7 @@ Permission2515=Setup documents directories Permission2801=Use FTP client in read mode (browse and download only) Permission2802=Use FTP client in write mode (delete or upload files) Permission3200=Read archived events and fingerprints +Permission3301=Generate new modules Permission4001=See employees Permission4002=Create employees Permission4003=Delete employees From 065ace5301d32d32519ae3e4604f3b8495787d6d Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 21 Aug 2020 05:26:07 +0200 Subject: [PATCH 10/23] Fix Missing language key on rights --- htdocs/langs/en_US/admin.lang | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index af561bf89c1..341164ee2c7 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -846,9 +846,9 @@ Permission564=Record Debits/Rejects of bank transfer payment order Permission650=Read Bills of Materials Permission651=Create/Update Bills of Materials Permission652=Delete Bills of Materials -Permission660=Read Manufacturing Order -Permission661=Create/Update Manufacturing Order -Permission662=Delete Manufacturing Order +Permission660=Read Manufacturing Order (MO) +Permission661=Create/Update Manufacturing Order (MO) +Permission662=Delete Manufacturing Order (MO) Permission701=Read donations Permission702=Create/modify donations Permission703=Delete donations From bf28201685a65d70f82be93bf816d6e4d08f76aa Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 23 Aug 2020 07:13:43 +0200 Subject: [PATCH 11/23] Fix Missing language key --- htdocs/core/class/infobox.class.php | 4 ++-- htdocs/langs/en_US/boxes.lang | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php index de00ea85e6f..ffba924b1ea 100644 --- a/htdocs/core/class/infobox.class.php +++ b/htdocs/core/class/infobox.class.php @@ -41,7 +41,7 @@ class InfoBox { return array( 0 => 'Home', - 27 => 'Accountancy Home' + 27 => 'AccountancyHome' ); } else @@ -74,7 +74,7 @@ class InfoBox 24 => 'expensereportindex', 25 => 'mailingindex', 26 => 'opensurveyindex', - 27 => 'Accountancy Home' + 27 => 'AccountancyHome' ); } } diff --git a/htdocs/langs/en_US/boxes.lang b/htdocs/langs/en_US/boxes.lang index bd62684421a..2405bfd5e64 100644 --- a/htdocs/langs/en_US/boxes.lang +++ b/htdocs/langs/en_US/boxes.lang @@ -100,3 +100,5 @@ SuspenseAccountNotDefined=Suspense account isn't defined BoxLastCustomerShipments=Last customer shipments BoxTitleLastCustomerShipments=Latest %s customer shipments NoRecordedShipments=No recorded customer shipment +# Pages +AccountancyHome=Accountancy From 9b7691c8d2459717e1ea7f82f95ca1386cb810bb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Aug 2020 18:04:02 +0200 Subject: [PATCH 12/23] Update admin.lang --- htdocs/langs/en_US/admin.lang | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 341164ee2c7..72c741c9056 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -839,10 +839,10 @@ Permission532=Create/modify services Permission534=Delete services Permission536=See/manage hidden services Permission538=Export services -Permission561=Read bank transfer payment orders -Permission562=Create/modify a bank transfer payment order -Permission563=Send/Transmit bank transfer payment order -Permission564=Record Debits/Rejects of bank transfer payment order +Permission561=Read payment orders by credit transfer +Permission562=Create/modify payment order by credit transfer +Permission563=Send/Transmit payment order by credit transfer +Permission564=Record Debits/Rejections of credit transfer Permission650=Read Bills of Materials Permission651=Create/Update Bills of Materials Permission652=Delete Bills of Materials From 6685cc5bc8ab4b74669cfedfacbd9f95872a3044 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Aug 2020 18:07:18 +0200 Subject: [PATCH 13/23] Update admin.lang --- htdocs/langs/en_US/admin.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 72c741c9056..482f89b30e7 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -859,6 +859,7 @@ Permission774=Read all expense reports (even for user not subordinates) Permission775=Approve expense reports Permission776=Pay expense reports Permission777=Read expense reports of everybody +Permission778=Create/modify expense reports of everybody Permission779=Export expense reports Permission1001=Read stocks Permission1002=Create/modify warehouses From 7eb003c6843a17a1cad2ef57a183bc3dcc326c73 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Aug 2020 19:11:19 +0200 Subject: [PATCH 14/23] Update pdf.lib.php --- htdocs/core/lib/pdf.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 3c6bf0765ed..c83b7f28ce6 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2129,7 +2129,7 @@ function pdf_getLinkedObjects($object,$outputlangs) { $elementobject->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0); if (! empty($elementobject->linkedObjectsIds['commande'])){ - dol_include_once('/commande/commande.class.php'); + include_once DOL_DOCUMENT_ROOT.'/commande/commande.class.php'; $order = new Commande($object->db); $ret = $order->fetch(reset($elementobject->linkedObjectsIds['commande'])); if ($ret < 1){ $order=null; } From b44d6744f9b496972491615f9c28ac445ccf6abe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Aug 2020 19:11:40 +0200 Subject: [PATCH 15/23] Update pdf.lib.php --- htdocs/core/lib/pdf.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index c83b7f28ce6..c0c7c7d0f9b 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2132,7 +2132,7 @@ function pdf_getLinkedObjects($object,$outputlangs) include_once DOL_DOCUMENT_ROOT.'/commande/commande.class.php'; $order = new Commande($object->db); $ret = $order->fetch(reset($elementobject->linkedObjectsIds['commande'])); - if ($ret < 1){ $order=null; } + if ($ret < 1) { $order=null; } } } if (! is_object($order)) From 7a183ea026bc0189f07ac803e006124a07eefe40 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Aug 2020 19:13:30 +0200 Subject: [PATCH 16/23] Update pdf.lib.php --- htdocs/core/lib/pdf.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index c0c7c7d0f9b..54252923ad6 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2071,7 +2071,7 @@ function pdf_getTotalQty($object,$type,$outputlangs) */ function pdf_getLinkedObjects($object,$outputlangs) { - global $hookmanager; + global $db, $hookmanager; $linkedobjects=array(); @@ -2130,7 +2130,7 @@ function pdf_getLinkedObjects($object,$outputlangs) $elementobject->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0); if (! empty($elementobject->linkedObjectsIds['commande'])){ include_once DOL_DOCUMENT_ROOT.'/commande/commande.class.php'; - $order = new Commande($object->db); + $order = new Commande($db); $ret = $order->fetch(reset($elementobject->linkedObjectsIds['commande'])); if ($ret < 1) { $order=null; } } From 74eac1d06a1708152b8232be83e897385724eafa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Aug 2020 19:22:01 +0200 Subject: [PATCH 17/23] Fix include regression --- htdocs/core/lib/pdf.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 54252923ad6..6a1ebacdab1 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -2129,7 +2129,7 @@ function pdf_getLinkedObjects($object,$outputlangs) { $elementobject->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0); if (! empty($elementobject->linkedObjectsIds['commande'])){ - include_once DOL_DOCUMENT_ROOT.'/commande/commande.class.php'; + include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $order = new Commande($db); $ret = $order->fetch(reset($elementobject->linkedObjectsIds['commande'])); if ($ret < 1) { $order=null; } From 9da49469551848837a3bd52b75a891d020e8188e Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 24 Aug 2020 12:26:40 +0200 Subject: [PATCH 18/23] Fix for better code --- htdocs/takepos/pay.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index b2534272ae2..cea50d390aa 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -341,8 +341,7 @@ if ($conf->global->TAKEPOS_ENABLE_SUMUP) { if (!empty($conf->global->$keyforsumupbank)) { print ''; } else { - $langs->load("errors"); - $langs->load("admin"); + $langs->loadLangs(array("errors", "admin"); print ''; } } From ff621cb146506ed6acb2d2c4bb84400bfae73a3f Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 24 Aug 2020 12:27:19 +0200 Subject: [PATCH 19/23] Update pay.php --- htdocs/takepos/pay.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index cea50d390aa..031c3cc8f2d 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -341,7 +341,7 @@ if ($conf->global->TAKEPOS_ENABLE_SUMUP) { if (!empty($conf->global->$keyforsumupbank)) { print ''; } else { - $langs->loadLangs(array("errors", "admin"); + $langs->loadLangs(array("errors", "admin")); print ''; } } From 05d82a06846a06adcfc34e39cdcd81012ebb01b5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Aug 2020 17:07:30 +0200 Subject: [PATCH 20/23] FIX Error management. Do no try to approve PO if validation fails. --- htdocs/fourn/commande/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 19e6f100609..9341bc24c4b 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -854,11 +854,12 @@ if (empty($reshook)) } else { + $error++; setEventMessages($object->error, $object->errors, 'errors'); } // If we have permission, and if we don't need to provide the idwarehouse, we go directly on approved step - if (empty($conf->global->SUPPLIER_ORDER_NO_DIRECT_APPROVE) && $user->rights->fournisseur->commande->approuver && !(!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) && $object->hasProductsOrServices(1))) + if (!$error && empty($conf->global->SUPPLIER_ORDER_NO_DIRECT_APPROVE) && $user->rights->fournisseur->commande->approuver && !(!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) && $object->hasProductsOrServices(1))) { $action = 'confirm_approve'; // can make standard or first level approval also if permission is set } From 0adf267f668e322adda4abf6948c3e67e2ccc817 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 25 Aug 2020 21:31:04 +0200 Subject: [PATCH 21/23] Fix Accountancy Listbyaccount Error missing formfile->getDocumentsLink --- htdocs/accountancy/bookkeeping/listbyaccount.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 25f664d955e..5a1056f8d50 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -2,8 +2,8 @@ /* Copyright (C) 2016 Neil Orley * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2016 Florian Henry - * Copyright (C) 2013-2018 Alexandre Spangaro - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2013-2020 Alexandre Spangaro + * Copyright (C) 2018 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 @@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; @@ -293,6 +294,7 @@ if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->suppri */ $formaccounting = new FormAccounting($db); +$formfile = new FormFile($db); $formother = new FormOther($db); $form = new Form($db); @@ -551,7 +553,7 @@ while ($i < min($num, $limit)) // Show the break account print ""; - print ''; From 243f59b9e90820e23cebf7a3f21cfcad2d102e15 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 26 Aug 2020 17:09:45 +0200 Subject: [PATCH 22/23] FIX Missing transaction on PO actions --- htdocs/fourn/commande/card.php | 79 +++++++++++++++++++++++++++++----- htdocs/fourn/facture/card.php | 4 +- 2 files changed, 71 insertions(+), 12 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 9341bc24c4b..3fb7ae18cbc 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -653,7 +653,9 @@ if (empty($reshook)) */ if ($action == 'updateline' && $user->rights->fournisseur->commande->creer && !GETPOST('cancel', 'alpha')) { - $vat_rate = (GETPOST('tva_tx') ?GETPOST('tva_tx') : 0); + $db->begin(); + + $vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); if ($lineid) { @@ -783,9 +785,13 @@ if (empty($reshook)) $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result < 0) dol_print_error($db, $result); } + + $db->commit(); } else { + $db->rollback(); + dol_print_error($db, $object->error); exit; } @@ -794,6 +800,8 @@ if (empty($reshook)) // Remove a product line if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->fournisseur->commande->creer) { + $db->begin(); + $result = $object->deleteline($lineid); if ($result > 0) { @@ -812,16 +820,23 @@ if (empty($reshook)) $ret = $object->fetch($object->id); // Reload to get new records $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } - - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); - exit; } else { + $error++; setEventMessages($object->error, $object->errors, 'errors'); - /* Fix bug 1485 : Reset action to avoid asking again confirmation on failure */ + // Reset action to avoid asking again confirmation on failure $action = ''; } + + if (!$error) { + $db->commit(); + + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + exit; + } else { + $db->rollback(); + } } // Validate @@ -830,6 +845,8 @@ if (empty($reshook)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->supplier_order_advance->validate))) ) { + $db->begin(); + $object->date_commande = dol_now(); $result = $object->valid($user); if ($result >= 0) @@ -849,7 +866,10 @@ if (empty($reshook)) $ret = $object->fetch($id); // Reload to get new records $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); - if ($result < 0) dol_print_error($db, $result); + if ($result < 0) { + $error++; + dol_print_error($db, $result); + } } } else @@ -863,10 +883,18 @@ if (empty($reshook)) { $action = 'confirm_approve'; // can make standard or first level approval also if permission is set } + + if (! $error) { + $db->commit(); + } else { + $db->rollback(); + } } if (($action == 'confirm_approve' || $action == 'confirm_approve2') && $confirm == 'yes' && $user->rights->fournisseur->commande->approuver) { + $db->begin(); + $idwarehouse = GETPOST('idwarehouse', 'int'); $qualified_for_stock_change = 0; @@ -906,14 +934,22 @@ if (empty($reshook)) } $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } - header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); - exit; } else { + $error++; setEventMessages($object->error, $object->errors, 'errors'); } } + + if (!$error) { + $db->commit(); + + header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); + exit; + } else { + $db->rollback(); + } } if ($action == 'confirm_refuse' && $confirm == 'yes' && $user->rights->fournisseur->commande->approuver) @@ -942,6 +978,8 @@ if (empty($reshook)) if ($action == 'confirm_commande' && $confirm == 'yes' && $user->rights->fournisseur->commande->commander) { + $db->begin(); + $result = $object->commande($user, GETPOST("datecommande"), GETPOST("methode", 'int'), GETPOST('comment', 'alphanohtml')); if ($result > 0) { @@ -958,13 +996,21 @@ if (empty($reshook)) $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } $action = ''; - header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); - exit; } else { + $error++; setEventMessages($object->error, $object->errors, 'errors'); } + + if (!$error) { + $db->commit(); + + header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); + exit; + } else { + $db->rollback(); + } } @@ -1014,6 +1060,8 @@ if (empty($reshook)) // Set status of reception (complete, partial, ...) if ($action == 'livraison' && $user->rights->fournisseur->commande->receptionner) { + $db->begin(); + if (GETPOST("type") != '') { $date_liv = dol_mktime(GETPOST('rehour'), GETPOST('remin'), GETPOST('resec'), GETPOST("remonth"), GETPOST("reday"), GETPOST("reyear")); @@ -1027,17 +1075,26 @@ if (empty($reshook)) } elseif ($result == -3) { + $error++; setEventMessages($object->error, $object->errors, 'errors'); } else { + $error++; setEventMessages($object->error, $object->errors, 'errors'); } } else { + $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Delivery")), null, 'errors'); } + + if (! $error) { + $db->commit(); + } else { + $db->rollback(); + } } if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->fournisseur->commande->commander) @@ -1971,7 +2028,7 @@ elseif (!empty($object->id)) $morehtmlref .= '
'; $morehtmlref .= ''; $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref .= $formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1, 0, 'maxwidth500'); $morehtmlref .= ''; $morehtmlref .= ''; } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 10cf8ee1b6f..6e502b88ac0 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1827,7 +1827,9 @@ if ($action == 'create') print '
'; // Ref supplier - print ''; + print ''; print ''; print '
'; + print ''; if ($line->numero_compte != "" && $line->numero_compte != '-1') print length_accountg($line->numero_compte).' : '.$object->get_compte_desc($line->numero_compte); else print ''.$langs->trans("Unknown").''; print '
'.$langs->trans('RefSupplier').'
'.$langs->trans('RefSupplier').'id > 0) print ' autofocus'; + print '>
'.$langs->trans('Type').''; From c6bdd27d4c4be379b87edde0f8de0db422b3429d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 27 Aug 2020 21:52:25 +0200 Subject: [PATCH 23/23] FIX #14530 --- .../install/mysql/migration/11.0.0-12.0.0.sql | 18 +++++++++++------- .../tables/llx_mrp_mo_extrafields.key.sql | 2 +- .../mysql/tables/llx_mrp_mo_extrafields.sql | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index 2d5bcd5d28e..994e5d89495 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -50,8 +50,8 @@ create table llx_c_shipment_package_type rowid integer AUTO_INCREMENT PRIMARY KEY, label varchar(50) NOT NULL, -- Short name description varchar(255), -- Description - active integer DEFAULT 1 NOT NULL, -- Active or not - entity integer DEFAULT 1 NOT NULL -- Multi company id + active integer DEFAULT 1 NOT NULL, -- Active or not + entity integer DEFAULT 1 NOT NULL -- Multi company id )ENGINE=innodb; create table llx_facturedet_rec_extrafields @@ -74,7 +74,11 @@ create table llx_mrp_mo_extrafields import_key varchar(14) -- import key ) ENGINE=innodb; -ALTER TABLE llx_mrp_mo_extrafields ADD INDEX idx_fk_object(fk_object); +ALTER TABLE llx_mrp_mo_extrafields DROP INDEX idx_fk_object; + +ALTER TABLE llx_mrp_mo_extrafields ADD INDEX idx_mrp_mo_fk_object(fk_object); + + -- This var is per entity now, so we remove const if global if exists delete from llx_const where name in ('PROJECT_HIDE_TASKS', 'MAIN_BUGTRACK_ENABLELINK', 'MAIN_HELP_DISABLELINK') and entity = 0; @@ -112,7 +116,7 @@ UPDATE llx_website_page SET lang = 'it' WHERE lang like 'it_%'; UPDATE llx_website_page SET lang = 'pt' WHERE lang like 'pt_%'; ALTER TABLE llx_website ADD COLUMN lang varchar(8); -ALTER TABLE llx_website ADD COLUMN otherlang varchar(255); +ALTER TABLE llx_website ADD COLUMN otherlang varchar(255); ALTER TABLE llx_website_page ADD COLUMN author_alias varchar(64); @@ -282,6 +286,7 @@ ALTER TABLE llx_commande_fournisseur_dispatch MODIFY COLUMN batch varchar(128); ALTER TABLE llx_stock_mouvement MODIFY COLUMN batch varchar(128); ALTER TABLE llx_mrp_production MODIFY COLUMN batch varchar(128); ALTER TABLE llx_mrp_production MODIFY qty real NOT NULL DEFAULT 1; +ALTER TABLE llx_expeditiondet_batch MODIFY COLUMN batch varchar(128); create table llx_categorie_website_page ( @@ -297,14 +302,13 @@ ALTER TABLE llx_categorie_website_page ADD INDEX idx_categorie_website_page_fk_w ALTER TABLE llx_categorie_website_page ADD CONSTRAINT fk_categorie_website_page_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); ALTER TABLE llx_categorie_website_page ADD CONSTRAINT fk_categorie_website_page_website_page_rowid FOREIGN KEY (fk_website_page) REFERENCES llx_website_page (rowid); -ALTER TABLE llx_categorie ADD COLUMN date_creation datetime; +ALTER TABLE llx_categorie ADD COLUMN date_creation datetime; ALTER TABLE llx_categorie ADD COLUMN tms timestamp; ALTER TABLE llx_categorie ADD COLUMN fk_user_creat integer; ALTER TABLE llx_categorie ADD COLUMN fk_user_modif integer; ALTER TABLE llx_commandedet ADD CONSTRAINT fk_commandedet_fk_commandefourndet FOREIGN KEY (fk_commandefourndet) REFERENCES llx_commande_fournisseurdet (rowid); - -- VMYSQL4.3 ALTER TABLE llx_prelevement_facture_demande MODIFY COLUMN fk_facture INTEGER NULL; -- VPGSQL8.2 ALTER TABLE llx_prelevement_facture_demande ALTER COLUMN fk_facture DROP NOT NULL; ALTER TABLE llx_prelevement_facture_demande ADD COLUMN fk_facture_fourn INTEGER NULL; @@ -315,7 +319,7 @@ ALTER TABLE llx_prelevement_facture ADD COLUMN fk_facture_fourn INTEGER NULL; ALTER TABLE llx_menu MODIFY COLUMN module varchar(255); -UPDATE llx_actioncomm SET fk_action = 50 where fk_action = 40 AND code = 'TICKET_MSG'; +UPDATE llx_actioncomm SET fk_action = 50 where fk_action = 40 AND code = 'TICKET_MSG'; ALTER TABLE llx_emailcollector_emailcollector ADD COLUMN hostcharset varchar(16) DEFAULT 'UTF-8'; diff --git a/htdocs/install/mysql/tables/llx_mrp_mo_extrafields.key.sql b/htdocs/install/mysql/tables/llx_mrp_mo_extrafields.key.sql index 5b280acc41f..b77c81aa7f1 100644 --- a/htdocs/install/mysql/tables/llx_mrp_mo_extrafields.key.sql +++ b/htdocs/install/mysql/tables/llx_mrp_mo_extrafields.key.sql @@ -15,5 +15,5 @@ -- BEGIN MODULEBUILDER INDEXES -ALTER TABLE llx_mrp_myobject_extrafields ADD INDEX idx_fk_object(fk_object); +ALTER TABLE llx_mrp_mo_extrafields ADD INDEX idx_mrp_mo_fk_object(fk_object); -- END MODULEBUILDER INDEXES diff --git a/htdocs/install/mysql/tables/llx_mrp_mo_extrafields.sql b/htdocs/install/mysql/tables/llx_mrp_mo_extrafields.sql index 9245ac1c341..97eab584cc7 100644 --- a/htdocs/install/mysql/tables/llx_mrp_mo_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_mrp_mo_extrafields.sql @@ -13,7 +13,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see http://www.gnu.org/licenses/. -create table llx_mrp_myobject_extrafields +create table llx_mrp_mo_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, tms timestamp,