From 0d534f0c37063feb8ec45a60bfff9f695ee6535a Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Wed, 2 Feb 2022 10:56:32 +0100 Subject: [PATCH 01/11] FIX #19974 : llx_onlinesignature.sql allready exist FIX #19974 : llx_onlinesignature.sql allready exist --- .../mysql/tables/llx_online_signatures.sql | 29 ------------------- 1 file changed, 29 deletions(-) delete mode 100644 htdocs/install/mysql/tables/llx_online_signatures.sql diff --git a/htdocs/install/mysql/tables/llx_online_signatures.sql b/htdocs/install/mysql/tables/llx_online_signatures.sql deleted file mode 100644 index fbba814dd4d..00000000000 --- a/htdocs/install/mysql/tables/llx_online_signatures.sql +++ /dev/null @@ -1,29 +0,0 @@ --- ============================================================================ --- Copyright (C) 2017 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_onlinesignature -( - rowid integer AUTO_INCREMENT PRIMARY KEY, - entity integer DEFAULT 1 NOT NULL, - object_type varchar(32) NOT NULL, - object_id integer NOT NULL, - datec datetime NOT NULL, - tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - name varchar(255) NOT NULL, - ip varchar(128), - pathoffile varchar(255) -)ENGINE=innodb; From da91c5f5efd7c02a59e644b48495661304f40b6d Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Wed, 2 Feb 2022 12:38:22 +0100 Subject: [PATCH 02/11] Update commonobject.class.php --- htdocs/core/class/commonobject.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index dcc31870b1c..73220505692 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2301,7 +2301,11 @@ abstract class CommonObject // Triggers if (!$error && !$notrigger) { // Call triggers - $result = $this->call_trigger(strtoupper(get_class($this)).'_MODIFY', $user); + if (get_class($this) == 'Commande') { + $result = $this->call_trigger('ORDER_MODIFY', $user); + }else{ + $result = $this->call_trigger(strtoupper(get_class($this)).'_MODIFY', $user); + } if ($result < 0) { $error++; } From 95833135f4b19805206d7a7d5c97f86bcc35601c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Feb 2022 10:44:19 +0100 Subject: [PATCH 03/11] FIX #19974 --- htdocs/install/mysql/data/llx_c_tva.sql | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index cae269783e4..1a14967357f 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -192,7 +192,7 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (14 -- MALI (id country=147) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1471, 147, '0','0','VAT rate 0', 1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1471, 147, '18','0','VAT rate - standard', 1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (1472, 147, '18','0','VAT rate - standard', 1); -- MONACO (id country=27) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 271, 27, '0','0','VAT rate 0 ou non applicable',1); @@ -379,10 +379,6 @@ INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 4 INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 462, 46, '15','0','VAT 15%',1); INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES ( 463, 46, '7.5','0','VAT 7.5%',1); --- SOUTH AFRICA (id country=205) -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2051,205, '0','0','No VAT',1); -INSERT INTO llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) VALUES (2052,205, '14','0','VAT 14%',1); - -- VENEZUELA (id country=232) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2321,232, '0','0','No VAT',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2322,232, '12','0','VAT 12%',1); From 15dca77330e3412e7fb445a20f3aecbf32c84eac Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Feb 2022 11:00:16 +0100 Subject: [PATCH 04/11] Fix filter on search_categ --- htdocs/product/reassort.php | 8 ++++---- htdocs/product/reassortlot.php | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index c327b24e8f0..a711c630414 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -146,11 +146,11 @@ if (!empty($conf->global->PRODUCT_USE_UNITS)) { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_units as u on p.fk_unit = u.rowid'; } // We'll need this table joined to the select in order to filter by categ -if ($search_categ) { +if ($search_categ > 0) { $sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp"; } $sql .= " WHERE p.entity IN (".getEntity('product').")"; -if ($search_categ) { +if ($search_categ > 0) { $sql .= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ } if ($sall) { @@ -267,7 +267,7 @@ if ($resql) { if ($search_sale) { $param .= "&search_sale=".urlencode($search_sale); } - if ($search_categ) { + if ($search_categ > 0) { $param .= "&search_categ=".urlencode($search_categ); } if ($toolowstock) { @@ -344,7 +344,7 @@ if ($resql) { if ($toolowstock) { $param .= "&toolowstock=".urlencode($toolowstock); } - if ($search_categ) { + if ($search_categ > 0) { $param .= "&search_categ=".urlencode($search_categ); } diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index 65e69b91384..21bca9c4aa8 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -135,11 +135,11 @@ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot as e on ps.fk_entrepot = e.rowid' $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_batch as pb on pb.fk_product_stock = ps.rowid'; // Detail for each lot on each warehouse $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot as pl on pl.fk_product = p.rowid AND pl.batch = pb.batch'; // Link on unique key // We'll need this table joined to the select in order to filter by categ -if ($search_categ) { +if ($search_categ > 0) { $sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp"; } $sql .= " WHERE p.entity IN (".getEntity('product').")"; -if ($search_categ) { +if ($search_categ > 0) { $sql .= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ } if ($sall) { @@ -178,7 +178,7 @@ if ($fourn_id > 0) { $sql .= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".((int) $fourn_id); } // Insert categ filter -if ($search_categ) { +if ($search_categ > 0) { $sql .= " AND cp.fk_categorie = ".((int) $search_categ); } if ($search_warehouse) { @@ -277,7 +277,7 @@ if ($resql) { if ($search_sale) { $param .= "&search_sale=".urlencode($search_sale); } - if ($search_categ) { + if ($search_categ > 0) { $param .= "&search_categ=".urlencode($search_categ); } /*if ($eatby) $param.="&eatby=".$eatby; From a7021008bae5240181f079380a529955f390acfd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Feb 2022 12:14:11 +0100 Subject: [PATCH 05/11] Update pdf.lib.php Conflicts: htdocs/core/lib/pdf.lib.php --- htdocs/core/lib/pdf.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index d95b240993d..75443366037 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -713,6 +713,7 @@ function pdf_pagehead(&$pdf, $outputlangs, $page_height) if (file_exists($filepath)) { $pdf->SetAutoPageBreak(0, 0); // Disable auto pagebreak before adding image $pdf->Image($filepath, (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_X) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_X : 0), (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y : 0), 0, $page_height); + $pdf->SetPageMark(); // This option avoid to have the images missing on some pages $pdf->SetAutoPageBreak(1, 0); // Restore pagebreak } } From d09303d27c2374f496a289f65a86ad860221adc2 Mon Sep 17 00:00:00 2001 From: El-dge Date: Fri, 4 Feb 2022 12:31:40 +0100 Subject: [PATCH 06/11] Issue on stock virtuel : fix Dolibarr/dolibarr#18634 --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 1e60a0f63d3..f69016d1576 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5026,7 +5026,7 @@ class Product extends CommonObject if ($result < 0) dol_print_error($this->db, $this->error); $stock_commande_fournisseur = $this->stats_commande_fournisseur['qty']; } - if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && empty($conf->reception->enabled)) + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && !empty($conf->reception->enabled)) { $filterStatus = '4'; if (isset($includedraftpoforvirtual)) $filterStatus = '0,'.$filterStatus; From 4324558d67ed7153d434ab5d4adb21205cbe8400 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Feb 2022 12:34:42 +0100 Subject: [PATCH 07/11] FIX backup fails --- htdocs/core/class/utils.class.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index b408985a92d..2fa329406fb 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -241,8 +241,15 @@ class Utils // MYSQL if ($type == 'mysql' || $type == 'mysqli') { - $cmddump = $conf->global->SYSTEMTOOLS_MYSQLDUMP; - + if (empty($conf->global->SYSTEMTOOLS_MYSQLDUMP)) { + $cmddump = $db->getPathOfDump(); + } else { + $cmddump = $conf->global->SYSTEMTOOLS_MYSQLDUMP; + } + if (empty($cmddump)) { + $this->error = "Failed to detect command to use for mysqldump. Try a manual backup before to set path of command."; + return -1; + } $outputfile = $outputdir.'/'.$file; // for compression format, we add extension From 3f87db08d4addbae2b1e9193e60417a7b6c21698 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Feb 2022 12:55:31 +0100 Subject: [PATCH 08/11] Update product.class.php --- htdocs/product/class/product.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index f69016d1576..ce7a5858a6a 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5026,16 +5026,18 @@ class Product extends CommonObject if ($result < 0) dol_print_error($this->db, $this->error); $stock_commande_fournisseur = $this->stats_commande_fournisseur['qty']; } - if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && !empty($conf->reception->enabled)) + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && empty($conf->reception->enabled)) { + // Case module reception is not used $filterStatus = '4'; if (isset($includedraftpoforvirtual)) $filterStatus = '0,'.$filterStatus; $result = $this->load_stats_reception(0, $filterStatus, 1); if ($result < 0) dol_print_error($this->db, $this->error); $stock_reception_fournisseur = $this->stats_reception['qty']; } - if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && empty($conf->reception->enabled)) + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && !empty($conf->reception->enabled)) { + // Case module reception is used $filterStatus = '4'; if (isset($includedraftpoforvirtual)) $filterStatus = '0,'.$filterStatus; $result = $this->load_stats_reception(0, $filterStatus, 1); // Use same tables than when module reception is not used. From 52498404020dcfbbc1903dfb69ded4e8d0ca6771 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Feb 2022 15:14:10 +0100 Subject: [PATCH 09/11] FIX #yogosha8628 --- htdocs/core/lib/functions.lib.php | 2 +- htdocs/viewimage.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9f6ac13fbb3..d89fd437a2d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9236,7 +9236,7 @@ function dolIsAllowedForPreview($file) /** - * Return mime type of a file + * Return MIME type of a file from its name with extension. * * @param string $file Filename we looking for MIME type * @param string $default Default mime type if extension not found in known list diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index 24c41e5e927..dee62999cf4 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -229,6 +229,11 @@ $original_file = str_replace('..\\', '/', $original_file); // Find the subdirectory name as the reference $refname = basename(dirname($original_file)."/"); +// Check that file is allowed for view with viewimage.php +if (!dolIsAllowedForPreview($original_file)) { + accessforbidden('This file is not qualified for preview', 0, 0, 1); +} + // Security check if (empty($modulepart)) { accessforbidden('Bad value for parameter modulepart', 0, 0, 1); From accf426f198b15e7215d5fef618aac074dbc2ada Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Fri, 4 Feb 2022 15:14:30 +0100 Subject: [PATCH 10/11] FIX : extrafields are not used yet + fix ihm --- htdocs/hrm/class/position.class.php | 2 +- htdocs/hrm/position_card.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index bd31311f4bf..2401791bb5f 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -59,7 +59,7 @@ class Position extends CommonObject /** * @var int Does object support extrafields ? 0=No, 1=Yes */ - public $isextrafieldmanaged = 1; + public $isextrafieldmanaged = 0; /** * @var string String with name of icon for position. Must be the part after the 'object_' into object_position.png diff --git a/htdocs/hrm/position_card.php b/htdocs/hrm/position_card.php index 3287091dcdb..c26d981a324 100644 --- a/htdocs/hrm/position_card.php +++ b/htdocs/hrm/position_card.php @@ -276,7 +276,7 @@ function DisplayPositionCard(&$object) $morehtmlref = '
'; $u_position = new User(($db)); $u_position->fetch($object->fk_user); - $morehtmlref .= $langs->trans('Employee').' : '.$u_position->getNomUrl(1); + $morehtmlref .= $langs->trans('Employee').' : '.($u_position->id > 0 ? $u_position->getNomUrl(1) : ''); $job = new Job($db); $job->fetch($object->fk_job); $morehtmlref .= '
'.$langs->trans('Job').' : '.$job->getNomUrl(1); From 5f3c81daeebae3c5a2e835d076b82c66044d8482 Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Thu, 20 Jan 2022 17:06:03 +0100 Subject: [PATCH 11/11] FIX if we have PRODUCT_USE_UNITS, task fail we need public function getLabelOfUnit($type = 'long') fonction or printlineOriginLine fail --- htdocs/projet/class/task.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 87a66279714..56db0bd2a64 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2014 Marcos García * Copyright (C) 2018 Frédéric France * Copyright (C) 2020 Juanjo Menent + * Copyright (C) 2022 Charlene Benke * * 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 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; /** * Class to manage tasks */ -class Task extends CommonObject +class Task extends CommonObjectLine { /** * @var string ID to identify managed object