Convert expense type to char, translations for ExpenseType

This commit is contained in:
Nabeel Shahzad
2018-04-01 22:26:20 -05:00
parent 2a01a935c0
commit cfd0853d79
12 changed files with 78 additions and 65 deletions

View File

@@ -60,7 +60,7 @@ class RecurringFinanceService extends Service
if ($expense->ref_model) {
$ref = explode('\\', $expense->ref_model);
$klass = end($ref);
$obj = $expense->getReference();
$obj = $expense->getReferencedObject();
}
if ($klass === 'Airport') {

View File

@@ -44,15 +44,13 @@ class ExpenseExporter extends ImportExport
$ret['airline'] = $expense->airline->icao;
}
$ret['type'] = ExpenseType::convertToCode($ret['type']);
// For the different expense types, instead of exporting
// the ID, export a specific column
if ($expense->ref_model === Expense::class) {
$ret['ref_model'] = '';
$ret['ref_model_id'] = '';
} else {
$obj = $expense->getReference();
$obj = $expense->getReferencedObject();
if(!$obj) { // bail out
return $ret;
}

View File

@@ -49,7 +49,6 @@ class ExpenseImporter extends ImportExport
# Figure out what this is referring to
$row = $this->getRefClassInfo($row);
$row['type'] = ExpenseType::getFromCode($row['type']);
if(!$row['active']) {
$row['active'] = true;
}