From 8221ab0a58d4457c2632bb58396cccd49978f0c2 Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Tue, 22 Apr 2025 11:51:25 +0200 Subject: [PATCH 1/9] fix: #33095 (#33907) --- htdocs/user/card.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index fef46046c3e..499ef4845c4 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -2395,26 +2395,28 @@ if ($action == 'create' || $action == 'adduserldap') { $type = $object->contact_id; } + $eventsCompanyContact = array(); + $eventsCompanyContact[] = array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php?showempty=1&token='.currentToken(), 1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); if ($object->socid > 0 && !($object->contact_id > 0)) { // external user but no link to a contact - print img_picto('', 'company').$form->select_company($object->socid, 'socid', '', ' ', 0, 0, null, 0, 'maxwidth300'); + print img_picto('', 'company').$form->select_company($object->socid, 'socid', '', ' ', 0, 0, $eventsCompanyContact, 0, 'maxwidth300'); print img_picto('', 'contact').$form->selectcontacts(0, 0, 'contactid', 1, '', '', 1, 'maxwidth300', false, 1); if ($object->ldap_sid) { print ' ('.$langs->trans("DomainUser").')'; } } elseif ($object->socid > 0 && $object->contact_id > 0) { // external user with a link to a contact - print img_picto('', 'company').$form->select_company($object->socid, 'socid', '', ' ', 0, 0, null, 0, 'maxwidth300'); // We keep thirdparty empty, contact is already set + print img_picto('', 'company').$form->select_company($object->socid, 'socid', '', ' ', 0, 0, $eventsCompanyContact, 0, 'maxwidth300'); // We keep thirdparty empty, contact is already set print img_picto('', 'contact').$form->selectcontacts(0, $object->contact_id, 'contactid', 1, '', '', 1, 'maxwidth300', false, 1); if ($object->ldap_sid) { print ' ('.$langs->trans("DomainUser").')'; } } elseif (!($object->socid > 0) && $object->contact_id > 0) { // internal user with a link to a contact - print img_picto('', 'company').$form->select_company(0, 'socid', '', ' ', 0, 0, null, 0, 'maxwidth300'); // We keep thirdparty empty, contact is already set + print img_picto('', 'company').$form->select_company(0, 'socid', '', ' ', 0, 0, $eventsCompanyContact, 0, 'maxwidth300'); // We keep thirdparty empty, contact is already set print img_picto('', 'contact').$form->selectcontacts(0, $object->contact_id, 'contactid', 1, '', '', 1, 'maxwidth300', false, 1); if ($object->ldap_sid) { print ' ('.$langs->trans("DomainUser").')'; } } else { // $object->socid is not > 0 here - print img_picto('', 'company').$form->select_company(0, 'socid', '', ' ', 0, 0, null, 0, 'maxwidth300'); // We keep thirdparty empty, contact is already set + print img_picto('', 'company').$form->select_company(0, 'socid', '', ' ', 0, 0, $eventsCompanyContact, 0, 'maxwidth300'); // We keep thirdparty empty, contact is already set print img_picto('', 'contact').$form->selectcontacts(0, 0, 'contactid', 1, '', '', 1, 'maxwidth300', false, 1); } } From 76a89cad009775bcbfa67c43ee989633ce8f2c08 Mon Sep 17 00:00:00 2001 From: Can Arslan <138895927+mc2rcanarslan@users.noreply.github.com> Date: Wed, 23 Apr 2025 15:32:23 -0600 Subject: [PATCH 2/9] fix: give user access for file if user has 'all' permission of the module (#33957) --- htdocs/core/lib/files.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 7aa51b29c3b..c576b957c55 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -3470,7 +3470,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed = 1; } } - if ($fuser->hasRight($modulepart, $lire) || $fuser->hasRight($modulepart, $read)) { + if (($fuser->hasRight($modulepart, $lire) || $fuser->hasRight($modulepart, $read)) || ($fuser->hasRight($modulepart, 'all', $lire) || $fuser->hasRight($modulepart, 'all', $read))) { $accessallowed = 1; } From be3fae0275c8a1c83a3b19bc2e310f46251be6f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= <81741011+altairis-noe@users.noreply.github.com> Date: Thu, 24 Apr 2025 01:47:43 +0200 Subject: [PATCH 3/9] FIX: stock control condition in reception delete (#33952) --- htdocs/reception/class/reception.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 7951b3347ee..c67622fcaa8 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1060,7 +1060,7 @@ class Reception extends CommonObject $this->db->begin(); // Stock control - if (isModEnabled('stock') && !getDolGlobalInt('STOCK_CALCULATE_ON_RECEPTION') && $this->statut > 0) { + if (isModEnabled('stock') && ((getDolGlobalInt('STOCK_CALCULATE_ON_RECEPTION') && $this->status > self::STATUS_DRAFT) || (getDolGlobalInt('STOCK_CALCULATE_ON_RECEPTION_CLOSE') && $this->status == self::STATUS_CLOSED))) { require_once DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"; $langs->load("agenda"); From 07db71dc33c9a3baaa8221ac6187a2136fdb70fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Lukas?= Date: Thu, 24 Apr 2025 15:39:03 +0200 Subject: [PATCH 4/9] Fix #33967 (#33968) --- htdocs/product/stats/card.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index f364d4c84e9..0c4227fa693 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -223,6 +223,7 @@ if ($result || !($id > 0)) { } else { print ''; } + print ''; // Year print ''.$langs->trans("Year").''; @@ -258,6 +259,9 @@ if ($result || !($id > 0)) { if ($socid > 0) { $param .= '&socid='.((int) $socid); } + if (!empty($search_categ)) { + $param .= '&search_categ='.((int) $search_categ); + } // Choice of stats mode (byunit or bynumber) From f1ff22a5167689580cd8ea375a31c28bcd91dd9d Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Fri, 25 Apr 2025 14:35:18 +0200 Subject: [PATCH 5/9] FIX creating acredit note from the remain to pay was always 0 --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 61e5caf6fd4..16d4ebc23e3 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1367,7 +1367,7 @@ if (empty($reshook)) { $tva_tx = 0; } - $object->addline($langs->trans('invoiceAvoirLineWithPaymentRestAmount'), $remain_to_pay, 1, $tva_tx, 0, 0, 0, 0, '', '', 0, 0, 0, 'TTC'); + $object->addline($langs->trans('invoiceAvoirLineWithPaymentRestAmount'), 0, 1, $tva_tx, 0, 0, 0, 0, '', '', 0, 0, 0, 'TTC', $remain_to_pay); } } From cf24f34947b8ee8240e391fc032112b76ac8b404 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Fri, 25 Apr 2025 17:26:17 +0200 Subject: [PATCH 6/9] Fix SQL --- htdocs/install/mysql/migration/10.0.0-11.0.0.sql | 3 +-- htdocs/install/mysql/tables/llx_expedition_package.sql | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 9bb097d10b2..d81f9fb6c26 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -433,7 +433,7 @@ create table llx_expedition_package rowid integer AUTO_INCREMENT PRIMARY KEY, fk_expedition integer NOT NULL, description varchar(255), --Description of goods in the package (required by the custom) - value double(24,8) DEFAULT 0,--Value (Price of the content, for insurance & custom) + value double(24,8) DEFAULT 0, --Value (Price of the content, for insurance & custom) fk_parcel_type integer, -- Type or package, linked to llx_c_shipment_parcel_type (eg: 1=enveloppe, 2=package, 3=palette, 4=other) height float, -- height width float, -- width @@ -593,4 +593,3 @@ create table llx_facturedet_rec_extrafields )ENGINE=innodb; ALTER TABLE llx_facturedet_rec_extrafields ADD INDEX idx_facturedet_rec_extrafields (fk_object); - diff --git a/htdocs/install/mysql/tables/llx_expedition_package.sql b/htdocs/install/mysql/tables/llx_expedition_package.sql index a4f372603ce..704e485e663 100644 --- a/htdocs/install/mysql/tables/llx_expedition_package.sql +++ b/htdocs/install/mysql/tables/llx_expedition_package.sql @@ -4,7 +4,7 @@ create table llx_expedition_package rowid integer AUTO_INCREMENT PRIMARY KEY, fk_expedition integer NOT NULL, description varchar(255), --Description of goods in the package (required by the custom) - value double(24,8) DEFAULT 0,--Value (Price of the content, for insurance & custom) + value double(24,8) DEFAULT 0, --Value (Price of the content, for insurance & custom) fk_package_type integer, -- Type or package, linked to llx_c_shipment_parcel_type (eg: 1=enveloppe, 2=package, 3=palette, 4=other) height float, -- height width float, -- width From 8623843a05dcc7acaed5f9774e47b0fb354980b7 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Fri, 25 Apr 2025 19:54:53 +0200 Subject: [PATCH 7/9] FIX DetecHTML on upload file from filemanager fails due to need to lock (no reason to need to lock file to read it). --- .../filemanagerdol/browser/default/frmupload.php | 5 ++++- .../filemanagerdol/connectors/php/connector.lib.php | 12 ++++++------ htdocs/core/lib/images.lib.php | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/htdocs/core/filemanagerdol/browser/default/frmupload.php b/htdocs/core/filemanagerdol/browser/default/frmupload.php index 17a2be8725b..7badd1763c3 100644 --- a/htdocs/core/filemanagerdol/browser/default/frmupload.php +++ b/htdocs/core/filemanagerdol/browser/default/frmupload.php @@ -134,7 +134,10 @@ function OnUploadCompleted( errorNumber, data ) alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + data + '"' ); break; case 202: - alert( 'Invalid file (Bad extension)' ); + alert( 'Invalid file (Bad extension reported by image_format_supported or other)' ); + break; + case 205: + alert( 'Invalid file (Bad file reported by DetectHtml)' ); break; default: alert( 'Error on file upload. Error number: ' + errorNumber ); diff --git a/htdocs/core/filemanagerdol/connectors/php/connector.lib.php b/htdocs/core/filemanagerdol/connectors/php/connector.lib.php index 3854d3f8b6e..91c93c531eb 100644 --- a/htdocs/core/filemanagerdol/connectors/php/connector.lib.php +++ b/htdocs/core/filemanagerdol/connectors/php/connector.lib.php @@ -323,6 +323,8 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '') //$sFileName = SanitizeFileName($sFileName); $sFileName = dol_sanitizeFileName($sFileName); + dol_syslog("FileUpload sFileName=".$sFileName); + $sOriginalFileName = $sFileName; // Get the extension. @@ -339,7 +341,7 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '') }*/ if (!$permissiontouploadmediaisok) { dol_syslog("connector.lib.php Try to upload a file with no permission"); - $sErrorNumber = '202'; + $sErrorNumber = '204'; } include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; @@ -397,9 +399,9 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '') $detectHtml = DetectHtml($sFilePath); if ($detectHtml === true || $detectHtml == -1) { // Note that is is a simple test and not reliable. Security does not rely on this. - dol_syslog("connector.lib.php DetectHtml is ko"); + dol_syslog("connector.lib.php DetectHtml is ko detectHtml=".$detectHtml.", we delete the file."); @unlink($sFilePath); - $sErrorNumber = '202'; + $sErrorNumber = '205'; } } } @@ -964,13 +966,11 @@ function DetectHtml($filePath) { $fp = @fopen($filePath, 'rb'); - //open_basedir restriction, see #1906 - if ($fp === false || !flock($fp, LOCK_SH)) { + if ($fp === false) { return -1; } $chunk = fread($fp, 1024); - flock($fp, LOCK_UN); fclose($fp); $chunk = strtolower($chunk); diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 4681cc0619f..9c076886fc9 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -80,7 +80,7 @@ function getListOfPossibleImageExt($acceptsvg = 0) * * @param string $file Filename * @param int $acceptsvg 0=Default (depends on setup), 1=Always accept SVG as image files - * @return int -1=Not image filename, 0=Image filename but format not supported for conversion by PHP, 1=Image filename with format supported by this PHP + * @return int -1=Not image filename, 0=Image filename but format not supported for conversion by PHP, 1=Image filename with format supported in conversion by this PHP */ function image_format_supported($file, $acceptsvg = 0) { From fd928a4d14b6f2717909e20e4f0ef05174910147 Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Sat, 26 Apr 2025 01:52:31 +0200 Subject: [PATCH 8/9] Change for #33970 --- htdocs/user/class/user.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 3508a114c7b..856b8c03c32 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -779,6 +779,7 @@ class User extends CommonObject 'mo' => 'mrp', 'order' => 'commande', 'produit' => 'product', + 'productlot' => 'product', 'project' => 'projet', 'propale' => 'propal', 'shipping' => 'expedition', From bc874ebc5c088d83179b266fc7b9e90fe8014e96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charl=C3=A8ne=20Benke?= <1179011+defrance@users.noreply.github.com> Date: Tue, 29 Apr 2025 06:41:30 +0200 Subject: [PATCH 9/9] delete category fail (interventional not full implemented) (#33989) the category for interventional is not full installed, so the table is not created we need the dolibarr 22 tto implement it --- htdocs/categories/class/categorie.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 166b9f9612c..72eb4c6935d 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -729,7 +729,7 @@ class Categorie extends CommonObject 'categorie_contact' => 'fk_categorie', 'categorie_fournisseur' => 'fk_categorie', 'categorie_knowledgemanagement' => array('field' => 'fk_categorie', 'enabled' => isModEnabled('knowledgemanagement')), - 'categorie_fichinter' => array('field' => 'fk_categorie', 'enabled' => isModEnabled('intervention')), + 'categorie_fichinter' => array('field' => 'fk_categorie', 'enabled' => false ), // not yet fully implemented (wait 22) isModEnabled('intervention')), 'categorie_member' => 'fk_categorie', 'categorie_user' => 'fk_categorie', 'categorie_product' => 'fk_categorie',