phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r5290 - in phpcompta/trunk: html html/admin/sql/patch ht


From: phpcompta-dev
Subject: [Phpcompta-dev] r5290 - in phpcompta/trunk: html html/admin/sql/patch html/js include include/template
Date: Sun, 19 May 2013 22:48:18 +0200 (CEST)

Author: danydb
Date: 2013-05-19 22:48:17 +0200 (Sun, 19 May 2013)
New Revision: 5290

Added:
   phpcompta/trunk/include/ajax_min_row.php
Modified:
   phpcompta/trunk/html/admin/sql/patch/upgrade106.sql
   phpcompta/trunk/html/ajax_misc.php
   phpcompta/trunk/html/js/acc_ledger.js
   phpcompta/trunk/html/js/scripts.js
   phpcompta/trunk/include/class_acc_ledger.php
   phpcompta/trunk/include/class_acc_ledger_fin.php
   phpcompta/trunk/include/class_acc_ledger_purchase.php
   phpcompta/trunk/include/class_acc_ledger_sold.php
   phpcompta/trunk/include/constant.php
   phpcompta/trunk/include/template/param_jrn.php
Log:
task #0000804: Nombre de ligne par d?\195?\169faut

Nombre de ligne MAX_ARTICLE est ?\195?\160 5 : impacte les actions

Modified: phpcompta/trunk/html/admin/sql/patch/upgrade106.sql
===================================================================
--- phpcompta/trunk/html/admin/sql/patch/upgrade106.sql 2013-05-19 18:59:29 UTC 
(rev 5289)
+++ phpcompta/trunk/html/admin/sql/patch/upgrade106.sql 2013-05-19 20:48:17 UTC 
(rev 5290)
@@ -11,6 +11,8 @@
 update fiche_def set fd_description='Catégorie qui contient la liste des 
fournisseurs' where fd_id=4;
 update fiche_def set fd_label='Services & Biens 
Divers',fd_description='Catégorie qui contient la liste des charges diverses' 
where fd_id=5;
 update fiche_def set fd_description='Catégorie qui contient la liste des 
prestations, marchandises... que l''on vend ' where fd_id=6;
+
+update jrn_def set jrn_deb_max_line=5 where jrn_deb_max_line is null;
 update version set val=107;
 
 commit;

Modified: phpcompta/trunk/html/ajax_misc.php
===================================================================
--- phpcompta/trunk/html/ajax_misc.php  2013-05-19 18:59:29 UTC (rev 5289)
+++ phpcompta/trunk/html/ajax_misc.php  2013-05-19 20:48:17 UTC (rev 5290)
@@ -569,6 +569,9 @@
        case 'vw_action':
                require_once 'ajax_view_action.php';
                break;
+       case 'minrow':
+               require_once 'ajax_min_row.php';
+               break;
        default:
                var_dump($_GET);
 }

Modified: phpcompta/trunk/html/js/acc_ledger.js
===================================================================
--- phpcompta/trunk/html/js/acc_ledger.js       2013-05-19 18:59:29 UTC (rev 
5289)
+++ phpcompta/trunk/html/js/acc_ledger.js       2013-05-19 20:48:17 UTC (rev 
5290)
@@ -141,6 +141,66 @@
 
 }
 /**
+ *ask the name, quick_code of the bank for the ledger
+ */
+function update_row(ctl)
+{
+       try
+       {
+    var jrn=g('p_jrn').value;
+    var dossier=g('gDossier').value;
+    var qs='gDossier='+dossier+'&op=minrow&j='+jrn+'&ctl='+ctl;
+       console.log(qs);
+    var action=new Ajax.Request(
+                   "ajax_misc.php",
+                   {
+                   method:'get',
+                   parameters:qs,
+                   onFailure:null,
+                   onSuccess:function(request,json)
+                                               {
+                                                       try {
+                                                               var 
answer=request.responseText.evalJSON(true);
+                                                               var 
row=parseFloat(answer.row);
+                                                               var 
current_row=parseFloat($('nb_item').value);
+                                                               
info_message("avant "+$('nb_item').value+"Maintenant "+row);
+                                                               if ( 
current_row > row ) {
+                                                                       // Too 
many row
+                                                                       var 
delta=$('nb_item').value-row;
+                                                                       var 
idx=$('nb_item').value;
+                                                                       
console.log("delta "+delta);
+                                                                       
console.log("idx"+idx);
+                                                                       for 
(var i=0;i<delta;i++){
+                                                                               
$(ctl).deleteRow(-1);
+                                                                               
console.log("remove "+idx)
+                                                                               
idx--;
+                                                                       }
+                                                                       
$('nb_item').value=row;
+                                                               }
+                                                               if (current_row 
< row) {
+                                                                       // We 
need to add rows
+                                                                               
var delta=row-current_row;
+                                                                               
for (var i =0;i<delta;i++) {
+                                                                               
        if ( ctl=='fin_item') {
+                                                                               
                ledger_fin_add_row();
+                                                                               
        }
+                                                                               
        if ( ctl=='sold_item'){
+                                                                               
                ledger_add_row();
+                                                                               
        }
+                                                                               
        if (ctl=='quick_item'){
+                                                                               
                quick_writing_add_row();
+                                                                               
        }
+                                                                               
}
+                                                                       }
+                                                       }catch (e) { 
alert(e.getMessage);}
+                                               }
+                                       }
+               );
+       } catch (e) {
+               alert(e.getMessage);
+       }
+}
+/**
  * Put into the span, the name of the bank, the bank account
  * and the quick_code
  */
