diff --git a/doc_db/doc_db.md b/doc_db/doc_db.md index ce6571c..83f8df3 100644 --- a/doc_db/doc_db.md +++ b/doc_db/doc_db.md @@ -34,7 +34,7 @@ | *| mvt_date| date | | | | additional_comment| varchar(255) | | | Indexes | -| đŸ”‘ primary key | pk_plugin_materiels_entry | | +| đŸ”‘ primary key | pk_plugin_materiels_movement | | | Foreign Keys | | | Fk_plugin_materiels_movement | ( equipment_id ) ref plugin_materiels_equipment (id) | | diff --git a/src/lib/Equipment.php b/src/lib/Equipment.php index 428b44f..6c39027 100644 --- a/src/lib/Equipment.php +++ b/src/lib/Equipment.php @@ -117,12 +117,18 @@ class Equipment } public function AllListsAllByCategory() + // construct and return 3 lists with all equipments: + // equipments owned, equipments no owned and equipments just listed + // ordered by category { + // get list of all equipments ordered by category $eqmts_by_cat = $this->listAllByCategory(); + // construct the 3 lists $eqmts_owned_by_cat = array(); $eqmts_no_owned_by_cat = array(); $eqmts_just_listed_by_cat = array(); foreach ($eqmts_by_cat as $cat => $eqmts) { + // for each category construct the 3 lists with all of his equipments list($eqmts_owned, $eqmts_no_owned, $eqmts_just_listed) = $this->AllListsAll($eqmts); $eqmts_owned_by_cat[$cat] = $eqmts_owned; $eqmts_no_owned_by_cat[$cat] = $eqmts_no_owned; diff --git a/src/lib/Movement.php b/src/lib/Movement.php index 64755c2..9200bf7 100644 --- a/src/lib/Movement.php +++ b/src/lib/Movement.php @@ -168,4 +168,12 @@ class Movement } return true; } + + public function AllEqmtMovements($eqmt_id) + // return list of all movements for a specific equipments + // ordered by date and side + { + return DB::getInstance()->get( + "SELECT * FROM plugin_materiels_movement WHERE equipment_id = '{$eqmt_id}' ORDER BY mvt_date DESC, side DESC;"); + } } diff --git a/src/templates/historique.tpl b/src/templates/historique.tpl index 907327a..d9fa150 100644 --- a/src/templates/historique.tpl +++ b/src/templates/historique.tpl @@ -1,9 +1,47 @@ -{include file="admin/_head.tpl" title="%s"|args:$plugin.nom current="plugin_%s"|args:$plugin.id} + +{include file="%s_nav.tpl"|args:$plugin_tpl current_nav="index"} + + +
{$date}
-{/foreach} +
+ {$eqmt_requested.designation} - {$eqmt_requested.category} -+ |
+ |||||
---|---|---|---|---|---|
Date | +Sens | +Type | +Nombre | +Remarques | +|
{$mvt.mvt_date|date_format:'%d/%m/%y'} | + {if $mvt.side} +Sortie | + {else} +Entrée | + {/if} +{$mvt.kind} | +{$mvt.equipment_number} | +{$mvt.additional_comment} | +