Merge remote-tracking branch 'Dolibarr/13.0' into 13

This commit is contained in:
Francis Appels 2021-05-13 09:37:41 +02:00
commit 4f43c80762
15 changed files with 276 additions and 188 deletions

View File

@ -3,6 +3,63 @@ English Dolibarr ChangeLog
-------------------------------------------------------------- --------------------------------------------------------------
***** ChangeLog for 13.0.3 compared to 13.0.2 *****
FIX: 13.0 warning - missing quotes around 'label'
FIX: #16143 Old PG requires "()" on DROP FUNCTION
FIX: #16843
FIX: #17060
FIX: #17192 - With tz < 0, event is show in bad day on calendar views
FIX: #17363
FIX: #17476 releve.php: Fix SQL statement
FIX: Accountancy - Import in general ledger
FIX: Accountancy - Quadra export - wrong data on credit
FIX: Accountancy - Warning on the pages of the preparatory statements of accounting entries
FIX: Add function price2num for rounding values in productAlertStock box
FIX: Add parameter to function price2num()
FIX: Cannot delete a batch material from item receipts
FIX: cast int
FIX: Change parameters MF to MS for price2num() function
FIX: create event from contact card preselect contact correctly
FIX: create sociales : keep values error form
FIX: dol_print_date for %a and %b with some timezone
FIX: email is not case sensitive
FIX: error for duplicate thirdparty found correctly returned by ws
FIX: Espadon PDF shippment model with long public note now wroking
FIX: esupplier order: error 500 when using packaging with product where it is not defined
FIX: Filter on debit/credit
FIX: Filter on supplier payment list
FIX: fix checkbox displayed according to module project setup parameters - work in progress
FIX: inconsistency in margin recording with option "Force to sale price"
FIX: invoice PDF generation after payment
FIX: mask selector fournisseur if module not activate
FIX: merge thirparty also work for bank URL entry
FIX: Missing extrafields into export of agenda record
FIX: missing parameter in select for POP
FIX: missing return edit if update error
FIX: missing token on dolGetButtonAction for action delete
FIX: payment creation: re-generate invoice PDF with correct display options
FIX: payment validation: invoices PDF were no re-generated, make it with correct display options
FIX: Periodicity by default on fiscal year, according to the now date, we have plus 1 year added
FIX: pgsql: prevent 'WHERE 1'
FIX: PHP version requirement in composer.json
FIX: project visibility field with two option
FIX: saving template email
FIX: search accented words in product description (consumption page)
FIX: Search on date in accountancy
FIX: selection of project for reception must use
FIX: shhhhhh ! There is nothing here...
FIX: Show input field checkbox selection
FIX: Show Ref.Supplier in LinkToObjectBlock
FIX: SQL Error show_contacts : socialnetworks
FIX: Start hour on ACCOUNTING_DATE_START_BINDING
FIX: supplier order: error 500 when using packaging with product where it is not defined
FIX: test must be === and not ==
FIX: test on link type
FIX: type link extrafield case for advanced target emailing
FIX: Write right on document
***** ChangeLog for 13.0.2 compared to 13.0.1 ***** ***** ChangeLog for 13.0.2 compared to 13.0.1 *****
FIX: 11.0 - $this->socid injected in query without checking for empty value FIX: 11.0 - $this->socid injected in query without checking for empty value

View File

