2021-06-05 00:30:48 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Garradin\Plugin\Materiels;
|
|
|
|
|
|
|
|
use Garradin\DB;
|
|
|
|
|
2021-06-05 18:48:45 +02:00
|
|
|
class Entry
|
2021-06-05 00:30:48 +02:00
|
|
|
{
|
|
|
|
protected $columns_order = array(
|
|
|
|
'id',
|
|
|
|
'kind',
|
2021-06-06 12:02:18 +02:00
|
|
|
'equipment_number',
|
2021-06-05 00:30:48 +02:00
|
|
|
'equipment_id',
|
2021-06-06 12:02:18 +02:00
|
|
|
'entry_date',
|
|
|
|
'additional_comment',
|
2021-06-05 00:30:48 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
public function listKinds()
|
|
|
|
{
|
|
|
|
return array(
|
|
|
|
'Achat',
|
|
|
|
'Don',
|
|
|
|
'Récupération',
|
2021-06-06 18:41:59 +02:00
|
|
|
'Location',
|
|
|
|
'Retour de location',
|
|
|
|
'Prêt',
|
|
|
|
'Retour de prêt',
|
2021-06-05 00:30:48 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-06-05 11:04:30 +02:00
|
|
|
public function add($data = [])
|
|
|
|
{
|
|
|
|
DB::getInstance()->insert('plugin_materiels_entry', $data);
|
|
|
|
}
|
2021-06-05 13:52:32 +02:00
|
|
|
|
2021-06-05 16:45:03 +02:00
|
|
|
public function edit($id, $data = [])
|
|
|
|
{
|
|
|
|
$db = DB::getInstance();
|
|
|
|
$db->update('plugin_materiels_entry', $data, $db->where('id', $id));
|
|
|
|
}
|
|
|
|
|
2021-06-05 13:52:32 +02:00
|
|
|
public function listAll()
|
|
|
|
{
|
2021-06-06 12:02:18 +02:00
|
|
|
return DB::getInstance()->get('SELECT * FROM plugin_materiels_entry ORDER BY entry_date DESC;');
|
2021-06-05 13:52:32 +02:00
|
|
|
}
|
2021-06-05 00:30:48 +02:00
|
|
|
}
|