From cd3454450bca289a425ecf180ec3365bd22b632d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 29 Mar 2026 15:40:18 +0200 Subject: [PATCH] Clean code --- htdocs/accountancy/admin/template/list.php | 2 +- htdocs/ai/admin/log_viewer.php | 2 +- htdocs/compta/cashcontrol/report.php | 2 +- htdocs/compta/paiement/document.php | 37 +++++++++++----------- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/htdocs/accountancy/admin/template/list.php b/htdocs/accountancy/admin/template/list.php index 6a23692fb2a..af12705b243 100644 --- a/htdocs/accountancy/admin/template/list.php +++ b/htdocs/accountancy/admin/template/list.php @@ -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"); diff --git a/htdocs/ai/admin/log_viewer.php b/htdocs/ai/admin/log_viewer.php index 1a433409a25..6e230407307 100644 --- a/htdocs/ai/admin/log_viewer.php +++ b/htdocs/ai/admin/log_viewer.php @@ -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"); diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php index 7bcff4361ca..05c637f1038 100644 --- a/htdocs/compta/cashcontrol/report.php +++ b/htdocs/compta/cashcontrol/report.php @@ -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'; diff --git a/htdocs/compta/paiement/document.php b/htdocs/compta/paiement/document.php index 479bb790e4a..fdbb3ac4671 100644 --- a/htdocs/compta/paiement/document.php +++ b/htdocs/compta/paiement/document.php @@ -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);