@ -197,7 +197,7 @@ $sql .= " AND f.fk_statut > 0";
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_REPLACEMENT.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_SITUATION.")"; $sql .= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_REPLACEMENT.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_SITUATION.")";
} else { } else {
$sql .= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_STANDARD.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_DEPOSIT.",".Facture::TYPE_SITUATION.")"; $sql .= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_REPLACEMENT.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_DEPOSIT.",".Facture::TYPE_SITUATION.")";
} }
// Add search filter like // Add search filter like
if ($search_societe) { if ($search_societe) {

View File

@ -1689,8 +1689,7 @@ class Account extends CommonObject
{ {
$sql = "UPDATE ".MAIN_DB_PREFIX."bank_url SET url_id = ".((int) $dest_id)." WHERE url_id = ".((int) $origin_id)." AND type='company'"; $sql = "UPDATE ".MAIN_DB_PREFIX."bank_url SET url_id = ".((int) $dest_id)." WHERE url_id = ".((int) $origin_id)." AND type='company'";
if (!$db->query($sql)) if (! $db->query($sql)) {
{
//if ($ignoreerrors) return true; // TODO Not enough. If there is A-B on kept thirdarty and B-C on old one, we must get A-B-C after merge. Not A-B. //if ($ignoreerrors) return true; // TODO Not enough. If there is A-B on kept thirdarty and B-C on old one, we must get A-B-C after merge. Not A-B.
//$this->errors = $db->lasterror(); //$this->errors = $db->lasterror();
return false; return false;

View File

@ -598,6 +598,8 @@ class ExtraFields
*/ */
public function update($attrname, $label, $type, $length, $elementtype, $unique = 0, $required = 0, $pos = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0) public function update($attrname, $label, $type, $length, $elementtype, $unique = 0, $required = 0, $pos = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0)
{ {
global $hookmanager;
if ($elementtype == 'thirdparty') $elementtype = 'societe'; if ($elementtype == 'thirdparty') $elementtype = 'societe';
if ($elementtype == 'contact') $elementtype = 'socpeople'; if ($elementtype == 'contact') $elementtype = 'socpeople';
@ -638,6 +640,18 @@ class ExtraFields
} }
$field_desc = array('type'=>$typedb, 'value'=>$lengthdb, 'null'=>($required ? 'NOT NULL' : 'NULL'), 'default'=>$default); $field_desc = array('type'=>$typedb, 'value'=>$lengthdb, 'null'=>($required ? 'NOT NULL' : 'NULL'), 'default'=>$default);
if (is_object($hookmanager))
{
$hookmanager->initHooks(array('extrafieldsdao'));
$parameters = array('field_desc'=>&$field_desc, 'table'=>$table, 'attr_name'=>$attrname, 'label'=>$label, 'type'=>$type, 'length'=>$length, 'unique'=>$unique, 'required'=>$required, 'pos'=>$pos, 'param'=>$param, 'alwayseditable'=>$alwayseditable, 'perms'=>$perms, 'list'=>$list, 'help'=>$help, 'default'=>$default, 'computed'=>$computed, 'entity'=>$entity, 'langfile'=>$langfile, 'enabled'=>$enabled, 'totalizable'=>$totalizable, 'printable'=>$printable);
$reshook = $hookmanager->executeHooks('updateExtrafields', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
$this->error = $this->db->lasterror();
return -1;
}
}
if ($type != 'separate') // No table update when separate type if ($type != 'separate') // No table update when separate type
{ {
$result = $this->db->DDLUpdateField(MAIN_DB_PREFIX.$table, $attrname, $field_desc); $result = $this->db->DDLUpdateField(MAIN_DB_PREFIX.$table, $attrname, $field_desc);

View File

@ -1,19 +1,19 @@
<?php <?php
/* Copyright (C) 2011-2012 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2011-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
/** /**
* \file htdocs/core/class/rssparser.class.php * \file htdocs/core/class/rssparser.class.php
@ -181,7 +181,7 @@ class RssParser
* @param string $urlRSS Url to parse * @param string $urlRSS Url to parse
* @param int $maxNb Max nb of records to get (0 for no limit) * @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 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 * @return int <0 if KO, >0 if OK
*/ */
public function parser($urlRSS, $maxNb = 0, $cachedelay = 60, $cachedir = '') public function parser($urlRSS, $maxNb = 0, $cachedelay = 60, $cachedir = '')
@ -189,13 +189,13 @@ class RssParser
global $conf; global $conf;
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
$rss = ''; $rss = '';
$str = ''; // This will contain content of feed $str = ''; // This will contain content of feed
// Check parameters // Check parameters
if (!dol_is_url($urlRSS)) if (!dol_is_url($urlRSS)) {
{
$this->error = "ErrorBadUrl"; $this->error = "ErrorBadUrl";
return -1; return -1;
} }
@ -209,11 +209,9 @@ class RssParser
// Search into cache // Search into cache
$foundintocache = 0; $foundintocache = 0;
if ($cachedelay > 0 && $cachedir) if ($cachedelay > 0 && $cachedir) {
{
$filedate = dol_filemtime($newpathofdestfile); $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."); //dol_syslog("RssParser::parser cache file ".$newpathofdestfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay.") so we use it.");
$foundintocache = 1; $foundintocache = 1;
@ -224,32 +222,22 @@ class RssParser
} }
// Load file into $str // 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); $str = file_get_contents($newpathofdestfile);
} else { } else {
try { try {
ini_set("user_agent", "Dolibarr ERP-CRM RSS reader"); $result = getURLContent($this->_urlRSS, 'GET', '', 1, array(), array('http', 'https'), 0);
ini_set("max_execution_time", $conf->global->MAIN_USE_RESPONSE_TIMEOUT); if (!empty($result['content'])) {
ini_set("default_socket_timeout", $conf->global->MAIN_USE_RESPONSE_TIMEOUT); $str = $result['content'];
}
$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);
} catch (Exception $e) { } catch (Exception $e) {
print 'Error retrieving URL '.$this->_urlRSS.' - '.$e->getMessage(); print 'Error retrieving URL '.$this->_urlRSS.' - '.$e->getMessage();
} }
} }
if ($str !== false) if ($str !== false) {
{
// Convert $str into xml // Convert $str into xml
if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) {
{
//print 'xx'.LIBXML_NOCDATA; //print 'xx'.LIBXML_NOCDATA;
libxml_use_internal_errors(false); libxml_use_internal_errors(false);
$rss = simplexml_load_string($str, "SimpleXMLElement", LIBXML_NOCDATA); $rss = simplexml_load_string($str, "SimpleXMLElement", LIBXML_NOCDATA);
@ -276,19 +264,20 @@ class RssParser
} }
// If $rss loaded // If $rss loaded
if ($rss) if ($rss) {
{
// Save file into cache // 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."); 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'); $fp = fopen($newpathofdestfile, 'w');
if ($fp) if ($fp) {
{
fwrite($fp, $str); fwrite($fp, $str);
fclose($fp); 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)); @chmod($newpathofdestfile, octdec($newmask));
$this->_lastfetchdate = $nowgmt; $this->_lastfetchdate = $nowgmt;
@ -299,10 +288,11 @@ class RssParser
unset($str); // Free memory 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'; $rss->_format = 'rss';
if (empty($rss->channel)) $rss->_format = 'atom'; if (empty($rss->channel)) {
$rss->_format = 'atom';
}
} }
$items = array(); $items = array();
@ -311,46 +301,98 @@ class RssParser
if ($rss->_format == 'rss') { if ($rss->_format == 'rss') {
//var_dump($rss); //var_dump($rss);
if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) { if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) {
if (!empty($rss->channel->language)) $this->_language = (string) $rss->channel->language; if (!empty($rss->channel->language)) {
if (!empty($rss->channel->generator)) $this->_generator = (string) $rss->channel->generator; $this->_language = (string) $rss->channel->language;
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->generator)) {
if (!empty($rss->channel->image->url[0])) $this->_imageurl = (string) $rss->channel->image->url[0]; $this->_generator = (string) $rss->channel->generator;
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->copyright)) {
if (!empty($rss->channel->description)) $this->_description = (string) $rss->channel->description; $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 { } else {
//var_dump($rss->channel); //var_dump($rss->channel);
if (!empty($rss->channel['language'])) $this->_language = (string) $rss->channel['language']; if (!empty($rss->channel['language'])) {
if (!empty($rss->channel['generator'])) $this->_generator = (string) $rss->channel['generator']; $this->_language = (string) $rss->channel['language'];
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['generator'])) {
if (!empty($rss->image['url'])) $this->_imageurl = (string) $rss->image['url']; $this->_generator = (string) $rss->channel['generator'];
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['copyright'])) {
if (!empty($rss->channel['description'])) $this->_description = (string) $rss->channel['description']; $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 if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) {
else $items = $rss->items; // With xmlparse $items = $rss->channel->item; // With simplexml
} else {
$items = $rss->items; // With xmlparse
}
//var_dump($items);exit; //var_dump($items);exit;
} elseif ($rss->_format == 'atom') { } elseif ($rss->_format == 'atom') {
//var_dump($rss); //var_dump($rss);
if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) {
{ if (!empty($rss->generator)) {
if (!empty($rss->generator)) $this->_generator = (string) $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->lastbuilddate)) {
if (!empty($rss->title)) $this->_title = (string) $rss->title; $this->_lastbuilddate = (string) $rss->modified;
if (!empty($rss->description)) $this->_description = (string) $rss->description; }
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 { } else {
//if (!empty($rss->channel['rss_language'])) $this->_language = (string) $rss->channel['rss_language']; //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['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->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['link'])) {
if (!empty($rss->channel['title'])) $this->_title = (string) $rss->channel['title']; $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['rss_description'])) $this->_description = (string) $rss->channel['rss_description'];
if (!empty($rss->channel)) { if (!empty($rss->channel)) {
@ -358,9 +400,12 @@ class RssParser
} }
} }
if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) { if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) {
$tmprss = xml2php($rss); $items = $tmprss['entry']; $tmprss = xml2php($rss);
} // With simplexml $items = $tmprss['entry'];
else $items = $rss->items; // With xmlparse } else {
// With simplexml
$items = $rss->items; // With xmlparse
}
//var_dump($items);exit; //var_dump($items);exit;
} }
@ -436,7 +481,9 @@ class RssParser
$i++; $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 // check for a namespace, and split if found
$ns = false; $ns = false;
if (strpos($element, ':')) if (strpos($element, ':')) {
{
list($ns, $el) = explode(':', $element, 2); list($ns, $el) = explode(':', $element, 2);
} }
if ($ns and $ns != 'rdf') if ($ns and $ns != 'rdf') {
{
$this->current_namespace = $ns; $this->current_namespace = $ns;
} }
// if feed type isn't set, then this is first element of feed identify feed from root element // 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') { if ($el == 'rdf') {
$this->_format = 'rss'; $this->_format = 'rss';
$this->feed_version = '1.0'; $this->feed_version = '1.0';
@ -492,75 +536,54 @@ class RssParser
return; return;
} }
if ($el == 'channel') if ($el == 'channel') {
{
$this->inchannel = true; $this->inchannel = true;
} elseif ($el == 'item' or $el == 'entry') } elseif ($el == 'item' or $el == 'entry') {
{
$this->initem = true; $this->initem = true;
if (isset($attrs['rdf:about'])) { if (isset($attrs['rdf:about'])) {
$this->current_item['about'] = $attrs['rdf:about']; $this->current_item['about'] = $attrs['rdf:about'];
} }
} } elseif ($this->_format == 'rss' and
$this->current_namespace == '' and
// if we're in the default namespace of an RSS feed, $el == 'textinput') {
// record textinput or image fields // if we're in the default namespace of an RSS feed,
elseif ( // record textinput or image fields
$this->_format == 'rss' and $this->intextinput = true;
$this->current_namespace == '' and } elseif ($this->_format == 'rss' and
$el == 'textinput' ) $this->current_namespace == '' and
{ $el == 'image') {
$this->intextinput = true; $this->inimage = true;
} elseif ( } elseif ($this->_format == 'atom' and in_array($el, $this->_CONTENT_CONSTRUCTS)) {
$this->_format == 'rss' and // handle atom content constructs
$this->current_namespace == '' and
$el == 'image' )
{
$this->inimage = true;
}
// handle atom content constructs
elseif ($this->_format == 'atom' and in_array($el, $this->_CONTENT_CONSTRUCTS))
{
// avoid clashing w/ RSS mod_content // avoid clashing w/ RSS mod_content
if ($el == 'content') { if ($el == 'content') {
$el = 'atom_content'; $el = 'atom_content';
} }
$this->incontent = $el; $this->incontent = $el;
} } elseif ($this->_format == 'atom' and $this->incontent) {
// if inside an Atom content construct (e.g. content or summary) field treat tags as text
// if inside an Atom content construct (e.g. content or summary) field treat tags as text
elseif ($this->_format == 'atom' and $this->incontent)
{
// if tags are inlined, then flatten // if tags are inlined, then flatten
$attrs_str = join(' ', array_map('map_attrs', array_keys($attrs), array_values($attrs))); $attrs_str = join(' ', array_map('map_attrs', array_keys($attrs), array_values($attrs)));
$this->append_content("<$element $attrs_str>"); $this->append_content("<$element $attrs_str>");
array_unshift($this->stack, $el); array_unshift($this->stack, $el);
} } elseif ($this->_format == 'atom' and $el == 'link') {
// Atom support many links per containging element.
// Atom support many links per containging element. // Magpie treats link elements of type rel='alternate'
// Magpie treats link elements of type rel='alternate' // as being equivalent to RSS's simple link element.
// as being equivalent to RSS's simple link element. if (isset($attrs['rel']) && $attrs['rel'] == 'alternate') {
//
elseif ($this->_format == 'atom' and $el == 'link')
{
if (isset($attrs['rel']) && $attrs['rel'] == 'alternate')
{
$link_el = 'link'; $link_el = 'link';
} elseif (!isset($attrs['rel'])) } elseif (!isset($attrs['rel'])) {
{
$link_el = 'link'; $link_el = 'link';
} else { } else {
$link_el = 'link_'.$attrs['rel']; $link_el = 'link_'.$attrs['rel'];
} }
$this->append($link_el, $attrs['href']); $this->append($link_el, $attrs['href']);
} } else {
// set stack[0] to current element // set stack[0] to current element
else {
array_unshift($this->stack, $el); array_unshift($this->stack, $el);
} }
} }
@ -577,8 +600,7 @@ class RssParser
public function feed_cdata($p, $text) public function feed_cdata($p, $text)
{ {
// phpcs:enable // phpcs:enable
if ($this->_format == 'atom' and $this->incontent) if ($this->_format == 'atom' and $this->incontent) {
{
$this->append_content($text); $this->append_content($text);
} else { } else {
$current_el = join('_', array_reverse($this->stack)); $current_el = join('_', array_reverse($this->stack));
@ -599,28 +621,22 @@ class RssParser
// phpcs:enable // phpcs:enable
$el = strtolower($el); $el = strtolower($el);
if ($el == 'item' or $el == 'entry') if ($el == 'item' or $el == 'entry') {
{
$this->items[] = $this->current_item; $this->items[] = $this->current_item;
$this->current_item = array(); $this->current_item = array();
$this->initem = false; $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; $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; $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; $this->incontent = false;
} elseif ($el == 'channel' or $el == 'feed') } elseif ($el == 'channel' or $el == 'feed') {
{
$this->inchannel = false; $this->inchannel = false;
} elseif ($this->_format == 'atom' and $this->incontent) { } elseif ($this->_format == 'atom' and $this->incontent) {
// balance tags properly // balance tags properly
// note: i don't think this is actually neccessary // note: i don't think this is actually neccessary
if ($this->stack[0] == $el) if ($this->stack[0] == $el) {
{
$this->append_content("</$el>"); $this->append_content("</$el>");
} else { } else {
$this->append_content("<$el />"); $this->append_content("<$el />");
@ -679,8 +695,7 @@ class RssParser
if (!$el) { if (!$el) {
return; return;
} }
if ($this->current_namespace) if ($this->current_namespace) {
{
if ($this->initem) { if ($this->initem) {
$this->concat($this->current_item[$this->current_namespace][$el], $text); $this->concat($this->current_item[$this->current_namespace][$el], $text);
} elseif ($this->inchannel) { } elseif ($this->inchannel) {
@ -714,11 +729,9 @@ class RssParser
{ {
$result = ""; $result = "";
if (isset($item['summary'])) if (isset($item['summary'])) {
{
$result = $item['summary']; $result = $item['summary'];
} elseif (isset($item['atom_content'])) } elseif (isset($item['atom_content'])) {
{
$result = $item['atom_content']; $result = $item['atom_content'];
} }
@ -728,8 +741,7 @@ class RssParser
$result = str_replace("\n", "", $result); $result = str_replace("\n", "", $result);
if (strlen($result) > $maxlength) if (strlen($result) > $maxlength) {
{
$result = substr($result, 0, $maxlength); $result = substr($result, 0, $maxlength);
$result .= "..."; $result .= "...";
} }
@ -745,28 +757,23 @@ class RssParser
*/ */
private function getAtomImageUrl(array $feed) private function getAtomImageUrl(array $feed)
{ {
if (isset($feed['icon'])) if (isset($feed['icon'])) {
{
return $feed['logo']; return $feed['logo'];
} }
if (isset($feed['icon'])) if (isset($feed['icon'])) {
{
return $feed['logo']; return $feed['logo'];
} }
if (isset($feed['webfeeds:logo'])) if (isset($feed['webfeeds:logo'])) {
{
return $feed['webfeeds:logo']; return $feed['webfeeds:logo'];
} }
if (isset($feed['webfeeds:icon'])) if (isset($feed['webfeeds:icon'])) {
{
return $feed['webfeeds:icon']; return $feed['webfeeds:icon'];
} }
if (isset($feed['webfeeds:wordmark'])) if (isset($feed['webfeeds:wordmark'])) {
{
return $feed['webfeeds:wordmark']; return $feed['webfeeds:wordmark'];
} }
@ -786,27 +793,23 @@ function xml2php($xml)
$fils = 0; $fils = 0;
$tab = false; $tab = false;
$array = array(); $array = array();
foreach ($xml->children() as $key => $value) foreach ($xml->children() as $key => $value) {
{
$child = xml2php($value); $child = xml2php($value);
//To deal with the attributes //To deal with the attributes
foreach ($value->attributes() as $ak=>$av) foreach ($value->attributes() as $ak => $av) {
{
$child[$ak] = (string) $av; $child[$ak] = (string) $av;
} }
//Let see if the new child is not in the array //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 //If this element is already in the array we will create an indexed array
$tmp = $array[$key]; $tmp = $array[$key];
$array[$key] = null; $array[$key] = null;
$array[$key][] = $tmp; $array[$key][] = $tmp;
$array[$key][] = $child; $array[$key][] = $child;
$tab = true; $tab = true;
} elseif ($tab === true) } elseif ($tab === true) {
{
//Add an element in an existing array //Add an element in an existing array
$array[$key][] = $child; $array[$key][] = $child;
} else { } else {
@ -818,8 +821,7 @@ function xml2php($xml)
} }
if ($fils == 0) if ($fils == 0) {
{
return (string) $xml; return (string) $xml;
} }

View File

@ -374,6 +374,9 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
} elseif ($feature == 'salaries') } elseif ($feature == 'salaries')
{ {
if (!$user->rights->salaries->delete) $deleteok = 0; if (!$user->rights->salaries->delete) $deleteok = 0;
} elseif ($feature == 'payment_supplier')
{
if (!$user->rights->fournisseur->facture->creer) { $deleteok = 0; }
} elseif (!empty($feature2)) // This is for permissions on 2 levels } elseif (!empty($feature2)) // This is for permissions on 2 levels
{ {
foreach ($feature2 as $subfeature) foreach ($feature2 as $subfeature)

View File

@ -335,6 +335,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
if ($type == 1) $sql .= " WHERE code_fournisseur = '".$db->escape($code)."'"; if ($type == 1) $sql .= " WHERE code_fournisseur = '".$db->escape($code)."'";
else $sql .= " WHERE code_client = '".$db->escape($code)."'"; else $sql .= " WHERE code_client = '".$db->escape($code)."'";
if ($soc->id > 0) $sql .= " AND rowid <> ".$soc->id; if ($soc->id > 0) $sql .= " AND rowid <> ".$soc->id;
$sql .= " AND entity IN (".getEntity('societe').")";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)

View File

@ -23,7 +23,13 @@ if (!empty($extrafieldsobjectkey) && !empty($search_array_options) && is_array($
if ($crit != '' && in_array($typ, array('date', 'datetime', 'timestamp'))) if ($crit != '' && in_array($typ, array('date', 'datetime', 'timestamp')))
{ {
$sql .= " AND ".$extrafieldsobjectprefix.$tmpkey." = '".$db->idate($crit)."'"; 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'))) } elseif (in_array($typ, array('boolean')))
{ {
if ($crit !== '-1' && $crit !== '') { if ($crit !== '-1' && $crit !== '') {

View File

@ -31,7 +31,7 @@
*/ */
if (!defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE', 'Dolibarr'); if (!defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE', 'Dolibarr');
if (!defined('DOL_VERSION')) define('DOL_VERSION', '13.0.2'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (!defined('DOL_VERSION')) define('DOL_VERSION', '13.0.3'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
if (!defined('EURO')) define('EURO', chr(128)); if (!defined('EURO')) define('EURO', chr(128));

View File

@ -1518,7 +1518,7 @@ class Societe extends CommonObject
$sql .= ' WHERE s.entity IN ('.getEntity($this->element).')'; $sql .= ' WHERE s.entity IN ('.getEntity($this->element).')';
if ($rowid) { if ($rowid) {
$sql .= ' AND s.rowid = '.$rowid; $sql .= ' AND s.rowid = '.((int) $rowid);
} }
if ($ref) { if ($ref) {
$sql .= " AND s.nom = '".$this->db->escape($ref)."'"; $sql .= " AND s.nom = '".$this->db->escape($ref)."'";

View File

@ -227,7 +227,7 @@ if ($type_element == 'propal')
$where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid;
$where .= " AND d.fk_propal = c.rowid"; $where .= " AND d.fk_propal = c.rowid";
$where .= " AND c.entity = ".$conf->entity; $where .= " AND c.entity = ".$conf->entity;
$datePrint = 'c.datep'; $dateprint = 'c.datep';
$doc_number = 'c.ref'; $doc_number = 'c.ref';
$thirdTypeSelect = 'customer'; $thirdTypeSelect = 'customer';
} }

View File

@ -43,6 +43,7 @@
--amountremaintopaycolor:#880000; --amountremaintopaycolor:#880000;
--amountpaymentcomplete:#008800; --amountpaymentcomplete:#008800;
--amountremaintopaybackcolor:none; --amountremaintopaybackcolor:none;
--infoboxmoduleenabledbgcolor : linear-gradient(0.4turn, #fff, #fff, #fff, #e4efe8);
} }
<?php <?php
@ -87,6 +88,7 @@ if (!empty($conf->global->THEME_DARKMODEENABLED)) {
--amountremaintopaycolor:rgb(252,84,91); --amountremaintopaycolor:rgb(252,84,91);
--amountpaymentcomplete:rgb(101,184,77); --amountpaymentcomplete:rgb(101,184,77);
--amountremaintopaybackcolor:rbg(245,130,46); --amountremaintopaybackcolor:rbg(245,130,46);
--infoboxmoduleenabledbgcolor : linear-gradient(0.4turn, #000, #000, #000, #274231);
}\n"; }\n";
if ($conf->global->THEME_DARKMODEENABLED != 2) { if ($conf->global->THEME_DARKMODEENABLED != 2) {
print "}\n"; print "}\n";

View File

@ -183,8 +183,8 @@ a.info-box-text-a i.fa.fa-exclamation-triangle {
margin-left: 80px; margin-left: 80px;
} }
.info-box-sm .info-box-module-enabled { .info-box-sm .info-box-module-enabled {
/* background: linear-gradient(0.35turn, #fff, #fff, #f6faf8, #e4efe8) */ /* background: linear-gradient(0.35turn, #fff, #fff, #f6faf8, #e4efe8) */
background: linear-gradient(0.4turn, #fff, #fff, #fff, #e4efe8); background: var(--infoboxmoduleenabledbgcolor);
} }
.info-box-content-warning span.font-status4 { .info-box-content-warning span.font-status4 {
color: #bc9526 !important; color: #bc9526 !important;

View File

@ -210,7 +210,7 @@ $styleuse = 'encoded'; // encoded/literal/literal wrapped
$server->register( $server->register(
'getThirdParty', 'getThirdParty',
// Entry values // Entry values
array('authentication'=>'tns:authentication', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string'), array('authentication'=>'tns:authentication', 'id'=>'xsd:string', 'ref'=>'xsd:string', 'ref_ext'=>'xsd:string', 'barcode'=>'xsd:string', 'profid1'=>'xsd:string', 'profid2'=>'xsd:string'),
// Exit values // Exit values
array('result'=>'tns:result', 'thirdparty'=>'tns:thirdparty'), array('result'=>'tns:result', 'thirdparty'=>'tns:thirdparty'),
$ns, $ns,
@ -286,13 +286,16 @@ $server->register(
* @param string $id internal id * @param string $id internal id
* @param string $ref internal reference * @param string $ref internal reference
* @param string $ref_ext external reference * @param string $ref_ext external reference
* @param string $barcode barcode
* @param string $profid1 profid1
* @param string $profid2 profid2
* @return array Array result * @return array Array result
*/ */
function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '') function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '', $barcode = '', $profid1 = '', $profid2 = '')
{ {
global $db, $conf; global $db, $conf;
dol_syslog("Function: getThirdParty login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext); dol_syslog("Function: getThirdParty login=".$authentication['login']." id=".$id." ref=".$ref." ref_ext=".$ref_ext." barcode=".$barcode." profid1=".$profid1." profid2=".$profid2);
if ($authentication['entity']) $conf->entity = $authentication['entity']; if ($authentication['entity']) $conf->entity = $authentication['entity'];
@ -317,7 +320,7 @@ function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '')
if ($fuser->rights->societe->lire) if ($fuser->rights->societe->lire)
{ {
$thirdparty = new Societe($db); $thirdparty = new Societe($db);
$result = $thirdparty->fetch($id, $ref, $ref_ext); $result = $thirdparty->fetch($id, $ref, $ref_ext, $barcode, $profid1, $profid2);
if ($result > 0) { if ($result > 0) {
$thirdparty_result_fields = array( $thirdparty_result_fields = array(
'id' => $thirdparty->id, 'id' => $thirdparty->id,

View File

@ -191,7 +191,8 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
'multicurrency.class.php', 'multicurrency.class.php',
'productbatch.class.php', 'productbatch.class.php',
'reception.class.php', 'reception.class.php',
'societe.class.php' 'societe.class.php',
'account.class.php'
))) { ))) {
// Must must not found $db-> // Must must not found $db->
$ok=true; $ok=true;