phpcompta-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpcompta-dev] r4477 - in phpcompta/trunk: html html/admin html/admin/s


From: phpcompta-dev
Subject: [Phpcompta-dev] r4477 - in phpcompta/trunk: html html/admin html/admin/sql/patch html/js include include/template sql
Date: Sat, 26 Nov 2011 02:14:55 +0100 (CET)

Author: danydb
Date: 2011-11-26 02:14:51 +0100 (Sat, 26 Nov 2011)
New Revision: 4477

Added:
   phpcompta/trunk/html/admin/sql/patch/ac-upgrade13.sql
   phpcompta/trunk/html/admin/sql/patch/upgrade97.sql
Modified:
   phpcompta/trunk/html/admin/setup.php
   phpcompta/trunk/html/admin/sql/patch/
   phpcompta/trunk/html/js/scripts.js
   phpcompta/trunk/html/style.css
   phpcompta/trunk/include/ac_common.php
   phpcompta/trunk/include/ajax_get_profile.php
   phpcompta/trunk/include/anc_acc_table.inc.php
   phpcompta/trunk/include/class_acc_ledger.php
   phpcompta/trunk/include/class_acc_ledger_purchase.php
   phpcompta/trunk/include/class_acc_ledger_sold.php
   phpcompta/trunk/include/class_anc_account.php
   phpcompta/trunk/include/class_anc_group.php
   phpcompta/trunk/include/class_anc_group_operation.php
   phpcompta/trunk/include/class_calendar.php
   phpcompta/trunk/include/class_database.php
   phpcompta/trunk/include/class_follow_up.php
   phpcompta/trunk/include/constant.php
   phpcompta/trunk/include/dossier.inc.php
   phpcompta/trunk/include/menu.inc.php
   phpcompta/trunk/include/modele.inc.php
   phpcompta/trunk/include/template/calendar.php
   phpcompta/trunk/include/template/dashboard.php
   phpcompta/trunk/include/tva.inc.php
   phpcompta/trunk/sql/
   phpcompta/trunk/sql/backup-new-object.sh
   phpcompta/trunk/sql/object-6.0.sql
   phpcompta/trunk/sql/tmp_pcmn_ins.sql
   phpcompta/trunk/sql/tva.sql
   phpcompta/trunk/sql/upgrade.sql
Log:
fix small bugs and add SQL script for update

Modified: phpcompta/trunk/html/admin/setup.php
===================================================================
--- phpcompta/trunk/html/admin/setup.php        2011-11-25 16:20:12 UTC (rev 
4476)
+++ phpcompta/trunk/html/admin/setup.php        2011-11-26 01:14:51 UTC (rev 
4477)
@@ -19,7 +19,7 @@
         width:70%;
         margin-left: 15%;
         margin-right: 15%;
-            
+
 }
 h2.error {
        color:red;
@@ -65,7 +65,7 @@
        background-color:blue;
        color:lightgrey;
        }
