diff --git a/include/anc_key.inc.php b/include/anc_key.inc.php index 0365faea8..25279341d 100644 --- a/include/anc_key.inc.php +++ b/include/anc_key.inc.php @@ -37,10 +37,11 @@ switch ($op) { case 'list': Anc_Key::display_list(); + Anc_Key::key_add(); break; case 'consult': - $id=HtmlInput::default_value_request("key", "-1"); - if (isNumber($id)==0||$id==-1) + $id=HtmlInput::default_value_request("key", "0"); + if (isNumber($id)==0||$id==0) { die(_('Clef invalide')); } @@ -51,6 +52,8 @@ switch ($op) { $key->save($_POST); Anc_Key::display_list(); + Anc_Key::key_add(); + break; } catch (Exception $e) diff --git a/include/class_anc_key.php b/include/class_anc_key.php index 0cd492bad..c277a527e 100644 --- a/include/class_anc_key.php +++ b/include/class_anc_key.php @@ -131,6 +131,9 @@ class Anc_Key { throw new Exception(_('Le total ne vaut pas 100, total calculĂ© = ').$tot_percent); } + if ($p_array['name_key']=='') { + throw new Exception (_('Le nom ne peut ĂȘtre vide')); + } } /** @@ -198,6 +201,9 @@ class Anc_Key $a_plan=$p_array['pa']; try { + $this->key->setp('name',$p_array['name_key']); + $this->key->setp('description',$p_array['description_key']); + $this->key->save(); for ($i=0; $ijrn_def_id=$a_ledger[$k]; $ledger->save(); } + } catch (Exception $e) { @@ -299,4 +306,17 @@ class Anc_Key } + static function key_add() + { + $key=new Anc_Key(); + $key->key->setp('name',_('Nouvelle clef')); + $key->key->setp('description',_('Description de la nouvelle clef')); + ?> + +'; + + } }