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

This commit is contained in:
Laurent Destailleur 2023-01-26 02:21:27 +01:00
commit d96b2f9ae3
9 changed files with 36 additions and 23 deletions

View File

@ -753,7 +753,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

@ -1309,11 +1309,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 = '')
{ {
@ -1329,11 +1329,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

@ -21,7 +21,6 @@
*/ */
class FormSetup class FormSetup
{ {
/** /**
* @var DoliDB Database handler. * @var DoliDB Database handler.
*/ */
@ -1073,16 +1072,18 @@ class FormSetupItem
} }
} }
} elseif (preg_match('/emailtemplate:/', $this->type)) { } elseif (preg_match('/emailtemplate:/', $this->type)) {
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; if ($this->fieldValue > 0) {
$formmail = new FormMail($this->db); 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); $template = $formmail->getEMailTemplate($this->db, $tmp[1], $user, $this->langs, $this->fieldValue);
if (is_numeric($template) && $template < 0) { if (is_numeric($template) && $template < 0) {
$this->setErrors($formmail->errors); $this->setErrors($formmail->errors);
}
$out.= $this->langs->trans($template->label);
} }
$out.= $this->langs->trans($template->label);
} elseif (preg_match('/category:/', $this->type)) { } elseif (preg_match('/category:/', $this->type)) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$c = new Categorie($this->db); $c = new Categorie($this->db);
@ -1108,6 +1109,7 @@ class FormSetupItem
} }
} elseif ($this->type == 'product') { } elseif ($this->type == 'product') {
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$product = new Product($this->db); $product = new Product($this->db);
$resprod = $product->fetch($this->fieldValue); $resprod = $product->fetch($this->fieldValue);
if ($resprod > 0) { if ($resprod > 0) {

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

@ -1210,11 +1210,17 @@ if (empty($reshook)) {
unset($date); unset($date);
} else { } else {
$error++;
setEventMessages($object->error, $object->errors, 'errors'); 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) { if ($action == 'confirm_delete_line' && GETPOST("confirm", 'alpha') == "yes" && $user->rights->expensereport->creer) {

View File

@ -2990,7 +2990,8 @@ if ($action == 'create') {
} }
if (isset($objectidnext) && $objectidnext > 0) { if (isset($objectidnext) && $objectidnext > 0) {
$facthatreplace = new FactureFournisseur($db); $facthatreplace = new FactureFournisseur($db);
$facthatreplace->fetch($facidnext);
$facthatreplace->fetch($objectidnext);
print ' <span class="opacitymediumbycolor paddingleft">'.str_replace('{s1}', $facthatreplace->getNomUrl(1), $langs->transnoentities("ReplacedByInvoice", '{s1}')).'</span>'; print ' <span class="opacitymediumbycolor paddingleft">'.str_replace('{s1}', $facthatreplace->getNomUrl(1), $langs->transnoentities("ReplacedByInvoice", '{s1}')).'</span>';
} }
if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT) { if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT) {

View File

@ -55,9 +55,6 @@ global $langs, $user;
// Libraries // Libraries
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php"; require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
require_once '../lib/mymodule.lib.php'; require_once '../lib/mymodule.lib.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
//require_once "../class/myclass.class.php"; //require_once "../class/myclass.class.php";
// Translations // Translations

View File

@ -229,9 +229,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) && isModEnabled('multicompany')) { if (!empty($entity) && isModEnabled('multicompany')) {
$param .= '&entity='.$entity; $param .= '&entity='.((int) $entity);
} }
// Definition of fields for list // Definition of fields for list
@ -407,7 +408,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) && isModEnabled('multicompany')?'?entity='.$entity:'').'" id="searchFormList" >'."\n"; print '<form method="POST" action="'.$_SERVER['PHP_SELF'].(!empty($entity) && isModEnabled('multicompany')?'?entity='.$entity:'').'" id="searchFormList" >'."\n";

View File

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