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];
|
return $this->meta[$id];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getAllMeta()
|
||||||
|
{
|
||||||
|
return $this->meta;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -162,12 +162,15 @@ class CMBInvoiceGenerator implements InvoiceGeneratorInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the meta for service charges
|
// get the meta for service charges
|
||||||
$service_charges = $jo->getMeta('service_charges');
|
if (array_key_exists('service_charges', $jo->getAllMeta()))
|
||||||
if ($service_charges != null)
|
|
||||||
{
|
{
|
||||||
$service_charges = $jo->getMeta('service_charges');
|
$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() {
|
$("#btn-reset-invoice").click(function() {
|
||||||
$("#invoice-discount").prop('selectedIndex', 0);
|
$("#invoice-discount").prop('selectedIndex', 0);
|
||||||
invoiceItems = [];
|
invoiceItems = [];
|
||||||
|
sc_array = [];
|
||||||
generateInvoice();
|
generateInvoice();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -1688,6 +1689,19 @@ $(function() {
|
||||||
console.log('removing service charge');
|
console.log('removing service charge');
|
||||||
|
|
||||||
$(this).closest('.row').remove();
|
$(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;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -1704,7 +1718,6 @@ $(function() {
|
||||||
sc_array.push({
|
sc_array.push({
|
||||||
id: id,
|
id: id,
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
generateInvoice();
|
generateInvoice();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue