Clean code

This commit is contained in:
Laurent Destailleur 2026-03-29 15:40:18 +02:00
parent fbd04a83ef
commit cd3454450b
4 changed files with 21 additions and 22 deletions

View file

@ -55,7 +55,7 @@ $optioncss = GETPOST('optioncss', 'aZ');
$mode = GETPOST('mode', 'aZ');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");

View file

@ -59,7 +59,7 @@ $search_time_max = GETPOST('search_time_max', 'alpha');
$search_status = GETPOST('search_status', 'alpha');
// Pagination parameters
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTINT("page");

View file

@ -63,7 +63,7 @@ $summaryonly = GETPOSTINT('summaryonly'); // May be used for ticket Z
$object = new CashControl($db);
$object->fetch($id);
//$limit = GETPOST('limit')?GETPOST('limit', 'int'):$conf->liste_limit;
//$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
$sortorder = 'ASC';
$sortfield = 'b.datev,b.dateo,b.rowid';

View file

@ -31,6 +31,13 @@
*/
require '../../main.inc.php';
/**
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
@ -41,14 +48,6 @@ if (isModEnabled('project')) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
}
/**
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
// Load translation files required by the page
$langs->loadLangs(array('bills', 'banks', 'companies', 'suppliers', 'other'));
@ -57,15 +56,8 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
// Security check
if ($user->socid) {
$socid = $user->socid;
}
if ($object !== null) {
$result = restrictedArea($user, $object->element, $object->id, 'payment', '');
}
// Get parameters
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT('page');
@ -92,9 +84,17 @@ if ($object->fetch($id, $ref)) {
$upload_dir = null;
}
// Security check
if ($user->socid) {
$socid = $user->socid;
}
if ($object !== null) {
$result = restrictedArea($user, $object->element, $object->id, 'payment', '');
}
$permissiontoadd = ($user->hasRight('facture', 'creer')); // Used by the include of actions_setnotes.inc.php
/*
* Actions
*/
@ -106,10 +106,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
* View
*/
$form = new Form($db);
$title = $langs->trans('Payment')." - ".$langs->trans('Documents');
llxHeader('', $title);
$help_url = '';
llxHeader('', $title, $help_url);
if ($object->id > 0 && $upload_dir !== null) {
$head = payment_prepare_head($object);