noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 34/46: Bug #0001245: Type actif - passif pour


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 34/46: Bug #0001245: Type actif - passif pour nouvelle fiche à partir de fiche Erreur dans PARM_POSTE pour la compta française
Date: Mon, 4 May 2020 13:38:52 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 0b55332b02a9a0122fd031ac06ab3909e02e3b74
Author: Dany De Bontridder <address@hidden>
AuthorDate: Sat Apr 4 13:48:36 2020 +0200

    Bug #0001245: Type actif - passif pour nouvelle fiche à partir de fiche
    Erreur dans PARM_POSTE pour la compta française
---
 include/class/database.class.php    | 18 ++++++++++++----
 include/class/dossier.class.php     |  8 ++++++-
 include/constant.php                |  2 +-
 include/sql/patch/upgrade141.BE.sql |  3 +++
 include/sql/patch/upgrade141.FR.sql |  5 +++++
 include/sql/patch/upgrade141.sql    |  0
 include/sql/patch/upgrade142.sql    | 43 +++++++++++++++++++++++++++++++++++++
 7 files changed, 73 insertions(+), 6 deletions(-)

diff --git a/include/class/database.class.php b/include/class/database.class.php
index 71dce9c..216d3f4 100644
--- a/include/class/database.class.php
+++ b/include/class/database.class.php
@@ -113,8 +113,11 @@ class Database extends DatabaseCore
     }
 
     /**
-     * \brief loop to apply all the path to a folder or
-     *         a template
+     * \brief loop to apply all the path to a folder or     a template
+     * Upgrade check if the folder $p_name needs to be upgrade thanks the 
variable DBVERSION
+     * and run  all the SQL script named  upgradeX.sql from the folder 
noalyss/include/sql/patch 
+     * until  X equal DBVERSION-1
+     *
      * \param $p_name database name
      *
      */
@@ -142,8 +145,7 @@ class Database extends DatabaseCore
                 echo "<li>Patching " . $p_name .
                     " from the version " . $this->get_version() . " to $to ";
 
-                $this->execute_script(NOALYSS_INCLUDE . '/sql/patch/upgrade' . 
$i . '.sql');
-                echo $succeed;
+              
 
                 if (!DEBUG)
                     ob_start();
@@ -214,9 +216,17 @@ class Database extends DatabaseCore
                     $country = $this->get_value("select pr_value from 
parameter where pr_id='MY_COUNTRY'");
                     $this->execute_script(NOALYSS_INCLUDE . 
"/sql/patch/upgrade61." . $country . ".sql");
                 }
+                /**
+                 * Bug in parm_code for FRANCE
+                 */
+                if ($i == 141 ) {
+                     $country = $this->get_value("select pr_value from 
parameter where pr_id='MY_COUNTRY'");
+                     $this->execute_script(NOALYSS_INCLUDE . 
"/sql/patch/upgrade141." . $country . ".sql");
+                }
 
                 if (!DEBUG)
                     ob_end_clean();
+                
             }
         }
         echo '</ul>';
diff --git a/include/class/dossier.class.php b/include/class/dossier.class.php
index 3d2cde9..ecd439e 100644
--- a/include/class/dossier.class.php
+++ b/include/class/dossier.class.php
@@ -330,7 +330,13 @@ class Dossier
             $cn->rollback();
         }
     }
-
+    /**
+     * Upgrade check if the folder ACCOUNT_REPOSITORY  needs to be upgrade 
thanks the variable DBVERSIONREPO 
+     * and run  all the SQL script named  ac-upgradeX.sql from the folder 
noalyss/include/sql/patch 
+     * until  X equal DBVERSIONREPO-1
+     * After it will call the function apply_patch, remove_inexistant_user and 
clean_orphan_log for each folder
+     * 
+     */
     static function upgrade()
     {
         $rep=new Database();
diff --git a/include/constant.php b/include/constant.php
index 1625f70..a10f5bb 100644
--- a/include/constant.php
+++ b/include/constant.php
@@ -107,7 +107,7 @@ if ( !defined ("NOALYSS_PACKAGE_REPOSITORY")) {
 if ( ! defined ("SYSINFO_DISPLAY")) {
     define ("SYSINFO_DISPLAY",TRUE);
 }
-define ("DBVERSION",141);
+define ("DBVERSION",143);
 define ("MONO_DATABASE",25);
 define ("DBVERSIONREPO",18);
 define ('NOTFOUND','--not found--');
diff --git a/include/sql/patch/upgrade141.BE.sql 
b/include/sql/patch/upgrade141.BE.sql
new file mode 100644
index 0000000..3447862
--- /dev/null
+++ b/include/sql/patch/upgrade141.BE.sql
@@ -0,0 +1,3 @@
+begin; 
+insert into version (val,v_description) values (142,'Bug dans PARM_POSTE');
+commit ;
diff --git a/include/sql/patch/upgrade141.FR.sql 
b/include/sql/patch/upgrade141.FR.sql
new file mode 100644
index 0000000..1e7c566
--- /dev/null
+++ b/include/sql/patch/upgrade141.FR.sql
@@ -0,0 +1,5 @@
+begin; 
+update parm_poste set p_type='PAS' where p_value='40';
+
+insert into version (val,v_description) values (142,'Bug dans PARM_POSTE');
+commit ;
diff --git a/include/sql/patch/upgrade141.sql b/include/sql/patch/upgrade141.sql
new file mode 100644
index 0000000..e69de29
diff --git a/include/sql/patch/upgrade142.sql b/include/sql/patch/upgrade142.sql
new file mode 100644
index 0000000..3afaed6
--- /dev/null
+++ b/include/sql/patch/upgrade142.sql
@@ -0,0 +1,43 @@
+begin;
+
+CREATE OR REPLACE FUNCTION comptaproc.find_pcm_type(pp_value account_type)
+ RETURNS text
+AS $function$
+declare
+       str_type parm_poste.p_type%TYPE;
+       str_value parm_poste.p_type%TYPE;
+       nLength integer;
+begin
+       str_value:=pp_value;
+       nLength:=length(str_value::text);
+
+       while nLength > 0 loop
+               select p_type into str_type from parm_poste where 
p_value=str_value;
+               if FOUND then
+                       raise info 'Type of %s is %s',str_value,str_type;
+                       return str_type;
+               end if;
+               nLength:=nLength-1;
+               str_value:=substring(str_value::text from 1 for 
nLength)::account_type;
+       end loop;
+-- Si non trouvé dans PARM_POSTE, prend le type du premier parent trouvé
+--
+       str_value := pp_value;
+       nLength:=length(str_value::text);
+       str_value:=substring(str_value::text from 1 for nLength)::account_type;
+       while nLength > 0 loop
+               select pcm_type into str_type from tmp_pcmn tp where 
pcm_val=str_value;
+               if FOUND then
+                       raise info 'Type of %s is %s',str_value,str_type;
+                       return str_type;
+               end if;
+               nLength:=nLength-1;
+               str_value:=substring(str_value::text from 1 for 
nLength)::account_type;
+       end loop;
+-- si ni parent ou parm_poste alors return CON
+return 'CON';
+end;
+$function$
+ LANGUAGE plpgsql;
+insert into version (val,v_description) values (143,'Corrige function 
find_pcm_type');
+commit ;



reply via email to

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