phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r4363 - in phpcompta/trunk: html html/js include include


From: phpcompta-dev
Subject: [Phpcompta-dev] r4363 - in phpcompta/trunk: html html/js include include/template sql
Date: Tue, 15 Nov 2011 21:40:52 +0100 (CET)

Author: danydb
Date: 2011-11-15 21:40:50 +0100 (Tue, 15 Nov 2011)
New Revision: 4363

Added:
   phpcompta/trunk/include/ajax_update_payment.php
   phpcompta/trunk/include/ajax_update_predef.php
Removed:
   phpcompta/trunk/include/ajax_update_predef.php.php
Modified:
   phpcompta/trunk/html/ajax_misc.php
   phpcompta/trunk/html/js/acc_ledger.js
   phpcompta/trunk/html/style.css
   phpcompta/trunk/include/ac_common.php
   phpcompta/trunk/include/class_acc_ledger.php
   phpcompta/trunk/include/class_acc_ledger_purchase.php
   phpcompta/trunk/include/class_acc_ledger_sold.php
   phpcompta/trunk/include/class_acc_payment.php
   phpcompta/trunk/include/class_calendar.php
   phpcompta/trunk/include/payment_middle.inc.php
   phpcompta/trunk/include/template/new_mod_payment.php
   phpcompta/trunk/sql/
   phpcompta/trunk/sql/mode_paiement.sql
Log:

Fix small bugs + add payment method by ledger


Modified: phpcompta/trunk/html/ajax_misc.php
===================================================================
--- phpcompta/trunk/html/ajax_misc.php  2011-11-15 16:00:05 UTC (rev 4362)
+++ phpcompta/trunk/html/ajax_misc.php  2011-11-15 20:40:50 UTC (rev 4363)
@@ -531,4 +531,7 @@
         case 'upd_receipt':
                 require_once 'ajax_get_receipt.php';
                 break;
+        case 'up_pay_method':
+                require_once 'ajax_update_payment.php';
+                break;
 }
\ No newline at end of file

Modified: phpcompta/trunk/html/js/acc_ledger.js
===================================================================
--- phpcompta/trunk/html/js/acc_ledger.js       2011-11-15 16:00:05 UTC (rev 
4362)
+++ phpcompta/trunk/html/js/acc_ledger.js       2011-11-15 20:40:50 UTC (rev 
4363)
@@ -44,7 +44,32 @@
                    }
                );
 }
+
 /**
+* @brief update the list of payment method when we change the ledger.
+*/
+function update_pay_method()
+{
+       waiting_box();
+    var jrn=g("p_jrn").value;
+    var dossier=g("gDossier").value;
+    var querystring='gDossier='+dossier+'&l='+jrn+"&op=up_pay_method";
+    var action=new Ajax.Request(
+                   "ajax_misc.php",
+                   {
+                   method:'get',
+                   parameters:querystring,
+                   onFailure:error_get_predef,
+                   onSuccess:function(req){
+                                                                               
remove_waiting_box();
+                                                                               
var answer=req.responseText;
+                                                                               
$('payment').innerHTML=answer;
+                                                               }
+                   }
+               );
+}
+
+/**
  address@hidden update ctl id =jrn_name with the value of p_jrn
  */
 function update_name()

Modified: phpcompta/trunk/html/style.css
===================================================================
--- phpcompta/trunk/html/style.css      2011-11-15 16:00:05 UTC (rev 4362)
+++ phpcompta/trunk/html/style.css      2011-11-15 20:40:50 UTC (rev 4363)
@@ -13,7 +13,7 @@
         font-style: italic;
         }
 
