Merge pull request #3008 from CihanSenturk/import-and-export-parent-number-issues
Import and export parent number issues
This commit is contained in:
commit
4c6408f15f
@ -26,7 +26,7 @@ class Bills extends Export implements WithColumnFormatting
|
||||
$model->bill_number = $model->document_number;
|
||||
$model->billed_at = $model->issued_at;
|
||||
$model->contact_country = $country;
|
||||
$model->parent_number = Model::billRecurring()->find($model->parent_id)?->document_number ?? null;
|
||||
$model->parent_number = Model::billRecurring()->find($model->parent_id)?->document_number;
|
||||
|
||||
return parent::map($model);
|
||||
}
|
||||
@ -53,7 +53,7 @@ class Bills extends Export implements WithColumnFormatting
|
||||
'contact_zip_code',
|
||||
'contact_city',
|
||||
'notes',
|
||||
'parent_number',
|
||||
'parent_number'
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ class Bills extends Import
|
||||
$row['currency_code'] = $this->getCurrencyCode($row);
|
||||
$row['type'] = Model::BILL_TYPE;
|
||||
$row['contact_country'] = !empty($country) ? $country : null;
|
||||
$row['parent_id'] = $this->getParentId($row);
|
||||
$row['parent_id'] = $this->getParentId($row) ?? 0;
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ class Invoices extends Import
|
||||
$row['currency_code'] = $this->getCurrencyCode($row);
|
||||
$row['type'] = Model::INVOICE_TYPE;
|
||||
$row['contact_country'] = !empty($country) ? $country : null;
|
||||
$row['parent_id'] = $this->getParentId($row);
|
||||
$row['parent_id'] = $this->getParentId($row) ?? 0;
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
@ -154,11 +154,15 @@ trait Import
|
||||
{
|
||||
$id = isset($row['parent_id']) ? $row['parent_id'] : null;
|
||||
|
||||
if (empty($id) && isset($row['document_number']) && !empty($row['parent_number'])) {
|
||||
if (empty($row['parent_number'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (empty($id) && (!empty($row['document_number']) || !empty($row['invoice_number']) || !empty($row['bill_number']))) {
|
||||
$id = Document::number($row['parent_number'])->pluck('id')->first();
|
||||
}
|
||||
|
||||
if (empty($id) && isset($row['number']) && !empty($row['parent_number'])) {
|
||||
if (empty($id) && isset($row['number'])) {
|
||||
$id = Transaction::number($row['parent_number'])->pluck('id')->first();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user