Merge remote-tracking branch 'upstream/develop' into zapieruser

This commit is contained in:
Frédéric FRANCE 2020-10-31 12:57:53 +01:00
commit a51d135c7b
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
10 changed files with 33 additions and 31 deletions

View File

@ -216,9 +216,8 @@ if (empty($conf->use_javascript_ajax))
print '</form>'."\n";
// Add env of ckeditor
// This is to show how CKEditor detect browser to understand why editor is disabled or not
if (1 == 2) // Change this to enable output
{
// This is to show how CKEditor detect browser to understand why editor is disabled or not. To help debug.
/*
print '<br><script language="javascript">
function jsdump(obj, id) {
var out = \'\';
@ -232,6 +231,7 @@ if (empty($conf->use_javascript_ajax))
jsdump(CKEDITOR.env, "divforlog");
</script>';
}
*/
}
// End of page

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2019 Maxime Kohlhaas <maxime@atm-consulting.fr>
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.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
@ -131,8 +132,7 @@ class Boms extends DolibarrApi
}
if ($sqlfilters)
{
if (!DolibarrApi::_checkFilters($sqlfilters))
{
if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
@ -224,8 +224,7 @@ class Boms extends DolibarrApi
$this->bom->$field = $value;
}
if ($this->bom->update($id, DolibarrApiAccess::$user) > 0)
{
if ($this->bom->update(DolibarrApiAccess::$user) > 0) {
return $this->get($id);
} else {
throw new RestException(500, $this->bom->error);

View File

@ -1415,11 +1415,12 @@ class Categorie extends CommonObject
if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type];
if ($type === Categorie::TYPE_BANK_LINE) { // TODO Remove this with standard category code
// Load bank groups
if ($type === Categorie::TYPE_BANK_LINE) { // TODO Remove this with standard category code after migration of llx_bank_categ into llx_categorie
// Load bank categories
$sql = "SELECT c.label, c.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."bank_class as a, ".MAIN_DB_PREFIX."bank_categ as c";
$sql .= " WHERE a.lineid=".$id." AND a.fk_categ = c.rowid";
$sql .= " AND c.entity IN (".getEntity('category').")";
$sql .= " ORDER BY c.label";
$res = $this->db->query($sql);

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.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
@ -416,7 +416,7 @@ class Contracts extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$request_data = (object) $request_data;
// $request_data = (object) $request_data;
$updateRes = $this->contract->close_line(DolibarrApiAccess::$user, $lineid, $datestart, $comment);

View File

@ -99,7 +99,8 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
$ret = dol_delete_file($file, 0, 0, 0, (is_object($object) ? $object : null));
if (!empty($fileold)) dol_delete_file($fileold, 0, 0, 0, (is_object($object) ? $object : null)); // Delete file using old path
// Si elle existe, on efface la vignette
// If it exists, remove thumb.
$regs = array();
if (preg_match('/(\.jpg|\.jpeg|\.bmp|\.gif|\.png|\.tiff)$/i', $file, $regs))
{
$photo_vignette = basename(preg_replace('/'.$regs[0].'/i', '', $file).'_small'.$regs[0]);
@ -120,8 +121,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
} else {
setEventMessages($langs->trans("ErrorFailToDeleteFile", $urlfile), null, 'errors');
}
} elseif ($linkid) // delete of external link
{
} elseif ($linkid) { // delete of external link
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
$link = new Link($db);
$link->fetch($linkid);
@ -179,6 +179,10 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
$filenamefrom = dol_sanitizeFileName(GETPOST('renamefilefrom', 'alpha'), '_', 0); // Do not remove accents
$filenameto = dol_sanitizeFileName(GETPOST('renamefileto', 'alpha'), '_', 0); // Do not remove accents
// We apply dol_string_nohtmltag also to clean file names (this remove duplicate spaces) because
// this function is also applied when we upload and when we make try to download file (by the GETPOST(filename, 'alphanohtml') call).
$filenameto = dol_string_nohtmltag($filenameto);
if ($filenamefrom != $filenameto)
{
// Security:

View File

@ -127,8 +127,7 @@ class EmailSenderProfile extends CommonObject
public $tms;
//public $fk_user_creat;
//public $fk_user_modif;
public $private;
public $signature;
public $position;
public $active;

View File

@ -1562,7 +1562,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess
$destfile = dol_sanitizeFileName($info['filename'].($info['extension'] != '' ? ('.'.strtolower($info['extension'])) : ''));
// We apply dol_string_nohtmltag also to clean file names (this remove duplicate spaces) because
// this function is also applied when we make try to download file (by the GETPOST(filename, 'alphanohtml') call).
// this function is also applied when we rename and when we make try to download file (by the GETPOST(filename, 'alphanohtml') call).
$destfile = dol_string_nohtmltag($destfile);
$destfull = dol_string_nohtmltag($destfull);

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.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
@ -111,8 +112,7 @@ class ExpenseReports extends DolibarrApi
// Add sql filters
if ($sqlfilters)
{
if (!DolibarrApi::_checkFilters($sqlfilters))
{
if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
@ -121,8 +121,7 @@ class ExpenseReports extends DolibarrApi
$sql .= $this->db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0)
{
if ($page < 0) {
$page = 0;
}
$offset = $limit * $page;
@ -136,6 +135,7 @@ class ExpenseReports extends DolibarrApi
{
$num = $this->db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit));
$i = 0;
while ($i < $min)
{
$obj = $this->db->fetch_object($result);

View File

@ -108,18 +108,18 @@ class SupplierOrders extends DolibarrApi
// If the internal user must only see his customers, force searching by him
$search_sale = 0;
if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id;
if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
$sql = "SELECT t.rowid";
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as t";
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
if (!empty($product_ids)) $sql .= ", ".MAIN_DB_PREFIX."commande_fournisseurdet as cd"; // We need this table joined to the select in order to filter by product
$sql .= ' WHERE t.entity IN ('.getEntity('supplier_order').')';
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= " AND t.fk_soc = sc.fk_soc";
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= " AND t.fk_soc = sc.fk_soc";
if (!empty($product_ids)) $sql .= " AND cd.fk_commande = t.rowid AND cd.fk_product IN (".$product_ids.")";
if ($socids) $sql .= " AND t.fk_soc IN (".$socids.")";
if ($search_sale > 0) $sql .= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale

View File

@ -146,8 +146,7 @@ class Projects extends DolibarrApi
$sql .= $this->db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0)
{
if ($page < 0) {
$page = 0;
}
$offset = $limit * $page;
@ -162,8 +161,8 @@ class Projects extends DolibarrApi
{
$num = $this->db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit));
while ($i < $min)
{
$i = 0;
while ($i < $min) {
$obj = $this->db->fetch_object($result);
$project_static = new Project($this->db);
if ($project_static->fetch($obj->rowid)) {