-a { 
+a {
 color:blue;
 padding:5px;
   font-size:15px;
@@ -188,7 +188,7 @@
   echo '<form method="post">';
   echo '<h1 class="info">Entrez les informations n&eacute;cessaires &agrave; 
phpcompta</h1>';
   require_once('config_file.php');
-  
+
   echo config_file_form();
   echo HtmlInput::submit('save_config','Sauver la configuration');
   echo '</form>';
@@ -213,7 +213,7 @@
 echo "<h1>Configuration</h1>";
 ?>
 <h2>Info</h2>
-Vous utilisez le domaine <?php echo domaine; ?> 
+Vous utilisez le domaine <?php echo domaine; ?>
 <h2>Php setting</h2>
 <?php
 
@@ -330,7 +330,7 @@
 
 if ( $version[0] < 8 ||
      ($version[0]=='8' && $version[2]<4)
-     ) 
+     )
   {
 ?>
   <p><?=$failed?> Vous devez absolument utiliser au minimum une version 8.4 de 
PostGresql, si votre distribution n'en
@@ -369,7 +369,7 @@
   switch ($a['name']){
   case 'effective_cache_size':
     if ( $a['setting'] < 1000 ){
-      
+
       print '<p class="warning">'.$failed.'Attention le param&egrave;tre 
effective_cache_size est de '.
        $a['setting']." au lieu de 1000 </p>";
       $flag++;
@@ -461,6 +461,7 @@
   echo "<h3>Patching ".$db_row['dos_name'].'</h3>';
   $db=new Database($db_row['dos_id'],'dos');
   $db->apply_patch($db_row['dos_name']);
+  Dossier::synchro_admin($db_row['dos_id']);
  }
 
 //----------------------------------------------------------------------


Property changes on: phpcompta/trunk/html/admin/sql/patch
___________________________________________________________________
Name: svn:ignore
   + .ac-upgrade13.sql.swp
.ac-upgrade12.sql.swp


Added: phpcompta/trunk/html/admin/sql/patch/ac-upgrade13.sql
===================================================================
--- phpcompta/trunk/html/admin/sql/patch/ac-upgrade13.sql                       
        (rev 0)
+++ phpcompta/trunk/html/admin/sql/patch/ac-upgrade13.sql       2011-11-26 
01:14:51 UTC (rev 4477)
@@ -0,0 +1,10 @@
+begin;
+-- Check: valid_state
+ ALTER TABLE audit_connect DROP CONSTRAINT valid_state;
+
+ALTER TABLE audit_connect ADD CONSTRAINT valid_state CHECK (ac_state = 
'FAIL'::text OR ac_state = 'SUCCESS'::text or ac_state='AUDIT');
+-- run to the account_repository
+insert into theme values ('EPad','style-epad.css',null);
+
+update version set val=14;
+commit;

Added: phpcompta/trunk/html/admin/sql/patch/upgrade97.sql
===================================================================
--- phpcompta/trunk/html/admin/sql/patch/upgrade97.sql                          
(rev 0)
+++ phpcompta/trunk/html/admin/sql/patch/upgrade97.sql  2011-11-26 01:14:51 UTC 
(rev 4477)
@@ -0,0 +1,963 @@
+begin;
+drop table public.import_tmp;
+drop table public.format_csv_banque;
+insert into parameter values ('MY_ALPHANUM','N');
+update PARAMETER set pr_value='N' where pr_id='MY_CHECK_PERIODE';
+delete from user_sec_act where ua_act_id not in (800,805,910);
+delete from action where ac_id not in (800,805,910);
+insert into action (ac_id,ac_description, ac_module, ac_code) 
values(1020,'Effacer les documents du suivi','followup','RMDOC');
+insert into action (ac_id,ac_description, ac_module, ac_code) 
values(1010,'Voir les documents du suivi','followup','VIEWDOC');
+insert into action (ac_id,ac_description, ac_module, ac_code) 
values(1050,'Modifier le type de document','followup','PARCATDOC');
+create unique index qcode_idx on fiche_detail (ad_value) where ad_id=23;
+
+CREATE OR REPLACE FUNCTION comptaproc.account_alphanum()
+  RETURNS boolean AS
+$BODY$
+declare
+       l_auto bool;
+begin
+       l_auto := true;
+       select pr_value into l_auto from parameter where pr_id='MY_ALPHANUM';
+       if l_auto = 'N' or l_auto is null then
+               l_auto:=false;
+       end if;
+       return l_auto;
+end;
+$BODY$
+  LANGUAGE plpgsql;
+
+CREATE OR REPLACE FUNCTION comptaproc.account_compute(p_f_id integer)
+  RETURNS account_type AS
+$BODY$
+declare
+       class_base fiche_def.fd_class_base%type;
+       maxcode numeric;
+       sResult account_type;
+       bAlphanum bool;
+       sName text;
+begin
+       select fd_class_base into class_base
+       from
+               fiche_def join fiche using (fd_id)
+       where
+               f_id=p_f_id;
+       raise notice 'account_compute class base %',class_base;
+       bAlphanum := account_alphanum();
+       if bAlphanum = false  then
+               select count (pcm_val) into maxcode from tmp_pcmn where 
pcm_val_parent = class_base;
+               if maxcode = 0  then
+                       maxcode:=class_base::numeric;
+               else
+                       select max (pcm_val) into maxcode from tmp_pcmn where 
pcm_val_parent = class_base;
+                       maxcode:=maxcode::numeric;
+               end if;
+               if maxcode::text = class_base then
+                       maxcode:=class_base::numeric*1000;
+               end if;
+               maxcode:=maxcode+1;
+               raise notice 'account_compute Max code %',maxcode;
+               sResult:=maxcode::account_type;
+       else
+               -- if alphanum, use name
+               select ad_value into sName from fiche_detail where f_id=p_f_id 
and ad_id=1;
+               if sName is null then
+                       raise exception 'Cannot compute an accounting without 
the name of the card for %',p_f_id;
+               end if;
+               sResult := class_base||sName;
+       end if;
+       return sResult;
+end;
+$BODY$
+LANGUAGE plpgsql;
+  
+DROP FUNCTION comptaproc.account_insert(integer, text);
+
+CREATE OR REPLACE FUNCTION comptaproc.account_insert(p_f_id integer, p_account 
text)
+  RETURNS text  AS
+$BODY$
+declare
+       nParent tmp_pcmn.pcm_val_parent%type;
+       sName varchar;
+       sNew tmp_pcmn.pcm_val%type;
+       bAuto bool;
+       nFd_id integer;
+       sClass_Base fiche_def.fd_class_base%TYPE;
+       nCount integer;
+       first text;
+       second text;
+begin
+
+       if p_account is not null and length(trim(p_account)) != 0 then
+       -- if there is coma in p_account, treat normally
+               if position (',' in p_account) = 0 then
+                       raise info 'p_account is not empty';
+                               select count(*)  into nCount from tmp_pcmn 
where pcm_val=p_account::account_type;
+                               raise notice 'found in tmp_pcm %',nCount;
+                               if nCount !=0  then
+                                       raise info 'this account exists in 
tmp_pcmn ';
+                                       perform 
attribut_insert(p_f_id,5,p_account);
+                                  else
+                                      -- account doesn't exist, create it
+                                       select ad_value into sName from
+                                               fiche_detail
+                                       where
+                                       ad_id=1 and f_id=p_f_id;
+
+                                       
nParent:=account_parent(p_account::account_type);
+                                       insert into 
tmp_pcmn(pcm_val,pcm_lib,pcm_val_parent) values 
(p_account::account_type,sName,nParent);
+                                       perform 
attribut_insert(p_f_id,5,p_account);
+
+                               end if;
+               else
+               raise info 'presence of a comma';
+               -- there is 2 accounts separated by a comma
+               first := split_part(p_account,',',1);
+               second := split_part(p_account,',',2);
+               -- check there is no other coma
+               raise info 'first value % second value %', first, second;
+
+               if  position (',' in first) != 0 or position (',' in second) != 
0 then
+                       raise exception 'Too many comas, invalid account';
+               end if;
+               perform attribut_insert(p_f_id,5,p_account);
+               end if;
+       else
+       raise info 'p_account is  empty';
+               select fd_id into nFd_id from fiche where f_id=p_f_id;
+               bAuto:= account_auto(nFd_id);
+
+               select fd_class_base into sClass_base from fiche_def where 
fd_id=nFd_id;
+raise info 'sClass_Base : %',sClass_base;
+               if bAuto = true and sClass_base similar to '[[:digit:]]*'  then
+                       raise info 'account generated automatically';
+                       sNew:=account_compute(p_f_id);
+                       raise info 'sNew %', sNew;
+                       select ad_value into sName from
+                               fiche_detail
+                       where
+                               ad_id=1 and f_id=p_f_id;
+                       nParent:=account_parent(sNew);
+                       sNew := account_add  (sNew,sName);
+                       perform attribut_insert(p_f_id,5,sNew);
+
+               else
+               -- if there is an account_base then it is the default
+                     select fd_class_base::account_type into sNew from 
fiche_def join fiche using (fd_id) where f_id=p_f_id;
+                       if sNew is null or length(trim(sNew)) = 0 then
+                               raise notice 'count is null';
+                                perform attribut_insert(p_f_id,5,null);
+                       else
+                                perform attribut_insert(p_f_id,5,sNew);
+                       end if;
+               end if;
+       end if;
+
+return 0;
+end;
+$BODY$
+LANGUAGE plpgsql;
+
+CREATE OR REPLACE FUNCTION comptaproc.account_update(p_f_id integer, p_account 
account_type)
+  RETURNS integer AS
+$BODY$
+declare
+       nMax fiche.f_id%type;
+       nCount integer;
+       nParent tmp_pcmn.pcm_val_parent%type;
+       sName varchar;
+       first text;
+       second text;
+begin
+
+       if length(trim(p_account)) != 0 then
+               -- 2 accounts in card separated by comma 
+               if position (',' in p_account) = 0 then
+                       select count(*) into nCount from tmp_pcmn where 
pcm_val=p_account;
+                       if nCount = 0 then
+                       select ad_value into sName from
+                               fiche_detail
+                               where
+                               ad_id=1 and f_id=p_f_id;
+                       nParent:=account_parent(p_account);
+                       insert into tmp_pcmn(pcm_val,pcm_lib,pcm_val_parent) 
values (p_account,sName,nParent);
+               end if;
+               else
+               raise info 'presence of a comma';
+               -- there is 2 accounts separated by a comma
+               first := split_part(p_account,',',1);
+               second := split_part(p_account,',',2);
+               -- check there is no other coma
+               raise info 'first value % second value %', first, second;
+
+               if  position (',' in first) != 0 or position (',' in second) != 
0 then
+                       raise exception 'Too many comas, invalid account';
+               end if;
+               -- check that both account are in PCMN
+               
+               end if;
+       else
+               -- account is null
+               update fiche_detail set ad_value=null where f_id=p_f_id and 
ad_id=5 ;
+       end if;
+       
+       update fiche_detail set ad_value=p_account where f_id=p_f_id and 
ad_id=5 ;
+
+return 0;
+end;
+$BODY$
+LANGUAGE plpgsql;
+
+CREATE OR REPLACE FUNCTION comptaproc.format_account(p_account account_type)
+  RETURNS account_type AS
+$BODY$
+
+declare
+
+sResult account_type;
+
+begin
+sResult := lower(p_account);
+
+sResult := translate(sResult,'éèêëàâäïîüûùöô','eeeeaaaiiuuuoo');
+sResult := translate(sResult,' $€µ£%.+-/\!(){}(),;_&|"#''^','');
+
+if not sResult similar to '^[[:alnum:]_]+$' then
+       raise exception 'Invalid character in %',p_account;
+end if;
+
+return upper(sResult);
+
+end;
+$BODY$
+LANGUAGE plpgsql;
+  
+COMMENT ON FUNCTION comptaproc.format_account(account_type) IS 'format the 
accounting :
+- upper case
+- remove space and special char.
+';
+
+CREATE OR REPLACE FUNCTION comptaproc.tmp_pcmn_alphanum_ins_upd()
+  RETURNS trigger AS
+$BODY$
+declare
+   r_record tmp_pcmn%ROWTYPE;
+begin
+r_record := NEW;
+r_record.pcm_val:=format_account(NEW.pcm_val);
+
+return r_record;
+end;
+$BODY$
+LANGUAGE plpgsql;
+CREATE OR REPLACE FUNCTION comptaproc.tmp_pcmn_ins()
+  RETURNS trigger AS
+$BODY$
+declare
+   r_record tmp_pcmn%ROWTYPE;
+begin
+r_record := NEW;
+if  length(trim(r_record.pcm_type))=0 or r_record.pcm_type is NULL then 
+   r_record.pcm_type:=find_pcm_type(NEW.pcm_val);
+   return r_record;
+end if;
+return NEW;
+end;
+$BODY$
+LANGUAGE plpgsql;
+
+CREATE TRIGGER t_tmp_pcm_alphanum_ins_upd
+  BEFORE INSERT OR UPDATE
+  ON tmp_pcmn
+  FOR EACH ROW
+  EXECUTE PROCEDURE comptaproc.tmp_pcmn_alphanum_ins_upd();
+
+DROP FUNCTION comptaproc.account_add(account_type, character varying);
+
+CREATE OR REPLACE FUNCTION comptaproc.account_add(p_id account_type, p_name 
character varying)
+  RETURNS text AS
+$BODY$
+declare
+       nParent tmp_pcmn.pcm_val_parent%type;
+       nCount integer;
+       sReturn text;
+begin
+       sReturn:= format_account(p_id);
+       select count(*) into nCount from tmp_pcmn where pcm_val=sReturn;
+       if nCount = 0 then
+               nParent=account_parent(p_id);
+               insert into tmp_pcmn (pcm_val,pcm_lib,pcm_val_parent)
+                       values (p_id, p_name,nParent) returning pcm_val into 
sReturn;
+       end if;
+return sReturn;
+end ;
+$BODY$
+  LANGUAGE plpgsql;
+
+CREATE TABLE menu_ref (
+    me_code text NOT NULL,
+    me_menu text,
+    me_file text,
+    me_url text,
+    me_description text,
+    me_parameter text,
+    me_javascript text,
+    me_type character varying(2)
+);
+COMMENT ON COLUMN menu_ref.me_code IS 'Menu Code ';
+COMMENT ON COLUMN menu_ref.me_menu IS 'Label to display';
+COMMENT ON COLUMN menu_ref.me_file IS 'if not empty file to include';
+COMMENT ON COLUMN menu_ref.me_url IS 'url ';
+COMMENT ON COLUMN menu_ref.me_type IS 'ME for menu
+PR for Printing
+SP for special meaning (ex: return to line)
+PL for plugin';
+
+CREATE TABLE profile (
+    p_name text NOT NULL,
+    p_id integer NOT NULL,
+    p_desc text,
+    with_calc boolean DEFAULT true,
+    with_direct_form boolean DEFAULT true
+);
+
+COMMENT ON TABLE profile IS 'Available profile ';
+COMMENT ON COLUMN profile.p_name IS 'Name of the profile';
+COMMENT ON COLUMN profile.p_desc IS 'description of the profile';
+COMMENT ON COLUMN profile.with_calc IS 'show the calculator';
+COMMENT ON COLUMN profile.with_direct_form IS 'show the direct form';
+
+CREATE TABLE profile_menu (
+    pm_id integer NOT NULL,
+    me_code text,
+    me_code_dep text,
+    p_id integer,
+    p_order integer,
+    p_type_display text NOT NULL,
+    pm_default integer
+);
+COMMENT ON TABLE profile_menu IS 'Join  between the profile and the menu ';
+COMMENT ON COLUMN profile_menu.me_code_dep IS 'menu code dependency';
+COMMENT ON COLUMN profile_menu.p_id IS 'link to profile';
+COMMENT ON COLUMN profile_menu.p_order IS 'order of displaying menu';
+COMMENT ON COLUMN profile_menu.pm_default IS 'default menu';
+COMMENT ON COLUMN profile_menu.p_type_display IS 'M is a module
+E is a menu
+S is a select (for plugin)';
+
+
+CREATE SEQUENCE profile_menu_pm_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MAXVALUE
+    NO MINVALUE
+    CACHE 1;
+ALTER SEQUENCE profile_menu_pm_id_seq OWNED BY profile_menu.pm_id;
+SELECT pg_catalog.setval('profile_menu_pm_id_seq', 778, true);
+
+CREATE TABLE profile_menu_type (
+    pm_type text NOT NULL,
+    pm_desc text
+);
+
+CREATE SEQUENCE profile_p_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MAXVALUE
+    NO MINVALUE
+    CACHE 1;
+
+ALTER SEQUENCE profile_p_id_seq OWNED BY profile.p_id;
+
+SELECT pg_catalog.setval('profile_p_id_seq', 11, true);
+
+CREATE TABLE profile_user (
+    user_name text NOT NULL,
+    pu_id integer NOT NULL,
+    p_id integer
+);
+
+COMMENT ON TABLE profile_user IS 'Contains the available profile for users';
+COMMENT ON COLUMN profile_user.user_name IS 'fk to available_user : login';
+COMMENT ON COLUMN profile_user.p_id IS 'fk to profile';
+
+CREATE SEQUENCE profile_user_pu_id_seq
+    START WITH 1
+    INCREMENT BY 1
+    NO MAXVALUE
+    NO MINVALUE
+    CACHE 1;
+ALTER SEQUENCE profile_user_pu_id_seq OWNED BY profile_user.pu_id;
+SELECT pg_catalog.setval('profile_user_pu_id_seq', 6, 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, mr.me_type, pm.p_id, 
mr.me_description 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 profile ALTER COLUMN p_id SET DEFAULT 
nextval('profile_p_id_seq'::regclass);
+ALTER TABLE profile_menu ALTER COLUMN pm_id SET DEFAULT 
nextval('profile_menu_pm_id_seq'::regclass);
+ALTER TABLE profile_user ALTER COLUMN pu_id SET DEFAULT 
nextval('profile_user_pu_id_seq'::regclass);
+INSERT INTO menu_ref VALUES ('ACH', 'Achat', 'compta_ach.inc.php', NULL, 
'Nouvel achat ou dépense', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('ANCHOP', 'Historique', 'anc_history.inc.php', 
NULL, 'Historique des imputations analytiques', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('ANCGL', 'Grand''Livre', 
'anc_great_ledger.inc.php', NULL, 'Grand livre d''plan analytique', NULL, NULL, 
'ME');
+INSERT INTO menu_ref VALUES ('ANCBS', 'Balance simple', 
'anc_balance_simple.inc.php', NULL, 'Balance simple des imputations 
analytiques', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('ANCBC2', 'Balance croisée double', 
'anc_balance_double.inc.php', NULL, 'Balance double croisées des imputations 
analytiques', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('ANCTAB', 'Tableau', 'anc_acc_table.inc.php', 
NULL, 'Tableau lié à la comptabilité', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('ANCBCC', 'Balance Analytique/comptabilité', 
'anc_acc_balance.inc.php', NULL, 'Lien entre comptabilité et Comptabilité 
analytique', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('ANCGR', 'Groupe', 'anc_group_balance.inc.php', 
NULL, 'Balance par groupe', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('CSV:AncGrandLivre', 'Impression Grand-Livre', 
NULL, NULL, NULL, NULL, NULL, 'PR');
+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');
+INSERT INTO menu_ref VALUES ('PDF:ledger', 'Export Journaux', NULL, NULL, 
NULL, NULL, NULL, 'PR');
+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 ('SEARCH', 'Recherche', NULL, NULL, 'Recherche', 
NULL, 'popup_recherche()', 'ME');
+INSERT INTO menu_ref VALUES ('DIVPARM', 'Divers', NULL, NULL, 'Paramètres 
divers', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('CFGTVA', 'TVA', 'tva.inc.php', NULL, 'Config. de 
la tva', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('CARD', 'Fiche', 'fiche.inc.php', NULL, 'Fiche', 
NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('STOCK', 'Stock', 'stock.inc.php', NULL, 'Stock', 
NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('MOD', 'Menu et profile', NULL, NULL, 'Menu ', 
NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('CFGPRO', 'Profile', 'profile.inc.php', NULL, 
'Configuration profile', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('CFGPAY', 'Moyen de paiement', 
'payment_middle.inc.php', NULL, 'Config. des méthodes de paiement', NULL, NULL, 
'ME');
+INSERT INTO menu_ref VALUES ('CFGACC', 'Poste', 'poste.inc.php', NULL, 
'Config. poste comptable de base', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('VEN', 'Vente', 'compta_ven.inc.php', NULL, 
'Nouvelle vente ou recette', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('CFGMENU', 'Config. Menu', 'menu.inc.php', NULL, 
'Configuration des menus et plugins', NULL, NULL, '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');
+INSERT INTO menu_ref VALUES ('PDF:fichedetail', 'Export Fiche détail', NULL, 
NULL, NULL, NULL, NULL, 'PR');
+INSERT INTO menu_ref VALUES ('CSV:fiche_balance', 'Export Fiche balance', 
NULL, NULL, NULL, NULL, NULL, 'PR');
+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');
+INSERT INTO menu_ref VALUES ('CSV:fiche', 'Export Fiche', NULL, NULL, NULL, 
NULL, NULL, 'PR');
+INSERT INTO menu_ref VALUES ('PDF:fiche', 'Export Fiche', NULL, NULL, NULL, 
NULL, NULL, 'PR');
+INSERT INTO menu_ref VALUES ('CSV:glcompte', 'Export Grand Livre', NULL, NULL, 
NULL, NULL, NULL, 'PR');
+INSERT INTO menu_ref VALUES ('PDF:glcompte', 'Export Grand Livre', NULL, NULL, 
NULL, NULL, NULL, 'PR');
+INSERT INTO menu_ref VALUES ('PDF:sec', 'Export Sécurité', NULL, NULL, NULL, 
NULL, NULL, 'PR');
+INSERT INTO menu_ref VALUES ('CSV:AncList', 'Export Comptabilité analytique', 
NULL, NULL, NULL, NULL, NULL, 'PR');
+INSERT INTO menu_ref VALUES ('CSV:AncBalSimple', 'Export Comptabilité 
analytique balance simple', NULL, NULL, NULL, NULL, NULL, 'PR');
+INSERT INTO menu_ref VALUES ('PDF:AncBalSimple', 'Export Comptabilité 
analytique', NULL, NULL, NULL, NULL, NULL, 'PR');
+INSERT INTO menu_ref VALUES ('CSV:AncBalDouble', 'Export Comptabilité 
analytique balance double', NULL, NULL, NULL, NULL, NULL, 'PR');
+INSERT INTO menu_ref VALUES ('PDF:AncBalDouble', 'Export Comptabilité 
analytique balance double', NULL, NULL, NULL, NULL, NULL, 'PR');
+INSERT INTO menu_ref VALUES ('CSV:balance', 'Export Balance comptable', NULL, 
NULL, NULL, NULL, NULL, 'PR');
+INSERT INTO menu_ref VALUES ('PDF:balance', 'Export Balance comptable', NULL, 
NULL, NULL, NULL, NULL, 'PR');
+INSERT INTO menu_ref VALUES ('CSV:histo', 'Export Historique', NULL, NULL, 
NULL, NULL, NULL, 'PR');
+INSERT INTO menu_ref VALUES ('CSV:ledger', 'Export Journaux', NULL, NULL, 
NULL, NULL, NULL, 'PR');
+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 ('SUPPL', 'Fournisseur', 'supplier.inc.php', NULL, 
'Suivi fournisseur', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('LET', 'Lettrage', NULL, NULL, 'Lettrage', NULL, 
NULL, 'ME');
+INSERT INTO menu_ref VALUES ('ANCODS', 'Opérations diverses', 
'anc_od.inc.php', NULL, 'OD analytique', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('VERIFBIL', 'Vérification ', 
'verif_bilan.inc.php', NULL, 'Vérification de la comptabilité', NULL, NULL, 
'ME');
+INSERT INTO menu_ref VALUES ('REPORT', 'Création de rapport', 
'report.inc.php', NULL, 'Création de rapport', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('OPEN', 'Ecriture Ouverture', 'opening.inc.php', 
NULL, 'Ecriture d''ouverture', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('ACHIMP', 'Historique achat', 
'history_operation.inc.php', NULL, 'Historique achat', 'ledger_type=ACH', NULL, 
'ME');
+INSERT INTO menu_ref VALUES ('FOLLOW', 'Courrier', 'action.inc.php', NULL, 
'Suivi, courrier, devis', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('FORECAST', 'Prévision', 'forecast.inc.php', 
NULL, 'Prévision', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('EXT', 'Extension', 'extension_choice.inc.php', 
NULL, 'Extensions (plugins)', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('CFGDOC', 'Document', 'document_modele.inc.php', 
NULL, 'Config. modèle de document', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('CFGLED', 'journaux', 'cfgledger.inc.php', NULL, 
'Configuration des journaux', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('PREDOP', 'Ecriture prédefinie', 'preod.inc.php', 
NULL, 'Gestion des opérations prédéfinifies', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('ADV', 'Avancé', NULL, NULL, 'Menu avancé', NULL, 
NULL, 'ME');
+INSERT INTO menu_ref VALUES ('ANC', 'Compta Analytique', NULL, NULL, 'Module 
comptabilité analytique', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('CFGSEC', 'Sécurité', 'param_sec.inc.php', NULL, 
'configuration de la sécurité', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('PLANANC', 'Plan Compt. analytique', 
'anc_pa.inc.php', NULL, 'Plan analytique', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('ANCGROUP', 'Groupe', 'anc_group.inc.php', NULL, 
'Groupe analytique', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('ODSIMP', 'Historique opérations diverses', 
'history_operation.inc.php', NULL, 'Historique opérations diverses', 
'ledger_type=ODS', NULL, 'ME');
+INSERT INTO menu_ref VALUES ('VENMENU', 'Vente / Recette', NULL, NULL, 'Menu 
ventes et recettes', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('PREFERENCE', 'Préférence', 'pref.inc.php', NULL, 
'Préférence', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('HIST', 'Historique', 
'history_operation.inc.php', NULL, 'Historique', 'ledger_type=ALL', NULL, 'ME');
+INSERT INTO menu_ref VALUES ('MENUFIN', 'Financier', NULL, NULL, 'Menu 
Financier', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('FIMP', 'Historique financier', 
'history_operation.inc.php', NULL, 'Historique financier', 'ledger_type=FIN', 
NULL, 'ME');
+INSERT INTO menu_ref VALUES ('MENUACH', 'Achat', NULL, NULL, 'Menu achat', 
NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('MENUODS', 'Opérations diverses', NULL, NULL, 
'Menu opérations diverses', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('ODS', 'Opérations Diverses', 
'compta_ods.inc.php', NULL, 'Nouvelle opérations diverses', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('FREC', 'Rapprochement', 
'compta_fin_rec.inc.php', NULL, 'Rapprochement bancaire', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('ADM', 'Administration', 'adm.inc.php', NULL, 
'Suivi administration, banque', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('FIN', 'Nouvel extrait', 'compta_fin.inc.php', 
NULL, 'Nouvel extrait bancaire', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('CFGATCARD', 'Attribut de fiche', 
'card_attr.inc.php', NULL, 'Gestion des modèles de fiches', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('FSALDO', 'Soldes', 'compta_fin_saldo.inc.php', 
NULL, 'Solde des comptes en banques, caisse...', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('JSSEARCH', 'Recherche', NULL, NULL, 'Recherche', 
NULL, 'search_reconcile()', 'ME');
+INSERT INTO menu_ref VALUES ('LETACC', 'Lettrage par Poste', 
'lettering.account.inc.php', NULL, 'lettrage par poste comptable', NULL, NULL, 
'ME');
+INSERT INTO menu_ref VALUES ('CARDBAL', 'Balance', 'balance_card.inc.php', 
NULL, 'Balance par catégorie de fiche', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('CUST', 'Client', 'client.inc.php', NULL, 'Suivi 
client', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('CFGCARDCAT', 'Catégorie de fiche', 
'fiche_def.inc.php', NULL, 'Gestion catégorie de fiche', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('CFGCATDOC', 'Catégorie de documents', 
'cat_document.inc.php', NULL, 'Config. catégorie de documents', NULL, NULL, 
'ME');
+INSERT INTO menu_ref VALUES ('VENIMP', 'Historique vente', 
'history_operation.inc.php', NULL, 'Historique des ventes', 'ledger_type=VEN', 
NULL, 'ME');
+INSERT INTO menu_ref VALUES ('LETCARD', 'Lettrage par Fiche', 
'lettering.card.inc.php', NULL, 'Lettrage par fiche', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('CFGPCMN', 'Plan Comptable', 
'param_pcmn.inc.php', NULL, 'Config. du plan comptable', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('LOGOUT', 'Sortie', NULL, 'logout.php', 'Sortie', 
NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('DASHBOARD', 'Tableau de bord', 
'dashboard.inc.php', NULL, 'Tableau de bord', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('COMPTA', 'Comptabilité', NULL, NULL, 'Module 
comptabilité', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('GESTION', 'Gestion', NULL, NULL, 'Module 
gestion', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('PARAM', 'Paramètre', NULL, NULL, 'Module 
paramètre', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('PRINTJRN', 'Historique', 'impress_jrn.inc.php', 
NULL, 'Impression historique', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('PRINTREC', 'Rapprochement', 
'impress_rec.inc.php', NULL, 'Impression des rapprochements', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('PRINTPOSTE', 'Poste', 'impress_poste.inc.php', 
NULL, 'Impression du détail d''un poste comptable', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('PRINTREPORT', 'Rapport', 
'impress_rapport.inc.php', NULL, 'Impression de rapport', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('PRINTBILAN', 'Bilan', 'impress_bilan.inc.php', 
NULL, 'Impression de bilan', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('PRINTGL', 'Grand Livre', 
'impress_gl_comptes.inc.php', NULL, 'Impression du grand livre', NULL, NULL, 
'ME');
+INSERT INTO menu_ref VALUES ('PRINTBAL', 'Balance', 'balance.inc.php', NULL, 
'Impression des balances comptables', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('PRINTCARD', 'Catégorie de Fiches', 
'impress_fiche.inc.php', NULL, 'Impression catégorie de fiches', NULL, NULL, 
'ME');
+INSERT INTO menu_ref VALUES ('PRINT', 'Impression', NULL, NULL, 'Menu 
impression', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('ACCESS', 'Accueil', NULL, 'user_login.php', 
'Accueil', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('ANCIMP', 'Impression', NULL, NULL, 'Impression 
compta. analytique', NULL, NULL, 'ME');
+INSERT INTO menu_ref VALUES ('new_line', 'saut de ligne', NULL, NULL, 'Saut de 
ligne', NULL, NULL, 'SP');
+
+INSERT INTO profile VALUES ('Administrateur', 1, 'Profil par défaut pour les 
adminstrateurs', true, true);
+INSERT INTO profile VALUES ('Utilisateur', 2, 'Profil par défaut pour les 
utilisateurs', true, true);
+INSERT INTO profile_menu VALUES (59, 'CFGPAY', 'DIVPARM', 1, 4, 'E', 0);
+INSERT INTO profile_menu VALUES (68, 'CFGATCARD', 'DIVPARM', 1, 9, 'E', 0);
+INSERT INTO profile_menu VALUES (61, 'CFGACC', 'DIVPARM', 1, 6, 'E', 0);
+INSERT INTO profile_menu VALUES (54, 'COMPANY', 'PARAM', 1, 1, 'E', 0);
+INSERT INTO profile_menu VALUES (651, 'ANCHOP', 'ANCIMP', 1, 10, 'E', 0);
+INSERT INTO profile_menu VALUES (173, 'COMPTA', NULL, 1, 40, 'M', 0);
+INSERT INTO profile_menu VALUES (55, 'PERIODE', 'PARAM', 1, 2, 'E', 0);
+INSERT INTO profile_menu VALUES (56, 'DIVPARM', 'PARAM', 1, 3, 'E', 0);
+INSERT INTO profile_menu VALUES (652, 'ANCGL', 'ANCIMP', 1, 20, 'E', 0);
+INSERT INTO profile_menu VALUES (60, 'CFGTVA', 'DIVPARM', 1, 5, 'E', 0);
+INSERT INTO profile_menu VALUES (653, 'ANCBS', 'ANCIMP', 1, 30, 'E', 0);
+INSERT INTO profile_menu VALUES (654, 'ANCBC2', 'ANCIMP', 1, 40, 'E', 0);
+INSERT INTO profile_menu VALUES (655, 'ANCTAB', 'ANCIMP', 1, 50, 'E', 0);
+INSERT INTO profile_menu VALUES (656, 'ANCBCC', 'ANCIMP', 1, 60, 'E', 0);
+INSERT INTO profile_menu VALUES (657, 'ANCGR', 'ANCIMP', 1, 70, 'E', 0);
+INSERT INTO profile_menu VALUES (658, 'CSV:AncGrandLivre', NULL, 1, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (662, 'new_line', NULL, 1, 35, 'M', 0);
+INSERT INTO profile_menu VALUES (67, 'CFGCATDOC', 'DIVPARM', 1, 8, 'E', 0);
+INSERT INTO profile_menu VALUES (69, 'CFGPCMN', 'PARAM', 1, 4, 'E', 0);
+INSERT INTO profile_menu VALUES (526, 'PRINTGL', 'PRINT', 1, 20, 'E', 0);
+INSERT INTO profile_menu VALUES (23, 'LET', 'COMPTA', 1, 8, 'E', 0);
+INSERT INTO profile_menu VALUES (523, 'PRINTBAL', 'PRINT', 1, 50, 'E', 0);
+INSERT INTO profile_menu VALUES (529, 'PRINTREPORT', 'PRINT', 1, 85, 'E', 0);
+INSERT INTO profile_menu VALUES (72, 'PREDOP', 'PARAM', 1, 7, 'E', 0);
+INSERT INTO profile_menu VALUES (75, 'PLANANC', 'ANC', 1, 1, 'E', 0);
+INSERT INTO profile_menu VALUES (65, 'CFGCARDCAT', 'DIVPARM', 1, 7, 'E', 0);
+INSERT INTO profile_menu VALUES (76, 'ANCODS', 'ANC', 1, 2, 'E', 0);
+INSERT INTO profile_menu VALUES (77, 'ANCGROUP', 'ANC', 1, 3, 'E', 0);
+INSERT INTO profile_menu VALUES (78, 'ANCIMP', 'ANC', 1, 4, 'E', 0);
+INSERT INTO profile_menu VALUES (45, 'PARAM', NULL, 1, 20, 'M', 0);
+INSERT INTO profile_menu VALUES (527, 'PRINTJRN', 'PRINT', 1, 10, 'E', 0);
+INSERT INTO profile_menu VALUES (530, 'PRINTREC', 'PRINT', 1, 100, 'E', 0);
+INSERT INTO profile_menu VALUES (524, 'PRINTBILAN', 'PRINT', 1, 90, 'E', 0);
+INSERT INTO profile_menu VALUES (79, 'PREFERENCE', NULL, 1, 15, 'M', 0);
+INSERT INTO profile_menu VALUES (37, 'CUST', 'GESTION', 1, 1, 'E', 0);
+INSERT INTO profile_menu VALUES (38, 'SUPPL', 'GESTION', 1, 2, 'E', 0);
+INSERT INTO profile_menu VALUES (39, 'ADM', 'GESTION', 1, 3, 'E', 0);
+INSERT INTO profile_menu VALUES (36, 'CARD', 'GESTION', 1, 6, 'E', 0);
+INSERT INTO profile_menu VALUES (40, 'STOCK', 'GESTION', 1, 5, 'E', 0);
+INSERT INTO profile_menu VALUES (41, 'FORECAST', 'GESTION', 1, 7, 'E', 0);
+INSERT INTO profile_menu VALUES (42, 'FOLLOW', 'GESTION', 1, 8, 'E', 0);
+INSERT INTO profile_menu VALUES (29, 'VERIFBIL', 'ADV', 1, 21, 'E', 0);
+INSERT INTO profile_menu VALUES (30, 'STOCK', 'ADV', 1, 22, 'E', 0);
+INSERT INTO profile_menu VALUES (31, 'PREDOP', 'ADV', 1, 23, 'E', 0);
+INSERT INTO profile_menu VALUES (32, 'OPEN', 'ADV', 1, 24, 'E', 0);
+INSERT INTO profile_menu VALUES (33, 'REPORT', 'ADV', 1, 25, 'E', 0);
+INSERT INTO profile_menu VALUES (5, 'CARD', 'COMPTA', 1, 7, 'E', 0);
+INSERT INTO profile_menu VALUES (43, 'HIST', 'COMPTA', 1, 1, 'E', 0);
+INSERT INTO profile_menu VALUES (28, 'ADV', 'COMPTA', 1, 20, 'E', 0);
+INSERT INTO profile_menu VALUES (53, 'ACCESS', NULL, 1, 25, 'M', 0);
+INSERT INTO profile_menu VALUES (123, 'CSV:histo', NULL, 1, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (20, 'LOGOUT', NULL, 1, 30, 'M', 0);
+INSERT INTO profile_menu VALUES (35, 'PRINT', 'GESTION', 1, 4, 'E', 0);
+INSERT INTO profile_menu VALUES (124, 'CSV:ledger', NULL, 1, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (125, 'PDF:ledger', NULL, 1, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (6, 'PRINT', 'COMPTA', 1, 6, 'E', 0);
+INSERT INTO profile_menu VALUES (126, 'CSV:postedetail', NULL, 1, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (3, 'MENUACH', 'COMPTA', 1, 3, 'E', 0);
+INSERT INTO profile_menu VALUES (86, 'ACHIMP', 'MENUACH', 1, 2, 'E', 0);
+INSERT INTO profile_menu VALUES (34, 'GESTION', NULL, 1, 45, 'M', 0);
+INSERT INTO profile_menu VALUES (18, 'MENUODS', 'COMPTA', 1, 5, 'E', 0);
+INSERT INTO profile_menu VALUES (88, 'ODS', 'MENUODS', 1, 1, 'E', 0);
+INSERT INTO profile_menu VALUES (89, 'ODSIMP', 'MENUODS', 1, 2, 'E', 0);
+INSERT INTO profile_menu VALUES (2, 'ANC', NULL, 1, 50, 'M', 0);
+INSERT INTO profile_menu VALUES (4, 'VENMENU', 'COMPTA', 1, 2, 'E', 0);
+INSERT INTO profile_menu VALUES (90, 'VEN', 'VENMENU', 1, 1, 'E', 0);
+INSERT INTO profile_menu VALUES (91, 'VENIMP', 'VENMENU', 1, 2, 'E', 0);
+INSERT INTO profile_menu VALUES (19, 'FIN', 'MENUFIN', 1, 1, 'E', 0);
+INSERT INTO profile_menu VALUES (73, 'CFGDOC', 'PARAM', 1, 8, 'E', 0);
+INSERT INTO profile_menu VALUES (74, 'CFGLED', 'PARAM', 1, 9, 'E', 0);
+INSERT INTO profile_menu VALUES (71, 'CFGSEC', 'PARAM', 1, 6, 'E', 0);
+INSERT INTO profile_menu VALUES (82, 'EXT', NULL, 1, 55, 'M', 0);
+INSERT INTO profile_menu VALUES (95, 'FREC', 'MENUFIN', 1, 4, 'E', 0);
+INSERT INTO profile_menu VALUES (94, 'FSALDO', 'MENUFIN', 1, 3, 'E', 0);
+INSERT INTO profile_menu VALUES (27, 'LETACC', 'LET', 1, 2, 'E', 0);
+INSERT INTO profile_menu VALUES (24, 'LETCARD', 'LET', 1, 1, 'E', 0);
+INSERT INTO profile_menu VALUES (167, 'MOD', 'PARAM', 1, 1, 'E', 0);
+INSERT INTO profile_menu VALUES (92, 'MENUFIN', 'COMPTA', 1, 4, 'E', 0);
+INSERT INTO profile_menu VALUES (93, 'FIMP', 'MENUFIN', 1, 2, 'E', 0);
+INSERT INTO profile_menu VALUES (151, 'SEARCH', NULL, 1, 60, 'M', 0);
+INSERT INTO profile_menu VALUES (85, 'ACH', 'MENUACH', 1, 1, 'E', 0);
+INSERT INTO profile_menu VALUES (127, 'PDF:postedetail', NULL, 1, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (128, 'CSV:fichedetail', NULL, 1, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (129, 'PDF:fichedetail', NULL, 1, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (130, 'CSV:fiche_balance', NULL, 1, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (131, 'PDF:fiche_balance', NULL, 1, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (132, 'CSV:report', NULL, 1, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (133, 'PDF:report', NULL, 1, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (134, 'CSV:fiche', NULL, 1, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (135, 'PDF:fiche', NULL, 1, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (136, 'CSV:glcompte', NULL, 1, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (137, 'PDF:glcompte', NULL, 1, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (138, 'PDF:sec', NULL, 1, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (139, 'CSV:AncList', NULL, 1, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (140, 'CSV:AncBalSimple', NULL, 1, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (141, 'PDF:AncBalSimple', NULL, 1, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (142, 'CSV:AncBalDouble', NULL, 1, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (143, 'PDF:AncBalDouble', NULL, 1, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (144, 'CSV:balance', NULL, 1, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (145, 'PDF:balance', NULL, 1, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (146, 'CSV:AncTable', NULL, 1, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (147, 'CSV:AncAccList', NULL, 1, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (148, 'CSV:AncBalGroup', NULL, 1, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (149, 'OTH:Bilan', NULL, 1, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (528, 'PRINTPOSTE', 'PRINT', 1, 30, 'E', 0);
+INSERT INTO profile_menu VALUES (525, 'PRINTCARD', 'PRINT', 1, 40, 'E', 0);
+INSERT INTO profile_menu VALUES (1, 'DASHBOARD', NULL, 1, 10, 'M', 1);
+INSERT INTO profile_menu VALUES (172, 'CFGPRO', 'MOD', 1, NULL, 'E', 0);
+INSERT INTO profile_menu VALUES (171, 'CFGMENU', 'MOD', 1, NULL, 'E', 0);
+INSERT INTO profile_menu VALUES (663, 'CFGPAY', 'DIVPARM', 2, 4, 'E', 0);
+INSERT INTO profile_menu VALUES (664, 'CFGATCARD', 'DIVPARM', 2, 9, 'E', 0);
+INSERT INTO profile_menu VALUES (665, 'CFGACC', 'DIVPARM', 2, 6, 'E', 0);
+INSERT INTO profile_menu VALUES (668, 'ANCHOP', 'ANCIMP', 2, 10, 'E', 0);
+INSERT INTO profile_menu VALUES (669, 'COMPTA', NULL, 2, 40, 'M', 0);
+INSERT INTO profile_menu VALUES (672, 'ANCGL', 'ANCIMP', 2, 20, 'E', 0);
+INSERT INTO profile_menu VALUES (673, 'CFGTVA', 'DIVPARM', 2, 5, 'E', 0);
+INSERT INTO profile_menu VALUES (674, 'ANCBS', 'ANCIMP', 2, 30, 'E', 0);
+INSERT INTO profile_menu VALUES (675, 'ANCBC2', 'ANCIMP', 2, 40, 'E', 0);
+INSERT INTO profile_menu VALUES (676, 'ANCTAB', 'ANCIMP', 2, 50, 'E', 0);
+INSERT INTO profile_menu VALUES (677, 'ANCBCC', 'ANCIMP', 2, 60, 'E', 0);
+INSERT INTO profile_menu VALUES (678, 'ANCGR', 'ANCIMP', 2, 70, 'E', 0);
+INSERT INTO profile_menu VALUES (679, 'CSV:AncGrandLivre', NULL, 2, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (680, 'new_line', NULL, 2, 35, 'M', 0);
+INSERT INTO profile_menu VALUES (681, 'CFGCATDOC', 'DIVPARM', 2, 8, 'E', 0);
+INSERT INTO profile_menu VALUES (683, 'PRINTGL', 'PRINT', 2, 20, 'E', 0);
+INSERT INTO profile_menu VALUES (684, 'LET', 'COMPTA', 2, 8, 'E', 0);
+INSERT INTO profile_menu VALUES (685, 'PRINTBAL', 'PRINT', 2, 50, 'E', 0);
+INSERT INTO profile_menu VALUES (686, 'PRINTREPORT', 'PRINT', 2, 85, 'E', 0);
+INSERT INTO profile_menu VALUES (688, 'PLANANC', 'ANC', 2, 1, 'E', 0);
+INSERT INTO profile_menu VALUES (689, 'CFGCARDCAT', 'DIVPARM', 2, 7, 'E', 0);
+INSERT INTO profile_menu VALUES (690, 'ANCODS', 'ANC', 2, 2, 'E', 0);
+INSERT INTO profile_menu VALUES (717, 'CSV:ledger', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (718, 'PDF:ledger', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (719, 'PRINT', 'COMPTA', 2, 6, 'E', 0);
+INSERT INTO profile_menu VALUES (720, 'CSV:postedetail', NULL, 2, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (721, 'MENUACH', 'COMPTA', 2, 3, 'E', 0);
+INSERT INTO profile_menu VALUES (722, 'ACHIMP', 'MENUACH', 2, 2, 'E', 0);
+INSERT INTO profile_menu VALUES (723, 'GESTION', NULL, 2, 45, 'M', 0);
+INSERT INTO profile_menu VALUES (724, 'MENUODS', 'COMPTA', 2, 5, 'E', 0);
+INSERT INTO profile_menu VALUES (725, 'ODS', 'MENUODS', 2, 1, 'E', 0);
+INSERT INTO profile_menu VALUES (726, 'ODSIMP', 'MENUODS', 2, 2, 'E', 0);
+INSERT INTO profile_menu VALUES (727, 'ANC', NULL, 2, 50, 'M', 0);
+INSERT INTO profile_menu VALUES (728, 'VENMENU', 'COMPTA', 2, 2, 'E', 0);
+INSERT INTO profile_menu VALUES (729, 'VEN', 'VENMENU', 2, 1, 'E', 0);
+INSERT INTO profile_menu VALUES (730, 'VENIMP', 'VENMENU', 2, 2, 'E', 0);
+INSERT INTO profile_menu VALUES (731, 'FIN', 'MENUFIN', 2, 1, 'E', 0);
+INSERT INTO profile_menu VALUES (735, 'EXT', NULL, 2, 55, 'M', 0);
+INSERT INTO profile_menu VALUES (736, 'FREC', 'MENUFIN', 2, 4, 'E', 0);
+INSERT INTO profile_menu VALUES (737, 'FSALDO', 'MENUFIN', 2, 3, 'E', 0);
+INSERT INTO profile_menu VALUES (738, 'LETACC', 'LET', 2, 2, 'E', 0);
+INSERT INTO profile_menu VALUES (691, 'ANCGROUP', 'ANC', 2, 3, 'E', 0);
+INSERT INTO profile_menu VALUES (692, 'ANCIMP', 'ANC', 2, 4, 'E', 0);
+INSERT INTO profile_menu VALUES (694, 'PRINTJRN', 'PRINT', 2, 10, 'E', 0);
+INSERT INTO profile_menu VALUES (695, 'PRINTREC', 'PRINT', 2, 100, 'E', 0);
+INSERT INTO profile_menu VALUES (696, 'PRINTBILAN', 'PRINT', 2, 90, 'E', 0);
+INSERT INTO profile_menu VALUES (697, 'PREFERENCE', NULL, 2, 15, 'M', 0);
+INSERT INTO profile_menu VALUES (698, 'CUST', 'GESTION', 2, 1, 'E', 0);
+INSERT INTO profile_menu VALUES (699, 'SUPPL', 'GESTION', 2, 2, 'E', 0);
+INSERT INTO profile_menu VALUES (700, 'ADM', 'GESTION', 2, 3, 'E', 0);
+INSERT INTO profile_menu VALUES (701, 'CARD', 'GESTION', 2, 6, 'E', 0);
+INSERT INTO profile_menu VALUES (702, 'STOCK', 'GESTION', 2, 5, 'E', 0);
+INSERT INTO profile_menu VALUES (703, 'FORECAST', 'GESTION', 2, 7, 'E', 0);
+INSERT INTO profile_menu VALUES (704, 'FOLLOW', 'GESTION', 2, 8, 'E', 0);
+INSERT INTO profile_menu VALUES (705, 'VERIFBIL', 'ADV', 2, 21, 'E', 0);
+INSERT INTO profile_menu VALUES (706, 'STOCK', 'ADV', 2, 22, 'E', 0);
+INSERT INTO profile_menu VALUES (707, 'PREDOP', 'ADV', 2, 23, 'E', 0);
+INSERT INTO profile_menu VALUES (708, 'OPEN', 'ADV', 2, 24, 'E', 0);
+INSERT INTO profile_menu VALUES (709, 'REPORT', 'ADV', 2, 25, 'E', 0);
+INSERT INTO profile_menu VALUES (710, 'CARD', 'COMPTA', 2, 7, 'E', 0);
+INSERT INTO profile_menu VALUES (711, 'HIST', 'COMPTA', 2, 1, 'E', 0);
+INSERT INTO profile_menu VALUES (712, 'ADV', 'COMPTA', 2, 20, 'E', 0);
+INSERT INTO profile_menu VALUES (713, 'ACCESS', NULL, 2, 25, 'M', 0);
+INSERT INTO profile_menu VALUES (714, 'CSV:histo', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (715, 'LOGOUT', NULL, 2, 30, 'M', 0);
+INSERT INTO profile_menu VALUES (716, 'PRINT', 'GESTION', 2, 4, 'E', 0);
+INSERT INTO profile_menu VALUES (739, 'LETCARD', 'LET', 2, 1, 'E', 0);
+INSERT INTO profile_menu VALUES (742, 'MENUFIN', 'COMPTA', 2, 4, 'E', 0);
+INSERT INTO profile_menu VALUES (743, 'FIMP', 'MENUFIN', 2, 2, 'E', 0);
+INSERT INTO profile_menu VALUES (744, 'SEARCH', NULL, 2, 60, 'M', 0);
+INSERT INTO profile_menu VALUES (745, 'ACH', 'MENUACH', 2, 1, 'E', 0);
+INSERT INTO profile_menu VALUES (746, 'PDF:postedetail', NULL, 2, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (747, 'CSV:fichedetail', NULL, 2, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (748, 'PDF:fichedetail', NULL, 2, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (749, 'CSV:fiche_balance', NULL, 2, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (750, 'PDF:fiche_balance', NULL, 2, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (751, 'CSV:report', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (752, 'PDF:report', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (753, 'CSV:fiche', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (754, 'PDF:fiche', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (755, 'CSV:glcompte', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (756, 'PDF:glcompte', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (757, 'PDF:sec', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (758, 'CSV:AncList', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (759, 'CSV:AncBalSimple', NULL, 2, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (760, 'PDF:AncBalSimple', NULL, 2, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (761, 'CSV:AncBalDouble', NULL, 2, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (762, 'PDF:AncBalDouble', NULL, 2, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (763, 'CSV:balance', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (764, 'PDF:balance', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (765, 'CSV:AncTable', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (766, 'CSV:AncAccList', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (767, 'CSV:AncBalGroup', NULL, 2, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (768, 'OTH:Bilan', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (769, 'PRINTPOSTE', 'PRINT', 2, 30, 'E', 0);
+INSERT INTO profile_menu VALUES (770, 'PRINTCARD', 'PRINT', 2, 40, 'E', 0);
+INSERT INTO profile_menu VALUES (777, 'CFGPRO', 'MOD', 2, NULL, 'E', 0);
+INSERT INTO profile_menu VALUES (778, 'CFGMENU', 'MOD', 2, NULL, 'E', 0);
+INSERT INTO profile_menu VALUES (772, 'DASHBOARD', NULL, 2, 10, 'M', 1);
+INSERT INTO profile_menu_type VALUES ('P', 'Impression');
+INSERT INTO profile_menu_type VALUES ('S', 'Extension');
+INSERT INTO profile_menu_type VALUES ('E', 'Menu');
+INSERT INTO profile_menu_type VALUES ('M', 'Module');
+INSERT INTO profile_user VALUES ('phpcompta', 1, 1);
+ALTER TABLE ONLY menu_ref    ADD CONSTRAINT menu_ref_pkey PRIMARY KEY 
(me_code);
+ALTER TABLE ONLY profile_menu    ADD CONSTRAINT profile_menu_pkey PRIMARY KEY 
(pm_id);
+ALTER TABLE ONLY profile_menu_type    ADD CONSTRAINT profile_menu_type_pkey 
PRIMARY KEY (pm_type);
+ALTER TABLE ONLY profile    ADD CONSTRAINT profile_pkey PRIMARY KEY (p_id);
+ALTER TABLE ONLY profile_user    ADD CONSTRAINT profile_user_pkey PRIMARY KEY 
(pu_id);
+ALTER TABLE ONLY profile_user    ADD CONSTRAINT profile_user_user_name_key 
UNIQUE (user_name, p_id);
+CREATE INDEX fki_profile_menu_me_code ON profile_menu USING btree (me_code);
+CREATE INDEX fki_profile_menu_profile ON profile_menu USING btree (p_id);
+CREATE INDEX fki_profile_menu_type_fkey ON profile_menu USING btree 
(p_type_display);
+ALTER TABLE ONLY profile_menu    ADD CONSTRAINT profile_menu_me_code_fkey 
FOREIGN KEY (me_code) REFERENCES menu_ref(me_code) ON UPDATE CASCADE ON DELETE 
CASCADE;
+ALTER TABLE ONLY profile_menu    ADD CONSTRAINT profile_menu_p_id_fkey FOREIGN 
KEY (p_id) REFERENCES profile(p_id) ON UPDATE CASCADE ON DELETE CASCADE;
+ALTER TABLE ONLY profile_menu    ADD CONSTRAINT profile_menu_type_fkey FOREIGN 
KEY (p_type_display) REFERENCES profile_menu_type(pm_type);
+ALTER TABLE ONLY profile_user    ADD CONSTRAINT profile_user_p_id_fkey FOREIGN 
KEY (p_id) REFERENCES profile(p_id) ON UPDATE CASCADE ON DELETE CASCADE;
+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';
+create type menu_tree as (code text,description text);
+
+create or replace function comptaproc.get_profile_menu(login text)
+returns setof  menu_tree
+as
+$BODY$
+declare
+       a menu_tree;
+       e menu_tree;
+begin
+for a in select me_code,me_description from v_all_menu where user_name=login 
+       and me_code_dep is null and me_type <> 'PR' and me_type <>'SP'
+loop
+               return next a;
+       
+               for e in select * from get_menu_tree(a.code,login)
+               loop 
+                       return next e;
+               end loop;
+       
+       end loop;
+return;
+end;
+$BODY$ language plpgsql;
+
+
+
+
+CREATE OR REPLACE FUNCTION comptaproc.get_menu_tree(p_code text,login text)
+  RETURNS SETOF menu_tree AS
+$BODY$
+declare
+       i menu_tree;
+       e menu_tree;
+       a text;
+       x v_all_menu%ROWTYPE;
+begin
+       for x in select *  from v_all_menu where me_code_dep=p_code::text and 
user_name=login::text
+       loop    
+               if x.me_code_dep is not null then
+                       i.code := x.me_code_dep||'/'||x.me_code;
+               else
+                       i.code := x.me_code;
+               end if;
+
+               i.description := x.me_description;
+               
+               return next i;
+               
+       for e in select *  from get_menu_tree(x.me_code,login)
+               loop
+                       e.code:=x.me_code_dep||'/'||e.code;
+                       return next e;
+               end loop;
+
+       end loop;
+       return;
+end;
+$BODY$
+LANGUAGE plpgsql;
+       
+alter table mod_payment add jrn_def_id bigint;
+update mod_payment set jrn_def_id=2 where mp_type='VEN';
+update mod_payment set jrn_def_id=3 where mp_type='ACH';
+
+alter table mod_payment drop mp_type;
+
+alter table mod_payment add constraint mod_payment_jrn_def_id_fk foreign key 
(jrn_def_id) references jrn_def(jrn_def_id) on delete cascade on update cascade;
+
+comment on column mod_payment.jrn_def_id is 'Ledger using this payment method';
+alter table tva_rate add tva_both_side integer ;
+alter table tva_rate alter tva_both_side set default 0;
+update tva_rate set tva_both_side=0;
+
+drop FUNCTION comptaproc.tva_modify(integer, text, numeric, text, text);
+alter table quant_purchase add qp_vat_sided numeric (20,4);
+alter table quant_sold add qs_vat_sided numeric (20,4);
+
+alter table quant_purchase alter qp_vat_sided set default 0.0;
+alter table quant_sold alter qs_vat_sided set default 0.0;
+
+update quant_purchase set qp_vat_sided=0.0;
+update quant_sold set qs_vat_sided=0.0;
+
+comment on column quant_purchase.qp_vat_sided is 'amount of the VAT which 
avoid VAT, case of the VAT which add the same amount at the deb and cred';
+comment on column quant_purchase.qp_vat_sided is 'amount of the VAT which 
avoid VAT, case of the VAT which add the same amount at the deb and cred';
+
+CREATE OR REPLACE FUNCTION comptaproc.tva_modify(integer, text, numeric, text, 
text,integer)
+ RETURNS integer
+AS $function$
+declare
+       p_tva_id alias for $1;
+       p_tva_label alias for $2;
+       p_tva_rate alias for $3;
+       p_tva_comment alias for $4;
+       p_tva_poste alias for $5;
+       p_tva_both_side alias for $6;
+       debit text;
+       credit text;
+       nCount integer;
+begin
+if length(trim(p_tva_label)) = 0 then
+       return 3;
+end if;
+
+if length(trim(p_tva_poste)) != 0 then
+       if position (',' in p_tva_poste) = 0 then return 4; end if;
+       debit  = split_part(p_tva_poste,',',1);
+       credit  = split_part(p_tva_poste,',',2);
+       select count(*) into nCount from tmp_pcmn where 
pcm_val=debit::account_type;
+       if nCount = 0 then return 4; end if;
+       select count(*) into nCount from tmp_pcmn where 
pcm_val=credit::account_type;
+       if nCount = 0 then return 4; end if;
+
+end if;
+update tva_rate set 
tva_label=p_tva_label,tva_rate=p_tva_rate,tva_comment=p_tva_comment,tva_poste=p_tva_poste,tva_both_side=p_tva_both_side
+       where tva_id=p_tva_id;
+return 0;
+end;
+$function$
+LANGUAGE plpgsql;
+
+drop FUNCTION comptaproc.tva_insert(text, numeric, text, text);
+
+CREATE OR REPLACE FUNCTION comptaproc.tva_insert(text, numeric, text, 
text,integer)
+ RETURNS integer
+AS $function$
+declare
+       l_tva_id integer;
+       p_tva_label alias for $1;
+       p_tva_rate alias for $2;
+       p_tva_comment alias for $3;
+       p_tva_poste alias for $4;
+       p_tva_both_side alias for $5;
+       debit text;
+       credit text;
+       nCount integer;
+begin
+if length(trim(p_tva_label)) = 0 then
+       return 3;
+end if;
+
+if length(trim(p_tva_poste)) != 0 then
+       if position (',' in p_tva_poste) = 0 then return 4; end if;
+       debit  = split_part(p_tva_poste,',',1);
+       credit  = split_part(p_tva_poste,',',2);
+       select count(*) into nCount from tmp_pcmn where 
pcm_val=debit::account_type;
+       if nCount = 0 then return 4; end if;
+       select count(*) into nCount from tmp_pcmn where 
pcm_val=credit::account_type;
+       if nCount = 0 then return 4; end if;
+
+end if;
+select into l_tva_id nextval('s_tva') ;
+insert into 
tva_rate(tva_id,tva_label,tva_rate,tva_comment,tva_poste,tva_both_side)
+       values 
(l_tva_id,p_tva_label,p_tva_rate,p_tva_comment,p_tva_poste,p_tva_both_side);
+return 0;
+end;
+$function$
+LANGUAGE plpgsql;
+
+DROP FUNCTION comptaproc.insert_quant_purchase(text,numeric, character 
varying,numeric,numeric,numeric,integer,numeric,numeric,numeric,numeric,character
 varying);
+
+CREATE OR REPLACE FUNCTION comptaproc.insert_quant_purchase(p_internal text, 
p_j_id numeric, p_fiche character varying, p_quant numeric, p_price numeric, 
p_vat numeric, p_vat_code integer, p_nd_amount numeric, p_nd_tva numeric, 
p_nd_tva_recup numeric, p_dep_priv numeric, p_client character 
varying,p_tva_sided numeric)
+ RETURNS void
+AS $function$
+declare
+        fid_client integer;
+        fid_good   integer;
+begin
+        select f_id into fid_client from
+                fiche_detail where ad_id=23 and ad_value=upper(trim(p_client));
+        select f_id into fid_good from
+                 fiche_detail where ad_id=23 and ad_value=upper(trim(p_fiche));
+        insert into quant_purchase
+                (qp_internal,
+                j_id,
+                qp_fiche,
+                qp_quantite,
+                qp_price,
+                qp_vat,
+                qp_vat_code,
+                qp_nd_amount,
+                qp_nd_tva,
+                qp_nd_tva_recup,
+                qp_supplier,
+                qp_dep_priv,
+                qp_vat_sided)
+        values
+                (p_internal,
+                p_j_id,
+                fid_good,
+                p_quant,
+                p_price,
+                p_vat,
+                p_vat_code,
+                p_nd_amount,
+                p_nd_tva,
+                p_nd_tva_recup,
+                fid_client,
+                p_dep_priv,
+                p_tva_sided);
+        return;
+end;
+ $function$ 
+ LANGUAGE plpgsql;
+
+DROP FUNCTION comptaproc.insert_quant_sold(text, numeric, character varying, 
numeric, numeric, numeric, integer, character varying);
+CREATE OR REPLACE FUNCTION comptaproc.insert_quant_sold(p_internal text, p_jid 
numeric, p_fiche character varying, p_quant numeric, p_price numeric, p_vat 
numeric, p_vat_code integer, p_client character varying,p_tva_sided numeric)
+ RETURNS void
+AS $function$
+declare
+        fid_client integer;
+        fid_good   integer;
+begin
+
+        select f_id into fid_client from
+                fiche_detail where ad_id=23 and ad_value=upper(trim(p_client));
+        select f_id into fid_good from
+                fiche_detail where ad_id=23 and ad_value=upper(trim(p_fiche));
+        insert into quant_sold
+                
(qs_internal,j_id,qs_fiche,qs_quantite,qs_price,qs_vat,qs_vat_code,qs_client,qs_valid,qs_vat_sided)
+        values
+                
(p_internal,p_jid,fid_good,p_quant,p_price,p_vat,p_vat_code,fid_client,'Y',p_tva_sided);
+        return;
+end;
+ $function$ 
+ LANGUAGE plpgsql;
+update version set val=98;
+
+commit;
\ No newline at end of file

Modified: phpcompta/trunk/html/js/scripts.js
===================================================================
--- phpcompta/trunk/html/js/scripts.js  2011-11-25 16:20:12 UTC (rev 4476)
+++ phpcompta/trunk/html/js/scripts.js  2011-11-26 01:14:51 UTC (rev 4477)
@@ -1043,7 +1043,7 @@
        var target="search_op";
        removeDiv(target);
        var str_style=fixed_position(77, 99);
-        str_style+=";width:55%";
+        str_style+=";width:80%";
 
     var div={id:target, 
cssclass:'inner_box',style:str_style,html:loading(),drag:1};
 

Modified: phpcompta/trunk/html/style.css
===================================================================
--- phpcompta/trunk/html/style.css      2011-11-25 16:20:12 UTC (rev 4476)
+++ phpcompta/trunk/html/style.css      2011-11-26 01:14:51 UTC (rev 4477)
@@ -2,7 +2,7 @@
 
 BODY {
   background-color:#EDF3FF;
- font-size:10;
+ font-size:12px;
   font-family:verdana,helvetica,sans-serif;
   padding: 0px 10px 0px 10px ;
   margin:0;
@@ -744,7 +744,7 @@
 }
 
 div.pc_calendar{
-               border:1px groove grey;
+               
                float:left;
 
                }
@@ -758,7 +758,8 @@
 
 }
 div.pc_calendar td{
-       width:10em;
+       width:14%;
+       border:#879ed4 solid 1px;
 }
 
 div.pc_calendar td.weekend {

Modified: phpcompta/trunk/include/ac_common.php
===================================================================
--- phpcompta/trunk/include/ac_common.php       2011-11-25 16:20:12 UTC (rev 
4476)
+++ phpcompta/trunk/include/ac_common.php       2011-11-26 01:14:51 UTC (rev 
4477)
@@ -808,7 +808,7 @@
                $default_module = $cn->get_array("select me_code
                        from profile_menu join profile_user using (p_id)
                        where
-                       user_name=$1 and p_order=(select min(p_order) from 
profile_menu
+                       user_name=$1 and p_order=(select min(p_order) from 
profile_menu join profile_user using (p_id)
                        where user_name=$2) limit 1", array($g_user->login, 
$g_user->login));
                /*
                 * if nothing found, there is no profile for this user => exit

Modified: phpcompta/trunk/include/ajax_get_profile.php
===================================================================
--- phpcompta/trunk/include/ajax_get_profile.php        2011-11-25 16:20:12 UTC 
(rev 4476)
+++ phpcompta/trunk/include/ajax_get_profile.php        2011-11-26 01:14:51 UTC 
(rev 4477)
@@ -51,31 +51,37 @@
 require_once("template/profile.php");
 echo HtmlInput::submit("save_name","Modifier");
 echo '</form>';
+if ($profile->p_id > 0)
+{
+       echo '<form method="POST" onsubmit="return confirm (\'vous 
confirmez\')">';
 
-echo '<form method="POST" onsubmit="return confirm (\'vous confirmez\')">';
-
-echo '
+       echo '
 Vous pouvez aussi copier ce profil et puis le corriger';
 
-echo HtmlInput::hidden('p_id',$profile->p_id);
-echo HtmlInput::submit("clone","Copier");
-echo '</form>';
+       echo HtmlInput::hidden('p_id', $profile->p_id);
+       echo HtmlInput::submit("clone", "Copier");
+       echo '</form>';
 
-echo '<form method="POST" onsubmit="return confirm (\'vous confirmez\')">';
+       echo '<form method="POST" onsubmit="return confirm (\'vous 
confirmez\')">';
 
-echo '
+       echo '
 Effacer ce profil';
 
-echo HtmlInput::hidden('p_id',$profile->p_id);
-echo HtmlInput::submit("delete_profil","Effacer ce profil");
-echo '</form>';
-//Menu / Module /plugin in this profile
-echo "<h1> Détail du profile</h1>";
-echo "<h2>Menu</h2>";
-echo $add_one;
-$profile_menu=new Profile_Menu($cn);
-$profile_menu->listing_profile($p_id);
-echo "<h2>Impression</h2>";
-$profile_menu->printing($p_id);
+       echo HtmlInput::hidden('p_id', $profile->p_id);
+       echo HtmlInput::submit("delete_profil", "Effacer ce profil");
+       echo '</form>';
+
+       //Menu / Module /plugin in this profile
+       echo "<h1> Détail du profile</h1>";
+       echo "<h2>Menu</h2>";
+       echo $add_one;
+       $profile_menu = new Profile_Menu($cn);
+       $profile_menu->listing_profile($p_id);
+       echo "<h2>Impression</h2>";
+       $profile_menu->printing($p_id);
+
+       echo $add_one;
+}
 ?>
-<?=$add_one?>
+
+

Modified: phpcompta/trunk/include/anc_acc_table.inc.php
===================================================================
--- phpcompta/trunk/include/anc_acc_table.inc.php       2011-11-25 16:20:12 UTC 
(rev 4476)
+++ phpcompta/trunk/include/anc_acc_table.inc.php       2011-11-26 01:14:51 UTC 
(rev 4477)
@@ -10,7 +10,7 @@
 echo '</form>';
 if (isset($_GET['result']))
 {
-    echo $tab->show_button();
+    echo $tab->show_button("");
     $tab->display_html();
 }
 ?>

Modified: phpcompta/trunk/include/class_acc_ledger.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger.php        2011-11-25 16:20:12 UTC 
(rev 4476)
+++ phpcompta/trunk/include/class_acc_ledger.php        2011-11-26 01:14:51 UTC 
(rev 4477)
@@ -781,6 +781,7 @@
                $table->add('PJ',$url,' order by  
substring(jr_pj_number,\'\\\d+$\')::numeric asc ',
                                ' order by  
substring(jr_pj_number,\'\\\d+$\')::numeric desc ' ,
                                "pja","pjd");
+               $table->add('Tiers',$url," order by  name asc"," order by  name 
desc",'na','nd');
                $table->add('Montant',$url," order by jr_montant asc"," order 
by jr_montant desc",
                                "ma","md");
                $table->add("Description",$url,"order by jr_comment asc",
@@ -819,10 +820,10 @@
         $r.='<th>'.$table->get_header(0).'</th>';
         $r.='<th>'.$table->get_header(1).'</td>';
         $r.='<th>'.$table->get_header(2).'</th>';
-       $r.=th('tiers');
+        $r.='<th>'.$table->get_header(3).'</th>';
+        $r.='<th>'.$table->get_header(5).'</th>';
+       $r.=th('Notes',' style="width:15%"');
         $r.='<th>'.$table->get_header(4).'</th>';
-       $r.=th('Notes',' style="width:15%"');
-        $r.='<th>'.$table->get_header(3).'</th>';
         // if $p_paid is not equal to 0 then we have a paid column
         if ( $p_paid != 0 )
         {
@@ -1845,7 +1846,7 @@
         if ( $this->id==0) return;
         $num =$this->db->get_next_seq('s_internal');
         $atype=$this->get_propertie();
-        $type=$atype['jrn_def_code'];
+        $type=substr($atype['jrn_def_code'],0,1);
         $internal_code=sprintf("%s%06X",$type,$num);
         $this->jr_internal=$internal_code;
         return $internal_code;

Modified: phpcompta/trunk/include/class_acc_ledger_purchase.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger_purchase.php       2011-11-25 
16:20:12 UTC (rev 4476)
+++ phpcompta/trunk/include/class_acc_ledger_purchase.php       2011-11-26 
01:14:51 UTC (rev 4477)
@@ -341,10 +341,10 @@
             $tot_perso=0;
             $tot_tva_nd=0;
             $tot_tva_ndded=0;
-            $n_both=0;
             /* Save all the items without vat and no deductible vat and 
expense*/
             for ($i=0;$i< $nb_item;$i++)
             {
+                               $n_both=0;
                 if ( strlen(trim(${'e_march'.$i})) == 0 ) continue;
                 if ( ${'e_march'.$i.'_price'} == 0 ) continue;
                 if ( ${'e_quant'.$i} == 0 ) continue;
@@ -487,7 +487,7 @@
                 if ( $g_parameter->MY_TVA_USE=='Y')
                 {
                     if ( $oTva->get_parameter("both_side")==1) 
$n_both=$acc_amount->amount_vat;
-                        
+
                     $r=$this->db->exec_sql("select insert_quant_purchase ".
                                            "(null".
                                            ",".$j_id.           /* 2 */

Modified: phpcompta/trunk/include/class_acc_ledger_sold.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger_sold.php   2011-11-25 16:20:12 UTC 
(rev 4476)
+++ phpcompta/trunk/include/class_acc_ledger_sold.php   2011-11-26 01:14:51 UTC 
(rev 4477)
@@ -272,11 +272,11 @@
             $tot_amount=0;
             $tot_tva=0;
             $tot_debit=0;
-            $n_both=0;
             $this->db->start();
             /* Save all the items without vat */
             for ($i=0;$i< $nb_item;$i++)
             {
+                               $n_both=0;
                 if ( strlen(trim(${'e_march'.$i})) == 0 ) continue;
                 if ( ${'e_march'.$i.'_price'} == 0 ) continue;
                 if ( ${'e_quant'.$i} == 0 ) continue;

Modified: phpcompta/trunk/include/class_anc_account.php
===================================================================
--- phpcompta/trunk/include/class_anc_account.php       2011-11-25 16:20:12 UTC 
(rev 4476)
+++ phpcompta/trunk/include/class_anc_account.php       2011-11-26 01:14:51 UTC 
(rev 4477)
@@ -158,15 +158,15 @@
     private function format_data()
     {
 
-        $this->name=sql_string($this->name);
-        $this->pa_id=sql_string($this->pa_id);
-        $this->amount=sql_string($this->amount);
+        $this->name=$this->name;
+        $this->pa_id=$this->pa_id;
+        $this->amount=$this->amount;
         if (strlen($this->amount) == 0 )
             $this->amount=0.0;
         if ( isNumber($this->amount) ==0 )
             $this->amount=0;
 
-        $this->description=sql_string($this->description);
+        $this->description=$this->description;
     }
     function delete()
     {

Modified: phpcompta/trunk/include/class_anc_group.php
===================================================================
--- phpcompta/trunk/include/class_anc_group.php 2011-11-25 16:20:12 UTC (rev 
4476)
+++ phpcompta/trunk/include/class_anc_group.php 2011-11-26 01:14:51 UTC (rev 
4477)
@@ -68,7 +68,7 @@
         return "";
     }
     /*!
-     * \brief remove from the database 
+     * \brief remove from the database
      */
 
     function remove()
@@ -163,15 +163,15 @@
       $sql="with m as (select po_id,
        po_name,
        ga_id,
-       case when  oa_debit = 't' then oa_amount 
+       case when  oa_debit = 't' then oa_amount
        else 0
        end  as amount_deb,
-       case when oa_debit = 'f' then oa_amount 
+       case when oa_debit = 'f' then oa_amount
        else 0
        end as amount_cred,
        oa_date
-       from operation_analytique 
-join poste_analytique using (po_id) 
+       from operation_analytique
+join poste_analytique using (po_id)
 where pa_id=$1 $filter_date )
 select sum(amount_cred) as sum_cred, sum(amount_deb)as 
sum_deb,po_name,ga_id,ga_description
 from m left join groupe_analytique using (ga_id)
@@ -194,14 +194,14 @@
       if ( empty ($array) ) return "";
       require_once('template/anc_balance_group.php');
 
-      
+
     }
   /**
    address@hidden display the button export CSV
    address@hidden $p_hidden is a string containing hidden items
    address@hidden html string
-   */  
-  function show_button($p_hidden)
+   */
+  function show_button($p_hidden="")
   {
     $r="";
     $r.= '<form method="GET" action="export.php"  style="display:inline">';

Modified: phpcompta/trunk/include/class_anc_group_operation.php
===================================================================
--- phpcompta/trunk/include/class_anc_group_operation.php       2011-11-25 
16:20:12 UTC (rev 4476)
+++ phpcompta/trunk/include/class_anc_group_operation.php       2011-11-26 
01:14:51 UTC (rev 4477)
@@ -106,16 +106,16 @@
 
         $ret="";
 
-        $ret.='<table style="border: 2px outset blue; width: 100%;"    >';
+        $ret.='<table style="result"   >';
 
         $ret.="<TR>".$wDate->input()."</tr>";
-        $ret.='<tr><td style="border:1px groove blue">Description</td>'.
+        $ret.='<tr><td>Description</td>'.
               '<td colspan="3">'.
               $wDescription->input()."</td></tr>";
         $Plan=new Anc_Plan($this->db);
         $aPlan=$Plan->get_list();
         
$max=(count($this->a_operation)<$this->nMaxRow)?$this->nMaxRow:count($this->a_operation);
-        $ret.='</table><table  id="ago" style="border: 2px outset blue; width: 
100%;">';
+        $ret.='</table><table  id="ago" style="width: 100%;">';
         /* show 10 rows */
         $ret.="<tr>";
         foreach ($aPlan as $d)
@@ -123,7 +123,7 @@
             $idx=$d['id'];
             /* array of possible value for the select */
             $aPoste[$idx]=$this->db->make_array("select po_id as value,".
-                                                " 
html_quote(po_name||':'||coalesce(po_description,'-')) as label ".
+                                                " 
po_name||':'||coalesce(po_description,'-') as label ".
                                                 " from poste_analytique ".
                                                 " where pa_id = ".$idx.
                                                 " order by po_name ");

Modified: phpcompta/trunk/include/class_calendar.php
===================================================================
--- phpcompta/trunk/include/class_calendar.php  2011-11-25 16:20:12 UTC (rev 
4476)
+++ phpcompta/trunk/include/class_calendar.php  2011-11-26 01:14:51 UTC (rev 
4477)
@@ -45,7 +45,8 @@
     function fill_from_action(&$p_array)
     {
         $cn=new Database(dossier::id());
-        $sql="select ag_id,substr(ag_title,0,20) as 
ag_title_fmt,to_char(ag_timestamp,'DD')::integer as ag_timestamp_day ".
+        $sql="select ag_id,substr(ag_title,0,20) as ag_title_fmt,ag_ref,
+                               to_char(ag_timestamp,'DD')::integer as 
ag_timestamp_day ".
              " from action_gestion ".
              " where ".
              " to_char(ag_timestamp,'MM')::integer=$1 ".
@@ -56,8 +57,8 @@
         {
             $ind=$array[$i]['ag_timestamp_day'];
             $p_array[$ind]=(isset($p_array[$ind]))?$p_array[$ind]:'';
-            $p_array[$ind].='<A 
HREF="commercial.php?'.dossier::get().'&p_action=suivi_courrier&sa=detail&ag_id='.$array[$i]['ag_id'].'">';
-            $p_array[$ind].="<span 
class=\"day\">".h($array[$i]['ag_title_fmt']).'</span>';
+            $p_array[$ind].='<A class="line" 
HREF="do.php?ac=FOLLOW&'.dossier::get().'&sa=detail&ag_id='.$array[$i]['ag_id'].'">';
+            $p_array[$ind].="<span 
class=\"calfollow\">".h($array[$i]['ag_ref']." 
".$array[$i]['ag_title_fmt']).'</span>';
             $p_array[$ind].="</A>";
 
         }

Modified: phpcompta/trunk/include/class_database.php
===================================================================
--- phpcompta/trunk/include/class_database.php  2011-11-25 16:20:12 UTC (rev 
4476)
+++ phpcompta/trunk/include/class_database.php  2011-11-26 01:14:51 UTC (rev 
4477)
@@ -359,6 +359,7 @@
     function apply_patch($p_name,$from_setup=1)
     {
         $MaxVersion=DBVERSION-1;
+               $succeed="<span 
style=\"font-size:18px;color:green\">&#x2713;</span>";
         echo '<ul style="list-type-style:square">';
         $add=($from_setup==0)?'admin/':'';
         for ( $i = 4;$i <= $MaxVersion;$i++)
@@ -371,7 +372,7 @@
 
                 $this->execute_script($add.'sql/patch/upgrade'.$i.'.sql');
                 echo $succeed;
-                
+
                 if ( ! DEBUG ) ob_start();
                 // specific for version 4
                 if ( $i == 4 )
@@ -451,6 +452,7 @@
                     $country=$this->get_value ("select pr_value from parameter 
where pr_id='MY_COUNTRY'");
                     
$this->execute_script($add."sql/patch/upgrade61.".$country.".sql");
                 }
+               
                 if ( ! DEBUG ) ob_end_clean();
             }
         }
@@ -852,7 +854,7 @@
      * with the handle of a successull query, echo each row into CSV and
      * send it directly
      * @param type $ret handle to a query
-     * @param type $aheader  double array, each item of the array contains 
+     * @param type $aheader  double array, each item of the array contains
      * a key type (num) and a key title
      */
     function query_to_csv($ret,$aheader)
@@ -864,7 +866,7 @@
             $seq=";";
         }
         printf("\n\r");
-        
+
         $seq="";
         // fetch all the rows
         for ($i=0;$i<count(Database::num_row($ret));$i++)

Modified: phpcompta/trunk/include/class_follow_up.php
===================================================================
--- phpcompta/trunk/include/class_follow_up.php 2011-11-25 16:20:12 UTC (rev 
4476)
+++ phpcompta/trunk/include/class_follow_up.php 2011-11-26 01:14:51 UTC (rev 
4477)
@@ -863,7 +863,8 @@
                             " ag_priority = $10 ,".
                             " ag_dest = $11 , ".
                             " ag_cal = $12 ,".
-                            " ag_contact = $13 ".
+                            " ag_contact = $13, ".
+                                                       " ag_ref = $14 ".
                             " where ag_id = $8",
                             array ( $this->ag_comment, /* 1 */
                                     $this->ag_timestamp, /* 2 */
@@ -877,7 +878,8 @@
                                     $this->ag_priority, /* 10 */
                                     $this->ag_dest,     /* 11 */
                                     $ag_cal,         /* 12 */
-                                    $contact->id   /* 13 */
+                                    $contact->id,   /* 13 */
+                                                                       
$this->ag_ref
                                   ));
         // Upload  documents
         $doc=new Document($this->db);

Modified: phpcompta/trunk/include/constant.php
===================================================================
--- phpcompta/trunk/include/constant.php        2011-11-25 16:20:12 UTC (rev 
4476)
+++ phpcompta/trunk/include/constant.php        2011-11-26 01:14:51 UTC (rev 
4477)
@@ -40,11 +40,11 @@
  * define ("DEBUG",false);
  *
  */
-$version_phpcompta=4208;
+$version_phpcompta=4444;
 define ("DEBUG",true);
 
-define ("DBVERSION",97);
-define ("DBVERSIONREPO",13);
+define ("DBVERSION",98);
+define ("DBVERSIONREPO",14);
 define ('NOTFOUND','--not found--');
 
 define ("MAX_COMPTE",4);

Modified: phpcompta/trunk/include/dossier.inc.php
===================================================================
--- phpcompta/trunk/include/dossier.inc.php     2011-11-25 16:20:12 UTC (rev 
4476)
+++ phpcompta/trunk/include/dossier.inc.php     2011-11-26 01:14:51 UTC (rev 
4477)
@@ -345,8 +345,8 @@
     $cn->exec_sql($sql,array($_REQUEST['d']));
     $sql="delete from ac_dossier where dos_id=$1";
     $cn->exec_sql($sql,array($_REQUEST['d']));
-    print '<h2 class="info">';
-    print "Voilà le dossier ".h($name)." est effacé</h2>";
+    print '<h2 class="error">';
+    print "Le dossier ".h($name)." est effacé</h2>";
     echo HtmlInput::button_anchor('Retour','?action=dossier_mgt');
 }
 ?>

Modified: phpcompta/trunk/include/menu.inc.php
===================================================================
--- phpcompta/trunk/include/menu.inc.php        2011-11-25 16:20:12 UTC (rev 
4476)
+++ phpcompta/trunk/include/menu.inc.php        2011-11-26 01:14:51 UTC (rev 
4477)
@@ -83,6 +83,7 @@
 $table->add('Code',$url,"order by me_code asc","order by me_code 
desc","codea","coded");
 $table->add('Menu',$url,"order by me_menu asc","order by me_menu 
desc","menua","menud");
 $table->add('Description',$url,"order by me_description asc","order by 
me_description desc","desa","desd");
+$table->add('Fichier',$url,"order by me_file asc","order by me_file 
desc","fa","fd");
 $table->add('URL',$url,"order by me_url asc","order by me_url 
desc","urla","urld");
 $table->add('Paramètre',$url,"order by me_parametere asc","order by 
me_parameter desc","paa","pad");
 $table->add('Javascript',$url,"order by me_javascript asc","order by 
me_javascript desc","jsa","jsd");
@@ -139,6 +140,7 @@
 echo '<th>'.$table->get_header(4).'</th>';
 echo '<th>'.$table->get_header(5).'</th>';
 echo '<th>'.$table->get_header(6).'</th>';
+echo '<th>'.$table->get_header(7).'</th>';
 echo '</tr>';
 
 for ($i=0;$i<Database::num_row($ret);$i++)
@@ -157,6 +159,7 @@
        echo td($js);
        echo td($row->me_menu);
        echo td($row->me_description);
+       echo td($row->me_file);
        echo td($row->me_url);
        echo td($row->me_parameter);
        echo td($row->me_javascript);

Modified: phpcompta/trunk/include/modele.inc.php
===================================================================
--- phpcompta/trunk/include/modele.inc.php      2011-11-25 16:20:12 UTC (rev 
4476)
+++ phpcompta/trunk/include/modele.inc.php      2011-11-26 01:14:51 UTC (rev 
4477)
@@ -391,8 +391,8 @@
                ob_flush();
                $sql = "delete from modeledef where mod_id=$1";
                $cn->exec_sql($sql, array($_REQUEST['m']));
-               print '<h2 class="info">';
-               print "Voilà le modèle $name est effacé</H2>";
+               print '<h2 class="error">';
+               print "Le modèle $name est effacé</H2>";
                echo HtmlInput::button_anchor('Retour', '?action=modele_mgt');
        }
        echo '</div>';

Modified: phpcompta/trunk/include/template/calendar.php
===================================================================
--- phpcompta/trunk/include/template/calendar.php       2011-11-25 16:20:12 UTC 
(rev 4476)
+++ phpcompta/trunk/include/template/calendar.php       2011-11-26 01:14:51 UTC 
(rev 4477)
@@ -1,4 +1,4 @@
-<div class="pc_calendar" id="user_cal">
+<div class="pc_calendar" id="user_cal" style="width:100%">
 <?=$month_year?>
 <table width="100%">
 <tr>
@@ -23,7 +23,7 @@
 $timestamp_date=mktime(0,0,0,$this->month,$ind,$this->year);
 $date_calendar=date('w',$timestamp_date);
 $st="";
-if ( $today_month==$this->month && $today_day==$ind) 
+if ( $today_month==$this->month && $today_day==$ind)
   $st='  style="border:1px solid red" ';
 if ( $date_calendar == $week ) {
        echo '<td class="'.$class.'"'.$st.'>'.'<span 
class="day">'.$ind."</span>";

Modified: phpcompta/trunk/include/template/dashboard.php
===================================================================
--- phpcompta/trunk/include/template/dashboard.php      2011-11-25 16:20:12 UTC 
(rev 4476)
+++ phpcompta/trunk/include/template/dashboard.php      2011-11-26 01:14:51 UTC 
(rev 4477)
@@ -1,10 +1,10 @@
-<div>
-       <div style="float:left;width:50%">
-<fieldset>
+<div style="float:left;width:50%">
+<fieldset style="width:100%">
 <legend><?=_('Calendrier')?>
 </legend>
 <?php echo $cal->display(); ?>
 </fieldset>
+</div>
 
 <?php
 /*
@@ -23,31 +23,8 @@
 $todo=new Todo_List($cn);
 $array=$todo->load_all();
 ?>
-<div id="add_todo_list" class="add_todo_list">
-       <script charset="utf8" type="text/javascript" language="javascript">
-               new Draggable($('add_todo_list'),{});
-       </script>
-<form method="post">
-<?php
-$wDate=new IDate('p_date_todo');
-$wDate->id='p_date_todo';
-$wTitle=new IText('p_title');
-$wDesc=new ITextArea('p_desc');
-$wDesc->heigh=5;
-$wDesc->width=40;
-echo h2info("Note");
-echo _("Date")." ".$wDate->input().'<br>';
-echo _("Titre")." ".$wTitle->input().'<br>';
-echo _("Description")."<br>".$wDesc->input().'<br>';
-echo dossier::hidden();
-echo HtmlInput::hidden('tl_id',0);
-echo 
HtmlInput::submit('save_todo_list',_('Sauve'),'onClick="$(\'add_todo_list\').hide();return
 true;"');
-echo 
HtmlInput::button('hide',_('Annuler'),'onClick="$(\'add_todo_list\').hide();return
 true;"');
-?>
-</form>
-</div>
-</div>
-<div style="float:left;width:50%">'
+
+<div style="float:right;width:45%">
 <fieldset> <legend><?=_('Pense-Bête')?></legend>
 
 <?php
@@ -66,7 +43,7 @@
       $row['tl_date'].
       '</td>'.
       '<td>'.
-      '<a href="javascript:void(0)" 
onclick="todo_list_show(\''.$row['tl_id'].'\')">'.
+      '<a class="line" href="javascript:void(0)" 
onclick="todo_list_show(\''.$row['tl_id'].'\')">'.
       htmlspecialchars($row['tl_title']).
       '</a>'.
        '</td>'.
@@ -80,7 +57,8 @@
 ?>
 </fieldset>
 </div>
-       <div style="clear:both"></div>
+<div style="clear:both">
+       <div style="float:left;width:50%">
 <?php
 /*
  * Mini Report
@@ -95,7 +73,7 @@
 }
 
 if ( $report != 0 ) {
-  echo '<fieldset 
style="width:50%;background-color:white"><legend>'.$rapport->get_name().'</legend>';
+  echo '<fieldset ><legend>'.$rapport->get_name().'</legend>';
   $exercice=$g_user->get_exercice();
   if ( $exercice == 0 ) {
     alert(_('Aucune periode par defaut'));
@@ -127,3 +105,28 @@
 
 ?>
 </div>
+</div>
+
+<div id="add_todo_list" class="add_todo_list">
+       <script charset="utf8" type="text/javascript" language="javascript">
+               new Draggable($('add_todo_list'),{});
+       </script>
+<form method="post">
+<?php
+$wDate=new IDate('p_date_todo');
+$wDate->id='p_date_todo';
+$wTitle=new IText('p_title');
+$wDesc=new ITextArea('p_desc');
+$wDesc->heigh=5;
+$wDesc->width=40;
+echo h2info("Note");
+echo _("Date")." ".$wDate->input().'<br>';
+echo _("Titre")." ".$wTitle->input().'<br>';
+echo _("Description")."<br>".$wDesc->input().'<br>';
+echo dossier::hidden();
+echo HtmlInput::hidden('tl_id',0);
+echo 
HtmlInput::submit('save_todo_list',_('Sauve'),'onClick="$(\'add_todo_list\').hide();return
 true;"');
+echo 
HtmlInput::button('hide',_('Annuler'),'onClick="$(\'add_todo_list\').hide();return
 true;"');
+?>
+</form>
+</div>
\ No newline at end of file

Modified: phpcompta/trunk/include/tva.inc.php
===================================================================
--- phpcompta/trunk/include/tva.inc.php 2011-11-25 16:20:12 UTC (rev 4476)
+++ phpcompta/trunk/include/tva.inc.php 2011-11-26 01:14:51 UTC (rev 4477)
@@ -50,8 +50,8 @@
     {
        $err = 2;
     }
-    var_dump($_POST);
-    if ($err == 0)
+
+       if ($err == 0)
     {
        if (isset($_POST['confirm_add']))
        {
@@ -146,7 +146,7 @@
     $str_msg=( $row['tva_both_side']==1)?'Employé au crédit et débit':'normal' 
;
     echo $str_msg;
     echo "</TD>";
-    
+
     echo "<TD>";
     echo HtmlInput::submit("rm", "Efface");
     echo HtmlInput::submit("mod", "Modifie");


Property changes on: phpcompta/trunk/sql
___________________________________________________________________
Name: svn:ignore
   - .upgrade.sql.swp
.object-6.0.sql.swp
.backup-new-object.sh.swp
.mode_paiement.sql.swp
.anc-grandlivre.sql.swp

   + .upgrade.sql.swp
.object-6.0.sql.swp
.backup-new-object.sh.swp
.mode_paiement.sql.swp
.anc-grandlivre.sql.swp
.tmp_pcmn_ins.sql.swp
.anc-modularity-imp.sql.swp


Modified: phpcompta/trunk/sql/backup-new-object.sh
===================================================================
--- phpcompta/trunk/sql/backup-new-object.sh    2011-11-25 16:20:12 UTC (rev 
4476)
+++ phpcompta/trunk/sql/backup-new-object.sh    2011-11-26 01:14:51 UTC (rev 
4477)
@@ -1 +1 @@
-pg_dump testdossier82 --no-owner --inserts -t profile -t menu_ref -t 
profile_menu -t profile_user -t profile_menu_type -t v_all_menu > object-6.0.sql
+pg_dump testdossier100 --no-owner --inserts -t profile -t menu_ref -t 
profile_menu -t profile_user -t profile_menu_type -t v_all_menu > object-6.0.sql

Modified: phpcompta/trunk/sql/object-6.0.sql
===================================================================
--- phpcompta/trunk/sql/object-6.0.sql  2011-11-25 16:20:12 UTC (rev 4476)
+++ phpcompta/trunk/sql/object-6.0.sql  2011-11-26 01:14:51 UTC (rev 4477)
@@ -158,6 +158,7 @@
 --
 
 COMMENT ON COLUMN profile_menu.p_order IS 'order of displaying menu';
+COMMENT ON COLUMN profile_menu.pm_default IS 'default menu';
 
 
 --
@@ -192,7 +193,7 @@
 -- Name: profile_menu_pm_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
 --
 
-SELECT pg_catalog.setval('profile_menu_pm_id_seq', 662, true);
+SELECT pg_catalog.setval('profile_menu_pm_id_seq', 778, true);
 
 
 --
@@ -228,7 +229,7 @@
 -- Name: profile_p_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
 --
 
-SELECT pg_catalog.setval('profile_p_id_seq', 10, true);
+SELECT pg_catalog.setval('profile_p_id_seq', 11, true);
 
 
 --
@@ -286,7 +287,7 @@
 -- Name: profile_user_pu_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
 --
 
-SELECT pg_catalog.setval('profile_user_pu_id_seq', 5, true);
+SELECT pg_catalog.setval('profile_user_pu_id_seq', 6, true);
 
 
 --
@@ -322,12 +323,6 @@
 -- Data for Name: menu_ref; Type: TABLE DATA; Schema: public; Owner: -
 --
 
-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 ('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 ('IMPORTBANK', 'Importation banque', 
'importbank/index.php', NULL, 'Import. fichier CVS de la banque', 
'plugin_code=IMPORTBANK', NULL, 'PL');
 INSERT INTO menu_ref VALUES ('ACH', 'Achat', 'compta_ach.inc.php', NULL, 
'Nouvel achat ou dépense', NULL, NULL, 'ME');
 INSERT INTO menu_ref VALUES ('ANCHOP', 'Historique', 'anc_history.inc.php', 
NULL, 'Historique des imputations analytiques', NULL, NULL, 'ME');
 INSERT INTO menu_ref VALUES ('ANCGL', 'Grand''Livre', 
'anc_great_ledger.inc.php', NULL, 'Grand livre d''plan analytique', NULL, NULL, 
'ME');
@@ -378,7 +373,6 @@
 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 ('SUPPL', 'Fournisseur', 'supplier.inc.php', NULL, 
'Suivi fournisseur', NULL, NULL, 'ME');
-INSERT INTO menu_ref VALUES ('MODOP', 'Modification d''opérations', 
'modop/index.php', NULL, 'Modification opérations', 'plugin_code=MODOP', NULL, 
'PL');
 INSERT INTO menu_ref VALUES ('LET', 'Lettrage', NULL, NULL, 'Lettrage', NULL, 
NULL, 'ME');
 INSERT INTO menu_ref VALUES ('ANCODS', 'Opérations diverses', 
'anc_od.inc.php', NULL, 'OD analytique', NULL, NULL, 'ME');
 INSERT INTO menu_ref VALUES ('VERIFBIL', 'Vérification ', 
'verif_bilan.inc.php', NULL, 'Vérification de la comptabilité', NULL, NULL, 
'ME');
@@ -443,122 +437,33 @@
 --
 
 INSERT INTO profile VALUES ('Administrateur', 1, 'Profil par défaut pour les 
adminstrateurs', true, true);
-INSERT INTO profile VALUES ('Utilisateur', 6, 'Profil par défaut pour les 
Utilisateurs', true, true);
+INSERT INTO profile VALUES ('Utilisateur', 2, 'Profil par défaut pour les 
utilisateurs', true, true);
 
 
 --
 -- Data for Name: profile_menu; Type: TABLE DATA; Schema: public; Owner: -
 --
 
-INSERT INTO profile_menu VALUES (178, 'CFGPAY', 'DIVPARM', 6, 4, 'E', 0);
 INSERT INTO profile_menu VALUES (59, 'CFGPAY', 'DIVPARM', 1, 4, 'E', 0);
-INSERT INTO profile_menu VALUES (194, 'LET', 'COMPTA', 6, 8, 'E', 0);
-INSERT INTO profile_menu VALUES (237, 'EXT', NULL, 6, 55, 'M', 0);
-INSERT INTO profile_menu VALUES (240, 'FIMP', 'MENUFIN', 6, 2, 'E', 0);
-INSERT INTO profile_menu VALUES (214, 'FREC', 'MENUFIN', 6, 4, 'E', 0);
-INSERT INTO profile_menu VALUES (213, 'FSALDO', 'MENUFIN', 6, 3, 'E', 0);
-INSERT INTO profile_menu VALUES (182, 'CFGATCARD', 'DIVPARM', 6, 9, 'E', 0);
 INSERT INTO profile_menu VALUES (68, 'CFGATCARD', 'DIVPARM', 1, 9, 'E', 0);
-INSERT INTO profile_menu VALUES (180, 'CFGACC', 'DIVPARM', 6, 6, 'E', 0);
 INSERT INTO profile_menu VALUES (61, 'CFGACC', 'DIVPARM', 1, 6, 'E', 0);
-INSERT INTO profile_menu VALUES (198, 'LETACC', 'LET', 6, 2, 'E', 0);
-INSERT INTO profile_menu VALUES (197, 'LETCARD', 'LET', 6, 1, 'E', 0);
-INSERT INTO profile_menu VALUES (225, 'TVA', 'EXT', 6, NULL, 'S', 0);
-INSERT INTO profile_menu VALUES (241, 'IMPCARD', 'EXT', 6, NULL, 'S', 0);
-INSERT INTO profile_menu VALUES (242, 'AMORTIS', 'EXT', 6, NULL, 'S', 0);
-INSERT INTO profile_menu VALUES (243, 'TOOLPLAN', 'EXT', 6, NULL, 'S', 0);
-INSERT INTO profile_menu VALUES (254, 'IMPORTBANK', 'EXT', 6, NULL, 'S', 0);
-INSERT INTO profile_menu VALUES (255, 'TOOL', 'EXT', 6, NULL, 'S', 0);
-INSERT INTO profile_menu VALUES (648, 'MODOP', 'EXT', 1, 10, 'E', 0);
 INSERT INTO profile_menu VALUES (54, 'COMPANY', 'PARAM', 1, 1, 'E', 0);
-INSERT INTO profile_menu VALUES (179, 'CFGTVA', 'DIVPARM', 6, 5, 'E', 0);
-INSERT INTO profile_menu VALUES (181, 'CFGCATDOC', 'DIVPARM', 6, 8, 'E', 0);
-INSERT INTO profile_menu VALUES (258, 'CFGMENU', 'MOD', 6, NULL, 'E', 0);
-INSERT INTO profile_menu VALUES (259, 'CFGPRO', 'MOD', 6, NULL, 'E', 0);
 INSERT INTO profile_menu VALUES (651, 'ANCHOP', 'ANCIMP', 1, 10, 'E', 0);
 INSERT INTO profile_menu VALUES (173, 'COMPTA', NULL, 1, 40, 'M', 0);
 INSERT INTO profile_menu VALUES (55, 'PERIODE', 'PARAM', 1, 2, 'E', 0);
 INSERT INTO profile_menu VALUES (56, 'DIVPARM', 'PARAM', 1, 3, 'E', 0);
 INSERT INTO profile_menu VALUES (652, 'ANCGL', 'ANCIMP', 1, 20, 'E', 0);
-INSERT INTO profile_menu VALUES (189, 'PLANANC', 'ANC', 6, 1, 'E', 0);
-INSERT INTO profile_menu VALUES (190, 'CFGCARDCAT', 'DIVPARM', 6, 7, 'E', 0);
-INSERT INTO profile_menu VALUES (191, 'ANCODS', 'ANC', 6, 2, 'E', 0);
-INSERT INTO profile_menu VALUES (192, 'ANCGROUP', 'ANC', 6, 3, 'E', 0);
-INSERT INTO profile_menu VALUES (193, 'ANCIMP', 'ANC', 6, 4, 'E', 0);
 INSERT INTO profile_menu VALUES (60, 'CFGTVA', 'DIVPARM', 1, 5, 'E', 0);
-INSERT INTO profile_menu VALUES (196, 'PREFERENCE', NULL, 6, 15, 'M', 1);
 INSERT INTO profile_menu VALUES (653, 'ANCBS', 'ANCIMP', 1, 30, 'E', 0);
-INSERT INTO profile_menu VALUES (199, 'CUST', 'GESTION', 6, 1, 'E', 0);
-INSERT INTO profile_menu VALUES (200, 'SUPPL', 'GESTION', 6, 2, 'E', 0);
-INSERT INTO profile_menu VALUES (201, 'ADM', 'GESTION', 6, 3, 'E', 0);
-INSERT INTO profile_menu VALUES (202, 'CARD', 'GESTION', 6, 6, 'E', 0);
 INSERT INTO profile_menu VALUES (654, 'ANCBC2', 'ANCIMP', 1, 40, 'E', 0);
-INSERT INTO profile_menu VALUES (203, 'STOCK', 'GESTION', 6, 5, 'E', 0);
-INSERT INTO profile_menu VALUES (204, 'FORECAST', 'GESTION', 6, 7, 'E', 0);
-INSERT INTO profile_menu VALUES (205, 'FOLLOW', 'GESTION', 6, 8, 'E', 0);
 INSERT INTO profile_menu VALUES (655, 'ANCTAB', 'ANCIMP', 1, 50, 'E', 0);
-INSERT INTO profile_menu VALUES (206, 'VERIFBIL', 'ADV', 6, 21, 'E', 0);
-INSERT INTO profile_menu VALUES (207, 'STOCK', 'ADV', 6, 22, 'E', 0);
-INSERT INTO profile_menu VALUES (208, 'PREDOP', 'ADV', 6, 23, 'E', 0);
 INSERT INTO profile_menu VALUES (656, 'ANCBCC', 'ANCIMP', 1, 60, 'E', 0);
-INSERT INTO profile_menu VALUES (209, 'OPEN', 'ADV', 6, 24, 'E', 0);
 INSERT INTO profile_menu VALUES (657, 'ANCGR', 'ANCIMP', 1, 70, 'E', 0);
 INSERT INTO profile_menu VALUES (658, 'CSV:AncGrandLivre', NULL, 1, NULL, 'P', 
0);
-INSERT INTO profile_menu VALUES (210, 'REPORT', 'ADV', 6, 25, 'E', 0);
-INSERT INTO profile_menu VALUES (211, 'CARD', 'COMPTA', 6, 7, 'E', 0);
-INSERT INTO profile_menu VALUES (212, 'HIST', 'COMPTA', 6, 1, 'E', 0);
-INSERT INTO profile_menu VALUES (215, 'ADV', 'COMPTA', 6, 20, 'E', 0);
-INSERT INTO profile_menu VALUES (216, 'ACCESS', NULL, 6, 25, 'M', 0);
-INSERT INTO profile_menu VALUES (217, 'CSV:histo', NULL, 6, NULL, 'P', 0);
-INSERT INTO profile_menu VALUES (175, 'COMPTA', NULL, 6, 40, 'M', 0);
-INSERT INTO profile_menu VALUES (218, 'LOGOUT', NULL, 6, 30, 'M', 0);
-INSERT INTO profile_menu VALUES (219, 'PRINT', 'GESTION', 6, 4, 'E', 0);
-INSERT INTO profile_menu VALUES (221, 'CSV:ledger', NULL, 6, NULL, 'P', 0);
-INSERT INTO profile_menu VALUES (222, 'PDF:ledger', NULL, 6, NULL, 'P', 0);
-INSERT INTO profile_menu VALUES (223, 'PRINT', 'COMPTA', 6, 6, 'E', 0);
-INSERT INTO profile_menu VALUES (224, 'CSV:postedetail', NULL, 6, NULL, 'P', 
0);
-INSERT INTO profile_menu VALUES (226, 'MENUACH', 'COMPTA', 6, 3, 'E', 0);
-INSERT INTO profile_menu VALUES (227, 'ACHIMP', 'MENUACH', 6, 2, 'E', 0);
-INSERT INTO profile_menu VALUES (228, 'GESTION', NULL, 6, 45, 'M', 0);
-INSERT INTO profile_menu VALUES (229, 'MENUODS', 'COMPTA', 6, 5, 'E', 0);
 INSERT INTO profile_menu VALUES (662, 'new_line', NULL, 1, 35, 'M', 0);
-INSERT INTO profile_menu VALUES (230, 'ODS', 'MENUODS', 6, 1, 'E', 0);
-INSERT INTO profile_menu VALUES (231, 'ODSIMP', 'MENUODS', 6, 2, 'E', 0);
-INSERT INTO profile_menu VALUES (232, 'ANC', NULL, 6, 50, 'M', 0);
-INSERT INTO profile_menu VALUES (234, 'VENMENU', 'COMPTA', 6, 2, 'E', 0);
-INSERT INTO profile_menu VALUES (235, 'VEN', 'VENMENU', 6, 1, 'E', 0);
-INSERT INTO profile_menu VALUES (236, 'VENIMP', 'VENMENU', 6, 2, 'E', 0);
-INSERT INTO profile_menu VALUES (238, 'FIN', 'MENUFIN', 6, 1, 'E', 0);
-INSERT INTO profile_menu VALUES (239, 'MENUFIN', 'COMPTA', 6, 4, 'E', 0);
-INSERT INTO profile_menu VALUES (244, 'SEARCH', NULL, 6, 60, 'M', 0);
-INSERT INTO profile_menu VALUES (245, 'ACH', 'MENUACH', 6, 1, 'E', 0);
-INSERT INTO profile_menu VALUES (256, 'AMORTIS', 'MENUACH', 6, 10, 'E', 0);
 INSERT INTO profile_menu VALUES (67, 'CFGCATDOC', 'DIVPARM', 1, 8, 'E', 0);
-INSERT INTO profile_menu VALUES (260, 'PDF:postedetail', NULL, 6, NULL, 'P', 
0);
-INSERT INTO profile_menu VALUES (261, 'CSV:fichedetail', NULL, 6, NULL, 'P', 
0);
-INSERT INTO profile_menu VALUES (262, 'PDF:fichedetail', NULL, 6, NULL, 'P', 
0);
 INSERT INTO profile_menu VALUES (69, 'CFGPCMN', 'PARAM', 1, 4, 'E', 0);
-INSERT INTO profile_menu VALUES (263, 'CSV:fiche_balance', NULL, 6, NULL, 'P', 
0);
-INSERT INTO profile_menu VALUES (264, 'PDF:fiche_balance', NULL, 6, NULL, 'P', 
0);
-INSERT INTO profile_menu VALUES (265, 'CSV:report', NULL, 6, NULL, 'P', 0);
-INSERT INTO profile_menu VALUES (266, 'PDF:report', NULL, 6, NULL, 'P', 0);
-INSERT INTO profile_menu VALUES (267, 'CSV:fiche', NULL, 6, NULL, 'P', 0);
-INSERT INTO profile_menu VALUES (268, 'PDF:fiche', NULL, 6, NULL, 'P', 0);
-INSERT INTO profile_menu VALUES (269, 'CSV:glcompte', NULL, 6, NULL, 'P', 0);
-INSERT INTO profile_menu VALUES (270, 'PDF:glcompte', NULL, 6, NULL, 'P', 0);
-INSERT INTO profile_menu VALUES (271, 'PDF:sec', NULL, 6, NULL, 'P', 0);
-INSERT INTO profile_menu VALUES (272, 'CSV:AncList', NULL, 6, NULL, 'P', 0);
-INSERT INTO profile_menu VALUES (273, 'CSV:AncBalSimple', NULL, 6, NULL, 'P', 
0);
 INSERT INTO profile_menu VALUES (526, 'PRINTGL', 'PRINT', 1, 20, 'E', 0);
-INSERT INTO profile_menu VALUES (274, 'PDF:AncBalSimple', NULL, 6, NULL, 'P', 
0);
-INSERT INTO profile_menu VALUES (275, 'CSV:AncBalDouble', NULL, 6, NULL, 'P', 
0);
-INSERT INTO profile_menu VALUES (276, 'PDF:AncBalDouble', NULL, 6, NULL, 'P', 
0);
-INSERT INTO profile_menu VALUES (277, 'CSV:balance', NULL, 6, NULL, 'P', 0);
-INSERT INTO profile_menu VALUES (278, 'PDF:balance', NULL, 6, NULL, 'P', 0);
-INSERT INTO profile_menu VALUES (279, 'CSV:AncTable', NULL, 6, NULL, 'P', 0);
-INSERT INTO profile_menu VALUES (280, 'CSV:AncAccList', NULL, 6, NULL, 'P', 0);
-INSERT INTO profile_menu VALUES (281, 'CSV:AncBalGroup', NULL, 6, NULL, 'P', 
0);
-INSERT INTO profile_menu VALUES (282, 'OTH:Bilan', NULL, 6, NULL, 'P', 0);
 INSERT INTO profile_menu VALUES (23, 'LET', 'COMPTA', 1, 8, 'E', 0);
 INSERT INTO profile_menu VALUES (523, 'PRINTBAL', 'PRINT', 1, 50, 'E', 0);
 INSERT INTO profile_menu VALUES (529, 'PRINTREPORT', 'PRINT', 1, 85, 'E', 0);
@@ -615,14 +520,11 @@
 INSERT INTO profile_menu VALUES (94, 'FSALDO', 'MENUFIN', 1, 3, 'E', 0);
 INSERT INTO profile_menu VALUES (27, 'LETACC', 'LET', 1, 2, 'E', 0);
 INSERT INTO profile_menu VALUES (24, 'LETCARD', 'LET', 1, 1, 'E', 0);
-INSERT INTO profile_menu VALUES (164, 'TVA', 'EXT', 1, NULL, 'S', 0);
-INSERT INTO profile_menu VALUES (659, 'AMORTIS', 'GESTION', 1, 10, 'E', 0);
 INSERT INTO profile_menu VALUES (167, 'MOD', 'PARAM', 1, 1, 'E', 0);
 INSERT INTO profile_menu VALUES (92, 'MENUFIN', 'COMPTA', 1, 4, 'E', 0);
 INSERT INTO profile_menu VALUES (93, 'FIMP', 'MENUFIN', 1, 2, 'E', 0);
 INSERT INTO profile_menu VALUES (151, 'SEARCH', NULL, 1, 60, 'M', 0);
 INSERT INTO profile_menu VALUES (85, 'ACH', 'MENUACH', 1, 1, 'E', 0);
-INSERT INTO profile_menu VALUES (157, 'AMORTIS', 'MENUACH', 1, 10, 'E', 0);
 INSERT INTO profile_menu VALUES (127, 'PDF:postedetail', NULL, 1, NULL, 'P', 
0);
 INSERT INTO profile_menu VALUES (128, 'CSV:fichedetail', NULL, 1, NULL, 'P', 
0);
 INSERT INTO profile_menu VALUES (129, 'PDF:fichedetail', NULL, 1, NULL, 'P', 
0);
@@ -648,14 +550,108 @@
 INSERT INTO profile_menu VALUES (149, 'OTH:Bilan', NULL, 1, NULL, 'P', 0);
 INSERT INTO profile_menu VALUES (528, 'PRINTPOSTE', 'PRINT', 1, 30, 'E', 0);
 INSERT INTO profile_menu VALUES (525, 'PRINTCARD', 'PRINT', 1, 40, 'E', 0);
-INSERT INTO profile_menu VALUES (160, 'AMORTIS', 'EXT', 1, NULL, 'S', 0);
 INSERT INTO profile_menu VALUES (1, 'DASHBOARD', NULL, 1, 10, 'M', 1);
-INSERT INTO profile_menu VALUES (163, 'TOOL', 'EXT', 1, NULL, 'S', 0);
-INSERT INTO profile_menu VALUES (162, 'IMPORTBANK', 'EXT', 1, NULL, 'S', 0);
-INSERT INTO profile_menu VALUES (161, 'TOOLPLAN', 'EXT', 1, NULL, 'S', 0);
-INSERT INTO profile_menu VALUES (159, 'IMPCARD', 'EXT', 1, NULL, 'S', 0);
 INSERT INTO profile_menu VALUES (172, 'CFGPRO', 'MOD', 1, NULL, 'E', 0);
 INSERT INTO profile_menu VALUES (171, 'CFGMENU', 'MOD', 1, NULL, 'E', 0);
+INSERT INTO profile_menu VALUES (663, 'CFGPAY', 'DIVPARM', 2, 4, 'E', 0);
+INSERT INTO profile_menu VALUES (664, 'CFGATCARD', 'DIVPARM', 2, 9, 'E', 0);
+INSERT INTO profile_menu VALUES (665, 'CFGACC', 'DIVPARM', 2, 6, 'E', 0);
+INSERT INTO profile_menu VALUES (668, 'ANCHOP', 'ANCIMP', 2, 10, 'E', 0);
+INSERT INTO profile_menu VALUES (669, 'COMPTA', NULL, 2, 40, 'M', 0);
+INSERT INTO profile_menu VALUES (672, 'ANCGL', 'ANCIMP', 2, 20, 'E', 0);
+INSERT INTO profile_menu VALUES (673, 'CFGTVA', 'DIVPARM', 2, 5, 'E', 0);
+INSERT INTO profile_menu VALUES (674, 'ANCBS', 'ANCIMP', 2, 30, 'E', 0);
+INSERT INTO profile_menu VALUES (675, 'ANCBC2', 'ANCIMP', 2, 40, 'E', 0);
+INSERT INTO profile_menu VALUES (676, 'ANCTAB', 'ANCIMP', 2, 50, 'E', 0);
+INSERT INTO profile_menu VALUES (677, 'ANCBCC', 'ANCIMP', 2, 60, 'E', 0);
+INSERT INTO profile_menu VALUES (678, 'ANCGR', 'ANCIMP', 2, 70, 'E', 0);
+INSERT INTO profile_menu VALUES (679, 'CSV:AncGrandLivre', NULL, 2, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (680, 'new_line', NULL, 2, 35, 'M', 0);
+INSERT INTO profile_menu VALUES (681, 'CFGCATDOC', 'DIVPARM', 2, 8, 'E', 0);
+INSERT INTO profile_menu VALUES (683, 'PRINTGL', 'PRINT', 2, 20, 'E', 0);
+INSERT INTO profile_menu VALUES (684, 'LET', 'COMPTA', 2, 8, 'E', 0);
+INSERT INTO profile_menu VALUES (685, 'PRINTBAL', 'PRINT', 2, 50, 'E', 0);
+INSERT INTO profile_menu VALUES (686, 'PRINTREPORT', 'PRINT', 2, 85, 'E', 0);
+INSERT INTO profile_menu VALUES (688, 'PLANANC', 'ANC', 2, 1, 'E', 0);
+INSERT INTO profile_menu VALUES (689, 'CFGCARDCAT', 'DIVPARM', 2, 7, 'E', 0);
+INSERT INTO profile_menu VALUES (690, 'ANCODS', 'ANC', 2, 2, 'E', 0);
+INSERT INTO profile_menu VALUES (717, 'CSV:ledger', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (718, 'PDF:ledger', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (719, 'PRINT', 'COMPTA', 2, 6, 'E', 0);
+INSERT INTO profile_menu VALUES (720, 'CSV:postedetail', NULL, 2, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (721, 'MENUACH', 'COMPTA', 2, 3, 'E', 0);
+INSERT INTO profile_menu VALUES (722, 'ACHIMP', 'MENUACH', 2, 2, 'E', 0);
+INSERT INTO profile_menu VALUES (723, 'GESTION', NULL, 2, 45, 'M', 0);
+INSERT INTO profile_menu VALUES (724, 'MENUODS', 'COMPTA', 2, 5, 'E', 0);
+INSERT INTO profile_menu VALUES (725, 'ODS', 'MENUODS', 2, 1, 'E', 0);
+INSERT INTO profile_menu VALUES (726, 'ODSIMP', 'MENUODS', 2, 2, 'E', 0);
+INSERT INTO profile_menu VALUES (727, 'ANC', NULL, 2, 50, 'M', 0);
+INSERT INTO profile_menu VALUES (728, 'VENMENU', 'COMPTA', 2, 2, 'E', 0);
+INSERT INTO profile_menu VALUES (729, 'VEN', 'VENMENU', 2, 1, 'E', 0);
+INSERT INTO profile_menu VALUES (730, 'VENIMP', 'VENMENU', 2, 2, 'E', 0);
+INSERT INTO profile_menu VALUES (731, 'FIN', 'MENUFIN', 2, 1, 'E', 0);
+INSERT INTO profile_menu VALUES (735, 'EXT', NULL, 2, 55, 'M', 0);
+INSERT INTO profile_menu VALUES (736, 'FREC', 'MENUFIN', 2, 4, 'E', 0);
+INSERT INTO profile_menu VALUES (737, 'FSALDO', 'MENUFIN', 2, 3, 'E', 0);
+INSERT INTO profile_menu VALUES (738, 'LETACC', 'LET', 2, 2, 'E', 0);
+INSERT INTO profile_menu VALUES (691, 'ANCGROUP', 'ANC', 2, 3, 'E', 0);
+INSERT INTO profile_menu VALUES (692, 'ANCIMP', 'ANC', 2, 4, 'E', 0);
+INSERT INTO profile_menu VALUES (694, 'PRINTJRN', 'PRINT', 2, 10, 'E', 0);
+INSERT INTO profile_menu VALUES (695, 'PRINTREC', 'PRINT', 2, 100, 'E', 0);
+INSERT INTO profile_menu VALUES (696, 'PRINTBILAN', 'PRINT', 2, 90, 'E', 0);
+INSERT INTO profile_menu VALUES (697, 'PREFERENCE', NULL, 2, 15, 'M', 0);
+INSERT INTO profile_menu VALUES (698, 'CUST', 'GESTION', 2, 1, 'E', 0);
+INSERT INTO profile_menu VALUES (699, 'SUPPL', 'GESTION', 2, 2, 'E', 0);
+INSERT INTO profile_menu VALUES (700, 'ADM', 'GESTION', 2, 3, 'E', 0);
+INSERT INTO profile_menu VALUES (701, 'CARD', 'GESTION', 2, 6, 'E', 0);
+INSERT INTO profile_menu VALUES (702, 'STOCK', 'GESTION', 2, 5, 'E', 0);
+INSERT INTO profile_menu VALUES (703, 'FORECAST', 'GESTION', 2, 7, 'E', 0);
+INSERT INTO profile_menu VALUES (704, 'FOLLOW', 'GESTION', 2, 8, 'E', 0);
+INSERT INTO profile_menu VALUES (705, 'VERIFBIL', 'ADV', 2, 21, 'E', 0);
+INSERT INTO profile_menu VALUES (706, 'STOCK', 'ADV', 2, 22, 'E', 0);
+INSERT INTO profile_menu VALUES (707, 'PREDOP', 'ADV', 2, 23, 'E', 0);
+INSERT INTO profile_menu VALUES (708, 'OPEN', 'ADV', 2, 24, 'E', 0);
+INSERT INTO profile_menu VALUES (709, 'REPORT', 'ADV', 2, 25, 'E', 0);
+INSERT INTO profile_menu VALUES (710, 'CARD', 'COMPTA', 2, 7, 'E', 0);
+INSERT INTO profile_menu VALUES (711, 'HIST', 'COMPTA', 2, 1, 'E', 0);
+INSERT INTO profile_menu VALUES (712, 'ADV', 'COMPTA', 2, 20, 'E', 0);
+INSERT INTO profile_menu VALUES (713, 'ACCESS', NULL, 2, 25, 'M', 0);
+INSERT INTO profile_menu VALUES (714, 'CSV:histo', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (715, 'LOGOUT', NULL, 2, 30, 'M', 0);
+INSERT INTO profile_menu VALUES (716, 'PRINT', 'GESTION', 2, 4, 'E', 0);
+INSERT INTO profile_menu VALUES (739, 'LETCARD', 'LET', 2, 1, 'E', 0);
+INSERT INTO profile_menu VALUES (742, 'MENUFIN', 'COMPTA', 2, 4, 'E', 0);
+INSERT INTO profile_menu VALUES (743, 'FIMP', 'MENUFIN', 2, 2, 'E', 0);
+INSERT INTO profile_menu VALUES (744, 'SEARCH', NULL, 2, 60, 'M', 0);
+INSERT INTO profile_menu VALUES (745, 'ACH', 'MENUACH', 2, 1, 'E', 0);
+INSERT INTO profile_menu VALUES (746, 'PDF:postedetail', NULL, 2, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (747, 'CSV:fichedetail', NULL, 2, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (748, 'PDF:fichedetail', NULL, 2, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (749, 'CSV:fiche_balance', NULL, 2, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (750, 'PDF:fiche_balance', NULL, 2, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (751, 'CSV:report', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (752, 'PDF:report', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (753, 'CSV:fiche', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (754, 'PDF:fiche', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (755, 'CSV:glcompte', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (756, 'PDF:glcompte', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (757, 'PDF:sec', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (758, 'CSV:AncList', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (759, 'CSV:AncBalSimple', NULL, 2, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (760, 'PDF:AncBalSimple', NULL, 2, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (761, 'CSV:AncBalDouble', NULL, 2, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (762, 'PDF:AncBalDouble', NULL, 2, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (763, 'CSV:balance', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (764, 'PDF:balance', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (765, 'CSV:AncTable', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (766, 'CSV:AncAccList', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (767, 'CSV:AncBalGroup', NULL, 2, NULL, 'P', 
0);
+INSERT INTO profile_menu VALUES (768, 'OTH:Bilan', NULL, 2, NULL, 'P', 0);
+INSERT INTO profile_menu VALUES (769, 'PRINTPOSTE', 'PRINT', 2, 30, 'E', 0);
+INSERT INTO profile_menu VALUES (770, 'PRINTCARD', 'PRINT', 2, 40, 'E', 0);
+INSERT INTO profile_menu VALUES (777, 'CFGPRO', 'MOD', 2, NULL, 'E', 0);
+INSERT INTO profile_menu VALUES (778, 'CFGMENU', 'MOD', 2, NULL, 'E', 0);
+INSERT INTO profile_menu VALUES (772, 'DASHBOARD', NULL, 2, 10, 'M', 1);
 
 
 --
@@ -673,8 +669,6 @@
 --
 
 INSERT INTO profile_user VALUES ('phpcompta', 1, 1);
-INSERT INTO profile_user VALUES ('acama-viramar', 2, 1);
-INSERT INTO profile_user VALUES ('adama', 5, 6);
 
 
 --

Modified: phpcompta/trunk/sql/tmp_pcmn_ins.sql
===================================================================
--- phpcompta/trunk/sql/tmp_pcmn_ins.sql        2011-11-25 16:20:12 UTC (rev 
4476)
+++ phpcompta/trunk/sql/tmp_pcmn_ins.sql        2011-11-26 01:14:51 UTC (rev 
4477)
@@ -1,4 +1,4 @@
-ZCREATE OR REPLACE FUNCTION comptaproc.tmp_pcmn_ins()
+CREATE OR REPLACE FUNCTION comptaproc.tmp_pcmn_ins()
   RETURNS trigger AS
 $BODY$
 declare

Modified: phpcompta/trunk/sql/tva.sql
===================================================================
--- phpcompta/trunk/sql/tva.sql 2011-11-25 16:20:12 UTC (rev 4476)
+++ phpcompta/trunk/sql/tva.sql 2011-11-26 01:14:51 UTC (rev 4477)
@@ -9,11 +9,15 @@
 
 
 
-alter table quant_purchase add qp_vat_sided number (20,4);
-alter table quant_sold add qs_vat_sided number (20,4);
+alter table quant_purchase add qp_vat_sided numeric (20,4);
+alter table quant_sold add qs_vat_sided numeric (20,4);
 
 alter table quant_purchase alter qp_vat_sided set default 0.0;
-alter table quant_solde alter qs_vat_sided set default 0.0;
+alter table quant_sold alter qs_vat_sided set default 0.0;
+
+update quant_purchase set qp_vat_sided=0.0;
+update quant_sold set qs_vat_sided=0.0;
+
 comment on column quant_purchase.qp_vat_sided is 'amount of the VAT which 
avoid VAT, case of the VAT which add the same amount at the deb and cred';
 comment on column quant_purchase.qp_vat_sided is 'amount of the VAT which 
avoid VAT, case of the VAT which add the same amount at the deb and cred';
 
@@ -96,7 +100,7 @@
 
 
 
-DROP FUNCTION comptaproc.insert_quant_purchase(text,numeric, character 
varying,numeric,numeric,numeric,integer,,numeric,numeric,,numeric,numeric,character
 varying, numeric);
+DROP FUNCTION comptaproc.insert_quant_purchase(text,numeric, character 
varying,numeric,numeric,numeric,integer,numeric,numeric,numeric,numeric,character
 varying);
 -- procedure insert_quant_purchase
 CREATE OR REPLACE FUNCTION comptaproc.insert_quant_purchase(p_internal text, 
p_j_id numeric, p_fiche character varying, p_quant numeric, p_price numeric, 
p_vat numeric, p_vat_code integer, p_nd_amount numeric, p_nd_tva numeric, 
p_nd_tva_recup numeric, p_dep_priv numeric, p_client character 
varying,p_tva_sided numeric)
  RETURNS void

Modified: phpcompta/trunk/sql/upgrade.sql
===================================================================
--- phpcompta/trunk/sql/upgrade.sql     2011-11-25 16:20:12 UTC (rev 4476)
+++ phpcompta/trunk/sql/upgrade.sql     2011-11-26 01:14:51 UTC (rev 4477)
@@ -27,8 +27,6 @@
 \i ajax-direct-form.sql
 
 \i mode_paiement.sql
-\i anc-modularity-imp.sql
-\i anc-grandlivre.sql
 \i tva.sql
 create unique index qcode_idx on fiche_detail (ad_value) where ad_id=23;
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]