[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpcompta-dev] r639 - in trunk/rapport_avance: . include include/templa
From: |
phpcompta-dev |
Subject: |
[Phpcompta-dev] r639 - in trunk/rapport_avance: . include include/template |
Date: |
Tue, 31 Dec 2013 02:16:40 +0100 (CET) |
Author: danydb
Date: 2013-12-31 02:16:39 +0100 (Tue, 31 Dec 2013)
New Revision: 639
Added:
trunk/rapport_avance/ajax_listing_detail_add.php
trunk/rapport_avance/ajax_listing_detail_modify.php
Removed:
trunk/rapport_avance/ajax_listing_param_add.php
Modified:
trunk/rapport_avance/ajax.php
trunk/rapport_avance/ajax_save_param_listing.php
trunk/rapport_avance/include/class_rapav_listing.php
trunk/rapport_avance/include/class_rapav_listing_formula.php
trunk/rapport_avance/include/class_rapav_listing_param.php
trunk/rapport_avance/include/template/rapav_listing_definition.php
trunk/rapport_avance/rapav_javascript.js
Log:
Formulaire are done and Listing
Task #958 - Permettre de modifier le d?\195?\169tail introduit
Modified: trunk/rapport_avance/ajax.php
===================================================================
--- trunk/rapport_avance/ajax.php 2013-12-30 21:30:25 UTC (rev 638)
+++ trunk/rapport_avance/ajax.php 2013-12-31 01:16:39 UTC (rev 639)
@@ -8,9 +8,9 @@
'mod_form,add_row_definition,mod_param,add_param_detail,'.
'rapav_search_code,save_param_detail,rapav_declaration_display,'.
'listing_modify,listing_remove_modele,listing_display_definition,'.
- 'listing_param_add,save_param_listing,listing_detail_remove,'.
+ 'listing_detail_add,save_param_listing,listing_detail_remove,'.
'listing_search_code,rapav_listing_display,parameter_send_mail,send_mail,'
- . 'include_follow,include_follow_save,modify_param_detail');
+ .
'include_follow,include_follow_save,modify_param_detail,listing_detail_modify');
if ( in_array($act,$a_action ) == true )
{
include 'ajax_'.$act.'.php';
Copied: trunk/rapport_avance/ajax_listing_detail_add.php (from rev 638,
trunk/rapport_avance/ajax_listing_param_add.php)
===================================================================
--- trunk/rapport_avance/ajax_listing_detail_add.php
(rev 0)
+++ trunk/rapport_avance/ajax_listing_detail_add.php 2013-12-31 01:16:39 UTC
(rev 639)
@@ -0,0 +1,23 @@
+<?php
+/**
+ * @file
+ * @brief Ajax file
+ */
+require_once 'include/class_rapav_listing.php';
+
+ob_start();
+echo HtmlInput::title_box("Nouveau paramètre", $cin);
+$obj=new RAPAV_Listing($id);
+$obj->add_parameter($id);
+$response = ob_get_contents();
+ob_end_clean();
+$html = escape_xml($response);
+header('Content-type: text/xml; charset=UTF-8');
+echo <<<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<data>
+<ctl></ctl>
+<code>$html</code>
+</data>
+EOF;
+?>
\ No newline at end of file
Added: trunk/rapport_avance/ajax_listing_detail_modify.php
===================================================================
--- trunk/rapport_avance/ajax_listing_detail_modify.php
(rev 0)
+++ trunk/rapport_avance/ajax_listing_detail_modify.php 2013-12-31 01:16:39 UTC
(rev 639)
@@ -0,0 +1,90 @@
+<?php
+
+require_once 'include/class_rapav_listing_formula.php';
+$id=HtmlInput::default_value_get('id',-1);
+if ($id == -1 )
+{
+ $id=HtmlInput::default_value_get('lp_id',-1);
+}
+if ($id !=-1)
+{
+
+ ob_start();
+ $obj=new RAPAV_Listing_Param_SQL($id);
+ $formula=RAPAV_Listing_Formula::make_object($obj);
+ echo HtmlInput::title_box($obj->lp_code,'listing_param_input_div_id');
+ echo h2($obj->lp_comment);
+ $code=new IText('code_id',$obj->lp_code);
+ $comment=new IText('comment',$obj->lp_comment);
+ $order=new INum('order',$obj->l_order);
+ $atab=array(
+ 'ATTR'=>'new_attribute_id',
+ 'ACCOUNT'=>'new_account_id',
+ 'COMP'=>'compute_id',
+ 'FORM'=>'formula'
+ )
+ ?>
+<?php echo HtmlInput::hidden("listing_id", $obj->l_id); ?>
+ <form id="common_frm">
+
+ <table >
+ <tr>
+ <td>
+ <label>Code</label>
+
+ </td>
+ <td>
+ <?php echo $code->input() ?>
+ </tD>
+ <td>
+ <p id="code_id_span" class="error"></p>
+ </td>
+
+
+ </tr>
+ <tr>
+ <td>
+ <label>Commentaire</label>
+ </td>
+ <td>
+ <?php echo $comment->input(); ?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <label>Ordre d'apparition</label>
+ </td>
+ <td>
+ <?php echo $order->input(); ?>
+ </td>
+ </tr>
+ </table>
+ </form>
+ <span class="error" id="info_listing_param_input_div_id"></span>
+<?php
+ echo '<form method="POST" id="listing_detail_modify_frm"
onsubmit="save_param_listing(\'listing_detail_modify_frm\'); return false;">';
+ echo $formula->input();
+ echo
HtmlInput::array_to_hidden(array('act','ac','plugin_code','gDossier'),$_REQUEST);
+ echo HtmlInput::hidden('tab',$atab[$formula->sig]);
+ echo HtmlInput::hidden('listing_id',$obj->l_id);
+ echo HtmlInput::hidden('lp_id',$obj->lp_id);
+
+ echo '<p>';
+ echo HtmlInput::submit('save_listing_detail_modify',_('Sauver'));
+ echo '</p>';
+ echo '</form>';
+ $response = ob_get_clean();
+ ob_end_clean();
+ } else {
+ $response='invalide id';
+ }
+ $html = escape_xml($response);
+header('Content-type: text/xml; charset=UTF-8');
+echo <<<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<data>
+<ctl></ctl>
+<code>$html</code>
+</data>
+EOF;
+?>
\ No newline at end of file
Deleted: trunk/rapport_avance/ajax_listing_param_add.php
===================================================================
--- trunk/rapport_avance/ajax_listing_param_add.php 2013-12-30 21:30:25 UTC
(rev 638)
+++ trunk/rapport_avance/ajax_listing_param_add.php 2013-12-31 01:16:39 UTC
(rev 639)
@@ -1,23 +0,0 @@
-<?php
-/**
- * @file
- * @brief Ajax file
- */
-require_once 'include/class_rapav_listing.php';
-
-ob_start();
-echo HtmlInput::title_box("Nouveau paramètre", $cin);
-$obj=new RAPAV_Listing($id);
-$obj->add_parameter($id);
-$response = ob_get_contents();
-ob_end_clean();
-$html = escape_xml($response);
-header('Content-type: text/xml; charset=UTF-8');
-echo <<<EOF
-<?xml version="1.0" encoding="UTF-8"?>
-<data>
-<ctl></ctl>
-<code>$html</code>
-</data>
-EOF;
-?>
\ No newline at end of file
Modified: trunk/rapport_avance/ajax_save_param_listing.php
===================================================================
--- trunk/rapport_avance/ajax_save_param_listing.php 2013-12-30 21:30:25 UTC
(rev 638)
+++ trunk/rapport_avance/ajax_save_param_listing.php 2013-12-31 01:16:39 UTC
(rev 639)
@@ -19,8 +19,10 @@
*/
require_once 'class_impress.php';
require_once 'include/class_rapav_listing_param.php';
-$formula = new RAPAV_Listing_Param_SQL();
+$lp_id = HtmlInput::default_value_get('lp_id', -1);
+$formula = new RAPAV_Listing_Param_SQL($lp_id);
+$html = "";
switch ($tab)
{
case 'formula':
@@ -49,6 +51,7 @@
$html.=HtmlInput::anchor("Effacer", "",
sprintf("onclick=\"listing_detail_remove('%s','%s','%s','%s')\""
, $_REQUEST['gDossier'],
$_REQUEST['plugin_code'], $_REQUEST['ac'], $lp_id));
$html.='</td>';
+
}
break;
case 'compute_id':
@@ -77,6 +80,7 @@
$html.=HtmlInput::anchor("Effacer", "",
sprintf("onclick=\"listing_detail_remove('%s','%s','%s','%s')\""
, $_REQUEST['gDossier'],
$_REQUEST['plugin_code'], $_REQUEST['ac'], $lp_id));
$html.='</td>';
+
}
break;
case 'new_account_id':
@@ -105,6 +109,7 @@
$html.=HtmlInput::anchor("Effacer", "",
sprintf("onclick=\"listing_detail_remove('%s','%s','%s','%s')\""
, $_REQUEST['gDossier'],
$_REQUEST['plugin_code'], $_REQUEST['ac'], $lp_id));
$html.='</td>';
+
}
break;
case 'new_attribute_id':
@@ -124,8 +129,17 @@
$html.='<td>';
$html.=HtmlInput::anchor("Effacer", "",
sprintf("onclick=\"listing_detail_remove('%s','%s','%s','%s')\"",
$_REQUEST['gDossier'], $_REQUEST['plugin_code'], $_REQUEST['ac'], $lp_id));
$html.='</td>';
+
+
break;
}
+ob_start();
+ echo '<td>';
+ $obj = new Rapav_Listing_Param($lp_id);
+$obj->button_modify();
+echo '</td>';
+$html.=ob_get_clean();
+ob_end_clean();
//echo $html;exit();
$html = escape_xml($html);
Modified: trunk/rapport_avance/include/class_rapav_listing.php
===================================================================
--- trunk/rapport_avance/include/class_rapav_listing.php 2013-12-30
21:30:25 UTC (rev 638)
+++ trunk/rapport_avance/include/class_rapav_listing.php 2013-12-31
01:16:39 UTC (rev 639)
@@ -268,7 +268,7 @@
'pc' => $_REQUEST['plugin_code'])
);
$arg = str_replace('"', "'", $arg);
- $button->javascript = 'listing_param_add(' . $arg . ')';
+ $button->javascript = 'listing_detail_add(' . $arg . ')';
echo $button->input();
}
@@ -306,6 +306,6 @@
$cat = $cn->get_value('select fd_description from fiche_def where
fd_id=$1', array($this->data->getp('fiche_def_id')));
return $cat;
}
+
-
}
Modified: trunk/rapport_avance/include/class_rapav_listing_formula.php
===================================================================
--- trunk/rapport_avance/include/class_rapav_listing_formula.php
2013-12-30 21:30:25 UTC (rev 638)
+++ trunk/rapport_avance/include/class_rapav_listing_formula.php
2013-12-31 01:16:39 UTC (rev 639)
@@ -73,9 +73,6 @@
case 'COMP':
$ret = new Rapav_Formula_Compute($obj);
break;
- case 'COMP':
- $ret = new Rapav_Formula_Histo($obj);
- break;
default:
throw new Exception('Object ' . var_export($obj, true) . '
invalide ');
break;
@@ -113,12 +110,50 @@
$this->fiche->f_id = $f_id;
}
-
function filter_operation($param)
{
$this->type_operation = $param;
}
+ /**
+ * display a choice of ledger
+ * @global cn
+ */
+ function input_ledger()
+ {
+ global $cn;
+ $select = new ISelect('p_ledger');
+ $a_ledger = $cn->make_array('select jrn_def_id,jrn_def_name from
jrn_def order by 2', 1);
+ $a_ledger[0]['label'] = '-- Tous les journaux -- ';
+ $select->value = $a_ledger;
+ if ($this->data->lp_id!= -1)
+ {
+ $select->selected = $this->data->jrn_def_id;
+ }
+
+ echo '<p> Filtrage par journal ' . $select->input() . '</p>';
+ }
+
+ /**
+ * Display a select for the date
+ */
+ function input_date_paiement()
+ {
+ $s_date = new ISelect('p_paid');
+ $s_date->value = array();
+ $s_date->value[] = array("value" => 0, "label" => 'Date d\'opération');
+ $s_date->value[] = array("value" => 1, "label" => 'Date de paiement');
+ $s_date->value[] = array("value" => 2, "label" => 'Date d\'échéance');
+ echo '<p> Si la date donnée concerne la date de paiement ou
d\'écheance, cela limitera la recherche aux journaux VEN et ACH ';
+ echo HtmlInput::infobulle(36);
+ if ($this->data->lp_id != -1)
+ {
+ $s_date->selected = $this->data->date_paid;
+ }
+ echo $s_date->input();
+ echo '</p>';
+ }
+
}
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -289,17 +324,17 @@
switch ($this->type_operation)
{
case 0:
- /*--all operation --*/
- $sql_filter_operation="";
+ /* --all operation -- */
+ $sql_filter_operation = "";
break;
case '1':
- /* -- only paid --*/
- $sql_filter_operation=" and j_id in (select j_id from jrnx
join
+ /* -- only paid -- */
+ $sql_filter_operation = " and j_id in (select j_id from jrnx
join
jrn on (j_grpt=jr_grpt_id) where jr_rapt='paid')";
break;
case '2':
- /*-- only unpaid --*/
- $sql_filter_operation=" and j_id in (select j_id from jrnx
join
+ /* -- only unpaid -- */
+ $sql_filter_operation = " and j_id in (select j_id from jrnx
join
jrn on (j_grpt=jr_grpt_id)
join jrn_def on (jrn_def_id=jr_def_id)
where coalesce(jr_rapt,'')='' and jrn_def_type in
('ACH','VEN'))";
@@ -336,9 +371,10 @@
$account->set_attribute('no_overwrite', 1);
$account->set_attribute('noquery', 1);
$account->set_attribute('account', "formula_input_id");
+ $account->value=$this->data->fp_formula;
echo $account->input();
- RAPAV::input_date_paiement();
- RAPAV::input_ledger();
+ $this->input_date_paiement();
+ $this->input_ledger();
}
function save($p_array)
@@ -447,18 +483,19 @@
ld.lc_id=$1
and lp.lp_code=$2
and lf.f_id = $3
- ', array($this->detail->lc_id,
$search,$this->fiche->f_id));
+ ', array($this->detail->lc_id, $search,
$this->fiche->f_id));
$formula = str_replace($piece, $value, $formula);
}
/** Protect against division by zero */
- if ( strpos("1".$formula,"/0.0000") != 0)
+ if (strpos("1" . $formula, "/0.0000") != 0)
{
- $amount=0;
- } else {
+ $amount = 0;
+ } else
+ {
eval('$amount = ' . $formula . ';');
}
//
- $this->detail->ld_value_numeric= $amount;
+ $this->detail->ld_value_numeric = $amount;
}
function input()
@@ -466,6 +503,7 @@
global $cn;
$f_id = $this->data->getp('listing_id');
$account = new IText("form_compute");
+ $account->value=$this->data->fp_formula;
$account->size = 50;
echo $account->input();
echo HtmlInput::button('listing_search_code_bt', 'Cherche codes',
sprintf(" onclick=\"listing_search_code('%s','%s','%s','%s')\"",
$_REQUEST['ac'], $_REQUEST['plugin_code'], $_REQUEST['gDossier'], $f_id));
@@ -555,20 +593,16 @@
{
$ledger = RAPAV::get_ledger_name($this->data->jrn_def_id);
$paid = RAPAV::str_date_type($this->data->date_paid);
- $a_sum=explode(',','invalid,Débit,Crédit,Débit-Crédit,Crédit-Débit');
- $sumof=($this->data->lp_card_saldo==0)?" du poste comptable":"de la
fiche";
- $str = sprintf("%s %s %s utilisant $ledger %s",
- $a_sum[$this->data->type_sum_account],
- $sumof,
- $this->data->fp_formula,
- $paid);
+ $a_sum = explode(',',
'invalid,Débit,Crédit,Débit-Crédit,Crédit-Débit');
+ $sumof = ($this->data->lp_card_saldo == 0) ? " du poste comptable" :
"de la fiche";
+ $str = sprintf("%s %s %s utilisant $ledger %s",
$a_sum[$this->data->type_sum_account], $sumof, $this->data->fp_formula, $paid);
return $str;
}
function compute($p_start, $p_end)
{
global $cn;
- $this->histo=array();
+ $this->histo = array();
$filter_ledger = "";
if ($this->data->jrn_def_id != "")
{
@@ -576,21 +610,21 @@
}
$card_saldo = ($this->data->lp_card_saldo == 0) ? "jrn1" : "jrn2";
- $sql_date = RAPAV::get_sql_date($this->data->date_paid,$card_saldo);
- switch ($this->type_operation)
+ $sql_date = RAPAV::get_sql_date($this->data->date_paid, $card_saldo);
+ switch ($this->type_operation)
{
case 0:
- /*--all operation --*/
- $sql_filter_operation="";
+ /* --all operation -- */
+ $sql_filter_operation = "";
break;
case '1':
- /* -- only paid --*/
- $sql_filter_operation=" and $card_saldo.j_id in (select j_id
from jrnx join
+ /* -- only paid -- */
+ $sql_filter_operation = " and $card_saldo.j_id in (select j_id
from jrnx join
jrn on (j_grpt=jr_grpt_id) where jr_rapt='paid')";
break;
case '2':
- /*-- only unpaid --*/
- $sql_filter_operation=" and $card_saldo.j_id in (select j_id
from jrnx join
+ /* -- only unpaid -- */
+ $sql_filter_operation = " and $card_saldo.j_id in (select j_id
from jrnx join
jrn on (j_grpt=jr_grpt_id)
join jrn_def on (jrn_def_id=jr_def_id)
where coalesce(jr_rapt,'')='' and jrn_def_type in
('ACH','VEN'))";
@@ -618,21 +652,20 @@
$sql_filter_operation
) as tv_amount
";
- $amount = $cn->get_value("select sum(jrnx_amount) from ".$sql,
array(
+ $amount = $cn->get_value("select sum(jrnx_amount) from " .
$sql, array(
$this->data->fp_formula,
$p_start,
$p_end,
$this->fiche->f_id
));
- if ($this->data->lp_histo == 1 )
+ if ($this->data->lp_histo == 1)
{
- $this->histo=$cn->get_array("select distinct jr_id from
- jrn join $sql on (j_grpt=jr_grpt_id) ",array (
+ $this->histo = $cn->get_array("select distinct jr_id from
+ jrn join $sql on (j_grpt=jr_grpt_id) ", array(
$this->data->fp_formula,
$p_start,
$p_end,
$this->fiche->f_id));
-
}
// if C-D is asked then reverse the result
if ($this->data->type_sum_account == 2)
@@ -656,21 +689,20 @@
$sql_filter_operation
) as tv_amount
";
- $amount = $cn->get_value("select sum(jrnx_amount) from".$sql,
array(
+ $amount = $cn->get_value("select sum(jrnx_amount) from" .
$sql, array(
$this->data->fp_formula,
$p_start,
$p_end,
$this->fiche->f_id
));
- if ($this->data->lp_histo == 1 )
+ if ($this->data->lp_histo == 1)
{
- $this->histo=$cn->get_array("select distinct jr_id from
- jrn join $sql on (j_grpt=jr_grpt_id) ",array (
+ $this->histo = $cn->get_array("select distinct jr_id from
+ jrn join $sql on (j_grpt=jr_grpt_id) ", array(
$this->data->fp_formula,
$p_start,
$p_end,
$this->fiche->f_id));
-
}
break;
@@ -692,21 +724,20 @@
$sql_filter_operation
) as tv_amount
";
- $amount = $cn->get_value("select sum(jrnx_amount) from ".$sql,
array(
+ $amount = $cn->get_value("select sum(jrnx_amount) from " .
$sql, array(
$this->data->fp_formula,
$p_start,
$p_end,
$this->fiche->f_id
));
- if ($this->data->lp_histo == 1 )
+ if ($this->data->lp_histo == 1)
{
- $this->histo=$cn->get_array("select distinct jr_id from
- jrn join $sql on (j_grpt=jr_grpt_id) ",array (
+ $this->histo = $cn->get_array("select distinct jr_id from
+ jrn join $sql on (j_grpt=jr_grpt_id) ", array(
$this->data->fp_formula,
$p_start,
$p_end,
$this->fiche->f_id));
-
}
break;
@@ -720,22 +751,24 @@
/*
* 4 possibilities with type_sum_account
*/
- if ($amount=="") $amount=0;
+ if ($amount == "")
+ $amount = 0;
$this->detail->ld_value_numeric = $amount;
}
+
function save_computed()
{
parent::save_computed();
/*
* Save history now
*/
- if ($this->data->lp_histo == 1 )
+ if ($this->data->lp_histo == 1)
{
- for ($e=0;$e< count($this->histo);$e++)
+ for ($e = 0; $e < count($this->histo); $e++)
{
- $histo=new RAPAV_Listing_Compute_Historique_SQL();
- $histo->jr_id=$this->histo[$e]['jr_id'];
- $histo->ld_id=$this->detail->ld_id;
+ $histo = new RAPAV_Listing_Compute_Historique_SQL();
+ $histo->jr_id = $this->histo[$e]['jr_id'];
+ $histo->ld_id = $this->detail->ld_id;
$histo->save();
unset($histo);
}
@@ -745,30 +778,33 @@
function input()
{
global $cn;
- $histo_operation=new ICheckBox('histo');
+ $histo_operation = new ICheckBox('histo');
+ $histo_operation->set_check( $this->data->lp_histo);
$account = new IPoste("p_formula", "", "formula_acc_input_id");
$account->label = _("Recherche poste");
$account->set_attribute('gDossier', dossier::id());
$account->set_attribute('account', "formula_acc_input_id");
+ $account->value=$this->data->fp_formula;
echo "Poste comptable utilisée avec chaque fiche " . $account->input();
$sel_total_type_row = new ISelect('tt_id');
$sel_total_type_row->value = $cn->make_array('select tt_id,tt_label
from '
. ' rapport_advanced.total_type_account order by 2');
-
+ $sel_total_type_row->selected=$this->data->tt_id;
echo '<p>';
echo "Reprendre historique opération: " . $histo_operation->input();
echo '</p>';
-
+
echo '<p>';
echo "type de total : " . $sel_total_type_row->input();
echo '</p>';
$ck = new ICheckBox('card_saldo');
+ $ck->set_check($this->data->lp_card_saldo);
echo '<p>';
echo 'Prendre le total de la fiche ' . $ck->input();
echo '</p>';
- RAPAV::input_date_paiement();
- RAPAV::input_ledger();
+ $this->input_date_paiement();
+ $this->input_ledger();
}
function save($p_array)
Modified: trunk/rapport_avance/include/class_rapav_listing_param.php
===================================================================
--- trunk/rapport_avance/include/class_rapav_listing_param.php 2013-12-30
21:30:25 UTC (rev 638)
+++ trunk/rapport_avance/include/class_rapav_listing_param.php 2013-12-31
01:16:39 UTC (rev 639)
@@ -92,4 +92,25 @@
$attribute->set_listing($p_id);
require 'template/listing_param_input.php';
}
+ function button_delete()
+ {
+ $json = sprintf("
onclick=\"listing_detail_remove('%s','%s','%s','%s')\"",
+ Dossier::id(),
+ $_REQUEST['plugin_code'],
+ $_REQUEST['ac'],
+ $this->Param->getp('lp_id') );
+ echo HtmlInput::anchor("Effacer", "", $json);
+ }
+ function button_modify()
+ {
+ $json=json_encode(array('pc'=>$_REQUEST['plugin_code'],
+ 'ac'=>$_REQUEST['ac'],
+ 'gDossier'=>Dossier::id(),
+ 'id'=>$this->Param->getp('lp_id'),
+ 'cin'=>'listing_param_input_div_id'));
+ $json= str_replace('"', "'", $json);
+ $js = sprintf(" onclick=\"listing_detail_modify(%s)\"",
+ $json );
+ echo HtmlInput::anchor("Modifier", "", $js);
+ }
}
Modified: trunk/rapport_avance/include/template/rapav_listing_definition.php
===================================================================
--- trunk/rapport_avance/include/template/rapav_listing_definition.php
2013-12-30 21:30:25 UTC (rev 638)
+++ trunk/rapport_avance/include/template/rapav_listing_definition.php
2013-12-31 01:16:39 UTC (rev 639)
@@ -57,14 +57,14 @@
</td>
<td>
<?php
- $json = sprintf(" onclick=\"listing_detail_remove('%s','%s','%s','%s')\"",
- Dossier::id(),
- $_REQUEST['plugin_code'],
- $_REQUEST['ac'],
- $this->a_detail[$i]->Param->getp('lp_id') );
- echo HtmlInput::anchor("Effacer", "", $json)
+ echo $this->a_detail[$i]->button_delete();
?>
</td>
+ <td>
+ <?php
+ echo $this->a_detail[$i]->button_modify();
+ ?>
+ </td>
</tr>
Modified: trunk/rapport_avance/rapav_javascript.js
===================================================================
--- trunk/rapport_avance/rapav_javascript.js 2013-12-30 21:30:25 UTC (rev
638)
+++ trunk/rapport_avance/rapav_javascript.js 2013-12-31 01:16:39 UTC (rev
639)
@@ -113,7 +113,7 @@
alert("add_param_detail" + e.message);
}
}
-function modify_param_detail(plugin_code,ac,dossier,fp_id)
+function modify_param_detail(plugin_code, ac, dossier, fp_id)
{
try
{
@@ -327,8 +327,8 @@
var afpid =
answer.getElementsByTagName('fp_id');
var fp_id = afpid[0].firstChild.nodeValue;
var p_id = ap_id[0].firstChild.nodeValue;
- var update=$('tr_'+fp_id);
- if ( update== undefined )
+ var update = $('tr_' + fp_id);
+ if (update == undefined)
{
// Ajoute une ligne avec résultat
var mytable = g("table_" +
p_id).tBodies[0];
@@ -337,7 +337,7 @@
oRow.id = "tr_" + fp_id;
oRow.innerHTML = code_html;
} else {
- $(update).innerHTML=code_html;
+ $(update).innerHTML = code_html;
}
removeDiv('param_detail_div');
@@ -653,6 +653,47 @@
}
}
+function listing_detail_modify(json)
+{
+ try {
+ var querystring = 'plugin_code=' + json.pc + '&ac=' + json.ac +
'&gDossier=' + json.gDossier + '&act=listing_detail_modify' + "&cin=" +
json.cin + '&id=' + json.id;
+ waiting_box();
+ var action = new Ajax.Request(
+ "ajax.php",
+ {
+ method: 'get',
+ parameters: querystring,
+ onFailure: error_get_predef,
+ onSuccess: function(req) {
+ try {
+ var answer = req.responseXML;
+ var a = answer.getElementsByTagName('ctl');
+ var html = answer.getElementsByTagName('code');
+ if (a.length == 0) {
+ var rec = req.responseText;
+ throw 'cannot find ctl element';
+ }
+ remove_waiting_box();
+ var code_html = getNodeText(html[0]);
+ code_html = unescape_xml(code_html);
+ var position = fixed_position(451, 217) +
';width:50%';
+ add_div({'id': json.cin, 'cssclass': 'inner_box',
'drag': 1, 'style': position});
+ $(json.cin).innerHTML = code_html;
+
+ } catch (e) {
+ alert(e.message);
+ }
+ code_html.evalScripts();
+ }
+ }
+ );
+
+ } catch (e)
+ {
+ alert(e.message);
+
+ }
+}
/**
* @brief display a form for adding a parameter to the current listing
* @param json
@@ -663,10 +704,10 @@
* - ac the AC code
* - pc plugin_code
*/
-function listing_param_add(json)
+function listing_detail_add(json)
{
try {
- var querystring = 'plugin_code=' + json.pc + '&ac=' + json.ac +
'&gDossier=' + json.gDossier + '&act=listing_param_add' + "&cin=" + json.cin +
'&id=' + json.id;
+ var querystring = 'plugin_code=' + json.pc + '&ac=' + json.ac +
'&gDossier=' + json.gDossier + '&act=listing_detail_add' + "&cin=" + json.cin +
'&id=' + json.id;
waiting_box();
var action = new Ajax.Request(
"ajax.php",
@@ -689,7 +730,7 @@
var position = fixed_position(451, 217) +
';width:50%';
add_div({'id': json.cin, 'cssclass': 'inner_box',
'drag': 1, 'style': position});
$(json.cin).innerHTML = code_html;
-
+
} catch (e) {
alert(e.message);
}
@@ -713,14 +754,14 @@
/**
* code_id can not be empty
*/
- if ( $('code_id').value.trim()=='') {
- $('code_id').style.border="solid 2px red";
- $('code_id_span').innerHTML=' Code ne peut pas être vide';
+ if ($('code_id').value.trim() == '') {
+ $('code_id').style.border = "solid 2px red";
+ $('code_id_span').innerHTML = ' Code ne peut pas être vide';
return false;
}
try
{
- var qs = $(p_form_id).serialize() +
'&act=save_param_listing&'+$('common_frm').serialize();
+ var qs = $(p_form_id).serialize() + '&act=save_param_listing&' +
$('common_frm').serialize();
waiting_box();
var action = new Ajax.Request(
"ajax.php",
@@ -728,13 +769,18 @@
method: 'get',
parameters: qs,
onFailure: error_get_predef,
- onSuccess: function (req, json) {
+ onSuccess: function(req, json) {
try {
remove_waiting_box();
+ console.log(775);
var answer = req.responseXML;
+ console.log(777);
var acode = answer.getElementsByTagName('code');
+ console.log(778);
var ap_id = answer.getElementsByTagName('l_id');
+ console.log(779);
var html = answer.getElementsByTagName('html');
+ console.log(780);
if (acode.length == 0) {
var rec = req.responseText;
@@ -745,15 +791,23 @@
var code_html = unescape_xml(code_xml);
if (code == 'ok')
{
+ console.log('ok');
var afpid =
answer.getElementsByTagName('lp_id');
var fp_id = afpid[0].firstChild.nodeValue;
var p_id = ap_id[0].firstChild.nodeValue;
- // Ajoute une ligne avec résultat
- var mytable = g("definition_tb_id").tBodies[0];
- var nNumberRow = mytable.rows.length;
- var oRow = mytable.insertRow(nNumberRow);
- oRow.id = "tr_" + fp_id;
- oRow.innerHTML = code_html;
+ var update = $('tr_' + fp_id);
+ if (update == undefined)
+ {
+ // Ajoute une ligne avec résultat
+ var mytable =
g("definition_tb_id").tBodies[0];
+ var nNumberRow = mytable.rows.length;
+ var oRow = mytable.insertRow(nNumberRow);
+ oRow.id = "tr_" + fp_id;
+ oRow.innerHTML = code_html;
+ }
+ else {
+ update.innerHTML = code_html;
+ }
removeDiv('listing_param_input_div_id');
}
@@ -765,12 +819,15 @@
}
catch (e) {
alert("save_param_detail " + e.message);
+ console.log(e.message);
+ return false;
}
try {
code_html.evalScripts();
}
catch (e) {
alert("save_param_detail Impossible executer
script de la reponse\n" + e.message);
+ console.log(e.message);
}
}
@@ -780,18 +837,19 @@
catch (e)
{
alert(e.message);
+ return false;
}
return false;
}
-function listing_detail_remove(dossier,plugin_code,ac,id)
+function listing_detail_remove(dossier, plugin_code, ac, id)
{
- if ( confirm('Confirmez-vous effacer ce détail ?') == false )
+ if (confirm('Confirmez-vous effacer ce détail ?') == false)
{
return;
}
try {
- var query='plugin_code=' + plugin_code+ '&ac=' + ac+ '&gDossier='
+dossier+ '&act=listing_detail_remove' + "&id="+id;
+ var query = 'plugin_code=' + plugin_code + '&ac=' + ac + '&gDossier='
+ dossier + '&act=listing_detail_remove' + "&id=" + id;
waiting_box();
var action = new Ajax.Request(
"ajax.php",
@@ -799,7 +857,7 @@
method: 'get',
parameters: query,
onFailure: error_get_predef,
- onSuccess: function (req, json) {
+ onSuccess: function(req, json) {
try {
remove_waiting_box();
var answer = req.responseXML;
@@ -811,13 +869,13 @@
alert('erreur :' + rec);
}
var code = acode[0].firstChild.nodeValue;
-
+
if (code == 'ok')
{
- var row=$('tr_'+id);
- row.style.color="red";
- row.style.textDecoration='line-through';
- row.cells[row.cells.length-1].innerHTML="";
+ var row = $('tr_' + id);
+ row.style.color = "red";
+ row.style.textDecoration = 'line-through';
+ row.cells[row.cells.length - 1].innerHTML = "";
}
if (code == 'nok')
@@ -833,7 +891,7 @@
}
}
);
- } catch(e)
+ } catch (e)
{
alert(e.message);
}
@@ -970,15 +1028,27 @@
{
alert(e.message);
return false;
-
+
}
}
function send_email()
{
- if (trim($('p_from').value)=="") { alert('champs obligatoire manquant');
$('p_from').style.border="solid 2px red";return false;}
- if (trim($('p_subject').value)=="") { alert('champs obligatoire
manquant'); $('p_subject').style.border="solid 2px red";return false;}
- if (trim($('p_attach').value)=="") { alert('champs obligatoire manquant');
$('p_attach').style.border="solid 2px red";return false;}
- try {
+ if (trim($('p_from').value) == "") {
+ alert('champs obligatoire manquant');
+ $('p_from').style.border = "solid 2px red";
+ return false;
+ }
+ if (trim($('p_subject').value) == "") {
+ alert('champs obligatoire manquant');
+ $('p_subject').style.border = "solid 2px red";
+ return false;
+ }
+ if (trim($('p_attach').value) == "") {
+ alert('champs obligatoire manquant');
+ $('p_attach').style.border = "solid 2px red";
+ return false;
+ }
+ try {
var qs = $('parameter_send_email_input_frm').serialize(false);
waiting_box();
var action = new Ajax.Request(
@@ -1011,12 +1081,12 @@
{
alert(e.message);
return false;
-
+
}
}
function js_include_follow()
{
- try {
+ try {
var qs = $('include_follow_frm').serialize(false);
waiting_box();
var action = new Ajax.Request(
@@ -1048,12 +1118,12 @@
{
alert(e.message);
return false;
-
+
}
}
function js_include_follow_save()
{
- try {
+ try {
var qs = $('include_follow_save_frm').serialize(false);
waiting_box();
var action = new Ajax.Request(
@@ -1086,6 +1156,6 @@
{
alert(e.message);
return false;
-
+
}
}
\ No newline at end of file
---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpcompta-dev] r639 - in trunk/rapport_avance: . include include/template,
phpcompta-dev <=