@@ -271,6 +331,7 @@
        }
        nb.value++;
 }
+
 /**
  * @brief add a line in the form for the purchase ledger
  */

Modified: phpcompta/trunk/html/js/scripts.js
===================================================================
--- phpcompta/trunk/html/js/scripts.js  2013-05-19 18:59:29 UTC (rev 5289)
+++ phpcompta/trunk/html/js/scripts.js  2013-05-19 20:48:17 UTC (rev 5290)
@@ -1764,6 +1764,10 @@
                $('info_div').innerHTML="";
        }
 }
+/**
+ * @brief
+ * Display the task late or for today in dashboard
+ */
 function display_task(p_id)
 {
        new Draggable(p_id,{starteffect:function()
@@ -1775,4 +1779,20 @@
     $(p_id).style.left=posX;
        $(p_id).style.display='block';
 
+}
+/**
+ * @brief
+ * Set a message in the info
+ */
+function info_message (p_message)
+{
+               $('info_div').innerHTML=p_message;
+               $('info_div').style.display="block";
+}
+/**
+ * @brief hide the info box
+ */
+function info_hide()
+{
+               $('info_div').style.display="none";
 }
\ No newline at end of file

Added: phpcompta/trunk/include/ajax_min_row.php
===================================================================
--- phpcompta/trunk/include/ajax_min_row.php                            (rev 0)
+++ phpcompta/trunk/include/ajax_min_row.php    2013-05-19 20:48:17 UTC (rev 
5290)
@@ -0,0 +1,48 @@
+<?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
+ *
+ */
+require_once('class_user.php');
+require_once('class_dossier.php');
+extract($_GET);
+/* check the parameters */
+foreach ( array('j','ctl') as $a )
+{
+    if ( ! isset(${$a}) )
+    {
+        echo "missing $a";
+        return;
+    }
+}
+
+if ( $g_user->check_jrn($_GET['j'])=='X' ) { echo  '{"row":"0"}';exit();}
+
+$row=$cn->get_value('select jrn_deb_max_line from jrn_def where 
jrn_def_id=$1',array($_GET['j']));
+
+echo '{"row":"'.$row.'"}';
+
+?>

Modified: phpcompta/trunk/include/class_acc_ledger.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger.php        2013-05-19 18:59:29 UTC 
(rev 5289)
+++ phpcompta/trunk/include/class_acc_ledger.php        2013-05-19 20:48:17 UTC 
(rev 5290)
@@ -1527,7 +1527,11 @@
                        $ret.='<input type="button" class="button" value="' . 
_('verifie Imputation Analytique') . '" onClick="verify_ca(\'\');">';
                return $ret;
        }
-
+       function get_min_row()
+       {
+               $row=$this->db->get_value("select jrn_deb_max_line from jrn_def 
where jrn_def_id=$1",array($this->id));
+               return $row;
+       }
        /**
         * @brief Show the form to encode your operation
         * @param$p_array if you correct or use a predef operation (default = 
null)
@@ -1539,7 +1543,7 @@
        function input($p_array = null, $p_readonly = 0)
        {
                global $g_parameter, $g_user;
-
+               $this->nb=$this->get_min_row();
                if ($p_readonly == 1)
                        return $this->confirm($p_array);
 
@@ -1554,6 +1558,7 @@
                {
                        $add_js.='get_last_date();';
                }
+               $add_js.='update_row("quick_item");';
                $ret = "";
                if ($g_user->check_action(FICADD) == 1)
                {
@@ -3271,6 +3276,9 @@
                $hidden.=HtmlInput::hidden('p_ech_lib', 'echeance');
                $hidden.=HtmlInput::hidden('p_jrn_type', $type);
 
+               $min_row = new INum("min_row",$this->jrn_deb_max_line);
+               $min_row->prec=0;
+
                /* Load the card */
                $card = $this->get_fiche_def();
                $rdeb = explode(',', $card['deb']);
@@ -3365,6 +3373,7 @@
                $this->jrn_def_type = $p_jrn_type;
                $this->jrn_def_pj_pref = $jrn_def_pj_pref;
                $this->jrn_def_fiche_deb = (isset($FICHEDEB)) ? join($FICHEDEB, 
',') : "";
+               $this->jrn_deb_max_line=$min_row;
                switch ($this->jrn_def_type)
                {
                        case 'ACH':
@@ -3458,7 +3467,8 @@
                echo HtmlInput::hidden('sa', 'add');
 
                $cn = $this->db;
-
+               $min_row = new INum("min_row",MAX_ARTICLE);
+               $min_row->prec=0;
                require_once('template/param_jrn.php');
        }
 
@@ -3478,6 +3488,7 @@
                $this->jrn_def_type = $p_jrn_type;
                $this->jrn_def_pj_pref = $jrn_def_pj_pref;
                $this->jrn_def_fiche_deb = (isset($FICHEDEB)) ? join($FICHEDEB, 
',') : "";
+               $this->jrn_deb_max_line=$min_row;
                $this->jrn_def_code = sprintf("%s%02d", 
trim(substr($this->jrn_def_type, 0, 1)), Acc_Ledger::next_number($this->db, 
$this->jrn_def_type));
 
                switch ($this->jrn_def_type)

Modified: phpcompta/trunk/include/class_acc_ledger_fin.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger_fin.php    2013-05-19 18:59:29 UTC 
(rev 5289)
+++ phpcompta/trunk/include/class_acc_ledger_fin.php    2013-05-19 20:48:17 UTC 
(rev 5290)
@@ -237,6 +237,8 @@
 
                $pview_only = false;
 
+               $min_article=$this->get_min_row();
+
                $f_add_button = new IButton('add_card');
                $f_add_button->label = _('Créer une nouvelle fiche');
                $f_add_button->set_attribute('ipopup', 'ipop_newcard');
@@ -291,7 +293,7 @@
 
                // Ledger (p_jrn)
                //--
-               
$onchange="update_bank();ajax_saldo('first_sold');update_name();";
+               
$onchange="update_bank();ajax_saldo('first_sold');update_name();update_row('fin_item');";
 
                if ($g_parameter->MY_DATE_SUGGEST == 'Y')
                        $onchange .= 'get_last_date();';
@@ -344,7 +346,7 @@
                $wLast = new INum('last_sold', $last_sold);
 
 
-               $max = (isset($nb_item)) ? $nb_item : MAX_ARTICLE;
+               $max = (isset($nb_item)) ? $nb_item : $min_article;
 
                $r.= HtmlInput::hidden('nb_item', $max);
                //--------------------------------------------------

Modified: phpcompta/trunk/include/class_acc_ledger_purchase.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger_purchase.php       2013-05-19 
18:59:29 UTC (rev 5289)
+++ phpcompta/trunk/include/class_acc_ledger_purchase.php       2013-05-19 
20:48:17 UTC (rev 5290)
@@ -982,7 +982,8 @@
                        $add_js.='get_last_date();';
                }
                $add_js.='update_name();';
-               $add_js.='update_pay_method()';
+               $add_js.='update_pay_method();';
+               $add_js.='update_row("sold_item");';
 
                $wLedger=$this->select_ledger('ACH',2);
         if ($wLedger == null) exit (_('Pas de journal disponible'));

Modified: phpcompta/trunk/include/class_acc_ledger_sold.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger_sold.php   2013-05-19 18:59:29 UTC 
(rev 5289)
+++ phpcompta/trunk/include/class_acc_ledger_sold.php   2013-05-19 20:48:17 UTC 
(rev 5290)
@@ -1119,7 +1119,8 @@
                        $add_js.='get_last_date();';
                }
                $add_js.='update_name();';
-               $add_js.='update_pay_method()';
+               $add_js.='update_pay_method();';
+               $add_js.='update_row("sold_item");';
 
         $wLedger=$this->select_ledger('VEN',2);
         if ( $wLedger == null )

Modified: phpcompta/trunk/include/constant.php
===================================================================
--- phpcompta/trunk/include/constant.php        2013-05-19 18:59:29 UTC (rev 
5289)
+++ phpcompta/trunk/include/constant.php        2013-05-19 20:48:17 UTC (rev 
5290)
@@ -62,9 +62,9 @@
 $g_succeed="<span style=\"font-size:18px;color:green\">&#x2713;</span>";
 /*set to none for production */
 /* uncomment for production */
-//define ('SVNINFO',5900);
+define ('SVNINFO',5900);
 $version_phpcompta=SVNINFO;
-define ("DEBUG",false);
+define ("DEBUG",true);
 /* define ('SVNINFO',5015);
  * $version_phpcompta=SVNINFO;
  * define ("DEBUG",true);
@@ -81,7 +81,7 @@
 define ('NOTFOUND','--not found--');
 
 define ("MAX_COMPTE",4);
-define ('MAX_ARTICLE',12);
+define ('MAX_ARTICLE',5);
 define ('MAX_CAT',15);
 define ('MAX_CARD_SEARCH',550);
 define ('MAX_FORECAST_ITEM',10);

Modified: phpcompta/trunk/include/template/param_jrn.php
===================================================================
--- phpcompta/trunk/include/template/param_jrn.php      2013-05-19 18:59:29 UTC 
(rev 5289)
+++ phpcompta/trunk/include/template/param_jrn.php      2013-05-19 20:48:17 UTC 
(rev 5290)
@@ -4,7 +4,7 @@
                <TD><?php echo _('Nom journal')?> </TD>
                <TD> <INPUT TYPE="text" class="input_text" NAME="p_jrn_name" 
VALUE="<?php       echo $name;     ?>"></TD>
 </TR>
-<?php 
+<?php
 if ($new || $type=='ODS' ):
 ?>
 <TR>
@@ -18,10 +18,10 @@
        utiliser le * pour indiquer 'tous les postes qui en dépendent' exemple: 
4*")?>
 </TD>
 </TR>
-<?php 
+<?php
 endif;
 ?>
-<?php 
+<?php
 if ( $new || $type=='FIN') {
 ?>
 <tr>
@@ -37,7 +37,7 @@
 <?php echo _('Compte en banque')?>
 </td>
 <TD>
-<?php 
+<?php
 $card=new ICard();
 $card->name='bank';
 $card->extra=$cn->make_list('select fd_id from fiche_def where frd_id=4');
@@ -55,12 +55,13 @@
 <td class="notice">
 <?php echo _("Obligatoire pour les journaux FIN : donner ici la fiche de la 
banque utilisée")?>
 </td>
-<?php 
+<?php
 }
 ?>
 </TR>
 <tr>
-<td><INPUT TYPE="hidden" id="p_jrn_deb_max_line" NAME="p_jrn_deb_max_line" 
VALUE="10"></td>
+       <td>Minimum de lignes à afficher</td>
+<td><?php echo $min_row->input()?></td>
 </tr>
 <tr>
 <td><INPUT TYPE="hidden" id="p_jrn_deb_max_line" NAME="p_jrn_deb_max_line" 
VALUE="10"></td>
@@ -116,12 +117,12 @@
 <H2 class="info"> Fiches </H2>
 <TABLE width="100%">
 <TR>
-<?php 
+<?php
 if ( $new || ($type != 'ODS' && $type != 'FIN')) {
 ?>
 <th style="text-align:left"><?php echo _('Fiches Débit')?></TH>
 <th style="text-align:left"><?php echo _('Fiches Crédit')?></TH>
-<?php 
+<?php
 }
 ?>
 </TR>



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