ok for historic for an equipment

This commit is contained in:
JBthePenguin 2021-09-03 12:49:53 +02:00
parent 8f3caadde1
commit 0af93066a3
8 changed files with 17 additions and 4 deletions

View File

@ -1,6 +1,6 @@
# Plugin Materiels pour Garradin
Cette extension permet de gérer les matériels de l'association: stock, entrées, sorties, valorisation.
Cette extension permet de gérer les matériels de l'association: stock, entrées, sorties.
## Installation

Binary file not shown.

View File

@ -0,0 +1,3 @@
DROP TABLE plugin_materiels_movement;
DROP TABLE plugin_materiels_equipment;
DROP TABLE plugin_materiels_category;

View File

@ -1,5 +1,5 @@
nom="Gestion des matériels"
description="Gestion des matériels: stock, entrées, sorties, valorisation."
description="Gestion des matériels: stock, entrées, sorties."
auteur="JBthePenguin"
url="https://gitlab.com/JBthePenguin"
version="1.0"

View File

@ -2,4 +2,6 @@
namespace Garradin;
$db->import(__DIR__ . '/schema.sql');
$db = DB::getInstance();
$db->import(__DIR__ . '/data/schema.sql');

View File

@ -172,8 +172,9 @@ class Movement
public function AllEqmtMovements($eqmt_id)
// return list of all movements for a specific equipments
// ordered by date and side
// if same date order by rent output and after put entry for return
{
return DB::getInstance()->get(
"SELECT * FROM plugin_materiels_movement WHERE equipment_id = '{$eqmt_id}' ORDER BY mvt_date DESC, side DESC;");
"SELECT * FROM plugin_materiels_movement WHERE equipment_id = '{$eqmt_id}' ORDER BY mvt_date DESC, CASE WHEN (side = '1' AND kind = 'Location / Prêt') THEN 1 WHEN (side = '0' AND kind != 'Retour de location / prêt') THEN 2 ELSE 0 END, side DESC;");
}
}

View File

@ -0,0 +1,7 @@
<?php
namespace Garradin;
$db = DB::getInstance();
$db->import(__DIR__ . '/data/schema_remove.sql');