diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 59e4b797b..74964b338 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -30,7 +30,7 @@ jobs: MULTI_DB_ENABLED: false NINJA_LICENSE: 123456 TRAVIS: true - MAIL_DRIVER: log + MAIL_MAILER: log services: mariadb: diff --git a/app/Console/Commands/PostUpdate.php b/app/Console/Commands/PostUpdate.php index a675503c7..def9f4237 100644 --- a/app/Console/Commands/PostUpdate.php +++ b/app/Console/Commands/PostUpdate.php @@ -51,49 +51,62 @@ class PostUpdate extends Command \Log::error("I wasn't able to optimize."); } - $composer_data = [ - 'url' => 'https://getcomposer.org/composer.phar', - 'dir' => __DIR__.'/.code', - 'bin' => __DIR__.'/.code/composer.phar', - 'json' => __DIR__.'/.code/composer.json', - 'conf' => [ - 'autoload' => [ - 'psr-4' => [ - '' => 'local/', - ], - ], - ], - ]; +// Composer\Factory::getHomeDir() method +// needs COMPOSER_HOME environment variable set + putenv('COMPOSER_HOME=' . __DIR__ . '/vendor/bin/composer'); - if (! is_dir($composer_data['dir'])) { - mkdir($composer_data['dir'], 0777, true); - } + // call `composer install` command programmatically + $input = new ArrayInput(array('command' => 'install')); + $application = new Application(); + $application->setAutoExit(false); + $out = $application->run($input); - if (! is_dir("{$composer_data['dir']}/local")) { - mkdir("{$composer_data['dir']}/local", 0777, true); - } + print_r($out); + echo "Done."; - copy($composer_data['url'], $composer_data['bin']); - require_once "phar://{$composer_data['bin']}/src/bootstrap.php"; + // $composer_data = [ + // 'url' => 'https://getcomposer.org/composer.phar', + // 'dir' => __DIR__.'/.code', + // 'bin' => __DIR__.'/.code/composer.phar', + // 'json' => __DIR__.'/.code/composer.json', + // 'conf' => [ + // 'autoload' => [ + // 'psr-4' => [ + // '' => 'local/', + // ], + // ], + // ], + // ]; - $conf_json = json_encode($composer_data['conf'], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); - file_put_contents($composer_data['json'], $conf_json); - chdir($composer_data['dir']); - putenv("COMPOSER_HOME={$composer_data['dir']}"); - putenv('OSTYPE=OS400'); - $app = new \Composer\Console\Application(); + // if (! is_dir($composer_data['dir'])) { + // mkdir($composer_data['dir'], 0777, true); + // } - $factory = new \Composer\Factory(); - $output = $factory->createOutput(); + // if (! is_dir("{$composer_data['dir']}/local")) { + // mkdir("{$composer_data['dir']}/local", 0777, true); + // } - $input = new \Symfony\Component\Console\Input\ArrayInput([ - 'command' => 'install', - ]); - $input->setInteractive(false); - echo '
';
- $cmdret = $app->doRun($input, $output);
- echo 'end!';
+ // copy($composer_data['url'], $composer_data['bin']);
+ // require_once "phar://{$composer_data['bin']}/src/bootstrap.php";
- \Log::error(print_r($cmdret, 1));
+ // $conf_json = json_encode($composer_data['conf'], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
+ // file_put_contents($composer_data['json'], $conf_json);
+ // chdir($composer_data['dir']);
+ // putenv("COMPOSER_HOME={$composer_data['dir']}");
+ // putenv('OSTYPE=OS400');
+ // $app = new \Composer\Console\Application();
+
+ // $factory = new \Composer\Factory();
+ // $output = $factory->createOutput();
+
+ // $input = new \Symfony\Component\Console\Input\ArrayInput([
+ // 'command' => 'install',
+ // ]);
+ // $input->setInteractive(false);
+ // echo '';
+ // $cmdret = $app->doRun($input, $output);
+ // echo 'end!';
+
+ // \Log::error(print_r($cmdret, 1));
}
}
diff --git a/app/Http/Controllers/ClientPortal/EntityViewController.php b/app/Http/Controllers/ClientPortal/EntityViewController.php
index e16b0c7f5..f65230ca4 100644
--- a/app/Http/Controllers/ClientPortal/EntityViewController.php
+++ b/app/Http/Controllers/ClientPortal/EntityViewController.php
@@ -33,17 +33,18 @@ class EntityViewController extends Controller
$key = $entity_type.'_id';
- $invitation = $invitation_entity::whereRaw('BINARY `key`= ?', [$invitation_key])->firstOrFail();
+ $invitation = $invitation_entity::whereRaw('BINARY `key`= ?', [$invitation_key])
+ ->with('contact.client')
+ ->firstOrFail();
$contact = $invitation->contact;
+ $client = $contact->client;
+ $entity = $invitation->{$entity_type};
if (is_null($contact->password) || empty($contact->password)) {
return redirect("/client/password/reset?email={$contact->email}");
}
- $entity_class = sprintf('App\\Models\\%s', ucfirst($entity_type));
- $entity = $entity_class::findOrFail($invitation->{$key});
-
if ((bool) $invitation->contact->client->getSetting('enable_client_portal_password') !== false) {
session()->flash("{$entity_type}_VIEW_{$entity->hashed_id}", true);
}
diff --git a/app/Http/Controllers/ClientPortal/InvitationController.php b/app/Http/Controllers/ClientPortal/InvitationController.php
index aba552eed..e891f5769 100644
--- a/app/Http/Controllers/ClientPortal/InvitationController.php
+++ b/app/Http/Controllers/ClientPortal/InvitationController.php
@@ -37,29 +37,34 @@ class InvitationController extends Controller
$entity_obj = 'App\Models\\'.ucfirst($entity).'Invitation';
- $invitation = $entity_obj::whereRaw('BINARY `key`= ?', [$invitation_key])->first();
+ $invitation = $entity_obj::whereRaw('BINARY `key`= ?', [$invitation_key])
+ ->with('contact.client')
+ ->firstOrFail();
- if ($invitation) {
- if ((bool) $invitation->contact->client->getSetting('enable_client_portal_password') !== false) {
- $this->middleware('auth:contact');
- } else {
- auth()->guard('contact')->login($invitation->contact, true);
- }
+ /* Return early if we have the correct client_hash embedded */
- if (! request()->has('silent') && ! $invitation->viewed_date) {
-// if (!request()->has('silent')) {
-
- $invitation->markViewed();
-
- event(new InvitationWasViewed($invitation->{$entity}, $invitation, $invitation->{$entity}->company, Ninja::eventVars()));
-
- $this->fireEntityViewedEvent($invitation, $entity);
- }
-
- return redirect()->route('client.'.$entity.'.show', [$entity => $this->encodePrimaryKey($invitation->{$key})]);
- } else {
- abort(404);
+ if(request()->has('client_hash') && request()->input('client_hash') == $invitation->contact->client->client_hash) {
+ auth()->guard('contact')->login($invitation->contact, true);
}
+ else if ((bool) $invitation->contact->client->getSetting('enable_client_portal_password') !== false) {
+ $this->middleware('auth:contact');
+ }
+ else {
+ auth()->guard('contact')->login($invitation->contact, true);
+ }
+
+ if (auth()->guard('contact') && ! request()->has('silent') && ! $invitation->viewed_date) {
+
+ $invitation->markViewed();
+
+ event(new InvitationWasViewed($invitation->{$entity}, $invitation, $invitation->{$entity}->company, Ninja::eventVars()));
+
+ $this->fireEntityViewedEvent($invitation, $entity);
+ }
+
+ return redirect()->route('client.'.$entity.'.show', [$entity => $this->encodePrimaryKey($invitation->{$key})]);
+
+
}
private function fireEntityViewedEvent($invitation, $entity_string)
diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php
index 9365e1d54..4f69d563d 100644
--- a/app/Http/Kernel.php
+++ b/app/Http/Kernel.php
@@ -29,8 +29,8 @@ class Kernel extends HttpKernel
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\App\Http\Middleware\TrustProxies::class,
- \Fruitcake\Cors\HandleCors::class,
- \App\Http\Middleware\Cors::class,
+ //\Fruitcake\Cors\HandleCors::class,
+ \App\Http\Middleware\Cors::class,
];
diff --git a/app/Http/Middleware/QueryLogging.php b/app/Http/Middleware/QueryLogging.php
index 64f8742da..4841c12bb 100644
--- a/app/Http/Middleware/QueryLogging.php
+++ b/app/Http/Middleware/QueryLogging.php
@@ -31,10 +31,12 @@ class QueryLogging
*/
public function handle(Request $request, Closure $next)
{
+
+ $timeStart = microtime(true);
+
// Enable query logging for development
if (config('ninja.app_env') != 'production') {
DB::enableQueryLog();
- $timeStart = microtime(true);
}
$response = $next($request);
diff --git a/app/Jobs/Invoice/CreateInvoicePdf.php b/app/Jobs/Invoice/CreateInvoicePdf.php
index b85b3309d..acc644594 100644
--- a/app/Jobs/Invoice/CreateInvoicePdf.php
+++ b/app/Jobs/Invoice/CreateInvoicePdf.php
@@ -111,7 +111,7 @@ class CreateInvoicePdf implements ShouldQueue
//todo - move this to the client creation stage so we don't keep hitting this unnecessarily
Storage::makeDirectory($path, 0775);
- info($maker->getCompiledHTML(true));
+ //info($maker->getCompiledHTML(true));
$pdf = $this->makePdf(null, null, $maker->getCompiledHTML(true));
diff --git a/app/PaymentDrivers/PayPalExpressPaymentDriver.php b/app/PaymentDrivers/PayPalExpressPaymentDriver.php
index 76f6d0a81..76b8600ef 100644
--- a/app/PaymentDrivers/PayPalExpressPaymentDriver.php
+++ b/app/PaymentDrivers/PayPalExpressPaymentDriver.php
@@ -262,6 +262,13 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver
public function createPayment($data, $status = Payment::STATUS_COMPLETED): Payment
{
+ $payment_meta = new \stdClass;
+ $payment_meta->exp_month = 'xx';
+ $payment_meta->exp_year = 'xx';
+ $payment_meta->brand = 'PayPal';
+ $payment_meta->last4 = 'xxxx';
+ $payment_meta->type = GatewayType::PAYPAL;
+
$payment = parent::createPayment($data, $status);
$client_contact = $this->getContact();
@@ -271,6 +278,7 @@ class PayPalExpressPaymentDriver extends BasePaymentDriver
$payment->type_id = PaymentType::PAYPAL;
$payment->transaction_reference = $data['PAYMENTINFO_0_TRANSACTIONID'];
$payment->client_contact_id = $client_contact_id;
+ $payment->meta = $payment_meta;
$payment->save();
return $payment;
diff --git a/composer.lock b/composer.lock
index e8f87a8c7..88e234c82 100644
--- a/composer.lock
+++ b/composer.lock
@@ -1541,16 +1541,16 @@
},
{
"name": "egulias/email-validator",
- "version": "2.1.19",
+ "version": "2.1.20",
"source": {
"type": "git",
"url": "https://github.com/egulias/EmailValidator.git",
- "reference": "840d5603eb84cc81a6a0382adac3293e57c1c64c"
+ "reference": "f46887bc48db66c7f38f668eb7d6ae54583617ff"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/840d5603eb84cc81a6a0382adac3293e57c1c64c",
- "reference": "840d5603eb84cc81a6a0382adac3293e57c1c64c",
+ "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/f46887bc48db66c7f38f668eb7d6ae54583617ff",
+ "reference": "f46887bc48db66c7f38f668eb7d6ae54583617ff",
"shasum": ""
},
"require": {
@@ -1595,7 +1595,7 @@
"validation",
"validator"
],
- "time": "2020-08-08T21:28:19+00:00"
+ "time": "2020-09-06T13:44:32+00:00"
},
{
"name": "fedeisas/laravel-mail-css-inliner",
@@ -4364,16 +4364,16 @@
},
{
"name": "opis/closure",
- "version": "3.5.6",
+ "version": "3.5.7",
"source": {
"type": "git",
"url": "https://github.com/opis/closure.git",
- "reference": "e8d34df855b0a0549a300cb8cb4db472556e8aa9"
+ "reference": "4531e53afe2fc660403e76fb7644e95998bff7bf"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/opis/closure/zipball/e8d34df855b0a0549a300cb8cb4db472556e8aa9",
- "reference": "e8d34df855b0a0549a300cb8cb4db472556e8aa9",
+ "url": "https://api.github.com/repos/opis/closure/zipball/4531e53afe2fc660403e76fb7644e95998bff7bf",
+ "reference": "4531e53afe2fc660403e76fb7644e95998bff7bf",
"shasum": ""
},
"require": {
@@ -4421,7 +4421,7 @@
"serialization",
"serialize"
],
- "time": "2020-08-11T08:46:50+00:00"
+ "time": "2020-09-06T17:02:15+00:00"
},
{
"name": "paragonie/random_compat",
@@ -11053,7 +11053,6 @@
"keywords": [
"tokenizer"
],
- "abandoned": true,
"time": "2019-09-17T06:23:10+00:00"
},
{
diff --git a/config/filesystems.php b/config/filesystems.php
index 88314fa61..816d65b2b 100644
--- a/config/filesystems.php
+++ b/config/filesystems.php
@@ -13,7 +13,7 @@ return [
|
*/
- 'default' => env('FILESYSTEM_DRIVER', 'local'),
+ 'default' => env('FILESYSTEM_DRIVER', 'public'),
/*
|--------------------------------------------------------------------------