2021-06-05 00:30:48 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Garradin\Plugin\Materiels;
|
|
|
|
|
|
|
|
use Garradin\DB;
|
|
|
|
|
2021-06-05 11:04:30 +02:00
|
|
|
class Entry // entrées définitives
|
2021-06-05 00:30:48 +02:00
|
|
|
{
|
|
|
|
protected $columns_order = array(
|
|
|
|
'id',
|
|
|
|
'kind',
|
|
|
|
'number_of_equipments',
|
|
|
|
'equipment_id',
|
|
|
|
'date_of_entry',
|
|
|
|
);
|
|
|
|
|
|
|
|
public function listKinds()
|
|
|
|
{
|
|
|
|
return array(
|
|
|
|
'Achat',
|
|
|
|
'Don',
|
|
|
|
'Récupération',
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
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()
|
|
|
|
{
|
|
|
|
return DB::getInstance()->get('SELECT * FROM plugin_materiels_entry ORDER BY date_of_entry DESC;');
|
|
|
|
}
|
2021-06-05 00:30:48 +02:00
|
|
|
}
|