Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into 16.0

This commit is contained in:
Laurent Destailleur 2023-01-26 02:16:32 +01:00
commit f6004d1b01
6 changed files with 24 additions and 11 deletions

View File

@ -744,7 +744,7 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto
$arrayofinclusion[] = '^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'\.pdf$'; $arrayofinclusion[] = '^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'\.pdf$';
} }
foreach ($listofobjectref as $tmppdf) { 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); $listoffiles = dol_dir_list($uploaddir, 'all', 1, implode('|', $arrayofinclusion), '\.meta$|\.png', 'date', SORT_DESC, 0, true);

View File

@ -1298,11 +1298,11 @@ abstract class CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // 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 $source '' or 'internal' or 'external'
* @param string $code Type of contact (code or id) * @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 = '') public function delete_linked_contact($source = '', $code = '')
{ {
@ -1318,11 +1318,15 @@ abstract class CommonObject
$listId = implode(",", $temp); $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 = "DELETE FROM ".$this->db->prefix()."element_contact";
$sql .= " WHERE element_id = ".((int) $this->id); $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); dol_syslog(get_class($this)."::delete_linked_contact", LOG_DEBUG);
if ($this->db->query($sql)) { if ($this->db->query($sql)) {

View File

@ -772,7 +772,7 @@ class Don extends CommonObject
*/ */
public function setPaid($id, $modepayment = 0) 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) { if ($modepayment) {
$sql .= ", fk_payment = ".((int) $modepayment); $sql .= ", fk_payment = ".((int) $modepayment);
} }
@ -782,6 +782,7 @@ class Don extends CommonObject
if ($resql) { if ($resql) {
if ($this->db->affected_rows($resql)) { if ($this->db->affected_rows($resql)) {
$this->statut = 2; $this->statut = 2;
$this->paid = 1;
return 1; return 1;
} else { } else {
return 0; return 0;

View File

@ -1206,12 +1206,18 @@ if (empty($reshook)) {
unset($date); unset($date);
} else { } else {
$error++;
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
if (!$error) {
header("Location: ".$_SERVER["PHP_SELF"]."?id=".GETPOST('id', 'int'));
exit;
} else {
$action = ''; $action = '';
} }
}
if ($action == 'confirm_delete_line' && GETPOST("confirm", 'alpha') == "yes" && $user->rights->expensereport->creer) { if ($action == 'confirm_delete_line' && GETPOST("confirm", 'alpha') == "yes" && $user->rights->expensereport->creer) {
$object = new ExpenseReport($db); $object = new ExpenseReport($db);

View File

@ -226,9 +226,10 @@ if ($action == "view_ticketlist") {
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
$filter = array(); $filter = array();
$param = '&action=view_ticketlist'; $param = '&action=view_ticketlist';
if (!empty($entity) && !empty($conf->multicompany->enabled)) { if (!empty($entity) && !empty($conf->multicompany->enabled)) {
$param .= '&entity='.$entity; $param .= '&entity='.((int) $entity);
} }
// Definition of fields for list // Definition of fields for list
@ -404,7 +405,8 @@ if ($action == "view_ticketlist") {
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) { if ($resql) {
$num = $db->num_rows($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 // Search bar
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].(!empty($entity) && !empty($conf->multicompany->enabled)?'?entity='.$entity:'').'" id="searchFormList" >'."\n"; print '<form method="POST" action="'.$_SERVER['PHP_SELF'].(!empty($entity) && !empty($conf->multicompany->enabled)?'?entity='.$entity:'').'" id="searchFormList" >'."\n";

View File

@ -3700,7 +3700,7 @@ td.border, div.tagtable div div.border {
} }
.fichehalfright table.noborder { .fichehalfright table.noborder , .fichehalfleft table.noborder{
margin: 0px 0px 0px 0px; 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) { table.liste, table.noborder:not(.paymenttable):not(.margintable):not(.tableforcontact), table.formdoc, div.noborder:not(.paymenttable):not(.margintable):not(.tableforcontact) {