-table.result  ,table.resultfooter {
+table.table_large, table.result  ,table.resultfooter {
   color:blue;
   /* border:blue solid 1px; */
   width:100%;
@@ -27,10 +27,10 @@
 
 
 }
-table.result th {
+table.table_large th,table.result th {
   font-weight:bold;
   font-family:helvetica,sans-serif;
- border-bottom:2px solid blue;
+ border-bottom:1px solid blue;
  border-top:0;
 
   color:#25238F;
@@ -931,7 +931,7 @@
              background-color:#e4e7ed;
 }
 
-table.result td
+table.table_large td, table.result td
 {
        padding-left:5px;
        padding-right:5px;
@@ -1044,4 +1044,8 @@
  background-color:blue;
  color:white;
  text-decoration:none
+}
+table.table_large tr.odd ,table.table_large tr.even {
+
+       height:32px;
 }
\ No newline at end of file

Modified: phpcompta/trunk/include/ac_common.php
===================================================================
--- phpcompta/trunk/include/ac_common.php       2011-11-15 16:00:05 UTC (rev 
4362)
+++ phpcompta/trunk/include/ac_common.php       2011-11-15 20:40:50 UTC (rev 
4363)
@@ -620,7 +620,7 @@
 function set_language()
 {
     // desactivate local check
-    if ( defined(LOCALE) && LOCALE==0 ) return;
+    if ( defined("LOCALE") && LOCALE==0 ) return;
     $dir = "";
     // set differently the language depending of the operating system
     if (what_os() == 1)

Added: phpcompta/trunk/include/ajax_update_payment.php
===================================================================
--- phpcompta/trunk/include/ajax_update_payment.php                             
(rev 0)
+++ phpcompta/trunk/include/ajax_update_payment.php     2011-11-15 20:40:50 UTC 
(rev 4363)
@@ -0,0 +1,32 @@
+<?php
+
+/*
+ *   This file is part of PhpCompta.
+ *
+ *   PhpCompta is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   PhpCompta is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with PhpCompta; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+/* $Revision$ */
+
+// Copyright Author Dany De Bontridder address@hidden
+
+/**
+ * @file
+ * @brief refresh the area with payment method
+ * -l for the ledger
+ */
+require_once 'class_acc_ledger.php';
+$ledger=new Acc_Ledger($cn,$l);
+echo $ledger->input_paid(1);
+?>

Copied: phpcompta/trunk/include/ajax_update_predef.php (from rev 4362, 
phpcompta/trunk/include/ajax_update_predef.php.php)
===================================================================
--- phpcompta/trunk/include/ajax_update_predef.php                              
(rev 0)
+++ phpcompta/trunk/include/ajax_update_predef.php      2011-11-15 20:40:50 UTC 
(rev 4363)
@@ -0,0 +1,68 @@
+<?php
+/*
+ *   This file is part of PhpCompta.
+ *
+ *   PhpCompta is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   PhpCompta is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with PhpCompta; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+/* $Revision$ */
+
+// Copyright Author Dany De Bontridder address@hidden
+
+/*!\file
+ * \brief respond ajax request, the get contains
+ *  the value :
+ * - l for ledger 
+ * - gDossier
+ * Must return at least tva, htva and tvac
+ */
+
+require_once ('constant.php');
+require_once ('class_database.php');
+require_once('class_dossier.php');
+require_once('class_pre_operation.php');
+// Check if the needed field does exist
+extract ($_GET);
+foreach (array('l','t','d','gDossier') as $a)
+{
+    if ( ! isset (${$a}) )
+    {
+        echo "error $a is not set ";
+        exit();
+    }
+
+}
+$cn=new Database(dossier::id());
+$op=new Pre_operation_detail($cn);
+$op->set('ledger',$l);
+$op->set('ledger_type',$t);
+$op->set('direct',$d);
+$array=$op->get_operation();
+$string='{"count":"'.count($array).'"';
+$idx=0;
+if (! empty($array))
+    foreach ($array as $a)
+{
+    $string.=',"value'.$idx.'":"'.$a['value'].'",';
+    $string.='"label'.$idx.'":"'.$a['label'].'"';
+    $idx++;
+}
+$string.="}";
+
+header("Content-type: text/json; charset: utf8",true);
+echo $string;
+
+
+?>
+

Deleted: phpcompta/trunk/include/ajax_update_predef.php.php
===================================================================
--- phpcompta/trunk/include/ajax_update_predef.php.php  2011-11-15 16:00:05 UTC 
(rev 4362)
+++ phpcompta/trunk/include/ajax_update_predef.php.php  2011-11-15 20:40:50 UTC 
(rev 4363)
@@ -1,68 +0,0 @@
-<?php
-/*
- *   This file is part of PhpCompta.
- *
- *   PhpCompta is free software; you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation; either version 2 of the License, or
- *   (at your option) any later version.
- *
- *   PhpCompta is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with PhpCompta; if not, write to the Free Software
- *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-/* $Revision$ */
-
-// Copyright Author Dany De Bontridder address@hidden
-
-/*!\file
- * \brief respond ajax request, the get contains
- *  the value :
- * - l for ledger 
- * - gDossier
- * Must return at least tva, htva and tvac
- */
-
-require_once ('constant.php');
-require_once ('class_database.php');
-require_once('class_dossier.php');
-require_once('class_pre_operation.php');
-// Check if the needed field does exist
-extract ($_GET);
-foreach (array('l','t','d','gDossier') as $a)
-{
-    if ( ! isset (${$a}) )
-    {
-        echo "error $a is not set ";
-        exit();
-    }
-
-}
-$cn=new Database(dossier::id());
-$op=new Pre_operation_detail($cn);
-$op->set('ledger',$l);
-$op->set('ledger_type',$t);
-$op->set('direct',$d);
-$array=$op->get_operation();
-$string='{"count":"'.count($array).'"';
-$idx=0;
-if (! empty($array))
-    foreach ($array as $a)
-{
-    $string.=',"value'.$idx.'":"'.$a['value'].'",';
-    $string.='"label'.$idx.'":"'.$a['label'].'"';
-    $idx++;
-}
-$string.="}";
-
-header("Content-type: text/json; charset: utf8",true);
-echo $string;
-
-
-?>
-

Modified: phpcompta/trunk/include/class_acc_ledger.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger.php        2011-11-15 16:00:05 UTC 
(rev 4362)
+++ phpcompta/trunk/include/class_acc_ledger.php        2011-11-15 20:40:50 UTC 
(rev 4363)
@@ -42,6 +42,7 @@
 require_once('class_lettering.php');
 require_once 'class_sort_table.php';
 require_once 'class_jrn_def_sql.php';
+require_once 'class_acc_payment.php';
 /*!\file
 * \brief Class for jrn,  class acc_ledger for manipulating the ledger
 */
@@ -3222,6 +3223,22 @@
                        
$Res=$this->db->alter_seq("s_jrn_pj".$p_jrn,$jrn_def_pj_seq);
                }
        }
+       function input_paid($nofieldset=0)
+    {
+        $r='';
+               if ( $nofieldset==0)
+               {
+                       $r.='<fieldset id="payment"> ';
+               }
+        $r.='<legend> '._('Payé par').' </legend>';
+        $mp=new Acc_Payment($this->db);
+        $mp->set_parameter('ledger_source',$this->id);
+        $r.=$mp->select();
+        if ( $nofieldset==0)
+                       $r.='</fieldset>';
+        return $r;
+    }
+
        /**
         * display screen to enter a new ledger
         */

Modified: phpcompta/trunk/include/class_acc_ledger_purchase.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger_purchase.php       2011-11-15 
16:00:05 UTC (rev 4362)
+++ phpcompta/trunk/include/class_acc_ledger_purchase.php       2011-11-15 
20:40:50 UTC (rev 4363)
@@ -968,7 +968,9 @@
         }
         $add_js.='get_last_date();';
                $add_js.='update_name();';
