phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r326 - in trunk/import_doli: . include


From: phpcompta-dev
Subject: [Phpcompta-dev] r326 - in trunk/import_doli: . include
Date: Sat, 31 Mar 2012 17:51:46 +0200 (CEST)

Author: danydb
Date: 2012-03-31 17:51:46 +0200 (Sat, 31 Mar 2012)
New Revision: 326

Modified:
   trunk/import_doli/include/class_install_impdol.php
   trunk/import_doli/index.php
Log:
auto install

Modified: trunk/import_doli/include/class_install_impdol.php
===================================================================
--- trunk/import_doli/include/class_install_impdol.php  2012-03-31 15:41:58 UTC 
(rev 325)
+++ trunk/import_doli/include/class_install_impdol.php  2012-03-31 15:51:46 UTC 
(rev 326)
@@ -31,18 +31,31 @@
 
        function install($p_cn)
        {
-
-               $cn->exec_sql("create schema impdol");
-               $cn->exec_sql("
+               try
+               {
+                       $p_cn->start();
+                       $p_cn->exec_sql("create schema impdol");
+                       $p_cn->exec_sql("
                        create table impdol.version (
                                v_id bigint primary key,
-                               v_date now(),
+                               v_date date default now(),
                                v_text text
                        )
-       ");
-               $cn->exec_sql("insert into impdol.version(v_id,v_text", 
array(1, "Installation"));
-               
-               $cn->exec_sql('
+                               ");
+                       $p_cn->exec_sql("insert into 
impdol.version(v_id,v_text) values ($1,$2)", array(1, "Installation"));
+
+                       $p_cn->exec_sql("
+                               CREATE TABLE impdol.import
+                                       (
+                                       i_id serial NOT NULL,
+                                       temp_file text,
+                                       send_file text,
+                                       i_date timestamp with time zone DEFAULT 
now(),
+                                       i_row bigint,
+                                       CONSTRAINT import_pkey PRIMARY KEY 
(i_id )
+                                       )");
+
+                       $p_cn->exec_sql('
                        CREATE TABLE impdol.parameter_tva
                                (
                                        pt_id serial NOT NULL,
@@ -51,24 +64,7 @@
                                        CONSTRAINT parameter_tva_pkey PRIMARY 
KEY (pt_id )
                                        )
                        ');
-
-               $cn->exec_sql("
-                       CREATE TABLE impdol.operation_transfer
-                               (
-                               ot_id serial NOT NULL,
-                               j_id bigint,
-                               o_id bigint,
-                               CONSTRAINT operation_transfer_pkey PRIMARY KEY 
(ot_id ),
-                               CONSTRAINT operation_transfer_j_id_fkey FOREIGN 
KEY (j_id)
-                                       REFERENCES jrnx (j_id) MATCH SIMPLE
-                                       ON UPDATE CASCADE ON DELETE CASCADE,
-                               CONSTRAINT operation_transfer_o_id_fkey FOREIGN 
KEY (o_id)
-                                       REFERENCES impdol.operation_tmp (o_id) 
MATCH SIMPLE
-                                       ON UPDATE CASCADE ON DELETE CASCADE
-                               )");
-
-
-               $cn->exec_sql("
+                       $p_cn->exec_sql("
                        CREATE TABLE impdol.operation_tmp
                                        (
                                        o_id bigserial NOT NULL,
@@ -96,14 +92,38 @@
                                                ON UPDATE CASCADE ON DELETE 
CASCADE
                                        )
                        ");
-               $cn->exec_sql("
+
+                       $p_cn->exec_sql("
+                       CREATE TABLE impdol.operation_transfer
+                               (
+                               ot_id serial NOT NULL,
+                               j_id bigint,
+                               o_id bigint,
+                               CONSTRAINT operation_transfer_pkey PRIMARY KEY 
(ot_id ),
+                               CONSTRAINT operation_transfer_j_id_fkey FOREIGN 
KEY (j_id)
+                                       REFERENCES jrnx (j_id) MATCH SIMPLE
+                                       ON UPDATE CASCADE ON DELETE CASCADE,
+                               CONSTRAINT operation_transfer_o_id_fkey FOREIGN 
KEY (o_id)
+                                       REFERENCES impdol.operation_tmp (o_id) 
MATCH SIMPLE
+                                       ON UPDATE CASCADE ON DELETE CASCADE
+                               )");
+
+
+
+                       $p_cn->exec_sql("
                        COMMENT ON COLUMN impdol.operation_tmp.o_result IS 
'result is T can be transferrable, N cannot be transferrable';
                        ");
 
-               $cn->exec_sql("
-                       COMMENT ON COLUMN impdol.operation_tmp.o_type IS 'S = 
marchandise, serviceT = tiers (fournisseurs, client)
+                       $p_cn->exec_sql("
+                       COMMENT ON COLUMN impdol.operation_tmp.o_type IS 'S = 
marchandise, serviceT = tiers (fournisseurs, client)'
                        ");
-
+                       $p_cn->commit();
+               }
+               catch (Exception $e)
+               {
+                       $p_cn->rollback();
+                       print_r($e->getTraceAsString());
+               }
        }
 
 }

Modified: trunk/import_doli/index.php
===================================================================
--- trunk/import_doli/index.php 2012-03-31 15:41:58 UTC (rev 325)
+++ trunk/import_doli/index.php 2012-03-31 15:51:46 UTC (rev 326)
@@ -78,8 +78,8 @@
   {
     require_once('include/class_install_impdol.php');
 
-    $iplugn=new Install_Impdol($cn);
-    $iplugn->install();
+    $iplugn=new Install_Impdol();
+    $iplugn->install($cn);
 
   }
 echo ShowItem($array,'H','mtitle','mtitle',$default,' 
style="width:80%;margin-left:10%"');



---
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]