Merge branch '21.0' of git@github.com:Dolibarr/dolibarr.git into 21.0

This commit is contained in:
Laurent Destailleur 2025-04-29 16:39:29 +02:00
commit 20d56960fd
11 changed files with 31 additions and 22 deletions

View file

@ -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',

View file

@ -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);
}
}

View file

@ -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 );

View file

@ -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);

View file

@ -3584,7 +3584,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;
}

View file

@ -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)
{

View file

@ -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);

View file

@ -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

View file

@ -232,6 +232,7 @@ if ($result || !($id > 0)) {
} else {
print '<input type="hidden" name="id" value="'.$id.'">';
}
print '<input type="hidden" name="mode" value="'.$mode.'">';
// Year
print '<tr class="nooddeven"><td class="titlefield">'.$langs->trans("Year").'</td><td>';
@ -267,6 +268,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)

View file

@ -2558,34 +2558,36 @@ 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', 'class="pictofixedwidth"').$form->select_company($object->socid, 'socid', '', '&nbsp;', 0, 0, array(), 0, 'maxwidth300');
print img_picto('', 'company', 'class="pictofixedwidth"');
print $form->select_company($object->socid, 'socid', '', '&nbsp;', 0, 0, $eventsCompanyContact, 0, 'maxwidth300');
print img_picto('', 'contact', 'class="pictofixedwidth"');
//print $form->selectcontacts(0, 0, 'contactid', 1, '', '', 1, 'maxwidth300', false, 1);
print $form->select_contact(0, 0, 'contactid', 1, '', '', 1, 'minwidth100imp widthcentpercentminusxx maxwidth300', true, 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', 'class="pictofixedwidth"').$form->select_company($object->socid, 'socid', '', '&nbsp;', 0, 0, array(), 0, 'maxwidth300'); // We keep thirdparty empty, contact is already set
print img_picto('', 'company', 'class="pictofixedwidth"');
print $form->select_company($object->socid, 'socid', '', '&nbsp;', 0, 0, $eventsCompanyContact, 0, 'maxwidth300'); // We keep thirdparty empty, contact is already set
print img_picto('', 'contact', 'class="pictofixedwidth"');
//print $form->selectcontacts(0, $object->contact_id, 'contactid', 1, '', '', 1, 'maxwidth300', false, 1);
print $form->select_contact(0, $object->contact_id, 'contactid', 1, '', '', 1, 'minwidth100imp widthcentpercentminusxx maxwidth300', true, 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', 'class="pictofixedwidth"').$form->select_company(0, 'socid', '', '&nbsp;', 0, 0, array(), 0, 'maxwidth300'); // We keep thirdparty empty, contact is already set
print img_picto('', 'company', 'class="pictofixedwidth"');
print $form->select_company(0, 'socid', '', '&nbsp;', 0, 0, $eventsCompanyContact, 0, 'maxwidth300'); // We keep thirdparty empty, contact is already set
print img_picto('', 'contact', 'class="pictofixedwidth"');
//print $form->selectcontacts(0, $object->contact_id, 'contactid', 1, '', '', 1, 'maxwidth300', false, 1);
print $form->select_contact(0, $object->contact_id, 'contactid', 1, '', '', 1, 'minwidth100imp widthcentpercentminusxx maxwidth300', true, 1);
if ($object->ldap_sid) {
print ' ('.$langs->trans("DomainUser").')';
}
} else { // $object->socid is not > 0 here
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company(0, 'socid', '', '&nbsp;', 0, 0, array(), 0, 'maxwidth300'); // We keep thirdparty empty, contact is already set
print img_picto('', 'company', 'class="pictofixedwidth"');
print $form->select_company(0, 'socid', '', '&nbsp;', 0, 0, $eventsCompanyContact, 0, 'maxwidth300'); // We keep thirdparty empty, contact is already set
print img_picto('', 'contact', 'class="pictofixedwidth"');
//print $form->selectcontacts(0, 0, 'contactid', 1, '', '', 1, 'maxwidth300', false, 1);
print $form->select_contact(0, 0, 'contactid', 1, '', '', 1, 'minwidth100imp widthcentpercentminusxx maxwidth300', true, 1);
}
}

View file

@ -876,6 +876,7 @@ class User extends CommonObject
'mo' => 'mrp',
'order' => 'commande',
'produit' => 'product',
'productlot' => 'product',
'project' => 'projet',
'propale' => 'propal',
'shipping' => 'expedition',