#1184 : remet le paiement par défaut si correction demandée

This commit is contained in:
Dany De Bontridder 2015-11-06 19:22:23 +01:00
parent 20cf9fef23
commit 24c93c135e
4 changed files with 19 additions and 12 deletions

View file

@ -3621,14 +3621,14 @@ class Acc_Ledger extends jrn_def_sql
}
}
function input_paid()
function input_paid($p_selected)
{
$r = '';
$r.='<div id="payment"> ';
$r.='<h2> ' . _('Payé par') . ' </h2>';
$mp = new Acc_Payment($this->db);
$mp->set_parameter('ledger_source', $this->id);
$r.=$mp->select();
$r.=$mp->select($p_selected);
$r.='</div>';
return $r;
}

View file

@ -275,10 +275,10 @@ class Acc_Payment
}
/*!\brief show several lines with radio button to select the payment
*method we want to use, the $_POST['e_mp'] will be set
*\param none
*\param $p_selected if the id choose
*\return html string
*/
public function select()
public function select($p_select)
{
$r='';
$array=$this->get_valide();
@ -313,17 +313,20 @@ class Acc_Payment
{
$a=new ICard();
$a->jrn=$row->mp_jrn_def_id;
$a->set_attribute('typecard',$row->mp_fd_id);
$a->set_attribute('typecard',$row->mp_fd_id);
$a->name='e_mp_qcode_'.$row->mp_id;
$a->set_dblclick("fill_ipopcard(this);");
$a->set_callback('filter_card');
$a->set_function('fill_data');
$a->set_attribute('ipopup','ipopcard');
$a->set_attribute('label',$a->name.'_label');
if ( $p_select == $row->mp_id ) {
$a->value=HtmlInput::default_value_request("e_mp_qcode_".$p_select, "");
}
$s=new ISpan();
$s->name=$a->name.'_label';
$f=_(" paiement par ").$a->input().$s->input();
}
else
{
@ -336,7 +339,8 @@ class Acc_Payment
// $f.=$fiche->strAttribut(ATTR_DEF_NAME);
}
$r.='<li><input type="radio" name="e_mp" value="'.$row->mp_id.'">';
$check=( $p_select == $row->mp_id)?" checked " : "unchecked";
$r.='<li><input type="radio" name="e_mp" value="'.$row->mp_id.'" '.$check.'>';
$r.=$row->mp_lib.' '.$f;
}

View file

@ -251,6 +251,7 @@ else
echo '<p class="notice">'.$p_msg.'</p>';
try
{
$payment=HtmlInput::default_value_request("e_mp", 0);
echo "<FORM class=\"print\"NAME=\"form_detail\" METHOD=\"POST\" >";
/* request for a predefined operation */
if (isset($_REQUEST['pre_def'])&&!isset($_POST['correct']))
@ -264,7 +265,7 @@ try
$p_post['p_jrn']=$Ledger->id;
echo $Ledger->input($p_post);
echo '<div class="content">';
echo $Ledger->input_paid();
echo $Ledger->input_paid($payment);
echo '</div>';
echo '<script>';
echo 'compute_all_ledger();';
@ -276,7 +277,7 @@ try
echo HtmlInput::hidden("p_action", "ach");
echo HtmlInput::hidden("sa", "p");
echo '<div class="content">';
echo $Ledger->input_paid();
echo $Ledger->input_paid($payment);
echo '</div>';
echo '<script>';
echo 'compute_all_ledger();';

View file

@ -265,6 +265,8 @@ echo '<div class="content">';
echo '<p class="notice">'.$p_msg.'</p>';
try
{
$payment=HtmlInput::default_value_request("e_mp", 0);
echo "<FORM class=\"print\" NAME=\"form_detail\" METHOD=\"POST\" >";
/* request for a predefined operation */
if (isset($_REQUEST['pre_def'])&&!isset($_POST['correct']))
@ -278,7 +280,7 @@ try
echo $Ledger->input($p_post);
echo '<div class="content">';
echo $Ledger->input_paid();
echo $Ledger->input_paid($payment);
echo '</div>';
echo '<script>';
echo 'compute_all_ledger();';
@ -292,7 +294,7 @@ try
echo HtmlInput::hidden("sa", "p");
echo $Ledger->input($array);
echo '<div class="content">';
echo $Ledger->input_paid();
echo $Ledger->input_paid($payment);
echo '</div>';
echo '<script>';
echo 'compute_all_ledger();';
@ -306,7 +308,7 @@ try
echo $Ledger->input($array);
echo '<div class="content">';
echo $Ledger->input_paid();
echo $Ledger->input_paid($payment);
echo '</div>';
echo '<script>';
echo 'compute_all_ledger();';