phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r372 - in trunk/tva: . sql


From: phpcompta-dev
Subject: [Phpcompta-dev] r372 - in trunk/tva: . sql
Date: Sun, 27 May 2012 23:09:34 +0200 (CEST)

Author: danydb
Date: 2012-05-27 23:09:34 +0200 (Sun, 27 May 2012)
New Revision: 372

Modified:
   trunk/tva/index.php
   trunk/tva/sql/patch2.sql
Log:
Add patch


Modified: trunk/tva/index.php
===================================================================
--- trunk/tva/index.php 2012-05-27 21:02:12 UTC (rev 371)
+++ trunk/tva/index.php 2012-05-27 21:09:34 UTC (rev 372)
@@ -67,6 +67,7 @@
   echo_warning(_("L'extension est installée, pourriez-vous en vérifier le 
paramètrage ?"));
   $def=5;
 }
+
 // check schema
 $a=$cn->exist_column('assujetti_chld','ac_periode','tva_belge');
 if ( $a == false)
@@ -87,7 +88,11 @@
 $a=$cn->exist_column('assujetti','exercice','tva_belge');
 if ( $a == false)
   $cn->exec_sql("alter table tva_belge.assujetti add exercice text");
-
+if ( $cn->exist_table("version","tva_belge")==false)
+{
+               $file=__DIR__."/sql/patch2.sql";
+               $cn->execute_script($file);
+}
 echo '<div style="float:right"><a class="mtitle" style="font-size:140%" 
href="http://wiki.phpcompta.eu/doku.php?id=tva"; target="_blank">Aide</a>'.
 '<span style="font-size:0.8em;color:red;display:inline">vers:SVNINFO</span>'.
 '</div>';

Modified: trunk/tva/sql/patch2.sql
===================================================================
--- trunk/tva/sql/patch2.sql    2012-05-27 21:02:12 UTC (rev 371)
+++ trunk/tva/sql/patch2.sql    2012-05-27 21:09:34 UTC (rev 372)
@@ -1,3 +1,4 @@
+begin;
 create table tva_belge.version (
        id serial primary key,
        vdate timestamp default now(),
@@ -88,29 +89,21 @@
 
 begin
 
-for i in select distinct pvalue from tva_belge.parameter WHERE pcode in 
('GRILL00','GRIL02','GRIL03')
+for i in select distinct pvalue from tva_belge.parameter WHERE pcode in 
('GRIL00','GRIL01','GRIL02','GRIL03')
 loop
-       if length(trim(i.pvalue)) = 0 or length(trim(i.paccount)) = 0 then
+       if length(trim(i.pvalue)) = 0  then
                continue;
        end if;
 
-       a_account := string_to_array(i.paccount, ',');
        a_tva_id  := string_to_array(i.pvalue,',');
 
        n_size_tva := array_upper(a_tva_id,1);
-       n_size_account := array_upper(a_account,1);
 
 
        while n_size_tva <> 0 loop
 
-               while n_size_account <> 0 loop
-
-                       insert into tva_belge.parameter_chld (pcode,tva_id)
-                               values 
('ASSUJETTI',a_tva_id[n_size_tva]::numeric);
-
-                       n_size_account := n_size_account -1;
-               end loop;
-               n_size_account := array_upper(a_account,1);
+               insert into tva_belge.parameter_chld (pcode,tva_id)
+                       values ('ASSUJETTI',a_tva_id[n_size_tva]::numeric);
                n_size_tva := n_size_tva -1;
        end loop;
 
@@ -128,5 +121,7 @@
 insert into tva_belge.parameter_chld (pcode,pcm_val) select pcode,paccount 
from tva_belge.parameter where pcode in ('ATVA','CRTVA','DTTVA');
 drop function tva_belge.fill_parameter_chld();
 drop function tva_belge.fill_parameter_chld_assujetti();
-alter table tva_belge.parameter drop column paccount;
-alter table tva_belge.parameter drop column pvalue;
+ alter table tva_belge.parameter drop column paccount;
+ alter table tva_belge.parameter drop column pvalue;
+insert into tva_belge.version(vdesc) values ('Version 2 : amélioration 
plugin');
+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]