diff --git a/materiels.tar.gz b/materiels.tar.gz index 4e35a82..8ea1acd 100644 Binary files a/materiels.tar.gz and b/materiels.tar.gz differ diff --git a/src/lib/Entry.php b/src/lib/Entry.php index 21e6a86..c9e33ac 100644 --- a/src/lib/Entry.php +++ b/src/lib/Entry.php @@ -13,7 +13,6 @@ class Entry 'Don', 'Récupération', 'Location / Prêt', - 'Retour de location / prêt', ); } diff --git a/src/templates/entrees/ajouter_entree.tpl b/src/templates/entrees/ajouter_entree.tpl index 4cc9400..7d2513f 100644 --- a/src/templates/entrees/ajouter_entree.tpl +++ b/src/templates/entrees/ajouter_entree.tpl @@ -4,17 +4,19 @@
- Ajouter une entrée d'un matériel {$legend_part} répertorié + Ajouter une entrée d'un matériel {$legend_part} {form_errors}
-
(obligatoire)
-
- -
+ {if $tpl_materiel_name != 'retour'} +
(obligatoire)
+
+ +
+ {/if} {input type="date" name="entry_date" default=$default_date label="Date d'entrée" required=true } {input type="number" name="equipment_number" label="Nombre" required=true step="1" min="1" default=$default_number}
diff --git a/src/templates/entrees/index.tpl b/src/templates/entrees/index.tpl index 15e08f6..c755d07 100644 --- a/src/templates/entrees/index.tpl +++ b/src/templates/entrees/index.tpl @@ -4,8 +4,9 @@
Ajouter une entrée pour du - {linkbutton shape="plus" label="Matériel pas encore répertorié" href="non_repertorie.php"} - {linkbutton shape="plus" label="Matériel déjà répertorié" href="deja_repertorie.php"} + {linkbutton shape="plus" label="Matériel répertorié" href="repertorie.php"} + {linkbutton shape="plus" label="Matériel non répertorié" href="non_repertorie.php"} + {linkbutton shape="plus" label="Matériel en retour de location / prêt" href="retour.php"}
{if $entries} @@ -23,7 +24,7 @@ {$entry.entry_date} {$entry.kind} {$entry.equipment_number} - {$entry.equipment.designation} + {$entry.equipment} {$entry.additional_comment} {/foreach} diff --git a/src/templates/entrees/deja_repertorie.tpl b/src/templates/entrees/repertorie.tpl similarity index 100% rename from src/templates/entrees/deja_repertorie.tpl rename to src/templates/entrees/repertorie.tpl diff --git a/src/templates/entrees/retour.tpl b/src/templates/entrees/retour.tpl new file mode 100644 index 0000000..37795a6 --- /dev/null +++ b/src/templates/entrees/retour.tpl @@ -0,0 +1,19 @@ +
+

Matériel

