diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 74852da84f7..d5731f014af 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -753,7 +753,7 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto $arrayofinclusion[] = '^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'\.pdf$'; } foreach ($listofobjectref as $tmppdf) { - $arrayofinclusion[] = '^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'_[a-zA-Z0-9-_]+\.pdf$'; // To include PDF generated from ODX files + $arrayofinclusion[] = '^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'_[a-zA-Z0-9\-\_\']+\.pdf$'; // To include PDF generated from ODX files } $listoffiles = dol_dir_list($uploaddir, 'all', 1, implode('|', $arrayofinclusion), '\.meta$|\.png', 'date', SORT_DESC, 0, true); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 2c9bb0c14c0..139c4b420ef 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1309,11 +1309,11 @@ abstract class CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Delete all links between an object $this and all its contacts + * Delete all links between an object $this and all its contacts in llx_element_contact * * @param string $source '' or 'internal' or 'external' * @param string $code Type of contact (code or id) - * @return int >0 if OK, <0 if KO + * @return int <0 if KO, 0=Nothing done, >0 if OK */ public function delete_linked_contact($source = '', $code = '') { @@ -1329,11 +1329,15 @@ abstract class CommonObject $listId = implode(",", $temp); } + // If $listId is empty, we have not criteria on fk_c_type_contact so we will delete record on element_id for + // any type or record instead of only the ones of the current object. So we do nothing in such a case. + if (empty($listId)) { + return 0; + } + $sql = "DELETE FROM ".$this->db->prefix()."element_contact"; $sql .= " WHERE element_id = ".((int) $this->id); - if (!empty($listId)) { - $sql .= " AND fk_c_type_contact IN (".$this->db->sanitize($listId).")"; - } + $sql .= " AND fk_c_type_contact IN (".$this->db->sanitize($listId).")"; dol_syslog(get_class($this)."::delete_linked_contact", LOG_DEBUG); if ($this->db->query($sql)) { diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index c57ee0c5106..8843a9f9177 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -21,7 +21,6 @@ */ class FormSetup { - /** * @var DoliDB Database handler. */ @@ -1073,16 +1072,18 @@ class FormSetupItem } } } elseif (preg_match('/emailtemplate:/', $this->type)) { - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; - $formmail = new FormMail($this->db); + if ($this->fieldValue > 0) { + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; + $formmail = new FormMail($this->db); - $tmp = explode(':', $this->type); + $tmp = explode(':', $this->type); - $template = $formmail->getEMailTemplate($this->db, $tmp[1], $user, $this->langs, $this->fieldValue); - if (is_numeric($template) && $template < 0) { - $this->setErrors($formmail->errors); + $template = $formmail->getEMailTemplate($this->db, $tmp[1], $user, $this->langs, $this->fieldValue); + if (is_numeric($template) && $template < 0) { + $this->setErrors($formmail->errors); + } + $out.= $this->langs->trans($template->label); } - $out.= $this->langs->trans($template->label); } elseif (preg_match('/category:/', $this->type)) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $c = new Categorie($this->db); @@ -1108,6 +1109,7 @@ class FormSetupItem } } elseif ($this->type == 'product') { require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; + $product = new Product($this->db); $resprod = $product->fetch($this->fieldValue); if ($resprod > 0) { diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index b52e0974b9a..ceb5b95c1f3 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -772,7 +772,7 @@ class Don extends CommonObject */ public function setPaid($id, $modepayment = 0) { - $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 2"; + $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 2, paid = 1"; if ($modepayment) { $sql .= ", fk_payment = ".((int) $modepayment); } @@ -782,6 +782,7 @@ class Don extends CommonObject if ($resql) { if ($this->db->affected_rows($resql)) { $this->statut = 2; + $this->paid = 1; return 1; } else { return 0; diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index f7101b2f85a..e258f057e69 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1210,11 +1210,17 @@ if (empty($reshook)) { unset($date); } else { + $error++; setEventMessages($object->error, $object->errors, 'errors'); } } - $action = ''; + if (!$error) { + header("Location: ".$_SERVER["PHP_SELF"]."?id=".GETPOST('id', 'int')); + exit; + } else { + $action = ''; + } } if ($action == 'confirm_delete_line' && GETPOST("confirm", 'alpha') == "yes" && $user->rights->expensereport->creer) { diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index b851211e2d8..7eedcc29403 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2990,7 +2990,8 @@ if ($action == 'create') { } if (isset($objectidnext) && $objectidnext > 0) { $facthatreplace = new FactureFournisseur($db); - $facthatreplace->fetch($facidnext); + + $facthatreplace->fetch($objectidnext); print ' '.str_replace('{s1}', $facthatreplace->getNomUrl(1), $langs->transnoentities("ReplacedByInvoice", '{s1}')).''; } if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT) { diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index 8b9feb7b60a..dea2a1a596e 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -55,9 +55,6 @@ global $langs, $user; // Libraries require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; require_once '../lib/mymodule.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; - - //require_once "../class/myclass.class.php"; // Translations diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index c929c2486bd..aafea0365e0 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -229,9 +229,10 @@ if ($action == "view_ticketlist") { $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); $filter = array(); + $param = '&action=view_ticketlist'; if (!empty($entity) && isModEnabled('multicompany')) { - $param .= '&entity='.$entity; + $param .= '&entity='.((int) $entity); } // Definition of fields for list @@ -407,7 +408,8 @@ if ($action == "view_ticketlist") { $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); - print_barre_liste($langs->trans('TicketList'), $page, '/public/ticket/list.php', $param, $sortfield, $sortorder, '', $num, $num_total, 'ticket'); + + print_barre_liste($langs->trans('TicketList'), $page, 'list.php', $param, $sortfield, $sortorder, '', $num, $num_total, 'ticket'); // Search bar print '
'."\n"; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index de4b84b5975..767517b362c 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -3783,7 +3783,7 @@ td.border, div.tagtable div div.border { } -.fichehalfright table.noborder { +.fichehalfright table.noborder , .fichehalfleft table.noborder{ margin: 0px 0px 0px 0px; } table.liste, table.noborder:not(.paymenttable):not(.margintable):not(.tableforcontact), table.formdoc, div.noborder:not(.paymenttable):not(.margintable):not(.tableforcontact) {