mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
fixes for tests
This commit is contained in:
parent
a907933d57
commit
ada4f3065c
@ -32,7 +32,6 @@ use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Spatie\Browsershot\Browsershot;
|
||||
|
||||
/**
|
||||
* Class SetupController.
|
||||
|
@ -110,10 +110,9 @@ class CSVImport implements ShouldQueue
|
||||
'settings' => $this->company->settings
|
||||
];
|
||||
|
||||
info(print_r($data,1));
|
||||
info(print_r($data, 1));
|
||||
|
||||
MailRouter::dispatch(new ImportCompleted($data), $this->company, auth()->user());
|
||||
|
||||
}
|
||||
|
||||
public function failed($exception)
|
||||
@ -179,20 +178,20 @@ info(print_r($data,1));
|
||||
|
||||
$invoice['line_items'] = $this->cleanItems($items);
|
||||
|
||||
$validator = Validator::make($invoice, (new StoreInvoiceRequest())->rules());
|
||||
|
||||
if ($validator->fails()) {
|
||||
$this->error_array['invoices'] = ['invoice' => $invoice, 'error' => json_encode($validator->errors())];
|
||||
} else {
|
||||
$validator = Validator::make($invoice, (new StoreInvoiceRequest())->rules());
|
||||
|
||||
if ($validator->fails()) {
|
||||
$this->error_array[] = ['invoice' => $invoice, 'error' => json_encode($validator->errors())];
|
||||
$this->error_array['invoices'] = ['invoice' => $invoice, 'error' => json_encode($validator->errors())];
|
||||
} else {
|
||||
$invoice = $invoice_repository->save($invoice, InvoiceFactory::create($this->company->id, $this->setUser($record)));
|
||||
if ($validator->fails()) {
|
||||
$this->error_array[] = ['invoice' => $invoice, 'error' => json_encode($validator->errors())];
|
||||
} else {
|
||||
$invoice = $invoice_repository->save($invoice, InvoiceFactory::create($this->company->id, $this->setUser($record)));
|
||||
|
||||
$this->maps['invoices'][] = $invoice->id;
|
||||
$this->maps['invoices'][] = $invoice->id;
|
||||
|
||||
$this->performInvoiceActions($invoice, $record, $invoice_repository);
|
||||
$this->performInvoiceActions($invoice, $record, $invoice_repository);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,6 @@ class BaseMailerJob implements ShouldQueue
|
||||
|
||||
public function failed($exception = null)
|
||||
{
|
||||
|
||||
info('the job failed');
|
||||
info($exception->getMessage());
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
namespace App\Jobs\Mail;
|
||||
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Client;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\Company;
|
||||
use App\Models\User;
|
||||
@ -76,8 +75,9 @@ class MailRouter extends BaseMailerJob implements ShouldQueue
|
||||
} catch (\Exception $e) {
|
||||
$this->failed($e);
|
||||
|
||||
if($this->to_user instanceof ClientContact)
|
||||
if ($this->to_user instanceof ClientContact) {
|
||||
$this->logMailError($e->getMessage(), $this->to_user->client);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,13 +41,13 @@ class Helpers
|
||||
|
||||
/**
|
||||
* A centralised way to format the custom fields content.
|
||||
*
|
||||
* @param mixed $custom_fields
|
||||
* @param mixed $field
|
||||
* @param mixed $value
|
||||
* @param null|\App\Models\Client $client
|
||||
*
|
||||
* @return null|string
|
||||
*
|
||||
* @param mixed $custom_fields
|
||||
* @param mixed $field
|
||||
* @param mixed $value
|
||||
* @param null|\App\Models\Client $client
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function formatCustomFieldValue($custom_fields, $field, $value, ?Client $client): ?string
|
||||
{
|
||||
|
@ -592,12 +592,12 @@ trait MakesInvoiceValues
|
||||
|
||||
/**
|
||||
* Formats the line items for display.
|
||||
*
|
||||
* @param mixed $items
|
||||
* @param string $table_type
|
||||
* @param mixed|null $custom_fields
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @param mixed $items
|
||||
* @param string $table_type
|
||||
* @param mixed|null $custom_fields
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function transformLineItems($items, $table_type = '$product') :array
|
||||
{
|
||||
@ -631,9 +631,12 @@ trait MakesInvoiceValues
|
||||
|
||||
|
||||
$data[$key][$table_type . ".{$_table_type}1"] = $helpers->formatCustomFieldValue($this->client->company->custom_fields, "{$_table_type}1", $item->custom_value1, $this->client);
|
||||
$data[$key][$table_type . ".{$_table_type}2"] = $helpers->formatCustomFieldValue($this->client->company->custom_fields, "{$_table_type}2", $item->custom_value2, $this->client);;
|
||||
$data[$key][$table_type . ".{$_table_type}3"] = $helpers->formatCustomFieldValue($this->client->company->custom_fields, "{$_table_type}3", $item->custom_value3, $this->client);;
|
||||
$data[$key][$table_type . ".{$_table_type}4"] = $helpers->formatCustomFieldValue($this->client->company->custom_fields, "{$_table_type}4", $item->custom_value4, $this->client);;
|
||||
$data[$key][$table_type . ".{$_table_type}2"] = $helpers->formatCustomFieldValue($this->client->company->custom_fields, "{$_table_type}2", $item->custom_value2, $this->client);
|
||||
;
|
||||
$data[$key][$table_type . ".{$_table_type}3"] = $helpers->formatCustomFieldValue($this->client->company->custom_fields, "{$_table_type}3", $item->custom_value3, $this->client);
|
||||
;
|
||||
$data[$key][$table_type . ".{$_table_type}4"] = $helpers->formatCustomFieldValue($this->client->company->custom_fields, "{$_table_type}4", $item->custom_value4, $this->client);
|
||||
;
|
||||
|
||||
$data[$key][$table_type.'.quantity'] = $item->quantity;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user