diff --git a/doc_db/LayoutwithTools.svg b/doc_db/LayoutwithTools.svg
new file mode 100644
index 0000000..a89295c
--- /dev/null
+++ b/doc_db/LayoutwithTools.svg
@@ -0,0 +1,328 @@
+
\ No newline at end of file
diff --git a/doc_db/doc_db.md b/doc_db/doc_db.md
new file mode 100644
index 0000000..3d23546
--- /dev/null
+++ b/doc_db/doc_db.md
@@ -0,0 +1,55 @@
+## Plugin materiels database
+
+![img](./LayoutwithTools.svg)
+
+### Table plugin_materiels_category
+| Idx | Field Name | Data Type |
+|---|---|---|
+| *🔑 ⬋ | id| integer autoincrement |
+| *🔍 | name| varchar(100) |
+| Indexes |
+| 🔑 primary key | pk_plugin_materiels_category ||
+| 🔍 unique | u_category_name |
+
+### Table plugin_materiels_equipment
+| Idx | Field Name | Data Type |
+|---|---|---|
+| *🔑 ⬋ | id| integer autoincrement |
+| *⬈ | category_id| integer |
+| *| stock_number| integer |
+| *🔍 | designation| varchar(255) |
+| Indexes |
+| 🔑 primary key | pk_plugin_materiels_equipment || ON id|
+| 🔍 unique | u_equipment_designation || ON designation|
+| Foreign Keys |
+| | Fk_plugin_materiels_equipment | ( category_id ) ref plugin_materiels_category (id) |
+
+### Table plugin_materiels_entry
+| Idx | Field Name | Data Type | Description |
+|---|---|---|---|
+| *🔑 | id| integer autoincrement | |
+| *| kind| varchar(20) | Achat, Don, Récupération, ... |
+| *| equipment_number| integer | |
+| *⬈ | equipment_id| integer | |
+| *| entry_date| date | |
+| | additional_comment| varchar(255) | |
+| Indexes |
+| 🔑 primary key | pk_plugin_materiels_entry | |
+| Foreign Keys |
+| | Fk_plugin_materiels_entry | ( equipment_id ) ref plugin_materiels_equipment (id) | |
+
+### Table plugin_materiels_output
+| Idx | Field Name | Data Type | Description |
+|---|---|---|---|
+| *🔑 | id| integer autoincrement | |
+| *| kind| varchar(20) | Vente, Don, Prêt, ... |
+| *| equipment_number| integer | |
+| *⬈ | equipment_id| integer | |
+| *| output_date| date | |
+| | additional_comment| varchar(255) | |
+| Indexes |
+| 🔑 primary key | pk_plugin_materiels_output || ON id | |
+| Foreign Keys |
+| | Fk_plugin_materiels_output | ( equipment_id ) ref plugin_materiels_equipment (id) | |
+
+| * -> NOT NULL
diff --git a/materiels.tar.gz b/materiels.tar.gz
index 0c46472..3a210c6 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 a455462..8cd3942 100644
--- a/src/lib/Entry.php
+++ b/src/lib/Entry.php
@@ -9,9 +9,10 @@ class Entry
protected $columns_order = array(
'id',
'kind',
- 'number_of_equipments',
+ 'equipment_number',
'equipment_id',
- 'date_of_entry',
+ 'entry_date',
+ 'additional_comment',
);
public function listKinds()
@@ -36,6 +37,6 @@ class Entry
public function listAll()
{
- return DB::getInstance()->get('SELECT * FROM plugin_materiels_entry ORDER BY date_of_entry DESC;');
+ return DB::getInstance()->get('SELECT * FROM plugin_materiels_entry ORDER BY entry_date DESC;');
}
}
diff --git a/src/lib/Equipment.php b/src/lib/Equipment.php
index c8c2193..565a94b 100644
--- a/src/lib/Equipment.php
+++ b/src/lib/Equipment.php
@@ -9,8 +9,8 @@ class Equipment
protected $columns_order = array(
'id',
'category_id',
- 'number_of_equipments',
- 'designation'
+ 'stock_number',
+ 'designation',
);
public function add($data = [])
diff --git a/src/schema.sql b/src/schema.sql
index 8af9085..c29ffec 100644
--- a/src/schema.sql
+++ b/src/schema.sql
@@ -7,7 +7,7 @@ CREATE TABLE IF NOT EXISTS plugin_materiels_category (
CREATE TABLE IF NOT EXISTS plugin_materiels_equipment (
id integer NOT NULL PRIMARY KEY autoincrement,
category_id integer NOT NULL,
- number_of_equipments integer NOT NULL,
+ stock_number integer NOT NULL,
designation varchar(255) NOT NULL,
CONSTRAINT u_equipment_designation UNIQUE ( designation ),
FOREIGN KEY ( category_id ) REFERENCES plugin_materiels_category( id ) ON DELETE RESTRICT ON UPDATE CASCADE
@@ -16,17 +16,19 @@ CREATE TABLE IF NOT EXISTS plugin_materiels_equipment (
CREATE TABLE IF NOT EXISTS plugin_materiels_entry (
id integer NOT NULL PRIMARY KEY autoincrement,
kind varchar(20) NOT NULL,
- number_of_equipments integer NOT NULL,
+ equipment_number integer NOT NULL,
equipment_id integer NOT NULL,
- date_of_entry date NOT NULL,
+ entry_date date NOT NULL,
+ additional_comment varchar(255),
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_number integer NOT NULL,
equipment_id integer NOT NULL,
output_date date NOT NULL,
+ additional_comment varchar(255),
FOREIGN KEY ( equipment_id ) REFERENCES plugin_materiels_equipment( id ) ON DELETE RESTRICT ON UPDATE CASCADE
);
diff --git a/src/templates/entrees/index.tpl b/src/templates/entrees/index.tpl
index 4f7500a..9b2854d 100644
--- a/src/templates/entrees/index.tpl
+++ b/src/templates/entrees/index.tpl
@@ -18,9 +18,9 @@
{foreach from=$entries item="entry"}
- {$entry.date_of_entry} |
+ {$entry.entry_date} |
{$entry.kind} |
- {$entry.number_of_equipments} |
+ {$entry.equipment_number} |
{$entry.equipment.designation} |
{/foreach}
diff --git a/src/templates/entrees/non_repertorie.tpl b/src/templates/entrees/non_repertorie.tpl
index 504d976..e741bbd 100644
--- a/src/templates/entrees/non_repertorie.tpl
+++ b/src/templates/entrees/non_repertorie.tpl
@@ -15,8 +15,8 @@
{/foreach}
- {input type="date" name="date_entree" default=$default_date label="Date d'entrée" required=true }
- {input type="number" name="number" label="Nombre d'entrée" required=true step="1" min="1" default=$default_number}
+ {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}