noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 05/65: Esthetic + the parent template is mand


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 05/65: Esthetic + the parent template is mandatory
Date: Wed, 09 Sep 2015 08:27:01 +0000

sparkyx pushed a commit to branch master
in repository noalyss.

commit de04ef10baf3fe240f25b50e1441aa8b7aae7e87
Author: Dany De Bontridder <address@hidden>
Date:   Sat Aug 29 23:59:03 2015 +0200

    Esthetic + the parent template is mandatory
---
 include/cfgfiche.inc.php             |    3 ++
 include/class_fiche_def.php          |   35 ++++++++++++++++++++++-----------
 include/template/fiche_def_input.php |   15 +++++++------
 3 files changed, 34 insertions(+), 19 deletions(-)

diff --git a/include/cfgfiche.inc.php b/include/cfgfiche.inc.php
index 4231c38..8d29d07 100644
--- a/include/cfgfiche.inc.php
+++ b/include/cfgfiche.inc.php
@@ -122,6 +122,9 @@ if ( isset($_POST['add_modele']))
        {
                $single->save();
                $fiche_def=new Fiche_Def($cn);
+                /**
+                 * Check if we have all needed information
+                 */
                if ( $fiche_def->Add($_POST) == 0 )
                {
                        echo $fiche_def->input_detail();
diff --git a/include/class_fiche_def.php b/include/class_fiche_def.php
index 3f06a16..ddf84f7 100644
--- a/include/class_fiche_def.php
+++ b/include/class_fiche_def.php
@@ -62,7 +62,7 @@ class Fiche_Def
                $fd_description=new ITextarea('fd_description');
                $fd_description->width=80;
                $fd_description->heigh=4;
-               $fd_description->style='style="vertical-align:text-top"';
+               $fd_description->style='class="itextarea" 
style="margin-left:0px;vertical-align:text-top"';
         require_once  NOALYSS_INCLUDE.'/template/fiche_def_input.php';
         return;
     }
@@ -197,10 +197,15 @@ $order
      */
     function Add($array)
     {
-        foreach ( $array as $key=>$element )
-        {
-            ${"p_$key"}=$element;
-        }
+        var_dump($array);
+        /** 
+         * Check needed info
+         */
+        $p_nom_mod = HtmlInput::default_value('nom_mod', "", $array);
+        $p_fd_description = HtmlInput::default_value('fd_description', "", 
$array);
+        $p_class_base= HtmlInput::default_value('class_base', "", $array);
+        $p_fiche_def= HtmlInput::default_value('FICHE_REF', "", $array);
+        $p_create= HtmlInput::default_value('create', "off", $array);
         
         // If there is no description then add a empty one
         if ( ! isset ($p_fd_description)) {
@@ -212,10 +217,16 @@ $order
 
         // Name can't be empty
         if ( strlen(trim($p_nom_mod)) == 0 )
-               {
-                       alert (_('Le nom de la catégorie ne peut pas être 
vide'));
+       {
+            alert (_('Le nom de la catégorie ne peut pas être vide'));
             return 1;
-               }
+       }
+        // $p_fiche_def can't be empty
+        if ( strlen(trim($p_fiche_def)) == 0 )
+       {
+            alert (_('Un modéle de catégorie est obligatoire'));
+            return 1;
+       }
         
         /* check if the cat. name already exists */
         $sql="select count(*) from fiche_Def where upper(fd_label)=upper($1)";
@@ -227,7 +238,7 @@ $order
                }
         // Set the value of fiche_def.fd_create_account
         // automatic creation for 'poste comptable'
-        if ( isset($p_create) && strlen(trim($p_class_base)) != 0)
+        if ( $p_create == "on" && strlen(trim($p_class_base)) != 0)
             $p_create='true';
         else
             $p_create='false';
@@ -239,7 +250,7 @@ $order
             $sql="insert into 
fiche_def(fd_label,fd_class_base,frd_id,fd_create_account,fd_description)
                  values ($1,$2,$3,$4,$5) returning fd_id";
 
-            
$fd_id=$this->cn->get_value($sql,array($p_nom_mod,$p_class_base,$p_FICHE_REF,$p_create,$p_fd_description));
+            
$fd_id=$this->cn->get_value($sql,array($p_nom_mod,$p_class_base,$p_fiche_def,$p_create,$p_fd_description));
 
             // p_class must be added to tmp_pcmn if it is a single accounting
             if ( strpos(',',$p_class_base) ==0)
@@ -261,7 +272,7 @@ $order
             $sql="insert into 
fiche_def(fd_label,frd_id,fd_create_account,fd_description) values 
($1,$2,$3,$4) returning fd_id";
 
 
-            
$this->id=$this->cn->get_value($sql,array($p_nom_mod,$p_FICHE_REF,$p_create,$p_fd_description));
+            
$this->id=$this->cn->get_value($sql,array($p_nom_mod,$p_fiche_def,$p_create,$p_fd_description));
 
             // Get the fd_id
             $fd_id=$this->cn->get_current_seq('s_fdef');
@@ -269,7 +280,7 @@ $order
         }
 
         // Get the default attr_def from attr_min
-        $def_attr=$this->get_attr_min($p_FICHE_REF);
+        $def_attr=$this->get_attr_min($p_fiche_def);
 
         //if defaut attr not null
         // build the sql insert for the table attr_def
diff --git a/include/template/fiche_def_input.php 
b/include/template/fiche_def_input.php
index 5b81f5c..b7291e7 100644
--- a/include/template/fiche_def_input.php
+++ b/include/template/fiche_def_input.php
@@ -22,19 +22,20 @@
 <TR>
 <TD colspan='2'> <INPUT TYPE="CHECKBOX" NAME="create" CHECKED><?php echo 
_("Création automatique du poste comptable uniquement s'il n'y a qu'un seul 
poste")?></TD>
 </TR>
+</table>
+<h2>Modèles de catégorie</h2>
+<ul>
 <?php
   if ( sizeof($ref)  ) {
     foreach ($ref as $i=>$v) { ?>
-<TR><TD style="width:auto" COLSPAN="2">
+    <li style="list-style-type: none">
 <?php echo $iradio->input("FICHE_REF",$v['frd_id']);
    echo $v['frd_text'];
    if ( sizeof ($v['frd_class_base']) != 0 )
           echo "&nbsp;&nbsp<I>Class base = ".$v['frd_class_base']."</I>";
-      echo "</TD></TR>";
 
-    }
-
-  }
+    }?>
+    </li>
+  <?php }
 ?>
-
-</TABLE>
+</UL>
\ No newline at end of file



reply via email to

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