Add new keys
This commit is contained in:
parent
004676e0b0
commit
8ff0a762d4
2 changed files with 25 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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; $i<count($a_row); $i++)
|
||||
{
|
||||
//save key_distribution_row
|
||||
|
|
@ -236,6 +242,7 @@ class Anc_Key
|
|||
$ledger->jrn_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'));
|
||||
?>
|
||||
<input type="button" class="smallbutton" value="<?php echo _('Ajout')?>" onclick="$('key_add_div_id').show()">
|
||||
<div id="key_add_div_id" style="display: none">
|
||||
<?php
|
||||
$key->input();
|
||||
echo '</div>';
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue