phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r5556 - phpcompta/trunk/dev/manage-code/create-file


From: phpcompta-dev
Subject: [Phpcompta-dev] r5556 - phpcompta/trunk/dev/manage-code/create-file
Date: Tue, 3 Dec 2013 02:19:39 +0100 (CET)

Author: danydb
Date: 2013-12-03 02:19:38 +0100 (Tue, 03 Dec 2013)
New Revision: 5556

Modified:
   phpcompta/trunk/dev/manage-code/create-file/create_config.py
   phpcompta/trunk/dev/manage-code/create-file/create_phpclass.py
Log:
Fix bug in new create script

Modified: phpcompta/trunk/dev/manage-code/create-file/create_config.py
===================================================================
--- phpcompta/trunk/dev/manage-code/create-file/create_config.py        
2013-12-01 20:53:16 UTC (rev 5555)
+++ phpcompta/trunk/dev/manage-code/create-file/create_config.py        
2013-12-03 01:19:38 UTC (rev 5556)
@@ -61,6 +61,7 @@
 
 file.write(class_name+"\n")
 file.write(schema+"."+table+"\n")
+record.reverse()
 for l in record:
     col_name,col_type,col_default=l
     file.write ("%s\t|%s\t|%s\n"%(col_name,col_type,col_default))

Modified: phpcompta/trunk/dev/manage-code/create-file/create_phpclass.py
===================================================================
--- phpcompta/trunk/dev/manage-code/create-file/create_phpclass.py      
2013-12-01 20:53:16 UTC (rev 5555)
+++ phpcompta/trunk/dev/manage-code/create-file/create_phpclass.py      
2013-12-03 01:19:38 UTC (rev 5556)
@@ -1,4 +1,4 @@
-  #!/usr/bin/python
+#!/usr/bin/python
 
 
 # Command we have to replace
@@ -63,6 +63,7 @@
 */
 class @class_name@ extends Phpcompta_SQL
 {
+       @vars@
   /* example private 
$variable=array("easy_name"=>column_name,"email"=>"column_name_email","val3"=>0);
 */
   function __construct($p_id=-1)
        {
@@ -83,7 +84,7 @@
                        "@id@" => "auto"
                );
                global $cn;
-
+               $this->date_format = "DD.MM.YYYY";
                parent::__construct($cn, $p_id);
        }
   /**
@@ -133,21 +134,25 @@
         column_array=''
         column_type_array=''
         sep=''
-        for e in line [3:]:
+       var='//------ Attributes-----'+"\n"
+        for e in line [2:]:
             if e.find('|') < 0 :
                 continue
             col_name=(e.split('|'))[0].strip()
             col_type=(e.split('|'))[1].strip()
             if col_type == 'integer' or col_type == 'numeric' or 
col_type=='bigint':
                col_type="numeric"
-           elif col_type=='text' or col_type=='character varying':
+           elif col_type=='text' or col_type=='character varying' or 
col_type=='character':
                col_type="text"
-           elif col_type=='date':
+           elif col_type=='oid':
+               col_type='oid'
+           elif col_type=='date' or col_type=='timestamp without timezone' or 
col_type=='timestamp with timezone':
                col_type='date'
            else :
                col_type='set_me'
             column_array+=sep+'"'+col_name+'"=>"'+col_name+'"'+"\n"
             column_type_array+=sep+'"'+col_name+'"=>"'+col_type+'"'+"\n"
+           var=var+' var $'+col_name+";\n"
             sep=','
         column_array='"'+id+'"=>"'+id+'",'+column_array
         i=1;sep='';set=' set '
@@ -170,6 +175,7 @@
             throw new Exception('DATATYPE "+col_id+" $this->"+col_id+" date 
invalide');\n"
        
        sParent=sParent.replace('@id@',id)
+       sParent=sParent.replace('@vars@',var)
        sParent=sParent.replace('@table@',table)
        sParent=sParent.replace('@class_name@',class_name)
        sParent=sParent.replace('@column_array@',column_array)



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