From 061f4623b3cc8ce593c97a8ae6c4fe2333514e0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Apr 2020 23:53:00 +0200 Subject: [PATCH 01/16] remove deprecated libelle --- htdocs/product/stock/class/entrepot.class.php | 21 +++++++++++-------- htdocs/product/stock/movement_card.php | 1 - htdocs/product/stock/movement_list.php | 1 - htdocs/product/stock/product.php | 1 - 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 3dd22c9e5c3..c09c8932401 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2008 Regis Houssin * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2016 Francis Appels - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019-2020 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 @@ -48,7 +48,11 @@ class Entrepot extends CommonObject * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ public $picto = 'stock'; - public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + + /** + * @var int 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + */ + public $ismultientitymanaged = 1; /** * @var string Label @@ -184,11 +188,10 @@ class Entrepot extends CommonObject $error = 0; - $this->libelle = trim($this->libelle); + $this->label = !empty($this->label) ? trim($this->label) : trim($this->libelle); - // Si libelle non defini, erreur - if ($this->libelle == '') - { + // Error if label not defined + if ($this->label == '') { $this->error = "ErrorFieldRequired"; return 0; } @@ -198,7 +201,7 @@ class Entrepot extends CommonObject $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."entrepot (ref, entity, datec, fk_user_author, fk_parent)"; - $sql .= " VALUES ('".$this->db->escape($this->libelle)."', ".$conf->entity.", '".$this->db->idate($now)."', ".$user->id.", ".($this->fk_parent > 0 ? $this->fk_parent : "NULL").")"; + $sql .= " VALUES ('".$this->db->escape($this->label)."', ".$conf->entity.", '".$this->db->idate($now)."', ".$user->id.", ".($this->fk_parent > 0 ? $this->fk_parent : "NULL").")"; dol_syslog(get_class($this)."::create", LOG_DEBUG); $result = $this->db->query($sql); @@ -285,7 +288,7 @@ class Entrepot extends CommonObject } } - $this->libelle = trim($this->libelle); + $this->label = !empty($this->label) ? trim($this->label) : trim($this->libelle); $this->description = trim($this->description); $this->lieu = trim($this->lieu); @@ -296,7 +299,7 @@ class Entrepot extends CommonObject $this->country_id = ($this->country_id > 0 ? $this->country_id : 0); $sql = "UPDATE ".MAIN_DB_PREFIX."entrepot "; - $sql .= " SET ref = '".$this->db->escape($this->libelle)."'"; + $sql .= " SET ref = '".$this->db->escape($this->label)."'"; $sql .= ", fk_parent = ".(($this->fk_parent > 0) ? $this->fk_parent : "NULL"); $sql .= ", description = '".$this->db->escape($this->description)."'"; $sql .= ", statut = ".$this->statut; diff --git a/htdocs/product/stock/movement_card.php b/htdocs/product/stock/movement_card.php index 2714740eb45..7e7aa53cd08 100644 --- a/htdocs/product/stock/movement_card.php +++ b/htdocs/product/stock/movement_card.php @@ -975,7 +975,6 @@ if ($resql) $productlot->sellby = $objp->sellby; $warehousestatic->id = $objp->entrepot_id; - $warehousestatic->libelle = $objp->warehouse_ref; // deprecated $warehousestatic->label = $objp->warehouse_ref; $warehousestatic->lieu = $objp->lieu; diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 944462ccdfc..de12c018f20 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -1012,7 +1012,6 @@ if ($resql) $warehousestatic->id = $objp->entrepot_id; $warehousestatic->ref = $objp->warehouse_ref; - $warehousestatic->libelle = $objp->warehouse_ref; // deprecated $warehousestatic->label = $objp->warehouse_ref; $warehousestatic->lieu = $objp->lieu; $warehousestatic->fk_parent = $objp->fk_parent; diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 0164f6338e6..e188ab368f7 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -866,7 +866,6 @@ if (!$variants) { $entrepotstatic->id = $obj->rowid; $entrepotstatic->ref = $obj->ref; - $entrepotstatic->libelle = $obj->ref; $entrepotstatic->label = $obj->ref; $entrepotstatic->lieu = $obj->lieu; $entrepotstatic->fk_parent = $obj->fk_parent; From 2349c2be2247188bd37fa260e1ff813b304919f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Apr 2020 23:55:50 +0200 Subject: [PATCH 02/16] remove deprecated libelle --- htdocs/product/stock/card.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 0665cc48e06..d0e9228fbf5 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -97,7 +97,7 @@ if (empty($reshook)) { $object->ref = GETPOST("ref"); $object->fk_parent = GETPOST("fk_parent"); - $object->libelle = GETPOST("libelle"); + $object->label = GETPOST("libelle"); $object->description = GETPOST("desc"); $object->statut = GETPOST("statut"); $object->lieu = GETPOST("lieu"); @@ -108,8 +108,7 @@ if (empty($reshook)) $object->phone = GETPOST("phone"); $object->fax = GETPOST("fax"); - if (!empty($object->libelle)) - { + if (!empty($object->label)) { // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object); if ($ret < 0) { @@ -167,7 +166,7 @@ if (empty($reshook)) { if ($object->fetch($id)) { - $object->libelle = GETPOST("libelle"); + $object->label = GETPOST("libelle"); $object->fk_parent = GETPOST("fk_parent"); $object->description = GETPOST("desc"); $object->statut = GETPOST("statut"); From bc4726c7c347e406b0bed30ddb0f437c3209bb8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 23 Apr 2020 00:06:57 +0200 Subject: [PATCH 03/16] remove deprecated libelle --- test/phpunit/MouvementStockTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/phpunit/MouvementStockTest.php b/test/phpunit/MouvementStockTest.php index d095736042b..85137234a3b 100644 --- a/test/phpunit/MouvementStockTest.php +++ b/test/phpunit/MouvementStockTest.php @@ -148,13 +148,13 @@ class MouvementStockTest extends PHPUnit\Framework\TestCase // We create a product for tests $warehouse1=new Entrepot($db); $warehouse1->initAsSpecimen(); - $warehouse1->libelle.=' 1'; + $warehouse1->label.=' 1'; $warehouse1->description.=' 1'; $warehouse1id=$warehouse1->create($user); $warehouse2=new Entrepot($db); $warehouse2->initAsSpecimen(); - $warehouse2->libelle.=' 2'; + $warehouse2->label.=' 2'; $warehouse2->description.=' 2'; $warehouse2id=$warehouse2->create($user); From 35410209124f135e12781f757012b1c932f7d335 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 23 Apr 2020 00:13:51 +0200 Subject: [PATCH 04/16] remove deprecated libelle --- htdocs/product/stock/class/mouvementstock.class.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 5bbc3f9d92c..d6ca1f3655e 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -41,7 +41,14 @@ class MouvementStock extends CommonObject public $table_element = 'stock_mouvement'; + /** + * @var int ID product + */ public $product_id; + + /** + * @var int ID warehouse + */ public $warehouse_id; public $qty; @@ -58,7 +65,7 @@ class MouvementStock extends CommonObject public $price; /** - * @var int ID + * @var int ID user author */ public $fk_user_author; @@ -894,13 +901,13 @@ class MouvementStock extends CommonObject } else { - dol_syslog(get_class($this)."::createBatch array param dluo must contain at least key fk_product_stock".$error, LOG_ERR); + dol_syslog(get_class($this)."::createBatch array param dluo must contain at least key fk_product_stock", LOG_ERR); $result = -1; } } else { - dol_syslog(get_class($this)."::createBatch error invalid param dluo".$error, LOG_ERR); + dol_syslog(get_class($this)."::createBatch error invalid param dluo", LOG_ERR); $result = -1; } From 1f46c57c0b07b1bbef56a53d013b6c6ac726ef38 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 19 May 2020 09:36:07 +0200 Subject: [PATCH 05/16] NEW Add employee in expense report binding page --- htdocs/accountancy/customer/lines.php | 66 +++++++++-------- htdocs/accountancy/expensereport/lines.php | 85 ++++++++++++++++------ htdocs/accountancy/expensereport/list.php | 37 +++++++++- htdocs/accountancy/supplier/lines.php | 50 +++++++------ htdocs/accountancy/supplier/list.php | 2 +- 5 files changed, 160 insertions(+), 80 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 45b0c909016..0bbb8800425 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -324,7 +325,7 @@ if ($result) { //print ''; print ''; print ''; - print ''; + print ''; print ''; $searchpicto = $form->showFilterButtons(); print $searchpicto; @@ -342,37 +343,41 @@ if ($result) { print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); $clickpicto = $form->showCheckAddButtons(); print_liste_field_titre($clickpicto, '', '', '', '', '', '', '', 'center '); print "\n"; - $thirdpartystatic=new Societe($db); - $facture_static = new Facture($db); - $product_static = new Product($db); + $thirdpartystatic=new Societe($db); + $facturestatic = new Facture($db); + $productstatic = new Product($db); + $accountingaccountstatic = new AccountingAccount($db); - while ($objp = $db->fetch_object($result)) { - $codecompta = length_accountg($objp->account_number).' - '.$objp->label_compte.''; + while ($objp = $db->fetch_object($result)) + { + $accountingaccountstatic->account_number = $objp->account_number; + $accountingaccountstatic->label = $objp->label_account; + $accountingaccountstatic->labelshort = $objp->labelshort_account; - $facture_static->ref = $objp->ref; - $facture_static->id = $objp->facid; - $facture_static->type = $objp->ftype; + $facturestatic->ref = $objp->ref; + $facturestatic->id = $objp->facid; + $facturestatic->type = $objp->ftype; - $thirdpartystatic->id = $objp->socid; - $thirdpartystatic->name = $objp->name; - $thirdpartystatic->client = $objp->client; - $thirdpartystatic->fournisseur = $objp->fournisseur; - $thirdpartystatic->code_client = $objp->code_client; - $thirdpartystatic->code_compta_client = $objp->code_compta_client; - $thirdpartystatic->code_fournisseur = $objp->code_fournisseur; - $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur; - $thirdpartystatic->email = $objp->email; - $thirdpartystatic->country_code = $objp->country_code; + $thirdpartystatic->id = $objp->socid; + $thirdpartystatic->name = $objp->name; + $thirdpartystatic->client = $objp->client; + $thirdpartystatic->fournisseur = $objp->fournisseur; + $thirdpartystatic->code_client = $objp->code_client; + $thirdpartystatic->code_compta_client = $objp->code_compta_client; + $thirdpartystatic->code_fournisseur = $objp->code_fournisseur; + $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur; + $thirdpartystatic->email = $objp->email; + $thirdpartystatic->country_code = $objp->country_code; - $product_static->ref = $objp->product_ref; - $product_static->id = $objp->product_id; - $product_static->label = $objp->product_label; - $product_static->type = $objp->line_type; + $productstatic->ref = $objp->product_ref; + $productstatic->id = $objp->product_id; + $productstatic->label = $objp->product_label; + $productstatic->type = $objp->line_type; print ''; @@ -380,16 +385,16 @@ if ($result) { print ''.$objp->rowid.''; // Ref Invoice - print ''.$facture_static->getNomUrl(1).''; + print ''.$facturestatic->getNomUrl(1).''; // Date invoice print ''.dol_print_date($db->jdate($objp->datef), 'day').''; // Ref Product print ''; - if ($product_static->id > 0) print $product_static->getNomUrl(1); - if ($product_static->id > 0 && $objp->product_label) print '
'; - if ($objp->product_label) print ''.$objp->product_label.''; + if ($productstatic->id > 0) print $productstatic->getNomUrl(1); + if ($productstatic->id > 0 && $objp->product_label) print '
'; + if ($objp->product_label) print $objp->product_label; print ''; print ''; @@ -415,8 +420,9 @@ if ($result) { print ''.$objp->tva_intra.''; - print ''; - print $codecompta.' '; + print ''; + print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1); + print ' '; print img_edit(); print ''; print ''; diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index 4cd51fb3a63..1940d382737 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -28,19 +28,22 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; +require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; // Load translation files required by the page -$langs->loadLangs(array("compta", "bills", "other", "accountancy", "trips", "productbatch")); +$langs->loadLangs(array("compta", "bills", "other", "accountancy", "trips", "productbatch", "hrm")); $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $account_parent = GETPOST('account_parent', 'int'); $changeaccount = GETPOST('changeaccount'); // Search Getpost +$search_login = GETPOST('search_login', 'alpha'); $search_expensereport = GETPOST('search_expensereport', 'alpha'); $search_label = GETPOST('search_label', 'alpha'); $search_desc = GETPOST('search_desc', 'alpha'); @@ -84,7 +87,8 @@ $formaccounting = new FormAccounting($db); // Purge search criteria if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers { - $search_expensereport = ''; + $search_login = ''; + $search_expensereport = ''; $search_label = ''; $search_desc = ''; $search_amount = ''; @@ -162,14 +166,21 @@ print '