From 53bebc4d0f530573e27cd2526af1eb465706ed08 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 13 Dec 2021 09:10:30 +0200 Subject: [PATCH 01/13] Update version --- app/Constants.php | 2 +- docs/conf.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Constants.php b/app/Constants.php index d8bb1190a6e1..b464e80aeeaf 100644 --- a/app/Constants.php +++ b/app/Constants.php @@ -361,7 +361,7 @@ if (! defined('APP_NAME')) { define('NINJA_APP_URL', env('NINJA_APP_URL', 'https://app.invoiceninja.com')); define('NINJA_DOCS_URL', env('NINJA_DOCS_URL', 'https://invoice-ninja.readthedocs.io/en/latest')); define('NINJA_DATE', '2000-01-01'); - define('NINJA_VERSION', '4.5.46' . env('NINJA_VERSION_SUFFIX')); + define('NINJA_VERSION', '4.5.47' . env('NINJA_VERSION_SUFFIX')); define('NINJA_TERMS_VERSION', '1.0.1'); define('SOCIAL_LINK_FACEBOOK', env('SOCIAL_LINK_FACEBOOK', 'https://www.facebook.com/invoiceninja')); diff --git a/docs/conf.py b/docs/conf.py index ea0a5ad6a1b6..f7937f7b35e8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -59,7 +59,7 @@ author = u'Invoice Ninja' # The short X.Y version. version = u'4.5' # The full version, including alpha/beta/rc tags. -release = u'4.5.46' +release = u'4.5.47' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. From 6a146e8fff0b9b8b90dd4fd64a0aca5f8303dc2d Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sat, 18 Dec 2021 21:06:58 +1100 Subject: [PATCH 02/13] Set account owner --- app/Http/Controllers/Migration/StepsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Migration/StepsController.php b/app/Http/Controllers/Migration/StepsController.php index ef4a89bc3121..dd168e3046bc 100644 --- a/app/Http/Controllers/Migration/StepsController.php +++ b/app/Http/Controllers/Migration/StepsController.php @@ -167,7 +167,7 @@ class StepsController extends BaseController $body = [ 'account_key' => $account->account_key, - 'email' => \Auth::user()->email, + 'email' => $account->getPrimaryUser()->email, 'plan' => $account->company->plan, 'plan_term' =>$account->company->plan_term, 'plan_started' =>$account->company->plan_started, From b54dc7bf0a2e9b7057b0955c05bb0a55a014931e Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 19 Dec 2021 16:24:33 +1100 Subject: [PATCH 03/13] Rollback where we define constants.php" --- public/index.php | 2 +- routes/web.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/public/index.php b/public/index.php index 2568d6704c02..5ab6801c45c8 100644 --- a/public/index.php +++ b/public/index.php @@ -34,7 +34,7 @@ require __DIR__.'/../bootstrap/autoload.php'; $app = require_once __DIR__.'/../bootstrap/app.php'; -require_once __DIR__.'/../app/Constants.php'; +// require_once __DIR__.'/../app/Constants.php'; /* |-------------------------------------------------------------------------- | Run The Application diff --git a/routes/web.php b/routes/web.php index edb7ada86327..77fa114091b4 100644 --- a/routes/web.php +++ b/routes/web.php @@ -412,4 +412,4 @@ if (Utils::isNinjaDev()) */ // Include static app constants -// require_once app_path() . '/Constants.php'; +require_once app_path() . '/Constants.php'; From 45acf67daa675492b90bf903e6e4be53c4cc85d0 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 19 Dec 2021 10:24:52 +0200 Subject: [PATCH 04/13] Hide referral link --- resources/views/accounts/user_details.blade.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/resources/views/accounts/user_details.blade.php b/resources/views/accounts/user_details.blade.php index 3fbc98f6dde6..04ab2612af7d 100644 --- a/resources/views/accounts/user_details.blade.php +++ b/resources/views/accounts/user_details.blade.php @@ -79,11 +79,6 @@ $referralCounts['pro'] . ' ' . trans('texts.pro') . '' . Icon::create('question-sign') . ' ') ->value(NINJA_APP_URL . '/invoice_now?rc=' . $user->referral_code) !!} - @else - {!! Former::checkbox('referral_code') - ->help(trans('texts.referral_code_help')) - ->text(trans('texts.enable') . ' ' . Icon::create('question-sign') . '') - ->value(1) !!} @endif @endif From 7d61ec831759e0db95767c76df33b66ce9848d8b Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 29 Dec 2021 09:14:41 +1100 Subject: [PATCH 05/13] Fixes for gatewayTypeId --- app/Http/Controllers/ClientPortalController.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/ClientPortalController.php b/app/Http/Controllers/ClientPortalController.php index 0a768426d770..ae82faca997e 100644 --- a/app/Http/Controllers/ClientPortalController.php +++ b/app/Http/Controllers/ClientPortalController.php @@ -140,7 +140,7 @@ class ClientPortalController extends BaseController $paymentURL = ''; if (count($paymentTypes) == 1) { $paymentURL = $paymentTypes[0]['url']; - if (in_array($paymentTypes[0]['gatewayTypeId'], [GATEWAY_TYPE_CUSTOM1, GATEWAY_TYPE_CUSTOM2, GATEWAY_TYPE_CUSTOM3])) { + if (array_key_exists('gatewayTypeId', $paymentTypes[0]) && in_array($paymentTypes[0]['gatewayTypeId'], [GATEWAY_TYPE_CUSTOM1, GATEWAY_TYPE_CUSTOM2, GATEWAY_TYPE_CUSTOM3])) { // do nothing } elseif (! $account->isGatewayConfigured(GATEWAY_PAYPAL_EXPRESS)) { $paymentURL = URL::to($paymentURL); @@ -162,6 +162,11 @@ class ClientPortalController extends BaseController $showApprove = false; } + $gatewayTypeIdCast = false; + + if(array_key_exists('gatewayTypeId', $paymentTypes[0])) + $gatewayTypeIdCast = $paymentTypes[0]['gatewayTypeId']; + $data += [ 'account' => $account, 'showApprove' => $showApprove, @@ -173,7 +178,7 @@ class ClientPortalController extends BaseController 'paymentTypes' => $paymentTypes, 'paymentURL' => $paymentURL, 'phantomjs' => Request::has('phantomjs'), - 'gatewayTypeId' => count($paymentTypes) == 1 ? $paymentTypes[0]['gatewayTypeId'] : false, + 'gatewayTypeId' => count($paymentTypes) == 1 ? $gatewayTypeIdCast : false, ]; if ($invoice->canBePaid()) { From 60897083d11109694e24235956ee0aa8664742b2 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 29 Dec 2021 17:05:04 +1100 Subject: [PATCH 06/13] Minor fixes --- app/Http/Controllers/ClientPortalController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/ClientPortalController.php b/app/Http/Controllers/ClientPortalController.php index ae82faca997e..fe5f666c3e58 100644 --- a/app/Http/Controllers/ClientPortalController.php +++ b/app/Http/Controllers/ClientPortalController.php @@ -164,7 +164,7 @@ class ClientPortalController extends BaseController $gatewayTypeIdCast = false; - if(array_key_exists('gatewayTypeId', $paymentTypes[0])) + if(count($paymentTypes) >= 1 && array_key_exists('gatewayTypeId', $paymentTypes[0])) $gatewayTypeIdCast = $paymentTypes[0]['gatewayTypeId']; $data += [ From 95c36f111bf8e665a9c9a808398007568001f6b8 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 2 Jan 2022 23:01:07 +1100 Subject: [PATCH 07/13] Fixes for mail notifications --- app/Http/Controllers/InvoiceController.php | 4 ++-- app/Jobs/SendInvoiceEmail.php | 2 +- app/Jobs/SendNotificationEmail.php | 24 ++++++++++++---------- app/Listeners/NotificationListener.php | 21 +++++++++++-------- app/Ninja/Mailers/UserMailer.php | 2 +- 5 files changed, 29 insertions(+), 24 deletions(-) diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 242f6009ac41..d21ae1c13fed 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -25,9 +25,9 @@ use App\Services\RecurringInvoiceService; use Auth; use Cache; use DB; +use Illuminate\Support\Facades\Session; use Redirect; use Request; -use Session; use URL; use Utils; use View; @@ -427,7 +427,7 @@ class InvoiceController extends BaseController $response = $this->emailRecurringInvoice($invoice); } else { $userId = Auth::user()->id; - $this->dispatch(new SendInvoiceEmail($invoice, $userId, $reminder, $template)); + dispatch(new SendInvoiceEmail($invoice, $userId, $reminder, $template)); $response = true; } diff --git a/app/Jobs/SendInvoiceEmail.php b/app/Jobs/SendInvoiceEmail.php index effa021b9be7..efa5336773be 100644 --- a/app/Jobs/SendInvoiceEmail.php +++ b/app/Jobs/SendInvoiceEmail.php @@ -21,7 +21,7 @@ class SendInvoiceEmail extends Job implements ShouldQueue /** * @var Invoice */ - protected $invoice; + public $invoice; /** * @var bool diff --git a/app/Jobs/SendNotificationEmail.php b/app/Jobs/SendNotificationEmail.php index cf475f77db4c..b6eec96adde1 100644 --- a/app/Jobs/SendNotificationEmail.php +++ b/app/Jobs/SendNotificationEmail.php @@ -2,51 +2,53 @@ namespace App\Jobs; +use App\Models\Invoice; use App\Models\Payment; +use App\Models\Traits\SerialisesDeletedModels; +use App\Models\User; use App\Ninja\Mailers\UserMailer; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; -use App\Models\Traits\SerialisesDeletedModels; /** * Class SendInvoiceEmail. */ class SendNotificationEmail extends Job implements ShouldQueue { - use InteractsWithQueue, SerializesModels, SerialisesDeletedModels { - SerialisesDeletedModels::getRestoredPropertyValue insteadof SerializesModels; - } + use InteractsWithQueue; + + public $deleteWhenMissingModels = true; /** * @var User */ - protected $user; + public User $user; /** * @var Invoice */ - protected $invoice; + public Invoice $invoice; /** * @var string */ - protected $type; + public $type; /** * @var Payment */ - protected $payment; + public ?Payment $payment; /** * @var string */ - protected $notes; + public $notes; /** * @var string */ - protected $server; + public $server; /** * Create a new job instance. @@ -59,7 +61,7 @@ class SendNotificationEmail extends Job implements ShouldQueue * @param mixed $type * @param mixed $payment */ - public function __construct($user, $invoice, $type, $payment, $notes) + public function __construct(User $user, Invoice $invoice, $type, ?Payment $payment, $notes) { $this->user = $user; $this->invoice = $invoice; diff --git a/app/Listeners/NotificationListener.php b/app/Listeners/NotificationListener.php index a906436519ec..b5d2af556410 100644 --- a/app/Listeners/NotificationListener.php +++ b/app/Listeners/NotificationListener.php @@ -1,17 +1,20 @@ -account->users as $user) { diff --git a/app/Ninja/Mailers/UserMailer.php b/app/Ninja/Mailers/UserMailer.php index 881ab1b1a90b..e47560246675 100644 --- a/app/Ninja/Mailers/UserMailer.php +++ b/app/Ninja/Mailers/UserMailer.php @@ -73,7 +73,7 @@ class UserMailer extends Mailer User $user, Invoice $invoice, $notificationType, - Payment $payment = null, + ?Payment $payment, $notes = false ) { if (! $user->shouldNotify($invoice)) { From 03a1c2be8ab4e840c9b9ca0103f9fef4fcc5c563 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 9 Jan 2022 14:05:59 +1100 Subject: [PATCH 08/13] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 5a064ee35749..95f4d13fbf54 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,6 @@ The self-host zip includes all third party libraries whereas downloading the cod * [StackOverflow](https://stackoverflow.com/tags/invoice-ninja/) ## Referral Program -* Earn 50% of Pro & Enterprise Plans up to 4 years - [Learn more](https://www.invoiceninja.com/referral-program/) ## Mobile App * [iPhone](https://itunes.apple.com/us/app/invoice-ninja/id1435514417?ls=1&mt=8) From 84a54b08c7cfd2ffe06e80d970a942dffdc76a4e Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 10 Jan 2022 16:43:36 +1100 Subject: [PATCH 09/13] Fixes for types --- app/Traits/GenerateMigrationResources.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/Traits/GenerateMigrationResources.php b/app/Traits/GenerateMigrationResources.php index 66531b2716f0..2fce8b61606a 100644 --- a/app/Traits/GenerateMigrationResources.php +++ b/app/Traits/GenerateMigrationResources.php @@ -206,7 +206,6 @@ trait GenerateMigrationResources 'client_number_pattern' => $this->account->client_number_pattern ?: '', 'payment_number_pattern' => '', 'payment_number_counter' => 0, - 'payment_terms' => $this->account->payment_terms ?: '', 'reset_counter_frequency_id' => $this->account->reset_counter_frequency_id ? (string) $this->transformFrequencyId ($this->account->reset_counter_frequency_id) : '0', 'payment_type_id' => $this->account->payment_type_id ? (string) $this->transformPaymentType($this->account->payment_type_id) : '1', From 5253cbc9021003750554fcefab8dc274302f05b1 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 12 Jan 2022 12:26:44 +0200 Subject: [PATCH 10/13] Update version --- app/Constants.php | 2 +- docs/conf.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Constants.php b/app/Constants.php index b464e80aeeaf..ca998cfa98ea 100644 --- a/app/Constants.php +++ b/app/Constants.php @@ -361,7 +361,7 @@ if (! defined('APP_NAME')) { define('NINJA_APP_URL', env('NINJA_APP_URL', 'https://app.invoiceninja.com')); define('NINJA_DOCS_URL', env('NINJA_DOCS_URL', 'https://invoice-ninja.readthedocs.io/en/latest')); define('NINJA_DATE', '2000-01-01'); - define('NINJA_VERSION', '4.5.47' . env('NINJA_VERSION_SUFFIX')); + define('NINJA_VERSION', '4.5.48' . env('NINJA_VERSION_SUFFIX')); define('NINJA_TERMS_VERSION', '1.0.1'); define('SOCIAL_LINK_FACEBOOK', env('SOCIAL_LINK_FACEBOOK', 'https://www.facebook.com/invoiceninja')); diff --git a/docs/conf.py b/docs/conf.py index f7937f7b35e8..7ee403fd2f8b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -59,7 +59,7 @@ author = u'Invoice Ninja' # The short X.Y version. version = u'4.5' # The full version, including alpha/beta/rc tags. -release = u'4.5.47' +release = u'4.5.48' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. From 788344783e929f84ccf795ac51d144f4dbb8c565 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 2 Feb 2022 11:25:12 +0200 Subject: [PATCH 11/13] Update version --- app/Constants.php | 2 +- docs/conf.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Constants.php b/app/Constants.php index ca998cfa98ea..a7b23bc32d17 100644 --- a/app/Constants.php +++ b/app/Constants.php @@ -361,7 +361,7 @@ if (! defined('APP_NAME')) { define('NINJA_APP_URL', env('NINJA_APP_URL', 'https://app.invoiceninja.com')); define('NINJA_DOCS_URL', env('NINJA_DOCS_URL', 'https://invoice-ninja.readthedocs.io/en/latest')); define('NINJA_DATE', '2000-01-01'); - define('NINJA_VERSION', '4.5.48' . env('NINJA_VERSION_SUFFIX')); + define('NINJA_VERSION', '4.5.49' . env('NINJA_VERSION_SUFFIX')); define('NINJA_TERMS_VERSION', '1.0.1'); define('SOCIAL_LINK_FACEBOOK', env('SOCIAL_LINK_FACEBOOK', 'https://www.facebook.com/invoiceninja')); diff --git a/docs/conf.py b/docs/conf.py index 7ee403fd2f8b..5c9a5cc1a42f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -59,7 +59,7 @@ author = u'Invoice Ninja' # The short X.Y version. version = u'4.5' # The full version, including alpha/beta/rc tags. -release = u'4.5.48' +release = u'4.5.49' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. From a369e017c9936ac103852d6d7ed0c33c147d98cf Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 3 Feb 2022 09:58:24 +1100 Subject: [PATCH 12/13] fixes for notificationmailer --- app/Notifications/PaymentCreated.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Notifications/PaymentCreated.php b/app/Notifications/PaymentCreated.php index 08ac7c7ef4f2..a806973a4a31 100644 --- a/app/Notifications/PaymentCreated.php +++ b/app/Notifications/PaymentCreated.php @@ -33,7 +33,7 @@ class PaymentCreated extends Notification implements ShouldQueue */ public function via($notifiable) { - return ['slack']; + return []; } /** From 1979eccadd263595399a0d9c6863f74024bba492 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 3 Feb 2022 11:12:11 +1100 Subject: [PATCH 13/13] Fixes for migrations - autobilling --- app/Traits/GenerateMigrationResources.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Traits/GenerateMigrationResources.php b/app/Traits/GenerateMigrationResources.php index 2fce8b61606a..0382c1a28048 100644 --- a/app/Traits/GenerateMigrationResources.php +++ b/app/Traits/GenerateMigrationResources.php @@ -799,8 +799,8 @@ trait GenerateMigrationResources 'due_date_days' => $this->transformDueDate($invoice), 'remaining_cycles' => $this->getRemainingCycles($invoice), 'invitations' => $this->getResourceInvitations($invoice->invitations, 'recurring_invoice_id'), - 'auto_bill_enabled' => $this->calcAutoBillEnabled($invoice), - 'auto_bill' => $this->calcAutoBill($invoice), + 'auto_bill_enabled' => $this->calcAutoBill($invoice), + 'auto_bill' => $this->calcAutoBillEnabled($invoice), ]; }