Fix warning

This commit is contained in:
Laurent Destailleur 2022-12-24 15:59:08 +01:00
parent 41256352fe
commit 7d2804bd32
2 changed files with 25 additions and 25 deletions

View File

@ -32,18 +32,6 @@ require_once DOL_DOCUMENT_ROOT.'/margin/lib/margins.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('companies', 'bills', 'products', 'margins'));
// Security check
$socid = GETPOST('socid', 'int');
$TSelectedProducts = GETPOST('products', 'array');
$TSelectedCats = GETPOST('categories', 'array');
if (!empty($user->socid)) {
$socid = $user->socid;
}
$result = restrictedArea($user, 'societe', '', '');
$result = restrictedArea($user, 'margins');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
@ -74,6 +62,17 @@ if (GETPOST('enddatemonth')) {
$object = new Societe($db);
$hookmanager->initHooks(array('margincustomerlist'));
// Security check
$socid = GETPOST('socid', 'int');
$TSelectedProducts = GETPOST('products', 'array');
$TSelectedCats = GETPOST('categories', 'array');
if (!empty($user->socid)) {
$socid = $user->socid;
}
$result = restrictedArea($user, 'societe', '', '');
$result = restrictedArea($user, 'margins');
/*
* View
@ -157,7 +156,7 @@ print img_picto('', 'product').$form->multiselectarray('products', $TProducts, $
print '</td></tr>';
// Categories
$TCats = $form->select_all_categories(0, array(), '', 64, 0, 1);
$TCats = $form->select_all_categories('product', array(), '', 64, 0, 1);
print '<tr>';
print '<td class="titlefield">'.$langs->trans('Category').'</td>';

View File

@ -38,17 +38,7 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$TSelectedCats = GETPOST('categories', 'array');
// Security check
$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
if (!empty($user->socid)) {
$socid = $user->socid;
}
$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
if (empty($user->rights->margins->liretous)) {
accessforbidden();
}
$socid = 0;
$mesg = '';
@ -85,6 +75,17 @@ if (GETPOST('enddatemonth')) {
$object = new Product($db);
$hookmanager->initHooks(array('marginproductlist'));
// Security check
$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
if (!empty($user->socid)) {
$socid = $user->socid;
}
$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
if (empty($user->rights->margins->liretous)) {
accessforbidden();
}
/*
* View
@ -119,7 +120,7 @@ print img_picto('', 'product').$form->select_produits(($id > 0 ? $id : ''), 'id'
print '</td></tr>';
// Categories
$TCats = $form->select_all_categories(0, array(), '', 64, 0, 1);
$TCats = $form->select_all_categories('product', array(), '', 64, 0, 1);
print '<tr>';
print '<td class="titlefield">'.$langs->trans('Category').'</td>';