From 6c098160dfa3e3874915105f72fcfcb845e626a5 Mon Sep 17 00:00:00 2001 From: = Date: Fri, 1 Jan 2021 20:11:21 +1100 Subject: [PATCH 1/6] Allow a user to change only their own password --- app/Http/Requests/User/UpdateUserRequest.php | 5 ++++- app/Repositories/UserRepository.php | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/Http/Requests/User/UpdateUserRequest.php b/app/Http/Requests/User/UpdateUserRequest.php index 474145e11f52..5c6b131f89f5 100644 --- a/app/Http/Requests/User/UpdateUserRequest.php +++ b/app/Http/Requests/User/UpdateUserRequest.php @@ -29,7 +29,10 @@ class UpdateUserRequest extends Request public function rules() { $input = $this->all(); - $rules = []; + + $rules = [ + 'password' => 'nullable|string|min:6', + ]; if (isset($input['email'])) { $rules['email'] = ['email:rfc,dns', 'sometimes', new UniqueUserRule($this->user, $input['email'])]; diff --git a/app/Repositories/UserRepository.php b/app/Repositories/UserRepository.php index 668cf0769d40..25f27e4561bb 100644 --- a/app/Repositories/UserRepository.php +++ b/app/Repositories/UserRepository.php @@ -18,6 +18,7 @@ use App\Models\User; use App\Utils\Ninja; use App\Utils\Traits\MakesHash; use Illuminate\Http\Request; +use Illuminate\Support\Facades\Hash; /** * UserRepository. @@ -61,6 +62,12 @@ class UserRepository extends BaseRepository $user->fill($details); + //allow users to change only their passwords - not others! + if(auth()->user()->id == $user->id && array_key_exists('password', $data) && isset($data['password'])) + { + $user->password = Hash::make($data['password']); + } + if (!$user->confirmation_code) { $user->confirmation_code = $this->createDbHash(config('database.default')); } From 0f70579b7268333cfa1bf55f2f9a9d603d43a570 Mon Sep 17 00:00:00 2001 From: = Date: Sat, 2 Jan 2021 09:32:58 +1100 Subject: [PATCH 2/6] Fixes for client_id_number placeholder for generatescounter --- app/Utils/Traits/GeneratesCounter.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/Utils/Traits/GeneratesCounter.php b/app/Utils/Traits/GeneratesCounter.php index b756eba1d416..2814d94f407d 100644 --- a/app/Utils/Traits/GeneratesCounter.php +++ b/app/Utils/Traits/GeneratesCounter.php @@ -628,21 +628,24 @@ trait GeneratesCounter $replace[] = $entity->id_number; } - if ($entity->client) { + if ($entity->client || ($entity instanceof Client)) { + + $client = $entity->client ?: $entity; + $search[] = '{$client_custom1}'; - $replace[] = $entity->client->custom_value1; + $replace[] = $client->custom_value1; $search[] = '{$client_custom2}'; - $replace[] = $entity->client->custom_value2; + $replace[] = $client->custom_value2; $search[] = '{$client_custom3}'; - $replace[] = $entity->client->custom_value3; + $replace[] = $client->custom_value3; $search[] = '{$client_custom4}'; - $replace[] = $entity->client->custom_value4; + $replace[] = $client->custom_value4; $search[] = '{$client_id_number}'; - $replace[] = $entity->client->id_number; + $replace[] = $client->id_number; } return str_replace($search, $replace, $pattern); From 564e1aefe116ad88c2fbd5e70d05338999473863 Mon Sep 17 00:00:00 2001 From: = Date: Sat, 2 Jan 2021 09:51:13 +1100 Subject: [PATCH 3/6] Fixes for next_send_date when updating a recurring invoice --- app/Models/RecurringInvoice.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/Models/RecurringInvoice.php b/app/Models/RecurringInvoice.php index 7d28949e2f2a..c6e3a03199bf 100644 --- a/app/Models/RecurringInvoice.php +++ b/app/Models/RecurringInvoice.php @@ -369,11 +369,10 @@ class RecurringInvoice extends BaseModel $data = []; - if(!$this->next_send_date) - return $data; - $next_send_date = Carbon::parse($this->next_send_date)->copy(); + if(!$next_send_date) + return $data; for ($x=0; $x<$iterations; $x++) { // we don't add the days... we calc the day of the month!! From ba8fcb0de0299e92101f8a6f9f03b3b02baa7272 Mon Sep 17 00:00:00 2001 From: = Date: Sat, 2 Jan 2021 09:52:42 +1100 Subject: [PATCH 4/6] Fixes for next_send_date when updating a recurring invoice --- app/Models/RecurringInvoice.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Models/RecurringInvoice.php b/app/Models/RecurringInvoice.php index c6e3a03199bf..8e50b30a386d 100644 --- a/app/Models/RecurringInvoice.php +++ b/app/Models/RecurringInvoice.php @@ -369,11 +369,11 @@ class RecurringInvoice extends BaseModel $data = []; - $next_send_date = Carbon::parse($this->next_send_date)->copy(); - - if(!$next_send_date) + if(!Carbon::parse($this->next_send_date)) return $data; + $next_send_date = Carbon::parse($this->next_send_date)->copy(); + for ($x=0; $x<$iterations; $x++) { // we don't add the days... we calc the day of the month!! $next_due_date = $this->calculateDueDate($next_send_date->copy()->format('Y-m-d')); From 0dbf1f1dfd77f4b17fb54cd421e9fa8794df1f82 Mon Sep 17 00:00:00 2001 From: = Date: Sat, 2 Jan 2021 10:01:33 +1100 Subject: [PATCH 5/6] Fix for missing Daily Recurring const --- app/Models/RecurringInvoice.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Models/RecurringInvoice.php b/app/Models/RecurringInvoice.php index 8e50b30a386d..d7266ed8768d 100644 --- a/app/Models/RecurringInvoice.php +++ b/app/Models/RecurringInvoice.php @@ -193,6 +193,8 @@ class RecurringInvoice extends BaseModel } switch ($this->frequency_id) { + case self::FREQUENCY_DAILY: + return Carbon::parse($this->next_send_date)->addDay(); case self::FREQUENCY_WEEKLY: return Carbon::parse($this->next_send_date)->addWeek(); case self::FREQUENCY_TWO_WEEKS: @@ -223,6 +225,8 @@ class RecurringInvoice extends BaseModel public function nextDateByFrequency($date) { switch ($this->frequency_id) { + case self::FREQUENCY_DAILY: + return Carbon::parse($this->next_send_date)->addDay(); case self::FREQUENCY_WEEKLY: return Carbon::parse($date)->addWeek(); case self::FREQUENCY_TWO_WEEKS: From 34e04ce31bcabd8130f5f69e57b6c53e0f1aaf87 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 3 Jan 2021 18:08:08 +1100 Subject: [PATCH 6/6] Fixes for recurring invoice daily recurring --- app/Models/RecurringInvoice.php | 2 +- composer.lock | 66 ++++++++++++++++----------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/app/Models/RecurringInvoice.php b/app/Models/RecurringInvoice.php index d7266ed8768d..8d4dba150577 100644 --- a/app/Models/RecurringInvoice.php +++ b/app/Models/RecurringInvoice.php @@ -226,7 +226,7 @@ class RecurringInvoice extends BaseModel { switch ($this->frequency_id) { case self::FREQUENCY_DAILY: - return Carbon::parse($this->next_send_date)->addDay(); + return Carbon::parse($date)->addDay(); case self::FREQUENCY_WEEKLY: return Carbon::parse($date)->addWeek(); case self::FREQUENCY_TWO_WEEKS: diff --git a/composer.lock b/composer.lock index 6dec6fe654a9..b5d83b70c078 100644 --- a/composer.lock +++ b/composer.lock @@ -116,16 +116,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.171.6", + "version": "3.171.10", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "5587d22e63ef82ef74dffca5d47f307b84137b51" + "reference": "ba12cbba6b7ae8f2aab741e5ac47e8bb30d3eac7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/5587d22e63ef82ef74dffca5d47f307b84137b51", - "reference": "5587d22e63ef82ef74dffca5d47f307b84137b51", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/ba12cbba6b7ae8f2aab741e5ac47e8bb30d3eac7", + "reference": "ba12cbba6b7ae8f2aab741e5ac47e8bb30d3eac7", "shasum": "" }, "require": { @@ -200,22 +200,22 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.171.6" + "source": "https://github.com/aws/aws-sdk-php/tree/3.171.10" }, - "time": "2020-12-23T19:12:28+00:00" + "time": "2020-12-31T19:13:37+00:00" }, { "name": "beganovich/snappdf", - "version": "v1.2.0", + "version": "v1.3.0", "source": { "type": "git", "url": "https://github.com/beganovich/snappdf.git", - "reference": "5f5e9bb17ddc9d9f16df7c20b7af35f04ffcddbd" + "reference": "1afb8d951461375eb334bb54e211b7e5724c9d10" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/beganovich/snappdf/zipball/5f5e9bb17ddc9d9f16df7c20b7af35f04ffcddbd", - "reference": "5f5e9bb17ddc9d9f16df7c20b7af35f04ffcddbd", + "url": "https://api.github.com/repos/beganovich/snappdf/zipball/1afb8d951461375eb334bb54e211b7e5724c9d10", + "reference": "1afb8d951461375eb334bb54e211b7e5724c9d10", "shasum": "" }, "require": { @@ -227,6 +227,7 @@ "symfony/process": "^5.2" }, "require-dev": { + "ext-fileinfo": "*", "friendsofphp/php-cs-fixer": "^2.17", "phpunit/phpunit": "^9.5" }, @@ -252,9 +253,9 @@ "description": "Convert webpages or HTML into the PDF file using Chromium or Google Chrome.", "support": { "issues": "https://github.com/beganovich/snappdf/issues", - "source": "https://github.com/beganovich/snappdf/tree/v1.2.0" + "source": "https://github.com/beganovich/snappdf/tree/v1.3.0" }, - "time": "2020-12-28T11:57:06+00:00" + "time": "2021-01-02T17:56:16+00:00" }, { "name": "brick/math", @@ -1590,16 +1591,16 @@ }, { "name": "egulias/email-validator", - "version": "2.1.24", + "version": "2.1.25", "source": { "type": "git", "url": "https://github.com/egulias/EmailValidator.git", - "reference": "ca90a3291eee1538cd48ff25163240695bd95448" + "reference": "0dbf5d78455d4d6a41d186da50adc1122ec066f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/ca90a3291eee1538cd48ff25163240695bd95448", - "reference": "ca90a3291eee1538cd48ff25163240695bd95448", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/0dbf5d78455d4d6a41d186da50adc1122ec066f4", + "reference": "0dbf5d78455d4d6a41d186da50adc1122ec066f4", "shasum": "" }, "require": { @@ -1646,7 +1647,7 @@ ], "support": { "issues": "https://github.com/egulias/EmailValidator/issues", - "source": "https://github.com/egulias/EmailValidator/tree/2.1.24" + "source": "https://github.com/egulias/EmailValidator/tree/2.1.25" }, "funding": [ { @@ -1654,7 +1655,7 @@ "type": "github" } ], - "time": "2020-11-14T15:56:27+00:00" + "time": "2020-12-29T14:50:06+00:00" }, { "name": "fedeisas/laravel-mail-css-inliner", @@ -10323,16 +10324,16 @@ }, { "name": "facade/ignition", - "version": "2.5.3", + "version": "2.5.8", "source": { "type": "git", "url": "https://github.com/facade/ignition.git", - "reference": "d8dc4f90ed469f9f9313b976fb078c20585d5c99" + "reference": "8e907d81244649c5ea746e2ec30c32c5f59df472" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/facade/ignition/zipball/d8dc4f90ed469f9f9313b976fb078c20585d5c99", - "reference": "d8dc4f90ed469f9f9313b976fb078c20585d5c99", + "url": "https://api.github.com/repos/facade/ignition/zipball/8e907d81244649c5ea746e2ec30c32c5f59df472", + "reference": "8e907d81244649c5ea746e2ec30c32c5f59df472", "shasum": "" }, "require": { @@ -10396,7 +10397,7 @@ "issues": "https://github.com/facade/ignition/issues", "source": "https://github.com/facade/ignition" }, - "time": "2020-12-09T20:25:45+00:00" + "time": "2020-12-29T09:12:55+00:00" }, { "name": "facade/ignition-contracts", @@ -13322,16 +13323,16 @@ }, { "name": "vimeo/psalm", - "version": "4.3.1", + "version": "4.3.2", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "2feba22a005a18bf31d4c7b9bdb9252c73897476" + "reference": "57b53ff26237074fdf5cbcb034f7da5172be4524" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/2feba22a005a18bf31d4c7b9bdb9252c73897476", - "reference": "2feba22a005a18bf31d4c7b9bdb9252c73897476", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/57b53ff26237074fdf5cbcb034f7da5172be4524", + "reference": "57b53ff26237074fdf5cbcb034f7da5172be4524", "shasum": "" }, "require": { @@ -13363,15 +13364,14 @@ "require-dev": { "amphp/amp": "^2.4.2", "bamarni/composer-bin-plugin": "^1.2", - "brianium/paratest": "^4.0.0", + "brianium/paratest": "^4.0||^6.0", "ext-curl": "*", - "php": "^7.3|^8", "phpdocumentor/reflection-docblock": "^5", - "phpmyadmin/sql-parser": "5.1.0", + "phpmyadmin/sql-parser": "5.1.0||dev-master", "phpspec/prophecy": ">=1.9.0", "phpunit/phpunit": "^9.0", "psalm/plugin-phpunit": "^0.13", - "slevomat/coding-standard": "^5.0", + "slevomat/coding-standard": "^6.3.11", "squizlabs/php_codesniffer": "^3.5", "symfony/process": "^4.3", "weirdan/prophecy-shim": "^1.0 || ^2.0" @@ -13421,9 +13421,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/4.3.1" + "source": "https://github.com/vimeo/psalm/tree/4.3.2" }, - "time": "2020-12-03T16:44:10+00:00" + "time": "2020-12-29T17:37:09+00:00" }, { "name": "webmozart/path-util",