From abc7198db4e1a66849d4e34046d5c9096e3393ca Mon Sep 17 00:00:00 2001 From: Pierre Ardoin <32256817+mapiolca@users.noreply.github.com> Date: Mon, 28 Oct 2019 12:51:12 +0100 Subject: [PATCH 1/6] Fix Multicompany Filter Select only invoice in current company. --- htdocs/margin/customerMargins.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index b3a2c59e63f..32ef5030cb8 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -220,6 +220,7 @@ if ($socid > 0) $sql.= ' AND s.rowid = '.$socid; if (!$user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $sql.= " AND f.fk_statut NOT IN (" . implode(', ', $invoice_status_except_list) . ")"; $sql.= ' AND s.entity IN ('.getEntity('societe').')'; +$sql.= ' AND f.entity IN ('.getEntity('').')'; $sql.= " AND d.fk_facture = f.rowid"; $sql.= " AND (d.product_type = 0 OR d.product_type = 1)"; if(! empty($TSelectedProducts)) { From 5550a62afa9b3f790bf0774c5235498da4df279b Mon Sep 17 00:00:00 2001 From: atm-josselin Date: Thu, 31 Oct 2019 11:05:45 +0100 Subject: [PATCH 2/6] Fix misspelling on field of productlot --- htdocs/product/stock/class/productlot.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index dd811a66cf6..bd1a14329a6 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -62,7 +62,7 @@ class Productlot extends CommonObject 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501), - 'fk_user_author'=>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510, 'foreignkey'=>'llx_user.rowid'), + 'fk_user_creat'=>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510, 'foreignkey'=>'llx_user.rowid'), 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511) ); From e191dd7cc015ed3495d5a27bab94ad96405d71b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 1 Nov 2019 16:13:40 +0100 Subject: [PATCH 3/6] $key is overwriting a variable from outer foreach loop --- htdocs/admin/notification.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index 3c7ce730d03..6ba0d5673e2 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -238,7 +238,7 @@ foreach($listofnotifiedevents as $notifiedevent) $s=''; // Do not use type="email" here, we must be able to enter a list of email with , separator. $arrayemail=explode(',', $value); $showwarning=0; - foreach($arrayemail as $key=>$valuedet) + foreach($arrayemail as $keydet => $valuedet) { $valuedet=trim($valuedet); if (! empty($valuedet) && ! isValidEmail($valuedet, 1)) $showwarning++; From d2b7961e873073d52623bad2834066cdae8da88d Mon Sep 17 00:00:00 2001 From: Pierre Ardoin <32256817+mapiolca@users.noreply.github.com> Date: Sun, 3 Nov 2019 22:45:50 +0100 Subject: [PATCH 4/6] Update customerMargins.php --- htdocs/margin/customerMargins.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index 32ef5030cb8..78d105ad5cb 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -220,7 +220,7 @@ if ($socid > 0) $sql.= ' AND s.rowid = '.$socid; if (!$user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $sql.= " AND f.fk_statut NOT IN (" . implode(', ', $invoice_status_except_list) . ")"; $sql.= ' AND s.entity IN ('.getEntity('societe').')'; -$sql.= ' AND f.entity IN ('.getEntity('').')'; +$sql.= ' AND f.entity IN ('.getEntity('invoice').')'; $sql.= " AND d.fk_facture = f.rowid"; $sql.= " AND (d.product_type = 0 OR d.product_type = 1)"; if(! empty($TSelectedProducts)) { From 887c1a70d9e4f6c9be0566639d58a3551863630e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Nov 2019 18:46:04 +0100 Subject: [PATCH 5/6] Fix remove annoying files --- htdocs/install/doctemplates/contracts/index.html | 0 htdocs/install/doctemplates/invoices/index.html | 0 htdocs/install/doctemplates/orders/index.html | 0 htdocs/install/doctemplates/products/index.html | 0 htdocs/install/doctemplates/projects/index.html | 0 htdocs/install/doctemplates/proposals/index.html | 0 htdocs/install/doctemplates/shipments/index.html | 0 htdocs/install/doctemplates/supplier_proposals/index.html | 0 htdocs/install/doctemplates/tasks/index.html | 0 htdocs/install/doctemplates/thirdparties/index.html | 0 htdocs/install/doctemplates/usergroups/index.html | 0 htdocs/install/doctemplates/users/index.html | 0 12 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 htdocs/install/doctemplates/contracts/index.html delete mode 100644 htdocs/install/doctemplates/invoices/index.html delete mode 100644 htdocs/install/doctemplates/orders/index.html delete mode 100644 htdocs/install/doctemplates/products/index.html delete mode 100644 htdocs/install/doctemplates/projects/index.html delete mode 100644 htdocs/install/doctemplates/proposals/index.html delete mode 100644 htdocs/install/doctemplates/shipments/index.html delete mode 100644 htdocs/install/doctemplates/supplier_proposals/index.html delete mode 100644 htdocs/install/doctemplates/tasks/index.html delete mode 100644 htdocs/install/doctemplates/thirdparties/index.html delete mode 100644 htdocs/install/doctemplates/usergroups/index.html delete mode 100644 htdocs/install/doctemplates/users/index.html diff --git a/htdocs/install/doctemplates/contracts/index.html b/htdocs/install/doctemplates/contracts/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/install/doctemplates/invoices/index.html b/htdocs/install/doctemplates/invoices/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/install/doctemplates/orders/index.html b/htdocs/install/doctemplates/orders/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/install/doctemplates/products/index.html b/htdocs/install/doctemplates/products/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/install/doctemplates/projects/index.html b/htdocs/install/doctemplates/projects/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/install/doctemplates/proposals/index.html b/htdocs/install/doctemplates/proposals/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/install/doctemplates/shipments/index.html b/htdocs/install/doctemplates/shipments/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/install/doctemplates/supplier_proposals/index.html b/htdocs/install/doctemplates/supplier_proposals/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/install/doctemplates/tasks/index.html b/htdocs/install/doctemplates/tasks/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/install/doctemplates/thirdparties/index.html b/htdocs/install/doctemplates/thirdparties/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/install/doctemplates/usergroups/index.html b/htdocs/install/doctemplates/usergroups/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/install/doctemplates/users/index.html b/htdocs/install/doctemplates/users/index.html deleted file mode 100644 index e69de29bb2d..00000000000 From de77e39e085c976016ae5419f8733ef4d879620c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Nov 2019 11:14:36 +0100 Subject: [PATCH 6/6] FIX #12319 Restore feature ACCOUNTANCY_AUTOFILL_ACCOUNT_WITH_GENERIC. Now autofill works, option can be reverted in v11. --- .../class/accountingaccount.class.php | 2 +- htdocs/accountancy/customer/list.php | 23 ++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index bc25e33484d..55e463a73f6 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -154,7 +154,7 @@ class AccountingAccount extends CommonObject * @param int $rowid Id * @param string $account_number Account number * @param int|boolean $limittocurrentchart 1 or true=Load record only if it is into current active char of account - * @param string $limittoachartaccount 'ABC'=Load record only if it is into chart account with code 'ABC'. + * @param string $limittoachartaccount 'ABC'=Load record only if it is into chart account with code 'ABC' (better and faster than previous parameter if you have chart of account code). * @return int <0 if KO, 0 if not found, Id of record if OK and found */ public function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0, $limittoachartaccount = '') diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 7826d2b1faf..55d72c79d12 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -420,6 +420,8 @@ if ($result) { $isSellerInEEC = isInEEC($mysoc); + $accountingaccount_codetotid_cache = array(); + while ($i < min($num_lines, $limit)) { $objp = $db->fetch_object($result); @@ -488,8 +490,8 @@ if ($result) { } } - if (! empty($objp->code_sell)) { - //$objp->code_sell_p = $objp->code_sell; // Code on product + if (! empty($objp->code_sell_p)) { + // Value was defined previously } else { $code_sell_p_notset = 'color:orange'; } @@ -561,11 +563,26 @@ if ($result) { print ''; // Suggested accounting account + // $objp->code_sell_l = default (it takes the country into consideration), $objp->code_sell_p is value for product (it takes the country into consideration too) print ''; $suggestedid = $objp->aarowid_suggest; + /*var_dump($suggestedid); + var_dump($objp->code_sell_p); + var_dump($objp->code_sell_l);*/ if (empty($suggestedid) && empty($objp->code_sell_p) && ! empty($objp->code_sell_l) && ! empty($conf->global->ACCOUNTANCY_AUTOFILL_ACCOUNT_WITH_GENERIC)) { - //$suggestedid = // id of $objp->code_sell_l + if (empty($accountingaccount_codetotid_cache[$objp->code_sell_l])) + { + $tmpaccount = new AccountingAccount($db); + $tmpaccount->fetch(0, $objp->code_sell_l, 1); + if ($tmpaccount->id > 0) { + $suggestedid = $tmpaccount->id; + } + $accountingaccount_codetotid_cache[$objp->code_sell_l] = $tmpaccount->id; + } + else { + $suggestedid = $accountingaccount_codetotid_cache[$objp->code_sell_l]; + } } print $formaccounting->select_account($suggestedid, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone'); print '';