OK to add already listed material

This commit is contained in:
JBthePenguin 2021-06-06 18:41:59 +02:00
parent e2849cfcf7
commit c4f8b4fb87
8 changed files with 147 additions and 53 deletions

View file

@ -21,6 +21,10 @@ class Entry
'Achat',
'Don',
'Récupération',
'Location',
'Retour de location',
'Prêt',
'Retour de prêt',
);
}

View file

@ -3,6 +3,7 @@
namespace Garradin\Plugin\Materiels;
use Garradin\DB;
use Garradin\Plugin\Materiels\Category;
class Equipment
{
@ -35,4 +36,16 @@ class Equipment
{
return DB::getInstance()->get('SELECT * FROM plugin_materiels_equipment ORDER BY designation;');
}
public function listAllByCategory()
{
$cat = new Category;
$cats = $cat->listAll();
$eqmts_by_cat = array();
foreach ($cats as $cat) {
$eqmts_by_cat[$cat->name] = DB::getInstance()->get(
'SELECT * FROM plugin_materiels_equipment WHERE category_id = ? ORDER BY designation;', $cat->id);
}
return $eqmts_by_cat;
}
}