From b739e7ba22773e7bf5a706dffc1a49b58e71df57 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Wed, 5 May 2021 11:26:15 +0200 Subject: [PATCH 01/52] 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/52] 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/52] 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/52] 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/52] 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 866c9d012fa08a66e39d004b9988e0cc96c40b7a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 May 2021 14:19:12 +0200 Subject: [PATCH 06/52] Fix fetch for customer and vendor relative discount --- htdocs/societe/class/societe.class.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index defcc71a3e5..946ceeb42f3 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -480,6 +480,7 @@ class Societe extends CommonObject public $remise_percent; public $remise_supplier_percent; + public $mode_reglement_supplier_id; public $cond_reglement_supplier_id; public $transport_mode_supplier_id; @@ -1636,14 +1637,14 @@ class Societe extends CommonObject $sql .= ', s.fk_typent as typent_id'; $sql .= ', s.fk_effectif as effectif_id'; $sql .= ', s.fk_forme_juridique as forme_juridique_code'; - $sql .= ', s.webservices_url, s.webservices_key'; + $sql .= ', s.webservices_url, s.webservices_key, s.model_pdf'; if (empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { $sql .= ', s.accountancy_code_buy, s.accountancy_code_sell'; } else { $sql .= ', spe.accountancy_code_buy, spe.accountancy_code_sell'; } $sql .= ', s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.parent, s.barcode'; - $sql .= ', s.fk_departement as state_id, s.fk_pays as country_id, s.fk_stcomm, s.remise_supplier, s.mode_reglement, s.cond_reglement, s.transport_mode'; + $sql .= ', s.fk_departement as state_id, s.fk_pays as country_id, s.fk_stcomm, s.mode_reglement, s.cond_reglement, s.transport_mode'; $sql .= ', s.fk_account, s.tva_assuj'; $sql .= ', s.mode_reglement_supplier, s.cond_reglement_supplier, s.transport_mode_supplier'; $sql .= ', s.localtax1_assuj, s.localtax1_value, s.localtax2_assuj, s.localtax2_value, s.fk_prospectlevel, s.default_lang, s.logo, s.logo_squarred'; @@ -1659,7 +1660,11 @@ class Societe extends CommonObject $sql .= ', st.libelle as stcomm, st.picto as stcomm_picto'; $sql .= ', te.code as typent_code'; $sql .= ', i.libelle as label_incoterms'; - $sql .= ', sr.remise_client, model_pdf'; + if (empty($conf->multicompany->enabled)) { + $sql .= ', s.remise_client, s.remise_supplier'; + } else { + $sql .= ', sr.remise_client, sr2.remise_supplier'; + } $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s'; if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); @@ -1672,8 +1677,12 @@ class Societe extends CommonObject $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_regions as r ON d.fk_region = r.code_region '; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as te ON s.fk_typent = te.id'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON s.fk_incoterms = i.rowid'; - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_remise as sr ON sr.rowid = (SELECT MAX(rowid) FROM '.MAIN_DB_PREFIX.'societe_remise WHERE fk_soc = s.rowid AND entity IN ('.getEntity('discount').'))'; - + // With default setup, llx_societe_remise is a history table in default setup and current value is in llx_societe. + // We use it for real value when multicompany is on. A better place would be into llx_societe_perentity. + if (!empty($conf->multicompany->enabled)) { + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_remise as sr ON sr.rowid = (SELECT MAX(rowid) FROM '.MAIN_DB_PREFIX.'societe_remise WHERE fk_soc = s.rowid AND entity IN ('.getEntity('discount').'))'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_remise_supplier as sr2 ON sr2.rowid = (SELECT MAX(rowid) FROM '.MAIN_DB_PREFIX.'societe_remise_supplier WHERE fk_soc = s.rowid AND entity IN ('.getEntity('discount').'))'; + } $sql .= ' WHERE s.entity IN ('.getEntity($this->element).')'; if ($rowid) { $sql .= ' AND s.rowid = '.((int) $rowid); @@ -1809,6 +1818,7 @@ class Societe extends CommonObject $this->remise_percent = $obj->remise_client ? price2num($obj->remise_client) : 0; // 0.000000 must be 0 $this->remise_supplier_percent = $obj->remise_supplier; + $this->mode_reglement_id = $obj->mode_reglement; $this->cond_reglement_id = $obj->cond_reglement; $this->transport_mode_id = $obj->transport_mode; From 75bd4405915dadb8eb0aa8314b7590570dbcf2ae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 May 2021 18:29:02 +0200 Subject: [PATCH 07/52] Trans --- htdocs/langs/en_US/stocks.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 5960f900cca..ddb94c70279 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -249,7 +249,7 @@ SelectAStockMovementFileToImport=select a stock movement file to import InfoTemplateImport=Uploaded file needs to have this format (* are mandatory fields):
Source Warehouse* | Target Warehouse* | Product* | Quantity* | Lot/serial number
CSV character separator must be "%s" LabelOfInventoryMovemement=Inventory %s ReOpen=Reopen -ConfirmFinish=Do you confirm the closing of the inventory ? This will generate all stock movements to update your stock. +ConfirmFinish=Do you confirm the closing of the inventory ? This will generate all stock movements to update your stock to the real qty you entered into the inventory. ObjectNotFound=%s not found MakeMovementsAndClose=Generate movements and close AutofillWithExpected=Fill real quantity with expected quantity \ No newline at end of file From aa2d85276ec285cfa03a344b68166800d4d0ccc1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 May 2021 18:38:22 +0200 Subject: [PATCH 08/52] Debug v14 --- htdocs/core/class/html.formother.class.php | 4 ++-- htdocs/install/fileconf.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index ba3ff77d394..46858191c7b 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -88,8 +88,8 @@ class FormOther */ $out .= '
'; $out .= '
'; - $out .= ''; - $out .= ''; + $out .= ''; + $out .= ''; $out .= '
'; $out .= ''.$langs->trans("FeatureNotYetAvailable").''; diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php index 3f2e714640a..42c8d3459fe 100644 --- a/htdocs/install/fileconf.php +++ b/htdocs/install/fileconf.php @@ -33,7 +33,7 @@ global $langs; $err = 0; -$setuplang = GETPOST("selectlang", '', 3) ? GETPOST("selectlang", '', 3) : (GETPOST('lang', 'alpha', 1) ? GETPOST('lang', 'alpha', 1) : 'auto'); +$setuplang = GETPOST("selectlang", 'alpha', 3) ? GETPOST("selectlang", 'alpha', 3) : (GETPOST('lang', 'alpha', 1) ? GETPOST('lang', 'alpha', 1) : 'auto'); $langs->setDefaultLang($setuplang); $langs->loadLangs(array("install", "errors")); From f504cbcec4865106017066ea0c7038f84d5ca1c1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 May 2021 19:18:51 +0200 Subject: [PATCH 09/52] Fix log --- htdocs/core/class/utils.class.php | 2 +- htdocs/langs/en_US/errors.lang | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 9534970a856..d2987e8fc63 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -354,7 +354,7 @@ class Utils $execmethod = 1; } - dol_syslog("Utils::dumpDatabase execmethod=".$execmethod." command:".$fullcommandcrypted, LOG_DEBUG); + dol_syslog("Utils::dumpDatabase execmethod=".$execmethod." command:".$fullcommandcrypted, LOG_INFO); // TODO Replace with executeCLI function if ($execmethod == 1) { diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index a1155b0f57c..f2d9106107b 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -117,7 +117,7 @@ ErrorCantReadFile=Failed to read file '%s' ErrorCantReadDir=Failed to read directory '%s' ErrorBadLoginPassword=Bad value for login or password ErrorLoginDisabled=Your account has been disabled -ErrorFailedToRunExternalCommand=Failed to run external command. Check it is available and runnable by your PHP server. If PHP Safe Mode is enabled, check that command is inside a directory defined by parameter safe_mode_exec_dir. +ErrorFailedToRunExternalCommand=Failed to run external command. Check it is available and runnable by your PHP server user. Check also the command is not protected on shell level by a security layer like apparmor. ErrorFailedToChangePassword=Failed to change password ErrorLoginDoesNotExists=User with login %s could not be found. ErrorLoginHasNoEmail=This user has no email address. Process aborted. From 9eda9c1e21e61363461dc23c967e855f86dacc3e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 May 2021 19:55:16 +0200 Subject: [PATCH 10/52] Enhance setup --- htdocs/admin/system/security.php | 33 +++++++++++++++++++++++++++++++- htdocs/langs/en_US/admin.lang | 4 +++- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index d8dd21719fd..36f08309e02 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -40,6 +40,8 @@ if (GETPOST('action', 'aZ09') == 'donothing') { exit; } +$execmethod = empty($conf->global->MAIN_EXEC_USE_POPEN) ? 1 : $conf->global->MAIN_EXEC_USE_POPEN; + /* * View @@ -74,7 +76,13 @@ print "PHP allow_url_include = ".(ini_get('allow_url_include') print "PHP disable_functions = "; $arrayoffunctionsdisabled = explode(',', ini_get('disable_functions')); $arrayoffunctionstodisable = explode(',', 'pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals'); -$arrayoffunctionstodisable2 = explode(',', 'exec,passthru,shell_exec,system,proc_open,popen'); +if ($execmethod == 1) { + $arrayoffunctionstodisable2 = explode(',', 'passthru,shell_exec,system,proc_open,popen'); + $functiontokeep = 'exec'; +} else { + $arrayoffunctionstodisable2 = explode(',', 'exec,passthru,shell_exec,system,proc_open'); + $functiontokeep = 'popen'; +} $i = 0; foreach ($arrayoffunctionsdisabled as $functionkey) { if ($i > 0) { @@ -115,6 +123,13 @@ if ($todisabletext) { print '
'; } +print $langs->trans("PHPFunctionsRequiredForCLI").': '; +if (in_array($functiontokeep, $arrayoffunctionsdisabled)) { + print img_picto($langs->trans("PHPFunctionsRequiredForCLI"), 'warning'); +} +print ''.$functiontokeep.''; +print '
'; + print '
'; // XDebug @@ -245,6 +260,22 @@ print 'MAIN_SECURITY_ANTI_SSRF_SERVER_IP = '.(empty($conf->glob print '
'; +print 'MAIN_EXEC_USE_POPEN = '; +if (empty($conf->global->MAIN_EXEC_USE_POPEN)) { + print ''.$langs->trans("Undefined").'   '; +} else { + print $conf->global->MAIN_EXEC_USE_POPEN.'   '; +} +if ($execmethod == 1) { + print ' --> "exec" PHP method will be used for shell commands.'; +} +if ($execmethod == 2) { + print ' --> "popen" PHP method will be used for shell commands.'; +} +print "
"; +print '
'; + + print ''.$langs->trans("AntivirusEnabledOnUpload").': '; print empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ? '' : img_picto('', 'tick').' '; print yn($conf->global->MAIN_ANTIVIRUS_COMMAND ? 1 : 0); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 9f4bcfcfbd4..467fba89199 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2127,7 +2127,8 @@ ConfFileIsReadableOrWritableByAnyUsers=The conf file is readable or writable by MailToSendEventOrganization=Event Organization AGENDA_EVENT_DEFAULT_STATUS=Default event status when creating a event from the form YouShouldDisablePHPFunctions=You should disable PHP functions -IfCLINotRequiredYouShouldDisablePHPFunctions=Except if you need to run system commands (for the module Scheduled job, or to run the external command line Anti-virus for example), you shoud disable PHP functions +IfCLINotRequiredYouShouldDisablePHPFunctions=Except if you need to run system commands in custom code, you shoud disable PHP functions +PHPFunctionsRequiredForCLI=For shell purpose (like scheduled job backup or running an anitivurs program), you must keep PHP functions NoWritableFilesFoundIntoRootDir=No writable files or directories of the common programs were found into your root directory (Good) RecommendedValueIs=Recommended: %s NotRecommended=Not recommanded @@ -2137,3 +2138,4 @@ CheckForModuleUpdateHelp=This action will connect to editors of external modules ModuleUpdateAvailable=An update is available NoExternalModuleWithUpdate=No updates found for external modules SwaggerDescriptionFile=Swagger API description file (for use with redoc for example) +YouEnableDeprecatedWSAPIsUseRESTAPIsInstead=You enabled deprecated WS API. You should use REST API instead. \ No newline at end of file From 19a203bd401599fca0523803dd7a9e4e44698dd6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 May 2021 22:09:06 +0200 Subject: [PATCH 11/52] Fix amount of memberships --- .../adherents/class/adherent_type.class.php | 2 +- htdocs/adherents/stats/index.php | 4 +-- htdocs/adherents/type.php | 29 ++++++++++--------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 2ffc1e2c9fd..0104f8f36e8 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -366,7 +366,7 @@ class AdherentType extends CommonObject $sql .= "libelle = '".$this->db->escape($this->label)."',"; $sql .= "morphy = '".$this->db->escape($this->morphy)."',"; $sql .= "subscription = '".$this->db->escape($this->subscription)."',"; - $sql .= "amount = '".$this->db->escape($this->amount)."',"; + $sql .= "amount = ".((empty($this->amount) && $this->amount == '') ? 'null' : ((float) $this->amount)).","; $sql .= "duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."',"; $sql .= "note = '".$this->db->escape($this->note)."',"; $sql .= "vote = ".(integer) $this->db->escape($this->vote).","; diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php index 11c0025dcc5..e820d0a0d23 100644 --- a/htdocs/adherents/stats/index.php +++ b/htdocs/adherents/stats/index.php @@ -198,8 +198,8 @@ foreach ($data as $val) { //print ''; print ''; print ''.$val['nb'].''; - print ''.price(price2num($val['total'], 'MT'), 1).''; - print ''.price(price2num($val['avg'], 'MT'), 1).''; + print ''.price(price2num($val['total'], 'MT'), 1).''; + print ''.price(price2num($val['avg'], 'MT'), 1).''; print ''; $oldyear = $year; } diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 6c4f63725e1..033592a9afc 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -71,7 +71,7 @@ $label = GETPOST("label", "alpha"); $morphy = GETPOST("morphy", "alpha"); $status = GETPOST("status", "int"); $subscription = GETPOST("subscription", "int"); -$amount = price2num(GETPOST('amount', 'alpha'), 'MT'); +$amount = GETPOST('amount', 'alpha'); $duration_value = GETPOST('duration_value', 'int'); $duration_unit = GETPOST('duration_unit', 'alpha'); $vote = GETPOST("vote", "int"); @@ -119,7 +119,7 @@ if ($action == 'add' && $user->rights->adherent->configurer) { $object->morphy = trim($morphy); $object->status = (int) $status; $object->subscription = (int) $subscription; - $object->amount = $amount; + $object->amount = ($amount == '' ? '' : price2num($amount, 'MT')); $object->duration_value = $duration_value; $object->duration_unit = $duration_unit; $object->note = trim($comment); @@ -166,12 +166,11 @@ if ($action == 'update' && $user->rights->adherent->configurer) { $object->fetch($rowid); $object->oldcopy = clone $object; - $object->label= trim($label); $object->morphy = trim($morphy); $object->status = (int) $status; $object->subscription = (int) $subscription; - $object->amount = $amount; + $object->amount = ($amount == '' ? '' : price2num($amount, 'MT'));; $object->duration_value = $duration_value; $object->duration_unit = $duration_unit; $object->note = trim($comment); @@ -306,7 +305,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') { } print ''; print ''.yn($objp->subscription).''; - print ''.price($objp->amount).''; + print ''.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).''; print ''.yn($objp->vote).''; print ''.$membertype->getLibStatut(5).''; if ($user->rights->adherent->configurer) { @@ -446,7 +445,7 @@ if ($rowid > 0) { print ''; print ''.$langs->trans("Amount").''; - print price($object->amount); + print ((is_null($object->amount) || $object->amount === '') ? '' : price($object->amount)); print ''; print ''.$langs->trans("VoteAllowed").''; @@ -594,24 +593,24 @@ if ($rowid > 0) { $titre .= " (".$membertype->label.")"; } - $param = "&rowid=".$object->id; + $param = "&rowid=".urlencode($object->id); if (!empty($status)) { - $param .= "&status=".$status; + $param .= "&status=".urlencode($status); } if (!empty($search_lastname)) { - $param .= "&search_lastname=".$search_lastname; + $param .= "&search_lastname=".urlencode($search_lastname); } if (!empty($search_firstname)) { - $param .= "&search_firstname=".$search_firstname; + $param .= "&search_firstname=".urlencode($search_firstname); } if (!empty($search_login)) { - $param .= "&search_login=".$search_login; + $param .= "&search_login=".urlencode($search_login); } if (!empty($search_email)) { - $param .= "&search_email=".$search_email; + $param .= "&search_email=".urlencode($search_email); } if (!empty($filter)) { - $param .= "&filter=".$filter; + $param .= "&filter=".urlencode($filter); } if ($sall) { @@ -797,7 +796,9 @@ if ($rowid > 0) { print ''; print ''.$langs->trans("Amount").''; - print ''; + print ''; print ''; print ''.$langs->trans("VoteAllowed").''; From ba6e675273cc72259dbfa2a76e7a9dc83ffd1727 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 May 2021 22:21:20 +0200 Subject: [PATCH 12/52] css --- htdocs/compta/bank/various_payment/list.php | 13 ++++++------- htdocs/salaries/stats/index.php | 8 ++++---- htdocs/theme/md/style.css.php | 5 ++++- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 5e6d199db0a..f78e004f571 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -338,14 +338,13 @@ if ($result) { if ($search_accountancy_subledger > 0) { $param .= '&search_accountancy_subledger='.urlencode($search_accountancy_subledger); } - if ($optioncss != '') { - $param .= '&optioncss='.urlencode($optioncss); + $param .= '&optioncss='.urlencode($optioncss); } $url = DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create'; if (!empty($socid)) { - $url .= '&socid='.$socid; + $url .= '&socid='.urlencode($socid); } $newcardbutton = dolGetButtonTitle($langs->trans('MenuNewVariousPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->banque->modifier); @@ -423,7 +422,7 @@ if ($result) { // Payment type if ($arrayfields['type']['checked']) { - print ''; + print ''; $form->select_types_paiements($typeid, 'typeid', '', 0, 1, 1, 16, 1, 'maxwidth100'); print ''; } @@ -498,7 +497,7 @@ if ($result) { print_liste_field_titre($arrayfields['ref']['label'], $_SERVER["PHP_SELF"], 'v.rowid', '', $param, '', $sortfield, $sortorder); } if ($arrayfields['label']['checked']) { - print_liste_field_titre($arrayfields['label']['label'], $_SERVER["PHP_SELF"], 'v.label', '', $param, '', $sortfield, $sortorder, 'left '); + print_liste_field_titre($arrayfields['label']['label'], $_SERVER["PHP_SELF"], 'v.label', '', $param, '', $sortfield, $sortorder); } if ($arrayfields['datep']['checked']) { print_liste_field_titre($arrayfields['datep']['label'], $_SERVER["PHP_SELF"], 'v.datep,v.rowid', '', $param, '', $sortfield, $sortorder, 'center '); @@ -507,7 +506,7 @@ if ($result) { print_liste_field_titre($arrayfields['datev']['label'], $_SERVER["PHP_SELF"], 'v.datev,v.rowid', '', $param, '', $sortfield, $sortorder, 'center '); } if ($arrayfields['type']['checked']) { - print_liste_field_titre($arrayfields['type']['label'], $_SERVER["PHP_SELF"], 'type', '', $param, '', $sortfield, $sortorder, 'left '); + print_liste_field_titre($arrayfields['type']['label'], $_SERVER["PHP_SELF"], 'type', '', $param, '', $sortfield, $sortorder, 'center '); } if ($arrayfields['project']['checked']) { print_liste_field_titre($arrayfields['project']['label'], $_SERVER["PHP_SELF"], 'fk_project', '', $param, '', $sortfield, $sortorder); @@ -590,7 +589,7 @@ if ($result) { // Type if ($arrayfields['type']['checked']) { - print ''; + print ''; if ($obj->payment_code) { print $langs->trans("PaymentTypeShort".$obj->payment_code); print ' '; diff --git a/htdocs/salaries/stats/index.php b/htdocs/salaries/stats/index.php index 1fe914d38c2..1a7f2de6d39 100644 --- a/htdocs/salaries/stats/index.php +++ b/htdocs/salaries/stats/index.php @@ -238,16 +238,16 @@ foreach ($data as $val) { print ''; print ''.$oldyear.''; print '0'; - print '0'; - print '0'; + print '0'; + print '0'; print ''; } print ''; print ''.$year.''; print ''.$val['nb'].''; - print ''.price(price2num($val['total'], 'MT'), 1).''; - print ''.price(price2num($val['avg'], 'MT'), 1).''; + print ''.price(price2num($val['total'], 'MT'), 1).''; + print ''.price(price2num($val['avg'], 'MT'), 1).''; print ''; $oldyear = $year; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 8152e56e945..06e05a542ee 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -369,7 +369,7 @@ select.vmenusearchselectcombo { background-color: unset; } -textarea:focus, button:focus { +textarea:focus { /* v6 box-shadow: 0 0 4px #8091BF; */ border: 1px solid #aaa !important; } @@ -738,6 +738,9 @@ div.floatright .largenumber { font-size: 1.4em; } +button:focus { + outline: none; +} th .button { -webkit-box-shadow: none !important; From 5e0f2f9781dab1facea07442917a73bf8b4745f3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 May 2021 22:35:21 +0200 Subject: [PATCH 13/52] Debug v14. Fix regression. --- .../install/mysql/migration/13.0.0-14.0.0.sql | 4 ++ .../install/mysql/tables/llx_product_lot.sql | 3 ++ .../product/stock/class/productlot.class.php | 38 +++++++++---------- htdocs/theme/md/style.css.php | 2 +- 4 files changed, 25 insertions(+), 22 deletions(-) diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 37719c015c5..da2cd34fa00 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -64,6 +64,10 @@ ALTER TABLE llx_export_model MODIFY COLUMN type varchar(64); -- For v14 +ALTER TABLE llx_product_lot ADD COLUMN eol_date datetime NULL; +ALTER TABLE llx_product_lot ADD COLUMN manufacturing_date datetime NULL; +ALTER TABLE llx_product_lot ADD COLUMN scrapping_date datetime NULL; + create table llx_accounting_groups_account ( rowid integer AUTO_INCREMENT PRIMARY KEY, diff --git a/htdocs/install/mysql/tables/llx_product_lot.sql b/htdocs/install/mysql/tables/llx_product_lot.sql index 86cca7d0f04..f8d02f19ccb 100644 --- a/htdocs/install/mysql/tables/llx_product_lot.sql +++ b/htdocs/install/mysql/tables/llx_product_lot.sql @@ -24,6 +24,9 @@ CREATE TABLE llx_product_lot ( batch varchar(128) DEFAULT NULL, -- Lot or serial number eatby date DEFAULT NULL, -- Eatby date sellby date DEFAULT NULL, -- Sellby date + eol_date datetime NULL, + manufacturing_date datetime NULL, + scrapping_date datetime NULL, datec datetime, tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, fk_user_creat integer, diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index f05a4ae3d39..2a3b3cf2e20 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -91,11 +91,11 @@ class Productlot extends CommonObject 'batch' => array('type'=>'varchar(30)', 'label'=>'Batch', 'enabled'=>1, 'visible'=>1, 'notnull'=>0, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'comment'=>'Batch', 'searchall'=>1), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20), 'sellby' => array('type'=>'date', 'label'=>'SellByDate', 'enabled'=>'empty($conf->global->PRODUCT_DISABLE_SELLBY)?1:0', 'visible'=>5, 'position'=>60), - 'eol_date' => array('type'=>'date', 'label'=>'EndOfLife', 'enabled'=>'empty($conf->global->PRODUCT_DISABLE_TRACEABILITY)?1:0', 'visible'=>5, 'position'=>70), - 'manufacturing_date' => array('type'=>'date', 'label'=>'ManufacturingDate', 'enabled'=>'empty($conf->global->PRODUCT_DISABLE_TRACEABILITY)?1:0', 'visible'=>5, 'position'=>80), - 'scrapping_date' => array('type'=>'date', 'label'=>'DestructionDate', 'enabled'=>'empty($conf->global->PRODUCT_DISABLE_TRACEABILITY)?1:0', 'visible'=>5, 'position'=>90), - 'commissionning_date' => array('type'=>'date', 'label'=>'FirstUseDate', 'enabled'=>'empty($conf->global->PRODUCT_DISABLE_TRACEABILITY)?1:0', 'visible'=>5, 'position'=>100), - 'qc_frequency' => array('type'=>'varchar(6)', 'label'=>'QCFrequency', 'enabled'=>'empty($conf->global->PRODUCT_DISABLE_TRACEABILITY)?1:0', 'visible'=>5, 'position'=>110), + 'eol_date' => array('type'=>'date', 'label'=>'EndOfLife', 'enabled'=>'empty($conf->global->PRODUCT_ENABLE_TRACEABILITY)?0:1', 'visible'=>5, 'position'=>70), + 'manufacturing_date' => array('type'=>'date', 'label'=>'ManufacturingDate', 'enabled'=>'empty($conf->global->PRODUCT_ENABLE_TRACEABILITY)?0:1', 'visible'=>5, 'position'=>80), + 'scrapping_date' => array('type'=>'date', 'label'=>'DestructionDate', 'enabled'=>'empty($conf->global->PRODUCT_ENABLE_TRACEABILITY)?0:1', 'visible'=>5, 'position'=>90), + //'commissionning_date' => array('type'=>'date', 'label'=>'FirstUseDate', 'enabled'=>'empty($conf->global->PRODUCT_ENABLE_TRACEABILITY)?0:1', 'visible'=>5, 'position'=>100), + //'qc_frequency' => array('type'=>'varchar(6)', 'label'=>'QCFrequency', 'enabled'=>'empty($conf->global->PRODUCT_ENABLE_QUALITYCONTROL)?1:0', 'visible'=>5, 'position'=>110), 'eatby' => array('type'=>'date', 'label'=>'EatByDate', 'enabled'=>'empty($conf->global->PRODUCT_DISABLE_EATBY)?1:0', 'visible'=>5, 'position'=>62), 'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>500), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501), @@ -120,8 +120,8 @@ class Productlot extends CommonObject public $eol_date = ''; public $manufacturing_date = ''; public $scrapping_date = ''; - public $commissionning_date = ''; - public $qc_frequency = ''; + //public $commissionning_date = ''; + //public $qc_frequency = ''; public $datec = ''; public $tms = ''; @@ -184,8 +184,6 @@ class Productlot extends CommonObject $this->import_key = trim($this->import_key); } - - // Check parameters // Put here code to add control on parameters values @@ -199,8 +197,8 @@ class Productlot extends CommonObject $sql .= 'eol_date,'; $sql .= 'manufacturing_date,'; $sql .= 'scrapping_date,'; - $sql .= 'commissionning_date,'; - $sql .= 'qc_frequency,'; + //$sql .= 'commissionning_date,'; + //$sql .= 'qc_frequency,'; $sql .= 'datec,'; $sql .= 'fk_user_creat,'; $sql .= 'fk_user_modif,'; @@ -214,9 +212,8 @@ class Productlot extends CommonObject $sql .= ' '.(!isset($this->eol_date) || dol_strlen($this->eol_date) == 0 ? 'NULL' : "'".$this->db->idate($this->eol_date)."'").','; $sql .= ' '.(!isset($this->manufacturing_date) || dol_strlen($this->manufacturing_date) == 0 ? 'NULL' : "'".$this->db->idate($this->manufacturing_date)."'").','; $sql .= ' '.(!isset($this->scrapping_date) || dol_strlen($this->scrapping_date) == 0 ? 'NULL' : "'".$this->db->idate($this->scrapping_date)."'").','; - $sql .= ' '.(!isset($this->commissionning_date) || dol_strlen($this->commissionning_date) == 0 ? 'NULL' : "'".$this->db->idate($this->commissionning_date)."'").','; - $sql .= ' '.(!isset($this->qc_frequency) ? 'NULL' : $this->qc_frequency).','; - + //$sql .= ' '.(!isset($this->commissionning_date) || dol_strlen($this->commissionning_date) == 0 ? 'NULL' : "'".$this->db->idate($this->commissionning_date)."'").','; + //$sql .= ' '.(!isset($this->qc_frequency) ? 'NULL' : $this->qc_frequency).','; $sql .= ' '."'".$this->db->idate(dol_now())."'".','; $sql .= ' '.(!isset($this->fk_user_creat) ? 'NULL' : $this->fk_user_creat).','; $sql .= ' '.(!isset($this->fk_user_modif) ? 'NULL' : $this->fk_user_modif).','; @@ -292,8 +289,8 @@ class Productlot extends CommonObject $sql .= " t.eol_date,"; $sql .= " t.manufacturing_date,"; $sql .= " t.scrapping_date,"; - $sql .= " t.commissionning_date,"; - $sql .= " t.qc_frequency,"; + //$sql .= " t.commissionning_date,"; + //$sql .= " t.qc_frequency,"; $sql .= " t.datec,"; $sql .= " t.tms,"; $sql .= " t.fk_user_creat,"; @@ -322,11 +319,10 @@ class Productlot extends CommonObject $this->eatby = $this->db->jdate($obj->eatby); $this->sellby = $this->db->jdate($obj->sellby); $this->eol_date = $this->db->jdate($obj->eol_date); - $this->manufacturing_date = $this->db->jdate($obj->manufacturing_date); $this->scrapping_date = $this->db->jdate($obj->scrapping_date); - $this->commissionning_date = $this->db->jdate($obj->commissionning_date); - $this->qc_frequency = $obj->qc_frequency; + //$this->commissionning_date = $this->db->jdate($obj->commissionning_date); + //$this->qc_frequency = $obj->qc_frequency; $this->datec = $this->db->jdate($obj->datec); $this->tms = $this->db->jdate($obj->tms); @@ -407,8 +403,8 @@ class Productlot extends CommonObject $sql .= ' eol_date = '.(!isset($this->eol_date) || dol_strlen($this->eol_date) != 0 ? "'".$this->db->idate($this->eol_date)."'" : 'null').','; $sql .= ' manufacturing_date = '.(!isset($this->manufacturing_date) || dol_strlen($this->manufacturing_date) != 0 ? "'".$this->db->idate($this->manufacturing_date)."'" : 'null').','; $sql .= ' scrapping_date = '.(!isset($this->destruction_date) || dol_strlen($this->destruction_date) != 0 ? "'".$this->db->idate($this->destruction_date)."'" : 'null').','; - $sql .= ' commissionning_date = '.(!isset($this->first_use_date) || dol_strlen($this->first_use_date) != 0 ? "'".$this->db->idate($this->first_use_date)."'" : 'null').','; - $sql .= ' qc_frequency = '.(!isset($this->qc_frequency) || dol_strlen($this->qc_frequency) != 0 ? "'".$this->db->escape($this->qc_frequency)."'" : 'null').','; + //$sql .= ' commissionning_date = '.(!isset($this->first_use_date) || dol_strlen($this->first_use_date) != 0 ? "'".$this->db->idate($this->first_use_date)."'" : 'null').','; + //$sql .= ' qc_frequency = '.(!isset($this->qc_frequency) || dol_strlen($this->qc_frequency) != 0 ? "'".$this->db->escape($this->qc_frequency)."'" : 'null').','; $sql .= ' datec = '.(!isset($this->datec) || dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').','; $sql .= ' tms = '.(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : "'".$this->db->idate(dol_now())."'").','; $sql .= ' fk_user_creat = '.(isset($this->fk_user_creat) ? $this->fk_user_creat : "null").','; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 06e05a542ee..5735837d665 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -3836,7 +3836,7 @@ tr.liste_titre_sel th, th.liste_titre_sel, tr.liste_titre_sel td, td.liste_titre font-family: ; font-weight: normal; border-bottom: 1px solid #FDFFFF; - text-decoration: underline; + /* text-decoration: underline; */ } input.liste_titre { background: transparent; From 488f242e25bd7b87c05724b85704b96f710189c6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 May 2021 22:42:10 +0200 Subject: [PATCH 14/52] css --- htdocs/product/list.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 073643fe235..eb3fc71d53a 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -586,7 +586,8 @@ if ($resql) { $paramsCat .= "&search_category_product_list[]=".urlencode($searchCategoryProduct); } - llxHeader('', $title, $helpurl, '', 0, 0, array(), array(), $paramsCat, 'classforhorizontalscrolloftabs'); + //llxHeader('', $title, $helpurl, '', 0, 0, array(), array(), $paramsCat, 'classforhorizontalscrolloftabs'); + llxHeader('', $title, $helpurl, '', 0, 0, array(), array(), $paramsCat, ''); // Displays product removal confirmation if (GETPOST('delprod')) { From 097f493315a798ef5ca210955bfe1ce0122bd542 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 May 2021 22:43:47 +0200 Subject: [PATCH 15/52] css --- htdocs/theme/md/style.css.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 5735837d665..5d6bcf13a59 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -793,10 +793,19 @@ textarea.centpercent { color: #777; } +.flip { + transform: scaleX(-1) translate(2px, 0); +} +.rotate90 { + transform: rotate(90deg) translate(0, 2px); +} .center { text-align: center; margin: 0px auto; } +.alignstart { + text-align: start; +} .left { text-align: ; } From e47118108906ab9b6049a2dfda2d9167ae56ba9f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 May 2021 22:52:50 +0200 Subject: [PATCH 16/52] css --- htdocs/theme/md/style.css.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 5d6bcf13a59..25df9b941ef 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -4290,10 +4290,10 @@ div.divphotoref > a > .photowithmargin { /* Margin right for photo not inside a .photowithborder { border: 1px solid #f0f0f0; } -.photointoolitp { +.photointooltip { margin-top: 8px; margin-bottom: 6px; - text-align: center; + text-align: center !important; } .photodelete { margin-top: 6px !important; From 5917a9f73eca3681d0ea48258afc229ee899bc53 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 May 2021 23:08:52 +0200 Subject: [PATCH 17/52] Fix phpcs --- dev/setup/codesniffer/README | 5 +++++ htdocs/theme/md/style.css.php | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/dev/setup/codesniffer/README b/dev/setup/codesniffer/README index 087fb318f6f..2fdc66b9d1f 100644 --- a/dev/setup/codesniffer/README +++ b/dev/setup/codesniffer/README @@ -10,6 +10,11 @@ To run phpcs: > cd dolibarrgitrepo > phpcs --standard=dev/setup/codesniffer/ruleset.xml --extensions=php --parallel=8 . +To fix with phpcbf: +> cd dolibarrgitrepo +> phpcbf --standard=dev/setup/codesniffer/ruleset.xml --extensions=php --parallel=8 . + + Note with Eclipse: You must setup the PTI plugin of Eclipse into PHPCodeSniffer menu with: * tab value to 4 * path of code sniffer standard to dev/codesniffer diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 25df9b941ef..70a2ce1303e 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -6623,9 +6623,9 @@ div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link:before /* ============================================================================== */ span.clipboardCPValue.hidewithsize { - width: 0 !important; - display: inline-block; - color: transparent; + width: 0 !important; + display: inline-block; + color: transparent; } .clipboardCPShowOnHover .clipboardCPButton { From b9336570ff65d161c434302110576520310e9956 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 13 May 2021 10:26:09 +0200 Subject: [PATCH 18/52] NEW report contact/adresses on credit note from invoice keep same contact/adresses from source invoice (ir: usefull for correct notifications) --- htdocs/compta/facture/card.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 48b7c505264..6dd4d050b8b 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1093,6 +1093,19 @@ if (empty($reshook)) { } } $id = $object->create($user); + if ($id < 0) { + $error++; + } else { + // copy internal contacts + if ($object->copy_linked_contact($facture_source, 'internal') < 0) { + $error++; + } elseif ($facture_source->socid == $object->socid) { + // copy external contacts if same company + if ($object->copy_linked_contact($facture_source, 'external') < 0) { + $error++; + } + } + } // NOTE: Pb with situation invoice // NOTE: fields total on situation invoice are stored as cumulative values on total of lines (bad) but delta on invoice total From 05ea8761a1156f342afb7743fe48e260cffc384f Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 13 May 2021 08:28:14 +0000 Subject: [PATCH 19/52] Fixing style errors. --- htdocs/compta/facture/card.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 6dd4d050b8b..e5b4b2d2398 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1093,19 +1093,19 @@ if (empty($reshook)) { } } $id = $object->create($user); - if ($id < 0) { - $error++; - } else { - // copy internal contacts - if ($object->copy_linked_contact($facture_source, 'internal') < 0) { - $error++; - } elseif ($facture_source->socid == $object->socid) { - // copy external contacts if same company - if ($object->copy_linked_contact($facture_source, 'external') < 0) { + if ($id < 0) { $error++; + } else { + // copy internal contacts + if ($object->copy_linked_contact($facture_source, 'internal') < 0) { + $error++; + } elseif ($facture_source->socid == $object->socid) { + // copy external contacts if same company + if ($object->copy_linked_contact($facture_source, 'external') < 0) { + $error++; + } + } } - } - } // NOTE: Pb with situation invoice // NOTE: fields total on situation invoice are stored as cumulative values on total of lines (bad) but delta on invoice total From d1f36ec20cf530d0f93ae10cea2275669dcc0f6a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 13 May 2021 15:45:47 +0200 Subject: [PATCH 20/52] Fix phpcs --- htdocs/theme/eldy/global.inc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 912cf21a1de..3518518a5ef 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -6767,9 +6767,9 @@ div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link:before /* ============================================================================== */ span.clipboardCPValue.hidewithsize { - width: 0 !important; - display: inline-block; - color: transparent; + width: 0 !important; + display: inline-block; + color: transparent; } .clipboardCPShowOnHover .clipboardCPButton { From a9ddf2a5ad51be91b2769fdbcf6595fa8db5457b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 13 May 2021 19:07:47 +0200 Subject: [PATCH 21/52] Fix phpcs --- htdocs/product/class/product.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 22e28001743..16c72297e10 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -190,6 +190,10 @@ class Product extends CommonObject public $localtax1_type; public $localtax2_type; + public $lifetime; + + public $qc_frequency; + /** * Stock real * From 009588e04d69ddfe8caae2197e4c26b9a656857b Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Fri, 14 May 2021 11:02:55 +0200 Subject: [PATCH 22/52] fix implode on string for formproduct loadwarehouse --- htdocs/product/class/html.formproduct.class.php | 14 +++++--------- htdocs/product/stock/stockatdate.php | 2 +- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index a5f28c50ee8..69429677c27 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -66,13 +66,13 @@ class FormProduct * 'warehouseclosed' = select products from closed warehouses, * 'warehouseinternal' = select products from warehouses for internal correct/transfer only * @param boolean $sumStock sum total stock of a warehouse, default true - * @param string $exclude warehouses ids to exclude + * @param array $exclude warehouses ids to exclude * @param bool|int $stockMin [=false] Value of minimum stock to filter or false not not filter by minimum stock * @param string $orderBy [='e.ref'] Order by * @return int Nb of loaded lines, 0 if already loaded, <0 if KO * @throws Exception */ - public function loadWarehouses($fk_product = 0, $batch = '', $status = '', $sumStock = true, $exclude = '', $stockMin = false, $orderBy = 'e.ref') + public function loadWarehouses($fk_product = 0, $batch = '', $status = '', $sumStock = true, $exclude = array(), $stockMin = false, $orderBy = 'e.ref') { global $conf, $langs; @@ -80,10 +80,6 @@ class FormProduct return 0; // Cache already loaded and we do not want a list with information specific to a product } - if (is_array($exclude)) { - $excludeGroups = implode("','", $exclude); - } - $warehouseStatus = array(); if (preg_match('/warehouseclosed/', $status)) { @@ -121,7 +117,7 @@ class FormProduct $sql .= " AND e.statut = 1"; } - if (!empty($exclude)) { + if (is_array($exclude) && !empty($exclude)) { $sql .= ' AND e.rowid NOT IN('.$this->db->sanitize(implode(',', $exclude)).')'; } @@ -220,7 +216,7 @@ class FormProduct * @param int $forcecombo 1=Force combo iso ajax select2 * @param array $events Events to add to select2 * @param string $morecss Add more css classes to HTML select - * @param string $exclude Warehouses ids to exclude + * @param array $exclude Warehouses ids to exclude * @param int $showfullpath 1=Show full path of name (parent ref into label), 0=Show only ref of current warehouse * @param bool|int $stockMin [=false] Value of minimum stock to filter or false not not filter by minimum stock * @param string $orderBy [='e.ref'] Order by @@ -228,7 +224,7 @@ class FormProduct * * @throws Exception */ - public function selectWarehouses($selected = '', $htmlname = 'idwarehouse', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $empty_label = '', $showstock = 0, $forcecombo = 0, $events = array(), $morecss = 'minwidth200', $exclude = '', $showfullpath = 1, $stockMin = false, $orderBy = 'e.ref') + public function selectWarehouses($selected = '', $htmlname = 'idwarehouse', $filterstatus = '', $empty = 0, $disabled = 0, $fk_product = 0, $empty_label = '', $showstock = 0, $forcecombo = 0, $events = array(), $morecss = 'minwidth200', $exclude = array(), $showfullpath = 1, $stockMin = false, $orderBy = 'e.ref') { global $conf, $langs, $user, $hookmanager; diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index 788c75f1141..b36d530d624 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -363,7 +363,7 @@ print $form->select_produits($productid, 'productid', '', 0, 0, -1, 2, '', 0, ar print '   '; print img_picto('', 'stock').' '; print $langs->trans('Warehouse').' '; -print $formproduct->selectWarehouses((GETPOSTISSET('fk_warehouse') ? $fk_warehouse : 'ifone'), 'fk_warehouse', '', 1, 0, 0, '', 0, 0, null, '', '', 1, false, 'e.ref'); +print $formproduct->selectWarehouses((GETPOSTISSET('fk_warehouse') ? $fk_warehouse : 'ifone'), 'fk_warehouse', '', 1, 0, 0, '', 0, 0, null, '', null, 1, false, 'e.ref'); print ''; $parameters = array(); From ce6df0ee4acb165cc685091e37f7419d462b232f Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Fri, 14 May 2021 13:50:12 +0200 Subject: [PATCH 23/52] 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 24/52] 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 cff0b69ce052258f1bbc3a4870c1ad32ba2f4a51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 14 May 2021 18:30:56 +0200 Subject: [PATCH 25/52] avoid sql error with sql_mode=only_full_group_by SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht FROM llx_societe as s, llx_contrat as t, llx_contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (2) AND t.entity IN (1)[DB_ERROR_1140] In aggregated query without GROUP BY, expression #4 of SELECT list contains nonaggregated column 'dolibarrdev.t.rowid'; this is incompatible with sql_mode=only_full_group_by --- htdocs/core/class/html.form.class.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 625e8e23d57..a0846b2b3ed 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7692,8 +7692,12 @@ class Form 'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande').')'), 'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'), 'invoice_template'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToTemplateInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('invoice').')'), - 'contrat'=>array('enabled'=>$conf->contrat->enabled, 'perms'=>1, 'label'=>'LinkToContract', - 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t, ".MAIN_DB_PREFIX."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('contract').')'), + 'contrat'=>array( + 'enabled'=>$conf->contrat->enabled, + 'perms'=>1, + 'label'=>'LinkToContract', + 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t, ".MAIN_DB_PREFIX."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('contract').') GROUP BY t.rowid' + ), 'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('intervention').')'), 'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled, 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'), 'order_supplier'=>array('enabled'=>$conf->supplier_order->enabled, 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'), From db32f882e8f03eb833dc59cd6cd45d8e32d88f27 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 15 May 2021 07:45:04 +0200 Subject: [PATCH 26/52] 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 014b34acc69175916d62bf4b4943136b1d052b66 Mon Sep 17 00:00:00 2001 From: piernov Date: Sat, 15 May 2021 16:44:46 +0200 Subject: [PATCH 27/52] Fix default gid 65534 for User in LDAP posixAccount objectclass (intended to be used with the uid/gid/homedir fields) requires a gid. Always set a gid in LDAP for the User class even if the user does not belong to any group. By default 65534 which corresponds to the nobody group on major distributions (incl. Debian). --- htdocs/user/class/user.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 89995a4584e..6c0645e82b7 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2678,10 +2678,10 @@ class User extends CommonObject } if (!empty($conf->global->LDAP_FIELD_USERID))$info[$conf->global->LDAP_FIELD_USERID] = $this->id; - if (!empty($info[$conf->global->LDAP_FIELD_GROUPID])) { + if (!empty($conf->global->LDAP_FIELD_GROUPID)) { $usergroup = new UserGroup($this->db); $groupslist = $usergroup->listGroupsForUser($this->id); - $info[$conf->global->LDAP_FIELD_GROUPID] = '1'; + $info[$conf->global->LDAP_FIELD_GROUPID] = '65534'; if (!empty($groupslist)) { foreach ($groupslist as $groupforuser) { $info[$conf->global->LDAP_FIELD_GROUPID] = $groupforuser->id; //Select first group in list From beff175de130c3ff3ac736c8ed89d0346df568a9 Mon Sep 17 00:00:00 2001 From: piernov Date: Sat, 15 May 2021 16:48:43 +0200 Subject: [PATCH 28/52] Fix use login for User homedir in LDAP posixAccount objectclass (intended to be used with the uid/gid/homedir fields) requires a homedir. Always set a homedir in LDAP for the User class even if user does not have a firstname by using the login instead. Additionally on Linux the login is typically used for the home directory rather than the first name. It also avoids having accentuated or other special characters (commonly found in names) in the home directory path. --- htdocs/user/class/user.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 6c0645e82b7..2d5a09659db 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2689,7 +2689,7 @@ class User extends CommonObject } } } - if (!empty($this->firstname) && !empty($conf->global->LDAP_FIELD_HOMEDIRECTORY) && !empty($conf->global->LDAP_FIELD_HOMEDIRECTORYPREFIX)) $info[$conf->global->LDAP_FIELD_HOMEDIRECTORY] = "{$conf->global->LDAP_FIELD_HOMEDIRECTORYPREFIX}/$this->firstname"; + if (!empty($conf->global->LDAP_FIELD_HOMEDIRECTORY) && !empty($conf->global->LDAP_FIELD_HOMEDIRECTORYPREFIX)) $info[$conf->global->LDAP_FIELD_HOMEDIRECTORY] = "{$conf->global->LDAP_FIELD_HOMEDIRECTORYPREFIX}/$this->login"; return $info; } From 1cbe0e3f2d2be8373950fe06daab4d23a1d47abc Mon Sep 17 00:00:00 2001 From: piernov Date: Sat, 15 May 2021 18:01:34 +0200 Subject: [PATCH 29/52] 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 e5e317bae3bfe331d86e21ba4998a892a022ce20 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 16 May 2021 09:58:34 +0200 Subject: [PATCH 30/52] Fix entity was set to 0 on group creation --- htdocs/user/group/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 33921544b45..21f53c64c68 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -138,7 +138,7 @@ if (empty($reshook)) { if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { $object->entity = 0; } else { - $object->entity = GETPOST("entity"); + $object->entity = GETPOSTISSET("entity") ? GETPOST("entity") : $conf->entity; } $db->begin(); From 3859e7f00ee6b90dd864b78443f9033b0841b8df Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 16 May 2021 10:49:00 +0200 Subject: [PATCH 31/52] Fix translations on expensereport list --- htdocs/expensereport/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index e83899d28d1..ce1dc4e3c09 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -138,8 +138,8 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen $fieldstosearchall = array( 'd.ref'=>'Ref', 'd.note_public'=>"NotePublic", - 'u.lastname'=>'Lastname', - 'u.firstname'=>"Firstname", + 'u.lastname'=>'EmployeeLastname', + 'u.firstname'=>"EmployeeFirstname", 'u.login'=>"Login", ); if (empty($user->socid)) { From baf0dda19cd31911348d28a6acbcbb1b16301e22 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 16 May 2021 10:52:51 +0200 Subject: [PATCH 32/52] Fix missing load langs for my company info in user block --- htdocs/main.inc.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 0c3679adac5..244ef483db5 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1964,6 +1964,8 @@ function top_menu_user($hideloginname = 0, $urllogout = '') global $dolibarr_main_authentication, $dolibarr_main_demo; global $menumanager; + $langs->loadLangs(array('companies')); + $userImage = $userDropDownImage = ''; if (!empty($user->photo)) { $userImage = Form::showphoto('userphoto', $user, 0, 0, 0, 'photouserphoto userphoto', 'small', 0, 1); From 3c3613a71a9100e63d02db2832322a0afc76a861 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 16 May 2021 11:06:49 +0200 Subject: [PATCH 33/52] Fix missing quick create holiday and expense report --- htdocs/main.inc.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 244ef483db5..09da7fdd80e 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2354,6 +2354,28 @@ function top_menu_quickadd() '; } + if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->creer) { + $langs->load("trips"); + $dropDownQuickAddHtml .= ' + + + '; + } + + if (!empty($conf->holiday->enabled) && $user->rights->holiday->write) { + $langs->load("holiday"); + $dropDownQuickAddHtml .= ' + + + '; + } + // Execute hook printTopRightMenu (hooks should output string like '') $parameters = array(); $result = $hookmanager->executeHooks('printQuickAddBlock', $parameters); // Note that $action and $object may have been modified by some hooks From c8b725165e24199833877dffd7fa534da9409ffe Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 16 May 2021 11:16:07 +0200 Subject: [PATCH 34/52] Fix use img_picto in quick create dropdown --- htdocs/main.inc.php | 44 +++++++++++--------------------------------- 1 file changed, 11 insertions(+), 33 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 09da7fdd80e..3fb1a1aa0da 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2217,9 +2217,7 @@ function top_menu_quickadd()
-
- '.$langs->trans("ThirdParty").' -
+ '. img_picto('', 'object_company') .'
'. $langs->trans("ThirdParty") .'
'; } @@ -2230,9 +2228,7 @@ function top_menu_quickadd()
-
- '.$langs->trans("Contact").' -
+ '. img_picto('', 'object_contact') .'
'. $langs->trans("Contact") .'
'; } @@ -2243,9 +2239,7 @@ function top_menu_quickadd()
-
- '.$langs->trans("Proposal").' -
+ '. img_picto('', 'object_propal') .'
'. $langs->trans("Proposal") .'
'; } @@ -2256,9 +2250,7 @@ function top_menu_quickadd()
-
- '.$langs->trans("Order").' -
+ '. img_picto('', 'object_order') .'
'. $langs->trans("Order") .'
'; } @@ -2269,9 +2261,7 @@ function top_menu_quickadd()
-
- '.$langs->trans("Bill").' -
+ '. img_picto('', 'object_bill') .'
'. $langs->trans("Bill") .'
'; } @@ -2282,9 +2272,7 @@ function top_menu_quickadd()
-
- '.$langs->trans("Contract").' -
+ '. img_picto('', 'object_contract') .'
'. $langs->trans("Contract") .'
'; } @@ -2295,9 +2283,7 @@ function top_menu_quickadd()
-
- '.$langs->trans("AskPrice").' -
+ '. img_picto('', 'object_propal') .'
'. $langs->trans("AskPrice") .'
'; } @@ -2308,9 +2294,7 @@ function top_menu_quickadd()
-
- '.$langs->trans("SupplierOrder").' -
+ '. img_picto('', 'object_order') .'
'. $langs->trans("SupplierOrder") .'
'; } @@ -2321,9 +2305,7 @@ function top_menu_quickadd()
-
- '.$langs->trans("SupplierBill").' -
+ '. img_picto('', 'object_bill') .'
'. $langs->trans("SupplierBill") .'
'; } @@ -2334,9 +2316,7 @@ function top_menu_quickadd()
-
- '.$langs->trans("Product").' -
+ '. img_picto('', 'object_product') .'
'. $langs->trans("Product") .'
'; } @@ -2347,9 +2327,7 @@ function top_menu_quickadd()
-
- '.$langs->trans("Service").' -
+ '. img_picto('', 'object_service') .'
'. $langs->trans("Service") .'
'; } From 7af0bda3a532554cbdb728c72058112a7fce13ab Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 16 May 2021 11:33:07 +0200 Subject: [PATCH 35/52] 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 '
'; From c820231363a75f0d528d7332b7a103e41f6f3e8f Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 16 May 2021 12:24:27 +0200 Subject: [PATCH 36/52] Fix id of expense report must be before object fetch --- htdocs/expensereport/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index a4c565bc1be..cb6dcfc94b8 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -55,6 +55,7 @@ $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); +$id = GETPOST('id', 'int'); $date_start = dol_mktime(0, 0, 0, GETPOST('date_debutmonth', 'int'), GETPOST('date_debutday', 'int'), GETPOST('date_debutyear', 'int')); $date_end = dol_mktime(0, 0, 0, GETPOST('date_finmonth', 'int'), GETPOST('date_finday', 'int'), GETPOST('date_finyear', 'int')); $date = dol_mktime(0, 0, 0, GETPOST('datemonth', 'int'), GETPOST('dateday', 'int'), GETPOST('dateyear', 'int')); @@ -120,7 +121,6 @@ if ($object->id > 0) { } // Security check -$id = GETPOST("id", 'int'); if ($user->socid) { $socid = $user->socid; } From 240137b768e4993406c2fe0037f1090438d4790d Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 16 May 2021 16:04:19 +0200 Subject: [PATCH 37/52] Fix HRM homepage --- htdocs/hrm/index.php | 60 ++++++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index 09485357956..af9518d4622 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -40,8 +40,13 @@ if ($conf->deplacement->enabled) { if ($conf->expensereport->enabled) { require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; } -require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentcandidature.class.php'; -require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; +if ($conf->recruitment->enabled) { + require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentcandidature.class.php'; + require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentjobposition.class.php'; +} +if ($conf->holiday->enabled) { + require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; +} $hookmanager = new HookManager($db); $hookmanager->initHooks('hrmindex'); @@ -60,10 +65,6 @@ if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INF $setupcompanynotcomplete = 1; } -$holiday = new Holiday($db); -$holidaystatic = new Holiday($db); -$staticrecruitmentcandidature = new RecruitmentCandidature($db); - $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT; @@ -73,7 +74,8 @@ $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT; // Update sold if (!empty($conf->holiday->enabled) && !empty($setupcompanynotcomplete)) { - $result = $holiday->updateBalance(); + $holidaystatic = new Holiday($db); + $result = $holidaystatic->updateBalance(); } @@ -144,6 +146,7 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // This is usel if (!empty($conf->holiday->enabled)) { if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) { + $holidaystatic = new Holiday($db); $user_id = $user->id; print '
'; @@ -154,9 +157,9 @@ if (!empty($conf->holiday->enabled)) { $out = ''; $nb_holiday = 0; - $typeleaves = $holiday->getTypes(1, 1); + $typeleaves = $holidaystatic->getTypes(1, 1); foreach ($typeleaves as $key => $val) { - $nb_type = $holiday->getCPforUser($user->id, $val['rowid']); + $nb_type = $holidaystatic->getCPforUser($user->id, $val['rowid']); $nb_holiday += $nb_type; $out .= ' - '.($langs->trans($val['code']) != $val['code'] ? $langs->trans($val['code']) : $val['label']).': '.($nb_type ? price2num($nb_type) : 0).'
'; } @@ -179,7 +182,7 @@ print '
'; // Latest leave requests if (!empty($conf->holiday->enabled) && $user->rights->holiday->read) { $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.photo, u.statut as user_status,"; - $sql .= " x.rowid, x.rowid as ref, x.fk_type, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.tms as dm, x.statut as status"; + $sql .= " x.rowid, x.ref, x.fk_type, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.tms as dm, x.statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u"; $sql .= " WHERE u.rowid = x.fk_user"; $sql .= " AND x.entity = ".$conf->entity; @@ -236,8 +239,8 @@ if (!empty($conf->holiday->enabled) && $user->rights->holiday->read) { $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ? 'afternoon' : 'morning'; $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ? 'morning' : 'afternoon'; - print '
'; print ''; print ''; @@ -330,20 +333,23 @@ if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->lire) // Last modified job position if (!empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitmentjobposition->read) { - $sql = "SELECT rc.rowid, rc.ref, rc.email, rc.lastname, rc.firstname, rc.date_creation, rc.tms, rc.status"; + $staticrecruitmentcandidature = new RecruitmentCandidature($db); + $staticrecruitmentjobposition = new RecruitmentJobPosition($db); + $sql = "SELECT rc.rowid, rc.ref, rc.email, rc.lastname, rc.firstname, rc.date_creation, rc.tms, rc.status,"; + $sql.= " rp.rowid as jobid, rp.ref as jobref, rp.label"; $sql .= " FROM ".MAIN_DB_PREFIX."recruitment_recruitmentcandidature as rc"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."recruitment_recruitmentjobposition as s ON rc.fk_recruitmentjobposition = s.rowid"; - if (!$user->rights->societe->client->voir && !$socid) { + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."recruitment_recruitmentjobposition as rp ON rc.fk_recruitmentjobposition = rp.rowid"; + if ($conf->societe->enabled && !$user->rights->societe->client->voir && !$socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } - $sql .= " WHERE rc.entity IN (".getEntity($staticrecruitmentjobposition->element).")"; - if (!$user->rights->societe->client->voir && !$socid) { - $sql .= " AND s.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; + $sql .= " WHERE rc.entity IN (".getEntity($staticrecruitmentcandidature->element).")"; + if ($conf->societe->enabled && !$user->rights->societe->client->voir && !$socid) { + $sql .= " AND rp.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($socid) { - $sql .= " AND s.fk_soc = $socid"; + $sql .= " AND rp.fk_soc = $socid"; } - $sql .= " ORDER BY rc.tms DESC"; + $sql .= $db->order("rc.tms", "DESC"); $sql .= $db->plimit($max, 0); $resql = $db->query($sql); @@ -354,8 +360,8 @@ if (!empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitme print '
'; print '
'; - print $langs->trans('Date'); + print $langs->trans('DatePropal'); print 'id.'">'.img_edit($langs->trans('SetDate'), 1).'
'.dol_print_date($db->jdate($obj->date_start), 'day').' '.$langs->trans($listhalfday[$starthalfday]).''; - print ''.dol_print_date($db->jdate($obj->date_end), 'day').' '.$langs->trans($listhalfday[$endhalfday]).''; + print ''.dol_print_date($db->jdate($obj->date_start), 'day').'
'.$langs->trans($listhalfday[$starthalfday]).''; + print '
'.dol_print_date($db->jdate($obj->date_end), 'day').'
'.$langs->trans($listhalfday[$endhalfday]).''; print '
'.dol_print_date($db->jdate($obj->dm), 'day').''.$holidaystatic->LibStatut($obj->status, 3).'
'; print ''; - print ''; print ''; print ''; @@ -370,11 +376,15 @@ if (!empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitme $staticrecruitmentcandidature->firstname = $objp->firstname; $staticrecruitmentcandidature->lastname = $objp->lastname; + $staticrecruitmentjobposition->id = $objp->jobid; + $staticrecruitmentjobposition->ref = $objp->jobref; + $staticrecruitmentjobposition->label = $objp->label; + print ''; print ''; - print '"; - print '"; + print ''; + print ''; + print ''; print '"; From 78633ccb2ba3a09d5b0a4aaa6850824e04b99664 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 16 May 2021 16:20:46 +0200 Subject: [PATCH 38/52] Fix expensereport and recruitment homepages --- htdocs/expensereport/index.php | 9 --------- htdocs/recruitment/recruitmentindex.php | 12 ++++++------ 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/htdocs/expensereport/index.php b/htdocs/expensereport/index.php index be8c735edc1..8198883e58f 100644 --- a/htdocs/expensereport/index.php +++ b/htdocs/expensereport/index.php @@ -171,9 +171,6 @@ $langs->load("boxes"); $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.statut as user_status, u.photo, u.email, u.admin,"; $sql .= " d.rowid, d.ref, d.date_debut as dated, d.date_fin as datef, d.date_create as dm, d.total_ht, d.total_ttc, d.fk_statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as d, ".MAIN_DB_PREFIX."user as u"; -if (!$user->rights->societe->client->voir && !$user->socid) { - $sql .= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -} $sql .= " WHERE u.rowid = d.fk_user_author"; // RESTRICT RIGHTS if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous) @@ -183,12 +180,6 @@ if (empty($user->rights->expensereport->readall) && empty($user->rights->expense $sql .= " AND d.fk_user_author IN (".$db->sanitize(join(',', $childids)).")\n"; } $sql .= ' AND d.entity IN ('.getEntity('expensereport').')'; -if (!$user->rights->societe->client->voir && !$user->socid) { - $sql .= " AND d.fk_user_author = s.rowid AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); -} -if ($socid) { - $sql .= " AND d.fk_user_author = ".$socid; -} $sql .= $db->order($sortfield, $sortorder); $sql .= $db->plimit($max, 0); diff --git a/htdocs/recruitment/recruitmentindex.php b/htdocs/recruitment/recruitmentindex.php index 3b6ff756b3c..7e369fe6bb2 100644 --- a/htdocs/recruitment/recruitmentindex.php +++ b/htdocs/recruitment/recruitmentindex.php @@ -331,18 +331,18 @@ if (!empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitme $sql = "SELECT s.rowid, s.ref, s.label, s.date_creation, s.tms, s.status, COUNT(rc.rowid) as nbapplications"; $sql .= " FROM ".MAIN_DB_PREFIX."recruitment_recruitmentjobposition as s"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."recruitment_recruitmentcandidature as rc ON rc.fk_recruitmentjobposition = s.rowid"; - if (!$user->rights->societe->client->voir && !$socid) { + if ($conf->societe->enabled && !$user->rights->societe->client->voir && !$socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE s.entity IN (".getEntity($staticrecruitmentjobposition->element).")"; - if (!$user->rights->societe->client->voir && !$socid) { + if ($conf->societe->enabled && !$user->rights->societe->client->voir && !$socid) { $sql .= " AND s.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($socid) { $sql .= " AND s.fk_soc = $socid"; } $sql .= " GROUP BY s.rowid, s.ref, s.label, s.date_creation, s.tms, s.status"; - $sql .= " ORDER BY s.tms DESC"; + $sql .= $db->order('s.tms', 'DESC'); $sql .= $db->plimit($max, 0); $resql = $db->query($sql); @@ -402,17 +402,17 @@ if (!empty($conf->recruitment->enabled) && $user->rights->recruitment->recruitme $sql = "SELECT rc.rowid, rc.ref, rc.email, rc.lastname, rc.firstname, rc.date_creation, rc.tms, rc.status"; $sql .= " FROM ".MAIN_DB_PREFIX."recruitment_recruitmentcandidature as rc"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."recruitment_recruitmentjobposition as s ON rc.fk_recruitmentjobposition = s.rowid"; - if (!$user->rights->societe->client->voir && !$socid) { + if ($conf->societe->enabled && !$user->rights->societe->client->voir && !$socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= " WHERE rc.entity IN (".getEntity($staticrecruitmentjobposition->element).")"; - if (!$user->rights->societe->client->voir && !$socid) { + if ($conf->societe->enabled && !$user->rights->societe->client->voir && !$socid) { $sql .= " AND s.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; } if ($socid) { $sql .= " AND s.fk_soc = $socid"; } - $sql .= " ORDER BY rc.tms DESC"; + $sql .= $db->order('rc.tms', 'DESC'); $sql .= $db->plimit($max, 0); $resql = $db->query($sql); From d4aa0ae4225f37569bf41a241b79d1e0a3cfcb42 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 16 May 2021 18:26:26 +0200 Subject: [PATCH 39/52] Update box_dolibarr_state_board.php Global stats box is always enabled --- htdocs/core/boxes/box_dolibarr_state_board.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/htdocs/core/boxes/box_dolibarr_state_board.php b/htdocs/core/boxes/box_dolibarr_state_board.php index d26dd2cb075..348ffeda4cd 100644 --- a/htdocs/core/boxes/box_dolibarr_state_board.php +++ b/htdocs/core/boxes/box_dolibarr_state_board.php @@ -60,13 +60,6 @@ class box_dolibarr_state_board extends ModeleBoxes global $conf, $user; $this->db = $db; - - // disable box for such cases - if (!empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { - $this->enabled = 0; // disabled by this option - } - - $this->hidden = !(!empty($user->rights->societe->lire) && empty($user->socid)); } /** From d3ff549b21417c314ced1c2a9d01acd821612e1e Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 16 May 2021 18:48:18 +0200 Subject: [PATCH 40/52] Fix ticket when module societe not enabled --- htdocs/core/class/html.formticket.class.php | 4 +++- htdocs/core/lib/ticket.lib.php | 5 +++-- htdocs/ticket/class/ticket.class.php | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 7d012077700..3cec6c19789 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -103,11 +103,13 @@ class FormTicket */ public function __construct($db) { + global $conf; + $this->db = $db; $this->action = 'add'; - $this->withcompany = 1; + $this->withcompany = $conf->societe->enabled ? 1 : 0; $this->withfromsocid = 0; $this->withfromcontactid = 0; //$this->withthreadid=0; diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index e2e06487de8..4d9d4bb2fa2 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -84,7 +84,7 @@ function ticket_prepare_head($object) $head[$h][2] = 'tabTicket'; $h++; - if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && empty($user->socid)) { + if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && empty($user->socid) && $conf->societe->enabled) { $nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external')); $head[$h][0] = DOL_URL_ROOT.'/ticket/contact.php?track_id='.$object->track_id; $head[$h][1] = $langs->trans('ContactsAddresses'); @@ -157,7 +157,8 @@ function showDirectPublicLink($object) $out = ''; if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { - $out .= ''.$langs->trans("PublicInterfaceNotEnabled").''; + $langs->load('errors'); + $out .= ''.$langs->trans("ErrorPublicInterfaceNotEnabled").''; } else { $out .= img_picto('', 'object_globe.png').' '.$langs->trans("TicketPublicAccess").'
'; if ($url) { diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 6c883be6b1a..5180abe6140 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2917,7 +2917,7 @@ class Ticket extends CommonObject $sql = "SELECT p.rowid, p.ref, p.datec as datec"; $sql .= " FROM ".MAIN_DB_PREFIX."ticket as p"; - if (!$user->rights->societe->client->voir && !$user->socid) { + if ($conf->societe->enabled && !$user->rights->societe->client->voir && !$user->socid) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc"; $sql .= " WHERE sc.fk_user = ".$user->id; $clause = " AND"; From 9a8bd2c24b8f67e4dc48e8a1795955b6fc11b384 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 May 2021 06:13:26 +0200 Subject: [PATCH 41/52] Add missing field Fix duplicate / in url --- htdocs/core/lib/website.lib.php | 2 +- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 6 +++++- htdocs/install/mysql/tables/llx_c_ticket_category.sql | 2 +- htdocs/install/mysql/tables/llx_c_ticket_type.sql | 2 +- .../tables/llx_knowledgemanagement_knowledgerecord.sql | 3 ++- htdocs/knowledgemanagement/class/knowledgerecord.class.php | 4 ++-- 6 files changed, 12 insertions(+), 7 deletions(-) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 4fa0f053236..8f6b484a733 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -618,7 +618,7 @@ function getStructuredData($type, $data = array()) $pageurl = str_replace('__WEBSITE_KEY__', $website->ref, $pageurl); $title = str_replace('__WEBSITE_KEY__', $website->ref, $title); - $image = '/medias/'.str_replace('__WEBSITE_KEY__', $website->ref, $image); + $image = '/medias'.(preg_match('/^\//', $image) ? '' : '/').str_replace('__WEBSITE_KEY__', $website->ref, $image); $companyname = str_replace('__WEBSITE_KEY__', $website->ref, $companyname); $description = str_replace('__WEBSITE_KEY__', $website->ref, $description); diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index da2cd34fa00..cf5da55d719 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -491,11 +491,15 @@ CREATE TABLE llx_knowledgemanagement_knowledgerecord( import_key varchar(14), model_pdf varchar(255), question text NOT NULL, - answer text, + answer text, + fk_ticket integer, status integer NOT NULL -- END MODULEBUILDER FIELDS ) ENGINE=innodb; +ALTER TABLE llx_knowledgemanagement_knowledgerecord ADD COLUMN fk_ticket integer; + + create table llx_knowledgemanagement_knowledgerecord_extrafields ( rowid integer AUTO_INCREMENT PRIMARY KEY, diff --git a/htdocs/install/mysql/tables/llx_c_ticket_category.sql b/htdocs/install/mysql/tables/llx_c_ticket_category.sql index 10d16331a06..57bd15f2c23 100644 --- a/htdocs/install/mysql/tables/llx_c_ticket_category.sql +++ b/htdocs/install/mysql/tables/llx_c_ticket_category.sql @@ -15,7 +15,7 @@ -- along with this program. If not, see . -- --- Table with the categories of a ticket +-- Table with the custom category tree for the category of a ticket -- create table llx_c_ticket_category diff --git a/htdocs/install/mysql/tables/llx_c_ticket_type.sql b/htdocs/install/mysql/tables/llx_c_ticket_type.sql index d480036d5d5..462d1a71535 100644 --- a/htdocs/install/mysql/tables/llx_c_ticket_type.sql +++ b/htdocs/install/mysql/tables/llx_c_ticket_type.sql @@ -13,7 +13,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- --- +-- Type of ticket. For example: COM, ISSUE, REQUEST, PROJECT, OTHER, ... create table llx_c_ticket_type ( diff --git a/htdocs/install/mysql/tables/llx_knowledgemanagement_knowledgerecord.sql b/htdocs/install/mysql/tables/llx_knowledgemanagement_knowledgerecord.sql index 9c2866980ec..5c9e4cf199f 100644 --- a/htdocs/install/mysql/tables/llx_knowledgemanagement_knowledgerecord.sql +++ b/htdocs/install/mysql/tables/llx_knowledgemanagement_knowledgerecord.sql @@ -27,7 +27,8 @@ CREATE TABLE llx_knowledgemanagement_knowledgerecord( import_key varchar(14), model_pdf varchar(255), question text NOT NULL, - answer text, + answer text, + fk_ticket integer, status integer NOT NULL -- END MODULEBUILDER FIELDS ) ENGINE=innodb; diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 2dba1581d9e..4d46794aaf8 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -110,8 +110,8 @@ class KnowledgeRecord extends CommonObject 'fk_user_valid' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>'1', 'position'=>512, 'notnull'=>0, 'visible'=>-2,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,), 'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,), - 'question' => array('type'=>'text', 'label'=>'Question', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1,), - 'answer' => array('type'=>'html', 'label'=>'Solution', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>-1,), + 'question' => array('type'=>'text', 'label'=>'Question', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'csslist'=>'tdoverflow300'), + 'answer' => array('type'=>'html', 'label'=>'Solution', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>3, 'csslist'=>'tdoverflow300'), 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Valid'),), ); public $rowid; From d1ff2e3590ef59a80f1aff48342cbe59ca9b185b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 May 2021 06:18:47 +0200 Subject: [PATCH 42/52] Add comment --- htdocs/core/lib/website.lib.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 8f6b484a733..44265e33ea5 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -666,6 +666,8 @@ function getStructuredData($type, $data = array()) $ret .= '"description": "'.dol_escape_json($description).'"'; $ret .= "\n".'}'."\n"; $ret .= ''."\n"; + } else { + $ret .= ''."\n"; } } elseif ($type == 'product') { $ret = ''."\n"; From 78b38f75a1bf846e0fecb47fa9c84a6f292e2fd0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 May 2021 06:39:18 +0200 Subject: [PATCH 43/52] Minor fixes --- htdocs/core/lib/website.lib.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 44265e33ea5..89fd777cd20 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -502,7 +502,7 @@ function includeContainer($containerref) } $includehtmlcontentopened++; if ($includehtmlcontentopened > $MAXLEVEL) { - print 'ERROR: RECURSIVE CONTENT LEVEL. Depth of recursive call is more than the limit of '.$MAXLEVEL.".\n"; + print 'ERROR: RECURSIVE CONTENT LEVEL. Depth of recursive call is more than the limit of '.((int) $MAXLEVEL).".\n"; return; } @@ -549,20 +549,20 @@ function getStructuredData($type, $data = array()) "@type": "SoftwareApplication", "name": "'.dol_escape_json($data['name']).'", "operatingSystem": "'.dol_escape_json($data['os']).'", - "applicationCategory": "https://schema.org/'.$data['applicationCategory'].'",'; + "applicationCategory": "https://schema.org/'.dol_escape_json($data['applicationCategory']).'",'; if (!empty($data['ratingcount'])) { $ret .= ' "aggregateRating": { "@type": "AggregateRating", - "ratingValue": "'.$data['ratingvalue'].'", - "ratingCount": "'.$data['ratingcount'].'" + "ratingValue": "'.dol_escape_json($data['ratingvalue']).'", + "ratingCount": "'.dol_escape_json($data['ratingcount']).'" },'; } $ret .= ' "offers": { "@type": "Offer", - "price": "'.$data['price'].'", - "priceCurrency": "'.($data['currency'] ? $data['currency'] : $conf->currency).'" + "price": "'.dol_escape_json($data['price']).'", + "priceCurrency": "'.dol_escape_json($data['currency'] ? $data['currency'] : $conf->currency).'" } }'."\n"; $ret .= ''."\n"; @@ -693,8 +693,8 @@ function getStructuredData($type, $data = array()) "offers": { "@type": "Offer", "url": "https://example.com/anvil", - "priceCurrency": "'.($data['currency'] ? $data['currency'] : $conf->currency).'", - "price": "'.$data['price'].'", + "priceCurrency": "'.dol_escape_json($data['currency'] ? $data['currency'] : $conf->currency).'", + "price": "'.dol_escape_json($data['price']).'", "itemCondition": "https://schema.org/UsedCondition", "availability": "https://schema.org/InStock", "seller": { From 90d6f70bce24b23af94e39aae964035114f6680c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 May 2021 06:54:39 +0200 Subject: [PATCH 44/52] Comment --- htdocs/website/index.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index da1244b567c..7247427363a 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2390,6 +2390,18 @@ if ($action == 'generatesitemaps' && $usercanedit) { } } + // Now add sitempas extension for news + // TODO When adding and when not ? + /* + + The Example Times + en + + 2008-12-23 + Companies A, B in Merger Talks + + */ + $root->appendChild($url); $i++; } From ea5d374f233e0162838aeb0df4606e1d8458b8bf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 May 2021 06:57:21 +0200 Subject: [PATCH 45/52] Update index.php --- htdocs/hrm/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index af9518d4622..50fd4c3f521 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -239,8 +239,8 @@ if (!empty($conf->holiday->enabled) && $user->rights->holiday->read) { $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ? 'afternoon' : 'morning'; $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ? 'morning' : 'afternoon'; - print '
'; print ''; print ''; From 7d0fa95d8134cf44f09bcf78e674d285c1b23d3c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 May 2021 07:08:45 +0200 Subject: [PATCH 46/52] Update card.php --- htdocs/user/group/card.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 21f53c64c68..19b78cf06e9 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -138,7 +138,11 @@ if (empty($reshook)) { if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { $object->entity = 0; } else { - $object->entity = GETPOSTISSET("entity") ? GETPOST("entity") : $conf->entity; + if ($conf->entity == 1 && $user->admin && !$user->entity) { // Same permissions test than the one used to show the combo of entities into the form + $object->entity = GETPOSTISSET("entity") ? GETPOST("entity") : $conf->entity; + } else { + $object->entity = $conf->entity; + } } $db->begin(); From ad64b43e3080412ec089585b653fa8a8c5276d66 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 May 2021 07:11:41 +0200 Subject: [PATCH 47/52] Update html.form.class.php --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a0846b2b3ed..9b90ed0b30a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7696,7 +7696,7 @@ class Form 'enabled'=>$conf->contrat->enabled, 'perms'=>1, 'label'=>'LinkToContract', - 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t, ".MAIN_DB_PREFIX."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('contract').') GROUP BY t.rowid' + 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_customer as ref_client, t.ref_supplier, SUM(td.total_ht) as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t, ".MAIN_DB_PREFIX."contratdet as td WHERE t.fk_soc = s.rowid AND td.fk_contrat = t.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('contract').') GROUP BY s.rowid, s.nom, s.client, t.rowid, t.ref, t.ref_customer, t.ref_supplier' ), 'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('intervention').')'), 'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled, 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'), From 6bf66adff04eb5c8aa431b14c75e3c10dd995ec5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 May 2021 07:27:02 +0200 Subject: [PATCH 48/52] Fix remove some $_REQUEST --- htdocs/admin/security_file.php | 2 +- htdocs/commande/list.php | 1 - htdocs/compta/bank/card.php | 2 +- htdocs/compta/paiement/cheque/card.php | 12 ++++++------ htdocs/core/lib/sendings.lib.php | 4 ++-- htdocs/core/tpl/card_presend.tpl.php | 4 ++-- htdocs/delivery/card.php | 4 ++-- htdocs/expedition/shipment.php | 4 ++-- htdocs/ticket/card.php | 4 ++-- 9 files changed, 18 insertions(+), 19 deletions(-) diff --git a/htdocs/admin/security_file.php b/htdocs/admin/security_file.php index 2b6a4e81fb4..12c90cf3c21 100644 --- a/htdocs/admin/security_file.php +++ b/htdocs/admin/security_file.php @@ -66,7 +66,7 @@ if ($action == 'updateform') { } elseif ($action == 'delete') { // Delete file $langs->load("other"); - $file = $conf->admin->dir_temp.'/'.GETPOST('urlfile', 'alpha'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). + $file = $conf->admin->dir_temp.'/'.GETPOST('urlfile', 'alpha'); $ret = dol_delete_file($file); if ($ret) { setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile', 'alpha')), null, 'mesgs'); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 3747b2107b2..2c08bb8684a 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -887,7 +887,6 @@ if ($resql) { } if ($massaction == 'createbills') { - //var_dump($_REQUEST); print ''; print '
'; - print $langs->trans("BoxTitleLatestModifiedCandidatures", $max); + print ''; + print $langs->trans("BoxTitleLatestModifiedCandidatures", min($max, $num)); print ''.$langs->trans("FullList").'
'.$staticrecruitmentcandidature->getNomUrl(1, '').''; - print "'.dol_print_date($db->jdate($objp->tms), 'day')."'.$staticrecruitmentcandidature->getFullName($langs).''.$staticrecruitmentjobposition->getNomUrl(1).''.dol_print_date($db->jdate($objp->tms), 'day').''; print $staticrecruitmentcandidature->getLibStatut(3); print "'.dol_print_date($db->jdate($obj->date_start), 'day').'
'.$langs->trans($listhalfday[$starthalfday]).''; - print '
'.dol_print_date($db->jdate($obj->date_end), 'day').'
'.$langs->trans($listhalfday[$endhalfday]).''; + print '
'.dol_print_date($db->jdate($obj->date_start), 'day').' '.$langs->trans($listhalfday[$starthalfday]).''; + print ''.dol_print_date($db->jdate($obj->date_end), 'day').' '.$langs->trans($listhalfday[$endhalfday]).''; print ''.dol_print_date($db->jdate($obj->dm), 'day').''.$holidaystatic->LibStatut($obj->status, 3).'
'; diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index bf30b1831f9..30aa32a8d58 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -829,7 +829,7 @@ if ($action == 'create') { print ''; print ''; print ''; - print ''."\n\n"; + print ''."\n\n"; print dol_get_fiche_head(array(), 0, '', 0); diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 39b5ded892b..04eee81ced0 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -126,8 +126,8 @@ if ($action == 'create' && GETPOST("accountid", "int") > 0 && $user->rights->ban // Define output language $outputlangs = $langs; $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($_REQUEST['lang_id'])) { - $newlang = $_REQUEST['lang_id']; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { + $newlang = GETPOST('lang_id', 'aZ09'); } //if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (!empty($newlang)) { @@ -177,8 +177,8 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->banque- // Define output language $outputlangs = $langs; $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($_REQUEST['lang_id'])) { - $newlang = $_REQUEST['lang_id']; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { + $newlang = GETPOST('lang_id', 'aZ09'); } //if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (!empty($newlang)) { @@ -219,8 +219,8 @@ if ($action == 'builddoc' && $user->rights->banque->cheque) { $outputlangs = $langs; $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($_REQUEST['lang_id'])) { - $newlang = $_REQUEST['lang_id']; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { + $newlang = GETPOST('lang_id', 'aZ09'); } //if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if (!empty($newlang)) { diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 15e7286ab08..880019d7b97 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -316,8 +316,8 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') $outputlangs = $langs; $newlang = ''; - if (empty($newlang) && !empty($_REQUEST['lang_id'])) { - $newlang = $_REQUEST['lang_id']; + if (empty($newlang) && GETPOST('lang_id', 'aZ09')) { + $newlang = GETPOST('lang_id', 'aZ09'); } if (empty($newlang)) { $newlang = $object->thirdparty->default_lang; diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index bca1386c82e..9c1387d7d58 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -58,8 +58,8 @@ if ($action == 'presend') { // Define output language $outputlangs = $langs; $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($_REQUEST['lang_id'])) { - $newlang = $_REQUEST['lang_id']; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { + $newlang = GETPOST('lang_id', 'aZ09'); } if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { $newlang = $object->thirdparty->default_lang; diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index 2c6415f17b7..4855c9c1e49 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -542,8 +542,8 @@ if ($action == 'create') { // Create. Seems to no be used if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { $outputlangs = $langs; $newlang = ''; - if (empty($newlang) && !empty($_REQUEST['lang_id'])) { - $newlang = $_REQUEST['lang_id']; + if (empty($newlang) && GETPOST('lang_id', 'aZ09')) { + $newlang = GETPOST('lang_id', 'aZ09'); } if (empty($newlang)) { $newlang = $object->thirdparty->default_lang; diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 1231f0b513e..8f5903dd988 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -687,8 +687,8 @@ if ($id > 0 || !empty($ref)) { $outputlangs = $langs; $newlang = ''; - if (empty($newlang) && !empty($_REQUEST['lang_id'])) { - $newlang = $_REQUEST['lang_id']; + if (empty($newlang) && GETPOST('lang_id', 'aZ09')) { + $newlang = GETPOST('lang_id', 'aZ09'); } if (empty($newlang)) { $newlang = $object->thirdparty->default_lang; diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 4b4b8e594d4..e04e3c51ce3 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1364,8 +1364,8 @@ if ($action == 'create' || $action == 'presend') { // Define output language $outputlangs = $langs; $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && !empty($_REQUEST['lang_id'])) { - $newlang = $_REQUEST['lang_id']; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { + $newlang = GETPOST('lang_id', 'aZ09'); } if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { $newlang = $object->default_lang; From 6308c17c5fd22898006d6ad56437b5122f1a4294 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 May 2021 08:30:12 +0200 Subject: [PATCH 49/52] Update main.inc.php --- htdocs/main.inc.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 3fb1a1aa0da..6110be38c86 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1964,8 +1964,6 @@ function top_menu_user($hideloginname = 0, $urllogout = '') global $dolibarr_main_authentication, $dolibarr_main_demo; global $menumanager; - $langs->loadLangs(array('companies')); - $userImage = $userDropDownImage = ''; if (!empty($user->photo)) { $userImage = Form::showphoto('userphoto', $user, 0, 0, 0, 'photouserphoto userphoto', 'small', 0, 1); @@ -2203,6 +2201,7 @@ function top_menu_quickadd() { global $langs, $conf, $db, $hookmanager, $user; global $menumanager; + $html = ''; // Define $dropDownQuickAddHtml $dropDownQuickAddHtml = '