@@ -20,94+20,114 @@ function void_transaction($type, $type_no, $date_, $memo_)
$void_entry = get_voided_entry($type, $type_no);
if ($void_entry != null)
$void_entry = get_voided_entry($type, $type_no);
if ($void_entry != null)
- return false;
+ return _('This transaction was already voided before.');
switch ($type) {
case ST_JOURNAL : // it's a journal entry
if (!exists_gl_trans($type, $type_no))
switch ($type) {
case ST_JOURNAL : // it's a journal entry
if (!exists_gl_trans($type, $type_no))
- return false;
+ return _('Selected transaction does not exists.');
+ if ($wo = check_wo_costing($type, $type_no))
+ return sprintf(_('This transaction cannot be voided because it is part of Work Order %s costs.'), $wo);
void_journal_trans($type, $type_no);
break;
void_journal_trans($type, $type_no);
break;
- case ST_BANKPAYMENT : // it's a payment
case ST_BANKDEPOSIT : // it's a deposit
case ST_BANKTRANSFER : // it's a transfer
case ST_BANKDEPOSIT : // it's a deposit
case ST_BANKTRANSFER : // it's a transfer
+ if (!check_void_bank_trans($type, $type_no))
+ return _('This transaction cannot be voided because the operation would decrease account balance below allowed limit in some point of account history.');
+ case ST_BANKPAYMENT : // it's a payment
if (!exists_bank_trans($type, $type_no))
if (!exists_bank_trans($type, $type_no))
- return false;
+ return _('Selected transaction does not exists.');
void_bank_trans($type, $type_no);
break;
void_bank_trans($type, $type_no);
break;
+ case ST_CUSTPAYMENT : // it's a customer payment
+ if (!check_void_bank_trans($type, $type_no))
+ return _('This transaction cannot be voided because the operation would decrease account balance below allowed limit in some point of account history.');
case ST_SALESINVOICE : // it's a customer invoice
case ST_SALESINVOICE : // it's a customer invoice
+ if (is_cust_invoice_credited($type_no))
+ return _('This invoice cannot be voided because it was already credited.');
case ST_CUSTCREDIT : // it's a customer credit note
case ST_CUSTCREDIT : // it's a customer credit note
- case ST_CUSTPAYMENT : // it's a customer payment
case ST_CUSTDELIVERY : // it's a customer dispatch
if (!exists_customer_trans($type, $type_no))
case ST_CUSTDELIVERY : // it's a customer dispatch
if (!exists_customer_trans($type, $type_no))
- return false;
+ return _('Selected transaction does not exists.');
if ($type == ST_CUSTDELIVERY) // added 04 Oct 2008 by Joe Hunt. If delivery note has a not voided invoice, then NO.
{
if ($type == ST_CUSTDELIVERY) // added 04 Oct 2008 by Joe Hunt. If delivery note has a not voided invoice, then NO.