Support for 1:1 columns

This commit is contained in:
Benjamin Beganović 2021-09-20 08:47:54 +02:00
parent a51436f224
commit a2eec608d9

View File

@ -272,12 +272,21 @@ document.addEventListener('DOMContentLoaded', function() {
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 {
$_variable = explode('.', $variable)[1];
} catch (Exception $e) {
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})) {
return true;
}