2
0
forked from Wavyzz/dolibarr

test action (#31815)

* NEW : Add category feature on Fichinter

category update

* Update viewcat.php

* Update categories.lang

* Update categorie.class.php

* Update categories.lang

* Update viewcat.php

* Update viewcat.php

* test action

* test action

* test action

* test action

* test action

* test action

* test action

* test action

* test action

* test action

* test action

* clean baseline

Debug v21

NEW: use Expedition::$date_shipping property in card and list (#31701)

* NEW: use Expedition::$date_shipping property in card and list

* FIX: translation

* FIX: PHPStan rebutal

* FIX: not a great idea to copy and not edit comment

* FIX: on create, expected delivery date should precede sending date

* Update card.php

* Update list.php

* Update list.php

* Update list.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

clean baseline

clean baseline

clean baseline

* clean baseline

* clean baseline

* merge

* fix

* fix

* fix

* fix

* fix

* fix

* fix translations

* fix translations

* fix translations

* fix translations

* fix

* fix filters

* fix filters

* fix filters

* fix filters

* fix

---------

Co-authored-by: Charlène Benke <1179011+defrance@users.noreply.github.com>
This commit is contained in:
Frédéric FRANCE
2024-11-15 14:09:04 +01:00
committed by GitHub
parent b6c03773e9
commit ec91ed2af9
37 changed files with 361 additions and 286 deletions

View File

@@ -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

View File

@@ -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\<int, array\{lang\: string, enabled\: bool, perm\: bool, label\: string, url\: string, urlroot\?\: string, isDropDown\?\: int\<0, 1\>\}\>\|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\<int, array\{lang\: string, enabled\: bool, perm\: bool, label\: string, url\: string, urlroot\?\: string, isDropDown\?\: int\<0, 1\>\}\>\|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\<mixed\>\|string given\.$#'
identifier: argument.type
count: 1
path: ../../htdocs/projet/tasks/time.php
-
message: '#^Parameter \#2 \$minute of function dol_mktime expects int, array\<mixed\>\|string given\.$#'
identifier: argument.type
count: 1
path: ../../htdocs/projet/tasks/time.php
-
message: '#^Parameter \#4 \$month of function dol_mktime expects int, array\<mixed\>\|string given\.$#'
identifier: argument.type
count: 2
path: ../../htdocs/projet/tasks/time.php
-
message: '#^Parameter \#5 \$day of function dol_mktime expects int, array\<mixed\>\|string given\.$#'
identifier: argument.type
count: 2
path: ../../htdocs/projet/tasks/time.php
-
message: '#^Parameter \#6 \$year of function dol_mktime expects int, array\<mixed\>\|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\<string, mixed\>, 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

View File

@@ -1204,6 +1204,7 @@ Feature
FeatureIsSupportedInInOutModeOnly
Features
FichinterNoContractLinked
FichintersCategoriesArea
FieldNeedSource
FieldTarget
FieldTitle

View File

@@ -1,4 +1,6 @@
<?php
/* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*/
// Load Dolibarr environment
@@ -87,7 +89,7 @@ This page is a sample of page using tables. It is designed to make test with<br>
<div class="wordbreak">
- css (add parameter &amp;theme=newtheme to test another theme or edit css of current theme)<br>
- jmobile (add parameter <a href="<?php echo $_SERVER["PHP_SELF"].'?dol_use_jmobile=1&dol_optimize_smallscreen=1'; ?>">dol_use_jmobile=1&amp;dol_optimize_smallscreen=1</a> and switch to small screen < 570 to enable with emulated jmobile)<br>
- no javascript / usage for bind people (add parameter <a href="<?php echo $_SERVER["PHP_SELF"].'?nojs=1'; ?>">nojs=1</a> to force disable javascript)<br>
- no javascript / usage for blind people (add parameter <a href="<?php echo $_SERVER["PHP_SELF"].'?nojs=1'; ?>">nojs=1</a> to force disable javascript)<br>
- tablednd<br>
</div>

View File

@@ -1,4 +1,19 @@
<?php
/* Copyright (C) 2024 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
* 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 <https://www.gnu.org/licenses/>.
*/
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<br>
- css (add parameter &amp;theme=newtheme to test another theme or edit css of current theme)<br>
- jmobile (add parameter <a class="wordbreak" href="<?php echo $_SERVER["PHP_SELF"].'?dol_use_jmobile=1&dol_optimize_smallscreen=1'; ?>">dol_use_jmobile=1&amp;dol_optimize_smallscreen=1</a> and switch to small screen < 570 to enable with emulated jmobile)<br>
- no javascript / usage for bind people (add parameter <a class="wordbreak" href="<?php echo $_SERVER["PHP_SELF"].'?nojs=1'; ?>">nojs=1</a> to force disable javascript)<br>
- no javascript / usage for blind people (add parameter <a class="wordbreak" href="<?php echo $_SERVER["PHP_SELF"].'?nojs=1'; ?>">nojs=1</a> to force disable javascript)<br>
- use with a text browser (add parameter <a class="wordbreak" href="<?php echo $_SERVER["PHP_SELF"].'?textbrowser=1'; ?>">textbrowser=1</a> to force detection of a text browser)<br>
<br><br>

View File

@@ -9,7 +9,7 @@
* Copyright (C) 2013-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2016-2024 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2023-2024 Benjamin Falière <benjamin.faliere@altairis.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
@@ -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',
);
/**
@@ -153,7 +156,8 @@ class Categorie extends CommonObject
'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',
);
/**
@@ -190,7 +195,8 @@ class Categorie extends CommonObject
'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',

View File

@@ -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 = '<a href="'.dol_sanitizeUrl($backtolist).'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter = 'type = '.((int) $object->type);
$object->next_prev_filter = 'type:=:'.((int) $object->type);
$object->ref = $object->label;
$morehtmlref = '<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.urlencode($type).'">'.$langs->trans("Root").'</a> >> ';
$ways = $object->print_all_ways(" &gt;&gt; ", '', 1);

View File

@@ -136,7 +136,7 @@ if ($object->id) {
$backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.urlencode($type));
$linkback = '<a href="'.dol_sanitizeUrl($backtolist).'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter = 'type = '.((int) $object->type);
$object->next_prev_filter = 'type:=:'.((int) $object->type);
$object->ref = $object->label;
$morehtmlref = '<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
$ways = $object->print_all_ways(" &gt;&gt; ", '', 1);

View File

@@ -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 = '<a href="'.dol_sanitizeUrl($backtolist).'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter = 'type = '.((int) $object->type);
$object->next_prev_filter = 'type:=:'.((int) $object->type);
$object->ref = $object->label;
$morehtmlref = '<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
$ways = $object->print_all_ways(" &gt;&gt; ", '', 1);

View File

@@ -9,6 +9,7 @@
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2023-2024 Charlene Benke <charlene@patas-monkey.com>
*
* 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,50 +196,45 @@ 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) {
$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) {
} 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) {
} 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) {
} 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_PROJECT) {
} 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) {
} 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) {
} 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) {
} 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) {
} 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';
@@ -253,7 +256,6 @@ if ($elemid && $action == 'addintocategory') { // Test on permission not require
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 = '<a href="'.dol_sanitizeUrl($backtolist).'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter = 'type = '.((int) $object->type);
$object->next_prev_filter = 'type:=:'.((int) $object->type);
$object->ref = $object->label;
$morehtmlref = '<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.urlencode($type).'">'.$langs->trans("Root").'</a> >> ';
$ways = $object->print_all_ways(" &gt;&gt; ", '', 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 '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>';
@@ -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 '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>';
@@ -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 '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>';
@@ -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 '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>';
@@ -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 '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>';
@@ -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 '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>';
@@ -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 '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>';
@@ -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 '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>';
@@ -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 '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>';
@@ -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 '<br>';
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
print '<input type="hidden" name="type" value="'.$typeid.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<input type="hidden" name="action" value="addintocategory">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>';
print $langs->trans("AddFichinterIntoCategory").' &nbsp;';
print $formfichinter->select_interventions(-1, 0, 'elemid');
print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
print '</tr>';
print '</table>';
print '</form>';
}
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
print '<input type="hidden" name="type" value="'.$typeid.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<input type="hidden" name="action" value="list">';
print '<br>';
$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 '<table class="noborder centpercent">'."\n";
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Ref").'</td></tr>'."\n";
if (count($fichinters) > 0) {
$i = 0;
foreach ($fichinters as $fichinter) {
$i++;
if ($i > $limit) break;
print "\t".'<tr class="oddeven">'."\n";
print '<td class="nowrap tdtop">';
print $fichinter->getNomUrl(1);
print "</td>\n";
print '<td class="tdtop">'.$fichinter->description."</td>\n";
// Link to delete from category
print '<td class="right">';
if ($permission) {
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid) ? 'id' : 'socid')."=".$object->id."&type=".$typeid."&action=unlink&token=".newToken()."&removeelem=".$fichinter->id."'>";
print $langs->trans("DeleteFromCat");
print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', 0, 0, 0, '', 'paddingleft');
print "</a>";
}
print '</td>';
print "</tr>\n";
}
} else {
print '<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans("ThisCategoryHasNoItems").'</span></td></tr>';
}
print "</table>\n";
print '</form>'."\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);

View File

@@ -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 '</tr></table>';
$editenable = $usercancreate && $caneditfield && $object->statut == Propal::STATUS_DRAFT;
$editenable = $usercancreate && $caneditfield && $object->status == Propal::STATUS_DRAFT;
print $form->editfieldkey("DatePropal", 'date', '', $object, $editenable);
print '</td><td class="valuefield">';
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') {
<input type="hidden" name="id" value="' . $object->id.'">
';
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 '<div class="div-table-responsive-no-min">';
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 '<table id="tablelines" class="noborder noshadow centpercent">';
}
@@ -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 '</table>';
}
print '</div>';
@@ -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 '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=validate&token='.newToken().'">'.(!getDolGlobalString('PROPAL_SKIP_ACCEPT_REFUSE') ? $langs->trans('Validate') : $langs->trans('ValidateAndSign')).'</a>';
} else {
@@ -3107,19 +3107,19 @@ if ($action == 'create') {
print '<a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a></div>';
}*/
// Edit
if ($object->statut == Propal::STATUS_VALIDATED && $usercancreate) {
if ($object->status == Propal::STATUS_VALIDATED && $usercancreate) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=modif&token='.newToken().'">'.$langs->trans('Modify').'</a>';
}
// 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 '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen&token='.newToken().(!getDolGlobalString('MAIN_JUMP_TAG') ? '' : '#reopen').'"';
print '>'.$langs->trans('ReOpen').'</a>';
}
// 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 '<a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddOrder").'</a>';
}
@@ -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 '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddPurchaseOrder").'</a>';
}
@@ -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 '<a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddIntervention").'</a>';
@@ -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,8 +3188,14 @@ 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 '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
}*/
@@ -3173,7 +3203,7 @@ if ($action == 'create') {
$actionButtonsParameters = [
"areDropdownButtons" => !getDolGlobalInt("MAIN_REMOVE_DROPDOWN_CREATE_BUTTONS_ON_ORDER"),
"backtopage" => $_SERVER["PHP_SELF"]."?id=".((int) $id)
"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 '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=closeas&token='.newToken().(!getDolGlobalString('MAIN_JUMP_TAG') ? '' : '#close').'"';
print '>'.$langs->trans('SetAcceptedRefused').'</a>';
@@ -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 '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&token='.newToken().'&action=closeas&token='.newToken() . (!getDolGlobalString('MAIN_JUMP_TAG') ? '' : '#close') . '"';
print '>' . $langs->trans('SetRefusedAndClose') . '</a>';
}
@@ -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 '<br><!-- Link to sign -->';
require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php';
print showOnlineSignatureUrl('proposal', $object->ref, $object).'<br>';

View File

@@ -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&amp;origin='.urlencode($object->element).'&amp;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&amp;origin=' . urlencode($object->element) . '&amp;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&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;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&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;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&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;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&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;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&amp;token='.newToken().'&amp;origin='.urlencode($object->element).'&amp;originid='.$object->id.'&amp;socid='.$object->socid
'url' => '/compta/facture/card.php?action=create&amp;token=' . newToken() . '&amp;origin=' . urlencode($object->element) . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid
);
/*
if (isModEnabled('facture') && $object->statut > Commande::STATUS_DRAFT && !$object->billed && $object->total_ttc >= 0) {

View File

@@ -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 {

View File

@@ -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

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

@@ -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

View File

@@ -463,9 +463,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$morehtmlref .= '</div>';
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);

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);
$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')))) {

View File

@@ -39,7 +39,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);
$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')))) {

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 = " 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);
$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')))) {

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);
$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')))) {

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);
$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')))) {

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 = "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);
$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')))) {

View File

@@ -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 = '';

View File

@@ -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 = '';

View File

@@ -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 '</td>';
print '<td>';
$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 '</td>';
print '</tr>';
print '</table>';

View File

@@ -1,4 +1,6 @@
<?php
/* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*/
//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<br>
<div class="wordbreak">
- css (add parameter &amp;theme=newtheme to test another theme or edit css of current theme)<br>
- jmobile (add parameter <a href="<?php echo $_SERVER["PHP_SELF"].'?dol_use_jmobile=1&dol_optimize_smallscreen=1'; ?>">dol_use_jmobile=1&amp;dol_optimize_smallscreen=1</a> and switch to small screen < 570 to enable with emulated jmobile)<br>
- no javascript / usage for bind people (add parameter <a href="<?php echo $_SERVER["PHP_SELF"].'?nojs=1'; ?>">nojs=1</a> to force disable javascript)<br>
- no javascript / usage for blind people (add parameter <a href="<?php echo $_SERVER["PHP_SELF"].'?nojs=1'; ?>">nojs=1</a> to force disable javascript)<br>
- tablednd<br>
</div>

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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 = '')

View File

@@ -424,7 +424,7 @@ if (!empty($id) || !empty($ref)) {
print dol_get_fiche_head($head, 'combinations', $titre, -1, $picto);
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?type='.((int) $object->type).'">'.$langs->trans("BackToList").'</a>';
$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, '', '');

View File

@@ -371,7 +371,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$morehtmlref .= '</div>';
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);