diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 67926aa4bdb..d10bf9fd0b3 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3870,7 +3870,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)) { @@ -4131,7 +4131,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)) { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 66ea879552f..e6198c8bb6e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -10198,7 +10198,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; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index ad27dc50266..a72d7dbd176 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6774,7 +6774,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; } } diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index fccce0cc1a9..9033ff0c87d 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1562,7 +1562,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 { diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 6f05062276d..7e17b32b699 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -603,10 +603,7 @@ class modAgenda extends DolibarrModules // Permissions $this->remove($options); - $sql = array( - "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type='member' AND entity = ".((int) $conf->entity), - "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','member',".((int) $conf->entity).")" - ); + $sql = array(); return $this->_init($sql, $options); } diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index c6e97db9d6b..d1af564f527 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -2872,7 +2872,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 { @@ -3345,6 +3345,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++; @@ -3360,7 +3367,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); } diff --git a/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php b/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php index 2e02e7b8808..689fe8903fb 100644 --- a/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php +++ b/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php @@ -95,7 +95,7 @@ if (!getDolGlobalString('EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES')) { } print '