From bdd095f6bbfc9eabb851eda3d5cbe7066e04d430 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien?= Date: Mon, 5 Oct 2020 13:59:06 +0200 Subject: [PATCH 01/13] translate livraison2delivery => change folder, filename and class ref into all dependencies #14697 --- htdocs/admin/livraison.php | 8 +++---- htdocs/core/lib/sendings.lib.php | 2 +- .../livraison/doc/pdf_storm.modules.php | 2 +- .../livraison/doc/pdf_typhon.modules.php | 2 +- htdocs/{livraison => delivery}/card.php | 6 ++--- .../class/delivery.class.php} | 22 +++++++++---------- .../{livraison => delivery}/class/index.html | 0 htdocs/{livraison => delivery}/index.html | 0 htdocs/expedition/class/expedition.class.php | 4 ++-- htdocs/societe/card.php | 2 +- .../societe/class/api_thirdparties.class.php | 2 +- 11 files changed, 25 insertions(+), 25 deletions(-) rename htdocs/{livraison => delivery}/card.php (99%) rename htdocs/{livraison/class/livraison.class.php => delivery/class/delivery.class.php} (98%) rename htdocs/{livraison => delivery}/class/index.html (100%) rename htdocs/{livraison => delivery}/index.html (100%) diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index f3477e151a2..0a315897081 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -26,13 +26,13 @@ /** * \file htdocs/admin/livraison.php * \ingroup livraison - * \brief Page d'administration/configuration du module Livraison + * \brief Page d'administration/configuration du module Delivery */ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/expedition.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/livraison/class/livraison.class.php'; +require_once DOL_DOCUMENT_ROOT.'/delivery/class/delivery.class.php'; // Load translation files required by the page $langs->loadLangs(array("admin", "sendings", "deliveries", "other")); @@ -87,7 +87,7 @@ if ($action == 'specimen') { $modele = GETPOST('module', 'alpha'); - $sending = new Livraison($db); + $sending = new Delivery($db); $sending->initAsSpecimen(); // Search template files @@ -245,7 +245,7 @@ foreach ($dirmodels as $reldir) } print ''; - $livraison = new Livraison($db); + $livraison = new Delivery($db); $livraison->initAsSpecimen(); // Info diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index b81757f261f..554332fe4db 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -405,7 +405,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') // Informations on receipt if (!empty($conf->livraison_bon->enabled)) { - include_once DOL_DOCUMENT_ROOT.'/livraison/class/livraison.class.php'; + include_once DOL_DOCUMENT_ROOT.'/delivery/class/delivery.class.php'; $expedition->id = $objp->sendingid; $expedition->fetchObjectLinked($expedition->id, $expedition->element); //var_dump($expedition->linkedObjects); diff --git a/htdocs/core/modules/livraison/doc/pdf_storm.modules.php b/htdocs/core/modules/livraison/doc/pdf_storm.modules.php index 2019de478eb..404e27b429f 100644 --- a/htdocs/core/modules/livraison/doc/pdf_storm.modules.php +++ b/htdocs/core/modules/livraison/doc/pdf_storm.modules.php @@ -29,7 +29,7 @@ */ require_once DOL_DOCUMENT_ROOT.'/core/modules/livraison/modules_livraison.php'; -require_once DOL_DOCUMENT_ROOT.'/livraison/class/livraison.class.php'; +require_once DOL_DOCUMENT_ROOT.'/delivery/class/delivery.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; diff --git a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php index 34b66066f54..8ea980fbd5c 100644 --- a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php @@ -28,7 +28,7 @@ */ require_once DOL_DOCUMENT_ROOT.'/core/modules/livraison/modules_livraison.php'; -require_once DOL_DOCUMENT_ROOT.'/livraison/class/livraison.class.php'; +require_once DOL_DOCUMENT_ROOT.'/delivery/class/delivery.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; diff --git a/htdocs/livraison/card.php b/htdocs/delivery/card.php similarity index 99% rename from htdocs/livraison/card.php rename to htdocs/delivery/card.php index 2a1646a5d80..7c796b70a97 100644 --- a/htdocs/livraison/card.php +++ b/htdocs/delivery/card.php @@ -28,7 +28,7 @@ */ require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/livraison/class/livraison.class.php'; +require_once DOL_DOCUMENT_ROOT.'/delivery/class/delivery.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/livraison/modules_livraison.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php'; @@ -59,7 +59,7 @@ $id = GETPOST('id', 'int'); if ($user->socid) $socid = $user->socid; $result = restrictedArea($user, 'expedition', $id, 'livraison', 'livraison'); -$object = new Livraison($db); +$object = new Delivery($db); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels @@ -306,7 +306,7 @@ if ($action == 'create') // Create. Seems to no be used /* - * Livraison + * Delivery */ if ($typeobject == 'commande' && $expedition->origin_id > 0 && !empty($conf->commande->enabled)) diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/delivery/class/delivery.class.php similarity index 98% rename from htdocs/livraison/class/livraison.class.php rename to htdocs/delivery/class/delivery.class.php index c612dbf6fe2..d7bd0856e74 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -22,7 +22,7 @@ */ /** - * \file htdocs/livraison/class/livraison.class.php + * \file htdocs/livraison/class/delivery.class.php * \ingroup delivery * \brief Delivery Order Management Class File */ @@ -37,7 +37,7 @@ if (!empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/ /** * Class to manage receptions */ -class Livraison extends CommonObject +class Delivery extends CommonObject { /** * @var string ID to identify managed object @@ -114,7 +114,7 @@ class Livraison extends CommonObject { global $conf; - dol_syslog("Livraison::create"); + dol_syslog("Delivery::create"); if (empty($this->model_pdf)) $this->model_pdf = $conf->global->LIVRAISON_ADDON_PDF; @@ -158,7 +158,7 @@ class Livraison extends CommonObject $sql .= ", '".$this->db->escape($this->location_incoterms)."'"; $sql .= ")"; - dol_syslog("Livraison::create", LOG_DEBUG); + dol_syslog("Delivery::create", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -170,7 +170,7 @@ class Livraison extends CommonObject $sql .= "SET ref = '".$this->db->escape($numref)."'"; $sql .= " WHERE rowid = ".$this->id; - dol_syslog("Livraison::create", LOG_DEBUG); + dol_syslog("Delivery::create", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -526,7 +526,7 @@ class Livraison extends CommonObject $num = count($expedition->lines); for ($i = 0; $i < $num; $i++) { - $line = new LivraisonLigne($this->db); + $line = new DeliveryLigne($this->db); $line->origin_line_id = $expedition->lines[$i]->origin_line_id; $line->libelle = $expedition->lines[$i]->libelle; $line->description = $expedition->lines[$i]->description; @@ -570,7 +570,7 @@ class Livraison extends CommonObject if ($id > 0 && !$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) // For avoid conflicts if trigger used { - $livraisonline = new LivraisonLigne($this->db); + $livraisonline = new DeliveryLigne($this->db); $livraisonline->array_options = $array_options; $livraisonline->id = $id; $result = $livraisonline->insertExtraFields(); @@ -597,7 +597,7 @@ class Livraison extends CommonObject public function addline($origin_id, $qty) { $num = count($this->lines); - $line = new LivraisonLigne($this->db); + $line = new DeliveryLigne($this->db); $line->origin_id = $origin_id; $line->qty = $qty; @@ -773,7 +773,7 @@ class Livraison extends CommonObject $i = 0; while ($i < $num) { - $line = new LivraisonLigne($this->db); + $line = new DeliveryLigne($this->db); $obj = $this->db->fetch_object($resql); @@ -911,7 +911,7 @@ class Livraison extends CommonObject $this->note_private = 'Private note'; $i = 0; - $line = new LivraisonLigne($this->db); + $line = new DeliveryLigne($this->db); $line->fk_product = $prodids[0]; $line->qty_asked = 10; $line->qty_shipped = 9; @@ -1083,7 +1083,7 @@ class Livraison extends CommonObject /** * Management class of delivery note lines */ -class LivraisonLigne extends CommonObjectLine +class DeliveryLigne extends CommonObjectLine { /** * @var DoliDB Database handler. diff --git a/htdocs/livraison/class/index.html b/htdocs/delivery/class/index.html similarity index 100% rename from htdocs/livraison/class/index.html rename to htdocs/delivery/class/index.html diff --git a/htdocs/livraison/index.html b/htdocs/delivery/index.html similarity index 100% rename from htdocs/livraison/index.html rename to htdocs/delivery/index.html diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 9b6a07a5435..e5ae22d5f91 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -878,8 +878,8 @@ class Expedition extends CommonObject if ($this->statut == self::STATUS_VALIDATED || $this->statut == self::STATUS_CLOSED) { // Expedition validee - include_once DOL_DOCUMENT_ROOT.'/livraison/class/livraison.class.php'; - $delivery = new Livraison($this->db); + include_once DOL_DOCUMENT_ROOT.'/delivery/class/delivery.class.php'; + $delivery = new Delivery($this->db); $result = $delivery->create_from_sending($user, $this->id); if ($result > 0) { diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 9e6ad514da6..6dad894cd38 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -236,7 +236,7 @@ if (empty($reshook)) 'FactureFournisseur' => '/fourn/class/fournisseur.facture.class.php', 'SupplierProposal' => '/supplier_proposal/class/supplier_proposal.class.php', 'ProductFournisseur' => '/fourn/class/fournisseur.product.class.php', - 'Livraison' => '/livraison/class/livraison.class.php', + 'Livraison' => '/delivery/class/delivery.class.php', 'Product' => '/product/class/product.class.php', 'Project' => '/projet/class/project.class.php', 'User' => '/user/class/user.class.php', diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 8551cb61f10..e6895b367cb 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -417,7 +417,7 @@ class Thirdparties extends DolibarrApi 'FactureFournisseur' => '/fourn/class/fournisseur.facture.class.php', 'SupplierProposal' => '/supplier_proposal/class/supplier_proposal.class.php', 'ProductFournisseur' => '/fourn/class/fournisseur.product.class.php', - 'Livraison' => '/livraison/class/livraison.class.php', + 'Livraison' => '/delivery/class/delivery.class.php', 'Product' => '/product/class/product.class.php', 'Project' => '/projet/class/project.class.php', 'User' => '/user/class/user.class.php', From c1b0c1f6a224c759271e02bfd472d75b2543a8e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien?= Date: Mon, 5 Oct 2020 15:32:29 +0200 Subject: [PATCH 02/13] rename folder ref to Module Delivery --- htdocs/core/lib/sendings.lib.php | 6 +++--- htdocs/delivery/card.php | 4 ++-- htdocs/delivery/class/delivery.class.php | 4 ++-- htdocs/expedition/card.php | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 554332fe4db..45be5148612 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -56,7 +56,7 @@ function shipping_prepare_head($object) // Take first one element of array $tmp = reset($object->linkedObjectsIds['delivery']); - $head[$h][0] = DOL_URL_ROOT."/livraison/card.php?id=".$tmp; + $head[$h][0] = DOL_URL_ROOT."/delivery/card.php?id=".$tmp; $head[$h][1] = $langs->trans("DeliveryCard"); $head[$h][2] = 'delivery'; $h++; @@ -135,7 +135,7 @@ function delivery_prepare_head($object) $h++; } - $head[$h][0] = DOL_URL_ROOT."/livraison/card.php?id=".$object->id; + $head[$h][0] = DOL_URL_ROOT."/delivery/card.php?id=".$object->id; $head[$h][1] = $langs->trans("DeliveryCard"); $head[$h][2] = 'delivery'; $h++; @@ -423,7 +423,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') // Ref print ''; print $receiving->getNomUrl($db); - //print ''.img_object($langs->trans("ShowReceiving"),'sending').' '.$objp->livraison_ref.''; + //print ''.img_object($langs->trans("ShowReceiving"),'sending').' '.$objp->livraison_ref.''; print ''; // Qty received //print ''; diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index 7c796b70a97..794717aa044 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -22,7 +22,7 @@ */ /** - * \file htdocs/livraison/card.php + * \file htdocs/delivery/card.php * \ingroup livraison * \brief Page to describe a delivery receipt */ @@ -458,7 +458,7 @@ if ($action == 'create') // Create. Seems to no be used print '
'; print $langs->trans('IncotermLabel'); print ''; - if ($user->rights->expedition->livraison->creer) print ''.img_edit().''; + if ($user->rights->expedition->livraison->creer) print ''.img_edit().''; else print ' '; print '
'; print ''; diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index d7bd0856e74..c226ad94083 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -22,7 +22,7 @@ */ /** - * \file htdocs/livraison/class/delivery.class.php + * \file htdocs/delivery/class/delivery.class.php * \ingroup delivery * \brief Delivery Order Management Class File */ @@ -725,7 +725,7 @@ class Delivery extends CommonObject $label = img_picto('', $this->picto).' '.$langs->trans("ShowReceiving").':
'; $label .= ''.$langs->trans("Status").': '.$this->ref; - $url = DOL_URL_ROOT.'/livraison/card.php?id='.$this->id; + $url = DOL_URL_ROOT.'/delivery/card.php?id='.$this->id; //if ($option !== 'nolink') //{ diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 86ec2ee5c38..2c62758e774 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -404,7 +404,7 @@ if (empty($reshook)) $result = $object->create_delivery($user); if ($result > 0) { - header("Location: ".DOL_URL_ROOT.'/livraison/card.php?action=create_delivery&id='.$result); + header("Location: ".DOL_URL_ROOT.'/delivery/card.php?action=create_delivery&id='.$result); exit; } else { setEventMessages($object->error, $object->errors, 'errors'); From 140200213e1f9bf8eadd77aca90479655235fa57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien?= Date: Tue, 6 Oct 2020 11:04:31 +0200 Subject: [PATCH 03/13] change table into DB and ref #14697 --- dev/initdata/purge-data.php | 4 +- dev/initdemo/mysqldump_dolibarr_12.0.0.sql | 80 +++++++++---------- htdocs/core/lib/sendings.lib.php | 2 +- .../modules/livraison/mod_livraison_jade.php | 4 +- htdocs/delivery/class/delivery.class.php | 64 +++++++-------- htdocs/expedition/card.php | 2 +- htdocs/expedition/list.php | 2 +- htdocs/install/mysql/migration/repair.sql | 8 +- ...livraison.key.sql => llx_delivery.key.sql} | 14 ++-- .../{llx_livraison.sql => llx_delivery.sql} | 2 +- ...y.sql => llx_delivery_extrafields.key.sql} | 2 +- ...ields.sql => llx_delivery_extrafields.sql} | 2 +- ...sondet.key.sql => llx_deliverydet.key.sql} | 4 +- ...x_livraisondet.sql => llx_deliverydet.sql} | 4 +- ...ql => llx_deliverydet_extrafields.key.sql} | 2 +- ...ds.sql => llx_deliverydet_extrafields.sql} | 2 +- htdocs/install/pgsql/functions/functions.sql | 2 +- htdocs/reception/card.php | 2 +- htdocs/reception/list.php | 2 +- 19 files changed, 102 insertions(+), 102 deletions(-) rename htdocs/install/mysql/tables/{llx_livraison.key.sql => llx_delivery.key.sql} (58%) rename htdocs/install/mysql/tables/{llx_livraison.sql => llx_delivery.sql} (98%) rename htdocs/install/mysql/tables/{llx_livraison_extrafields.key.sql => llx_delivery_extrafields.key.sql} (90%) rename htdocs/install/mysql/tables/{llx_livraison_extrafields.sql => llx_delivery_extrafields.sql} (96%) rename htdocs/install/mysql/tables/{llx_livraisondet.key.sql => llx_deliverydet.key.sql} (81%) rename htdocs/install/mysql/tables/{llx_livraisondet.sql => llx_deliverydet.sql} (96%) rename htdocs/install/mysql/tables/{llx_livraisondet_extrafields.key.sql => llx_deliverydet_extrafields.key.sql} (90%) rename htdocs/install/mysql/tables/{llx_livraisondet_extrafields.sql => llx_deliverydet_extrafields.sql} (96%) diff --git a/dev/initdata/purge-data.php b/dev/initdata/purge-data.php index e6a67aa73c8..18256c33766 100755 --- a/dev/initdata/purge-data.php +++ b/dev/initdata/purge-data.php @@ -120,8 +120,8 @@ $sqls=array( "DELETE FROM ".MAIN_DB_PREFIX."expedition where date_creation < '__DATE__'", ), 'delivery'=>array( - "DELETE FROM ".MAIN_DB_PREFIX."livraisondet WHERE fk_livraison IN (select rowid FROM ".MAIN_DB_PREFIX."livraison where date_creation < '__DATE__')", - "DELETE FROM ".MAIN_DB_PREFIX."livraison where date_creation < '__DATE__'", + "DELETE FROM ".MAIN_DB_PREFIX."deliverydet WHERE fk_delivery IN (select rowid FROM ".MAIN_DB_PREFIX."delivery where date_creation < '__DATE__')", + "DELETE FROM ".MAIN_DB_PREFIX."delivery where date_creation < '__DATE__'", ), 'contract'=>array( "DELETE FROM ".MAIN_DB_PREFIX."contratdet_extrafields WHERE fk_object IN (select rowid FROM ".MAIN_DB_PREFIX."contratdet WHERE fk_contrat IN (select rowid FROM ".MAIN_DB_PREFIX."contrat where datec < '__DATE__'))", diff --git a/dev/initdemo/mysqldump_dolibarr_12.0.0.sql b/dev/initdemo/mysqldump_dolibarr_12.0.0.sql index 3cc1db1cf34..4c12f2d5f94 100644 --- a/dev/initdemo/mysqldump_dolibarr_12.0.0.sql +++ b/dev/initdemo/mysqldump_dolibarr_12.0.0.sql @@ -7522,13 +7522,13 @@ INSERT INTO `llx_links` VALUES (1,1,'2018-01-16 16:45:35','http://www.dolicloud. UNLOCK TABLES; -- --- Table structure for table `llx_livraison` +-- Table structure for table `llx_delivery` -- -DROP TABLE IF EXISTS `llx_livraison`; +DROP TABLE IF EXISTS `llx_delivery`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `llx_livraison` ( +CREATE TABLE `llx_delivery` ( `rowid` int(11) NOT NULL AUTO_INCREMENT, `tms` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `ref` varchar(30) COLLATE utf8_unicode_ci NOT NULL, @@ -7554,61 +7554,61 @@ CREATE TABLE `llx_livraison` ( `import_key` varchar(14) COLLATE utf8_unicode_ci DEFAULT NULL, `extraparams` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`rowid`), - UNIQUE KEY `idx_livraison_uk_ref` (`ref`,`entity`), - KEY `idx_livraison_fk_soc` (`fk_soc`), - KEY `idx_livraison_fk_user_author` (`fk_user_author`), - KEY `idx_livraison_fk_user_valid` (`fk_user_valid`), - CONSTRAINT `fk_livraison_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`), - CONSTRAINT `fk_livraison_fk_user_author` FOREIGN KEY (`fk_user_author`) REFERENCES `llx_user` (`rowid`), - CONSTRAINT `fk_livraison_fk_user_valid` FOREIGN KEY (`fk_user_valid`) REFERENCES `llx_user` (`rowid`) + UNIQUE KEY `idx_delivery_uk_ref` (`ref`,`entity`), + KEY `idx_delivery_fk_soc` (`fk_soc`), + KEY `idx_delivery_fk_user_author` (`fk_user_author`), + KEY `idx_delivery_fk_user_valid` (`fk_user_valid`), + CONSTRAINT `fk_delivery_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`), + CONSTRAINT `fk_delivery_fk_user_author` FOREIGN KEY (`fk_user_author`) REFERENCES `llx_user` (`rowid`), + CONSTRAINT `fk_delivery_fk_user_valid` FOREIGN KEY (`fk_user_valid`) REFERENCES `llx_user` (`rowid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Dumping data for table `llx_livraison` +-- Dumping data for table `llx_delivery` -- -LOCK TABLES `llx_livraison` WRITE; -/*!40000 ALTER TABLE `llx_livraison` DISABLE KEYS */; -/*!40000 ALTER TABLE `llx_livraison` ENABLE KEYS */; +LOCK TABLES `llx_delivery` WRITE; +/*!40000 ALTER TABLE `llx_delivery` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_delivery` ENABLE KEYS */; UNLOCK TABLES; -- --- Table structure for table `llx_livraison_extrafields` +-- Table structure for table `llx_delivery_extrafields` -- -DROP TABLE IF EXISTS `llx_livraison_extrafields`; +DROP TABLE IF EXISTS `llx_delivery_extrafields`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `llx_livraison_extrafields` ( +CREATE TABLE `llx_delivery_extrafields` ( `rowid` int(11) NOT NULL AUTO_INCREMENT, `tms` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `fk_object` int(11) NOT NULL, `import_key` varchar(14) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`rowid`), - KEY `idx_livraison_extrafields` (`fk_object`) + KEY `idx_delivery_extrafields` (`fk_object`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Dumping data for table `llx_livraison_extrafields` +-- Dumping data for table `llx_delivery_extrafields` -- -LOCK TABLES `llx_livraison_extrafields` WRITE; -/*!40000 ALTER TABLE `llx_livraison_extrafields` DISABLE KEYS */; -/*!40000 ALTER TABLE `llx_livraison_extrafields` ENABLE KEYS */; +LOCK TABLES `llx_delivery_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_delivery_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_delivery_extrafields` ENABLE KEYS */; UNLOCK TABLES; -- --- Table structure for table `llx_livraisondet` +-- Table structure for table `llx_deliverydet` -- -DROP TABLE IF EXISTS `llx_livraisondet`; +DROP TABLE IF EXISTS `llx_deliverydet`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `llx_livraisondet` ( +CREATE TABLE `llx_deliverydet` ( `rowid` int(11) NOT NULL AUTO_INCREMENT, - `fk_livraison` int(11) DEFAULT NULL, + `fk_delivery` int(11) DEFAULT NULL, `fk_origin_line` int(11) DEFAULT NULL, `fk_product` int(11) DEFAULT NULL, `description` text COLLATE utf8_unicode_ci DEFAULT NULL, @@ -7617,44 +7617,44 @@ CREATE TABLE `llx_livraisondet` ( `total_ht` double(24,8) DEFAULT 0.00000000, `rang` int(11) DEFAULT 0, PRIMARY KEY (`rowid`), - KEY `idx_livraisondet_fk_expedition` (`fk_livraison`), - CONSTRAINT `fk_livraisondet_fk_livraison` FOREIGN KEY (`fk_livraison`) REFERENCES `llx_livraison` (`rowid`) + KEY `idx_deliverydet_fk_expedition` (`fk_delivery`), + CONSTRAINT `fk_deliverydet_fk_delivery` FOREIGN KEY (`fk_delivery`) REFERENCES `llx_delivery` (`rowid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Dumping data for table `llx_livraisondet` +-- Dumping data for table `llx_deliverydet` -- -LOCK TABLES `llx_livraisondet` WRITE; -/*!40000 ALTER TABLE `llx_livraisondet` DISABLE KEYS */; -/*!40000 ALTER TABLE `llx_livraisondet` ENABLE KEYS */; +LOCK TABLES `llx_deliverydet` WRITE; +/*!40000 ALTER TABLE `llx_deliverydet` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_deliverydet` ENABLE KEYS */; UNLOCK TABLES; -- --- Table structure for table `llx_livraisondet_extrafields` +-- Table structure for table `llx_deliverydet_extrafields` -- -DROP TABLE IF EXISTS `llx_livraisondet_extrafields`; +DROP TABLE IF EXISTS `llx_deliverydet_extrafields`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; -CREATE TABLE `llx_livraisondet_extrafields` ( +CREATE TABLE `llx_deliverydet_extrafields` ( `rowid` int(11) NOT NULL AUTO_INCREMENT, `tms` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `fk_object` int(11) NOT NULL, `import_key` varchar(14) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`rowid`), - KEY `idx_livraisondet_extrafields` (`fk_object`) + KEY `idx_deliverydet_extrafields` (`fk_object`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- --- Dumping data for table `llx_livraisondet_extrafields` +-- Dumping data for table `llx_deliverydet_extrafields` -- -LOCK TABLES `llx_livraisondet_extrafields` WRITE; -/*!40000 ALTER TABLE `llx_livraisondet_extrafields` DISABLE KEYS */; -/*!40000 ALTER TABLE `llx_livraisondet_extrafields` ENABLE KEYS */; +LOCK TABLES `llx_deliverydet_extrafields` WRITE; +/*!40000 ALTER TABLE `llx_deliverydet_extrafields` DISABLE KEYS */; +/*!40000 ALTER TABLE `llx_deliverydet_extrafields` ENABLE KEYS */; UNLOCK TABLES; -- diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 45be5148612..447310c8ad2 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -219,7 +219,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') $sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed"; $sql .= ", ".MAIN_DB_PREFIX."expedition as e"; $sql .= ", ".MAIN_DB_PREFIX.$origin."det as obj"; - //if ($conf->livraison_bon->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."livraison as l ON l.fk_expedition = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."livraisondet as ld ON ld.fk_livraison = l.rowid AND obj.rowid = ld.fk_origin_line"; + //if ($conf->livraison_bon->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_expedition = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON obj.fk_product = p.rowid"; //TODO Add link to expeditiondet_batch $sql .= " WHERE e.entity IN (".getEntity('expedition').")"; diff --git a/htdocs/core/modules/livraison/mod_livraison_jade.php b/htdocs/core/modules/livraison/mod_livraison_jade.php index 01788cd863b..1cf337814b9 100644 --- a/htdocs/core/modules/livraison/mod_livraison_jade.php +++ b/htdocs/core/modules/livraison/mod_livraison_jade.php @@ -98,7 +98,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL - $sql .= " FROM ".MAIN_DB_PREFIX."livraison"; + $sql .= " FROM ".MAIN_DB_PREFIX."delivery"; $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; $sql .= " AND entity = ".$conf->entity; @@ -132,7 +132,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder // First, we get the max value $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL - $sql .= " FROM ".MAIN_DB_PREFIX."livraison"; + $sql .= " FROM ".MAIN_DB_PREFIX."delivery"; $sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; $sql .= " AND entity = ".$conf->entity; diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index c226ad94083..4ef1a257277 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -47,24 +47,24 @@ class Delivery extends CommonObject /** * @var int Field with ID of parent key if this field has a parent */ - public $fk_element = "fk_livraison"; + public $fk_element = "fk_delivery"; /** * @var string Name of table without prefix where object is stored */ - public $table_element = "livraison"; + public $table_element = "delivery"; /** * @var int Name of subtable line */ - public $table_element_line = "livraisondet"; + public $table_element_line = "deliverydet"; /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ public $picto = 'sending'; - public $brouillon; + public $draft; public $socid; public $ref_customer; @@ -108,7 +108,7 @@ class Delivery extends CommonObject * Create delivery receipt in database * * @param User $user Objet du user qui cree - * @return int <0 si erreur, id livraison cree si ok + * @return int <0 si erreur, id delivery cree si ok */ public function create($user) { @@ -122,14 +122,14 @@ class Delivery extends CommonObject $now = dol_now(); - /* On positionne en mode brouillon le bon de livraison */ - $this->brouillon = 1; + /* Delivery note as draft On positionne en mode draft le bon de livraison */ + $this->draft = 1; $this->user = $user; $this->db->begin(); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."livraison ("; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."delivery ("; $sql .= "ref"; $sql .= ", entity"; $sql .= ", fk_soc"; @@ -162,11 +162,11 @@ class Delivery extends CommonObject $resql = $this->db->query($sql); if ($resql) { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."livraison"); + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."delivery"); $numref = "(PROV".$this->id.")"; - $sql = "UPDATE ".MAIN_DB_PREFIX."livraison "; + $sql = "UPDATE ".MAIN_DB_PREFIX."delivery "; $sql .= "SET ref = '".$this->db->escape($numref)."'"; $sql .= " WHERE rowid = ".$this->id; @@ -207,7 +207,7 @@ class Delivery extends CommonObject if (!$conf->expedition_bon->enabled) { - // TODO uniformiser les statuts + // TODO standardize status uniformiser les statuts $ret = $this->setStatut(2, $this->origin_id, $this->origin); if (!$ret) { @@ -257,7 +257,7 @@ class Delivery extends CommonObject $idprod = $fk_product; $j = 0; - $sql = "INSERT INTO ".MAIN_DB_PREFIX."livraisondet (fk_livraison, fk_origin_line,"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."deliverydet (fk_delivery, fk_origin_line,"; $sql .= " fk_product, description, qty)"; $sql .= " VALUES (".$this->id.",".$origin_id.","; $sql .= " ".($idprod > 0 ? $idprod : "null").","; @@ -292,7 +292,7 @@ class Delivery extends CommonObject $sql .= ", el.fk_source as origin_id, el.sourcetype as origin"; $sql .= ', l.fk_incoterms, l.location_incoterms'; $sql .= ", i.libelle as label_incoterms"; - $sql .= " FROM ".MAIN_DB_PREFIX."livraison as l"; + $sql .= " FROM ".MAIN_DB_PREFIX."delivery as l"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = l.rowid AND el.targettype = '".$this->db->escape($this->element)."'"; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON l.fk_incoterms = i.rowid'; $sql .= " WHERE l.rowid = ".$id; @@ -330,7 +330,7 @@ class Delivery extends CommonObject $this->label_incoterms = $obj->label_incoterms; $this->db->free($result); - if ($this->statut == 0) $this->brouillon = 1; + if ($this->statut == 0) $this->draft = 1; // Retreive all extrafields // fetch optionals attributes and labels @@ -402,7 +402,7 @@ class Delivery extends CommonObject // Test if is not already in valid status. If so, we stop to avoid decrementing the stock twice. $sql = "SELECT ref"; - $sql .= " FROM ".MAIN_DB_PREFIX."livraison"; + $sql .= " FROM ".MAIN_DB_PREFIX."delivery"; $sql .= " WHERE ref = '".$this->db->escape($numref)."'"; $sql .= " AND fk_statut <> 0"; $sql .= " AND entity = ".$conf->entity; @@ -417,7 +417,7 @@ class Delivery extends CommonObject } } - $sql = "UPDATE ".MAIN_DB_PREFIX."livraison SET"; + $sql = "UPDATE ".MAIN_DB_PREFIX."delivery SET"; $sql .= " ref='".$this->db->escape($numref)."'"; $sql .= ", fk_statut = 1"; $sql .= ", date_valid = '".$this->db->idate($now)."'"; @@ -570,14 +570,14 @@ class Delivery extends CommonObject if ($id > 0 && !$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) // For avoid conflicts if trigger used { - $livraisonline = new DeliveryLigne($this->db); - $livraisonline->array_options = $array_options; - $livraisonline->id = $id; - $result = $livraisonline->insertExtraFields(); + $line = new DeliveryLigne($this->db); + $line->array_options = $array_options; + $line->id = $id; + $result = $line->insertExtraFields(); if ($result < 0) { - $this->error[] = $livraisonline->error; + $this->error[] = $line->error; $error++; } } @@ -643,8 +643,8 @@ class Delivery extends CommonObject $error = 0; - $sql = "DELETE FROM ".MAIN_DB_PREFIX."livraisondet"; - $sql .= " WHERE fk_livraison = ".$this->id; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."deliverydet"; + $sql .= " WHERE fk_delivery = ".$this->id; if ($this->db->query($sql)) { // Delete linked object @@ -653,13 +653,13 @@ class Delivery extends CommonObject if (!$error) { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."livraison"; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."delivery"; $sql .= " WHERE rowid = ".$this->id; if ($this->db->query($sql)) { $this->db->commit(); - // On efface le repertoire de pdf provisoire + // Deleting pdf folder's draft On efface le repertoire de pdf provisoire $ref = dol_sanitizeFileName($this->ref); if (!empty($conf->expedition->dir_output)) { @@ -760,10 +760,10 @@ class Delivery extends CommonObject $sql .= " cd.qty as qty_asked, cd.label as custom_label, cd.fk_unit,"; $sql .= " p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc,"; $sql .= " p.weight, p.weight_units, p.width, p.width_units, p.length, p.length_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tobatch as product_tobatch"; - $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd, ".MAIN_DB_PREFIX."livraisondet as ld"; + $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd, ".MAIN_DB_PREFIX."deliverydet as ld"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on p.rowid = ld.fk_product"; $sql .= " WHERE ld.fk_origin_line = cd.rowid"; - $sql .= " AND ld.fk_livraison = ".$this->id; + $sql .= " AND ld.fk_delivery = ".$this->id; dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG); $resql = $this->db->query($sql); @@ -956,10 +956,10 @@ class Delivery extends CommonObject // Get lines of sources alread delivered $sql = "SELECT ld.fk_origin_line, sum(ld.qty) as qty"; - $sql .= " FROM ".MAIN_DB_PREFIX."livraisondet as ld, ".MAIN_DB_PREFIX."livraison as l,"; + $sql .= " FROM ".MAIN_DB_PREFIX."deliverydet as ld, ".MAIN_DB_PREFIX."delivery as l,"; $sql .= " ".MAIN_DB_PREFIX.$this->linked_object[0]['type']." as c"; $sql .= ", ".MAIN_DB_PREFIX.$this->linked_object[0]['type']."det as cd"; - $sql .= " WHERE ld.fk_livraison = l.rowid"; + $sql .= " WHERE ld.fk_delivery = l.rowid"; $sql .= " AND ld.fk_origin_line = cd.rowid"; $sql .= " AND cd.fk_".$this->linked_object[0]['type']." = c.rowid"; $sql .= " AND cd.fk_".$this->linked_object[0]['type']." = ".$this->linked_object[0]['linkid']; @@ -1009,7 +1009,7 @@ class Delivery extends CommonObject // phpcs:enable if ($user->rights->expedition->creer) { - $sql = "UPDATE ".MAIN_DB_PREFIX."livraison"; + $sql = "UPDATE ".MAIN_DB_PREFIX."delivery"; $sql .= " SET date_delivery = ".($date_livraison ? "'".$this->db->idate($date_livraison)."'" : 'null'); $sql .= " WHERE rowid = ".$this->id; @@ -1125,12 +1125,12 @@ class DeliveryLigne extends CommonObjectLine /** * @var string ID to identify managed object */ - public $element = 'livraisondet'; + public $element = 'deliverydet'; /** * @var string Name of table without prefix where object is stored */ - public $table_element = 'livraisondet'; + public $table_element = 'deliverydet'; /** * Constructor diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 2c62758e774..e808fa809c3 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -2052,7 +2052,7 @@ if ($action == 'create') $sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed"; $sql .= ", ".MAIN_DB_PREFIX."expedition as e"; $sql .= ", ".MAIN_DB_PREFIX.$origin."det as obj"; - //if ($conf->livraison_bon->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."livraison as l ON l.fk_expedition = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."livraisondet as ld ON ld.fk_livraison = l.rowid AND obj.rowid = ld.fk_origin_line"; + //if ($conf->livraison_bon->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_expedition = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON obj.fk_product = p.rowid"; $sql .= " WHERE e.entity IN (".getEntity('expedition').")"; $sql .= " AND obj.fk_".$origin." = ".$origin_id; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 3f9de5533fc..73db3ef8fe9 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -246,7 +246,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as ee ON e.rowid = ee.fk_source AND ee.sourcetype = 'shipping' AND ee.targettype = 'delivery'"; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."livraison as l ON l.rowid = ee.fk_target"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.rowid = ee.fk_target"; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON e.fk_user_author = u.rowid'; // We'll need this table joined to the select in order to filter by sale diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index c9c916ed3ad..d21c43bfb8a 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -91,8 +91,8 @@ delete from llx_commandedet where fk_commande in (select rowid from llx_commande delete from llx_commande where ref = ''; delete from llx_propaldet where fk_propal in (select rowid from llx_propal where ref = ''); delete from llx_propal where ref = ''; -delete from llx_livraisondet where fk_livraison in (select rowid from llx_livraison where ref = ''); -delete from llx_livraison where ref = ''; +delete from llx_deliverydet where fk_delivery in (select rowid from llx_delivery where ref = ''); +delete from llx_delivery where ref = ''; delete from llx_expeditiondet where fk_expedition in (select rowid from llx_expedition where ref = ''); delete from llx_expedition where ref = ''; delete from llx_holiday_logs where fk_user_update not IN (select rowid from llx_user); @@ -187,8 +187,8 @@ delete from llx_categorie_project where fk_categorie not in (select rowid from l delete from llx_ecm_files where src_object_type = 'expensereport' and src_object_id NOT IN (select rowid from llx_expensereport); -- Fix: delete orphelin deliveries. Note: deliveries are linked to shipment by llx_element_element only. No other links. -delete from llx_livraisondet where fk_livraison not in (select fk_target from llx_element_element where targettype = 'delivery') AND fk_livraison not in (select fk_source from llx_element_element where sourcetype = 'delivery'); -delete from llx_livraison where rowid not in (select fk_target from llx_element_element where targettype = 'delivery') AND rowid not in (select fk_source from llx_element_element where sourcetype = 'delivery'); +delete from llx_deliverydet where fk_delivery not in (select fk_target from llx_element_element where targettype = 'delivery') AND fk_delivery not in (select fk_source from llx_element_element where sourcetype = 'delivery'); +delete from llx_delivery where rowid not in (select fk_target from llx_element_element where targettype = 'delivery') AND rowid not in (select fk_source from llx_element_element where sourcetype = 'delivery'); -- Fix delete element_element orphelins (right side) diff --git a/htdocs/install/mysql/tables/llx_livraison.key.sql b/htdocs/install/mysql/tables/llx_delivery.key.sql similarity index 58% rename from htdocs/install/mysql/tables/llx_livraison.key.sql rename to htdocs/install/mysql/tables/llx_delivery.key.sql index e0e21c13451..4eb3b96f2a0 100644 --- a/htdocs/install/mysql/tables/llx_livraison.key.sql +++ b/htdocs/install/mysql/tables/llx_delivery.key.sql @@ -18,12 +18,12 @@ -- =================================================================== -ALTER TABLE llx_livraison ADD UNIQUE INDEX idx_livraison_uk_ref (ref, entity); +ALTER TABLE llx_delivery ADD UNIQUE INDEX idx_delivery_uk_ref (ref, entity); -ALTER TABLE llx_livraison ADD INDEX idx_livraison_fk_soc (fk_soc); -ALTER TABLE llx_livraison ADD INDEX idx_livraison_fk_user_author (fk_user_author); -ALTER TABLE llx_livraison ADD INDEX idx_livraison_fk_user_valid (fk_user_valid); +ALTER TABLE llx_delivery ADD INDEX idx_delivery_fk_soc (fk_soc); +ALTER TABLE llx_delivery ADD INDEX idx_delivery_fk_user_author (fk_user_author); +ALTER TABLE llx_delivery ADD INDEX idx_delivery_fk_user_valid (fk_user_valid); -ALTER TABLE llx_livraison ADD CONSTRAINT fk_livraison_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); -ALTER TABLE llx_livraison ADD CONSTRAINT fk_livraison_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); -ALTER TABLE llx_livraison ADD CONSTRAINT fk_livraison_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid); +ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); +ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); +ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid); diff --git a/htdocs/install/mysql/tables/llx_livraison.sql b/htdocs/install/mysql/tables/llx_delivery.sql similarity index 98% rename from htdocs/install/mysql/tables/llx_livraison.sql rename to htdocs/install/mysql/tables/llx_delivery.sql index 31af38edfb6..637c366ee95 100644 --- a/htdocs/install/mysql/tables/llx_livraison.sql +++ b/htdocs/install/mysql/tables/llx_delivery.sql @@ -17,7 +17,7 @@ -- -- =================================================================== -create table llx_livraison +create table llx_delivery ( rowid integer AUTO_INCREMENT PRIMARY KEY, tms timestamp, diff --git a/htdocs/install/mysql/tables/llx_livraison_extrafields.key.sql b/htdocs/install/mysql/tables/llx_delivery_extrafields.key.sql similarity index 90% rename from htdocs/install/mysql/tables/llx_livraison_extrafields.key.sql rename to htdocs/install/mysql/tables/llx_delivery_extrafields.key.sql index 87d8931d27c..a9118a2493b 100644 --- a/htdocs/install/mysql/tables/llx_livraison_extrafields.key.sql +++ b/htdocs/install/mysql/tables/llx_delivery_extrafields.key.sql @@ -17,4 +17,4 @@ -- =================================================================== -ALTER TABLE llx_livraison_extrafields ADD INDEX idx_livraison_extrafields (fk_object); +ALTER TABLE llx_delivery_extrafields ADD INDEX idx_delivery_extrafields (fk_object); diff --git a/htdocs/install/mysql/tables/llx_livraison_extrafields.sql b/htdocs/install/mysql/tables/llx_delivery_extrafields.sql similarity index 96% rename from htdocs/install/mysql/tables/llx_livraison_extrafields.sql rename to htdocs/install/mysql/tables/llx_delivery_extrafields.sql index 70248d0ceca..6d9e3cc85c4 100644 --- a/htdocs/install/mysql/tables/llx_livraison_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_delivery_extrafields.sql @@ -16,7 +16,7 @@ -- -- ======================================================================== -create table llx_livraison_extrafields +create table llx_delivery_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, tms timestamp, diff --git a/htdocs/install/mysql/tables/llx_livraisondet.key.sql b/htdocs/install/mysql/tables/llx_deliverydet.key.sql similarity index 81% rename from htdocs/install/mysql/tables/llx_livraisondet.key.sql rename to htdocs/install/mysql/tables/llx_deliverydet.key.sql index 3006d520907..67ad3c37615 100644 --- a/htdocs/install/mysql/tables/llx_livraisondet.key.sql +++ b/htdocs/install/mysql/tables/llx_deliverydet.key.sql @@ -18,5 +18,5 @@ -- =================================================================== -ALTER TABLE llx_livraisondet ADD INDEX idx_livraisondet_fk_expedition (fk_livraison); -ALTER TABLE llx_livraisondet ADD CONSTRAINT fk_livraisondet_fk_livraison FOREIGN KEY (fk_livraison) REFERENCES llx_livraison (rowid); +ALTER TABLE llx_deliverydet ADD INDEX idx_deliverydet_fk_expedition (fk_delivery); +ALTER TABLE llx_deliverydet ADD CONSTRAINT fk_deliverydet_fk_delivery FOREIGN KEY (fk_delivery) REFERENCES llx_delivery (rowid); diff --git a/htdocs/install/mysql/tables/llx_livraisondet.sql b/htdocs/install/mysql/tables/llx_deliverydet.sql similarity index 96% rename from htdocs/install/mysql/tables/llx_livraisondet.sql rename to htdocs/install/mysql/tables/llx_deliverydet.sql index 3b30da9a955..69612018bf3 100644 --- a/htdocs/install/mysql/tables/llx_livraisondet.sql +++ b/htdocs/install/mysql/tables/llx_deliverydet.sql @@ -17,10 +17,10 @@ -- -- =================================================================== -create table llx_livraisondet +create table llx_deliverydet ( rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_livraison integer, + fk_delivery integer, fk_origin_line integer, -- Correspondance de la ligne avec le document d'origine (propal, commande) fk_product integer, description text, diff --git a/htdocs/install/mysql/tables/llx_livraisondet_extrafields.key.sql b/htdocs/install/mysql/tables/llx_deliverydet_extrafields.key.sql similarity index 90% rename from htdocs/install/mysql/tables/llx_livraisondet_extrafields.key.sql rename to htdocs/install/mysql/tables/llx_deliverydet_extrafields.key.sql index cc9ee6673d0..3bce2b47a3b 100644 --- a/htdocs/install/mysql/tables/llx_livraisondet_extrafields.key.sql +++ b/htdocs/install/mysql/tables/llx_deliverydet_extrafields.key.sql @@ -17,4 +17,4 @@ -- =================================================================== -ALTER TABLE llx_livraisondet_extrafields ADD INDEX idx_livraisondet_extrafields (fk_object); +ALTER TABLE llx_deliverydet_extrafields ADD INDEX idx_deliverydet_extrafields (fk_object); diff --git a/htdocs/install/mysql/tables/llx_livraisondet_extrafields.sql b/htdocs/install/mysql/tables/llx_deliverydet_extrafields.sql similarity index 96% rename from htdocs/install/mysql/tables/llx_livraisondet_extrafields.sql rename to htdocs/install/mysql/tables/llx_deliverydet_extrafields.sql index cb6300a8ca1..be7addb1f00 100644 --- a/htdocs/install/mysql/tables/llx_livraisondet_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_deliverydet_extrafields.sql @@ -16,7 +16,7 @@ -- -- =================================================================== -create table llx_livraisondet_extrafields +create table llx_deliverydet_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, tms timestamp, diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql index 309343b7789..cd98cdfef2e 100644 --- a/htdocs/install/pgsql/functions/functions.sql +++ b/htdocs/install/pgsql/functions/functions.sql @@ -124,7 +124,7 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_facturedet_extrafiel CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_fichinter FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_fichinter_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_fichinterdet_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); -CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_livraison FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_delivery FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_loan FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_localtax FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_mailing FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index d41ce8e6bf4..4dfd36e4a98 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1671,7 +1671,7 @@ if ($action == 'create') $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as ed"; $sql .= ", ".MAIN_DB_PREFIX."reception as e"; $sql .= ", ".MAIN_DB_PREFIX.$origin."det as obj"; - //if ($conf->livraison_bon->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."livraison as l ON l.fk_reception = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."livraisondet as ld ON ld.fk_livraison = l.rowid AND obj.rowid = ld.fk_origin_line"; + //if ($conf->livraison_bon->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_reception = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON obj.fk_product = p.rowid"; $sql .= " WHERE e.entity IN (".getEntity('reception').")"; $sql .= " AND obj.fk_commande = ".$origin_id; diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index 891a5630c7f..db8d652cc95 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -429,7 +429,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as ee ON e.rowid = ee.fk_source AND ee.sourcetype = 'reception' AND ee.targettype = 'delivery'"; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."livraison as l ON l.rowid = ee.fk_target"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.rowid = ee.fk_target"; if (!$user->rights->societe->client->voir && !$socid) // Internal user with no permission to see all { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; From 5571a166c62d0db9598e32d44e1ae3439024f520 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien?= Date: Tue, 6 Oct 2020 11:37:55 +0200 Subject: [PATCH 04/13] change variable #14697 --- htdocs/admin/livraison.php | 6 +++--- htdocs/admin/livraison_extrafields.php | 2 +- htdocs/admin/livraisondet_extrafields.php | 2 +- htdocs/comm/propal/card.php | 2 +- htdocs/comm/propal/class/propal.class.php | 12 ++++++------ htdocs/commande/card.php | 2 +- htdocs/commande/class/commande.class.php | 10 +++++----- .../boxes/box_supplier_orders_awaiting_reception.php | 6 +++--- htdocs/delivery/card.php | 2 +- htdocs/delivery/class/delivery.class.php | 10 +++++----- htdocs/expedition/card.php | 2 +- htdocs/expedition/class/expedition.class.php | 10 +++++----- htdocs/expedition/shipment.php | 2 +- htdocs/fourn/class/fournisseur.commande.class.php | 12 ++++++------ htdocs/fourn/commande/card.php | 4 ++-- htdocs/reception/card.php | 2 +- htdocs/reception/class/reception.class.php | 10 +++++----- htdocs/supplier_proposal/card.php | 2 +- .../class/supplier_proposal.class.php | 12 ++++++------ 19 files changed, 55 insertions(+), 55 deletions(-) diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index 0a315897081..38c9114f50b 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -245,13 +245,13 @@ foreach ($dirmodels as $reldir) } print ''; - $livraison = new Delivery($db); - $livraison->initAsSpecimen(); + $delivery = new Delivery($db); + $delivery->initAsSpecimen(); // Info $htmltooltip = ''; $htmltooltip .= ''.$langs->trans("Version").': '.$module->getVersion().'
'; - $nextval = $module->getNextValue($mysoc, $livraison); + $nextval = $module->getNextValue($mysoc, $delivery); if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval $htmltooltip .= ''.$langs->trans("NextValue").': '; if ($nextval) { diff --git a/htdocs/admin/livraison_extrafields.php b/htdocs/admin/livraison_extrafields.php index d30635333be..7c1d5cb3a5c 100644 --- a/htdocs/admin/livraison_extrafields.php +++ b/htdocs/admin/livraison_extrafields.php @@ -49,7 +49,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoenti $action = GETPOST('action', 'aZ09'); $attrname = GETPOST('attrname', 'alpha'); -$elementtype = 'livraison'; //Must be the $table_element of the class that manage extrafield +$elementtype = 'delivery'; //Must be the $table_element of the class that manage extrafield if (!$user->admin) accessforbidden(); diff --git a/htdocs/admin/livraisondet_extrafields.php b/htdocs/admin/livraisondet_extrafields.php index cc9dfa1c49f..ee174ab5024 100644 --- a/htdocs/admin/livraisondet_extrafields.php +++ b/htdocs/admin/livraisondet_extrafields.php @@ -50,7 +50,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoenti $action = GETPOST('action', 'aZ09'); $attrname = GETPOST('attrname', 'alpha'); -$elementtype = 'livraisondet'; //Must be the $table_element of the class that manage extrafield +$elementtype = 'deliverydet'; //Must be the $table_element of the class that manage extrafield if (!$user->admin) accessforbidden(); diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 9caf2c8483c..7a289867849 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -287,7 +287,7 @@ if (empty($reshook)) dol_print_error($db, $object->error); } elseif ($action == 'setdate_livraison' && $usercancreate) { - $result = $object->set_date_livraison($user, dol_mktime(12, 0, 0, $_POST['date_livraisonmonth'], $_POST['date_livraisonday'], $_POST['date_livraisonyear'])); + $result = $object->set_delivery_date($user, dol_mktime(12, 0, 0, $_POST['date_livraisonmonth'], $_POST['date_livraisonday'], $_POST['date_livraisonyear'])); if ($result < 0) dol_print_error($db, $object->error); } // Positionne ref client diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 7e34ac6fc3c..0c44e4256da 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -152,9 +152,9 @@ class Propal extends CommonObject public $datep; /** - * @var integer|string $date_livraison; + * @var integer|string $delivery_date; */ - public $date_livraison; + public $delivery_date; public $fin_validite; @@ -2060,11 +2060,11 @@ class Propal extends CommonObject * Set delivery date * * @param User $user Object user that modify - * @param int $date_livraison Delivery date + * @param int $delivery_date Delivery date * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - public function set_date_livraison($user, $date_livraison, $notrigger = 0) + public function set_delivery_date($user, $delivery_date, $notrigger = 0) { // phpcs:enable if (!empty($user->rights->propal->creer)) @@ -2074,7 +2074,7 @@ class Propal extends CommonObject $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."propal "; - $sql .= " SET date_livraison = ".($date_livraison != '' ? "'".$this->db->idate($date_livraison)."'" : 'null'); + $sql .= " SET date_livraison = ".($delivery_date != '' ? "'".$this->db->idate($delivery_date)."'" : 'null'); $sql .= " WHERE rowid = ".$this->id; dol_syslog(__METHOD__, LOG_DEBUG); @@ -2088,7 +2088,7 @@ class Propal extends CommonObject if (!$error) { $this->oldcopy = clone $this; - $this->date_livraison = $date_livraison; + $this->date_livraison = $delivery_date; } if (!$notrigger && empty($error)) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 5de377930d7..eeec7bcd0c1 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -541,7 +541,7 @@ if (empty($reshook)) $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); $object->fetch($id); - $result = $object->set_date_livraison($user, $datedelivery); + $result = $object->set_delivery_date($user, $datedelivery); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 5c314226214..133a3cb4c81 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -180,7 +180,7 @@ class Commande extends CommonOrder */ public $date_commande; - public $date_livraison; // Date expected of shipment (date starting shipment, not the reception that occurs some days after) + public $delivery_date; // Date expected of shipment (date starting shipment, not the reception that occurs some days after) /** * @var int ID @@ -2548,11 +2548,11 @@ class Commande extends CommonOrder * Set the planned delivery date * * @param User $user Objet utilisateur qui modifie - * @param int $date_livraison Date de livraison + * @param int $delivery_date Delivery date * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 si ko, >0 si ok */ - public function set_date_livraison($user, $date_livraison, $notrigger = 0) + public function set_delivery_date($user, $delivery_date, $notrigger = 0) { // phpcs:enable if ($user->rights->commande->creer) @@ -2562,7 +2562,7 @@ class Commande extends CommonOrder $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."commande"; - $sql .= " SET date_livraison = ".($date_livraison ? "'".$this->db->idate($date_livraison)."'" : 'null'); + $sql .= " SET date_livraison = ".($delivery_date ? "'".$this->db->idate($delivery_date)."'" : 'null'); $sql .= " WHERE rowid = ".$this->id; dol_syslog(__METHOD__, LOG_DEBUG); @@ -2576,7 +2576,7 @@ class Commande extends CommonOrder if (!$error) { $this->oldcopy = clone $this; - $this->date_livraison = $date_livraison; + $this->date_livraison = $delivery_date; } if (!$notrigger && empty($error)) diff --git a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php index 952e0b78d92..dc5b3684cd5 100644 --- a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php +++ b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php @@ -113,10 +113,10 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes while ($line < $num) { $objp = $this->db->fetch_object($result); $date = $this->db->jdate($objp->date_commande); - $date_livraison = $this->db->jdate($objp->date_livraison); + $delivery_date = $this->db->jdate($objp->date_livraison); $datem = $this->db->jdate($objp->tms); - $supplierorderstatic->date_livraison = $date_livraison; + $supplierorderstatic->date_livraison = $delivery_date; $supplierorderstatic->statut = $objp->fk_statut; $supplierorderstatic->id = $objp->rowid; @@ -153,7 +153,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes $this->info_box_contents[$line][] = array( 'td' => 'class="right"', - 'text' => $delayIcon.' '.dol_print_date($date_livraison, 'day').'', + 'text' => $delayIcon.' '.dol_print_date($delivery_date, 'day').'', 'asis' => 1 ); diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index 794717aa044..dc40d118f6e 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -170,7 +170,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expeditio if ($action == 'setdate_livraison' && $user->rights->expedition->livraison->creer) { $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); - $result = $object->set_date_livraison($user, $datedelivery); + $result = $object->set_delivery_date($user, $datedelivery); if ($result < 0) { $mesg = '
'.$object->error.'
'; diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index 4ef1a257277..c87c2f87df6 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -1001,23 +1001,23 @@ class Delivery extends CommonObject * Set the planned delivery date * * @param User $user Objet utilisateur qui modifie - * @param integer $date_livraison Date de livraison + * @param integer $delivery_date Delivery date * @return int <0 if KO, >0 if OK */ - public function set_date_livraison($user, $date_livraison) + public function set_delivery_date($user, $delivery_date) { // phpcs:enable if ($user->rights->expedition->creer) { $sql = "UPDATE ".MAIN_DB_PREFIX."delivery"; - $sql .= " SET date_delivery = ".($date_livraison ? "'".$this->db->idate($date_livraison)."'" : 'null'); + $sql .= " SET date_delivery = ".($delivery_date ? "'".$this->db->idate($delivery_date)."'" : 'null'); $sql .= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::set_date_livraison", LOG_DEBUG); + dol_syslog(get_class($this)."::set_delivery_date", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - $this->date_delivery = $date_livraison; + $this->date_delivery = $delivery_date; return 1; } else { $this->error = $this->db->error(); diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index e808fa809c3..f4f087aa5a3 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -479,7 +479,7 @@ if (empty($reshook)) $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); $object->fetch($id); - $result = $object->set_date_livraison($user, $datedelivery); + $result = $object->set_delivery_date($user, $datedelivery); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index e5ae22d5f91..dd6b9992064 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1955,23 +1955,23 @@ class Expedition extends CommonObject * Set the planned delivery date * * @param User $user Objet user that modify - * @param integer $date_livraison Date of delivery + * @param integer $delivery_date Date of delivery * @return int <0 if KO, >0 if OK */ - public function set_date_livraison($user, $date_livraison) + public function set_delivery_date($user, $delivery_date) { // phpcs:enable if ($user->rights->expedition->creer) { $sql = "UPDATE ".MAIN_DB_PREFIX."expedition"; - $sql .= " SET date_delivery = ".($date_livraison ? "'".$this->db->idate($date_livraison)."'" : 'null'); + $sql .= " SET date_delivery = ".($delivery_date ? "'".$this->db->idate($delivery_date)."'" : 'null'); $sql .= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::set_date_livraison", LOG_DEBUG); + dol_syslog(get_class($this)."::set_delivery_date", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - $this->date_delivery = $date_livraison; + $this->date_delivery = $delivery_date; return 1; } else { $this->error = $this->db->error(); diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 152dee7cd36..f6318c7b9b6 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -108,7 +108,7 @@ if (empty($reshook)) $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); $object->fetch($id); - $result = $object->set_date_livraison($user, $datedelivery); + $result = $object->set_delivery_date($user, $datedelivery); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 3d6d2c2f837..786cca8ac5c 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -117,7 +117,7 @@ class CommandeFournisseur extends CommonOrder /** * Delivery date */ - public $date_livraison; + public $delivery_date; public $total_ht; public $total_tva; @@ -2263,11 +2263,11 @@ class CommandeFournisseur extends CommonOrder * Set the planned delivery date * * @param User $user Objet user making change - * @param integer $date_livraison Planned delivery date + * @param integer $delivery_date Planned delivery date * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - public function set_date_livraison($user, $date_livraison, $notrigger = 0) + public function set_delivery_date($user, $delivery_date, $notrigger = 0) { // phpcs:enable if ($user->rights->fournisseur->commande->creer) @@ -2277,7 +2277,7 @@ class CommandeFournisseur extends CommonOrder $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur"; - $sql .= " SET date_livraison = ".($date_livraison ? "'".$this->db->idate($date_livraison)."'" : 'null'); + $sql .= " SET date_livraison = ".($delivery_date ? "'".$this->db->idate($delivery_date)."'" : 'null'); $sql .= " WHERE rowid = ".$this->id; dol_syslog(__METHOD__, LOG_DEBUG); @@ -2291,7 +2291,7 @@ class CommandeFournisseur extends CommonOrder if (!$error) { $this->oldcopy = clone $this; - $this->date_livraison = $date_livraison; + $this->date_livraison = $delivery_date; } if (!$notrigger && empty($error)) @@ -2325,7 +2325,7 @@ class CommandeFournisseur extends CommonOrder * Set the id projet * * @param User $user Objet utilisateur qui modifie - * @param int $id_projet Date de livraison + * @param int $id_projet Delivery date * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 si ko, >0 si ok */ diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 419d5c7a559..948404e2169 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -203,7 +203,7 @@ if (empty($reshook)) // date of delivery if ($action == 'setdate_livraison' && $usercancreate) { - $result = $object->set_date_livraison($user, $datelivraison); + $result = $object->set_delivery_date($user, $datelivraison); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } @@ -1199,7 +1199,7 @@ if (empty($reshook)) $result = $srcobject->fetch($object->origin_id); if ($result > 0) { - $object->set_date_livraison($user, $srcobject->date_livraison); + $object->set_delivery_date($user, $srcobject->date_livraison); $object->set_id_projet($user, $srcobject->fk_project); $lines = $srcobject->lines; diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 4dfd36e4a98..ed4f52c501b 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -425,7 +425,7 @@ if (empty($reshook)) $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); $object->fetch($id); - $result = $object->set_date_livraison($user, $datedelivery); + $result = $object->set_delivery_date($user, $datedelivery); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 8ea45ccd1c8..0a2458f57a6 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1224,23 +1224,23 @@ class Reception extends CommonObject * Set the planned delivery date * * @param User $user Objet utilisateur qui modifie - * @param integer $date_livraison Date de livraison + * @param integer $delivery_date Delivery date * @return int <0 if KO, >0 if OK */ - public function set_date_livraison($user, $date_livraison) + public function set_delivery_date($user, $delivery_date) { // phpcs:enable if ($user->rights->reception->creer) { $sql = "UPDATE ".MAIN_DB_PREFIX."reception"; - $sql .= " SET date_delivery = ".($date_livraison ? "'".$this->db->idate($date_livraison)."'" : 'null'); + $sql .= " SET date_delivery = ".($delivery_date ? "'".$this->db->idate($delivery_date)."'" : 'null'); $sql .= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::set_date_livraison", LOG_DEBUG); + dol_syslog(get_class($this)."::set_delivery_date", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - $this->date_delivery = $date_livraison; + $this->date_delivery = $delivery_date; return 1; } else { $this->error = $this->db->error(); diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 1190b29aa3c..ed501a6f8a6 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -229,7 +229,7 @@ if (empty($reshook)) else setEventMessages($langs->trans($object->error), null, 'errors'); } } elseif ($action == 'setdate_livraison' && $usercancreate) { - $result = $object->set_date_livraison($user, dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year'])); + $result = $object->set_delivery_date($user, dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year'])); if ($result < 0) dol_print_error($db, $object->error); } diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 92759515ba4..1a308469b6e 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -112,7 +112,7 @@ class SupplierProposal extends CommonObject /** * @var integer|string date_livraison */ - public $date_livraison; + public $delivery_date; /** * @deprecated @@ -1511,25 +1511,25 @@ class SupplierProposal extends CommonObject * Set delivery date * * @param User $user Object user that modify - * @param int $date_livraison Delivery date + * @param int $delivery_date Delivery date * @return int <0 if ko, >0 if ok */ - public function set_date_livraison($user, $date_livraison) + public function set_delivery_date($user, $delivery_date) { // phpcs:enable if (!empty($user->rights->supplier_proposal->creer)) { $sql = "UPDATE ".MAIN_DB_PREFIX."supplier_proposal "; - $sql .= " SET date_livraison = ".($date_livraison != '' ? "'".$this->db->idate($date_livraison)."'" : 'null'); + $sql .= " SET date_livraison = ".($delivery_date != '' ? "'".$this->db->idate($delivery_date)."'" : 'null'); $sql .= " WHERE rowid = ".$this->id; if ($this->db->query($sql)) { - $this->date_livraison = $date_livraison; + $this->date_livraison = $delivery_date; return 1; } else { $this->error = $this->db->error(); - dol_syslog(get_class($this)."::set_date_livraison Erreur SQL"); + dol_syslog(get_class($this)."::set_delivery_date Erreur SQL"); return -1; } } From af7c23b2accafe5bcbf2b2aa0b5842e28f288a7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien?= Date: Tue, 6 Oct 2020 12:05:24 +0200 Subject: [PATCH 05/13] rename folder admin/livraison.php and dependencies #14697 --- htdocs/admin/{livraison.php => delivery.php} | 6 +++--- ...raison_extrafields.php => delivery_extrafields.php} | 6 +++--- ...det_extrafields.php => deliverydet_extrafields.php} | 6 +++--- htdocs/commande/card.php | 2 +- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/class/conf.class.php | 6 +++--- htdocs/core/lib/expedition.lib.php | 8 ++++---- htdocs/core/lib/functions.lib.php | 6 +++--- htdocs/core/lib/functions2.lib.php | 6 +++--- htdocs/core/lib/order.lib.php | 10 +++++----- htdocs/core/lib/propal.lib.php | 4 ++-- htdocs/core/lib/sendings.lib.php | 10 +++++----- htdocs/expedition/card.php | 8 ++++---- htdocs/expedition/class/expedition.class.php | 2 +- htdocs/expedition/list.php | 4 ++-- htdocs/install/mysql/tables/llx_menu.sql | 2 +- htdocs/install/upgrade2.php | 4 ++-- htdocs/reception/card.php | 4 ++-- 18 files changed, 48 insertions(+), 48 deletions(-) rename htdocs/admin/{livraison.php => delivery.php} (99%) rename htdocs/admin/{livraison_extrafields.php => delivery_extrafields.php} (96%) rename htdocs/admin/{livraisondet_extrafields.php => deliverydet_extrafields.php} (96%) diff --git a/htdocs/admin/livraison.php b/htdocs/admin/delivery.php similarity index 99% rename from htdocs/admin/livraison.php rename to htdocs/admin/delivery.php index 38c9114f50b..4ef0179d88e 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/delivery.php @@ -24,9 +24,9 @@ */ /** - * \file htdocs/admin/livraison.php - * \ingroup livraison - * \brief Page d'administration/configuration du module Delivery + * \file htdocs/admin/delivery.php + * \ingroup delivery + * \brief age to setup extra fields of delivery */ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; diff --git a/htdocs/admin/livraison_extrafields.php b/htdocs/admin/delivery_extrafields.php similarity index 96% rename from htdocs/admin/livraison_extrafields.php rename to htdocs/admin/delivery_extrafields.php index 7c1d5cb3a5c..182985b47da 100644 --- a/htdocs/admin/livraison_extrafields.php +++ b/htdocs/admin/delivery_extrafields.php @@ -22,9 +22,9 @@ */ /** - * \file htdocs/admin/livraison_extrafields.php - * \ingroup livraison - * \brief Page to setup extra fields of livraison + * \file htdocs/admin/delivery_extrafields.php + * \ingroup delivery + * \brief Page to setup extra fields of delivery */ require '../main.inc.php'; diff --git a/htdocs/admin/livraisondet_extrafields.php b/htdocs/admin/deliverydet_extrafields.php similarity index 96% rename from htdocs/admin/livraisondet_extrafields.php rename to htdocs/admin/deliverydet_extrafields.php index ee174ab5024..11be79f1cc4 100644 --- a/htdocs/admin/livraisondet_extrafields.php +++ b/htdocs/admin/deliverydet_extrafields.php @@ -24,9 +24,9 @@ */ /** - * \file htdocs/admin/livraisondet_extrafields.php - * \ingroup livraison - * \brief Page to setup extra fields of livraison + * \file htdocs/admin/deliverydet_extrafields.php + * \ingroup delivery + * \brief Page to setup extra fields of delivery */ require '../main.inc.php'; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index eeec7bcd0c1..0e66e56cc87 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2555,7 +2555,7 @@ if ($action == 'create' && $usercancreate) $numshipping = $object->nb_expedition(); if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) { - if (($conf->expedition_bon->enabled && $user->rights->expedition->creer) || ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->creer)) { + if (($conf->expedition_bon->enabled && $user->rights->expedition->creer) || ($conf->delivery_note->enabled && $user->rights->expedition->livraison->creer)) { if ($user->rights->expedition->creer) { print '
'.$langs->trans('CreateShipment').''; } else { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 3ea4bba4a7f..05e1d4a2cd5 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3314,7 +3314,7 @@ abstract class CommonObject } elseif ($objecttype == 'shipping') { $classpath = 'expedition/class'; $subelement = 'expedition'; $module = 'expedition_bon'; } elseif ($objecttype == 'delivery') { - $classpath = 'livraison/class'; $subelement = 'livraison'; $module = 'livraison_bon'; + $classpath = 'delivery/class'; $subelement = 'delivery'; $module = 'delivery_note'; } elseif ($objecttype == 'invoice_supplier' || $objecttype == 'order_supplier') { $classpath = 'fourn/class'; $module = 'fournisseur'; } elseif ($objecttype == 'fichinter') { diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 32d7b145a41..7c2a4fd0788 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -122,7 +122,7 @@ class Conf // First level object // TODO Remove this part. $this->expedition_bon = new stdClass(); - $this->livraison_bon = new stdClass(); + $this->delivery_note = new stdClass(); $this->fournisseur = new stdClass(); $this->product = new stdClass(); $this->service = new stdClass(); @@ -370,8 +370,8 @@ class Conf // Sous module bons d'expedition $this->expedition_bon->enabled = (!empty($this->global->MAIN_SUBMODULE_EXPEDITION) ? $this->global->MAIN_SUBMODULE_EXPEDITION : 0); - // Sous module bons de livraison - $this->livraison_bon->enabled = (!empty($this->global->MAIN_SUBMODULE_LIVRAISON) ? $this->global->MAIN_SUBMODULE_LIVRAISON : 0); + // Sub module delivery note Sous module bons de livraison + $this->delivery_note->enabled = (!empty($this->global->MAIN_SUBMODULE_LIVRAISON) ? $this->global->MAIN_SUBMODULE_LIVRAISON : 0); // Module fournisseur if (!empty($this->fournisseur)) diff --git a/htdocs/core/lib/expedition.lib.php b/htdocs/core/lib/expedition.lib.php index b575247e84b..a7881bb9e29 100644 --- a/htdocs/core/lib/expedition.lib.php +++ b/htdocs/core/lib/expedition.lib.php @@ -53,7 +53,7 @@ function expedition_prepare_head(Expedition $object) if (!empty($conf->global->MAIN_SUBMODULE_LIVRAISON)) { - $head[$h][0] = DOL_URL_ROOT."/admin/livraison.php"; + $head[$h][0] = DOL_URL_ROOT."/admin/delivery.php"; $head[$h][1] = $langs->trans("Receivings"); $h++; } @@ -111,7 +111,7 @@ function expedition_admin_prepare_head() if (!empty($conf->global->MAIN_SUBMODULE_LIVRAISON)) { - $head[$h][0] = DOL_URL_ROOT."/admin/livraison.php"; + $head[$h][0] = DOL_URL_ROOT."/admin/delivery.php"; $head[$h][1] = $langs->trans("Receivings"); $head[$h][2] = 'receivings'; $h++; @@ -119,7 +119,7 @@ function expedition_admin_prepare_head() if (!empty($conf->global->MAIN_SUBMODULE_LIVRAISON)) { - $head[$h][0] = DOL_URL_ROOT.'/admin/livraison_extrafields.php'; + $head[$h][0] = DOL_URL_ROOT.'/admin/delivery_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); $head[$h][2] = 'attributes_receivings'; $h++; @@ -127,7 +127,7 @@ function expedition_admin_prepare_head() if (!empty($conf->global->MAIN_SUBMODULE_LIVRAISON)) { - $head[$h][0] = DOL_URL_ROOT.'/admin/livraisondet_extrafields.php'; + $head[$h][0] = DOL_URL_ROOT.'/admin/deliverydet_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); $head[$h][2] = 'attributeslines_receivings'; $h++; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3af3f7c2562..f60043e9d97 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8650,9 +8650,9 @@ function getElementProperties($element_type) $module = 'expedition_bon'; } if ($element_type == 'delivery') { - $classpath = 'livraison/class'; - $subelement = 'livraison'; - $module = 'livraison_bon'; + $classpath = 'delivery/class'; + $subelement = 'delivery'; + $module = 'delivery_note'; } if ($element_type == 'contract') { $classpath = 'contrat/class'; diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 7cc14060aac..1f4cbfa9644 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1791,9 +1791,9 @@ function dolGetElementUrl($objectid, $objecttype, $withpicto = 0, $option = '') $myobject = 'expedition'; $module = 'expedition_bon'; } elseif ($objecttype == 'delivery') { - $classpath = 'livraison/class'; - $myobject = 'livraison'; - $module = 'livraison_bon'; + $classpath = 'delivery/class'; + $myobject = 'delivery'; + $module = 'delivery_note'; } elseif ($objecttype == 'contract') { $classpath = 'contrat/class'; $module = 'contrat'; diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index 939b731f135..4e2f2fac24d 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -59,17 +59,17 @@ function commande_prepare_head(Commande $object) } if (($conf->expedition_bon->enabled && $user->rights->expedition->lire) - || ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire)) + || ($conf->delivery_note->enabled && $user->rights->expedition->livraison->lire)) { $nbShipments = $object->getNbOfShipments(); $nbReceiption = 0; $head[$h][0] = DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id; $text = ''; if ($conf->expedition_bon->enabled) $text .= $langs->trans("Shipments"); - if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled) $text .= ' - '; - if ($conf->livraison_bon->enabled) $text .= $langs->trans("Receivings"); + if ($conf->expedition_bon->enabled && $conf->delivery_note->enabled) $text .= ' - '; + if ($conf->delivery_note->enabled) $text .= $langs->trans("Receivings"); if ($nbShipments > 0 || $nbReceiption > 0) $text .= ''.($nbShipments ? $nbShipments : 0); - if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled && ($nbShipments > 0 || $nbReceiption > 0)) $text .= ' - '; - if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled && ($nbShipments > 0 || $nbReceiption > 0)) $text .= ($nbReceiption ? $nbReceiption : 0); + if ($conf->expedition_bon->enabled && $conf->delivery_note->enabled && ($nbShipments > 0 || $nbReceiption > 0)) $text .= ' - '; + if ($conf->expedition_bon->enabled && $conf->delivery_note->enabled && ($nbShipments > 0 || $nbReceiption > 0)) $text .= ($nbReceiption ? $nbReceiption : 0); if ($nbShipments > 0 || $nbReceiption > 0) $text .= ''; $head[$h][1] = $text; $head[$h][2] = 'shipping'; diff --git a/htdocs/core/lib/propal.lib.php b/htdocs/core/lib/propal.lib.php index a1dab5cd6cb..126a62fdf5e 100644 --- a/htdocs/core/lib/propal.lib.php +++ b/htdocs/core/lib/propal.lib.php @@ -43,13 +43,13 @@ function propal_prepare_head($object) $h++; if ((empty($conf->commande->enabled) && ((!empty($conf->expedition->enabled) && !empty($conf->expedition_bon->enabled) && $user->rights->expedition->lire) - || (!empty($conf->expedition->enabled) && !empty($conf->livraison_bon->enabled) && $user->rights->expedition->livraison->lire)))) + || (!empty($conf->expedition->enabled) && !empty($conf->delivery_note->enabled) && $user->rights->expedition->livraison->lire)))) { $langs->load("sendings"); $text = ''; $head[$h][0] = DOL_URL_ROOT.'/expedition/propal.php?id='.$object->id; if ($conf->expedition_bon->enabled) $text = $langs->trans("Shipment"); - if ($conf->livraison_bon->enabled) $text .= '/'.$langs->trans("Receivings"); + if ($conf->delivery_note->enabled) $text .= '/'.$langs->trans("Receivings"); $head[$h][1] = $text; $head[$h][2] = 'shipping'; $h++; diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 447310c8ad2..23f009b6234 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -47,7 +47,7 @@ function shipping_prepare_head($object) $head[$h][2] = 'shipping'; $h++; - if ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire) + if ($conf->delivery_note->enabled && $user->rights->expedition->livraison->lire) { // delivery link $object->fetchObjectLinked($object->id, $object->element); @@ -213,13 +213,13 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end,"; $sql .= " ed.rowid as edrowid, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot as warehouse_id,"; $sql .= " e.rowid as sendingid, e.ref as exp_ref, e.date_creation, e.date_delivery, e.date_expedition,"; - //if ($conf->livraison_bon->enabled) $sql .= " l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received,"; + //if ($conf->delivery_note->enabled) $sql .= " l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received,"; $sql .= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch,'; $sql .= ' p.description as product_desc'; $sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed"; $sql .= ", ".MAIN_DB_PREFIX."expedition as e"; $sql .= ", ".MAIN_DB_PREFIX.$origin."det as obj"; - //if ($conf->livraison_bon->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_expedition = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; + //if ($conf->delivery_note->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_expedition = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON obj.fk_product = p.rowid"; //TODO Add link to expeditiondet_batch $sql .= " WHERE e.entity IN (".getEntity('expedition').")"; @@ -260,7 +260,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') print ''; print ''; }*/ - if (!empty($conf->livraison_bon->enabled)) + if (!empty($conf->delivery_note->enabled)) { print ''.$langs->trans("DeliveryOrder").''; //print ''.$langs->trans("QtyReceived").''; @@ -403,7 +403,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') }*/ // Informations on receipt - if (!empty($conf->livraison_bon->enabled)) + if (!empty($conf->delivery_note->enabled)) { include_once DOL_DOCUMENT_ROOT.'/delivery/class/delivery.class.php'; $expedition->id = $objp->sendingid; diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index f4f087aa5a3..37c7119d814 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -399,7 +399,7 @@ if (empty($reshook)) /* * Build a receiving receipt */ - elseif ($action == 'create_delivery' && $conf->livraison_bon->enabled && $user->rights->expedition->livraison->creer) + elseif ($action == 'create_delivery' && $conf->delivery_note->enabled && $user->rights->expedition->livraison->creer) { $result = $object->create_delivery($user); if ($result > 0) @@ -2046,13 +2046,13 @@ if ($action == 'create') $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end"; $sql .= ", ed.rowid as shipmentline_id, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot"; $sql .= ", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition"; - //if ($conf->livraison_bon->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received"; + //if ($conf->delivery_note->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received"; $sql .= ', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch'; $sql .= ', p.description as product_desc'; $sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed"; $sql .= ", ".MAIN_DB_PREFIX."expedition as e"; $sql .= ", ".MAIN_DB_PREFIX.$origin."det as obj"; - //if ($conf->livraison_bon->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_expedition = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; + //if ($conf->delivery_note->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_expedition = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON obj.fk_product = p.rowid"; $sql .= " WHERE e.entity IN (".getEntity('expedition').")"; $sql .= " AND obj.fk_".$origin." = ".$origin_id; @@ -2467,7 +2467,7 @@ if ($action == 'create') // This is just to generate a delivery receipt //var_dump($object->linkedObjectsIds['delivery']); - if ($conf->livraison_bon->enabled && ($object->statut == Expedition::STATUS_VALIDATED || $object->statut == Expedition::STATUS_CLOSED) && $user->rights->expedition->livraison->creer && empty($object->linkedObjectsIds['delivery'])) + if ($conf->delivery_note->enabled && ($object->statut == Expedition::STATUS_VALIDATED || $object->statut == Expedition::STATUS_CLOSED) && $user->rights->expedition->livraison->creer && empty($object->linkedObjectsIds['delivery'])) { print ''.$langs->trans("CreateDeliveryOrder").''; } diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index dd6b9992064..e475053dcda 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -873,7 +873,7 @@ class Expedition extends CommonObject // phpcs:enable global $conf; - if ($conf->livraison_bon->enabled) + if ($conf->delivery_note->enabled) { if ($this->statut == self::STATUS_VALIDATED || $this->statut == self::STATUS_CLOSED) { diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 73db3ef8fe9..4270fe7421b 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -127,8 +127,8 @@ $arrayfields = array( 'e.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 'e.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), 'e.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), - 'l.ref'=>array('label'=>$langs->trans("DeliveryRef"), 'checked'=>1, 'enabled'=>(empty($conf->livraison_bon->enabled) ? 0 : 1)), - 'l.date_delivery'=>array('label'=>$langs->trans("DateReceived"), 'checked'=>1, 'enabled'=>(empty($conf->livraison_bon->enabled) ? 0 : 1)), + 'l.ref'=>array('label'=>$langs->trans("DeliveryRef"), 'checked'=>1, 'enabled'=>(empty($conf->delivery_note->enabled) ? 0 : 1)), + 'l.date_delivery'=>array('label'=>$langs->trans("DateReceived"), 'checked'=>1, 'enabled'=>(empty($conf->delivery_note->enabled) ? 0 : 1)), 'e.billed'=>array('label'=>$langs->trans("Billed"), 'checked'=>1, 'position'=>1000, 'enabled'=>(!empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) ); diff --git a/htdocs/install/mysql/tables/llx_menu.sql b/htdocs/install/mysql/tables/llx_menu.sql index 4408cb69627..b9641aff1f4 100644 --- a/htdocs/install/mysql/tables/llx_menu.sql +++ b/htdocs/install/mysql/tables/llx_menu.sql @@ -39,7 +39,7 @@ CREATE TABLE llx_menu langs varchar(100), -- Lang file to load for translation level smallint, -- Deprecated. Not used. perms text, -- Condition to show enabled or disabled - enabled text NULL default '1', -- Condition to show or hide + enabled text NULL, -- Condition to show or hide usertype integer NOT NULL DEFAULT 0, -- 0 if menu for all users, 1 for external only, 2 for internal only tms timestamp diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 6c154ca062a..c6208f1dd1b 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -2090,11 +2090,11 @@ function migrate_commande_livraison($db, $langs, $conf) if ($resql2) { - $date_livraison = $db->jdate($obj->date_livraison); + $delivery_date = $db->jdate($obj->date_livraison); $sqlu = "UPDATE ".MAIN_DB_PREFIX."livraison SET"; $sqlu .= " ref_client='".$db->escape($obj->ref_client)."'"; - $sqlu .= ", date_livraison='".$db->idate($date_livraison)."'"; + $sqlu .= ", date_livraison='".$db->idate($delivery_date)."'"; $sqlu .= " WHERE rowid = ".$obj->rowid; $resql3 = $db->query($sqlu); if (!$resql3) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index ed4f52c501b..e0e5f6f5d03 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1665,13 +1665,13 @@ if ($action == 'create') $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end"; $sql .= ", ed.rowid as receptionline_id, ed.qty, ed.fk_reception as reception_id, ed.fk_entrepot"; $sql .= ", e.rowid as reception_id, e.ref as reception_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_reception"; - //if ($conf->livraison_bon->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received"; + //if ($conf->delivery_note->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received"; $sql .= ', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch'; $sql .= ', p.description as product_desc'; $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as ed"; $sql .= ", ".MAIN_DB_PREFIX."reception as e"; $sql .= ", ".MAIN_DB_PREFIX.$origin."det as obj"; - //if ($conf->livraison_bon->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_reception = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; + //if ($conf->delivery_note->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_reception = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON obj.fk_product = p.rowid"; $sql .= " WHERE e.entity IN (".getEntity('reception').")"; $sql .= " AND obj.fk_commande = ".$origin_id; From 1af42b313ce6f007ce084af9e9f9697f8fa7c5a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien?= Date: Tue, 6 Oct 2020 13:32:02 +0200 Subject: [PATCH 06/13] rename livraison pdf and dependencies #14697 --- htdocs/admin/confexped.php | 8 +++---- htdocs/admin/delivery.php | 22 +++++++++---------- htdocs/commande/card.php | 2 +- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/class/conf.class.php | 2 +- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/class/html.formfile.class.php | 6 ++--- htdocs/core/lib/expedition.lib.php | 8 +++---- htdocs/core/lib/files.lib.php | 6 ++--- htdocs/core/lib/functions.lib.php | 2 +- htdocs/core/lib/functions2.lib.php | 2 +- htdocs/core/lib/order.lib.php | 10 ++++----- htdocs/core/lib/propal.lib.php | 4 ++-- htdocs/core/lib/sendings.lib.php | 10 ++++----- .../core/modules/bank/doc/pdf_ban.modules.php | 2 +- .../bank/doc/pdf_sepamandate.modules.php | 2 +- .../{livraison => delivery}/doc/index.html | 0 .../doc/pdf_storm.modules.php | 6 ++--- .../doc/pdf_typhon.modules.php | 8 +++---- .../{livraison => delivery}/index.html | 0 .../mod_delivery_jade.php} | 14 ++++++------ .../mod_delivery_saphir.php} | 18 +++++++-------- .../modules_delivery.php} | 2 +- htdocs/core/modules/modExpedition.class.php | 8 +++---- htdocs/delivery/card.php | 2 +- htdocs/delivery/class/delivery.class.php | 20 ++++++++--------- htdocs/expedition/card.php | 8 +++---- htdocs/expedition/class/expedition.class.php | 2 +- htdocs/expedition/list.php | 4 ++-- htdocs/reception/card.php | 4 ++-- phpstan.neon | 2 +- 31 files changed, 94 insertions(+), 94 deletions(-) rename htdocs/core/modules/{livraison => delivery}/doc/index.html (100%) rename htdocs/core/modules/{livraison => delivery}/doc/pdf_storm.modules.php (99%) rename htdocs/core/modules/{livraison => delivery}/doc/pdf_typhon.modules.php (99%) rename htdocs/core/modules/{livraison => delivery}/index.html (100%) rename htdocs/core/modules/{livraison/mod_livraison_jade.php => delivery/mod_delivery_jade.php} (90%) rename htdocs/core/modules/{livraison/mod_livraison_saphir.php => delivery/mod_delivery_saphir.php} (89%) rename htdocs/core/modules/{livraison/modules_livraison.php => delivery/modules_delivery.php} (98%) diff --git a/htdocs/admin/confexped.php b/htdocs/admin/confexped.php index 3f1eb8d9651..46066a3f318 100644 --- a/htdocs/admin/confexped.php +++ b/htdocs/admin/confexped.php @@ -67,12 +67,12 @@ if ($action == 'disable_sending') if ($action == 'activate_delivery') { dolibarr_set_const($db, "MAIN_SUBMODULE_EXPEDITION", "1", 'chaine', 0, '', $conf->entity); // We must also enable this - dolibarr_set_const($db, "MAIN_SUBMODULE_LIVRAISON", "1", 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_SUBMODULE_DELIVERY", "1", 'chaine', 0, '', $conf->entity); header("Location: confexped.php"); exit; } elseif ($action == 'disable_delivery') { - dolibarr_del_const($db, "MAIN_SUBMODULE_LIVRAISON", $conf->entity); + dolibarr_del_const($db, "MAIN_SUBMODULE_DELIVERY", $conf->entity); header("Location: confexped.php"); exit; } @@ -121,7 +121,7 @@ else print ""; print ''; -// Bon de livraison activation/desactivation +// Delivery note activate/deactivate Bon de livraison activation/desactivation print ''; print ''; print $langs->trans("DeliveriesOrderAbility"); @@ -131,7 +131,7 @@ print ''; print ''; print ''; -if (empty($conf->global->MAIN_SUBMODULE_LIVRAISON)) +if (empty($conf->global->MAIN_SUBMODULE_DELIVERY)) { print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } else { diff --git a/htdocs/admin/delivery.php b/htdocs/admin/delivery.php index 4ef0179d88e..7987d4cda10 100644 --- a/htdocs/admin/delivery.php +++ b/htdocs/admin/delivery.php @@ -95,7 +95,7 @@ if ($action == 'specimen') $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { - $file = dol_buildpath($reldir."core/modules/livraison/doc/pdf_".$modele.".modules.php", 0); + $file = dol_buildpath($reldir."core/modules/delivery/doc/pdf_".$modele.".modules.php", 0); if (file_exists($file)) { $filefound = 1; @@ -112,7 +112,7 @@ if ($action == 'specimen') if ($module->write_file($sending, $langs) > 0) { - header("Location: ".DOL_URL_ROOT."/document.php?modulepart=livraison&file=SPECIMEN.pdf"); + header("Location: ".DOL_URL_ROOT."/document.php?modulepart=delivery&file=SPECIMEN.pdf"); return; } else { setEventMessages($module->error, $module->errors, 'errors'); @@ -134,17 +134,17 @@ if ($action == 'del') $ret = delDocumentModel($value, $type); if ($ret > 0) { - if ($conf->global->LIVRAISON_ADDON_PDF == "$value") dolibarr_del_const($db, 'LIVRAISON_ADDON_PDF', $conf->entity); + if ($conf->global->DELIVERY_ADDON_PDF == "$value") dolibarr_del_const($db, 'DELIVERY_ADDON_PDF', $conf->entity); } } if ($action == 'setdoc') { - if (dolibarr_set_const($db, "LIVRAISON_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity)) + if (dolibarr_set_const($db, "DELIVERY_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity)) { // La constante qui a ete lue en avant du nouveau set // on passe donc par une variable pour avoir un affichage coherent - $conf->global->LIVRAISON_ADDON_PDF = $value; + $conf->global->DELIVERY_ADDON_PDF = $value; } // On active le modele @@ -160,7 +160,7 @@ if ($action == 'setmod') // TODO Verifier si module numerotation choisi peut etre active // par appel methode canBeActivated - dolibarr_set_const($db, "LIVRAISON_ADDON_NUMBER", $value, 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "DELIVERY_ADDON_NUMBER", $value, 'chaine', 0, '', $conf->entity); } @@ -199,7 +199,7 @@ clearstatcache(); foreach ($dirmodels as $reldir) { - $dir = dol_buildpath($reldir."core/modules/livraison/"); + $dir = dol_buildpath($reldir."core/modules/delivery/"); if (is_dir($dir)) { @@ -208,7 +208,7 @@ foreach ($dirmodels as $reldir) { while (($file = readdir($handle)) !== false) { - if (substr($file, 0, 14) == 'mod_livraison_' && substr($file, dol_strlen($file) - 3, 3) == 'php') + if (substr($file, 0, 14) == 'mod_delivery_' && substr($file, dol_strlen($file) - 3, 3) == 'php') { $file = substr($file, 0, dol_strlen($file) - 4); @@ -237,7 +237,7 @@ foreach ($dirmodels as $reldir) print ''."\n"; print ''; - if ($conf->global->LIVRAISON_ADDON_NUMBER == "$file") + if ($conf->global->DELIVERY_ADDON_NUMBER == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); } else { @@ -323,7 +323,7 @@ clearstatcache(); foreach ($dirmodels as $reldir) { - $dir = dol_buildpath($reldir."core/modules/livraison/doc/"); + $dir = dol_buildpath($reldir."core/modules/delivery/doc/"); if (is_dir($dir)) { @@ -378,7 +378,7 @@ foreach ($dirmodels as $reldir) // Default print ""; - if ($conf->global->LIVRAISON_ADDON_PDF == "$name") + if ($conf->global->DELIVERY_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); } else { diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 0e66e56cc87..eeec7bcd0c1 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2555,7 +2555,7 @@ if ($action == 'create' && $usercancreate) $numshipping = $object->nb_expedition(); if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) { - if (($conf->expedition_bon->enabled && $user->rights->expedition->creer) || ($conf->delivery_note->enabled && $user->rights->expedition->livraison->creer)) { + if (($conf->expedition_bon->enabled && $user->rights->expedition->creer) || ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->creer)) { if ($user->rights->expedition->creer) { print ''.$langs->trans('CreateShipment').''; } else { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 05e1d4a2cd5..0d1942a517d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3314,7 +3314,7 @@ abstract class CommonObject } elseif ($objecttype == 'shipping') { $classpath = 'expedition/class'; $subelement = 'expedition'; $module = 'expedition_bon'; } elseif ($objecttype == 'delivery') { - $classpath = 'delivery/class'; $subelement = 'delivery'; $module = 'delivery_note'; + $classpath = 'delivery/class'; $subelement = 'delivery'; $module = 'livraison_bon'; } elseif ($objecttype == 'invoice_supplier' || $objecttype == 'order_supplier') { $classpath = 'fourn/class'; $module = 'fournisseur'; } elseif ($objecttype == 'fichinter') { diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 7c2a4fd0788..e5a1aed0a64 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -371,7 +371,7 @@ class Conf // Sous module bons d'expedition $this->expedition_bon->enabled = (!empty($this->global->MAIN_SUBMODULE_EXPEDITION) ? $this->global->MAIN_SUBMODULE_EXPEDITION : 0); // Sub module delivery note Sous module bons de livraison - $this->delivery_note->enabled = (!empty($this->global->MAIN_SUBMODULE_LIVRAISON) ? $this->global->MAIN_SUBMODULE_LIVRAISON : 0); + $this->delivery_note->enabled = (!empty($this->global->MAIN_SUBMODULE_DELIVERY) ? $this->global->MAIN_SUBMODULE_DELIVERY : 0); // Module fournisseur if (!empty($this->fournisseur)) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 3f4938360e0..1670d4bee4f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6749,7 +6749,7 @@ class Form $tplpath = 'reception'; if (empty($conf->reception->enabled)) continue; // Do not show if module disabled } elseif ($objecttype == 'delivery') { - $tplpath = 'livraison'; + $tplpath = 'delivery'; if (empty($conf->expedition->enabled)) continue; // Do not show if module disabled } elseif ($objecttype == 'invoice_supplier') { $tplpath = 'fourn/facture'; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 2b98bac30c6..16526be2331 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -366,7 +366,7 @@ class FormFile } $printer = 0; - if (in_array($modulepart, array('facture', 'supplier_proposal', 'propal', 'proposal', 'order', 'commande', 'expedition', 'commande_fournisseur', 'expensereport', 'livraison', 'ticket'))) // The direct print feature is implemented only for such elements + if (in_array($modulepart, array('facture', 'supplier_proposal', 'propal', 'proposal', 'order', 'commande', 'expedition', 'commande_fournisseur', 'expensereport', 'delivery', 'ticket'))) // The direct print feature is implemented only for such elements { $printer = (!empty($user->rights->printing->read) && !empty($conf->printing->enabled)) ?true:false; } @@ -466,11 +466,11 @@ class FormFile include_once DOL_DOCUMENT_ROOT.'/core/modules/reception/modules_reception.php'; $modellist = ModelePdfReception::liste_modeles($this->db); } - } elseif ($modulepart == 'livraison') + } elseif ($modulepart == 'delivery') { if (is_array($genallowed)) $modellist = $genallowed; else { - include_once DOL_DOCUMENT_ROOT.'/core/modules/livraison/modules_livraison.php'; + include_once DOL_DOCUMENT_ROOT.'/core/modules/delivery/modules_delivery.php'; $modellist = ModelePDFDeliveryOrder::liste_modeles($this->db); } } elseif ($modulepart == 'ficheinter') diff --git a/htdocs/core/lib/expedition.lib.php b/htdocs/core/lib/expedition.lib.php index a7881bb9e29..92c58d7b5db 100644 --- a/htdocs/core/lib/expedition.lib.php +++ b/htdocs/core/lib/expedition.lib.php @@ -51,7 +51,7 @@ function expedition_prepare_head(Expedition $object) $hselected = $h; $h++; - if (!empty($conf->global->MAIN_SUBMODULE_LIVRAISON)) + if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) { $head[$h][0] = DOL_URL_ROOT."/admin/delivery.php"; $head[$h][1] = $langs->trans("Receivings"); @@ -109,7 +109,7 @@ function expedition_admin_prepare_head() $h++; } - if (!empty($conf->global->MAIN_SUBMODULE_LIVRAISON)) + if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) { $head[$h][0] = DOL_URL_ROOT."/admin/delivery.php"; $head[$h][1] = $langs->trans("Receivings"); @@ -117,7 +117,7 @@ function expedition_admin_prepare_head() $h++; } - if (!empty($conf->global->MAIN_SUBMODULE_LIVRAISON)) + if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) { $head[$h][0] = DOL_URL_ROOT.'/admin/delivery_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); @@ -125,7 +125,7 @@ function expedition_admin_prepare_head() $h++; } - if (!empty($conf->global->MAIN_SUBMODULE_LIVRAISON)) + if (!empty($conf->global->MAIN_SUBMODULE_DELIVERY)) { $head[$h][0] = DOL_URL_ROOT.'/admin/deliverydet_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 7f2fd4ce70d..d73bf175861 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2636,10 +2636,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed = 1; } $original_file = $conf->expedition->dir_output."/sending/".$original_file; - } // Wrapping pour les bons de livraison - elseif ($modulepart == 'livraison' && !empty($conf->expedition->dir_output)) + } // Delivery Note Wrapping + elseif ($modulepart == 'delivery' && !empty($conf->expedition->dir_output)) { - if ($fuser->rights->expedition->livraison->{$lire} || preg_match('/^specimen/i', $original_file)) + if ($fuser->rights->expedition->delivery->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f60043e9d97..a27cd362827 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8652,7 +8652,7 @@ function getElementProperties($element_type) if ($element_type == 'delivery') { $classpath = 'delivery/class'; $subelement = 'delivery'; - $module = 'delivery_note'; + $module = 'livraison_bon'; } if ($element_type == 'contract') { $classpath = 'contrat/class'; diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 1f4cbfa9644..5188cd02e30 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1793,7 +1793,7 @@ function dolGetElementUrl($objectid, $objecttype, $withpicto = 0, $option = '') } elseif ($objecttype == 'delivery') { $classpath = 'delivery/class'; $myobject = 'delivery'; - $module = 'delivery_note'; + $module = 'livraison_bon'; } elseif ($objecttype == 'contract') { $classpath = 'contrat/class'; $module = 'contrat'; diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index 4e2f2fac24d..939b731f135 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -59,17 +59,17 @@ function commande_prepare_head(Commande $object) } if (($conf->expedition_bon->enabled && $user->rights->expedition->lire) - || ($conf->delivery_note->enabled && $user->rights->expedition->livraison->lire)) + || ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire)) { $nbShipments = $object->getNbOfShipments(); $nbReceiption = 0; $head[$h][0] = DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id; $text = ''; if ($conf->expedition_bon->enabled) $text .= $langs->trans("Shipments"); - if ($conf->expedition_bon->enabled && $conf->delivery_note->enabled) $text .= ' - '; - if ($conf->delivery_note->enabled) $text .= $langs->trans("Receivings"); + if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled) $text .= ' - '; + if ($conf->livraison_bon->enabled) $text .= $langs->trans("Receivings"); if ($nbShipments > 0 || $nbReceiption > 0) $text .= ''.($nbShipments ? $nbShipments : 0); - if ($conf->expedition_bon->enabled && $conf->delivery_note->enabled && ($nbShipments > 0 || $nbReceiption > 0)) $text .= ' - '; - if ($conf->expedition_bon->enabled && $conf->delivery_note->enabled && ($nbShipments > 0 || $nbReceiption > 0)) $text .= ($nbReceiption ? $nbReceiption : 0); + if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled && ($nbShipments > 0 || $nbReceiption > 0)) $text .= ' - '; + if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled && ($nbShipments > 0 || $nbReceiption > 0)) $text .= ($nbReceiption ? $nbReceiption : 0); if ($nbShipments > 0 || $nbReceiption > 0) $text .= ''; $head[$h][1] = $text; $head[$h][2] = 'shipping'; diff --git a/htdocs/core/lib/propal.lib.php b/htdocs/core/lib/propal.lib.php index 126a62fdf5e..a1dab5cd6cb 100644 --- a/htdocs/core/lib/propal.lib.php +++ b/htdocs/core/lib/propal.lib.php @@ -43,13 +43,13 @@ function propal_prepare_head($object) $h++; if ((empty($conf->commande->enabled) && ((!empty($conf->expedition->enabled) && !empty($conf->expedition_bon->enabled) && $user->rights->expedition->lire) - || (!empty($conf->expedition->enabled) && !empty($conf->delivery_note->enabled) && $user->rights->expedition->livraison->lire)))) + || (!empty($conf->expedition->enabled) && !empty($conf->livraison_bon->enabled) && $user->rights->expedition->livraison->lire)))) { $langs->load("sendings"); $text = ''; $head[$h][0] = DOL_URL_ROOT.'/expedition/propal.php?id='.$object->id; if ($conf->expedition_bon->enabled) $text = $langs->trans("Shipment"); - if ($conf->delivery_note->enabled) $text .= '/'.$langs->trans("Receivings"); + if ($conf->livraison_bon->enabled) $text .= '/'.$langs->trans("Receivings"); $head[$h][1] = $text; $head[$h][2] = 'shipping'; $h++; diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 23f009b6234..447310c8ad2 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -47,7 +47,7 @@ function shipping_prepare_head($object) $head[$h][2] = 'shipping'; $h++; - if ($conf->delivery_note->enabled && $user->rights->expedition->livraison->lire) + if ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire) { // delivery link $object->fetchObjectLinked($object->id, $object->element); @@ -213,13 +213,13 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end,"; $sql .= " ed.rowid as edrowid, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot as warehouse_id,"; $sql .= " e.rowid as sendingid, e.ref as exp_ref, e.date_creation, e.date_delivery, e.date_expedition,"; - //if ($conf->delivery_note->enabled) $sql .= " l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received,"; + //if ($conf->livraison_bon->enabled) $sql .= " l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received,"; $sql .= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch,'; $sql .= ' p.description as product_desc'; $sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed"; $sql .= ", ".MAIN_DB_PREFIX."expedition as e"; $sql .= ", ".MAIN_DB_PREFIX.$origin."det as obj"; - //if ($conf->delivery_note->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_expedition = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; + //if ($conf->livraison_bon->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_expedition = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON obj.fk_product = p.rowid"; //TODO Add link to expeditiondet_batch $sql .= " WHERE e.entity IN (".getEntity('expedition').")"; @@ -260,7 +260,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') print ''; print ''; }*/ - if (!empty($conf->delivery_note->enabled)) + if (!empty($conf->livraison_bon->enabled)) { print ''.$langs->trans("DeliveryOrder").''; //print ''.$langs->trans("QtyReceived").''; @@ -403,7 +403,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') }*/ // Informations on receipt - if (!empty($conf->delivery_note->enabled)) + if (!empty($conf->livraison_bon->enabled)) { include_once DOL_DOCUMENT_ROOT.'/delivery/class/delivery.class.php'; $expedition->id = $objp->sendingid; diff --git a/htdocs/core/modules/bank/doc/pdf_ban.modules.php b/htdocs/core/modules/bank/doc/pdf_ban.modules.php index 27b40d48257..56c538af8a6 100644 --- a/htdocs/core/modules/bank/doc/pdf_ban.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_ban.modules.php @@ -262,7 +262,7 @@ class pdf_ban extends ModeleBankAccountDoc } } - $this->error = $langs->transnoentities("ErrorConstantNotDefined", "LIVRAISON_OUTPUTDIR"); + $this->error = $langs->transnoentities("ErrorConstantNotDefined", "DELIVERY_OUTPUTDIR"); return 0; } diff --git a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php index b6e4cbc191a..2b8987958f4 100644 --- a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php @@ -415,7 +415,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc } } - $this->error = $langs->transnoentities("ErrorConstantNotDefined", "LIVRAISON_OUTPUTDIR"); + $this->error = $langs->transnoentities("ErrorConstantNotDefined", "DELIVERY_OUTPUTDIR"); return 0; } diff --git a/htdocs/core/modules/livraison/doc/index.html b/htdocs/core/modules/delivery/doc/index.html similarity index 100% rename from htdocs/core/modules/livraison/doc/index.html rename to htdocs/core/modules/delivery/doc/index.html diff --git a/htdocs/core/modules/livraison/doc/pdf_storm.modules.php b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php similarity index 99% rename from htdocs/core/modules/livraison/doc/pdf_storm.modules.php rename to htdocs/core/modules/delivery/doc/pdf_storm.modules.php index 404e27b429f..7de29cce294 100644 --- a/htdocs/core/modules/livraison/doc/pdf_storm.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php @@ -23,12 +23,12 @@ */ /** - * \file htdocs/core/modules/livraison/doc/pdf_storm.modules.php + * \file htdocs/core/modules/delivery/doc/pdf_storm.modules.php * \ingroup livraison * \brief File of class to manage receving receipts with template Storm */ -require_once DOL_DOCUMENT_ROOT.'/core/modules/livraison/modules_livraison.php'; +require_once DOL_DOCUMENT_ROOT.'/core/modules/delivery/modules_delivery.php'; require_once DOL_DOCUMENT_ROOT.'/delivery/class/delivery.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; @@ -157,7 +157,7 @@ class pdf_storm extends ModelePDFDeliveryOrder /** * Function to build pdf onto disk * - * @param Livraison $object Object to generate + * @param Delivery $object Object to generate * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details diff --git a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php similarity index 99% rename from htdocs/core/modules/livraison/doc/pdf_typhon.modules.php rename to htdocs/core/modules/delivery/doc/pdf_typhon.modules.php index 8ea980fbd5c..114283c6773 100644 --- a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php @@ -22,12 +22,12 @@ */ /** - * \file htdocs/core/modules/livraison/doc/pdf_typhon.modules.php + * \file htdocs/core/modules/delivery/doc/pdf_typhon.modules.php * \ingroup livraison * \brief File of class to manage receving receipts with template Typhon */ -require_once DOL_DOCUMENT_ROOT.'/core/modules/livraison/modules_livraison.php'; +require_once DOL_DOCUMENT_ROOT.'/core/modules/delivery/modules_delivery.php'; require_once DOL_DOCUMENT_ROOT.'/delivery/class/delivery.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; @@ -618,7 +618,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder } } - $this->error = $langs->transnoentities("ErrorConstantNotDefined", "LIVRAISON_OUTPUTDIR"); + $this->error = $langs->transnoentities("ErrorConstantNotDefined", "DELIVERY_OUTPUTDIR"); return 0; } @@ -844,7 +844,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder // If SHIPPING contact defined on order, we use it $usecontact = false; $arrayidcontact = $object->commande->getIdContact('external', 'SHIPPING'); - if (count($arrayidcontact) > 0) + if ($arrayidcontact && count($arrayidcontact) > 0) { $usecontact = true; $result = $object->fetch_contact($arrayidcontact[0]); diff --git a/htdocs/core/modules/livraison/index.html b/htdocs/core/modules/delivery/index.html similarity index 100% rename from htdocs/core/modules/livraison/index.html rename to htdocs/core/modules/delivery/index.html diff --git a/htdocs/core/modules/livraison/mod_livraison_jade.php b/htdocs/core/modules/delivery/mod_delivery_jade.php similarity index 90% rename from htdocs/core/modules/livraison/mod_livraison_jade.php rename to htdocs/core/modules/delivery/mod_delivery_jade.php index 1cf337814b9..822986cffa5 100644 --- a/htdocs/core/modules/livraison/mod_livraison_jade.php +++ b/htdocs/core/modules/delivery/mod_delivery_jade.php @@ -19,20 +19,20 @@ */ /** - * \file htdocs/core/modules/livraison/mod_livraison_jade.php + * \file htdocs/core/modules/delivery/mod_delivery_jade.php * \ingroup delivery * \brief Fichier contenant la classe du modele de numerotation de reference de bon de livraison Jade */ -require_once DOL_DOCUMENT_ROOT.'/core/modules/livraison/modules_livraison.php'; +require_once DOL_DOCUMENT_ROOT.'/core/modules/delivery/modules_delivery.php'; /** - * \class mod_livraison_jade + * \class mod_delivery_jade * \brief Classe du modele de numerotation de reference de bon de livraison Jade */ -class mod_livraison_jade extends ModeleNumRefDeliveryOrder +class mod_delivery_jade extends ModeleNumRefDeliveryOrder { /** * Dolibarr version of the loaded document @@ -137,7 +137,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder $sql .= " AND entity = ".$conf->entity; $resql = $db->query($sql); - dol_syslog("mod_livraison_jade::getNextValue", LOG_DEBUG); + dol_syslog("mod_delivery_jade::getNextValue", LOG_DEBUG); if ($resql) { $obj = $db->fetch_object($resql); if ($obj) $max = intval($obj->max); @@ -153,7 +153,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is else $num = sprintf("%04s", $max + 1); - dol_syslog("mod_livraison_jade::getNextValue return ".$this->prefix.$yymm."-".$num); + dol_syslog("mod_delivery_jade::getNextValue return ".$this->prefix.$yymm."-".$num); return $this->prefix.$yymm."-".$num; } @@ -166,7 +166,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder * @param Object $object Object livraison * @return string Texte descriptif */ - public function livraison_get_num($objsoc = 0, $object = '') + public function delivery_get_num($objsoc = 0, $object = '') { // phpcs:enable return $this->getNextValue($objsoc, $object); diff --git a/htdocs/core/modules/livraison/mod_livraison_saphir.php b/htdocs/core/modules/delivery/mod_delivery_saphir.php similarity index 89% rename from htdocs/core/modules/livraison/mod_livraison_saphir.php rename to htdocs/core/modules/delivery/mod_delivery_saphir.php index ad03984a6f2..10a979d4ee2 100644 --- a/htdocs/core/modules/livraison/mod_livraison_saphir.php +++ b/htdocs/core/modules/delivery/mod_delivery_saphir.php @@ -19,17 +19,17 @@ */ /** - * \file htdocs/core/modules/livraison/mod_livraison_saphir.php + * \file htdocs/core/modules/delivery/mod_livraison_saphir.php * \ingroup expedition * \brief Fichier contenant la classe du modele de numerotation de reference de livraison Saphir */ -require_once DOL_DOCUMENT_ROOT.'/core/modules/livraison/modules_livraison.php'; +require_once DOL_DOCUMENT_ROOT.'/core/modules/delivery/modules_delivery.php'; /** - * \class mod_livraison_saphir + * \class mod_delivery_saphir * \brief Classe du modele de numerotation de reference de livraison Saphir */ -class mod_livraison_saphir extends ModeleNumRefDeliveryOrder +class mod_delivery_saphir extends ModeleNumRefDeliveryOrder { /** * Dolibarr version of the loaded document @@ -72,7 +72,7 @@ class mod_livraison_saphir extends ModeleNumRefDeliveryOrder $texte .= '
'; $texte .= ''; $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; $tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Delivery"), $langs->transnoentities("Delivery")); @@ -83,7 +83,7 @@ class mod_livraison_saphir extends ModeleNumRefDeliveryOrder // Parametrage du prefix $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; @@ -131,7 +131,7 @@ class mod_livraison_saphir extends ModeleNumRefDeliveryOrder require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // On defini critere recherche compteur - $mask = $conf->global->LIVRAISON_SAPHIR_MASK; + $mask = $conf->global->DELIVERY_SAPHIR_MASK; if (!$mask) { @@ -139,7 +139,7 @@ class mod_livraison_saphir extends ModeleNumRefDeliveryOrder return 0; } - $numFinal = get_next_value($db, $mask, 'livraison', 'ref', '', $objsoc, $object->date_livraison); + $numFinal = get_next_value($db, $mask, 'delivery', 'ref', '', $objsoc, $object->date_livraison); return $numFinal; } @@ -166,7 +166,7 @@ class mod_livraison_saphir extends ModeleNumRefDeliveryOrder * @param Object $object Objet livraison * @return string Texte descripif */ - public function livraison_get_num($objsoc = 0, $object = '') + public function delivery_get_num($objsoc = 0, $object = '') { // phpcs:enable return $this->getNextValue($objsoc, $object); diff --git a/htdocs/core/modules/livraison/modules_livraison.php b/htdocs/core/modules/delivery/modules_delivery.php similarity index 98% rename from htdocs/core/modules/livraison/modules_livraison.php rename to htdocs/core/modules/delivery/modules_delivery.php index 9bf8a9e3ca2..80e2b092d42 100644 --- a/htdocs/core/modules/livraison/modules_livraison.php +++ b/htdocs/core/modules/delivery/modules_delivery.php @@ -22,7 +22,7 @@ */ /** - * \file htdocs/core/modules/livraison/modules_livraison.php + * \file htdocs/core/modules/delivery/modules_delivery.php * \ingroup expedition * \brief Fichier contenant la classe mere de generation de bon de livraison en PDF * et la classe mere de numerotation des bons de livraisons diff --git a/htdocs/core/modules/modExpedition.class.php b/htdocs/core/modules/modExpedition.class.php index 19e22497a7a..eed6ec4ec5e 100644 --- a/htdocs/core/modules/modExpedition.class.php +++ b/htdocs/core/modules/modExpedition.class.php @@ -103,21 +103,21 @@ class modExpedition extends DolibarrModules $this->const[$r][4] = 0; $r++; - $this->const[$r][0] = "LIVRAISON_ADDON_PDF"; + $this->const[$r][0] = "DELIVERY_ADDON_PDF"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "typhon"; $this->const[$r][3] = 'Nom du gestionnaire de generation des bons de reception en PDF'; $this->const[$r][4] = 0; $r++; - $this->const[$r][0] = "LIVRAISON_ADDON_NUMBER"; + $this->const[$r][0] = "DELIVERY_ADDON_NUMBER"; $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "mod_livraison_jade"; + $this->const[$r][2] = "mod_delivery_jade"; $this->const[$r][3] = 'Nom du gestionnaire de numerotation des bons de reception'; $this->const[$r][4] = 0; $r++; - $this->const[$r][0] = "LIVRAISON_ADDON_PDF_ODT_PATH"; + $this->const[$r][0] = "DELIVERY_ADDON_PDF_ODT_PATH"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/deliveries"; $this->const[$r][3] = ""; diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index dc40d118f6e..0b0ddda1794 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -29,7 +29,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/delivery/class/delivery.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/modules/livraison/modules_livraison.php'; +require_once DOL_DOCUMENT_ROOT.'/core/modules/delivery/modules_delivery.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index c87c2f87df6..8c227dc109f 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -116,7 +116,7 @@ class Delivery extends CommonObject dol_syslog("Delivery::create"); - if (empty($this->model_pdf)) $this->model_pdf = $conf->global->LIVRAISON_ADDON_PDF; + if (empty($this->model_pdf)) $this->model_pdf = $conf->global->DELIVERY_ADDON_PDF; $error = 0; @@ -376,14 +376,14 @@ class Delivery extends CommonObject if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->livraison->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->livraison_advance->validate))) { - if (!empty($conf->global->LIVRAISON_ADDON_NUMBER)) + if (!empty($conf->global->DELIVERY_ADDON_NUMBER)) { // Setting the command numbering module name - $modName = $conf->global->LIVRAISON_ADDON_NUMBER; + $modName = $conf->global->DELIVERY_ADDON_NUMBER; - if (is_readable(DOL_DOCUMENT_ROOT.'/core/modules/livraison/'.$modName.'.php')) + if (is_readable(DOL_DOCUMENT_ROOT.'/core/modules/delivery/'.$modName.'.php')) { - require_once DOL_DOCUMENT_ROOT.'/core/modules/livraison/'.$modName.'.php'; + require_once DOL_DOCUMENT_ROOT.'/core/modules/delivery/'.$modName.'.php'; $now = dol_now(); @@ -394,7 +394,7 @@ class Delivery extends CommonObject if (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) // empty should not happened, but when it occurs, the test save life { - $numref = $objMod->livraison_get_num($soc, $this); + $numref = $objMod->delivery_get_num($soc, $this); } else { $numref = $this->ref; } @@ -1050,12 +1050,12 @@ class Delivery extends CommonObject if ($this->model_pdf) { $modele = $this->model_pdf; - } elseif (!empty($conf->global->LIVRAISON_ADDON_PDF)) { - $modele = $conf->global->LIVRAISON_ADDON_PDF; + } elseif (!empty($conf->global->DELIVERY_ADDON_PDF)) { + $modele = $conf->global->DELIVERY_ADDON_PDF; } } - $modelpath = "core/modules/livraison/doc/"; + $modelpath = "core/modules/delivery/doc/"; return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } @@ -1071,7 +1071,7 @@ class Delivery extends CommonObject public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) { $tables = array( - 'livraison' + 'delivery' ); return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 37c7119d814..f4f087aa5a3 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -399,7 +399,7 @@ if (empty($reshook)) /* * Build a receiving receipt */ - elseif ($action == 'create_delivery' && $conf->delivery_note->enabled && $user->rights->expedition->livraison->creer) + elseif ($action == 'create_delivery' && $conf->livraison_bon->enabled && $user->rights->expedition->livraison->creer) { $result = $object->create_delivery($user); if ($result > 0) @@ -2046,13 +2046,13 @@ if ($action == 'create') $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end"; $sql .= ", ed.rowid as shipmentline_id, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot"; $sql .= ", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition"; - //if ($conf->delivery_note->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received"; + //if ($conf->livraison_bon->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received"; $sql .= ', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch'; $sql .= ', p.description as product_desc'; $sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed"; $sql .= ", ".MAIN_DB_PREFIX."expedition as e"; $sql .= ", ".MAIN_DB_PREFIX.$origin."det as obj"; - //if ($conf->delivery_note->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_expedition = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; + //if ($conf->livraison_bon->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_expedition = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON obj.fk_product = p.rowid"; $sql .= " WHERE e.entity IN (".getEntity('expedition').")"; $sql .= " AND obj.fk_".$origin." = ".$origin_id; @@ -2467,7 +2467,7 @@ if ($action == 'create') // This is just to generate a delivery receipt //var_dump($object->linkedObjectsIds['delivery']); - if ($conf->delivery_note->enabled && ($object->statut == Expedition::STATUS_VALIDATED || $object->statut == Expedition::STATUS_CLOSED) && $user->rights->expedition->livraison->creer && empty($object->linkedObjectsIds['delivery'])) + if ($conf->livraison_bon->enabled && ($object->statut == Expedition::STATUS_VALIDATED || $object->statut == Expedition::STATUS_CLOSED) && $user->rights->expedition->livraison->creer && empty($object->linkedObjectsIds['delivery'])) { print ''.$langs->trans("CreateDeliveryOrder").''; } diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index e475053dcda..dd6b9992064 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -873,7 +873,7 @@ class Expedition extends CommonObject // phpcs:enable global $conf; - if ($conf->delivery_note->enabled) + if ($conf->livraison_bon->enabled) { if ($this->statut == self::STATUS_VALIDATED || $this->statut == self::STATUS_CLOSED) { diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 4270fe7421b..73db3ef8fe9 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -127,8 +127,8 @@ $arrayfields = array( 'e.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 'e.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), 'e.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), - 'l.ref'=>array('label'=>$langs->trans("DeliveryRef"), 'checked'=>1, 'enabled'=>(empty($conf->delivery_note->enabled) ? 0 : 1)), - 'l.date_delivery'=>array('label'=>$langs->trans("DateReceived"), 'checked'=>1, 'enabled'=>(empty($conf->delivery_note->enabled) ? 0 : 1)), + 'l.ref'=>array('label'=>$langs->trans("DeliveryRef"), 'checked'=>1, 'enabled'=>(empty($conf->livraison_bon->enabled) ? 0 : 1)), + 'l.date_delivery'=>array('label'=>$langs->trans("DateReceived"), 'checked'=>1, 'enabled'=>(empty($conf->livraison_bon->enabled) ? 0 : 1)), 'e.billed'=>array('label'=>$langs->trans("Billed"), 'checked'=>1, 'position'=>1000, 'enabled'=>(!empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) ); diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index e0e5f6f5d03..ed4f52c501b 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1665,13 +1665,13 @@ if ($action == 'create') $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end"; $sql .= ", ed.rowid as receptionline_id, ed.qty, ed.fk_reception as reception_id, ed.fk_entrepot"; $sql .= ", e.rowid as reception_id, e.ref as reception_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_reception"; - //if ($conf->delivery_note->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received"; + //if ($conf->livraison_bon->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received"; $sql .= ', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch'; $sql .= ', p.description as product_desc'; $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as ed"; $sql .= ", ".MAIN_DB_PREFIX."reception as e"; $sql .= ", ".MAIN_DB_PREFIX.$origin."det as obj"; - //if ($conf->delivery_note->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_reception = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; + //if ($conf->livraison_bon->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_reception = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON obj.fk_product = p.rowid"; $sql .= " WHERE e.entity IN (".getEntity('reception').")"; $sql .= " AND obj.fk_commande = ".$origin_id; diff --git a/phpstan.neon b/phpstan.neon index 71b70a42218..02e47e753d7 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -41,7 +41,7 @@ parameters: - %currentWorkingDirectory%/htdocs/core/modules/facture - %currentWorkingDirectory%/htdocs/core/modules/fichinter - %currentWorkingDirectory%/htdocs/core/modules/holiday - - %currentWorkingDirectory%/htdocs/core/modules/livraison + - %currentWorkingDirectory%/htdocs/core/modules/delivery #- %currentWorkingDirectory%/htdocs/core/modules/member - %currentWorkingDirectory%/htdocs/core/modules/payment - %currentWorkingDirectory%/htdocs/core/modules/product From d103a9aede214480cb969af9e29858058066ce7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien?= Date: Tue, 6 Oct 2020 14:35:27 +0200 Subject: [PATCH 07/13] rename table on migration #14697 --- .../install/mysql/migration/12.0.0-13.0.0.sql | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) 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 88c17cc0619..6afbb5c8b00 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 @@ -355,3 +355,26 @@ CREATE TABLE llx_ecm_directories_extrafields ALTER TABLE llx_ecm_directories_extrafields ADD INDEX idx_ecm_directories_extrafields (fk_object); ALTER TABLE llx_website_page ADD COLUMN object_type varchar(255); ALTER TABLE llx_website_page ADD COLUMN fk_object varchar(255); + +-- rename Table +ALTER TABLE llx_livraison RENAME TO llx_delivery; +ALTER TABLE llx_livraison_extrafields RENAME TO llx_delivery_extrafields; +ALTER TABLE llx_livraisondet RENAME TO llx_deliverydet; +ALTER TABLE llx_livraisondet_extrafields RENAME TO llx_deliverydet_extrafields; + +-- rename index +ALTER TABLE llx_delivery DROP INDEX idx_livraison_uk_ref, ADD UNIQUE INDEX idx_delivery_uk_ref (ref, entity); +ALTER TABLE llx_delivery DROP INDEX idx_livraison_fk_soc, ADD INDEX idx_delivery_fk_soc (fk_soc); +ALTER TABLE llx_delivery DROP INDEX idx_livraison_fk_user_author, ADD INDEX idx_delivery_fk_user_author (fk_user_author); +ALTER TABLE llx_delivery DROP INDEX idx_livraison_fk_user_valid, ADD INDEX idx_delivery_fk_user_valid (fk_user_valid); + +-- drop constraint +ALTER TABLE llx_delivery DROP CONSTRAINT fk_delivery_fk_soc; +ALTER TABLE llx_delivery DROP CONSTRAINT fk_delivery_fk_user_author; +ALTER TABLE llx_delivery DROP CONSTRAINT fk_delivery_fk_user_valid; + +-- add constraint +ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); +ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); +ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid); + From c8cd55e158c87fe67983f129b0a6cd96161910e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien?= Date: Tue, 6 Oct 2020 15:57:50 +0200 Subject: [PATCH 08/13] debug access right after rename class #14697 --- htdocs/commande/card.php | 2 +- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/class/html.formfile.class.php | 2 +- htdocs/core/lib/functions.lib.php | 2 +- htdocs/core/lib/functions2.lib.php | 2 +- htdocs/core/lib/order.lib.php | 10 +++++----- htdocs/core/lib/propal.lib.php | 4 ++-- htdocs/core/lib/sendings.lib.php | 10 +++++----- htdocs/delivery/card.php | 4 ++-- htdocs/expedition/card.php | 8 ++++---- htdocs/expedition/class/expedition.class.php | 2 +- htdocs/expedition/list.php | 4 ++-- htdocs/reception/card.php | 4 ++-- 13 files changed, 28 insertions(+), 28 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index eeec7bcd0c1..0e66e56cc87 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2555,7 +2555,7 @@ if ($action == 'create' && $usercancreate) $numshipping = $object->nb_expedition(); if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) { - if (($conf->expedition_bon->enabled && $user->rights->expedition->creer) || ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->creer)) { + if (($conf->expedition_bon->enabled && $user->rights->expedition->creer) || ($conf->delivery_note->enabled && $user->rights->expedition->livraison->creer)) { if ($user->rights->expedition->creer) { print ''.$langs->trans('CreateShipment').''; } else { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 0d1942a517d..05e1d4a2cd5 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3314,7 +3314,7 @@ abstract class CommonObject } elseif ($objecttype == 'shipping') { $classpath = 'expedition/class'; $subelement = 'expedition'; $module = 'expedition_bon'; } elseif ($objecttype == 'delivery') { - $classpath = 'delivery/class'; $subelement = 'delivery'; $module = 'livraison_bon'; + $classpath = 'delivery/class'; $subelement = 'delivery'; $module = 'delivery_note'; } elseif ($objecttype == 'invoice_supplier' || $objecttype == 'order_supplier') { $classpath = 'fourn/class'; $module = 'fournisseur'; } elseif ($objecttype == 'fichinter') { diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 16526be2331..a2c7721f0f8 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -417,7 +417,7 @@ class FormFile $titletoshow = $langs->trans("Documents"); if (!empty($title)) $titletoshow = ($title == 'none' ? '' : $title); - +print($modulepart); // Show table if ($genallowed) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a27cd362827..f60043e9d97 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8652,7 +8652,7 @@ function getElementProperties($element_type) if ($element_type == 'delivery') { $classpath = 'delivery/class'; $subelement = 'delivery'; - $module = 'livraison_bon'; + $module = 'delivery_note'; } if ($element_type == 'contract') { $classpath = 'contrat/class'; diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 5188cd02e30..1f4cbfa9644 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1793,7 +1793,7 @@ function dolGetElementUrl($objectid, $objecttype, $withpicto = 0, $option = '') } elseif ($objecttype == 'delivery') { $classpath = 'delivery/class'; $myobject = 'delivery'; - $module = 'livraison_bon'; + $module = 'delivery_note'; } elseif ($objecttype == 'contract') { $classpath = 'contrat/class'; $module = 'contrat'; diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index 939b731f135..4e2f2fac24d 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -59,17 +59,17 @@ function commande_prepare_head(Commande $object) } if (($conf->expedition_bon->enabled && $user->rights->expedition->lire) - || ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire)) + || ($conf->delivery_note->enabled && $user->rights->expedition->livraison->lire)) { $nbShipments = $object->getNbOfShipments(); $nbReceiption = 0; $head[$h][0] = DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id; $text = ''; if ($conf->expedition_bon->enabled) $text .= $langs->trans("Shipments"); - if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled) $text .= ' - '; - if ($conf->livraison_bon->enabled) $text .= $langs->trans("Receivings"); + if ($conf->expedition_bon->enabled && $conf->delivery_note->enabled) $text .= ' - '; + if ($conf->delivery_note->enabled) $text .= $langs->trans("Receivings"); if ($nbShipments > 0 || $nbReceiption > 0) $text .= ''.($nbShipments ? $nbShipments : 0); - if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled && ($nbShipments > 0 || $nbReceiption > 0)) $text .= ' - '; - if ($conf->expedition_bon->enabled && $conf->livraison_bon->enabled && ($nbShipments > 0 || $nbReceiption > 0)) $text .= ($nbReceiption ? $nbReceiption : 0); + if ($conf->expedition_bon->enabled && $conf->delivery_note->enabled && ($nbShipments > 0 || $nbReceiption > 0)) $text .= ' - '; + if ($conf->expedition_bon->enabled && $conf->delivery_note->enabled && ($nbShipments > 0 || $nbReceiption > 0)) $text .= ($nbReceiption ? $nbReceiption : 0); if ($nbShipments > 0 || $nbReceiption > 0) $text .= ''; $head[$h][1] = $text; $head[$h][2] = 'shipping'; diff --git a/htdocs/core/lib/propal.lib.php b/htdocs/core/lib/propal.lib.php index a1dab5cd6cb..126a62fdf5e 100644 --- a/htdocs/core/lib/propal.lib.php +++ b/htdocs/core/lib/propal.lib.php @@ -43,13 +43,13 @@ function propal_prepare_head($object) $h++; if ((empty($conf->commande->enabled) && ((!empty($conf->expedition->enabled) && !empty($conf->expedition_bon->enabled) && $user->rights->expedition->lire) - || (!empty($conf->expedition->enabled) && !empty($conf->livraison_bon->enabled) && $user->rights->expedition->livraison->lire)))) + || (!empty($conf->expedition->enabled) && !empty($conf->delivery_note->enabled) && $user->rights->expedition->livraison->lire)))) { $langs->load("sendings"); $text = ''; $head[$h][0] = DOL_URL_ROOT.'/expedition/propal.php?id='.$object->id; if ($conf->expedition_bon->enabled) $text = $langs->trans("Shipment"); - if ($conf->livraison_bon->enabled) $text .= '/'.$langs->trans("Receivings"); + if ($conf->delivery_note->enabled) $text .= '/'.$langs->trans("Receivings"); $head[$h][1] = $text; $head[$h][2] = 'shipping'; $h++; diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 447310c8ad2..23f009b6234 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -47,7 +47,7 @@ function shipping_prepare_head($object) $head[$h][2] = 'shipping'; $h++; - if ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire) + if ($conf->delivery_note->enabled && $user->rights->expedition->livraison->lire) { // delivery link $object->fetchObjectLinked($object->id, $object->element); @@ -213,13 +213,13 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end,"; $sql .= " ed.rowid as edrowid, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot as warehouse_id,"; $sql .= " e.rowid as sendingid, e.ref as exp_ref, e.date_creation, e.date_delivery, e.date_expedition,"; - //if ($conf->livraison_bon->enabled) $sql .= " l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received,"; + //if ($conf->delivery_note->enabled) $sql .= " l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received,"; $sql .= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch,'; $sql .= ' p.description as product_desc'; $sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed"; $sql .= ", ".MAIN_DB_PREFIX."expedition as e"; $sql .= ", ".MAIN_DB_PREFIX.$origin."det as obj"; - //if ($conf->livraison_bon->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_expedition = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; + //if ($conf->delivery_note->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_expedition = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON obj.fk_product = p.rowid"; //TODO Add link to expeditiondet_batch $sql .= " WHERE e.entity IN (".getEntity('expedition').")"; @@ -260,7 +260,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') print ''; }*/ - if (!empty($conf->livraison_bon->enabled)) + if (!empty($conf->delivery_note->enabled)) { print ''; //print ''; @@ -403,7 +403,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') }*/ // Informations on receipt - if (!empty($conf->livraison_bon->enabled)) + if (!empty($conf->delivery_note->enabled)) { include_once DOL_DOCUMENT_ROOT.'/delivery/class/delivery.class.php'; $expedition->id = $objp->sendingid; diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index 0b0ddda1794..68e037d430f 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -57,7 +57,7 @@ $backtopage = GETPOST('backtopage', 'alpha'); // Security check $id = GETPOST('id', 'int'); if ($user->socid) $socid = $user->socid; -$result = restrictedArea($user, 'expedition', $id, 'livraison', 'livraison'); +$result = restrictedArea($user, 'expedition', $id, 'delivery', 'livraison'); $object = new Delivery($db); $extrafields = new ExtraFields($db); @@ -681,7 +681,7 @@ if ($action == 'create') // Create. Seems to no be used $genallowed = $user->rights->expedition->livraison->lire; $delallowed = $user->rights->expedition->livraison->creer; - print $formfile->showdocuments('livraison', $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang); + print $formfile->showdocuments('delivery', $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang); /* * Linked object block (of linked shipment) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index f4f087aa5a3..37c7119d814 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -399,7 +399,7 @@ if (empty($reshook)) /* * Build a receiving receipt */ - elseif ($action == 'create_delivery' && $conf->livraison_bon->enabled && $user->rights->expedition->livraison->creer) + elseif ($action == 'create_delivery' && $conf->delivery_note->enabled && $user->rights->expedition->livraison->creer) { $result = $object->create_delivery($user); if ($result > 0) @@ -2046,13 +2046,13 @@ if ($action == 'create') $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end"; $sql .= ", ed.rowid as shipmentline_id, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot"; $sql .= ", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition"; - //if ($conf->livraison_bon->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received"; + //if ($conf->delivery_note->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received"; $sql .= ', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch'; $sql .= ', p.description as product_desc'; $sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed"; $sql .= ", ".MAIN_DB_PREFIX."expedition as e"; $sql .= ", ".MAIN_DB_PREFIX.$origin."det as obj"; - //if ($conf->livraison_bon->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_expedition = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; + //if ($conf->delivery_note->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_expedition = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON obj.fk_product = p.rowid"; $sql .= " WHERE e.entity IN (".getEntity('expedition').")"; $sql .= " AND obj.fk_".$origin." = ".$origin_id; @@ -2467,7 +2467,7 @@ if ($action == 'create') // This is just to generate a delivery receipt //var_dump($object->linkedObjectsIds['delivery']); - if ($conf->livraison_bon->enabled && ($object->statut == Expedition::STATUS_VALIDATED || $object->statut == Expedition::STATUS_CLOSED) && $user->rights->expedition->livraison->creer && empty($object->linkedObjectsIds['delivery'])) + if ($conf->delivery_note->enabled && ($object->statut == Expedition::STATUS_VALIDATED || $object->statut == Expedition::STATUS_CLOSED) && $user->rights->expedition->livraison->creer && empty($object->linkedObjectsIds['delivery'])) { print ''.$langs->trans("CreateDeliveryOrder").''; } diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index dd6b9992064..e475053dcda 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -873,7 +873,7 @@ class Expedition extends CommonObject // phpcs:enable global $conf; - if ($conf->livraison_bon->enabled) + if ($conf->delivery_note->enabled) { if ($this->statut == self::STATUS_VALIDATED || $this->statut == self::STATUS_CLOSED) { diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 73db3ef8fe9..4270fe7421b 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -127,8 +127,8 @@ $arrayfields = array( 'e.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 'e.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), 'e.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), - 'l.ref'=>array('label'=>$langs->trans("DeliveryRef"), 'checked'=>1, 'enabled'=>(empty($conf->livraison_bon->enabled) ? 0 : 1)), - 'l.date_delivery'=>array('label'=>$langs->trans("DateReceived"), 'checked'=>1, 'enabled'=>(empty($conf->livraison_bon->enabled) ? 0 : 1)), + 'l.ref'=>array('label'=>$langs->trans("DeliveryRef"), 'checked'=>1, 'enabled'=>(empty($conf->delivery_note->enabled) ? 0 : 1)), + 'l.date_delivery'=>array('label'=>$langs->trans("DateReceived"), 'checked'=>1, 'enabled'=>(empty($conf->delivery_note->enabled) ? 0 : 1)), 'e.billed'=>array('label'=>$langs->trans("Billed"), 'checked'=>1, 'position'=>1000, 'enabled'=>(!empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) ); diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index ed4f52c501b..e0e5f6f5d03 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1665,13 +1665,13 @@ if ($action == 'create') $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end"; $sql .= ", ed.rowid as receptionline_id, ed.qty, ed.fk_reception as reception_id, ed.fk_entrepot"; $sql .= ", e.rowid as reception_id, e.ref as reception_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_reception"; - //if ($conf->livraison_bon->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received"; + //if ($conf->delivery_note->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received"; $sql .= ', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch'; $sql .= ', p.description as product_desc'; $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as ed"; $sql .= ", ".MAIN_DB_PREFIX."reception as e"; $sql .= ", ".MAIN_DB_PREFIX.$origin."det as obj"; - //if ($conf->livraison_bon->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_reception = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; + //if ($conf->delivery_note->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.fk_reception = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."deliverydet as ld ON ld.fk_delivery = l.rowid AND obj.rowid = ld.fk_origin_line"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON obj.fk_product = p.rowid"; $sql .= " WHERE e.entity IN (".getEntity('reception').")"; $sql .= " AND obj.fk_commande = ".$origin_id; From f954e8b173a974f3e237ec868679856213597b4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien?= Date: Tue, 6 Oct 2020 16:10:48 +0200 Subject: [PATCH 09/13] :mod livraison rename user acces right #14697 --- htdocs/commande/card.php | 2 +- htdocs/core/class/html.formfile.class.php | 2 +- htdocs/core/lib/order.lib.php | 2 +- htdocs/core/lib/propal.lib.php | 2 +- htdocs/core/lib/sendings.lib.php | 2 +- htdocs/core/modules/modExpedition.class.php | 8 ++++---- htdocs/core/tpl/extrafields_view.tpl.php | 2 +- htdocs/delivery/card.php | 20 ++++++++++---------- htdocs/delivery/class/delivery.class.php | 4 ++-- htdocs/expedition/card.php | 6 +++--- 10 files changed, 25 insertions(+), 25 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 0e66e56cc87..92c1777199e 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2555,7 +2555,7 @@ if ($action == 'create' && $usercancreate) $numshipping = $object->nb_expedition(); if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) { - if (($conf->expedition_bon->enabled && $user->rights->expedition->creer) || ($conf->delivery_note->enabled && $user->rights->expedition->livraison->creer)) { + if (($conf->expedition_bon->enabled && $user->rights->expedition->creer) || ($conf->delivery_note->enabled && $user->rights->expedition->delivery->creer)) { if ($user->rights->expedition->creer) { print ''.$langs->trans('CreateShipment').''; } else { diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index a2c7721f0f8..16526be2331 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -417,7 +417,7 @@ class FormFile $titletoshow = $langs->trans("Documents"); if (!empty($title)) $titletoshow = ($title == 'none' ? '' : $title); -print($modulepart); + // Show table if ($genallowed) { diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index 4e2f2fac24d..bf7bc352e3f 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -59,7 +59,7 @@ function commande_prepare_head(Commande $object) } if (($conf->expedition_bon->enabled && $user->rights->expedition->lire) - || ($conf->delivery_note->enabled && $user->rights->expedition->livraison->lire)) + || ($conf->delivery_note->enabled && $user->rights->expedition->delivery->lire)) { $nbShipments = $object->getNbOfShipments(); $nbReceiption = 0; $head[$h][0] = DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id; diff --git a/htdocs/core/lib/propal.lib.php b/htdocs/core/lib/propal.lib.php index 126a62fdf5e..ef41614116f 100644 --- a/htdocs/core/lib/propal.lib.php +++ b/htdocs/core/lib/propal.lib.php @@ -43,7 +43,7 @@ function propal_prepare_head($object) $h++; if ((empty($conf->commande->enabled) && ((!empty($conf->expedition->enabled) && !empty($conf->expedition_bon->enabled) && $user->rights->expedition->lire) - || (!empty($conf->expedition->enabled) && !empty($conf->delivery_note->enabled) && $user->rights->expedition->livraison->lire)))) + || (!empty($conf->expedition->enabled) && !empty($conf->delivery_note->enabled) && $user->rights->expedition->delivery->lire)))) { $langs->load("sendings"); $text = ''; diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 23f009b6234..59f0e46d428 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -47,7 +47,7 @@ function shipping_prepare_head($object) $head[$h][2] = 'shipping'; $h++; - if ($conf->delivery_note->enabled && $user->rights->expedition->livraison->lire) + if ($conf->delivery_note->enabled && $user->rights->expedition->delivery->lire) { // delivery link $object->fetchObjectLinked($object->id, $object->element); diff --git a/htdocs/core/modules/modExpedition.class.php b/htdocs/core/modules/modExpedition.class.php index eed6ec4ec5e..165633849a1 100644 --- a/htdocs/core/modules/modExpedition.class.php +++ b/htdocs/core/modules/modExpedition.class.php @@ -191,7 +191,7 @@ class modExpedition extends DolibarrModules $this->rights[$r][1] = 'Read delivery receipts'; $this->rights[$r][2] = 'r'; $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'livraison'; + $this->rights[$r][4] = 'delivery'; $this->rights[$r][5] = 'lire'; $r++; @@ -199,7 +199,7 @@ class modExpedition extends DolibarrModules $this->rights[$r][1] = 'Create/modify delivery receipts'; $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'livraison'; + $this->rights[$r][4] = 'delivery'; $this->rights[$r][5] = 'creer'; $r++; @@ -207,7 +207,7 @@ class modExpedition extends DolibarrModules $this->rights[$r][1] = 'Validate delivery receipts'; $this->rights[$r][2] = 'd'; $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'livraison_advance'; + $this->rights[$r][4] = 'delivery_advance'; $this->rights[$r][5] = 'validate'; $r++; @@ -215,7 +215,7 @@ class modExpedition extends DolibarrModules $this->rights[$r][1] = 'Delete delivery receipts'; $this->rights[$r][2] = 'd'; $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'livraison'; + $this->rights[$r][4] = 'delivery'; $this->rights[$r][5] = 'supprimer'; diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index 8f02f40fe3c..2453daab761 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -141,7 +141,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] if ($object->element == 'order_supplier') $permok = $user->rights->fournisseur->commande->creer; if ($object->element == 'invoice_supplier') $permok = $user->rights->fournisseur->facture->creer; if ($object->element == 'shipping') $permok = $user->rights->expedition->creer; - if ($object->element == 'delivery') $permok = $user->rights->expedition->livraison->creer; + if ($object->element == 'delivery') $permok = $user->rights->expedition->delivery->creer; if ($object->element == 'productlot') $permok = $user->rights->stock->creer; if ($object->element == 'facturerec') $permok = $user->rights->facture->creer; if ($object->element == 'mo') $permok = $user->rights->mrp->write; diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index 68e037d430f..37f6c3ddc80 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -126,8 +126,8 @@ if ($action == 'add') $action = 'create'; } } elseif ($action == 'confirm_valid' && $confirm == 'yes' && - ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->livraison->creer)) - || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->livraison_advance->validate))) + ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery->creer)) + || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery_advance->validate))) ) { $result = $object->valid($user); @@ -151,7 +151,7 @@ if ($action == 'add') } } -if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expedition->livraison->supprimer) +if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expedition->delivery->supprimer) { $db->begin(); $result = $object->delete(); @@ -167,7 +167,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expeditio } } -if ($action == 'setdate_livraison' && $user->rights->expedition->livraison->creer) +if ($action == 'setdate_livraison' && $user->rights->expedition->delivery->creer) { $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); $result = $object->set_delivery_date($user, $datedelivery); @@ -458,7 +458,7 @@ if ($action == 'create') // Create. Seems to no be used print '
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 1).'  '; print ''.$langs->trans("DeliveryOrder").''.$langs->trans("QtyReceived").'
'; print $langs->trans('IncotermLabel'); print ''; - if ($user->rights->expedition->livraison->creer) print ''.img_edit().''; + if ($user->rights->expedition->delivery->creer) print ''.img_edit().''; else print ' '; print '
'; print ''; @@ -647,14 +647,14 @@ if ($action == 'create') // Create. Seems to no be used if ($object->statut == 0 && $num_prod > 0) { - if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->livraison->creer)) - || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->livraison_advance->validate))) + if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery->creer)) + || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery_advance->validate))) { print ''.$langs->trans("Validate").''; } } - if ($user->rights->expedition->livraison->supprimer) + if ($user->rights->expedition->delivery->supprimer) { if ($conf->expedition_bon->enabled) { @@ -678,8 +678,8 @@ if ($action == 'create') // Create. Seems to no be used $filedir = $conf->expedition->dir_output."/receipt/".$objectref; $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed = $user->rights->expedition->livraison->lire; - $delallowed = $user->rights->expedition->livraison->creer; + $genallowed = $user->rights->expedition->delivery->lire; + $delallowed = $user->rights->expedition->delivery->creer; print $formfile->showdocuments('delivery', $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang); diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index 8c227dc109f..b9c0299c8ab 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -373,8 +373,8 @@ class Delivery extends CommonObject $error = 0; - if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->livraison->creer)) - || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->livraison_advance->validate))) + if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery->creer)) + || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery_advance->validate))) { if (!empty($conf->global->DELIVERY_ADDON_NUMBER)) { diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 37c7119d814..98c1c4ea7cf 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -102,7 +102,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('expeditioncard', 'globalcard')); -$permissiondellink = $user->rights->expedition->livraison->creer; // Used by the include of actions_dellink.inc.php +$permissiondellink = $user->rights->expedition->delivery->creer; // Used by the include of actions_dellink.inc.php //var_dump($object->lines[0]->detail_batch); @@ -399,7 +399,7 @@ if (empty($reshook)) /* * Build a receiving receipt */ - elseif ($action == 'create_delivery' && $conf->delivery_note->enabled && $user->rights->expedition->livraison->creer) + elseif ($action == 'create_delivery' && $conf->delivery_note->enabled && $user->rights->expedition->delivery->creer) { $result = $object->create_delivery($user); if ($result > 0) @@ -2467,7 +2467,7 @@ if ($action == 'create') // This is just to generate a delivery receipt //var_dump($object->linkedObjectsIds['delivery']); - if ($conf->delivery_note->enabled && ($object->statut == Expedition::STATUS_VALIDATED || $object->statut == Expedition::STATUS_CLOSED) && $user->rights->expedition->livraison->creer && empty($object->linkedObjectsIds['delivery'])) + if ($conf->delivery_note->enabled && ($object->statut == Expedition::STATUS_VALIDATED || $object->statut == Expedition::STATUS_CLOSED) && $user->rights->expedition->delivery->creer && empty($object->linkedObjectsIds['delivery'])) { print ''.$langs->trans("CreateDeliveryOrder").''; } From 16e076d18210a89fe3e28177d8bf2cdbf57b0c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien?= Date: Wed, 7 Oct 2020 20:54:56 +0200 Subject: [PATCH 10/13] fix UPDATE llx_extrafields.elementtype = livraison to delivery #14697 --- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 4 ++++ 1 file changed, 4 insertions(+) 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 a9a8786807c..1b0cc69f8f3 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 @@ -379,3 +379,7 @@ ALTER TABLE llx_delivery DROP CONSTRAINT fk_delivery_fk_user_valid; ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid); + +-- update llx_extrafields +UPDATE llx_extrafields SET elementtype = 'delivery' WHERE llx_extrafields.elementtype = 'livraison' +UPDATE llx_extrafields SET elementtype = 'deliverydet' WHERE llx_extrafields.elementtype = 'livraison' \ No newline at end of file From 9c0239006685827de24be9dd8e6da7242e8d0950 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien?= Date: Wed, 7 Oct 2020 21:26:40 +0200 Subject: [PATCH 11/13] fix migration12->13.sql #14697 fix drop constraint fix error on update extrafields --- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 1b0cc69f8f3..9e9b60c96a7 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 @@ -371,9 +371,9 @@ ALTER TABLE llx_delivery DROP INDEX idx_livraison_fk_user_author, ADD INDEX idx_ ALTER TABLE llx_delivery DROP INDEX idx_livraison_fk_user_valid, ADD INDEX idx_delivery_fk_user_valid (fk_user_valid); -- drop constraint -ALTER TABLE llx_delivery DROP CONSTRAINT fk_delivery_fk_soc; -ALTER TABLE llx_delivery DROP CONSTRAINT fk_delivery_fk_user_author; -ALTER TABLE llx_delivery DROP CONSTRAINT fk_delivery_fk_user_valid; +ALTER TABLE llx_livraison DROP CONSTRAINT fk_livraison_fk_soc; +ALTER TABLE llx_livraison DROP CONSTRAINT fk_livraison_fk_user_author; +ALTER TABLE llx_livraison DROP CONSTRAINT fk_livraison_fk_user_valid; -- add constraint ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe (rowid); @@ -381,5 +381,5 @@ ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_user_author FOREIGN KEY ( ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid); -- update llx_extrafields -UPDATE llx_extrafields SET elementtype = 'delivery' WHERE llx_extrafields.elementtype = 'livraison' -UPDATE llx_extrafields SET elementtype = 'deliverydet' WHERE llx_extrafields.elementtype = 'livraison' \ No newline at end of file +UPDATE llx_extrafields SET elementtype = 'delivery' WHERE llx_extrafields.elementtype = 'livraison'; +UPDATE llx_extrafields SET elementtype = 'deliverydet' WHERE llx_extrafields.elementtype = 'livraisondet'; \ No newline at end of file From 5fa481422aff74abd57085f682648575d4066a02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien?= Date: Thu, 8 Oct 2020 15:56:44 +0200 Subject: [PATCH 12/13] update dependencies migration12->13.sql #14697 --- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 9e9b60c96a7..d9bd96c71da 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 @@ -382,4 +382,15 @@ ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_user_valid FOREIGN KEY (f -- update llx_extrafields UPDATE llx_extrafields SET elementtype = 'delivery' WHERE llx_extrafields.elementtype = 'livraison'; -UPDATE llx_extrafields SET elementtype = 'deliverydet' WHERE llx_extrafields.elementtype = 'livraisondet'; \ No newline at end of file +UPDATE llx_extrafields SET elementtype = 'deliverydet' WHERE llx_extrafields.elementtype = 'livraisondet'; + +-- update llx_ecm_files +UPDATE llx_ecm_files SET src_object_type = 'delivery' WHERE llx_ecm_files.src_object_type = 'livraison'; + +-- update llx_links +UPDATE llx_links SET objecttype = 'delivery' WHERE llx_links.objecttype = 'livraison'; + +-- update llx_document_model +UPDATE llx_document_model SET type = 'delivery' WHERE llx_document_model.type = 'livraison'; + +-- TODO Check DB llx_actioncomm, llx_element_element(already modified by shipping/delivery), llx_c_email_template, llx_c_type_contact, llx_object_langs because Module changing label livraison 2 delivery. I think those table have been manage by Module Expedition \ No newline at end of file From 3daf530a92881d2acbd91422d394832a822d48c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien?= Date: Thu, 8 Oct 2020 18:52:17 +0200 Subject: [PATCH 13/13] Revert "update dependencies migration12->13.sql #14697" This reverts commit 5fa481422aff74abd57085f682648575d4066a02. --- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 4 ++++ 1 file changed, 4 insertions(+) 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 9b5bb75c35b..1a2b1f9b43a 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 @@ -384,6 +384,7 @@ ALTER TABLE llx_delivery ADD CONSTRAINT fk_delivery_fk_user_valid FOREIGN KEY (f -- update llx_extrafields UPDATE llx_extrafields SET elementtype = 'delivery' WHERE llx_extrafields.elementtype = 'livraison'; +<<<<<<< HEAD UPDATE llx_extrafields SET elementtype = 'deliverydet' WHERE llx_extrafields.elementtype = 'livraisondet'; -- update llx_ecm_files @@ -396,3 +397,6 @@ UPDATE llx_links SET objecttype = 'delivery' WHERE llx_links.objecttype = 'livra UPDATE llx_document_model SET type = 'delivery' WHERE llx_document_model.type = 'livraison'; -- TODO Check DB llx_actioncomm, llx_element_element(already modified by shipping/delivery), llx_c_email_template, llx_c_type_contact, llx_object_langs because Module changing label livraison 2 delivery. I think those table have been manage by Module Expedition +======= +UPDATE llx_extrafields SET elementtype = 'deliverydet' WHERE llx_extrafields.elementtype = 'livraisondet'; +>>>>>>> parent of 5fa481422a... update dependencies migration12->13.sql #14697