2
0
forked from Wavyzz/dolibarr

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

This commit is contained in:
Laurent Destailleur (aka Eldy)
2025-02-04 23:25:24 +01:00
8 changed files with 20 additions and 16 deletions

View File

@@ -3943,7 +3943,7 @@ class Facture extends CommonInvoice
if (empty($fk_prev_id)) {
$fk_prev_id = 'null';
}
if (!isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') {
if (!isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '' || $situation_percent == null) {
$situation_percent = 100;
}
if (empty($ref_ext)) {
@@ -4207,7 +4207,7 @@ class Facture extends CommonInvoice
if (empty($special_code) || $special_code == 3) {
$special_code = 0;
}
if (!isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') {
if (!isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '' || $situation_percent == null) {
$situation_percent = 100;
}
if (empty($ref_ext)) {

View File

@@ -10472,7 +10472,7 @@ abstract class CommonObject
}
// Create lines
if (!empty($this->table_element_line) && !empty($this->fk_element)) {
if (!empty($this->table_element_line) && !empty($this->fk_element) && !empty($this->lines)) {
foreach ($this->lines as $line) {
$keyforparent = $this->fk_element;
$line->$keyforparent = $this->id;

View File

@@ -7000,7 +7000,7 @@ class Form
// Keep only the VAT qualified for $type_vat
$arrayofvatrates = array();
foreach ($this->cache_vatrates as $cachevalue) {
if (empty($cachevalue['type_vat']) || $cachevalue['type_vat'] != $type_vat) {
if (empty($cachevalue['type_vat']) || $cachevalue['type_vat'] == $type_vat) {
$arrayofvatrates[] = $cachevalue;
}
}

View File

@@ -1588,7 +1588,9 @@ function dol_delete_file($file, $disableglob = 0, $nophperrors = 0, $nohook = 0,
}
}
} else {
$ok = false; // to avoid false positive
if (empty($nophperrors)) {
$ok = false; // to avoid false positive
}
dol_syslog("No files to delete found", LOG_DEBUG);
}
} else {

View File

@@ -604,15 +604,10 @@ class modAgenda extends DolibarrModules
*/
public function init($options = '')
{
global $conf;
// Permissions
$this->remove($options);
$sql = array(
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type='action' AND entity = ".((int) $conf->entity),
// "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','action',".((int) $conf->entity).")"
);
$sql = array();
return $this->_init($sql, $options);
}

View File

@@ -2938,7 +2938,7 @@ class EmailCollector extends CommonObject
$this->errors = $actioncomm->errors;
} else {
if ($fk_element_type == "ticket" && is_object($objectemail)) {
if ($objectemail->status == Ticket::STATUS_CLOSED || $objectemail->status == Ticket::STATUS_CANCELED) {
if ($objectemail->status == Ticket::STATUS_CLOSED || $objectemail->status == Ticket::STATUS_CANCELED || $objectemail->status == Ticket::STATUS_NEED_MORE_INFO || $objectemail->status == Ticket::STATUS_WAITING) {
if ($objectemail->fk_user_assign != null) {
$res = $objectemail->setStatut(Ticket::STATUS_ASSIGNED);
} else {
@@ -3414,6 +3414,13 @@ class EmailCollector extends CommonObject
$tickettocreate->context['actionmsg'] = $langs->trans("ActionAC_EMAIL_IN").' - '.$langs->trans("TICKET_CREATEInDolibarr");
//$tickettocreate->email_fields_no_propagate_in_actioncomm = 0;
// Add sender to context array to make sure that confirmation e-mail can be sent by trigger script
$sender_contact = new Contact($this->db);
$sender_contact->fetch(0, null, '', $from);
if (!empty($sender_contact->id)) {
$tickettocreate->context['contactid'] = $sender_contact->id;
}
$result = $tickettocreate->create($user);
if ($result <= 0) {
$errorforactions++;
@@ -3429,7 +3436,7 @@ class EmailCollector extends CommonObject
foreach ($attachments as $attachment) {
// $attachment->save($destdir.'/');
$typeattachment = (string) $attachment->getDisposition();
$filename = $attachment->getFilename();
$filename = $attachment->getName();
$content = $attachment->getContent();
$this->saveAttachment($destdir, $filename, $content);
}

View File

@@ -104,7 +104,7 @@ if (($id > 0) || $ref) {
}
$upload_dir = $conf->holiday->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, '');
$upload_dir = $conf->holiday->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, '');
$modulepart = 'holiday';
// Protection if external user
@@ -303,7 +303,7 @@ if ($object->id) {
$permissiontoadd = $user->hasRight('holiday', 'write');
$permtoedit = $user->hasRight('holiday', 'write');
$param = '&id='.$object->id;
$relativepathwithnofile = dol_sanitizeFileName($object->ref).'/';
$relativepathwithnofile = get_exdir(0, 0, 0, 1, $object, '').'/';
$savingdocmask = dol_sanitizeFileName($object->ref).'-__file__';
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';

View File

@@ -4157,7 +4157,7 @@ function migrate_delete_old_files($db, $langs, $conf)
//print '<b>'DOL_DOCUMENT_ROOT.$filetodelete."</b><br>\n";
if (preg_match('/\*/', $filetodelete) || file_exists(DOL_DOCUMENT_ROOT.$filetodelete)) {
//print "Process file ".$filetodelete."\n";
$result = dol_delete_file(DOL_DOCUMENT_ROOT.$filetodelete, 0, 0, 0, null, true, 0);
$result = dol_delete_file(DOL_DOCUMENT_ROOT.$filetodelete, 0, (preg_match('/\*/', $filetodelete) ? 1 : 0), 0, null, true, 0);
if (!$result) {
$langs->load("errors");
print '<div class="error">'.$langs->trans("Error").': '.$langs->trans("ErrorFailToDeleteFile", DOL_DOCUMENT_ROOT.$filetodelete);