From f14f1c9190914fbeaeef1190558b76cd10f8b67d Mon Sep 17 00:00:00 2001 From: atm-ph Date: Fri, 23 Aug 2019 09:15:15 +0200 Subject: [PATCH 01/16] Fix wrong placement to print title and missing hook to print value --- htdocs/compta/paiement.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 2da6052c63f..631cc10389a 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -593,6 +593,10 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''.$alreadypayedlabel.''; print ''.$remaindertopay.''; print ''.$langs->trans('PaymentAmount').''; + + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $facture, $action); // Note that $action and $object may have been modified by hook + print ' '; print "\n"; @@ -737,7 +741,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ""; $parameters=array(); - $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $objp, $action); // Note that $action and $object may have been modified by hook + $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $objp, $action); // Note that $action and $object may have been modified by hook // Warning print ''; From ad38478fc6596ef43eb1fc813de4adb2f6338735 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 26 Aug 2019 20:01:05 +0200 Subject: [PATCH 02/16] Fix lang for "nature" in contact --- htdocs/core/tpl/contacts.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 14534b3472e..1f7d403b575 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -149,7 +149,7 @@ if ($permission) { ?>
-
trans("Nature"); ?>
+
trans("NatureOfContact"); ?>
trans("ThirdParty"); ?>
trans("Users").'/'.$langs->trans("Contacts"); ?>
trans("ContactType"); ?>
From 76bd9a09a69eb37d4e4f292de0a507c56c6df65c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Aug 2019 22:34:41 +0200 Subject: [PATCH 03/16] FIX #11570 --- htdocs/core/class/html.form.class.php | 34 +++--- test/phpunit/FormTest.php | 149 ++++++++++++++++++++++++++ 2 files changed, 168 insertions(+), 15 deletions(-) create mode 100644 test/phpunit/FormTest.php diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index d2130e24291..ad81f7d7a2b 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1862,10 +1862,10 @@ class Form * @param int $forcecombo Force to use combo box * @param string $morecss Add more css on select * @param int $hidepriceinlabel 1=Hide prices in label - * @param string $warehouseStatus warehouse status filter, following comma separated filter options can be used - * 'warehouseopen' = select products from open warehouses, - * 'warehouseclosed' = select products from closed warehouses, - * 'warehouseinternal' = select products from warehouses for internal correct/transfer only + * @param string $warehouseStatus Warehouse status filter to count the quantity in stock. Following comma separated filter options can be used + * 'warehouseopen' = count products from open warehouses, + * 'warehouseclosed' = count products from closed warehouses, + * 'warehouseinternal' = count products from warehouses for internal correct/transfer only * @param array $selected_combinations Selected combinations. Format: array([attrid] => attrval, [...]) * @return void */ @@ -1877,7 +1877,7 @@ class Form // check parameters $price_level = (! empty($price_level) ? $price_level : 0); if (is_null($ajaxoptions)) $ajaxoptions=array(); - + if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) { $placeholder=''; @@ -2007,10 +2007,10 @@ class Form * @param int $forcecombo Force to use combo box * @param string $morecss Add more css on select * @param int $hidepriceinlabel 1=Hide prices in label - * @param string $warehouseStatus warehouse status filter, following comma separated filter options can be used - * 'warehouseopen' = select products from open warehouses, - * 'warehouseclosed' = select products from closed warehouses, - * 'warehouseinternal' = select products from warehouses for internal correct/transfer only + * @param string $warehouseStatus Warehouse status filter to group/count stock. Following comma separated filter options can be used. + * 'warehouseopen' = count products from open warehouses, + * 'warehouseclosed' = count products from closed warehouses, + * 'warehouseinternal' = count products from warehouses for internal correct/transfer only * @return array Array of keys for json */ function select_produits_list($selected='',$htmlname='productid',$filtertype='',$limit=20,$price_level=0,$filterkey='',$status=1,$finished=2,$outputmode=0,$socid=0,$showempty='1',$forcecombo=0,$morecss='',$hidepriceinlabel=0, $warehouseStatus='') @@ -2040,7 +2040,14 @@ class Form } $selectFields = " p.rowid, p.label, p.ref, p.description, p.barcode, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.duration, p.fk_price_expression"; - (count($warehouseStatusArray)) ? $selectFieldsGrouped = ", sum(ps.reel) as stock" : $selectFieldsGrouped = ", p.stock"; + if (count($warehouseStatusArray)) + { + $selectFieldsGrouped = ", sum(".$db->ifsql("e.statut IS NULL", "0", "ps.reel").") as stock"; // e.statut is null if there is no record in stock + } + else + { + $selectFieldsGrouped = ", p.stock"; + } $sql = "SELECT "; $sql.= $selectFields . $selectFieldsGrouped; @@ -2076,6 +2083,7 @@ class Form { $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps on ps.fk_product = p.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e on ps.fk_entrepot = e.rowid"; + $sql.= ' AND e.statut IN ('.$this->db->escape(implode(',',$warehouseStatusArray)).')'; // Return line if product is inside the selected stock. If not, an empty line will be returned so we will count 0. } // include search in supplier ref @@ -2099,10 +2107,6 @@ class Form } $sql.= ' WHERE p.entity IN ('.getEntity('product').')'; - if (count($warehouseStatusArray)) - { - $sql.= ' AND (p.fk_product_type = 1 OR e.statut IN ('.$this->db->escape(implode(',',$warehouseStatusArray)).'))'; - } if (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) { $sql .= " AND pac.rowid IS NULL"; @@ -2273,7 +2277,7 @@ class Form /** * constructProductListOption * - * @param resultset $objp Resultset of fetch + * @param resource $objp Resultset of fetch * @param string $opt Option (var used for returned value in string option format) * @param string $optJson Option (var used for returned value in json format) * @param int $price_level Price level diff --git a/test/phpunit/FormTest.php b/test/phpunit/FormTest.php new file mode 100644 index 00000000000..b3025b4c345 --- /dev/null +++ b/test/phpunit/FormTest.php @@ -0,0 +1,149 @@ + + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see http://www.gnu.org/ + */ + +/** + * \file test/phpunit/FormTest.php + * \ingroup test + * \brief PHPUnit test + * \remarks To run this script as CLI: phpunit filename.php + */ + +global $conf,$user,$langs,$db; +//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver +//require_once 'PHPUnit/Autoload.php'; +require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; +require_once dirname(__FILE__).'/../../htdocs/core/class/html.form.class.php'; + +if (empty($user->id)) +{ + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); +} +$conf->global->MAIN_DISABLE_ALL_MAILS=1; + + +/** + * Class for PHPUnit tests + * + * @backupGlobals disabled + * @backupStaticAttributes enabled + * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. + */ +class FormTest extends PHPUnit\Framework\TestCase +{ + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; + + /** + * Constructor + * We save global variables into local variables + * + * @return FactureTest + */ + function __construct() + { + parent::__construct(); + + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; + + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; + } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + + // tear down after class + public static function tearDownAfterClass() + { + global $conf,$user,$langs,$db; + $db->rollback(); + + print __METHOD__."\n"; + } + + /** + * Init phpunit tests + * + * @return void + */ + protected function setUp() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + print __METHOD__."\n"; + } + + /** + * End phpunit tests + * + * @return void + */ + protected function tearDown() + { + print __METHOD__."\n"; + } + + /** + * testSelectProduitsList + * + * @return int + */ + public function testSelectProduitsList() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $localobject=new Form($this->savdb); + $result=$localobject->select_produits_list('', 'productid', '', 5, 0, '', 1, 2, 1); + + $this->assertEquals(count($result), 5); + print __METHOD__." result=".$result."\n"; + + $conf->global->ENTREPOT_EXTRA_STATUS = 1; + + // Exclude stock in warehouseinternal + $result=$localobject->select_produits_list('', 'productid', '', 5, 0, '', 1, 2, 1, 0, '1', 0, '', 0, 'warehouseclosed,warehouseopen'); + $this->assertEquals(count($result), 5); + print __METHOD__." result=".$result."\n"; + + return $result; + } +} From b6db04a727402b66973fcd69a17ba8d73310db6d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Aug 2019 22:42:04 +0200 Subject: [PATCH 04/16] Fix add missing filter on entity on stock listing for product combo --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index ad81f7d7a2b..1666901d04a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2082,7 +2082,7 @@ class Form if (count($warehouseStatusArray)) { $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps on ps.fk_product = p.rowid"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e on ps.fk_entrepot = e.rowid"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e on ps.fk_entrepot = e.rowid AND e.entity IN (".getEntity('stock').")"; $sql.= ' AND e.statut IN ('.$this->db->escape(implode(',',$warehouseStatusArray)).')'; // Return line if product is inside the selected stock. If not, an empty line will be returned so we will count 0. } From 669301669d3d8c6032de1b4031eebf8ed7ae173e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Aug 2019 22:48:45 +0200 Subject: [PATCH 05/16] Add phpunit for FormTest --- test/phpunit/AllTests.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/phpunit/AllTests.php b/test/phpunit/AllTests.php index ee7ec9375d6..db3dc95e434 100644 --- a/test/phpunit/AllTests.php +++ b/test/phpunit/AllTests.php @@ -239,6 +239,8 @@ class AllTests require_once dirname(__FILE__).'/FormAdminTest.php'; $suite->addTestSuite('FormAdminTest'); + require_once dirname(__FILE__).'/FormTest.php'; + $suite->addTestSuite('FormTest'); require_once dirname(__FILE__).'/ModulesTest.php'; // At end because it's the longer $suite->addTestSuite('ModulesTest'); From 9e04eccf547a8b229d0d009b418c31efc55b6421 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Aug 2019 23:28:06 +0200 Subject: [PATCH 06/16] Fix syntax error --- htdocs/commande/card.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index dea2d0c0ed8..5b6a47fa998 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1758,15 +1758,16 @@ if ($action == 'create' && $usercancreate) $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); print $hookmanager->resPrint; if (empty($reshook)) { - if (! empty($conf->global->THIRDPARTY_PROPAGATE_EXTRAFIELDS_TO_ORDER)) - // copy from thirdparty - $tpExtrafields = new Extrafields($db); - $tpExtrafieldLabels = $tpExtrafields->fetch_name_optionals_label($soc->table_element); - if ($soc->fetch_optionals() > 0) { - $object->array_options = array_merge($object->array_options, $soc->array_options); - } + if (! empty($conf->global->THIRDPARTY_PROPAGATE_EXTRAFIELDS_TO_ORDER)) { + // copy from thirdparty + $tpExtrafields = new Extrafields($db); + $tpExtrafieldLabels = $tpExtrafields->fetch_name_optionals_label($soc->table_element); + if ($soc->fetch_optionals() > 0) { + $object->array_options = array_merge($object->array_options, $soc->array_options); + } }; - print $object->showOptionals($extrafields, 'edit'); + + print $object->showOptionals($extrafields, 'edit'); } // Template to use by default From db6b1b6ffb37b159eb0273d695fc25f63a3a48ea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Aug 2019 23:44:20 +0200 Subject: [PATCH 07/16] NEW Add status of warehouse in tooltip of a warehouse. --- htdocs/product/stock/class/entrepot.class.php | 2 ++ htdocs/product/stock/product.php | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index e857166e392..ad475436932 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -686,6 +686,8 @@ class Entrepot extends CommonObject $label.= '
' . $langs->trans('Ref') . ': ' . (empty($this->ref)?(empty($this->label)?$this->libelle:$this->label):$this->ref); if (! empty($this->lieu)) $label.= '
' . $langs->trans('LocationSummary').': '.$this->lieu; + if (isset($this->statut)) + $label.= '
' . $langs->trans("Status").": ".$this->getLibStatut(2); $url = DOL_URL_ROOT.'/product/stock/card.php?id='.$this->id; diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 2c0515d309c..9dd46428ffb 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -827,7 +827,7 @@ if (! $variants) { print ''; } - $sql = "SELECT e.rowid, e.ref as label, e.lieu, ps.reel, ps.rowid as product_stock_id, p.pmp"; + $sql = "SELECT e.rowid, e.ref as label, e.lieu, e.statut, ps.reel, ps.rowid as product_stock_id, p.pmp"; $sql .= " FROM " . MAIN_DB_PREFIX . "entrepot as e,"; $sql .= " " . MAIN_DB_PREFIX . "product_stock as ps"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = ps.fk_product"; @@ -851,9 +851,12 @@ if (! $variants) { $var = false; while ($i < $num) { $obj = $db->fetch_object($resql); + $entrepotstatic->id = $obj->rowid; $entrepotstatic->libelle = $obj->label; $entrepotstatic->lieu = $obj->lieu; + $entrepotstatic->statut = $obj->statut; + $stock_real = price2num($obj->reel, 'MS'); print ''; print '' . $entrepotstatic->getNomUrl(1) . ''; From e8bb84e803ce3cd15201a44967c1df0204da3d1f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Aug 2019 23:54:15 +0200 Subject: [PATCH 08/16] NEW Add status of warehouse in tooltip of a warehouse. --- htdocs/product/stock/class/entrepot.class.php | 2 +- htdocs/product/stock/list.php | 17 ++++++++++++++--- htdocs/product/stock/movement_list.php | 8 ++++++-- htdocs/product/stock/product.php | 7 +++++-- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index ad475436932..18d17f9acf0 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -687,7 +687,7 @@ class Entrepot extends CommonObject if (! empty($this->lieu)) $label.= '
' . $langs->trans('LocationSummary').': '.$this->lieu; if (isset($this->statut)) - $label.= '
' . $langs->trans("Status").": ".$this->getLibStatut(2); + $label.= '
' . $langs->trans("Status").": ".$this->getLibStatut(5); $url = DOL_URL_ROOT.'/product/stock/card.php?id='.$this->id; diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 8e19242d1c1..9426d2041b0 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -104,13 +104,19 @@ $form=new Form($db); $warehouse=new Entrepot($db); $sql = "SELECT e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays, e.fk_parent,"; -$sql.= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue, SUM(ps.reel) as stockqty"; +$sql.= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue, SUM(ps.reel) as stockqty,"; // Add fields from extrafields -foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); +if (! empty($extrafields->attributes[$object->table_element]['label'])) + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : ''); +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +$sql=preg_replace('/, $/', '', $sql); $sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON e.rowid = ps.fk_entrepot"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON ps.fk_product = p.rowid"; -if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot_extrafields as ef on (e.rowid = ef.fk_object)"; +if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (e.rowid = ef.fk_object)"; $sql.= " WHERE e.entity IN (".getEntity('stock').")"; if ($search_ref) $sql.= natural_search("e.ref", $search_ref); // ref if ($search_label) $sql.= natural_search("e.lieu", $search_label); // label @@ -118,6 +124,10 @@ if ($search_status != '' && $search_status >= 0) $sql.= " AND e.statut = ".$sear if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; $sql.= " GROUP BY e.rowid, e.ref, e.statut, e.lieu, e.address, e.zip, e.town, e.fk_pays, e.fk_parent"; $totalnboflines=0; $result=$db->query($sql); @@ -241,6 +251,7 @@ if ($result) $warehouse->label = $obj->ref; $warehouse->lieu = $obj->lieu; $warehouse->fk_parent = $obj->fk_parent; + $warehouse->statut = $obj->statut; print ''; print '' . $warehouse->getNomUrl(1) . ''; diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index f62b732cf7e..149804ee966 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -420,7 +420,7 @@ $formproduct=new FormProduct($db); if (!empty($conf->projet->enabled)) $formproject=new FormProjets($db); $sql = "SELECT p.rowid, p.ref as product_ref, p.label as produit, p.tobatch, p.fk_product_type as type, p.entity,"; -$sql.= " e.ref as stock, e.rowid as entrepot_id, e.lieu,"; +$sql.= " e.ref as warehouse_ref, e.rowid as entrepot_id, e.lieu, e.fk_parent, e.statut,"; $sql.= " m.rowid as mid, m.value as qty, m.datem, m.fk_user_author, m.label, m.inventorycode, m.fk_origin, m.origintype,"; $sql.= " m.batch, m.price,"; $sql.= " m.type_mouvement,"; @@ -988,8 +988,12 @@ if ($resql) $productlot->sellby= $objp->sellby; $warehousestatic->id=$objp->entrepot_id; - $warehousestatic->libelle=$objp->stock; + $warehousestatic->ref=$objp->warehouse_ref; + $warehousestatic->libelle=$objp->warehouse_ref; + $warehousestatic->label=$objp->warehouse_ref; $warehousestatic->lieu=$objp->lieu; + $warehousestatic->fk_parent = $objp->fk_parent; + $warehousestatic->statut = $objp->statut; $arrayofuniqueproduct[$objp->rowid]=$objp->produit; if(!empty($objp->fk_origin)) { diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 9dd46428ffb..41c9b151865 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -827,7 +827,7 @@ if (! $variants) { print ''; } - $sql = "SELECT e.rowid, e.ref as label, e.lieu, e.statut, ps.reel, ps.rowid as product_stock_id, p.pmp"; + $sql = "SELECT e.rowid, e.ref, e.lieu, e.fk_parent, e.statut, ps.reel, ps.rowid as product_stock_id, p.pmp"; $sql .= " FROM " . MAIN_DB_PREFIX . "entrepot as e,"; $sql .= " " . MAIN_DB_PREFIX . "product_stock as ps"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = ps.fk_product"; @@ -853,8 +853,11 @@ if (! $variants) { $obj = $db->fetch_object($resql); $entrepotstatic->id = $obj->rowid; - $entrepotstatic->libelle = $obj->label; + $entrepotstatic->ref = $obj->ref; + $entrepotstatic->libelle = $obj->ref; + $entrepotstatic->label = $obj->ref; $entrepotstatic->lieu = $obj->lieu; + $entrepotstatic->fk_parent = $obj->fk_parent; $entrepotstatic->statut = $obj->statut; $stock_real = price2num($obj->reel, 'MS'); From c7f06fe50e88804fdc0fdadb0b4d5ba617dfc6e8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Aug 2019 23:56:17 +0200 Subject: [PATCH 09/16] Fix phpcs --- htdocs/societe/class/societe.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index c45e6871420..6bbbf987fcf 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3853,11 +3853,9 @@ class Societe extends CommonObject $outstandingOpened+=$obj->total_ttc - $paiement - $creditnotes - $deposits; } - + //if credit note is converted but not used if($mode == 'supplier' && $obj->type == FactureFournisseur::TYPE_CREDIT_NOTE && $tmpobject->isCreditNoteUsed())$outstandingOpened-=$tmpobject->getSumFromThisCreditNotesNotUsed(); - - } return array('opened'=>$outstandingOpened, 'total_ht'=>$outstandingTotal, 'total_ttc'=>$outstandingTotalIncTax); // 'opened' is 'incl taxes' } From 4fb36ce84debdad4f5ddd5fd5bd2d3c1d7e8ffb6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Aug 2019 03:22:58 +0200 Subject: [PATCH 10/16] Fix phpcs --- htdocs/core/class/commoninvoice.class.php | 2 +- htdocs/core/class/discount.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 86ef739d63e..2121330a751 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -201,7 +201,7 @@ abstract class CommonInvoice extends CommonObject * @param int $multicurrency Return multicurrency_amount instead of amount * @return int <0 if KO, Sum of credit notes and deposits amount otherwise */ - function getSumFromThisCreditNotesNotUsed($multicurrency=0) + public function getSumFromThisCreditNotesNotUsed($multicurrency=0) { require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index cb2ad44b90c..5ed79b7c2d5 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -636,7 +636,7 @@ class DiscountAbsolute * @param int $multicurrency Return multicurrency_amount instead of amount * @return int <0 if KO, Sum of credit notes and deposits amount otherwise */ - function getSumFromThisCreditNotesNotUsed($invoice, $multicurrency=0) + public function getSumFromThisCreditNotesNotUsed($invoice, $multicurrency=0) { dol_syslog(get_class($this)."::getSumCreditNotesUsed", LOG_DEBUG); From 784f5ec0972e3256cce2b885df46111703cd4a8a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Aug 2019 03:23:25 +0200 Subject: [PATCH 11/16] Fix bad name of hidden constant --- htdocs/admin/system/perf.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/system/perf.php b/htdocs/admin/system/perf.php index fbf6fa3bb14..e17756391f1 100644 --- a/htdocs/admin/system/perf.php +++ b/htdocs/admin/system/perf.php @@ -522,9 +522,9 @@ if ($resql) $nb=$obj->nb; if ($nb > $limitforoptim) { - if (empty($conf->global->THIRDPARTY_DONOTSEARCH_ANYWHERE)) + if (empty($conf->global->COMPANY_DONOTSEARCH_ANYWHERE)) { - print img_picto('', 'warning.png').' '.$langs->trans("YouHaveXObjectUseSearchOptim", $nb, $langs->transnoentitiesnoconv("ThirdParties"), 'THIRDPARTY_DONOTSEARCH_ANYWHERE'); + print img_picto('', 'warning.png').' '.$langs->trans("YouHaveXObjectUseSearchOptim", $nb, $langs->transnoentitiesnoconv("ThirdParties"), 'COMPANY_DONOTSEARCH_ANYWHERE'); } else { From 0ae7be8fe681a6ae57360bad988f68495dbcffd5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Aug 2019 03:34:43 +0200 Subject: [PATCH 12/16] Test sponsor github --- .github/FUNDING.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 81813c2bebe..6b651234788 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -2,3 +2,4 @@ open_collective: dolibarr custom: https://wiki.dolibarr.org/index.php/Subscribe +github: [eldy] \ No newline at end of file From 01e2a181b83b64236c0ece0633288f9403304540 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Aug 2019 03:36:47 +0200 Subject: [PATCH 13/16] Fix user not yet enrolled --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 6b651234788..186b20a051d 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -2,4 +2,4 @@ open_collective: dolibarr custom: https://wiki.dolibarr.org/index.php/Subscribe -github: [eldy] \ No newline at end of file +# github: [eldy] \ No newline at end of file From 855ebc298f671e92848807af2311718f0c343bbf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Aug 2019 03:39:27 +0200 Subject: [PATCH 14/16] Removed hound (not used) --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 5d4de0af909..f4ccc78e9dc 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # DOLIBARR ERP & CRM ![Downloads per day](https://img.shields.io/sourceforge/dw/dolibarr.svg) -[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com) |7|8|9|10|develop| |----------|----------|----------|----------|----------| From 63dcef710eb44f7afc0c6ec3ea2ef07939daa984 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Aug 2019 03:41:02 +0200 Subject: [PATCH 15/16] Fix phpcs --- htdocs/core/class/commoninvoice.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 2121330a751..259014cf691 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -201,7 +201,7 @@ abstract class CommonInvoice extends CommonObject * @param int $multicurrency Return multicurrency_amount instead of amount * @return int <0 if KO, Sum of credit notes and deposits amount otherwise */ - public function getSumFromThisCreditNotesNotUsed($multicurrency=0) + public function getSumFromThisCreditNotesNotUsed($multicurrency = 0) { require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; From 505a06ca3e68110f6e92d533f63567aa29809991 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Aug 2019 03:42:34 +0200 Subject: [PATCH 16/16] Fix phpunit --- test/phpunit/FormAdminTest.php | 2 +- test/phpunit/FormTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/phpunit/FormAdminTest.php b/test/phpunit/FormAdminTest.php index 8532d6ac283..844be2e4f32 100644 --- a/test/phpunit/FormAdminTest.php +++ b/test/phpunit/FormAdminTest.php @@ -119,7 +119,7 @@ class FormAdminTest extends PHPUnit_Framework_TestCase } /** - * testFactureCreate + * testSelectPaperFormat * * @return int */ diff --git a/test/phpunit/FormTest.php b/test/phpunit/FormTest.php index b3025b4c345..69594325b20 100644 --- a/test/phpunit/FormTest.php +++ b/test/phpunit/FormTest.php @@ -58,7 +58,7 @@ class FormTest extends PHPUnit\Framework\TestCase * * @return FactureTest */ - function __construct() + public function __construct() { parent::__construct();