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

This commit is contained in:
Laurent Destailleur
2022-07-22 18:09:38 +02:00
16 changed files with 135 additions and 101 deletions

View File

@@ -674,7 +674,7 @@ if ($id) {
// Can an entry be erased or disabled ?
$iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
$url = $_SERVER["PHP_SELF"].'?token='.newToken().($page ? '&page='.$page : '').'&sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
if ($param) {
$url .= '&'.$param;
}

View File

@@ -3,6 +3,7 @@
* Copyright (C) 2005-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2018 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* 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
@@ -108,7 +109,7 @@ llxHeader('', $langs->trans("WithdrawalsLines"));
$sql = "SELECT p.rowid, p.ref, p.statut as status, p.datec";
$sql .= " , f.rowid as facid, f.ref as invoiceref, f.total_ttc";
$sql .= " , s.rowid as socid, s.nom as name, s.code_client, s.email";
$sql .= " , s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.email";
$sql .= " , pl.amount, pl.statut as statut_ligne, pl.rowid as rowid_ligne";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
@@ -139,7 +140,7 @@ if ($search_bon) {
}
if ($type == 'bank-transfer') {
if ($search_code) {
$sql .= natural_search("s.code_fourn", $search_code);
$sql .= natural_search("s.code_fournisseur", $search_code);
}
} else {
if ($search_code) {
@@ -172,6 +173,9 @@ if ($result) {
$param = "&amp;statut=".urlencode($statut);
$param .= "&amp;search_bon=".urlencode($search_bon);
if ($type == 'bank-transfer') {
$param .= '&amp;type=bank-transfer';
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}
@@ -204,7 +208,7 @@ if ($result) {
print '<td class="liste_titre"><input type="text" class="flat" name="search_bon" value="'.dol_escape_htmltag($search_bon).'" size="6"></td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_company" value="'.dol_escape_htmltag($search_company).'" size="6"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" name="search_code" value="'.dol_escape_htmltag($search_code).'" size="6"></td>';
print '<td class="liste_titre center"><input type="text" class="flat" name="search_code" value="'.dol_escape_htmltag($search_code).'" size="6"></td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre maxwidthsearch">';
@@ -214,8 +218,12 @@ if ($result) {
print '</tr>';
$columntitle = "WithdrawalsReceipts";
$columntitlethirdparty = "CustomerCode";
$columncodethirdparty = "s.code_client";
if ($type == 'bank-transfer') {
$columntitle = "BankTransferReceipts";
$columntitlethirdparty = "SupplierCode";
$columncodethirdparty = "s.code_fournisseur";
}
print '<tr class="liste_titre">';
@@ -223,7 +231,7 @@ if ($result) {
print_liste_field_titre("Line", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre("Bill", $_SERVER["PHP_SELF"], "f.ref", '', $param, '', $sortfield, $sortorder);
print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", '', $param, '', $sortfield, $sortorder);
print_liste_field_titre("CustomerCode", $_SERVER["PHP_SELF"], "s.code_client", '', $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre($columntitlethirdparty, $_SERVER["PHP_SELF"], $columncodethirdparty, '', $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "pl.amount", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre('');
@@ -256,9 +264,17 @@ if ($result) {
print '</a></td>';
print '<td>';
print '<a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->facid.'">';
print img_object($langs->trans("ShowBill"), "bill");
print '&nbsp;<a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->facid.'">'.$obj->invoiceref."</a></td>\n";
$link_to_bill = '/compta/facture/card.php?facid=';
$link_title = 'Invoice';
$link_picto = 'bill';
if ($type == 'bank-transfer') {
$link_to_bill = '/fourn/facture/card.php?facid=';
$link_title = 'SupplierInvoice';
$link_picto = 'supplier_invoice';
}
print '<a href="'.DOL_URL_ROOT.$link_to_bill.$obj->facid.'">';
print img_object($langs->trans($link_title), $link_picto);
print '&nbsp;'.$obj->invoiceref."</td>\n";
print '</a>';
print '</td>';
@@ -266,7 +282,15 @@ if ($result) {
print $company->getNomUrl(1);
print "</td>\n";
print '<td align="center"><a href="card.php?id='.$obj->rowid.'">'.$obj->code_client."</a></td>\n";
print '<td class="center">';
$link_to_tab = '/comm/card.php?socid=';
$link_code = $obj->code_client;
if ($type == 'bank-transfer') {
$link_to_tab = '/fourn/card.php?socid=';
$link_code = $obj->code_fournisseur;
}
print '<a href="'.DOL_URL_ROOT.$link_to_tab.$company->id.'">'.$link_code."</a></td>\n";
print '<td class="center">'.dol_print_date($db->jdate($obj->datec), 'day')."</td>\n";

View File

@@ -132,6 +132,9 @@ if ($result) {
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($type == 'bank-transfer') {
$param .= '&amp;type=bank-transfer';
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit);
}

View File

@@ -51,6 +51,12 @@ class RssParser
private $current_namespace;
private $initem;
private $intextinput;
private $incontent;
private $inimage;
private $inchannel;
// For parsing with xmlparser
public $stack = array(); // parser stack
private $_CONTENT_CONSTRUCTS = array('content', 'summary', 'info', 'title', 'tagline', 'copyright');
@@ -254,7 +260,8 @@ class RssParser
return -1;
}
$xmlparser = xml_parser_create('');
try {
$xmlparser = xml_parser_create(null);
if (!is_resource($xmlparser) && !is_object($xmlparser)) {
$this->error = "ErrorFailedToCreateParser";
@@ -265,10 +272,14 @@ class RssParser
xml_set_element_handler($xmlparser, 'feed_start_element', 'feed_end_element');
xml_set_character_data_handler($xmlparser, 'feed_cdata');
$status = xml_parse($xmlparser, $str);
$status = xml_parse($xmlparser, $str, false);
xml_parser_free($xmlparser);
$rss = $this;
//var_dump($status.' '.$rss->_format);exit;
} catch (Exception $e) {
$rss = null;
}
}
}
@@ -443,7 +454,7 @@ class RssParser
// Loop on each category
$itemCategory = array();
if (is_array($item->category)) {
if (!empty($item->category) && is_array($item->category)) {
foreach ($item->category as $cat) {
$itemCategory[] = (string) $cat;
}
@@ -514,7 +525,7 @@ class RssParser
* @param array $attrs Attributes of tags
* @return void
*/
public function feed_start_element($p, $element, &$attrs)
public function feed_start_element($p, $element, $attrs)
{
// phpcs:enable
$el = $element = strtolower($element);
@@ -681,9 +692,9 @@ class RssParser
public function append_content($text)
{
// phpcs:enable
if ($this->initem) {
if (!empty($this->initem)) {
$this->concat($this->current_item[$this->incontent], $text);
} elseif ($this->inchannel) {
} elseif (!empty($this->inchannel)) {
$this->concat($this->channel[$this->incontent], $text);
}
}
@@ -700,24 +711,24 @@ class RssParser
if (!$el) {
return;
}
if ($this->current_namespace) {
if ($this->initem) {
if (!empty($this->current_namespace)) {
if (!empty($this->initem)) {
$this->concat($this->current_item[$this->current_namespace][$el], $text);
} elseif ($this->inchannel) {
} elseif (!empty($this->inchannel)) {
$this->concat($this->channel[$this->current_namespace][$el], $text);
} elseif ($this->intextinput) {
} elseif (!empty($this->intextinput)) {
$this->concat($this->textinput[$this->current_namespace][$el], $text);
} elseif ($this->inimage) {
} elseif (!empty($this->inimage)) {
$this->concat($this->image[$this->current_namespace][$el], $text);
}
} else {
if ($this->initem) {
if (!empty($this->initem)) {
$this->concat($this->current_item[$el], $text);
} elseif ($this->intextinput) {
} elseif (!empty($this->intextinput)) {
$this->concat($this->textinput[$el], $text);
} elseif ($this->inimage) {
} elseif (!empty($this->inimage)) {
$this->concat($this->image[$el], $text);
} elseif ($this->inchannel) {
} elseif (!empty($this->inchannel)) {
$this->concat($this->channel[$el], $text);
}
}

View File

@@ -471,7 +471,7 @@ class DoliDBMysqli extends DoliDB
*/
public function escape($stringtoencode)
{
return $this->db->real_escape_string($stringtoencode);
return $this->db->real_escape_string((string) $stringtoencode);
}
/**
@@ -482,7 +482,7 @@ class DoliDBMysqli extends DoliDB
*/
public function escapeunderscore($stringtoencode)
{
return str_replace('_', '\_', $stringtoencode);
return str_replace('_', '\_', (string) $stringtoencode);
}
/**

View File

@@ -6583,10 +6583,10 @@ function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart = '
*
* @param string $dir Directory to create (Separator must be '/'. Example: '/mydir/mysubdir')
* @param string $dataroot Data root directory (To avoid having the data root in the loop. Using this will also lost the warning on first dir PHP has no permission when open_basedir is used)
* @param string|null $newmask Mask for new file (Defaults to $conf->global->MAIN_UMASK or 0755 if unavailable). Example: '0444'
* @param string $newmask Mask for new file (Defaults to $conf->global->MAIN_UMASK or 0755 if unavailable). Example: '0444'
* @return int < 0 if KO, 0 = already exists, > 0 if OK
*/
function dol_mkdir($dir, $dataroot = '', $newmask = null)
function dol_mkdir($dir, $dataroot = '', $newmask = '')
{
global $conf;
@@ -6627,7 +6627,7 @@ function dol_mkdir($dir, $dataroot = '', $newmask = null)
dol_syslog("functions.lib::dol_mkdir: Directory '".$ccdir."' does not exists or is outside open_basedir PHP setting.", LOG_DEBUG);
umask(0);
$dirmaskdec = octdec($newmask);
$dirmaskdec = octdec((string) $newmask);
if (empty($newmask)) {
$dirmaskdec = empty($conf->global->MAIN_UMASK) ? octdec('0755') : octdec($conf->global->MAIN_UMASK);
}

View File

@@ -93,7 +93,8 @@ class modIncoterm extends DolibarrModules
'tabfieldvalue'=>array("code,libelle"), // List of fields (list of fields to edit a record)
'tabfieldinsert'=>array("code,libelle"), // List of fields (list of fields for insert)
'tabrowid'=>array("rowid"), // Name of columns with primary key (try to always name it 'rowid')
'tabcond'=>array($conf->incoterm->enabled)
'tabcond'=>array($conf->incoterm->enabled),
'tabhelp' => array(array())
);
$this->boxes = array(); // List of boxes

View File

@@ -263,7 +263,7 @@ if (empty($reshook)) {
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->expensereport->creer))
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->expensereport->creer) && empty($user->rights->expensereport->writeall_advance))) {
$error++;
setEventMessages($langs->trans("NotEnoughPermission"), null, 'errors');
setEventMessages($langs->trans("NotEnoughPermissions"), null, 'errors');
}
if (!$error) {
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->expensereport->writeall_advance)) {

View File

@@ -482,7 +482,7 @@ if ($resql) {
if ($canedit) {
print '<a href="'.DOL_URL_ROOT.'/expensereport/card.php?action=create&fk_user_author='.$fuser->id.'" class="butAction">'.$langs->trans("AddTrip").'</a>';
} else {
print '<a href="#" class="butActionRefused" title="'.$langs->trans("NotEnoughPermission").'">'.$langs->trans("AddTrip").'</a>';
print '<a href="#" class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("AddTrip").'</a>';
}
print '</div>';

View File

@@ -109,7 +109,7 @@ insert into llx_c_forme_juridique (fk_pays, code, libelle) values (2, '228', 'VO
insert into llx_c_forme_juridique (fk_pays, code, libelle) values (2, '229', 'VS0 - Vennootschap met sociaal oogmerk');
-- France: Extrait de http://www.insee.fr/fr/nom_def_met/nomenclatures/cj/cjniveau2.htm
-- France: Extrait de https://www.insee.fr/fr/information/2028129
insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'11','Artisan Commerçant (EI)');
insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'12','Commerçant (EI)');
insert into llx_c_forme_juridique (fk_pays, code, libelle) values (1,'13','Artisan (EI)');

View File

@@ -345,7 +345,7 @@ KiloBytes=Kilobytes
MegaBytes=Megabytes
GigaBytes=Gigabytes
TeraBytes=Terabytes
UserAuthor=Ceated by
UserAuthor=Created by
UserModif=Updated by
b=b.
Kb=Kb
@@ -712,6 +712,7 @@ FeatureDisabled=Feature disabled
MoveBox=Move widget
Offered=Offered
NotEnoughPermissions=You don't have permission for this action
UserNotInHierachy=This action is reserved to the supervisors of this user
SessionName=Session name
Method=Method
Receive=Receive

View File

@@ -221,9 +221,9 @@ class modMyModule extends DolibarrModules
// Name of columns with primary key (try to always name it 'rowid')
'tabrowid'=>array("rowid", "rowid", "rowid"),
// Condition to show each dictionary
'tabcond'=>array($conf->mymodule->enabled, $conf->mymodule->enabled, $conf->mymodule->enabled)
// Help tooltip for each fields of the dictionary
'tabhelp'=>array(array('code'=>$langs->trans('CodeTooltipHelp')))
'tabcond'=>array($conf->mymodule->enabled, $conf->mymodule->enabled, $conf->mymodule->enabled),
// Tooltip for every fields of dictionaries: DO NOT PUT AN EMPTY ARRAY
'tabhelp'=>array(array('code'=>$langs->trans('CodeTooltipHelp'), 'field2' => 'field2tooltip'), array('code'=>$langs->trans('CodeTooltipHelp'), 'field2' => 'field2tooltip'), ...),
);
*/

View File

@@ -336,7 +336,7 @@ $sql .= " t.rowid as id, t.ref, t.label, t.planned_workload, t.duration_effectiv
$sql .= " t.description, t.fk_task_parent";
$sql .= " ,t.budget_amount";
// We'll need these fields in order to filter by categ
if ($search_categ) {
if ($search_categ > 0) {
$sql .= ", cs.fk_categorie, cs.fk_project";
}
// Add sum fields
@@ -356,7 +356,7 @@ $sql .= $hookmanager->resPrint;
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
// We'll need this table joined to the select in order to filter by categ
if (!empty($search_categ)) {
if ($search_categ > 0) {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_project as cs ON p.rowid = cs.fk_project"; // We'll need this table joined to the select in order to filter by categ
}
$sql .= ", ".MAIN_DB_PREFIX."projet_task as t";

View File

@@ -751,7 +751,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
if ($permissiontoaddbankaccount) {
$morehtmlright = dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=create');
} else {
$morehtmlright = dolGetButtonTitle($langs->trans('Add'), 'NotEnoughPermission', 'fa fa-plus-circle', '', '', -2);
$morehtmlright = dolGetButtonTitle($langs->trans('Add'), $langs->trans('NotEnoughPermissions'), 'fa fa-plus-circle', '', '', -2);
}
} else {
$morehtmlright = dolGetButtonTitle($langs->trans('Add'), 'AlreadyOneBankAccount', 'fa fa-plus-circle', '', '', -2);

View File

@@ -476,7 +476,7 @@ if (empty($reshook)) {
$object->lang = GETPOST('default_lang', 'aZ09');
// Do we update also ->entity ?
if (!empty($conf->multicompany->enabled && $user->entity == 0 && !empty($user->admin))) { // If multicompany is not enabled, we never update the entity of a user.
if (!empty($conf->multicompany->enabled) && empty($user->entity) && !empty($user->admin)) { // If multicompany is not enabled, we never update the entity of a user.
if (GETPOST('superadmin', 'int')) {
$object->entity = 0;
} else {

View File

@@ -1488,8 +1488,8 @@ class User extends CommonObject
// Clean parameters
$this->setUpperOrLowerCase();
$this->civility_code = trim($this->civility_code);
$this->login = trim($this->login);
$this->civility_code = trim((string) $this->civility_code);
$this->login = trim((string) $this->login);
if (!isset($this->entity)) {
$this->entity = $conf->entity; // If not defined, we use default value
}
@@ -1851,46 +1851,44 @@ class User extends CommonObject
dol_syslog(get_class($this)."::update notrigger=".$notrigger.", nosyncmember=".$nosyncmember.", nosyncmemberpass=".$nosyncmemberpass);
// Clean parameters
$this->civility_code = trim($this->civility_code);
$this->lastname = trim($this->lastname);
$this->firstname = trim($this->firstname);
$this->ref_employee = trim($this->ref_employee);
$this->national_registration_number = trim($this->national_registration_number);
$this->employee = $this->employee ? $this->employee : 0;
$this->login = trim($this->login);
$this->gender = trim($this->gender);
$this->pass = trim($this->pass);
$this->api_key = trim($this->api_key);
$this->address = $this->address ? trim($this->address) : trim($this->address);
$this->zip = $this->zip ? trim($this->zip) : trim($this->zip);
$this->town = $this->town ? trim($this->town) : trim($this->town);
$this->civility_code = trim((string) $this->civility_code);
$this->lastname = trim((string) $this->lastname);
$this->firstname = trim((string) $this->firstname);
$this->ref_employee = trim((string) $this->ref_employee);
$this->national_registration_number = trim((string) $this->national_registration_number);
$this->employee = ($this->employee > 0 ? $this->employee : 0);
$this->login = trim((string) $this->login);
$this->gender = trim((string) $this->gender);
$this->pass = trim((string) $this->pass);
$this->api_key = trim((string) $this->api_key);
$this->address = trim((string) $this->address);
$this->zip = trim((string) $this->zip);
$this->town = trim((string) $this->town);
$this->setUpperOrLowerCase();
$this->state_id = trim($this->state_id);
$this->country_id = ($this->country_id > 0) ? $this->country_id : 0;
$this->office_phone = trim($this->office_phone);
$this->office_fax = trim($this->office_fax);
$this->user_mobile = trim($this->user_mobile);
$this->personal_mobile = trim($this->personal_mobile);
$this->email = trim($this->email);
$this->personal_email = trim($this->personal_email);
$this->job = trim($this->job);
$this->signature = trim($this->signature);
$this->note_public = trim($this->note_public);
$this->note_private = trim($this->note_private);
$this->openid = trim(empty($this->openid) ? '' : $this->openid); // Avoid warning
$this->admin = $this->admin ? $this->admin : 0;
$this->address = empty($this->address) ? '' : $this->address;
$this->zip = empty($this->zip) ? '' : $this->zip;
$this->town = empty($this->town) ? '' : $this->town;
$this->setUpperOrLowerCase();
$this->accountancy_code = trim($this->accountancy_code);
$this->color = empty($this->color) ? '' : $this->color;
$this->state_id = ($this->state_id > 0 ? $this->state_id : 0);
$this->country_id = ($this->country_id > 0 ? $this->country_id : 0);
$this->office_phone = trim((string) $this->office_phone);
$this->office_fax = trim((string) $this->office_fax);
$this->user_mobile = trim((string) $this->user_mobile);
$this->personal_mobile = trim((string) $this->personal_mobile);
$this->email = trim((string) $this->email);
$this->personal_email = trim((string) $this->personal_email);
$this->job = trim((string) $this->job);
$this->signature = trim((string) $this->signature);
$this->note_public = trim((string) $this->note_public);
$this->note_private = trim((string) $this->note_private);
$this->openid = trim((string) $this->openid);
$this->admin = ($this->admin > 0 ? $this->admin : 0);
$this->accountancy_code = trim((string) $this->accountancy_code);
$this->color = trim((string) $this->color);
$this->dateemployment = empty($this->dateemployment) ? '' : $this->dateemployment;
$this->dateemploymentend = empty($this->dateemploymentend) ? '' : $this->dateemploymentend;
$this->datestartvalidity = empty($this->datestartvalidity) ? '' : $this->datestartvalidity;
$this->dateendvalidity = empty($this->dateendvalidity) ? '' : $this->dateendvalidity;
$this->birth = trim($this->birth);
$this->birth = empty($this->birth) ? '' : $this->birth;
$this->fk_warehouse = (int) $this->fk_warehouse;
// Check parameters
@@ -2061,8 +2059,6 @@ class User extends CommonObject
$adh->pass = $this->pass;
//$adh->societe = (empty($adh->societe) && $this->societe_id ? $this->societe_id : $adh->societe);
$adh->address = $this->address;
$adh->town = $this->town;
$adh->zip = $this->zip;
@@ -2112,8 +2108,6 @@ class User extends CommonObject
//$tmpobj->pass=$this->pass;
//$tmpobj->societe=(empty($tmpobj->societe) && $this->societe_id ? $this->societe_id : $tmpobj->societe);
$tmpobj->email = $this->email;
$tmpobj->socialnetworks = $this->socialnetworks;