diff --git a/app/Filters/DocumentFilters.php b/app/Filters/DocumentFilters.php index 6d333db8eeec..122545c7269b 100644 --- a/app/Filters/DocumentFilters.php +++ b/app/Filters/DocumentFilters.php @@ -19,20 +19,6 @@ use Illuminate\Database\Eloquent\Builder; */ class DocumentFilters extends QueryFilters { - public function type_id(int $type_id) :Builder - { - return $this->builder->where('type_id', $type_id); - } - - public function category_id(int $category_id) :Builder - { - return $this->builder->where('category_id', $category_id); - } - - public function event_id(int $event_id) :Builder - { - return $this->builder->where('event_id', $event_id); - } public function client_id(int $client_id) :Builder { diff --git a/app/Http/Controllers/BaseController.php b/app/Http/Controllers/BaseController.php index 13e9d06844cd..68ac5202d06d 100644 --- a/app/Http/Controllers/BaseController.php +++ b/app/Http/Controllers/BaseController.php @@ -104,6 +104,7 @@ class BaseController extends Controller 'user.company_user', 'token', 'company.activities', + 'company.documents', //'company.users.company_user', 'company.tax_rates', 'company.groups', @@ -183,7 +184,10 @@ class BaseController extends Controller protected function refreshResponse($query) { - $this->manager->parseIncludes($this->first_load); + if (auth()->user()->getCompany()->is_large) + $this->manager->parseIncludes($this->mini_load); + else + $this->manager->parseIncludes($this->first_load); $this->serializer = request()->input('serializer') ?: EntityTransformer::API_SERIALIZER_ARRAY; @@ -196,9 +200,9 @@ class BaseController extends Controller $transformer = new $this->entity_transformer($this->serializer); $updated_at = request()->has('updated_at') ? request()->input('updated_at') : 0; - if (auth()->user()->getCompany()->is_large && ! request()->has('updated_at')) { - return response()->json(['message' => ctrans('texts.large_account_update_parameter'), 'errors' =>[]], 401); - } + // if (auth()->user()->getCompany()->is_large && ! request()->has('updated_at')) { + // return response()->json(['message' => ctrans('texts.large_account_update_parameter'), 'errors' =>[]], 401); + // } $updated_at = date('Y-m-d H:i:s', $updated_at); diff --git a/app/Jobs/RecurringInvoice/SendRecurring.php b/app/Jobs/RecurringInvoice/SendRecurring.php index 0b3f1b52412d..843c722d1d6c 100644 --- a/app/Jobs/RecurringInvoice/SendRecurring.php +++ b/app/Jobs/RecurringInvoice/SendRecurring.php @@ -80,6 +80,7 @@ class SendRecurring implements ShouldQueue } if ($invoice->client->getSetting('auto_bill_date') == 'on_send_date' && $this->recurring_invoice->auto_bill_enabled) { + nlog("attempting to autobill {$invoice->number}"); $invoice->service()->autoBill()->save(); } diff --git a/app/Models/Presenters/CompanyPresenter.php b/app/Models/Presenters/CompanyPresenter.php index 0148d1f1adc4..fec12b9eac87 100644 --- a/app/Models/Presenters/CompanyPresenter.php +++ b/app/Models/Presenters/CompanyPresenter.php @@ -91,13 +91,13 @@ class CompanyPresenter extends EntityPresenter } } - public function getSpcQrCode($client_custom, $invoice_number, $balance) + public function getSpcQrCode($client_currency, $invoice_number, $balance) { $settings = $this->entity->settings; return - "SPC\n0200\n1\nCH860021421411198240K\nK\n{$this->name}\n{$settings->address1}\n{$settings->postal_code} {$settings->city}\n\n\nCH\n\n\n\n\n\n\n\n{$balance}\n{$client_custom}\n\n\n\n\n\n\n\nNON\n\n{$invoice_number}\nEPD\n"; + "SPC\n0200\n1\nCH860021421411198240K\nK\n{$this->name}\n{$settings->address1}\n{$settings->postal_code} {$settings->city}\n\n\nCH\n\n\n\n\n\n\n\n{$balance}\n{$client_currency}\n\n\n\n\n\n\n\nNON\n\n{$invoice_number}\nEPD\n"; } } diff --git a/app/PaymentDrivers/StripePaymentDriver.php b/app/PaymentDrivers/StripePaymentDriver.php index dcd3894f98c9..52b9dc67caf0 100644 --- a/app/PaymentDrivers/StripePaymentDriver.php +++ b/app/PaymentDrivers/StripePaymentDriver.php @@ -175,10 +175,8 @@ class StripePaymentDriver extends BaseDriver return $this->payment_method->paymentView($data); } - public function processPaymentResponse($request) //We never have to worry about unsuccessful payments as failures are handled at the front end for this driver. + public function processPaymentResponse($request) { - $this->setPaymentHash($request->payment_hash); - return $this->payment_method->paymentResponse($request); } diff --git a/app/Utils/HtmlEngine.php b/app/Utils/HtmlEngine.php index 9373325d46b4..fdf8e0eeaa04 100644 --- a/app/Utils/HtmlEngine.php +++ b/app/Utils/HtmlEngine.php @@ -276,7 +276,7 @@ class HtmlEngine $data['$company.website'] = ['value' => $this->settings->website ?: ' ', 'label' => ctrans('texts.website')]; $data['$company.address'] = ['value' => $this->company->present()->address($this->settings) ?: ' ', 'label' => ctrans('texts.address')]; - $data['$spc_qr_code'] = ['value' => $this->company->present()->getSpcQrCode($this->client->custom1, $this->entity->number, $this->entity->balance), 'label' => '']; + $data['$spc_qr_code'] = ['value' => $this->company->present()->getSpcQrCode($this->client->currency()->code, $this->entity->number, $this->entity->balance), 'label' => '']; $logo = $this->company->present()->logo($this->settings);