phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r5451 - phpcompta/trunk/include


From: phpcompta-dev
Subject: [Phpcompta-dev] r5451 - phpcompta/trunk/include
Date: Tue, 1 Oct 2013 16:12:45 +0200 (CEST)

Author: danydb
Date: 2013-10-01 16:12:44 +0200 (Tue, 01 Oct 2013)
New Revision: 5451

Modified:
   phpcompta/trunk/include/ajax_mod_predf_op.php
   phpcompta/trunk/include/class_acc_ledger.php
   phpcompta/trunk/include/class_pre_op_ach.php
   phpcompta/trunk/include/class_pre_operation.php
   phpcompta/trunk/include/compta_ach.inc.php
   phpcompta/trunk/include/compta_ven.inc.php
   phpcompta/trunk/include/operation_ods_confirm.inc.php
   phpcompta/trunk/include/preod.inc.php
Log:
Add description to the predefined operation

Modified: phpcompta/trunk/include/ajax_mod_predf_op.php
===================================================================
--- phpcompta/trunk/include/ajax_mod_predf_op.php       2013-09-29 17:47:15 UTC 
(rev 5450)
+++ phpcompta/trunk/include/ajax_mod_predf_op.php       2013-10-01 14:12:44 UTC 
(rev 5451)
@@ -38,6 +38,13 @@
 $name->value = $op->od_name;
 $name->size = 60;
 echo "Nom =" . $name->input();
+$opd_description=new ITextarea('od_description');
+$opd_description->style=' class="itextarea" 
style="width:30em;height:4em;vertical-align:top"';
+$opd_description->value=$op->od_description;
+echo '<p>';
+echo "Description (max 50 car.)";
+echo $opd_description->input();
+echo '</p>';
 echo dossier::hidden() . HtmlInput::hidden('od_id', $_GET['id']);
 echo "<hr>";
 //////////////////////////////////////////////////////////////////////////////

Modified: phpcompta/trunk/include/class_acc_ledger.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger.php        2013-09-29 17:47:15 UTC 
(rev 5450)
+++ phpcompta/trunk/include/class_acc_ledger.php        2013-10-01 14:12:44 UTC 
(rev 5451)
@@ -2090,8 +2090,7 @@
                        $this->internal = $internal;
                        // Save now the predef op
                        //------------------------
-                       if (isset($opd_save))
-                       {
+                        if (isset ($opd_name)){
                                $opd = new Pre_Op_Advanced($this->db);
                                $opd->get_post();
                                $opd->save();

Modified: phpcompta/trunk/include/class_pre_op_ach.php
===================================================================
--- phpcompta/trunk/include/class_pre_op_ach.php        2013-09-29 17:47:15 UTC 
(rev 5450)
+++ phpcompta/trunk/include/class_pre_op_ach.php        2013-10-01 14:12:44 UTC 
(rev 5451)
@@ -128,7 +128,9 @@
         }
         return $array;
     }
-    /*!\brief load the data from the database and return an array
+    /**
+     * @brief 
+     * load the data from the database and return an array
      * \return an array
      */
     function load()
@@ -146,7 +148,7 @@
     }
    function display($p_array)
    {
-          require_once('class_acc_ledger_purchase.php');
+        require_once('class_acc_ledger_purchase.php');
        global $g_parameter,$g_user;
        extract($p_array);
        $ledger=new Acc_Ledger_Purchase($this->db,$this->jrn_def_id);

Modified: phpcompta/trunk/include/class_pre_operation.php
===================================================================
--- phpcompta/trunk/include/class_pre_operation.php     2013-09-29 17:47:15 UTC 
(rev 5450)
+++ phpcompta/trunk/include/class_pre_operation.php     2013-10-01 14:12:44 UTC 
(rev 5451)
@@ -47,17 +47,38 @@
         $this->od_direct='false';
         $this->od_id=$p_id;
     }
