diff --git a/VERSION.txt b/VERSION.txt index f66977e2e453..0b8b1f018787 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.1.42 \ No newline at end of file +5.1.43 \ No newline at end of file diff --git a/app/DataMapper/CompanySettings.php b/app/DataMapper/CompanySettings.php index 0bda4f8ed96e..097bfe453e38 100644 --- a/app/DataMapper/CompanySettings.php +++ b/app/DataMapper/CompanySettings.php @@ -595,14 +595,14 @@ class CompanySettings extends BaseSettings $variables = [ 'client_details' => [ '$client.name', - '$client.id_number', + '$client.number', '$client.vat_number', '$client.address1', '$client.address2', '$client.city_state_postal', '$client.country', - '$contact.email', '$client.phone', + '$contact.email', ], 'company_details' => [ '$company.name', @@ -668,7 +668,7 @@ class CompanySettings extends BaseSettings '$total_taxes', '$line_taxes', '$paid_to_date', - '$outstanding', + '$total', ], ]; diff --git a/app/Http/Controllers/SelfUpdateController.php b/app/Http/Controllers/SelfUpdateController.php index 0acedf0791bd..7c666fad7d54 100644 --- a/app/Http/Controllers/SelfUpdateController.php +++ b/app/Http/Controllers/SelfUpdateController.php @@ -12,8 +12,6 @@ namespace App\Http\Controllers; use App\Utils\Ninja; -use Cz\Git\GitException; -use Cz\Git\GitRepository; use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Support\Facades\Artisan; @@ -54,69 +52,42 @@ class SelfUpdateController extends BaseController * ), * ) */ - public function update() + public function update(\Codedge\Updater\UpdaterManager $updater) { + set_time_limit(0); define('STDIN', fopen('php://stdin', 'r')); if (Ninja::isNinja()) { return response()->json(['message' => ctrans('texts.self_update_not_available')], 403); } - /* .git MUST be owned/writable by the webserver user */ - $repo = new GitRepository(base_path()); - - nlog('Are there changes to pull? '.$repo->hasChanges()); - $output = ''; - - - $updater = new \Codedge\Updater\UpdaterManager() - // Check if new version is available if($updater->source()->isNewVersionAvailable()) { - // Get the current installed version - echo $updater->source()->getVersionInstalled(); - // Get the new version available $versionAvailable = $updater->source()->getVersionAvailable(); // Create a release $release = $updater->source()->fetch($versionAvailable); - // Run the update process $updater->source()->update($release); + } - - // try { - // $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); } + $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('cache:clear'); - // Artisan::call('debugbar:clear'); - // Artisan::call('route:clear'); - // Artisan::call('view:clear'); - // Artisan::call('config:clear'); + Artisan::call('clear-compiled'); + Artisan::call('cache:clear'); + Artisan::call('debugbar:clear'); + Artisan::call('route:clear'); + Artisan::call('view:clear'); + Artisan::call('config:clear'); - // // $output = $repo->execute('stash'); - // // $output = $repo->execute('reset --hard origin/v5-stable'); - // $output = $repo->execute('pull origin'); + return response()->json(['message' => 'Update completed'], 200); - // } catch (GitException $e) { - - // nlog($output); - // nlog($e->getMessage()); - // return response()->json(['message'=>$e->getMessage()], 500); - // } - - // dispatch(function () { - // Artisan::call('ninja:post-update'); - // }); - - return response()->json(['message' => $output], 200); } public function checkVersion() diff --git a/app/Models/Account.php b/app/Models/Account.php index ed0a7484f26b..79ec7439a69b 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -14,6 +14,7 @@ namespace App\Models; use App\Models\Presenters\AccountPresenter; use App\Utils\Ninja; use App\Utils\Traits\MakesHash; +use Carbon\Carbon; use DateTime; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Laracasts\Presenter\PresentableTrait; @@ -257,8 +258,8 @@ class Account extends BaseModel $plan_active = true; $plan_expires = false; } else { - $plan_expires = DateTime::createFromFormat('Y-m-d', $this->plan_expires); - if ($plan_expires >= date_create()) { + $plan_expires = Carbon::parse($this->plan_expires); + if ($plan_expires->greaterThan(now())) { $plan_active = true; } } diff --git a/app/Repositories/PaymentRepository.php b/app/Repositories/PaymentRepository.php index 95e3c4ba4c91..b94161609fcc 100644 --- a/app/Repositories/PaymentRepository.php +++ b/app/Repositories/PaymentRepository.php @@ -114,6 +114,7 @@ class PaymentRepository extends BaseRepository { /*Iterate through invoices and apply payments*/ if (array_key_exists('invoices', $data) && is_array($data['invoices']) && count($data['invoices']) > 0) { + $invoice_totals = array_sum(array_column($data['invoices'], 'amount')); $invoices = Invoice::whereIn('id', array_column($data['invoices'], 'invoice_id'))->get(); @@ -125,7 +126,10 @@ class PaymentRepository extends BaseRepository { $invoice = Invoice::whereId($paid_invoice['invoice_id'])->first(); if ($invoice) { - $invoice = $invoice->service()->markSent()->applyPayment($payment, $paid_invoice['amount'])->save(); + $invoice = $invoice->service() + ->markSent() + ->applyPayment($payment, $paid_invoice['amount']) + ->save(); } } } else { diff --git a/app/Services/Invoice/InvoiceService.php b/app/Services/Invoice/InvoiceService.php index 6f056e7e900f..86296b632a15 100644 --- a/app/Services/Invoice/InvoiceService.php +++ b/app/Services/Invoice/InvoiceService.php @@ -101,6 +101,8 @@ class InvoiceService */ public function applyPayment(Payment $payment, float $payment_amount) { + $this->deletePdf(); + $this->invoice = (new ApplyPayment($this->invoice, $payment, $payment_amount))->run(); return $this; @@ -295,6 +297,7 @@ class InvoiceService public function deletePdf() { + nlog("delete PDF"); //UnlinkFile::dispatchNow(config('filesystems.default'), $this->invoice->client->invoice_filepath() . $this->invoice->numberFormatter().'.pdf'); Storage::disk(config('filesystems.default'))->delete($this->invoice->client->invoice_filepath() . $this->invoice->numberFormatter().'.pdf'); diff --git a/composer.json b/composer.json index 07e68ad2ac1c..9b29fe5258b5 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,6 @@ "coconutcraig/laravel-postmark": "^2.10", "codedge/laravel-selfupdater": "^3.2", "composer/composer": "^2", - "czproject/git-php": "^3.17", "doctrine/dbal": "^2.10", "fakerphp/faker": "^1.14", "fideloper/proxy": "^4.2", diff --git a/composer.lock b/composer.lock index 5b49aaf3fc86..e426f659b282 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c7966839cf1cb74e25348aff4acadb1c", + "content-hash": "56b8467dfddd19762a9124d0624a5003", "packages": [ { "name": "authorizenet/authorizenet", @@ -51,16 +51,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.176.9", + "version": "3.178.0", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "17dc67514b148979994758fbfb54088a8a3393bf" + "reference": "214e3d98c54277cd8965f1cf307dce39631407bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/17dc67514b148979994758fbfb54088a8a3393bf", - "reference": "17dc67514b148979994758fbfb54088a8a3393bf", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/214e3d98c54277cd8965f1cf307dce39631407bf", + "reference": "214e3d98c54277cd8965f1cf307dce39631407bf", "shasum": "" }, "require": { @@ -135,9 +135,9 @@ "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.176.9" + "source": "https://github.com/aws/aws-sdk-php/tree/3.178.0" }, - "time": "2021-04-06T18:13:47+00:00" + "time": "2021-04-08T18:13:16+00:00" }, { "name": "bacon/bacon-qr-code", @@ -565,31 +565,31 @@ }, { "name": "codedge/laravel-selfupdater", - "version": "3.2.2", + "version": "3.2.3", "source": { "type": "git", "url": "https://github.com/codedge/laravel-selfupdater.git", - "reference": "ade06363a1a8175adcf070f392f1fd25eef5c214" + "reference": "60bca20f30d36259ef5eff65bc84d0dcb61267f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/codedge/laravel-selfupdater/zipball/ade06363a1a8175adcf070f392f1fd25eef5c214", - "reference": "ade06363a1a8175adcf070f392f1fd25eef5c214", + "url": "https://api.github.com/repos/codedge/laravel-selfupdater/zipball/60bca20f30d36259ef5eff65bc84d0dcb61267f7", + "reference": "60bca20f30d36259ef5eff65bc84d0dcb61267f7", "shasum": "" }, "require": { "ext-json": "*", "ext-zip": "*", "guzzlehttp/guzzle": "6.* || 7.*", - "laravel/framework": "^8.33.1", + "laravel/framework": "^8.36.2", "php": "^7.3 || ^7.4 || ^8.0" }, "require-dev": { "dg/bypass-finals": "^1.3", "mikey179/vfsstream": "^1.6", "mockery/mockery": "^1.4", - "orchestra/testbench": "^6.14.0", - "phpunit/phpunit": "^9.5.3" + "orchestra/testbench": "^6.17.0", + "phpunit/phpunit": "^9.5.4" }, "type": "library", "extra": { @@ -643,7 +643,7 @@ "type": "github" } ], - "time": "2021-03-20T09:31:26+00:00" + "time": "2021-04-09T08:47:03+00:00" }, { "name": "composer/ca-bundle", @@ -1042,52 +1042,6 @@ ], "time": "2021-03-25T17:01:18+00:00" }, - { - "name": "czproject/git-php", - "version": "v3.18.2", - "source": { - "type": "git", - "url": "https://github.com/czproject/git-php.git", - "reference": "cb3bfc6f1e487e572870afae5d52ef3c7d250d8a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/czproject/git-php/zipball/cb3bfc6f1e487e572870afae5d52ef3c7d250d8a", - "reference": "cb3bfc6f1e487e572870afae5d52ef3c7d250d8a", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "require-dev": { - "nette/tester": "^1.1" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jan Pecha", - "email": "janpecha@email.cz" - } - ], - "description": "Library for work with Git repository in PHP.", - "keywords": [ - "git" - ], - "support": { - "issues": "https://github.com/czproject/git-php/issues", - "source": "https://github.com/czproject/git-php/tree/v3.18.2" - }, - "time": "2021-02-15T11:41:33+00:00" - }, { "name": "dasprid/enum", "version": "1.0.3", @@ -2841,16 +2795,16 @@ }, { "name": "laravel/framework", - "version": "v8.36.1", + "version": "v8.36.2", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "91c454715b81b9a39f718651d4e2f8104d45e7c2" + "reference": "0debd8ad6b5aa1f61ccc73910adf049af4ca0444" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/91c454715b81b9a39f718651d4e2f8104d45e7c2", - "reference": "91c454715b81b9a39f718651d4e2f8104d45e7c2", + "url": "https://api.github.com/repos/laravel/framework/zipball/0debd8ad6b5aa1f61ccc73910adf049af4ca0444", + "reference": "0debd8ad6b5aa1f61ccc73910adf049af4ca0444", "shasum": "" }, "require": { @@ -3005,7 +2959,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2021-04-06T21:14:06+00:00" + "time": "2021-04-07T12:37:22+00:00" }, { "name": "laravel/slack-notification-channel", @@ -10910,16 +10864,16 @@ }, { "name": "facade/flare-client-php", - "version": "1.5.0", + "version": "1.6.1", "source": { "type": "git", "url": "https://github.com/facade/flare-client-php.git", - "reference": "9dd6f2b56486d939c4467b3f35475d44af57cf17" + "reference": "f2b0969f2d9594704be74dbeb25b201570a98098" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/facade/flare-client-php/zipball/9dd6f2b56486d939c4467b3f35475d44af57cf17", - "reference": "9dd6f2b56486d939c4467b3f35475d44af57cf17", + "url": "https://api.github.com/repos/facade/flare-client-php/zipball/f2b0969f2d9594704be74dbeb25b201570a98098", + "reference": "f2b0969f2d9594704be74dbeb25b201570a98098", "shasum": "" }, "require": { @@ -10963,7 +10917,7 @@ ], "support": { "issues": "https://github.com/facade/flare-client-php/issues", - "source": "https://github.com/facade/flare-client-php/tree/1.5.0" + "source": "https://github.com/facade/flare-client-php/tree/1.6.1" }, "funding": [ { @@ -10971,26 +10925,26 @@ "type": "github" } ], - "time": "2021-03-31T07:32:54+00:00" + "time": "2021-04-08T08:50:01+00:00" }, { "name": "facade/ignition", - "version": "2.7.0", + "version": "2.8.2", "source": { "type": "git", "url": "https://github.com/facade/ignition.git", - "reference": "bdc8b0b32c888f6edc838ca641358322b3d9506d" + "reference": "cb7f790e6306caeb4a9ffe21e59942b7128cc630" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/facade/ignition/zipball/bdc8b0b32c888f6edc838ca641358322b3d9506d", - "reference": "bdc8b0b32c888f6edc838ca641358322b3d9506d", + "url": "https://api.github.com/repos/facade/ignition/zipball/cb7f790e6306caeb4a9ffe21e59942b7128cc630", + "reference": "cb7f790e6306caeb4a9ffe21e59942b7128cc630", "shasum": "" }, "require": { "ext-json": "*", "ext-mbstring": "*", - "facade/flare-client-php": "^1.3.7", + "facade/flare-client-php": "^1.6", "facade/ignition-contracts": "^1.0.2", "filp/whoops": "^2.4", "illuminate/support": "^7.0|^8.0", @@ -11048,7 +11002,7 @@ "issues": "https://github.com/facade/ignition/issues", "source": "https://github.com/facade/ignition" }, - "time": "2021-03-30T15:55:38+00:00" + "time": "2021-04-08T10:42:53+00:00" }, { "name": "facade/ignition-contracts", diff --git a/config/ninja.php b/config/ninja.php index c5c54a5a6b25..81376365d85b 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -14,8 +14,8 @@ return [ 'require_https' => env('REQUIRE_HTTPS', true), 'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_domain' => env('APP_DOMAIN', ''), - 'app_version' => '5.1.42', - 'app_tag' => 'v5.1.42', + 'app_version' => '5.1.43', + 'app_tag' => '5.1.43-release', 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', false), diff --git a/config/self-update.php b/config/self-update.php index 844282b6f597..7a61c05a4238 100644 --- a/config/self-update.php +++ b/config/self-update.php @@ -44,7 +44,7 @@ return [ 'repository_url' => 'https://github.com/', 'download_path' => env('SELF_UPDATER_DOWNLOAD_PATH', '/tmp'), 'private_access_token' => env('SELF_UPDATER_GITHUB_PRIVATE_ACCESS_TOKEN', ''), - 'use_branch' => env('SELF_UPDATER_USE_BRANCH', 'v5-stable'), + 'use_branch' => env('SELF_UPDATER_USE_BRANCH', ''), ], 'http' => [ 'type' => 'http', @@ -89,7 +89,7 @@ return [ | */ - 'log_events' => env('SELF_UPDATER_LOG_EVENTS', false), + 'log_events' => env('SELF_UPDATER_LOG_EVENTS', true), /* |-------------------------------------------------------------------------- @@ -140,8 +140,10 @@ return [ //] ], 'post_update' => [ - 'class' => \App\Console\Commands\PostUpdate::class + 'postupdate:cleanup' => [ + 'class' => \App\Console\Commands\PostUpdate::class, ], + ] ], ]; diff --git a/routes/web.php b/routes/web.php index 914077b0b8c2..119d7cd21921 100644 --- a/routes/web.php +++ b/routes/web.php @@ -5,6 +5,7 @@ use Illuminate\Support\Facades\Route; //Auth::routes(['password.reset' => false]); Route::get('/', 'BaseController@flutterRoute')->middleware('guest'); + // Route::get('self-update', 'SelfUpdateController@update')->middleware('guest'); Route::get('setup', 'SetupController@index')->middleware('guest'); Route::post('setup', 'SetupController@doSetup')->middleware('guest');