Merge branch 'develop' into fix_dev_add_help_text

This commit is contained in:
Laurent Destailleur 2025-01-27 01:45:06 +01:00 committed by GitHub
commit 49cda2c7db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
101 changed files with 1567 additions and 966 deletions

View file

@ -10734,36 +10734,12 @@ parameters:
count: 1
path: ../../../htdocs/core/customreports.php
-
message: '#^Variable \$gval might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/customreports.php
-
message: '#^Variable \$page might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/customreports.php
-
message: '#^Variable \$search_graph might not be defined\.$#'
identifier: variable.undefined
count: 3
path: ../../../htdocs/core/customreports.php
-
message: '#^Variable \$search_groupby might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../../htdocs/core/customreports.php
-
message: '#^Variable \$search_xaxis might not be defined\.$#'
identifier: variable.undefined
count: 5
path: ../../../htdocs/core/customreports.php
-
message: '#^Variable \$search_yaxis might not be defined\.$#'
identifier: variable.undefined
@ -10782,12 +10758,6 @@ parameters:
count: 1
path: ../../../htdocs/core/customreports.php
-
message: '#^Variable \$tabfamily might not be defined\.$#'
identifier: variable.undefined
count: 3
path: ../../../htdocs/core/customreports.php
-
message: '#^Constructor of class DoliDBMysqli has an unused parameter \$type\.$#'
identifier: constructor.unusedParameter
@ -10866,12 +10836,6 @@ parameters:
count: 1
path: ../../../htdocs/core/db/sqlite3.class.php
-
message: '#^Method DoliDBSqlite3\:\:getListOfCollation\(\) should return array\<int, array\{collation\: string\}\>\|null but returns array\{array\{charset\: ''UTF\-8'', description\: ''UTF\-8''\}\}\.$#'
identifier: return.type
count: 1
path: ../../../htdocs/core/db/sqlite3.class.php
-
message: '#^Cannot access property \$db on mixed\.$#'
identifier: property.nonObject
@ -11424,12 +11388,6 @@ parameters:
count: 3
path: ../../../htdocs/core/lib/images.lib.php
-
message: '#^Variable \$extImg might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/lib/images.lib.php
-
message: '#^Loose comparison using \=\= between ''suppliers'' and ''fourn'' will always evaluate to false\.$#'
identifier: equal.alwaysFalse
@ -12150,12 +12108,6 @@ parameters:
count: 1
path: ../../../htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php
-
message: '#^Variable \$carac_client_name might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php
-
message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
@ -12198,12 +12150,6 @@ parameters:
count: 2
path: ../../../htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php
-
message: '#^Variable \$result might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/modules/barcode/doc/phpbarcode.modules.php
-
message: '#^Property modTcpdfbarcode\:\:\$is2d has no type specified\.$#'
identifier: missingType.property
@ -12216,18 +12162,6 @@ parameters:
count: 1
path: ../../../htdocs/core/modules/barcode/mod_barcode_product_standard.php
-
message: '#^Property mod_barcode_product_standard\:\:\$numbitcounter has no type specified\.$#'
identifier: missingType.property
count: 1
path: ../../../htdocs/core/modules/barcode/mod_barcode_product_standard.php
-
message: '#^Property mod_barcode_product_standard\:\:\$searchcode has no type specified\.$#'
identifier: missingType.property
count: 1
path: ../../../htdocs/core/modules/barcode/mod_barcode_product_standard.php
-
message: '#^Parameter \#2 \$type of method mod_barcode_thirdparty_standard\:\:literalBarcodeType\(\) expects int, string given\.$#'
identifier: argument.type
@ -12336,12 +12270,6 @@ parameters:
count: 1
path: ../../../htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
-
message: '#^Left side of && is always true\.$#'
identifier: booleanAnd.leftAlwaysTrue
count: 1
path: ../../../htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
-
message: '#^Property Commande\:\:\$availability \(string\) in isset\(\) is not nullable\.$#'
identifier: isset.property
@ -12450,18 +12378,6 @@ parameters:
count: 1
path: ../../../htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
-
message: '#^Variable \$carac_client_name might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
-
message: '#^Variable \$realpath might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
-
message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\<string, CommonObject\|float\|int\|string\>, Contrat given\.$#'
identifier: argument.type
@ -12498,12 +12414,6 @@ parameters:
count: 1
path: ../../../htdocs/core/modules/delivery/doc/pdf_storm.modules.php
-
message: '#^Left side of && is always true\.$#'
identifier: booleanAnd.leftAlwaysTrue
count: 1
path: ../../../htdocs/core/modules/delivery/doc/pdf_storm.modules.php
-
message: '#^Parameter \#3 \$posy of method pdf_storm\:\:_tableau_info\(\) expects int, float given\.$#'
identifier: argument.type
@ -12558,12 +12468,6 @@ parameters:
count: 1
path: ../../../htdocs/core/modules/delivery/doc/pdf_storm.modules.php
-
message: '#^Variable \$realpath might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/modules/delivery/doc/pdf_storm.modules.php
-
message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
@ -12582,24 +12486,6 @@ parameters:
count: 2
path: ../../../htdocs/core/modules/delivery/doc/pdf_typhon.modules.php
-
message: '#^Property pdf_typhon\:\:\$posxcomm has no type specified\.$#'
identifier: missingType.property
count: 1
path: ../../../htdocs/core/modules/delivery/doc/pdf_typhon.modules.php
-
message: '#^Property pdf_typhon\:\:\$posxremainingqty has no type specified\.$#'
identifier: missingType.property
count: 1
path: ../../../htdocs/core/modules/delivery/doc/pdf_typhon.modules.php
-
message: '#^Property pdf_typhon\:\:\$posxweightvol has no type specified\.$#'
identifier: missingType.property
count: 1
path: ../../../htdocs/core/modules/delivery/doc/pdf_typhon.modules.php
-
message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
@ -12720,24 +12606,6 @@ parameters:
count: 1
path: ../../../htdocs/core/modules/expedition/doc/pdf_merou.modules.php
-
message: '#^Property pdf_merou\:\:\$destinataire has no type specified\.$#'
identifier: missingType.property
count: 1
path: ../../../htdocs/core/modules/expedition/doc/pdf_merou.modules.php
-
message: '#^Property pdf_merou\:\:\$expediteur has no type specified\.$#'
identifier: missingType.property
count: 1
path: ../../../htdocs/core/modules/expedition/doc/pdf_merou.modules.php
-
message: '#^Property pdf_merou\:\:\$livreur has no type specified\.$#'
identifier: missingType.property
count: 1
path: ../../../htdocs/core/modules/expedition/doc/pdf_merou.modules.php
-
message: '#^Parameter \#4 \$posy of method pdf_rouget\:\:_tableau_tot\(\) expects int, float given\.$#'
identifier: argument.type
@ -12768,36 +12636,6 @@ parameters:
count: 6
path: ../../../htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php
-
message: '#^Property pdf_standard_expensereport\:\:\$postotalttc has no type specified\.$#'
identifier: missingType.property
count: 1
path: ../../../htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php
-
message: '#^Property pdf_standard_expensereport\:\:\$posxcomment has no type specified\.$#'
identifier: missingType.property
count: 1
path: ../../../htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php
-
message: '#^Property pdf_standard_expensereport\:\:\$posxpiece has no type specified\.$#'
identifier: missingType.property
count: 1
path: ../../../htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php
-
message: '#^Property pdf_standard_expensereport\:\:\$posxprojet has no type specified\.$#'
identifier: missingType.property
count: 1
path: ../../../htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php
-
message: '#^Property pdf_standard_expensereport\:\:\$posxtype has no type specified\.$#'
identifier: missingType.property
count: 1
path: ../../../htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php
-
message: '#^Ternary operator condition is always false\.$#'
identifier: ternary.alwaysFalse
@ -12900,12 +12738,6 @@ parameters:
count: 13
path: ../../../htdocs/core/modules/facture/doc/pdf_octopus.modules.php
-
message: '#^Left side of && is always true\.$#'
identifier: booleanAnd.leftAlwaysTrue
count: 1
path: ../../../htdocs/core/modules/facture/doc/pdf_octopus.modules.php
-
message: '#^Parameter \#1 \$a of method pdf_octopus\:\:sumSituation\(\) expects array\<int\|string, array\<mixed\>\|float\|int\>, array\<string, Facture\|float\|int\> given\.$#'
identifier: argument.type
@ -13068,12 +12900,6 @@ parameters:
count: 3
path: ../../../htdocs/core/modules/facture/doc/pdf_octopus.modules.php
-
message: '#^Variable \$realpath might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/modules/facture/doc/pdf_octopus.modules.php
-
message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
@ -13086,12 +12912,6 @@ parameters:
count: 1
path: ../../../htdocs/core/modules/facture/doc/pdf_sponge.modules.php
-
message: '#^Left side of && is always true\.$#'
identifier: booleanAnd.leftAlwaysTrue
count: 1
path: ../../../htdocs/core/modules/facture/doc/pdf_sponge.modules.php
-
message: '#^Property CommonInvoice\:\:\$type \(int\) in isset\(\) is not nullable\.$#'
identifier: isset.property
@ -13212,12 +13032,6 @@ parameters:
count: 1
path: ../../../htdocs/core/modules/facture/doc/pdf_sponge.modules.php
-
message: '#^Variable \$realpath might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/modules/facture/doc/pdf_sponge.modules.php
-
message: '#^Property mod_facture_mars\:\:\$prefixcreditnote has no type specified\.$#'
identifier: missingType.property
@ -13296,12 +13110,6 @@ parameters:
count: 1
path: ../../../htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
-
message: '#^Variable \$max might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/modules/fichinter/mod_pacific.php
-
message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#'
identifier: isset.property
@ -14094,36 +13902,6 @@ parameters:
count: 2
path: ../../../htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php
-
message: '#^Property pdf_standard_movementstock\:\:\$posxdatemouv has no type specified\.$#'
identifier: missingType.property
count: 1
path: ../../../htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php
-
message: '#^Property pdf_standard_movementstock\:\:\$posxidref has no type specified\.$#'
identifier: missingType.property
count: 1
path: ../../../htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php
-
message: '#^Property pdf_standard_movementstock\:\:\$wref has no type specified\.$#'
identifier: missingType.property
count: 1
path: ../../../htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php
-
message: '#^Variable \$lastmovementdate might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php
-
message: '#^Variable \$result might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/modules/movement/doc/pdf_standard_movementstock.modules.php
-
message: '#^Parameter \#1 \$object of method CommonDocGenerator\:\:get_substitutionarray_each_var_object\(\) expects array\<string, CommonObject\|float\|int\|string\>, Mo given\.$#'
identifier: argument.type
@ -14526,12 +14304,6 @@ parameters:
count: 1
path: ../../../htdocs/core/modules/propale/doc/pdf_azur.modules.php
-
message: '#^Variable \$filetomerge_dir might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../../htdocs/core/modules/propale/doc/pdf_azur.modules.php
-
message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
@ -14646,12 +14418,6 @@ parameters:
count: 1
path: ../../../htdocs/core/modules/propale/doc/pdf_cyan.modules.php
-
message: '#^Variable \$filetomerge_dir might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../../htdocs/core/modules/propale/doc/pdf_cyan.modules.php
-
message: '#^Call to function is_object\(\) with object will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType

View file

@ -60051,15 +60051,6 @@ INSERT INTO `llx_const` VALUES
(12776,'MAIN_VERSION_LAST_UPGRADE',0,'21.0.0','chaine',0,'Dolibarr version for last upgrade','2025-01-06 15:48:34'),
(12777,'MAIN_FIRST_PING_OK_DATE',2,'20250106154835','chaine',0,'','2025-01-06 15:48:35'),
(12778,'MAIN_FIRST_PING_OK_ID',2,'disabled','chaine',0,'','2025-01-06 15:48:35'),
(12781,'MAIN_MODULE_MULTICOMPANY',0,'1','string',0,'{\"authorid\":\"12\",\"ip\":\"127.0.0.1\",\"lastactivationversion\":\"18.0.1\"}','2025-01-06 15:50:14'),
(12782,'MAIN_MODULE_MULTICOMPANY_LOGIN',0,'1','chaine',0,NULL,'2025-01-06 15:50:14'),
(12783,'MAIN_MODULE_MULTICOMPANY_TRIGGERS',0,'1','chaine',0,NULL,'2025-01-06 15:50:14'),
(12784,'MAIN_MODULE_MULTICOMPANY_HOOKS',0,'[\"login\",\"main\",\"mainloginpage\",\"upgrade\",\"upgrade2\",\"cashdeskloginpage\",\"passwordforgottenpage\",\"toprightmenu\",\"adminmodules\",\"admincompany\",\"commonobject\",\"thirdpartiesindex\",\"commercialindex\",\"globalcard\",\"thirdpartycard\",\"thirdpartycontact\",\"thirdpartylist\",\"customerlist\",\"prospectlist\",\"supplierlist\",\"usercard\",\"userperms\",\"groupcard\",\"groupperms\",\"userlist\",\"userhome\",\"userdao\",\"contactlist\",\"contactprospectlist\",\"contactcustomerlist\",\"contactsupplierlist\",\"contactotherlist\",\"productindex\",\"productcard\",\"productservicelist\",\"pricesuppliercard\",\"productreassortlist\",\"propalcard\",\"propallist\",\"ordercard\",\"orderlist\",\"invoicecard\",\"invoicelist\",\"warehousecard\",\"stocklist\",\"memberlist\",\"membercard\",\"projectlist\",\"projectcard\",\"accountancyadminaccount\"]','chaine',0,NULL,'2025-01-06 15:50:14'),
(12785,'MAIN_MODULE_MULTICOMPANY_CSS',0,'/multicompany/css/multicompany.css.php','chaine',0,NULL,'2025-01-06 15:50:14'),
(12786,'MAIN_MODULE_MULTICOMPANY_SUBSTITUTIONS',0,'/multicompany/core/substitutions/','chaine',0,NULL,'2025-01-06 15:50:14'),
(12787,'MULTICOMPANY_MAIN_VERSION',0,'18.0.1','chaine',0,NULL,'2025-01-06 15:50:14'),
(12788,'MULTICOMPANY_EXTERNAL_MODULES_SHARING',0,'','chaine',0,NULL,'2025-01-06 15:50:14'),
(12789,'MULTICOMPANY_PMP_PER_ENTITY_ENABLED',0,'1','chaine',0,NULL,'2025-01-06 15:50:14'),
(12790,'MAIN_IHM_PARAMS_REV',2,'1','chaine',0,'','2025-01-06 15:50:15'),
(12791,'MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT',2,'commonkanban','chaine',0,'','2025-01-06 15:50:15'),
(12792,'MAIN_FIRST_PING_OK_DATE',1,'20250106155034','chaine',0,'','2025-01-06 15:50:34'),

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2025 Frédéric France <frederic.france@free.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

View file

@ -490,6 +490,14 @@ print '<td>';
print ajax_constantonoff('EXPEDITION_ALLOW_ONLINESIGN', array(), null, 0, 0, 0, 2, 0, 1, '', '', 'inline-block', 0, $langs->trans("WarningOnlineSignature"));
print '</td></tr>';
// Pre fill shipment qty option
print '<tr class="oddeven">';
print '<td>'.$langs->trans("DontPrefillShipmentQty");
print '</td>';
print '<td>';
print ajax_constantonoff('SHIPMENT_DONT_PREFILL_QTY', array(), null, 0, 0, 0, 2, 0, 1, '', '', 'inline-block', 0, '');
print '</td></tr>';
print '</table>';
print $form->buttonsSaveCancel("Modify", '');

View file

