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.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.status' => ['bail','sometimes', 'string'],
|
||||
'parameters.status' => ['bail','sometimes', 'nullable', 'string'],
|
||||
];
|
||||
|
||||
return $rules;
|
||||
|
@ -1145,8 +1145,6 @@ class Import implements ShouldQueue
|
||||
|
||||
$key = "invoices_{$resource['id']}";
|
||||
|
||||
nlog($invoice->id);
|
||||
|
||||
$this->ids['invoices'][$key] = [
|
||||
'old' => $resource['id'],
|
||||
'new' => $invoice->id,
|
||||
@ -1352,11 +1350,11 @@ class Import implements ShouldQueue
|
||||
'*.client_id' => ['required'],
|
||||
];
|
||||
|
||||
$validator = Validator::make($data, $rules);
|
||||
// $validator = Validator::make($data, $rules);
|
||||
|
||||
if ($validator->fails()) {
|
||||
throw new MigrationValidatorFailed(json_encode($validator->errors()));
|
||||
}
|
||||
// if ($validator->fails()) {
|
||||
// throw new MigrationValidatorFailed(json_encode($validator->errors()));
|
||||
// }
|
||||
|
||||
$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.");
|
||||
}
|
||||
|
||||
|
||||
if (array_key_exists('expense_id', $resource) && $resource['expense_id'] && array_key_exists('expenses', $this->ids)) {
|
||||
$expense_id = $this->transformId('expenses', $resource['expense_id']);
|
||||
$entity = Expense::query()->where('id', $expense_id)->withTrashed()->first();
|
||||
}
|
||||
|
||||
if (!$entity) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$file_url = $resource['url'];
|
||||
$file_name = $resource['name'];
|
||||
$file_path = sys_get_temp_dir().'/'.$file_name;
|
||||
|
Loading…
x
Reference in New Issue
Block a user