mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Ensure port is int for SMTP
This commit is contained in:
parent
e2287c6d57
commit
6c7df568dc
@ -140,6 +140,7 @@ class BaseController extends Controller
|
||||
'company.quotes.invitations.company',
|
||||
'company.quotes.documents',
|
||||
'company.tasks.documents',
|
||||
// 'company.tasks.project',
|
||||
'company.subscriptions',
|
||||
'company.tax_rates',
|
||||
'company.tokens_hashed',
|
||||
@ -458,7 +459,7 @@ class BaseController extends Controller
|
||||
}
|
||||
},
|
||||
'company.tasks' => function ($query) use ($updated_at, $user) {
|
||||
$query->where('updated_at', '>=', $updated_at)->with('documents');
|
||||
$query->where('updated_at', '>=', $updated_at)->with('project','documents');
|
||||
|
||||
if (! $user->hasPermission('view_task')) {
|
||||
$query->whereNested(function ($query) use ($user) {
|
||||
|
@ -75,6 +75,10 @@ class Project extends BaseModel
|
||||
'number',
|
||||
];
|
||||
|
||||
protected $with = [
|
||||
'documents',
|
||||
];
|
||||
|
||||
public function getEntityType()
|
||||
{
|
||||
return self::class;
|
||||
|
@ -131,6 +131,10 @@ class Task extends BaseModel
|
||||
'deleted_at' => 'timestamp',
|
||||
];
|
||||
|
||||
protected $with = [
|
||||
// 'project',
|
||||
];
|
||||
|
||||
protected $touches = [];
|
||||
|
||||
public function getEntityType()
|
||||
|
@ -77,8 +77,6 @@ class AutoBillInvoice extends AbstractService
|
||||
return;
|
||||
}
|
||||
|
||||
nlog($this->invoice->toArray());
|
||||
|
||||
$amount = 0;
|
||||
$invoice_total = 0;
|
||||
|
||||
@ -236,9 +234,7 @@ class AutoBillInvoice extends AbstractService
|
||||
|
||||
//if we have paid the invoice in full using credits, then we need to fire the event
|
||||
if($this->invoice->balance == 0) {
|
||||
|
||||
event(new InvoiceWasPaid($this->invoice, $payment, $payment->company, Ninja::eventVars()));
|
||||
|
||||
}
|
||||
|
||||
return $this->invoice
|
||||
@ -267,8 +263,6 @@ class AutoBillInvoice extends AbstractService
|
||||
->orderBy('created_at')
|
||||
->get();
|
||||
|
||||
nlog($unapplied_payments->pluck("id"));
|
||||
|
||||
$available_unapplied_balance = $unapplied_payments->sum('amount') - $unapplied_payments->sum('applied');
|
||||
|
||||
nlog("available unapplied balance = {$available_unapplied_balance}");
|
||||
@ -291,7 +285,10 @@ class AutoBillInvoice extends AbstractService
|
||||
if ($payment_balance > $this->invoice->partial) {
|
||||
$payload = ['client_id' => $this->invoice->client_id, 'invoices' => [['invoice_id' => $this->invoice->id,'amount' => $this->invoice->partial]]];
|
||||
$payment_repo->save($payload, $payment);
|
||||
break;
|
||||
|
||||
$this->invoice = $this->invoice->fresh();
|
||||
|
||||
return $this;
|
||||
} else {
|
||||
$payload = ['client_id' => $this->invoice->client_id, 'invoices' => [['invoice_id' => $this->invoice->id,'amount' => $payment_balance]]];
|
||||
$payment_repo->save($payload, $payment);
|
||||
@ -303,7 +300,10 @@ class AutoBillInvoice extends AbstractService
|
||||
$payload = ['client_id' => $this->invoice->client_id, 'invoices' => [['invoice_id' => $this->invoice->id,'amount' => $this->invoice->balance]]];
|
||||
$payment_repo->save($payload, $payment);
|
||||
|
||||
break;
|
||||
$this->invoice = $this->invoice->fresh();
|
||||
|
||||
return $this;
|
||||
|
||||
} else {
|
||||
|
||||
$payload = ['client_id' => $this->invoice->client_id, 'invoices' => [['invoice_id' => $this->invoice->id,'amount' => $payment_balance]]];
|
||||
@ -312,9 +312,8 @@ class AutoBillInvoice extends AbstractService
|
||||
}
|
||||
}
|
||||
|
||||
$this->invoice = $this->invoice->fresh();
|
||||
|
||||
if((int)$this->invoice->balance == 0) {
|
||||
event(new InvoiceWasPaid($this->invoice, $payment, $payment->company, Ninja::eventVars()));
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ class CompanyTransformer extends EntityTransformer
|
||||
'invoice_task_item_description' => (bool) $company->invoice_task_item_description,
|
||||
'origin_tax_data' => $company->origin_tax_data ?: new \stdClass(),
|
||||
'smtp_host' => (string)$company->smtp_host ?? '',
|
||||
'smtp_port' => (string)$company->smtp_port ?? '',
|
||||
'smtp_port' => (int)$company->smtp_port ?? 25,
|
||||
'smtp_encryption' => (string)$company->smtp_encryption ?? 'tls',
|
||||
'smtp_username' => $company->smtp_username ? '********' : '',
|
||||
'smtp_password' => $company->smtp_password ? '********' : '',
|
||||
|
@ -41,7 +41,10 @@ class ProjectTransformer extends EntityTransformer
|
||||
{
|
||||
$transformer = new DocumentTransformer($this->serializer);
|
||||
|
||||
return $this->includeCollection($project->documents, $transformer, Document::class);
|
||||
if($project->documents)
|
||||
return $this->includeCollection($project->documents, $transformer, Document::class);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function includeClient(Project $project): \League\Fractal\Resource\Item
|
||||
|
@ -100,11 +100,10 @@ class TaskTransformer extends EntityTransformer
|
||||
{
|
||||
$transformer = new ProjectTransformer($this->serializer);
|
||||
|
||||
if (!$task->project) {
|
||||
return null;
|
||||
}
|
||||
if ($task->project)
|
||||
return $this->includeItem($task->project, $transformer, Project::class);
|
||||
|
||||
return $this->includeItem($task->project, $transformer, Project::class);
|
||||
return null;
|
||||
}
|
||||
|
||||
public function transform(Task $task)
|
||||
|
Loading…
x
Reference in New Issue
Block a user