Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include fields plugin with values #48

Closed
miguelanruiz opened this issue Sep 8, 2023 · 2 comments
Closed

Include fields plugin with values #48

miguelanruiz opened this issue Sep 8, 2023 · 2 comments

Comments

@miguelanruiz
Copy link

Hi there,

I noticed that the additionalfields related to equipment aren't currently being included in the reports.

It would be immensely beneficial for community and potentially other users if these fields could be incorporated into the report generation. The additionalfields provide critical context and data that would enhance the quality and comprehensiveness of the reports.

I understand that there are various considerations when updating functionalities, and I'd be happy to provide further details or examples if needed.

Thank you for your continuous efforts and dedication to improving the tool. I appreciate any consideration you can give to this request.

@miguelanruiz
Copy link
Author

PR #49

@yllen
Copy link
Owner

yllen commented Nov 7, 2023

I can't manage all others plugins.
Each plugin must define what it wants to display in PDF, the plugin allow it.

How to do in Fields plugin:
in setup add

$PLUGIN_HOOKS['plugin_pdf']['PluginFields] = 'NameOfYourClassPDF';

in inc/NameOfYourClassPDF

`class PluginGeststockReservationPDF extends PluginPdfCommon {

function __construct(CommonGLPI $obj=NULL) {

  $this->obj = ($obj ? $obj : new PluginFieldsClassYouWantToDisplay());

}

function defineAllTabsPDF($options=[]) {

  $onglets = parent::defineAllTabs($options);
  return $onglets;

}

static function displayTabContentForPDF(PluginPdfSimplePDF $pdf, CommonGLPI $item, $tab) {

  switch ($tab) {
     case 'nameItemDisplayedByGLPI'  (normally PluginFieldsClassYouWantToDisplay$main' :
        fonctionToCall(;
        break;

     case 'nameItemDisplayedByGLPI' :
        functionToCall;
        break;

     default :
        return false;
  }
  return true;

}
}`

To help you: https://github.com/yllen/geststock

@yllen yllen closed this as completed Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants