From 1d59cdc41b346b88e0b27616190e2fb5e5267ef7 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Mon, 3 Apr 2023 10:13:11 +0200 Subject: [PATCH 1/9] FIX : Add the possibility to events oxwner to check their events from the list when the perm "Read the actions (events or tasks) of others" is not active --- htdocs/comm/action/class/actioncomm.class.php | 2 +- htdocs/comm/action/list.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index cf45a7d70d0..d930ea96b2c 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1566,7 +1566,7 @@ class ActionComm extends CommonObject } $canread = 0; - if ($user->rights->agenda->myactions->read && $this->authorid == $user->id) { + if ($user->rights->agenda->myactions->read && ($this->authorid == $user->id || $this->userownerid == $user->id)) { $canread = 1; // Can read my event } if ($user->rights->agenda->myactions->read && array_key_exists($user->id, $this->userassigned)) { diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index c9f0f31391f..bd1f628f55c 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -917,6 +917,7 @@ while ($i < $imaxinloop) { $actionstatic->datep = $db->jdate($obj->dp); $actionstatic->percentage = $obj->percent; $actionstatic->authorid = $obj->fk_user_author; + $actionstatic->userownerid = $obj->fk_user_action; // Initialize $this->userassigned && this->socpeopleassigned array && this->userownerid // but only if we need it From 9461550b8fe6d7e860d02a5f58e872b300c566c7 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Thu, 6 Apr 2023 22:40:51 +0200 Subject: [PATCH 2/9] FIX regression Undefined $datepaid As until v16 there was a $payment->datepaid set on line 97 of /don/payment/payement.php witch was corrected in v17 to $payment->datep = $datepaid de shall mot use this->datepaid in this class anymore --- htdocs/don/class/paymentdonation.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/don/class/paymentdonation.class.php b/htdocs/don/class/paymentdonation.class.php index b42f5fb4e4d..dd035d98894 100644 --- a/htdocs/don/class/paymentdonation.class.php +++ b/htdocs/don/class/paymentdonation.class.php @@ -130,7 +130,7 @@ class PaymentDonation extends CommonObject $now = dol_now(); // Validate parameters - if (!$this->datepaid) { + if (!$this->datep) { $this->error = 'ErrorBadValueForParameterCreatePaymentDonation'; return -1; } @@ -189,7 +189,7 @@ class PaymentDonation extends CommonObject $sql .= " fk_typepayment, num_payment, note, ext_payment_id, ext_payment_site,"; $sql .= " fk_user_creat, fk_bank)"; $sql .= " VALUES (".((int) $this->chid).", '".$this->db->idate($now)."',"; - $sql .= " '".$this->db->idate($this->datepaid)."',"; + $sql .= " '".$this->db->idate($this->datep)."',"; $sql .= " ".((float) price2num($totalamount)).","; $sql .= " ".((int) $this->paymenttype).", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note_public)."', "; $sql .= " ".($this->ext_payment_id ? "'".$this->db->escape($this->ext_payment_id)."'" : "null").", ".($this->ext_payment_site ? "'".$this->db->escape($this->ext_payment_site)."'" : "null").","; @@ -587,7 +587,7 @@ class PaymentDonation extends CommonObject // Insert payment into llx_bank $bank_line_id = $acc->addline( - $this->datepaid, + $this->datep, $this->paymenttype, // Payment mode id or code ("CHQ or VIR for example") $label, $amount, From fb6f3b573cf702782fcfeec58b160fb83e5e9cb1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 7 Apr 2023 11:34:51 +0200 Subject: [PATCH 3/9] Better log --- htdocs/emailcollector/class/emailcollector.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index af3529aa9ad..3af345fb10f 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -2169,6 +2169,8 @@ class EmailCollector extends CommonObject } } } + } else { + dol_syslog("One and only one existing third party has been found"); } } } @@ -2552,6 +2554,8 @@ class EmailCollector extends CommonObject } } } + } else { + $operationslog .= '
Project already exists msgid ='.dol_escape_htmltag($msgid); } } elseif ($operation['type'] == 'ticket') { // Create ticket From eae52f95d21ab6ff4694f417091d1adc1c866e2f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 7 Apr 2023 11:34:51 +0200 Subject: [PATCH 4/9] Better log --- htdocs/emailcollector/class/emailcollector.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index af3529aa9ad..7da3da4e83a 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -2169,6 +2169,8 @@ class EmailCollector extends CommonObject } } } + } else { + dol_syslog("One and only one existing third party has been found"); } } } @@ -2552,6 +2554,8 @@ class EmailCollector extends CommonObject } } } + } else { + $operationslog .= '
Project already exists for msgid ='.dol_escape_htmltag($msgid); } } elseif ($operation['type'] == 'ticket') { // Create ticket From 45fb3d9bbe97a1e7e0ca589cce57415cead9a8dd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 8 Apr 2023 12:11:00 +0200 Subject: [PATCH 5/9] FIX Search when criteria start with ! --- htdocs/core/lib/functions.lib.php | 39 +++++++++++++++---------------- htdocs/projet/list.php | 1 - 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f592b20ceea..c306005cffe 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9765,10 +9765,10 @@ function dol_getmypid() * like "keyword1 keyword2" = We want record field like keyword1 AND field like keyword2 * or like "keyword1|keyword2" = We want record field like keyword1 OR field like keyword2 * If param $mode is 1, can contains an operator <, > or = like "<10" or ">=100.5 < -1000" - * If param $mode is 2, can contains a list of int id separated by comma like "1,3,4" - * If param $mode is 3, can contains a list of string separated by comma like "a,b,c" - * @param integer $mode 0=value is list of keyword strings, 1=value is a numeric test (Example ">5.5 <10"), 2=value is a list of ID separated with comma (Example '1,3,4') - * 3=value is list of string separated with comma (Example 'text 1,text 2'), 4=value is a list of ID separated with comma (Example '2,7') to be used to search into a multiselect string '1,2,3,4' + * If param $mode is 2 or -2, can contains a list of int id separated by comma like "1,3,4" + * If param $mode is 3 or -3, can contains a list of string separated by comma like "a,b,c". + * @param integer $mode 0=value is list of keyword strings, 1=value is a numeric test (Example ">5.5 <10"), 2=value is a list of ID separated with comma (Example '1,3,4'), -2 is for exclude list, + * 3=value is list of string separated with comma (Example 'text 1,text 2'), -3 if for exclude list, 4=value is a list of ID separated with comma (Example '2,7') to be used to search into a multiselect string '1,2,3,4' * @param integer $nofirstand 1=Do not output the first 'AND' * @return string $res The statement to append to the SQL query * @see dolSqlDateFilter() @@ -9783,7 +9783,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) $value = preg_replace('/\*/', '%', $value); // Replace * with % } if ($mode == 1) { - $value = preg_replace('/([!<>=]+)\s+([0-9'.preg_quote($langs->trans("DecimalSeparator"), '/').'\-])/', '\1\2', $value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do + $value = preg_replace('/([!<>=]+)\s+([0-9'.preg_quote($langs->trans("DecimalSeparator"), '/').'\-])/', '\1\2', $value); // Clean string '< 10' into '<10' so we can then explode on space to get all tests to do } $value = preg_replace('/\s*\|\s*/', '|', $value); @@ -9794,16 +9794,15 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) $fields = array($fields); } - $j = 0; - foreach ($crits as $crit) { + $i1 = 0; // count the nb of and criteria added (all fields / criterias) + foreach ($crits as $crit) { // Loop on each AND criteria $crit = trim($crit); - $i = 0; - $i2 = 0; + $i2 = 0; // count the nb of valid criteria added for this this first criteria $newres = ''; foreach ($fields as $field) { if ($mode == 1) { $tmpcrits = explode('|', $crit); - $i3 = 0; // count the nb of valid criteria added for this field + $i3 = 0; // count the nb of valid criteria added for this current field foreach ($tmpcrits as $tmpcrit) { if ($tmpcrit !== '0' && empty($tmpcrit)) { continue; @@ -9830,7 +9829,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) $i3++; // a criteria was added to string } } - $i2++; + $i2++; // a criteria for 1 more field was added to string } elseif ($mode == 2 || $mode == -2) { $crit = preg_replace('/[^0-9,]/', '', $crit); // ID are always integer $newres .= ($i2 > 0 ? ' OR ' : '').$field." ".($mode == -2 ? 'NOT ' : ''); @@ -9838,7 +9837,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) if ($mode == -2) { $newres .= ' OR '.$field.' IS NULL'; } - $i2++; // a criteria was added to string + $i2++; // a criteria for 1 more field was added to string } elseif ($mode == 3 || $mode == -3) { $tmparray = explode(',', $crit); if (count($tmparray)) { @@ -9851,7 +9850,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) } } $newres .= ($i2 > 0 ? ' OR ' : '').$field." ".($mode == -3 ? 'NOT ' : '')."IN (".$db->sanitize($listofcodes, 1).")"; - $i2++; // a criteria was added to string + $i2++; // a criteria for 1 more field was added to string } if ($mode == -3) { $newres .= ' OR '.$field.' IS NULL'; @@ -9868,20 +9867,20 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) $newres .= ' OR '.$field." LIKE '%,".$db->escape($val)."'"; $newres .= ' OR '.$field." LIKE '%,".$db->escape($val).",%'"; $newres .= ')'; - $i2++; + $i2++; // a criteria for 1 more field was added to string (we can add several citeria for the same field as it is a multiselect search criteria) } } } } else { // $mode=0 $tmpcrits = explode('|', $crit); - $i3 = 0; // count the nb of valid criteria added for this field - foreach ($tmpcrits as $tmpcrit) { + $i3 = 0; // count the nb of valid criteria added for the current couple criteria/field + foreach ($tmpcrits as $tmpcrit) { // loop on each OR criteria if ($tmpcrit !== '0' && empty($tmpcrit)) { continue; } $tmpcrit = trim($tmpcrit); - if ($tmpcrit == '^$') { // If we search empty, we must combined different fields with AND + if ($tmpcrit == '^$' || strpos($crit, '!') === 0) { // If we search empty, we must combined different OR fields with AND $newres .= (($i2 > 0 || $i3 > 0) ? ' AND ' : ''); } else { $newres .= (($i2 > 0 || $i3 > 0) ? ' OR ' : ''); @@ -9927,15 +9926,15 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) $i3++; } - $i2++; // a criteria was added to string + + $i2++; // a criteria for 1 more field was added to string } - $i++; } if ($newres) { $res = $res.($res ? ' AND ' : '').($i2 > 1 ? '(' : '').$newres.($i2 > 1 ? ')' : ''); } - $j++; + $i1++; } $res = ($nofirstand ? "" : " AND ")."(".$res.")"; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 924930e14ac..0d75a0ce7f9 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -501,7 +501,6 @@ if ($search_opp_percent) { $sql .= dolSqlDateFilter('p.dateo', $search_sday, $search_smonth, $search_syear); $sql .= dolSqlDateFilter('p.datee', $search_eday, $search_emonth, $search_eyear); - if ($search_date_start_start) { $sql .= " AND p.dateo >= '".$db->idate($search_date_start_start)."'"; } From 7cf1487d2c2ddd8e450fa32a4278eb0ce6bb6e13 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Apr 2023 21:39:41 +0200 Subject: [PATCH 6/9] FIX jump to direct record on member search was broken --- htdocs/adherents/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index ec8b1159c1c..7593940a1a3 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -326,6 +326,7 @@ $help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_M $morejs = array(); $morecss = array(); + // Build and execute select // -------------------------------------------------------------------- if ((!empty($search_categ) && $search_categ > 0) || !empty($catid)) { From 97f73d74acffd410b08d9d7e53503af1c25ebcf5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 8 Apr 2023 12:32:00 +0200 Subject: [PATCH 7/9] Debug v17 - Fix table access in workstation constructor --- htdocs/workstation/class/workstation.class.php | 2 -- htdocs/workstation/workstation_card.php | 5 +++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php index 58f326e3749..cd6b4861e7b 100644 --- a/htdocs/workstation/class/workstation.class.php +++ b/htdocs/workstation/class/workstation.class.php @@ -182,8 +182,6 @@ class Workstation extends CommonObject $this->db = $db; - $this->fields['ref']['default'] = $this->getNextNumRef(); - if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) { $this->fields['rowid']['visible'] = 0; } diff --git a/htdocs/workstation/workstation_card.php b/htdocs/workstation/workstation_card.php index 0e16293bd11..19d8a67999c 100644 --- a/htdocs/workstation/workstation_card.php +++ b/htdocs/workstation/workstation_card.php @@ -148,8 +148,6 @@ if (empty($reshook)) { /* * View - * - * Put here all code to build page */ $form = new Form($db); @@ -190,6 +188,9 @@ llxHeader('', $title, $help_url); // Part to create if ($action == 'create') { + // Set default value of the property ref + $object->fields['ref']['default'] = $object->getNextNumRef(); + print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Workstation")), '', 'object_'.$object->picto); print '
'; From aacd9ce2ceb2e56aeee5e5be287a27597e81808c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 8 Apr 2023 13:33:11 +0200 Subject: [PATCH 8/9] css --- htdocs/workstation/workstation_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/workstation/workstation_list.php b/htdocs/workstation/workstation_list.php index d4ea81e769f..43038ff04f2 100644 --- a/htdocs/workstation/workstation_list.php +++ b/htdocs/workstation/workstation_list.php @@ -213,7 +213,7 @@ $formresource = new FormResource($db); $now = dol_now(); $help_url = 'EN:Module_Workstation'; -$title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("Workstations")); +$title = $langs->trans("Workstations"); $morejs = array(); $morecss = array(); From 1be641a30d2fcff328b96f0e44dd9cec425f3b03 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 8 Apr 2023 14:37:27 +0200 Subject: [PATCH 9/9] css --- htdocs/projet/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 0d75a0ce7f9..671f528483b 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -1400,7 +1400,7 @@ while ($i < $imaxinloop) { } // Project url if (!empty($arrayfields['p.ref']['checked'])) { - print ''; + print ''; print $object->getNomUrl(1, (!empty(GETPOST('search_usage_event_organization', 'int'))?'eventorganization':'')); if ($object->hasDelay()) { print img_warning($langs->trans('Late'));