v5.10.44
This commit is contained in:
parent
5b8241347f
commit
360e2a85b0
|
|
@ -1 +1 @@
|
||||||
5.10.43
|
5.10.44
|
||||||
|
|
@ -11,34 +11,35 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\DataMapper\Analytics\LivePreview;
|
|
||||||
use App\Factory\PurchaseOrderFactory;
|
|
||||||
use App\Http\Requests\Preview\PreviewPurchaseOrderRequest;
|
|
||||||
use App\Jobs\Util\PreviewPdf;
|
|
||||||
use App\Libraries\MultiDB;
|
|
||||||
use App\Models\Client;
|
|
||||||
use App\Models\PurchaseOrder;
|
|
||||||
use App\Models\PurchaseOrderInvitation;
|
|
||||||
use App\Models\Vendor;
|
|
||||||
use App\Models\VendorContact;
|
|
||||||
use App\Repositories\PurchaseOrderRepository;
|
|
||||||
use App\Services\Pdf\PdfService;
|
|
||||||
use App\Services\PdfMaker\Design;
|
|
||||||
use App\Services\PdfMaker\Design as PdfDesignModel;
|
|
||||||
use App\Services\PdfMaker\Design as PdfMakerDesign;
|
|
||||||
use App\Services\PdfMaker\PdfMaker;
|
|
||||||
use App\Utils\HostedPDF\NinjaPdf;
|
|
||||||
use App\Utils\Ninja;
|
use App\Utils\Ninja;
|
||||||
use App\Utils\PhantomJS\Phantom;
|
use App\Models\Client;
|
||||||
|
use App\Models\Vendor;
|
||||||
|
use App\Libraries\MultiDB;
|
||||||
|
use App\Jobs\Util\PreviewPdf;
|
||||||
|
use App\Models\PurchaseOrder;
|
||||||
|
use App\Models\VendorContact;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use App\Utils\Traits\MakesInvoiceHtml;
|
|
||||||
use App\Utils\Traits\Pdf\PageNumbering;
|
|
||||||
use App\Utils\VendorHtmlEngine;
|
use App\Utils\VendorHtmlEngine;
|
||||||
use Illuminate\Support\Facades\App;
|
use App\Services\Pdf\PdfService;
|
||||||
|
use App\Utils\PhantomJS\Phantom;
|
||||||
|
use App\Services\PdfMaker\Design;
|
||||||
|
use App\Utils\HostedPDF\NinjaPdf;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use App\Services\PdfMaker\PdfMaker;
|
||||||
|
use Illuminate\Support\Facades\App;
|
||||||
|
use App\Factory\PurchaseOrderFactory;
|
||||||
|
use App\Utils\Traits\MakesInvoiceHtml;
|
||||||
|
use Turbo124\Beacon\Facades\LightLogs;
|
||||||
|
use App\Models\PurchaseOrderInvitation;
|
||||||
|
use App\Utils\Traits\Pdf\PageNumbering;
|
||||||
use Illuminate\Support\Facades\Request;
|
use Illuminate\Support\Facades\Request;
|
||||||
use Illuminate\Support\Facades\Response;
|
use Illuminate\Support\Facades\Response;
|
||||||
use Turbo124\Beacon\Facades\LightLogs;
|
use App\DataMapper\Analytics\LivePreview;
|
||||||
|
use App\Repositories\PurchaseOrderRepository;
|
||||||
|
use App\Http\Requests\Preview\ShowPreviewRequest;
|
||||||
|
use App\Services\PdfMaker\Design as PdfDesignModel;
|
||||||
|
use App\Services\PdfMaker\Design as PdfMakerDesign;
|
||||||
|
use App\Http\Requests\Preview\PreviewPurchaseOrderRequest;
|
||||||
|
|
||||||
class PreviewPurchaseOrderController extends BaseController
|
class PreviewPurchaseOrderController extends BaseController
|
||||||
{
|
{
|
||||||
|
|
@ -84,7 +85,7 @@ class PreviewPurchaseOrderController extends BaseController
|
||||||
* ),
|
* ),
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
public function show(Request $request)
|
public function show(ShowPreviewRequest $request)
|
||||||
{
|
{
|
||||||
if (request()->has('entity') &&
|
if (request()->has('entity') &&
|
||||||
request()->has('entity_id') &&
|
request()->has('entity_id') &&
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ class AddTaxIdentifierRequest extends FormRequest
|
||||||
/** @var \App\Models\User $user */
|
/** @var \App\Models\User $user */
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
|
|
||||||
if (app()->isLocal()) {
|
if (config('ninja.app_env') == 'local') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class DisconnectRequest extends FormRequest
|
||||||
*/
|
*/
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
|
|
||||||
if (app()->isLocal()) {
|
if (config('ninja.app_env') == 'local') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ class ShowEntityRequest extends FormRequest
|
||||||
*/
|
*/
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
|
|
||||||
if (app()->isLocal()) {
|
if (config('ninja.app_env') == 'local') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ class StoreEntityRequest extends FormRequest
|
||||||
*/
|
*/
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
|
|
||||||
if (app()->isLocal()) {
|
if (config('ninja.app_env') == 'local') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class UpdateEntityRequest extends FormRequest
|
||||||
*/
|
*/
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
|
|
||||||
if (app()->isLocal()) {
|
if (config('ninja.app_env') == 'local') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ class ShowQuotaRequest extends FormRequest
|
||||||
{
|
{
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
{
|
{
|
||||||
if (app()->isLocal()) {
|
if (config('ninja.app_env') == 'local') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ class UpdateTokenRequest extends Request
|
||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
{
|
{
|
||||||
if (app()->isLocal()) {
|
if (config('ninja.app_env') == 'local') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,210 +93,210 @@ class ProcessBankRules extends AbstractService
|
||||||
// $client.custom2
|
// $client.custom2
|
||||||
// $client.custom3
|
// $client.custom3
|
||||||
// $client.custom4
|
// $client.custom4
|
||||||
private function matchCreditXX()
|
// private function matchCreditXX() //phpstan-ignore-line
|
||||||
{
|
// {
|
||||||
$match_set = [];
|
// $match_set = [];
|
||||||
|
|
||||||
$this->credit_rules = $this->bank_transaction->company->credit_rules();
|
// $this->credit_rules = $this->bank_transaction->company->credit_rules();
|
||||||
|
|
||||||
foreach ($this->credit_rules as $bank_transaction_rule) {
|
// foreach ($this->credit_rules as $bank_transaction_rule) {
|
||||||
$match_set = [];
|
// $match_set = [];
|
||||||
|
|
||||||
if (!is_array($bank_transaction_rule['rules'])) {
|
// if (!is_array($bank_transaction_rule['rules'])) {
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
|
|
||||||
$rule_count = count($bank_transaction_rule['rules']);
|
// $rule_count = count($bank_transaction_rule['rules']);
|
||||||
|
|
||||||
foreach ($bank_transaction_rule['rules'] as $rule) {
|
// foreach ($bank_transaction_rule['rules'] as $rule) {
|
||||||
|
|
||||||
$results = [];
|
// $results = [];
|
||||||
|
|
||||||
$payments = Payment::query()
|
// $payments = Payment::query()
|
||||||
->withTrashed()
|
// ->withTrashed()
|
||||||
->whereIn('status_id', [1,4])
|
// ->whereIn('status_id', [1,4])
|
||||||
->where('is_deleted', 0)
|
// ->where('is_deleted', 0)
|
||||||
->whereNull('transaction_id')
|
// ->whereNull('transaction_id')
|
||||||
->get();
|
// ->get();
|
||||||
|
|
||||||
$invoices = Invoice::query()
|
// $invoices = Invoice::query()
|
||||||
->withTrashed()
|
// ->withTrashed()
|
||||||
->where('company_id', $this->bank_transaction->company_id)
|
// ->where('company_id', $this->bank_transaction->company_id)
|
||||||
->whereIn('status_id', [1,2,3])
|
// ->whereIn('status_id', [1,2,3])
|
||||||
->where('is_deleted', 0)
|
// ->where('is_deleted', 0)
|
||||||
->get();
|
// ->get();
|
||||||
|
|
||||||
match($rule['search_key']) {
|
// match($rule['search_key']) {
|
||||||
'$payment.amount' => $results = [Payment::class, $this->searchPaymentResource('amount', $rule, $payments)],
|
// '$payment.amount' => $results = [Payment::class, $this->searchPaymentResource('amount', $rule, $payments)],
|
||||||
'$payment.transaction_reference' => $results = [Payment::class, $this->searchPaymentResource('transaction_reference', $rule, $payments)],
|
// '$payment.transaction_reference' => $results = [Payment::class, $this->searchPaymentResource('transaction_reference', $rule, $payments)],
|
||||||
'$payment.custom1' => $results = [Payment::class, $this->searchPaymentResource('custom_value1', $rule, $payments)],
|
// '$payment.custom1' => $results = [Payment::class, $this->searchPaymentResource('custom_value1', $rule, $payments)],
|
||||||
'$payment.custom2' => $results = [Payment::class, $this->searchPaymentResource('custom_value2', $rule, $payments)],
|
// '$payment.custom2' => $results = [Payment::class, $this->searchPaymentResource('custom_value2', $rule, $payments)],
|
||||||
'$payment.custom3' => $results = [Payment::class, $this->searchPaymentResource('custom_value3', $rule, $payments)],
|
// '$payment.custom3' => $results = [Payment::class, $this->searchPaymentResource('custom_value3', $rule, $payments)],
|
||||||
'$payment.custom4' => $results = [Payment::class, $this->searchPaymentResource('custom_value4', $rule, $payments)],
|
// '$payment.custom4' => $results = [Payment::class, $this->searchPaymentResource('custom_value4', $rule, $payments)],
|
||||||
'$invoice.amount' => $results = [Invoice::class, $this->searchInvoiceResource('amount', $rule, $invoices)],
|
// '$invoice.amount' => $results = [Invoice::class, $this->searchInvoiceResource('amount', $rule, $invoices)],
|
||||||
'$invoice.number' => $results = [Invoice::class, $this->searchInvoiceResource('number', $rule, $invoices)],
|
// '$invoice.number' => $results = [Invoice::class, $this->searchInvoiceResource('number', $rule, $invoices)],
|
||||||
'$invoice.po_number' => $results = [Invoice::class, $this->searchInvoiceResource('po_number', $rule, $invoices)],
|
// '$invoice.po_number' => $results = [Invoice::class, $this->searchInvoiceResource('po_number', $rule, $invoices)],
|
||||||
'$invoice.custom1' => $results = [Invoice::class, $this->searchInvoiceResource('custom_value1', $rule, $invoices)],
|
// '$invoice.custom1' => $results = [Invoice::class, $this->searchInvoiceResource('custom_value1', $rule, $invoices)],
|
||||||
'$invoice.custom2' => $results = [Invoice::class, $this->searchInvoiceResource('custom_value2', $rule, $invoices)],
|
// '$invoice.custom2' => $results = [Invoice::class, $this->searchInvoiceResource('custom_value2', $rule, $invoices)],
|
||||||
'$invoice.custom3' => $results = [Invoice::class, $this->searchInvoiceResource('custom_value3', $rule, $invoices)],
|
// '$invoice.custom3' => $results = [Invoice::class, $this->searchInvoiceResource('custom_value3', $rule, $invoices)],
|
||||||
'$invoice.custom4' => $results = [Invoice::class, $this->searchInvoiceResource('custom_value4', $rule, $invoices)],
|
// '$invoice.custom4' => $results = [Invoice::class, $this->searchInvoiceResource('custom_value4', $rule, $invoices)],
|
||||||
'$client.id_number' => $results = [Client::class, $this->searchClientResource('id_number', $rule, $invoices, $payments)],
|
// '$client.id_number' => $results = [Client::class, $this->searchClientResource('id_number', $rule, $invoices, $payments)],
|
||||||
'$client.email' => $results = [Client::class, $this->searchClientResource('email', $rule, $invoices, $payments)],
|
// '$client.email' => $results = [Client::class, $this->searchClientResource('email', $rule, $invoices, $payments)],
|
||||||
'$client.custom1' => $results = [Client::class, $this->searchClientResource('custom_value1', $rule, $invoices, $payments)],
|
// '$client.custom1' => $results = [Client::class, $this->searchClientResource('custom_value1', $rule, $invoices, $payments)],
|
||||||
'$client.custom2' => $results = [Client::class, $this->searchClientResource('custom_value2', $rule, $invoices, $payments)],
|
// '$client.custom2' => $results = [Client::class, $this->searchClientResource('custom_value2', $rule, $invoices, $payments)],
|
||||||
'$client.custom3' => $results = [Client::class, $this->searchClientResource('custom_value3', $rule, $invoices, $payments)],
|
// '$client.custom3' => $results = [Client::class, $this->searchClientResource('custom_value3', $rule, $invoices, $payments)],
|
||||||
'$client.custom4' => $results = [Client::class, $this->searchClientResource('custom_value4', $rule, $invoices, $payments)],
|
// '$client.custom4' => $results = [Client::class, $this->searchClientResource('custom_value4', $rule, $invoices, $payments)],
|
||||||
default => $results = [Client::class, [collect([]), Invoice::class]],
|
// default => $results = [Client::class, [collect([]), Invoice::class]],
|
||||||
};
|
// };
|
||||||
|
|
||||||
if($results[0] == 'App\Models\Client') {
|
// if($results[0] == 'App\Models\Client') {
|
||||||
$set = $results[1];
|
// $set = $results[1];
|
||||||
$result_set = $set[0];
|
// $result_set = $set[0];
|
||||||
$entity = $set[1];
|
// $entity = $set[1];
|
||||||
|
|
||||||
if($result_set->count() > 0) {
|
// if($result_set->count() > 0) {
|
||||||
$match_set[] = [$entity, $result_set->pluck('id')];
|
// $match_set[] = [$entity, $result_set->pluck('id')];
|
||||||
}
|
// }
|
||||||
|
|
||||||
} elseif($results[1]->count() > 0) {
|
// } elseif($results[1]->count() > 0) {
|
||||||
$match_set[] = $results;
|
// $match_set[] = $results;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (($bank_transaction_rule['matches_on_all'] && $this->checkMatchSetForKey($match_set, $rule_count)) || (!$bank_transaction_rule['matches_on_all'] && count($match_set) > 0))
|
// if (($bank_transaction_rule['matches_on_all'] && $this->checkMatchSetForKey($match_set, $rule_count)) || (!$bank_transaction_rule['matches_on_all'] && count($match_set) > 0))
|
||||||
{
|
// {
|
||||||
|
|
||||||
$this->bank_transaction->status_id = BankTransaction::STATUS_MATCHED;
|
// $this->bank_transaction->status_id = BankTransaction::STATUS_MATCHED;
|
||||||
$this->bank_transaction->bank_transaction_rule_id = $bank_transaction_rule->id;
|
// $this->bank_transaction->bank_transaction_rule_id = $bank_transaction_rule->id;
|
||||||
$this->bank_transaction->save();
|
// $this->bank_transaction->save();
|
||||||
|
|
||||||
$first_result = reset($match_set);
|
// $first_result = reset($match_set);
|
||||||
|
|
||||||
$invoice_id = false;
|
// $invoice_id = false;
|
||||||
$payment_id = false;
|
// $payment_id = false;
|
||||||
|
|
||||||
if($first_result[0] == Payment::class) {
|
// if($first_result[0] == Payment::class) {
|
||||||
$payment_id = $first_result[1][0];
|
// $payment_id = $first_result[1][0];
|
||||||
}
|
// }
|
||||||
elseif($first_result[0] == Invoice::class) {
|
// elseif($first_result[0] == Invoice::class) {
|
||||||
$invoice_id = $first_result[1][0];
|
// $invoice_id = $first_result[1][0];
|
||||||
}
|
// }
|
||||||
|
|
||||||
if ($bank_transaction_rule['auto_convert']) {
|
// if ($bank_transaction_rule['auto_convert']) {
|
||||||
(new MatchBankTransactions($this->bank_transaction->company->id, $this->bank_transaction->company->db, [
|
// (new MatchBankTransactions($this->bank_transaction->company->id, $this->bank_transaction->company->db, [
|
||||||
'transactions' => [
|
// 'transactions' => [
|
||||||
[
|
// [
|
||||||
'id' => $this->bank_transaction->id,
|
// 'id' => $this->bank_transaction->id,
|
||||||
'invoice_ids' => $invoice_id ?? '',
|
// 'invoice_ids' => $invoice_id ?? '',
|
||||||
'payment_id' => $payment_id ?? '',
|
// 'payment_id' => $payment_id ?? '',
|
||||||
],
|
// ],
|
||||||
],
|
// ],
|
||||||
]))->handle();
|
// ]))->handle();
|
||||||
}
|
// }
|
||||||
else {
|
// else {
|
||||||
|
|
||||||
if($invoice_id){
|
// if($invoice_id){
|
||||||
$this->bank_transaction->invoice_ids = $this->encodePrimaryKey($invoice_id);
|
// $this->bank_transaction->invoice_ids = $this->encodePrimaryKey($invoice_id);
|
||||||
}
|
// }
|
||||||
elseif($payment_id){
|
// elseif($payment_id){
|
||||||
$this->bank_transaction->payment_id = $payment_id;
|
// $this->bank_transaction->payment_id = $payment_id;
|
||||||
}
|
// }
|
||||||
|
|
||||||
$this->bank_transaction->save();
|
// $this->bank_transaction->save();
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
private function checkMatchSetForKey(array $match_set, $rule_count)
|
// private function checkMatchSetForKey(array $match_set, $rule_count)
|
||||||
{
|
// {
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
private function searchInvoiceResource(string $column, array $rule, $invoices)
|
// private function searchInvoiceResource(string $column, array $rule, $invoices)
|
||||||
{
|
// {
|
||||||
|
|
||||||
return $invoices->when($column != 'amount', function ($q) use ($rule, $column) {
|
// return $invoices->when($column != 'amount', function ($q) use ($rule, $column) {
|
||||||
return $q->filter(function ($record) use ($rule, $column) {
|
// return $q->filter(function ($record) use ($rule, $column) {
|
||||||
return $this->matchStringOperator($this->bank_transaction->description, $record->{$column}, $rule['operator']);
|
// return $this->matchStringOperator($this->bank_transaction->description, $record->{$column}, $rule['operator']);
|
||||||
});
|
// });
|
||||||
})
|
// })
|
||||||
->when($column == 'amount', function ($q) use ($rule, $column) {
|
// ->when($column == 'amount', function ($q) use ($rule, $column) {
|
||||||
return $q->filter(function ($record) use ($rule, $column) {
|
// return $q->filter(function ($record) use ($rule, $column) {
|
||||||
return $this->matchNumberOperator($this->bank_transaction->amount, $record->{$column}, $rule['operator']);
|
// return $this->matchNumberOperator($this->bank_transaction->amount, $record->{$column}, $rule['operator']);
|
||||||
});
|
// });
|
||||||
})->pluck("id");
|
// })->pluck("id");
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
private function searchPaymentResource(string $column, array $rule, $payments)
|
// private function searchPaymentResource(string $column, array $rule, $payments)
|
||||||
{
|
// {
|
||||||
return $payments->when($column != 'amount', function ($q) use ($rule, $column) {
|
// return $payments->when($column != 'amount', function ($q) use ($rule, $column) {
|
||||||
return $q->filter(function ($record) use ($rule, $column) {
|
// return $q->filter(function ($record) use ($rule, $column) {
|
||||||
|
|
||||||
$bool = $this->matchStringOperator($this->bank_transaction->description, $record->{$column}, $rule['operator']);
|
// $bool = $this->matchStringOperator($this->bank_transaction->description, $record->{$column}, $rule['operator']);
|
||||||
return $bool;
|
// return $bool;
|
||||||
});
|
// });
|
||||||
})
|
// })
|
||||||
->when($column == 'amount', function ($q) use ($rule, $column) {
|
// ->when($column == 'amount', function ($q) use ($rule, $column) {
|
||||||
return $q->filter(function ($record) use ($rule, $column) {
|
// return $q->filter(function ($record) use ($rule, $column) {
|
||||||
return $this->matchNumberOperator($this->bank_transaction->amount, $record->{$column}, $rule['operator']);
|
// return $this->matchNumberOperator($this->bank_transaction->amount, $record->{$column}, $rule['operator']);
|
||||||
});
|
// });
|
||||||
})->pluck("id");
|
// })->pluck("id");
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
private function searchClientResource(string $column, array $rule, $invoices, $payments)
|
// private function searchClientResource(string $column, array $rule, $invoices, $payments)
|
||||||
{
|
// {
|
||||||
|
|
||||||
$invoice_matches = Client::query()
|
// $invoice_matches = Client::query()
|
||||||
->whereIn('id', $invoices->pluck('client_id'))
|
// ->whereIn('id', $invoices->pluck('client_id'))
|
||||||
->when($column == 'email', function ($q) {
|
// ->when($column == 'email', function ($q) {
|
||||||
return $q->whereHas('contacts', function ($qc) {
|
// return $q->whereHas('contacts', function ($qc) {
|
||||||
$qc->where('email', $this->bank_transaction->description);
|
// $qc->where('email', $this->bank_transaction->description);
|
||||||
});
|
// });
|
||||||
})
|
// })
|
||||||
->when($column != 'email', function ($q) use ($rule, $column) {
|
// ->when($column != 'email', function ($q) use ($rule, $column) {
|
||||||
|
|
||||||
return $q->cursor()->filter(function ($record) use ($rule, $column) {
|
// return $q->cursor()->filter(function ($record) use ($rule, $column) {
|
||||||
return $this->matchStringOperator($this->bank_transaction->description, $record->{$column}, $rule['operator']);
|
// return $this->matchStringOperator($this->bank_transaction->description, $record->{$column}, $rule['operator']);
|
||||||
});
|
// });
|
||||||
})->pluck('id');
|
// })->pluck('id');
|
||||||
|
|
||||||
|
|
||||||
$intersection = $invoices->whereIn('client_id', $invoice_matches);
|
// $intersection = $invoices->whereIn('client_id', $invoice_matches);
|
||||||
|
|
||||||
if($intersection->count() > 0) {
|
// if($intersection->count() > 0) {
|
||||||
return [$intersection, Invoice::class];
|
// return [$intersection, Invoice::class];
|
||||||
}
|
// }
|
||||||
|
|
||||||
$payments_matches = Client::query()
|
// $payments_matches = Client::query()
|
||||||
->whereIn('id', $payments->pluck('client_id'))
|
// ->whereIn('id', $payments->pluck('client_id'))
|
||||||
->when($column == 'email', function ($q) {
|
// ->when($column == 'email', function ($q) {
|
||||||
return $q->whereHas('contacts', function ($qc) {
|
// return $q->whereHas('contacts', function ($qc) {
|
||||||
$qc->where('email', $this->bank_transaction->description);
|
// $qc->where('email', $this->bank_transaction->description);
|
||||||
});
|
// });
|
||||||
})
|
// })
|
||||||
->when($column != 'email', function ($q) use ($rule, $column) {
|
// ->when($column != 'email', function ($q) use ($rule, $column) {
|
||||||
|
|
||||||
return $q->cursor()->filter(function ($record) use ($rule, $column) {
|
// return $q->cursor()->filter(function ($record) use ($rule, $column) {
|
||||||
return $this->matchStringOperator($this->bank_transaction->description, $record->{$column}, $rule['operator']);
|
// return $this->matchStringOperator($this->bank_transaction->description, $record->{$column}, $rule['operator']);
|
||||||
});
|
// });
|
||||||
})->pluck('id');
|
// })->pluck('id');
|
||||||
|
|
||||||
$intersection = $payments->whereIn('client_id', $payments_matches);
|
// $intersection = $payments->whereIn('client_id', $payments_matches);
|
||||||
|
|
||||||
if($intersection->count() > 0) {
|
// if($intersection->count() > 0) {
|
||||||
return [$intersection, Payment::class];
|
// return [$intersection, Payment::class];
|
||||||
}
|
// }
|
||||||
|
|
||||||
return [Client::class, collect([])];
|
// return [Client::class, collect([])];
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
private function matchDebit()
|
private function matchDebit()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,7 @@ class SendEDocument implements ShouldQueue
|
||||||
// nlog($r->body());
|
// nlog($r->body());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//@todo remove early return prior to release
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -159,16 +160,16 @@ class SendEDocument implements ShouldQueue
|
||||||
/**
|
/**
|
||||||
* Self hosted request headers
|
* Self hosted request headers
|
||||||
*
|
*
|
||||||
* @return array
|
*
|
||||||
*/
|
**/
|
||||||
private function getHeaders(): array
|
// private function getHeaders(): array
|
||||||
{
|
// {
|
||||||
return [
|
// return [
|
||||||
'X-API-SELF-HOST-TOKEN' => config('ninja.license_key'),
|
// 'X-API-SELF-HOST-TOKEN' => config('ninja.license_key'),
|
||||||
"X-Requested-With" => "XMLHttpRequest",
|
// "X-Requested-With" => "XMLHttpRequest",
|
||||||
"Content-Type" => "application/json",
|
// "Content-Type" => "application/json",
|
||||||
];
|
// ];
|
||||||
}
|
// }
|
||||||
|
|
||||||
public function failed($exception = null)
|
public function failed($exception = null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@ return [
|
||||||
'require_https' => env('REQUIRE_HTTPS', true),
|
'require_https' => env('REQUIRE_HTTPS', true),
|
||||||
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
||||||
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
||||||
'app_version' => env('APP_VERSION', '5.10.43'),
|
'app_version' => env('APP_VERSION', '5.10.44'),
|
||||||
'app_tag' => env('APP_TAG', '5.10.43'),
|
'app_tag' => env('APP_TAG', '5.10.44'),
|
||||||
'minimum_client_version' => '5.0.16',
|
'minimum_client_version' => '5.0.16',
|
||||||
'terms_version' => '1.0.1',
|
'terms_version' => '1.0.1',
|
||||||
'api_secret' => env('API_SECRET', false),
|
'api_secret' => env('API_SECRET', false),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue