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 2022-11-28 20:07:13

ima
Member
Registered: 2021-05-26
Posts: 2

How to receive calculated values from the core? (Order plugin, budget)

Hi,

I am trying to figure out how a plugin can retrieve calculated values from the core.

In my case I want to extend the Order plugin to show a "budget preview". That is: What would the total amount spent on a budget look like, after the pending orders have been processed.

For this I need the Order plugin to know the total value already spent on the budget. Which is a value that is calculated in core class Budget, function showValuesByEntity(). But how can the plugin receive this value?

(I cound reproduce the calculate logic within the plugin code, but that would result in duplicate code. Seems to be very bad programming style to me.)

Shoud I extend the core class Budget? By adding an additional function, like "getTotalAmountSpent()"? Would such a modification of a core class be ever accepted in the official codebase, anyway?

Or do I miss something, and there ist already a way of getting this value from the core?

Offline

Board footer

Powered by FluxBB