phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r454 - in tag/rel652/rapport_avance: . include sql


From: phpcompta-dev
Subject: [Phpcompta-dev] r454 - in tag/rel652/rapport_avance: . include sql
Date: Thu, 27 Dec 2012 01:10:14 +0100 (CET)

Author: danydb
Date: 2012-12-27 01:10:12 +0100 (Thu, 27 Dec 2012)
New Revision: 454

Added:
   tag/rel652/rapport_avance/sql/upgrade2.sql
Modified:
   tag/rel652/rapport_avance/include/class_rapav_install.php
   tag/rel652/rapport_avance/index.php
   tag/rel652/rapport_avance/rapav_constant.php
Log:
add upgrade script

Modified: tag/rel652/rapport_avance/include/class_rapav_install.php
===================================================================
--- tag/rel652/rapport_avance/include/class_rapav_install.php   2012-12-26 
20:02:17 UTC (rev 453)
+++ tag/rel652/rapport_avance/include/class_rapav_install.php   2012-12-27 
00:10:12 UTC (rev 454)
@@ -37,6 +37,16 @@
                $file=dirname(__FILE__);
                $this->db->execute_script($file.'/../sql/install.sql');
        }
+               function upgrade($p_version)
+       {
+               global $cn;
+               $cur_version=$cn->get_value('select max(version_id) from 
rapport_advanced.version');
+               $cur_version++;
+               $file=dirname(__FILE__);
+               for ($e=$cur_version;$e<=$p_version;$e++) {
+                       
$this->db->execute_script($file.'/../sql/upgrade'.$e.'.sql');
+               }
+       }
 }
 
 ?>

Modified: tag/rel652/rapport_avance/index.php
===================================================================
--- tag/rel652/rapport_avance/index.php 2012-12-26 20:02:17 UTC (rev 453)
+++ tag/rel652/rapport_avance/index.php 2012-12-27 00:10:12 UTC (rev 454)
@@ -38,6 +38,12 @@
        $iplugn->install();
        echo_warning(_("L'extension est installée, pourriez-vous en vérifier le 
paramètrage ?"));
 }
+if ( $cn->get_value('select max(version_id) from rapport_advanced.version') < 
$rapav_version )
+{
+       require_once('include/class_rapav_install.php');
+       $iplugn = new Rapav_Install($cn);
+       $iplugn->upgrade($rapav_version);
+}
 /*
  * load javascript
  */

Modified: tag/rel652/rapport_avance/rapav_constant.php
===================================================================
--- tag/rel652/rapport_avance/rapav_constant.php        2012-12-26 20:02:17 UTC 
(rev 453)
+++ tag/rel652/rapport_avance/rapav_constant.php        2012-12-27 00:10:12 UTC 
(rev 454)
@@ -9,6 +9,7 @@
 
 require_once ('class_database.php');
 
-global $cn;
+global $cn,$rapav_version;
 $cn=new Database (dossier::id());
+$rapav_version=2;
 ?>
\ No newline at end of file

Added: tag/rel652/rapport_avance/sql/upgrade2.sql
===================================================================
--- tag/rel652/rapport_avance/sql/upgrade2.sql                          (rev 0)
+++ tag/rel652/rapport_avance/sql/upgrade2.sql  2012-12-27 00:10:12 UTC (rev 
454)
@@ -0,0 +1,62 @@
+begin;
+insert into rapport_advanced.type_row_detail values (4,'Poste comptable');
+insert into rapport_advanced.type_row_detail  (tr_id,tr_description) values 
(5,'Opération réconcilée');
+insert into rapport_advanced.periode_type (t_id,t_description) values 
(6,'Depuis début exercice courant N');
+
+ALTER TABLE rapport_advanced.formulaire_param_detail ADD COLUMN with_tmp_val 
account_type;
+ALTER TABLE rapport_advanced.formulaire_param_detail ADD COLUMN 
type_sum_account bigint;
+ALTER TABLE rapport_advanced.formulaire_param_detail ADD COLUMN 
operation_pcm_val account_type;
+
+
+CREATE TABLE rapport_advanced.total_type_account
+(
+  tt_id serial NOT NULL,
+  tt_label text,
+  CONSTRAINT total_type_account_pkey PRIMARY KEY (tt_id )
+);
+INSERT INTO rapport_advanced.total_type_account (tt_id, tt_label) VALUES (1, 
'Solde (débit-crédit)');
+INSERT INTO rapport_advanced.total_type_account (tt_id, tt_label) VALUES (2, 
'Solde (crédit-débit)');
+INSERT INTO rapport_advanced.total_type_account (tt_id, tt_label) VALUES (3, 
'Débit');
+INSERT INTO rapport_advanced.total_type_account (tt_id, tt_label) VALUES (4, 
'Crédit');
+
+
+
+CREATE TABLE rapport_advanced.restore_formulaire_param
+(
+  p_id integer NOT NULL,
+  p_code text,
+  p_libelle text,
+  p_type integer,
+  p_order integer NOT NULL,
+  f_id integer,
+  p_info text, -- si non vide affiche infobulle
+  t_id integer,
+  CONSTRAINT restore_formulaire_param_pkey PRIMARY KEY (p_id )
+
+);
+CREATE TABLE rapport_advanced.restore_formulaire_param_detail
+(
+  fp_id integer NOT NULL,
+  p_id integer,
+  tmp_val account_type,
+  tva_id integer,
+  fp_formula text,
+  fp_signed integer,
+  jrn_def_type character(3),
+  tt_id integer,
+  type_detail integer,
+  with_tmp_val account_type,
+  type_sum_account bigint,
+  operation_pcm_val account_type,
+  CONSTRAINT restore_formulaire_param_detail_pkey PRIMARY KEY (fp_id ),
+  CONSTRAINT formulaire_param_detail_p_id_fkey FOREIGN KEY (p_id)
+      REFERENCES rapport_advanced.formulaire_param (p_id) MATCH SIMPLE
+      ON UPDATE CASCADE ON DELETE CASCADE
+);
+insert into rapport_advanced.version(version_id,version_note) values (2,'Ajout 
formules, export CSV des déclarations et des formulaires');
+
+ALTER TABLE rapport_advanced.formulaire_param_detail
+  ADD CONSTRAINT formulaire_param_detail_type_sum_account_fkey FOREIGN KEY 
(type_sum_account)
+      REFERENCES rapport_advanced.total_type_account (tt_id) MATCH SIMPLE
+      ON UPDATE SET NULL ON DELETE SET NULL;
+commit;
\ No newline at end of file



---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu



reply via email to

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