diff --git a/VERSION.txt b/VERSION.txt index 12e20d8de1dc..9baf8dbc7227 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.3.83 \ No newline at end of file +5.3.84 \ No newline at end of file diff --git a/app/DataMapper/CompanySettings.php b/app/DataMapper/CompanySettings.php index ec223897bdd0..ac89c714a27e 100644 --- a/app/DataMapper/CompanySettings.php +++ b/app/DataMapper/CompanySettings.php @@ -271,8 +271,10 @@ class CompanySettings extends BaseSettings public $use_credits_payment = 'off'; //always, option, off //@implemented public $hide_empty_columns_on_pdf = false; public $email_from_name = ''; + public $auto_archive_invoice_cancelled = false; public static $casts = [ + 'auto_archive_invoice_cancelled' => 'bool', 'email_from_name' => 'string', 'show_all_tasks_client_portal' => 'string', 'entity_send_time' => 'int', diff --git a/app/Http/Controllers/ClientController.php b/app/Http/Controllers/ClientController.php index ce6ed40da855..0026090298bb 100644 --- a/app/Http/Controllers/ClientController.php +++ b/app/Http/Controllers/ClientController.php @@ -107,6 +107,8 @@ class ClientController extends BaseController */ public function index(ClientFilters $filters) { + set_time_limit(45); + $clients = Client::filter($filters); return $this->listResponse($clients); diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 51ad55d86ab7..8694695d7fde 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -119,6 +119,8 @@ class InvoiceController extends BaseController */ public function index(InvoiceFilters $filters) { + set_time_limit(45); + $invoices = Invoice::filter($filters); return $this->listResponse($invoices); diff --git a/app/Http/Controllers/SelfUpdateController.php b/app/Http/Controllers/SelfUpdateController.php index a0ba4e1860b4..713fc78d09f5 100644 --- a/app/Http/Controllers/SelfUpdateController.php +++ b/app/Http/Controllers/SelfUpdateController.php @@ -111,6 +111,7 @@ class SelfUpdateController extends BaseController } $this->testWritable(); + $this->clearCacheDir(); copy($this->getDownloadUrl(), storage_path('app/invoiceninja.zip')); @@ -158,6 +159,19 @@ class SelfUpdateController extends BaseController } } + private function clearCacheDir() + { + + $directoryIterator = new \RecursiveDirectoryIterator(base_path('bootstrap/cache'), \RecursiveDirectoryIterator::SKIP_DOTS); + + foreach (new \RecursiveIteratorIterator($directoryIterator) as $file) { + + unlink(base_path('bootstrap/cache/').$file->getFileName()); + + } + + } + private function testWritable() { $directoryIterator = new \RecursiveDirectoryIterator(base_path(), \RecursiveDirectoryIterator::SKIP_DOTS); diff --git a/app/Import/Providers/BaseImport.php b/app/Import/Providers/BaseImport.php index 4f11b0fbb503..1ccc17f1e80e 100644 --- a/app/Import/Providers/BaseImport.php +++ b/app/Import/Providers/BaseImport.php @@ -569,8 +569,6 @@ class BaseImport 'company' => $this->company, ]; -nlog($this->company->company_users); - $nmo = new NinjaMailerObject; $nmo->mailable = new ImportCompleted($this->company, $data); $nmo->company = $this->company; diff --git a/app/Mail/SupportMessageSent.php b/app/Mail/SupportMessageSent.php index 57fdfe67a78e..3c07eead3f77 100644 --- a/app/Mail/SupportMessageSent.php +++ b/app/Mail/SupportMessageSent.php @@ -30,7 +30,8 @@ class SupportMessageSent extends Mailable */ public function build() { - $system_info = null; + $system_info = request()->has('version') ? 'Version: '.request()->input('version') : 'Version: No Version Supplied.'; + $log_lines = []; /* diff --git a/app/Models/Gateway.php b/app/Models/Gateway.php index 5f214de0ce4b..706e5b7045fd 100644 --- a/app/Models/Gateway.php +++ b/app/Models/Gateway.php @@ -159,7 +159,7 @@ class Gateway extends StaticModel break; case 52: return [ - GatewayType::BANK_TRANSFER => ['refund' => true, 'token_billing' => true, 'webhooks' => [' ']], // GoCardless + GatewayType::BANK_TRANSFER => ['refund' => false, 'token_billing' => true, 'webhooks' => [' ']], // GoCardless GatewayType::DIRECT_DEBIT => ['refund' => false, 'token_billing' => true, 'webhooks' => [' ']], GatewayType::SEPA => ['refund' => false, 'token_billing' => true, 'webhooks' => [' ']], GatewayType::INSTANT_BANK_PAY => ['refund' => false, 'token_billing' => true, 'webhooks' => [' ']], diff --git a/app/Repositories/PaymentRepository.php b/app/Repositories/PaymentRepository.php index 651737fd8393..51cd2e09a4f3 100644 --- a/app/Repositories/PaymentRepository.php +++ b/app/Repositories/PaymentRepository.php @@ -186,7 +186,7 @@ class PaymentRepository extends BaseRepository { TransactionLog::dispatch(TransactionEvent::PAYMENT_MADE, $transaction, $payment->company->db); - return $payment->fresh(); + return $payment->refresh(); } /** diff --git a/app/Services/Invoice/HandleCancellation.php b/app/Services/Invoice/HandleCancellation.php index fb93aca67ac7..9f2a450634a4 100644 --- a/app/Services/Invoice/HandleCancellation.php +++ b/app/Services/Invoice/HandleCancellation.php @@ -52,6 +52,8 @@ class HandleCancellation extends AbstractService //adjust client balance $this->invoice->client->service()->updateBalance($adjustment)->save(); + $this->invoice->service()->workFlow()->save(); + event(new InvoiceWasCancelled($this->invoice, $this->invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null))); $transaction = [ diff --git a/app/Services/Invoice/InvoiceService.php b/app/Services/Invoice/InvoiceService.php index e91ae43aa5b5..622387322253 100644 --- a/app/Services/Invoice/InvoiceService.php +++ b/app/Services/Invoice/InvoiceService.php @@ -546,6 +546,19 @@ class InvoiceService event(new InvoiceWasArchived($this->invoice, $this->invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null))); + } + + if ($this->invoice->status_id == Invoice::STATUS_CANCELLED && $this->invoice->client->getSetting('auto_archive_invoice_cancelled')) { + /* Throws: Payment amount xxx does not match invoice totals. */ + + if ($this->invoice->trashed()) + return $this; + + $this->invoice->delete(); + + event(new InvoiceWasArchived($this->invoice, $this->invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null))); + + } return $this; diff --git a/app/Utils/Ninja.php b/app/Utils/Ninja.php index 95435412a9dd..af8c20bcb242 100644 --- a/app/Utils/Ninja.php +++ b/app/Utils/Ninja.php @@ -48,7 +48,8 @@ class Ninja 'White Label: '.'\\n'. // TODO: Implement white label with hasFeature. 'Server OS: '.php_uname('s').' '.php_uname('r').'\\n'. 'PHP Version: '.phpversion().'\\n'. - 'MySQL Version: '.$mysql_version; + 'MySQL Version: '.$mysql_version.'\\n'. + 'Version: '. request()->has('version') ? request()->input('version') : 'No Version Supplied.'; return $info; } diff --git a/config/ninja.php b/config/ninja.php index ff45b1ecad18..2b09aa28889e 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', 'invoicing.co'), - 'app_version' => '5.3.83', - 'app_tag' => '5.3.83', + 'app_version' => '5.3.84', + 'app_tag' => '5.3.84', 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', ''),