+    /**
+     * @brief Propose to save the operation into a predefined operation
+     * @return HTML  string
+     */
+    static function save_propose() {
+        $r="<h2>Modèle d'opération</h2>";
+        $r.= '<p class="decale">';
+        $r.= "Donnez un nom pour sauver cette opération comme modèle <br>";
+        $opd_name = new IText('opd_name');
+        $r.= "Nom du modèle " . $opd_name->input();
+        $opd_description=new ITextarea('od_description');
+        $opd_description->style=' class="itextarea" 
style="width:30em;height:4em;vertical-align:top"';
+        $r.='</p>';
+        $r.= '<p class="decale">';
+        $r.= 'Description (max 50 car.)';   
+        $r.='<br>';
+        $r.=$opd_description->input();
+        $r.='</p>';
+        return $r;
+    }
+
     /*!\brief fill the object with the $_POST variable */
     function get_post()
     {
         $this->nb_item=$_POST['nb_item'];
         $this->p_jrn=$_REQUEST['p_jrn'];
         $this->jrn_type=$_POST['jrn_type'];
-
+        
        $this->name=$_POST['opd_name'];
 
         $this->name=(trim($this->name)=='')?$_POST['e_comm']:$this->name;
-
+        $this->description=  $_POST['od_description'];
         if ( $this->name=="")
         {
             $n=$this->db->get_next_seq('op_def_op_seq');
@@ -89,15 +110,16 @@
             echo '<span class="notice">Vous avez atteint le max. 
d\'op&eacute;ration pr&eacute;d&eacute;finie, d&eacute;sol&eacute;</span>';
             return false;
         }
-        $sql=sprintf('insert into op_predef 
(jrn_def_id,od_name,od_item,od_jrn_type,od_direct)'.
+        $sql='insert into op_predef 
(jrn_def_id,od_name,od_item,od_jrn_type,od_direct,od_description)'.
                      'values'.
-                     "(%d,'%s',%d,'%s','%s')",
-                     $this->p_jrn,
-                     Database::escape_string($this->name),
+                     "($1,$2,$3,$4,$5  ,$6               )";
+        $this->db->exec_sql($sql,array($this->p_jrn,
+                     $this->name,
                      $this->nb_item,
                      $this->jrn_type,
-                     $this->od_direct);
-        $this->db->exec_sql($sql);
+                     $this->od_direct,
+                     $this->description,
+            ));
         $this->od_id=$this->db->get_current_seq('op_def_op_seq');
         return true;
     }