@ -1269,7 +1269,9 @@ if ($mode == 'marketplace') {
print '<br>';
if (!getDolGlobalString('MAIN_DISABLE_DOLISTORE_SEARCH') && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1) {
$conf->global->MAIN_DISABLE_DOLISTORE_SEARCH = 1; // avoid warning with the new Dolistore website
if (!getDolGlobalString('MAIN_DISABLE_DOLISTORE_SEARCH') && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
// $options is array with filter criteria
if (getDolGlobalInt('MAIN_ENANLE_OLD_DOLISTORE')) {

View file

@ -1466,12 +1466,13 @@ class Categorie extends CommonObject
// phpcs:enable
$ways = array();
$all_ways = $this->get_all_ways(); // Load array of categories
foreach ($all_ways as $way) {
$all_ways = $this->get_all_ways(); // Load array of categories to reach this->id
foreach ($all_ways as $way) { // It seems we always have 1 entry in this array.
$w = array();
$i = 0;
$forced_color = '';
foreach ($way as $cat) {
foreach ($way as $cat) { // Loop on each successive categories to reach the target of current category
$i++;
if (empty($nocolor)) {
@ -1511,6 +1512,7 @@ class Categorie extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns an array containing the list of parent categories
* Note: A category can only have one parent but this method return an array to work the same way the get_filles is working.
*
* @return int|Categorie[] Return integer <0 KO, array OK
*/
@ -1541,7 +1543,7 @@ class Categorie extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns in a table all possible paths to get to the category
* Returns in a array all possible paths to go to the category
* starting with the major categories represented by Tables of categories
*
* @return Categorie[][]
@ -1554,7 +1556,7 @@ class Categorie extends CommonObject
$parents = $this->get_meres();
if (is_array($parents)) {
foreach ($parents as $parent) {
$all_ways = $parent->get_all_ways();
$all_ways = $parent->get_all_ways(); // recursivity. TODO Add a protection for infinite loop
foreach ($all_ways as $way) {
$w = $way;
$w[] = $this;
@ -1646,8 +1648,8 @@ class Categorie extends CommonObject
}
/**
* Returns categories whose id or name match
* add wildcards in the name unless $exact = true
* Returns categories whose id or name matches.
* It add wildcards in the name unless $exact = true
*
* @param int $id Id
* @param string $nom Name

View file

@ -7,7 +7,7 @@
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017 Open-DSI <support@open-dsi.fr>
* Copyright (C) 2021-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2021-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@ -33,14 +33,13 @@
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
if (isModEnabled('project')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
}
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
/**
* @var Conf $conf
@ -50,14 +49,7 @@ if (isModEnabled('project')) {
* @var User $user
*/
if (!isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) {
$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW = 3;
}
if (!getDolGlobalString('AGENDA_EXT_NB')) {
$conf->global->AGENDA_EXT_NB = 5;
}
$MAXAGENDA = getDolGlobalString('AGENDA_EXT_NB');
$MAXAGENDA = getDolGlobalString('AGENDA_EXT_NB', 5);
$DELAYFORCACHE = 300; // 300 seconds
$disabledefaultvalues = GETPOSTINT('disabledefaultvalues');
@ -122,10 +114,10 @@ $year = GETPOSTINT("year") ? GETPOSTINT("year") : date("Y");
$month = GETPOSTINT("month") ? GETPOSTINT("month") : date("m");
$week = GETPOSTINT("week") ? GETPOSTINT("week") : date("W");
$day = GETPOSTINT("day") ? GETPOSTINT("day") : date("d");
$pid = GETPOSTINT("search_projectid", 3) ? GETPOSTINT("search_projectid", 3) : GETPOSTINT("projectid", 3);
$pid = GETPOSTISSET("search_projectid") ? GETPOSTINT("search_projectid", 3) : GETPOSTINT("projectid", 3);
$status = GETPOSTISSET("search_status") ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09'); // status may be 0, 50, 100, 'todo', 'na' or -1
$type = GETPOSTISSET("search_type") ? GETPOST("search_type", 'aZ09') : GETPOST("type", 'aZ09');
$maxprint = GETPOSTISSET("maxprint") ? GETPOSTINT("maxprint") : getDolGlobalInt('AGENDA_MAX_EVENTS_DAY_VIEW');
$maxprint = GETPOSTISSET("maxprint") ? GETPOSTINT("maxprint") : getDolGlobalInt('AGENDA_MAX_EVENTS_DAY_VIEW', 3);
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$dateselect = dol_mktime(0, 0, 0, GETPOSTINT('dateselectmonth'), GETPOSTINT('dateselectday'), GETPOSTINT('dateselectyear'));
@ -149,7 +141,7 @@ if (is_scalar($actioncode) && $actioncode == '-1') {
}
if ($status == '' && !GETPOSTISSET('search_status')) {
$status = ((!getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS') || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS);
$status = ((!getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS') || $disabledefaultvalues) ? '' : getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS'));
}
$defaultview = getDolGlobalString('AGENDA_DEFAULT_VIEW', 'show_month'); // default for app
@ -253,14 +245,14 @@ if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:M&oacute;dulo_Agenda|DE:Modul_Terminplanung';
llxHeader('', $langs->trans("Agenda"), $help_url);
$form = new Form($db);
$companystatic = new Societe($db);
$contactstatic = new Contact($db);
$userstatic = new User($db);
$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:M&oacute;dulo_Agenda|DE:Modul_Terminplanung';
llxHeader('', $langs->trans("Agenda"), $help_url);
$now = dol_now();
$nowarray = dol_getdate($now);
$nowyear = $nowarray['year'];
@ -407,9 +399,13 @@ if ($mode == 'show_day') {
//print dol_print_date($firstdaytoshow,'dayhour').' '.dol_print_date($lastdaytoshow,'dayhour');
/*$title = $langs->trans("DoneAndToDoActions");
if ($status == 'done') $title = $langs->trans("DoneActions");
if ($status == 'todo') $title = $langs->trans("ToDoActions");
*/
if ($status == 'done') {
$title = $langs->trans("DoneActions");
}
if ($status == 'todo') {
$title = $langs->trans("ToDoActions");
}
*/
$param = '';
if ($actioncode || GETPOSTISSET('search_actioncode')) {
@ -428,10 +424,10 @@ if ($status || GETPOSTISSET('status') || GETPOSTISSET('search_status')) {
$param .= "&search_status=".urlencode($status);
}
if ($filter) {
$param .= "&search_filter=".urlencode($filter);
$param .= "&search_filter=".urlencode((string) $filter);
}
if ($filtert) {
$param .= "&search_filtert=".urlencode($filtert);
$param .= "&search_filtert=".urlencode((string) $filtert);
}
if ($usergroup > 0) {
$param .= "&search_usergroup=".urlencode((string) ($usergroup));
@ -624,8 +620,8 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on
$s .= '<script type="text/javascript">'."\n";
$s .= 'jQuery(document).ready(function () {'."\n";
$s .= 'jQuery(".check_birthday").click(function() { console.log("Toggle birthdays"); jQuery(".family_birthday").toggle(); });'."\n";
$s .= 'jQuery(".check_holiday").click(function() { console.log("Toggle holidays"); jQuery(".family_holiday").toggle(); });'."\n";
$s .= 'jQuery(".check_birthday").click(function() { console.log("Toggle class .family_birthday"); jQuery(".family_birthday").toggle(); });'."\n";
$s .= 'jQuery(".check_holiday").click(function() { console.log("Toggle class .family_holiday"); jQuery(".family_holiday").toggle(); });'."\n";
if (isModEnabled("bookcal") && !empty($bookcalcalendars["calendars"])) {
foreach ($bookcalcalendars["calendars"] as $key => $value) {
$s .= 'jQuery(".check_bookcal_calendar_'.$value['id'].'").click(function() { console.log("Toggle Bookcal Calendar '.$value['id'].'"); jQuery(".family_bookcal_calendar_'.$value['id'].'").toggle(); });'."\n";
@ -771,10 +767,14 @@ if ($resourceid > 0) {
}
// We must filter on assignment table
if ($filtert > 0 || $usergroup > 0) {
$sql .= ", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
}
if ($usergroup > 0) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as ar";
$sql .= " ON ar.fk_actioncomm = a.id AND ar.element_type='user'";
if ($filtert > 0) {
$sql .= " AND ar.fk_element = ".((int) $filtert);
}
if ($usergroup > 0) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element AND ugu.fk_usergroup = ".((int) $usergroup);
}
}
$sql .= ' WHERE a.fk_action = ca.id';
$sql .= ' AND a.entity IN ('.getEntity('agenda').')'; // bookcal is a "virtual view" of agenda
@ -798,7 +798,7 @@ if (!empty($actioncode)) {
$sql .= " AND ca.type != 'systemauto'";
} elseif ($actioncode == 'AC_ALL_AUTO') {
$sql .= " AND ca.type = 'systemauto'";
} else {
} elseif (/* !empty($actioncode) && */ $actioncode !== '-1') {
if (is_array($actioncode)) {
$sql .= " AND ca.code IN (".$db->sanitize("'".implode("','", $actioncode)."'", 1).")";
} else {
@ -830,10 +830,6 @@ if ($search_sale && $search_sale != '-1') {
if ($socid) {
$sql .= " AND a.fk_soc = ".((int) $socid);
}
// We must filter on assignment table
if ($filtert > 0 || $usergroup > 0) {
$sql .= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
}
//var_dump($day.' '.$month.' '.$year);
if ($mode == 'show_day') {
$sql .= " AND (";
@ -866,7 +862,7 @@ if ($status == '0') {
// To do (not started)
$sql .= " AND a.percent = 0";
}
if ($status == 'na') {
if ($status === 'na') {
// Not applicable
$sql .= " AND a.percent = -1";
}
@ -902,7 +898,7 @@ if ($search_categ_cus != -1) {
}
// Sort on date
$sql .= ' ORDER BY datep';
$sql .= $db->order("datep");
//print $sql;
dol_syslog("comm/action/index.php", LOG_DEBUG);
@ -1129,25 +1125,27 @@ if ($showbirthday) {
}
}
// LEAVE-HOLIDAY CALENDAR
if ($user->hasRight("holiday", "read")) {
// LEAVE-HOLIDAY CALENDAR
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.statut, x.rowid, x.date_debut as date_start, x.date_fin as date_end, x.halfday, 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 u.statut = '1'"; // Show only active users (0 = inactive user, 1 = active user)
$sql .= " AND (x.statut = '2' OR x.statut = '3')"; // Show only public leaves (2 = leave wait for approval, 3 = leave approved)
if ($mode == 'show_day') {
// Request only leaves for the current selected day
$sql .= " AND '".$db->escape($year)."-".$db->escape($month)."-".$db->escape($day)."' BETWEEN x.date_debut AND x.date_fin"; // date_debut and date_fin are date without time
} elseif ($mode == 'show_week') {
// Restrict on current month (we get more, but we will filter later)
$sql .= " AND date_debut < '".$db->idate(dol_get_last_day($year, $month))."'";
$sql .= " AND date_fin >= '".$db->idate(dol_get_first_day($year, $month))."'";
$sql .= " AND x.date_debut < '".$db->idate(dol_get_last_day($year, $month))."'";
$sql .= " AND x.date_fin >= '".$db->idate(dol_get_first_day($year, $month))."'";
} elseif ($mode == 'show_month') {
// Restrict on current month
$sql .= " AND date_debut <= '".$db->idate(dol_get_last_day($year, $month))."'";
$sql .= " AND date_fin >= '".$db->idate(dol_get_first_day($year, $month))."'";
$sql .= " AND x.date_debut <= '".$db->idate(dol_get_last_day($year, $month))."'";
$sql .= " AND x.date_fin >= '".$db->idate(dol_get_first_day($year, $month))."'";
}
if (!$user->hasRight('holiday', 'readall')) {
$sql.= " AND x.fk_user IN(".$db->sanitize(implode(", ", $user->getAllChildIds(1))).") ";
}
$resql = $db->query($sql);
@ -1170,8 +1168,8 @@ if ($user->hasRight("holiday", "read")) {
$event->type = 'holiday';
$event->type_picto = 'holiday';
$event->datep = $db->jdate($obj->date_start) + (empty($halfday) || $halfday == 1 ? 0 : 12 * 60 * 60 - 1);
$event->datef = $db->jdate($obj->date_end) + (empty($halfday) || $halfday == -1 ? 24 : 12) * 60 * 60 - 1;
$event->datep = $db->jdate($obj->date_start) + (empty($obj->halfday) || $obj->halfday == 1 ? 0 : 12) * 60 * 60;
$event->datef = $db->jdate($obj->date_end) + (empty($obj->halfday) || $obj->halfday == -1 ? 24 : 12) * 60 * 60 - 1;
$event->date_start_in_calendar = $event->datep;
$event->date_end_in_calendar = $event->datef;
@ -1183,24 +1181,50 @@ if ($user->hasRight("holiday", "read")) {
$event->percentage = 0;
}
if ($obj->halfday == 1) {
$event->label = $obj->lastname.' ('.$langs->trans("Morning").')';
} elseif ($obj->halfday == -1) {
$event->label = $obj->lastname.' ('.$langs->trans("Afternoon").')';
} else {
$event->label = $obj->lastname;
}
$event->label = $langs->trans("Holiday");
$daycursor = $event->date_start_in_calendar;
$annee = (int) dol_print_date($daycursor, '%Y', 'tzuserrel');
$mois = (int) dol_print_date($daycursor, '%m', 'tzuserrel');
$jour = (int) dol_print_date($daycursor, '%d', 'tzuserrel');
$daycursorend = $event->date_end_in_calendar;
$anneeend = (int) dol_print_date($daycursorend, '%Y', 'tzuserrel');
$moisend = (int) dol_print_date($daycursorend, '%m', 'tzuserrel');
$jourend = (int) dol_print_date($daycursorend, '%d', 'tzuserrel');
// daykey must be date that represent day box in calendar so must be a user time
$daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt');
$daykeygmt = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt');
$ifornbofdays = 0;
do {
$eventarray[$daykey][] = $event;
$ifornbofdays++;
$firstdayofholiday = ($ifornbofdays == 1);
$lastdayofholiday = ($daykeygmt == dol_get_first_hour($event->date_end_in_calendar, 'gmt'));
/*
var_dump(dol_print_date($daykeygmt, 'dayhour', 'gmt'));
var_dump(dol_print_date(dol_get_first_hour($event->date_end_in_calendar, 'gmt'), 'dayhour', 'gmt'));
var_dump($lastdayofholiday);
var_dump($obj->halfday);
*/
if ((in_array($obj->halfday, array(1, 2)) == 1 && $lastdayofholiday) || (in_array($obj->halfday, array(-1, 2)) && $firstdayofholiday)) {
// We create a copy of event because we want tochange the label
$newevent = dol_clone($event, 1);
if (in_array($obj->halfday, array(1, 2)) && $lastdayofholiday) {
$newevent->label .= ' ('.$langs->trans("Morning").')';
} elseif (in_array($obj->halfday, array(-1, 2)) && $firstdayofholiday) {
$newevent->label .= ' ('.$langs->trans("Afternoon").')';
}
$eventarray[$daykey][] = $newevent; // We need to use ->gtTypePicto, getXXXon object, so clone must be PHP clone.
} else {
$eventarray[$daykey][] = $event; // We can use the event unchanged
}
$daykey += 60 * 60 * 24;
$daykeygmt += 60 * 60 * 24;
} while ($daykey <= $event->date_end_in_calendar);
$i++;
@ -1931,7 +1955,6 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
foreach ($eventarray[$daykey] as $index => $event) {
if ($i < $maxprint || $maxprint == 0 || getDolGlobalString('MAIN_JS_SWITCH_AGENDA')) {
$keysofuserassigned = array_keys($event->userassigned);
$ponct = ($event->date_start_in_calendar == $event->date_end_in_calendar);
// Define $color (Hex string like '0088FF') and $cssclass of event
$color = -1;
@ -1951,6 +1974,10 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
if (!empty($cacheusers[$event->userownerid]->color)) {
$color = $cacheusers[$event->userownerid]->color;
}
/* May be we need this: if (getDolGlobalString('AGENDA_USE_COLOR_PER_EVENT_TYPE')) {
$color = $event->type_color;
}*/
} elseif ($event->type_code == 'ICALEVENT') { // Event come from external ical file
$numical++;
if (!empty($event->icalname)) {
@ -2092,7 +2119,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
//var_dump($event->userassigned);
//var_dump($event->transparency);
print '<table class="centpercent cal_event';
print(empty($event->transparency) ? ' cal_event_notbusy' : ' cal_event_busy');
print (empty($event->transparency) ? ' cal_event_notbusy' : ' cal_event_busy');
//if (empty($event->transparency) && empty($conf->global->AGENDA_NO_TRANSPARENT_ON_NOT_BUSY)) print ' opacitymedium'; // Not busy
print '" style="'.$h;
$colortouse = $color;
@ -2112,54 +2139,14 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
//print ' -moz-border-radius:4px;"';
//print 'border: 1px solid #ccc" width="100%"';
print '">';
// First the tr of the event (only one tr for event is used, but several td)
print '<tr>';
print '<td class="tdoverflow nobottom small centpercent '.($nowrapontd ? 'nowrap ' : '').'cal_event'.($event->type_code == 'BIRTHDAY' ? ' cal_event_birthday' : '').'">';
print '<!-- left section of event -->';
$daterange = '';
if ($event->type_code == 'BIRTHDAY') {
// It's birthday calendar
$picb = '<i class="fas fa-birthday-cake inline-block valignmiddle"></i>';
//$pice = '<i class="fas fa-briefcase inline-block"></i>';
//$typea = ($objp->typea == 'birth') ? $picb : $pice;
//var_dump($event);
print $picb.' '.$langs->trans("Birthday").'<br>';
//print img_picto($langs->trans("Birthday"), 'birthday-cake').' ';
$tmpid = $event->id;
if (empty($cachecontacts[$tmpid])) {
$newcontact = new Contact($db);
$newcontact->fetch($tmpid);
$cachecontacts[$tmpid] = $newcontact;
}
print $cachecontacts[$tmpid]->getNomUrl(1, '', 0, '', -1, 0, 'valignmiddle inline-block');
//$event->picto = 'birthday-cake';
//print $event->getNomUrl(1, $maxnbofchar, 'cal_event', 'birthday', 'contact');
/*$listofcontacttoshow = '';
$listofcontacttoshow .= '<br>'.$cacheusers[$tmpid]->getNomUrl(-1, '', 0, 0, 0, 0, '', 'paddingright valignmiddle');
print $listofcontacttoshow;
*/
} elseif ($event->type_code == 'HOLIDAY') {
// It's holiday calendar
$tmpholiday->fetch($event->id);
print $tmpholiday->getNomUrl(1, -1, 0, 'valignmiddle inline-block');
$tmpid = $tmpholiday->fk_user;
if (empty($cacheusers[$tmpid])) {
$newuser = new User($db);
$newuser->fetch($tmpid);
$cacheusers[$tmpid] = $newuser;
}
$listofusertoshow = '';
$listofusertoshow .= '<br>'.$cacheusers[$tmpid]->getNomUrl(-1, '', 0, 0, 0, 0, '', 'paddingright valignmiddle inline-block');
print $listofusertoshow;
}
$parameters = array();
$reshook = $hookmanager->executeHooks('eventOptions', $parameters, $event, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
@ -2174,41 +2161,49 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
}
*/
// Date
if (empty($event->fulldayevent)) {
// Show hours (start ... end)
$tmpyearstart = dol_print_date($event->date_start_in_calendar, '%Y', 'tzuserrel');
$tmpmonthstart = dol_print_date($event->date_start_in_calendar, '%m', 'tzuserrel');
$tmpdaystart = dol_print_date($event->date_start_in_calendar, '%d', 'tzuserrel');
$tmpyearend = dol_print_date($event->date_end_in_calendar, '%Y', 'tzuserrel');
$tmpmonthend = dol_print_date($event->date_end_in_calendar, '%m', 'tzuserrel');
$tmpdayend = dol_print_date($event->date_end_in_calendar, '%d', 'tzuserrel');
if ($event->type_code == 'BIRTHDAY') {
// It's birthday calendar
$picb = img_picto('', 'birthday-cake', 'class="pictofixedwidth"');
print $picb.$langs->trans("Birthday").'<br>';
}
// Hour start
if ($tmpyearstart == $annee && $tmpmonthstart == $mois && $tmpdaystart == $jour) {
$daterange .= dol_print_date($event->date_start_in_calendar, 'hour', 'tzuserrel');
if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar) {
if ($tmpyearstart == $tmpyearend && $tmpmonthstart == $tmpmonthend && $tmpdaystart == $tmpdayend) {
$daterange .= '-';
// Date
if ($event->type_code != 'HOLIDAY' && $event->type_code != 'BIRTHDAY') {
if (empty($event->fulldayevent)) {
// Show hours (start ... end)
$tmpyearstart = dol_print_date($event->date_start_in_calendar, '%Y', 'tzuserrel');
$tmpmonthstart = dol_print_date($event->date_start_in_calendar, '%m', 'tzuserrel');
$tmpdaystart = dol_print_date($event->date_start_in_calendar, '%d', 'tzuserrel');
$tmpyearend = dol_print_date($event->date_end_in_calendar, '%Y', 'tzuserrel');
$tmpmonthend = dol_print_date($event->date_end_in_calendar, '%m', 'tzuserrel');
$tmpdayend = dol_print_date($event->date_end_in_calendar, '%d', 'tzuserrel');
// Hour start
if ($tmpyearstart == $annee && $tmpmonthstart == $mois && $tmpdaystart == $jour) {
$daterange .= dol_print_date($event->date_start_in_calendar, 'hour', 'tzuserrel');
if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar) {
if ($tmpyearstart == $tmpyearend && $tmpmonthstart == $tmpmonthend && $tmpdaystart == $tmpdayend) {
$daterange .= '-';
}
//else
//print '...';
}
//else
//print '...';
}
}
if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar) {
if ($tmpyearstart != $tmpyearend || $tmpmonthstart != $tmpmonthend || $tmpdaystart != $tmpdayend) {
$daterange .= '...';
if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar) {
if ($tmpyearstart != $tmpyearend || $tmpmonthstart != $tmpmonthend || $tmpdaystart != $tmpdayend) {
$daterange .= '...';
}
}
}
// Hour end
if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar) {
if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour) {
$daterange .= dol_print_date($event->date_end_in_calendar, 'hour', 'tzuserrel');
// Hour end
if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar) {
if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour) {
$daterange .= dol_print_date($event->date_end_in_calendar, 'hour', 'tzuserrel');
}
}
} else {
if ($showinfo) {
print $langs->trans("EventOnFullDay")."<br>\n";
}
}
} else {
if ($showinfo) {
print $langs->trans("EventOnFullDay")."<br>\n";
}
}
@ -2216,7 +2211,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$titletoshow = $daterange;
$titletoshow .= ($titletoshow ? ' ' : '').dol_escape_htmltag($event->label);
if ($event->type_code != 'ICALEVENT') {
if ($event->type_code != 'ICALEVENT' && $event->type_code != 'BIRTHDAY') {
$savlabel = $event->label;
$event->label = $titletoshow;
// Note: List of users are inside $event->userassigned. Link may be clickable depending on permissions of user.
@ -2242,8 +2237,10 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$listofusertoshow .= $cacheusers[$tmpid]->getNomUrl(-3, '', 0, 0, 0, 0, '', 'valignmiddle inline-block');
}
print $titletoshow;
print $listofusertoshow.' &nbsp;';
if ($event->type_code != 'BIRTHDAY') {
print $titletoshow;
print $listofusertoshow.' &nbsp;';
}
if ($event->type_code == 'ICALEVENT') {
print '<br>('.dol_trunc($event->icalname, $maxnbofchar).')';
@ -2263,7 +2260,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$thirdparty = $cachethirdparties[$thirdparty_id];
}
if (!empty($thirdparty->id)) {
$linerelatedto .= $thirdparty->getNomUrl(1, '', 0, 0, -1, 0, '', 'valignmiddle inline-block');
$linerelatedto .= $thirdparty->getNomUrl(1, '', 0, 0, -1, 0, '', 'valignmiddle inline'); // using inline-block make the content completely replace with ... when too large
}
}
if (!empty($contact_id) && $contact_id > 0) {
@ -2278,7 +2275,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$linerelatedto .= '&nbsp;';
}
if (!empty($contact->id)) {
$linerelatedto .= $contact->getNomUrl(1, '', 0, '', -1, 0, 'valignmiddle inline-block');
$linerelatedto .= $contact->getNomUrl(1, '', 0, '', -1, 0, 'valignmiddle inline'); // using inline-block make the content completely replace with ... when too large
}
}
if (!empty($event->fk_element) && $event->fk_element > 0 && !empty($event->elementtype) && getDolGlobalString('AGENDA_SHOW_LINKED_OBJECT')) {
@ -2296,6 +2293,24 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
}
}
if ($event->type_code == 'HOLIDAY') {
// It's holiday calendar
$tmpholiday->fetch($event->id);
//print $tmpholiday->getNomUrl(1, -1, 0, 'valignmiddle inline-block');
$tmpid = $tmpholiday->fk_user;
if (empty($cacheusers[$tmpid])) {
$newuser = new User($db);
$newuser->fetch($tmpid);
$cacheusers[$tmpid] = $newuser;
}
$listofusertoshow = '';
$listofusertoshow .= "\n".'<br>'.$cacheusers[$tmpid]->getNomUrl(-1, '', 0, 0, 0, 0, '', 'paddingright valignmiddle inline-block')."\n";
print $listofusertoshow;
}
// Show location
if ($showinfo) {
if ($event->location) {
@ -2305,9 +2320,10 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
}
print '</td>';
// Status - Percent
$withstatus = 0;
if ($event->type_code != 'BIRTHDAY' && $event->type_code != 'ICALEVENT') {
if ($event->type_code != 'HOLIDAY' && $event->type_code != 'BIRTHDAY' && $event->type_code != 'ICALEVENT') {
$withstatus = 1;
if ($event->percentage >= 0) {
$withstatus = 2;

View file

@ -1027,8 +1027,6 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
$ponct = ($event->date_start_in_calendar == $event->date_end_in_calendar);
// Define $color (Hex string like '0088FF') and $cssclass of event
$color = -1;
$cssclass = '';

File diff suppressed because it is too large Load diff

View file

@ -156,13 +156,13 @@ if (isModEnabled("propal") && $user->hasRight("propal", "lire") && is_object($pr
$sql .= ", s.canvas";
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p,";
$sql .= " ".MAIN_DB_PREFIX."societe as s";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE p.entity IN (".getEntity($propalstatic->element).")";
$sql .= " AND p.fk_soc = s.rowid";
$sql .= " AND p.fk_statut = ".Propal::STATUS_DRAFT;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($socid) {
@ -256,13 +256,13 @@ if (isModEnabled('supplier_proposal') && $user->hasRight("supplier_proposal", "l
$sql .= ", s.canvas";
$sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p,";
$sql .= " ".MAIN_DB_PREFIX."societe as s";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE p.entity IN (".getEntity($supplierproposalstatic->element).")";
$sql .= " AND p.fk_statut = ".SupplierProposal::STATUS_DRAFT;
$sql .= " AND p.fk_soc = s.rowid";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($socid) {
@ -355,13 +355,13 @@ if (isModEnabled('order') && $user->hasRight('commande', 'lire') && is_object($o
$sql .= ", s.canvas";
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c,";
$sql .= " ".MAIN_DB_PREFIX."societe as s";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.entity IN (".getEntity($orderstatic->element).")";
$sql .= " AND c.fk_statut = ".Commande::STATUS_DRAFT;
$sql .= " AND c.fk_soc = s.rowid";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($socid) {
@ -457,13 +457,13 @@ if ((isModEnabled("fournisseur") && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMO
$sql .= ", s.canvas";
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf,";
$sql .= " ".MAIN_DB_PREFIX."societe as s";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE cf.entity IN (".getEntity($supplierorderstatic->element).")";
$sql .= " AND cf.fk_statut = ".CommandeFournisseur::STATUS_DRAFT;
$sql .= " AND cf.fk_soc = s.rowid";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($socid) {
@ -556,7 +556,7 @@ if (isModEnabled('intervention') && is_object($fichinterstatic)) {
$sql .= ", s.canvas";
$sql .= " FROM ".MAIN_DB_PREFIX."fichinter as f";
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE f.entity IN (".getEntity('intervention').")";
@ -565,7 +565,7 @@ if (isModEnabled('intervention') && is_object($fichinterstatic)) {
if ($socid) {
$sql .= " AND f.fk_soc = ".((int) $socid);
}
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
@ -641,12 +641,12 @@ if (isModEnabled("societe") && $user->hasRight('societe', 'lire')) {
$sql .= ", s.canvas";
$sql .= ", s.datec, s.tms";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE s.entity IN (".getEntity($companystatic->element).")";
$sql .= " AND s.client IN (".Societe::CUSTOMER.", ".Societe::PROSPECT.", ".Societe::CUSTOMER_AND_PROSPECT.")";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
// Add where from hooks
@ -750,7 +750,7 @@ if (isModEnabled('propal') && is_object($propalstatic)) {
$sql .= " AND c.fk_soc = s.rowid";
// If the internal user must only see his customers, force searching by him
$search_sale = 0;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$search_sale = $user->id;
}
// Search on sale representative
@ -845,7 +845,7 @@ if (isModEnabled('order')) {
$sql .= ", s.canvas";
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c,";
$sql .= " ".MAIN_DB_PREFIX."societe as s";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.fk_soc = s.rowid";
@ -854,7 +854,7 @@ if (isModEnabled('order')) {
if ($socid) {
$sql .= " AND c.fk_soc = ".((int) $socid);
}
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= " ORDER BY c.tms DESC";
@ -933,12 +933,12 @@ if ((isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $use
$sql .= ", s.canvas";
$sql .= ", s.datec as dc, s.tms as dm";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE s.entity IN (".getEntity($companystatic->element).")";
$sql .= " AND s.fournisseur = ".Societe::SUPPLIER;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
// Add where from hooks
@ -1049,13 +1049,13 @@ if (isModEnabled('contract') && $user->hasRight("contrat", "lire") && 0) { // TO
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."contrat as c";
$sql .= ", ".MAIN_DB_PREFIX."product as p";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.entity IN (".getEntity($staticcontrat->element).")";
$sql .= " AND c.fk_soc = s.rowid";
$sql .= " AND c.fk_product = p.rowid";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($socid) {
@ -1125,13 +1125,13 @@ if (isModEnabled("propal") && $user->hasRight("propal", "lire")) {
$sql .= ", s.canvas";
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p";
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE p.entity IN (".getEntity($propalstatic->element).")";
$sql .= " AND p.fk_soc = s.rowid";
$sql .= " AND p.fk_statut = ".Propal::STATUS_VALIDATED;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($socid) {
@ -1245,13 +1245,13 @@ if (isModEnabled('order') && $user->hasRight('commande', 'lire') && is_object($o
$sql .= ", s.canvas";
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c";
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.entity IN (".getEntity($orderstatic->element).")";
$sql .= " AND c.fk_soc = s.rowid";
$sql .= " AND c.fk_statut IN (".Commande::STATUS_VALIDATED.", ".Commande::STATUS_SHIPMENTONPROCESS.")";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($socid) {

View file

@ -2925,7 +2925,7 @@ class Propal extends CommonObject
// If the internal user must only see his customers, force searching by him
$search_sale = 0;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$search_sale = $user->id;
}
// Search on sale representative
@ -3448,7 +3448,7 @@ class Propal extends CommonObject
}
// If the internal user must only see his customers, force searching by him
$search_sale = 0;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$search_sale = $user->id;
}
// Search on sale representative
@ -3625,7 +3625,7 @@ class Propal extends CommonObject
// If the internal user must only see his customers, force searching by him
$search_sale = 0;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$search_sale = $user->id;
}
// Search on sale representative

View file

@ -145,7 +145,7 @@ class PropaleStats extends Stats
$sql = "SELECT date_format(".$this->field_date.",'%m') as dm, COUNT(*) as nb";
$sql .= " FROM ".$this->from;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
@ -170,7 +170,7 @@ class PropaleStats extends Stats
$sql = "SELECT date_format(".$this->field_date.",'%Y') as dm, COUNT(*) as nb, SUM(c.".$this->field.")";
$sql .= " FROM ".$this->from;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
@ -194,7 +194,7 @@ class PropaleStats extends Stats
$sql = "SELECT date_format(".$this->field_date.",'%m') as dm, SUM(p.".$this->field.")";
$sql .= " FROM ".$this->from;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
@ -219,7 +219,7 @@ class PropaleStats extends Stats
$sql = "SELECT date_format(".$this->field_date.",'%m') as dm, AVG(p.".$this->field.")";
$sql .= " FROM ".$this->from;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
@ -242,7 +242,7 @@ class PropaleStats extends Stats
$sql = "SELECT date_format(".$this->field_date.",'%Y') as year, COUNT(*) as nb, SUM(".$this->field.") as total, AVG(".$this->field.") as avg";
$sql .= " FROM ".$this->from;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
@ -269,7 +269,7 @@ class PropaleStats extends Stats
$sql .= " FROM ".$this->from;
$sql .= " INNER JOIN ".$this->from_line." ON p.rowid = tl.fk_propal";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."product as product ON tl.fk_product = product.rowid";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;

View file

@ -296,7 +296,8 @@ foreach ($object->fields as $key => $val) {
}
}*/
if (!$user->hasRight('societe', 'client', 'voir')) {
// Check only if it's an internal user (external users are already filtered by company whatever are permissions on this)
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$search_sale = $user->id;
}

View file

@ -2658,16 +2658,16 @@ class Commande extends CommonOrder
$sql = "SELECT s.rowid, s.nom as name, s.client,";
$sql .= " c.rowid as cid, c.ref";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", sc.fk_soc, sc.fk_user";
}
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX.$this->table_element." as c";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.entity IN (".getEntity('commande').")";
$sql .= " AND c.fk_soc = s.rowid";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($socid) {
@ -3492,7 +3492,7 @@ class Commande extends CommonOrder
$sql = "SELECT c.rowid, c.date_creation as datec, c.date_commande, c.date_livraison as delivery_date, c.fk_statut, c.total_ht";
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as c";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc";
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
$clause = " AND";
@ -3667,6 +3667,7 @@ class Commande extends CommonOrder
/**
* getTooltipContentArray
*
* @param array<string,mixed> $params params to construct tooltip data
* @since v18
* @return array{picto?:string,ref?:string,refsupplier?:string,label?:string,date?:string,date_echeance?:string,amountht?:string,total_ht?:string,totaltva?:string,amountlt1?:string,amountlt2?:string,amountrevenustamp?:string,totalttc?:string}|array{optimize:string}
@ -4001,7 +4002,7 @@ class Commande extends CommonOrder
$sql = "SELECT count(co.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as co";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON co.fk_soc = s.rowid";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
$clause = "AND";

View file

@ -159,7 +159,7 @@ class CommandeStats extends Stats
$sql = "SELECT date_format(c.date_commande,'%m') as dm, COUNT(*) as nb";
$sql .= " FROM ".$this->from;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
@ -184,7 +184,7 @@ class CommandeStats extends Stats
$sql = "SELECT date_format(c.date_commande,'%Y') as dm, COUNT(*) as nb, SUM(c.".$this->field.")";
$sql .= " FROM ".$this->from;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
@ -208,7 +208,7 @@ class CommandeStats extends Stats
$sql = "SELECT date_format(c.date_commande,'%m') as dm, SUM(c.".$this->field.")";
$sql .= " FROM ".$this->from;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
@ -233,7 +233,7 @@ class CommandeStats extends Stats
$sql = "SELECT date_format(c.date_commande,'%m') as dm, AVG(c.".$this->field.")";
$sql .= " FROM ".$this->from;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
@ -256,7 +256,7 @@ class CommandeStats extends Stats
$sql = "SELECT date_format(c.date_commande,'%Y') as year, COUNT(*) as nb, SUM(c.".$this->field.") as total, AVG(".$this->field.") as avg";
$sql .= " FROM ".$this->from;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
@ -282,7 +282,7 @@ class CommandeStats extends Stats
$sql .= " FROM ".$this->from;
$sql .= " INNER JOIN ".$this->from_line." ON c.rowid = tl.fk_commande";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."product as product ON tl.fk_product = product.rowid";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;

View file

@ -105,7 +105,7 @@ if (isModEnabled('order')) {
$sql .= ", s.canvas";
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c";
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.fk_soc = s.rowid";
@ -114,7 +114,7 @@ if (isModEnabled('order')) {
if ($socid) {
$sql .= " AND c.fk_soc = ".((int) $socid);
}
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
@ -171,7 +171,7 @@ $sql .= ", s.code_client";
$sql .= ", s.canvas";
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c,";
$sql .= " ".MAIN_DB_PREFIX."societe as s";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.fk_soc = s.rowid";
@ -180,7 +180,7 @@ $sql .= " AND c.entity IN (".getEntity('commande').")";
if ($socid) {
$sql .= " AND c.fk_soc = ".((int) $socid);
}
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= " ORDER BY c.tms DESC";
@ -257,7 +257,7 @@ if (isModEnabled('order')) {
$sql .= ", s.canvas";
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c";
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.fk_soc = s.rowid";
@ -266,7 +266,7 @@ if (isModEnabled('order')) {
if ($socid) {
$sql .= " AND c.fk_soc = ".((int) $socid);
}
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= " ORDER BY c.rowid DESC";
@ -346,7 +346,7 @@ if (isModEnabled('order')) {
$sql .= ", s.canvas";
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c";
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.fk_soc = s.rowid";
@ -355,7 +355,7 @@ if (isModEnabled('order')) {
if ($socid) {
$sql .= " AND c.fk_soc = ".((int) $socid);
}
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= " ORDER BY c.rowid DESC";

View file

@ -951,9 +951,8 @@ $sql .= ' AND c.entity IN ('.getEntity('commande').')';
if ($socid > 0) {
$sql .= ' AND s.rowid = '.((int) $socid);
}
// Restriction on sale representative
if (!$permissiontoreadallthirdparty) {
if (empty($user->socid) && !$permissiontoreadallthirdparty) {
$sql .= " AND (EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc AND sc.fk_user = ".((int) $user->id).")";
if (getDolGlobalInt('MAIN_SEE_SUBORDINATES') && $userschilds) {
$sql .= " OR EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc AND sc.fk_user IN (".$db->sanitize(implode(',', $userschilds))."))";
@ -1682,7 +1681,7 @@ if (!empty($arrayfields['p.title']['checked'])) {
// Thirpdarty
if (!empty($arrayfields['s.nom']['checked'])) {
print '<td class="liste_titre" align="left">';
print '<input class="flat maxwidth100" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).'">';
print '<input class="flat maxwidth100" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).'"'.(!empty($user->socid) ? " disabled" : "").'>';
print '</td>';
}
// Alias

View file

@ -77,6 +77,11 @@ class Facture extends CommonInvoice
*/
public $table_element_line = 'facturedet';
/**
* @var string Name of class line
*/
public $class_element_line = 'FactureLigne';
/**
* @var string Fieldname with ID of parent key if this field has a parent
*/
@ -4831,7 +4836,7 @@ class Facture extends CommonInvoice
}
// If the internal user must only see his customers, force searching by him
$search_sale = 0;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$search_sale = $user->id;
}
// Search on sale representative
@ -5025,7 +5030,7 @@ class Facture extends CommonInvoice
$sql = "SELECT f.rowid, f.date_lim_reglement as datefin, f.fk_statut as status, f.total_ht";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON f.fk_soc = sc.fk_soc";
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
$clause = " AND";
@ -5273,7 +5278,7 @@ class Facture extends CommonInvoice
$sql = "SELECT count(f.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
$clause = "AND";

View file

@ -154,7 +154,7 @@ class FactureStats extends Stats
$sql = "SELECT date_format(f.datef,'%m') as dm, COUNT(*) as nb";
$sql .= " FROM ".$this->from;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= $this->join;
@ -180,7 +180,7 @@ class FactureStats extends Stats
$sql = "SELECT date_format(f.datef,'%Y') as dm, COUNT(*), SUM(c.".$this->field.")";
$sql .= " FROM ".$this->from;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= $this->join;
@ -205,7 +205,7 @@ class FactureStats extends Stats
$sql = "SELECT date_format(datef,'%m') as dm, SUM(f.".$this->field.")";
$sql .= " FROM ".$this->from;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= $this->join;
@ -231,7 +231,7 @@ class FactureStats extends Stats
$sql = "SELECT date_format(datef,'%m') as dm, AVG(f.".$this->field.")";
$sql .= " FROM ".$this->from;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= $this->join;
@ -254,7 +254,7 @@ class FactureStats extends Stats
$sql = "SELECT date_format(datef,'%Y') as year, COUNT(*) as nb, SUM(f.".$this->field.") as total, AVG(f.".$this->field.") as avg";
$sql .= " FROM ".$this->from;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= $this->join;
@ -278,7 +278,7 @@ class FactureStats extends Stats
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
$sql .= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= $this->join;
@ -306,7 +306,7 @@ class FactureStats extends Stats
$startYear = $endYear - $numberYears;
$sql = "SELECT date_format(datef,'%Y') as dm, SUM(f.".$this->field.")";
$sql .= " FROM ".$this->from;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= $this->join;

View file

@ -316,7 +316,8 @@ $object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
if (!$user->hasRight('societe', 'client', 'voir')) {
// Check only if it's an internal user, external users are already filtered by $socid
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$search_sale = $user->id;
}
@ -325,6 +326,10 @@ $fieldid = (!empty($ref) ? 'ref' : 'rowid');
if (!empty($user->socid)) {
$socid = $user->socid;
}
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$search_sale = $user->id;
}
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid);

View file

@ -161,7 +161,7 @@ if (isModEnabled('invoice') && $user->hasRight('facture', 'lire')) {
$sql .= " AND f.fk_soc = ".((int) $socid);
}
// Filter on sale representative
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = f.fk_soc AND sc.fk_user = ".((int) $user->id).")";
}
// Add where from hooks
@ -312,7 +312,7 @@ if ((isModEnabled('fournisseur') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMO
$sql .= " AND ff.fk_soc = ".((int) $socid);
}
// Filter on sale representative
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = ff.fk_soc AND sc.fk_user = ".((int) $user->id).")";
}
// Add where from hooks
@ -635,7 +635,7 @@ if (isModEnabled('invoice') && isModEnabled('order') && $user->hasRight("command
$sql .= " AND c.fk_statut = ".((int) Commande::STATUS_CLOSED);
$sql .= " AND c.facture = 0";
// Filter on sale representative
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc AND sc.fk_user = ".((int) $user->id).")";
}

View file

@ -215,6 +215,7 @@ if (empty($reshook)) {
$object->mode_reglement_id = GETPOSTINT('mode_reglement_id');
$object->fk_account = GETPOSTINT('fk_account');
$object->fk_project = GETPOSTINT('fk_project');
$object->paye = ChargeSociales::STATUS_UNPAID;
$id = $object->create($user);
if ($id <= 0) {

View file

@ -80,7 +80,7 @@ $search_date_limit_endyear = GETPOSTINT('search_date_limit_endyear');
$search_date_limit_start = dol_mktime(0, 0, 0, $search_date_limit_startmonth, $search_date_limit_startday, $search_date_limit_startyear);
$search_date_limit_end = dol_mktime(23, 59, 59, $search_date_limit_endmonth, $search_date_limit_endday, $search_date_limit_endyear);
$search_project_ref = GETPOST('search_project_ref', 'alpha');
$search_users = GETPOST('search_users', 'intcomma');
$search_users = GETPOST('search_users', 'array:int');
$search_type = GETPOST('search_type', 'alpha');
$search_account = GETPOST('search_account', 'alpha');

View file

@ -924,16 +924,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<table class="border centpercent">';
// Date To Birth
print '<tr><td><label for="birthday">'.$langs->trans("DateOfBirth").'</label></td><td>';
print '<tr><td class="titlefieldcreate"><label for="birthday">'.$langs->trans("DateOfBirth").'</label></td><td colspan="3">';
$form = new Form($db);
if ($object->birthday) {
print $form->selectDate($object->birthday, 'birthday', 0, 0, 0, "perso", 1, 0);
} else {
print $form->selectDate('', 'birthday', 0, 0, 1, "perso", 1, 0);
}
print '</td>';
print '<td><label for="birthday_alert">'.$langs->trans("Alert").'</label>: ';
print ' &nbsp; <label for="birthday_alert">'.$langs->trans("Alert").'</label> ';
if (!empty($object->birthday_alert)) {
print '<input type="checkbox" name="birthday_alert" id="birthday_alert" checked>';
} else {

View file

@ -2294,7 +2294,7 @@ class Contrat extends CommonObject
$this->from = " FROM ".MAIN_DB_PREFIX."contrat as c";
$this->from .= ", ".MAIN_DB_PREFIX."contratdet as cd";
$this->from .= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$this->from .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
@ -2325,7 +2325,7 @@ class Contrat extends CommonObject
if ($user->socid) {
$sql .= " AND c.fk_soc = ".((int) $user->socid);
}
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
@ -2393,7 +2393,7 @@ class Contrat extends CommonObject
$sql = "SELECT count(c.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."contrat as c";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON c.fk_soc = s.rowid";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
$clause = "AND";

View file

@ -212,7 +212,7 @@ $object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$search_sale = $user->id;
}
@ -903,7 +903,7 @@ if (!empty($arrayfields['c.ref_supplier']['checked'])) {
}
if (!empty($arrayfields['s.nom']['checked'])) {
print '<td class="liste_titre">';
print '<input type="text" class="flat" size="8" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
print '<input type="text" class="flat" size="8" name="search_name" value="'.dol_escape_htmltag($search_name).'"'.($user->socid > 0 ? " disabled" : "").'>';
print '</td>';
}
if (!empty($arrayfields['s.email']['checked'])) {

View file

@ -87,14 +87,14 @@ class box_actions extends ModeleBoxes
$sql .= ", s.code_client, s.code_compta as code_compta_client, s.client";
$sql .= ", s.logo, s.email, s.entity";
$sql .= " FROM ".MAIN_DB_PREFIX."c_actioncomm AS ta, ".MAIN_DB_PREFIX."actioncomm AS a";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
$sql .= " WHERE a.fk_action = ta.id";
$sql .= " AND a.entity IN (".getEntity('actioncomm').")";
$sql .= " AND a.percent >= 0 AND a.percent < 100";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = ".((int) $user->id).")";
}
if ($user->socid) {

View file

@ -86,14 +86,14 @@ class box_actions_future extends ModeleBoxes
$sql .= ", s.code_client, s.code_compta as code_compta_client, s.client";
$sql .= ", s.logo, s.email, s.entity";
$sql .= " FROM ".MAIN_DB_PREFIX."c_actioncomm AS ta, ".MAIN_DB_PREFIX."actioncomm AS a";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
$sql .= " WHERE a.fk_action = ta.id";
$sql .= " AND a.entity IN (".getEntity('actioncomm').")";
//$sql .= " AND a.percent >= 0 AND a.percent < 100";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = ".((int) $user->id).")";
}
if ($user->socid) {

View file

@ -105,13 +105,13 @@ class box_activity extends ModeleBoxes
$sql = "SELECT p.fk_statut, SUM(p.total_ttc) as Mnttot, COUNT(*) as nb";
$sql .= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= ")";
$sql .= " WHERE p.entity IN (".getEntity('propal').")";
$sql .= " AND p.fk_soc = s.rowid";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($user->socid) {
@ -194,13 +194,13 @@ class box_activity extends ModeleBoxes
$sql = "SELECT c.fk_statut, sum(c.total_ttc) as Mnttot, count(*) as nb";
$sql .= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= ")";
$sql .= " WHERE c.entity IN (".getEntity('commande').")";
$sql .= " AND c.fk_soc = s.rowid";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($user->socid) {
@ -279,12 +279,12 @@ class box_activity extends ModeleBoxes
$data = array();
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
$sql .= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= ")";
$sql .= " WHERE f.entity IN (".getEntity('invoice').')';
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($user->socid) {

View file

@ -89,12 +89,12 @@ class box_clients extends ModeleBoxes
$sql .= ", s.logo, s.email, s.entity";
$sql .= ", s.datec, s.tms, s.status";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE s.client IN (1, 3)";
$sql .= " AND s.entity IN (".getEntity('societe').")";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
// Add where from hooks

View file

@ -97,7 +97,7 @@ class box_commandes extends ModeleBoxes
$sql .= ", c.total_tva";
$sql .= ", c.total_ttc";
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.fk_soc = s.rowid";
@ -105,7 +105,7 @@ class box_commandes extends ModeleBoxes
if (getDolGlobalString('ORDER_BOX_LAST_ORDERS_VALIDATED_ONLY')) {
$sql .= " AND c.fk_statut = 1";
}
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($user->socid) {

View file

@ -102,11 +102,11 @@ class box_contacts extends ModeleBoxes
if (getDolGlobalString('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);
}
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE sp.entity IN (".getEntity('contact').")";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= " AND ((sp.fk_user_creat = ".((int) $user->id)." AND sp.priv = 1) OR sp.priv = 0)"; // check if this is a private contact

View file

@ -80,12 +80,12 @@ class box_contracts extends ModeleBoxes
$sql .= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat, c.datec, c.tms as date_modification, c.fin_validite, c.date_cloture,";
$sql .= " c.ref_customer, c.ref_supplier";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.fk_soc = s.rowid";
$sql .= " AND c.entity = ".$conf->entity;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($user->socid) {

View file

@ -85,12 +85,12 @@ class box_customers_outstanding_bill_reached extends ModeleBoxes
$sql .= ", s.outstanding_limit";
$sql .= ", s.datec, s.tms, s.status";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE s.client IN (1, 3)";
$sql .= " AND s.entity IN (".getEntity('societe').")";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($user->socid) {

View file

@ -95,13 +95,13 @@ class box_factures extends ModeleBoxes
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid = pf.fk_facture,";
$sql .= " ".MAIN_DB_PREFIX."societe as s";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE f.fk_soc = s.rowid";
$sql .= " AND f.fk_statut > 0";
$sql .= " AND f.entity IN (".getEntity('invoice').")";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($user->socid) {

View file

@ -93,12 +93,12 @@ class box_factures_fourn extends ModeleBoxes
$sql .= ', f.date_lim_reglement as datelimite, f.tms, f.type';
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."facture_fourn as f";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE f.fk_soc = s.rowid";
$sql .= " AND f.entity = ".$conf->entity;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($user->socid) {

View file

@ -93,14 +93,14 @@ class box_factures_fourn_imp extends ModeleBoxes
$sql2 = " FROM ".MAIN_DB_PREFIX."societe as s";
$sql2 .= ",".MAIN_DB_PREFIX."facture_fourn as f";
$sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf ON f.rowid = pf.fk_facturefourn";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql2 .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql2 .= " WHERE f.fk_soc = s.rowid";
$sql2 .= " AND f.entity IN (".getEntity('supplier_invoice').")";
$sql2 .= " AND f.paye = 0";
$sql2 .= " AND fk_statut = 1";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql2 .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($user->socid) {

View file

@ -104,7 +104,7 @@ class box_factures_imp extends ModeleBoxes
if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
$sql2 .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
}
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql2 .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql2 .= ", ".MAIN_DB_PREFIX."facture as f";
@ -113,7 +113,7 @@ class box_factures_imp extends ModeleBoxes
$sql2 .= " AND f.entity IN (".getEntity('invoice').")";
$sql2 .= " AND f.paye = 0";
$sql2 .= " AND fk_statut = 1";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql2 .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($user->socid) {

View file

@ -83,13 +83,13 @@ class box_ficheinter extends ModeleBoxes
$sql .= ", s.code_client, s.code_compta, s.client";
$sql .= ", s.logo, s.email, s.entity";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= ", ".MAIN_DB_PREFIX."fichinter as f";
$sql .= " WHERE f.fk_soc = s.rowid ";
$sql .= " AND f.entity = ".$conf->entity;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($user->socid) {

View file

@ -81,12 +81,12 @@ class box_fournisseurs extends ModeleBoxes
$sql .= ", s.logo, s.email, s.entity";
$sql .= ", s.datec, s.tms, s.status";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE s.fournisseur = 1";
$sql .= " AND s.entity IN (".getEntity('societe').")";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
// Add where from hooks

View file

@ -97,7 +97,7 @@ class box_graph_propales_permonth extends ModeleBoxes
if ($user->socid) {
$socid = $user->socid;
}
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$prefix .= 'private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user
}

View file

@ -85,12 +85,12 @@ class box_propales extends ModeleBoxes
$sql .= ", s.logo, s.email, s.entity";
$sql .= ", p.rowid, p.ref, p.fk_statut as status, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.total_tva, p.total_ttc, p.tms";
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."societe as s";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE p.fk_soc = s.rowid";
$sql .= " AND p.entity IN (".getEntity('propal').")";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($user->socid) {

View file

@ -90,12 +90,12 @@ class box_prospect extends ModeleBoxes
$sql .= ", s.fk_stcomm";
$sql .= ", s.datec, s.tms, s.status";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE s.client IN (2, 3)";
$sql .= " AND s.entity IN (".getEntity('societe').")";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
// Add where from hooks

View file

@ -90,7 +90,7 @@ class box_services_contracts extends ModeleBoxes
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."contrat as c ON s.rowid = c.fk_soc";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= ")";

View file

@ -78,7 +78,7 @@ class box_services_expired extends ModeleBoxes
$sql .= " s.nom as name, s.rowid as socid, s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
$sql .= " MIN(cd.date_fin_validite) as date_line, COUNT(cd.rowid) as nb_services";
$sql .= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe s, ".MAIN_DB_PREFIX."contratdet as cd";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE cd.statut = 4 AND cd.date_fin_validite <= '".$this->db->idate($now)."'";
@ -87,7 +87,7 @@ class box_services_expired extends ModeleBoxes
if ($user->socid) {
$sql .= ' AND c.fk_soc = '.((int) $user->socid);
}
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= " GROUP BY c.rowid, c.ref, c.statut, c.date_contrat, c.ref_customer, c.ref_supplier, s.nom, s.rowid";

View file

@ -96,7 +96,7 @@ class box_shipments extends ModeleBoxes
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target AND el.targettype = 'shipping' AND el.sourcetype IN ('commande')";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid AND el.sourcetype IN ('commande') AND el.targettype = 'shipping'";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc";
}
$sql .= " WHERE e.entity IN (".getEntity('expedition').")";
@ -106,7 +106,7 @@ class box_shipments extends ModeleBoxes
if ($user->socid > 0) {
$sql .= " AND s.rowid = ".((int) $user->socid);
}
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND sc.fk_user = ".((int) $user->id);
} else {
$sql .= " ORDER BY e.tms DESC, e.date_delivery DESC, e.ref DESC";

View file

@ -88,12 +88,12 @@ class box_supplier_orders extends ModeleBoxes
$sql .= ", c.fk_statut as status";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as c";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.fk_soc = s.rowid";
$sql .= " AND c.entity IN (".getEntity('supplier_order').")";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($user->socid) {

View file

@ -82,14 +82,14 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes
$sql .= ", c.fk_statut as status";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as c";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.fk_soc = s.rowid";
$sql .= " AND c.entity IN (".getEntity('supplier_order').")";
$sql .= " AND c.date_livraison IS NOT NULL";
$sql .= " AND c.fk_statut IN (".CommandeFournisseur::STATUS_ORDERSENT.", ".CommandeFournisseur::STATUS_RECEIVED_PARTIALLY.")";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($user->socid) {

View file

@ -6580,8 +6580,6 @@ abstract class CommonObject
*/
public function deleteExtraFields()
{
global $conf;
if (getDolGlobalString('MAIN_EXTRAFIELDS_DISABLED')) {
return 0;
}

View file

@ -4,7 +4,7 @@
* Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2006 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.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
@ -1204,10 +1204,10 @@ class Conf extends stdClass
// For modules that want to disable top or left menu
if (!empty($this->global->MAIN_HIDE_TOP_MENU)) {
$this->dol_hide_topmenu = getDolGlobalString('MAIN_HIDE_TOP_MENU');
$this->dol_hide_topmenu = getDolGlobalInt('MAIN_HIDE_TOP_MENU');
}
if (!empty($this->global->MAIN_HIDE_LEFT_MENU)) {
$this->dol_hide_leftmenu = getDolGlobalString('MAIN_HIDE_LEFT_MENU');
$this->dol_hide_leftmenu = getDolGlobalInt('MAIN_HIDE_LEFT_MENU');
}
if (empty($this->global->MAIN_SIZE_SHORTLIST_LIMIT)) {

View file

@ -4071,16 +4071,16 @@ class Form
$optstart .= ' data-product-id="' . dol_escape_htmltag($objp->rowid) . '"';
$optstart .= ' data-price-id="' . dol_escape_htmltag($objp->idprodfournprice) . '"';
$optstart .= ' data-qty="' . dol_escape_htmltag($objp->quantity) . '"';
$optstart .= ' data-up="' . dol_escape_htmltag(price2num($objp->unitprice)) . '"';
$optstart .= ' data-up-locale="' . dol_escape_htmltag(price($objp->unitprice)) . '"';
$optstart .= ' data-up="' . dol_escape_htmltag(price2num($objp->unitprice)) . '"'; // the price with numeric international format
$optstart .= ' data-up-locale="' . dol_escape_htmltag(price($objp->unitprice)) . '"'; // the price formatted in user language
$optstart .= ' data-discount="' . dol_escape_htmltag($outdiscount) . '"';
$optstart .= ' data-tvatx="' . dol_escape_htmltag(price2num($objp->tva_tx)) . '"';
$optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"';
$optstart .= ' data-tvatx="' . dol_escape_htmltag(price2num($objp->tva_tx)) . '"'; // the rate with numeric international format
$optstart .= ' data-tvatx-formated="' . dol_escape_htmltag(price($objp->tva_tx, 0, $langs, 1, -1, 2)) . '"'; // the rate formatted in user language
$optstart .= ' data-default-vat-code="' . dol_escape_htmltag($objp->default_vat_code) . '"';
$optstart .= ' data-supplier-ref="' . dol_escape_htmltag($objp->ref_fourn) . '"';
if (isModEnabled('multicurrency')) {
$optstart .= ' data-multicurrency-code="' . dol_escape_htmltag($objp->multicurrency_code) . '"';
$optstart .= ' data-multicurrency-unitprice="' . dol_escape_htmltag($objp->multicurrency_unitprice) . '"';
$optstart .= ' data-multicurrency-unitprice="' . dol_escape_htmltag(price2num($objp->multicurrency_unitprice)) . '"'; // the price with numeric international format
}
}
$optstart .= ' data-description="' . dol_escape_htmltag($objp->description, 0, 1) . '"';
@ -7325,17 +7325,17 @@ class Form
if ($d) {
// Show date with popup
if ($usecalendar != 'combo') {
$formated_date = '';
$formatted_date = '';
//print "e".$set_time." t ".$conf->format_date_short;
if (strval($set_time) != '' && $set_time != -1) {
//$formated_date=dol_print_date($set_time,$conf->format_date_short);
$formated_date = dol_print_date($set_time, $langs->trans("FormatDateShortInput"), $gm); // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
//$formatted_date=dol_print_date($set_time,$conf->format_date_short);
$formatted_date = dol_print_date($set_time, $langs->trans("FormatDateShortInput"), $gm); // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
}
// Calendrier popup version eldy
if ($usecalendar == "eldy") {
// Input area to enter date manually
$retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidthdate center" maxlength="11" value="' . $formated_date . '"';
$retstring .= '<input id="' . $prefix . '" name="' . $prefix . '" type="text" class="maxwidthdate center" maxlength="11" value="' . $formatted_date . '"';
$retstring .= ($disabled ? ' disabled' : '');
$retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
$retstring .= ' autocomplete="off">';
@ -7392,7 +7392,7 @@ class Form
// Input area to enter date manually
$retstring .= '<div class="nowraponall inline-block divfordateinput">';
$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="'.($usecalendar == 'html' ? "date" : "text").'" class="maxwidthdate center" maxlength="11" value="'.$formated_date.'"';
$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="'.($usecalendar == 'html' ? "date" : "text").'" class="maxwidthdate center" maxlength="11" value="'.$formatted_date.'"';
$retstring .= ($disabled ? ' disabled' : '');
$retstring .= ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '');
$retstring .= ' onChange="dpChangeDay(\'' . dol_escape_js($prefix) . '\',\'' . dol_escape_js($langs->trans("FormatDateShortJavaInput")) . '\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
@ -9498,7 +9498,7 @@ class Form
}
// Note: $val['checked'] <> 0 means we must show the field into the combo list @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset
$listoffieldsforselection .= '<li><input type="checkbox" id="checkbox' . $key . '" value="' . $key . '"' . ((!array_key_exists('checked', $val) || empty($val['checked']) || $val['checked'] == '-1') ? '' : ' checked="checked"') . '/><label for="checkbox' . $key . '">' . dol_escape_htmltag($langs->trans($val['label'])) . '</label></li>';
$listoffieldsforselection .= '<li><input type="checkbox" id="checkbox' . $key . '" value="' . $key . '"' . ((!array_key_exists('checked', $val) || empty($val['checked']) || $val['checked'] == '-1') ? '' : ' checked="checked"') . ' data-position="'.$val['position'].'" /><label for="checkbox' . $key . '">' . dol_escape_htmltag($langs->trans($val['label'])) . '</label></li>';
$listcheckedstring .= (empty($val['checked']) ? '' : $key . ',');
}
}
@ -10208,7 +10208,15 @@ class Form
if (is_object($hookmanager)) {
$parameters = array('showrefnav' => true);
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
$object->next_prev_filter .= $hookmanager->resPrint;
if (!empty($hookmanager->resPrint)) {
if (empty($object->next_prev_filter) && preg_match('/^\s*AND/i', $hookmanager->resPrint)) {
$object->next_prev_filter = preg_replace('/^\s*AND\s*/i', '', $hookmanager->resPrint);
} elseif (!empty($object->next_prev_filter) && !preg_match('/^\s*AND/i', $hookmanager->resPrint)) {
$object->next_prev_filter .= ' AND '.$hookmanager->resPrint;
} else {
$object->next_prev_filter .= $hookmanager->resPrint;
}
}
}
$previous_ref = $next_ref = '';

View file

@ -2,7 +2,7 @@
/* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2022-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2022-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@ -31,7 +31,7 @@
*
* @param Form $form Form object
* @param int $canedit Can edit filter fields
* @param int $status Status
* @param string $status Status see FormActions::form_select_status_action
* @param int $year Year
* @param int $month Month
* @param int $day Day

View file

@ -987,14 +987,8 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null
$out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$defkey][$paramname], '', $forbidden_chars_to_replace);
}
} else {
// Check if the value is a json format for use with multiselect field, eg ["1","2"]
if (preg_match('/^\[.*\]$/', $user->default_values[$relativepathstring]['filters'][$defkey][$paramname])) {
$out = json_decode($user->default_values[$relativepathstring]['filters'][$defkey][$paramname], true);
$check = 'array'; // force to check an array
} else {
$forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and ,
$out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$defkey][$paramname], '', $forbidden_chars_to_replace);
}
$forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and ,
$out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$defkey][$paramname], '', $forbidden_chars_to_replace);
}
break;
}
@ -2023,12 +2017,13 @@ function dol_escape_xml($stringtoescape)
* Return a string label (so on 1 line only and that should not contains any HTML) ready to be output on HTML page.
* To use text that is not HTML content inside an attribute, you can simply use only dol_escape_htmltag(). In doubt, use dolPrintHTMLForAttribute().
*
* @param string $s String to print
* @return string String ready for HTML output
* @param string $s String to print
* @param int $escapeonlyhtmltags 1=Escape only html tags, not the special chars like accents.
* @return string String ready for HTML output
*/
function dolPrintLabel($s)
function dolPrintLabel($s, $escapeonlyhtmltags = 0)
{
return dol_escape_htmltag(dol_string_nohtmltag($s, 1, 'UTF-8', 0, 0), 0, 0, '', 0, 1);
return dol_escape_htmltag(dol_string_nohtmltag($s, 1, 'UTF-8', 0, 0), 0, 0, '', $escapeonlyhtmltags, 1);
}
/**
@ -2059,18 +2054,23 @@ function dolPrintHTML($s, $allowiframe = 0)
}
/**
* Return a string ready to be output on an HTML attribute (alt, title, data-html, ...)
* Return a string ready to be output into an HTML attribute (alt, title, data-html, ...)
* With dolPrintHTMLForAttribute(), the content is HTML encode, even if it is already HTML content.
*
* @param string $s String to print
* @return string String ready for HTML output
* @param string $s String to print
* @param int $escapeonlyhtmltags 1=Escape only html tags, not the special chars like accents.
* @return string String ready for HTML output
* @see dolPrintHTML(), dolPrintHTMLFortextArea()
*/
function dolPrintHTMLForAttribute($s)
function dolPrintHTMLForAttribute($s, $escapeonlyhtmltags = 0)
{
// The dol_htmlentitiesbr will convert simple text into html
// The dol_escape_htmltag will escape html chars.
return dol_escape_htmltag(dol_string_onlythesehtmltags(dol_htmlentitiesbr($s), 1, 0, 0, 0, array('br', 'b', 'font', 'hr', 'span')), 1, -1, '', 0, 1);
// The dol_htmlentitiesbr will convert simple text into html, including switching accent into HTML entities
// The dol_escape_htmltag will escape html tags.
if ($escapeonlyhtmltags) {
return dol_escape_htmltag(dol_string_onlythesehtmltags($s, 1, 0, 0, 0, array('br', 'b', 'font', 'hr', 'span')), 1, -1, '', 1, 1);
} else {
return dol_escape_htmltag(dol_string_onlythesehtmltags(dol_htmlentitiesbr($s), 1, 0, 0, 0, array('br', 'b', 'font', 'hr', 'span')), 1, -1, '', 0, 1);
}
}
/**
@ -11371,7 +11371,7 @@ function printCommonFooter($zone = 'private')
}
// Management of focus and mandatory for fields
if ($action == 'create' || $action == 'edit' || (empty($action) && (preg_match('/new\.php/', $_SERVER["PHP_SELF"]))) || ((empty($action) || $action == 'addline') && (preg_match('/card\.php/', $_SERVER["PHP_SELF"])))) {
if ($action == 'create' || $action == 'add' || $action == 'edit' || (empty($action) && (preg_match('/new\.php/', $_SERVER["PHP_SELF"]))) || ((empty($action) || $action == 'addline') && (preg_match('/card\.php/', $_SERVER["PHP_SELF"])))) {
print '/* JS CODE TO ENABLE to manage focus and mandatory form fields */'."\n";
$relativepathstring = $_SERVER["PHP_SELF"];
// Clean $relativepathstring
@ -11442,7 +11442,7 @@ function printCommonFooter($zone = 'private')
// Solution 1: Add handler on submit to check if mandatory fields are empty
print 'var form = $(\'#'.dol_escape_js($paramkey).'\').closest("form");'."\n";
print "form.on('submit', function(event) {
var submitter = event.originalEvent.submitter;
var submitter = $(this).find(':submit:focus').get(0);
if (submitter) {
var buttonName = $(submitter).attr('name');
if (buttonName == 'cancel') {
@ -11469,10 +11469,10 @@ function printCommonFooter($zone = 'private')
if (tmpvalue === null || tmpvalue === undefined || tmpvalue === '' || tmpvalue === -1) {
tmpvalueisempty = true;
}
if (tmpvalue === '0' && tmptypefield == 'select') {
if (tmpvalue === '0' && (tmptypefield == 'select' || tmptypefield == 'input')) {
tmpvalueisempty = true;
}
if (tmpvalueisempty) {
if (tmpvalueisempty && (buttonName == 'save')) {
console.log('field has type '+tmptypefield+' and is empty, we cancel the submit');
event.preventDefault(); // Stop submission of form to allow custom code to decide.
event.stopPropagation(); // Stop other handlers.

View file

@ -569,6 +569,7 @@ function getCustomerInvoiceDraftTable($maxCount = 500, $socid = 0)
$result = '';
if (isModEnabled('invoice') && $user->hasRight('facture', 'lire')) {
if ($user->socid > 0) $socid = $user->socid;
$maxofloop = (!getDolGlobalString('MAIN_MAXLIST_OVERLOAD') ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD);
$tmpinvoice = new Facture($db);
@ -579,16 +580,16 @@ function getCustomerInvoiceDraftTable($maxCount = 500, $socid = 0)
$sql .= ", s.rowid as socid, s.email";
$sql .= ", s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur";
$sql .= ", cc.rowid as country_id, cc.code as country_code";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", sc.fk_soc, sc.fk_user ";
}
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE s.rowid = f.fk_soc AND f.fk_statut = ".Facture::STATUS_DRAFT;
$sql .= " AND f.entity IN (".getEntity('invoice').")";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
@ -603,7 +604,7 @@ function getCustomerInvoiceDraftTable($maxCount = 500, $socid = 0)
$sql .= " GROUP BY f.rowid, f.ref, f.datef, f.total_ht, f.total_tva, f.total_ttc, f.ref_client, f.type, f.fk_statut, f.paye,";
$sql .= " s.nom, s.rowid, s.email, s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur,";
$sql .= " cc.rowid, cc.code";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", sc.fk_soc, sc.fk_user";
}
@ -720,6 +721,7 @@ function getDraftSupplierTable($maxCount = 500, $socid = 0)
$result = '';
if ((isModEnabled('fournisseur') || isModEnabled('supplier_invoice')) && $user->hasRight('facture', 'lire')) {
if ($user->socid > 0) $socid = $user->socid;
$maxofloop = (!getDolGlobalString('MAIN_MAXLIST_OVERLOAD') ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD);
$facturesupplierstatic = new FactureFournisseur($db);
@ -731,12 +733,12 @@ function getDraftSupplierTable($maxCount = 500, $socid = 0)
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur";
$sql .= ", cc.rowid as country_id, cc.code as country_code";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE s.rowid = f.fk_soc AND f.fk_statut = ".FactureFournisseur::STATUS_DRAFT;
$sql .= " AND f.entity IN (".getEntity('invoice').')';
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($socid) {
@ -852,12 +854,12 @@ function getDraftSupplierTable($maxCount = 500, $socid = 0)
function getCustomerInvoiceLatestEditTable($maxCount = 5, $socid = 0)
{
global $conf, $db, $langs, $user;
if ($user->socid > 0) $socid = $user->socid;
$sql = "SELECT f.rowid, f.entity, f.ref, f.fk_statut as status, f.paye, f.type, f.total_ht, f.total_tva, f.total_ttc, f.datec,";
$sql .= " s.nom as socname, s.rowid as socid, s.canvas, s.client";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE f.fk_soc = s.rowid";
@ -865,7 +867,7 @@ function getCustomerInvoiceLatestEditTable($maxCount = 5, $socid = 0)
if ($socid) {
$sql .= " AND f.fk_soc = ".((int) $socid);
}
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= " ORDER BY f.tms DESC";
@ -961,12 +963,12 @@ function getCustomerInvoiceLatestEditTable($maxCount = 5, $socid = 0)
function getPurchaseInvoiceLatestEditTable($maxCount = 5, $socid = 0)
{
global $conf, $db, $langs, $user;
if ($user->socid > 0) $socid = $user->socid;
$sql = "SELECT f.rowid, f.entity, f.ref, f.fk_statut as status, f.paye, f.total_ht, f.total_tva, f.total_ttc, f.type, f.ref_supplier, f.datec,";
$sql .= " s.nom as socname, s.rowid as socid, s.canvas, s.client";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE f.fk_soc = s.rowid";
@ -974,7 +976,7 @@ function getPurchaseInvoiceLatestEditTable($maxCount = 5, $socid = 0)
if ($socid) {
$sql .= " AND f.fk_soc = ".((int) $socid);
}
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= " ORDER BY f.tms DESC";
@ -1079,6 +1081,7 @@ function getCustomerInvoiceUnpaidOpenTable($maxCount = 500, $socid = 0)
$result = '';
if (isModEnabled('invoice') && $user->hasRight('facture', 'lire')) {
if ($user->socid > 0) $socid = $user->socid;
$tmpinvoice = new Facture($db);
$sql = "SELECT f.rowid, f.ref, f.fk_statut as status, f.datef, f.type, f.total_ht, f.total_tva, f.total_ttc, f.paye, f.tms";
@ -1091,12 +1094,12 @@ function getCustomerInvoiceUnpaidOpenTable($maxCount = 500, $socid = 0)
$sql .= ", sum(pf.amount) as am";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays,".MAIN_DB_PREFIX."facture as f";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE s.rowid = f.fk_soc AND f.paye = 0 AND f.fk_statut = ".Facture::STATUS_VALIDATED;
$sql .= " AND f.entity IN (".getEntity('invoice').')';
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($socid) {
@ -1268,6 +1271,7 @@ function getPurchaseInvoiceUnpaidOpenTable($maxCount = 500, $socid = 0)
$result = '';
if (isModEnabled("supplier_invoice") && ($user->hasRight('fournisseur', 'facture', 'lire') || $user->hasRight('supplier_invoice', 'read'))) {
if ($user->socid > 0) $socid = $user->socid;
$facstatic = new FactureFournisseur($db);
$sql = "SELECT ff.rowid, ff.ref, ff.fk_statut as status, ff.type, ff.libelle as label, ff.total_ht, ff.total_tva, ff.total_ttc, ff.paye";
@ -1279,14 +1283,14 @@ function getPurchaseInvoiceUnpaidOpenTable($maxCount = 500, $socid = 0)
$sql .= ", sum(pf.amount) as am";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf on ff.rowid=pf.fk_facturefourn";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE s.rowid = ff.fk_soc";
$sql .= " AND ff.entity = ".$conf->entity;
$sql .= " AND ff.paye = 0";
$sql .= " AND ff.fk_statut = ".FactureFournisseur::STATUS_VALIDATED;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($socid) {

View file

@ -240,11 +240,11 @@ function getCustomerOrderPieChart($socid = 0)
/*
* Statistics
*/
if ($user->socid > 0) $socid = $user->socid;
$sql = "SELECT count(c.rowid) as nb, c.fk_statut as status";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."commande as c";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.fk_soc = s.rowid";
@ -252,7 +252,7 @@ function getCustomerOrderPieChart($socid = 0)
if ($user->socid) {
$sql .= ' AND c.fk_soc = '.((int) $user->socid);
}
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= " GROUP BY c.fk_statut";

View file

@ -222,11 +222,11 @@ function getCustomerProposalPieChart($socid = 0)
$listofstatus = array(Propal::STATUS_DRAFT, Propal::STATUS_VALIDATED, Propal::STATUS_SIGNED, Propal::STATUS_NOTSIGNED, Propal::STATUS_BILLED);
$propalstatic = new Propal($db);
if ($user->socid > 0) $socid = $user->socid;
$sql = "SELECT count(p.rowid) as nb, p.fk_statut as status";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."propal as p";
if (!$user->hasRight('societe', 'client', 'voir')) {
if ($user->socid == 0 && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE p.entity IN (".getEntity($propalstatic->element).")";
@ -234,7 +234,7 @@ function getCustomerProposalPieChart($socid = 0)
if ($user->socid) {
$sql .= ' AND p.fk_soc = '.((int) $user->socid);
}
if (!$user->hasRight('societe', 'client', 'voir')) {
if ($user->socid == 0 && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= " AND p.fk_statut IN (".$db->sanitize(implode(" ,", $listofstatus)).")";

View file

@ -509,14 +509,15 @@ function dolWebsiteSaveContent($content)
/**
* Make a redirect to another container.
*
* @param string $containerref Ref of container to redirect to (Example: 'mypage' or 'mypage.php').
* @param string $containeraliasalt Ref of alternative aliases to redirect to.
* @param int $containerid Id of container.
* @param int<0,1> $permanent 0=Use temporary redirect 302, 1=Use permanent redirect 301
* @param array<string,mixed> $parameters Array of parameters to append to the URL.
* @param string $containerref Ref of container to redirect to (Example: 'mypage' or 'mypage.php').
* @param string $containeraliasalt Ref of alternative aliases to redirect to.
* @param int $containerid Id of container.
* @param int<0,1> $permanent 0=Use temporary redirect 302 (default), 1=Use permanent redirect 301
* @param array<string,mixed> $parameters Array of parameters to append to the URL.
* @param int<0,1> $parampropagation 0=Do not propagate query parameter in URL when doing the redirect, 1=Keep parameters (default)
* @return void
*/
function redirectToContainer($containerref, $containeraliasalt = '', $containerid = 0, $permanent = 0, $parameters = array())
function redirectToContainer($containerref, $containeraliasalt = '', $containerid = 0, $permanent = 0, $parameters = array(), $parampropagation = 1)
{
global $db, $website;
'@phan-var-force Website $website';
@ -572,7 +573,9 @@ function redirectToContainer($containerref, $containeraliasalt = '', $containeri
}
} else { // When page called from virtual host server
$newurl = '/'.$containerref.'.php';
$newurl .= (empty($_SERVER["QUERY_STRING"]) ? '' : '?'.$_SERVER["QUERY_STRING"]);
if ($parampropagation) {
$newurl .= (empty($_SERVER["QUERY_STRING"]) ? '' : '?'.$_SERVER["QUERY_STRING"]);
}
}
if ($newurl) {

View file

@ -209,23 +209,22 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage,
$listofaltlang = $object->otherlang;
// Add the link of the canonical reference
// Note: $object is website, $objectpage is website page
if ($object->virtualhost) {
// Add the link of the canonical reference
$canonicalurladdidlang = '';
if ($objectpage->lang) { // A language is forced on the page, it means we may have other language files with hard links into properties of page
$canonicalurl = (($objectpage->id == $object->fk_default_home) ? '/' : (($shortlangcode != substr($object->lang, 0, 2) ? '/'.$shortlangcode : '').'/'.$objectpage->pageurl.'.php'));
} else { // No language forced, it means the canonical is the one with
} else { // No language forced, it means the canonical is the one with params making url unique
$canonicalurl = '/'.$objectpage->pageurl.'.php';
if ($object->lang && $listofaltlang) {
$tmpshortlangcode = preg_replace('/[_-].*$/', '', $object->lang); // en_US or en-US -> en
// Add parameter ID required to be unique/canonical
$canonicalurladdidlang = '<?php echo GETPOSTINT("id") ? "?id=".GETPOSTINT("id")."&" : (GETPOSTINT("cat") ? "?cat=".GETPOSTINT("cat")."&" : "?") ?>';
$canonicalurladdidlang .= 'l=<?php echo $weblangs->shortlang ? $weblangs->shortlang : "'.$tmpshortlangcode.'"; ?>';
$canonicalurladdidlang = '?__SEO_CANONICAL_URL_PARAMS__';
$canonicalurladdidlang .= '&l=__SEO_CANONICAL_LANG__';
} else {
// Add parameter ID required to be unique/canonical
$canonicalurladdidlang = '<?php echo GETPOSTINT("id") ? "?id=".GETPOSTINT("id") : (GETPOSTINT("cat") ? "?cat=".GETPOSTINT("cat") : "") ?>';
$canonicalurladdidlang = '?__SEO_CANONICAL_URL_PARAMS__';
}
}
@ -278,20 +277,20 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage,
$tplcontent .= '<link rel="alternate" hreflang="'.$shortlangcode.'" href="<?php echo $website->virtualhost; ?>'.(($object->fk_default_home == $objectpage->id) ? '/' : (($shortlangcode != substr($object->lang, 0, 2)) ? '/'.$shortlangcode : '').'/'.$objectpage->pageurl.'.php').'" />'."\n";
$tplcontent .= '<?php } ?>'."\n";
} else {
} else { // No language forced, it means the canonical is the one withparams making url unique
$canonicalurl = '/'.$objectpage->pageurl.'.php';
$arrayofaltlang = explode(',', $listofaltlang);
foreach ($arrayofaltlang as $altlang) {
// Add parameter ID required to be unique/canonical
$canonicalurladdidlang = '<?php echo GETPOSTINT("id") ? "?id=".GETPOSTINT("id")."&" : (GETPOSTINT("cat") ? "?cat=".GETPOSTINT("cat")."&" : "?") ?>';
$canonicalurladdidlang .= 'l='.$altlang;
$canonicalurladdidlang = '?__SEO_CANONICAL_URL_PARAMS__';
$canonicalurladdidlang .= '&l='.$altlang;
$tplcontent .= '<link rel="alternate" hreflang="'.$altlang.'" href="<?php echo $website->virtualhost; ?>'.$canonicalurl.$canonicalurladdidlang.'" />'."\n";
}
$tmpshortlangcode = preg_replace('/[_-].*$/', '', $object->lang); // en_US or en-US -> en
$canonicalurladdidlang = '<?php echo GETPOSTINT("id") ? "?id=".GETPOSTINT("id")."&" : (GETPOSTINT("cat") ? "?cat=".GETPOSTINT("cat")."&" : "?") ?>';
$canonicalurladdidlang .= 'l='.$tmpshortlangcode;
$canonicalurladdidlang = '?__SEO_CANONICAL_URL_PARAMS__';
$canonicalurladdidlang .= '&l='.$tmpshortlangcode;
$tplcontent .= '<link rel="alternate" hreflang="'.$tmpshortlangcode.'" href="<?php echo $website->virtualhost; ?>'.$canonicalurl.$canonicalurladdidlang.'" />'."\n";
}
}
@ -320,29 +319,41 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage,
$tplcontent .= '<?php // BEGIN PHP'."\n";
$tplcontent .= '$tmp = ob_get_contents(); ob_end_clean();'."\n"; // replace with ob_get_clean ?
$tplcontent .= "// Now fix the content for SEO or multilanguage\n";
// Old method for custom SEO
if (strpos($objectpage->content, '$__PAGE__TITLE__') !== false) {
$tplcontent .= '$tmp = preg_replace("/<title>.*?<\/title>/s", "<title>" . dol_escape_htmltag($__PAGE__TITLE__) . "</title>", $tmp);'."\n";
$tplcontent .= '$tmp = preg_replace("/<meta name=\"title\" content=\".*?\" \/>/s", "<meta name=\"title\" content=\"" . dol_string_nohtmltag($__PAGE__TITLE__) . "\" />", $tmp);';
}
if (strpos($objectpage->content, '$__PAGE__KEYWORDS__') !== false) {
$tplcontent .= '$tmp = preg_replace("/<meta name=\"keywords\" content=\".*?\" \/>/s", "<meta name=\"keywords\" content=\"" . dol_string_nohtmltag($__PAGE__KEYWORDS__) . "\" />", $tmp);';
$tplcontent .= '$tmp = preg_replace("/^<meta name=\"keywords\" content=\".*?\" \/>/ms", "<meta name=\"keywords\" content=\"" . dolPrintHTMLForAttribute($__PAGE__KEYWORDS__, 1) . "\" />", $tmp);'."\n";
}
if (strpos($objectpage->content, '$__PAGE__TITLE__') !== false) {
$tplcontent .= '$tmp = preg_replace("/^<title>.*?<\/title>/ms", "<title>" . dolPrintHTMLForAttribute($__PAGE__TITLE__, 1) . "</title>", $tmp);'."\n";
$tplcontent .= '$tmp = preg_replace("/^<meta name=\"title\" content=\".*?\" \/>/ms", "<meta name=\"title\" content=\"" . dolPrintHTMLForAttribute($__PAGE__TITLE__, 1) . "\" />", $tmp);'."\n";
}
if (strpos($objectpage->content, '$__PAGE__DESC__') !== false) {
$tplcontent .= '$tmp = preg_replace("/<meta name=\"description\" content=\".*?\" \/>/s", "<meta name=\"description\" content=\"" . dol_string_nohtmltag($__PAGE__DESC__) . "\" />", $tmp);';
$tplcontent .= '$tmp = preg_replace("/^<meta name=\"description\" content=\".*?\" \/>/ms", "<meta name=\"description\" content=\"" . dolPrintHTMLForAttribute($__PAGE__DESC__, 1) . "\" />", $tmp);'."\n";
}
// New method for custom SEO
if (strpos($objectpage->content, 'define("__SEO_PAGE_TITLE__"') !== false) {
$tplcontent .= '$tmp = preg_replace("/<title>.*?<\/title>/s", "<title>" . dol_escape_htmltag(constant("__SEO_PAGE_TITLE__")) . "</title>", $tmp);'."\n";
$tplcontent .= '$tmp = preg_replace("/<meta name=\"title\" content=\".*?\" \/>/s", "<meta name=\"title\" content=\"" . dol_string_nohtmltag(constant("__SEO_PAGE_TITLE__")) . "\" />", $tmp);';
if (strpos($objectpage->content, 'define("__SEO_PAGE_LANG__"') !== false) {
$tmpshortlangcode = preg_replace('/[_-].*$/', '', $object->lang); // en_US or en-US -> en
$tplcontent .= '$tmp = preg_replace("/^<html lang=\"[a-z]+\"/ms", "<html lang=\"" . dolPrintHTMLForAttribute(defined("__SEO_PAGE_LANG__") ? preg_replace(\'/\[_-\].*$/\', "", constant("__SEO_PAGE_LANG__")) : (empty($weblangs->shortlang) ? "'.$tmpshortlangcode.'" : $weblangs->shortlang), 1) . "\"", $tmp);'."\n";
}
if (strpos($objectpage->content, 'define("__SEO_PAGE_KEYWORDS__"') !== false) {
$tplcontent .= '$tmp = preg_replace("/<meta name=\"keywords\" content=\".*?\" \/>/s", "<meta name=\"keywords\" content=\"" . dol_string_nohtmltag(constant("__SEO_PAGE_KEYWORDS__")) . "\" />", $tmp);';
$tplcontent .= '$tmp = preg_replace("/^<meta name=\"keywords\" content=\".*?\" \/>/ms", "<meta name=\"keywords\" content=\"" . dolPrintHTMLForAttribute(constant("__SEO_PAGE_KEYWORDS__"), 1) . "\" />", $tmp);'."\n";
}
if (strpos($objectpage->content, 'define("__SEO_PAGE_TITLE__"') !== false) {
$tplcontent .= '$tmp = preg_replace("/^<title>.*?<\/title>/ms", "<title>" . dolPrintHTMLForAttribute(constant("__SEO_PAGE_TITLE__"), 1) . "</title>", $tmp);'."\n";
$tplcontent .= '$tmp = preg_replace("/^<meta name=\"title\" content=\".*?\" \/>/ms", "<meta name=\"title\" content=\"" . dolPrintHTMLForAttribute(constant("__SEO_PAGE_TITLE__"), 1) . "\" />", $tmp);'."\n";
}
if (strpos($objectpage->content, 'define("__SEO_PAGE_DESC__"') !== false) {
$tplcontent .= '$tmp = preg_replace("/<meta name=\"description\" content=\".*?\" \/>/s", "<meta name=\"description\" content=\"" . dol_string_nohtmltag(constant("__SEO_PAGE_DESC__")) . "\" />", $tmp);';
$tplcontent .= '$tmp = preg_replace("/^<meta name=\"description\" content=\".*?\" \/>/ms", "<meta name=\"description\" content=\"" . dolPrintHTMLForAttribute(constant("__SEO_PAGE_DESC__"), 1) . "\" />", $tmp);'."\n";
}
if (empty($objectpage->lang)) { // We may need to use param into the canonical url
$tplcontent .= 'defined("__SEO_CANONICAL_URL_PARAMS__") ? ($tmp = preg_replace("/__SEO_CANONICAL_URL_PARAMS__/", dolPrintHTMLForAttributeUrl(constant("__SEO_CANONICAL_URL_PARAMS__")), $tmp)) : ($tmp = preg_replace("/\?__SEO_CANONICAL_URL_PARAMS__\"/", "", preg_replace("/\?__SEO_CANONICAL_URL_PARAMS__&/", "?", $tmp)));'."\n";
$tmpshortlangcode = preg_replace('/[_-].*$/', '', $object->lang); // en_US or en-US -> en
$tplcontent .= '$tmp = preg_replace("/__SEO_CANONICAL_LANG__/", (defined("__SEO_PAGE_LANG__") ? preg_replace(\'/\[_-\].*$/\', "", constant("__SEO_PAGE_LANG__")) : (empty($weblangs->shortlang) ? "'.$tmpshortlangcode.'" : $weblangs->shortlang)), $tmp);'."\n";
}
$tplcontent .= "// Now output the generated page content\n";
$tplcontent .= 'dolWebsiteOutput($tmp, "html", '.((int) $objectpage->id).'); dolWebsiteIncrementCounter('.((int) $object->id).', "'.$objectpage->type_container.'", '.((int) $objectpage->id).');'."\n";
$tplcontent .= "// END PHP ?>\n";
} else {

View file

@ -1,9 +1,10 @@
<?php
/*
* Copyright (C) 2014-2016 Jean-François Ferry <hello@librethic.io>
* 2016 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2023 Benjamin Falière <benjamin.faliere@altairis.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2025 Frédéric France <frederic.france@free.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
@ -178,7 +179,8 @@ class InterfaceTicketEmail extends DolibarrTriggers
if (!getDolGlobalString('TICKET_DISABLE_ALL_MAILS')) {
// Send email to assigned user
$sendto = $userstat->email;
$old_MAIN_MAIL_AUTOCOPY_TO = null;
$old_MAIN_MAIL_AUTOCOPY_TO = '';
if (!getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO')) {
$old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO;
$conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
@ -193,8 +195,7 @@ class InterfaceTicketEmail extends DolibarrTriggers
}
}
} else {
$this->error = $userstat->error;
$this->errors = $userstat->errors;
$this->setErrorsFromObject($userstat);
}
}

View file

@ -1360,7 +1360,11 @@ if ($action == 'create') {
$deliverableQty = GETPOSTINT('qtyl'.$indiceAsked);
}
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
print '<input name="qtyl'.$indiceAsked.'" id="qtyl'.$indiceAsked.'" class="qtyl right" type="text" size="4" value="'.$deliverableQty.'">';
$qtylValue = $deliverableQty;
if (getDolGlobalBool('SHIPMENT_DONT_PREFILL_QTY', false)) {
$qtylValue = '';
}
print '<input name="qtyl'.$indiceAsked.'" id="qtyl'.$indiceAsked.'" class="qtyl right" type="text" size="4" value="'.$qtylValue.'">';
} else {
if (getDolGlobalString('SHIPMENT_GETS_ALL_ORDER_PRODUCTS')) {
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
@ -1491,7 +1495,11 @@ if ($action == 'create') {
print '<!-- subj='.$subj.'/'.$nbofsuggested.' --><tr '.((($subj + 1) == $nbofsuggested) ? 'oddeven' : '').'>';
print '<td colspan="3" ></td><td class="center">';
print '<input class="qtyl '.$tooltipClass.' right" title="'.$tooltipTitle.'" name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="'.$deliverableQty.'">';
$qtylValue = $deliverableQty;
if (getDolGlobalBool('SHIPMENT_DONT_PREFILL_QTY', false)) {
$qtylValue = '';
}
print '<input class="qtyl '.$tooltipClass.' right" title="'.$tooltipTitle.'" name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="'.$qtylValue.'">';
print '</td>';
print '<!-- Show details of lot -->';
@ -1604,8 +1612,11 @@ if ($action == 'create') {
if (GETPOSTISSET($inputName)) {
$deliverableQty = GETPOSTINT($inputName);
}
print '<input class="qtyl'.$tooltipClass.' right" title="'.$tooltipTitle.'" name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'" type="text" size="4" value="'.$deliverableQty.'">';
$qtylValue = $deliverableQty;
if (getDolGlobalBool('SHIPMENT_DONT_PREFILL_QTY', false)) {
$qtylValue = '';
}
print '<input class="qtyl'.$tooltipClass.' right" title="'.$tooltipTitle.'" name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'" type="text" size="4" value="'.$qtylValue.'">';
print '<input name="ent1'.$indiceAsked.'_'.$subj.'" type="hidden" value="'.$warehouse_id.'">';
} else {
if (getDolGlobalString('SHIPMENT_GETS_ALL_ORDER_PRODUCTS')) {
@ -1729,7 +1740,11 @@ if ($action == 'create') {
$alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)] = $deliverableQty + $alreadyQtyBatchSetted[$line->fk_product][$dbatch->batch][intval($warehouse_id)];
print '<!-- subj='.$subj.'/'.$nbofsuggested.' --><tr '.((($subj + 1) == $nbofsuggested) ? 'oddeven' : '').'><td colspan="3"></td><td class="center">';
print '<input class="qtyl right '.$tooltipClass.'" title="'.$tooltipTitle.'" name="'.$inputName.'" id="'.$inputName.'" type="text" size="4" value="'.$deliverableQty.'">';
$qtylValue = $deliverableQty;
if (getDolGlobalBool('SHIPMENT_DONT_PREFILL_QTY', false)) {
$qtylValue = '';
}
print '<input class="qtyl right '.$tooltipClass.'" title="'.$tooltipTitle.'" name="'.$inputName.'" id="'.$inputName.'" type="text" size="4" value="'.$qtylValue.'">';
print '</td>';
print '<td class="left">';

View file

@ -114,7 +114,7 @@ class FichinterStats extends Stats
$sql = "SELECT date_format(c.date_valid,'%m') as dm, COUNT(*) as nb";
$sql .= " FROM ".$this->from;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.date_valid BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
@ -138,7 +138,7 @@ class FichinterStats extends Stats
$sql = "SELECT date_format(c.date_valid,'%Y') as dm, COUNT(*) as nb, 0";
$sql .= " FROM ".$this->from;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE ".$this->where;
@ -161,7 +161,7 @@ class FichinterStats extends Stats
$sql = "SELECT date_format(c.date_valid,'%m') as dm, 0";
$sql .= " FROM ".$this->from;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.date_valid BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
@ -185,7 +185,7 @@ class FichinterStats extends Stats
$sql = "SELECT date_format(c.date_valid,'%m') as dm, 0";
$sql .= " FROM ".$this->from;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.date_valid BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
@ -207,7 +207,7 @@ class FichinterStats extends Stats
$sql = "SELECT date_format(c.date_valid,'%Y') as year, COUNT(*) as nb, 0 as total, 0 as avg";
$sql .= " FROM ".$this->from;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE ".$this->where;

View file

@ -307,7 +307,7 @@ $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= ", ".MAIN_DB_PREFIX."societe as s";

View file

@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
*/
class Fournisseur extends Societe
{
public $next_prev_filter = "te.fournisseur:=:1"; // Used to add a filter in Form::showrefnav method
public $next_prev_filter = "(te.fournisseur:=:1)"; // Used to add a filter in Form::showrefnav method
/**

View file

@ -3284,7 +3284,7 @@ class CommandeFournisseur extends CommonOrder
$sql = "SELECT count(co.rowid) as nb";
$sql .= " FROM ".$this->db->prefix()."commande_fournisseur as co";
$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON co.fk_soc = s.rowid";
if (!$user->hasRight("societe", "client", "voir") && !$user->socid) {
if (empty($user->socid) && !$user->hasRight("societe", "client", "voir") && !$user->socid) {
$sql .= " LEFT JOIN ".$this->db->prefix()."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
$clause = "AND";
@ -3320,7 +3320,7 @@ class CommandeFournisseur extends CommonOrder
$sql = "SELECT c.rowid, c.date_creation as datec, c.date_commande, c.fk_statut, c.date_livraison as delivery_date, c.total_ht";
$sql .= " FROM ".$this->db->prefix()."commande_fournisseur as c";
if (!$user->hasRight("societe", "client", "voir") && !$user->socid) {
if (empty($user->socid) && !$user->hasRight("societe", "client", "voir") && !$user->socid) {
$sql .= " JOIN ".$this->db->prefix()."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= " WHERE c.entity = ".$conf->entity;

View file

@ -2715,7 +2715,7 @@ class FactureFournisseur extends CommonInvoice
$sql = 'SELECT ff.rowid, ff.date_lim_reglement as datefin, ff.fk_statut as status, ff.total_ht, ff.total_ttc';
$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as ff';
if (!$user->hasRight("societe", "client", "voir") && !$user->socid) {
if (empty($user->socid) && !$user->hasRight("societe", "client", "voir")) {
$sql .= " JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ff.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= ' WHERE ff.paye = 0';
@ -3135,7 +3135,7 @@ class FactureFournisseur extends CommonInvoice
$sql = "SELECT count(f.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";
if (!$user->hasRight("societe", "client", "voir") && !$user->socid) {
if (empty($user->socid) && !$user->hasRight("societe", "client", "voir")) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
$clause = "AND";

View file

@ -234,7 +234,8 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
$error = 0;
if (!$user->hasRight('societe', 'client', 'voir')) {
// Check only if it's an internal user
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$search_sale = $user->id;
}
@ -534,6 +535,7 @@ if (empty($reshook)) {
}
$tva_tx = $lines[$i]->tva_tx;
// @phan-suppress-next-line PhanTypeMismatchArgumentInternal
if (!empty($lines[$i]->vat_src_code) && !preg_match('/\(/', (string) $tva_tx)) {
$tva_tx .= ' ('.$lines[$i]->vat_src_code.')';
}

View file

@ -1347,6 +1347,7 @@ if (empty($reshook)) {
}
$tva_tx = $lines[$i]->tva_tx;
// @phan-suppress-next-line PhanTypeMismatchArgumentInternal
if (!empty($lines[$i]->vat_src_code) && !preg_match('/\(/', (string) $tva_tx)) {
$tva_tx .= ' ('.$lines[$i]->vat_src_code.')';
}

View file

@ -236,7 +236,8 @@ if ((!$user->hasRight("fournisseur", "facture", "lire") && !getDolGlobalString('
accessforbidden();
}
if (!$user->hasRight('societe', 'client', 'voir')) {
// Check only if it' an internal user
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$search_sale = $user->id;
}
@ -317,7 +318,6 @@ if (empty($reshook)) {
$search_categ_sup = 0;
$filter = '';
$option = '';
$socid = "";
}
// Mass actions

View file

@ -246,7 +246,7 @@ $holidaystatic = new Holiday($db);
// Update sold
$result = $object->updateBalance();
$title = $langs->trans('CPTitreMenu');
$title = $langs->trans('Holidays');
$help_url = 'EN:Module_Holiday';
llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'bodyforlist mod-holiday page-list');
@ -542,9 +542,6 @@ if ($id > 0) { // For user tab
print '</div>';
} else {
$title = $langs->trans("ListeCP");
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition'));

View file

@ -349,7 +349,7 @@ ALTER TABLE llx_societe_commerciaux ADD COLUMN fk_c_type_contact_code varchar(32
-- VPGSQL8.2 DROP INDEX uk_societe_commerciaux;
ALTER TABLE llx_societe_commerciaux ADD UNIQUE INDEX uk_societe_commerciaux_c_type_contact (fk_soc, fk_user, fk_c_type_contact_code);
ALTER TABLE llx_c_type_contact ADD INDEX idx_c_type_contact_code (code);
--Removed, not unique. ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_c_type_contact_code FOREIGN KEY (fk_c_type_contact_code) REFERENCES llx_c_type_contact(code);
-- Removed, not unique. ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_c_type_contact_code FOREIGN KEY (fk_c_type_contact_code) REFERENCES llx_c_type_contact(code);
ALTER TABLE llx_societe_commerciaux DROP FOREIGN KEY fk_societe_commerciaux_fk_c_type_contact_code;
ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid);
ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_user FOREIGN KEY (fk_user) REFERENCES llx_user(rowid);
@ -363,7 +363,7 @@ ALTER TABLE llx_ecm_files DROP column keyword;
ALTER TABLE llx_c_type_container ADD COLUMN typecontainer varchar(10) DEFAULT 'page';
UPDATE llx_c_type_container SET typecontainer = 'container' WHERE code IN ('banner', 'other', 'menu');
--UPDATE llx_c_type_container SET typecontainer = 'page' WHERE code IN ('page', 'blogpost');
-- UPDATE llx_c_type_container SET typecontainer = 'page' WHERE code IN ('page', 'blogpost');
UPDATE llx_c_type_container SET position = 10 WHERE code IN ('page');
UPDATE llx_c_type_container SET position = 20 WHERE code IN ('blogpost');
@ -413,7 +413,7 @@ ALTER TABLE llx_hrm_evaluation ADD COLUMN entity INTEGER DEFAULT 1 NOT NULL;
-- Error SQL DB_ERROR_1170 BLOB/TEXT column 'url' used in key specification without a key length, so we remove completely the unique key
ALTER TABLE llx_menu DROP INDEX idx_menu_uk_menu;
ALTER TABLE llx_menu MODIFY COLUMN url TEXT NOT NULL;
--ALTER TABLE llx_menu ADD UNIQUE INDEX idx_menu_uk_menu (menu_handler, fk_menu, position, entity, url);
-- ALTER TABLE llx_menu ADD UNIQUE INDEX idx_menu_uk_menu (menu_handler, fk_menu, position, entity, url);
UPDATE llx_c_units SET short_label = 'mn' WHERE short_label = 'i' AND code = 'MI';

View file

@ -1806,6 +1806,7 @@ SendingsNumberingModules=Sendings numbering modules
SendingsAbility=Support shipping sheets for customer deliveries
NoNeedForDeliveryReceipts=In most cases, shipping sheets are used both as sheets for customer deliveries (list of products to send) and sheets that are received and signed by customer. Hence the product deliveries receipt is a duplicated feature and is rarely activated.
FreeLegalTextOnShippings=Free text on shipments
DontPrefillShipmentQty = Don't prefill lines quantities at shipment creation
##### Deliveries #####
DeliveryOrderNumberingModules=Products deliveries receipt numbering module
DeliveryOrderModel=Products deliveries receipt model

View file

@ -1800,6 +1800,7 @@ SendingsNumberingModules=Modèles de numérotation des expéditions
SendingsAbility=Prise en charge des bons d'expédition pour les livraisons clients
NoNeedForDeliveryReceipts=Dans le plupart des cas, la fiche expédition est utilisée en tant que bon d'expédition (liste des produits expédiés) et bon de livraison (signée par le client). Le bon de réception est un doublon de fonctionnalité et est rarement utilisé.
FreeLegalTextOnShippings=Mention complémentaire sur les expéditions
DontPrefillShipmentQty = Ne pas pré-remplir les quantités des lignes à la création d'une expédition
##### Deliveries #####
DeliveryOrderNumberingModules=Modèle de numérotation des bons de réception client
DeliveryOrderModel=Modèle de bon de réception client

View file

@ -1,7 +1,7 @@
# Dolibarr language file - Source file is en_US - holiday
HRM=GRH
Holidays=Congés
Holiday=Demande de congés
Holiday=Congés
CPTitreMenu=Demande de congés
MenuReportMonth=État mensuel
MenuAddCP=Créer demande de congés

View file

@ -3,7 +3,7 @@
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2015-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2016-2025 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
@ -32,10 +32,9 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/loan.lib.php';
if (isModEnabled('project')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
}
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
/**
* @var Conf $conf
* @var DoliDB $db
@ -84,9 +83,6 @@ if (empty($reshook)) {
$morehtmlright = '';
$form = new Form($db);
if (isModEnabled('project')) {
$formproject = new FormProjets($db);
}
$title = $langs->trans("Loan").' - '.$langs->trans("Notes");
$help_url = 'EN:Module_Loan|FR:Module_Emprunt';
@ -109,6 +105,7 @@ if ($id > 0) {
$morehtmlref .= $form->editfieldval("Label", 'label', $object->label, $object, 0, 'string', '', null, null, '', 1);
// Project
if (isModEnabled('project')) {
$formproject = new FormProjets($db);
$langs->loadLangs(array("projects"));
$morehtmlref .= '<br>'.$langs->trans('Project').' : ';
if ($user->hasRight('loan', 'write')) {

View file

@ -168,6 +168,7 @@ if ($id > 0 || !empty($ref)) {
print dol_get_fiche_head($head, 'margin', $titre, -1, $picto);
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter = "(te.fk_product_type:=:".((int) $object->type).")";
dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref');

View file

@ -170,7 +170,7 @@ $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product');
print dol_get_fiche_head($head, 'agenda', $titre, -1, $picto);
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1&type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter = "fk_product_type:=:".((int) $object->type); // usf filter
$object->next_prev_filter = "(te.fk_product_type:=:".((int) $object->type).")";
$shownav = 1;
if ($user->socid && !in_array('product', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) {

View file

@ -15,6 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* @var Conf $conf
* @var Translate $langs
@ -39,7 +40,7 @@ $titre = $langs->trans("CardProduct".$object->type);
print dol_get_fiche_head($head, 'card', $titre, -1, 'product');
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1&type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter = "fk_product_type:=:".((int) $object->type); // usf filter
$object->next_prev_filter = "(te.fk_product_type:=:".((int) $object->type).")";
$shownav = 1;
if ($user->socid && !in_array('product', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) {

View file

@ -39,7 +39,7 @@ $titre = $langs->trans("CardProduct".$object->type);
print dol_get_fiche_head($head, 'card', $titre, -1, 'service');
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1&type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter = " fk_product_type:=:".((int) $object->type);
$object->next_prev_filter = "(te.fk_product_type:=:".((int) $object->type).")";
$shownav = 1;
if ($user->socid && !in_array('product', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) {

View file

@ -2528,7 +2528,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
print dol_get_fiche_head($head, 'card', $titre, -1, $picto, 0, '', '', 0, '', 1);
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1&type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter = "fk_product_type:=:".((int) $object->type);
$object->next_prev_filter = "(te.fk_product_type:=:".((int) $object->type).")";
$shownav = 1;
if ($user->socid && !in_array('product', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) {

View file

@ -248,7 +248,7 @@ if ($object->id > 0) {
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1&type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter = "fk_product_type:=:".((int) $object->type); // usf filter
$object->next_prev_filter = "(te.fk_product_type:=:".((int) $object->type).")";
$shownav = 1;
if ($user->socid && !in_array('product', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) {

View file

@ -170,7 +170,7 @@ $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product');
print dol_get_fiche_head($head, 'agenda', $titre, -1, $picto);
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1&type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter = "fk_product_type:=:".((int) $object->type); // usf filter
$object->next_prev_filter = "(te.fk_product_type:=:".((int) $object->type).")";
$shownav = 1;
if ($user->socid && !in_array('product', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) {

View file

@ -130,7 +130,7 @@ if ($id > 0 || !empty($ref)) {
print dol_get_fiche_head($head, 'note', $titre, -1, $picto);
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1&type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter = "fk_product_type:=:".((int) $object->type); // usf filter
$object->next_prev_filter = "(te.fk_product_type:=:".((int) $object->type).")";
$shownav = 1;
if ($user->socid && !in_array('product', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) {

View file

@ -1007,7 +1007,7 @@ $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product');
print dol_get_fiche_head($head, 'price', $titre, -1, $picto);
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1&type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter = "fk_product_type:=:".((int) $object->type);
$object->next_prev_filter = "(te.fk_product_type:=:".((int) $object->type).")";
$shownav = 1;
if ($user->socid && !in_array('product', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) {

View file

@ -403,7 +403,7 @@ if ($id > 0 || $ref) {
print dol_get_fiche_head($head, 'suppliers', $titre, -1, $picto);
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1&type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter = "fk_product_type:=:".((int) $object->type); // usf filter
$prod->next_prev_filter = "(te.fk_product_type:=:".((int) $object->type).")"; // use $prod instead $object
$shownav = 1;
if ($user->socid && !in_array('product', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) {

View file

@ -159,6 +159,7 @@ if ($result && ($id > 0 || !empty($ref)) && empty($notab)) {
print dol_get_fiche_head($head, 'stats', $titre, -1, $picto);
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1&type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter = "(te.fk_product_type:=:".((int) $object->type).")";
dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', '', '', '', 0, '', '', 1);

View file

@ -178,6 +178,7 @@ if ($id > 0 || !empty($ref)) {
}
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1&type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter = "(te.fk_product_type:=:".((int) $object->type).")";
$shownav = 1;
if ($user->socid && !in_array('product', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) {

View file

@ -208,6 +208,7 @@ $form = new Form($db);
$warehouse = new Entrepot($db);
$now = dol_now();
$totalarray = array();
$title = $langs->trans("Warehouses");
$help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:M&oacute;dulo_Stocks';
@ -624,7 +625,6 @@ if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
}
print '</tr>'."\n";
$totalarray = array();
$totalarray['nbfield'] = 0;
// Fields title label

View file

@ -624,6 +624,7 @@ if ($id > 0 || $ref) {
dol_htmloutput_events();
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1&type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter = "(te.fk_product_type:=:".((int) $object->type).")";
$shownav = 1;
if ($user->socid && !in_array('stock', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) {

View file

@ -1772,9 +1772,7 @@ class Project extends CommonObject
// Load source object
$clone_project->fetch($fromid);
$clone_project->fetch_optionals();
if ($newthirdpartyid > 0) {
$clone_project->socid = $newthirdpartyid;
}
$clone_project->socid = ($newthirdpartyid > 0 ? $newthirdpartyid : 0);
$clone_project->fetch_thirdparty();
$orign_dt_start = $clone_project->date_start;

View file

@ -169,7 +169,6 @@ $ErrorCode = $ErrorShortMsg = $ErrorLongMsg = $ErrorSeverityCode = '';
$object = new stdClass(); // For triggers
/** @var CommonObject $object */
$error = 0;

View file

@ -1566,8 +1566,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
print '</td></tr></table>';
print '</td>';
// Supplier code
if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) {
if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD')) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))
|| (isModEnabled('supplier_proposal') && $user->hasRight('supplier_proposal', 'lire'))) {
if ($conf->browser->layout == 'phone') {
print '<td colspan="2"></td>';
print '</tr><tr>';

View file

@ -162,6 +162,12 @@ class SocieteAccount extends CommonObject
* @var string
*/
public $site;
/**
* @var int
*/
public $fk_website;
/**
* @var ?string
*/

View file

@ -131,7 +131,7 @@ if (!$rowid) {
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'left ');
print_liste_field_titre("Paid", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", '', '', '', 'right ');
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", '', '', '', 'center ');
print "</tr>\n";
try {
@ -228,7 +228,7 @@ if (!$rowid) {
if ($servicestatus) {
$url = 'https://dashboard.stripe.com/'.$connect.'payments/'.$charge->id;
}
print "<td>";
print '<td class="tdoverflowmax150">';
print "<a href='".$url."' target='_stripe'>".img_picto($langs->trans('ShowInStripe'), 'globe')." ".$charge->id."</a>";
if ($charge->payment_intent) {
print '<br><span class="opacitymedium">'.$charge->payment_intent.'</span>';
@ -236,7 +236,7 @@ if (!$rowid) {
print "</td>\n";
// Stripe customer
print "<td>";
print '<td class="tdoverflowmax150">';
if (isModEnabled('stripe') && !empty($stripeacc)) {
$connect = $stripeacc.'/';
}
@ -250,7 +250,7 @@ if (!$rowid) {
print "</td>\n";
// Link
print "<td>";
print '<td class="tdoverflowmax200">';
if ($societestatic->id > 0) {
print $societestatic->getNomUrl(1);
} elseif ($memberstatic->id > 0) {
@ -259,7 +259,7 @@ if (!$rowid) {
print "</td>\n";
// Origin
print "<td>";
print '<td class="nowraponall">';
if ($charge->metadata->dol_type == "order" || $charge->metadata->dol_type == "commande") {
$object = new Commande($db);
$object->fetch($charge->metadata->dol_id);
@ -282,7 +282,7 @@ if (!$rowid) {
print "</td>\n";
// Date payment
print '<td class="center">'.dol_print_date($charge->created, 'dayhour')."</td>\n";
print '<td class="center nowraponall">'.dol_print_date($charge->created, 'dayhour')."</td>\n";
// Type
print '<td>';
print $type;
@ -290,7 +290,7 @@ if (!$rowid) {
// Amount
print '<td class="right"><span class="amount">'.price(($charge->amount - $charge->amount_refunded) / 100, 0, '', 1, - 1, - 1, strtoupper($charge->currency))."</span></td>";
// Status
print '<td class="right">';
print '<td class="nowraponall">';
print $status;
print "</td>\n";

View file

@ -1992,7 +1992,7 @@ class SupplierProposal extends CommonObject
$ga = array();
$search_sale = 0;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$search_sale = $user->id;
}
@ -2261,7 +2261,7 @@ class SupplierProposal extends CommonObject
public function load_board($user, $mode)
{
// phpcs:enable
global $conf, $user, $langs;
global $conf, $langs;
$now = dol_now();
@ -2269,7 +2269,7 @@ class SupplierProposal extends CommonObject
$sql = "SELECT p.rowid, p.ref, p.datec as datec, p.date_cloture as datefin";
$sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc";
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
$clause = " AND";
@ -2427,7 +2427,7 @@ class SupplierProposal extends CommonObject
$sql = "SELECT count(p.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
$clause = "AND";

View file

@ -74,8 +74,8 @@ $mode = GETPOST('mode', 'alpha');
$search_user = GETPOST('search_user', 'intcomma');
$search_sale = GETPOST('search_sale', 'intcomma');
$search_ref = GETPOST('sf_ref') ? GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha');
$search_societe = GETPOST('search_societe', 'alpha');
$search_societe_alias = GETPOST('search_societe_alias', 'alpha');
$search_company = GETPOST('search_company', 'alpha');
$search_company_alias = GETPOST('search_company_alias', 'alpha');
$search_login = GETPOST('search_login', 'alpha');
$search_town = GETPOST('search_town', 'alpha');
$search_zip = GETPOST('search_zip', 'alpha');
@ -208,7 +208,8 @@ $object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
if (!$user->hasRight('societe', 'client', 'voir')) {
// Check only if it's an internal user
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$search_sale = $user->id;
}
@ -246,8 +247,8 @@ if (empty($reshook)) {
$search_user = '';
$search_sale = '';
$search_ref = '';
$search_societe = '';
$search_societe_alias = '';
$search_company = '';
$search_company_alias = '';
$search_montant_ht = '';
$search_montant_vat = '';
$search_montant_ttc = '';
@ -304,6 +305,14 @@ $formcompany = new FormCompany($db);
$now = dol_now();
if ($socid > 0) {
$soc = new Societe($db);
$soc->fetch($socid);
if (empty($search_company)) {
$search_company = $soc->name;
}
}
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
@ -372,14 +381,14 @@ if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
if ($search_ref) {
$sql .= natural_search('sp.ref', $search_ref);
}
if (empty($arrayfields['s.name_alias']['checked']) && $search_societe) {
$sql .= natural_search(array("s.nom", "s.name_alias"), $search_societe);
if (empty($arrayfields['s.name_alias']['checked']) && $search_company) {
$sql .= natural_search(array("s.nom", "s.name_alias"), $search_company);
} else {
if ($search_societe) {
$sql .= natural_search('s.nom', $search_societe);
if ($search_company) {
$sql .= natural_search('s.nom', $search_company);
}
if ($search_societe_alias) {
$sql .= natural_search('s.name_alias', $search_societe_alias);
if ($search_company_alias) {
$sql .= natural_search('s.name_alias', $search_company_alias);
}
}
if ($search_login) {
@ -581,11 +590,11 @@ if ($resql) {
if ($search_ref) {
$param .= '&search_ref='.urlencode($search_ref);
}
if ($search_societe) {
$param .= '&search_societe='.urlencode($search_societe);
if ($search_company) {
$param .= '&search_company='.urlencode($search_company);
}
if ($search_societe_alias) {
$param .= '&search_societe_alias='.urlencode($search_societe_alias);
if ($search_company_alias) {
$param .= '&search_company_alias='.urlencode($search_company_alias);
}
if ($search_user > 0) {
$param .= '&search_user='.urlencode((string) ($search_user));
@ -752,12 +761,12 @@ if ($resql) {
}
if (!empty($arrayfields['s.nom']['checked'])) {
print '<td class="liste_titre left">';
print '<input class="flat" type="text" size="12" name="search_societe" value="'.dol_escape_htmltag($search_societe).'">';
print '<input class="flat" type="text" size="12" name="search_company" value="'.dol_escape_htmltag($search_company).'">';
print '</td>';
}
if (!empty($arrayfields['s.name_alias']['checked'])) {
print '<td class="liste_titre left">';
print '<input class="flat" type="text" size="12" name="search_societe_alias" value="'.dol_escape_htmltag($search_societe_alias).'">';
print '<input class="flat" type="text" size="12" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).'">';
print '</td>';
}
if (!empty($arrayfields['s.town']['checked'])) {

View file

@ -2932,11 +2932,11 @@ img.photorefnoborder {
display:none;
<?php } else { ?>
background: var(--colorbackhmenu1);
/* background-image: linear-gradient(-45deg, <?php echo colorAdjustBrightness(colorArrayToHex(colorStringToArray($colorbackhmenu1)), '5'); ?>, var(--colorbackhmenu1)); */
<?php if ($colorbackhmenu1 == '255,255,255') { ?>
box-shadow: 0px 0px 4px #ddd;
<?php } ?>
<?php } ?>
<?php if ($colorbackhmenu1 == $colorbackbody) { ?>
border-bottom: 1px solid var(--colorbackgrey);
box-shadow: 0 0 3px var(--colorbackgrey);
<?php } else { ?>
<?php } } ?>
}
div#tmenu_tooltip {
@ -6138,6 +6138,7 @@ table.cal_month { border-spacing: 0px; }
table.cal_month td:first-child { border-left: 0px; }
table.cal_month td:last-child { border-right: 0px; }
table.cal_month td { padding-left: 1px !important; padding-right: 1px !important; }
table.cal_month.cal_peruser td { padding-left: 0 !important; padding-right: 0 !important; }
.cal_current_month { border-top: 0; border-left: solid 1px #E0E0E0; border-right: 0; border-bottom: solid 1px #E0E0E0; }
.cal_current_month_peruserleft { border-top: 0; border-left: solid 2px #6C7C7B; border-right: 0; border-bottom: solid 1px #E0E0E0; }
.cal_current_month_oneday { border-right: solid 1px #E0E0E0; }
@ -6153,7 +6154,7 @@ table.cal_month td { padding-left: 1px !important; padding-right: 1px !important
.cal_today_peruser { background: #FDFDF0; border-right: solid 1px #E0E0E0; border-bottom: solid 1px #E0E0E0; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
.cal_today_peruser_peruserleft { background: #FDFDF0; border-left: solid 2px #6C7C7B; border-right: solid 1px #E0E0E0; border-bottom: solid 1px #E0E0E0; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 1px; padding-top: 0px; padding-bottom: 0px; }
.cal_past { }
.cal_peruser { padding-top: 0 !important; padding-bottom: 0 !important; padding-<?php print $left; ?>: 1px !important; padding-<?php print $right; ?>: 1px !important; }
.cal_peruser { padding-top: 0 !important; padding-bottom: 0 !important; padding-<?php print $left; ?>: 0 !important; padding-<?php print $right; ?>: 0 !important; }
.cal_impair {
background: linear-gradient(bottom, var(--colorbacklinepair2) 85%, var(--colorbacklinepair2) 100%);
background: -o-linear-gradient(bottom, var(--colorbacklinepair2) 85%, var(--colorbacklinepair2) 100%);
@ -6190,10 +6191,12 @@ td.small.cal_event {
td.cal_other_month {
opacity: 0.7;
}
td.event-past span {
opacity: 0.5;
}
td.peruser_holiday_imp {
background-color: #aaa !important;
}
.cal_available { background: #0060d450; }
.cal_chosen { background: #0060d4; }

View file

@ -6067,6 +6067,8 @@ span.websitebuttonsitepreviewdisabled img, a.websitebuttonsitepreviewdisabled im
table.cal_month { border-spacing: 0px; }
table.cal_month td:first-child { border-left: 0px; }
table.cal_month td:last-child { border-right: 0px; }
table.cal_month td { padding-left: 1px !important; padding-right: 1px !important; }
table.cal_month.cal_peruser td { padding-left: 0 !important; padding-right: 0 !important; }
.cal_current_month { border-top: 0; border-left: solid 1px #E0E0E0; border-right: 0; border-bottom: solid 1px #E0E0E0; }
.cal_current_month_peruserleft { border-top: 0; border-left: solid 2px #6C7C7B; border-right: 0; border-bottom: solid 1px #E0E0E0; }
.cal_current_month_oneday { border-right: solid 1px #E0E0E0; }
@ -6115,6 +6117,12 @@ td.small.cal_event {
td.cal_other_month {
opacity: 0.7;
}
td.event-past span {
opacity: 0.5;
}
td.peruser_holiday_imp {
background-color: #aaa !important;
}
.cal_available { background: #0060d450; }
.cal_chosen { background: #0060d4; }

View file

@ -890,7 +890,7 @@ class Ticket extends CommonObject
$socid = $user->socid ?: 0;
// If the internal user must only see his customers, force searching by him
$search_sale = 0;
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$search_sale = $user->id;
}
// Search on sale representative
@ -3156,7 +3156,7 @@ class Ticket extends CommonObject
$sql = "SELECT p.rowid, p.ref, p.datec as datec";
$sql .= " FROM ".MAIN_DB_PREFIX."ticket as p";
if (isModEnabled('societe') && !$user->hasRight('societe', 'client', 'voir') && !$user->socid) {
if (empty($user->socid) && isModEnabled('societe') && !$user->hasRight('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 = ".((int) $user->id);
$clause = " AND";
@ -3220,7 +3220,7 @@ class Ticket extends CommonObject
$sql = "SELECT count(p.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."ticket as p";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
$clause = "AND";

View file

@ -126,7 +126,11 @@ $search_all = trim(GETPOST("search_all", 'alphanohtml'));
$search = array();
foreach ($object->fields as $key => $val) {
if (GETPOST('search_'.$key, 'alpha') !== '') {
$search[$key] = GETPOST('search_'.$key, 'alpha');
if (isset($val['arrayofkeyval'])) {
$search[$key] = GETPOST('search_'.$key, 'array');
} else {
$search[$key] = GETPOST('search_'.$key, 'alpha');
}
} else {
$search[$key] = "";
}
@ -394,13 +398,15 @@ foreach ($search as $key => $val) {
$tmpkey = 't.' . $key;
if ($key == 'fk_statut' && !empty($search['fk_statut'])) {
$newarrayofstatus = array();
foreach ($search['fk_statut'] as $key2 => $val2) {
if (in_array($val2, array('openall', 'closeall'))) {
continue;
if (is_array($search['fk_statut'])) {
foreach ($search['fk_statut'] as $key2 => $val2) {
if (in_array($val2, array('openall', 'closeall'))) {
continue;
}
$newarrayofstatus[] = $val2;
}
$newarrayofstatus[] = $val2;
}
if ($search['fk_statut'] == 'openall' || in_array('openall', $search['fk_statut'])) {
if ($search['fk_statut'] == 'openall' || (is_array($search['fk_statut']) && in_array('openall', $search['fk_statut']))) {
$newarrayofstatus[] = Ticket::STATUS_NOT_READ;
$newarrayofstatus[] = Ticket::STATUS_READ;
$newarrayofstatus[] = Ticket::STATUS_ASSIGNED;
@ -408,7 +414,7 @@ foreach ($search as $key => $val) {
$newarrayofstatus[] = Ticket::STATUS_NEED_MORE_INFO;
$newarrayofstatus[] = Ticket::STATUS_WAITING;
}
if ($search['fk_statut'] == 'closeall' || in_array('closeall', $search['fk_statut'])) {
if ($search['fk_statut'] == 'closeall' || (is_array($search['fk_statut']) && in_array('closeall', $search['fk_statut']))) {
$newarrayofstatus[] = Ticket::STATUS_CLOSED;
$newarrayofstatus[] = Ticket::STATUS_CANCELED;
}
@ -908,7 +914,11 @@ foreach ($object->fields as $key => $val) {
//var_dump(array_values($search[$key]));
$selectedarray = null;
if (!empty($search[$key])) {
$selectedarray = array_values($search[$key]);
if (is_array($search[$key])) {
$selectedarray = array_values($search[$key]);
} else {
$selectedarray = array($search[$key]); // Compatibility with "Default search filters"
}
}
print Form::multiselectarray('search_fk_statut', $arrayofstatus, $selectedarray, 0, 0, 'search_status width150 onrightofpage', 1, 0, '', '', '');
print '</td>';

View file

@ -339,6 +339,7 @@ if ($user->admin) {
if (!empty($object->socid)) {
print info_admin(showModulesExludedForExternal($modules))."\n";
}
print '<br>';
$parameters = array('permsgroupbyentity' => $permsgroupbyentity);
$reshook = $hookmanager->executeHooks('insertExtraHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
@ -346,7 +347,7 @@ if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
$listofexpandedmodules = array();
//$listofexpandedmodules = array();
print "\n";

Some files were not shown because too many files have changed in this diff Show more