From b739e7ba22773e7bf5a706dffc1a49b58e71df57 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Wed, 5 May 2021 11:26:15 +0200 Subject: [PATCH 01/10] Fix #17491 : date extrafield filter works well now --- htdocs/core/tpl/extrafields_list_search_sql.tpl.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php index 1e62bd0a9d5..0f12ad52756 100644 --- a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php @@ -23,7 +23,11 @@ if (!empty($extrafieldsobjectkey) && !empty($search_array_options) && is_array($ if ($crit != '' && in_array($typ, array('date', 'datetime', 'timestamp'))) { - $sql .= " AND ".$extrafieldsobjectprefix.$tmpkey." = '".$db->idate($crit)."'"; + if($typ == 'date'){ + $sql .= " AND ".$extrafieldsobjectprefix.$tmpkey." = DATE('".$db->idate($crit)."')"; + }else{ + $sql .= " AND ".$extrafieldsobjectprefix.$tmpkey." = '".$db->idate($crit)."'"; + } } elseif (in_array($typ, array('boolean'))) { if ($crit !== '-1' && $crit !== '') { From 95be7e8a63aff8bfe9de15527f3fafd221bd5e9d Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 5 May 2021 09:29:52 +0000 Subject: [PATCH 02/10] Fixing style errors. --- htdocs/core/tpl/extrafields_list_search_sql.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php index 0f12ad52756..4445d34f63f 100644 --- a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php @@ -23,9 +23,9 @@ if (!empty($extrafieldsobjectkey) && !empty($search_array_options) && is_array($ if ($crit != '' && in_array($typ, array('date', 'datetime', 'timestamp'))) { - if($typ == 'date'){ + if ($typ == 'date'){ $sql .= " AND ".$extrafieldsobjectprefix.$tmpkey." = DATE('".$db->idate($crit)."')"; - }else{ + }else { $sql .= " AND ".$extrafieldsobjectprefix.$tmpkey." = '".$db->idate($crit)."'"; } } elseif (in_array($typ, array('boolean'))) From c39dbd81b34e31e9abc2a8912fd6d785fc94207d Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 7 May 2021 09:47:15 +0200 Subject: [PATCH 03/10] Fix #17491 : Update of fix date extrafield filter --- htdocs/core/tpl/extrafields_list_search_sql.tpl.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php index 4445d34f63f..e846390c7c5 100644 --- a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php @@ -23,9 +23,11 @@ if (!empty($extrafieldsobjectkey) && !empty($search_array_options) && is_array($ if ($crit != '' && in_array($typ, array('date', 'datetime', 'timestamp'))) { - if ($typ == 'date'){ - $sql .= " AND ".$extrafieldsobjectprefix.$tmpkey." = DATE('".$db->idate($crit)."')"; - }else { + if($typ == 'date'){ + include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + $crit = dol_get_first_hour($crit); + $sql .= " AND ".$extrafieldsobjectprefix.$tmpkey." = '".$db->idate($crit)."'"; + }else{ $sql .= " AND ".$extrafieldsobjectprefix.$tmpkey." = '".$db->idate($crit)."'"; } } elseif (in_array($typ, array('boolean'))) From d108496c677d106d30a0e8b10bf695e7f8eb5f06 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 7 May 2021 07:47:49 +0000 Subject: [PATCH 04/10] Fixing style errors. --- htdocs/core/tpl/extrafields_list_search_sql.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php index e846390c7c5..ffd89bbc992 100644 --- a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php @@ -23,11 +23,11 @@ if (!empty($extrafieldsobjectkey) && !empty($search_array_options) && is_array($ if ($crit != '' && in_array($typ, array('date', 'datetime', 'timestamp'))) { - if($typ == 'date'){ + if ($typ == 'date'){ include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $crit = dol_get_first_hour($crit); $sql .= " AND ".$extrafieldsobjectprefix.$tmpkey." = '".$db->idate($crit)."'"; - }else{ + }else { $sql .= " AND ".$extrafieldsobjectprefix.$tmpkey." = '".$db->idate($crit)."'"; } } elseif (in_array($typ, array('boolean'))) From f84817f0f6e1dd382970eac111803e247a2510c2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 11 May 2021 23:49:33 +0200 Subject: [PATCH 05/10] FIX rss module on servers with allow_url_fopen=0 --- htdocs/core/class/rssparser.class.php | 350 +++++++++++++------------- 1 file changed, 176 insertions(+), 174 deletions(-) diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php index 578e180edff..5f5676601a0 100644 --- a/htdocs/core/class/rssparser.class.php +++ b/htdocs/core/class/rssparser.class.php @@ -1,19 +1,19 @@ * -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ /** * \file htdocs/core/class/rssparser.class.php @@ -181,7 +181,7 @@ class RssParser * @param string $urlRSS Url to parse * @param int $maxNb Max nb of records to get (0 for no limit) * @param int $cachedelay 0=No cache, nb of seconds we accept cache files (cachedir must also be defined) - * @param string $cachedir Directory where to save cache file + * @param string $cachedir Directory where to save cache file (For example $conf->externalrss->dir_temp) * @return int <0 if KO, >0 if OK */ public function parser($urlRSS, $maxNb = 0, $cachedelay = 60, $cachedir = '') @@ -189,13 +189,13 @@ class RssParser global $conf; include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; $rss = ''; $str = ''; // This will contain content of feed // Check parameters - if (!dol_is_url($urlRSS)) - { + if (!dol_is_url($urlRSS)) { $this->error = "ErrorBadUrl"; return -1; } @@ -209,11 +209,9 @@ class RssParser // Search into cache $foundintocache = 0; - if ($cachedelay > 0 && $cachedir) - { + if ($cachedelay > 0 && $cachedir) { $filedate = dol_filemtime($newpathofdestfile); - if ($filedate >= ($nowgmt - $cachedelay)) - { + if ($filedate >= ($nowgmt - $cachedelay)) { //dol_syslog("RssParser::parser cache file ".$newpathofdestfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay.") so we use it."); $foundintocache = 1; @@ -224,32 +222,22 @@ class RssParser } // Load file into $str - if ($foundintocache) // Cache file found and is not too old - { + if ($foundintocache) { // Cache file found and is not too old $str = file_get_contents($newpathofdestfile); } else { try { - ini_set("user_agent", "Dolibarr ERP-CRM RSS reader"); - ini_set("max_execution_time", $conf->global->MAIN_USE_RESPONSE_TIMEOUT); - ini_set("default_socket_timeout", $conf->global->MAIN_USE_RESPONSE_TIMEOUT); - - $opts = array('http'=>array('method'=>"GET")); - if (!empty($conf->global->MAIN_USE_CONNECT_TIMEOUT)) $opts['http']['timeout'] = $conf->global->MAIN_USE_CONNECT_TIMEOUT; - if (!empty($conf->global->MAIN_PROXY_USE)) $opts['http']['proxy'] = 'tcp://'.$conf->global->MAIN_PROXY_HOST.':'.$conf->global->MAIN_PROXY_PORT; - //var_dump($opts);exit; - $context = stream_context_create($opts); - - $str = file_get_contents($this->_urlRSS, false, $context); + $result = getURLContent($this->_urlRSS, 'GET', '', 1, array(), array('http', 'https'), 0); + if (!empty($result['content'])) { + $str = $result['content']; + } } catch (Exception $e) { print 'Error retrieving URL '.$this->_urlRSS.' - '.$e->getMessage(); } } - if ($str !== false) - { + if ($str !== false) { // Convert $str into xml - if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) - { + if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) { //print 'xx'.LIBXML_NOCDATA; libxml_use_internal_errors(false); $rss = simplexml_load_string($str, "SimpleXMLElement", LIBXML_NOCDATA); @@ -276,19 +264,20 @@ class RssParser } // If $rss loaded - if ($rss) - { + if ($rss) { // Save file into cache - if (empty($foundintocache) && $cachedir) - { + if (empty($foundintocache) && $cachedir) { dol_syslog(get_class($this)."::parser cache file ".$newpathofdestfile." is saved onto disk."); - if (!dol_is_dir($cachedir)) dol_mkdir($cachedir); + if (!dol_is_dir($cachedir)) { + dol_mkdir($cachedir); + } $fp = fopen($newpathofdestfile, 'w'); - if ($fp) - { + if ($fp) { fwrite($fp, $str); fclose($fp); - if (!empty($conf->global->MAIN_UMASK)) $newmask = $conf->global->MAIN_UMASK; + if (!empty($conf->global->MAIN_UMASK)) { + $newmask = $conf->global->MAIN_UMASK; + } @chmod($newpathofdestfile, octdec($newmask)); $this->_lastfetchdate = $nowgmt; @@ -299,10 +288,11 @@ class RssParser unset($str); // Free memory - if (empty($rss->_format)) // If format not detected automatically - { + if (empty($rss->_format)) { // If format not detected automatically $rss->_format = 'rss'; - if (empty($rss->channel)) $rss->_format = 'atom'; + if (empty($rss->channel)) { + $rss->_format = 'atom'; + } } $items = array(); @@ -311,46 +301,98 @@ class RssParser if ($rss->_format == 'rss') { //var_dump($rss); if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) { - if (!empty($rss->channel->language)) $this->_language = (string) $rss->channel->language; - if (!empty($rss->channel->generator)) $this->_generator = (string) $rss->channel->generator; - if (!empty($rss->channel->copyright)) $this->_copyright = (string) $rss->channel->copyright; - if (!empty($rss->channel->lastbuilddate)) $this->_lastbuilddate = (string) $rss->channel->lastbuilddate; - if (!empty($rss->channel->image->url[0])) $this->_imageurl = (string) $rss->channel->image->url[0]; - if (!empty($rss->channel->link)) $this->_link = (string) $rss->channel->link; - if (!empty($rss->channel->title)) $this->_title = (string) $rss->channel->title; - if (!empty($rss->channel->description)) $this->_description = (string) $rss->channel->description; + if (!empty($rss->channel->language)) { + $this->_language = (string) $rss->channel->language; + } + if (!empty($rss->channel->generator)) { + $this->_generator = (string) $rss->channel->generator; + } + if (!empty($rss->channel->copyright)) { + $this->_copyright = (string) $rss->channel->copyright; + } + if (!empty($rss->channel->lastbuilddate)) { + $this->_lastbuilddate = (string) $rss->channel->lastbuilddate; + } + if (!empty($rss->channel->image->url[0])) { + $this->_imageurl = (string) $rss->channel->image->url[0]; + } + if (!empty($rss->channel->link)) { + $this->_link = (string) $rss->channel->link; + } + if (!empty($rss->channel->title)) { + $this->_title = (string) $rss->channel->title; + } + if (!empty($rss->channel->description)) { + $this->_description = (string) $rss->channel->description; + } } else { //var_dump($rss->channel); - if (!empty($rss->channel['language'])) $this->_language = (string) $rss->channel['language']; - if (!empty($rss->channel['generator'])) $this->_generator = (string) $rss->channel['generator']; - if (!empty($rss->channel['copyright'])) $this->_copyright = (string) $rss->channel['copyright']; - if (!empty($rss->channel['lastbuilddate'])) $this->_lastbuilddate = (string) $rss->channel['lastbuilddate']; - if (!empty($rss->image['url'])) $this->_imageurl = (string) $rss->image['url']; - if (!empty($rss->channel['link'])) $this->_link = (string) $rss->channel['link']; - if (!empty($rss->channel['title'])) $this->_title = (string) $rss->channel['title']; - if (!empty($rss->channel['description'])) $this->_description = (string) $rss->channel['description']; + if (!empty($rss->channel['language'])) { + $this->_language = (string) $rss->channel['language']; + } + if (!empty($rss->channel['generator'])) { + $this->_generator = (string) $rss->channel['generator']; + } + if (!empty($rss->channel['copyright'])) { + $this->_copyright = (string) $rss->channel['copyright']; + } + if (!empty($rss->channel['lastbuilddate'])) { + $this->_lastbuilddate = (string) $rss->channel['lastbuilddate']; + } + if (!empty($rss->image['url'])) { + $this->_imageurl = (string) $rss->image['url']; + } + if (!empty($rss->channel['link'])) { + $this->_link = (string) $rss->channel['link']; + } + if (!empty($rss->channel['title'])) { + $this->_title = (string) $rss->channel['title']; + } + if (!empty($rss->channel['description'])) { + $this->_description = (string) $rss->channel['description']; + } } - if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) $items = $rss->channel->item; // With simplexml - else $items = $rss->items; // With xmlparse + if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) { + $items = $rss->channel->item; // With simplexml + } else { + $items = $rss->items; // With xmlparse + } //var_dump($items);exit; } elseif ($rss->_format == 'atom') { //var_dump($rss); - if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) - { - if (!empty($rss->generator)) $this->_generator = (string) $rss->generator; - if (!empty($rss->lastbuilddate)) $this->_lastbuilddate = (string) $rss->modified; - if (!empty($rss->link->href)) $this->_link = (string) $rss->link->href; - if (!empty($rss->title)) $this->_title = (string) $rss->title; - if (!empty($rss->description)) $this->_description = (string) $rss->description; + if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) { + if (!empty($rss->generator)) { + $this->_generator = (string) $rss->generator; + } + if (!empty($rss->lastbuilddate)) { + $this->_lastbuilddate = (string) $rss->modified; + } + if (!empty($rss->link->href)) { + $this->_link = (string) $rss->link->href; + } + if (!empty($rss->title)) { + $this->_title = (string) $rss->title; + } + if (!empty($rss->description)) { + $this->_description = (string) $rss->description; + } } else { //if (!empty($rss->channel['rss_language'])) $this->_language = (string) $rss->channel['rss_language']; - if (!empty($rss->channel['generator'])) $this->_generator = (string) $rss->channel['generator']; + if (!empty($rss->channel['generator'])) { + $this->_generator = (string) $rss->channel['generator']; + } //if (!empty($rss->channel['rss_copyright'])) $this->_copyright = (string) $rss->channel['rss_copyright']; - if (!empty($rss->channel['modified'])) $this->_lastbuilddate = (string) $rss->channel['modified']; + if (!empty($rss->channel['modified'])) { + $this->_lastbuilddate = (string) $rss->channel['modified']; + } //if (!empty($rss->image['rss_url'])) $this->_imageurl = (string) $rss->image['rss_url']; - if (!empty($rss->channel['link'])) $this->_link = (string) $rss->channel['link']; - if (!empty($rss->channel['title'])) $this->_title = (string) $rss->channel['title']; + if (!empty($rss->channel['link'])) { + $this->_link = (string) $rss->channel['link']; + } + if (!empty($rss->channel['title'])) { + $this->_title = (string) $rss->channel['title']; + } //if (!empty($rss->channel['rss_description'])) $this->_description = (string) $rss->channel['rss_description']; if (!empty($rss->channel)) { @@ -358,9 +400,12 @@ class RssParser } } if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) { - $tmprss = xml2php($rss); $items = $tmprss['entry']; - } // With simplexml - else $items = $rss->items; // With xmlparse + $tmprss = xml2php($rss); + $items = $tmprss['entry']; + } else { + // With simplexml + $items = $rss->items; // With xmlparse + } //var_dump($items);exit; } @@ -436,7 +481,9 @@ class RssParser $i++; - if ($i > $maxNb) break; // We get all records we want + if ($i > $maxNb) { + break; // We get all records we want + } } } @@ -466,18 +513,15 @@ class RssParser // check for a namespace, and split if found $ns = false; - if (strpos($element, ':')) - { + if (strpos($element, ':')) { list($ns, $el) = explode(':', $element, 2); } - if ($ns and $ns != 'rdf') - { + if ($ns and $ns != 'rdf') { $this->current_namespace = $ns; } // if feed type isn't set, then this is first element of feed identify feed from root element - if (empty($this->_format)) - { + if (empty($this->_format)) { if ($el == 'rdf') { $this->_format = 'rss'; $this->feed_version = '1.0'; @@ -492,75 +536,54 @@ class RssParser return; } - if ($el == 'channel') - { + if ($el == 'channel') { $this->inchannel = true; - } elseif ($el == 'item' or $el == 'entry') - { + } elseif ($el == 'item' or $el == 'entry') { $this->initem = true; if (isset($attrs['rdf:about'])) { $this->current_item['about'] = $attrs['rdf:about']; } - } - - // if we're in the default namespace of an RSS feed, - // record textinput or image fields - elseif ( - $this->_format == 'rss' and - $this->current_namespace == '' and - $el == 'textinput' ) - { - $this->intextinput = true; - } elseif ( - $this->_format == 'rss' and - $this->current_namespace == '' and - $el == 'image' ) - { - $this->inimage = true; - } - - // handle atom content constructs - elseif ($this->_format == 'atom' and in_array($el, $this->_CONTENT_CONSTRUCTS)) - { + } elseif ($this->_format == 'rss' and + $this->current_namespace == '' and + $el == 'textinput') { + // if we're in the default namespace of an RSS feed, + // record textinput or image fields + $this->intextinput = true; + } elseif ($this->_format == 'rss' and + $this->current_namespace == '' and + $el == 'image') { + $this->inimage = true; + } elseif ($this->_format == 'atom' and in_array($el, $this->_CONTENT_CONSTRUCTS)) { + // handle atom content constructs // avoid clashing w/ RSS mod_content if ($el == 'content') { $el = 'atom_content'; } $this->incontent = $el; - } - - // if inside an Atom content construct (e.g. content or summary) field treat tags as text - elseif ($this->_format == 'atom' and $this->incontent) - { + } elseif ($this->_format == 'atom' and $this->incontent) { + // if inside an Atom content construct (e.g. content or summary) field treat tags as text // if tags are inlined, then flatten $attrs_str = join(' ', array_map('map_attrs', array_keys($attrs), array_values($attrs))); $this->append_content("<$element $attrs_str>"); array_unshift($this->stack, $el); - } - - // Atom support many links per containging element. - // Magpie treats link elements of type rel='alternate' - // as being equivalent to RSS's simple link element. - // - elseif ($this->_format == 'atom' and $el == 'link') - { - if (isset($attrs['rel']) && $attrs['rel'] == 'alternate') - { + } elseif ($this->_format == 'atom' and $el == 'link') { + // Atom support many links per containging element. + // Magpie treats link elements of type rel='alternate' + // as being equivalent to RSS's simple link element. + if (isset($attrs['rel']) && $attrs['rel'] == 'alternate') { $link_el = 'link'; - } elseif (!isset($attrs['rel'])) - { + } elseif (!isset($attrs['rel'])) { $link_el = 'link'; } else { $link_el = 'link_'.$attrs['rel']; } $this->append($link_el, $attrs['href']); - } - // set stack[0] to current element - else { + } else { + // set stack[0] to current element array_unshift($this->stack, $el); } } @@ -577,8 +600,7 @@ class RssParser public function feed_cdata($p, $text) { // phpcs:enable - if ($this->_format == 'atom' and $this->incontent) - { + if ($this->_format == 'atom' and $this->incontent) { $this->append_content($text); } else { $current_el = join('_', array_reverse($this->stack)); @@ -599,28 +621,22 @@ class RssParser // phpcs:enable $el = strtolower($el); - if ($el == 'item' or $el == 'entry') - { + if ($el == 'item' or $el == 'entry') { $this->items[] = $this->current_item; $this->current_item = array(); $this->initem = false; - } elseif ($this->_format == 'rss' and $this->current_namespace == '' and $el == 'textinput') - { + } elseif ($this->_format == 'rss' and $this->current_namespace == '' and $el == 'textinput') { $this->intextinput = false; - } elseif ($this->_format == 'rss' and $this->current_namespace == '' and $el == 'image') - { + } elseif ($this->_format == 'rss' and $this->current_namespace == '' and $el == 'image') { $this->inimage = false; - } elseif ($this->_format == 'atom' and in_array($el, $this->_CONTENT_CONSTRUCTS)) - { + } elseif ($this->_format == 'atom' and in_array($el, $this->_CONTENT_CONSTRUCTS)) { $this->incontent = false; - } elseif ($el == 'channel' or $el == 'feed') - { + } elseif ($el == 'channel' or $el == 'feed') { $this->inchannel = false; } elseif ($this->_format == 'atom' and $this->incontent) { // balance tags properly // note: i don't think this is actually neccessary - if ($this->stack[0] == $el) - { + if ($this->stack[0] == $el) { $this->append_content(""); } else { $this->append_content("<$el />"); @@ -679,8 +695,7 @@ class RssParser if (!$el) { return; } - if ($this->current_namespace) - { + if ($this->current_namespace) { if ($this->initem) { $this->concat($this->current_item[$this->current_namespace][$el], $text); } elseif ($this->inchannel) { @@ -714,11 +729,9 @@ class RssParser { $result = ""; - if (isset($item['summary'])) - { + if (isset($item['summary'])) { $result = $item['summary']; - } elseif (isset($item['atom_content'])) - { + } elseif (isset($item['atom_content'])) { $result = $item['atom_content']; } @@ -728,8 +741,7 @@ class RssParser $result = str_replace("\n", "", $result); - if (strlen($result) > $maxlength) - { + if (strlen($result) > $maxlength) { $result = substr($result, 0, $maxlength); $result .= "..."; } @@ -745,28 +757,23 @@ class RssParser */ private function getAtomImageUrl(array $feed) { - if (isset($feed['icon'])) - { + if (isset($feed['icon'])) { return $feed['logo']; } - if (isset($feed['icon'])) - { + if (isset($feed['icon'])) { return $feed['logo']; } - if (isset($feed['webfeeds:logo'])) - { + if (isset($feed['webfeeds:logo'])) { return $feed['webfeeds:logo']; } - if (isset($feed['webfeeds:icon'])) - { + if (isset($feed['webfeeds:icon'])) { return $feed['webfeeds:icon']; } - if (isset($feed['webfeeds:wordmark'])) - { + if (isset($feed['webfeeds:wordmark'])) { return $feed['webfeeds:wordmark']; } @@ -786,27 +793,23 @@ function xml2php($xml) $fils = 0; $tab = false; $array = array(); - foreach ($xml->children() as $key => $value) - { + foreach ($xml->children() as $key => $value) { $child = xml2php($value); //To deal with the attributes - foreach ($value->attributes() as $ak=>$av) - { + foreach ($value->attributes() as $ak => $av) { $child[$ak] = (string) $av; } //Let see if the new child is not in the array - if ($tab === false && in_array($key, array_keys($array))) - { + if ($tab === false && in_array($key, array_keys($array))) { //If this element is already in the array we will create an indexed array $tmp = $array[$key]; $array[$key] = null; $array[$key][] = $tmp; $array[$key][] = $child; $tab = true; - } elseif ($tab === true) - { + } elseif ($tab === true) { //Add an element in an existing array $array[$key][] = $child; } else { @@ -818,8 +821,7 @@ function xml2php($xml) } - if ($fils == 0) - { + if ($fils == 0) { return (string) $xml; } From ce6df0ee4acb165cc685091e37f7419d462b232f Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Fri, 14 May 2021 13:50:12 +0200 Subject: [PATCH 06/10] FIX: Filter of the dates in the lists is lost --- htdocs/comm/propal/list.php | 14 +++++++------- htdocs/commande/list.php | 12 +++++------- htdocs/compta/facture/list.php | 14 +++++++------- htdocs/expedition/list.php | 14 +++++++------- 4 files changed, 26 insertions(+), 28 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 5190adb379a..8060bc94698 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -10,7 +10,7 @@ * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2016-2018 Ferran Marcet + * Copyright (C) 2016-2021 Ferran Marcet * Copyright (C) 2017-2018 Charlene Benke * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2019 Alexandre Spangaro @@ -504,12 +504,12 @@ if ($resql) if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); if ($sall) $param .= '&sall='.urlencode($sall); - if ($search_date_start) $param .= '&search_date_start='.urlencode($search_date_start); - if ($search_date_end) $param .= '&search_date_end='.urlencode($search_date_end); - if ($search_dateend_start) $param .= '&search_dateend_start='.urlencode($search_dateend_start); - if ($search_dateend_end) $param .= '&search_dateend_end='.urlencode($search_dateend_end); - if ($search_datedelivery_start) $param .= '&search_datedelivery_start='.urlencode($search_datedelivery_start); - if ($search_datedelivery_end) $param .= '&search_datedelivery_end='.urlencode($search_datedelivery_end); + if ($search_date_start) $param .= '&search_date_startday='.urlencode(dol_print_date($search_date_start,'%d')).'&search_date_startmonth='.urlencode(dol_print_date($search_date_start,'%m')).'&search_date_startyear='.urlencode(dol_print_date($search_date_start,'%Y')); + if ($search_date_end) $param .= '&search_date_endday='.urlencode(dol_print_date($search_date_end,'%d')).'&search_date_endmonth='.urlencode(dol_print_date($search_date_end,'%m')).'&search_date_endyear='.urlencode(dol_print_date($search_date_end,'%Y')); + if ($search_dateend_start) $param .= '&search_dateend_startday='.urlencode(dol_print_date($search_dateend_start,'%d')).'&search_dateend_startmonth='.urlencode(dol_print_date($search_dateend_start,'%m')).'&search_dateend_startyear='.urlencode(dol_print_date($search_dateend_start,'%Y')); + if ($search_dateend_end) $param .= '&search_dateend_endday='.urlencode(dol_print_date($search_dateend_end,'%d')).'&search_dateend_endmonth='.urlencode(dol_print_date($search_dateend_end,'%m')).'&search_dateend_endyear='.urlencode(dol_print_date($search_dateend_end,'%Y')); + if ($search_datedelivery_start) $param .= '&search_datedelivery_startday='.urlencode(dol_print_date($search_datedelivery_start,'%d')).'&search_datedelivery_startmonth='.urlencode(dol_print_date($search_datedelivery_start,'%m')).'&search_datedelivery_startyear='.urlencode(dol_print_date($search_datedelivery_start,'%Y')); + if ($search_datedelivery_end) $param .= '&search_datedelivery_endday='.urlencode(dol_print_date($search_datedelivery_end,'%d')).'&search_datedelivery_endmonth='.urlencode(dol_print_date($search_datedelivery_end,'%m')).'&search_datedelivery_endyear='.urlencode(dol_print_date($search_datedelivery_end,'%Y')); if ($search_ref) $param .= '&search_ref='.urlencode($search_ref); if ($search_refcustomer) $param .= '&search_refcustomer='.urlencode($search_refcustomer); if ($search_refproject) $param .= '&search_refproject='.urlencode($search_refproject); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 3efa8f534a4..9b3e865e459 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -9,7 +9,7 @@ * Copyright (C) 2015-2018 Frédéric France * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2016-2021 Ferran Marcet * Copyright (C) 2018 Charlene Benke * * This program is free software; you can redistribute it and/or modify @@ -55,10 +55,8 @@ $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'orderlist'; -$search_datecloture_start = GETPOST('search_datecloture_start', 'int'); -if (empty($search_datecloture_start)) $search_datecloture_start = dol_mktime(0, 0, 0, GETPOST('search_datecloture_startmonth', 'int'), GETPOST('search_datecloture_startday', 'int'), GETPOST('search_datecloture_startyear', 'int')); -$search_datecloture_end = GETPOST('search_datecloture_end', 'int'); -if (empty($search_datecloture_end)) $search_datecloture_end = dol_mktime(23, 59, 59, GETPOST('search_datecloture_endmonth', 'int'), GETPOST('search_datecloture_endday', 'int'), GETPOST('search_datecloture_endyear', 'int')); +$search_datecloture_start = dol_mktime(0, 0, 0, GETPOST('search_datecloture_startmonth', 'int'), GETPOST('search_datecloture_startday', 'int'), GETPOST('search_datecloture_startyear', 'int')); +$search_datecloture_end = dol_mktime(23, 59, 59, GETPOST('search_datecloture_endmonth', 'int'), GETPOST('search_datecloture_endday', 'int'), GETPOST('search_datecloture_endyear', 'int')); $search_dateorder_start = dol_mktime(0, 0, 0, GETPOST('search_dateorder_start_month', 'int'), GETPOST('search_dateorder_start_day', 'int'), GETPOST('search_dateorder_start_year', 'int')); $search_dateorder_end = dol_mktime(23, 59, 59, GETPOST('search_dateorder_end_month', 'int'), GETPOST('search_dateorder_end_day', 'int'), GETPOST('search_dateorder_end_year', 'int')); $search_datedelivery_start = dol_mktime(0, 0, 0, GETPOST('search_datedelivery_start_month', 'int'), GETPOST('search_datedelivery_start_day', 'int'), GETPOST('search_datedelivery_start_year', 'int')); @@ -446,8 +444,8 @@ if ($resql) if ($sall) $param .= '&sall='.urlencode($sall); if ($socid > 0) $param .= '&socid='.urlencode($socid); if ($search_status != '') $param .= '&search_status='.urlencode($search_status); - if ($search_datecloture_start) $param .= '&search_datecloture_start='.urlencode($search_datecloture_start); - if ($search_datecloture_end) $param .= '&search_datecloture_end='.urlencode($search_datecloture_end); + if ($search_datecloture_start) $param .= '&search_datecloture_startday='.dol_print_date($search_datecloture_start, '%d').'&search_datecloture_startmonth='.dol_print_date($search_datecloture_start, '%m').'&search_datecloture_startyear='.dol_print_date($search_datecloture_start, '%Y'); + if ($search_datecloture_end) $param .= '&search_datecloture_endday='.dol_print_date($search_datecloture_end, '%d').'&search_datecloture_endmonth='.dol_print_date($search_datecloture_end, '%m').'&search_datecloture_endyear='.dol_print_date($search_datecloture_end, '%Y'); if ($search_dateorder_start) $param .= '&search_dateorder_start_day='.dol_print_date($search_dateorder_start, '%d').'&search_dateorder_start_month='.dol_print_date($search_dateorder_start, '%m').'&search_dateorder_start_year='.dol_print_date($search_dateorder_start, '%Y'); if ($search_dateorder_end) $param .= '&search_dateorder_end_day='.dol_print_date($search_dateorder_end, '%d').'&search_dateorder_end_month='.dol_print_date($search_dateorder_end, '%m').'&search_dateorder_end_year='.dol_print_date($search_dateorder_end, '%Y'); if ($search_datedelivery_start) $param .= '&search_datedelivery_start_day='.dol_print_date($search_datedelivery_start, '%d').'&search_datedelivery_start_month='.dol_print_date($search_datedelivery_start, '%m').'&search_datedelivery_start_year='.dol_print_date($search_datedelivery_start, '%Y'); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index f427466c560..78cee038107 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -10,7 +10,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2015-2016 Ferran Marcet + * Copyright (C) 2015-2021 Ferran Marcet * Copyright (C) 2017 Josep Lluís Amador * Copyright (C) 2018 Charlene Benke * Copyright (C) 2019 Alexandre Spangaro @@ -616,12 +616,12 @@ if ($resql) if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); if ($sall) $param .= '&sall='.urlencode($sall); - if ($search_date_start) $param .= '&search_date_start='.urlencode($search_date_start); - if ($search_date_end) $param .= '&search_date_end='.urlencode($search_date_end); - if ($search_date_valid_start) $param .= '&search_date_valid_start='.urlencode($search_date_valid_start); - if ($search_date_valid_end) $param .= '&search_date_valid_end='.urlencode($search_date_valid_end); - if ($search_datelimit_start) $param .= '&search_datelimit_start='.urlencode($search_datelimit_start); - if ($search_datelimit_end) $param .= '&search_datelimit_end='.urlencode($search_datelimit_end); + if ($search_date_start) $param .= '&search_date_startday='.urlencode(dol_print_date($search_date_start,'%d')).'&search_date_startmonth='.urlencode(dol_print_date($search_date_start,'%m')).'&search_date_startyear='.urlencode(dol_print_date($search_date_start,'%Y')); + if ($search_date_end) $param .= '&search_date_endday='.urlencode(dol_print_date($search_date_end,'%d')).'&search_date_endmonth='.urlencode(dol_print_date($search_date_end,'%m')).'&search_date_endyear='.urlencode(dol_print_date($search_date_end,'%Y')); + if ($search_date_valid_start) $param .= '&search_date_valid_startday='.urlencode(dol_print_date($search_date_valid_start,'%d')).'&search_date_valid_startmonth='.urlencode(dol_print_date($search_date_valid_start,'%m')).'&search_date_valid_startyear='.urlencode(dol_print_date($search_date_valid_start,'%Y')); + if ($search_date_valid_end) $param .= '&search_date_valid_endday='.urlencode(dol_print_date($search_date_valid_end,'%d')).'&search_date_valid_endmonth='.urlencode(dol_print_date($search_date_valid_end,'%m')).'&search_date_valid_endyear='.urlencode(dol_print_date($search_date_valid_end,'%Y')); + if ($search_datelimit_start) $param .= '&search_datelimit_startday='.urlencode(dol_print_date($search_datelimit_start,'%d')).'&search_datelimit_startmonth='.urlencode(dol_print_date($search_datelimit_start,'%m')).'&search_datelimit_startyear='.urlencode(dol_print_date($search_datelimit_start,'%Y')); + if ($search_datelimit_end) $param .= '&search_datelimit_endday='.urlencode(dol_print_date($search_datelimit_end,'%d')).'&search_datelimit_endmonth='.urlencode(dol_print_date($search_datelimit_end,'%m')).'&search_datelimit_endyear='.urlencode(dol_print_date($search_datelimit_end,'%Y')); if ($search_ref) $param .= '&search_ref='.urlencode($search_ref); if ($search_refcustomer) $param .= '&search_refcustomer='.urlencode($search_refcustomer); if ($search_project_ref) $param .= '&search_project_ref='.urlencode($search_project_ref); diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 20bb6f298cb..2de5a755b72 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2005 Rodolphe Quiedeville * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin - * Copyright (C) 2016-2018 Ferran Marcet + * Copyright (C) 2016-2021 Ferran Marcet * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2020 Thibault FOUCART * @@ -340,10 +340,10 @@ if ($resql) if ($search_town) $param .= '&search_town='.urlencode($search_town); if ($search_zip) $param .= '&search_zip='.urlencode($search_zip); - if ($search_datedelivery_start) $param .= '&search_datedelivery_start='.urlencode($search_datedelivery_start); - if ($search_datedelivery_end) $param .= '&search_datedelivery_end='.urlencode($search_datedelivery_end); - if ($search_datereceipt_start) $param .= '&search_datereceipt_start='.urlencode($search_datereceipt_start); - if ($search_datereceipt_end) $param .= '&search_datereceipt_end='.urlencode($search_datereceipt_end); + if ($search_datedelivery_start) $param .= '&search_datedelivery_startday='.urlencode(dol_print_date($search_datedelivery_start,'%d')).'&search_datedelivery_startmonth='.urlencode(dol_print_date($search_datedelivery_start,'%m')).'&search_datedelivery_startyear='.urlencode(dol_print_date($search_datedelivery_start,'%Y')); + if ($search_datedelivery_end) $param .= '&search_datedelivery_endday='.urlencode(dol_print_date($search_datedelivery_end,'%d')).'&search_datedelivery_endmonth='.urlencode(dol_print_date($search_datedelivery_end,'%m')).'&search_datedelivery_endyear='.urlencode(dol_print_date($search_datedelivery_end,'%Y')); + if ($search_datereceipt_start) $param .= '&search_datereceipt_startday='.urlencode(dol_print_date($search_datereceipt_start,'%d')).'&search_datereceipt_startmonth='.urlencode(dol_print_date($search_datereceipt_start,'%m')).'&search_datereceipt_startyear='.urlencode(dol_print_date($search_datereceipt_start,'%Y')); + if ($search_datereceipt_end) $param .= '&search_datereceipt_endday='.urlencode(dol_print_date($search_datereceipt_end,'%d')).'&search_datereceipt_endmonth='.urlencode(dol_print_date($search_datereceipt_end,'%m')).'&search_datereceipt_endyear='.urlencode(dol_print_date($search_datereceipt_end,'%Y')); if ($search_product_category != '') $param .= '&search_product_category='.urlencode($search_product_category); if ($search_categ_cus > 0) $param .= '&search_categ_cus='.urlencode($search_categ_cus); @@ -506,11 +506,11 @@ if ($resql) print ''; print '
'; print $langs->trans('From').' '; - print $form->selectDate($search_delivery_start ? $search_delivery_start : -1, 'search_delivery_start', 0, 0, 1); + print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1, 'search_datedelivery_start', 0, 0, 1); print '
'; print '
'; print $langs->trans('to').' '; - print $form->selectDate($search_delivery_end ? $search_delivery_end : -1, 'search_delivery_end', 0, 0, 1); + print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1, 'search_datedelivery_end', 0, 0, 1); print '
'; print ''; } From 50d4d28c140f8f92c360c8eb6f8b5cfda8651d60 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 14 May 2021 11:54:50 +0000 Subject: [PATCH 07/10] Fixing style errors. --- htdocs/comm/propal/list.php | 12 ++++++------ htdocs/compta/facture/list.php | 12 ++++++------ htdocs/expedition/list.php | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 8060bc94698..8f5e8d9818e 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -504,12 +504,12 @@ if ($resql) if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); if ($sall) $param .= '&sall='.urlencode($sall); - if ($search_date_start) $param .= '&search_date_startday='.urlencode(dol_print_date($search_date_start,'%d')).'&search_date_startmonth='.urlencode(dol_print_date($search_date_start,'%m')).'&search_date_startyear='.urlencode(dol_print_date($search_date_start,'%Y')); - if ($search_date_end) $param .= '&search_date_endday='.urlencode(dol_print_date($search_date_end,'%d')).'&search_date_endmonth='.urlencode(dol_print_date($search_date_end,'%m')).'&search_date_endyear='.urlencode(dol_print_date($search_date_end,'%Y')); - if ($search_dateend_start) $param .= '&search_dateend_startday='.urlencode(dol_print_date($search_dateend_start,'%d')).'&search_dateend_startmonth='.urlencode(dol_print_date($search_dateend_start,'%m')).'&search_dateend_startyear='.urlencode(dol_print_date($search_dateend_start,'%Y')); - if ($search_dateend_end) $param .= '&search_dateend_endday='.urlencode(dol_print_date($search_dateend_end,'%d')).'&search_dateend_endmonth='.urlencode(dol_print_date($search_dateend_end,'%m')).'&search_dateend_endyear='.urlencode(dol_print_date($search_dateend_end,'%Y')); - if ($search_datedelivery_start) $param .= '&search_datedelivery_startday='.urlencode(dol_print_date($search_datedelivery_start,'%d')).'&search_datedelivery_startmonth='.urlencode(dol_print_date($search_datedelivery_start,'%m')).'&search_datedelivery_startyear='.urlencode(dol_print_date($search_datedelivery_start,'%Y')); - if ($search_datedelivery_end) $param .= '&search_datedelivery_endday='.urlencode(dol_print_date($search_datedelivery_end,'%d')).'&search_datedelivery_endmonth='.urlencode(dol_print_date($search_datedelivery_end,'%m')).'&search_datedelivery_endyear='.urlencode(dol_print_date($search_datedelivery_end,'%Y')); + if ($search_date_start) $param .= '&search_date_startday='.urlencode(dol_print_date($search_date_start, '%d')).'&search_date_startmonth='.urlencode(dol_print_date($search_date_start, '%m')).'&search_date_startyear='.urlencode(dol_print_date($search_date_start, '%Y')); + if ($search_date_end) $param .= '&search_date_endday='.urlencode(dol_print_date($search_date_end, '%d')).'&search_date_endmonth='.urlencode(dol_print_date($search_date_end, '%m')).'&search_date_endyear='.urlencode(dol_print_date($search_date_end, '%Y')); + if ($search_dateend_start) $param .= '&search_dateend_startday='.urlencode(dol_print_date($search_dateend_start, '%d')).'&search_dateend_startmonth='.urlencode(dol_print_date($search_dateend_start, '%m')).'&search_dateend_startyear='.urlencode(dol_print_date($search_dateend_start, '%Y')); + if ($search_dateend_end) $param .= '&search_dateend_endday='.urlencode(dol_print_date($search_dateend_end, '%d')).'&search_dateend_endmonth='.urlencode(dol_print_date($search_dateend_end, '%m')).'&search_dateend_endyear='.urlencode(dol_print_date($search_dateend_end, '%Y')); + if ($search_datedelivery_start) $param .= '&search_datedelivery_startday='.urlencode(dol_print_date($search_datedelivery_start, '%d')).'&search_datedelivery_startmonth='.urlencode(dol_print_date($search_datedelivery_start, '%m')).'&search_datedelivery_startyear='.urlencode(dol_print_date($search_datedelivery_start, '%Y')); + if ($search_datedelivery_end) $param .= '&search_datedelivery_endday='.urlencode(dol_print_date($search_datedelivery_end, '%d')).'&search_datedelivery_endmonth='.urlencode(dol_print_date($search_datedelivery_end, '%m')).'&search_datedelivery_endyear='.urlencode(dol_print_date($search_datedelivery_end, '%Y')); if ($search_ref) $param .= '&search_ref='.urlencode($search_ref); if ($search_refcustomer) $param .= '&search_refcustomer='.urlencode($search_refcustomer); if ($search_refproject) $param .= '&search_refproject='.urlencode($search_refproject); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 78cee038107..6d4af64902d 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -616,12 +616,12 @@ if ($resql) if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); if ($sall) $param .= '&sall='.urlencode($sall); - if ($search_date_start) $param .= '&search_date_startday='.urlencode(dol_print_date($search_date_start,'%d')).'&search_date_startmonth='.urlencode(dol_print_date($search_date_start,'%m')).'&search_date_startyear='.urlencode(dol_print_date($search_date_start,'%Y')); - if ($search_date_end) $param .= '&search_date_endday='.urlencode(dol_print_date($search_date_end,'%d')).'&search_date_endmonth='.urlencode(dol_print_date($search_date_end,'%m')).'&search_date_endyear='.urlencode(dol_print_date($search_date_end,'%Y')); - if ($search_date_valid_start) $param .= '&search_date_valid_startday='.urlencode(dol_print_date($search_date_valid_start,'%d')).'&search_date_valid_startmonth='.urlencode(dol_print_date($search_date_valid_start,'%m')).'&search_date_valid_startyear='.urlencode(dol_print_date($search_date_valid_start,'%Y')); - if ($search_date_valid_end) $param .= '&search_date_valid_endday='.urlencode(dol_print_date($search_date_valid_end,'%d')).'&search_date_valid_endmonth='.urlencode(dol_print_date($search_date_valid_end,'%m')).'&search_date_valid_endyear='.urlencode(dol_print_date($search_date_valid_end,'%Y')); - if ($search_datelimit_start) $param .= '&search_datelimit_startday='.urlencode(dol_print_date($search_datelimit_start,'%d')).'&search_datelimit_startmonth='.urlencode(dol_print_date($search_datelimit_start,'%m')).'&search_datelimit_startyear='.urlencode(dol_print_date($search_datelimit_start,'%Y')); - if ($search_datelimit_end) $param .= '&search_datelimit_endday='.urlencode(dol_print_date($search_datelimit_end,'%d')).'&search_datelimit_endmonth='.urlencode(dol_print_date($search_datelimit_end,'%m')).'&search_datelimit_endyear='.urlencode(dol_print_date($search_datelimit_end,'%Y')); + if ($search_date_start) $param .= '&search_date_startday='.urlencode(dol_print_date($search_date_start, '%d')).'&search_date_startmonth='.urlencode(dol_print_date($search_date_start, '%m')).'&search_date_startyear='.urlencode(dol_print_date($search_date_start, '%Y')); + if ($search_date_end) $param .= '&search_date_endday='.urlencode(dol_print_date($search_date_end, '%d')).'&search_date_endmonth='.urlencode(dol_print_date($search_date_end, '%m')).'&search_date_endyear='.urlencode(dol_print_date($search_date_end, '%Y')); + if ($search_date_valid_start) $param .= '&search_date_valid_startday='.urlencode(dol_print_date($search_date_valid_start, '%d')).'&search_date_valid_startmonth='.urlencode(dol_print_date($search_date_valid_start, '%m')).'&search_date_valid_startyear='.urlencode(dol_print_date($search_date_valid_start, '%Y')); + if ($search_date_valid_end) $param .= '&search_date_valid_endday='.urlencode(dol_print_date($search_date_valid_end, '%d')).'&search_date_valid_endmonth='.urlencode(dol_print_date($search_date_valid_end, '%m')).'&search_date_valid_endyear='.urlencode(dol_print_date($search_date_valid_end, '%Y')); + if ($search_datelimit_start) $param .= '&search_datelimit_startday='.urlencode(dol_print_date($search_datelimit_start, '%d')).'&search_datelimit_startmonth='.urlencode(dol_print_date($search_datelimit_start, '%m')).'&search_datelimit_startyear='.urlencode(dol_print_date($search_datelimit_start, '%Y')); + if ($search_datelimit_end) $param .= '&search_datelimit_endday='.urlencode(dol_print_date($search_datelimit_end, '%d')).'&search_datelimit_endmonth='.urlencode(dol_print_date($search_datelimit_end, '%m')).'&search_datelimit_endyear='.urlencode(dol_print_date($search_datelimit_end, '%Y')); if ($search_ref) $param .= '&search_ref='.urlencode($search_ref); if ($search_refcustomer) $param .= '&search_refcustomer='.urlencode($search_refcustomer); if ($search_project_ref) $param .= '&search_project_ref='.urlencode($search_project_ref); diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 2de5a755b72..c4a3666937e 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -340,10 +340,10 @@ if ($resql) if ($search_town) $param .= '&search_town='.urlencode($search_town); if ($search_zip) $param .= '&search_zip='.urlencode($search_zip); - if ($search_datedelivery_start) $param .= '&search_datedelivery_startday='.urlencode(dol_print_date($search_datedelivery_start,'%d')).'&search_datedelivery_startmonth='.urlencode(dol_print_date($search_datedelivery_start,'%m')).'&search_datedelivery_startyear='.urlencode(dol_print_date($search_datedelivery_start,'%Y')); - if ($search_datedelivery_end) $param .= '&search_datedelivery_endday='.urlencode(dol_print_date($search_datedelivery_end,'%d')).'&search_datedelivery_endmonth='.urlencode(dol_print_date($search_datedelivery_end,'%m')).'&search_datedelivery_endyear='.urlencode(dol_print_date($search_datedelivery_end,'%Y')); - if ($search_datereceipt_start) $param .= '&search_datereceipt_startday='.urlencode(dol_print_date($search_datereceipt_start,'%d')).'&search_datereceipt_startmonth='.urlencode(dol_print_date($search_datereceipt_start,'%m')).'&search_datereceipt_startyear='.urlencode(dol_print_date($search_datereceipt_start,'%Y')); - if ($search_datereceipt_end) $param .= '&search_datereceipt_endday='.urlencode(dol_print_date($search_datereceipt_end,'%d')).'&search_datereceipt_endmonth='.urlencode(dol_print_date($search_datereceipt_end,'%m')).'&search_datereceipt_endyear='.urlencode(dol_print_date($search_datereceipt_end,'%Y')); + if ($search_datedelivery_start) $param .= '&search_datedelivery_startday='.urlencode(dol_print_date($search_datedelivery_start, '%d')).'&search_datedelivery_startmonth='.urlencode(dol_print_date($search_datedelivery_start, '%m')).'&search_datedelivery_startyear='.urlencode(dol_print_date($search_datedelivery_start, '%Y')); + if ($search_datedelivery_end) $param .= '&search_datedelivery_endday='.urlencode(dol_print_date($search_datedelivery_end, '%d')).'&search_datedelivery_endmonth='.urlencode(dol_print_date($search_datedelivery_end, '%m')).'&search_datedelivery_endyear='.urlencode(dol_print_date($search_datedelivery_end, '%Y')); + if ($search_datereceipt_start) $param .= '&search_datereceipt_startday='.urlencode(dol_print_date($search_datereceipt_start, '%d')).'&search_datereceipt_startmonth='.urlencode(dol_print_date($search_datereceipt_start, '%m')).'&search_datereceipt_startyear='.urlencode(dol_print_date($search_datereceipt_start, '%Y')); + if ($search_datereceipt_end) $param .= '&search_datereceipt_endday='.urlencode(dol_print_date($search_datereceipt_end, '%d')).'&search_datereceipt_endmonth='.urlencode(dol_print_date($search_datereceipt_end, '%m')).'&search_datereceipt_endyear='.urlencode(dol_print_date($search_datereceipt_end, '%Y')); if ($search_product_category != '') $param .= '&search_product_category='.urlencode($search_product_category); if ($search_categ_cus > 0) $param .= '&search_categ_cus='.urlencode($search_categ_cus); From db32f882e8f03eb833dc59cd6cd45d8e32d88f27 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 15 May 2021 07:45:04 +0200 Subject: [PATCH 08/10] Fix use of DatePropal instead of Date --- htdocs/comm/propal/card.php | 6 +++--- htdocs/comm/propal/list.php | 2 +- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 32994e816de..ada520c293b 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -325,7 +325,7 @@ if (empty($reshook)) $duration = GETPOST('duree_validite', 'int'); if (empty($datep)) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatePropal")), null, 'errors'); $action = 'create'; $error++; } @@ -1614,7 +1614,7 @@ if ($action == 'create') } // Date - print ''.$langs->trans('Date').''; + print ''.$langs->trans('DatePropal').''; print $form->selectDate('', '', '', '', '', "addprop", 1, 1); print ''; @@ -2044,7 +2044,7 @@ if ($action == 'create') print ''; print ''; print ''; if ($action != 'editdate' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) print ''; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 522e8f5eaa3..f8481997051 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -157,7 +157,7 @@ $arrayfields = array( 'state.nom'=>array('label'=>"StateShort", 'checked'=>0), 'country.code_iso'=>array('label'=>"Country", 'checked'=>0), 'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers), - 'p.date'=>array('label'=>"Date", 'checked'=>1), + 'p.date'=>array('label'=>"DatePropal", 'checked'=>1), 'p.fin_validite'=>array('label'=>"DateEnd", 'checked'=>1), 'p.date_livraison'=>array('label'=>"DeliveryDate", 'checked'=>0), 'ava.rowid'=>array('label'=>"AvailabilityPeriod", 'checked'=>0), diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 1235a312006..44192cf6067 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1533,7 +1533,7 @@ class pdf_azur extends ModelePDFPropales $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("DatePropal")." : ".dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R'); $posy += 4; $pdf->SetXY($posx, $posy); From 1cbe0e3f2d2be8373950fe06daab4d23a1d47abc Mon Sep 17 00:00:00 2001 From: piernov Date: Sat, 15 May 2021 18:01:34 +0200 Subject: [PATCH 09/10] Fix: properly set gid for Group LDAP synchro Even if the gidNumber field was set in the configuration, a gid different from the Dolibarr's one was generated and stored into LDAP. Now the gidNumber is properly set to Dolibarr's gid if gidNumber field is set in the LDAP module configuration. --- .../core/triggers/interface_50_modLdap_Ldapsynchro.class.php | 4 ++-- htdocs/user/class/usergroup.class.php | 2 +- htdocs/user/group/ldap.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php index ec6d23e2f01..17efdca41c5 100644 --- a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php +++ b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php @@ -282,8 +282,8 @@ class InterfaceLdapsynchro extends DolibarrTriggers $info=$object->_load_ldap_info(); $dn=$object->_load_ldap_dn($info); - // Get a gid number for objectclass PosixGroup - if (in_array('posixGroup', $info['objectclass'])) { + // Get a gid number for objectclass PosixGroup if none was provided + if (empty($info[$conf->global->LDAP_GROUP_FIELD_GROUPID]) && in_array('posixGroup', $info['objectclass'])) { $info['gidNumber'] = $ldap->getNextGroupGid('LDAP_KEY_GROUPS'); } diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index aa4a6b3f8b6..e1e003267b0 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -983,7 +983,7 @@ class UserGroup extends CommonObject } $info[$conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS] = (!empty($valueofldapfield)?$valueofldapfield:''); } - if(!empty($info[$conf->global->LDAP_GROUP_FIELD_GROUPID])){ + if(!empty($conf->global->LDAP_GROUP_FIELD_GROUPID)){ $info[$conf->global->LDAP_GROUP_FIELD_GROUPID]=$this->id; } return $info; diff --git a/htdocs/user/group/ldap.php b/htdocs/user/group/ldap.php index eca923f68be..f28ca81c42a 100644 --- a/htdocs/user/group/ldap.php +++ b/htdocs/user/group/ldap.php @@ -69,8 +69,8 @@ if ($action == 'dolibarr2ldap') { $info=$object->_load_ldap_info(); - // Get a gid number for objectclass PosixGroup - if (in_array('posixGroup', $info['objectclass'])) { + // Get a gid number for objectclass PosixGroup if none was provided + if (empty($info[$conf->global->LDAP_GROUP_FIELD_GROUPID]) && in_array('posixGroup', $info['objectclass'])) { $info['gidNumber'] = $ldap->getNextGroupGid('LDAP_KEY_GROUPS'); } From 7af0bda3a532554cbdb728c72058112a7fce13ab Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 16 May 2021 11:33:07 +0200 Subject: [PATCH 10/10] Update admin_extrafields_view.tpl.php --- htdocs/core/tpl/admin_extrafields_view.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/admin_extrafields_view.tpl.php b/htdocs/core/tpl/admin_extrafields_view.tpl.php index 96620da28d9..79f852f49a9 100644 --- a/htdocs/core/tpl/admin_extrafields_view.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php @@ -120,7 +120,7 @@ if (is_array($extrafields->attributes[$elementtype]['type']) && count($extrafiel } else { - $colspan = 13; + $colspan = 14; if (!empty($conf->multicompany->enabled)) $colspan++; print '';
'; - print $langs->trans('Date'); + print $langs->trans('DatePropal'); print 'id.'">'.img_edit($langs->trans('SetDate'), 1).'