diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 555778e7124..c8965d32c6a 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -5128,7 +5128,7 @@ class Form
$resql = $this->db->query($sql);
if ($resql && $this->db->num_rows($resql) > 0) {
if ($showempty) {
- $return .= '';
+ $return .= '';
}
while ($res = $this->db->fetch_object($resql)) {
@@ -5144,6 +5144,8 @@ class Form
}
}
$return .= '';
+
+ $return .= ajax_combobox($htmlname);
}
return $return;
}
diff --git a/htdocs/core/lib/invoice2.lib.php b/htdocs/core/lib/invoice2.lib.php
index 98566c95d51..288a1f5a014 100644
--- a/htdocs/core/lib/invoice2.lib.php
+++ b/htdocs/core/lib/invoice2.lib.php
@@ -231,6 +231,7 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
while ($cpt < $num) {
$obj = $db->fetch_object($resql);
+ $fac = null;
if ($mode == 'invoice') {
$fac = new Facture($db);
} elseif ($mode == 'order') {
@@ -241,37 +242,39 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
$fac = new Expedition($db);
}
- $result = $fac->fetch($obj->rowid);
- if ($result > 0) {
- $outputlangs = $langs;
- if (!empty($newlangid)) {
- if ($outputlangs->defaultlang != $newlangid) {
- $outputlangs = new Translate("", $conf);
- $outputlangs->setDefaultLang($newlangid);
+ if ($fac) {
+ $result = $fac->fetch($obj->rowid);
+ if ($result > 0) {
+ $outputlangs = $langs;
+ if (!empty($newlangid)) {
+ if ($outputlangs->defaultlang != $newlangid) {
+ $outputlangs = new Translate("", $conf);
+ $outputlangs->setDefaultLang($newlangid);
+ }
}
- }
- $filename = $dir_output.'/'.$fac->ref.'/'.$fac->ref.'.pdf';
- if ($regenerate || !dol_is_file($filename)) {
- if ($usestdout) {
- print "Build PDF for document ".$obj->ref." - Lang = ".$outputlangs->defaultlang."\n";
- }
- $result = $fac->generateDocument($regenerate ? $regenerate : $fac->model_pdf, $outputlangs);
- } else {
- if ($usestdout) {
- print "PDF for document ".$obj->ref." already exists\n";
+ $filename = $dir_output.'/'.$fac->ref.'/'.$fac->ref.'.pdf';
+ if ($regenerate || !dol_is_file($filename)) {
+ if ($usestdout) {
+ print "Build PDF for document ".$obj->ref." - Lang = ".$outputlangs->defaultlang."\n";
+ }
+ $result = $fac->generateDocument($regenerate ? $regenerate : $fac->model_pdf, $outputlangs);
+ } else {
+ if ($usestdout) {
+ print "PDF for document ".$obj->ref." already exists\n";
+ }
}
+
+ // Add file into files array
+ $files[] = $filename;
}
- // Add file into files array
- $files[] = $filename;
- }
-
- if ($result <= 0) {
- $error++;
- if ($usestdout) {
- print "Error: Failed to build PDF for document ".($fac->ref ? $fac->ref : ' id '.$obj->rowid)."\n";
- } else {
- dol_syslog("Failed to build PDF for document ".($fac->ref ? $fac->ref : ' id '.$obj->rowid), LOG_ERR);
+ if ($result <= 0) {
+ $error++;
+ if ($usestdout) {
+ print "Error: Failed to build PDF for document ".($fac->ref ? $fac->ref : ' id '.$obj->rowid)."\n";
+ } else {
+ dol_syslog("Failed to build PDF for document ".($fac->ref ? $fac->ref : ' id '.$obj->rowid), LOG_ERR);
+ }
}
}
diff --git a/htdocs/product/list.php b/htdocs/product/list.php
index 5922e0f18d1..287e00cd4c9 100644
--- a/htdocs/product/list.php
+++ b/htdocs/product/list.php
@@ -583,6 +583,7 @@ if ($search_vatrate) {
if (dol_strlen($canvas) > 0) {
$sql .= " AND p.canvas = '".$db->escape($canvas)."'";
}
+
// Search for tag/category ($searchCategoryProductList is an array of ID)
if (!empty($searchCategoryProductList)) {
$searchCategoryProductSqlList = array();
@@ -641,9 +642,10 @@ if ($search_accountancy_code_buy_intra) {
if ($search_accountancy_code_buy_export) {
$sql .= natural_search($alias_product_perentity . '.accountancy_code_buy_export', clean_account($search_accountancy_code_buy_export));
}
-if (getDolGlobalString('PRODUCT_USE_UNITS') && $search_units) {
+if (getDolGlobalString('PRODUCT_USE_UNITS') && $search_units && $search_units != '-1') {
$sql .= natural_search('cu.rowid', $search_units);
}
+
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks
diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php
index 9121d0ec032..e0da84aa3d9 100644
--- a/htdocs/ticket/class/ticket.class.php
+++ b/htdocs/ticket/class/ticket.class.php
@@ -3192,7 +3192,7 @@ class Ticket extends CommonObject
while ($obj = $this->db->fetch_object($resql)) {
$response->nbtodo++;
if ($mode == 'opened') {
- $datelimit = $this->db->jdate($obj->datec) + $delay_warning;
+ $datelimit = (int) $this->db->jdate($obj->datec) + (int) $delay_warning;
if ($datelimit < $now) {
//$response->nbtodolate++;
}