From 11c64470964bc03af0f4363de52e027a0461cf64 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 7 Feb 2020 12:13:55 +0100 Subject: [PATCH] Generic report --- .../template/class/actions_mymodule.class.php | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/htdocs/modulebuilder/template/class/actions_mymodule.class.php b/htdocs/modulebuilder/template/class/actions_mymodule.class.php index 743c46bfc39..45548c28312 100644 --- a/htdocs/modulebuilder/template/class/actions_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/actions_mymodule.class.php @@ -238,5 +238,46 @@ class ActionsMyModule return $ret; } + + + /** + * Overloading the loadDataForCustomReports function : returns data to complete the customreport tool + * + * @param array $parameters Hook metadatas (context, etc...) + * @param string $action Current action (if set). Generally create or edit or null + * @param HookManager $hookmanager Hook manager propagated to allow calling another hook + * @return int < 0 on error, 0 on success, 1 to replace standard code + */ + public function loadDataForCustomReports($parameters, &$action, $hookmanager) + { + global $conf, $user, $langs; + + $langs->load("mymodule@mymodule"); + + $this->results = array(); + + $head = array(); + $h = 0; + + if ($parameters['tabfamily'] == 'mymodule') { + $head[$h][0] = dol_buildpath('/module/index.php', 1); + $head[$h][1] = $langs->trans("Home"); + $head[$h][2] = 'home'; + $h++; + + $this->results['title'] = $langs->trans("MyModule"); + $this->results['picto'] = 'mymodule@mymodule'; + } + + $head[$h][0] = 'customreports.php?objecttype='.$parameters['objecttype'].(empty($parameters['tabfamily'])?'':'&tabfamily='.$parameters['tabfamily']); + $head[$h][1] = $langs->trans("CustomReports"); + $head[$h][2] = 'customreports'; + + $this->results['head'] = $head; + + return 1; + } + + /* Add here any other hooked methods... */ }