From c74ba5ed85803d866ba044803584a0228f41dece Mon Sep 17 00:00:00 2001 From: JBthePenguin Date: Sat, 5 Jun 2021 13:08:55 +0200 Subject: [PATCH] remove location --- src/lib/Equipment.php | 6 ++- src/lib/Location.php | 40 ----------------- src/schema.sql | 10 +---- src/templates/_nav.tpl | 1 - .../entrees/definitives/non_repertorie.tpl | 8 ---- src/templates/index.tpl | 18 ++++++++ src/templates/localisations/index.tpl | 38 ---------------- .../materiels_par_localisation.tpl | 5 --- .../localisations/modifier_localisation.tpl | 20 --------- .../localisations/supprimer_localisation.tpl | 11 ----- .../entrees/definitives/non_repertorie.php | 9 +--- src/www/admin/entrees_definitives.php | 7 --- src/www/admin/index.php | 14 ++++++ src/www/admin/localisations/index.php | 39 ---------------- .../materiels_par_localisation.php | 20 --------- .../localisations/modifier_localisation.php | 44 ------------------- .../localisations/supprimer_localisation.php | 36 --------------- 17 files changed, 39 insertions(+), 287 deletions(-) delete mode 100644 src/lib/Location.php delete mode 100644 src/templates/localisations/index.tpl delete mode 100644 src/templates/localisations/materiels_par_localisation.tpl delete mode 100644 src/templates/localisations/modifier_localisation.tpl delete mode 100644 src/templates/localisations/supprimer_localisation.tpl delete mode 100644 src/www/admin/entrees_definitives.php delete mode 100644 src/www/admin/localisations/index.php delete mode 100644 src/www/admin/localisations/materiels_par_localisation.php delete mode 100644 src/www/admin/localisations/modifier_localisation.php delete mode 100644 src/www/admin/localisations/supprimer_localisation.php diff --git a/src/lib/Equipment.php b/src/lib/Equipment.php index b72757c..f35a4ff 100644 --- a/src/lib/Equipment.php +++ b/src/lib/Equipment.php @@ -9,7 +9,6 @@ class Equipment protected $columns_order = array( 'id', 'category_id', - 'location_id', 'number_of_equipments', 'designation' ); @@ -20,4 +19,9 @@ class Equipment $db->insert('plugin_materiels_equipment', $data); return $db->lastInsertRowId(); } + + public function listAll() + { + return DB::getInstance()->get('SELECT * FROM plugin_materiels_equipment ORDER BY designation;'); + } } diff --git a/src/lib/Location.php b/src/lib/Location.php deleted file mode 100644 index 886fe41..0000000 --- a/src/lib/Location.php +++ /dev/null @@ -1,40 +0,0 @@ -insert('plugin_materiels_location', $data); - } - - public function edit($id, $data = []) - { - $db = DB::getInstance(); - $db->update('plugin_materiels_location', $data, $db->where('id', $id)); - } - - - public function delete($id) - { - DB::getInstance()->delete('plugin_materiels_location', 'id = ' . $id); - } - - public function get($id) - { - return DB::getInstance()->first('SELECT * FROM plugin_materiels_location WHERE id = ?;', $id); - } - - public function listAll() - { - return DB::getInstance()->get('SELECT * FROM plugin_materiels_location ORDER BY name;'); - } -} diff --git a/src/schema.sql b/src/schema.sql index 639d70a..27d23fc 100644 --- a/src/schema.sql +++ b/src/schema.sql @@ -4,21 +4,13 @@ CREATE TABLE IF NOT EXISTS plugin_materiels_category ( 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, - location_id integer NOT NULL, 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 + FOREIGN KEY ( category_id ) REFERENCES plugin_materiels_category( id ) ON DELETE RESTRICT ON UPDATE CASCADE ); CREATE TABLE IF NOT EXISTS plugin_materiels_entry ( diff --git a/src/templates/_nav.tpl b/src/templates/_nav.tpl index 4a3f698..9ed7323 100644 --- a/src/templates/_nav.tpl +++ b/src/templates/_nav.tpl @@ -2,7 +2,6 @@