Bug #0001562: Achat mémoriser également 3 champs

This commit is contained in:
Dany De Bontridder 2018-03-05 23:08:08 +01:00
parent 39b198867d
commit c8709f2d5c
4 changed files with 29 additions and 11 deletions

View file

@ -2396,15 +2396,22 @@ class Acc_Ledger extends jrn_def_sql
$Res=$this->db->alter_seq("s_jrn_pj".$p_jrn, $jrn_def_pj_seq);
}
}
function input_paid($p_selected)
/**
* Create the section payment
* @param int $p_selected
* @param number $p_amount
* @param date $p_date or empty string
* @param string $p_comm or empty comm
* @return string
*/
function input_paid($p_selected,$p_amount=0,$p_date="",$p_comm="")
{
$r='';
$r.='<div id="payment"> ';
$r.='<h2> '._('Payement').' </h2>';
$r.='<h2> '._('Paiement').' </h2>';
$mp=new Acc_Payment($this->db);
$mp->set_parameter('ledger_source', $this->id);
$r.=$mp->select($p_selected);
$r.=$mp->select($p_selected,$p_amount,$p_date,$p_comm);
$r.='</div>';
return $r;
}

View file

@ -280,9 +280,12 @@ class Acc_Payment
* \todo this class is used only for storage of the defined payment method, not the payment itself,
* it must be moved to another class 'Operation_Payment'
*\param $p_selected if the id choose
*\param $p_date date of payment
*\param $p_amount amount already paid
*\param $p_comm label of payment
*\return html string
*/
public function select($p_select)
public function select($p_select,$p_amount,$p_date,$p_comm)
{
$r='';
$array=$this->get_valide();
@ -290,15 +293,16 @@ class Acc_Payment
if ( empty($array)==false ) {
$date_pay=new IDate('mp_date');
$date_pay->value=$p_date;
$r.=sprintf(_("Date %s"),
$date_pay->input());
$acompte=new INum('acompte');
$acompte->value=0;
$acompte->value=$p_amount;
$r.=_(" Acompte à déduire");
$r.=$acompte->input();
$r.='<p>';
$e_comm_paiement=new IText('e_comm_paiement');
$e_comm_paiement->value=$p_comm;
$e_comm_paiement->table = 0;
$e_comm_paiement->setReadOnly(false);
$e_comm_paiement->size = 60;

View file

@ -256,6 +256,10 @@ echo '<p class="notice">'.$p_msg.'</p>';
try
{
$payment=$http->request("e_mp", "string",0);
$date_payment=$http->request("mp_date", "string","");
$comm_payment=$http->request("e_comm_paiement", "string","");
$acompte=$http->request("acompte", "string",0);
echo "<FORM class=\"print\"NAME=\"form_detail\" METHOD=\"POST\" >";
/* request for a predefined operation */
if (isset($_REQUEST['pre_def'])&&!isset($_POST['correct']) && ! isset($correct) )
@ -282,7 +286,7 @@ try
echo HtmlInput::hidden("p_action", "ach");
echo HtmlInput::hidden("sa", "p");
echo '<div class="content">';
echo $Ledger->input_paid($payment);
echo $Ledger->input_paid($payment,$acompte,$date_payment,$comm_payment);
echo '</div>';
echo '<script>';
echo 'compute_all_ledger();';

View file

@ -276,7 +276,10 @@ echo '<p class="notice">'.$p_msg.'</p>';
try
{
$payment=$http->request("e_mp","string", 0);
$date_payment=$http->request("mp_date", "string","");
$comm_payment=$http->request("e_comm_paiement", "string","");
$acompte=$http->request("acompte", "string",0);
echo "<FORM class=\"print\" NAME=\"form_detail\" METHOD=\"POST\" >";
/* request for a predefined operation */
if (isset($_REQUEST['pre_def'])&&!isset($_POST['correct']) && ! isset($correct))
@ -304,7 +307,7 @@ try
echo HtmlInput::hidden("sa", "p");
echo $Ledger->input($array);
echo '<div class="content">';
echo $Ledger->input_paid($payment);
echo $Ledger->input_paid($payment,$acompte,$date_payment,$comm_payment);
echo '</div>';
echo '<script>';
echo 'compute_all_ledger();';
@ -318,7 +321,7 @@ try
echo $Ledger->input($array);
echo '<div class="content">';
echo $Ledger->input_paid($payment);
echo $Ledger->input_paid($payment,$acompte,$date_payment,$comm_payment);
echo '</div>';
echo '<script>';
echo 'compute_all_ledger();';