mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 17:34:30 -04:00
Small improvement for document imports
This commit is contained in:
parent
886e6b3de8
commit
73df9cc494
@ -49,7 +49,7 @@ class StoreSchedulerRequest extends Request
|
|||||||
'parameters.entity_id' => ['bail', 'sometimes', 'string'],
|
'parameters.entity_id' => ['bail', 'sometimes', 'string'],
|
||||||
'parameters.report_name' => ['bail','sometimes', 'string', 'required_if:template,email_report','in:ar_detailed,ar_summary,client_balance,tax_summary,profitloss,client_sales,user_sales,product_sales,activity,client,contact,client_contact,credit,document,expense,invoice,invoice_item,quote,quote_item,recurring_invoice,payment,product,task'],
|
'parameters.report_name' => ['bail','sometimes', 'string', 'required_if:template,email_report','in:ar_detailed,ar_summary,client_balance,tax_summary,profitloss,client_sales,user_sales,product_sales,activity,client,contact,client_contact,credit,document,expense,invoice,invoice_item,quote,quote_item,recurring_invoice,payment,product,task'],
|
||||||
'parameters.date_key' => ['bail','sometimes', 'string'],
|
'parameters.date_key' => ['bail','sometimes', 'string'],
|
||||||
'parameters.status' => ['bail','sometimes', 'string'],
|
'parameters.status' => ['bail','sometimes', 'nullable', 'string'],
|
||||||
];
|
];
|
||||||
|
|
||||||
return $rules;
|
return $rules;
|
||||||
|
@ -1145,8 +1145,6 @@ class Import implements ShouldQueue
|
|||||||
|
|
||||||
$key = "invoices_{$resource['id']}";
|
$key = "invoices_{$resource['id']}";
|
||||||
|
|
||||||
nlog($invoice->id);
|
|
||||||
|
|
||||||
$this->ids['invoices'][$key] = [
|
$this->ids['invoices'][$key] = [
|
||||||
'old' => $resource['id'],
|
'old' => $resource['id'],
|
||||||
'new' => $invoice->id,
|
'new' => $invoice->id,
|
||||||
@ -1352,11 +1350,11 @@ class Import implements ShouldQueue
|
|||||||
'*.client_id' => ['required'],
|
'*.client_id' => ['required'],
|
||||||
];
|
];
|
||||||
|
|
||||||
$validator = Validator::make($data, $rules);
|
// $validator = Validator::make($data, $rules);
|
||||||
|
|
||||||
if ($validator->fails()) {
|
// if ($validator->fails()) {
|
||||||
throw new MigrationValidatorFailed(json_encode($validator->errors()));
|
// throw new MigrationValidatorFailed(json_encode($validator->errors()));
|
||||||
}
|
// }
|
||||||
|
|
||||||
$payment_repository = new PaymentMigrationRepository(new CreditRepository());
|
$payment_repository = new PaymentMigrationRepository(new CreditRepository());
|
||||||
|
|
||||||
@ -1527,18 +1525,19 @@ class Import implements ShouldQueue
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$entity) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// throw new Exception("Resource invoice/quote document not available.");
|
// throw new Exception("Resource invoice/quote document not available.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (array_key_exists('expense_id', $resource) && $resource['expense_id'] && array_key_exists('expenses', $this->ids)) {
|
if (array_key_exists('expense_id', $resource) && $resource['expense_id'] && array_key_exists('expenses', $this->ids)) {
|
||||||
$expense_id = $this->transformId('expenses', $resource['expense_id']);
|
$expense_id = $this->transformId('expenses', $resource['expense_id']);
|
||||||
$entity = Expense::query()->where('id', $expense_id)->withTrashed()->first();
|
$entity = Expense::query()->where('id', $expense_id)->withTrashed()->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$entity) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$file_url = $resource['url'];
|
$file_url = $resource['url'];
|
||||||
$file_name = $resource['name'];
|
$file_name = $resource['name'];
|
||||||
$file_path = sys_get_temp_dir().'/'.$file_name;
|
$file_path = sys_get_temp_dir().'/'.$file_name;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user