diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php
index 3cd1f3cc5ac..0e27287ffd4 100644
--- a/htdocs/accountancy/class/bookkeeping.class.php
+++ b/htdocs/accountancy/class/bookkeeping.class.php
@@ -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);
diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php
index 6188bd2802a..9b7f1bf2e47 100644
--- a/htdocs/admin/company.php
+++ b/htdocs/admin/company.php
@@ -419,7 +419,7 @@ $formother = new FormOther($db);
$formcompany = new FormCompany($db);
$formfile = new FormFile($db);
-$countrynotdefined = ''.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
+$countrynotdefined = ''.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
print load_fiche_titre($langs->trans("CompanyFoundation"), '', 'title_setup');
@@ -475,10 +475,10 @@ print '
|
'."\n";
// Zip
-print ' | ';
+print ' |
| ';
print ' |
'."\n";
-print ' | ';
+print ' |
| ';
print ' |
'."\n";
// State
diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php
index 1d7d7c083cc..27083e25e8a 100644
--- a/htdocs/core/db/mysqli.class.php
+++ b/htdocs/core/db/mysqli.class.php
@@ -1296,8 +1296,7 @@ class DoliDBMysqli extends DoliDB
}
}
-
-if (class_exists('myslqi')) {
+if (class_exists('mysqli')) {
/**
* Class to make SSL connection
*/
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 25beda1136f..cc7e1ae1495 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -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,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,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') {
diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php
index 5ddde8e2465..562773488e4 100644
--- a/htdocs/imports/import.php
+++ b/htdocs/imports/import.php
@@ -1933,6 +1933,13 @@ if ($step == 5 && $datatoimport) {
$nbok++;
}
}
+
+ $reshook = $hookmanager->executeHooks('AfterImportInsert', $parameters);
+ if ($reshook < 0) {
+ $arrayoferrors[$sourcelinenb][] = [
+ 'lib' => implode("
", array_merge([$hookmanager->error], $hookmanager->errors))
+ ];
+ }
}
// Close file
$obj->import_close_file();