diff --git a/README.md b/README.md index 628de01..4e11690 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Cette extension permet de gérer les matériels de l'association: stock, entrée ## Installation -- Télécharger le fichier materiels.tar.gz et l'ajouter dans le répertoire garradin/plugins. +- Télécharger le fichier [materiels.tar.gz](https://gitlab.com/JBthePenguin/garradin-plugin-materiels/-/raw/main/materiels.tar.gz) et l'ajouter dans le répertoire garradin/plugins. - Installer le plugin via le menu "Configuration > Extensions" de Garradin. ## Utilisation - Fonctionnalités diff --git a/materiels.tar.gz b/materiels.tar.gz index 88e8ef2..e251a4a 100644 Binary files a/materiels.tar.gz and b/materiels.tar.gz differ diff --git a/src/install.php b/src/install.php index e69de29..07a618a 100644 --- a/src/install.php +++ b/src/install.php @@ -0,0 +1,5 @@ +import(__DIR__ . '/schema.sql'); diff --git a/src/schema.sql b/src/schema.sql new file mode 100644 index 0000000..78365bb --- /dev/null +++ b/src/schema.sql @@ -0,0 +1,57 @@ +CREATE TABLE IF NOT EXISTS plugin_materiels_category ( + id integer NOT NULL PRIMARY KEY autoincrement, + name varchar(100) NOT NULL, + CONSTRAINT u_category_name UNIQUE ( name ) +); + +CREATE TABLE IF NOT EXISTS plugin_materiels_location ( + id integer NOT NULL PRIMARY KEY autoincrement, + name varchar(100) NOT NULL, + CONSTRAINT u_location_name UNIQUE ( name ) +); + +CREATE TABLE IF NOT EXISTS plugin_materiels_equipment ( + id integer NOT NULL PRIMARY KEY autoincrement, + category_id integer NOT NULL, + designation varchar(255) NOT NULL, + localisation_id integer NOT NULL, + current_value decimal NOT NULL DEFAULT 0, + number_of_materiels integer NOT NULL DEFAULT 1, + CONSTRAINT u_equipment_designation UNIQUE ( designation ), + FOREIGN KEY ( category_id ) REFERENCES plugin_materiels_category( id ) ON DELETE RESTRICT ON UPDATE CASCADE, + FOREIGN KEY ( localisation_id ) REFERENCES plugin_materiels_location( id ) ON DELETE RESTRICT ON UPDATE CASCADE +); + +CREATE TABLE IF NOT EXISTS plugin_materiels_entry ( + id integer NOT NULL PRIMARY KEY autoincrement, + kind varchar(20) NOT NULL, + equipment_id integer NOT NULL, + date_of_entry date NOT NULL, + 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, + 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, + 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, + 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 +); diff --git a/src/templates/_nav.tpl b/src/templates/_nav.tpl new file mode 100644 index 0000000..1b9b263 --- /dev/null +++ b/src/templates/_nav.tpl @@ -0,0 +1,10 @@ + diff --git a/src/templates/config.tpl b/src/templates/config.tpl deleted file mode 100644 index 6c8ac79..0000000 --- a/src/templates/config.tpl +++ /dev/null @@ -1,20 +0,0 @@ -{include file="admin/_head.tpl" title="Configuration — %s"|args:$plugin.nom current="plugin_%s"|args:$plugin.id} - -{form_errors} - -
- -{include file="admin/_foot.tpl"} diff --git a/src/templates/entrees_definitives.tpl b/src/templates/entrees_definitives.tpl new file mode 100644 index 0000000..131944a --- /dev/null +++ b/src/templates/entrees_definitives.tpl @@ -0,0 +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_definitives"} + +{include file="admin/_foot.tpl"} diff --git a/src/templates/entrees_provisoires.tpl b/src/templates/entrees_provisoires.tpl new file mode 100644 index 0000000..1c6b217 --- /dev/null +++ b/src/templates/entrees_provisoires.tpl @@ -0,0 +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="admin/_foot.tpl"} diff --git a/src/templates/index.tpl b/src/templates/index.tpl index ea1dd8d..6b73859 100644 --- a/src/templates/index.tpl +++ b/src/templates/index.tpl @@ -1,12 +1,5 @@ -{include file="admin/_head.tpl" title="Extension — %s"|args:$plugin.nom current="plugin_%s"|args:$plugin.id} - -Gestion du materiel de l'association
- -{if $plugin.config.display_hello} -