Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 47 additions & 1 deletion src/Cartridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,24 @@ public function backToStock(array $input, $history = true)
'id' => $input['id'],
]
);
return $result && ($DB->affectedRows() > 0);
if ($result && ($DB->affectedRows() > 0)) {
$changesCartrige = [
0,
'',
sprintf(__('Cartridge (%1$s): back to stock'), $input['id']),
];
$this->getFromDB($input['id']);
Log::history(
$this->fields['cartridgeitems_id'],
CartridgeItem::class,
$changesCartrige,
Cartridge::class,
Log::HISTORY_UPDATE_SUBITEM
);
return true;
}

return false;
}

// SPECIFIC FUNCTIONS
Expand Down Expand Up @@ -302,6 +319,20 @@ public function install($pID, $tID)
__('Installing a cartridge'),
];
Log::history($pID, 'Printer', $changes, 0, Log::HISTORY_LOG_SIMPLE_MESSAGE);

$changesCartrige = [
0,
'',
sprintf(__('Instal the cartridge %1$s on printer : %2$s'), $cID, $pID),
];
$this->getFromDB($cID);
Log::history(
$this->fields['cartridgeitems_id'],
CartridgeItem::class,
$changesCartrige,
Cartridge::class,
Log::HISTORY_UPDATE_SUBITEM
);
return true;
}
} else {
Expand Down Expand Up @@ -355,6 +386,21 @@ public function uninstall($ID)
Log::HISTORY_LOG_SIMPLE_MESSAGE
);

$this->getFromDB($ID);
$changesCartrige = [
0,
'',
sprintf(__('Uninstal the cartridge %1$s for end life'), $ID),
];

Log::history(
$this->fields['cartridgeitems_id'],
CartridgeItem::class,
$changesCartrige,
Cartridge::class,
Log::HISTORY_UPDATE_SUBITEM
);

return true;
}
}
Expand Down
33 changes: 33 additions & 0 deletions src/Consumable.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,19 @@ public function backToStock(array $input, $history = true)
]
);
if ($result) {

$this->getFromDB($input['id']);
Log::history(
$this->fields["consumableitems_id"],
ConsumableItem::class,
[
0,
'',
sprintf(__('Return %1$s (%2$s) to stock'), $this->getPreAdditionalInfosForName(), $input['id']),
],
static::class,
Log::HISTORY_UPDATE_SUBITEM
);
return true;
}
return false;
Expand Down Expand Up @@ -188,6 +201,26 @@ public function out($ID, $itemtype = '', $items_id = 0)
]
);
if ($result) {
$item = getItemForItemtype($itemtype);
$item->getFromDB($items_id);
Log::history(
$this->fields["consumableitems_id"],
ConsumableItem::class,
[
0,
'',
sprintf(
__('%1$s (%2$s) given to : %3$s (%4$s id %5$s)'),
$this->getPreAdditionalInfosForName(),
$ID,
$item->fields['name'],
__($itemtype),
$item->fields['id']
),
],
static::class,
Log::HISTORY_UPDATE_SUBITEM
);
return true;
}
}
Expand Down
Loading