+
+
(obligatoire)
+
+ +
+
+
diff --git a/src/templates/sorties/index.tpl b/src/templates/sorties/index.tpl index d292667..21b944d 100644 --- a/src/templates/sorties/index.tpl +++ b/src/templates/sorties/index.tpl @@ -23,7 +23,7 @@ {$output.output_date} {$output.kind} {$output.equipment_number} - {$output.equipment.designation} + {$output.equipment} {$output.additional_comment} {/foreach} diff --git a/src/www/admin/entrees/index.php b/src/www/admin/entrees/index.php index f0b8989..f9830b0 100644 --- a/src/www/admin/entrees/index.php +++ b/src/www/admin/entrees/index.php @@ -13,7 +13,8 @@ $entry = new Entry; $entries = $entry->listAll(); foreach ($entries as $key => $value) { - $entries[$key]->equipment = $eqmt->get($value->equipment_id); + $entry_eqmt = $eqmt->get($value->equipment_id); + $entries[$key]->equipment = $entry_eqmt->designation; } $tpl->assign(compact('entries')); diff --git a/src/www/admin/entrees/non_repertorie.php b/src/www/admin/entrees/non_repertorie.php index c5dfe79..dd8aa83 100644 --- a/src/www/admin/entrees/non_repertorie.php +++ b/src/www/admin/entrees/non_repertorie.php @@ -10,6 +10,7 @@ use Garradin\Utils; require_once __DIR__ . '/../_inc.php'; $entry = new Entry; + $kinds = $entry->listKinds(); $selected_kind = $kinds[0]; @@ -66,7 +67,7 @@ if (f('save')) } $cancel_link = PLUGIN_URL . 'entrees/index.php'; -$legend_part = "pas encore"; +$legend_part = "non répertorié"; $tpl_materiel_name = "non_repertorie"; diff --git a/src/www/admin/entrees/repertorie.php b/src/www/admin/entrees/repertorie.php new file mode 100644 index 0000000..f7c8349 --- /dev/null +++ b/src/www/admin/entrees/repertorie.php @@ -0,0 +1,51 @@ +check($csrf_key) && !$form->hasErrors()) +{ + $entry->add([ + 'kind' => f('kind'), + 'equipment_number' => (int) f('equipment_number'), + 'equipment_id' => f('equipment_id'), + 'entry_date' => f('entry_date'), + 'additional_comment' => f('additional_comment'), + ]); + Utils::redirect(PLUGIN_URL . 'entrees/index.php'); +} + +$eqmt = new Equipment; +$eqmts_by_cat = $eqmt->listAllByCategory(); + +$kinds = $entry->listKinds(); +$selected_kind = $kinds[0]; + +$date = new \DateTime; +$date->setTimestamp(time()); +$default_date = $date; + +$default_number = "1"; +$default_comment = ""; + +$cancel_link = PLUGIN_URL . 'entrees/index.php'; +$legend_part = "répertorié"; +$tpl_materiel_name = "repertorie"; + + +$tpl->assign(compact( + 'kinds', 'eqmts_by_cat', 'selected_kind', 'default_date', + 'default_number', 'default_comment', 'cancel_link', + 'legend_part', 'tpl_materiel_name', 'csrf_key' +)); + +$tpl->display(PLUGIN_ROOT . '/templates/entrees/ajouter_entree.tpl'); diff --git a/src/www/admin/entrees/deja_repertorie.php b/src/www/admin/entrees/retour.php similarity index 73% rename from src/www/admin/entrees/deja_repertorie.php rename to src/www/admin/entrees/retour.php index 8031290..075373c 100644 --- a/src/www/admin/entrees/deja_repertorie.php +++ b/src/www/admin/entrees/retour.php @@ -8,17 +8,15 @@ use Garradin\Utils; require_once __DIR__ . '/../_inc.php'; -$entry = new Entry; -$eqmt = new Equipment; - $csrf_key = 'add_entry'; if (f('save') && $form->check($csrf_key) && !$form->hasErrors()) { if ($form->check($csrf_key) && !$form->hasErrors()) { + $entry = new Entry; $entry->add([ - 'kind' => f('kind'), + 'kind' => 'Retour de location / prêt', 'equipment_number' => (int) f('equipment_number'), 'equipment_id' => f('equipment_id'), 'entry_date' => f('entry_date'), @@ -28,11 +26,9 @@ if (f('save') && $form->check($csrf_key) && !$form->hasErrors()) } } +$eqmt = new Equipment; $eqmts_by_cat = $eqmt->listAllByCategory(); -$kinds = $entry->listKinds(); -$selected_kind = $kinds[0]; - $date = new \DateTime; $date->setTimestamp(time()); $default_date = $date; @@ -41,14 +37,13 @@ $default_number = "1"; $default_comment = ""; $cancel_link = PLUGIN_URL . 'entrees/index.php'; -$legend_part = "déjà"; -$tpl_materiel_name = "deja_repertorie"; - +$legend_part = "en retour de location / prêt"; +$tpl_materiel_name = "retour"; $tpl->assign(compact( - 'kinds', 'eqmts_by_cat', 'selected_kind', 'default_date', - 'default_number', 'default_comment', 'cancel_link', - 'legend_part', 'tpl_materiel_name', 'csrf_key' + 'eqmts_by_cat', 'default_date', 'default_number', + 'default_comment', 'cancel_link', 'legend_part', + 'tpl_materiel_name', 'csrf_key' )); $tpl->display(PLUGIN_ROOT . '/templates/entrees/ajouter_entree.tpl'); diff --git a/src/www/admin/sorties/index.php b/src/www/admin/sorties/index.php index 351d909..231d69a 100644 --- a/src/www/admin/sorties/index.php +++ b/src/www/admin/sorties/index.php @@ -13,7 +13,8 @@ $output = new Output; $outputs = $output->listAll(); foreach ($outputs as $key => $value) { - $outputs[$key]->equipment = $eqmt->get($value->equipment_id); + $output_eqmt = $eqmt->get($value->equipment_id); + $outputs[$key]->equipment = $output_eqmt->designation; } $tpl->assign(compact('outputs'));