-        $wLedger=$this->select_ledger('ACH',2);
+               $add_js.='update_pay_method()';
+
+               $wLedger=$this->select_ledger('ACH',2);
         if ($wLedger == null) exit (_('Pas de journal disponible'));
         $wLedger->javascript="onChange='update_predef(\"ach\",\"f\");$add_js'";
         $label=" Journal ".HtmlInput::infobulle(2) ;
@@ -1210,17 +1212,6 @@
         }
         return $r;
     }
-    function input_paid()
-    {
-        $r='';
-        $r.='<fieldset>';
-        $r.='<legend> '._('Payé par').' </legend>';
-        $mp=new Acc_Payment($this->db);
-        $mp->set_parameter('ledger_source',$this->id);
-        $r.=$mp->select();
-        $r.='</fieldset>';
-        return $r;
-    }
 
     /address@hidden show the summary of the operation and propose to save it
      address@hidden array contains normally $_POST. It proposes also to save

Modified: phpcompta/trunk/include/class_acc_ledger_sold.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger_sold.php   2011-11-15 16:00:05 UTC 
(rev 4362)
+++ phpcompta/trunk/include/class_acc_ledger_sold.php   2011-11-15 20:40:50 UTC 
(rev 4363)
@@ -1048,6 +1048,7 @@
         }
         $add_js.='get_last_date();';
                $add_js.='update_name();';
