From 58f3e38e84d7477034f6470dbdb5c2aec0134fbd Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Tue, 8 Nov 2011 23:04:55 +0000 Subject: [PATCH] Extension : change for security, now based on MENU_REF Update the script to put the extension into menu_ref + profile_menu --- html/ajax.php | 6 +- html/do.php | 11 ++ html/extension.raw.php | 8 +- include/ac_common.php | 44 +++--- include/class_extension.php | 262 +++++-------------------------- include/extension_choice.inc.php | 4 +- include/extension_get.inc.php | 51 +++--- include/template/module.php | 17 +- sql/extension.sql | 4 + sql/object-6.0.sql | 92 +++++++---- sql/upgrade.sql | 4 +- 11 files changed, 193 insertions(+), 310 deletions(-) create mode 100644 sql/extension.sql diff --git a/html/ajax.php b/html/ajax.php index 08e7f3360..18ce29bbf 100644 --- a/html/ajax.php +++ b/html/ajax.php @@ -21,8 +21,8 @@ if (isset($_REQUEST['plugin_code']) ) { $ext=new Extension($cn); - $ext->search('code',$_REQUEST['plugin_code']); - if ( $ext->get_parameter('id') != 0 ) + + if ( $ext->search($_REQUEST['plugin_code']) != -1) { /* security */ if ( !isset ($_SESSION['g_user']) || $ext->can_request($_SESSION['g_user']) == 0 ) @@ -30,7 +30,7 @@ if (isset($_REQUEST['plugin_code']) ) exit(); } /* call the ajax script */ - require_once('ext'.DIRECTORY_SEPARATOR.dirname(trim($ext->get_parameter('filepath'))).DIRECTORY_SEPARATOR.'ajax.php'); + require_once('ext'.DIRECTORY_SEPARATOR.dirname(trim($ext->get_parameter('me_file'))).DIRECTORY_SEPARATOR.'ajax.php'); } else { diff --git a/html/do.php b/html/do.php index 473aa26ff..17d6e9ce7 100644 --- a/html/do.php +++ b/html/do.php @@ -127,6 +127,17 @@ if (isset($_REQUEST['ac'])) show_menu($all, $i); } } +elseif (isset($_REQUEST['plugin_code'])) +{ + $default = find_default_module(); + $_GET['ac']=$default; + $_POST['ac']=$default; + $_REQUEST['ac']=$default; + show_module('EXTENSION'); + $all[0] = $default; + show_menu($all, 0); + require_once 'extension_choice.inc.php'; +} else { $default = find_default_module(); diff --git a/html/extension.raw.php b/html/extension.raw.php index 21ec8f58f..0e68c628f 100644 --- a/html/extension.raw.php +++ b/html/extension.raw.php @@ -41,16 +41,16 @@ $user->check(); $only_plugin=$user->check_dossier(dossier::id()); $ext=new Extension($cn); -$ext->search('code',$_REQUEST['plugin_code']); -if ( $ext->get_parameter('id') != 0 ) + +if ( $ext->search($_REQUEST['plugin_code']) != -1 ) { /* security */ if ( !isset ($_SESSION['g_user']) || $ext->can_request($_SESSION['g_user']) == 0 ) { - exit(); + exit(); } /* call the ajax script */ - require_once('ext'.DIRECTORY_SEPARATOR.dirname(trim($ext->get_parameter('filepath'))).DIRECTORY_SEPARATOR.'raw.php'); + require_once('ext'.DIRECTORY_SEPARATOR.dirname(trim($ext->get_parameter('me_file'))).DIRECTORY_SEPARATOR.'raw.php'); } else { diff --git a/include/ac_common.php b/include/ac_common.php index 0f2198abb..f808a3bf6 100644 --- a/include/ac_common.php +++ b/include/ac_common.php @@ -737,7 +737,7 @@ function show_module($selected) global $g_user; $cn = Dossier::connect(); $amodule = $cn->get_array("select - me_code,me_menu,me_url,me_javascript,p_order + me_code,me_menu,me_url,me_javascript,p_order,me_type from v_all_menu where user_name=$1 @@ -747,7 +747,7 @@ function show_module($selected) if ($selected != -1) { require_once('template/module.php'); - $file = $cn->get_array("select me_file,me_parameter,me_javascript from v_all_menu + $file = $cn->get_array("select me_file,me_parameter,me_javascript,me_type from v_all_menu where me_code=$1 and user_name=$2", array($selected,$g_user->login)); if ( count($file ) == 0 ) { @@ -766,6 +766,9 @@ function show_module($selected) $array=compute_variable($file[0]['me_parameter']); put_global($array); } + + // if file is not a plugin, include the file, otherwise + // include the plugin launcher if ( $file[0]['me_type'] != 'PL') require_once $file[0]['me_file']; else @@ -810,7 +813,7 @@ function find_default_module() if (count($default_module) > 1) { - echo_error("Plusieurs modules sont le module par défaut", __LINE__, __FILE__); + echo_error("Plusieurs modules sont le module par défaut", __LINE__, __FILE__); } elseif (count($default_module) == 1) { @@ -829,21 +832,21 @@ function show_menu($module, $idx) global $g_user; $cn = Dossier::connect(); $amenu = $cn->get_array("select - me_menu,me_code,me_url,me_javascript + me_menu,me_code,me_url,me_javascript,me_type from v_all_menu where me_code_dep=$1 and user_name=$2 order by p_order", array($module[$idx], $g_user->login)); if (!empty($amenu) && count($amenu) > 1) { - require 'template/menu.php'; + require 'template/menu.php'; } elseif (count($amenu) == 1) { - echo '
'; - echo h2info($amenu[0]['me_menu']); - echo '
'; - $module[$idx] = $amenu[0]['me_code']; + echo '
'; + echo h2info($amenu[0]['me_menu']); + echo '
'; + $module[$idx] = $amenu[0]['me_code']; } if (empty($amenu) || count($amenu) == 1) @@ -852,7 +855,7 @@ function show_menu($module, $idx) * @todo add security * check if user can access this module */ - $file = $cn->get_array("select me_file,me_parameter,me_javascript + $file = $cn->get_array("select me_file,me_parameter,me_javascript,me_type from menu_ref where me_code=$1 and @@ -869,24 +872,29 @@ function show_menu($module, $idx) { if ($file[0]['me_parameter'] !== "") { - // if there are paramter put them in superglobal - $array=compute_variable($file[0]['me_parameter']); - put_global($array); + // if there are paramter put them in superglobal + $array=compute_variable($file[0]['me_parameter']); + put_global($array); } - echo '
'; - require_once $file[0]['me_file']; - echo '
'; + + // if file is not a plugin, include the file, otherwise + // include the plugin launcher + if ( $file[0]['me_type'] != 'PL') + require_once $file[0]['me_file']; + else + require 'extension_get.inc.php'; + exit(); } if ( $file[0]['me_javascript'] != '') { - echo create_script($file[0]['me_javascript']); + echo create_script($file[0]['me_javascript']); } } } /** * Put in superglobal (get,post,request) the value contained in - * the superglobal + * the parameter field (me_parameter) * @param $array [key] [value] */ function put_global($array) diff --git a/include/class_extension.php b/include/class_extension.php index e848e57e9..101dd3a3f 100644 --- a/include/class_extension.php +++ b/include/class_extension.php @@ -25,8 +25,8 @@ * the inclusion... */ /*!\brief manage the extension, it involves the table extension - * - * Data member + * + * Data member * - $cn database connection * - $variable : * - id (extension.ex_id) @@ -36,136 +36,22 @@ * - enable (extension.ex_enable) * - filepath (extension.ex_file) */ -class Extension +require_once 'class_menu_ref_sql.php'; + +class Extension extends Menu_Ref_sql { - private static $variable=array('id'=>'ex_id', - 'name'=>'ex_name', - 'code'=>'ex_code', - 'desc'=>'ex_desc', - 'enable'=>'ex_enable', - 'filepath'=>'ex_file'); - /*!\brief constructor - *\param a database connextion - */ - function __construct ($p_init) - { - $this->cn=$p_init; - $this->ex_id=0; - } - public function get_parameter($p_string) - { - if ( array_key_exists($p_string,self::$variable) ) - { - $idx=self::$variable[$p_string]; - return $this->$idx; - } - else - exit (__FILE__.":".__LINE__.'Erreur attribut inexistant'.$p_string); - } - public function set_parameter($p_string,$p_value) - { - if ( array_key_exists($p_string,self::$variable) ) - { - $idx=self::$variable[$p_string]; - $this->$idx=$p_value; - } - else - exit (__FILE__.":".__LINE__.'Erreur attribut inexistant '.$p_string); - - - } - public function get_info() - { - return var_export(self::$variable,true); - } + /** + * @todo to be rewritten + */ public function verify() { // Verify that the elt we want to add is correct - if (trim($this->ex_code)=="") throw new Exception('Le code ne peut pas être vide'); - if (trim($this->ex_name)=="") throw new Exception('Le nom ne peut pas être vide'); - if (trim($this->ex_file)=="") throw new Exception('Chemin incorrect'); - if (file_exists('..'.DIRECTORY_SEPARATOR.'include'.DIRECTORY_SEPARATOR.'ext'.DIRECTORY_SEPARATOR.$this->ex_file) == false) + if (trim($this->me_code)=="") throw new Exception('Le code ne peut pas être vide'); + if (trim($this->me_name)=="") throw new Exception('Le nom ne peut pas être vide'); + if (trim($this->me_file)=="") throw new Exception('Chemin incorrect'); + if (file_exists('..'.DIRECTORY_SEPARATOR.'include'.DIRECTORY_SEPARATOR.'ext'.DIRECTORY_SEPARATOR.$this->me_file) == false) throw new Exception ('Extension non trouvée, le chemin est-il correct?'); } - /*!\brief call insert for a new plugin or update if the plugin exist */ - public function save() - { - if ( $this->get_parameter("id") == 0 ) - $this->insert(); - else - $this->update(); - } - /*!\brief insert a plugin - * \return error = -1 otherwiser the id */ - public function insert() - { - if ( $this->verify() != 0 ) return -1; - if ( $this->cn->count_sql('select * from extension where upper(ex_code)=upper($1)', - array($this->ex_code)) > 0) - throw new Exception ('Ce code existe déjà'); - if ( $this->cn->count_sql('select * from extension where upper(ex_name)=upper($1)', - array($this->ex_name)) > 0) - throw new Exception ('Ce nom existe déjà'); - - $sql='INSERT INTO extension( ex_code, ex_desc, ex_file, ex_enable,ex_name) '. - ' VALUES ($1, $2, $3,$4,$5) returning ex_id'; - $res=$this->cn->exec_sql( - $sql, - array($this->ex_code, - $this->ex_desc, - $this->ex_file, - $this->ex_enable, - $this->ex_name) - ); - $this->ex_id=Database::fetch_result($res,0,0); - } - /*!\brief update a plugin - * \return error = -1 otherwiser 0 */ - public function update() - { - if ( $this->verify() != 0 ) return -1; - $sql='UPDATE extension '. - 'SET ex_code=$1, ex_desc=$2, ex_file=$3, ex_enable=$4,ex_name=$5 '. - ' WHERE ex_id=$6 '; - $this->cn->exec_sql($sql, - array($this->ex_code, - $this->ex_desc, - $this->ex_file, - $this->ex_enable, - $this->ex_name, - $this->ex_id) - ); - return 0; - } - /*!\brief load a plugin */ - public function load() - { - $sql='SELECT ex_id, ex_name,ex_code, ex_desc, ex_file, ex_enable '. - ' FROM extension where ex_id=$1'; - $res=$this->cn->exec_sql($sql,array($this->ex_id)); - if ( Database::num_row($res) == 0 ) return -1; - $row=Database::fetch_array($res,0); - foreach ($row as $idx=>$value) - { - $this->$idx=$value; - } - return 0; - } - /*!\brief delete a plugin */ - public function delete() - { - $sql="delete from extension where ex_id=$1"; - $res=$this->cn->exec_sql($sql,array($this->ex_id)); - } - /*!\brief load all the plugin and returns an array - *\param $p_cn database connx - */ - static public function listing($p_cn) - { - $sql="SELECT ex_id, ex_name,ex_code, ex_desc, ex_file, ex_enable FROM extension order by ex_code"; - $array=$p_cn->get_array($sql); - return $array; - } /*!\brief transform an array into a valid object *\param $array with the value *\verbatim @@ -180,88 +66,35 @@ class Extension */ function fromArray($p_array) { - $this->ex_id=$p_array['ex_id']; - $this->ex_name=$p_array['name']; - $this->ex_code=$p_array['code']; - $this->ex_desc=$p_array['desc']; - $this->ex_enable=$p_array['enable']; - $this->ex_file=$p_array['file']; - + $this->me_menu=$p_array['name']; + $this->me_code=$p_array['code']; + $this->me_desc=$p_array['desc']; + $this->me_file=$p_array['file']; + $this->me_type='PL'; } /*!@brief search a extension, the what is the column (extends_code */ - function search($p_what,$p_value) + function search($p_what) { - switch($p_what) - { - case 'code': - $cond=" where ex_code = upper($1) "; - break; - default: - return -1; - } - - $sql="select ex_id from extension $cond"; - $res=$this->cn->get_value($sql, array($p_value)); - if ( $res=="") return -1; - - $this->ex_id=$res; - $this->load(); - + $this->me_code=$p_what; + if ( $this->load() == -1) return null; + return 1; } /*!\brief return 1 if the user given in parameter can access this extension * otherwise returns 0 *\param $p_login the user login - *\return 1 has access, 0 has no access + *\return 1 has access, 0 has no access */ function can_request($p_login) { - $sql="select use_access from user_sec_extension where ". - "upper(use_login ) = upper($1) and ex_id=$2"; - $ret=$this->cn->get_value($sql,array($p_login,$this->ex_id)); - if ( $this->cn->count() == 0 ) return 0; - if ( $ret=='Y') return 1; - return 0; - } - /*!@brief save the security in the table - *@param $p_array is an array of value - * indices are : - * - "is_" + login - * - value is Y or N - * you must add the value of gDossier - \code - [is_phpcompta]=>N - [gDossier]=>xx - \endcode - */ - function save_security($p_array) - { - $d=$p_array['gDossier']; - $cn=new Database($d); - $list_user=User::get_list($d); - for ($i=0;$icount_sql("select ex_id from user_sec_extension where use_login=$1 and ex_id=$2" - ,array($list_user[$i]['use_login'],$this->ex_id)) == 0 ) - { - /* insert */ - $sql="INSERT INTO user_sec_extension( - ex_id, use_login, use_access) VALUES ($1,$2,$3)"; - $cn->exec_sql($sql,array($this->ex_id,$list_user[$i]['use_login'],$p_array[$ix])); - - } - else - { - /* update */ - $sql="update user_sec_extension set use_access=$1 where ex_id=$2 and use_login=$3"; - $cn->exec_sql($sql,array($p_array[$ix],$this->ex_id,$list_user[$i]['use_login'])); - } - } - - } + $cnt=$this->cn->get_value("select count(*) from menu_ref + join profile_menu using (me_code) + join profile_user using (p_id) + where + me_code=$1 + and user_name=$2", + array($this->me_code,$p_login)); + if ( $cnt > 0) return 1; + return 0; } /*!@brief make an array of the available plugin for the current user * @return an array @@ -269,9 +102,10 @@ class Extension */ static function make_array($cn) { - $sql="select ex_code as value, ex_name as label from user_sec_extension ". - " join extension using (ex_id) where ex_enable='Y' and use_access='Y' ". - " and use_login=$1"; + $sql="select me_code as value, me_menu as label from ". + " menu_ref join profile_menu using (me_code) + join profile_user using (p_id) where ". + " user_name=$1 and me_type='PL' and me_code_dep='EXTENSION'"; $a=$cn->get_array($sql,array($_SESSION['g_user'])); return $a; } @@ -285,31 +119,5 @@ class Extension exit(); } } - /*!\brief test this class - */ - static function test_me() - { - $cn=new Database(dossier::id()); - print '

Save

'; - $ext=new Extension($cn); - /* create a plugin */ - $ext->set_parameter('code','test'); - $ext->set_parameter('enable','Y'); - $ext->set_parameter('desc','plugin de test'); - $ext->set_parameter('filepath','test.php'); - $ext->save(); - print '

Show

'; - /* show plugins */ - $res=$cn->get_array('select * from extension'); - print_r($res); - /* delete plugin */ - print '

Load

'; - $ext->load(); - print_r($ext); - print '

Delete

'; - $ext->delete(); - } - } -/* test::test_me(); */ diff --git a/include/extension_choice.inc.php b/include/extension_choice.inc.php index d98abcccf..a2f14a611 100644 --- a/include/extension_choice.inc.php +++ b/include/extension_choice.inc.php @@ -47,6 +47,8 @@ else echo ''; echo '
'; } -require_once 'extension_get.inc.php'; + +if ( isset($_REQUEST['plugin_code'])) + require_once 'extension_get.inc.php'; ?> diff --git a/include/extension_get.inc.php b/include/extension_get.inc.php index c233ea60e..84d1e06b4 100644 --- a/include/extension_get.inc.php +++ b/include/extension_get.inc.php @@ -10,33 +10,32 @@ require_once('class_iselect.php'); require_once ('constant.security.php'); require_once ('class_user.php'); -/* if a code has been asked */ -if (isset($_REQUEST['plugin_code']) ) -{ - $cn=new Database(dossier::id()); - $ext=new Extension($cn); - $ext->search('code',$_REQUEST['plugin_code']); - if ( $ext->get_parameter('id') != 0 ) - { - /* security */ - if ( $ext->can_request($_SESSION['g_user']) == 0 ) - { - alert(j(_("Vous ne pouvez pas utiliser cette extension. Contactez votre responsable"))); - exit(); - } +/** + * included from do.php + extension_choice.inc.php + */ - if ( ! file_exists('../include/ext'.DIRECTORY_SEPARATOR.trim($ext->get_parameter('filepath')))) - { - alert(j(_("Ce fichier n'existe pas "))); - exit(); - } - require_once('ext'.DIRECTORY_SEPARATOR.trim($ext->get_parameter('filepath'))); - } - else - { - alert(j(_("Cette extension n'existe pas "))); - exit(); - } +// find file and check security +global $cn,$g_user; +$ext=new Extension($cn); +; +if ($ext->search($_REQUEST['plugin_code']) == -1) + { + echo_warning("plugin non trouvé"); + exit(); } +if ($ext->can_request($g_user->login)==-1) +{ + alert("Plugin non authorisé"); + exit(); +} +if ( ! file_exists('../include/ext'.DIRECTORY_SEPARATOR.trim($ext->me_file))) + { + alert(j(_("Ce fichier n'existe pas "))); + exit(); + } +echo '
'; +require_once('ext'.DIRECTORY_SEPARATOR.trim($ext->me_file)); + + ?> diff --git a/include/template/module.php b/include/template/module.php index c17e6d278..c998b9046 100644 --- a/include/template/module.php +++ b/include/template/module.php @@ -2,20 +2,33 @@

Dossier :

- +get_value("select count(*) from profile join profile_user using (p_id) + where user_name=$1 and with_calc=true",array($_SESSION['g_user'])) ==1): + echo IButton::show_calc(); +endif; + +if ( $cn->get_value("select count(*) from profile join profile_user using (p_id) + where user_name=$1 and with_direct_form=true",array($_SESSION['g_user'])) ==1): +?>
+ style='class="direct"'; - $direct->value=HtmlInput::default_value('ac', '', $_REQUEST); + $direct->value=''; $direct->size=(strlen($direct->value)<10)?10:strlen($direct->value); echo $direct->input(); echo HtmlInput::submit('go','aller'); ?>
+
diff --git a/sql/extension.sql b/sql/extension.sql new file mode 100644 index 000000000..7c2e674ee --- /dev/null +++ b/sql/extension.sql @@ -0,0 +1,4 @@ +insert into menu_ref(me_code,me_menu,me_file,me_description,me_type,me_parameter) select ex_code,ex_name,ex_file,ex_desC,'PL','plugin_code='||ex_code from extension; + +insert into profile_menu (me_code,me_code_dep,p_id,p_type_display) select me_code,'EXTENSION',1,'S' from menu_ref where me_type='PL'; + diff --git a/sql/object-6.0.sql b/sql/object-6.0.sql index 76612730e..779830403 100644 --- a/sql/object-6.0.sql +++ b/sql/object-6.0.sql @@ -78,7 +78,9 @@ PL for plugin'; CREATE TABLE profile ( p_name text NOT NULL, p_id integer NOT NULL, - p_desc text + p_desc text, + with_calc boolean DEFAULT true, + with_direct_form boolean DEFAULT true ); @@ -105,6 +107,20 @@ COMMENT ON COLUMN profile.p_name IS 'Name of the profile'; COMMENT ON COLUMN profile.p_desc IS 'description of the profile'; +-- +-- Name: COLUMN profile.with_calc; Type: COMMENT; Schema: public; Owner: dany +-- + +COMMENT ON COLUMN profile.with_calc IS 'show the calculator'; + + +-- +-- Name: COLUMN profile.with_direct_form; Type: COMMENT; Schema: public; Owner: dany +-- + +COMMENT ON COLUMN profile.with_direct_form IS 'show the direct form'; + + -- -- Name: profile_menu; Type: TABLE; Schema: public; Owner: dany; Tablespace: -- @@ -155,7 +171,8 @@ COMMENT ON COLUMN profile_menu.p_order IS 'order of displaying menu'; -- COMMENT ON COLUMN profile_menu.p_type_display IS 'M is a module -E is a menu'; +E is a menu +S is a select (for plugin)'; -- @@ -183,7 +200,7 @@ ALTER SEQUENCE profile_menu_pm_id_seq OWNED BY profile_menu.pm_id; -- Name: profile_menu_pm_id_seq; Type: SEQUENCE SET; Schema: public; Owner: dany -- -SELECT pg_catalog.setval('profile_menu_pm_id_seq', 156, true); +SELECT pg_catalog.setval('profile_menu_pm_id_seq', 172, true); -- @@ -281,7 +298,7 @@ SELECT pg_catalog.setval('profile_user_pu_id_seq', 1, true); -- CREATE VIEW v_all_menu AS - SELECT pm.me_code, pm.pm_id, pm.me_code_dep, pm.p_order, pm.p_type_display, pu.user_name, pu.pu_id, p.p_name, p.p_desc, mr.me_menu, mr.me_file, mr.me_url, mr.me_parameter, mr.me_javascript FROM (((profile_menu pm JOIN profile_user pu ON ((pu.p_id = pm.p_id))) JOIN profile p ON ((p.p_id = pm.p_id))) JOIN menu_ref mr USING (me_code)) ORDER BY pm.p_order; + SELECT pm.me_code, pm.pm_id, pm.me_code_dep, pm.p_order, pm.p_type_display, pu.user_name, pu.pu_id, p.p_name, p.p_desc, mr.me_menu, mr.me_file, mr.me_url, mr.me_parameter, mr.me_javascript, mr.me_type FROM (((profile_menu pm JOIN profile_user pu ON ((pu.p_id = pm.p_id))) JOIN profile p ON ((p.p_id = pm.p_id))) JOIN menu_ref mr USING (me_code)) ORDER BY pm.p_order; ALTER TABLE public.v_all_menu OWNER TO dany; @@ -311,6 +328,13 @@ ALTER TABLE profile_user ALTER COLUMN pu_id SET DEFAULT nextval('profile_user_pu -- Data for Name: menu_ref; Type: TABLE DATA; Schema: public; Owner: dany -- +INSERT INTO menu_ref VALUES ('MODOP', 'Correction Opération', 'modop/index.php', NULL, 'Correction d''écritures comptables', 'plugin_code=MODOP', NULL, 'PL'); +INSERT INTO menu_ref VALUES ('IMPCARD', 'Import Fiche', 'import_card/index.php', NULL, 'Importation de fiches', 'plugin_code=IMPCARD', NULL, 'PL'); +INSERT INTO menu_ref VALUES ('AMORTIS', 'Amortissement', 'amortis/index.php', NULL, 'Amortissement', 'plugin_code=AMORTIS', NULL, 'PL'); +INSERT INTO menu_ref VALUES ('TOOLPLAN', 'Import/export plan', 'tool_pcmn/index.php', NULL, 'Importation /export de plan comptable', 'plugin_code=TOOLPLAN', NULL, 'PL'); +INSERT INTO menu_ref VALUES ('IMPORTBANK', 'Importation banque', 'importbank/index.php', NULL, 'Import. fichier CVS de la banque', 'plugin_code=IMPORTBANK', NULL, 'PL'); +INSERT INTO menu_ref VALUES ('TOOL', 'Outil comptable', 'tools/index.php', NULL, 'Outil comptable', 'plugin_code=TOOL', NULL, 'PL'); +INSERT INTO menu_ref VALUES ('TVA', 'Module de TVA', 'tva/index.php', NULL, 'Cette extension permet de faire les listings et declarations TVA', 'plugin_code=TVA', NULL, 'PL'); INSERT INTO menu_ref VALUES ('ACH', 'Achat', 'compta_ach.inc.php', NULL, NULL, NULL, NULL, 'ME'); INSERT INTO menu_ref VALUES ('CSV:AncBalGroup', 'Export Balance groupe analytique', NULL, NULL, NULL, NULL, NULL, 'PR'); INSERT INTO menu_ref VALUES ('OTH:Bilan', 'Export Bilan', NULL, NULL, NULL, NULL, NULL, 'PR'); @@ -318,6 +342,9 @@ INSERT INTO menu_ref VALUES ('PDF:ledger', 'Export Journaux', NULL, NULL, NULL, INSERT INTO menu_ref VALUES ('CSV:postedetail', 'Export Poste détail', NULL, NULL, NULL, NULL, NULL, 'PR'); INSERT INTO menu_ref VALUES ('PDF:postedetail', 'Export Poste détail', NULL, NULL, NULL, NULL, NULL, 'PR'); INSERT INTO menu_ref VALUES ('CSV:fichedetail', 'Export Fiche détail', NULL, NULL, NULL, NULL, NULL, 'PR'); +INSERT INTO menu_ref VALUES ('CFGMENU', 'Config. Menu', 'menu.inc.php', NULL, NULL, NULL, NULL, 'ME'); +INSERT INTO menu_ref VALUES ('MODULARITY', 'Menu et profile', NULL, NULL, NULL, NULL, NULL, 'ME'); +INSERT INTO menu_ref VALUES ('CFGPROFILE', 'Profile', 'profile.inc.php', NULL, NULL, NULL, NULL, 'ME'); INSERT INTO menu_ref VALUES ('SEARCH', 'Recherche', NULL, NULL, NULL, NULL, 'popup_recherche()', 'ME'); INSERT INTO menu_ref VALUES ('COMPANY', 'Sociétés', 'company.inc.php', NULL, 'Parametre societe', NULL, NULL, 'ME'); INSERT INTO menu_ref VALUES ('PERIODE', 'Période', 'periode.inc.php', NULL, 'Gestion des périodes', NULL, NULL, 'ME'); @@ -340,7 +367,6 @@ INSERT INTO menu_ref VALUES ('ACHIMP', 'Historique achat', 'history_operation.in INSERT INTO menu_ref VALUES ('SUPPL', 'Fournisseur', 'supplier.inc.php', NULL, NULL, NULL, NULL, 'ME'); INSERT INTO menu_ref VALUES ('FOLLOW', 'Courrier', 'action.inc.php', NULL, NULL, NULL, NULL, 'ME'); INSERT INTO menu_ref VALUES ('FORECAST', 'Prévision', 'forecast.inc.php', NULL, NULL, NULL, NULL, 'ME'); -INSERT INTO menu_ref VALUES ('IMPJRN', 'Historique', 'impress_jrn.inc.php', NULL, NULL, NULL, NULL, 'ME'); INSERT INTO menu_ref VALUES ('LETTER', 'Lettrage', NULL, NULL, NULL, NULL, NULL, 'ME'); INSERT INTO menu_ref VALUES ('CFGSECURITY', 'Sécurité', 'param_sec.inc.php', NULL, NULL, NULL, NULL, 'ME'); INSERT INTO menu_ref VALUES ('LETTERCARD', 'Let. Fiche', 'lettering.card.inc.php', NULL, NULL, NULL, NULL, 'ME'); @@ -358,7 +384,6 @@ INSERT INTO menu_ref VALUES ('VENMENU', 'Vente / Recette', NULL, NULL, NULL, NUL INSERT INTO menu_ref VALUES ('PREFERENCE', 'Préférence', 'pref.inc.php', NULL, NULL, NULL, NULL, 'ME'); INSERT INTO menu_ref VALUES ('HIST', 'Historique', 'history_operation.inc.php', NULL, NULL, 'ledger_type=ALL', NULL, 'ME'); INSERT INTO menu_ref VALUES ('MENUFIN', 'Financier', NULL, NULL, NULL, NULL, NULL, 'ME'); -INSERT INTO menu_ref VALUES ('TVA', 'Tva', 'extension_get.inc.php', NULL, NULL, 'plugin_code=AMORTIS', NULL, 'ME'); INSERT INTO menu_ref VALUES ('EXTENSION', 'Extension', 'extension_choice.inc.php', NULL, NULL, NULL, NULL, 'ME'); INSERT INTO menu_ref VALUES ('MENUACH', 'Achat', NULL, NULL, NULL, NULL, NULL, 'ME'); INSERT INTO menu_ref VALUES ('MENUODS', 'Opérations diverses', NULL, NULL, NULL, NULL, NULL, 'ME'); @@ -371,13 +396,6 @@ INSERT INTO menu_ref VALUES ('FINREC', 'Rapprochement', 'compta_fin_rec.inc.php' INSERT INTO menu_ref VALUES ('ACCESS', 'Dossier', NULL, 'user_login.php', NULL, NULL, NULL, 'ME'); INSERT INTO menu_ref VALUES ('JSSEARCH', 'Recherche', NULL, NULL, NULL, NULL, 'search_reconcile()', 'ME'); INSERT INTO menu_ref VALUES ('CFGLEDGER', 'journaux', 'cfgledger.inc.php', NULL, NULL, NULL, NULL, 'ME'); -INSERT INTO menu_ref VALUES ('IMPREC', 'Rapprochement', 'impress_rec.inc.php', NULL, NULL, NULL, NULL, 'ME'); -INSERT INTO menu_ref VALUES ('IMPPOSTE', 'Poste', 'impress_poste.inc.php', NULL, NULL, NULL, NULL, 'ME'); -INSERT INTO menu_ref VALUES ('IMPREPORT', 'Rapport', 'impress_rapport.inc.php', NULL, NULL, NULL, NULL, 'ME'); -INSERT INTO menu_ref VALUES ('IMPBILAN', 'Bilan', 'impress_bilan.inc.php', NULL, NULL, NULL, NULL, 'ME'); -INSERT INTO menu_ref VALUES ('IMPGL', 'Grand Livre', 'impress_gl_comptes.inc.php', NULL, NULL, NULL, NULL, 'ME'); -INSERT INTO menu_ref VALUES ('IMPBAL', 'Balance', 'balance.inc.php', NULL, NULL, NULL, NULL, 'ME'); -INSERT INTO menu_ref VALUES ('IMPCARD', 'Catégorie de Fiches', 'impress_fiche.inc.php', NULL, NULL, NULL, NULL, 'ME'); INSERT INTO menu_ref VALUES ('CUSTDET', 'Fiche', 'detail_client.inc.php', NULL, NULL, NULL, NULL, 'ME'); INSERT INTO menu_ref VALUES ('CUSTFOLLOW', 'Suivi', 'suivi_client.inc.php', NULL, NULL, NULL, NULL, 'ME'); INSERT INTO menu_ref VALUES ('CUSTOP', 'Opération', 'operation_client.inc.php', NULL, NULL, NULL, NULL, 'ME'); @@ -395,7 +413,6 @@ INSERT INTO menu_ref VALUES ('CFGEXTENSION', 'Extension', 'extension.inc.php', N INSERT INTO menu_ref VALUES ('COMPTA', 'Comptabilité', NULL, NULL, NULL, NULL, NULL, 'ME'); INSERT INTO menu_ref VALUES ('LOGOUT', 'Sortie', NULL, 'logout.php', NULL, NULL, NULL, 'ME'); INSERT INTO menu_ref VALUES ('DASHBOARD', 'Tableau de bord', 'dashboard.inc.php', NULL, NULL, NULL, NULL, 'ME'); -INSERT INTO menu_ref VALUES ('IMP', 'Impression', NULL, NULL, NULL, NULL, NULL, 'ME'); INSERT INTO menu_ref VALUES ('PDF:fiche_balance', 'Export Fiche balance', NULL, NULL, NULL, NULL, NULL, 'PR'); INSERT INTO menu_ref VALUES ('CSV:report', 'Export report', NULL, NULL, NULL, NULL, NULL, 'PR'); INSERT INTO menu_ref VALUES ('PDF:report', 'Export report', NULL, NULL, NULL, NULL, NULL, 'PR'); @@ -416,15 +433,24 @@ INSERT INTO menu_ref VALUES ('CSV:ledger', 'Export Journaux', NULL, NULL, NULL, INSERT INTO menu_ref VALUES ('CSV:AncTable', 'Export Tableau Analytique', NULL, NULL, NULL, NULL, NULL, 'PR'); INSERT INTO menu_ref VALUES ('CSV:AncAccList', 'Export Historique Compt. Analytique', NULL, NULL, NULL, NULL, NULL, 'PR'); INSERT INTO menu_ref VALUES ('new_line', NULL, NULL, NULL, 'Saut de ligne', NULL, NULL, 'SP'); +INSERT INTO menu_ref VALUES ('PRINTJRN', 'Historique', 'impress_jrn.inc.php', NULL, NULL, NULL, NULL, 'ME'); +INSERT INTO menu_ref VALUES ('PRINTREC', 'Rapprochement', 'impress_rec.inc.php', NULL, NULL, NULL, NULL, 'ME'); +INSERT INTO menu_ref VALUES ('PRINTPOSTE', 'Poste', 'impress_poste.inc.php', NULL, NULL, NULL, NULL, 'ME'); +INSERT INTO menu_ref VALUES ('PRINTREPORT', 'Rapport', 'impress_rapport.inc.php', NULL, NULL, NULL, NULL, 'ME'); +INSERT INTO menu_ref VALUES ('PRINTBILAN', 'Bilan', 'impress_bilan.inc.php', NULL, NULL, NULL, NULL, 'ME'); +INSERT INTO menu_ref VALUES ('PRINTGL', 'Grand Livre', 'impress_gl_comptes.inc.php', NULL, NULL, NULL, NULL, 'ME'); +INSERT INTO menu_ref VALUES ('PRINTBAL', 'Balance', 'balance.inc.php', NULL, NULL, NULL, NULL, 'ME'); +INSERT INTO menu_ref VALUES ('PRINTCARD', 'Catégorie de Fiches', 'impress_fiche.inc.php', NULL, NULL, NULL, NULL, 'ME'); +INSERT INTO menu_ref VALUES ('PRINT', 'Impression', NULL, NULL, NULL, NULL, NULL, 'ME'); -- -- Data for Name: profile; Type: TABLE DATA; Schema: public; Owner: dany -- -INSERT INTO profile VALUES ('default', 1, 'Profil par défaut'); -INSERT INTO profile VALUES ('Analytique', 2, 'Uniquement comptabilité analytique'); -INSERT INTO profile VALUES ('Vente', 3, 'Uniquement vente'); +INSERT INTO profile VALUES ('Analytique', 2, 'Uniquement comptabilité analytique', true, true); +INSERT INTO profile VALUES ('Vente', 3, 'Uniquement vente', true, true); +INSERT INTO profile VALUES ('default', 1, 'Profil par défaut', true, true); -- @@ -440,11 +466,6 @@ INSERT INTO profile_menu VALUES (59, 'CFGPAYMENT', 'DIVPARM', 1, 4, 'E', NULL); INSERT INTO profile_menu VALUES (60, 'CFGTVA', 'DIVPARM', 1, 5, 'E', NULL); INSERT INTO profile_menu VALUES (61, 'CFGACCOUNT', 'DIVPARM', 1, 6, 'E', NULL); INSERT INTO profile_menu VALUES (67, 'CFGCATDOC', 'DIVPARM', 1, 8, 'E', NULL); -INSERT INTO profile_menu VALUES (13, 'IMPBILAN', 'IMP', 1, 11, 'E', NULL); -INSERT INTO profile_menu VALUES (14, 'IMPCARD', 'IMP', 1, 12, 'E', NULL); -INSERT INTO profile_menu VALUES (15, 'IMPGL', 'IMP', 1, 13, 'E', NULL); -INSERT INTO profile_menu VALUES (16, 'IMPJRN', 'IMP', 1, 14, 'E', NULL); -INSERT INTO profile_menu VALUES (17, 'IMPBAL', 'IMP', 1, 15, 'E', NULL); INSERT INTO profile_menu VALUES (68, 'CFGATTRIBCARD', 'DIVPARM', 1, 9, 'E', NULL); INSERT INTO profile_menu VALUES (69, 'CFGPCMN', 'PARAM', 1, 4, 'E', NULL); INSERT INTO profile_menu VALUES (70, 'CFGEXTENSION', 'PARAM', 1, 5, 'E', NULL); @@ -454,9 +475,6 @@ INSERT INTO profile_menu VALUES (73, 'CFGDOCUMENT', 'PARAM', 1, 8, 'E', NULL); INSERT INTO profile_menu VALUES (74, 'CFGLEDGER', 'PARAM', 1, 9, 'E', NULL); INSERT INTO profile_menu VALUES (75, 'PLANANC', 'ANC', 1, 1, 'E', NULL); INSERT INTO profile_menu VALUES (65, 'CFGCARDCAT', 'DIVPARM', 1, 7, 'E', NULL); -INSERT INTO profile_menu VALUES (9, 'IMPPOSTE', 'IMP', 1, 8, 'E', NULL); -INSERT INTO profile_menu VALUES (10, 'IMPREC', 'IMP', 1, 9, 'E', NULL); -INSERT INTO profile_menu VALUES (11, 'IMPREPORT', 'IMP', 1, 10, 'E', NULL); INSERT INTO profile_menu VALUES (76, 'ANCODS', 'ANC', 1, 2, 'E', NULL); INSERT INTO profile_menu VALUES (77, 'ANCGROUP', 'ANC', 1, 3, 'E', NULL); INSERT INTO profile_menu VALUES (78, 'ANCIMP', 'ANC', 1, 4, 'E', NULL); @@ -466,7 +484,6 @@ INSERT INTO profile_menu VALUES (27, 'LETTERACC', 'LETTER', 1, 2, 'E', NULL); INSERT INTO profile_menu VALUES (37, 'CUST', 'GESTION', 1, 1, 'E', NULL); INSERT INTO profile_menu VALUES (38, 'SUPPL', 'GESTION', 1, 2, 'E', NULL); INSERT INTO profile_menu VALUES (39, 'ADM', 'GESTION', 1, 3, 'E', NULL); -INSERT INTO profile_menu VALUES (35, 'IMP', 'GESTION', 1, 4, 'E', NULL); INSERT INTO profile_menu VALUES (36, 'CARD', 'GESTION', 1, 6, 'E', NULL); INSERT INTO profile_menu VALUES (40, 'STOCK', 'GESTION', 1, 5, 'E', NULL); INSERT INTO profile_menu VALUES (41, 'FORECAST', 'GESTION', 1, 7, 'E', NULL); @@ -481,20 +498,21 @@ INSERT INTO profile_menu VALUES (43, 'HIST', 'COMPTA', 1, 1, 'E', NULL); INSERT INTO profile_menu VALUES (94, 'FINSALDO', 'MENUFIN', 1, 3, 'E', NULL); INSERT INTO profile_menu VALUES (95, 'FINREC', 'MENUFIN', 1, 4, 'E', NULL); INSERT INTO profile_menu VALUES (79, 'PREFERENCE', NULL, 1, 15, 'M', NULL); -INSERT INTO profile_menu VALUES (6, 'IMP', 'COMPTA', 1, 6, 'E', NULL); INSERT INTO profile_menu VALUES (28, 'ADV', 'COMPTA', 1, 20, 'E', NULL); INSERT INTO profile_menu VALUES (45, 'PARAM', NULL, 1, 20, 'M', NULL); INSERT INTO profile_menu VALUES (53, 'ACCESS', NULL, 1, 25, 'M', NULL); INSERT INTO profile_menu VALUES (123, 'CSV:histo', NULL, 1, NULL, 'P', NULL); INSERT INTO profile_menu VALUES (20, 'LOGOUT', NULL, 1, 30, 'M', NULL); INSERT INTO profile_menu VALUES (44, 'DASHBOARD', NULL, 1, 10, 'M', 1); +INSERT INTO profile_menu VALUES (35, 'PRINT', 'GESTION', 1, 4, 'E', NULL); INSERT INTO profile_menu VALUES (156, 'new_line', NULL, 1, 35, 'M', NULL); INSERT INTO profile_menu VALUES (124, 'CSV:ledger', NULL, 1, NULL, 'P', NULL); INSERT INTO profile_menu VALUES (80, 'PLANANC', 'ANC', 2, 1, 'E', NULL); INSERT INTO profile_menu VALUES (125, 'PDF:ledger', NULL, 1, NULL, 'P', NULL); +INSERT INTO profile_menu VALUES (6, 'PRINT', 'COMPTA', 1, 6, 'E', NULL); INSERT INTO profile_menu VALUES (126, 'CSV:postedetail', NULL, 1, NULL, 'P', NULL); -INSERT INTO profile_menu VALUES (84, 'TVA', 'PARAM', 1, 102, 'E', NULL); INSERT INTO profile_menu VALUES (1, 'COMPTA', NULL, 1, 40, 'M', 0); +INSERT INTO profile_menu VALUES (164, 'TVA', 'EXTENSION', 1, NULL, 'S', NULL); INSERT INTO profile_menu VALUES (3, 'MENUACH', 'COMPTA', 1, 3, 'E', NULL); INSERT INTO profile_menu VALUES (86, 'ACHIMP', 'MENUACH', 1, 2, 'E', NULL); INSERT INTO profile_menu VALUES (34, 'GESTION', NULL, 1, 45, 'M', NULL); @@ -502,6 +520,8 @@ INSERT INTO profile_menu VALUES (18, 'MENUODS', 'COMPTA', 1, 5, 'E', NULL); INSERT INTO profile_menu VALUES (88, 'ODS', 'MENUODS', 1, 1, 'E', NULL); INSERT INTO profile_menu VALUES (89, 'ODSIMP', 'MENUODS', 1, 2, 'E', NULL); INSERT INTO profile_menu VALUES (2, 'ANC', NULL, 1, 50, 'M', 0); +INSERT INTO profile_menu VALUES (157, 'AMORTIS', 'MENUACH', 1, 10, 'M', NULL); +INSERT INTO profile_menu VALUES (158, 'MODOP', 'EXTENSION', 1, NULL, 'S', NULL); INSERT INTO profile_menu VALUES (4, 'VENMENU', 'COMPTA', 1, 2, 'E', NULL); INSERT INTO profile_menu VALUES (90, 'VEN', 'VENMENU', 1, 1, 'E', NULL); INSERT INTO profile_menu VALUES (91, 'VENIMP', 'VENMENU', 1, 2, 'E', NULL); @@ -509,8 +529,24 @@ INSERT INTO profile_menu VALUES (82, 'EXTENSION', NULL, 1, 55, 'M', NULL); INSERT INTO profile_menu VALUES (19, 'FIN', 'MENUFIN', 1, 1, 'E', NULL); INSERT INTO profile_menu VALUES (92, 'MENUFIN', 'COMPTA', 1, 4, 'E', NULL); INSERT INTO profile_menu VALUES (93, 'FINIMP', 'MENUFIN', 1, 2, 'E', NULL); +INSERT INTO profile_menu VALUES (159, 'IMPCARD', 'EXTENSION', 1, NULL, 'S', NULL); +INSERT INTO profile_menu VALUES (160, 'AMORTIS', 'EXTENSION', 1, NULL, 'S', NULL); +INSERT INTO profile_menu VALUES (161, 'TOOLPLAN', 'EXTENSION', 1, NULL, 'S', NULL); INSERT INTO profile_menu VALUES (151, 'SEARCH', NULL, 1, 60, 'M', NULL); INSERT INTO profile_menu VALUES (85, 'ACH', 'MENUACH', 1, 1, 'E', NULL); +INSERT INTO profile_menu VALUES (16, 'PRINTJRN', 'IMP', 1, 14, 'E', NULL); +INSERT INTO profile_menu VALUES (10, 'PRINTREC', 'IMP', 1, 9, 'E', NULL); +INSERT INTO profile_menu VALUES (9, 'PRINTPOSTE', 'IMP', 1, 8, 'E', NULL); +INSERT INTO profile_menu VALUES (11, 'PRINTREPORT', 'IMP', 1, 10, 'E', NULL); +INSERT INTO profile_menu VALUES (13, 'PRINTBILAN', 'IMP', 1, 11, 'E', NULL); +INSERT INTO profile_menu VALUES (15, 'PRINTGL', 'IMP', 1, 13, 'E', NULL); +INSERT INTO profile_menu VALUES (17, 'PRINTBAL', 'IMP', 1, 15, 'E', NULL); +INSERT INTO profile_menu VALUES (14, 'PRINTCARD', 'IMP', 1, 12, 'E', NULL); +INSERT INTO profile_menu VALUES (162, 'IMPORTBANK', 'EXTENSION', 1, NULL, 'S', NULL); +INSERT INTO profile_menu VALUES (163, 'TOOL', 'EXTENSION', 1, NULL, 'S', NULL); +INSERT INTO profile_menu VALUES (171, 'CFGMENU', 'MODULARITY', 1, NULL, 'M', NULL); +INSERT INTO profile_menu VALUES (167, 'MODULARITY', 'PARAM', 1, 1, 'M', NULL); +INSERT INTO profile_menu VALUES (172, 'CFGPROFILE', 'MODULARITY', 1, NULL, 'M', NULL); INSERT INTO profile_menu VALUES (127, 'PDF:postedetail', NULL, 1, NULL, 'P', NULL); INSERT INTO profile_menu VALUES (50, 'ANC', NULL, 2, 1, 'M', 0); INSERT INTO profile_menu VALUES (128, 'CSV:fichedetail', NULL, 1, NULL, 'P', NULL); diff --git a/sql/upgrade.sql b/sql/upgrade.sql index 8690f9551..5d3312a01 100644 --- a/sql/upgrade.sql +++ b/sql/upgrade.sql @@ -15,6 +15,8 @@ tmp_pcmn_ins.sql trigger.tmp_pcmn.sql account_add.sql object-6.0.sql -epad-style.css +epad-style.sql +extension.sql + */ create unique index qcode_idx on fiche_detail (ad_value) where ad_id=23;