diff --git a/materiels.tar.gz b/materiels.tar.gz index 73fa49a..65b8a9d 100644 Binary files a/materiels.tar.gz and b/materiels.tar.gz differ diff --git a/src/lib/Category.php b/src/lib/Category.php index 57b4d04..ca69d87 100644 --- a/src/lib/Category.php +++ b/src/lib/Category.php @@ -6,13 +6,10 @@ use Garradin\DB; class Category { - protected $id; - protected $name; - - protected $_types = [ - 'id' => 'int', - 'name' => 'string', - ]; + protected $columns_order = array( + 'id', + 'name', + ); public function add($data = []) { diff --git a/src/lib/Entry.php b/src/lib/Entry.php new file mode 100644 index 0000000..bc3c52a --- /dev/null +++ b/src/lib/Entry.php @@ -0,0 +1,30 @@ +kinds; + } +} diff --git a/src/lib/Equipment.php b/src/lib/Equipment.php new file mode 100644 index 0000000..5c3ef05 --- /dev/null +++ b/src/lib/Equipment.php @@ -0,0 +1,16 @@ + 'int', - 'name' => 'string', - ]; + protected $columns_order = array( + 'id', + 'name', + ); public function add($data = []) { diff --git a/src/schema.sql b/src/schema.sql index 78365bb..9a718bd 100644 --- a/src/schema.sql +++ b/src/schema.sql @@ -13,10 +13,9 @@ CREATE TABLE IF NOT EXISTS plugin_materiels_location ( 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, + number_of_equipments 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, FOREIGN KEY ( localisation_id ) REFERENCES plugin_materiels_location( id ) ON DELETE RESTRICT ON UPDATE CASCADE @@ -25,6 +24,7 @@ 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_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 @@ -33,6 +33,7 @@ CREATE TABLE IF NOT EXISTS plugin_materiels_entry ( 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, @@ -42,6 +43,7 @@ CREATE TABLE IF NOT EXISTS plugin_materiels_temporary_entry ( 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 @@ -50,6 +52,7 @@ CREATE TABLE IF NOT EXISTS plugin_materiels_output ( 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, diff --git a/src/templates/_nav.tpl b/src/templates/_nav.tpl index 151fd2f..4a3f698 100644 --- a/src/templates/_nav.tpl +++ b/src/templates/_nav.tpl @@ -1,9 +1,9 @@