From ab206910ab509c76bd592501463688a2a9154d7f Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Mon, 15 Jan 2024 09:40:59 +0100 Subject: [PATCH 1/6] change to receptiondet_batch into scripts --- ...php => receptiondet_batch_extrafields.php} | 4 ++-- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/lib/reception.lib.php | 6 ++--- htdocs/core/modules/modReception.class.php | 6 ++--- htdocs/expedition/dispatch.php | 2 +- .../class/fournisseur.commande.class.php | 8 +++---- .../fournisseur.commande.dispatch.class.php | 2 +- htdocs/fourn/commande/dispatch.php | 4 ++-- htdocs/product/class/product.class.php | 2 +- .../product/stock/class/productlot.class.php | 4 ++-- .../product/stock/lib/replenishment.lib.php | 2 +- htdocs/product/stock/replenish.php | 2 +- .../stock/stats/commande_fournisseur.php | 2 +- htdocs/product/stock/stats/reception.php | 2 +- htdocs/reception/card.php | 4 ++-- htdocs/reception/class/reception.class.php | 24 +++++++++---------- htdocs/reception/dispatch.php | 4 ++-- 17 files changed, 40 insertions(+), 40 deletions(-) rename htdocs/admin/{commande_fournisseur_dispatch_extrafields.php => receptiondet_batch_extrafields.php} (94%) diff --git a/htdocs/admin/commande_fournisseur_dispatch_extrafields.php b/htdocs/admin/receptiondet_batch_extrafields.php similarity index 94% rename from htdocs/admin/commande_fournisseur_dispatch_extrafields.php rename to htdocs/admin/receptiondet_batch_extrafields.php index 277d61e1b2f..ea98618dda0 100644 --- a/htdocs/admin/commande_fournisseur_dispatch_extrafields.php +++ b/htdocs/admin/receptiondet_batch_extrafields.php @@ -25,7 +25,7 @@ */ /** - * \file htdocs/admin/commande_fournisseur_dispatch_extrafields.php + * \file htdocs/admin/receptiondet_batch.php * \ingroup reception * \brief Page to setup extra fields of reception */ @@ -56,7 +56,7 @@ foreach ($tmptype2label as $key => $val) { $action = GETPOST('action', 'aZ09'); $attrname = GETPOST('attrname', 'alpha'); -$elementtype = 'commande_fournisseur_dispatch'; //Must be the $table_element of the class that manage extrafield +$elementtype = 'receptiondet_batch'; //Must be the $table_element of the class that manage extrafield if (!$user->admin) { accessforbidden(); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 75fd4a5e47a..4dc6a6dad58 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4535,7 +4535,7 @@ abstract class CommonObject if ($elementTable == 'expensereport') { $fieldstatus = "fk_statut"; } - if ($elementTable == 'commande_fournisseur_dispatch') { + if ($elementTable == 'receptiondet_batch') { $fieldstatus = "status"; } if ($elementTable == 'prelevement_bons') { diff --git a/htdocs/core/lib/reception.lib.php b/htdocs/core/lib/reception.lib.php index 2dce74e6a11..b5f5a0c7067 100644 --- a/htdocs/core/lib/reception.lib.php +++ b/htdocs/core/lib/reception.lib.php @@ -122,7 +122,7 @@ function reception_admin_prepare_head() $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label('reception'); - $extrafields->fetch_name_optionals_label('commande_fournisseur_dispatch'); + $extrafields->fetch_name_optionals_label('receptiondet_batch'); $h = 0; $head = array(); @@ -146,9 +146,9 @@ function reception_admin_prepare_head() } if (getDolGlobalString('MAIN_SUBMODULE_RECEPTION')) { - $head[$h][0] = DOL_URL_ROOT.'/admin/commande_fournisseur_dispatch_extrafields.php'; + $head[$h][0] = DOL_URL_ROOT.'/admin/receptiondet_batch_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); - $nbExtrafields = $extrafields->attributes['commande_fournisseur_dispatch']['count']; + $nbExtrafields = $extrafields->attributes['receptiondet_batch']['count']; if ($nbExtrafields > 0) { $head[$h][1] .= ''.$nbExtrafields.''; } diff --git a/htdocs/core/modules/modReception.class.php b/htdocs/core/modules/modReception.class.php index f5f8429f5db..f0327612b7d 100644 --- a/htdocs/core/modules/modReception.class.php +++ b/htdocs/core/modules/modReception.class.php @@ -218,7 +218,7 @@ class modReception extends DolibarrModules $keyforelement = 'reception'; $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'commande_fournisseur_dispatch'; + $keyforselect = 'receptiondet_batch'; $keyforelement = 'reception_line'; $keyforaliasextra = 'extra2'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; @@ -232,8 +232,8 @@ class modReception extends DolibarrModules } $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,'; - $this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch as ed'; - $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch_extrafields as extra2 ON ed.rowid = extra2.fk_object'; + $this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'receptiondet_batch as ed'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'receptiondet_batch_extrafields as extra2 ON ed.rowid = extra2.fk_object'; $this->export_sql_end[$r] .= ' , '.MAIN_DB_PREFIX.'commande_fournisseurdet as cd'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on cd.fk_product = p.rowid'; if ($idcontacts && getDolGlobalString('RECEPTION_ADD_CONTACTS_IN_EXPORT')) { diff --git a/htdocs/expedition/dispatch.php b/htdocs/expedition/dispatch.php index 8ba6e6d7768..1daba85e87f 100644 --- a/htdocs/expedition/dispatch.php +++ b/htdocs/expedition/dispatch.php @@ -774,7 +774,7 @@ if ($object->id > 0 || !empty($object->ref)) { print ''; // Warehouse column /*$sql = "SELECT cfd.rowid, cfd.qty, cfd.fk_entrepot, cfd.batch, cfd.eatby, cfd.sellby, cfd.fk_product"; - $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd"; + $sql .= " FROM ".MAIN_DB_PREFIX."receptiondet_batch as cfd"; $sql .= " WHERE cfd.fk_commandefourndet = ".(int) $objp->rowid;*/ $sql = "SELECT ed.rowid, ed.qty, ed.fk_entrepot,"; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 81570e7e320..102399eb4d9 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2103,7 +2103,7 @@ class CommandeFournisseur extends CommonOrder /** - * Save a receiving into the tracking table of receiving (commande_fournisseur_dispatch) and add product into stock warehouse. + * Save a receiving into the tracking table of receiving (receptiondet_batch) and add product into stock warehouse. * * @param User $user User object making change * @param int $product Id of product to dispatch @@ -2148,7 +2148,7 @@ class CommandeFournisseur extends CommonOrder if (($this->statut == self::STATUS_ORDERSENT || $this->statut == self::STATUS_RECEIVED_PARTIALLY || $this->statut == self::STATUS_RECEIVED_COMPLETELY)) { $this->db->begin(); - $sql = "INSERT INTO ".$this->db->prefix()."commande_fournisseur_dispatch"; + $sql = "INSERT INTO ".$this->db->prefix()."receptiondet_batch"; $sql .= " (fk_commande, fk_product, qty, fk_entrepot, fk_user, datec, fk_commandefourndet, status, comment, eatby, sellby, batch, fk_reception) VALUES"; $sql .= " ('".$this->id."','".$product."','".$qty."',".($entrepot > 0 ? "'".$entrepot."'" : "null").",'".$user->id."','".$this->db->idate($now)."','".$fk_commandefourndet."', ".$dispatchstatus.", '".$this->db->escape($comment)."', "; $sql .= ($eatby ? "'".$this->db->idate($eatby)."'" : "null").", ".($sellby ? "'".$this->db->idate($sellby)."'" : "null").", ".($batch ? "'".$this->db->escape($batch)."'" : "null").", ".($fk_reception > 0 ? "'".$this->db->escape($fk_reception)."'" : "null"); @@ -2395,7 +2395,7 @@ class CommandeFournisseur extends CommonOrder $sql .= " e.rowid as warehouse_id, e.ref as entrepot,"; $sql .= " cfd.rowid as dispatchedlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status, cfd.fk_commandefourndet"; $sql .= " FROM ".$this->db->prefix()."product as p,"; - $sql .= " ".$this->db->prefix()."commande_fournisseur_dispatch as cfd"; + $sql .= " ".$this->db->prefix()."receptiondet_batch as cfd"; $sql .= " LEFT JOIN ".$this->db->prefix()."entrepot as e ON cfd.fk_entrepot = e.rowid"; $sql .= " WHERE cfd.fk_commande = ".((int) $this->id); $sql .= " AND cfd.fk_product = p.rowid"; @@ -3556,7 +3556,7 @@ class CommandeFournisseur extends CommonOrder $sql = 'SELECT cd.rowid, cd.fk_product,'; $sql .= ' sum(cfd.qty) as qty'; - $sql .= ' FROM '.$this->db->prefix().'commande_fournisseur_dispatch as cfd,'; + $sql .= ' FROM '.$this->db->prefix().'receptiondet_batch as cfd,'; if ($filtre_statut >= 0) { $sql .= ' '.$this->db->prefix().'reception as e,'; } diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index 044a14119c9..7374ccb9111 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -56,7 +56,7 @@ class CommandeFournisseurDispatch extends CommonObjectLine /** * @var string Name of table without prefix where object is stored */ - public $table_element = 'commande_fournisseur_dispatch'; //!< Name of table without prefix where object is stored + public $table_element = 'receptiondet_batch'; //!< Name of table without prefix where object is stored public $lines = array(); /** diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 6241d2bd202..5c0a245310e 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -655,7 +655,7 @@ if ($id > 0 || !empty($ref)) { // Set $products_dispatched with qty dispatched for each product id $products_dispatched = array(); $sql = "SELECT l.rowid, cfd.fk_product, sum(cfd.qty) as qty"; - $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd"; + $sql .= " FROM ".MAIN_DB_PREFIX."receptiondet_batch as cfd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande_fournisseurdet as l on l.rowid = cfd.fk_commandefourndet"; $sql .= " WHERE cfd.fk_commande = ".((int) $object->id); $sql .= " GROUP BY l.rowid, cfd.fk_product"; @@ -1158,7 +1158,7 @@ if ($id > 0 || !empty($ref)) { $sql .= " ,cfd.fk_reception, r.date_delivery"; } $sql .= " FROM ".MAIN_DB_PREFIX."product as p,"; - $sql .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd"; + $sql .= " ".MAIN_DB_PREFIX."receptiondet_batch as cfd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande_fournisseurdet as cd ON cd.rowid = cfd.fk_commandefourndet"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e ON cfd.fk_entrepot = e.rowid"; if ($conf->reception->enabled) { diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 5a7ae18ee1d..99279e0b173 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3427,7 +3427,7 @@ class Product extends CommonObject $sql = "SELECT COUNT(DISTINCT cf.fk_soc) as nb_suppliers, COUNT(DISTINCT cf.rowid) as nb,"; $sql .= " COUNT(fd.rowid) as nb_rows, SUM(fd.qty) as qty"; - $sql .= " FROM ".$this->db->prefix()."commande_fournisseur_dispatch as fd"; + $sql .= " FROM ".$this->db->prefix()."receptiondet_batch as fd"; $sql .= ", ".$this->db->prefix()."commande_fournisseur as cf"; $sql .= ", ".$this->db->prefix()."societe as s"; if (!$user->hasRight('societe', 'client', 'voir') && !$forVirtualStock) { diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 0e9852fba82..9c145073f94 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -835,7 +835,7 @@ class Productlot extends CommonObject $sql = "SELECT COUNT(DISTINCT cf.fk_soc) as nb_customers, COUNT(DISTINCT cf.rowid) as nb,"; $sql .= " COUNT(cfd.rowid) as nb_rows, SUM(cfdi.qty) as qty"; - $sql .= " FROM ".$this->db->prefix()."commande_fournisseur_dispatch as cfdi"; + $sql .= " FROM ".$this->db->prefix()."receptiondet_batch as cfdi"; $sql .= " INNER JOIN ".$this->db->prefix()."commande_fournisseurdet as cfd ON (cfd.rowid = cfdi.fk_commandefourndet)"; $sql .= " INNER JOIN ".$this->db->prefix()."commande_fournisseur as cf ON (cf.rowid = cfd.fk_commande)"; // $sql .= ", ".$this->db->prefix()."societe as s"; @@ -910,7 +910,7 @@ class Productlot extends CommonObject $sql = "SELECT COUNT(DISTINCT recep.fk_soc) as nb_customers, COUNT(DISTINCT recep.rowid) as nb,"; $sql .= " COUNT(cfdi.rowid) as nb_rows, SUM(cfdi.qty) as qty"; - $sql .= " FROM ".$this->db->prefix()."commande_fournisseur_dispatch as cfdi"; + $sql .= " FROM ".$this->db->prefix()."receptiondet_batch as cfdi"; $sql .= " INNER JOIN ".$this->db->prefix()."reception as recep ON (recep.rowid = cfdi.fk_reception)"; // $sql .= ", ".$this->db->prefix()."societe as s"; if (!$user->hasRight('societe', 'client', 'voir')) { diff --git a/htdocs/product/stock/lib/replenishment.lib.php b/htdocs/product/stock/lib/replenishment.lib.php index 8751935cb13..e6bf9d8a060 100644 --- a/htdocs/product/stock/lib/replenishment.lib.php +++ b/htdocs/product/stock/lib/replenishment.lib.php @@ -38,7 +38,7 @@ function dolDispatchToDo($order_id) $ordered = array(); // Count nb of quantity dispatched per product - $sql = 'SELECT fk_product, SUM(qty) as qtydispatched FROM '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch'; + $sql = 'SELECT fk_product, SUM(qty) as qtydispatched FROM '.MAIN_DB_PREFIX.'receptiondet_batch'; $sql .= ' WHERE fk_commande = '.((int) $order_id); $sql .= ' GROUP BY fk_product'; $sql .= ' ORDER by fk_product'; diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index a9ae3c62195..b3e9b4aa510 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -451,7 +451,7 @@ if ($usevirtualstock) { $sqlReceptionFourn = "(SELECT ".$db->ifsql("SUM(fd4.qty) IS NULL", "0", "SUM(fd4.qty)")." as qty"; // We need the ifsql because if result is 0 for product p.rowid, we must return 0 and not NULL $sqlReceptionFourn .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf4,"; - $sqlReceptionFourn .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as fd4"; + $sqlReceptionFourn .= " ".MAIN_DB_PREFIX."receptiondet_batch as fd4"; $sqlReceptionFourn .= " WHERE fd4.fk_commande = cf4.rowid AND cf4.entity IN (".getEntity(getDolGlobalString('STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE') ? 'stock' : 'supplier_order').")"; $sqlReceptionFourn .= " AND fd4.fk_product = p.rowid"; $sqlReceptionFourn .= " AND cf4.fk_statut IN (3,4))"; diff --git a/htdocs/product/stock/stats/commande_fournisseur.php b/htdocs/product/stock/stats/commande_fournisseur.php index 756f814f575..4365c91e460 100644 --- a/htdocs/product/stock/stats/commande_fournisseur.php +++ b/htdocs/product/stock/stats/commande_fournisseur.php @@ -224,7 +224,7 @@ if ($id > 0 || !empty($ref)) { $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."commande_fournisseur as cf ON (cf.fk_soc = s.rowid)"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."commande_fournisseurdet as cfd ON (cfd.fk_commande = cf.rowid)"; - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfdi ON (cfdi.fk_commandefourndet = cfd.rowid)"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."receptiondet_batch as cfdi ON (cfdi.fk_commandefourndet = cfd.rowid)"; if (!$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } diff --git a/htdocs/product/stock/stats/reception.php b/htdocs/product/stock/stats/reception.php index 63c4b942310..cc7165e3f4b 100644 --- a/htdocs/product/stock/stats/reception.php +++ b/htdocs/product/stock/stats/reception.php @@ -223,7 +223,7 @@ if ($id > 0 || !empty($ref)) { } $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."reception as recep ON (recep.fk_soc = s.rowid)"; - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as d ON (d.fk_reception = recep.rowid)"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."receptiondet_batch as d ON (d.fk_reception = recep.rowid)"; if (!$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 0498c8d06bc..96835b53dc5 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1035,7 +1035,7 @@ if ($action == 'create') { // Note that if an extrafield with the same name exists in the origin supplier order line, the value // from the HTTP query will be ignored foreach ($suffix2numAsked as $suffix => $n) { - $dispatchLines[$n]['array_options'] = $extrafields->getOptionalsFromPost('commande_fournisseur_dispatch', '_' . $suffix, ''); + $dispatchLines[$n]['array_options'] = $extrafields->getOptionalsFromPost('receptiondet_batch', '_' . $suffix, ''); } print '