+               $add_js.='update_pay_method()';
 
         $wLedger=$this->select_ledger('VEN',2);
         if ( $wLedger == null )
@@ -1283,18 +1284,7 @@
         $r.="</DIV>";
         return $r;
     }
-    function input_paid()
-    {
-        $r='';
-        $r.='<fieldset>';
-        $r.='<legend> '._('Payé par').' </legend>';
-        $mp=new Acc_Payment($this->db);
-        $mp->set_parameter('ledger_source',$this->id);
-        $r.=$mp->select();
-        $r.='</fieldset>';
-        return $r;
-    }
-
+ 
     /*!\brief test function
      */
     static function test_me($p_string='')

Modified: phpcompta/trunk/include/class_acc_payment.php
===================================================================
--- phpcompta/trunk/include/class_acc_payment.php       2011-11-15 16:00:05 UTC 
(rev 4362)
+++ phpcompta/trunk/include/class_acc_payment.php       2011-11-15 20:40:50 UTC 
(rev 4363)
@@ -222,7 +222,7 @@
         }
         return $ret;
     }
-    public function row()
+    public function row_deprecated()
     {
         
//---------------------------------------------------------------------------
         // Common variable
@@ -240,7 +240,7 @@
                     array($this->jrn_def_id));
         }
         $r.=td($this->mp_lib);
