diff --git a/src/lib/Entry.php b/src/lib/Entry.php
index bc3c52a..94e0dc2 100644
--- a/src/lib/Entry.php
+++ b/src/lib/Entry.php
@@ -4,7 +4,7 @@ namespace Garradin\Plugin\Materiels;
use Garradin\DB;
-class Entry
+class Entry // entrées définitives
{
protected $columns_order = array(
'id',
@@ -23,8 +23,8 @@ class Entry
);
}
- public function listEquipmentIds()
- {
- // return $this->kinds;
- }
+ public function add($data = [])
+ {
+ DB::getInstance()->insert('plugin_materiels_entry', $data);
+ }
}
diff --git a/src/lib/Equipment.php b/src/lib/Equipment.php
index 5c3ef05..b72757c 100644
--- a/src/lib/Equipment.php
+++ b/src/lib/Equipment.php
@@ -9,8 +9,15 @@ class Equipment
protected $columns_order = array(
'id',
'category_id',
- 'localisation_id',
+ 'location_id',
'number_of_equipments',
'designation'
);
+
+ public function add($data = [])
+ {
+ $db = DB::getInstance();
+ $db->insert('plugin_materiels_equipment', $data);
+ return $db->lastInsertRowId();
+ }
}
diff --git a/src/schema.sql b/src/schema.sql
index 9a718bd..639d70a 100644
--- a/src/schema.sql
+++ b/src/schema.sql
@@ -13,7 +13,7 @@ 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,
- localisation_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 ),
diff --git a/src/templates/entrees/definitives/non_repertorie.tpl b/src/templates/entrees/definitives/non_repertorie.tpl
index 9799572..02c297f 100644
--- a/src/templates/entrees/definitives/non_repertorie.tpl
+++ b/src/templates/entrees/definitives/non_repertorie.tpl
@@ -15,8 +15,8 @@
{/foreach}
- {input type="date" name="date_entree" 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="1"}
+ {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}