00001 <?php 00002 00003 /* 00004 * This file is part of PhpCompta. 00005 * 00006 * PhpCompta is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * PhpCompta is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with PhpCompta; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 */ 00020 // Copyright 2014 Author Dany De Bontridder ddebontridder@yahoo.fr 00021 00022 /** 00023 * @file 00024 * @brief manage distribution keys for Analytic accountancy, this file is called by 00025 * do.php 00026 * @see do.php 00027 * 00028 */ 00029 if (!defined('ALLOWED')) 00030 die('Appel direct ne sont pas permis'); 00031 global $cn, $g_user; 00032 require_once 'class_anc_key.php'; 00033 $op=HtmlInput::default_value_request("op", "list"); 00034 00035 switch ($op) 00036 { 00037 case 'list': 00038 Anc_Key::display_list(); 00039 Anc_Key::key_add(); 00040 break; 00041 case 'consult': 00042 $id=HtmlInput::default_value_request("key", "0"); 00043 if (isNumber($id)==0||$id==0) 00044 { 00045 die(_('Clef invalide')); 00046 } 00047 $key=new Anc_Key($id); 00048 if (isset($_POST['save_key'])) 00049 { 00050 try 00051 { 00052 $key->save($_POST); 00053 Anc_Key::display_list(); 00054 Anc_Key::key_add(); 00055 00056 break; 00057 } 00058 catch (Exception $e) 00059 { 00060 echo span($e->getMessage(),' class="notice"'); 00061 } 00062 } 00063 $key->input(); 00064 break; 00065 case 'delete_key': 00066 $id=HtmlInput::default_value_request("key", "0"); 00067 $key=new Anc_Key($id); 00068 $key->delete(); 00069 Anc_Key::display_list(); 00070 Anc_Key::key_add(); 00071 } 00072 ?>