diff --git a/app/Filters/ClientFilters.php b/app/Filters/ClientFilters.php index a04f8eb623..18eb909d0c 100644 --- a/app/Filters/ClientFilters.php +++ b/app/Filters/ClientFilters.php @@ -30,7 +30,10 @@ class ClientFilters extends QueryFilters */ public function name(string $name): Builder { - return $this->builder->where('name', 'like', '%'.$name.'%'); + if(strlen($name) >=1) + return $this->builder->where('name', 'like', '%'.$name.'%'); + + return $this->builder; } /** diff --git a/app/Helpers/SwissQr/SwissQrGenerator.php b/app/Helpers/SwissQr/SwissQrGenerator.php index 105b080711..043acd5ae4 100644 --- a/app/Helpers/SwissQr/SwissQrGenerator.php +++ b/app/Helpers/SwissQr/SwissQrGenerator.php @@ -105,11 +105,21 @@ class SwissQrGenerator // Add payment reference // This is what you will need to identify incoming payments. + if(stripos($this->invoice->number, "Live-") === 0) + { + // we're currently in preview status. Let's give a dummy reference for now + $invoice_number = "123456789"; + } + else + { + $invoice_number = $this->invoice->number; + } + if(strlen($this->company->present()->besr_id()) > 1) { $referenceNumber = QrBill\Reference\QrPaymentReferenceGenerator::generate( $this->company->present()->besr_id() ?: '', // You receive this number from your bank (BESR-ID). Unless your bank is PostFinance, in that case use NULL. - $this->invoice->number// A number to match the payment with your internal data, e.g. an invoice number + $invoice_number// A number to match the payment with your internal data, e.g. an invoice number ); $qrBill->setPaymentReference( diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php index 8e85d37f12..eca62ed1f2 100644 --- a/app/Http/Controllers/ActivityController.php +++ b/app/Http/Controllers/ActivityController.php @@ -41,7 +41,7 @@ class ActivityController extends BaseController /** * @OA\Get( - * path="/api/v1/actvities", + * path="/api/v1/activities", * operationId="getActivities", * tags={"actvities"}, * summary="Gets a list of actvities", diff --git a/app/Http/Controllers/SelfUpdateController.php b/app/Http/Controllers/SelfUpdateController.php index 32324873a9..4614d1486c 100644 --- a/app/Http/Controllers/SelfUpdateController.php +++ b/app/Http/Controllers/SelfUpdateController.php @@ -69,39 +69,7 @@ class SelfUpdateController extends BaseController * ), * ) */ - // public function old_update(\Codedge\Updater\UpdaterManager $updater) - // { - // set_time_limit(0); - // define('STDIN', fopen('php://stdin', 'r')); - - // if (Ninja::isHosted()) { - // return response()->json(['message' => ctrans('texts.self_update_not_available')], 403); - // } - - // $this->testWritable(); - - // // Get the new version available - // $versionAvailable = $updater->source()->getVersionAvailable(); - - // // Create a release - // $release = $updater->source()->fetch($versionAvailable); - - // $updater->source()->update($release); - - // $cacheCompiled = base_path('bootstrap/cache/compiled.php'); - // if (file_exists($cacheCompiled)) { unlink ($cacheCompiled); } - // $cacheServices = base_path('bootstrap/cache/services.php'); - // if (file_exists($cacheServices)) { unlink ($cacheServices); } - - // Artisan::call('clear-compiled'); - // Artisan::call('route:clear'); - // Artisan::call('view:clear'); - // Artisan::call('optimize'); - - // return response()->json(['message' => 'Update completed'], 200); - - // } - + public function update() { set_time_limit(0); diff --git a/app/Jobs/Util/Import.php b/app/Jobs/Util/Import.php index 7a987808d1..5fad49fe6e 100644 --- a/app/Jobs/Util/Import.php +++ b/app/Jobs/Util/Import.php @@ -264,7 +264,7 @@ class Import implements ShouldQueue $t->replace(Ninja::transformTranslations($this->company->settings)); Mail::to($this->user->email, $this->user->name()) - ->send(new MigrationCompleted($this->company, implode("
",$check_data))); + ->send(new MigrationCompleted($this->company->id, $this->company->db, implode("
",$check_data))); } catch(\Exception $e) { nlog($e->getMessage()); @@ -715,6 +715,15 @@ class Import implements ShouldQueue Client::reguard(); + Client::with('contacts')->where('company_id', $this->company->id)->cursor()->each(function ($client){ + + $contact = $client->contacts->sortByDesc('is_primary')->first(); + $contact->is_primary = true; + $contact->save(); + + }); + + /*Improve memory handling by setting everything to null when we have finished*/ $data = null; $contact_repository = null; diff --git a/app/Mail/MigrationCompleted.php b/app/Mail/MigrationCompleted.php index d8dfb3ed8e..daddca816c 100644 --- a/app/Mail/MigrationCompleted.php +++ b/app/Mail/MigrationCompleted.php @@ -2,6 +2,7 @@ namespace App\Mail; +use App\Libraries\MultiDB; use App\Models\Company; use App\Utils\Ninja; use Illuminate\Bus\Queueable; @@ -13,19 +14,23 @@ class MigrationCompleted extends Mailable { // use Queueable, SerializesModels; - public $company; + public $company_id; + + public $db; public $check_data; + public $company; /** * Create a new message instance. * * @return void */ - public function __construct(Company $company, $check_data = '') + public function __construct(int $company_id, string $db, $check_data = '') { - $this->company = $company; + $this->company_id = $company_id; $this->check_data = $check_data; + $this->db = $db; } /** @@ -35,6 +40,10 @@ class MigrationCompleted extends Mailable */ public function build() { + + MultiDB::setDb($this->db); + $this->company = Company::find($this->company_id); + App::forgetInstance('translator'); $t = app('translator'); $t->replace(Ninja::transformTranslations($this->company->settings)); diff --git a/app/PaymentDrivers/CheckoutComPaymentDriver.php b/app/PaymentDrivers/CheckoutComPaymentDriver.php index fffdd8edf1..2a7a9e9451 100644 --- a/app/PaymentDrivers/CheckoutComPaymentDriver.php +++ b/app/PaymentDrivers/CheckoutComPaymentDriver.php @@ -12,6 +12,7 @@ namespace App\PaymentDrivers; +use App\Exceptions\PaymentFailed; use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest; use App\Http\Requests\Gateways\Checkout3ds\Checkout3dsRequest; use App\Http\Requests\Payments\PaymentWebhookRequest; @@ -254,12 +255,13 @@ class CheckoutComPaymentDriver extends BaseDriver ]; } catch (CheckoutApiException $e) { // API error - $request_id = $e->request_id; - $http_status_code = $e->http_status_code; - $error_details = $e->error_details; + throw new PaymentFailed($e->getMessage(), $e->getCode()); + } catch (CheckoutArgumentException $e) { // Bad arguments + throw new PaymentFailed($e->getMessage(), $e->getCode()); + return [ 'transaction_reference' => null, 'transaction_response' => json_encode($e->getMessage()), @@ -270,6 +272,8 @@ class CheckoutComPaymentDriver extends BaseDriver } catch (CheckoutAuthorizationException $e) { // Bad Invalid authorization + throw new PaymentFailed($e->getMessage(), $e->getCode()); + return [ 'transaction_reference' => null, 'transaction_response' => json_encode($e->getMessage()), diff --git a/app/PaymentDrivers/Stripe/UpdatePaymentMethods.php b/app/PaymentDrivers/Stripe/UpdatePaymentMethods.php index 860b590602..4424ca40ee 100644 --- a/app/PaymentDrivers/Stripe/UpdatePaymentMethods.php +++ b/app/PaymentDrivers/Stripe/UpdatePaymentMethods.php @@ -74,7 +74,7 @@ class UpdatePaymentMethods { $sources = $customer->sources; - if(!property_exists($sources, 'data')) + if(!$customer || !property_exists($sources, 'data')) return; foreach ($sources->data as $method) { diff --git a/public/css/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsjZ0B4gaVI.woff2 b/public/css/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsjZ0B4gaVI.woff2 new file mode 100644 index 0000000000..15339ea9cc Binary files /dev/null and b/public/css/memSYaGs126MiZpBA-UvWbX2vVnXBbObj2OVZyOOSr4dVJWUgsjZ0B4gaVI.woff2 differ diff --git a/resources/views/errors/illustrated-layout.blade.php b/resources/views/errors/illustrated-layout.blade.php index 06e3372f46..3f81c6cae1 100644 --- a/resources/views/errors/illustrated-layout.blade.php +++ b/resources/views/errors/illustrated-layout.blade.php @@ -7,9 +7,20 @@ @yield('title') - - - + {{-- --}} + {{-- --}} + + + diff --git a/resources/views/layouts/ninja.blade.php b/resources/views/layouts/ninja.blade.php index 9fa37c947f..d18aa27e8b 100644 --- a/resources/views/layouts/ninja.blade.php +++ b/resources/views/layouts/ninja.blade.php @@ -52,8 +52,19 @@ - - + {{-- --}} + {{-- --}} + diff --git a/resources/views/portal/ninja2020/auth/register.blade.php b/resources/views/portal/ninja2020/auth/register.blade.php index 23fd243113..84e2c0f2a9 100644 --- a/resources/views/portal/ninja2020/auth/register.blade.php +++ b/resources/views/portal/ninja2020/auth/register.blade.php @@ -27,7 +27,11 @@ @if($field['required']) diff --git a/resources/views/portal/ninja2020/layout/app.blade.php b/resources/views/portal/ninja2020/layout/app.blade.php index 91a1cde304..e2aed0225b 100644 --- a/resources/views/portal/ninja2020/layout/app.blade.php +++ b/resources/views/portal/ninja2020/layout/app.blade.php @@ -51,9 +51,19 @@ - - - + {{-- --}} + {{-- --}} + diff --git a/resources/views/portal/ninja2020/layout/clean.blade.php b/resources/views/portal/ninja2020/layout/clean.blade.php index 7a504e7468..0302bdb23f 100644 --- a/resources/views/portal/ninja2020/layout/clean.blade.php +++ b/resources/views/portal/ninja2020/layout/clean.blade.php @@ -51,8 +51,20 @@ - + {{-- + --}} + diff --git a/resources/views/portal/ninja2020/layout/clean_setup.blade.php b/resources/views/portal/ninja2020/layout/clean_setup.blade.php index 50452d2b7e..3eaf8875c7 100644 --- a/resources/views/portal/ninja2020/layout/clean_setup.blade.php +++ b/resources/views/portal/ninja2020/layout/clean_setup.blade.php @@ -55,8 +55,19 @@ - - + {{-- --}} + {{-- --}} + @if(strpos(Request::url(),'setup') === false) diff --git a/resources/views/portal/ninja2020/layout/vendor_app.blade.php b/resources/views/portal/ninja2020/layout/vendor_app.blade.php index 64d66f8322..87f03f3d80 100644 --- a/resources/views/portal/ninja2020/layout/vendor_app.blade.php +++ b/resources/views/portal/ninja2020/layout/vendor_app.blade.php @@ -51,8 +51,19 @@ - - + {{-- --}} + {{-- --}} + diff --git a/resources/views/themes/ninja2020/clean.blade.php b/resources/views/themes/ninja2020/clean.blade.php index 8a24e8ca80..b1ecd0e05b 100644 --- a/resources/views/themes/ninja2020/clean.blade.php +++ b/resources/views/themes/ninja2020/clean.blade.php @@ -51,9 +51,21 @@ - - + {{-- --}} + {{-- --}} + + {{-- --}} diff --git a/resources/views/vendor/l5-swagger/index.blade.php b/resources/views/vendor/l5-swagger/index.blade.php index e75abb2e41..d0992af082 100644 --- a/resources/views/vendor/l5-swagger/index.blade.php +++ b/resources/views/vendor/l5-swagger/index.blade.php @@ -4,7 +4,18 @@ {{config('l5-swagger.documentations.'.$documentation.'.api.title')}} - + {{-- --}} +