task #0000804: Nombre de ligne par défaut

Nombre de ligne MAX_ARTICLE est à 5 : impacte les actions
This commit is contained in:
Dany De Bontridder 2013-05-19 20:48:17 +00:00
parent f6e3a31f7d
commit 448549c925
11 changed files with 168 additions and 18 deletions

View file

@ -11,6 +11,8 @@ update fiche_def set fd_description='Catégorie qui contient la liste des compte
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;

View file

@ -569,6 +569,9 @@ EOF;
case 'vw_action':
require_once 'ajax_view_action.php';
break;
case 'minrow':
require_once 'ajax_min_row.php';
break;
default:
var_dump($_GET);
}

View file

@ -140,6 +140,66 @@ function update_bank()
);
}
/**
*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 @@ function ledger_fin_add_row()
}
nb.value++;
}
/**
* @brief add a line in the form for the purchase ledger
*/

View file

@ -1764,6 +1764,10 @@ function filter_table(phrase, _id, colnr,start_row) {
$('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 @@ function display_task(p_id)
$(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";
}

48
include/ajax_min_row.php Normal file
View file

@ -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 ddebontridder@yahoo.fr
/**
* @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.'"}';
?>

View file

@ -1527,7 +1527,11 @@ class Acc_Ledger extends jrn_def_sql
$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 @@ class Acc_Ledger extends jrn_def_sql
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 @@ class Acc_Ledger extends jrn_def_sql
{
$add_js.='get_last_date();';
}
$add_js.='update_row("quick_item");';
$ret = "";
if ($g_user->check_action(FICADD) == 1)
{
@ -3271,6 +3276,9 @@ class Acc_Ledger extends jrn_def_sql
$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 @@ class Acc_Ledger extends jrn_def_sql
$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 @@ class Acc_Ledger extends jrn_def_sql
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 @@ class Acc_Ledger extends jrn_def_sql
$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)

View file

@ -237,6 +237,8 @@ class Acc_Ledger_Fin extends Acc_Ledger
$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 @@ class Acc_Ledger_Fin extends Acc_Ledger
// 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 @@ class Acc_Ledger_Fin extends Acc_Ledger
$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);
//--------------------------------------------------

View file

@ -982,7 +982,8 @@ class Acc_Ledger_Purchase extends Acc_Ledger
$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'));

View file

@ -1119,7 +1119,8 @@ class Acc_Ledger_Sold extends Acc_Ledger
$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 )

View file

@ -62,9 +62,9 @@ $g_failed="<span style=\"font-size:18px;color:red\">&#x2716;</span>";
$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 ("DBVERSIONREPO",14);
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);

View file

@ -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 @@ if ($new || $type=='ODS' ):
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 @@ if ( $new || $type=='FIN') {
<?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 @@ echo $card->input();
<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 @@ echo $card->input();
<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>