diff --git a/app/Console/Commands/CheckData.php b/app/Console/Commands/CheckData.php index bb2cf5ca6..7130c1a9a 100644 --- a/app/Console/Commands/CheckData.php +++ b/app/Console/Commands/CheckData.php @@ -22,6 +22,7 @@ use App\Models\Credit; use App\Models\Invitation; use App\Models\Invoice; use App\Models\InvoiceInvitation; +use App\Models\Payment; use App\Utils\Ninja; use Carbon; use DB; @@ -299,6 +300,9 @@ class CheckData extends Command foreach (Client::cursor() as $client) { $invoice_balance = $client->invoices->where('is_deleted', false)->where('status_id', '>', 1)->sum('balance'); + $credit_balance = $client->credits->where('is_deleted', false)->sum('balance'); + + $invoice_balance -= $credit_balance; $ledger = CompanyLedger::where('client_id', $client->id)->orderBy('id', 'DESC')->first(); @@ -322,8 +326,11 @@ class CheckData extends Command $total_invoice_payments = 0; foreach ($client->invoices->where('is_deleted', false)->where('status_id', '>', 1) as $invoice) { - $total_amount = $invoice->payments->whereNull('deleted_at')->sum('pivot.amount'); - $total_refund = $invoice->payments->whereNull('deleted_at')->sum('pivot.refunded'); + // $total_amount = $invoice->payments->whereNull('deleted_at')->sum('pivot.amount'); + // $total_refund = $invoice->payments->whereNull('deleted_at')->sum('pivot.refunded'); + + $total_amount = $invoice->payments->where('is_deleted', false)->whereIn('status_id', [Payment::STATUS_COMPLETED, Payment:: STATUS_PENDING, Payment::STATUS_PARTIALLY_REFUNDED])->sum('pivot.amount'); + $total_refund = $invoice->payments->where('is_deleted', false)->whereIn('status_id', [Payment::STATUS_COMPLETED, Payment:: STATUS_PENDING, Payment::STATUS_PARTIALLY_REFUNDED])->sum('pivot.refunded'); $total_invoice_payments += ($total_amount - $total_refund); } @@ -357,8 +364,8 @@ class CheckData extends Command Client::cursor()->each(function ($client) use ($wrong_balances) { $client->invoices->where('is_deleted', false)->whereIn('status_id', '!=', Invoice::STATUS_DRAFT)->each(function ($invoice) use ($wrong_balances, $client) { - $total_amount = $invoice->payments->sum('pivot.amount'); - $total_refund = $invoice->payments->sum('pivot.refunded'); + $total_amount = $invoice->payments->whereIn('status_id', [Payment::STATUS_PAID, Payment:: STATUS_PENDING, Payment::STATUS_PARTIALLY_REFUNDED])->sum('pivot.amount'); + $total_refund = $invoice->payments->whereIn('status_id', [Payment::STATUS_PAID, Payment:: STATUS_PENDING, Payment::STATUS_PARTIALLY_REFUNDED])->sum('pivot.refunded'); $total_credit = $invoice->credits->sum('amount'); $total_paid = $total_amount - $total_refund; @@ -383,7 +390,11 @@ class CheckData extends Command $wrong_paid_to_dates = 0; foreach (Client::cursor() as $client) { - $invoice_balance = $client->invoices->where('is_deleted', false)->where('status_id', '>', 1)->sum('balance'); + //$invoice_balance = $client->invoices->where('is_deleted', false)->where('status_id', '>', 1)->sum('balance'); + $invoice_balance = Invoice::where('client_id', $client->id)->where('is_deleted', false)->where('status_id', '>', 1)->withTrashed()->sum('balance'); + $client_balance = Credit::where('client_id', $client->id)->where('is_deleted', false)->withTrashed()->sum('balance'); + + $invoice_balance -= $client_balance; $ledger = CompanyLedger::where('client_id', $client->id)->orderBy('id', 'DESC')->first(); @@ -395,7 +406,7 @@ class CheckData extends Command } } - $this->logMessage("{$wrong_paid_to_dates} clients with incorrect paid_to_dates"); + $this->logMessage("{$wrong_paid_to_dates} clients with incorrect client balances"); } private function checkLogoFiles() diff --git a/app/Console/Commands/ImportMigrations.php b/app/Console/Commands/ImportMigrations.php index 1e4604ba5..bfbc60cd6 100644 --- a/app/Console/Commands/ImportMigrations.php +++ b/app/Console/Commands/ImportMigrations.php @@ -125,6 +125,7 @@ class ImportMigrations extends Command { $company = Company::factory()->create([ 'account_id' => $account->id, + 'is_disabled' => true, ]); if (! $account->default_company_id) { diff --git a/app/DataMapper/InvoiceItem.php b/app/DataMapper/InvoiceItem.php index 6349e057b..396ae875d 100644 --- a/app/DataMapper/InvoiceItem.php +++ b/app/DataMapper/InvoiceItem.php @@ -51,7 +51,7 @@ class InvoiceItem public $custom_value4 = ''; - public $type_id = 1; //1 = product, 2 = service, 3 unpaid gateway fee, 4 paid gateway fee, 5 late fee + public $type_id = '1'; //1 = product, 2 = service, 3 unpaid gateway fee, 4 paid gateway fee, 5 late fee public static $casts = [ 'type_id' => 'string', diff --git a/app/Helpers/Invoice/InvoiceSum.php b/app/Helpers/Invoice/InvoiceSum.php index 4ed998ba4..d3e54e607 100644 --- a/app/Helpers/Invoice/InvoiceSum.php +++ b/app/Helpers/Invoice/InvoiceSum.php @@ -160,6 +160,18 @@ class InvoiceSum { $this->total += $this->total_taxes; + if($this->invoice->custom_value1 > 0) + $this->total += $this->invoice->custom_value1; + + if($this->invoice->custom_value2 > 0) + $this->total += $this->invoice->custom_value2; + + if($this->invoice->custom_value3 > 0) + $this->total += $this->invoice->custom_value3; + + if($this->invoice->custom_value4 > 0) + $this->total += $this->invoice->custom_value4; + return $this; } diff --git a/app/Helpers/Invoice/InvoiceSumInclusive.php b/app/Helpers/Invoice/InvoiceSumInclusive.php index e46718961..20f10b609 100644 --- a/app/Helpers/Invoice/InvoiceSumInclusive.php +++ b/app/Helpers/Invoice/InvoiceSumInclusive.php @@ -66,7 +66,7 @@ class InvoiceSumInclusive ->calculateCustomValues() ->calculateInvoiceTaxes() ->setTaxMap() -// ->calculateTotals() + ->calculateTotals() //just don't add the taxes!! ->calculateBalance() ->calculatePartial(); @@ -170,7 +170,19 @@ class InvoiceSumInclusive private function calculateTotals() { - $this->total += $this->total_taxes; + //$this->total += $this->total_taxes; + + if($this->invoice->custom_value1 > 0) + $this->total += $this->invoice->custom_value1; + + if($this->invoice->custom_value2 > 0) + $this->total += $this->invoice->custom_value2; + + if($this->invoice->custom_value3 > 0) + $this->total += $this->invoice->custom_value3; + + if($this->invoice->custom_value4 > 0) + $this->total += $this->invoice->custom_value4; return $this; } diff --git a/app/Http/Controllers/MigrationController.php b/app/Http/Controllers/MigrationController.php index 9934573bd..de7e14fa9 100644 --- a/app/Http/Controllers/MigrationController.php +++ b/app/Http/Controllers/MigrationController.php @@ -98,6 +98,24 @@ class MigrationController extends BaseController return response()->json(['message' => 'Company purged'], 200); } + private function purgeCompanyWithForceFlag(Company $company) + { + $account = $company->account; + $company_id = $company->id; + + $company->delete(); + + /*Update the new default company if necessary*/ + if ($company_id == $account->default_company_id && $account->companies->count() >= 1) { + $new_default_company = $account->companies->first(); + + if ($new_default_company) { + $account->default_company_id = $new_default_company->id; + $account->save(); + } + } + } + /** * Purge Company but save settings. * @@ -201,6 +219,7 @@ class MigrationController extends BaseController */ public function startMigration(Request $request) { + $companies = json_decode($request->companies); if (app()->environment() === 'local') { @@ -208,21 +227,21 @@ class MigrationController extends BaseController } foreach ($companies as $company) { - $is_valid = $request->file($company->company_key)->isValid(); + + $is_valid = $request->file($company->company_index)->isValid(); if (!$is_valid) { // We might want to send user something's wrong with migration or nope? - continue; } $user = auth()->user(); // Look for possible existing company (based on company keys). - $existing_company = Company::where('company_key', $request->company_key)->first(); + $existing_company = Company::whereRaw('BINARY `company_key` = ?', [$company->company_key])->first(); $checks = [ - 'existing_company' => (bool) $existing_company, + 'existing_company' => $existing_company ? (bool)1 : false, 'force' => property_exists($company, 'force') ? (bool) $company->force : false, ]; @@ -230,7 +249,7 @@ class MigrationController extends BaseController if ($checks['existing_company'] == true && $checks['force'] == false) { info('Migrating: Existing company without force. (CASE_01)'); - MailRouter::dispatch(new ExistingMigration(), $company, $user); + MailRouter::dispatch(new ExistingMigration(), $existing_company, $user); return response()->json([ '_id' => Str::uuid(), @@ -241,7 +260,8 @@ class MigrationController extends BaseController // If there's existing company and force ** is provided ** - purge the company and migrate again. if ($checks['existing_company'] == true && $checks['force'] == true) { - $this->purgeCompany($existing_company); + info("purging the existing company here"); + $this->purgeCompanyWithForceFlag($existing_company); $account = auth()->user()->account; $fresh_company = (new ImportMigrations())->getCompany($account); @@ -300,10 +320,10 @@ class MigrationController extends BaseController ]); } - $migration_file = $request->file($company->company_key) + $migration_file = $request->file($company->company_index) ->storeAs( 'migrations', - $request->file($company->company_key)->getClientOriginalName() + $request->file($company->company_index)->getClientOriginalName() ); if (app()->environment() == 'testing') { @@ -311,7 +331,7 @@ class MigrationController extends BaseController } try { - StartMigration::dispatch(base_path("storage/app/public/$migration_file"), $user, $fresh_company)->delay(now()->addSeconds(60)); + StartMigration::dispatch(base_path("storage/app/public/$migration_file"), $user, $fresh_company)->delay(now()->addSeconds(5)); } catch (\Exception $e) { info($e->getMessage()); } diff --git a/app/Jobs/Product/UpdateOrCreateProduct.php b/app/Jobs/Product/UpdateOrCreateProduct.php index 210046f6f..4f7098b34 100644 --- a/app/Jobs/Product/UpdateOrCreateProduct.php +++ b/app/Jobs/Product/UpdateOrCreateProduct.php @@ -70,7 +70,7 @@ class UpdateOrCreateProduct implements ShouldQueue continue; } - $product = Product::firstOrNew(['product_key' => $item->product_key, 'company_id' => $this->invoice->company->id]); + $product = Product::withTrashed()->firstOrNew(['product_key' => $item->product_key, 'company_id' => $this->invoice->company->id]); $product->product_key = $item->product_key; $product->notes = isset($item->notes) ? $item->notes : ''; @@ -94,4 +94,10 @@ class UpdateOrCreateProduct implements ShouldQueue $product->save(); } } + + public function failed($exception = null) + { + info("update create failed with = "); + info(print_r($exception->getMessage(),1)); + } } diff --git a/app/Jobs/Util/Import.php b/app/Jobs/Util/Import.php index 8182653a3..c83d8c214 100644 --- a/app/Jobs/Util/Import.php +++ b/app/Jobs/Util/Import.php @@ -74,6 +74,7 @@ use App\Repositories\VendorRepository; use App\Utils\Traits\CleanLineItems; use App\Utils\Traits\CompanyGatewayFeesAndLimitsSaver; use App\Utils\Traits\MakesHash; +use App\Utils\Traits\SavesDocuments; use App\Utils\Traits\Uploadable; use Exception; use Illuminate\Bus\Queueable; @@ -93,10 +94,11 @@ class Import implements ShouldQueue use MakesHash; use CleanLineItems; use Uploadable; + use SavesDocuments; /** * @var array */ - private $data; + private $file_path; //the file path - using a different JSON parser here. /** * @var Company @@ -115,10 +117,10 @@ class Import implements ShouldQueue 'vendors', 'projects', 'products', + 'credits', 'invoices', 'recurring_invoices', 'quotes', - 'credits', 'payments', 'company_gateways', 'client_gateway_tokens', @@ -126,7 +128,7 @@ class Import implements ShouldQueue 'task_statuses', 'expenses', 'tasks', - // //'documents', + 'documents', ]; /** @@ -150,9 +152,9 @@ class Import implements ShouldQueue public $tries = 1; - public $timeout = 86400; + public $timeout = 0; - public $backoff = 86430; + // public $backoff = 86430; // public $maxExceptions = 2; /** @@ -163,9 +165,9 @@ class Import implements ShouldQueue * @param User $user * @param array $resources */ - public function __construct(array $data, Company $company, User $user, array $resources = []) + public function __construct(string $file_path, Company $company, User $user, array $resources = []) { - $this->data = $data; + $this->file_path = $file_path; $this->company = $company; $this->user = $user; $this->resources = $resources; @@ -180,18 +182,23 @@ class Import implements ShouldQueue { set_time_limit(0); - foreach ($this->data as $key => $resource) { - if (! in_array($key, $this->available_imports)) { + // $jsonStream = \JsonMachine\JsonMachine::fromFile($this->file_path, "/data"); + $array = json_decode(file_get_contents($this->file_path), 1); + $data = $array['data']; + + foreach ($this->available_imports as $import) { + + if (! array_key_exists($import, $data)) { //throw new ResourceNotAvailableForMigration("Resource {$key} is not available for migration."); - info("Resource {$key} is not available for migration."); + info("Resource {$import} is not available for migration."); continue; } - $method = sprintf('process%s', Str::ucfirst(Str::camel($key))); + $method = sprintf('process%s', Str::ucfirst(Str::camel($import))); - info("Importing {$key}"); + info("Importing {$import}"); - $this->{$method}($resource); + $this->{$method}($data[$import]); } $this->setInitialCompanyLedgerBalances(); @@ -754,18 +761,18 @@ class Import implements ShouldQueue unset($modified['id']); - $invoice = $quote_repository->save( + $quote = $quote_repository->save( $modified, QuoteFactory::create($this->company->id, $modified['user_id']) ); $old_user_key = array_key_exists('user_id', $resource) ?? $this->user->id; - $key = "invoices_{$resource['id']}"; + $key = "quotes_{$resource['id']}"; $this->ids['quotes'][$key] = [ 'old' => $resource['id'], - 'new' => $invoice->id, + 'new' => $quote->id, ]; } @@ -778,6 +785,7 @@ class Import implements ShouldQueue private function processPayments(array $data): void { + Payment::reguard(); $rules = [ @@ -811,7 +819,7 @@ class Import implements ShouldQueue if (isset($modified['invoices'])) { foreach ($modified['invoices'] as $key => $invoice) { - if($modified['amount'] >= 0) + if($this->tryTransformingId('invoices', $invoice['invoice_id'])) $modified['invoices'][$key]['invoice_id'] = $this->transformId('invoices', $invoice['invoice_id']); else{ $modified['credits'][$key]['credit_id'] = $this->transformId('credits', $invoice['invoice_id']); @@ -834,6 +842,15 @@ class Import implements ShouldQueue 'new' => $payment->id, ], ]; + + //depending on the status, we do a final action. + //s$payment = $this->updatePaymentForStatus($payment, $modified['status_id']); + + // if($modified['is_deleted']) + // $payment->service()->deletePayment(); + + // if(isset($modified['deleted_at'])) + // $payment->delete(); } Payment::reguard(); @@ -843,12 +860,52 @@ class Import implements ShouldQueue $payment_repository = null; } + private function updatePaymentForStatus($payment, $status_id) :Payment + { + // define('PAYMENT_STATUS_PENDING', 1); + // define('PAYMENT_STATUS_VOIDED', 2); + // define('PAYMENT_STATUS_FAILED', 3); + // define('PAYMENT_STATUS_COMPLETED', 4); + // define('PAYMENT_STATUS_PARTIALLY_REFUNDED', 5); + // define('PAYMENT_STATUS_REFUNDED', 6); + + switch ($status_id) { + case 1: + return $payment; + break; + case 2: + return $payment->service()->deletePayment(); + break; + case 3: + return $payment->service()->deletePayment(); + break; + case 4: + return $payment; + break; + case 5: + $payment->status_id = Payment::STATUS_PARTIALLY_REFUNDED; + $payment->save(); + return $payment; + break; + case 6: + $payment->status_id = Payment::STATUS_REFUNDED; + $payment->save(); + return $payment; + break; + + default: + return $payment; + break; + } + } + private function processDocuments(array $data): void { - Document::unguard(); + // Document::unguard(); /* No validators since data provided by database is already valid. */ - foreach ($data as $resource) { + foreach($data as $resource) + { $modified = $resource; if (array_key_exists('invoice_id', $resource) && $resource['invoice_id'] && ! array_key_exists('invoices', $this->ids)) { @@ -859,42 +916,67 @@ class Import implements ShouldQueue throw new ResourceDependencyMissing('Processing documents failed, because of missing dependency - expenses.'); } - /* Remove because of polymorphic joins. */ - unset($modified['invoice_id']); - unset($modified['expense_id']); - if (array_key_exists('invoice_id', $resource) && $resource['invoice_id'] && array_key_exists('invoices', $this->ids)) { - $modified['documentable_id'] = $this->transformId('invoices', $resource['invoice_id']); - $modified['documentable_type'] = Invoice::class; + $invoice_id = $this->transformId('invoices', $resource['invoice_id']); + $entity = Invoice::where('id', $invoice_id)->withTrashed()->first(); } if (array_key_exists('expense_id', $resource) && $resource['expense_id'] && array_key_exists('expenses', $this->ids)) { - $modified['documentable_id'] = $this->transformId('expenses', $resource['expense_id']); - $modified['documentable_type'] = Expense::class; + $expense_id = $this->transformId('expenses', $resource['expense_id']); + $entity = Expense::where('id', $expense_id)->withTrashed()->first(); } - $modified['user_id'] = $this->processUserId($resource); - $modified['company_id'] = $this->company->id; + $this->saveDocument(file_get_contents($resource['url']), $entity, $is_public = true); - $document = Document::create($modified); - - // $entity = $modified['documentable_type']::find($modified['documentable_id']); - // $entity->documents()->save($modified); - - $old_user_key = array_key_exists('user_id', $resource) ?? $this->user->id; - - $this->ids['documents'] = [ - "documents_{$old_user_key}" => [ - 'old' => $resource['id'], - 'new' => $document->id, - ], - ]; } - Document::reguard(); + // foreach ($data as $resource) { + // $modified = $resource; - /*Improve memory handling by setting everything to null when we have finished*/ - $data = null; + // if (array_key_exists('invoice_id', $resource) && $resource['invoice_id'] && ! array_key_exists('invoices', $this->ids)) { + // throw new ResourceDependencyMissing('Processing documents failed, because of missing dependency - invoices.'); + // } + + // if (array_key_exists('expense_id', $resource) && $resource['expense_id'] && ! array_key_exists('expenses', $this->ids)) { + // throw new ResourceDependencyMissing('Processing documents failed, because of missing dependency - expenses.'); + // } + + // /* Remove because of polymorphic joins. */ + // unset($modified['invoice_id']); + // unset($modified['expense_id']); + + // if (array_key_exists('invoice_id', $resource) && $resource['invoice_id'] && array_key_exists('invoices', $this->ids)) { + // $modified['documentable_id'] = $this->transformId('invoices', $resource['invoice_id']); + // $modified['documentable_type'] = Invoice::class; + // } + + // if (array_key_exists('expense_id', $resource) && $resource['expense_id'] && array_key_exists('expenses', $this->ids)) { + // $modified['documentable_id'] = $this->transformId('expenses', $resource['expense_id']); + // $modified['documentable_type'] = Expense::class; + // } + + // $modified['user_id'] = $this->processUserId($resource); + // $modified['company_id'] = $this->company->id; + + // $document = Document::create($modified); + + // // $entity = $modified['documentable_type']::find($modified['documentable_id']); + // // $entity->documents()->save($modified); + + // $old_user_key = array_key_exists('user_id', $resource) ?? $this->user->id; + + // $this->ids['documents'] = [ + // "documents_{$old_user_key}" => [ + // 'old' => $resource['id'], + // 'new' => $document->id, + // ], + // ]; + // } + + // Document::reguard(); + + // /*Improve memory handling by setting everything to null when we have finished*/ + // $data = null; } private function processPaymentTerms(array $data) :void @@ -1113,14 +1195,13 @@ class Import implements ShouldQueue $project = Project::Create($modified); - $old_user_key = array_key_exists('user_id', $resource) ?? $this->user->id; + $key = "projects_{$resource['id']}"; - $this->ids['projects'] = [ - "projects_{$old_user_key}" => [ - 'old' => $resource['id'], - 'new' => $project->id, - ], + $this->ids['projects'][$key] = [ + 'old' => $resource['id'], + 'new' => $project->id, ]; + } Project::reguard(); @@ -1208,6 +1289,7 @@ class Import implements ShouldQueue public function transformId($resource, string $old): int { if (! array_key_exists($resource, $this->ids)) { + info(print_r($resource,1)); throw new Exception("Resource {$resource} not available."); } @@ -1218,6 +1300,19 @@ class Import implements ShouldQueue return $this->ids[$resource]["{$resource}_{$old}"]['new']; } + private function tryTransformingId($resource, string $old): ?int + { + if (! array_key_exists($resource, $this->ids)) { + return false; + } + + if (! array_key_exists("{$resource}_{$old}", $this->ids[$resource])) { + return false; + } + + return $this->ids[$resource]["{$resource}_{$old}"]['new']; + } + /** * Process & handle user_id. * diff --git a/app/Jobs/Util/StartMigration.php b/app/Jobs/Util/StartMigration.php index f8ed9db36..e782549ae 100644 --- a/app/Jobs/Util/StartMigration.php +++ b/app/Jobs/Util/StartMigration.php @@ -53,7 +53,7 @@ class StartMigration implements ShouldQueue */ public $tries = 1; - public $timeout = 86400; + public $timeout = 0; // public $maxExceptions = 2; @@ -107,9 +107,9 @@ class StartMigration implements ShouldQueue throw new NonExistingMigrationFile('Migration file does not exist, or it is corrupted.'); } - $data = json_decode(file_get_contents($file), 1); - - Import::dispatchNow($data['data'], $this->company, $this->user); + //$data = json_decode(file_get_contents($file), 1); + //Import::dispatchNow($data['data'], $this->company, $this->user); + Import::dispatchNow($file, $this->company, $this->user); } catch (NonExistingMigrationFile | ProcessingMigrationArchiveFailed | ResourceNotAvailableForMigration | MigrationValidatorFailed | ResourceDependencyMissing $e) { Mail::to($this->user)->send(new MigrationFailed($e, $e->getMessage())); diff --git a/app/Models/Company.php b/app/Models/Company.php index df64f0716..e7e333282 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -46,8 +46,6 @@ use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Notifications\Notification; use Illuminate\Support\Facades\Log; use Laracasts\Presenter\PresentableTrait; -use Staudenmeir\EloquentHasManyDeep\HasRelationships; -use Staudenmeir\EloquentHasManyDeep\HasTableAlias; class Company extends BaseModel { @@ -55,8 +53,6 @@ class Company extends BaseModel use MakesHash; use CompanySettingsSaver; use ThrottlesEmail; - use HasRelationships; - use HasTableAlias; const ENTITY_RECURRING_INVOICE = 'recurring_invoice'; const ENTITY_CREDIT = 'credit'; diff --git a/app/Models/CompanyUser.php b/app/Models/CompanyUser.php index 8655e398b..90386e136 100644 --- a/app/Models/CompanyUser.php +++ b/app/Models/CompanyUser.php @@ -13,11 +13,10 @@ namespace App\Models; use Illuminate\Database\Eloquent\Relations\Pivot; use Illuminate\Database\Eloquent\SoftDeletes; -use Staudenmeir\EloquentHasManyDeep\HasRelationships; class CompanyUser extends Pivot { - use HasRelationships; + use SoftDeletes; // protected $guarded = ['id']; @@ -95,7 +94,6 @@ class CompanyUser extends Pivot //return $this->hasMany(CompanyToken::class); //return $this->hasOne(CompanyToken::class, 'user_id', 'user_id','company_id', 'company_id'); - //return $this->hasOneDeep(CompanyToken::class, [CompanyUser::class], ['user_id','company_id'], ['company_id','company_id']); //return $this->belongsTo(CompanyToken::class, 'user_id', 'user_id'); diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index d85044440..50c35ef9c 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -186,7 +186,7 @@ class Invoice extends BaseModel public function payments() { - return $this->morphToMany(Payment::class, 'paymentable')->withPivot('amount', 'refunded')->withTimestamps()->withTrashed(); + return $this->morphToMany(Payment::class, 'paymentable')->withTrashed()->withPivot('amount', 'refunded')->withTimestamps(); } public function company_ledger() diff --git a/app/Models/Payment.php b/app/Models/Payment.php index 3fcad72d5..33b5760b1 100644 --- a/app/Models/Payment.php +++ b/app/Models/Payment.php @@ -131,12 +131,12 @@ class Payment extends BaseModel public function invoices() { - return $this->morphedByMany(Invoice::class, 'paymentable')->withPivot('amount', 'refunded')->withTimestamps(); + return $this->morphedByMany(Invoice::class, 'paymentable')->withTrashed()->withPivot('amount', 'refunded')->withTimestamps(); } public function credits() { - return $this->morphedByMany(Credit::class, 'paymentable')->withPivot('amount', 'refunded')->withTimestamps(); + return $this->morphedByMany(Credit::class, 'paymentable')->withTrashed()->withPivot('amount', 'refunded')->withTimestamps(); } public function company_ledger() diff --git a/app/Models/User.php b/app/Models/User.php index 34505645c..00653a53b 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -33,7 +33,6 @@ use Illuminate\Support\Carbon; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Auth; use Laracasts\Presenter\PresentableTrait; -use Staudenmeir\EloquentHasManyDeep\HasRelationships; class User extends Authenticatable implements MustVerifyEmail { @@ -44,7 +43,6 @@ class User extends Authenticatable implements MustVerifyEmail use UserSessionAttributes; use UserSettings; use Filterable; - use HasRelationships; use HasFactory; protected $guard = 'user'; diff --git a/app/Observers/ClientObserver.php b/app/Observers/ClientObserver.php index 61e2494f7..e6336c5eb 100644 --- a/app/Observers/ClientObserver.php +++ b/app/Observers/ClientObserver.php @@ -25,7 +25,12 @@ class ClientObserver */ public function created(Client $client) { - WebhookHandler::dispatch(Webhook::EVENT_CREATE_CLIENT, $client, $client->company); + $subscriptions = Webhook::where('company_id', $client->company->id) + ->where('event_id', Webhook::EVENT_CREATE_CLIENT) + ->exists(); + + if($subscriptions) + WebhookHandler::dispatch(Webhook::EVENT_CREATE_CLIENT, $client, $client->company); } /** @@ -36,7 +41,12 @@ class ClientObserver */ public function updated(Client $client) { - WebhookHandler::dispatch(Webhook::EVENT_UPDATE_CLIENT, $client, $client->company); + $subscriptions = Webhook::where('company_id', $client->company->id) + ->where('event_id', Webhook::EVENT_UPDATE_CLIENT) + ->exists(); + + if($subscriptions) + WebhookHandler::dispatch(Webhook::EVENT_UPDATE_CLIENT, $client, $client->company); } /** @@ -47,7 +57,12 @@ class ClientObserver */ public function deleted(Client $client) { - WebhookHandler::dispatch(Webhook::EVENT_DELETE_CLIENT, $client, $client->company); + $subscriptions = Webhook::where('company_id', $client->company->id) + ->where('event_id', Webhook::EVENT_DELETE_CLIENT) + ->exists(); + + if($subscriptions) + WebhookHandler::dispatch(Webhook::EVENT_DELETE_CLIENT, $client, $client->company); } /** diff --git a/app/Observers/ExpenseObserver.php b/app/Observers/ExpenseObserver.php index f1f3a80c6..e67abbd9e 100644 --- a/app/Observers/ExpenseObserver.php +++ b/app/Observers/ExpenseObserver.php @@ -25,7 +25,12 @@ class ExpenseObserver */ public function created(Expense $expense) { - WebhookHandler::dispatch(Webhook::EVENT_CREATE_EXPENSE, $expense, $expense->company); + $subscriptions = Webhook::where('company_id', $expense->company->id) + ->where('event_id', Webhook::EVENT_CREATE_EXPENSE) + ->exists(); + + if($subscriptions) + WebhookHandler::dispatch(Webhook::EVENT_CREATE_EXPENSE, $expense, $expense->company); } /** @@ -36,7 +41,12 @@ class ExpenseObserver */ public function updated(Expense $expense) { - WebhookHandler::dispatch(Webhook::EVENT_UPDATE_EXPENSE, $expense, $expense->company); + $subscriptions = Webhook::where('company_id', $expense->company->id) + ->where('event_id', Webhook::EVENT_UPDATE_EXPENSE) + ->exists(); + + if($subscriptions) + WebhookHandler::dispatch(Webhook::EVENT_UPDATE_EXPENSE, $expense, $expense->company); } /** @@ -47,7 +57,12 @@ class ExpenseObserver */ public function deleted(Expense $expense) { - WebhookHandler::dispatch(Webhook::EVENT_DELETE_EXPENSE, $expense, $expense->company); + $subscriptions = Webhook::where('company_id', $expense->company->id) + ->where('event_id', Webhook::EVENT_DELETE_EXPENSE) + ->exists(); + + if($subscriptions) + WebhookHandler::dispatch(Webhook::EVENT_DELETE_EXPENSE, $expense, $expense->company); } /** diff --git a/app/Observers/InvoiceObserver.php b/app/Observers/InvoiceObserver.php index 133109824..224456d68 100644 --- a/app/Observers/InvoiceObserver.php +++ b/app/Observers/InvoiceObserver.php @@ -26,7 +26,13 @@ class InvoiceObserver */ public function created(Invoice $invoice) { - WebhookHandler::dispatch(Webhook::EVENT_CREATE_INVOICE, $invoice, $invoice->company); + + $subscriptions = Webhook::where('company_id', $invoice->company->id) + ->where('event_id', Webhook::EVENT_CREATE_INVOICE) + ->exists(); + + if($subscriptions) + WebhookHandler::dispatch(Webhook::EVENT_CREATE_INVOICE, $invoice, $invoice->company); } /** @@ -37,7 +43,12 @@ class InvoiceObserver */ public function updated(Invoice $invoice) { - WebhookHandler::dispatch(Webhook::EVENT_UPDATE_INVOICE, $invoice, $invoice->company); + $subscriptions = Webhook::where('company_id', $invoice->company->id) + ->where('event_id', Webhook::EVENT_UPDATE_INVOICE) + ->exists(); + + if($subscriptions) + WebhookHandler::dispatch(Webhook::EVENT_UPDATE_INVOICE, $invoice, $invoice->company); } /** @@ -48,7 +59,12 @@ class InvoiceObserver */ public function deleted(Invoice $invoice) { - WebhookHandler::dispatch(Webhook::EVENT_DELETE_INVOICE, $invoice, $invoice->company); + $subscriptions = Webhook::where('company_id', $invoice->company->id) + ->where('event_id', Webhook::EVENT_DELETE_INVOICE) + ->exists(); + + if($subscriptions) + WebhookHandler::dispatch(Webhook::EVENT_DELETE_INVOICE, $invoice, $invoice->company); } /** diff --git a/app/Observers/PaymentObserver.php b/app/Observers/PaymentObserver.php index 0706c5600..5eaa05de5 100644 --- a/app/Observers/PaymentObserver.php +++ b/app/Observers/PaymentObserver.php @@ -26,7 +26,13 @@ class PaymentObserver */ public function created(Payment $payment) { - WebhookHandler::dispatch(Webhook::EVENT_CREATE_PAYMENT, $payment, $payment->company); + + $subscriptions = Webhook::where('company_id', $payment->company->id) + ->where('event_id', Webhook::EVENT_CREATE_PAYMENT) + ->exists(); + + if($subscriptions) + WebhookHandler::dispatch(Webhook::EVENT_CREATE_PAYMENT, $payment, $payment->company); } /** @@ -47,7 +53,12 @@ class PaymentObserver */ public function deleted(Payment $payment) { - WebhookHandler::dispatch(Webhook::EVENT_DELETE_PAYMENT, $payment, $payment->company); + $subscriptions = Webhook::where('company_id', $payment->company->id) + ->where('event_id', Webhook::EVENT_DELETE_PAYMENT) + ->exists(); + + if($subscriptions) + WebhookHandler::dispatch(Webhook::EVENT_DELETE_PAYMENT, $payment, $payment->company); } /** diff --git a/app/Observers/QuoteObserver.php b/app/Observers/QuoteObserver.php index 0c69048d7..600382a0d 100644 --- a/app/Observers/QuoteObserver.php +++ b/app/Observers/QuoteObserver.php @@ -25,6 +25,11 @@ class QuoteObserver */ public function created(Quote $quote) { + $subscriptions = Webhook::where('company_id', $quote->company->id) + ->where('event_id', Webhook::EVENT_CREATE_QUOTE) + ->exists(); + + if($subscriptions) WebhookHandler::dispatch(Webhook::EVENT_CREATE_QUOTE, $quote, $quote->company); } @@ -36,7 +41,12 @@ class QuoteObserver */ public function updated(Quote $quote) { - WebhookHandler::dispatch(Webhook::EVENT_UPDATE_QUOTE, $quote, $quote->company); + $subscriptions = Webhook::where('company_id', $quote->company->id) + ->where('event_id', Webhook::EVENT_UPDATE_QUOTE) + ->exists(); + + if($subscriptions) + WebhookHandler::dispatch(Webhook::EVENT_UPDATE_QUOTE, $quote, $quote->company); } /** @@ -47,7 +57,12 @@ class QuoteObserver */ public function deleted(Quote $quote) { - WebhookHandler::dispatch(Webhook::EVENT_DELETE_QUOTE, $quote, $quote->company); + $subscriptions = Webhook::where('company_id', $quote->company->id) + ->where('event_id', Webhook::EVENT_DELETE_QUOTE) + ->exists(); + + if($subscriptions) + WebhookHandler::dispatch(Webhook::EVENT_DELETE_QUOTE, $quote, $quote->company); } /** diff --git a/app/Observers/TaskObserver.php b/app/Observers/TaskObserver.php index 9bbfc38d6..e31371276 100644 --- a/app/Observers/TaskObserver.php +++ b/app/Observers/TaskObserver.php @@ -25,7 +25,13 @@ class TaskObserver */ public function created(Task $task) { - WebhookHandler::dispatch(Webhook::EVENT_CREATE_TASK, $task, $task->company); + + $subscriptions = Webhook::where('company_id', $task->company->id) + ->where('event_id', Webhook::EVENT_CREATE_TASK) + ->exists(); + + if($subscriptions) + WebhookHandler::dispatch(Webhook::EVENT_CREATE_TASK, $task, $task->company); } /** @@ -36,7 +42,13 @@ class TaskObserver */ public function updated(Task $task) { - WebhookHandler::dispatch(Webhook::EVENT_UPDATE_TASK, $task, $task->company); + + $subscriptions = Webhook::where('company_id', $task->company->id) + ->where('event_id', Webhook::EVENT_UPDATE_TASK) + ->exists(); + + if($subscriptions) + WebhookHandler::dispatch(Webhook::EVENT_UPDATE_TASK, $task, $task->company); } /** @@ -47,7 +59,14 @@ class TaskObserver */ public function deleted(Task $task) { - WebhookHandler::dispatch(Webhook::EVENT_DELETE_TASK, $task, $task->company); + + + $subscriptions = Webhook::where('company_id', $task->company->id) + ->where('event_id', Webhook::EVENT_DELETE_TASK) + ->exists(); + + if($subscriptions) + WebhookHandler::dispatch(Webhook::EVENT_DELETE_TASK, $task, $task->company); } /** diff --git a/app/Repositories/ActivityRepository.php b/app/Repositories/ActivityRepository.php index 78daafd60..0e52ea0cb 100644 --- a/app/Repositories/ActivityRepository.php +++ b/app/Repositories/ActivityRepository.php @@ -73,6 +73,9 @@ class ActivityRepository extends BaseRepository */ public function createBackup($entity, $activity) { + if($entity->company->is_disabled) + return; + $backup = new Backup(); if (get_class($entity) == Invoice::class || get_class($entity) == Quote::class || get_class($entity) == Credit::class) { diff --git a/app/Repositories/BaseRepository.php b/app/Repositories/BaseRepository.php index 7b0cc2987..1f95fbfe4 100644 --- a/app/Repositories/BaseRepository.php +++ b/app/Repositories/BaseRepository.php @@ -162,9 +162,9 @@ class BaseRepository $class = new ReflectionClass($model); if (array_key_exists('client_id', $data)) { - $client = Client::find($data['client_id']); + $client = Client::where('id', $data['client_id'])->withTrashed()->first(); } else { - $client = Client::find($model->client_id); + $client = Client::where('id', $model->client_id)->withTrashed()->first(); } $state = []; diff --git a/app/Repositories/Migration/InvoiceMigrationRepository.php b/app/Repositories/Migration/InvoiceMigrationRepository.php index d0a0b53b4..bb8254e24 100644 --- a/app/Repositories/Migration/InvoiceMigrationRepository.php +++ b/app/Repositories/Migration/InvoiceMigrationRepository.php @@ -46,9 +46,9 @@ class InvoiceMigrationRepository extends BaseRepository $class = new ReflectionClass($model); if (array_key_exists('client_id', $data)) { - $client = Client::find($data['client_id']); + $client = Client::where('id', $data['client_id'])->withTrashed()->first(); } else { - $client = Client::find($model->client_id); + $client = Client::where('id', $model->client_id)->withTrashed()->first(); } $state = []; diff --git a/app/Repositories/Migration/PaymentMigrationRepository.php b/app/Repositories/Migration/PaymentMigrationRepository.php index 197e4eaac..d4144ac42 100644 --- a/app/Repositories/Migration/PaymentMigrationRepository.php +++ b/app/Repositories/Migration/PaymentMigrationRepository.php @@ -87,7 +87,15 @@ class PaymentMigrationRepository extends BaseRepository /*Fill the payment*/ $payment->fill($data); - $payment->status_id = Payment::STATUS_COMPLETED; + //$payment->status_id = Payment::STATUS_COMPLETED; + + if(!array_key_exists('status_id', $data)){ + info("payment with no status id?"); + info(print_r($data,1)); + } + + $payment->status_id = $data['status_id']; + $payment->deleted_at = $data['deleted_at'] ?: NULL; $payment->save(); /*Ensure payment number generated*/ @@ -102,13 +110,15 @@ class PaymentMigrationRepository 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')); + $refund_totals = array_sum(array_column($data['invoices'], 'refunded')); - $invoices = Invoice::whereIn('id', array_column($data['invoices'], 'invoice_id'))->get(); + $invoices = Invoice::whereIn('id', array_column($data['invoices'], 'invoice_id'))->withTrashed()->get(); $payment->invoices()->saveMany($invoices); - $payment->invoices->each(function ($inv) use ($invoice_totals) { + $payment->invoices->each(function ($inv) use ($invoice_totals, $refund_totals) { $inv->pivot->amount = $invoice_totals; + $inv->pivot->refunded = $refund_totals; $inv->pivot->save(); }); } @@ -116,7 +126,7 @@ class PaymentMigrationRepository extends BaseRepository if (array_key_exists('credits', $data) && is_array($data['credits']) && count($data['credits']) > 0) { $credit_totals = array_sum(array_column($data['credits'], 'amount')); - $credits = Credit::whereIn('id', array_column($data['credits'], 'credit_id'))->get(); + $credits = Credit::whereIn('id', array_column($data['credits'], 'credit_id'))->withTrashed()->get(); $payment->credits()->saveMany($credits); @@ -164,7 +174,7 @@ class PaymentMigrationRepository extends BaseRepository */ private function processExchangeRates($data, $payment) { - $client = Client::find($data['client_id']); + $client = Client::where('id', $data['client_id'])->withTrashed()->first(); $client_currency = $client->getSetting('currency_id'); $company_currency = $client->company->settings->currency_id; diff --git a/app/Repositories/PaymentRepository.php b/app/Repositories/PaymentRepository.php index 3578c2236..bdf05cfc6 100644 --- a/app/Repositories/PaymentRepository.php +++ b/app/Repositories/PaymentRepository.php @@ -12,6 +12,7 @@ namespace App\Repositories; use App\Events\Payment\PaymentWasCreated; +use App\Events\Payment\PaymentWasDeleted; use App\Factory\CreditFactory; use App\Jobs\Credit\ApplyCreditPayment; use App\Libraries\Currency\Conversion\CurrencyApi; @@ -72,7 +73,7 @@ class PaymentRepository extends BaseRepository $this->processExchangeRates($data, $payment); $is_existing_payment = false; - $client = Client::find($data['client_id']); + $client = Client::where('id', $data['client_id'])->withTrashed()->first(); /*We only update the paid to date ONCE per payment*/ if (array_key_exists('invoices', $data) && is_array($data['invoices']) && count($data['invoices']) > 0) { @@ -146,7 +147,7 @@ class PaymentRepository extends BaseRepository //todo optimize into a single query foreach ($data['credits'] as $paid_credit) { - $credit = Credit::find($this->decodePrimaryKey($paid_credit['credit_id'])); + $credit = Credit::withTrashed()->find($this->decodePrimaryKey($paid_credit['credit_id'])); if ($credit) { ApplyCreditPayment::dispatchNow($credit, $payment, $paid_credit['amount'], $credit->company); @@ -198,9 +199,12 @@ class PaymentRepository extends BaseRepository return; } - $payment->service()->deletePayment(); + $payment = $payment->service()->deletePayment(); - return parent::delete($payment); + event(new PaymentWasDeleted($payment, $payment->company, Ninja::eventVars())); + + return $payment; + //return parent::delete($payment); } public function restore($payment) diff --git a/app/Services/Payment/DeletePayment.php b/app/Services/Payment/DeletePayment.php index 6157f40cc..286012ca6 100644 --- a/app/Services/Payment/DeletePayment.php +++ b/app/Services/Payment/DeletePayment.php @@ -36,11 +36,15 @@ class DeletePayment public function run() { + if($this->payment->is_deleted) + return $this->payment; + return $this->setStatus(Payment::STATUS_CANCELLED) //sets status of payment ->updateCreditables() //return the credits first ->adjustInvoices() ->updateClient() ->deletePaymentables() + ->cleanupPayment() ->save(); } @@ -52,6 +56,15 @@ class DeletePayment //set applied amount to 0 + private function cleanupPayment() + { + $this->payment->is_deleted = true; + // $entity->save(); + $this->payment->delete(); + + return $this; + } + private function deletePaymentables() { $this->payment->paymentables()->update(['deleted_at' => now()]); diff --git a/app/Utils/PhantomJS/Phantom.php b/app/Utils/PhantomJS/Phantom.php index 9c67bac1a..fb95c2755 100644 --- a/app/Utils/PhantomJS/Phantom.php +++ b/app/Utils/PhantomJS/Phantom.php @@ -68,6 +68,7 @@ class Phantom $file_path = $path.$entity_obj->number.'.pdf'; $url = config('ninja.app_url').'phantom/'.$entity.'/'.$invitation->key.'?phantomjs_secret='.config('ninja.phantomjs_secret'); +info($url); $key = config('ninja.phantomjs_key'); $secret = config('ninja.phantomjs_key'); diff --git a/app/Utils/Traits/CleanLineItems.php b/app/Utils/Traits/CleanLineItems.php index eba9fd7b0..be2072a37 100644 --- a/app/Utils/Traits/CleanLineItems.php +++ b/app/Utils/Traits/CleanLineItems.php @@ -28,7 +28,9 @@ trait CleanLineItems $cleaned_items = []; foreach ($items as $item) { + $cleaned_items[] = $this->cleanLineItem($item); + } return $cleaned_items; diff --git a/app/Utils/Traits/GeneratesCounter.php b/app/Utils/Traits/GeneratesCounter.php index 739321840..da5c90d62 100644 --- a/app/Utils/Traits/GeneratesCounter.php +++ b/app/Utils/Traits/GeneratesCounter.php @@ -577,10 +577,10 @@ trait GeneratesCounter $search[] = '{$counter}'; $replace[] = $counter; - $search[] = '{$clientCounter}'; + $search[] = '{$client_counter}'; $replace[] = $counter; - $search[] = '{$groupCounter}'; + $search[] = '{$group_counter}'; $replace[] = $counter; if (strstr($pattern, '{$user_id}')) { @@ -600,20 +600,39 @@ trait GeneratesCounter $replace[] = str_replace($format, $date, $matches[1]); } - $search[] = '{$custom1}'; - $replace[] = $entity->custom_value1; + if($entity instanceof Client || $entity instanceof Vendor){ + $search[] = '{$client_custom1}'; + $replace[] = $entity->custom_value1; - $search[] = '{$custom2}'; - $replace[] = $entity->custom_value2; + $search[] = '{$client_custom2}'; + $replace[] = $entity->custom_value2; - $search[] = '{$custom3}'; - $replace[] = $entity->custom_value3; + $search[] = '{$client_custom3}'; + $replace[] = $entity->custom_value3; - $search[] = '{$custom4}'; - $replace[] = $entity->custom_value4; + $search[] = '{$client_custom4}'; + $replace[] = $entity->custom_value4; - $search[] = '{$id_number}'; - $replace[] = $entity->id_number; + $search[] = '{$id_number}'; + $replace[] = $entity->id_number; + } + else + { + $search[] = '{$client_custom1}'; + $replace[] = $entity->client->custom_value1; + + $search[] = '{$client_custom2}'; + $replace[] = $entity->client->custom_value2; + + $search[] = '{$client_custom3}'; + $replace[] = $entity->client->custom_value3; + + $search[] = '{$client_custom4}'; + $replace[] = $entity->client->custom_value4; + + $search[] = '{$id_number}'; + $replace[] = $entity->client->id_number; + } return str_replace($search, $replace, $pattern); } diff --git a/app/Utils/Traits/SavesDocuments.php b/app/Utils/Traits/SavesDocuments.php index 6afb48c53..2ce496f9b 100644 --- a/app/Utils/Traits/SavesDocuments.php +++ b/app/Utils/Traits/SavesDocuments.php @@ -43,4 +43,30 @@ trait SavesDocuments ); } } + + public function saveDocument($document, $entity, $is_public = true) + { + if ($entity instanceof Company) { + $account = $entity->account; + $company = $entity; + } else { + $account = $entity->company->account; + $company = $entity->company; + } + + if (! $account->hasFeature(Account::FEATURE_DOCUMENTS)) { + return false; + } + + $document = UploadFile::dispatchNow( + $document, + UploadFile::DOCUMENT, + $entity->user, + $entity->company, + $entity, + null, + $is_public + ); + + } } diff --git a/composer.json b/composer.json index 8b9865fa9..21f49728c 100644 --- a/composer.json +++ b/composer.json @@ -58,7 +58,6 @@ "predis/predis": "^1.1", "sentry/sentry-laravel": "^2", "spatie/browsershot": "^3.37", - "staudenmeir/eloquent-has-many-deep": "^1.11", "stripe/stripe-php": "^7.50", "turbo124/beacon": "^1", "turbo124/laravel-gmail": "^5.0", diff --git a/composer.lock b/composer.lock index e5bd8516b..4cf215799 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": "7e448a70f9bd66e655c3a9dab1159d66", + "content-hash": "a178576541f03dbaf5e757fb4c89b474", "packages": [ { "name": "asgrim/ofxparser", @@ -116,16 +116,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.158.22", + "version": "3.163.3", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "0aae6d7d0e9fc40ace69ed7f7785d7ddab4dabd0" + "reference": "f6cd8fe1334b19e1dc0d841fa1b2da7cd30a1e8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/0aae6d7d0e9fc40ace69ed7f7785d7ddab4dabd0", - "reference": "0aae6d7d0e9fc40ace69ed7f7785d7ddab4dabd0", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/f6cd8fe1334b19e1dc0d841fa1b2da7cd30a1e8a", + "reference": "f6cd8fe1334b19e1dc0d841fa1b2da7cd30a1e8a", "shasum": "" }, "require": { @@ -200,9 +200,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.158.22" + "source": "https://github.com/aws/aws-sdk-php/tree/3.163.3" }, - "time": "2020-11-06T19:13:12+00:00" + "time": "2020-11-23T20:34:30+00:00" }, { "name": "brick/math", @@ -521,16 +521,16 @@ }, { "name": "composer/composer", - "version": "2.0.5", + "version": "2.0.7", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "0934b44a86d4c43e416674e80cd6c94044cd23b3" + "reference": "cbee637510037f293e641857b2a6223d0ea8008d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/0934b44a86d4c43e416674e80cd6c94044cd23b3", - "reference": "0934b44a86d4c43e416674e80cd6c94044cd23b3", + "url": "https://api.github.com/repos/composer/composer/zipball/cbee637510037f293e641857b2a6223d0ea8008d", + "reference": "cbee637510037f293e641857b2a6223d0ea8008d", "shasum": "" }, "require": { @@ -598,7 +598,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/composer/issues", - "source": "https://github.com/composer/composer/tree/2.0.5" + "source": "https://github.com/composer/composer/tree/2.0.7" }, "funding": [ { @@ -614,20 +614,20 @@ "type": "tidelift" } ], - "time": "2020-11-06T19:57:15+00:00" + "time": "2020-11-13T16:31:06+00:00" }, { "name": "composer/package-versions-deprecated", - "version": "1.11.99", + "version": "1.11.99.1", "source": { "type": "git", "url": "https://github.com/composer/package-versions-deprecated.git", - "reference": "c8c9aa8a14cc3d3bec86d0a8c3fa52ea79936855" + "reference": "7413f0b55a051e89485c5cb9f765fe24bb02a7b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/c8c9aa8a14cc3d3bec86d0a8c3fa52ea79936855", - "reference": "c8c9aa8a14cc3d3bec86d0a8c3fa52ea79936855", + "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/7413f0b55a051e89485c5cb9f765fe24bb02a7b6", + "reference": "7413f0b55a051e89485c5cb9f765fe24bb02a7b6", "shasum": "" }, "require": { @@ -671,7 +671,7 @@ "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", "support": { "issues": "https://github.com/composer/package-versions-deprecated/issues", - "source": "https://github.com/composer/package-versions-deprecated/tree/master" + "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.1" }, "funding": [ { @@ -687,27 +687,27 @@ "type": "tidelift" } ], - "time": "2020-08-25T05:50:16+00:00" + "time": "2020-11-11T10:22:58+00:00" }, { "name": "composer/semver", - "version": "3.2.2", + "version": "3.2.4", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "4089fddb67bcf6bf860d91b979e95be303835002" + "reference": "a02fdf930a3c1c3ed3a49b5f63859c0c20e10464" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/4089fddb67bcf6bf860d91b979e95be303835002", - "reference": "4089fddb67bcf6bf860d91b979e95be303835002", + "url": "https://api.github.com/repos/composer/semver/zipball/a02fdf930a3c1c3ed3a49b5f63859c0c20e10464", + "reference": "a02fdf930a3c1c3ed3a49b5f63859c0c20e10464", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpstan/phpstan": "^0.12.19", + "phpstan/phpstan": "^0.12.54", "symfony/phpunit-bridge": "^4.2 || ^5" }, "type": "library", @@ -752,7 +752,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.2.2" + "source": "https://github.com/composer/semver/tree/3.2.4" }, "funding": [ { @@ -768,7 +768,7 @@ "type": "tidelift" } ], - "time": "2020-10-14T08:51:15+00:00" + "time": "2020-11-13T08:59:24+00:00" }, { "name": "composer/spdx-licenses", @@ -851,16 +851,16 @@ }, { "name": "composer/xdebug-handler", - "version": "1.4.4", + "version": "1.4.5", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "6e076a124f7ee146f2487554a94b6a19a74887ba" + "reference": "f28d44c286812c714741478d968104c5e604a1d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/6e076a124f7ee146f2487554a94b6a19a74887ba", - "reference": "6e076a124f7ee146f2487554a94b6a19a74887ba", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/f28d44c286812c714741478d968104c5e604a1d4", + "reference": "f28d44c286812c714741478d968104c5e604a1d4", "shasum": "" }, "require": { @@ -894,7 +894,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/1.4.4" + "source": "https://github.com/composer/xdebug-handler/tree/1.4.5" }, "funding": [ { @@ -910,7 +910,7 @@ "type": "tidelift" } ], - "time": "2020-10-24T12:39:10+00:00" + "time": "2020-11-13T08:04:11+00:00" }, { "name": "czproject/git-php", @@ -1097,16 +1097,16 @@ }, { "name": "doctrine/dbal", - "version": "2.12.0", + "version": "2.12.1", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "c6d37b4c42aaa3c3ee175f05eca68056f4185646" + "reference": "adce7a954a1c2f14f85e94aed90c8489af204086" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/c6d37b4c42aaa3c3ee175f05eca68056f4185646", - "reference": "c6d37b4c42aaa3c3ee175f05eca68056f4185646", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/adce7a954a1c2f14f85e94aed90c8489af204086", + "reference": "adce7a954a1c2f14f85e94aed90c8489af204086", "shasum": "" }, "require": { @@ -1188,7 +1188,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/2.12.0" + "source": "https://github.com/doctrine/dbal/tree/2.12.1" }, "funding": [ { @@ -1204,7 +1204,7 @@ "type": "tidelift" } ], - "time": "2020-10-22T17:26:24+00:00" + "time": "2020-11-14T20:26:58+00:00" }, { "name": "doctrine/event-manager", @@ -1535,16 +1535,16 @@ }, { "name": "egulias/email-validator", - "version": "2.1.23", + "version": "2.1.24", "source": { "type": "git", "url": "https://github.com/egulias/EmailValidator.git", - "reference": "5fa792ad1853ae2bc60528dd3e5cbf4542d3c1df" + "reference": "ca90a3291eee1538cd48ff25163240695bd95448" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/5fa792ad1853ae2bc60528dd3e5cbf4542d3c1df", - "reference": "5fa792ad1853ae2bc60528dd3e5cbf4542d3c1df", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/ca90a3291eee1538cd48ff25163240695bd95448", + "reference": "ca90a3291eee1538cd48ff25163240695bd95448", "shasum": "" }, "require": { @@ -1591,9 +1591,15 @@ ], "support": { "issues": "https://github.com/egulias/EmailValidator/issues", - "source": "https://github.com/egulias/EmailValidator/tree/2.1.23" + "source": "https://github.com/egulias/EmailValidator/tree/2.1.24" }, - "time": "2020-10-31T20:37:35+00:00" + "funding": [ + { + "url": "https://github.com/egulias", + "type": "github" + } + ], + "time": "2020-11-14T15:56:27+00:00" }, { "name": "fedeisas/laravel-mail-css-inliner", @@ -1824,16 +1830,16 @@ }, { "name": "google/apiclient", - "version": "v2.8.1", + "version": "v2.8.3", "source": { "type": "git", "url": "https://github.com/googleapis/google-api-php-client.git", - "reference": "c8f6d09f50f859fa9457104bb0fb72c893804ede" + "reference": "81696e6206322e38c643cfcc96c4494ccfef8a32" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client/zipball/c8f6d09f50f859fa9457104bb0fb72c893804ede", - "reference": "c8f6d09f50f859fa9457104bb0fb72c893804ede", + "url": "https://api.github.com/repos/googleapis/google-api-php-client/zipball/81696e6206322e38c643cfcc96c4494ccfef8a32", + "reference": "81696e6206322e38c643cfcc96c4494ccfef8a32", "shasum": "" }, "require": { @@ -1887,22 +1893,22 @@ ], "support": { "issues": "https://github.com/googleapis/google-api-php-client/issues", - "source": "https://github.com/googleapis/google-api-php-client/tree/v2.8.1" + "source": "https://github.com/googleapis/google-api-php-client/tree/v2.8.3" }, - "time": "2020-10-27T23:20:13+00:00" + "time": "2020-11-17T17:33:35+00:00" }, { "name": "google/apiclient-services", - "version": "v0.153", + "version": "v0.154", "source": { "type": "git", "url": "https://github.com/googleapis/google-api-php-client-services.git", - "reference": "db62bb19f32f81c9551f223c72be0682eb58ebd8" + "reference": "7f44a314836c444b7894d648c1c49f83fb9d37ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/db62bb19f32f81c9551f223c72be0682eb58ebd8", - "reference": "db62bb19f32f81c9551f223c72be0682eb58ebd8", + "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/7f44a314836c444b7894d648c1c49f83fb9d37ca", + "reference": "7f44a314836c444b7894d648c1c49f83fb9d37ca", "shasum": "" }, "require": { @@ -1928,9 +1934,9 @@ ], "support": { "issues": "https://github.com/googleapis/google-api-php-client-services/issues", - "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.153" + "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.154" }, - "time": "2020-11-01T00:25:23+00:00" + "time": "2020-11-19T19:01:11+00:00" }, { "name": "google/auth", @@ -2287,6 +2293,54 @@ }, "time": "2020-09-30T07:37:11+00:00" }, + { + "name": "halaxa/json-machine", + "version": "0.4.0", + "source": { + "type": "git", + "url": "https://github.com/halaxa/json-machine.git", + "reference": "b99d7a9a1efc8ba633da4581cf079b3a6f1ed219" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/halaxa/json-machine/zipball/b99d7a9a1efc8ba633da4581cf079b3a6f1ed219", + "reference": "b99d7a9a1efc8ba633da4581cf079b3a6f1ed219", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "ext-json": "*", + "guzzlehttp/guzzle": "^6", + "phpunit/phpunit": "^5.7.27" + }, + "type": "library", + "autoload": { + "psr-4": { + "JsonMachine\\": "src/" + }, + "files": [ + "src/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Filip Halaxa", + "email": "filip@halaxa.cz" + } + ], + "description": "Efficient, easy-to-use and fast JSON pull parser", + "support": { + "issues": "https://github.com/halaxa/json-machine/issues", + "source": "https://github.com/halaxa/json-machine/tree/0.4.0" + }, + "time": "2020-11-09T13:28:55+00:00" + }, { "name": "hashids/hashids", "version": "3.0.0", @@ -2662,16 +2716,16 @@ }, { "name": "laravel/framework", - "version": "v8.13.0", + "version": "v8.15.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "37a0abd4f3dbc51e2256296b45f8be72c8fe2196" + "reference": "22e4182fa0885dea3772106c3b6df705b7c7363e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/37a0abd4f3dbc51e2256296b45f8be72c8fe2196", - "reference": "37a0abd4f3dbc51e2256296b45f8be72c8fe2196", + "url": "https://api.github.com/repos/laravel/framework/zipball/22e4182fa0885dea3772106c3b6df705b7c7363e", + "reference": "22e4182fa0885dea3772106c3b6df705b7c7363e", "shasum": "" }, "require": { @@ -2745,7 +2799,7 @@ }, "require-dev": { "aws/aws-sdk-php": "^3.0", - "doctrine/dbal": "^2.6", + "doctrine/dbal": "^2.6|^3.0", "filp/whoops": "^2.8", "guzzlehttp/guzzle": "^6.5.5|^7.0.1", "league/flysystem-cached-adapter": "^1.0", @@ -2758,7 +2812,7 @@ }, "suggest": { "aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage and SES mail driver (^3.0).", - "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6).", + "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6|^3.0).", "ext-ftp": "Required to use the Flysystem FTP driver.", "ext-gd": "Required to use Illuminate\\Http\\Testing\\FileFactory::image().", "ext-memcached": "Required to use the memcache cache driver.", @@ -2825,7 +2879,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2020-11-03T14:13:19+00:00" + "time": "2020-11-17T14:53:20+00:00" }, { "name": "laravel/slack-notification-channel", @@ -3451,28 +3505,28 @@ }, { "name": "league/glide", - "version": "1.6.0", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/thephpleague/glide.git", - "reference": "8759b8edfe953c8e6aceb45b3647fb7ae5349a0c" + "reference": "ae5e26700573cb678919d28e425a8b87bc71c546" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/glide/zipball/8759b8edfe953c8e6aceb45b3647fb7ae5349a0c", - "reference": "8759b8edfe953c8e6aceb45b3647fb7ae5349a0c", + "url": "https://api.github.com/repos/thephpleague/glide/zipball/ae5e26700573cb678919d28e425a8b87bc71c546", + "reference": "ae5e26700573cb678919d28e425a8b87bc71c546", "shasum": "" }, "require": { "intervention/image": "^2.4", "league/flysystem": "^1.0", - "php": "^7.2", + "php": "^7.2|^8.0", "psr/http-message": "^1.0" }, "require-dev": { - "mockery/mockery": "^1.2", - "phpunit/php-token-stream": "^3.1", - "phpunit/phpunit": "^8.5" + "mockery/mockery": "^1.3.3", + "phpunit/php-token-stream": "^3.1|^4.0", + "phpunit/phpunit": "^8.5|^9.0" }, "type": "library", "extra": { @@ -3510,9 +3564,9 @@ ], "support": { "issues": "https://github.com/thephpleague/glide/issues", - "source": "https://github.com/thephpleague/glide/tree/1.6.0" + "source": "https://github.com/thephpleague/glide/tree/1.7.0" }, - "time": "2020-07-07T12:23:45+00:00" + "time": "2020-11-05T17:34:03+00:00" }, { "name": "league/mime-type-detection", @@ -4077,16 +4131,16 @@ }, { "name": "myclabs/php-enum", - "version": "1.7.6", + "version": "1.7.7", "source": { "type": "git", "url": "https://github.com/myclabs/php-enum.git", - "reference": "5f36467c7a87e20fbdc51e524fd8f9d1de80187c" + "reference": "d178027d1e679832db9f38248fcc7200647dc2b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/php-enum/zipball/5f36467c7a87e20fbdc51e524fd8f9d1de80187c", - "reference": "5f36467c7a87e20fbdc51e524fd8f9d1de80187c", + "url": "https://api.github.com/repos/myclabs/php-enum/zipball/d178027d1e679832db9f38248fcc7200647dc2b7", + "reference": "d178027d1e679832db9f38248fcc7200647dc2b7", "shasum": "" }, "require": { @@ -4121,9 +4175,19 @@ ], "support": { "issues": "https://github.com/myclabs/php-enum/issues", - "source": "https://github.com/myclabs/php-enum/tree/master" + "source": "https://github.com/myclabs/php-enum/tree/1.7.7" }, - "time": "2020-02-14T08:15:52+00:00" + "funding": [ + { + "url": "https://github.com/mnapoli", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/php-enum", + "type": "tidelift" + } + ], + "time": "2020-11-14T18:14:52+00:00" }, { "name": "nesbot/carbon", @@ -4834,21 +4898,21 @@ }, { "name": "php-http/message", - "version": "1.9.1", + "version": "1.10.0", "source": { "type": "git", "url": "https://github.com/php-http/message.git", - "reference": "09f3f13af3a1a4273ecbf8e6b27248c002a3db29" + "reference": "39db36d5972e9e6d00ea852b650953f928d8f10d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/message/zipball/09f3f13af3a1a4273ecbf8e6b27248c002a3db29", - "reference": "09f3f13af3a1a4273ecbf8e6b27248c002a3db29", + "url": "https://api.github.com/repos/php-http/message/zipball/39db36d5972e9e6d00ea852b650953f928d8f10d", + "reference": "39db36d5972e9e6d00ea852b650953f928d8f10d", "shasum": "" }, "require": { - "clue/stream-filter": "^1.4.1", - "php": "^7.1", + "clue/stream-filter": "^1.5", + "php": "^7.1 || ^8.0", "php-http/message-factory": "^1.0.2", "psr/http-message": "^1.0" }, @@ -4856,13 +4920,10 @@ "php-http/message-factory-implementation": "1.0" }, "require-dev": { - "akeneo/phpspec-skip-example-extension": "^1.0", - "coduo/phpspec-data-provider-extension": "^1.0", - "ergebnis/composer-normalize": "^2.1", + "ergebnis/composer-normalize": "^2.6", "ext-zlib": "*", "guzzlehttp/psr7": "^1.0", - "henrikbjorn/phpspec-code-coverage": "^1.0", - "phpspec/phpspec": "^2.4", + "phpspec/phpspec": "^5.1 || ^6.3", "slim/slim": "^3.0", "zendframework/zend-diactoros": "^1.0" }, @@ -4875,7 +4936,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.10-dev" } }, "autoload": { @@ -4905,9 +4966,9 @@ ], "support": { "issues": "https://github.com/php-http/message/issues", - "source": "https://github.com/php-http/message/tree/1.9.1" + "source": "https://github.com/php-http/message/tree/1.10.0" }, - "time": "2020-10-13T06:21:08+00:00" + "time": "2020-11-11T10:19:56+00:00" }, { "name": "php-http/message-factory", @@ -6152,16 +6213,16 @@ }, { "name": "seld/jsonlint", - "version": "1.8.2", + "version": "1.8.3", "source": { "type": "git", "url": "https://github.com/Seldaek/jsonlint.git", - "reference": "590cfec960b77fd55e39b7d9246659e95dd6d337" + "reference": "9ad6ce79c342fbd44df10ea95511a1b24dee5b57" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/590cfec960b77fd55e39b7d9246659e95dd6d337", - "reference": "590cfec960b77fd55e39b7d9246659e95dd6d337", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/9ad6ce79c342fbd44df10ea95511a1b24dee5b57", + "reference": "9ad6ce79c342fbd44df10ea95511a1b24dee5b57", "shasum": "" }, "require": { @@ -6199,7 +6260,7 @@ ], "support": { "issues": "https://github.com/Seldaek/jsonlint/issues", - "source": "https://github.com/Seldaek/jsonlint/tree/master" + "source": "https://github.com/Seldaek/jsonlint/tree/1.8.3" }, "funding": [ { @@ -6211,7 +6272,7 @@ "type": "tidelift" } ], - "time": "2020-08-25T06:56:57+00:00" + "time": "2020-11-11T09:19:24+00:00" }, { "name": "seld/phar-utils", @@ -6508,27 +6569,27 @@ }, { "name": "spatie/browsershot", - "version": "3.40.1", + "version": "3.41.0", "source": { "type": "git", "url": "https://github.com/spatie/browsershot.git", - "reference": "7793556fdacaff56fcc45b0e45bb9f0f72a50803" + "reference": "2cc87d4dad788b372549cf856c773a7e5a8fcace" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/browsershot/zipball/7793556fdacaff56fcc45b0e45bb9f0f72a50803", - "reference": "7793556fdacaff56fcc45b0e45bb9f0f72a50803", + "url": "https://api.github.com/repos/spatie/browsershot/zipball/2cc87d4dad788b372549cf856c773a7e5a8fcace", + "reference": "2cc87d4dad788b372549cf856c773a7e5a8fcace", "shasum": "" }, "require": { - "php": "^7.1", + "php": "^7.4|^8.0", "spatie/image": "^1.5.3", "spatie/temporary-directory": "^1.1", - "symfony/process": "^4.2|^5.0" + "symfony/process": "^5.0" }, "require-dev": { - "phpunit/phpunit": "^6.1|^7.5", - "spatie/phpunit-snapshot-assertions": "^1.0" + "phpunit/phpunit": "^9.0", + "spatie/phpunit-snapshot-assertions": "^4.2.3" }, "type": "library", "autoload": { @@ -6562,7 +6623,7 @@ ], "support": { "issues": "https://github.com/spatie/browsershot/issues", - "source": "https://github.com/spatie/browsershot/tree/3.40.1" + "source": "https://github.com/spatie/browsershot/tree/3.41.0" }, "funding": [ { @@ -6570,35 +6631,34 @@ "type": "github" } ], - "time": "2020-11-06T09:19:20+00:00" + "time": "2020-11-18T08:51:42+00:00" }, { "name": "spatie/image", - "version": "1.7.6", + "version": "1.9.0", "source": { "type": "git", "url": "https://github.com/spatie/image.git", - "reference": "74535b5fd67ace75840c00c408666660843e755e" + "reference": "cef42a2d131e28d6f3e0af91c0570f6ba45a8d40" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/image/zipball/74535b5fd67ace75840c00c408666660843e755e", - "reference": "74535b5fd67ace75840c00c408666660843e755e", + "url": "https://api.github.com/repos/spatie/image/zipball/cef42a2d131e28d6f3e0af91c0570f6ba45a8d40", + "reference": "cef42a2d131e28d6f3e0af91c0570f6ba45a8d40", "shasum": "" }, "require": { "ext-exif": "*", "ext-mbstring": "*", "league/glide": "^1.4", - "php": "^7.0", - "spatie/image-optimizer": "^1.0", + "php": "^7.2|^8.0", + "spatie/image-optimizer": "^1.1", "spatie/temporary-directory": "^1.0.0", "symfony/process": "^3.0|^4.0|^5.0" }, "require-dev": { - "larapack/dd": "^1.1", - "phpunit/phpunit": "^6.0|^7.0", - "symfony/var-dumper": "^3.2|^5.0" + "phpunit/phpunit": "^8.0|^9.0", + "symfony/var-dumper": "^4.0|^5.0" }, "type": "library", "autoload": { @@ -6626,32 +6686,42 @@ ], "support": { "issues": "https://github.com/spatie/image/issues", - "source": "https://github.com/spatie/image/tree/master" + "source": "https://github.com/spatie/image/tree/1.9.0" }, - "time": "2020-01-26T18:56:44+00:00" + "funding": [ + { + "url": "https://spatie.be/open-source/support-us", + "type": "custom" + }, + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2020-11-13T09:39:41+00:00" }, { "name": "spatie/image-optimizer", - "version": "1.2.1", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/spatie/image-optimizer.git", - "reference": "9c1d470e34b28b715d25edb539dd6c899461527c" + "reference": "b622d0cf29f57d7735d49f2b62471e6b788cb291" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/image-optimizer/zipball/9c1d470e34b28b715d25edb539dd6c899461527c", - "reference": "9c1d470e34b28b715d25edb539dd6c899461527c", + "url": "https://api.github.com/repos/spatie/image-optimizer/zipball/b622d0cf29f57d7735d49f2b62471e6b788cb291", + "reference": "b622d0cf29f57d7735d49f2b62471e6b788cb291", "shasum": "" }, "require": { "ext-fileinfo": "*", - "php": "^7.2", + "php": "^7.2|^8.0", "psr/log": "^1.0", "symfony/process": "^4.2|^5.0" }, "require-dev": { - "phpunit/phpunit": "^8.0", + "phpunit/phpunit": "^8.0|^9.0", "symfony/var-dumper": "^4.2|^5.0" }, "type": "library", @@ -6680,29 +6750,29 @@ ], "support": { "issues": "https://github.com/spatie/image-optimizer/issues", - "source": "https://github.com/spatie/image-optimizer/tree/master" + "source": "https://github.com/spatie/image-optimizer/tree/1.3.1" }, - "time": "2019-11-25T12:29:24+00:00" + "time": "2020-11-20T11:36:11+00:00" }, { "name": "spatie/temporary-directory", - "version": "1.2.4", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/spatie/temporary-directory.git", - "reference": "8efe8e61e0ca943d84341f10e51ef3a9606af932" + "reference": "f517729b3793bca58f847c5fd383ec16f03ffec6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/temporary-directory/zipball/8efe8e61e0ca943d84341f10e51ef3a9606af932", - "reference": "8efe8e61e0ca943d84341f10e51ef3a9606af932", + "url": "https://api.github.com/repos/spatie/temporary-directory/zipball/f517729b3793bca58f847c5fd383ec16f03ffec6", + "reference": "f517729b3793bca58f847c5fd383ec16f03ffec6", "shasum": "" }, "require": { - "php": "^7.2" + "php": "^7.2|^8.0" }, "require-dev": { - "phpunit/phpunit": "^8.0" + "phpunit/phpunit": "^8.0|^9.0" }, "type": "library", "autoload": { @@ -6725,36 +6795,36 @@ "description": "Easily create, use and destroy temporary directories", "homepage": "https://github.com/spatie/temporary-directory", "keywords": [ + "php", "spatie", "temporary-directory" ], "support": { "issues": "https://github.com/spatie/temporary-directory/issues", - "source": "https://github.com/spatie/temporary-directory/tree/master" + "source": "https://github.com/spatie/temporary-directory/tree/1.3.0" }, - "time": "2020-09-07T20:41:15+00:00" + "time": "2020-11-09T15:54:21+00:00" }, { "name": "staudenmeir/eloquent-has-many-deep", - "version": "v1.13", + "version": "v1.13.1", "source": { "type": "git", "url": "https://github.com/staudenmeir/eloquent-has-many-deep.git", - "reference": "6ba7af2a83e263bd27ee4e65fafabf89c2efcb26" + "reference": "c0c9b6bd5c39d08e8adddc7eb8625962bd67a3da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/staudenmeir/eloquent-has-many-deep/zipball/6ba7af2a83e263bd27ee4e65fafabf89c2efcb26", - "reference": "6ba7af2a83e263bd27ee4e65fafabf89c2efcb26", + "url": "https://api.github.com/repos/staudenmeir/eloquent-has-many-deep/zipball/c0c9b6bd5c39d08e8adddc7eb8625962bd67a3da", + "reference": "c0c9b6bd5c39d08e8adddc7eb8625962bd67a3da", "shasum": "" }, "require": { "illuminate/database": "^8.0", - "php": "^7.3" + "php": "^7.3|^8.0" }, "require-dev": { "illuminate/pagination": "^8.0", - "laravel/homestead": "^11.0", "phpunit/phpunit": "^9.3", "staudenmeir/eloquent-eager-limit": "^1.6" }, @@ -6777,7 +6847,7 @@ "description": "Laravel Eloquent HasManyThrough relationships with unlimited levels", "support": { "issues": "https://github.com/staudenmeir/eloquent-has-many-deep/issues", - "source": "https://github.com/staudenmeir/eloquent-has-many-deep/tree/v1.13" + "source": "https://github.com/staudenmeir/eloquent-has-many-deep/tree/v1.13.1" }, "funding": [ { @@ -6785,20 +6855,20 @@ "type": "custom" } ], - "time": "2020-08-19T20:13:24+00:00" + "time": "2020-11-22T18:51:29+00:00" }, { "name": "stripe/stripe-php", - "version": "v7.61.0", + "version": "v7.65.0", "source": { "type": "git", "url": "https://github.com/stripe/stripe-php.git", - "reference": "51c6cd18cb51740101c940a3fefc876ef7cd8cae" + "reference": "d4a22eeec7654efb8476fe8bea95b1e9928025a6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/stripe/stripe-php/zipball/51c6cd18cb51740101c940a3fefc876ef7cd8cae", - "reference": "51c6cd18cb51740101c940a3fefc876ef7cd8cae", + "url": "https://api.github.com/repos/stripe/stripe-php/zipball/d4a22eeec7654efb8476fe8bea95b1e9928025a6", + "reference": "d4a22eeec7654efb8476fe8bea95b1e9928025a6", "shasum": "" }, "require": { @@ -6808,7 +6878,7 @@ "php": ">=5.6.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "2.16.1", + "friendsofphp/php-cs-fixer": "2.16.5", "php-coveralls/php-coveralls": "^2.1", "phpunit/phpunit": "^5.7", "squizlabs/php_codesniffer": "^3.3", @@ -6844,9 +6914,9 @@ ], "support": { "issues": "https://github.com/stripe/stripe-php/issues", - "source": "https://github.com/stripe/stripe-php/tree/v7.61.0" + "source": "https://github.com/stripe/stripe-php/tree/v7.65.0" }, - "time": "2020-10-20T20:01:45+00:00" + "time": "2020-11-19T19:37:25+00:00" }, { "name": "swiftmailer/swiftmailer", @@ -9629,23 +9699,23 @@ }, { "name": "voku/portable-ascii", - "version": "1.5.3", + "version": "1.5.6", "source": { "type": "git", "url": "https://github.com/voku/portable-ascii.git", - "reference": "25bcbf01678930251fd572891447d9e318a6e2b8" + "reference": "80953678b19901e5165c56752d087fc11526017c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/voku/portable-ascii/zipball/25bcbf01678930251fd572891447d9e318a6e2b8", - "reference": "25bcbf01678930251fd572891447d9e318a6e2b8", + "url": "https://api.github.com/repos/voku/portable-ascii/zipball/80953678b19901e5165c56752d087fc11526017c", + "reference": "80953678b19901e5165c56752d087fc11526017c", "shasum": "" }, "require": { "php": ">=7.0.0" }, "require-dev": { - "phpunit/phpunit": "~6.0 || ~7.0" + "phpunit/phpunit": "~6.0 || ~7.0 || ~9.0" }, "suggest": { "ext-intl": "Use Intl for transliterator_transliterate() support" @@ -9675,7 +9745,7 @@ ], "support": { "issues": "https://github.com/voku/portable-ascii/issues", - "source": "https://github.com/voku/portable-ascii/tree/master" + "source": "https://github.com/voku/portable-ascii/tree/1.5.6" }, "funding": [ { @@ -9699,7 +9769,7 @@ "type": "tidelift" } ], - "time": "2020-07-22T23:32:04+00:00" + "time": "2020-11-12T00:07:28+00:00" }, { "name": "webpatser/laravel-countries", @@ -10364,36 +10434,31 @@ }, { "name": "doctrine/instantiator", - "version": "1.3.1", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "f350df0268e904597e3bd9c4685c53e0e333feea" + "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f350df0268e904597e3bd9c4685c53e0e333feea", - "reference": "f350df0268e904597e3bd9c4685c53e0e333feea", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", + "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^6.0", + "doctrine/coding-standard": "^8.0", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.13", - "phpstan/phpstan-phpunit": "^0.11", - "phpstan/phpstan-shim": "^0.11", - "phpunit/phpunit": "^7.0" + "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, "autoload": { "psr-4": { "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" @@ -10407,7 +10472,7 @@ { "name": "Marco Pivetta", "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" + "homepage": "https://ocramius.github.io/" } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", @@ -10418,7 +10483,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.3.x" + "source": "https://github.com/doctrine/instantiator/tree/1.4.0" }, "funding": [ { @@ -10434,7 +10499,7 @@ "type": "tidelift" } ], - "time": "2020-05-29T17:27:14+00:00" + "time": "2020-11-10T18:47:58+00:00" }, { "name": "facade/flare-client-php", @@ -10503,16 +10568,16 @@ }, { "name": "facade/ignition", - "version": "2.5.0", + "version": "2.5.2", "source": { "type": "git", "url": "https://github.com/facade/ignition.git", - "reference": "81698c5e32837c74abf9bb764ff0c1b3e001afb3" + "reference": "08668034beb185fa2ac6f09b1034eaa440952ace" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/facade/ignition/zipball/81698c5e32837c74abf9bb764ff0c1b3e001afb3", - "reference": "81698c5e32837c74abf9bb764ff0c1b3e001afb3", + "url": "https://api.github.com/repos/facade/ignition/zipball/08668034beb185fa2ac6f09b1034eaa440952ace", + "reference": "08668034beb185fa2ac6f09b1034eaa440952ace", "shasum": "" }, "require": { @@ -10576,7 +10641,7 @@ "issues": "https://github.com/facade/ignition/issues", "source": "https://github.com/facade/ignition" }, - "time": "2020-10-27T13:02:22+00:00" + "time": "2020-11-17T09:18:51+00:00" }, { "name": "facade/ignition-contracts", @@ -10987,16 +11052,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.10.1", + "version": "1.10.2", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5" + "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", - "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", + "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", "shasum": "" }, "require": { @@ -11033,7 +11098,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.x" + "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" }, "funding": [ { @@ -11041,7 +11106,7 @@ "type": "tidelift" } ], - "time": "2020-06-29T13:22:24+00:00" + "time": "2020-11-13T09:40:50+00:00" }, { "name": "netresearch/jsonmapper", @@ -11891,16 +11956,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.4.2", + "version": "9.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "3866b2eeeed21b1b099c4bc0b7a1690ac6fd5baa" + "reference": "9fa359ff5ddaa5eb2be2bedb08a6a5787a5807ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3866b2eeeed21b1b099c4bc0b7a1690ac6fd5baa", - "reference": "3866b2eeeed21b1b099c4bc0b7a1690ac6fd5baa", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9fa359ff5ddaa5eb2be2bedb08a6a5787a5807ab", + "reference": "9fa359ff5ddaa5eb2be2bedb08a6a5787a5807ab", "shasum": "" }, "require": { @@ -11978,7 +12043,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.4.2" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.4.3" }, "funding": [ { @@ -11990,7 +12055,7 @@ "type": "github" } ], - "time": "2020-10-19T09:23:29+00:00" + "time": "2020-11-10T12:53:30+00:00" }, { "name": "sebastian/cli-parser", @@ -12958,16 +13023,16 @@ }, { "name": "swagger-api/swagger-ui", - "version": "v3.36.2", + "version": "v3.37.0", "source": { "type": "git", "url": "https://github.com/swagger-api/swagger-ui.git", - "reference": "69518cf5e5554b3d7fa731892efe1f05a60682f9" + "reference": "f0b7e7b0412d89b20a3f7def8397b60ca2ee5041" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swagger-api/swagger-ui/zipball/69518cf5e5554b3d7fa731892efe1f05a60682f9", - "reference": "69518cf5e5554b3d7fa731892efe1f05a60682f9", + "url": "https://api.github.com/repos/swagger-api/swagger-ui/zipball/f0b7e7b0412d89b20a3f7def8397b60ca2ee5041", + "reference": "f0b7e7b0412d89b20a3f7def8397b60ca2ee5041", "shasum": "" }, "type": "library", @@ -13013,9 +13078,9 @@ ], "support": { "issues": "https://github.com/swagger-api/swagger-ui/issues", - "source": "https://github.com/swagger-api/swagger-ui/tree/v3.36.2" + "source": "https://github.com/swagger-api/swagger-ui/tree/v3.37.0" }, - "time": "2020-11-06T17:40:21+00:00" + "time": "2020-11-19T23:36:32+00:00" }, { "name": "symfony/debug", @@ -13213,16 +13278,16 @@ }, { "name": "vimeo/psalm", - "version": "4.1.1", + "version": "4.2.1", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "16bfbd9224698bd738c665f33039fade2a1a3977" + "reference": "ea9cb72143b77e7520c52fa37290bd8d8bc88fd9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/16bfbd9224698bd738c665f33039fade2a1a3977", - "reference": "16bfbd9224698bd738c665f33039fade2a1a3977", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/ea9cb72143b77e7520c52fa37290bd8d8bc88fd9", + "reference": "ea9cb72143b77e7520c52fa37290bd8d8bc88fd9", "shasum": "" }, "require": { @@ -13312,9 +13377,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/4.1.1" + "source": "https://github.com/vimeo/psalm/tree/4.2.1" }, - "time": "2020-11-02T05:54:12+00:00" + "time": "2020-11-20T14:56:53+00:00" }, { "name": "webmozart/assert", diff --git a/config/queue.php b/config/queue.php index b706b148f..6fb44cc4f 100644 --- a/config/queue.php +++ b/config/queue.php @@ -38,14 +38,14 @@ return [ 'driver' => 'database', 'table' => 'jobs', 'queue' => 'default', - 'retry_after' => 90, + 'retry_after' => 90000000, ], 'beanstalkd' => [ 'driver' => 'beanstalkd', 'host' => 'localhost', 'queue' => 'default', - 'retry_after' => 90, + 'retry_after' => 90000000, 'block_for' => 0, ], @@ -63,7 +63,7 @@ return [ 'driver' => 'redis', 'connection' => 'default', 'queue' => env('REDIS_QUEUE', 'default'), - 'retry_after' => 90, + 'retry_after' => 90000000, 'block_for' => null, ], diff --git a/resources/views/index/index.blade.php b/resources/views/index/index.blade.php index b22de8319..5c629c810 100644 --- a/resources/views/index/index.blade.php +++ b/resources/views/index/index.blade.php @@ -95,6 +95,55 @@ document.addEventListener('DOMContentLoaded', function(event) { document.getElementById('loader').style.display = 'none'; }); + + /* + function invokeServiceWorkerUpdateFlow() { + // you have a better UI here, reloading is not a great user experince here. + const confirmed = confirm('New version of the app is available. Refresh now'); + if (confirmed) { + window.location.reload(); + } + } + async function handleServiceWorker() { + if ('serviceWorker' in navigator) { + // get the ServiceWorkerRegistration instance + const registration = await navigator.serviceWorker.getRegistration(); + // (it is also returned from navigator.serviceWorker.register() function) + + if (registration) { + // detect Service Worker update available and wait for it to become installed + registration.addEventListener('updatefound', () => { + if (registration.installing) { + // wait until the new Service worker is actually installed (ready to take over) + registration.installing.addEventListener('statechange', () => { + if (registration.waiting) { + // if there's an existing controller (previous Service Worker), show the prompt + if (navigator.serviceWorker.controller) { + invokeServiceWorkerUpdateFlow(registration); + } else { + // otherwise it's the first install, nothing to do + console.log('Service Worker initialized for the first time'); + } + } + }); + } + }); + + let refreshing = false; + + // detect controller change and refresh the page + navigator.serviceWorker.addEventListener('controllerchange', () => { + if (!refreshing) { + window.location.reload(); + refreshing = true; + } + }); + } + } + } + + handleServiceWorker(); + */ diff --git a/tests/Unit/GeneratesCounterTest.php b/tests/Unit/GeneratesCounterTest.php index 25980d120..2528f7799 100644 --- a/tests/Unit/GeneratesCounterTest.php +++ b/tests/Unit/GeneratesCounterTest.php @@ -167,21 +167,21 @@ class GeneratesCounterTest extends TestCase public function testInvoiceClientNumberPattern() { $settings = $this->company->settings; - $settings->client_number_pattern = '{$year}-{$clientCounter}'; + $settings->client_number_pattern = '{$year}-{$client_counter}'; $settings->client_number_counter = 10; $this->company->settings = $settings; $this->company->save(); $settings = $this->client->settings; - $settings->client_number_pattern = '{$year}-{$clientCounter}'; + $settings->client_number_pattern = '{$year}-{$client_counter}'; $settings->client_number_counter = 10; $this->client->settings = $settings; $this->client->save(); $this->client->fresh(); $this->assertEquals($this->client->settings->client_number_counter, 10); - $this->assertEquals($this->client->getSetting('client_number_pattern'), '{$year}-{$clientCounter}'); + $this->assertEquals($this->client->getSetting('client_number_pattern'), '{$year}-{$client_counter}'); $invoice_number = $this->getNextClientNumber($this->client);