NEW : Execute doActions on statistics pages (#29851)

* NEW : Execute doActions on statistics pages

* Update index.php

* Update index.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
Zephyriony 2024-06-09 13:39:00 +02:00 committed by GitHub
parent acd8fdc24e
commit 2bfa92983c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 25 additions and 0 deletions

View File

@ -40,6 +40,8 @@ $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height');
$mode = GETPOSTISSET("mode") ? GETPOST("mode", 'aZ09') : 'customer';
$hookmanager->initHooks(array('propalstats', 'globalcard'));
$object_status = GETPOST('object_status', 'intcomma');
$typent_id = GETPOSTINT('typent_id');
$categ_id = GETPOSTINT('categ_id');
@ -52,6 +54,12 @@ if ($user->socid > 0) {
$socid = $user->socid;
}
$parameters = array();
$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');
}
$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
$year = GETPOST('year') > 0 ? GETPOSTINT('year') : $nowyear;
$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS'))));

View File

@ -41,6 +41,8 @@ $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height');
$mode = GETPOSTISSET("mode") ? GETPOST("mode", 'aZ09') : 'customer';
$hookmanager->initHooks(array('orderstats', 'globalcard'));
$usercanreadcustumerstatistic = $user->hasRight('commande', 'lire');
$usercanreadsupplierstatistic = $user->hasRight('fournisseur', 'commande', 'lire');
if (getDolGlobalInt('MAIN_NEED_EXPORT_PERMISSION_TO_READ_STATISTICS')) {
@ -73,6 +75,12 @@ if ($user->socid > 0) {
$socid = $user->socid;
}
$parameters = array();
$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');
}
$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
$year = GETPOST('year') > 0 ? GETPOST('year') : $nowyear;
$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS'))));

View File

@ -44,6 +44,9 @@ $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height');
$langs->loadLangs(array('bills', 'companies', 'other'));
$mode = GETPOST("mode") ? GETPOST("mode") : 'customer';
$hookmanager->initHooks(array('invoicestats', 'globalcard'));
if ($mode == 'customer' && !$user->hasRight('facture', 'lire')) {
accessforbidden();
}
@ -64,6 +67,12 @@ if ($user->socid > 0) {
$socid = $user->socid;
}
$parameters = array();
$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');
}
$nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
$year = GETPOST('year') > 0 ? GETPOSTINT('year') : $nowyear;
$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS'))));