-        
+
         if ( $this->mp_fd_id != NULL && $this->mp_fd_id !=0)
         {
             $fiche=new Fiche_Def($this->cn,$this->mp_fd_id);
@@ -264,57 +264,51 @@
     }
     /*!\brief return a string with a form (into a table)
      *\param none
-     *\return a html string 
+     *\return a html string
      */
     public function form()
     {
-        $td='<TD>';
-        $etd='</td>';
-        $tr='<tr>';
-        $etr='</tr>';
-        $th='<th>';
-        $eth='</th>';
-        $r='';
-        $r.=HtmlInput::hidden('id',$this->mp_id);
-        $r.=HtmlInput::hidden('jrn_def_id',$this->jrn_def_id);
-        $r.='<table>';
-        $r.=$tr.$td.'Libell&eacute;'.$etd;
-        $r.=$td;
-        $r.=$this->mp_lib;
-        $r.=$etd.$etr;
-        $r.=$tr.$td;
-        $r.='Type de fiche '.$etd;
-        $array=$this->cn->make_array('select fd_id,fd_label from fiche_def 
join fiche_def_ref '.
-                                     ' using (frd_id) where frd_id in (25,4) 
order by fd_label');
-        $fd=new ISelect();
-        $fd->name='mp_fd_id';
-        $fd->value=$array;
-        $fd->selected=$this->mp_fd_id;
-        $r.=$td.$fd->input();
-        $r.=$etd;
-        $r.=$tr.$td.'Enregistre dans le journal '.$etd;
-        $array=$this->cn->make_array('select jrn_def_id,jrn_def_name from '.
-                                     ' jrn_def where jrn_def_type = \'ODS\' or 
jrn_def_type=\'FIN\'');
-        $jrn=new ISelect();
-        $jrn->value=$array;
-        $jrn->name='mp_jrn_def_id';
-        $jrn->selected=(isset ($this->mp_jrn_def_id))?$this->mp_jrn_def_id:0;
-        $r.=$td.$jrn->input().$etd;
-        $r.=$etr.$tr;
-        $r.=$td.'Avec la fiche'.$etd;
-        $f=new ICard();
-        $f->jrn=$jrn->selected;
-        $f->noadd=true;
-        $f->name='mp_qcode';
+       //label
+        $lib=new IText('mp_lib');
+        $lib->value=$this->mp_lib;
+               $f_lib=$lib->input();
+
+
+        $ledger_source=new ISelect('jrn_def_id');
+        $ledger_source->value=$this->cn->make_array("select 
jrn_def_id,jrn_Def_name from
+                              jrn_def where jrn_def_type  in ('ACH','VEN') 
order by jrn_def_name");
+               $ledger_source->selected=$this->jrn_def_id;
+        $f_source=$ledger_source->input();
+
+        // type of card
+        $tcard=new ISelect('mp_fd_id');
+        $tcard->value=$this->cn->make_array('select fd_id,fd_label from 
fiche_def join fiche_def_ref '.
+                                            ' using (frd_id) where frd_id in 
(25,4) order by fd_label');
+               $tcard->selected=$this->mp_fd_id;
+
+        $f_type_fiche=$tcard->input();
+        $ledger_record=new ISelect('mp_jrn_def_id');
+        $ledger_record->value=$this->cn->make_array("select 
jrn_def_id,jrn_Def_name from
+                              jrn_def where jrn_def_type  in ('ODS','FIN')");
+               $ledger_record->selected=$this->mp_jrn_def_id;
+        $f_ledger_record=$ledger_record->input();
+
+        // the card
+        $qcode=new ICard();
+        $qcode->noadd=true;
+        $qcode->name='mp_qcode';
         $list=$this->cn->make_list('select fd_id from fiche_def where frd_id 
in (25,4)');
-        $f->typecard=$list;
-       $f->dblclick='fill_ipopcard(this);';
-        $f->extra2=_('Recherche');
-        $f->value=(isset($this->mp_qcode))?$this->mp_qcode:'';
-        $r.=$td.$f->input().$etd;
-        $s=new ISpan();
-        $r.=$td.$s->input('mp_qcode_label');
-        $r.='</table>';
+        $qcode->typecard=$list;
+               $qcode->dblclick='fill_ipopcard(this);';
+               $qcode->value=$this->mp_qcode;
+
+        $f_qcode=$qcode->input();
+
+               $msg="Modification de ".$this->mp_lib;
+        ob_start();
+        require_once('template/new_mod_payment.php');
+        $r=ob_get_contents();
+        ob_end_clean();
         return $r;
 
     }
@@ -395,7 +389,7 @@
         $ledger_source->value=$this->cn->make_array("select 
jrn_def_id,jrn_Def_name from
                               jrn_def where jrn_def_type  in ('ACH','VEN') 
order by jrn_def_name");
         $f_source=$ledger_source->input();
-        
+
         // type of card
         $tcard=new ISelect('mp_fd_id');
         $tcard->value=$this->cn->make_array('select fd_id,fd_label from 
fiche_def join fiche_def_ref '.
@@ -412,9 +406,10 @@
         $qcode->name='mp_qcode';
         $list=$this->cn->make_list('select fd_id from fiche_def where frd_id 
in (25,4)');
         $qcode->typecard=$list;
-       $qcode->dblclick='fill_ipopcard(this);';
+               $qcode->dblclick='fill_ipopcard(this);';
 
         $f_qcode=$qcode->input();
+               $msg="Ajout d'un nouveau moyen de paiement";
         ob_start();
         require_once('template/new_mod_payment.php');
         $r=ob_get_contents();

Modified: phpcompta/trunk/include/class_calendar.php
===================================================================
--- phpcompta/trunk/include/class_calendar.php  2011-11-15 16:00:05 UTC (rev 
4362)
+++ phpcompta/trunk/include/class_calendar.php  2011-11-15 20:40:50 UTC (rev 
4363)
@@ -137,18 +137,18 @@
         $cn=new Database(dossier::id());
         $today=date('d.m.Y');
         $p_id=$cn->get_value("
-                select p_id from parm_periode 
-                where 
+                select p_id from parm_periode
+                where
                 p_start <= to_date($1,'DD.MM.YYYY')
-                and 
+                and
                 p_end >= to_date($1,'DD.MM.YYYY')",
                 array($today));
         if ( $p_id == '')
         {
             $user=new User($cn);
-            $this->default_periode=$user->get_periode();
-            $p_id=$this->default_periode;
+            $p_id=$user->get_periode();
         }
+               $this->default_periode=$p_id;
         return  $p_id;
     }
     /**

Modified: phpcompta/trunk/include/payment_middle.inc.php
===================================================================
--- phpcompta/trunk/include/payment_middle.inc.php      2011-11-15 16:00:05 UTC 
(rev 4362)
+++ phpcompta/trunk/include/payment_middle.inc.php      2011-11-15 20:40:50 UTC 
(rev 4363)
@@ -20,7 +20,7 @@
 
 // Copyright Author Dany De Bontridder address@hidden
 require_once('class_acc_payment.php');
-
+require_once 'class_sort_table.php';
 //---------------------------------------------------------------------------
 // Common variable
 $td='<TD>';
@@ -46,18 +46,15 @@
     $javascript="return confirm('"._('Vous confirmez')."')";
     echo '<form method="post" onsubmit="'.$javascript.'">';
     echo dossier::hidden();
-    echo HtmlInput::hidden('p_jrn',0);
-    echo HtmlInput::hidden('p_action','divers');
     echo HtmlInput::hidden('sa','mp');
     echo HtmlInput::hidden('sb','save');
-    echo HtmlInput::hidden('jrn_def_id',$row->get_parameter('ledger_source'));
-    echo HtmlInput::hidden('mp_lib',$row->get_parameter('lib'));
+    echo HtmlInput::hidden('id',$row->get_parameter("id"));
 
     echo $row->form();
     echo HtmlInput::submit('save',_('Sauve'));
     echo HtmlInput::submit('delete',_('Efface'));
-    echo HtmlInput::button_anchor(_('Retour sans sauvez'),
-                                  '?p_action=divers&sa=mp&'.dossier::get()
+    echo HtmlInput::button_anchor(_('Retour sans sauver'),
+                                  
'?p_action=divers&sa=mp&'.dossier::get()."&ac=".$_REQUEST['ac']
                                      );
     echo '</form>';
     exit();
@@ -82,60 +79,71 @@
     $row->delete();
 }
 //---------------------------------------------------------------------------
+// Insert a new mod of payment
+//---------------------------------------------------------------------------
+if ( isset($_POST['insert']))
+{
+    $row=new Acc_Payment($cn);
+    $row->from_array($_POST);
+    $row->insert();
+       $sb="list";
+}
+
+//---------------------------------------------------------------------------
 // Show form to enter a new one
 //---------------------------------------------------------------------------
 if ($sb=='ins')
 {
     $mp=new Acc_Payment($cn);
     $r=$mp->blank();
-    echo '<form method="POST">';
-    echo dossier::hidden().HtmlInput::hidden('sa',$_REQUEST['sa']).
+    echo '<form method="POST" onsubmit="return confirm(\'Vous confirmez 
?\')">';
+    echo dossier::hidden();
        
HtmlInput::hidden('ac',$_REQUEST['ac']).HtmlInput::hidden('sb','insert');
     echo $r;
     echo HtmlInput::submit('insert',_('Enregistre'));
     echo '</form>';
-    echo HtmlInput::button_anchor(_('Retour sans sauvez'),
+    echo HtmlInput::button_anchor(_('Retour sans sauver'),
                                   
'?p_action=divers&sa=mp&'.dossier::get()."&ac=".$_REQUEST['ac']
                                      );
 
     exit();
 }
-//---------------------------------------------------------------------------
-// Insert a new mod of payment
-//---------------------------------------------------------------------------
-if ( $sb=='insert')
-{
-    $row=new Acc_Payment($cn);
-    $row->from_array($_POST);
-    $row->insert();
-}
-//----------------------------------------------------------------------
-// LEDGER PURCHASE
-//----------------------------------------------------------------------
+//--------------------------------------------------------------------------------
+//LIST
+//--------------------------------------------------------------------------------
+/* Get the data from database */
+$header=new Sort_Table();
+$base_url=$_SERVER['PHP_SELF']."?".Dossier::get()."&ac=".$_REQUEST['ac'];
 
-echo '<fieldset>';
-echo '<legend>Journaux </legend>';
-/* Get the data from database */
-$mp=new Acc_Payment($cn);
-$array=$mp->get_all();
+$header->add("Libelle",$base_url,"order by mp_lib asc","order by mp_lib 
desc",'la','ld');
+$header->add("Pour le journal",$base_url,"order by jrn_def_name asc","order by 
jrn_def_name  desc",'ja','jd');
+$header->add("Type de fiche",$base_url,"order by fd_label asc","order by 
fd_label desc",'tc','td');
+$header->add("Enregistré dans le journal",$base_url,"order by jrn_target 
asc","order by jrn_target desc",'jta','jtd');
+$header->add("Avec la fiche",$base_url,"order by vw_name asc","order by 
vw_name desc",'na','nd');
+
+$order=(isset($_REQUEST['ord']))?$_REQUEST['ord']:'la';
+
+$sql=$header->get_sql_order($order);
+
+$array=$cn->get_array("
+       select
+                       
mp_id,mp_lib,mp_jrn_def_id,mp_fd_id,mp_qcode,j.jrn_def_id,
+                       j.jrn_def_name as jrn_def_name,
+                       j2.jrn_def_name as jrn_target,
+                       fd_label,
+                       coalesce(mp_qcode,'A choisir à l''encodage') as vw_name
+                       from mod_payment as mp
+                       left join jrn_def as j on (j.jrn_def_id=mp.jrn_def_id)
+                       left join jrn_def as j2 on 
(j2.jrn_def_id=mp.mp_jrn_def_id)
+                       left join fiche_def as fd on (mp.mp_fd_id=fd.fd_id)
+                       $sql
+       ");
 /* if there are data show them in a table */
 if ( ! empty ($array))
 {
-    echo '<table >';
-    echo $tr.$th._('Libellé').$eth.$th._('Type de fiche')
-    .$eth.$th._('enregistré dans le journal').$eth.
-    $th._(' Avec la fiche').$eth.$th.'Action'.$eth.$etr;
-    foreach ($array as $row)
-    {
-        echo $tr;
-        echo $row->row();
-        echo 
$td.HtmlInput::button_anchor(_('Modifie'),'?ac='.$_REQUEST['ac'].'&sa=mp&sb=change&'.dossier::get().
-                                              
'&id='.$row->get_parameter('id'));
-        echo $etr;
 
-    }
-    echo '</table>';
+       require_once 'template/list_mod_payment.php';
+       echo HtmlInput::button_anchor("Ajout", $base_url."&sb=ins");
 }
-echo '</fieldset>';
 echo '</div>';
 ?>

Modified: phpcompta/trunk/include/template/new_mod_payment.php
===================================================================
--- phpcompta/trunk/include/template/new_mod_payment.php        2011-11-15 
16:00:05 UTC (rev 4362)
+++ phpcompta/trunk/include/template/new_mod_payment.php        2011-11-15 
20:40:50 UTC (rev 4363)
@@ -1,5 +1,5 @@
 <fieldset>
-<legend><?=_('Nouveau moyen de paiement')?>
+<legend><?=$msg?>
 </legend>
 <table>
 <tr>


Property changes on: phpcompta/trunk/sql
___________________________________________________________________
Name: svn:ignore
   - .upgrade.sql.swp
.object-6.0.sql.swp
.backup-new-object.sh.swp

   + .upgrade.sql.swp
.object-6.0.sql.swp
.backup-new-object.sh.swp
.mode_paiement.sql.swp


Modified: phpcompta/trunk/sql/mode_paiement.sql
===================================================================
--- phpcompta/trunk/sql/mode_paiement.sql       2011-11-15 16:00:05 UTC (rev 
4362)
+++ phpcompta/trunk/sql/mode_paiement.sql       2011-11-15 20:40:50 UTC (rev 
4363)
@@ -8,6 +8,6 @@
 alter table mod_payment drop mp_type;
 
 
-alter table mod_payment add constraint foreign key (jrn_def_id) references 
jrn_def(jrn_def_id);
+alter table mod_payment add constraint mod_payment_jrn_def_id_fk foreign key 
(jrn_def_id) references jrn_def(jrn_def_id) on delete cascade on update cascade;
 
 comment on column mod_payment.jrn_def_id is 'Ledger using this payment method';




reply via email to

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