Add fix when saving an invoice with no service charges. #341
This commit is contained in:
parent
0cff722c6a
commit
f9c304422c
3 changed files with 25 additions and 4 deletions
|
|
@ -821,4 +821,9 @@ class JobOrder
|
|||
{
|
||||
return $this->meta[$id];
|
||||
}
|
||||
|
||||
public function getAllMeta()
|
||||
{
|
||||
return $this->meta;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -162,12 +162,15 @@ class CMBInvoiceGenerator implements InvoiceGeneratorInterface
|
|||
}
|
||||
|
||||
// get the meta for service charges
|
||||
$service_charges = $jo->getMeta('service_charges');
|
||||
if ($service_charges != null)
|
||||
if (array_key_exists('service_charges', $jo->getAllMeta()))
|
||||
{
|
||||
$service_charges = $jo->getMeta('service_charges');
|
||||
if ($service_charges != null)
|
||||
{
|
||||
$service_charges = $jo->getMeta('service_charges');
|
||||
|
||||
$this->invoiceServiceCharges($criteria, $service_charges);
|
||||
$this->invoiceServiceCharges($criteria, $service_charges);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1373,6 +1373,7 @@ $(function() {
|
|||
$("#btn-reset-invoice").click(function() {
|
||||
$("#invoice-discount").prop('selectedIndex', 0);
|
||||
invoiceItems = [];
|
||||
sc_array = [];
|
||||
generateInvoice();
|
||||
});
|
||||
|
||||
|
|
@ -1688,6 +1689,19 @@ $(function() {
|
|||
console.log('removing service charge');
|
||||
|
||||
$(this).closest('.row').remove();
|
||||
|
||||
sc_array.length = 0;
|
||||
|
||||
// get the service charges
|
||||
$('.sc-select').each(function() {
|
||||
var id = $(this).children('option:selected').val();
|
||||
sc_array.push({
|
||||
id: id,
|
||||
});
|
||||
});
|
||||
|
||||
generateInvoice();
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
|
|
@ -1704,7 +1718,6 @@ $(function() {
|
|||
sc_array.push({
|
||||
id: id,
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
generateInvoice();
|
||||
|
|
|
|||
Loading…
Reference in a new issue