Merge pull request #5398 from turbo124/v5-develop

v5.1.43
This commit is contained in:
David Bomba 2021-04-10 08:43:28 +10:00 committed by GitHub
commit f3062d4242
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 69 additions and 134 deletions

View File

@ -1 +1 @@
5.1.42 5.1.43

View File

@ -595,14 +595,14 @@ class CompanySettings extends BaseSettings
$variables = [ $variables = [
'client_details' => [ 'client_details' => [
'$client.name', '$client.name',
'$client.id_number', '$client.number',
'$client.vat_number', '$client.vat_number',
'$client.address1', '$client.address1',
'$client.address2', '$client.address2',
'$client.city_state_postal', '$client.city_state_postal',
'$client.country', '$client.country',
'$contact.email',
'$client.phone', '$client.phone',
'$contact.email',
], ],
'company_details' => [ 'company_details' => [
'$company.name', '$company.name',
@ -668,7 +668,7 @@ class CompanySettings extends BaseSettings
'$total_taxes', '$total_taxes',
'$line_taxes', '$line_taxes',
'$paid_to_date', '$paid_to_date',
'$outstanding', '$total',
], ],
]; ];

View File

@ -12,8 +12,6 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Utils\Ninja; use App\Utils\Ninja;
use Cz\Git\GitException;
use Cz\Git\GitRepository;
use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Support\Facades\Artisan; 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')); define('STDIN', fopen('php://stdin', 'r'));
if (Ninja::isNinja()) { if (Ninja::isNinja()) {
return response()->json(['message' => ctrans('texts.self_update_not_available')], 403); 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 // Check if new version is available
if($updater->source()->isNewVersionAvailable()) { if($updater->source()->isNewVersionAvailable()) {
// Get the current installed version
echo $updater->source()->getVersionInstalled();
// Get the new version available // Get the new version available
$versionAvailable = $updater->source()->getVersionAvailable(); $versionAvailable = $updater->source()->getVersionAvailable();
// Create a release // Create a release
$release = $updater->source()->fetch($versionAvailable); $release = $updater->source()->fetch($versionAvailable);
// Run the update process
$updater->source()->update($release); $updater->source()->update($release);
} }
// try {
// $cacheCompiled = base_path('bootstrap/cache/compiled.php'); $cacheCompiled = base_path('bootstrap/cache/compiled.php');
// if (file_exists($cacheCompiled)) { unlink ($cacheCompiled); } if (file_exists($cacheCompiled)) { unlink ($cacheCompiled); }
// $cacheServices = base_path('bootstrap/cache/services.php'); $cacheServices = base_path('bootstrap/cache/services.php');
// if (file_exists($cacheServices)) { unlink ($cacheServices); } if (file_exists($cacheServices)) { unlink ($cacheServices); }
// Artisan::call('clear-compiled'); Artisan::call('clear-compiled');
// Artisan::call('cache:clear'); Artisan::call('cache:clear');
// Artisan::call('debugbar:clear'); Artisan::call('debugbar:clear');
// Artisan::call('route:clear'); Artisan::call('route:clear');
// Artisan::call('view:clear'); Artisan::call('view:clear');
// Artisan::call('config:clear'); Artisan::call('config:clear');
// // $output = $repo->execute('stash'); return response()->json(['message' => 'Update completed'], 200);
// // $output = $repo->execute('reset --hard origin/v5-stable');
// $output = $repo->execute('pull origin');
// } 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() public function checkVersion()

View File

@ -14,6 +14,7 @@ namespace App\Models;
use App\Models\Presenters\AccountPresenter; use App\Models\Presenters\AccountPresenter;
use App\Utils\Ninja; use App\Utils\Ninja;
use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesHash;
use Carbon\Carbon;
use DateTime; use DateTime;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Laracasts\Presenter\PresentableTrait; use Laracasts\Presenter\PresentableTrait;
@ -257,8 +258,8 @@ class Account extends BaseModel
$plan_active = true; $plan_active = true;
$plan_expires = false; $plan_expires = false;
} else { } else {
$plan_expires = DateTime::createFromFormat('Y-m-d', $this->plan_expires); $plan_expires = Carbon::parse($this->plan_expires);
if ($plan_expires >= date_create()) { if ($plan_expires->greaterThan(now())) {
$plan_active = true; $plan_active = true;
} }
} }

