Merge branch 'v5-develop' into bank_rules

This commit is contained in:
David Bomba 2022-11-14 07:56:32 +11:00
commit fe7f30785a
12 changed files with 23106 additions and 23189 deletions

View File

@ -13,6 +13,7 @@ namespace App\Helpers\Epc;
use App\Models\Company;
use App\Models\Invoice;
use App\Utils\Ninja;
use BaconQrCode\Renderer\ImageRenderer;
use BaconQrCode\Renderer\Image\SvgImageBackEnd;
use BaconQrCode\Renderer\RendererStyle\RendererStyle;
@ -77,10 +78,10 @@ class EpcQrGenerator
private function validateFields()
{
if(isset($this->company?->custom_fields?->company2))
if(Ninja::isSelfHost() && isset($this->company?->custom_fields?->company2))
nlog('The BIC field is not present and _may_ be a required fields for EPC QR codes');
if(isset($this->company?->custom_fields?->company1))
if(Ninja::isSelfHost() && isset($this->company?->custom_fields?->company1))
nlog('The IBAN field is required');
}

View File

@ -823,7 +823,7 @@ class BaseController extends Controller
//06-10-2022 - some entities do not have assigned_user_id - this becomes an issue when we have a large company and low permission users
if(lcfirst(class_basename(Str::snake($this->entity_type))) == 'user')
$query->where('id', auth()->user()->id);
elseif(in_array(lcfirst(class_basename(Str::snake($this->entity_type))),['design','group_setting','payment_term'])){
elseif(in_array(lcfirst(class_basename(Str::snake($this->entity_type))),['design','group_setting','payment_term','bank_transaction'])){
//need to pass these back regardless
}
else

View File

@ -214,9 +214,8 @@ class MatchBankTransactions implements ShouldQueue
$this->invoice = Invoice::withTrashed()->where('id', $invoice->id)->lockForUpdate()->first();
// if($invoices->count() == 1){
// $_amount = $this->available_balance;
// }
$_amount = false;
if(floatval($this->invoice->balance) < floatval($this->available_balance) && $this->available_balance > 0)
{
$_amount = $this->invoice->balance;
@ -230,6 +229,9 @@ class MatchBankTransactions implements ShouldQueue
$this->available_balance = 0;
}
if($_amount)
{
$this->attachable_invoices[] = ['id' => $this->invoice->id, 'amount' => $_amount];
$this->invoice
@ -239,6 +241,7 @@ class MatchBankTransactions implements ShouldQueue
->updatePaidToDate($_amount)
->setCalculatedStatus()
->save();
}
});

View File

