diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php
index 9396b02d518..ef4639e4b5e 100644
--- a/htdocs/adherents/list.php
+++ b/htdocs/adherents/list.php
@@ -436,7 +436,7 @@ if ($sall) {
// Filter on categories
$moreforfilter = '';
-if (!empty($conf->categorie->enabled)) {
+if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '
';
$moreforfilter .= $langs->trans('Categories').': ';
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index e50078993f8..f9ccc0837c8 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -542,7 +542,7 @@ if ($resql)
$moreforfilter .= '
';
}
// If the user can view products
- if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
+ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '';
@@ -551,7 +551,7 @@ if ($resql)
$moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter .= '
';
}
- if (!empty($conf->categorie->enabled))
+ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '';
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index ae73b23a876..c30a60424a6 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -593,7 +593,7 @@ if ($resql)
$moreforfilter .= '
';
}
// If the user can view prospects other than his'
- if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
+ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '';
@@ -602,7 +602,7 @@ if ($resql)
$moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter .= '
';
}
- if (!empty($conf->categorie->enabled))
+ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '';
diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php
index 5cdd4711871..9c67897e18d 100644
--- a/htdocs/compta/bank/list.php
+++ b/htdocs/compta/bank/list.php
@@ -276,7 +276,7 @@ if ($sall)
$moreforfilter = '';
-if (!empty($conf->categorie->enabled))
+if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
$moreforfilter .= $form->getFilterBox(Categorie::TYPE_ACCOUNT, $search_category_list);
}
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 607afbc943f..e12e21e70b4 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -729,7 +729,7 @@ if ($resql)
$moreforfilter .= '
';
}
// If the user can view prospects other than his'
- if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
+ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '';
@@ -738,7 +738,7 @@ if ($resql)
$moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter .= '
';
}
- if (!empty($conf->categorie->enabled))
+ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '';
diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php
index eb2523960f3..e2f3ea9012b 100644
--- a/htdocs/compta/paiement/list.php
+++ b/htdocs/compta/paiement/list.php
@@ -1,13 +1,14 @@
- * Copyright (C) 2004-2011 Laurent Destailleur
- * Copyright (C) 2005-2009 Regis Houssin
- * Copyright (C) 2013 Cédric Salvador
- * Copyright (C) 2015 Jean-François Ferry
- * Copyright (C) 2015 Juanjo Menent
- * Copyright (C) 2017 Alexandre Spangaro
- * Copyright (C) 2018 Ferran Marcet
- * Copyright (C) 2018 Charlene Benke
+/* Copyright (C) 2001-2006 Rodolphe Quiedeville
+ * Copyright (C) 2004-2011 Laurent Destailleur
+ * Copyright (C) 2005-2009 Regis Houssin
+ * Copyright (C) 2013 Cédric Salvador
+ * Copyright (C) 2015 Jean-François Ferry
+ * Copyright (C) 2015 Juanjo Menent
+ * Copyright (C) 2017 Alexandre Spangaro
+ * Copyright (C) 2018 Ferran Marcet
+ * Copyright (C) 2018 Charlene Benke
+ * Copyright (C) 2020 Tobias Sekan
*
* 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
@@ -30,6 +31,11 @@
*/
require '../../main.inc.php';
+
+// Security check
+if ($user->socid) $socid = $user->socid;
+$result = restrictedArea($user, 'facture', $facid, '');
+
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
@@ -39,136 +45,159 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
// Load translation files required by the page
$langs->loadLangs(array('bills', 'banks', 'compta', 'companies'));
-$action = GETPOST('action', 'alpha');
-$confirm = GETPOST('confirm', 'alpha');
-$optioncss = GETPOST('optioncss', 'alpha');
+$action = GETPOST('action', 'alpha');
+$massaction = GETPOST('massaction', 'alpha');
+$confirm = GETPOST('confirm', 'alpha');
+$optioncss = GETPOST('optioncss', 'alpha');
+$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'paymentlist';
-$facid = GETPOST('facid', 'int');
-$socid = GETPOST('socid', 'int');
-$userid = GETPOST('userid', 'int');
-$day = GETPOST('day', 'int');
-$month = GETPOST('month', 'int');
-$year = GETPOST('year', 'int');
+$facid = GETPOST('facid', 'int');
+$socid = GETPOST('socid', 'int');
+$userid = GETPOST('userid', 'int');
+$day = GETPOST('day', 'int');
+$month = GETPOST('month', 'int');
+$year = GETPOST('year', 'int');
-// Security check
-if ($user->socid) $socid = $user->socid;
-$result = restrictedArea($user, 'facture', $facid, '');
+$search_ref = GETPOST("search_ref", "alpha");
+$search_account = GETPOST("search_account", "int");
+$search_paymenttype = GETPOST("search_paymenttype");
+$search_amount = GETPOST("search_amount", 'alpha'); // alpha because we must be able to search on "< x"
+$search_company = GETPOST("search_company", 'alpha');
+$search_payment_num = GETPOST('search_payment_num', 'alpha');
-$paymentstatic = new Paiement($db);
-$accountstatic = new Account($db);
-$companystatic = new Societe($db);
+$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
+$sortfield = GETPOST("sortfield", 'alpha');
+$sortorder = GETPOST("sortorder", 'alpha');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
-$search_ref = GETPOST("search_ref", "alpha");
-$search_account = GETPOST("search_account", "int");
-$search_paymenttype = GETPOST("search_paymenttype");
-$search_amount = GETPOST("search_amount", 'alpha'); // alpha because we must be able to search on "< x"
-$search_company = GETPOST("search_company", 'alpha');
-$search_payment_num = GETPOST('search_payment_num', 'alpha');
-
-$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
-$sortfield = GETPOST("sortfield", 'alpha');
-$sortorder = GETPOST("sortorder", 'alpha');
-$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
-if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
+if (empty($page) || $page == -1) $page = 0; // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
+
if (!$sortorder) $sortorder = "DESC";
if (!$sortfield) $sortfield = "p.rowid";
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
+$object = new Paiement($db);
$hookmanager->initHooks(array('paymentlist'));
$extrafields = new ExtraFields($db);
-$arrayfields = array();
+$arrayfields = array(
+ 'p.rowid' => array('label'=>"RefPayment", 'checked'=>1, 'position'=>10),
+ 'p.datep' => array('label'=>"Date", 'checked'=>1, 'position'=>20),
+ 's.nom' => array('label'=>"ThirdParty", 'checked'=>1, 'position'=>30),
+ 'c.libelle' => array('label'=>"Type", 'checked'=>1, 'position'=>40),
+ 'transaction' => array('label'=>"BankTransactionLine", 'checked'=>1, 'position'=>50, 'enabled'=>(!empty($conf->banque->enabled))),
+ 'ba.label' => array('label'=>"Account", 'checked'=>1, 'position'=>60, 'enabled'=>(!empty($conf->banque->enabled))),
+ 'p.num_payment' => array('label'=>"Numero", 'checked'=>1, 'position'=>70, 'tooltip'=>"ChequeOrTransferNumber"),
+ 'p.amount' => array('label'=>"Amount", 'checked'=>1, 'position'=>80),
+ 'p.statut' => array('label'=>"Status", 'checked'=>1, 'position'=>90, 'enabled'=>(!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))),
+);
+$arrayfields = dol_sort_array($arrayfields, 'position');
/*
* Actions
*/
-if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
-{
- $search_ref = "";
- $search_account = "";
- $search_amount = "";
- $search_paymenttype = "";
- $search_payment_num = "";
- $search_company = "";
- $day = '';
- $year = '';
- $month = '';
- $search_array_options = array();
+$parameters = array('socid'=>$socid);
+$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
+if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+
+
+if (empty($reshook)) {
+ include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
+
+ // All tests are required to be compatible with all browsers
+ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
+ $search_ref = '';
+ $search_account = '';
+ $search_amount = '';
+ $search_paymenttype = '';
+ $search_payment_num = '';
+ $search_company = '';
+ $day = '';
+ $year = '';
+ $month = '';
+ $option = '';
+ $toselect = '';
+ $search_array_options = array();
+ }
}
-
/*
- * View
+ * View
*/
$form = new Form($db);
$formother = new FormOther($db);
+$accountstatic = new Account($db);
+$companystatic = new Societe($db);
+$bankline = new AccountLine($db);
llxHeader('', $langs->trans('ListPayment'));
-if (GETPOST("orphelins", "alpha"))
-{
- // Payments not linked to an invoice. Should not happend. For debug only.
- $sql = "SELECT p.rowid, p.ref, p.datep as dp, p.amount,";
- $sql .= " p.statut, p.num_paiement as num_payment,";
- $sql .= " c.code as paiement_code";
+if (GETPOST("orphelins", "alpha")) {
+ // Payments not linked to an invoice. Should not happend. For debug only.
+ $sql = "SELECT p.rowid, p.ref, p.datep, p.amount, p.statut, p.num_paiement as num_payment";
+ $sql .= ", c.code as paiement_code";
+
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
- $sql .= " FROM ".MAIN_DB_PREFIX."paiement as p LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id";
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
- $sql .= " WHERE p.entity IN (".getEntity('invoice').")";
- $sql .= " AND pf.fk_facture IS NULL";
+ $sql .= " FROM ".MAIN_DB_PREFIX."paiement as p LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
+ $sql .= " WHERE p.entity IN (".getEntity('invoice').")";
+ $sql .= " AND pf.fk_facture IS NULL";
+
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
} else {
- $sql = "SELECT DISTINCT p.rowid, p.ref, p.datep as dp, p.amount,"; // DISTINCT is to avoid duplicate when there is a link to sales representatives
- $sql .= " p.statut, p.num_paiement as num_payment,";
- $sql .= " c.code as paiement_code,";
- $sql .= " ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.fk_accountancy_journal as accountancy_journal,";
- $sql .= " s.rowid as socid, s.nom as name, s.email";
+ // DISTINCT is to avoid duplicate when there is a link to sales representatives
+ $sql = "SELECT DISTINCT p.rowid, p.ref, p.datep, p.fk_bank, p.amount, p.statut, p.num_paiement as num_payment";
+ $sql .= ", c.code as paiement_code";
+ $sql .= ", ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.fk_accountancy_journal as accountancy_journal";
+ $sql .= ", s.rowid as socid, s.nom as name, s.email";
+
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
- $sql .= " FROM ".MAIN_DB_PREFIX."paiement as p";
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id";
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank = b.rowid";
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON pf.fk_facture = f.rowid";
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";
- if (!$user->rights->societe->client->voir && !$socid)
- {
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
- }
- $sql .= " WHERE p.entity IN (".getEntity('invoice').")";
- if (!$user->rights->societe->client->voir && !$socid)
- {
- $sql .= " AND sc.fk_user = ".$user->id;
- }
- if ($socid > 0) $sql .= " AND f.fk_soc = ".$socid;
- if ($userid)
- {
- if ($userid == -1) $sql .= " AND f.fk_user_author IS NULL";
- else $sql .= " AND f.fk_user_author = ".$userid;
- }
- // Search criteria
- $sql .= dolSqlDateFilter("p.datep", $day, $month, $year);
- if ($search_ref) $sql .= natural_search('p.ref', $search_ref);
- if ($search_account > 0) $sql .= " AND b.fk_account=".$search_account;
- if ($search_paymenttype != "") $sql .= " AND c.code='".$db->escape($search_paymenttype)."'";
- if ($search_payment_num != '') $sql .= natural_search('p.num_paiement', $search_payment_num);
- if ($search_amount) $sql .= natural_search('p.amount', $search_amount, 1);
- if ($search_company) $sql .= natural_search('s.nom', $search_company);
+ $sql .= " FROM ".MAIN_DB_PREFIX."paiement as p";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_paiement = c.id";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank = b.rowid";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON pf.fk_facture = f.rowid";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";
+ if (!$user->rights->societe->client->voir && !$socid) {
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
+ }
+ $sql .= " WHERE p.entity IN (".getEntity('invoice').")";
+ if (!$user->rights->societe->client->voir && !$socid) {
+ $sql .= " AND sc.fk_user = ".$user->id;
+ }
+ if ($socid > 0) {
+ $sql .= " AND f.fk_soc = ".$socid;
+ }
+ if ($userid) {
+ if ($userid == -1) $sql .= " AND f.fk_user_author IS NULL";
+ else $sql .= " AND f.fk_user_author = ".$userid;
+ }
+
+ // Search criteria
+ $sql .= dolSqlDateFilter("p.datep", $day, $month, $year);
+ if ($search_ref) $sql .= natural_search('p.ref', $search_ref);
+ if ($search_account > 0) $sql .= " AND b.fk_account=".$search_account;
+ if ($search_paymenttype != '') $sql .= " AND c.code='".$db->escape($search_paymenttype)."'";
+ if ($search_payment_num != '') $sql .= natural_search('p.num_paiement', $search_payment_num);
+ if ($search_amount) $sql .= natural_search('p.amount', $search_amount, 1);
+ if ($search_company) $sql .= natural_search('s.nom', $search_company);
+
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
@@ -177,209 +206,278 @@ if (GETPOST("orphelins", "alpha"))
$sql .= $db->order($sortfield, $sortorder);
$nbtotalofrecords = '';
-if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
-{
+if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
- if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
- {
+
+ // if total resultset is smaller then paging size (filtering), goto and load page 0
+ if (($page * $limit) > $nbtotalofrecords) {
$page = 0;
$offset = 0;
}
}
$sql .= $db->plimit($limit + 1, $offset);
-//print "$sql";
$resql = $db->query($sql);
-if ($resql)
-{
- $num = $db->num_rows($resql);
-
- $param = '';
- if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
- if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
- $param .= (GETPOST("orphelins") ? "&orphelins=1" : "");
- $param .= ($search_ref ? "&search_ref=".urlencode($search_ref) : "");
- $param .= ($search_company ? "&search_company=".urlencode($search_company) : "");
- $param .= ($search_amount ? "&search_amount=".urlencode($search_amount) : "");
- $param .= ($search_payment_num ? "&search_payment_num=".urlencode($search_payment_num) : "");
- if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
-
- print '\n";
-} else {
- dol_print_error($db);
+if (!$resql) {
+ dol_print_error($db);
+ llxFooter();
+ $db->close();
+ exit;
}
+$num = $db->num_rows($resql);
+
+$param = '';
+if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
+if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
+$param .= (GETPOST("orphelins") ? "&orphelins=1" : '');
+$param .= ($search_ref ? "&search_ref=".urlencode($search_ref) : '');
+$param .= ($search_company ? "&search_company=".urlencode($search_company) : '');
+$param .= ($search_amount ? "&search_amount=".urlencode($search_amount) : '');
+$param .= ($search_payment_num ? "&search_payment_num=".urlencode($search_payment_num) : '');
+if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
+
+print '";
+
// End of page
llxFooter();
$db->close();
diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php
index 531fb885f63..8199a62201b 100644
--- a/htdocs/contact/list.php
+++ b/htdocs/contact/list.php
@@ -571,7 +571,7 @@ if ($search_firstlast_only)
}
$moreforfilter = '';
-if (!empty($conf->categorie->enabled))
+if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '';
@@ -594,21 +594,20 @@ if (!empty($conf->categorie->enabled))
$moreforfilter .= $formother->select_categories(Categorie::TYPE_SUPPLIER, $search_categ_supplier, 'search_categ_supplier', 1);
$moreforfilter .= '
';
}
- $moreforfilter .= '';
- $moreforfilter .= $langs->trans('Roles').': ';
- $moreforfilter .= $formcompany->showRoles("search_roles", $objecttmp, 'edit', $search_roles);
- $moreforfilter .= '
';
-}
-if ($moreforfilter)
-{
- print '';
- print $moreforfilter;
- $parameters = array('type'=>$type);
- $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
- print $hookmanager->resPrint;
- print '
';
}
+$moreforfilter .= '';
+$moreforfilter .= $langs->trans('Roles').': ';
+$moreforfilter .= $formcompany->showRoles("search_roles", $objecttmp, 'edit', $search_roles);
+$moreforfilter .= '
';
+
+print '';
+print $moreforfilter;
+$parameters = array('type'=>$type);
+$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
+print $hookmanager->resPrint;
+print '
';
+
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php
index 608fc6c0d81..04329a63145 100644
--- a/htdocs/contrat/list.php
+++ b/htdocs/contrat/list.php
@@ -416,7 +416,7 @@ if ($user->rights->user->user->lire)
$moreforfilter .= ' ';
}
// If the user can view categories of products
-if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
+if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '';
diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php
index 3f9de5533fc..37bee98d73f 100644
--- a/htdocs/expedition/list.php
+++ b/htdocs/expedition/list.php
@@ -408,7 +408,7 @@ if ($resql)
$moreforfilter .= '
';
}
// If the user can view prospects other than his'
- if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
+ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '';
@@ -417,7 +417,7 @@ if ($resql)
$moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter .= '
';
}
- if (!empty($conf->categorie->enabled))
+ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '';
diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php
index a1dfb78a2c5..8bbd73ad016 100644
--- a/htdocs/fourn/commande/list.php
+++ b/htdocs/fourn/commande/list.php
@@ -782,7 +782,7 @@ if ($resql)
$moreforfilter .= '
';
}
// If the user can view prospects other than his'
- if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
+ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '';
diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php
index 66e94d461a4..337f2a9a000 100644
--- a/htdocs/fourn/facture/list.php
+++ b/htdocs/fourn/facture/list.php
@@ -595,7 +595,7 @@ if ($resql)
$moreforfilter .= '
';
}
// If the user can view prospects other than his'
- if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
+ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '';
diff --git a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php
index 4c5951dad70..be6d42047ce 100644
--- a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php
+++ b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php
@@ -102,6 +102,19 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers
// Put here code you want to execute when a Dolibarr business events occurs.
// Data and type of action are stored into $object and $action
+ // You can isolate code for each action in a separate method: this method should be named like the trigger in camelCase.
+ // For example : COMPANY_CREATE => public function companyCreate($action, $object, User $user, Translate $langs, Conf $conf)
+ $methodName = lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', strtolower($action)))));
+ $callback = array($this, $methodName);
+ if (is_callable($callback)){
+ dol_syslog(
+ "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
+ );
+
+ return call_user_func($callback, $action, $object, $user, $langs, $conf);
+ };
+
+ // Or you can execute some code here
switch ($action) {
// Users
//case 'USER_CREATE':
diff --git a/htdocs/product/list.php b/htdocs/product/list.php
index a0bfa073afa..4abf8fd4a8b 100644
--- a/htdocs/product/list.php
+++ b/htdocs/product/list.php
@@ -593,7 +593,7 @@ if ($resql)
// Filter on categories
$moreforfilter = '';
- if (!empty($conf->categorie->enabled))
+ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
$moreforfilter .= '
';
$moreforfilter .= $langs->trans('Categories').': ';
diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php
index b0f593f82d9..f717e541229 100644
--- a/htdocs/product/stock/list.php
+++ b/htdocs/product/stock/list.php
@@ -375,7 +375,7 @@ if ($search_all)
$moreforfilter = '';
-if (!empty($conf->categorie->enabled))
+if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
$formcategory = new FormCategory($db);
$moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_WAREHOUSE, $search_category_list);
diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php
index a2eb2d1938c..7c85327545d 100644
--- a/htdocs/projet/list.php
+++ b/htdocs/projet/list.php
@@ -496,7 +496,7 @@ if ($search_all)
$moreforfilter = '';
// Filter on categories
-if (!empty($conf->categorie->enabled))
+if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
$formcategory = new FormCategory($db);
$moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PROJECT, $search_category_array);
diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php
index 7d1a8354bb3..f2d455f7a04 100644
--- a/htdocs/projet/tasks/list.php
+++ b/htdocs/projet/tasks/list.php
@@ -458,7 +458,7 @@ if ($search_all)
$morehtmlfilter = '';
// Filter on categories
-if (!empty($conf->categorie->enabled))
+if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '
';
diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php
index 54ee7d5310c..ed861220816 100644
--- a/htdocs/societe/list.php
+++ b/htdocs/societe/list.php
@@ -663,7 +663,7 @@ if ($search_all)
$moreforfilter = '';
if (empty($type) || $type == 'c' || $type == 'p')
{
- if (!empty($conf->categorie->enabled))
+ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '
';
@@ -674,7 +674,7 @@ if (empty($type) || $type == 'c' || $type == 'p')
}
if (empty($type) || $type == 'f')
{
- if (!empty($conf->categorie->enabled))
+ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '
';
diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php
index b0f8bf40609..7f2576ca0f6 100644
--- a/htdocs/supplier_proposal/list.php
+++ b/htdocs/supplier_proposal/list.php
@@ -463,7 +463,7 @@ if ($resql)
$moreforfilter .= '
';
}
// If the user can view products
- if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
+ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '
';
diff --git a/htdocs/user/list.php b/htdocs/user/list.php
index 0bed08c3c31..ef19ebefe26 100644
--- a/htdocs/user/list.php
+++ b/htdocs/user/list.php
@@ -482,7 +482,7 @@ $moreforfilter = '';
$moreforfilter.= '
';*/
// Filter on categories
-if (!empty($conf->categorie->enabled))
+if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
$moreforfilter .= '
';
$moreforfilter .= $langs->trans('Categories').': ';