mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge pull request #6680 from beganovich/v5-691
(v5) Show partial on the quotes
This commit is contained in:
commit
7f28f859ee
@ -241,6 +241,10 @@ class Design extends BaseDesign
|
|||||||
|
|
||||||
if ($this->entity instanceof Quote) {
|
if ($this->entity instanceof Quote) {
|
||||||
$variables = $this->context['pdf_variables']['quote_details'];
|
$variables = $this->context['pdf_variables']['quote_details'];
|
||||||
|
|
||||||
|
if ($this->entity->partial > 0) {
|
||||||
|
$variables[] = '$quote.balance_due';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->entity instanceof Credit) {
|
if ($this->entity instanceof Credit) {
|
||||||
@ -631,6 +635,10 @@ class Design extends BaseDesign
|
|||||||
if (in_array('$outstanding', $variables)) {
|
if (in_array('$outstanding', $variables)) {
|
||||||
$variables = \array_diff($variables, ['$outstanding']);
|
$variables = \array_diff($variables, ['$outstanding']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->entity->partial > 0) {
|
||||||
|
$variables[] = '$partial_due';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (['discount'] as $property) {
|
foreach (['discount'] as $property) {
|
||||||
|
@ -272,12 +272,21 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Some variables don't map 1:1 to table columns. This gives us support for such cases.
|
||||||
|
$aliases = [
|
||||||
|
'$quote.balance_due' => 'partial',
|
||||||
|
];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$_variable = explode('.', $variable)[1];
|
$_variable = explode('.', $variable)[1];
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new Exception('Company settings seems to be broken. Missing $entity.variable type.');
|
throw new Exception('Company settings seems to be broken. Missing $entity.variable type.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (\in_array($variable, \array_keys($aliases))) {
|
||||||
|
$_variable = $aliases[$variable];
|
||||||
|
}
|
||||||
|
|
||||||
if (is_null($this->entity->{$_variable})) {
|
if (is_null($this->entity->{$_variable})) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user