From 840b0e48435da9f5b58271e44bfd81b046ee9c14 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Sat, 8 Jan 2022 14:47:40 +0100 Subject: [PATCH 01/23] FIX #19760 Uniformize label length --- .../install/mysql/migration/15.0.0-16.0.0.sql | 67 +++++++++++++++++++ .../install/mysql/tables/llx_c_actioncomm.sql | 3 +- .../mysql/tables/llx_c_availability.sql | 3 +- .../mysql/tables/llx_c_barcode_type.sql | 3 +- .../mysql/tables/llx_c_chargesociales.sql | 3 +- .../install/mysql/tables/llx_c_civility.sql | 3 +- htdocs/install/mysql/tables/llx_c_country.sql | 3 +- .../install/mysql/tables/llx_c_currencies.sql | 3 +- .../install/mysql/tables/llx_c_effectif.sql | 3 +- .../mysql/tables/llx_c_exp_tax_cat.sql | 3 +- .../mysql/tables/llx_c_hrm_department.sql | 3 +- .../mysql/tables/llx_c_hrm_function.sql | 3 +- .../mysql/tables/llx_c_input_method.sql | 3 +- .../mysql/tables/llx_c_input_reason.sql | 3 +- .../mysql/tables/llx_c_lead_status.sql | 3 +- .../install/mysql/tables/llx_c_paiement.sql | 3 +- .../mysql/tables/llx_c_paper_format.sql | 3 +- .../mysql/tables/llx_c_partnership_type.sql | 3 +- .../mysql/tables/llx_c_product_nature.sql | 4 +- .../tables/llx_c_productbatch_qcstatus.sql | 3 +- .../install/mysql/tables/llx_c_propalst.sql | 3 +- .../tables/llx_c_prospectcontactlevel.sql | 3 +- .../mysql/tables/llx_c_prospectlevel.sql | 3 +- .../mysql/tables/llx_c_recruitment_origin.sql | 3 +- .../mysql/tables/llx_c_shipment_mode.sql | 3 +- .../tables/llx_c_shipment_package_type.sql | 2 +- htdocs/install/mysql/tables/llx_c_stcomm.sql | 3 +- .../mysql/tables/llx_c_stcommcontact.sql | 3 +- .../mysql/tables/llx_c_type_contact.sql | 3 +- .../mysql/tables/llx_c_type_container.sql | 3 +- .../install/mysql/tables/llx_c_type_fees.sql | 3 +- .../mysql/tables/llx_c_type_resource.sql | 3 +- htdocs/install/mysql/tables/llx_c_typent.sql | 3 +- htdocs/install/mysql/tables/llx_c_units.sql | 3 +- 34 files changed, 133 insertions(+), 33 deletions(-) create mode 100644 htdocs/install/mysql/migration/15.0.0-16.0.0.sql diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql new file mode 100644 index 00000000000..9158aad8ae8 --- /dev/null +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -0,0 +1,67 @@ +-- +-- Be carefull to requests order. +-- This file must be loaded by calling /install/index.php page +-- when current version is 14.0.0 or higher. +-- +-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y +-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y +-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new; +-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; +-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); +-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; +-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60); +-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name; +-- To create a unique index ALTER TABLE llx_table ADD UNIQUE INDEX uk_table_field (field); +-- To drop an index: -- VMYSQL4.1 DROP INDEX nomindex on llx_table; +-- To drop an index: -- VPGSQL8.2 DROP INDEX nomindex; +-- To make pk to be auto increment (mysql): -- VMYSQL4.3 ALTER TABLE llx_table CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; +-- To make pk to be auto increment (postgres): +-- -- VPGSQL8.2 CREATE SEQUENCE llx_table_rowid_seq OWNED BY llx_table.rowid; +-- -- VPGSQL8.2 ALTER TABLE llx_table ADD PRIMARY KEY (rowid); +-- -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN rowid SET DEFAULT nextval('llx_table_rowid_seq'); +-- -- VPGSQL8.2 SELECT setval('llx_table_rowid_seq', MAX(rowid)) FROM llx_table; +-- To set a field as NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NULL; +-- To set a field as NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL; +-- To set a field as NOT NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NOT NULL; +-- To set a field as NOT NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET NOT NULL; +-- To set a field as default NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL; +-- Note: fields with type BLOB/TEXT can't have default value. +-- To rebuild sequence for postgresql after insert by forcing id autoincrement fields: +-- -- VPGSQL8.2 SELECT dol_util_rebuild_sequences(); + +-- Missing in v15 or lower + +ALTER TABLE llx_c_availability MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_civility MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_country MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_currencies MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_effectif MODIFY COLUMN libelle varchar(128); +ALTER TABLE llx_c_exp_tax_cat MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_hrm_department MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_hrm_function MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_input_reason MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_lead_status MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_paper_format MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_partnership_type MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_product_nature MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_productbatch_qcstatus MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_propalst MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_prospectcontactlevel MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_prospectlevel MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_recruitment_origin MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_shipment_package_type MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_type_container MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_type_fees MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_type_resource MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_units MODIFY COLUMN label varchar(128); +ALTER TABLE llx_c_actioncomm MODIFY COLUMN libelle varchar(128); +ALTER TABLE llx_c_barcode_type MODIFY COLUMN libelle varchar(128); +ALTER TABLE llx_c_chargesociales MODIFY COLUMN libelle varchar(128); +ALTER TABLE llx_c_input_method MODIFY COLUMN libelle varchar(128); +ALTER TABLE llx_c_paiement MODIFY COLUMN libelle varchar(128); +ALTER TABLE llx_c_shipment_mode MODIFY COLUMN libelle varchar(128); +ALTER TABLE llx_c_stcomm MODIFY COLUMN libelle varchar(128); +ALTER TABLE llx_c_stcommcontact MODIFY COLUMN libelle varchar(128); +ALTER TABLE llx_c_type_contact MODIFY COLUMN libelle varchar(128); +ALTER TABLE llx_c_typent MODIFY COLUMN libelle varchar(128); + diff --git a/htdocs/install/mysql/tables/llx_c_actioncomm.sql b/htdocs/install/mysql/tables/llx_c_actioncomm.sql index a2b2dffe8a7..4ccbf4a1340 100644 --- a/htdocs/install/mysql/tables/llx_c_actioncomm.sql +++ b/htdocs/install/mysql/tables/llx_c_actioncomm.sql @@ -2,6 +2,7 @@ -- Copyright (C) 2001-2002,2004 Rodolphe Quiedeville -- Copyright (C) 2004-2016 Laurent Destailleur -- Copyright (C) 2012 Florian Henry +-- Copyright (C) 2022 Juanjo Menent -- -- 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 @@ -23,7 +24,7 @@ create table llx_c_actioncomm id integer PRIMARY KEY, code varchar(50) NOT NULL, type varchar(50) DEFAULT 'system' NOT NULL, - libelle varchar(48) NOT NULL, + libelle varchar(128) NOT NULL, module varchar(50) DEFAULT NULL, active tinyint DEFAULT 1 NOT NULL, todo tinyint, -- deprecated diff --git a/htdocs/install/mysql/tables/llx_c_availability.sql b/htdocs/install/mysql/tables/llx_c_availability.sql index 4cdc8d6203c..b36d89870b4 100644 --- a/htdocs/install/mysql/tables/llx_c_availability.sql +++ b/htdocs/install/mysql/tables/llx_c_availability.sql @@ -1,6 +1,7 @@ -- ======================================================================== -- Copyright (C) 2011 Philippe GRAND -- Copyright (C) 2020 Alexandre SPANGARO +-- Copyright (C) 2022 Juanjo Menent -- -- 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 @@ -21,7 +22,7 @@ create table llx_c_availability ( rowid integer AUTO_INCREMENT PRIMARY KEY, code varchar(30) NOT NULL, - label varchar(60) NOT NULL, + label varchar(128) NOT NULL, active tinyint DEFAULT 1 NOT NULL, position integer NOT NULL DEFAULT 0 )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_barcode_type.sql b/htdocs/install/mysql/tables/llx_c_barcode_type.sql index fc76fab2dc9..3aaea7a5f59 100644 --- a/htdocs/install/mysql/tables/llx_c_barcode_type.sql +++ b/htdocs/install/mysql/tables/llx_c_barcode_type.sql @@ -1,6 +1,7 @@ -- ======================================================================== -- Copyright (C) 2007-2009 Regis Houssin -- Copyright (C) 2008 Laurent Destailleur +-- Copyright (C) 2022 Juanjo Menent -- -- 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 @@ -22,7 +23,7 @@ create table llx_c_barcode_type rowid integer AUTO_INCREMENT PRIMARY KEY, code varchar(16) NOT NULL, entity integer DEFAULT 1 NOT NULL, -- multi company id - libelle varchar(50) NOT NULL, + libelle varchar(128) NOT NULL, coder varchar(16) NOT NULL, example varchar(16) NOT NULL diff --git a/htdocs/install/mysql/tables/llx_c_chargesociales.sql b/htdocs/install/mysql/tables/llx_c_chargesociales.sql index 9da2976348f..78b87f95152 100644 --- a/htdocs/install/mysql/tables/llx_c_chargesociales.sql +++ b/htdocs/install/mysql/tables/llx_c_chargesociales.sql @@ -1,6 +1,7 @@ -- ======================================================================== -- Copyright (C) 2001-2002,2004 Rodolphe Quiedeville -- Copyright (C) 2004-2009 Laurent Destailleur +-- Copyright (C) 2022 Juanjo Menent -- -- 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 @@ -20,7 +21,7 @@ create table llx_c_chargesociales ( id integer AUTO_INCREMENT PRIMARY KEY, - libelle varchar(80), + libelle varchar(128), deductible smallint DEFAULT 0 NOT NULL, active tinyint DEFAULT 1 NOT NULL, code varchar(12) NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_c_civility.sql b/htdocs/install/mysql/tables/llx_c_civility.sql index 63fc8fca81f..9586101b254 100644 --- a/htdocs/install/mysql/tables/llx_c_civility.sql +++ b/htdocs/install/mysql/tables/llx_c_civility.sql @@ -1,6 +1,7 @@ -- ======================================================================== -- Copyright (C) 2004 Benoit Mortier -- Copyright (C) 2004 Laurent Destailleur +-- Copyright (C) 2022 Juanjo Menent -- -- 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 @@ -21,7 +22,7 @@ create table llx_c_civility ( rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, code varchar(6) NOT NULL, - label varchar(50), + label varchar(128), active tinyint DEFAULT 1 NOT NULL, module varchar(32) NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_country.sql b/htdocs/install/mysql/tables/llx_c_country.sql index 7f7ba0d4113..d97c3b90371 100644 --- a/htdocs/install/mysql/tables/llx_c_country.sql +++ b/htdocs/install/mysql/tables/llx_c_country.sql @@ -2,6 +2,7 @@ -- Copyright (C) 2001-2004 Rodolphe Quiedeville -- Copyright (C) 2004 Laurent Destailleur -- Copyright (C) 2014 Alexandre Spangaro +-- Copyright (C) 2022 Juanjo Menent -- -- 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 @@ -23,7 +24,7 @@ create table llx_c_country rowid integer PRIMARY KEY, code varchar(2) NOT NULL, code_iso varchar(3) , - label varchar(50) NOT NULL, + label varchar(128) NOT NULL, eec integer , active tinyint DEFAULT 1 NOT NULL, favorite tinyint DEFAULT 0 NOT NULL diff --git a/htdocs/install/mysql/tables/llx_c_currencies.sql b/htdocs/install/mysql/tables/llx_c_currencies.sql index 1943fa6eb41..d2d66236016 100644 --- a/htdocs/install/mysql/tables/llx_c_currencies.sql +++ b/htdocs/install/mysql/tables/llx_c_currencies.sql @@ -1,6 +1,7 @@ -- ======================================================================== -- Copyright (C) 2005 Laurent Destailleur -- Copyright (C) 2012 Regis Houssin +-- Copyright (C) 2022 Juanjo Menent -- -- 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 @@ -20,7 +21,7 @@ create table llx_c_currencies ( code_iso varchar(3) PRIMARY KEY, - label varchar(64) NOT NULL, + label varchar(128) NOT NULL, unicode varchar(32) DEFAULT NULL, active tinyint DEFAULT 1 NOT NULL diff --git a/htdocs/install/mysql/tables/llx_c_effectif.sql b/htdocs/install/mysql/tables/llx_c_effectif.sql index 26cab5c43da..dda78304fd9 100644 --- a/htdocs/install/mysql/tables/llx_c_effectif.sql +++ b/htdocs/install/mysql/tables/llx_c_effectif.sql @@ -1,6 +1,7 @@ -- ======================================================================== -- Copyright (C) 2001-2002,2004 Rodolphe Quiedeville -- Copyright (C) 2004 Laurent Destailleur +-- Copyright (C) 2022 Juanjo Menent -- -- 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 @@ -21,7 +22,7 @@ create table llx_c_effectif ( id integer PRIMARY KEY, code varchar(12) NOT NULL, - libelle varchar(30), + libelle varchar(128), active tinyint DEFAULT 1 NOT NULL, module varchar(32) NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_exp_tax_cat.sql b/htdocs/install/mysql/tables/llx_c_exp_tax_cat.sql index 90c60d87b97..6b106caa355 100644 --- a/htdocs/install/mysql/tables/llx_c_exp_tax_cat.sql +++ b/htdocs/install/mysql/tables/llx_c_exp_tax_cat.sql @@ -2,6 +2,7 @@ -- Copyright (C) 2012 Mikael Carlavan -- Copyright (C) 2017 ATM Consulting -- Copyright (C) 2017 Pierre-Henry Favre +-- Copyright (C) 2022 Juanjo Menent -- -- 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 @@ -20,7 +21,7 @@ CREATE TABLE IF NOT EXISTS llx_c_exp_tax_cat ( rowid integer AUTO_INCREMENT PRIMARY KEY, - label varchar(48) NOT NULL, + label varchar(128) NOT NULL, entity integer DEFAULT 1 NOT NULL, active integer DEFAULT 1 NOT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_hrm_department.sql b/htdocs/install/mysql/tables/llx_c_hrm_department.sql index 13380bf03b9..fbe6c67671c 100644 --- a/htdocs/install/mysql/tables/llx_c_hrm_department.sql +++ b/htdocs/install/mysql/tables/llx_c_hrm_department.sql @@ -1,6 +1,7 @@ -- -- Copyright (C) 2013 Jean-François Ferry -- Copyright (C) 2015 Alexandre Spangaro +-- Copyright (C) 2022 Juanjo Menent -- -- 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 @@ -20,7 +21,7 @@ create table llx_c_hrm_department rowid integer PRIMARY KEY, pos tinyint DEFAULT 0 NOT NULL, code varchar(16) NOT NULL, - label varchar(50), + label varchar(128), active tinyint DEFAULT 1 NOT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_hrm_function.sql b/htdocs/install/mysql/tables/llx_c_hrm_function.sql index 3d6fc37fc2b..558893ba8d6 100644 --- a/htdocs/install/mysql/tables/llx_c_hrm_function.sql +++ b/htdocs/install/mysql/tables/llx_c_hrm_function.sql @@ -1,6 +1,7 @@ -- -- Copyright (C) 2013 Jean-François Ferry -- Copyright (C) 2015 Alexandre Spangaro +-- Copyright (C) 2022 Juanjo Menent -- -- 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 @@ -20,7 +21,7 @@ create table llx_c_hrm_function rowid integer PRIMARY KEY, pos tinyint DEFAULT 0 NOT NULL, code varchar(16) NOT NULL, - label varchar(50), + label varchar(128), c_level tinyint DEFAULT 0 NOT NULL, active tinyint DEFAULT 1 NOT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_input_method.sql b/htdocs/install/mysql/tables/llx_c_input_method.sql index 40ed48f8fc6..fc77566e6bd 100644 --- a/htdocs/install/mysql/tables/llx_c_input_method.sql +++ b/htdocs/install/mysql/tables/llx_c_input_method.sql @@ -1,6 +1,7 @@ -- ======================================================================== -- Copyright (C) 2004-2005 Rodolphe Quiedeville -- Copyright (C) 2005-2009 Laurent Destailleur +-- Copyright (C) 2022 Juanjo Menent -- -- 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 @@ -21,7 +22,7 @@ create table llx_c_input_method ( rowid integer AUTO_INCREMENT PRIMARY KEY, code varchar(30), - libelle varchar(60), + libelle varchar(128), active tinyint default 1 NOT NULL, module varchar(32) NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_input_reason.sql b/htdocs/install/mysql/tables/llx_c_input_reason.sql index dba58dbbecc..f57a9a877ab 100644 --- a/htdocs/install/mysql/tables/llx_c_input_reason.sql +++ b/htdocs/install/mysql/tables/llx_c_input_reason.sql @@ -1,6 +1,7 @@ -- ======================================================================== -- Copyright (C) 2004-2005 Rodolphe Quiedeville -- Copyright (C) 2005-2009 Laurent Destailleur +-- Copyright (C) 2022 Juanjo Menent -- -- 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 @@ -23,7 +24,7 @@ create table llx_c_input_reason ( rowid integer AUTO_INCREMENT PRIMARY KEY, code varchar(30), - label varchar(60), + label varchar(128), active tinyint default 1 NOT NULL, module varchar(32) NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_lead_status.sql b/htdocs/install/mysql/tables/llx_c_lead_status.sql index 9027c0f6ca1..7905c5b6c05 100644 --- a/htdocs/install/mysql/tables/llx_c_lead_status.sql +++ b/htdocs/install/mysql/tables/llx_c_lead_status.sql @@ -1,5 +1,6 @@ -- Manage Lead -- Copyright (C) 2014 Florian HENRY +-- Copyright (C) 2022 Juanjo Menent -- -- 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 @@ -18,7 +19,7 @@ create table llx_c_lead_status ( rowid integer AUTO_INCREMENT PRIMARY KEY, code varchar(10), - label varchar(50), + label varchar(128), position integer, percent double(5,2), active tinyint DEFAULT 1 NOT NULL diff --git a/htdocs/install/mysql/tables/llx_c_paiement.sql b/htdocs/install/mysql/tables/llx_c_paiement.sql index 739d31e946d..535e5115e85 100644 --- a/htdocs/install/mysql/tables/llx_c_paiement.sql +++ b/htdocs/install/mysql/tables/llx_c_paiement.sql @@ -3,6 +3,7 @@ -- Copyright (C) 2004-2014 Laurent Destailleur -- Copyright (C) 2014 Alexandre Spangaro -- Copyright (C) 2017 Regis Houssin +-- Copyright (C) 2022 Juanjo Menent -- -- 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 @@ -24,7 +25,7 @@ create table llx_c_paiement id integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, -- multi company id code varchar(6) NOT NULL, - libelle varchar(62), + libelle varchar(128), type smallint, -- 0: input money, 1: output money, 2: input and output, 3: other active tinyint DEFAULT 1 NOT NULL, accountancy_code varchar(32) NULL, diff --git a/htdocs/install/mysql/tables/llx_c_paper_format.sql b/htdocs/install/mysql/tables/llx_c_paper_format.sql index 45c56ce379f..fd9fc672b68 100644 --- a/htdocs/install/mysql/tables/llx_c_paper_format.sql +++ b/htdocs/install/mysql/tables/llx_c_paper_format.sql @@ -1,5 +1,6 @@ -- ======================================================================== -- Copyright (C) 2007 Regis Houssin +-- Copyright (C) 2022 Juanjo Menent -- -- 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 @@ -20,7 +21,7 @@ create table llx_c_paper_format ( rowid integer AUTO_INCREMENT PRIMARY KEY, code varchar(16) NOT NULL, - label varchar(50) NOT NULL, + label varchar(128) NOT NULL, width float(6,2) DEFAULT 0, -- Largeur du papier height float(6,2) DEFAULT 0, -- Hauteur du papier unit varchar(5) NOT NULL, -- Mesure unit diff --git a/htdocs/install/mysql/tables/llx_c_partnership_type.sql b/htdocs/install/mysql/tables/llx_c_partnership_type.sql index d2a4a3b7549..99841f967cb 100644 --- a/htdocs/install/mysql/tables/llx_c_partnership_type.sql +++ b/htdocs/install/mysql/tables/llx_c_partnership_type.sql @@ -1,5 +1,6 @@ -- ======================================================================== -- Copyright (C) 2021 Laurent Destailleur +-- Copyright (C) 2022 Juanjo Menent -- -- 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 @@ -29,7 +30,7 @@ create table llx_c_partnership_type rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, code varchar(32) NOT NULL, - label varchar(64) NOT NULL, + label varchar(128) NOT NULL, active tinyint DEFAULT 1 NOT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_product_nature.sql b/htdocs/install/mysql/tables/llx_c_product_nature.sql index 3c467ce7cf8..e2efdf2a981 100644 --- a/htdocs/install/mysql/tables/llx_c_product_nature.sql +++ b/htdocs/install/mysql/tables/llx_c_product_nature.sql @@ -1,5 +1,7 @@ -- ======================================================================== -- Copyright (C) 2020 Florian HENRY +-- Copyright (C) 2022 Juanjo Menent + -- -- 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 @@ -19,6 +21,6 @@ CREATE TABLE llx_c_product_nature ( rowid integer AUTO_INCREMENT PRIMARY KEY, code tinyint NOT NULL, - label varchar(100), + label varchar(128), active tinyint DEFAULT 1 NOT NULL ) ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_productbatch_qcstatus.sql b/htdocs/install/mysql/tables/llx_c_productbatch_qcstatus.sql index 73daa56067a..06a2a76220d 100644 --- a/htdocs/install/mysql/tables/llx_c_productbatch_qcstatus.sql +++ b/htdocs/install/mysql/tables/llx_c_productbatch_qcstatus.sql @@ -1,5 +1,6 @@ -- ======================================================================== -- Copyright (C) 2012-2017 Noé Cendrier +-- Copyright (C) 2022 Juanjo Menent -- -- 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 @@ -21,6 +22,6 @@ CREATE TABLE llx_c_productbatch_qcstatus rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer NOT NULL DEFAULT 1, code varchar(16) NOT NULL, - label varchar(50) NOT NULL, + label varchar(128) NOT NULL, active integer DEFAULT 1 NOT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_propalst.sql b/htdocs/install/mysql/tables/llx_c_propalst.sql index 2a107b52735..7b3351a52b8 100644 --- a/htdocs/install/mysql/tables/llx_c_propalst.sql +++ b/htdocs/install/mysql/tables/llx_c_propalst.sql @@ -1,6 +1,7 @@ -- =================================================================== -- Copyright (C) 2001-2002,2004 Rodolphe Quiedeville -- Copyright (C) 2004 Laurent Destailleur +-- Copyright (C) 2022 Juanjo Menent -- -- 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 @@ -21,7 +22,7 @@ create table llx_c_propalst ( id smallint PRIMARY KEY, code varchar(12) NOT NULL, - label varchar(30), + label varchar(128), active tinyint DEFAULT 1 NOT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_prospectcontactlevel.sql b/htdocs/install/mysql/tables/llx_c_prospectcontactlevel.sql index 421b3452371..b9efe7967ad 100644 --- a/htdocs/install/mysql/tables/llx_c_prospectcontactlevel.sql +++ b/htdocs/install/mysql/tables/llx_c_prospectcontactlevel.sql @@ -1,5 +1,6 @@ -- =================================================================== -- Copyright (C) 2020 Open-Dsi +-- Copyright (C) 2022 Juanjo Menent -- -- 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 @@ -19,7 +20,7 @@ create table llx_c_prospectcontactlevel ( code varchar(12) PRIMARY KEY, - label varchar(30), + label varchar(128), sortorder smallint, active smallint DEFAULT 1 NOT NULL, module varchar(32) NULL diff --git a/htdocs/install/mysql/tables/llx_c_prospectlevel.sql b/htdocs/install/mysql/tables/llx_c_prospectlevel.sql index 70e26dc3a26..31d3abcb5bc 100644 --- a/htdocs/install/mysql/tables/llx_c_prospectlevel.sql +++ b/htdocs/install/mysql/tables/llx_c_prospectlevel.sql @@ -1,5 +1,6 @@ -- =================================================================== -- Copyright (C) 2008 Laurent Destailleur +-- Copyright (C) 2022 Juanjo Menent -- -- 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 @@ -19,7 +20,7 @@ create table llx_c_prospectlevel ( code varchar(12) PRIMARY KEY, - label varchar(30), + label varchar(128), sortorder smallint, active smallint DEFAULT 1 NOT NULL, module varchar(32) NULL diff --git a/htdocs/install/mysql/tables/llx_c_recruitment_origin.sql b/htdocs/install/mysql/tables/llx_c_recruitment_origin.sql index b18f7eb383c..2d1c6682900 100644 --- a/htdocs/install/mysql/tables/llx_c_recruitment_origin.sql +++ b/htdocs/install/mysql/tables/llx_c_recruitment_origin.sql @@ -1,5 +1,6 @@ -- ======================================================================== -- Copyright (C) 2005-2016 Laurent Destailleur +-- Copyright (C) 2022 Juanjo Menent -- -- 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 @@ -28,6 +29,6 @@ create table llx_c_recruitment_origin ( rowid integer AUTO_INCREMENT PRIMARY KEY, code varchar(32) NOT NULL, - label varchar(64) NOT NULL, + label varchar(128) NOT NULL, active tinyint DEFAULT 1 NOT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_shipment_mode.sql b/htdocs/install/mysql/tables/llx_c_shipment_mode.sql index 6f49f682f24..4f0d584d6d7 100644 --- a/htdocs/install/mysql/tables/llx_c_shipment_mode.sql +++ b/htdocs/install/mysql/tables/llx_c_shipment_mode.sql @@ -1,5 +1,6 @@ -- =================================================================== -- Copyright (C) 2003 Rodolphe Quiedeville +-- Copyright (C) 2022 Juanjo Menent -- -- 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 @@ -22,7 +23,7 @@ create table llx_c_shipment_mode entity integer DEFAULT 1 NOT NULL, -- multi company id tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, code varchar(30) NOT NULL, - libelle varchar(50) NOT NULL, + libelle varchar(128) NOT NULL, description text, tracking varchar(255) NULL, active tinyint DEFAULT 0, diff --git a/htdocs/install/mysql/tables/llx_c_shipment_package_type.sql b/htdocs/install/mysql/tables/llx_c_shipment_package_type.sql index e510352eba2..92dd861fd49 100644 --- a/htdocs/install/mysql/tables/llx_c_shipment_package_type.sql +++ b/htdocs/install/mysql/tables/llx_c_shipment_package_type.sql @@ -2,7 +2,7 @@ create table llx_c_shipment_package_type ( rowid integer AUTO_INCREMENT PRIMARY KEY, - label varchar(50) NOT NULL, -- Short name + label varchar(128) NOT NULL, -- Short name description varchar(255), -- Description active integer DEFAULT 1 NOT NULL, -- Active or not entity integer DEFAULT 1 NOT NULL -- Multi company id diff --git a/htdocs/install/mysql/tables/llx_c_stcomm.sql b/htdocs/install/mysql/tables/llx_c_stcomm.sql index 5f31666b28c..aa5d58a280f 100644 --- a/htdocs/install/mysql/tables/llx_c_stcomm.sql +++ b/htdocs/install/mysql/tables/llx_c_stcomm.sql @@ -1,6 +1,7 @@ -- ======================================================================== -- Copyright (C) 2001-2002,2004 Rodolphe Quiedeville -- Copyright (C) 2004-2015 Laurent Destailleur +-- Copyright (C) 2022 Juanjo Menent -- -- 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 @@ -21,7 +22,7 @@ create table llx_c_stcomm ( id integer PRIMARY KEY, code varchar(12) NOT NULL, - libelle varchar(30), + libelle varchar(128), picto varchar(128), active tinyint default 1 NOT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_stcommcontact.sql b/htdocs/install/mysql/tables/llx_c_stcommcontact.sql index c906e4f5103..7ab74e123f6 100644 --- a/htdocs/install/mysql/tables/llx_c_stcommcontact.sql +++ b/htdocs/install/mysql/tables/llx_c_stcommcontact.sql @@ -1,5 +1,6 @@ -- ======================================================================== -- Copyright (C) 2020 Open-Dsi +-- Copyright (C) 2022 Juanjo Menent -- -- 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 @@ -20,7 +21,7 @@ create table llx_c_stcommcontact ( id integer PRIMARY KEY, code varchar(12) NOT NULL, - libelle varchar(30), + libelle varchar(128), picto varchar(128), active tinyint default 1 NOT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_type_contact.sql b/htdocs/install/mysql/tables/llx_c_type_contact.sql index c222b0fe273..4b12661657e 100644 --- a/htdocs/install/mysql/tables/llx_c_type_contact.sql +++ b/htdocs/install/mysql/tables/llx_c_type_contact.sql @@ -1,6 +1,7 @@ -- ======================================================================== -- Copyright (C) 2005 Patrick Rouillon -- Copyright (C) 2005 Laurent Destailleur +-- Copyright (C) 2022 Juanjo Menent -- -- 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 @@ -32,7 +33,7 @@ create table llx_c_type_contact element varchar(30) NOT NULL, source varchar(8) DEFAULT 'external' NOT NULL, code varchar(32) NOT NULL, - libelle varchar(64) NOT NULL, + libelle varchar(128) NOT NULL, active tinyint DEFAULT 1 NOT NULL, module varchar(32) NULL, position integer NOT NULL DEFAULT 0 diff --git a/htdocs/install/mysql/tables/llx_c_type_container.sql b/htdocs/install/mysql/tables/llx_c_type_container.sql index 53a89fe873b..6de3d041669 100644 --- a/htdocs/install/mysql/tables/llx_c_type_container.sql +++ b/htdocs/install/mysql/tables/llx_c_type_container.sql @@ -1,5 +1,6 @@ -- ======================================================================== -- Copyright (C) 2018 Laurent Destailleur +-- Copyright (C) 2022 Juanjo Menent -- -- -- This program is free software; you can redistribute it and/or modify @@ -30,7 +31,7 @@ create table llx_c_type_container rowid integer AUTO_INCREMENT PRIMARY KEY, code varchar(32) NOT NULL, entity integer DEFAULT 1 NOT NULL, -- multi company id - label varchar(64) NOT NULL, + label varchar(128) NOT NULL, module varchar(32) NULL, active tinyint DEFAULT 1 NOT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_type_fees.sql b/htdocs/install/mysql/tables/llx_c_type_fees.sql index 3f9c49c95d7..d620e38cf69 100644 --- a/htdocs/install/mysql/tables/llx_c_type_fees.sql +++ b/htdocs/install/mysql/tables/llx_c_type_fees.sql @@ -2,6 +2,7 @@ -- Copyright (C) 2001-2002,2004 Rodolphe Quiedeville -- Copyright (C) 2004 Laurent Destailleur -- Copyright (C) 2014 Alexandre Spangaro +-- Copyright (C) 2022 Juanjo Menent -- -- 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 @@ -23,7 +24,7 @@ create table llx_c_type_fees ( id integer AUTO_INCREMENT PRIMARY KEY, code varchar(12) NOT NULL, - label varchar(30), + label varchar(128), type integer DEFAULT 0, -- 0=type product, 1=type service accountancy_code varchar(32) NULL, active tinyint DEFAULT 1 NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_c_type_resource.sql b/htdocs/install/mysql/tables/llx_c_type_resource.sql index e490755b1f7..f88f502a038 100644 --- a/htdocs/install/mysql/tables/llx_c_type_resource.sql +++ b/htdocs/install/mysql/tables/llx_c_type_resource.sql @@ -1,5 +1,6 @@ -- ======================================================================== -- Copyright (C) 2014 Jean-François Ferry +-- Copyright (C) 2022 Juanjo Menent -- -- -- This program is free software; you can redistribute it and/or modify @@ -29,6 +30,6 @@ create table llx_c_type_resource ( rowid integer AUTO_INCREMENT PRIMARY KEY, code varchar(32) NOT NULL, - label varchar(64) NOT NULL, + label varchar(128) NOT NULL, active tinyint DEFAULT 1 NOT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_c_typent.sql b/htdocs/install/mysql/tables/llx_c_typent.sql index 0b15e70b15b..69253f98857 100644 --- a/htdocs/install/mysql/tables/llx_c_typent.sql +++ b/htdocs/install/mysql/tables/llx_c_typent.sql @@ -1,6 +1,7 @@ -- ======================================================================== -- Copyright (C) 2001-2002,2004 Rodolphe Quiedeville -- Copyright (C) 2004 Laurent Destailleur +-- Copyright (C) 2022 Juanjo Menent -- -- 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 @@ -21,7 +22,7 @@ create table llx_c_typent ( id integer PRIMARY KEY, code varchar(12) NOT NULL, - libelle varchar(64), + libelle varchar(128), fk_country integer NULL, -- Defined only to have specific list for countries that can't use generic list (like argentina that need type A or B) active tinyint DEFAULT 1 NOT NULL, module varchar(32) NULL, diff --git a/htdocs/install/mysql/tables/llx_c_units.sql b/htdocs/install/mysql/tables/llx_c_units.sql index 7b2424a8f54..94046d25b87 100644 --- a/htdocs/install/mysql/tables/llx_c_units.sql +++ b/htdocs/install/mysql/tables/llx_c_units.sql @@ -2,6 +2,7 @@ -- Copyright (C) 2001-2002,2004 Rodolphe Quiedeville -- Copyright (C) 2004 Laurent Destailleur -- Copyright (C) 2012 Cédric Salvador +-- Copyright (C) 2022 Juanjo Menent -- -- 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 @@ -23,7 +24,7 @@ create table llx_c_units( code varchar(3), sortorder smallint, scale integer, - label varchar(50), + label varchar(128), short_label varchar(5), unit_type varchar(10), active tinyint DEFAULT 1 NOT NULL From 59921d60b3d1840d768daa45a8f1a6187c828384 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 21 Jan 2022 13:38:59 +0100 Subject: [PATCH 02/23] Length label control --- htdocs/admin/dict.php | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 5245e60ad67..0b2404050e6 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2018 Laurent Destailleur * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2017 Regis Houssin - * Copyright (C) 2010-2016 Juanjo Menent + * Copyright (C) 2010-2022 Juanjo Menent * Copyright (C) 2011-2021 Philippe Grand * Copyright (C) 2011 Remy Younes * Copyright (C) 2012-2015 Marcos García @@ -2408,6 +2408,33 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') $fieldValue = '0'; } } + + // Labels Length + $maxlength = ''; + if (in_array($fieldlist[$field], array('libelle', 'label'))) { + if ($fieldlist[$field] == 'label' || $fieldlist[$field] == 'libelle') { + switch ($tabname) { + case MAIN_DB_PREFIX . 'c_accounting_category': + case MAIN_DB_PREFIX . 'c_ecotaxe': + case MAIN_DB_PREFIX . 'c_email_senderprofile': + case MAIN_DB_PREFIX . 'c_forme_juridique': + case MAIN_DB_PREFIX . 'c_holiday_types': + case MAIN_DB_PREFIX . 'c_payment_term': + case MAIN_DB_PREFIX . 'c_transport_mode': + $maxlength = ' maxlength="255"'; + break; + case MAIN_DB_PREFIX . 'c_email_templates': + $maxlength = ' maxlength="180"'; + break; + case MAIN_DB_PREFIX . 'c_socialnetworks': + $maxlength = ' maxlength="150"'; + break; + default: + $maxlength = ' maxlength="128"'; + } + } + } + print ''; $transfound = 0; $transkey = ''; @@ -2426,7 +2453,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') } } if (!$transfound) { - print ''; + print ''; } else { print ''; } From 18e308e800e0899d1b52ff67a3b2245a40c9e11e Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 21 Jan 2022 13:47:20 +0100 Subject: [PATCH 03/23] remove leftover if --- htdocs/admin/dict.php | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 0b2404050e6..954b3e632ca 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -2412,26 +2412,24 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') // Labels Length $maxlength = ''; if (in_array($fieldlist[$field], array('libelle', 'label'))) { - if ($fieldlist[$field] == 'label' || $fieldlist[$field] == 'libelle') { - switch ($tabname) { - case MAIN_DB_PREFIX . 'c_accounting_category': - case MAIN_DB_PREFIX . 'c_ecotaxe': - case MAIN_DB_PREFIX . 'c_email_senderprofile': - case MAIN_DB_PREFIX . 'c_forme_juridique': - case MAIN_DB_PREFIX . 'c_holiday_types': - case MAIN_DB_PREFIX . 'c_payment_term': - case MAIN_DB_PREFIX . 'c_transport_mode': - $maxlength = ' maxlength="255"'; - break; - case MAIN_DB_PREFIX . 'c_email_templates': - $maxlength = ' maxlength="180"'; - break; - case MAIN_DB_PREFIX . 'c_socialnetworks': - $maxlength = ' maxlength="150"'; - break; - default: - $maxlength = ' maxlength="128"'; - } + switch ($tabname) { + case MAIN_DB_PREFIX . 'c_accounting_category': + case MAIN_DB_PREFIX . 'c_ecotaxe': + case MAIN_DB_PREFIX . 'c_email_senderprofile': + case MAIN_DB_PREFIX . 'c_forme_juridique': + case MAIN_DB_PREFIX . 'c_holiday_types': + case MAIN_DB_PREFIX . 'c_payment_term': + case MAIN_DB_PREFIX . 'c_transport_mode': + $maxlength = ' maxlength="255"'; + break; + case MAIN_DB_PREFIX . 'c_email_templates': + $maxlength = ' maxlength="180"'; + break; + case MAIN_DB_PREFIX . 'c_socialnetworks': + $maxlength = ' maxlength="150"'; + break; + default: + $maxlength = ' maxlength="128"'; } } From 84d446cf73ec1e14432253ebd2ff3ebc7b5b2d57 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Fri, 21 Jan 2022 15:31:30 +0100 Subject: [PATCH 04/23] NEW possibility to consume multiple batch --- htdocs/mrp/js/lib_dispatch.js.php | 6 ++++-- htdocs/mrp/mo_production.php | 16 ++++++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/htdocs/mrp/js/lib_dispatch.js.php b/htdocs/mrp/js/lib_dispatch.js.php index 8a5eef60211..aa29b38c5fb 100644 --- a/htdocs/mrp/js/lib_dispatch.js.php +++ b/htdocs/mrp/js/lib_dispatch.js.php @@ -70,10 +70,12 @@ function addDispatchLine(index, type, mode) mode = mode || 'qtymissing' console.log("fourn/js/lib_dispatch.js.php Split line type="+type+" index="+index+" mode="+mode); + if(mode == 'qtymissingconsume') var inputId = 'qtytoconsume'; + else var inputId = 'qtytoproduce'; var nbrTrs = $("tr[name^='"+type+"_"+index+"']").length; // position of line for batch var $row = $("tr[name='"+type+'_'+index+"_1']").clone(true); // clone last batch line to jQuery object var qtyOrdered = parseFloat($("#qty_ordered_"+index).val()); // Qty ordered is same for all rows - var qty = parseFloat($("#qtytoproduce-"+index+"-"+nbrTrs).val()); + var qty = parseFloat($("#"+inputId+"-"+index+"-"+nbrTrs).val()); var qtyDispatched; if (mode === 'lessone') @@ -83,7 +85,7 @@ function addDispatchLine(index, type, mode) else { qtyDispatched = parseFloat($("#qty_dispatched_"+index).val()) + qty; - console.log(qty); + console.log($("#qty_dispatched_"+index).val()); // If user did not reduced the qty to dispatch on old line, we keep only 1 on old line and the rest on new line if (qtyDispatched == qtyOrdered && qtyDispatched > 1) { qtyDispatched = parseFloat($("#qty_dispatched_"+index).val()) + 1; diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index ca9480eb1ae..fa5897bb5f0 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -811,6 +811,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $alreadyconsumed += $line2['qty']; } + $suffix = '_'.$line->id; + print ''."\n"; + // hidden fields for js function + print ''; + print ''; + print ''; print ''.$tmpproduct->getNomUrl(1); print '
'.$tmpproduct->label.''; @@ -914,13 +920,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) { $i = 1; print ''."\n"; - print ''; + print ''; print ''.$langs->trans("ToConsume").''; $preselected = (GETPOSTISSET('qty-'.$line->id.'-'.$i) ? GETPOST('qty-'.$line->id.'-'.$i) : max(0, $line->qty - $alreadyconsumed)); if ($action == 'consumeorproduce' && !GETPOSTISSET('qty-'.$line->id.'-'.$i)) { $preselected = 0; } - print ''; + print ''; if ($permissiontoupdatecost && !empty($conf->global->MRP_SHOW_COST_FOR_CONSUMPTION)) { print ''; } @@ -945,6 +951,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; } print ''; + print ''; + if ($tmpproduct->status_batch) { + $type = 'batch'; + print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'class="splitbutton" onClick="addDispatchLine('.$line->id.', \''.$type.'\', \'qtymissingconsume\')"'); + } + print ''; } print ''; } From c131bdcbd307301a70d28f165d62410216bf9071 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Mon, 24 Jan 2022 16:06:02 +0100 Subject: [PATCH 05/23] NEW : Add hooks on salaries and sociales card --- htdocs/compta/sociales/card.php | 28 +++++++++++++++++++++++++--- htdocs/salaries/card.php | 20 +++++++++++++++++--- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 7454f61f6de..f0dd02eac80 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -56,6 +56,9 @@ $label = GETPOST('label', 'alpha'); $actioncode = GETPOST('actioncode'); $fk_user = GETPOST('userid', 'int'); +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('propalcard', 'globalcard')); + $object = new ChargeSociales($db); if ($id > 0) { $object->fetch($id); @@ -74,6 +77,12 @@ $result = restrictedArea($user, 'tax', $object->id, 'chargesociales', 'charges') * Actions */ +$parameters = array('socid' => $socid); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} + // Classify paid if ($action == 'confirm_paid' && $user->rights->tax->charges->creer && $confirm == 'yes') { $object->fetch($id); @@ -416,6 +425,8 @@ if ($id > 0) { $object = new ChargeSociales($db); $result = $object->fetch($id); + $formconfirm = ''; + if ($result > 0) { $head = tax_prepare_head($object); @@ -433,25 +444,36 @@ if ($id > 0) { $formquestion[] = array('type' => 'date', 'name' => 'clone_period', 'label' => $langs->trans("PeriodEndDate"), 'value' => -1); } - print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneTax', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 240); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneTax', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 240); } if ($action == 'paid') { $text = $langs->trans('ConfirmPaySocialContribution'); - print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans('PaySocialContribution'), $text, "confirm_paid", '', '', 2); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans('PaySocialContribution'), $text, "confirm_paid", '', '', 2); } // Confirmation of the removal of the Social Contribution if ($action == 'delete') { $text = $langs->trans('ConfirmDeleteSocialContribution'); - print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('DeleteSocialContribution'), $text, 'confirm_delete', '', '', 2); + $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('DeleteSocialContribution'), $text, 'confirm_delete', '', '', 2); } if ($action == 'edit') { print "
id&action=update\" method=\"post\">"; print ''; } + // Call Hook formConfirm + $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid); + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) { + $formconfirm .= $hookmanager->resPrint; + } elseif ($reshook > 0) { + $formconfirm = $hookmanager->resPrint; + } + + // Print form confirm + print $formconfirm; print dol_get_fiche_head($head, 'card', $langs->trans("SocialContribution"), -1, 'bill'); diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index f5ebbcf0ec6..dc1a98209f4 100755 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -647,6 +647,7 @@ if ($action == 'create') { if ($id) { $head = salaries_prepare_head($object); + $formconfirm = ''; if ($action === 'clone') { $formquestion = array( @@ -657,17 +658,17 @@ if ($id) { $formquestion[] = array('type' => 'date', 'name' => 'clone_date_start', 'label' => $langs->trans("DateStart"), 'value' => -1); $formquestion[] = array('type' => 'date', 'name' => 'clone_date_end', 'label' => $langs->trans("DateEnd"), 'value' => -1); - print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneSalary', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 240); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneSalary', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 240); } if ($action == 'paid') { $text = $langs->trans('ConfirmPaySalary'); - print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans('PaySalary'), $text, "confirm_paid", '', '', 2); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans('PaySalary'), $text, "confirm_paid", '', '', 2); } if ($action == 'delete') { $text = $langs->trans('ConfirmDeleteSalary'); - print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('DeleteSalary'), $text, 'confirm_delete', '', '', 2); + $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('DeleteSalary'), $text, 'confirm_delete', '', '', 2); } if ($action == 'edit') { @@ -675,6 +676,19 @@ if ($id) { print ''; } + // Call Hook formConfirm + $parameters = array('formConfirm' => $formconfirm); + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) { + $formconfirm .= $hookmanager->resPrint; + } elseif ($reshook > 0) { + $formconfirm = $hookmanager->resPrint; + } + + // Print form confirm + print $formconfirm; + + print dol_get_fiche_head($head, 'card', $langs->trans("SalaryPayment"), -1, 'salary'); $linkback = ''.$langs->trans("BackToList").''; From 6cb97b1346fdbbebc08cf0ea477517d84d9171a4 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 24 Jan 2022 15:13:40 +0000 Subject: [PATCH 06/23] Fixing style errors. --- htdocs/compta/sociales/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index f0dd02eac80..d1ef5c1ea08 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -426,7 +426,7 @@ if ($id > 0) { $result = $object->fetch($id); $formconfirm = ''; - + if ($result > 0) { $head = tax_prepare_head($object); From 37338f9a6025b4f0a2f671f3dbcb6f217bf9e1c6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Jan 2022 14:03:29 +0100 Subject: [PATCH 07/23] Update card.php --- htdocs/compta/sociales/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index d1ef5c1ea08..888d3c77d6c 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -57,7 +57,7 @@ $actioncode = GETPOST('actioncode'); $fk_user = GETPOST('userid', 'int'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('propalcard', 'globalcard')); +$hookmanager->initHooks(array('taxcard', 'globalcard')); $object = new ChargeSociales($db); if ($id > 0) { From ecc4a7c1ae899ff5a5d2d683fc569430c92deadd Mon Sep 17 00:00:00 2001 From: Markusi13 Date: Tue, 25 Jan 2022 14:55:34 +0100 Subject: [PATCH 08/23] Updated the old issue form to the new yml format --- .github/ISSUE_TEMPLATE/bug_report.md | 35 ------------ .github/ISSUE_TEMPLATE/bug_report.yml | 81 +++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 35 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 432f30f2332..00000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -name: Bug report -about: Create a report to help us fix something that is broken -title: '' -labels: Bug -assignees: '' - ---- - -# Instructions -*This is a template to help you report good issues. You may use [Github Markdown](https://help.github.com/articles/getting-started-with-writing-and-formatting-on-github/) syntax to format your issue report.* -*Please:* -- *replace the bracket enclosed texts with meaningful information* -- *remove any unused sub-section* - - -# Bug -[*Short description*] - -## Environment -- **Version**: [*Affected Dolibarr version(s)*] -- **OS**: [*Server OS type and version*] -- **Web server**: [*Webserver type and version*] -- **PHP**: [*PHP version*] -- **Database**: [*Database type and version*] -- **URL(s)**: [*Affected URL(s)*] - -## Expected and actual behavior -[*Verbose description*] - -## Steps to reproduce the behavior -[*Verbose description*] - -## [Attached files](https://help.github.com/articles/issue-attachments) (Screenshots, screencasts, dolibarr.log, debugging informations…) -[*Files*] diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 00000000000..23948ad189c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,81 @@ +name: Bug report +description: Create a report to help us fix something that is broken +title: '' +labels: ["Bug"] + +body: + - type: markdown + attributes: + value: | + This is a template to help you report good issues. You may use [Github Markdown](https://help.github.com/articles/getting-started-with-writing-and-formatting-on-github/) syntax to format your issue report. + + - type: textarea + id: bug + attributes: + label: Bug + description: Please give a short description of the bug + validations: + required: true + + - type: input + id: environmentversion + attributes: + label: Environment Version + description: Affected Dolibarr version(s) + + - type: input + id: environmentos + attributes: + label: Environment OS + description: Server OS type and version + + - type: input + id: environmentwebserver + attributes: + label: Environment Web server + description: Webserver type and version + + - type: input + id: environmentphp + attributes: + label: Environment PHP + description: PHP version + + - type: input + id: environmentdatabase + attributes: + label: Environment Database + description: Database type and version + + - type: input + id: environmenturls + attributes: + label: Environment URL(s) + description: Affected URL(s) + + - type: textarea + id: expectedbehaviour + attributes: + label: Expected and actual behavior + description: Verbose description + + - type: textarea + id: reproduce + attributes: + label: Steps to reproduce the behavior + description: Verbose description + + - type: textarea + id: files + attributes: + label: Attached files + description: Screenshots, screencasts, dolibarr.log, debugging informations + + - type: checkboxes + id: terms + attributes: + label: Code of Conduct + description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CODE_OF_CONDUCT.md) + options: + - label: I agree to follow this project's Code of Conduct + required: true From 7efa219e33e4aa6b17c6bcbaee916c688002167b Mon Sep 17 00:00:00 2001 From: Markusi13 Date: Tue, 25 Jan 2022 14:55:52 +0100 Subject: [PATCH 09/23] Update bug_report.yml --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 23948ad189c..2459458dc90 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,6 +1,6 @@ name: Bug report description: Create a report to help us fix something that is broken -title: '' +title: labels: ["Bug"] body: From 688e74aad877bdcb9966acd4a73083c20db093a0 Mon Sep 17 00:00:00 2001 From: Markusi13 Date: Tue, 25 Jan 2022 14:56:01 +0100 Subject: [PATCH 10/23] Update bug_report.yml --- .github/ISSUE_TEMPLATE/bug_report.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 2459458dc90..b215dc62f9c 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,6 +1,5 @@ name: Bug report description: Create a report to help us fix something that is broken -title: labels: ["Bug"] body: From ea6dfb172c4f94c8afe9ed6c74d82e34f7682e5e Mon Sep 17 00:00:00 2001 From: Markusi13 Date: Tue, 25 Jan 2022 15:01:29 +0100 Subject: [PATCH 11/23] Update the feature request template to the new yml format --- .github/ISSUE_TEMPLATE/feature_request.md | 27 ------------- .github/ISSUE_TEMPLATE/feature_request.yml | 44 ++++++++++++++++++++++ 2 files changed, 44 insertions(+), 27 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 32e2deff2c1..00000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -name: Feature request -about: Suggest a new idea for this project -title: '' -labels: Feature request -assignees: '' - ---- - -# Instructions -*This is a template to help you report good issues. You may use [Github Markdown](https://help.github.com/articles/getting-started-with-writing-and-formatting-on-github/) syntax to format your issue report.* -*Please:* -- *replace the bracket enclosed texts with meaningful information* -- *remove any unused sub-section* - - -# Feature Request -[*Short description*] - -## Use case -[*Verbose description*] - -## Suggested implementation -[*Verbose description*] - -## Suggested steps -[*List of tasks to achieve goal*] diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 00000000000..f4975622a8f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,44 @@ +name: Feature request +description: Suggest a new idea for this project +labels: ["Feature request"] + +body: + - type: markdown + attributes: + value: | + This is a template to help you report good issues. You may use [Github Markdown](https://help.github.com/articles/getting-started-with-writing-and-formatting-on-github/) syntax to format your issue report. + + - type: textarea + id: feature-request + attributes: + label: Feature Request + description: Short description + validations: + required: true + + - type: textarea + id: use-case + attributes: + label: Use case + description: Verbose description + + - type: textarea + id: suggested-implementation + attributes: + label: Suggested implementation + description: Verbose description + + - type: textarea + id: suggested-steps + attributes: + label: Suggested steps + description: List of tasks to achieve goal + + - type: checkboxes + id: terms + attributes: + label: Code of Conduct + description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CODE_OF_CONDUCT.md) + options: + - label: I agree to follow this project's Code of Conduct + required: true From 4ab28b10ea0f4556cb4413fa674523433516e0f3 Mon Sep 17 00:00:00 2001 From: Markusi13 Date: Tue, 25 Jan 2022 15:02:11 +0100 Subject: [PATCH 12/23] Update bug_report.yml --- .github/ISSUE_TEMPLATE/bug_report.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index b215dc62f9c..7e7a62c1e84 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -17,43 +17,43 @@ body: required: true - type: input - id: environmentversion + id: environment-version attributes: label: Environment Version description: Affected Dolibarr version(s) - type: input - id: environmentos + id: environment-os attributes: label: Environment OS description: Server OS type and version - type: input - id: environmentwebserver + id: environment-webserver attributes: label: Environment Web server description: Webserver type and version - type: input - id: environmentphp + id: environment-php attributes: label: Environment PHP description: PHP version - type: input - id: environmentdatabase + id: environment-database attributes: label: Environment Database description: Database type and version - type: input - id: environmenturls + id: environment-urls attributes: label: Environment URL(s) description: Affected URL(s) - type: textarea - id: expectedbehaviour + id: expected-behaviour attributes: label: Expected and actual behavior description: Verbose description From 4de5ee97b35dd4a18297b9bff18a692d9c3e7ef7 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Tue, 25 Jan 2022 16:37:33 +0100 Subject: [PATCH 13/23] NEW : split consumption line on MO --- htdocs/mrp/js/lib_dispatch.js.php | 36 ++++++++++++++++++------------- htdocs/mrp/mo_production.php | 2 +- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/htdocs/mrp/js/lib_dispatch.js.php b/htdocs/mrp/js/lib_dispatch.js.php index aa29b38c5fb..d8285ac75c1 100644 --- a/htdocs/mrp/js/lib_dispatch.js.php +++ b/htdocs/mrp/js/lib_dispatch.js.php @@ -70,8 +70,14 @@ function addDispatchLine(index, type, mode) mode = mode || 'qtymissing' console.log("fourn/js/lib_dispatch.js.php Split line type="+type+" index="+index+" mode="+mode); - if(mode == 'qtymissingconsume') var inputId = 'qtytoconsume'; - else var inputId = 'qtytoproduce'; + if(mode == 'qtymissingconsume') { + var inputId = 'qtytoconsume'; + var warehouseId = 'idwarehouse'; + } + else { + var inputId = 'qtytoproduce'; + var warehouseId = 'idwarehousetoproduce'; + } var nbrTrs = $("tr[name^='"+type+"_"+index+"']").length; // position of line for batch var $row = $("tr[name='"+type+'_'+index+"_1']").clone(true); // clone last batch line to jQuery object var qtyOrdered = parseFloat($("#qty_ordered_"+index).val()); // Qty ordered is same for all rows @@ -105,11 +111,11 @@ function addDispatchLine(index, type, mode) $row.html($row.html().replace(re1, '_'+index+'_'+(nbrTrs+1))); $row.html($row.html().replace(re2, '-'+index+'-'+(nbrTrs+1))); //create new select2 to avoid duplicate id of cloned one - $row.find("select[name='"+'idwarehousetoproduce-'+index+'-'+(nbrTrs+1)+"']").select2(); + $row.find("select[name='"+warehouseId+'-'+index+'-'+(nbrTrs+1)+"']").select2(); // TODO find solution to copy selected option to new select // TODO find solution to keep new tr's after page refresh //clear value - $row.find("input[name^='qtytoproduce']").val(''); + $row.find("input[id^='"+inputId+"']").val(''); //change name of new row $row.attr('name',type+'_'+index+'_'+(nbrTrs+1)); //insert new row before last row @@ -120,20 +126,20 @@ function addDispatchLine(index, type, mode) $(".csswarehouse_"+index+"_"+(nbrTrs+1)+":first-child").parent("span.selection").parent(".select2").detach(); /* Suffix of lines are: index _ trs.length */ - $("#qtytoproduce-"+index+"-"+(nbrTrs+1)).focus(); - if ($("#qtytoproduce-"+index+"-"+(nbrTrs)).val() == 0) { - $("#qtytoproduce-"+index+"-"+(nbrTrs)).val(1); + $("#"+inputId+"-"+index+"-"+(nbrTrs+1)).focus(); + if ($("#"+inputId+"-"+index+"-"+(nbrTrs)).val() == 0) { + $("#"+inputId+"-"+index+"-"+(nbrTrs)).val(1); } var totalonallines = 0; for (let i = 1; i <= nbrTrs; i++) { - console.log(i+" = "+parseFloat($("#qtytoproduce-"+index+"-"+i).val())); - totalonallines = totalonallines + parseFloat($("#qtytoproduce-"+index+"-"+i).val()); + console.log(i+" = "+parseFloat($("#"+inputId+"-"+index+"-"+i).val())); + totalonallines = totalonallines + parseFloat($("#"+inputId+"-"+index+"-"+i).val()); } console.log("totalonallines="+totalonallines); if (totalonallines == qtyOrdered && qtyOrdered > 1) { - var prevouslineqty = $("#qtytoproduce-"+index+"-"+nbrTrs).val(); - $("#qtytoproduce-"+index+"-"+(nbrTrs)).val(1); - $("#qtytoproduce-"+index+"-"+(nbrTrs+1)).val(prevouslineqty - 1); + var prevouslineqty = $("#"+inputId+"-"+index+"-"+nbrTrs).val(); + $("#"+inputId+"-"+index+"-"+(nbrTrs)).val(1); + $("#"+inputId+"-"+index+"-"+(nbrTrs+1)).val(prevouslineqty - 1); } $("#qty_dispatched_"+index).val(qtyDispatched); @@ -147,9 +153,9 @@ function addDispatchLine(index, type, mode) $("#qty_"+(nbrTrs-1)+"_"+index).val(qty); } // Store arbitrary data for dispatch qty input field change event - $("#qtytoproduce-"+index+(nbrTrs)).data('qty', qty); - $("#qtytoproduce-"+index+(nbrTrs)).data('type', type); - $("#qtytoproduce-"+index+(nbrTrs)).data('index', index); + $("#"+inputId+"-"+index+(nbrTrs)).data('qty', qty); + $("#"+inputId+"-"+index+(nbrTrs)).data('type', type); + $("#"+inputId+"-"+index+(nbrTrs)).data('index', index); } } diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index f83b32f1c99..6a5c41b77c5 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -1010,7 +1010,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($tmpproduct->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { if (empty($line->disable_stock_change)) { $preselected = (GETPOSTISSET('idwarehouse-'.$line->id.'-'.$i) ? GETPOST('idwarehouse-'.$line->id.'-'.$i) : ($tmpproduct->fk_default_warehouse > 0 ? $tmpproduct->fk_default_warehouse : 'ifone')); - print $formproduct->selectWarehouses($preselected, 'idwarehouse-'.$line->id.'-'.$i, '', 1, 0, $line->fk_product, '', 1, 0, null, 'maxwidth200'); + print $formproduct->selectWarehouses($preselected, 'idwarehouse-'.$line->id.'-'.$i, '', 1, 0, $line->fk_product, '', 1, 0, null, 'maxwidth200 csswarehouse_'.$line->id.'_'.$i); } else { print ''.$langs->trans("DisableStockChange").''; } From 30fd55addc270e58b5e3184db0b8dd967f1ceee0 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 26 Jan 2022 07:29:37 +0100 Subject: [PATCH 14/23] NEW API Proposals - Add POST lines --- .../comm/propal/class/api_proposals.class.php | 90 ++++++++++++++++++- 1 file changed, 86 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 41ed388e044..6d4f9446021 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -1,7 +1,9 @@ - * Copyright (C) 2016 Laurent Destailleur - * Copyright (C) 2020 Thibault FOUCART +/* Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2016 Laurent Destailleur + * Copyright (C) 2020 Thibault FOUCART + * Copyright (C) 2022 ATM Consulting + * Copyright (C) 2022 OpenDSI * * 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 @@ -308,7 +310,7 @@ class Proposals extends DolibarrApi * @param int $id Id of commercial proposal to update * @param array $request_data Commercial proposal line data * - * @url POST {id}/lines + * @url POST {id}/line * * @return int */ @@ -368,6 +370,86 @@ class Proposals extends DolibarrApi } } + /** + * Add lines to given commercial proposal + * + * @param int $id Id of commercial proposal to update + * @param array $request_data Commercial proposal line data + * + * @url POST {id}/lines + * + * @return int + */ + public function postLines($id, $request_data = null) + { + if (!DolibarrApiAccess::$user->rights->propal->creer) { + throw new RestException(401); + } + + $result = $this->propal->fetch($id); + if (!$result) { + throw new RestException(404, 'Commercial Proposal not found'); + } + + if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + $errors = []; + $this->db->begin(); + + foreach ($request_data as $TData) + { + if(empty($TData[0])) $TData = array($TData); + + foreach ($TData as $lineData) { + + $line = (object)$lineData; + + $updateRes = $this->propal->addline( + $line->desc, + $line->subprice, + $line->qty, + $line->tva_tx, + $line->localtax1_tx, + $line->localtax2_tx, + $line->fk_product, + $line->remise_percent, + 'HT', + 0, + $line->info_bits, + $line->product_type, + $line->rang, + $line->special_code, + $line->fk_parent_line, + $line->fk_fournprice, + $line->pa_ht, + $line->label, + $line->date_start, + $line->date_end, + $line->array_options, + $line->fk_unit, + $line->origin, + $line->origin_id, + $line->multicurrency_subprice, + $line->fk_remise_except + ); + + if ($updateRes < 0) { + $errors['lineLabel'] = $line->label; + $errors['msg'] = $this->propal->errors; + } + } + } + if (empty($errors)) { + $this->db->commit(); + return count($request_data); + } else { + $this->db->rollback(); + throw new RestException(400, implode(", ", $errors)); + } + } + /** * Update a line of given commercial proposal * From 68ba60896f293d213a8bcab43e6fe61eecb79d86 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 26 Jan 2022 07:31:17 +0100 Subject: [PATCH 15/23] Copyright --- htdocs/comm/propal/class/api_proposals.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 6d4f9446021..778bdd3ba2f 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -1,9 +1,9 @@ * Copyright (C) 2016 Laurent Destailleur - * Copyright (C) 2020 Thibault FOUCART - * Copyright (C) 2022 ATM Consulting - * Copyright (C) 2022 OpenDSI + * Copyright (C) 2020 Thibault FOUCART + * Copyright (C) 2022 ATM Consulting + * Copyright (C) 2022 OpenDSI * * 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 From 71876755d2c7c4092b06ab0897d47e1839cd229f Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 26 Jan 2022 06:35:26 +0000 Subject: [PATCH 16/23] Fixing style errors. --- htdocs/comm/propal/class/api_proposals.class.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 778bdd3ba2f..19e1451b300 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -398,13 +398,11 @@ class Proposals extends DolibarrApi $errors = []; $this->db->begin(); - foreach ($request_data as $TData) - { - if(empty($TData[0])) $TData = array($TData); + foreach ($request_data as $TData) { + if (empty($TData[0])) $TData = array($TData); foreach ($TData as $lineData) { - - $line = (object)$lineData; + $line = (object) $lineData; $updateRes = $this->propal->addline( $line->desc, From 31787a99f0c76e8f89022e12a717bdc4298f4dd3 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 26 Jan 2022 08:50:57 +0100 Subject: [PATCH 17/23] NEW Proposal - Add filter on proposal get lines --- .../comm/propal/class/api_proposals.class.php | 18 +++++-- htdocs/comm/propal/class/propal.class.php | 51 +++++++++++-------- 2 files changed, 44 insertions(+), 25 deletions(-) diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 41ed388e044..7d71dc4f244 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -274,14 +274,17 @@ class Proposals extends DolibarrApi /** * Get lines of a commercial proposal * - * @param int $id Id of commercial proposal + * @param int $id Id of commercial proposal + * @param string $sqlfilters Other criteria to filter answers separated by a comma. d is the alias for proposal lines table, p is the alias for product table. "Syntax example "(p.ref:like:'SO-%') and (d.date_start:<:'20220101')" * * @url GET {id}/lines * * @return int */ - public function getLines($id) + public function getLines($id, $sqlfilters = '') { + $filters = ""; + if (!DolibarrApiAccess::$user->rights->propal->lire) { throw new RestException(401); } @@ -294,7 +297,16 @@ class Proposals extends DolibarrApi if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - $this->propal->getLinesArray(); + + if (!empty($sqlfilters)) { + if (!DolibarrApi::_checkFilters($sqlfilters)) { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $filters = " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + $this->propal->getLinesArray($filters); $result = array(); foreach ($this->propal->lines as $line) { array_push($result, $this->_cleanObjectDatas($line)); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index fd3bbfe7171..1c532e26147 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1,20 +1,22 @@ - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2005 Marc Barilley - * Copyright (C) 2005-2013 Regis Houssin - * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2008 Raphael Bertrand - * Copyright (C) 2010-2020 Juanjo Menent - * Copyright (C) 2010-2017 Philippe Grand - * Copyright (C) 2012-2014 Christophe Battarel - * Copyright (C) 2012 Cedric Salvador - * Copyright (C) 2013 Florian Henry - * Copyright (C) 2014-2015 Marcos García - * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2018-2021 Frédéric France - * Copyright (C) 2018 Ferran Marcet +/* Copyright (C) 2002-2004 Rodolphe Quiedeville + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2005 Marc Barilley + * Copyright (C) 2005-2013 Regis Houssin + * Copyright (C) 2006 Andre Cianfarani + * Copyright (C) 2008 Raphael Bertrand + * Copyright (C) 2010-2020 Juanjo Menent + * Copyright (C) 2010-2017 Philippe Grand + * Copyright (C) 2012-2014 Christophe Battarel + * Copyright (C) 2012 Cedric Salvador + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2014-2015 Marcos García + * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2018-2021 Frédéric France + * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2022 ATM Consulting + * Copyright (C) 2022 OpenDSI * * 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 @@ -1714,12 +1716,13 @@ class Propal extends CommonObject /** * Load array lines * - * @param int $only_product Return only physical products - * @param int $loadalsotranslation Return translation for products + * @param int $only_product Return only physical products + * @param int $loadalsotranslation Return translation for products + * @param string $filters Filter on other fields * - * @return int <0 if KO, >0 if OK + * @return int <0 if KO, >0 if OK */ - public function fetch_lines($only_product = 0, $loadalsotranslation = 0) + public function fetch_lines($only_product = 0, $loadalsotranslation = 0, $filters = '') { global $langs, $conf; // phpcs:enable @@ -1738,6 +1741,9 @@ class Propal extends CommonObject if ($only_product) { $sql .= ' AND p.fk_product_type = 0'; } + if ($filters) { + $sql .= $filters; + } $sql .= ' ORDER by d.rang'; dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG); @@ -3689,12 +3695,13 @@ class Propal extends CommonObject /** * Retrieve an array of proposal lines + * @param string $filters Filter on other fields * * @return int >0 if OK, <0 if KO */ - public function getLinesArray() + public function getLinesArray($filters = '') { - return $this->fetch_lines(); + return $this->fetch_lines(0, 0, $filters); } /** From ec723657c93da5d9f3160ebeba25fd0a44350828 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Wed, 26 Jan 2022 09:55:41 +0100 Subject: [PATCH 18/23] new : allow informations to be displayed before the public ticket list --- htdocs/public/ticket/list.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index 8a353eea881..1a3c0c3babd 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -77,6 +77,9 @@ if (isset($_SESSION['email_customer'])) { $object = new Ticket($db); +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('ticketpubliclist', 'globalcard')); + if (empty($conf->ticket->enabled)) { accessforbidden('', 0, 0, 1); } @@ -407,6 +410,11 @@ if ($action == "view_ticketlist") { $varpage = empty($contextpage) ? $url_page_current : $contextpage; $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + // allow to display information before list + $parameters=array('arrayfields'=>$arrayfields); + $reshook=$hookmanager->executeHooks('printFieldListHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print ''; // Filter bar From 95df5bebe6d8e938849a72bd931b1ca407073d5b Mon Sep 17 00:00:00 2001 From: pandreani Date: Wed, 26 Jan 2022 10:18:44 +0100 Subject: [PATCH 19/23] NEW stock limit in stock export CSV --- htdocs/core/modules/modStock.class.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index 00e5a7859c0..b0de609a874 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -235,19 +235,22 @@ class modStock extends DolibarrModules 'p.rowid'=>"ProductId", 'p.ref'=>"Ref", 'p.fk_product_type'=>"Type", 'p.label'=>"Label", 'p.description'=>"Description", 'p.note'=>"Note", 'p.price'=>"Price", 'p.tva_tx'=>'VAT', 'p.tosell'=>"OnSell", 'p.tobuy'=>'OnBuy', 'p.duration'=>"Duration", 'p.datec'=>'DateCreation', 'p.tms'=>'DateModification', 'p.pmp'=>'PMPValue', 'p.cost_price'=>'CostPrice', + 'p.seuil_stock_alerte'=>'StockLimit', ); $this->export_TypeFields_array[$r] = array( 'e.rowid'=>'List:entrepot:ref::stock', 'e.ref'=>'Text', 'e.lieu'=>'Text', 'e.address'=>'Text', 'e.zip'=>'Text', 'e.town'=>'Text', 'p.rowid'=>"List:product:label::product", 'p.ref'=>"Text", 'p.fk_product_type'=>"Text", 'p.label'=>"Text", 'p.description'=>"Text", 'p.note'=>"Text", 'p.price'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean", 'p.duration'=>"Duree", 'p.datec'=>'Date', 'p.tms'=>'Date', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric', - 'ps.reel'=>'Numeric' + 'ps.reel'=>'Numeric', + 'p.seuil_stock_alerte'=>'Numeric', ); $this->export_entities_array[$r] = array( 'p.rowid'=>"product", 'p.ref'=>"product", 'p.fk_product_type'=>"product", 'p.label'=>"product", 'p.description'=>"product", 'p.note'=>"product", 'p.price'=>"product", 'p.tva_tx'=>'product', 'p.tosell'=>"product", 'p.tobuy'=>"product", 'p.duration'=>"product", 'p.datec'=>'product', 'p.tms'=>'product', 'p.pmp'=>'product', 'p.cost_price'=>'product', - 'ps.reel'=>'stock' + 'ps.reel'=>'stock', + 'p.seuil_stock_alerte'=>'product', ); // We define here only fields that use another icon that the one defined into export_icon $this->export_aggregate_array[$r] = array('ps.reel'=>'SUM'); // TODO Not used yet $this->export_dependencies_array[$r] = array('stock'=>array('p.rowid', 'e.rowid')); // We must keep this until the aggregate_array is used. To have a unique key, if we ask a field of a child, to avoid the DISTINCT to discard them. From 3e1cfc2997208b5874b0761f37aad7ea0180e8f9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 26 Jan 2022 11:29:27 +0100 Subject: [PATCH 20/23] NEW Add status "Obsolete" to KM articles --- htdocs/bom/bom_card.php | 5 -- .../class/knowledgerecord.class.php | 6 +- .../knowledgerecord_card.php | 57 +++++++++++++++++-- htdocs/langs/en_US/knowledgemanagement.lang | 6 +- .../modulebuilder/template/myobject_card.php | 12 +++- 5 files changed, 72 insertions(+), 14 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 748aea4ddb2..7d83a88ce55 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -354,8 +354,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $formquestion = array(); if (!empty($conf->bom->enabled)) { $langs->load("mrp"); - require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; - $formproduct = new FormProduct($db); $forcecombo = 0; if ($conf->browser->name == 'ie') { $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy @@ -384,8 +382,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $formquestion = array(); if (!empty($conf->bom->enabled)) { $langs->load("mrp"); - require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; - $formproduct = new FormProduct($db); $forcecombo = 0; if ($conf->browser->name == 'ie') { $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy @@ -415,7 +411,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (!empty($conf->bom->enabled)) { $langs->load("mrp"); require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; - $formproduct = new FormProduct($db); $forcecombo = 0; if ($conf->browser->name == 'ie') { $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 8629ec7bbc6..b241cb2d9e9 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -116,7 +116,7 @@ class KnowledgeRecord extends CommonObject 'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,), //'url' => array('type'=>'varchar(255)', 'label'=>'URL', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>-1, 'csslist'=>'tdoverflow200', 'help'=>'UrlForInfoPage'), 'fk_c_ticket_category' => array('type'=>'integer:CTicketCategory:ticket/class/cticketcategory.class.php:0::pos', 'label'=>'SuggestedForTicketsInGroup', 'enabled'=>'$conf->ticket->enabled', 'position'=>512, 'notnull'=>0, 'visible'=>-1, 'help'=>'YouCanLinkArticleToATicketCategory', 'csslist'=>'minwidth200 tdoverflowmax250'), - 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>5, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated'),), + 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>5, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '9'=>'Obsolete'),), ); public $rowid; public $ref; @@ -829,10 +829,10 @@ class KnowledgeRecord extends CommonObject //$langs->load("knowledgemanagement"); $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft'); $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated'); - $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled'); + $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Obsolete'); $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft'); $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated'); - $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled'); + $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Obsolete'); } $statusType = 'status'.$status; diff --git a/htdocs/knowledgemanagement/knowledgerecord_card.php b/htdocs/knowledgemanagement/knowledgerecord_card.php index 809d69128cf..a388175dbcf 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_card.php +++ b/htdocs/knowledgemanagement/knowledgerecord_card.php @@ -1,6 +1,5 @@ - * Copyright (C) ---Put here your own copyright and developer email--- +/* Copyright (C) 2017-2021 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 @@ -295,6 +294,56 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); } + // Confirmation of action xxxx (You can use it for xxx = 'close', xxx = 'reopen', ...) + if ($action == 'close') { + $text = $langs->trans('ConfirmCloseKM', $object->ref); + /*if (! empty($conf->notification->enabled)) + { + require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; + $notify = new Notify($db); + $text .= '
'; + $text .= $notify->confirmMessage('MYOBJECT_CLOSE', $object->socid, $object); + }*/ + + $formquestion = array(); + /* + $forcecombo=0; + if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy + $formquestion = array( + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)) + ); + */ + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetObsolete'), $text, 'confirm_close', $formquestion, 0, 1, 220); + } + + // Confirmation of action xxxx (You can use it for xxx = 'close', xxx = 'reopen', ...) + if ($action == 'reopen') { + $text = $langs->trans('ConfirmReopenKM', $object->ref); + /*if (! empty($conf->notification->enabled)) + { + require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; + $notify = new Notify($db); + $text .= '
'; + $text .= $notify->confirmMessage('MYOBJECT_CLOSE', $object->socid, $object); + }*/ + + $formquestion = array(); + /* + $forcecombo=0; + if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy + $formquestion = array( + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)) + ); + */ + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Re-Open'), $text, 'confirm_reopen', $formquestion, 0, 1, 220); + } + // Call Hook formConfirm $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid); $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook @@ -428,14 +477,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$langs->trans("Enable").''."\n"; } } + */ if ($permissiontoadd) { if ($object->status == $object::STATUS_VALIDATED) { - print ''.$langs->trans("Cancel").''."\n"; + print ''.$langs->trans("SetObsolete").''."\n"; } else { print ''.$langs->trans("Re-Open").''."\n"; } } - */ // Delete (need delete permission, or if draft, just need create/modify permission) print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)); diff --git a/htdocs/langs/en_US/knowledgemanagement.lang b/htdocs/langs/en_US/knowledgemanagement.lang index 1f5e9d3905b..ee93715a5c0 100644 --- a/htdocs/langs/en_US/knowledgemanagement.lang +++ b/htdocs/langs/en_US/knowledgemanagement.lang @@ -47,4 +47,8 @@ KnowledgeRecord = Article KnowledgeRecordExtraFields = Extrafields for Article GroupOfTicket=Group of tickets YouCanLinkArticleToATicketCategory=You can link an article to a ticket group (so the article will be suggested during qualification of new tickets) -SuggestedForTicketsInGroup=Suggested for tickets when group is \ No newline at end of file +SuggestedForTicketsInGroup=Suggested for tickets when group is + +SetObsolete=Set as obsolete +ConfirmCloseKM=Do you confirm the closing of this article as obsolete ? +ConfirmReopenKM=Do you want to restore this article to status "Validated" ? \ No newline at end of file diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index a493508878c..66279849abb 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -316,6 +316,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($action == 'deleteline') { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1); } + // Clone confirmation if ($action == 'clone') { // Create an array for form @@ -323,8 +324,17 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); } - // Confirmation of action xxxx + // Confirmation of action xxxx (You can use it for xxx = 'close', xxx = 'reopen', ...) if ($action == 'xxx') { + $text = $langs->trans('ConfirmActionMyObject', $object->ref); + /*if (! empty($conf->notification->enabled)) + { + require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php'; + $notify = new Notify($db); + $text .= '
'; + $text .= $notify->confirmMessage('MYOBJECT_CLOSE', $object->socid, $object); + }*/ + $formquestion = array(); /* $forcecombo=0; From 7b990a1a7ff7511337ffa9e169ba43ad531994d9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 26 Jan 2022 11:30:19 +0100 Subject: [PATCH 21/23] Fix phpcs --- htdocs/core/class/html.form.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index d29fd0d5e15..ff5f5d0d0a5 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1693,8 +1693,7 @@ class Form if ($showempty && ! is_numeric($showempty)) { $textforempty = $showempty; $out .= ''; - } - else { + } else { if (($showempty == 1 || ($showempty == 3 && $num > 1)) && ! $multiple) { $out .= ''; } From b7d199657b38f96792fa06237a16405ee56c8921 Mon Sep 17 00:00:00 2001 From: Markusi13 Date: Wed, 26 Jan 2022 12:23:12 +0100 Subject: [PATCH 22/23] Update bug_report.yml --- .github/ISSUE_TEMPLATE/bug_report.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 7e7a62c1e84..d7dc3d584e3 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -69,12 +69,3 @@ body: attributes: label: Attached files description: Screenshots, screencasts, dolibarr.log, debugging informations - - - type: checkboxes - id: terms - attributes: - label: Code of Conduct - description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CODE_OF_CONDUCT.md) - options: - - label: I agree to follow this project's Code of Conduct - required: true From a47145f96247f3155002d3d172f7f059f0e00eeb Mon Sep 17 00:00:00 2001 From: Markusi13 Date: Wed, 26 Jan 2022 12:23:25 +0100 Subject: [PATCH 23/23] Update feature_request.yml --- .github/ISSUE_TEMPLATE/feature_request.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index f4975622a8f..885f3472d18 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -33,12 +33,3 @@ body: attributes: label: Suggested steps description: List of tasks to achieve goal - - - type: checkboxes - id: terms - attributes: - label: Code of Conduct - description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CODE_OF_CONDUCT.md) - options: - - label: I agree to follow this project's Code of Conduct - required: true