Probesys / glpi-plugins-groupcategory

GLPI plugin that allows to limit the number of categories available for ticket requesters.
GNU Affero General Public License v3.0
5 stars 4 forks source link

Now to install glpi 9.4 #5

Closed hawatius closed 5 years ago

hawatius commented 5 years ago

Hi. It is possible to install the plugin on GLPI 9.4? Error: `[error] 7757#7757: *1805656 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Error: Call to undefined function TableExists() in /var/www/glpi/plugins/groupcategory/hook.php:12 Stack trace:

0 /var/www/glpi/inc/plugin.class.php(493): plugin_groupcategory_install()

1 /var/www/glpi/front/plugin.form.php(47): Plugin->install('8')

2 {main}

`

thiagopassamani commented 5 years ago

Alter code of TableExists() to $DB->TableExists.

lucioaquino commented 5 years ago

It´s ok for the installation , but not ok , for use .

=============================================================

function plugin_groupcategory_install() { global $DB;

if (!$DB->TableExists(getTableForItemType('PluginGroupcategoryGroupcategory'))) {
    $create_table_query = "
        CREATE TABLE IF NOT EXISTS `" . getTableForItemType('PluginGroupcategoryGroupcategory') . "`
        (
            `id` INT(11) NOT NULL AUTO_INCREMENT,
            `group_id` INT(11) NOT NULL,
            `category_ids` TEXT NOT NULL,
            PRIMARY KEY (`id`),
            INDEX (`group_id`)
        )
        COLLATE='utf8_unicode_ci'
        ENGINE=MyISAM
    ";
    $DB->query($create_table_query) or die($DB->error());
}

return true;

}

hawatius commented 5 years ago

The plugin is installed, but does not work

[Thu Aug 29 09:40:40.296345 2019] [:error] [pid 22923] [client :58636] PHP Fatal error: Uncaught Error: Call to undefined method PluginGroupcategoryGroupcategory::getFromDBByQuery() in /var/www/glpi/plugins/groupcategory/inc/groupcategory.class.php:39\nStack trace:\n#0 /var/www/glpi/plugins/groupcategory/hook.php(87): PluginGroupcategoryGroupcategory::getSelectedCategoriesForGroup(Object(Group))\n#1 /var/www/glpi/plugins/groupcategory/hook.php(63): plugin_groupcategory_post_show_group(Object(Group))\n#2 /var/www/glpi/inc/plugin.class.php(1091): plugin_groupcategory_post_show_item(Array)\n#3 /var/www/glpi/inc/commonglpi.class.php(476): Plugin::doHook('post_show_item', Array)\n#4 /var/www/glpi/inc/commonglpi.class.php(452): CommonGLPI::displayStandardTab(Object(Group), 'Group$main', '', Array)\n#5 /var/www/glpi/ajax/common.tabs.php(92): CommonGLPI::displayStandardTab(Object(Group), '-1', '', Array)\n#6 {main}\n thrown in /var/www/glpi/plugins/groupcategory/inc/groupcategory.class.php on line 39, referer: https://glpiru.local/front/group.form.php?id=4