@@ -106,12 +128,12 @@
      */
     function load()
     {
-        $sql="select od_id,jrn_def_id,od_name,od_item,od_jrn_type".
+        $sql="select 
od_id,jrn_def_id,od_name,od_item,od_jrn_type,od_description".
              " from op_predef where od_id=".$this->od_id.
              " order by od_name";
         $res=$this->db->exec_sql($sql);
         $array=Database::fetch_all($res);
-        foreach (array('jrn_def_id','od_name','od_item','od_jrn_type') as 
$field) {
+        foreach 
(array('jrn_def_id','od_name','od_item','od_jrn_type','od_description') as 
$field) {
             $this->$field=$array[0][$field];
         }
         switch ($this->od_jrn_type) {
@@ -139,7 +161,8 @@
                    "e_comm"=>$p_array[0]["od_name"],
                    
"nb_item"=>(($p_array[0]["od_item"]<10?10:$p_array[0]["od_item"]))   ,
                    "p_jrn"=>$p_array[0]["jrn_def_id"],
-                   "jrn_type"=>$p_array[0]["od_jrn_type"]
+                   "jrn_type"=>$p_array[0]["od_jrn_type"],
+                   "od_description"=>$p_array['0']['od_description']
                );
         return $array;
 
@@ -175,7 +198,7 @@
      */
     function get_list_ledger()
     {
-        $sql="select od_id,od_name from op_predef ".
+        $sql="select od_id,od_name,od_description from op_predef ".
              " where jrn_def_id=".$this->p_jrn.
              " and od_direct ='".$this->od_direct."'".
              " order by od_name";
@@ -246,7 +269,15 @@
     /*!\brief show the button for selecting a predefined operation */
     function show_button($p_url)
     {
-        $value=$this->get_operation();
+        
+        
+        $value=$this->db->get_array("select od_id,od_name,od_description from 
op_predef ".
+                                     " where jrn_def_id=$1".
+                                     " and od_direct =$2".
+                                     " order by 
od_name",array($this->jrn_def_id,$this->od_direct ));
+        
+        if ( $this->jrn_def_id=='') $value=array();
+        
         $r="";
         $r.='<h2>Choississez un modèle</h2>';
         $r.='Filtrer '.HtmlInput::filter_table('modele_op_tab', '0', '0');
@@ -254,8 +285,9 @@
         for ($i=0;$i<count($value);$i++) {
             $r.='<tr class="'.(($i%2==0)?"even":"odd").'">';
             $r.='<td>';
-            $r.=sprintf('<a href="%s&pre_def=%s" 
onclick="waiting_box()">%s</a>',$p_url,$value[$i]['value'],$value[$i]['label']);
+            $r.=sprintf('<a href="%s&pre_def=%s" 
onclick="waiting_box()">%s</a> 
',$p_url,$value[$i]['od_id'],$value[$i]['od_name']);
             $r.='</td>';
+            $r.='<td>'.h($value[$i]['od_description']).'</td>';
             $r.='</tr>';
         }
         $r.='</table>';

Modified: phpcompta/trunk/include/compta_ach.inc.php
===================================================================
--- phpcompta/trunk/include/compta_ach.inc.php  2013-09-29 17:47:15 UTC (rev 
5450)
+++ phpcompta/trunk/include/compta_ach.inc.php  2013-10-01 14:12:44 UTC (rev 
5451)
@@ -73,12 +73,7 @@
                echo HtmlInput::hidden('ac', $_REQUEST['ac']);
                echo '<div style="clear:both">';
 
-                echo "<h2>Modèle d'opération</h2>";
-                echo '<p class="decale">';
-                echo "Donnez un nom pour sauver cette opération comme modèle 
<br>";
-               $opd_name = new IText('opd_name');
-               echo "Nom du modèle " . $opd_name->input();
-                echo '</p>';
+                echo Pre_operation::save_propose();
                 echo '</div>';
                echo HtmlInput::submit("record", _("Enregistrement"), 
'onClick="return verify_ca(\'\');"');
                echo HtmlInput::submit('correct', _("Corriger"));

Modified: phpcompta/trunk/include/compta_ven.inc.php
===================================================================
--- phpcompta/trunk/include/compta_ven.inc.php  2013-09-29 17:47:15 UTC (rev 
5450)
+++ phpcompta/trunk/include/compta_ven.inc.php  2013-10-01 14:12:44 UTC (rev 
5451)
@@ -81,12 +81,7 @@
                        echo HtmlInput::hidden('ac',$_REQUEST['ac']);
            echo '<div style="clear:both">';
             
-            echo "<h2>Modèle d'opération</h2>";
-            echo '<p class="decale">';
-            echo "Donnez un nom pour sauver cette opération comme modèle <br>";
-           $opd_name=new IText('opd_name');
-           echo "Nom du modèle ".$opd_name->input();
-            echo '</p>';
+            echo Pre_operation::save_propose();
            echo '</div>';
            echo HtmlInput::hidden('ac',$_REQUEST['ac']);
             echo 
HtmlInput::submit("record",_("Enregistrement"),'onClick="return 
verify_ca(\'\');"');

Modified: phpcompta/trunk/include/operation_ods_confirm.inc.php
===================================================================
--- phpcompta/trunk/include/operation_ods_confirm.inc.php       2013-09-29 
17:47:15 UTC (rev 5450)
+++ phpcompta/trunk/include/operation_ods_confirm.inc.php       2013-10-01 
14:12:44 UTC (rev 5451)
@@ -39,13 +39,7 @@
 echo $ledger->confirm($_POST,false);
 
 echo '<hr>';
-$chk=new ICheckBox();
-$chk->selected=false;
-echo $chk->input('opd_save');
-echo "Sauvez cette op&eacute;ration comme modèle d'opération ?";
-echo '<br/>';
-$opd_name=new IText('opd_name');
-echo "Nom du modèle ".$opd_name->input();
+echo Pre_operation::save_propose();
 echo '<hr>';
 echo HtmlInput::submit("save","Confirmer");
 echo HtmlInput::submit("correct","Corriger");

Modified: phpcompta/trunk/include/preod.inc.php
===================================================================
--- phpcompta/trunk/include/preod.inc.php       2013-09-29 17:47:15 UTC (rev 
5450)
+++ phpcompta/trunk/include/preod.inc.php       2013-10-01 14:12:44 UTC (rev 
5451)
@@ -88,6 +88,7 @@
       $count++;
 
         echo '<td>'.h($row['od_name']).'</td>';
+        echo '<td>'.h($row['od_description']).'</td>';
         echo '<td>';
        echo '<form method="POST" style="margin:0;padding:0">';
         echo dossier::hidden();



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