Merge branch '8.0' of https://github.com/Dolibarr/dolibarr into FIX_credit_note_used_on_list
This commit is contained in:
commit
57fff10766
@ -688,6 +688,7 @@ if (empty($reshook))
|
|||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$amount_ht = $amount_tva = $amount_ttc = array();
|
$amount_ht = $amount_tva = $amount_ttc = array();
|
||||||
|
$multicurrency_amount_ht = $multicurrency_amount_tva = $multicurrency_amount_ttc = array();
|
||||||
|
|
||||||
// Loop on each vat rate
|
// Loop on each vat rate
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@ -701,7 +702,7 @@ if (empty($reshook))
|
|||||||
$multicurrency_amount_ht[$line->tva_tx] += $line->multicurrency_total_ht;
|
$multicurrency_amount_ht[$line->tva_tx] += $line->multicurrency_total_ht;
|
||||||
$multicurrency_amount_tva[$line->tva_tx] += $line->multicurrency_total_tva;
|
$multicurrency_amount_tva[$line->tva_tx] += $line->multicurrency_total_tva;
|
||||||
$multicurrency_amount_ttc[$line->tva_tx] += $line->multicurrency_total_ttc;
|
$multicurrency_amount_ttc[$line->tva_tx] += $line->multicurrency_total_ttc;
|
||||||
$i ++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -250,11 +250,14 @@ if (empty($reshook))
|
|||||||
$paiement->amounts = $amounts; // Array with all payments dispatching with invoice id
|
$paiement->amounts = $amounts; // Array with all payments dispatching with invoice id
|
||||||
$paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching
|
$paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching
|
||||||
$paiement->paiementid = dol_getIdFromCode($db,GETPOST('paiementcode'),'c_paiement','code','id',1);
|
$paiement->paiementid = dol_getIdFromCode($db,GETPOST('paiementcode'),'c_paiement','code','id',1);
|
||||||
$paiement->num_paiement = GETPOST('num_paiement');
|
$paiement->num_paiement = GETPOST('num_paiement', 'alpha');
|
||||||
$paiement->note = GETPOST('comment');
|
$paiement->note = GETPOST('comment', 'alpha');
|
||||||
|
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
|
// Create payment and update this->multicurrency_amounts if this->amounts filled or
|
||||||
|
// this->amounts if this->multicurrency_amounts filled.
|
||||||
$paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices')=='on'?1:0)); // This include closing invoices and regenerating documents
|
$paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices')=='on'?1:0)); // This include closing invoices and regenerating documents
|
||||||
if ($paiement_id < 0)
|
if ($paiement_id < 0)
|
||||||
{
|
{
|
||||||
@ -279,7 +282,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
|
|
||||||
// If payment dispatching on more than one invoice, we keep on summary page, otherwise jump on invoice card
|
// If payment dispatching on more than one invoice, we stay on summary page, otherwise jump on invoice card
|
||||||
$invoiceid=0;
|
$invoiceid=0;
|
||||||
foreach ($paiement->amounts as $key => $amount)
|
foreach ($paiement->amounts as $key => $amount)
|
||||||
{
|
{
|
||||||
@ -649,12 +652,12 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
|||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Multicurrency Price
|
// Multicurrency remain to pay
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) print price($sign * $multicurrency_remaintopay);
|
if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) print price($sign * $multicurrency_remaintopay);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="right">';
|
print '<td class="right nowraponall">';
|
||||||
|
|
||||||
// Add remind multicurrency amount
|
// Add remind multicurrency amount
|
||||||
$namef = 'multicurrency_amount_'.$objp->facid;
|
$namef = 'multicurrency_amount_'.$objp->facid;
|
||||||
@ -666,12 +669,12 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
|||||||
{
|
{
|
||||||
if (!empty($conf->use_javascript_ajax))
|
if (!empty($conf->use_javascript_ajax))
|
||||||
print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $multicurrency_remaintopay)."'");
|
print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $multicurrency_remaintopay)."'");
|
||||||
|
print '<input type="text" class="maxwidth75 multicurrency_amount" name="'.$namef.'" value="'.$_POST[$namef].'">';
|
||||||
print '<input type=hidden class="multicurrency_remain" name="'.$nameRemain.'" value="'.$multicurrency_remaintopay.'">';
|
print '<input type=hidden class="multicurrency_remain" name="'.$nameRemain.'" value="'.$multicurrency_remaintopay.'">';
|
||||||
print '<input type="text" size="8" class="multicurrency_amount" name="'.$namef.'" value="'.$_POST[$namef].'">';
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<input type="text" size="8" name="'.$namef.'_disabled" value="'.$_POST[$namef].'" disabled>';
|
print '<input type="text" class="maxwidth75" name="'.$namef.'_disabled" value="'.$_POST[$namef].'" disabled>';
|
||||||
print '<input type="hidden" name="'.$namef.'" value="'.$_POST[$namef].'">';
|
print '<input type="hidden" name="'.$namef.'" value="'.$_POST[$namef].'">';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -692,7 +695,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
|||||||
//$test= price(price2num($objp->total_ttc - $paiement - $creditnotes - $deposits));
|
//$test= price(price2num($objp->total_ttc - $paiement - $creditnotes - $deposits));
|
||||||
|
|
||||||
// Amount
|
// Amount
|
||||||
print '<td align="right">';
|
print '<td class="right nowraponall">';
|
||||||
|
|
||||||
// Add remind amount
|
// Add remind amount
|
||||||
$namef = 'amount_'.$objp->facid;
|
$namef = 'amount_'.$objp->facid;
|
||||||
@ -702,12 +705,12 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
|||||||
{
|
{
|
||||||
if (!empty($conf->use_javascript_ajax))
|
if (!empty($conf->use_javascript_ajax))
|
||||||
print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $remaintopay)."'");
|
print img_picto("Auto fill",'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $remaintopay)."'");
|
||||||
|
print '<input type="text" class="maxwidth75 amount" name="'.$namef.'" value="'.dol_escape_htmltag(GETPOST($namef)).'">';
|
||||||
print '<input type="hidden" class="remain" name="'.$nameRemain.'" value="'.$remaintopay.'">';
|
print '<input type="hidden" class="remain" name="'.$nameRemain.'" value="'.$remaintopay.'">';
|
||||||
print '<input type="text" size="8" class="amount" name="'.$namef.'" value="'.dol_escape_htmltag(GETPOST($namef)).'">';
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<input type="text" size="8" name="'.$namef.'_disabled" value="'.dol_escape_htmltag(GETPOST($namef)).'" disabled>';
|
print '<input type="text" class="maxwidth75" name="'.$namef.'_disabled" value="'.dol_escape_htmltag(GETPOST($namef)).'" disabled>';
|
||||||
print '<input type="hidden" name="'.$namef.'" value="'.dol_escape_htmltag(GETPOST($namef)).'">';
|
print '<input type="hidden" name="'.$namef.'" value="'.dol_escape_htmltag(GETPOST($namef)).'">';
|
||||||
}
|
}
|
||||||
print "</td>";
|
print "</td>";
|
||||||
|
|||||||
@ -292,6 +292,7 @@ class Paiement extends CommonObject
|
|||||||
if ($invoice->type == Facture::TYPE_DEPOSIT)
|
if ($invoice->type == Facture::TYPE_DEPOSIT)
|
||||||
{
|
{
|
||||||
$amount_ht = $amount_tva = $amount_ttc = array();
|
$amount_ht = $amount_tva = $amount_ttc = array();
|
||||||
|
$multicurrency_amount_ht = $multicurrency_amount_tva = $multicurrency_amount_ttc = array();
|
||||||
|
|
||||||
// Insert one discount by VAT rate category
|
// Insert one discount by VAT rate category
|
||||||
$discount = new DiscountAbsolute($this->db);
|
$discount = new DiscountAbsolute($this->db);
|
||||||
@ -310,6 +311,9 @@ class Paiement extends CommonObject
|
|||||||
$amount_ht[$line->tva_tx] += $line->total_ht;
|
$amount_ht[$line->tva_tx] += $line->total_ht;
|
||||||
$amount_tva[$line->tva_tx] += $line->total_tva;
|
$amount_tva[$line->tva_tx] += $line->total_tva;
|
||||||
$amount_ttc[$line->tva_tx] += $line->total_ttc;
|
$amount_ttc[$line->tva_tx] += $line->total_ttc;
|
||||||
|
$multicurrency_amount_ht[$line->tva_tx] += $line->multicurrency_total_ht;
|
||||||
|
$multicurrency_amount_tva[$line->tva_tx] += $line->multicurrency_total_tva;
|
||||||
|
$multicurrency_amount_ttc[$line->tva_tx] += $line->multicurrency_total_ttc;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -318,6 +322,9 @@ class Paiement extends CommonObject
|
|||||||
$discount->amount_ht = abs($amount_ht[$tva_tx]);
|
$discount->amount_ht = abs($amount_ht[$tva_tx]);
|
||||||
$discount->amount_tva = abs($amount_tva[$tva_tx]);
|
$discount->amount_tva = abs($amount_tva[$tva_tx]);
|
||||||
$discount->amount_ttc = abs($amount_ttc[$tva_tx]);
|
$discount->amount_ttc = abs($amount_ttc[$tva_tx]);
|
||||||
|
$discount->multicurrency_amount_ht = abs($multicurrency_amount_ht[$tva_tx]);
|
||||||
|
$discount->multicurrency_amount_tva = abs($multicurrency_amount_tva[$tva_tx]);
|
||||||
|
$discount->multicurrency_amount_ttc = abs($multicurrency_amount_ttc[$tva_tx]);
|
||||||
$discount->tva_tx = abs($tva_tx);
|
$discount->tva_tx = abs($tva_tx);
|
||||||
|
|
||||||
$result = $discount->create($user);
|
$result = $discount->create($user);
|
||||||
@ -995,7 +1002,7 @@ class Paiement extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* get the right way of payment
|
* get the right way of payment
|
||||||
*
|
*
|
||||||
* @return string 'dolibarr' if standard comportment or paid in dolibarr currency, 'customer' if payment received from multicurrency inputs
|
* @return string 'dolibarr' if standard comportment or paid in main currency, 'customer' if payment received from multicurrency inputs
|
||||||
*/
|
*/
|
||||||
function getWay()
|
function getWay()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -33,10 +33,14 @@ class DiscountAbsolute
|
|||||||
|
|
||||||
public $id; // Id discount
|
public $id; // Id discount
|
||||||
public $fk_soc;
|
public $fk_soc;
|
||||||
public $discount_type; // 0 => customer discount, 1 => supplier discount
|
|
||||||
public $amount_ht; //
|
public $discount_type; // 0 => customer discount, 1 => supplier discount
|
||||||
|
public $amount_ht; //
|
||||||
public $amount_tva; //
|
public $amount_tva; //
|
||||||
public $amount_ttc; //
|
public $amount_ttc; //
|
||||||
|
public $multicurrency_amount_ht;
|
||||||
|
public $multicurrency_amount_tva;
|
||||||
|
public $multicurrency_amount_ttc;
|
||||||
public $tva_tx; // Vat rate
|
public $tva_tx; // Vat rate
|
||||||
public $fk_user; // Id utilisateur qui accorde la remise
|
public $fk_user; // Id utilisateur qui accorde la remise
|
||||||
public $description; // Description libre
|
public $description; // Description libre
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user