@ -45,7 +45,7 @@ class InvoiceObserver
* @return void
*/
public function updated(Invoice $invoice)
{nlog("updated");
{
$subscriptions = Webhook::where('company_id', $invoice->company_id)
->where('event_id', Webhook::EVENT_UPDATE_INVOICE)
->exists();

View File

@ -27,6 +27,8 @@ class TriggeredActions extends AbstractService
private $invoice;
private bool $updated = false;
public function __construct(Invoice $invoice, Request $request)
{
$this->request = $request;
@ -37,30 +39,38 @@ class TriggeredActions extends AbstractService
public function run()
{
if ($this->request->has('auto_bill') && $this->request->input('auto_bill') == 'true') {
$this->invoice->service()->autoBill();
$this->invoice->service()->autoBill(); //update notification sends automatically for this.
}
if ($this->request->has('paid') && $this->request->input('paid') == 'true') {
$this->invoice = $this->invoice->service()->markPaid()->save();
$this->invoice = $this->invoice->service()->markPaid()->save(); //update notification sends automatically for this.
}
if ($this->request->has('mark_sent') && $this->request->input('mark_sent') == 'true') {
$this->invoice = $this->invoice->service()->markSent()->save();
if ($this->request->has('mark_sent') && $this->request->input('mark_sent') == 'true' && $this->invoice->status_id == Invoice::STATUS_DRAFT) {
$this->invoice = $this->invoice->service()->markSent()->save(); //update notification NOT sent
$this->updated = true;
}
if ($this->request->has('amount_paid') && is_numeric($this->request->input('amount_paid'))) {
$this->invoice = $this->invoice->service()->applyPaymentAmount($this->request->input('amount_paid'))->save();
$this->updated = false;
}
if ($this->request->has('send_email') && $this->request->input('send_email') == 'true') {
$this->invoice->service()->markSent()->touchPdf()->save();
$this->sendEmail();
$this->updated = false;
}
if ($this->request->has('cancel') && $this->request->input('cancel') == 'true') {
$this->invoice = $this->invoice->service()->handleCancellation()->save();
$this->updated = false;
}
if($this->updated)
event('eloquent.updated: App\Models\Invoice', $this->invoice);
return $this->invoice;
}

View File

@ -11,9 +11,9 @@ const RESOURCES = {
"favicon.png": "dca91c54388f52eded692718d5a98b8b",
"favicon.ico": "51636d3a390451561744c42188ccd628",
"flutter.js": "f85e6fb278b0fd20c349186fb46ae36d",
"/": "b3e1f363b096f7aa924366021ccd1f84",
"/": "d2b918382ed83045e8e3854cae1edc55",
"manifest.json": "ef43d90e57aa7682d7e2cfba2f484a40",
"main.dart.js": "ec0f416f73c0949c563c9c049a29747d",
"main.dart.js": "f6e5cc85c8e2f5aca83137308c219666",
"assets/AssetManifest.json": "759f9ef9973f7e26c2a51450b55bb9fa",
"assets/FontManifest.json": "087fb858dc3cbfbf6baf6a30004922f1",
"assets/NOTICES": "1a34e70168d56fad075adfb4bdbb20eb",

22168
public/main.dart.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

23899
public/main.foss.dart.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -7,10 +7,10 @@
@foreach ($entity->documents as $document)
<div class="inline-flex items-center space-x-1">
@if($entity instanceof App\Models\PurchaseOrder)
<a href="{{ route('vendor.documents.show', $document->hashed_id) }}" target="_blank"
<a href="{{ route('vendor.documents.download', $document->hashed_id) }}" target="_blank"
class="block text-sm button-link text-primary">{{ Illuminate\Support\Str::limit($document->name, 40) }}</a>
@else
<a href="{{ route('client.documents.show', $document->hashed_id) }}" target="_blank"
<a href="{{ route('client.documents.download', $document->hashed_id) }}" target="_blank"
class="block text-sm button-link text-primary">{{ Illuminate\Support\Str::limit($document->name, 40) }}</a>
@endif
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
@ -30,10 +30,10 @@
@foreach ($entity->company->documents as $document)
<div class="inline-flex items-center space-x-1">
@if($entity instanceof App\Models\PurchaseOrder)
<a href="{{ route('vendor.documents.show', $document->hashed_id) }}" target="_blank"
<a href="{{ route('vendor.documents.download', $document->hashed_id) }}" target="_blank"
class="block text-sm button-link text-primary">{{ Illuminate\Support\Str::limit($document->name, 40) }}</a>
@else
<a href="{{ route('client.documents.show', $document->hashed_id) }}" target="_blank"
<a href="{{ route('client.documents.download', $document->hashed_id) }}" target="_blank"
class="block text-sm button-link text-primary">{{ Illuminate\Support\Str::limit($document->name, 40) }}</a>
@endif
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
@ -54,7 +54,7 @@
@foreach ($entity->expense_documents() as $expense)
@foreach($expense->documents as $document)
<div class="inline-flex items-center space-x-1">
<a href="{{ route('client.documents.show', $document->hashed_id) }}" target="_blank"
<a href="{{ route('client.documents.download', $document->hashed_id) }}" target="_blank"
class="block text-sm button-link text-primary">{{ Illuminate\Support\Str::limit($document->name, 40) }}</a>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
@ -77,7 +77,7 @@
@foreach ($entity->task_documents() as $task)
@foreach($task->documents as $document)
<div class="inline-flex items-center space-x-1">
<a href="{{ route('client.documents.show', $document->hashed_id) }}" target="_blank"
<a href="{{ route('client.documents.download', $document->hashed_id) }}" target="_blank"
class="block text-sm button-link text-primary">{{ Illuminate\Support\Str::limit($document->name, 40) }}</a>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"