You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2021-05-12 17:03:46

Launian
Member
Registered: 2021-05-11
Posts: 8

Help with plugin tab

Hello. I'm new to GLPI, and at work they asked me to fix  a plugin they made to print custom PDF form for an equipment. It worked without a hitch until version 9.3, but when they migrated to 9.5, it stopped working. Now, I managed to install the plugin, but when I open an equipment page, the plugin doesn't show on the tab menu. So, my question is, where in the GLPI code is decided that a plugin should be given its own tab on the glpi_tabs div?

Offline

#2 2021-05-12 21:41:09

oj69
Member
From: Somewhere in the cloud
Registered: 2021-02-01
Posts: 157

Re: Help with plugin tab

What is the name of your plugin ?

Offline

#3 2021-05-13 16:37:14

Launian
Member
Registered: 2021-05-11
Posts: 8

Re: Help with plugin tab

It's an internal plugin fmade by someone at my company some 5 years ago. It's based on the PDF plugin, tho, for printing info about the assets you have.

Offline

#4 2021-05-13 17:08:45

cconard96
Moderator
Registered: 2018-07-31
Posts: 2,336
Website

Re: Help with plugin tab

Tabs are typically defined in the setup.php file in the plugin folder. The lines should be a Plugin::registerClass call with a "addtabon" option.
I would also suggest checking in your Profile to see if there are rights associated with the plugin that are not enabled for you.


GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.

Offline

#5 2021-05-14 18:12:34

oj69
Member
From: Somewhere in the cloud
Registered: 2021-02-01
Posts: 157

Re: Help with plugin tab

If you can not fix your problem maybe it´s a way to install the pdf plugin from glpi marketplace ?

Offline

#6 2021-05-17 18:10:25

Launian
Member
Registered: 2021-05-11
Posts: 8

Re: Help with plugin tab

I tried to do it with the RegisterClass  option, but as far as I can see, none of the lines with that command helped.

What I ended up doing was modifying the original PDF plugin, adding what I needed and changing the layout of the report. But now I have a new problem: I can't figure out what I need to do so GLPI recognizes it as a new plugin instead of the PDF one. I changed the name in the setup.php file, but if I try to add both my plugin and the PDF plugin, I get an error about a function already declared. Is there  a place where I can specify what folder the plugin should be installed in?

Offline

#7 2021-05-18 11:20:37

cconard96
Moderator
Registered: 2018-07-31
Posts: 2,336
Website

Re: Help with plugin tab

You need to change the plugin's folder name to the internal name of your plugin (no spaces, all lowercase). Each function in hooks.php and setup.php need renamed replacing "pdf" with your plugin's internal name.
There are probably other places referring to the "pdf" plugin that you need to change.


GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.

Offline

#8 2021-05-18 16:55:58

Launian
Member
Registered: 2021-05-11
Posts: 8

Re: Help with plugin tab

I figured the name thingy, and I managed to be able to install both plugins at the same time (I just did a massive Find and Replace, replacing all the instances of PluginPdf for PluginNewPdf, and so on), but now I have another new problem: I can't make it show the new Tab on the menu. I even figured out where it's added in the latest PDF Plugin: it's in the plugin_pdf_postinit() function in hook.php; if I comment the line CommonGLPI[...] in the original PDF plugin, the menu tab disappears. But, no matter how I change the name in my modified plugin, it just won't show. I'm honestly at a loss as  to what am I supposed  to do.

Offline

Board footer

Powered by FluxBB