View File

@ -114,6 +114,7 @@ class PaymentRepository extends BaseRepository {
/*Iterate through invoices and apply payments*/ /*Iterate through invoices and apply payments*/
if (array_key_exists('invoices', $data) && is_array($data['invoices']) && count($data['invoices']) > 0) { if (array_key_exists('invoices', $data) && is_array($data['invoices']) && count($data['invoices']) > 0) {
$invoice_totals = array_sum(array_column($data['invoices'], 'amount')); $invoice_totals = array_sum(array_column($data['invoices'], 'amount'));
$invoices = Invoice::whereIn('id', array_column($data['invoices'], 'invoice_id'))->get(); $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(); $invoice = Invoice::whereId($paid_invoice['invoice_id'])->first();
if ($invoice) { if ($invoice) {
$invoice = $invoice->service()->markSent()->applyPayment($payment, $paid_invoice['amount'])->save(); $invoice = $invoice->service()
->markSent()
->applyPayment($payment, $paid_invoice['amount'])
->save();
} }
} }
} else { } else {

View File

@ -101,6 +101,8 @@ class InvoiceService
*/ */
public function applyPayment(Payment $payment, float $payment_amount) public function applyPayment(Payment $payment, float $payment_amount)
{ {
$this->deletePdf();
$this->invoice = (new ApplyPayment($this->invoice, $payment, $payment_amount))->run(); $this->invoice = (new ApplyPayment($this->invoice, $payment, $payment_amount))->run();
return $this; return $this;
@ -295,6 +297,7 @@ class InvoiceService
public function deletePdf() public function deletePdf()
{ {
nlog("delete PDF");
//UnlinkFile::dispatchNow(config('filesystems.default'), $this->invoice->client->invoice_filepath() . $this->invoice->numberFormatter().'.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'); Storage::disk(config('filesystems.default'))->delete($this->invoice->client->invoice_filepath() . $this->invoice->numberFormatter().'.pdf');

View File

@ -38,7 +38,6 @@
"coconutcraig/laravel-postmark": "^2.10", "coconutcraig/laravel-postmark": "^2.10",
"codedge/laravel-selfupdater": "^3.2", "codedge/laravel-selfupdater": "^3.2",
"composer/composer": "^2", "composer/composer": "^2",
"czproject/git-php": "^3.17",
"doctrine/dbal": "^2.10", "doctrine/dbal": "^2.10",
"fakerphp/faker": "^1.14", "fakerphp/faker": "^1.14",
"fideloper/proxy": "^4.2", "fideloper/proxy": "^4.2",

110
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "c7966839cf1cb74e25348aff4acadb1c", "content-hash": "56b8467dfddd19762a9124d0624a5003",
"packages": [ "packages": [
{ {
"name": "authorizenet/authorizenet", "name": "authorizenet/authorizenet",
@ -51,16 +51,16 @@
}, },
{ {
"name": "aws/aws-sdk-php", "name": "aws/aws-sdk-php",
"version": "3.176.9", "version": "3.178.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/aws/aws-sdk-php.git", "url": "https://github.com/aws/aws-sdk-php.git",
"reference": "17dc67514b148979994758fbfb54088a8a3393bf" "reference": "214e3d98c54277cd8965f1cf307dce39631407bf"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/17dc67514b148979994758fbfb54088a8a3393bf", "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/214e3d98c54277cd8965f1cf307dce39631407bf",
"reference": "17dc67514b148979994758fbfb54088a8a3393bf", "reference": "214e3d98c54277cd8965f1cf307dce39631407bf",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -135,9 +135,9 @@
"support": { "support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues", "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", "name": "bacon/bacon-qr-code",
@ -565,31 +565,31 @@
}, },
{ {
"name": "codedge/laravel-selfupdater", "name": "codedge/laravel-selfupdater",
"version": "3.2.2", "version": "3.2.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/codedge/laravel-selfupdater.git", "url": "https://github.com/codedge/laravel-selfupdater.git",
"reference": "ade06363a1a8175adcf070f392f1fd25eef5c214" "reference": "60bca20f30d36259ef5eff65bc84d0dcb61267f7"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/codedge/laravel-selfupdater/zipball/ade06363a1a8175adcf070f392f1fd25eef5c214", "url": "https://api.github.com/repos/codedge/laravel-selfupdater/zipball/60bca20f30d36259ef5eff65bc84d0dcb61267f7",
"reference": "ade06363a1a8175adcf070f392f1fd25eef5c214", "reference": "60bca20f30d36259ef5eff65bc84d0dcb61267f7",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-json": "*", "ext-json": "*",
"ext-zip": "*", "ext-zip": "*",
"guzzlehttp/guzzle": "6.* || 7.*", "guzzlehttp/guzzle": "6.* || 7.*",
"laravel/framework": "^8.33.1", "laravel/framework": "^8.36.2",
"php": "^7.3 || ^7.4 || ^8.0" "php": "^7.3 || ^7.4 || ^8.0"
}, },
"require-dev": { "require-dev": {
"dg/bypass-finals": "^1.3", "dg/bypass-finals": "^1.3",
"mikey179/vfsstream": "^1.6", "mikey179/vfsstream": "^1.6",
"mockery/mockery": "^1.4", "mockery/mockery": "^1.4",
"orchestra/testbench": "^6.14.0", "orchestra/testbench": "^6.17.0",
"phpunit/phpunit": "^9.5.3" "phpunit/phpunit": "^9.5.4"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
@ -643,7 +643,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2021-03-20T09:31:26+00:00" "time": "2021-04-09T08:47:03+00:00"
}, },
{ {
"name": "composer/ca-bundle", "name": "composer/ca-bundle",
@ -1042,52 +1042,6 @@
], ],
"time": "2021-03-25T17:01:18+00:00" "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", "name": "dasprid/enum",
"version": "1.0.3", "version": "1.0.3",
@ -2841,16 +2795,16 @@
}, },
{ {
"name": "laravel/framework", "name": "laravel/framework",
"version": "v8.36.1", "version": "v8.36.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/framework.git", "url": "https://github.com/laravel/framework.git",
"reference": "91c454715b81b9a39f718651d4e2f8104d45e7c2" "reference": "0debd8ad6b5aa1f61ccc73910adf049af4ca0444"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/91c454715b81b9a39f718651d4e2f8104d45e7c2", "url": "https://api.github.com/repos/laravel/framework/zipball/0debd8ad6b5aa1f61ccc73910adf049af4ca0444",
"reference": "91c454715b81b9a39f718651d4e2f8104d45e7c2", "reference": "0debd8ad6b5aa1f61ccc73910adf049af4ca0444",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3005,7 +2959,7 @@
"issues": "https://github.com/laravel/framework/issues", "issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework" "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", "name": "laravel/slack-notification-channel",
@ -10910,16 +10864,16 @@
}, },
{ {
"name": "facade/flare-client-php", "name": "facade/flare-client-php",
"version": "1.5.0", "version": "1.6.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/facade/flare-client-php.git", "url": "https://github.com/facade/flare-client-php.git",
"reference": "9dd6f2b56486d939c4467b3f35475d44af57cf17" "reference": "f2b0969f2d9594704be74dbeb25b201570a98098"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/facade/flare-client-php/zipball/9dd6f2b56486d939c4467b3f35475d44af57cf17", "url": "https://api.github.com/repos/facade/flare-client-php/zipball/f2b0969f2d9594704be74dbeb25b201570a98098",
"reference": "9dd6f2b56486d939c4467b3f35475d44af57cf17", "reference": "f2b0969f2d9594704be74dbeb25b201570a98098",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -10963,7 +10917,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/facade/flare-client-php/issues", "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": [ "funding": [
{ {
@ -10971,26 +10925,26 @@
"type": "github" "type": "github"
} }
], ],
"time": "2021-03-31T07:32:54+00:00" "time": "2021-04-08T08:50:01+00:00"
}, },
{ {
"name": "facade/ignition", "name": "facade/ignition",
"version": "2.7.0", "version": "2.8.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/facade/ignition.git", "url": "https://github.com/facade/ignition.git",
"reference": "bdc8b0b32c888f6edc838ca641358322b3d9506d" "reference": "cb7f790e6306caeb4a9ffe21e59942b7128cc630"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/facade/ignition/zipball/bdc8b0b32c888f6edc838ca641358322b3d9506d", "url": "https://api.github.com/repos/facade/ignition/zipball/cb7f790e6306caeb4a9ffe21e59942b7128cc630",
"reference": "bdc8b0b32c888f6edc838ca641358322b3d9506d", "reference": "cb7f790e6306caeb4a9ffe21e59942b7128cc630",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-json": "*", "ext-json": "*",
"ext-mbstring": "*", "ext-mbstring": "*",
"facade/flare-client-php": "^1.3.7", "facade/flare-client-php": "^1.6",
"facade/ignition-contracts": "^1.0.2", "facade/ignition-contracts": "^1.0.2",
"filp/whoops": "^2.4", "filp/whoops": "^2.4",
"illuminate/support": "^7.0|^8.0", "illuminate/support": "^7.0|^8.0",
@ -11048,7 +11002,7 @@
"issues": "https://github.com/facade/ignition/issues", "issues": "https://github.com/facade/ignition/issues",
"source": "https://github.com/facade/ignition" "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", "name": "facade/ignition-contracts",

View File

@ -14,8 +14,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true), 'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', ''), 'app_domain' => env('APP_DOMAIN', ''),
'app_version' => '5.1.42', 'app_version' => '5.1.43',
'app_tag' => 'v5.1.42', 'app_tag' => '5.1.43-release',
'minimum_client_version' => '5.0.16', 'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1', 'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', false), 'api_secret' => env('API_SECRET', false),

View File

@ -44,7 +44,7 @@ return [
'repository_url' => 'https://github.com/', 'repository_url' => 'https://github.com/',
'download_path' => env('SELF_UPDATER_DOWNLOAD_PATH', '/tmp'), 'download_path' => env('SELF_UPDATER_DOWNLOAD_PATH', '/tmp'),
'private_access_token' => env('SELF_UPDATER_GITHUB_PRIVATE_ACCESS_TOKEN', ''), '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' => [ 'http' => [
'type' => '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' => [ 'post_update' => [
'class' => \App\Console\Commands\PostUpdate::class 'postupdate:cleanup' => [
'class' => \App\Console\Commands\PostUpdate::class,
], ],
]
], ],
]; ];

View File

@ -5,6 +5,7 @@ use Illuminate\Support\Facades\Route;
//Auth::routes(['password.reset' => false]); //Auth::routes(['password.reset' => false]);
Route::get('/', 'BaseController@flutterRoute')->middleware('guest'); Route::get('/', 'BaseController@flutterRoute')->middleware('guest');
// Route::get('self-update', 'SelfUpdateController@update')->middleware('guest');
Route::get('setup', 'SetupController@index')->middleware('guest'); Route::get('setup', 'SetupController@index')->middleware('guest');
Route::post('setup', 'SetupController@doSetup')->middleware('guest'); Route::post('setup', 'SetupController@doSetup')->middleware('guest');