From 97404460ee1c6ece343ce23072e7da8d710efce6 Mon Sep 17 00:00:00 2001 From: Noizette Date: Sun, 16 Apr 2023 00:51:55 +0200 Subject: [PATCH] Add new menu item call --- install.php | 5 ++++- lib/Facture.php | 5 +++++ upgrade.php | 6 ++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/install.php b/install.php index 42e3480..8ed3d95 100644 --- a/install.php +++ b/install.php @@ -1,10 +1,13 @@ import(dirname(__FILE__) . "/data/schema.sql"); $path = __DIR__.'/data/default_sign.png'; -$png = (new File)->createAndStore('skel/plugin/facturation','sign.png', $path, null); \ No newline at end of file +$png = (new File)->createAndStore('skel/plugin/facturation','sign.png', $path, null); + +$plugin->registerSignal('menu.item', [Facture::class, 'menuItem']); \ No newline at end of file diff --git a/lib/Facture.php b/lib/Facture.php index aa2f23d..bc6cfc3 100644 --- a/lib/Facture.php +++ b/lib/Facture.php @@ -523,4 +523,9 @@ class Facture { return DB::getInstance()->delete('plugin_facturation_factures', 'id = '. (int)$id); } + + public static function menuItem(array $params, array &$list): void + { + $list['plugin_facturation'] = sprintf('Facturation', \Garradin\ADMIN_URL); + } } diff --git a/upgrade.php b/upgrade.php index 5588674..b83f80e 100644 --- a/upgrade.php +++ b/upgrade.php @@ -198,4 +198,10 @@ EOT if (version_compare($infos->version, '0.7.1', '<')) { $plugin->setConfig('ttc', false); +} + +// 0.7.4 - Signal menu item +if (version_compare($infos->version, '0.7.4', '<')) +{ + $plugin->registerSignal('menu.item', [Facture::class, 'menuItem']); } \ No newline at end of file