From 00f532c43623443a8e8647f81e5a39772d9e4994 Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Thu, 4 Oct 2018 09:50:39 +0200 Subject: [PATCH] =?UTF-8?q?validation=20mod=C3=A8le=20de=20donn=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ande_fournisseur_dispatch_extrafields.php} | 4 +-- htdocs/core/lib/reception.lib.php | 2 +- .../llx_commande_fournisseur_dispatch.key.sql | 4 ++- .../llx_commande_fournisseur_dispatch.sql | 1 + ..._fournisseur_dispatch_extrafields.key.sql} | 2 +- ...ande_fournisseur_dispatch_extrafields.sql} | 2 +- .../mysql/tables/llx_receptiondet.key.sql | 22 -------------- .../install/mysql/tables/llx_receptiondet.sql | 29 ------------------- .../tables/llx_receptiondet_batch.key.sql | 20 ------------- .../mysql/tables/llx_receptiondet_batch.sql | 27 ----------------- scripts/reception/create-table.php | 4 +-- 11 files changed, 11 insertions(+), 106 deletions(-) rename htdocs/admin/{receptiondet_extrafields.php => commande_fournisseur_dispatch_extrafields.php} (95%) rename htdocs/install/mysql/tables/{llx_receptiondet_extrafields.key.sql => llx_commande_fournisseur_dispatch_extrafields.key.sql} (87%) rename htdocs/install/mysql/tables/{llx_receptiondet_extrafields.sql => llx_commande_fournisseur_dispatch_extrafields.sql} (94%) delete mode 100644 htdocs/install/mysql/tables/llx_receptiondet.key.sql delete mode 100644 htdocs/install/mysql/tables/llx_receptiondet.sql delete mode 100644 htdocs/install/mysql/tables/llx_receptiondet_batch.key.sql delete mode 100644 htdocs/install/mysql/tables/llx_receptiondet_batch.sql diff --git a/htdocs/admin/receptiondet_extrafields.php b/htdocs/admin/commande_fournisseur_dispatch_extrafields.php similarity index 95% rename from htdocs/admin/receptiondet_extrafields.php rename to htdocs/admin/commande_fournisseur_dispatch_extrafields.php index 80bc3806b52..68246b675e5 100644 --- a/htdocs/admin/receptiondet_extrafields.php +++ b/htdocs/admin/commande_fournisseur_dispatch_extrafields.php @@ -25,7 +25,7 @@ */ /** - * \file htdocs/admin/receptiondet_extrafields.php + * \file htdocs/admin/commandefournisseurdispatch_extrafields.php * \ingroup reception * \brief Page to setup extra fields of reception */ @@ -52,7 +52,7 @@ foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val); $action=GETPOST('action', 'alpha'); $attrname=GETPOST('attrname', 'alpha'); -$elementtype='receptiondet'; //Must be the $table_element of the class that manage extrafield +$elementtype='commande_fournisseur_dispatch'; //Must be the $table_element of the class that manage extrafield if (!$user->admin) accessforbidden(); diff --git a/htdocs/core/lib/reception.lib.php b/htdocs/core/lib/reception.lib.php index 34cd46026ed..b3c32ee60b4 100644 --- a/htdocs/core/lib/reception.lib.php +++ b/htdocs/core/lib/reception.lib.php @@ -85,7 +85,7 @@ function reception_admin_prepare_head() if (! empty($conf->global->MAIN_SUBMODULE_RECEPTION)) { - $head[$h][0] = DOL_URL_ROOT.'/admin/receptiondet_extrafields.php'; + $head[$h][0] = DOL_URL_ROOT.'/admin/commande_fournisseur_dispatch_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); $head[$h][2] = 'attributeslines_reception'; $h++; diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.key.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.key.sql index ba7c02280ec..369a25f2b32 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.key.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.key.sql @@ -16,4 +16,6 @@ -- -- =================================================================== -ALTER TABLE llx_commande_fournisseur_dispatch ADD INDEX idx_commande_fournisseur_dispatch_fk_commande (fk_commande); \ No newline at end of file +ALTER TABLE llx_commande_fournisseur_dispatch ADD INDEX idx_commande_fournisseur_dispatch_fk_commande (fk_commande); +ALTER TABLE llx_commande_fournisseur_dispatch ADD INDEX idx_commande_fournisseur_dispatch_fk_reception (fk_reception); +ALTER TABLE llx_commande_fournisseur_dispatch ADD CONSTRAINT fk_commande_fournisseur_dispatch_fk_reception FOREIGN KEY (fk_reception) REFERENCES llx_reception (rowid); \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql index 074dc0d4c16..9a6e05d1af1 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch.sql @@ -26,6 +26,7 @@ create table llx_commande_fournisseur_dispatch fk_product integer, fk_commandefourndet integer, fk_projet integer DEFAULT NULL, + fk_reception integer DEFAULT NULL, qty float, -- qty fk_entrepot integer, fk_user integer, diff --git a/htdocs/install/mysql/tables/llx_receptiondet_extrafields.key.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch_extrafields.key.sql similarity index 87% rename from htdocs/install/mysql/tables/llx_receptiondet_extrafields.key.sql rename to htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch_extrafields.key.sql index 5d5d52b5526..c836fbaea6a 100644 --- a/htdocs/install/mysql/tables/llx_receptiondet_extrafields.key.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch_extrafields.key.sql @@ -17,4 +17,4 @@ -- =================================================================== -ALTER TABLE llx_receptiondet_extrafields ADD INDEX idx_receptiondet_extrafields (fk_object); +ALTER TABLE llx_commande_fournisseur_dispatch_extrafields ADD INDEX idx_commande_fournisseur_dispatch_extrafields (fk_object); diff --git a/htdocs/install/mysql/tables/llx_receptiondet_extrafields.sql b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch_extrafields.sql similarity index 94% rename from htdocs/install/mysql/tables/llx_receptiondet_extrafields.sql rename to htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch_extrafields.sql index 5fe823efd76..f00eabf42fa 100644 --- a/htdocs/install/mysql/tables/llx_receptiondet_extrafields.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseur_dispatch_extrafields.sql @@ -16,7 +16,7 @@ -- -- =================================================================== -create table llx_receptiondet_extrafields +create table llx_commande_fournisseur_dispatch_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, tms timestamp, diff --git a/htdocs/install/mysql/tables/llx_receptiondet.key.sql b/htdocs/install/mysql/tables/llx_receptiondet.key.sql deleted file mode 100644 index 3740f83d1d0..00000000000 --- a/htdocs/install/mysql/tables/llx_receptiondet.key.sql +++ /dev/null @@ -1,22 +0,0 @@ --- =================================================================== --- Copyright (C) 2005 Laurent Destailleur --- Copyright (C) 2008 Regis Houssin --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 3 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program. If not, see . --- --- =================================================================== - - -ALTER TABLE llx_receptiondet ADD INDEX idx_receptiondet_fk_reception (fk_reception); -ALTER TABLE llx_receptiondet ADD CONSTRAINT fk_receptiondet_fk_reception FOREIGN KEY (fk_reception) REFERENCES llx_reception (rowid); diff --git a/htdocs/install/mysql/tables/llx_receptiondet.sql b/htdocs/install/mysql/tables/llx_receptiondet.sql deleted file mode 100644 index dd726c85eab..00000000000 --- a/htdocs/install/mysql/tables/llx_receptiondet.sql +++ /dev/null @@ -1,29 +0,0 @@ --- =================================================================== --- Copyright (C) 2003 Rodolphe Quiedeville --- Copyright (C) 2008 Regis Houssin --- Copyright (C) 2011 Laurent Destailleur --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 3 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program. If not, see . --- --- =================================================================== - -create table llx_receptiondet -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_reception integer NOT NULL, - fk_origin_line integer, -- Correspondance de la ligne avec le document d'origine (propal, commande) - fk_entrepot integer, -- Entrepot de depart du produit - qty real, -- Quantity - rang integer DEFAULT 0 -)ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_receptiondet_batch.key.sql b/htdocs/install/mysql/tables/llx_receptiondet_batch.key.sql deleted file mode 100644 index 59928d1c278..00000000000 --- a/htdocs/install/mysql/tables/llx_receptiondet_batch.key.sql +++ /dev/null @@ -1,20 +0,0 @@ --- ============================================================================ --- Copyright (C) 2014 Cédric GROSS --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 3 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program. If not, see . --- --- ============================================================================ - -ALTER TABLE llx_receptiondet_batch ADD INDEX idx_fk_receptiondet (fk_receptiondet); -ALTER TABLE llx_receptiondet_batch ADD CONSTRAINT fk_receptiondet_batch_fk_receptiondet FOREIGN KEY (fk_receptiondet) REFERENCES llx_receptiondet(rowid); diff --git a/htdocs/install/mysql/tables/llx_receptiondet_batch.sql b/htdocs/install/mysql/tables/llx_receptiondet_batch.sql deleted file mode 100644 index ef2537cc116..00000000000 --- a/htdocs/install/mysql/tables/llx_receptiondet_batch.sql +++ /dev/null @@ -1,27 +0,0 @@ --- ============================================================================ --- Copyright (C) 2014 Cédric GROSS --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 3 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program. If not, see . --- --- ============================================================================ -CREATE TABLE llx_receptiondet_batch ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_receptiondet int NOT NULL, - eatby date DEFAULT NULL, - sellby date DEFAULT NULL, - batch varchar(30) DEFAULT NULL, - qty double NOT NULL DEFAULT '0', - fk_origin_stock integer NOT NULL -) ENGINE=InnoDB; - diff --git a/scripts/reception/create-table.php b/scripts/reception/create-table.php index a9f3401f327..c65292da04b 100644 --- a/scripts/reception/create-table.php +++ b/scripts/reception/create-table.php @@ -47,7 +47,7 @@ if (is_resource($handle)) { if (preg_match('/\.sql$/i', $file) && preg_match('/^llx_/i', $file) && !preg_match('/\.key\.sql$/i', $file)) { - if (strpos($file, 'reception') !== false){ + if (strpos($file, 'reception') !== false || strpos($file, 'commande_fournisseur_dispatch') !== false){ $tablefound++; $tabledata[] = $file; } @@ -160,7 +160,7 @@ if (is_resource($handle)) { if (preg_match('/\.sql$/i', $file) && preg_match('/^llx_/i', $file) && preg_match('/\.key\.sql$/i', $file)) { - if (strpos($file, 'reception') !== false){ + if (strpos($file, 'reception') !== false || strpos($file, 'commande_fournisseur_dispatch') !== false){ $tablefound++; $tabledata[] = $file; }