FIX Can convert a partially closed down payment when close for
bankcharge
This commit is contained in:
parent
37db86183c
commit
5e451e1155
@ -425,12 +425,12 @@ if ($socid > 0) {
|
||||
print '<td class="nowrap">'.$langs->trans("ConsumedBy").'</td>';
|
||||
print '<td class="right">'.$langs->trans("AmountHT").'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td class="right">'.$langs->trans("MulticurrencyAmountHT").'</td>';
|
||||
print '<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountHT")).'">'.$langs->trans("MulticurrencyAmountHT").'</td>';
|
||||
}
|
||||
print '<td class="right">'.$langs->trans("VATRate").'</td>';
|
||||
print '<td class="right">'.$langs->trans("AmountTTC").'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td class="right">'.$langs->trans("MulticurrencyAmountTTC").'</td>';
|
||||
print '<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountTTC")).'">'.$langs->trans("MulticurrencyAmountTTC").'</td>';
|
||||
}
|
||||
print '<td width="100" class="center">'.$langs->trans("DiscountOfferedBy").'</td>';
|
||||
print '<td width="50"> </td>';
|
||||
@ -563,12 +563,12 @@ if ($socid > 0) {
|
||||
print '<td class="nowrap">'.$langs->trans("ConsumedBy").'</td>';
|
||||
print '<td class="right">'.$langs->trans("AmountHT").'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td class="right">'.$langs->trans("MulticurrencyAmountHT").'</td>';
|
||||
print '<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountHT")).'">'.$langs->trans("MulticurrencyAmountHT").'</td>';
|
||||
}
|
||||
print '<td class="right">'.$langs->trans("VATRate").'</td>';
|
||||
print '<td class="right">'.$langs->trans("AmountTTC").'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td class="right">'.$langs->trans("MulticurrencyAmountTTC").'</td>';
|
||||
print '<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountTTC")).'">'.$langs->trans("MulticurrencyAmountTTC").'</td>';
|
||||
}
|
||||
print '<td width="100" class="center">'.$langs->trans("DiscountOfferedBy").'</td>';
|
||||
print '<td width="50"> </td>';
|
||||
@ -736,12 +736,12 @@ if ($socid > 0) {
|
||||
print '<td class="nowrap">'.$langs->trans("ConsumedBy").'</td>';
|
||||
print '<td class="right">'.$langs->trans("AmountHT").'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td class="right">'.$langs->trans("MulticurrencyAmountHT").'</td>';
|
||||
print '<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountHT")).'">'.$langs->trans("MulticurrencyAmountHT").'</td>';
|
||||
}
|
||||
print '<td class="right">'.$langs->trans("VATRate").'</td>';
|
||||
print '<td class="right">'.$langs->trans("AmountTTC").'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td class="right">'.$langs->trans("MulticurrencyAmountTTC").'</td>';
|
||||
print '<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountTTC")).'">'.$langs->trans("MulticurrencyAmountTTC").'</td>';
|
||||
}
|
||||
print '<td width="100" class="center">'.$langs->trans("Author").'</td>';
|
||||
print '<td width="50"> </td>';
|
||||
@ -897,12 +897,12 @@ if ($socid > 0) {
|
||||
print '<td class="nowrap">'.$langs->trans("ConsumedBy").'</td>';
|
||||
print '<td class="right">'.$langs->trans("AmountHT").'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td class="right">'.$langs->trans("MulticurrencyAmountHT").'</td>';
|
||||
print '<td class="right toverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountHT")).'">'.$langs->trans("MulticurrencyAmountHT").'</td>';
|
||||
}
|
||||
print '<td class="right">'.$langs->trans("VATRate").'</td>';
|
||||
print '<td class="right">'.$langs->trans("AmountTTC").'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td class="right">'.$langs->trans("MulticurrencyAmountTTC").'</td>';
|
||||
print '<td class="right tdoverflowmax125" title="'.dol_escape_htmltag($langs->trans("MulticurrencyAmountTTC")).'">'.$langs->trans("MulticurrencyAmountTTC").'</td>';
|
||||
}
|
||||
print '<td width="100" class="center">'.$langs->trans("Author").'</td>';
|
||||
print '<td width="50"> </td>';
|
||||
|
||||
@ -5522,9 +5522,9 @@ if ($action == 'create') {
|
||||
) {
|
||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=converttoreduc" title="'.dol_escape_htmltag($langs->trans("ConfirmConvertToReduc2")).'">'.$langs->trans('ConvertToReduc').'</a>';
|
||||
}
|
||||
// For deposit invoice
|
||||
// For down payment invoice (deposit)
|
||||
if ($object->type == Facture::TYPE_DEPOSIT && $usercancreate && $object->statut > Facture::STATUS_DRAFT && empty($discount->id)) {
|
||||
if (price2num($object->total_ttc, 'MT') == price2num($sumofpaymentall, 'MT')) {
|
||||
if (price2num($object->total_ttc, 'MT') == price2num($sumofpaymentall, 'MT') || ($object->type == Facture::STATUS_ABANDONED && in_array($object->close_code, array('bankcharge', 'discount_vat', 'other')))) {
|
||||
// We can close a down payment only if paid amount is same than amount of down payment (by definition)
|
||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=converttoreduc">'.$langs->trans('ConvertToReduc').'</a>';
|
||||
} else {
|
||||
|
||||
@ -167,7 +167,7 @@ class Facture extends CommonInvoice
|
||||
public $revenuestamp;
|
||||
|
||||
/**
|
||||
* ! Closing after partial payment: discount_vat, badsupplier, abandon
|
||||
* ! Closing after partial payment: discount_vat, badcustomer or badsupplier, bankcharge, other
|
||||
* ! Closing when no payment: replaced, abandoned
|
||||
* @var string Close code
|
||||
*/
|
||||
@ -424,7 +424,10 @@ class Facture extends CommonInvoice
|
||||
const STATUS_ABANDONED = 3;
|
||||
|
||||
const CLOSECODE_DISCOUNTVAT = 'discount_vat'; // Abandonned remain - escompte
|
||||
const CLOSECODE_BADDEBT = 'badcustomer'; // Abandonned - bad
|
||||
const CLOSECODE_BADDEBT = 'badcustomer'; // Abandonned remain - bad customer
|
||||
const CLOSECODE_BANKCHARGE = 'bankcharge'; // Abandonned remain - bank charge
|
||||
const CLOSECODE_OTHER = 'other'; // Abandonned remain - other
|
||||
|
||||
const CLOSECODE_ABANDONED = 'abandon'; // Abandonned - other
|
||||
const CLOSECODE_REPLACED = 'replaced'; // Closed after doing a replacement invoice
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user