Skip to content

Commit

Permalink
add column type in cartridge tab of a printer - fixed #5275
Browse files Browse the repository at this point in the history
  • Loading branch information
yllen committed May 29, 2015
1 parent ae97fec commit 8a40da3
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions inc/cartridge.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -865,9 +865,12 @@ static function showForPrinter(Printer $printer, $old=0) {
`glpi_cartridges`.`pages` AS pages,
`glpi_cartridges`.`date_use` AS date_use,
`glpi_cartridges`.`date_out` AS date_out,
`glpi_cartridges`.`date_in` AS date_in
`glpi_cartridges`.`date_in` AS date_in,
`glpi_cartridgeitemtypes`.`name` AS typename
FROM `glpi_cartridges`,
`glpi_cartridgeitems`
LEFT JOIN `glpi_cartridgeitemtypes`
on (`glpi_cartridgeitems`.`cartridgeitemtypes_id` = `glpi_cartridgeitemtypes`.`id`)
WHERE (`glpi_cartridges`.`date_out` IS ".($old?"NOT":"")." NULL
AND `glpi_cartridges`.`printers_id` = '$instID'
AND `glpi_cartridges`.`cartridgeitems_id` = `glpi_cartridgeitems`.`id`)
Expand Down Expand Up @@ -936,9 +939,9 @@ static function showForPrinter(Printer $printer, $old=0) {
echo "<table class='tab_cadre_fixehov'>";
echo "<tr class='noHover'>";
if ($old == 0) {
echo "<th colspan='".($canedit?'5':'4')."'>".__('Used cartridges')."</th>";
echo "<th colspan='".($canedit?'6':'5')."'>".__('Used cartridges')."</th>";
} else {
echo "<th colspan='".($canedit?'8':'7')."'>".__('Worn cartridges')."</th>";
echo "<th colspan='".($canedit?'9':'8')."'>".__('Worn cartridges')."</th>";
}
echo "</tr>";

Expand All @@ -954,6 +957,7 @@ static function showForPrinter(Printer $printer, $old=0) {
$header_end .= "</th>";
}
$header_end .= "<th>".__('ID')."</th><th>"._n('Cartridge model','Cartridge models',1)."</th>";
$header_end .= "<th>"._n('Cartridge type','Cartridge types',1)."</th>";
$header_end .= "<th>".__('Add date')."</th>";
$header_end .= "<th>".__('Use date')."</th>";
if ($old != 0) {
Expand All @@ -971,6 +975,7 @@ static function showForPrinter(Printer $printer, $old=0) {

while ($data = $DB->fetch_assoc($result)) {
$cart_id = $data["id"];
$typename = $data["typename"];
$date_in = Html::convDate($data["date_in"]);
$date_use = Html::convDate($data["date_use"]);
$date_out = Html::convDate($data["date_out"]);
Expand Down Expand Up @@ -1000,6 +1005,7 @@ static function showForPrinter(Printer $printer, $old=0) {
echo "<a href=\"".$CFG_GLPI["root_doc"]."/front/cartridgeitem.form.php?id=".$data["tID"]."\">";
printf(__('%1$s - %2$s'), $data["type"], $data["ref"]);
echo "</a></td>";
echo "<td class='center' $viewitemjs>".$typename."</td>";
echo "<td class='center' $viewitemjs>".$date_in."</td>";
echo "<td class='center' $viewitemjs>".$date_use."</td>";

Expand Down

0 comments on commit 8a40da3

Please sign in to comment.