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

This commit is contained in:
ldestailleur 2025-03-08 14:51:36 +01:00
commit 3e24bbd419
5 changed files with 37 additions and 10 deletions

View file

@ -364,8 +364,13 @@ class BookKeeping extends CommonObject
dol_syslog(get_class($this).":: create sqlnum=".$sqlnum, LOG_DEBUG);
$resqlnum = $this->db->query($sqlnum);
if ($resqlnum) {
$objnum = $this->db->fetch_object($resqlnum);
$this->piece_num = $objnum->piece_num;
$num = $this->db->num_rows($resqlnum);
if ($num > 0) {
$objnum = $this->db->fetch_object($resqlnum);
$this->piece_num = $objnum->piece_num;
} else {
$this->piece_num = 0;
}
}
dol_syslog(get_class($this)."::create this->piece_num=".$this->piece_num, LOG_DEBUG);

View file

@ -419,7 +419,7 @@ $formother = new FormOther($db);
$formcompany = new FormCompany($db);
$formfile = new FormFile($db);
$countrynotdefined = '<span class="error">'.$langs->trans("ErrorSetACountryFirst").' <a href="#trzipbeforecountry">('.$langs->trans("SeeAbove").')</a></span>';
$countrynotdefined = '<span class="error">'.$langs->trans("ErrorSetACountryFirst").' <a href="" onclick="window.scrollTo({top: 0, behavior: \'smooth\'}); return false;">('.$langs->trans("SeeAbove").')</a></span>';
print load_fiche_titre($langs->trans("CompanyFoundation"), '', 'title_setup');
@ -475,10 +475,10 @@ print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ADDRESS">'.$langs->
print '<textarea name="MAIN_INFO_SOCIETE_ADDRESS" id="MAIN_INFO_SOCIETE_ADDRESS" class="quatrevingtpercent" rows="'.ROWS_3.'">'.(GETPOSTISSET('MAIN_INFO_SOCIETE_ADDRESS') ? GETPOST('MAIN_INFO_SOCIETE_ADDRESS', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_ADDRESS'))).'</textarea></td></tr>'."\n";
// Zip
print '<tr class="oddeven" id="trzipbeforecountry"><td><label for="MAIN_INFO_SOCIETE_ZIP">'.$langs->trans("CompanyZip").'</label></td><td>';
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ZIP">'.$langs->trans("CompanyZip").'</label></td><td>';
print '<input class="width100" name="MAIN_INFO_SOCIETE_ZIP" id="MAIN_INFO_SOCIETE_ZIP" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_INFO_SOCIETE_ZIP') ? GETPOST('MAIN_INFO_SOCIETE_ZIP', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_ZIP')))).'"></td></tr>'."\n";
print '<tr class="oddeven" id="trtownbeforecountry"><td><label for="MAIN_INFO_SOCIETE_TOWN">'.$langs->trans("CompanyTown").'</label></td><td>';
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_TOWN">'.$langs->trans("CompanyTown").'</label></td><td>';
print '<input name="MAIN_INFO_SOCIETE_TOWN" class="minwidth200" id="MAIN_INFO_SOCIETE_TOWN" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_INFO_SOCIETE_TOWN') ? GETPOST('MAIN_INFO_SOCIETE_TOWN', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_TOWN')))).'"></td></tr>'."\n";
// State

View file

@ -1296,8 +1296,7 @@ class DoliDBMysqli extends DoliDB
}
}
if (class_exists('myslqi')) {
if (class_exists('mysqli')) {
/**
* Class to make SSL connection
*/

View file

@ -12957,7 +12957,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
* @param string $id Attribute id of action button. Example 'action-delete'. This can be used for full ajax confirm if this code is reused into the ->formconfirm() method.
* @param int|boolean $userRight User action right
* // phpcs:disable
* @param array{confirm?:array{url?:string,title?:string,content?:string,action-btn-label?:string,cancel-btn-label?:string,modal?:bool},attr?:array<string,mixed>,areDropdownButtons?:bool,backtopage?:string,lang?:string,enabled?:bool,perm?:int<0,1>,label?:string,url?:string,isDropdown?:int<0,1>,isDropDown?:int<0,1>} $params = [ // Various params for future : recommended rather than adding more function arguments
* @param array{confirm?:array{url?:string,title?:string,content?:string,use_unsecured_unescapedattr?:bool|string[],action-btn-label?:string,cancel-btn-label?:string,modal?:bool},attr?:array<string,mixed>,areDropdownButtons?:bool,backtopage?:string,lang?:string,enabled?:bool,perm?:int<0,1>,label?:string,url?:string,isDropdown?:int<0,1>,isDropDown?:int<0,1>} $params = [ // Various params for future : recommended rather than adding more function arguments
* 'attr' => [ // to add or override button attributes
* 'xxxxx' => '', // your xxxxx attribute you want
* 'class' => 'reposition', // to add more css class to the button class attribute
@ -12974,7 +12974,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
* ],
* ]
* // phpcs:enable
* Example: array('attr' => array('class' => 'reposition'))
* Example: array('attr' => array('class' => 'reposition'))
* @return string html button
*/
function dolGetButtonAction($label, $text = '', $actionType = 'default', $url = '', $id = '', $userRight = 1, $params = array())
@ -13138,7 +13138,23 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url =
unset($attr['href']);
}
// escape all attributes
// Escape all attributes
if (!empty($params['use_unsecured_unescapedattr'])) { // Not recommended.
if (is_array($params['use_unsecured_unescapedattr'])) {
foreach ($attr as $attrK => $attrV) {
if (in_array($attrK, $params['use_unsecured_unescapedattr'])) {
$attr[$attrK] = dol_htmlentities($attrV, ENT_QUOTES | ENT_SUBSTITUTE);
} else {
$attr[$attrK] = dolPrintHTMLForAttribute($attrV);
}
}
} else {
$attr = array_map('dol_htmlentities', $attr);
}
} else {
$attr = array_map('dolPrintHTMLForAttribute', $attr);
}
$TCompiledAttr = array();
foreach ($attr as $key => $value) {
if ($key == 'href') {

View file

@ -1933,6 +1933,13 @@ if ($step == 5 && $datatoimport) {
$nbok++;
}
}
$reshook = $hookmanager->executeHooks('AfterImportInsert', $parameters);
if ($reshook < 0) {
$arrayoferrors[$sourcelinenb][] = [
'lib' => implode("<br>", array_merge([$hookmanager->error], $hookmanager->errors))
];
}
}
// Close file
$obj->import_close_file();