InfotelGLPI / printercounters

Plugin Printercounters for GLPI
http://blogglpi.infotel.com
GNU General Public License v2.0
14 stars 9 forks source link

New pt-BR translation and Bugfixes #82

Closed eduardomozart closed 3 years ago

eduardomozart commented 3 years ago

Update search.class.php: See #69

Bugfix and pt-BR Translation: A pt_BR translation was added to the columns title of reports. There was a bug at printercountersreport4.en_GB.php that shows the title of the report as "Array" because it's translation variables was defined as an Array instead of Strings. The "%s1" and "%s2" variables was replaced by "%s" and "%s" because it was printing something like "Page number from 11-18-20201 to 11-18-20202" (note the "1" and "2" after "2020").

Update printercountersreport5.php: (Replaced by "Fix for getting IP address for printers without a Networkname") The printercountersreport5.php report was failing to generate when a printer has 2 or more Network Ports with the SQL error: "Subquery returns more than 1 row in query". It's possible a printer have 2 or more Network Ports. This bugfix uses the 'mainitemtype' column from 'glpi_ipaddresses' table instead of 'itemtype' from 'glpi_networkports' to select the row with the IP address of the printer.

New translations: Translated to pt_BR missing columns from reports.

Fix for no "Records amount" into Complementary Report: This is a complementary fix for #69. When generating the report "Complementary report", it didn't calculate the "Records amount" when a printer is into "Root Entity" because the $budget['entities_id'] value is stored as an integer into report/printercountersreport3/printercountersreport3.php. The entity ID from "Root Entity" is 0. The script printercountersreport3.php calls the function $budget->getRecordsAmountForBudget from inc\budget.class.php that calls this->getRecordAmount. The getRecordAmount function from budget.class.php checks if the $budget['entity_id'] is empty (line 556) through $budget['entities_id'] != null, but this also considerates 0 ("Root Entity" ID) as null. Changing it to !is_null($budget['entities_id']]) checks if entities_id is not null and consider the "Root Entity" ID (0) as not null. The budget button at the plug-in menu (Tools > Printer counters) and the "Complementary report" are working normally with this fix.

Fix for getting IP address for printers without a Networkname: Fix to get IP address from printers that has no entry in "glpi_networknames" table.

Fix for HP M551: See #81