Merge branch 'develop' into develop

This commit is contained in:
Laurent Destailleur 2024-12-24 00:37:40 +01:00 committed by GitHub
commit 709603519a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 37 additions and 30 deletions

View file

@ -5128,7 +5128,7 @@ class Form
$resql = $this->db->query($sql);
if ($resql && $this->db->num_rows($resql) > 0) {
if ($showempty) {
$return .= '<option value="none"></option>';
$return .= '<option value="-1"></option>';
}
while ($res = $this->db->fetch_object($resql)) {
@ -5144,6 +5144,8 @@ class Form
}
}
$return .= '</select>';
$return .= ajax_combobox($htmlname);
}
return $return;
}

View file

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

View file

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

View file

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