diff --git a/.github/workflows/phpstan_baseline.yml b/.github/workflows/phpstan_baseline.yml index 1ad3a0b49f7..dc2a25f7296 100644 --- a/.github/workflows/phpstan_baseline.yml +++ b/.github/workflows/phpstan_baseline.yml @@ -23,6 +23,9 @@ env: jobs: phpstan: runs-on: ubuntu-latest + permissions: write-all + # contents: write + # pull-requests: write steps: - name: Checkout uses: actions/checkout@v4 @@ -51,7 +54,7 @@ jobs: phpstan-cache-${{ env.PHP_VERSION }}- - uses: ruudk/phpstan-baseline-refresh-create-pr-action@main with: - github_token: ${{ secrets.PAT_GITHUB_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} phpstan_path: phpstan configuration_path: phpstan.neon.dist phpstan_additional_arguments: --memory-limit 7G -a build/phpstan/bootstrap_action.php diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index bbacb30775f..e519fa25114 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -3918,30 +3918,6 @@ parameters: count: 2 path: ../../htdocs/categories/photos.php - - - message: '#^If condition is always true\.$#' - identifier: if.alwaysTrue - count: 9 - path: ../../htdocs/categories/viewcat.php - - - - message: '#^Loose comparison using \=\= between ''bank_account'' and ''bank_account'' will always evaluate to true\.$#' - identifier: equal.alwaysTrue - count: 1 - path: ../../htdocs/categories/viewcat.php - - - - message: '#^Strict comparison using \!\=\= between Account\|Adherent\|Contact\|Product\|Project\|Societe\|Ticket\|User and null will always evaluate to true\.$#' - identifier: notIdentical.alwaysTrue - count: 1 - path: ../../htdocs/categories/viewcat.php - - - - message: '#^Variable \$elementtype might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/categories/viewcat.php - - message: '#^Variable \$object might not be defined\.$#' identifier: variable.undefined @@ -4608,12 +4584,6 @@ parameters: count: 1 path: ../../htdocs/comm/propal/card.php - - - message: '#^Parameter \#4 \$url of function dolGetButtonAction expects array\\}\>\|string, array\{0\: array\{lang\: ''orders'', enabled\: bool, perm\: 0\|1, label\: ''AddOrder'', url\: non\-falsy\-string\}, 1\: array\{lang\: ''interventions'', enabled\: bool, perm\: 0\|1, label\: ''AddIntervention'', url\: non\-falsy\-string\}\|array\{lang\: ''orders'', enabled\: bool, perm\: bool, label\: ''AddPurchaseOrder'', url\: non\-falsy\-string\}, 2\: array\{lang\: ''contracts'', enabled\: bool, perm\: 0\|1, label\: ''AddContract'', url\: non\-falsy\-string\}\|array\{lang\: ''interventions'', enabled\: bool, perm\: 0\|1, label\: ''AddIntervention'', url\: non\-falsy\-string\}, 3\?\: array\{lang\: ''contracts'', enabled\: bool, perm\: 0\|1, label\: ''AddContract'', url\: non\-falsy\-string\}\|array\{lang\: ''invoice'', enabled\: bool, perm\: 0\|1, label\: ''CreateBill'', url\: non\-falsy\-string\}, 4\?\: array\{lang\: ''invoice'', enabled\: bool, perm\: 0\|1, label\: ''CreateBill'', url\: non\-falsy\-string\}\} given\.$#' - identifier: argument.type - count: 2 - path: ../../htdocs/comm/propal/card.php - - message: '#^Property CommonObject\:\:\$fk_project \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -5028,12 +4998,6 @@ parameters: count: 1 path: ../../htdocs/commande/card.php - - - message: '#^Parameter \#4 \$url of function dolGetButtonAction expects array\\}\>\|string, array\{0\: array\{lang\: ''interventions'', enabled\: bool, perm\: 0\|1, label\: ''AddIntervention'', url\: non\-falsy\-string\}, 1\: array\{lang\: ''contracts'', enabled\: bool, perm\: 0\|1, label\: ''AddContract'', url\: non\-falsy\-string\}, 2\: array\{lang\: ''bills'', enabled\: bool, perm\: bool, label\: ''CreateBill'', url\: non\-falsy\-string\}\|array\{lang\: ''sendings'', enabled\: bool, perm\: 0\|1, label\: ''CreateShipment'', url\: non\-falsy\-string\}, 3\?\: array\{lang\: ''bills'', enabled\: bool, perm\: bool, label\: ''CreateBill'', url\: non\-falsy\-string\}\}\|array\{0\: array\{lang\: ''orders'', enabled\: bool, perm\: bool, label\: ''AddPurchaseOrder'', url\: non\-falsy\-string\}, 1\: array\{lang\: ''interventions'', enabled\: bool, perm\: 0\|1, label\: ''AddIntervention'', url\: non\-falsy\-string\}, 2\: array\{lang\: ''contracts'', enabled\: bool, perm\: 0\|1, label\: ''AddContract'', url\: non\-falsy\-string\}, 3\: array\{lang\: ''bills'', enabled\: bool, perm\: bool, label\: ''CreateBill'', url\: non\-falsy\-string\}\|array\{lang\: ''sendings'', enabled\: bool, perm\: 0\|1, label\: ''CreateShipment'', url\: non\-falsy\-string\}, 4\?\: array\{lang\: ''bills'', enabled\: bool, perm\: bool, label\: ''CreateBill'', url\: non\-falsy\-string\}\} given\.$#' - identifier: argument.type - count: 2 - path: ../../htdocs/commande/card.php - - message: '#^Result of && is always false\.$#' identifier: booleanAnd.alwaysFalse @@ -30750,36 +30714,6 @@ parameters: count: 5 path: ../../htdocs/projet/tasks/time.php - - - message: '#^Parameter \#1 \$hour of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/projet/tasks/time.php - - - - message: '#^Parameter \#2 \$minute of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/projet/tasks/time.php - - - - message: '#^Parameter \#4 \$month of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 2 - path: ../../htdocs/projet/tasks/time.php - - - - message: '#^Parameter \#5 \$day of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 2 - path: ../../htdocs/projet/tasks/time.php - - - - message: '#^Parameter \#6 \$year of function dol_mktime expects int, array\\|string given\.$#' - identifier: argument.type - count: 2 - path: ../../htdocs/projet/tasks/time.php - - message: '#^Right side of && is always true\.$#' identifier: booleanAnd.rightAlwaysTrue @@ -31884,30 +31818,6 @@ parameters: count: 1 path: ../../htdocs/public/test/test_arrays.php - - - message: '#^Variable \$conf might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../htdocs/public/test/test_badges.php - - - - message: '#^Variable \$dolibarr_main_prod might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/public/test/test_badges.php - - - - message: '#^Parameter \#7 \$params of function dolGetButtonAction expects array\{confirm\?\: array\{url\?\: string, title\?\: string, content\?\: string, action\-btn\-label\?\: string, cancel\-btn\-label\?\: string, modal\?\: bool\}, attr\?\: array\, areDropdownButtons\?\: bool, backtopage\?\: string, lang\?\: string, enabled\?\: bool, perm\?\: int\<0, 1\>, label\?\: string, \.\.\.\}, array\{confirm\: true\} given\.$#' - identifier: argument.type - count: 2 - path: ../../htdocs/public/test/test_buttons.php - - - - message: '#^Variable \$dolibarr_main_prod might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/public/test/test_buttons.php - - message: '#^Variable \$dolibarr_main_prod might not be defined\.$#' identifier: variable.undefined @@ -31920,18 +31830,6 @@ parameters: count: 1 path: ../../htdocs/public/test/test_exec.php - - - message: '#^Variable \$db might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/public/test/test_forms.php - - - - message: '#^Variable \$dolibarr_main_prod might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/public/test/test_forms.php - - message: '#^Variable \$dolibarr_main_prod might not be defined\.$#' identifier: variable.undefined diff --git a/dev/translation/dynamic_translation_keys.lst b/dev/translation/dynamic_translation_keys.lst index f043dd89e6d..dee58f40a5e 100644 --- a/dev/translation/dynamic_translation_keys.lst +++ b/dev/translation/dynamic_translation_keys.lst @@ -1204,6 +1204,7 @@ Feature FeatureIsSupportedInInOutModeOnly Features FichinterNoContractLinked +FichintersCategoriesArea FieldNeedSource FieldTarget FieldTitle diff --git a/htdocs/admin/tools/ui/components/test_arrays.php b/htdocs/admin/tools/ui/components/test_arrays.php index 815fa608db2..8954e0cd7a3 100644 --- a/htdocs/admin/tools/ui/components/test_arrays.php +++ b/htdocs/admin/tools/ui/components/test_arrays.php @@ -1,4 +1,6 @@ + */ // Load Dolibarr environment @@ -87,7 +89,7 @@ This page is a sample of page using tables. It is designed to make test with
- css (add parameter &theme=newtheme to test another theme or edit css of current theme)
- jmobile (add parameter ">dol_use_jmobile=1&dol_optimize_smallscreen=1 and switch to small screen < 570 to enable with emulated jmobile)
-- no javascript / usage for bind people (add parameter ">nojs=1 to force disable javascript)
+- no javascript / usage for blind people (add parameter ">nojs=1 to force disable javascript)
- tablednd
@@ -379,4 +381,4 @@ if (!empty($usedolheader)) { - \ No newline at end of file + diff --git a/htdocs/admin/tools/ui/components/test_forms.php b/htdocs/admin/tools/ui/components/test_forms.php index 427bdb86472..60f351eb994 100644 --- a/htdocs/admin/tools/ui/components/test_forms.php +++ b/htdocs/admin/tools/ui/components/test_forms.php @@ -1,4 +1,19 @@ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. //define("NOLOGIN",1); // This means this output page does not require to be logged. /*if (!defined('NOSESSION')) { @@ -26,7 +41,7 @@ llxHeader(); This page is a sample of page using Dolibarr HTML widget methods. It is designed to make test with
- css (add parameter &theme=newtheme to test another theme or edit css of current theme)
- jmobile (add parameter ">dol_use_jmobile=1&dol_optimize_smallscreen=1 and switch to small screen < 570 to enable with emulated jmobile)
-- no javascript / usage for bind people (add parameter ">nojs=1 to force disable javascript)
+- no javascript / usage for blind people (add parameter ">nojs=1 to force disable javascript)
- use with a text browser (add parameter ">textbrowser=1 to force detection of a text browser)


diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index f3542260589..f0d3e729791 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -9,7 +9,7 @@ * Copyright (C) 2013-2018 Philippe Grand * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Raphaël Doursenaud - * Copyright (C) 2016 Charlie Benke + * Copyright (C) 2016-2024 Charlene Benke * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2023-2024 Benjamin Falière * Copyright (C) 2024 MDW @@ -62,6 +62,7 @@ class Categorie extends CommonObject const TYPE_WEBSITE_PAGE = 'website_page'; const TYPE_TICKET = 'ticket'; const TYPE_KNOWLEDGEMANAGEMENT = 'knowledgemanagement'; + const TYPE_FICHINTER = 'fichinter'; /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png @@ -86,7 +87,8 @@ class Categorie extends CommonObject 'actioncomm' => 10, 'website_page' => 11, 'ticket' => 12, - 'knowledgemanagement' => 13 + 'knowledgemanagement' => 13, + 'fichinter' => 14, ); /** @@ -108,7 +110,8 @@ class Categorie extends CommonObject 10 => 'actioncomm', 11 => 'website_page', 12 => 'ticket', - 13 => 'knowledgemanagement' + 13 => 'knowledgemanagement', + 14 => 'fichinter', ); /** @@ -140,20 +143,21 @@ class Categorie extends CommonObject * @note Move to const array when PHP 5.6 will be our minimum target */ public $MAP_OBJ_CLASS = array( - 'product' => 'Product', + 'product' => 'Product', 'customer' => 'Societe', 'supplier' => 'Fournisseur', - 'member' => 'Adherent', - 'contact' => 'Contact', - 'user' => 'User', - 'account' => 'Account', // old for bank account - 'bank_account' => 'Account', - 'project' => 'Project', + 'member' => 'Adherent', + 'contact' => 'Contact', + 'user' => 'User', + 'account' => 'Account', // old for bank account + 'bank_account' => 'Account', + 'project' => 'Project', 'warehouse' => 'Entrepot', 'actioncomm' => 'ActionComm', 'website_page' => 'WebsitePage', 'ticket' => 'Ticket', - 'knowledgemanagement' => 'KnowledgeRecord' + 'knowledgemanagement' => 'KnowledgeRecord', + 'fichinter' => 'Fichinter', ); /** @@ -173,9 +177,10 @@ class Categorie extends CommonObject 'project' => 'ProjectsCategoriesArea', 'warehouse' => 'StocksCategoriesArea', 'actioncomm' => 'ActioncommCategoriesArea', - 'website_page' => 'WebsitePageCategoriesArea', - 'ticket' => 'TicketCategoriesArea', - 'knowledgemanagement' => 'KnowledgemanagementCategoriesArea' + 'website_page' => 'WebsitePagesCategoriesArea', + 'ticket' => 'TicketsCategoriesArea', + 'knowledgemanagement' => 'KnowledgemanagementsCategoriesArea', + 'fichinter' => 'FichintersCategoriesArea', ); /** @@ -185,12 +190,13 @@ class Categorie extends CommonObject public $MAP_OBJ_TABLE = array( 'customer' => 'societe', 'supplier' => 'societe', - 'member' => 'adherent', - 'contact' => 'socpeople', - 'account' => 'bank_account', // old for bank account - 'project' => 'projet', + 'member' => 'adherent', + 'contact' => 'socpeople', + 'account' => 'bank_account', // old for bank account + 'project' => 'projet', 'warehouse' => 'entrepot', - 'knowledgemanagement' => 'knowledgemanagement_knowledgerecord' + 'knowledgemanagement' => 'knowledgemanagement_knowledgerecord', + 'fichinter' => 'fichinter', ); /** @@ -254,6 +260,7 @@ class Categorie extends CommonObject * @see Categorie::TYPE_ACTIONCOMM * @see Categorie::TYPE_WEBSITE_PAGE * @see Categorie::TYPE_TICKET + * @see Categorie::TYPE_FICHINTER */ public $type; @@ -695,6 +702,7 @@ class Categorie extends CommonObject 'categorie_contact' => 'fk_categorie', 'categorie_fournisseur' => 'fk_categorie', 'categorie_knowledgemanagement' => array('field' => 'fk_categorie', 'enabled' => isModEnabled('knowledgemanagement')), + 'categorie_fichinter' => array('field' => 'fk_categorie', 'enabled' => isModEnabled('intervention')), 'categorie_member' => 'fk_categorie', 'categorie_user' => 'fk_categorie', 'categorie_product' => 'fk_categorie', @@ -1071,12 +1079,12 @@ class Categorie extends CommonObject $category_static = new Categorie($this->db); if ($category_static->fetch($obj->rowid)) { $categories[$i]['id'] = $category_static->id; - $categories[$i]['fk_parent'] = $category_static->fk_parent; - $categories[$i]['label'] = $category_static->label; + $categories[$i]['fk_parent'] = $category_static->fk_parent; + $categories[$i]['label'] = $category_static->label; $categories[$i]['description'] = $category_static->description; - $categories[$i]['color'] = $category_static->color; - $categories[$i]['position'] = $category_static->position; - $categories[$i]['socid'] = $category_static->socid; + $categories[$i]['color'] = $category_static->color; + $categories[$i]['position'] = $category_static->position; + $categories[$i]['socid'] = $category_static->socid; $categories[$i]['ref_ext'] = $category_static->ref_ext; $categories[$i]['visible'] = $category_static->visible; $categories[$i]['type'] = $category_static->type; diff --git a/htdocs/categories/info.php b/htdocs/categories/info.php index 8d371d7887b..46495960e25 100644 --- a/htdocs/categories/info.php +++ b/htdocs/categories/info.php @@ -85,7 +85,7 @@ print dol_get_fiche_head($head, 'info', $langs->trans($title), -1, 'category'); $backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.urlencode($type)); $linkback = ''.$langs->trans("BackToList").''; -$object->next_prev_filter = 'type = '.((int) $object->type); +$object->next_prev_filter = 'type:=:'.((int) $object->type); $object->ref = $object->label; $morehtmlref = '
'.$langs->trans("Root").' >> '; $ways = $object->print_all_ways(" >> ", '', 1); diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index 1929ec09533..7f05bb934ee 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -136,7 +136,7 @@ if ($object->id) { $backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.urlencode($type)); $linkback = ''.$langs->trans("BackToList").''; - $object->next_prev_filter = 'type = '.((int) $object->type); + $object->next_prev_filter = 'type:=:'.((int) $object->type); $object->ref = $object->label; $morehtmlref = '
'.$langs->trans("Root").' >> '; $ways = $object->print_all_ways(" >> ", '', 1); diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index 2a46eff46ba..84992cc45bc 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -210,7 +210,7 @@ print dol_get_fiche_head($head, 'translation', $langs->trans($title), -1, 'categ $backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.urlencode($type)); $linkback = ''.$langs->trans("BackToList").''; -$object->next_prev_filter = 'type = '.((int) $object->type); +$object->next_prev_filter = 'type:=:'.((int) $object->type); $object->ref = $object->label; $morehtmlref = '
'.$langs->trans("Root").' >> '; $ways = $object->print_all_ways(" >> ", '', 1); diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 99e8c805056..c45c5f016e9 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -9,6 +9,7 @@ * Copyright (C) 2024 MDW * Copyright (C) 2024 Frédéric France * Copyright (C) 2024 Alexandre Spangaro + * Copyright (C) 2023-2024 Charlene Benke * * 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 @@ -116,12 +117,12 @@ if ($confirm == 'no') { exit; } } - $parameters = array('type' => $type, 'id' => $id, 'label' => $label); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks // Remove element from category if ($id > 0 && $removeelem > 0 && $action == 'unlink') { // Test on permission not required here. Done later according to type of object. $tmpobject = null; + $elementtype = ''; if ($type == Categorie::TYPE_PRODUCT && ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer'))) { require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $tmpobject = new Product($db); @@ -165,6 +166,13 @@ if ($id > 0 && $removeelem > 0 && $action == 'unlink') { // Test on permission n $tmpobject = new Ticket($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'ticket'; + } elseif ($type == Categorie::TYPE_FICHINTER && $user->hasRight('ficheinter', 'write')) { + require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; + $tmpobject = new Fichinter($db); + $result = $tmpobject->fetch($removeelem); + $elementtype = 'fichinter'; + } else { + dol_print_error(null, "Not supported value of type = ".$type); } $result = $object->del_type($tmpobject, $elementtype); @@ -188,70 +196,64 @@ if ($user->hasRight('categorie', 'supprimer') && $action == 'confirm_delete' && } if ($elemid && $action == 'addintocategory') { // Test on permission not required here. Done just after depending on object type - if (($type == Categorie::TYPE_PRODUCT && ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer'))) || - ($type == Categorie::TYPE_CUSTOMER && $user->hasRight('societe', 'creer')) || - ($type == Categorie::TYPE_SUPPLIER && $user->hasRight('societe', 'creer')) || - ($type == Categorie::TYPE_TICKET && $user->hasRight('ticket', 'write')) || - ($type == Categorie::TYPE_PROJECT && $user->hasRight('projet', 'creer')) || - ($type == Categorie::TYPE_MEMBER && $user->hasRight('adherent', 'creer')) || - ($type == Categorie::TYPE_CONTACT && $user->hasRight('societe', 'creer')) || - ($type == Categorie::TYPE_USER && $user->hasRight('user', 'user', 'creer')) || - ($type == Categorie::TYPE_ACCOUNT && $user->hasRight('banque', 'configurer')) - ) { - $newobject = null; - if ($type == Categorie::TYPE_PRODUCT) { - require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; - $newobject = new Product($db); - $elementtype = 'product'; - } elseif ($type == Categorie::TYPE_CUSTOMER) { - require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; - $newobject = new Societe($db); - $elementtype = 'customer'; - } elseif ($type == Categorie::TYPE_SUPPLIER) { - require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; - $newobject = new Societe($db); - $elementtype = 'supplier'; - } elseif ($type == Categorie::TYPE_TICKET) { - require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; - $newobject = new Ticket($db); - $elementtype = 'ticket'; - } elseif ($type == Categorie::TYPE_PROJECT) { - require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; - $newobject = new Project($db); - $elementtype = 'project'; - } elseif ($type == Categorie::TYPE_MEMBER) { - require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; - $newobject = new Adherent($db); - $elementtype = 'member'; - } elseif ($type == Categorie::TYPE_CONTACT) { - require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; - $newobject = new Contact($db); - $elementtype = 'contact'; - } elseif ($type == Categorie::TYPE_USER) { - require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; - $newobject = new User($db); - $elementtype = 'user'; - } elseif ($type == Categorie::TYPE_ACCOUNT) { - require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - $newobject = new Account($db); - $elementtype = 'bank_account'; - } else { - dol_print_error(null, "Not supported value of type = ".$type); - } - if ($newobject !== null) { - $result = $newobject->fetch($elemid); - } + $newobject = null; + $elementtype = ''; + if ($type == Categorie::TYPE_PRODUCT && ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer'))) { + require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; + $newobject = new Product($db); + $elementtype = 'product'; + } elseif ($type == Categorie::TYPE_CUSTOMER && $user->hasRight('societe', 'creer')) { + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; + $newobject = new Societe($db); + $elementtype = 'customer'; + } elseif ($type == Categorie::TYPE_SUPPLIER && $user->hasRight('societe', 'creer')) { + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; + $newobject = new Societe($db); + $elementtype = 'supplier'; + } elseif ($type == Categorie::TYPE_TICKET && $user->hasRight('ticket', 'write')) { + require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; + $newobject = new Ticket($db); + $elementtype = 'ticket'; + } elseif ($type == Categorie::TYPE_FICHINTER && $user->hasRight('ficheinter', 'write')) { + require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; + $newobject = new Fichinter($db); + $elementtype = 'fichinter'; + } elseif ($type == Categorie::TYPE_PROJECT && $user->hasRight('projet', 'creer')) { + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + $newobject = new Project($db); + $elementtype = 'project'; + } elseif ($type == Categorie::TYPE_MEMBER && $user->hasRight('adherent', 'creer')) { + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; + $newobject = new Adherent($db); + $elementtype = 'member'; + } elseif ($type == Categorie::TYPE_CONTACT && $user->hasRight('societe', 'creer')) { + require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; + $newobject = new Contact($db); + $elementtype = 'contact'; + } elseif ($type == Categorie::TYPE_USER && $user->hasRight('user', 'user', 'creer')) { + require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; + $newobject = new User($db); + $elementtype = 'user'; + } elseif ($type == Categorie::TYPE_ACCOUNT && $user->hasRight('banque', 'configurer')) { + require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + $newobject = new Account($db); + $elementtype = 'bank_account'; + } else { + dol_print_error(null, "Not supported value of type = ".$type); + } + if ($newobject !== null) { + $result = $newobject->fetch($elemid); + } - // Add into category - $result = $object->add_type($newobject, $elementtype); - if ($result >= 0) { - setEventMessages($langs->trans("WasAddedSuccessfully", $newobject->ref), null, 'mesgs'); + // Add into category + $result = $object->add_type($newobject, $elementtype); + if ($result >= 0) { + setEventMessages($langs->trans("WasAddedSuccessfully", $newobject->ref), null, 'mesgs'); + } else { + if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { + setEventMessages($langs->trans("ObjectAlreadyLinkedToCategory"), null, 'warnings'); } else { - if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { - setEventMessages($langs->trans("ObjectAlreadyLinkedToCategory"), null, 'warnings'); - } else { - setEventMessages($object->error, $object->errors, 'errors'); - } + setEventMessages($object->error, $object->errors, 'errors'); } } } @@ -264,7 +266,10 @@ if ($elemid && $action == 'addintocategory') { // Test on permission not require $form = new Form($db); $formother = new FormOther($db); -$arrayofjs = array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); +$arrayofjs = array( + '/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', + '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js' +); $arrayofcss = array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); $help_url = ''; @@ -278,7 +283,7 @@ print dol_get_fiche_head($head, 'card', $langs->trans($title), -1, 'category'); $backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.urlencode($type)); $linkback = ''.$langs->trans("BackToList").''; -$object->next_prev_filter = 'type = '.((int) $object->type); +$object->next_prev_filter = 'type:=:'.((int) $object->type); $object->ref = $object->label; $morehtmlref = '
'.$langs->trans("Root").' >> '; $ways = $object->print_all_ways(" >> ", '', 1); @@ -519,6 +524,7 @@ $typeid = $type; if ($type == Categorie::TYPE_PRODUCT) { if ($user->hasRight("product", "read") || $user->hasRight("service", "read")) { $permission = ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer')); + $showclassifyform = ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer')); $prods = $object->getObjectsInCateg($type, 0, $limit, $offset); if ($prods < 0) { @@ -544,7 +550,6 @@ if ($type == Categorie::TYPE_PRODUCT) { // @phan-suppress-next-line PhanPluginSuspiciousParamOrder print_barre_liste($langs->trans("ProductsAndServices"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'products', 0, $newcardbutton, '', $limit); - $showclassifyform = 1; if ($showclassifyform) { print ''; print '
'; @@ -599,6 +604,7 @@ if ($type == Categorie::TYPE_PRODUCT) { if ($type == Categorie::TYPE_CUSTOMER) { if ($user->hasRight("societe", "read")) { $permission = $user->hasRight('societe', 'creer'); + $showclassifyform = $user->hasRight('societe', 'creer'); $socs = $object->getObjectsInCateg($type, 0, $limit, $offset); if ($socs < 0) { @@ -624,7 +630,6 @@ if ($type == Categorie::TYPE_CUSTOMER) { // @phan-suppress-next-line PhanPluginSuspiciousParamOrder print_barre_liste($langs->trans("Customers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'companies', 0, $newcardbutton, '', $limit); - $showclassifyform = 1; if ($showclassifyform) { print ''; print '
'; @@ -679,6 +684,7 @@ if ($type == Categorie::TYPE_CUSTOMER) { if ($type == Categorie::TYPE_SUPPLIER) { if ($user->hasRight("fournisseur", "read")) { $permission = $user->hasRight('societe', 'creer'); + $showclassifyform = $user->hasRight('societe', 'creer'); $socs = $object->getObjectsInCateg($type, 0, $limit, $offset); @@ -705,7 +711,6 @@ if ($type == Categorie::TYPE_SUPPLIER) { // @phan-suppress-next-line PhanPluginSuspiciousParamOrder print_barre_liste($langs->trans("Suppliers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'companies', 0, $newcardbutton, '', $limit); - $showclassifyform = 1; if ($showclassifyform) { print ''; print '
'; @@ -763,6 +768,7 @@ if ($type == Categorie::TYPE_MEMBER) { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; $permission = $user->hasRight('adherent', 'creer'); + $showclassifyform = $user->hasRight('adherent', 'creer'); $members = $object->getObjectsInCateg($type, 0, $limit, $offset); if ($members < 0) { @@ -788,7 +794,6 @@ if ($type == Categorie::TYPE_MEMBER) { // @phan-suppress-next-line PhanPluginSuspiciousParamOrder print_barre_liste($langs->trans("Member"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit); - $showclassifyform = 1; if ($showclassifyform) { print ''; print '
'; @@ -845,6 +850,7 @@ if ($type == Categorie::TYPE_MEMBER) { if ($type == Categorie::TYPE_CONTACT) { if ($user->hasRight("societe", "read")) { $permission = $user->hasRight('societe', 'creer'); + $showclassifyform = $user->hasRight('societe', 'creer'); $contacts = $object->getObjectsInCateg($type, 0, $limit, $offset); if (is_numeric($contacts) && $contacts < 0) { @@ -872,7 +878,6 @@ if ($type == Categorie::TYPE_CONTACT) { // @phan-suppress-next-line PhanPluginSuspiciousParamOrder print_barre_liste($langs->trans("Contact"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contact', 0, $newcardbutton, '', $limit); - $showclassifyform = 1; if ($showclassifyform) { print ''; print '
'; @@ -933,6 +938,7 @@ if ($type == Categorie::TYPE_ACCOUNT) { require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $permission = $user->hasRight('banque', 'creer'); + $showclassifyform = $user->hasRight('banque', 'creer'); $accounts = $object->getObjectsInCateg($type, 0, $limit, $offset); if ($accounts < 0) { @@ -958,7 +964,6 @@ if ($type == Categorie::TYPE_ACCOUNT) { // @phan-suppress-next-line PhanPluginSuspiciousParamOrder print_barre_liste($langs->trans("Account"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bank_account', 0, $newcardbutton, '', $limit); - $showclassifyform = 1; if ($showclassifyform) { print ''; print '
'; @@ -1016,6 +1021,7 @@ if ($type == Categorie::TYPE_PROJECT) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $permission = $user->hasRight('projet', 'creer'); + $showclassifyform = $user->hasRight('projet', 'creer'); $objects = $object->getObjectsInCateg($type, 0, $limit, $offset); if ($objects < 0) { @@ -1041,7 +1047,6 @@ if ($type == Categorie::TYPE_PROJECT) { // @phan-suppress-next-line PhanPluginSuspiciousParamOrder print_barre_liste($langs->trans("Project"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'project', 0, $newcardbutton, '', $limit); - $showclassifyform = 1; if ($showclassifyform) { print ''; print '
'; @@ -1096,6 +1101,7 @@ if ($type == Categorie::TYPE_PROJECT) { if ($type == Categorie::TYPE_USER) { if ($user->hasRight("user", "user", "read")) { require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; + $showclassifyform = $user->hasRight("user", "user", "creer"); $users = $object->getObjectsInCateg($type); if ($users < 0) { @@ -1122,7 +1128,6 @@ if ($type == Categorie::TYPE_USER) { // @phan-suppress-next-line PhanPluginSuspiciousParamOrder print_barre_liste($langs->trans("Users"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'user', 0, '', '', $limit); - $showclassifyform = 1; if ($showclassifyform) { print ''; print ''; print ''; print ''; print '
'; @@ -1170,7 +1175,6 @@ if ($type == Categorie::TYPE_USER) { } } - // List of warehouses if ($type == Categorie::TYPE_WAREHOUSE) { if ($user->hasRight("stock", "read")) { @@ -1246,6 +1250,7 @@ if ($type == Categorie::TYPE_WAREHOUSE) { if ($type == Categorie::TYPE_TICKET) { if ($user->hasRight("ticket", "read")) { $permission = $user->hasRight('categorie', 'creer'); + $showclassifyform = $user->hasRight('categorie', 'creer'); $tickets = $object->getObjectsInCateg($type, 0, $limit, $offset); if ($tickets < 0) { @@ -1271,7 +1276,6 @@ if ($type == Categorie::TYPE_TICKET) { // @phan-suppress-next-line PhanPluginSuspiciousParamOrder print_barre_liste($langs->trans("Ticket"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'ticket', 0, $newcardbutton, '', $limit); - $showclassifyform = 1; if ($showclassifyform) { print ''; print '
'; @@ -1322,6 +1326,91 @@ if ($type == Categorie::TYPE_TICKET) { } } +// List of Interventions +if ($type == Categorie::TYPE_FICHINTER) { + if ($user->hasRight("fichinter", "lire")) { + $permission = $user->hasRight('categorie', 'creer'); + $showclassifyform = $user->hasRight('categorie', 'creer'); + + $fichinters = $object->getObjectsInCateg($type, 0, $limit, $offset); + if ($fichinters < 0) { + dol_print_error($db, $object->error, $object->errors); + } else { + // Form to add record into a category + if ($showclassifyform) { + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formintervention.class.php'; + $formfichinter = new FormIntervention($db); + + print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $langs->trans("AddFichinterIntoCategory").'  '; + print $formfichinter->select_interventions(-1, 0, 'elemid'); + print '
'; + print '
'; + } + + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + + print '
'; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; + $num = count($fichinters); + $nbtotalofrecords = ''; + $newcardbutton = ''; + + $langs->load('interventions'); + // @phan-suppress-next-line PhanPluginSuspiciousParamOrder + print_barre_liste($langs->trans("Intervention"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_intervention', 0, $newcardbutton, '', $limit); + print ''."\n"; + print ''."\n"; + + if (count($fichinters) > 0) { + $i = 0; + foreach ($fichinters as $fichinter) { + $i++; + if ($i > $limit) break; + + print "\t".''."\n"; + print '\n"; + print '\n"; + // Link to delete from category + print ''; + print "\n"; + } + } else { + print ''; + } + print "
'.$langs->trans("Ref").'
'; + print $fichinter->getNomUrl(1); + print "'.$fichinter->description."'; + if ($permission) { + print "id."'>"; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft'); + print ""; + } + print '
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; + print '
'."\n"; + } + } else { + print_barre_liste($langs->trans("Intervention"), null, $_SERVER["PHP_SELF"], '', '', '', '', 0, '', 'fichinter'); + accessforbidden("NotEnoughPermissions", 0, 0); + } +} + // Note that $action and $object may have been modified by some hooks $parameters = array('type' => $type, 'id' => $id, 'label' => $label); $reshook = $hookmanager->executeHooks('addMoreCategoriesList', $parameters, $object, $action); diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 19d4200b5c1..10b01316bf0 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -137,10 +137,10 @@ $usercanvalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $usercanc $usercansend = (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('propal', 'propal_advance', 'send'))); $usermustrespectpricemin = ((getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('produit', 'ignore_price_min_advance')) || !getDolGlobalString('MAIN_USE_ADVANCED_PERMS')); -$usercancreateorder = $user->hasRight('commande', 'creer'); -$usercancreateinvoice = $user->hasRight('facture', 'creer'); -$usercancreatecontract = $user->hasRight('contrat', 'creer'); -$usercancreateintervention = $user->hasRight('ficheinter', 'creer'); +$usercancreateorder = ($user->hasRight('commande', 'creer') == 1); +$usercancreateinvoice = ($user->hasRight('facture', 'creer') == 1); +$usercancreatecontract = ($user->hasRight('contrat', 'creer') == 1); +$usercancreateintervention = ($user->hasRight('ficheinter', 'creer') == 1); $usercancreatepurchaseorder = ($user->hasRight('fournisseur', 'commande', 'creer') || $user->hasRight('supplier_order', 'creer')); $permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php @@ -754,7 +754,7 @@ if (empty($reshook)) { } elseif (GETPOSTINT('statut') == $object::STATUS_SIGNED || GETPOSTINT('statut') == $object::STATUS_NOTSIGNED) { $locationTarget = ''; // prevent browser refresh from closing proposal several times - if ($object->statut == $object::STATUS_VALIDATED || (getDolGlobalString('PROPAL_SKIP_ACCEPT_REFUSE') && $object->statut == $object::STATUS_DRAFT)) { + if ($object->status == $object::STATUS_VALIDATED || (getDolGlobalString('PROPAL_SKIP_ACCEPT_REFUSE') && $object->status == $object::STATUS_DRAFT)) { $db->begin(); $oldstatus = $object->status; @@ -833,7 +833,7 @@ if (empty($reshook)) { } elseif ($action == 'confirm_reopen' && $usercanclose && !GETPOST('cancel', 'alpha')) { // Reopen proposal // prevent browser refresh from reopening proposal several times - if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED || $object->statut == Propal::STATUS_CANCELED) { + if ($object->status == Propal::STATUS_SIGNED || $object->status == Propal::STATUS_NOTSIGNED || $object->status == Propal::STATUS_BILLED || $object->status == Propal::STATUS_CANCELED) { $db->begin(); $newstatus = (getDolGlobalInt('PROPAL_SKIP_ACCEPT_REFUSE') ? Propal::STATUS_DRAFT : Propal::STATUS_VALIDATED); @@ -852,7 +852,7 @@ if (empty($reshook)) { $db->rollback(); } } - } elseif ($action == 'import_lines_from_object' && $usercancreate && $object->statut == Propal::STATUS_DRAFT) { + } elseif ($action == 'import_lines_from_object' && $usercancreate && $object->status == Propal::STATUS_DRAFT) { // add lines from objectlinked $fromElement = GETPOST('fromelement'); $fromElementid = GETPOST('fromelementid'); @@ -2663,7 +2663,7 @@ if ($action == 'create') { $absolute_discount = price2num($absolute_discount, 'MT'); $absolute_creditnote = price2num($absolute_creditnote, 'MT'); - $caneditfield = ($object->statut != Propal::STATUS_SIGNED && $object->statut != Propal::STATUS_BILLED); + $caneditfield = ($object->status != Propal::STATUS_SIGNED && $object->status != Propal::STATUS_BILLED); $thirdparty = $soc; $discount_type = 0; @@ -2683,7 +2683,7 @@ if ($action == 'create') { // } // print '
'; - $editenable = $usercancreate && $caneditfield && $object->statut == Propal::STATUS_DRAFT; + $editenable = $usercancreate && $caneditfield && $object->status == Propal::STATUS_DRAFT; print $form->editfieldkey("DatePropal", 'date', '', $object, $editenable); print '
'; if ($action == 'editdate' && $usercancreate && $caneditfield) { @@ -2725,7 +2725,7 @@ if ($action == 'create') { } else { if (!empty($object->fin_validite)) { print dol_print_date($object->fin_validite, 'day'); - if ($object->statut == Propal::STATUS_VALIDATED && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) { + if ($object->status == Propal::STATUS_VALIDATED && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) { print img_warning($langs->trans("Late")); } } else { @@ -3038,12 +3038,12 @@ if ($action == 'create') { '; - if (!empty($conf->use_javascript_ajax) && $object->statut == Propal::STATUS_DRAFT) { + if (!empty($conf->use_javascript_ajax) && $object->status == Propal::STATUS_DRAFT) { include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; } print '
'; - if (!empty($object->lines) || ($object->statut == Propal::STATUS_DRAFT && $usercancreate && $action != 'selectlines' && $action != 'editline')) { + if (!empty($object->lines) || ($object->status == Propal::STATUS_DRAFT && $usercancreate && $action != 'selectlines' && $action != 'editline')) { print ''; } @@ -3052,7 +3052,7 @@ if ($action == 'create') { } // Form to add new line - if ($object->statut == Propal::STATUS_DRAFT && $usercancreate && $action != 'selectlines') { + if ($object->status == Propal::STATUS_DRAFT && $usercancreate && $action != 'selectlines') { if ($action != 'editline') { $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook @@ -3068,7 +3068,7 @@ if ($action == 'create') { } } - if (!empty($object->lines) || ($object->statut == Propal::STATUS_DRAFT && $usercancreate && $action != 'selectlines' && $action != 'editline')) { + if (!empty($object->lines) || ($object->status == Propal::STATUS_DRAFT && $usercancreate && $action != 'selectlines' && $action != 'editline')) { print '
'; } print '
'; @@ -3093,8 +3093,8 @@ if ($action == 'create') { if (empty($reshook)) { if ($action != 'editline') { // Validate - if (($object->statut == Propal::STATUS_DRAFT && $object->total_ttc >= 0 && count($object->lines) > 0) - || ($object->statut == Propal::STATUS_DRAFT && getDolGlobalString('PROPAL_ENABLE_NEGATIVE') && count($object->lines) > 0)) { + if (($object->status == Propal::STATUS_DRAFT && $object->total_ttc >= 0 && count($object->lines) > 0) + || ($object->status == Propal::STATUS_DRAFT && getDolGlobalString('PROPAL_ENABLE_NEGATIVE') && count($object->lines) > 0)) { if ($usercanvalidate) { print ''.(!getDolGlobalString('PROPAL_SKIP_ACCEPT_REFUSE') ? $langs->trans('Validate') : $langs->trans('ValidateAndSign')).''; } else { @@ -3107,19 +3107,19 @@ if ($action == 'create') { print '' . $langs->trans("AddAction") . ''; }*/ // Edit - if ($object->statut == Propal::STATUS_VALIDATED && $usercancreate) { + if ($object->status == Propal::STATUS_VALIDATED && $usercancreate) { print ''.$langs->trans('Modify').''; } // ReOpen - if (((getDolGlobalString('PROPAL_REOPEN_UNSIGNED_ONLY') && $object->statut == Propal::STATUS_NOTSIGNED) || (!getDolGlobalString('PROPAL_REOPEN_UNSIGNED_ONLY') && ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED || $object->statut == Propal::STATUS_CANCELED))) && $usercanclose) { + if (((getDolGlobalString('PROPAL_REOPEN_UNSIGNED_ONLY') && $object->status == Propal::STATUS_NOTSIGNED) || (!getDolGlobalString('PROPAL_REOPEN_UNSIGNED_ONLY') && ($object->status == Propal::STATUS_SIGNED || $object->status == Propal::STATUS_NOTSIGNED || $object->status == Propal::STATUS_BILLED || $object->status == Propal::STATUS_CANCELED))) && $usercanclose) { print ''.$langs->trans('ReOpen').''; } // Send if (empty($user->socid)) { - if ($object->statut == Propal::STATUS_VALIDATED || $object->statut == Propal::STATUS_SIGNED || getDolGlobalString('PROPOSAL_SENDBYEMAIL_FOR_ALL_STATUS')) { + if ($object->status == Propal::STATUS_VALIDATED || $object->status == Propal::STATUS_SIGNED || getDolGlobalString('PROPOSAL_SENDBYEMAIL_FOR_ALL_STATUS')) { print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?action=presend&token='.newToken().'&id='.$object->id.'&mode=init#formmailbeforetitle', '', $usercansend); } } @@ -3127,8 +3127,14 @@ if ($action == 'create') { $arrayforbutaction = array(); // Create a sale order - $arrayforbutaction[] = array('lang' => 'orders', 'enabled' => (isModEnabled('order') && $object->statut == Propal::STATUS_SIGNED), 'perm' => $usercancreateorder, 'label' => 'AddOrder', 'url' => '/commande/card.php?action=create&origin='.urlencode($object->element).'&originid='.((int) $object->id).'&socid='.((int) $object->socid)); - /*if (isModEnabled('order') && $object->statut == Propal::STATUS_SIGNED) { + $arrayforbutaction[] = array( + 'lang' => 'orders', + 'enabled' => (isModEnabled('order') && $object->status == Propal::STATUS_SIGNED), + 'perm' => $usercancreateorder, + 'label' => 'AddOrder', + 'url' => '/commande/card.php?action=create&origin=' . urlencode($object->element) . '&originid=' . ((int) $object->id) . '&socid=' . ((int) $object->socid) + ); + /*if (isModEnabled('order') && $object->status == Propal::STATUS_SIGNED) { if ($usercancreateorder) { print ''.$langs->trans("AddOrder").''; } @@ -3136,8 +3142,14 @@ if ($action == 'create') { // Create a purchase order if (getDolGlobalString('WORKFLOW_CAN_CREATE_PURCHASE_ORDER_FROM_PROPOSAL')) { - $arrayforbutaction[] = array('lang' => 'orders', 'enabled' => ($object->statut == Propal::STATUS_SIGNED && isModEnabled("supplier_order")), 'perm' => $usercancreatepurchaseorder, 'label' => 'AddPurchaseOrder', 'url' => '/fourn/commande/card.php?action=create&origin='.urlencode($object->element).'&originid='.((int) $object->id).'&socid='.((int) $object->socid)); - /*if ($object->statut == Propal::STATUS_SIGNED && isModEnabled("supplier_order")) { + $arrayforbutaction[] = array( + 'lang' => 'orders', + 'enabled' => ($object->status == Propal::STATUS_SIGNED && isModEnabled("supplier_order")), + 'perm' => $usercancreatepurchaseorder, + 'label' => 'AddPurchaseOrder', + 'url' => '/fourn/commande/card.php?action=create&origin=' . urlencode($object->element) . '&originid=' . ((int) $object->id) . '&socid=' . ((int) $object->socid) + ); + /*if ($object->status == Propal::STATUS_SIGNED && isModEnabled("supplier_order")) { if ($usercancreatepurchaseorder) { print ''.$langs->trans("AddPurchaseOrder").''; } @@ -3145,8 +3157,14 @@ if ($action == 'create') { } // Create an intervention - $arrayforbutaction[] = array('lang' => 'interventions', 'enabled' => (isModEnabled("service") && isModEnabled('intervention') && $object->statut == Propal::STATUS_SIGNED), 'perm' => $usercancreateintervention, 'label' => 'AddIntervention', 'url' => '/fichinter/card.php?action=create&origin='.urlencode($object->element).'&originid='.((int) $object->id).'&socid='.((int) $object->socid)); - /*if (isModEnabled("service") && isModEnabled('intervention') && $object->statut == Propal::STATUS_SIGNED) { + $arrayforbutaction[] = array( + 'lang' => 'interventions', + 'enabled' => (isModEnabled("service") && isModEnabled('intervention') && $object->status == Propal::STATUS_SIGNED), + 'perm' => $usercancreateintervention, + 'label' => 'AddIntervention', + 'url' => '/fichinter/card.php?action=create&origin=' . urlencode($object->element) . '&originid=' . ((int) $object->id) . '&socid=' . ((int) $object->socid) + ); + /*if (isModEnabled("service") && isModEnabled('intervention') && $object->status == Propal::STATUS_SIGNED) { if ($usercancreateintervention) { $langs->load("interventions"); print ''.$langs->trans("AddIntervention").''; @@ -3154,8 +3172,14 @@ if ($action == 'create') { }*/ // Create contract - $arrayforbutaction[] = array('lang' => 'contracts', 'enabled' => (isModEnabled('contract') && $object->statut == Propal::STATUS_SIGNED), 'perm' => $usercancreatecontract, 'label' => 'AddContract', 'url' => '/contrat/card.php?action=create&origin='.urlencode($object->element).'&originid='.((int) $object->id).'&socid='.((int) $object->socid)); - /*if (isModEnabled('contract') && $object->statut == Propal::STATUS_SIGNED) { + $arrayforbutaction[] = array( + 'lang' => 'contracts', + 'enabled' => (isModEnabled('contract') && $object->status == Propal::STATUS_SIGNED), + 'perm' => $usercancreatecontract, + 'label' => 'AddContract', + 'url' => '/contrat/card.php?action=create&origin=' . urlencode($object->element) . '&originid=' . ((int) $object->id) . '&socid=' . ((int) $object->socid) + ); + /*if (isModEnabled('contract') && $object->status == Propal::STATUS_SIGNED) { $langs->load("contracts"); if ($usercancreatecontract) { @@ -3164,16 +3188,22 @@ if ($action == 'create') { }*/ // Create an invoice and classify billed - if ($object->statut == Propal::STATUS_SIGNED && !getDolGlobalString('PROPOSAL_ARE_NOT_BILLABLE')) { - $arrayforbutaction[] = array('lang' => 'invoice', 'enabled' => isModEnabled('invoice'), 'perm' => $usercancreateinvoice, 'label' => 'CreateBill', 'url' => '/compta/facture/card.php?action=create&origin='.urlencode($object->element).'&originid='.((int) $object->id).'&socid='.((int) $object->socid)); + if ($object->status == Propal::STATUS_SIGNED && !getDolGlobalString('PROPOSAL_ARE_NOT_BILLABLE')) { + $arrayforbutaction[] = [ + 'lang' => 'invoice', + 'enabled' => isModEnabled('invoice'), + 'perm' => $usercancreateinvoice, + 'label' => 'CreateBill', + 'url' => '/compta/facture/card.php?action=create&origin='.urlencode($object->element).'&originid='.((int) $object->id).'&socid='.((int) $object->socid), + ]; /*if (isModEnabled('invoice') && $usercancreateinvoice) { print ''.$langs->trans("CreateBill").''; }*/ } $actionButtonsParameters = [ - "areDropdownButtons" => !getDolGlobalInt("MAIN_REMOVE_DROPDOWN_CREATE_BUTTONS_ON_ORDER"), - "backtopage" => $_SERVER["PHP_SELF"]."?id=".((int) $id) + "areDropdownButtons" => !getDolGlobalInt("MAIN_REMOVE_DROPDOWN_CREATE_BUTTONS_ON_ORDER"), + "backtopage" => $_SERVER["PHP_SELF"] . "?id=" . ((int) $id) ]; if ($numlines > 0) { @@ -3182,7 +3212,7 @@ if ($action == 'create') { print dolGetButtonAction($langs->trans("ErrorObjectMustHaveLinesToBeValidated", $object->ref), $langs->trans("Create"), 'default', $arrayforbutaction, $object->id, 0, $actionButtonsParameters); } - if ($object->statut == Propal::STATUS_SIGNED && !getDolGlobalString('PROPOSAL_ARE_NOT_BILLABLE')) { + if ($object->status == Propal::STATUS_SIGNED && !getDolGlobalString('PROPOSAL_ARE_NOT_BILLABLE')) { $arrayofinvoiceforpropal = $object->getInvoiceArrayList(); if ((is_array($arrayofinvoiceforpropal) && count($arrayofinvoiceforpropal) > 0) || !getDolGlobalString('WORKFLOW_PROPAL_NEED_INVOICE_TO_BE_CLASSIFIED_BILLED')) { if ($usercanclose) { @@ -3195,7 +3225,7 @@ if ($action == 'create') { if (!getDolGlobalString('PROPAL_SKIP_ACCEPT_REFUSE')) { // Close as accepted/refused - if ($object->statut == Propal::STATUS_VALIDATED) { + if ($object->status == Propal::STATUS_VALIDATED) { if ($usercanclose) { print ''.$langs->trans('SetAcceptedRefused').''; @@ -3206,7 +3236,7 @@ if ($action == 'create') { } } else { // Set not signed (close) - if ($object->statut == Propal::STATUS_DRAFT && $usercanclose) { + if ($object->status == Propal::STATUS_DRAFT && $usercanclose) { print '' . $langs->trans('SetRefusedAndClose') . ''; } @@ -3256,7 +3286,7 @@ if ($action == 'create') { print $htmltoenteralink; $compatibleImportElementsList = false; - if ($user->hasRight('propal', 'creer') && $object->statut == Propal::STATUS_DRAFT) { + if ($user->hasRight('propal', 'creer') && $object->status == Propal::STATUS_DRAFT) { $compatibleImportElementsList = array('commande', 'propal', 'facture'); // import from linked elements } $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, $compatibleImportElementsList); @@ -3264,7 +3294,7 @@ if ($action == 'create') { // Show online signature link $useonlinesignature = getDolGlobalInt('PROPOSAL_ALLOW_ONLINESIGN'); - if ($object->statut != Propal::STATUS_DRAFT && $useonlinesignature) { + if ($object->status != Propal::STATUS_DRAFT && $useonlinesignature) { print '
'; require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php'; print showOnlineSignatureUrl('proposal', $object->ref, $object).'
'; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index feec0ed9527..6366fbe34b9 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -3041,7 +3041,13 @@ if ($action == 'create' && $usercancreate) { // Create a purchase order if (!getDolGlobalInt('COMMANDE_DISABLE_ADD_PURCHASE_ORDER')) { - $arrayforbutaction[] = array('lang' => 'orders', 'enabled' => (isModEnabled("supplier_order") && $object->statut > Commande::STATUS_DRAFT), 'perm' => $usercancreatepurchaseorder, 'label' => 'AddPurchaseOrder', 'url' => '/fourn/commande/card.php?action=create&origin='.urlencode($object->element).'&originid='.((int) $object->id)); + $arrayforbutaction[] = array( + 'lang' => 'orders', + 'enabled' => (isModEnabled("supplier_order") && $object->statut > Commande::STATUS_DRAFT), + 'perm' => $usercancreatepurchaseorder, + 'label' => 'AddPurchaseOrder', + 'url' => '/fourn/commande/card.php?action=create&origin=' . urlencode($object->element) . '&originid=' . ((int) $object->id) + ); } /*if (isModEnabled("supplier_order") && $object->statut > Commande::STATUS_DRAFT && $object->getNbOfServicesLines() > 0) { @@ -3051,8 +3057,14 @@ if ($action == 'create' && $usercancreate) { }*/ // Create intervention - $arrayforbutaction[] = array('lang' => 'interventions', 'enabled' => (isModEnabled("intervention") && $object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0), 'perm' => $user->hasRight('ficheinter', 'creer'), 'label' => 'AddIntervention', 'url' => '/fichinter/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid); - /*if (isModEnabled('intervention')) { + $arrayforbutaction[] = array( + 'lang' => 'interventions', + 'enabled' => (isModEnabled("intervention") && $object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0), + 'perm' => ($user->hasRight('ficheinter', 'creer') == 1), + 'label' => 'AddIntervention', + 'url' => '/fichinter/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid, + ); + /*if (isModEnabled('ficheinter')) { $langs->load("interventions"); if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) { @@ -3065,7 +3077,13 @@ if ($action == 'create' && $usercancreate) { }*/ // Create contract - $arrayforbutaction[] = array('lang' => 'contracts', 'enabled' => (isModEnabled("contract") && ($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS || $object->statut == Commande::STATUS_CLOSED)), 'perm' => $user->hasRight('contrat', 'creer'), 'label' => 'AddContract', 'url' => '/contrat/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid); + $arrayforbutaction[] = array( + 'lang' => 'contracts', + 'enabled' => (isModEnabled("contract") && ($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS || $object->statut == Commande::STATUS_CLOSED)), + 'perm' => ($user->hasRight('contrat', 'creer') == 1), + 'label' => 'AddContract', + 'url' => '/contrat/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid, + ); /*if (isModEnabled('contrat') && ($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS || $object->statut == Commande::STATUS_CLOSED)) { $langs->load("contracts"); @@ -3082,7 +3100,13 @@ if ($action == 'create' && $usercancreate) { // Create shipment if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { if ((getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION') && $user->hasRight('expedition', 'creer')) || (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') && $user->hasRight('expedition', 'delivery', 'creer'))) { - $arrayforbutaction[] = array('lang' => 'sendings', 'enabled' => (isModEnabled("shipping") && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')))), 'perm' => $user->hasRight('expedition', 'creer'), 'label' => 'CreateShipment', 'url' => '/expedition/shipment.php?id='.$object->id); + $arrayforbutaction[] = array( + 'lang' => 'sendings', + 'enabled' => (isModEnabled("shipping") && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || getDolGlobalString('STOCK_SUPPORTS_SERVICES')))), + 'perm' => $user->hasRight('expedition', 'creer'), + 'label' => 'CreateShipment', + 'url' => '/expedition/shipment.php?id=' . $object->id + ); /* if ($user->hasRight('expedition', 'creer')) { print dolGetButtonAction('', $langs->trans('CreateShipment'), 'default', DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id, ''); @@ -3101,7 +3125,7 @@ if ($action == 'create' && $usercancreate) { 'enabled' => (isModEnabled('invoice') && $object->statut > Commande::STATUS_DRAFT && !$object->billed && $object->total_ttc >= 0), 'perm' => ($user->hasRight('facture', 'creer') && !getDolGlobalInt('WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER')), 'label' => 'CreateBill', - 'url' => '/compta/facture/card.php?action=create&token='.newToken().'&origin='.urlencode($object->element).'&originid='.$object->id.'&socid='.$object->socid + 'url' => '/compta/facture/card.php?action=create&token=' . newToken() . '&origin=' . urlencode($object->element) . '&originid=' . $object->id . '&socid=' . $object->socid ); /* if (isModEnabled('facture') && $object->statut > Commande::STATUS_DRAFT && !$object->billed && $object->total_ttc >= 0) { diff --git a/htdocs/core/class/html.formintervention.class.php b/htdocs/core/class/html.formintervention.class.php index 8fee0906396..6fa982dadbc 100644 --- a/htdocs/core/class/html.formintervention.class.php +++ b/htdocs/core/class/html.formintervention.class.php @@ -74,7 +74,7 @@ class FormIntervention $sql = "SELECT f.rowid, f.ref, f.fk_soc, f.fk_statut"; $sql .= " FROM ".$this->db->prefix()."fichinter as f"; $sql .= " WHERE f.entity = ".$conf->entity; - if ($socid != '') { + if ($socid >= 0) { if ($socid == '0') { $sql .= " AND (f.fk_soc = 0 OR f.fk_soc IS NULL)"; } else { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0dced127de7..5b42cbf54d9 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1165,9 +1165,10 @@ function GETPOSTDATE($prefix, $hourTime = '', $gm = 'auto') $hour = $minute = $second = 0; } // normalize out of range values - $hour = min($hour, 23); - $minute = min($minute, 59); - $second = min($second, 59); + $hour = (int) min($hour, 23); + $minute = (int) min($minute, 59); + $second = (int) min($second, 59); + return dol_mktime($hour, $minute, $second, GETPOSTINT($prefix . 'month'), GETPOSTINT($prefix . 'day'), GETPOSTINT($prefix . 'year'), $gm); } @@ -4971,7 +4972,7 @@ function getPictoForType($key, $morecss = '') * @param int<0,1> $pictoisfullpath If true or 1, image path is a full path, 0 if not * @param int $srconly Return only content of the src attribute of img. * @param int $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip. - * @param string $alt Force alt for bind people + * @param string $alt Force alt for blind people * @param string $morecss Add more class css on img tag (For example 'myclascss'). * @param int $marginleftonlyshort 1 = Add a short left margin on picto, 2 = Add a larger left margin on picto, 0 = No margin left. Works for fontawesome picto only. * @return string Return img tag diff --git a/htdocs/fourn/class/fournisseur.class.php b/htdocs/fourn/class/fournisseur.class.php index c26b99bfc09..54b835dcac2 100644 --- a/htdocs/fourn/class/fournisseur.class.php +++ b/htdocs/fourn/class/fournisseur.class.php @@ -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 /** diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index 640e360eebb..8a18d426114 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -93,6 +93,7 @@ CategorieRecursivHelp=If option is on, when you add an object into a subcategory AddProductServiceIntoCategory=Assign category to the product/service AddCustomerIntoCategory=Assign category to customer AddSupplierIntoCategory=Assign category to supplier +AddFichinterIntoCategory=Assign category to interventional AssignCategoryTo=Assign category to ShowCategory=Show tag/category ByDefaultInList=By default in list @@ -104,3 +105,4 @@ WebsitePagesCategoriesArea=Page-Container Categories KnowledgemanagementsCategoriesArea=KM article Categories UseOrOperatorForCategories=Use 'OR' operator for categories AddObjectIntoCategory=Assign to the category +FichintersCategoriesArea=Intervention Categories diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php index b84b5e00934..0d4306689fe 100644 --- a/htdocs/partnership/partnership_card.php +++ b/htdocs/partnership/partnership_card.php @@ -463,9 +463,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $morehtmlref .= ''; if ($managedfor == 'member') { - $object->next_prev_filter = "te.fk_member > 0"; + $object->next_prev_filter = "te.fk_member:>:0"; // usf filter } else { - $object->next_prev_filter = "te.fk_soc > 0"; + $object->next_prev_filter = "te.fk_soc:>:0"; // usf filter } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/product/agenda.php b/htdocs/product/agenda.php index 619a7e9ff3e..00032c9acbc 100644 --- a/htdocs/product/agenda.php +++ b/htdocs/product/agenda.php @@ -170,7 +170,7 @@ $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product'); print dol_get_fiche_head($head, 'agenda', $titre, -1, $picto); $linkback = ''.$langs->trans("BackToList").''; -$object->next_prev_filter = "fk_product_type = ".((int) $object->type); +$object->next_prev_filter = "fk_product_type:=:".((int) $object->type); // usf filter $shownav = 1; if ($user->socid && !in_array('product', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) { diff --git a/htdocs/product/canvas/product/tpl/card_view.tpl.php b/htdocs/product/canvas/product/tpl/card_view.tpl.php index b370c02c234..3cf61f55d2f 100644 --- a/htdocs/product/canvas/product/tpl/card_view.tpl.php +++ b/htdocs/product/canvas/product/tpl/card_view.tpl.php @@ -39,7 +39,7 @@ $titre = $langs->trans("CardProduct".$object->type); print dol_get_fiche_head($head, 'card', $titre, -1, 'product'); $linkback = ''.$langs->trans("BackToList").''; -$object->next_prev_filter = "fk_product_type = ".((int) $object->type); +$object->next_prev_filter = "fk_product_type:=:".((int) $object->type); // usf filter $shownav = 1; if ($user->socid && !in_array('product', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) { diff --git a/htdocs/product/canvas/service/tpl/card_view.tpl.php b/htdocs/product/canvas/service/tpl/card_view.tpl.php index 9707694dd36..2b48f913b0e 100644 --- a/htdocs/product/canvas/service/tpl/card_view.tpl.php +++ b/htdocs/product/canvas/service/tpl/card_view.tpl.php @@ -39,7 +39,7 @@ $titre = $langs->trans("CardProduct".$object->type); print dol_get_fiche_head($head, 'card', $titre, -1, 'service'); $linkback = ''.$langs->trans("BackToList").''; -$object->next_prev_filter = " fk_product_type = ".((int) $object->type); +$object->next_prev_filter = " fk_product_type:=:".((int) $object->type); $shownav = 1; if ($user->socid && !in_array('product', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) { diff --git a/htdocs/product/document.php b/htdocs/product/document.php index 7b0c72369c1..dd97f6cf96a 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -248,7 +248,7 @@ if ($object->id > 0) { $linkback = ''.$langs->trans("BackToList").''; - $object->next_prev_filter = "fk_product_type = ".((int) $object->type); + $object->next_prev_filter = "fk_product_type:=:".((int) $object->type); // usf filter $shownav = 1; if ($user->socid && !in_array('product', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) { diff --git a/htdocs/product/messaging.php b/htdocs/product/messaging.php index e0659548a1a..354018c5499 100644 --- a/htdocs/product/messaging.php +++ b/htdocs/product/messaging.php @@ -170,7 +170,7 @@ $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product'); print dol_get_fiche_head($head, 'agenda', $titre, -1, $picto); $linkback = ''.$langs->trans("BackToList").''; -$object->next_prev_filter = "fk_product_type = ".((int) $object->type); +$object->next_prev_filter = "fk_product_type:=:".((int) $object->type); // usf filter $shownav = 1; if ($user->socid && !in_array('product', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) { diff --git a/htdocs/product/note.php b/htdocs/product/note.php index a94c6bd929f..6b087600a4a 100644 --- a/htdocs/product/note.php +++ b/htdocs/product/note.php @@ -130,7 +130,7 @@ if ($id > 0 || !empty($ref)) { print dol_get_fiche_head($head, 'note', $titre, -1, $picto); $linkback = ''.$langs->trans("BackToList").''; - $object->next_prev_filter = "fk_product_type = ".((int) $object->type); + $object->next_prev_filter = "fk_product_type:=:".((int) $object->type); // usf filter $shownav = 1; if ($user->socid && !in_array('product', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) { diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 9a1600a82cc..e10fe4caabd 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1007,7 +1007,7 @@ $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product'); print dol_get_fiche_head($head, 'price', $titre, -1, $picto); $linkback = ''.$langs->trans("BackToList").''; -$object->next_prev_filter = "fk_product_type = ".((int) $object->type); +$object->next_prev_filter = "fk_product_type:=:".((int) $object->type); $shownav = 1; if ($user->socid && !in_array('product', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) { diff --git a/htdocs/product/price_suppliers.php b/htdocs/product/price_suppliers.php index d89ebed0e6e..82c500e09c1 100644 --- a/htdocs/product/price_suppliers.php +++ b/htdocs/product/price_suppliers.php @@ -403,7 +403,7 @@ if ($id > 0 || $ref) { print dol_get_fiche_head($head, 'suppliers', $titre, -1, $picto); $linkback = ''.$langs->trans("BackToList").''; - $object->next_prev_filter = "fk_product_type = ".((int) $object->type); + $object->next_prev_filter = "fk_product_type:=:".((int) $object->type); // usf filter $shownav = 1; if ($user->socid && !in_array('product', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) { diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 99ad9516c38..3bc79705f8f 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -337,7 +337,7 @@ if ($id > 0 || !empty($ref)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); $object->next_prev_filter = "fk_projet IN (".$db->sanitize($projectsListId).")"; } else { - $object->next_prev_filter = "fk_projet = ".((int) $projectstatic->id); + $object->next_prev_filter = "fk_projet:=:".((int) $projectstatic->id); } $morehtmlref = ''; diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index 43b747ce6b1..4f04c2674cc 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -295,7 +295,7 @@ if ($object->id > 0) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); $object->next_prev_filter = "fk_projet IN (".$db->sanitize($projectsListId).")"; } else { - $object->next_prev_filter = "fk_projet = ".((int) $projectstatic->id); + $object->next_prev_filter = "fk_projet:=:".((int) $projectstatic->id); } $morehtmlref = ''; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 7e6514bb77a..a982145f402 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -301,10 +301,10 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us $object->timespent_duration = GETPOSTINT("new_durationhour") * 60 * 60; // We store duration in seconds $object->timespent_duration += (GETPOSTINT("new_durationmin") ? GETPOSTINT('new_durationmin') : 0) * 60; // We store duration in seconds if (GETPOST("timelinehour") != '' && GETPOST("timelinehour") >= 0) { // If hour was entered - $object->timespent_date = dol_mktime(GETPOST("timelinehour"), GETPOST("timelinemin"), 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); + $object->timespent_date = dol_mktime(GETPOSTINT("timelinehour"), GETPOSTINT("timelinemin"), 0, GETPOSTINT("timelinemonth"), GETPOSTINT("timelineday"), GETPOSTINT("timelineyear")); $object->timespent_withhour = 1; } else { - $object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); + $object->timespent_date = dol_mktime(12, 0, 0, GETPOSTINT("timelinemonth"), GETPOSTINT("timelineday"), GETPOSTINT("timelineyear")); } $object->timespent_fk_user = GETPOSTINT("userid_line"); $object->timespent_fk_product = GETPOSTINT("fk_product"); @@ -1533,7 +1533,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser print '
'; $forminter = new FormIntervention($db); - print $forminter->select_interventions($projectstatic->thirdparty->id, '', 'interid', 24, $langs->trans('NewInter'), true); + print $forminter->select_interventions($projectstatic->thirdparty->id, 0, 'interid', 24, $langs->trans('NewInter'), true); print '
'; diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php index 0ac22c11228..f2050ac969b 100644 --- a/htdocs/public/test/test_arrays.php +++ b/htdocs/public/test/test_arrays.php @@ -1,4 +1,6 @@ + */ //define("NOLOGIN",1); // This means this output page does not require to be logged. //if (!defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); //if (!defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); @@ -102,7 +104,7 @@ This page is a sample of page using tables. It is designed to make test with
- css (add parameter &theme=newtheme to test another theme or edit css of current theme)
- jmobile (add parameter ">dol_use_jmobile=1&dol_optimize_smallscreen=1 and switch to small screen < 570 to enable with emulated jmobile)
-- no javascript / usage for bind people (add parameter ">nojs=1 to force disable javascript)
+- no javascript / usage for blind people (add parameter ">nojs=1 to force disable javascript)
- tablednd
@@ -386,4 +388,4 @@ if (!empty($usedolheader)) { - \ No newline at end of file + diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php index 68111dcdd31..91bbd1ed699 100644 --- a/htdocs/ticket/agenda.php +++ b/htdocs/ticket/agenda.php @@ -179,9 +179,9 @@ if ($socid > 0) { } if (!$user->socid && getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY')) { - $object->next_prev_filter = "te.fk_user_assign = ".((int) $user->id); + $object->next_prev_filter = "te.fk_user_assign:=:".((int) $user->id); } elseif ($user->socid > 0) { - $object->next_prev_filter = "te.fk_soc = ".((int) $user->socid); + $object->next_prev_filter = "te.fk_soc:=:".((int) $user->socid); } $head = ticket_prepare_head($object); diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 653f522403c..2f44c8fb5df 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -905,9 +905,9 @@ if ($action == 'create' || $action == 'presend') { } if (!$user->socid && getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY')) { - $object->next_prev_filter = "te.fk_user_assign = ".((int) $user->id); + $object->next_prev_filter = "te.fk_user_assign:=:".((int) $user->id); } elseif ($user->socid > 0) { - $object->next_prev_filter = "te.fk_soc = ".((int) $user->socid); + $object->next_prev_filter = "te.fk_soc:=:".((int) $user->socid); } $head = ticket_prepare_head($object); diff --git a/htdocs/ticket/contact.php b/htdocs/ticket/contact.php index 3d1c04c5cce..64dee97164e 100644 --- a/htdocs/ticket/contact.php +++ b/htdocs/ticket/contact.php @@ -215,9 +215,9 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) { } if (!$user->socid && getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY')) { - $object->next_prev_filter = "te.fk_user_assign ='".((int) $user->id); + $object->next_prev_filter = "te.fk_user_assign:=:'".((int) $user->id); } elseif ($user->socid > 0) { - $object->next_prev_filter = "te.fk_soc = ".((int) $user->socid); + $object->next_prev_filter = "te.fk_soc:=:".((int) $user->socid); } $head = ticket_prepare_head($object); diff --git a/htdocs/ticket/document.php b/htdocs/ticket/document.php index 7d9c990a786..ae935b8f101 100644 --- a/htdocs/ticket/document.php +++ b/htdocs/ticket/document.php @@ -149,9 +149,9 @@ if ($object->id) { } if (!$user->socid && getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY')) { - $object->next_prev_filter = "te.fk_user_assign = ".((int) $user->id); + $object->next_prev_filter = "te.fk_user_assign:=:".((int) $user->id); // usf filter } elseif ($user->socid > 0) { - $object->next_prev_filter = "te.fk_soc = ".((int) $user->socid); + $object->next_prev_filter = "te.fk_soc:=:".((int) $user->socid); // usf filter } $head = ticket_prepare_head($object); diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php index 8863b2b495f..7e35d9aa060 100644 --- a/htdocs/ticket/messaging.php +++ b/htdocs/ticket/messaging.php @@ -176,9 +176,9 @@ if ($socid > 0) { } if (!$user->socid && getDolGlobalString('TICKET_LIMIT_VIEW_ASSIGNED_ONLY')) { - $object->next_prev_filter = "te.fk_user_assign = ".((int) $user->id); + $object->next_prev_filter = "te.fk_user_assign:=:".((int) $user->id); // usf filter } elseif ($user->socid > 0) { - $object->next_prev_filter = "te.fk_soc = ".((int) $user->socid); + $object->next_prev_filter = "te.fk_soc:=:".((int) $user->socid); // usf filter } $head = ticket_prepare_head($object); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index a230763a1ab..f0b2ea132fa 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -864,7 +864,7 @@ class User extends CommonObject * @param string $module Module of permission to check * @param string $permlevel1 Permission level1 (Example: 'read', 'write', 'delete') * @param string $permlevel2 Permission level2 - * @return 0|1 Return integer 1 if user has permission, 0 if not. + * @return int<0,1> Return integer 1 if user has permission, 0 if not. * @see clearrights(), delrights(), loadRights(), hasRight() */ public function hasRight($module, $permlevel1, $permlevel2 = '') diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index d14a331cda6..0e31f37cba9 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -424,7 +424,7 @@ if (!empty($id) || !empty($ref)) { print dol_get_fiche_head($head, 'combinations', $titre, -1, $picto); $linkback = ''.$langs->trans("BackToList").''; - $object->next_prev_filter = "fk_product_type = ".((int) $object->type); + $object->next_prev_filter = "fk_product_type:=:".((int) $object->type); // usf filter dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', '', '', '', 0, '', ''); diff --git a/htdocs/website/websiteaccount_card.php b/htdocs/website/websiteaccount_card.php index 7eceda10cc3..7c82bf48493 100644 --- a/htdocs/website/websiteaccount_card.php +++ b/htdocs/website/websiteaccount_card.php @@ -371,7 +371,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $morehtmlref .= ''; if ($socid > 0) { - $object->next_prev_filter = 'te.fk_soc = '.((int) $socid); + $object->next_prev_filter = 'te.fk_soc:=:'.((int) $socid); } dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'rowid', $morehtmlref);