clean and simplify tree of the plugin

This commit is contained in:
JBthePenguin 2021-06-05 18:48:45 +02:00
parent 35c88400b0
commit 12a11611c6
18 changed files with 31 additions and 77 deletions

Binary file not shown.

View File

@ -4,7 +4,7 @@ namespace Garradin\Plugin\Materiels;
use Garradin\DB;
class Entry // entrées définitives
class Entry
{
protected $columns_order = array(
'id',

View File

@ -22,31 +22,11 @@ CREATE TABLE IF NOT EXISTS plugin_materiels_entry (
FOREIGN KEY ( equipment_id ) REFERENCES plugin_materiels_equipment( id ) ON DELETE RESTRICT ON UPDATE CASCADE
);
CREATE TABLE IF NOT EXISTS plugin_materiels_temporary_entry (
id integer NOT NULL PRIMARY KEY autoincrement,
kind varchar(20) NOT NULL,
number_of_equipments integer NOT NULL,
equipment_id integer NOT NULL,
start_date date NOT NULL,
end_date date,
FOREIGN KEY ( equipment_id ) REFERENCES plugin_materiels_equipment( id ) ON DELETE RESTRICT ON UPDATE CASCADE
);
CREATE TABLE IF NOT EXISTS plugin_materiels_output (
id integer NOT NULL PRIMARY KEY autoincrement,
kind varchar(20) NOT NULL,
number_of_equipments integer NOT NULL,
equipment_id integer NOT NULL,
output_date date NOT NULL,
FOREIGN KEY ( equipment_id ) REFERENCES plugin_materiels_entry( equipment_id ) ON DELETE RESTRICT ON UPDATE CASCADE
);
CREATE TABLE IF NOT EXISTS plugin_materiels_temporary_output (
id integer NOT NULL PRIMARY KEY autoincrement,
kind varchar(20) NOT NULL,
number_of_equipments integer NOT NULL,
equipment_id integer NOT NULL,
start_date date NOT NULL,
end_date date,
FOREIGN KEY ( equipment_id ) REFERENCES plugin_materiels_entry( equipment_id ) ON DELETE RESTRICT ON UPDATE CASCADE
FOREIGN KEY ( equipment_id ) REFERENCES plugin_materiels_equipment( id ) ON DELETE RESTRICT ON UPDATE CASCADE
);

View File

@ -1,11 +1,9 @@
<nav class="tabs">
<ul>
<li class="{if $current == 'index'}current{/if}"><a href="{plugin_url}">Stock</a></li>
<li class="{if $current == 'index'}current{/if}"><a href="{plugin_url}">Inventaire</a></li>
<li class="{if $current == 'categories'}current{/if}"><a href="{plugin_url file="categories/index.php"}">Catégories</a></li>
<li class="{if $current == 'entrees_definitives'}current{/if}"><a href="{plugin_url file="entrees/definitives/index.php"}">Entrées définitives</a></li>
<li class="{if $current == 'entrees_provisoires'}current{/if}"><a href="{plugin_url file="entrees_provisoires.php"}">Entrées provisoires</a></li>
<li class="{if $current == 'sorties_definitives'}current{/if}"><a href="{plugin_url file="sorties_definitives.php"}">Sorties définitives</a></li>
<li class="{if $current == 'sorties_provisoires'}current{/if}"><a href="{plugin_url file="sorties_provisoires.php"}">Sorties provisoires</a></li>
<li class="{if $current == 'entrees'}current{/if}"><a href="{plugin_url file="entrees/index.php"}">Entrées</a></li>
<li class="{if $current == 'sorties_definitives'}current{/if}"><a href="{plugin_url file="sorties.php"}">Sorties</a></li>
<li class="{if $current == 'recherche'}current{/if}"><a href="{plugin_url file="recherche.php"}">Recherche</a></li>
</ul>
</nav>

View File

@ -1,6 +1,6 @@
{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="entrees_definitives"}
{include file="%s_nav.tpl"|args:$plugin_tpl current="entrees"}
déjà repertorie

View File

@ -1,9 +1,9 @@
{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="entrees_definitives"}
{include file="%s_nav.tpl"|args:$plugin_tpl current="entrees"}
<fieldset>
<legend>Ajouter une entrée définitive pour du </legend>
<legend>Ajouter une entrée pour du </legend>
{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"}
</fieldset>

View File

@ -1,10 +1,10 @@
{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="entrees_definitives"}
{include file="%s_nav.tpl"|args:$plugin_tpl current="entrees"}
<form method="post" action="{$self_url}">
<fieldset>
<legend>Ajouter une entrée définitive d'un matériel pas encore répertorié</legend>
<legend>Ajouter une entrée d'un matériel pas encore répertorié</legend>
{form_errors}
<dl>
<dt><label for="f_kind">Type</label> <b>(obligatoire)</b></dt>

View File

@ -1,5 +1,5 @@
{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="entrees_provisoires"}
{include file="%s_nav.tpl"|args:$plugin_tpl current="sorties"}
{include file="admin/_foot.tpl"}

View File

@ -1,5 +0,0 @@
{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="sorties_definitives"}
{include file="admin/_foot.tpl"}

View File

@ -1,5 +0,0 @@
{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="sorties_provisoires"}
{include file="admin/_foot.tpl"}

View File

@ -1,7 +0,0 @@
<?php
namespace Garradin;
require_once __DIR__ . '/../../_inc.php';
$tpl->display(PLUGIN_ROOT . '/templates/entrees/definitives/deja_repertorie.tpl');

View File

@ -0,0 +1,7 @@
<?php
namespace Garradin;
require_once __DIR__ . '/../_inc.php';
$tpl->display(PLUGIN_ROOT . '/templates/entrees/deja_repertorie.tpl');

View File

@ -5,7 +5,7 @@ namespace Garradin;
use Garradin\Plugin\Materiels\Equipment;
use Garradin\Plugin\Materiels\Entry;
require_once __DIR__ . '/../../_inc.php';
require_once __DIR__ . '/../_inc.php';
$eqmt = new Equipment;
$entry = new Entry;
@ -18,4 +18,4 @@ foreach ($entries as $key => $value) {
$tpl->assign(compact('entries'));
$tpl->display(PLUGIN_ROOT . '/templates/entrees/definitives/index.tpl');
$tpl->display(PLUGIN_ROOT . '/templates/entrees/index.tpl');

View File

@ -7,7 +7,7 @@ use Garradin\Plugin\Materiels\Category;
use Garradin\Plugin\Materiels\Equipment;
use Garradin\Utils;
require_once __DIR__ . '/../../_inc.php';
require_once __DIR__ . '/../_inc.php';
$entry = new Entry;
$kinds = $entry->listKinds();
@ -48,7 +48,7 @@ if (f('save'))
'equipment_id' => $eqmt_id,
'date_of_entry' => f('date_entree'),
]);
Utils::redirect(PLUGIN_URL . 'entrees/definitives/index.php');
Utils::redirect(PLUGIN_URL . 'entrees/index.php');
}
catch (\RuntimeException $e)
{
@ -63,8 +63,8 @@ if (f('save'))
}
}
$cancel_link = PLUGIN_URL . 'entrees/definitives/index.php';
$cancel_link = PLUGIN_URL . 'entrees/index.php';
$tpl->assign(compact('kinds', 'date', 'cats', 'selected_kind', 'default_date', 'default_number', 'selected_cat', 'cancel_link', 'csrf_key'));
$tpl->display(PLUGIN_ROOT . '/templates/entrees/definitives/non_repertorie.tpl');
$tpl->display(PLUGIN_ROOT . '/templates/entrees/non_repertorie.tpl');

View File

@ -1,7 +0,0 @@
<?php
namespace Garradin;
require_once __DIR__ . '/_inc.php';
$tpl->display(PLUGIN_ROOT . '/templates/entrees_provisoires.tpl');

View File

@ -0,0 +1,7 @@
<?php
namespace Garradin;
require_once __DIR__ . '/_inc.php';
$tpl->display(PLUGIN_ROOT . '/templates/sorties.tpl');

View File

@ -1,7 +0,0 @@
<?php
namespace Garradin;
require_once __DIR__ . '/_inc.php';
$tpl->display(PLUGIN_ROOT . '/templates/sorties_definitives.tpl');

View File

@ -1,7 +0,0 @@
<?php
namespace Garradin;
require_once __DIR__ . '/_inc.php';
$tpl->display(PLUGIN_ROOT . '/templates/sorties_provisoires.tpl');