diff --git a/.env.example b/.env.example index 2a6eb900debe..b92cf8fae044 100644 --- a/.env.example +++ b/.env.example @@ -52,7 +52,7 @@ TRUSTED_PROXIES= NINJA_ENVIRONMENT=selfhost -PHANTOMJS_CLOUD_KEY='a-demo-key-with-low-quota-per-ip-address' +PHANTOMJS_KEY='a-demo-key-with-low-quota-per-ip-address' PHANTOMJS_SECRET= SELF_UPDATER_REPO_VENDOR = invoiceninja diff --git a/app/Console/Commands/DemoMode.php b/app/Console/Commands/DemoMode.php index f58b9d5bfdd6..4f6600f5acf8 100644 --- a/app/Console/Commands/DemoMode.php +++ b/app/Console/Commands/DemoMode.php @@ -16,6 +16,7 @@ use App\Events\Invoice\InvoiceWasCreated; use App\Factory\InvoiceFactory; use App\Factory\InvoiceItemFactory; use App\Helpers\Invoice\InvoiceSum; +use App\Jobs\Company\CreateCompanyPaymentTerms; use App\Jobs\Ninja\CompanySizeCheck; use App\Jobs\Util\VersionCheck; use App\Models\Account; @@ -173,6 +174,8 @@ class DemoMode extends Command ]); } + CreateCompanyPaymentTerms::dispatchNow($company, $user); + $company_token = new CompanyToken; $company_token->user_id = $user->id; $company_token->company_id = $company->id; @@ -198,7 +201,7 @@ class DemoMode extends Command if (! $u2) { $u2 = User::factory()->create([ 'email' => 'demo@invoiceninja.com', - 'password' => Hash::make('demo'), + 'password' => Hash::make('Password0'), 'account_id' => $account->id, 'confirmation_code' => $this->createDbHash(config('database.default')), ]); diff --git a/app/Console/Commands/ImportMigrations.php b/app/Console/Commands/ImportMigrations.php index c9c891146cd3..54d1adfa9fd0 100644 --- a/app/Console/Commands/ImportMigrations.php +++ b/app/Console/Commands/ImportMigrations.php @@ -112,7 +112,7 @@ class ImportMigrations extends Command public function getCompany(Account $account): Company { - $company = factory(Company::class)->create([ + $company = Company::factory()->create([ 'account_id' => $account->id, ]); diff --git a/app/DataMapper/CompanySettings.php b/app/DataMapper/CompanySettings.php index ca48a17faf4b..647f28975c15 100644 --- a/app/DataMapper/CompanySettings.php +++ b/app/DataMapper/CompanySettings.php @@ -78,6 +78,9 @@ class CompanySettings extends BaseSettings public $invoice_number_pattern = ''; public $invoice_number_counter = 1; + public $recurring_invoice_number_pattern = ''; + public $recurring_invoice_number_counter = 1; + public $quote_number_pattern = ''; public $quote_number_counter = 1; @@ -246,6 +249,8 @@ class CompanySettings extends BaseSettings public $client_portal_allow_over_payment = false; public static $casts = [ + 'recurring_invoice_number_pattern' => 'string', + 'recurring_invoice_number_counter' => 'int', 'client_portal_under_payment_minimum'=> 'float', 'auto_bill_date' => 'string', 'primary_color' => 'string', diff --git a/app/Factory/InvoiceItemFactory.php b/app/Factory/InvoiceItemFactory.php index 16fa0afded39..d370495a9001 100644 --- a/app/Factory/InvoiceItemFactory.php +++ b/app/Factory/InvoiceItemFactory.php @@ -38,6 +38,7 @@ class InvoiceItemFactory $item->custom_value2 = ''; $item->custom_value3 = ''; $item->custom_value4 = ''; + $item->type_id = "1"; return $item; } @@ -68,7 +69,8 @@ class InvoiceItemFactory $item->custom_value4 = $faker->realText(10); $item->tax_name1 = 'GST'; $item->tax_rate1 = 10.00; - + $item->type_id = "1"; + $data[] = $item; } @@ -101,6 +103,7 @@ class InvoiceItemFactory $item->custom_value4 = $faker->realText(10); $item->tax_name1 = 'GST'; $item->tax_rate1 = 10.00; + $item->type_id = "1"; $data[] = $item; } diff --git a/app/Factory/RecurringInvoiceInvitationFactory.php b/app/Factory/RecurringInvoiceInvitationFactory.php new file mode 100644 index 000000000000..fc3e461cfd2b --- /dev/null +++ b/app/Factory/RecurringInvoiceInvitationFactory.php @@ -0,0 +1,38 @@ +company_id = $company_id; + $ii->user_id = $user_id; + $ii->client_contact_id = null; + $ii->recurring_invoice_id = null; + $ii->key = Str::random(config('ninja.key_length')); + $ii->transaction_reference = null; + $ii->message_id = null; + $ii->email_error = ''; + $ii->signature_base64 = ''; + $ii->signature_date = null; + $ii->sent_date = null; + $ii->viewed_date = null; + $ii->opened_date = null; + + return $ii; + } +} diff --git a/app/Http/Controllers/MigrationController.php b/app/Http/Controllers/MigrationController.php index 681f1fa9d084..1556f0d69861 100644 --- a/app/Http/Controllers/MigrationController.php +++ b/app/Http/Controllers/MigrationController.php @@ -270,7 +270,7 @@ class MigrationController extends BaseController // If keys ain't same, but existing company with force. if (! $checks['same_keys'] && $checks['existing_company'] && $checks['with_force']) { - info('Migrating: Different keys, exisiting company with force option.'); + info('Migrating: Different keys, existing company with force option.'); if ($company) { $this->purgeCompany($company); diff --git a/app/Http/Middleware/ContactKeyLogin.php b/app/Http/Middleware/ContactKeyLogin.php index b718f775ae46..4362be0854cb 100644 --- a/app/Http/Middleware/ContactKeyLogin.php +++ b/app/Http/Middleware/ContactKeyLogin.php @@ -33,6 +33,11 @@ class ContactKeyLogin */ public function handle($request, Closure $next) { + info($request->segment(3)); + info($request->route('contact_key')); + + if(Auth::guard('contact')->check()) + Auth::guard('contact')->logout(); if ($request->segment(3) && config('ninja.db.multi_db_enabled')) { diff --git a/app/Http/Requests/RecurringInvoice/StoreRecurringInvoiceRequest.php b/app/Http/Requests/RecurringInvoice/StoreRecurringInvoiceRequest.php index f92ef7dd3dd8..67fb0ef95051 100644 --- a/app/Http/Requests/RecurringInvoice/StoreRecurringInvoiceRequest.php +++ b/app/Http/Requests/RecurringInvoice/StoreRecurringInvoiceRequest.php @@ -97,12 +97,13 @@ class StoreRecurringInvoiceRequest extends Request $input['line_items'] = isset($input['line_items']) ? $this->cleanItems($input['line_items']) : []; - if(isset($input['auto_bill'])) - $input['auto_bill_enabled'] = $this->setAutoBillFlag($input['auto_bill']); - else{ - $client = Client::find($input['client_id']); - $input['auto_bill'] = $client->getSetting('auto_bill'); - } + if(isset($input['auto_bill'])) + $input['auto_bill_enabled'] = $this->setAutoBillFlag($input['auto_bill']); + else{ + + if($client = Client::find($input['client_id'])) + $input['auto_bill'] = $client->getSetting('auto_bill'); + } $this->replace($input); } diff --git a/app/Http/Requests/Vendor/StoreVendorRequest.php b/app/Http/Requests/Vendor/StoreVendorRequest.php index 005fcea8a564..df27f39ea8b6 100644 --- a/app/Http/Requests/Vendor/StoreVendorRequest.php +++ b/app/Http/Requests/Vendor/StoreVendorRequest.php @@ -42,14 +42,6 @@ class StoreVendorRequest extends Request //$rules['settings'] = new ValidVendorGroupSettingsRule(); $rules['contacts.*.email'] = 'nullable|distinct'; - // $contacts = request('contacts'); - - // if (is_array($contacts)) { - // for ($i = 0; $i < count($contacts); $i++) { - - // //$rules['contacts.' . $i . '.email'] = 'nullable|email|distinct'; - // } - // } return $rules; } diff --git a/app/Jobs/Util/Import.php b/app/Jobs/Util/Import.php index f4b667d2133a..10c7911a7059 100644 --- a/app/Jobs/Util/Import.php +++ b/app/Jobs/Util/Import.php @@ -22,6 +22,7 @@ use App\Factory\InvoiceFactory; use App\Factory\PaymentFactory; use App\Factory\ProductFactory; use App\Factory\QuoteFactory; +use App\Factory\RecurringInvoiceFactory; use App\Factory\TaxRateFactory; use App\Factory\UserFactory; use App\Http\Requests\Company\UpdateCompanyRequest; @@ -46,6 +47,7 @@ use App\Models\Payment; use App\Models\PaymentTerm; use App\Models\Product; use App\Models\Quote; +use App\Models\RecurringInvoice; use App\Models\TaxRate; use App\Models\User; use App\Repositories\ClientContactRepository; @@ -99,12 +101,14 @@ class Import implements ShouldQueue 'clients', 'products', 'invoices', + 'recurring_invoices', 'quotes', 'payments', 'credits', 'company_gateways', - //'documents', 'client_gateway_tokens', + + // //'documents', ]; /** @@ -478,6 +482,59 @@ class Import implements ShouldQueue $product_repository = null; } + private function processRecurringInvoices(array $data) :void + { + RecurringInvoice::unguard(); + + $rules = [ + '*.client_id' => ['required'], + ]; + + $validator = Validator::make($data, $rules); + + if ($validator->fails()) { + throw new MigrationValidatorFailed(json_encode($validator->errors())); + } + + $invoice_repository = new InvoiceMigrationRepository(); + + foreach ($data as $key => $resource) { + + $modified = $resource; + + if (array_key_exists('client_id', $resource) && ! array_key_exists('clients', $this->ids)) { + throw new ResourceDependencyMissing('Processing invoices failed, because of missing dependency - clients.'); + } + + $modified['client_id'] = $this->transformId('clients', $resource['client_id']); + $modified['user_id'] = $this->processUserId($resource); + $modified['company_id'] = $this->company->id; + $modified['line_items'] = $this->cleanItems($modified['line_items']); + + unset($modified['id']); + + $invoice = $invoice_repository->save( + $modified, + RecurringInvoiceFactory::create($this->company->id, $modified['user_id']) + ); + + $key = "recurring_invoices_{$resource['id']}"; + + $this->ids['recurring_invoices'][$key] = [ + 'old' => $resource['id'], + 'new' => $invoice->id, + ]; + + } + + RecurringInvoice::reguard(); + + /*Improve memory handling by setting everything to null when we have finished*/ + $data = null; + $invoice_repository = null; + + } + private function processInvoices(array $data): void { Invoice::unguard(); diff --git a/app/Mail/MigrationCompleted.php b/app/Mail/MigrationCompleted.php index ca230f4b2862..861e2bfda287 100644 --- a/app/Mail/MigrationCompleted.php +++ b/app/Mail/MigrationCompleted.php @@ -28,6 +28,8 @@ class MigrationCompleted extends Mailable */ public function build() { - return $this->view('email.migration.completed'); + $data['settings'] = auth()->user()->company()->settings; + + return $this->view('email.migration.completed', $data); } } diff --git a/app/Models/Gateway.php b/app/Models/Gateway.php index f658e84fa15a..801d4d5eec3e 100644 --- a/app/Models/Gateway.php +++ b/app/Models/Gateway.php @@ -21,11 +21,16 @@ class Gateway extends StaticModel 'is_secure' => 'boolean', 'recommended' => 'boolean', //'visible' => 'boolean', - //'sort_order' => 'int', + 'sort_order' => 'int', 'updated_at' => 'timestamp', 'created_at' => 'timestamp', 'default_gateway_type_id' => 'string', 'fields' => 'json', + 'options' => 'array', + ]; + + protected $appends = [ + 'options', ]; protected $dateFormat = 'Y-m-d H:i:s.u'; @@ -45,6 +50,12 @@ class Gateway extends StaticModel } } + public function getOptionsAttribute() + { + return $this->getMethods(); + } + + /** * Test if gateway is custom. * @return bool TRUE|FALSE @@ -83,4 +94,30 @@ class Gateway extends StaticModel //return $key != $str ? $str : ''; } + + /** + * Returns an array of methods and the gatewaytypes possible + * + * @return array + */ + public function getMethods() + { + switch ($this->id) { + case 1: + return ['methods' => [GatewayType::CREDIT_CARD], 'refund' => true, 'token_billing' => true ]; //Authorize.net + break; + case 15: + return ['methods' => [GatewayType::PAYPAL], 'refund' => true, 'token_billing' => false ]; //Paypal + break; + case 20: + return ['methods' => [GatewayType::CREDIT_CARD, GatewayType::BANK_TRANSFER, GatewayType::ALIPAY, GatewayType::APPLE_PAY], 'refund' => true, 'token_billing' => true ]; //Stripe + break; + case 39: + return ['methods' => [GatewayType::CREDIT_CARD], 'refund' => true, 'token_billing' => true ]; //Checkout + break; + default: + return []; + break; + } + } } diff --git a/app/Models/RecurringInvoice.php b/app/Models/RecurringInvoice.php index 44d3f68028bb..70a9795c89c6 100644 --- a/app/Models/RecurringInvoice.php +++ b/app/Models/RecurringInvoice.php @@ -392,13 +392,13 @@ class RecurringInvoice extends BaseModel { // we don't add the days... we calc the day of the month!! $next_due_date = $this->calculateDueDate($next_send_date->copy()->format('Y-m-d')); - + $next_due_date_string = $next_due_date ? $next_due_date->format('Y-m-d') : ''; + $next_send_date = Carbon::parse($next_send_date); - $next_due_date = Carbon::parse($next_due_date); $data[] = [ 'send_date' => $next_send_date->format('Y-m-d'), - 'due_date' => $next_due_date->format('Y-m-d'), + 'due_date' => $next_due_date_string ]; $next_send_date = $this->nextDateByFrequency($next_send_date->format('Y-m-d')); @@ -406,12 +406,12 @@ class RecurringInvoice extends BaseModel } /*If no due date is set - unset the due_date value */ - if(!$this->due_date_days || $this->due_date_days == 0){ + // if(!$this->due_date_days || $this->due_date_days == 0){ - foreach($data as $key => $value) - $data[$key]['due_date'] = ''; + // foreach($data as $key => $value) + // $data[$key]['due_date'] = ''; - } + // } return $data; diff --git a/app/Models/RecurringInvoiceInvitation.php b/app/Models/RecurringInvoiceInvitation.php index 6d3f7cca1922..31aeb6043363 100644 --- a/app/Models/RecurringInvoiceInvitation.php +++ b/app/Models/RecurringInvoiceInvitation.php @@ -11,11 +11,18 @@ namespace App\Models; +use App\Models\RecurringInvoice; +use App\Utils\Traits\Inviteable; +use App\Utils\Traits\MakesDates; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\SoftDeletes; class RecurringInvoiceInvitation extends BaseModel { - + use MakesDates; + use SoftDeletes; + use Inviteable; + protected $fillable = ['client_contact_id']; protected $touches = ['recurring_invoice']; @@ -25,6 +32,11 @@ class RecurringInvoiceInvitation extends BaseModel return self::class; } + public function entityType() + { + return RecurringInvoice::class; + } + /** * @return mixed */ diff --git a/app/Repositories/Migration/InvoiceMigrationRepository.php b/app/Repositories/Migration/InvoiceMigrationRepository.php index f6fca7eedc39..9230c9a80bfd 100644 --- a/app/Repositories/Migration/InvoiceMigrationRepository.php +++ b/app/Repositories/Migration/InvoiceMigrationRepository.php @@ -23,6 +23,7 @@ use App\Models\Credit; use App\Models\Invoice; use App\Models\Payment; use App\Models\Quote; +use App\Models\RecurringInvoice; use App\Repositories\ActivityRepository; use App\Repositories\BaseRepository; use App\Repositories\CreditRepository; @@ -54,7 +55,7 @@ class InvoiceMigrationRepository extends BaseRepository $resource = explode('\\', $class->name)[2]; /** This will extract 'Invoice' from App\Models\Invoice */ $lcfirst_resource_id = lcfirst($resource).'_id'; - if ($class->name == Invoice::class || $class->name == Quote::class) { + if ($class->name == Invoice::class || $class->name == Quote::class || $class->name == RecurringInvoice::class) { $state['starting_amount'] = $model->amount; } @@ -141,7 +142,7 @@ class InvoiceMigrationRepository extends BaseRepository UpdateOrCreateProduct::dispatch($model->line_items, $model, $model->company); } - if ($class->name == Invoice::class) { + if ($class->name == Invoice::class || $class->name == RecurringInvoice::class) { if (($state['finished_amount'] != $state['starting_amount']) && ($model->status_id != Invoice::STATUS_DRAFT)) { // $model->ledger()->updateInvoiceBalance(($state['finished_amount'] - $state['starting_amount'])); diff --git a/app/Repositories/RecurringInvoiceRepository.php b/app/Repositories/RecurringInvoiceRepository.php index 736390139992..525bbc9fc6a2 100644 --- a/app/Repositories/RecurringInvoiceRepository.php +++ b/app/Repositories/RecurringInvoiceRepository.php @@ -33,6 +33,8 @@ class RecurringInvoiceRepository extends BaseRepository $invoice_calc = new InvoiceSum($invoice, $invoice->settings); + $invoice->service()->applyNumber()->save(); + $invoice = $invoice_calc->build()->getInvoice(); return $invoice; diff --git a/app/Services/Recurring/ApplyNumber.php b/app/Services/Recurring/ApplyNumber.php new file mode 100644 index 000000000000..97e6a77f4a3a --- /dev/null +++ b/app/Services/Recurring/ApplyNumber.php @@ -0,0 +1,58 @@ +client = $client; + + $this->recurring_entity = $recurring_entity; + } + + /* Recurring numbers are set when saved */ + public function run() + { + if ($this->recurring_entity->number != '') { + return $this->recurring_entity; + } + + + $this->recurring_entity->number = $this->getNextRecurringInvoiceNumber($this->client); + + + // switch ($this->client->getSetting('counter_number_applied')) { + // case 'when_saved': + // $this->recurring_entity->number = $this->getNextRecurringInvoiceNumber($this->client); + // break; + // case 'when_sent': + // break; + + // default: + // $this->recurring_entity->number = $this->getNextRecurringInvoiceNumber($this->client); + // break; + // } + + return $this->recurring_entity; + } +} diff --git a/app/Services/Recurring/CreateRecurringInvitations.php b/app/Services/Recurring/CreateRecurringInvitations.php new file mode 100644 index 000000000000..9e753e462696 --- /dev/null +++ b/app/Services/Recurring/CreateRecurringInvitations.php @@ -0,0 +1,74 @@ +entity = $entity; + $this->entity_name = lcfirst(Str::snake(class_basename($entity))); + $this->entity_id_name = $this->entity_name . "_id"; + $this->invitation_class = 'App\Models\\' . ucfirst(Str::camel($this->entity_name)) . "Invitation"; + $this->invitation_factory = 'App\Factory\\' . ucfirst(Str::camel($this->entity_name)) . "InvitationFactory"; + } + + public function run() + { + + try { + $this->entity->client->contacts->each(function ($contact) { + + $invitation = $this->invitation_class::whereCompanyId($this->entity->company_id) + ->whereClientContactId($contact->id) + ->where($this->entity_id_name, $this->entity->id) + ->withTrashed() + ->first(); + + if (! $invitation && $contact->send_email) { + $ii = $this->invitation_factory::create($this->entity->company_id, $this->entity->user_id); + $ii->{$this->entity_id_name} = $this->entity->id; + $ii->client_contact_id = $contact->id; + $ii->save(); + } elseif ($invitation && ! $contact->send_email) { + $invitation->delete(); + } + + }); + } + catch(\Exception $e) + { + info($e->getMessage()); + } + + return $this->entity; + } +} \ No newline at end of file diff --git a/app/Services/Recurring/RecurringService.php b/app/Services/Recurring/RecurringService.php index f05532c7ae1e..a6cd1394cd72 100644 --- a/app/Services/Recurring/RecurringService.php +++ b/app/Services/Recurring/RecurringService.php @@ -12,6 +12,8 @@ namespace App\Services\Recurring; use App\Models\RecurringInvoice; +use App\Services\Recurring\ApplyNumber; +use App\Services\Recurring\CreateRecurringInvitations; use Illuminate\Support\Carbon; class RecurringService @@ -37,6 +39,13 @@ class RecurringService return $this; } + public function createInvitations() + { + $this->recurring_entity = (new CreateRecurringInvitations($this->recurring_entity))->run(); + + return $this; + } + public function start() { //make sure next_send_date is either now or in the future else return. @@ -49,6 +58,17 @@ class RecurringService } + /** + * Applies the invoice number. + * @return $this InvoiceService object + */ + public function applyNumber() + { + $this->recurring_entity = (new ApplyNumber($this->recurring_entity->client, $this->recurring_entity))->run(); + + return $this; + } + public function save() { $this->recurring_entity->save(); diff --git a/app/Transformers/RecurringInvoiceInvitationTransformer.php b/app/Transformers/RecurringInvoiceInvitationTransformer.php index aff8dee99096..e509d15fe2ef 100644 --- a/app/Transformers/RecurringInvoiceInvitationTransformer.php +++ b/app/Transformers/RecurringInvoiceInvitationTransformer.php @@ -22,12 +22,16 @@ class RecurringInvoiceInvitationTransformer extends EntityTransformer public function transform(RecurringInvoiceInvitation $invitation) { return [ - 'id' => $this->encodePrimaryKey($invitation->id), + 'id' => $this->encodePrimaryKey($invitation->id), 'client_contact_id' => $this->encodePrimaryKey($invitation->client_contact_id), - 'key' => $invitation->key, + 'key' => $invitation->key, + 'link' => $invitation->getLink() ?: '', + 'sent_date' => $invitation->sent_date ?: '', + 'viewed_date' => $invitation->viewed_date ?: '', + 'opened_date' => $invitation->opened_date ?: '', 'updated_at' => (int) $invitation->updated_at, 'archived_at' => (int) $invitation->deleted_at, - 'created_at' => (int) $invitation->created_at, + 'created_at' => (int) $invitation->created_at, ]; } } diff --git a/app/Utils/SystemHealth.php b/app/Utils/SystemHealth.php index 4c7814bbaa20..9766640c9a9e 100644 --- a/app/Utils/SystemHealth.php +++ b/app/Utils/SystemHealth.php @@ -34,6 +34,7 @@ class SystemHealth 'mbstring', 'xml', 'bcmath', + 'mysqlnd', ]; private static $php_version = 7.3; diff --git a/app/Utils/TemplateEngine.php b/app/Utils/TemplateEngine.php index 4563d472d9a0..1bf85b519cb1 100644 --- a/app/Utils/TemplateEngine.php +++ b/app/Utils/TemplateEngine.php @@ -12,6 +12,10 @@ namespace App\Utils; use App\DataMapper\EmailTemplateDefaults; +use App\Models\Client; +use App\Models\ClientContact; +use App\Models\Invoice; +use App\Models\InvoiceInvitation; use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesInvoiceHtml; use App\Utils\Traits\MakesTemplateData; @@ -71,6 +75,8 @@ class TemplateEngine $class = 'App\Models\\'.ucfirst($this->entity); $this->entity_obj = $class::whereId($this->decodePrimaryKey($this->entity_id))->company()->first(); } + else + $this->mockEntity(); return $this; } @@ -195,6 +201,56 @@ class TemplateEngine 'wrapper' => $wrapper, ]; + + $this->tearDown(); + return $data; } + + private function mockEntity() + { + \DB::beginTransaction(); + + $client = Client::factory()->create([ + 'user_id' => auth()->user()->id, + 'company_id' => auth()->user()->company()->id, + ]); + + $contact = ClientContact::factory()->create([ + 'user_id' => auth()->user()->id, + 'company_id' => auth()->user()->company()->id, + 'client_id' => $client->id, + 'is_primary' => 1, + 'send_email' => true, + ]); + + $this->entity_obj = Invoice::factory()->create([ + 'user_id' => auth()->user()->id, + 'company_id' => auth()->user()->company()->id, + 'client_id' => $client->id, + ]); + + $invitation = InvoiceInvitation::factory()->create([ + 'user_id' => auth()->user()->id, + 'company_id' => auth()->user()->company()->id, + 'invoice_id' => $this->entity_obj->id, + 'client_contact_id' => $contact->id, + ]); + + $this->entity_obj->setRelation('invitations', $invitation); + $this->entity_obj->setRelation('client', $client); + $this->entity_obj->setRelation('company', auth()->user()->company()); + $this->entity_obj->load('client'); + $client->setRelation('company', auth()->user()->company()); + $client->load('company'); + + } + + private function tearDown() + { + + \DB::rollBack(); + + } + } diff --git a/app/Utils/Traits/GeneratesCounter.php b/app/Utils/Traits/GeneratesCounter.php index bf801b7fd13a..a94a231cfcc4 100644 --- a/app/Utils/Traits/GeneratesCounter.php +++ b/app/Utils/Traits/GeneratesCounter.php @@ -154,27 +154,27 @@ trait GeneratesCounter $is_client_counter = false; //todo handle if we have specific client patterns in the future - $pattern = $client->company->settings->invoice_number_pattern; + $pattern = $client->company->settings->recurring_invoice_number_pattern; //Determine if we are using client_counters if (strpos($pattern, 'client_counter') === false) { - $counter = $client->company->settings->invoice_number_counter; + $counter = $client->company->settings->recurring_invoice_number_counter; } else { - $counter = $client->settings->invoice_number_counter; + $counter = $client->settings->recurring_invoice_number_counter; $is_client_counter = true; } //Return a valid counter $pattern = ''; $padding = $client->getSetting('counter_padding'); - $invoice_number = $this->checkEntityNumber(Invoice::class, $client, $counter, $padding, $pattern); + $invoice_number = $this->checkEntityNumber(RecurringInvoice::class, $client, $counter, $padding, $pattern); $invoice_number = $this->prefixCounter($invoice_number, $client->getSetting('recurring_number_prefix')); //increment the correct invoice_number Counter (company vs client) if ($is_client_counter) { - $this->incrementCounter($client, 'invoice_number_counter'); + $this->incrementCounter($client, 'recurring_invoice_number_counter'); } else { - $this->incrementCounter($client->company, 'invoice_number_counter'); + $this->incrementCounter($client->company, 'recurring_invoice_number_counter'); } return $invoice_number; diff --git a/app/Utils/Traits/MakesInvoiceValues.php b/app/Utils/Traits/MakesInvoiceValues.php index bc1f50d46920..6c518a981781 100644 --- a/app/Utils/Traits/MakesInvoiceValues.php +++ b/app/Utils/Traits/MakesInvoiceValues.php @@ -213,7 +213,9 @@ trait MakesInvoiceValues $data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.invoice_number')]; $data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.invoice_terms')]; $data['$terms'] = &$data['$entity.terms']; - $data['$view_link'] = ['value' => ''.ctrans('texts.view_invoice').'', 'label' => ctrans('texts.view_invoice')]; + + if($invitation) + $data['$view_link'] = ['value' => ''.ctrans('texts.view_invoice').'', 'label' => ctrans('texts.view_invoice')]; // $data['$view_link'] = ['value' => $invitation->getLink(), 'label' => ctrans('texts.view_invoice')]; } @@ -222,7 +224,9 @@ trait MakesInvoiceValues $data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.quote_number')]; $data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.quote_terms')]; $data['$terms'] = &$data['$entity.terms']; - $data['$view_link'] = ['value' => ''.ctrans('texts.view_quote').'', 'label' => ctrans('texts.view_quote')]; + + if($invitation) + $data['$view_link'] = ['value' => ''.ctrans('texts.view_quote').'', 'label' => ctrans('texts.view_quote')]; // $data['$view_link'] = ['value' => $invitation->getLink(), 'label' => ctrans('texts.view_quote')]; } @@ -231,7 +235,9 @@ trait MakesInvoiceValues $data['$number'] = ['value' => $this->number ?: ' ', 'label' => ctrans('texts.credit_number')]; $data['$entity.terms'] = ['value' => $this->terms ?: ' ', 'label' => ctrans('texts.credit_terms')]; $data['$terms'] = &$data['$entity.terms']; - $data['$view_link'] = ['value' => ''.ctrans('texts.view_credit').'', 'label' => ctrans('texts.view_credit')]; + + if($invitation) + $data['$view_link'] = ['value' => ''.ctrans('texts.view_credit').'', 'label' => ctrans('texts.view_credit')]; // $data['$view_link'] = ['value' => $invitation->getLink(), 'label' => ctrans('texts.view_credit')]; } diff --git a/composer.lock b/composer.lock index c344f50e9f4c..83432f82fc5b 100644 --- a/composer.lock +++ b/composer.lock @@ -108,16 +108,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.157.0", + "version": "3.158.2", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "ad2c0183d7ebc695acb1ba39d528f2328f2c0de3" + "reference": "b80957465d94c127254e36061dd3d0c3ccc94cc1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/ad2c0183d7ebc695acb1ba39d528f2328f2c0de3", - "reference": "ad2c0183d7ebc695acb1ba39d528f2328f2c0de3", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/b80957465d94c127254e36061dd3d0c3ccc94cc1", + "reference": "b80957465d94c127254e36061dd3d0c3ccc94cc1", "shasum": "" }, "require": { @@ -189,7 +189,7 @@ "s3", "sdk" ], - "time": "2020-09-30T18:58:20+00:00" + "time": "2020-10-05T18:13:27+00:00" }, { "name": "brick/math", @@ -355,23 +355,23 @@ }, { "name": "clue/stream-filter", - "version": "v1.4.1", + "version": "v1.5.0", "source": { "type": "git", "url": "https://github.com/clue/php-stream-filter.git", - "reference": "5a58cc30a8bd6a4eb8f856adf61dd3e013f53f71" + "reference": "aeb7d8ea49c7963d3b581378955dbf5bc49aa320" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/clue/php-stream-filter/zipball/5a58cc30a8bd6a4eb8f856adf61dd3e013f53f71", - "reference": "5a58cc30a8bd6a4eb8f856adf61dd3e013f53f71", + "url": "https://api.github.com/repos/clue/php-stream-filter/zipball/aeb7d8ea49c7963d3b581378955dbf5bc49aa320", + "reference": "aeb7d8ea49c7963d3b581378955dbf5bc49aa320", "shasum": "" }, "require": { "php": ">=5.3" }, "require-dev": { - "phpunit/phpunit": "^5.0 || ^4.8" + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.36" }, "type": "library", "autoload": { @@ -389,7 +389,7 @@ "authors": [ { "name": "Christian Lück", - "email": "christian@lueck.tv" + "email": "christian@clue.engineering" } ], "description": "A simple and modern approach to stream filtering in PHP", @@ -403,7 +403,17 @@ "stream_filter_append", "stream_filter_register" ], - "time": "2019-04-09T12:31:48+00:00" + "funding": [ + { + "url": "https://clue.engineering/support", + "type": "custom" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2020-10-02T12:38:20+00:00" }, { "name": "composer/ca-bundle", @@ -1767,16 +1777,16 @@ }, { "name": "google/apiclient-services", - "version": "v0.148", + "version": "v0.149", "source": { "type": "git", "url": "https://github.com/googleapis/google-api-php-client-services.git", - "reference": "692a8d4c6a89458570e0d804624c50120cdd6388" + "reference": "6a44aa8dc22b181594ba93c2ffb5d731c318c810" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/692a8d4c6a89458570e0d804624c50120cdd6388", - "reference": "692a8d4c6a89458570e0d804624c50120cdd6388", + "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/6a44aa8dc22b181594ba93c2ffb5d731c318c810", + "reference": "6a44aa8dc22b181594ba93c2ffb5d731c318c810", "shasum": "" }, "require": { @@ -1800,20 +1810,20 @@ "keywords": [ "google" ], - "time": "2020-09-26T00:26:16+00:00" + "time": "2020-10-05T00:26:25+00:00" }, { "name": "google/auth", - "version": "v1.13.0", + "version": "v1.14.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-auth-library-php.git", - "reference": "173191f5defd1d9ae8bdfc28da31b63eb73dd34e" + "reference": "95c23ebd89a0a4d1b511aed81426f57388ab7268" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/173191f5defd1d9ae8bdfc28da31b63eb73dd34e", - "reference": "173191f5defd1d9ae8bdfc28da31b63eb73dd34e", + "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/95c23ebd89a0a4d1b511aed81426f57388ab7268", + "reference": "95c23ebd89a0a4d1b511aed81426f57388ab7268", "shasum": "" }, "require": { @@ -1852,7 +1862,7 @@ "google", "oauth2" ], - "time": "2020-09-18T20:03:05+00:00" + "time": "2020-10-02T22:20:36+00:00" }, { "name": "graham-campbell/result-type", @@ -2487,16 +2497,16 @@ }, { "name": "laravel/framework", - "version": "v8.7.1", + "version": "v8.8.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "3fb29e904a152b3e1fe49581f66ba5e02fe991f2" + "reference": "0bdd5c6f12cb7cb6644e484169656245af417735" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/3fb29e904a152b3e1fe49581f66ba5e02fe991f2", - "reference": "3fb29e904a152b3e1fe49581f66ba5e02fe991f2", + "url": "https://api.github.com/repos/laravel/framework/zipball/0bdd5c6f12cb7cb6644e484169656245af417735", + "reference": "0bdd5c6f12cb7cb6644e484169656245af417735", "shasum": "" }, "require": { @@ -2646,7 +2656,7 @@ "framework", "laravel" ], - "time": "2020-09-29T15:39:07+00:00" + "time": "2020-10-02T14:33:08+00:00" }, { "name": "laravel/slack-notification-channel", @@ -3870,16 +3880,16 @@ }, { "name": "nesbot/carbon", - "version": "2.40.1", + "version": "2.41.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "d9a76d8b7eb0f97cf3a82529393245212f40ba3b" + "reference": "8690b13ad4da6d54d692afea15aab30b36fee52e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/d9a76d8b7eb0f97cf3a82529393245212f40ba3b", - "reference": "d9a76d8b7eb0f97cf3a82529393245212f40ba3b", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/8690b13ad4da6d54d692afea15aab30b36fee52e", + "reference": "8690b13ad4da6d54d692afea15aab30b36fee52e", "shasum": "" }, "require": { @@ -3955,7 +3965,7 @@ "type": "tidelift" } ], - "time": "2020-09-23T08:17:37+00:00" + "time": "2020-10-04T09:11:05+00:00" }, { "name": "nikic/php-parser", @@ -5658,24 +5668,25 @@ }, { "name": "sabre/uri", - "version": "2.2.0", + "version": "2.2.1", "source": { "type": "git", "url": "https://github.com/sabre-io/uri.git", - "reference": "059d11012603be2e32ddb7543602965563ddbb09" + "reference": "f502edffafea8d746825bd5f0b923a60fd2715ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sabre-io/uri/zipball/059d11012603be2e32ddb7543602965563ddbb09", - "reference": "059d11012603be2e32ddb7543602965563ddbb09", + "url": "https://api.github.com/repos/sabre-io/uri/zipball/f502edffafea8d746825bd5f0b923a60fd2715ff", + "reference": "f502edffafea8d746825bd5f0b923a60fd2715ff", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.1 || ^8.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "~2.16.1", - "phpunit/phpunit": "^7 || ^8" + "phpstan/phpstan": "^0.12", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.0" }, "type": "library", "autoload": { @@ -5705,7 +5716,7 @@ "uri", "url" ], - "time": "2020-01-31T18:53:43+00:00" + "time": "2020-10-03T10:33:23+00:00" }, { "name": "sabre/xml", @@ -5928,16 +5939,16 @@ }, { "name": "sentry/sentry", - "version": "3.0.0", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/getsentry/sentry-php.git", - "reference": "b77ff3783060ce3213011ddae369e550ec985dc8" + "reference": "a35c6c71693a72f2fedb9b6f9644ced52268771d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/getsentry/sentry-php/zipball/b77ff3783060ce3213011ddae369e550ec985dc8", - "reference": "b77ff3783060ce3213011ddae369e550ec985dc8", + "url": "https://api.github.com/repos/getsentry/sentry-php/zipball/a35c6c71693a72f2fedb9b6f9644ced52268771d", + "reference": "a35c6c71693a72f2fedb9b6f9644ced52268771d", "shasum": "" }, "require": { @@ -6024,20 +6035,20 @@ "type": "custom" } ], - "time": "2020-09-28T07:11:32+00:00" + "time": "2020-10-02T14:16:36+00:00" }, { "name": "sentry/sentry-laravel", - "version": "2.0.0", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/getsentry/sentry-laravel.git", - "reference": "ed8f28507f18474223df7de4c86e210c09dda630" + "reference": "1815b6e7c037f9495768e906f978e1a15d7a2944" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/getsentry/sentry-laravel/zipball/ed8f28507f18474223df7de4c86e210c09dda630", - "reference": "ed8f28507f18474223df7de4c86e210c09dda630", + "url": "https://api.github.com/repos/getsentry/sentry-laravel/zipball/1815b6e7c037f9495768e906f978e1a15d7a2944", + "reference": "1815b6e7c037f9495768e906f978e1a15d7a2944", "shasum": "" }, "require": { @@ -6048,6 +6059,7 @@ "require-dev": { "friendsofphp/php-cs-fixer": "2.16.*", "laravel/framework": "^7.0", + "mockery/mockery": "1.3.*", "orchestra/testbench": "^5.0", "phpunit/phpunit": "^8.0" }, @@ -6104,7 +6116,7 @@ "type": "custom" } ], - "time": "2020-09-28T08:31:49+00:00" + "time": "2020-10-06T08:40:32+00:00" }, { "name": "spatie/browsershot", @@ -6488,7 +6500,7 @@ }, { "name": "symfony/console", - "version": "v5.1.6", + "version": "v5.1.7", "source": { "type": "git", "url": "https://github.com/symfony/console.git", @@ -6581,7 +6593,7 @@ }, { "name": "symfony/css-selector", - "version": "v5.1.6", + "version": "v5.1.7", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", @@ -6712,16 +6724,16 @@ }, { "name": "symfony/error-handler", - "version": "v5.1.6", + "version": "v5.1.7", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "d2f1d4996d5499f1261164d10080e4120001f041" + "reference": "5e4d8ef8d71822922d1eebd130219ae3491a5ca9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/d2f1d4996d5499f1261164d10080e4120001f041", - "reference": "d2f1d4996d5499f1261164d10080e4120001f041", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/5e4d8ef8d71822922d1eebd130219ae3491a5ca9", + "reference": "5e4d8ef8d71822922d1eebd130219ae3491a5ca9", "shasum": "" }, "require": { @@ -6779,11 +6791,11 @@ "type": "tidelift" } ], - "time": "2020-09-27T03:44:28+00:00" + "time": "2020-10-02T08:49:02+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v5.1.6", + "version": "v5.1.7", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -6946,16 +6958,16 @@ }, { "name": "symfony/filesystem", - "version": "v5.1.6", + "version": "v5.1.7", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "f3194303d3077829dbbc1d18f50288b2a01146f2" + "reference": "1a8697545a8d87b9f2f6b1d32414199cc5e20aae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/f3194303d3077829dbbc1d18f50288b2a01146f2", - "reference": "f3194303d3077829dbbc1d18f50288b2a01146f2", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/1a8697545a8d87b9f2f6b1d32414199cc5e20aae", + "reference": "1a8697545a8d87b9f2f6b1d32414199cc5e20aae", "shasum": "" }, "require": { @@ -7006,11 +7018,11 @@ "type": "tidelift" } ], - "time": "2020-09-02T16:23:27+00:00" + "time": "2020-09-27T14:02:37+00:00" }, { "name": "symfony/finder", - "version": "v5.1.6", + "version": "v5.1.7", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -7073,16 +7085,16 @@ }, { "name": "symfony/http-client", - "version": "v5.1.6", + "version": "v5.1.7", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "4a5f2750b54e3cfc5b6711dd78fdbac6563ee7bf" + "reference": "df757997ee95101c0ca94c7ea2b76e16a758e0ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/4a5f2750b54e3cfc5b6711dd78fdbac6563ee7bf", - "reference": "4a5f2750b54e3cfc5b6711dd78fdbac6563ee7bf", + "url": "https://api.github.com/repos/symfony/http-client/zipball/df757997ee95101c0ca94c7ea2b76e16a758e0ca", + "reference": "df757997ee95101c0ca94c7ea2b76e16a758e0ca", "shasum": "" }, "require": { @@ -7155,7 +7167,7 @@ "type": "tidelift" } ], - "time": "2020-09-27T03:44:28+00:00" + "time": "2020-10-02T14:24:03+00:00" }, { "name": "symfony/http-client-contracts", @@ -7234,16 +7246,16 @@ }, { "name": "symfony/http-foundation", - "version": "v5.1.6", + "version": "v5.1.7", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "6cca6b2e4b69fc5bace160d14cf1ee5f71483db4" + "reference": "353b42e7b4fd1c898aab09a059466c9cea74039b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/6cca6b2e4b69fc5bace160d14cf1ee5f71483db4", - "reference": "6cca6b2e4b69fc5bace160d14cf1ee5f71483db4", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/353b42e7b4fd1c898aab09a059466c9cea74039b", + "reference": "353b42e7b4fd1c898aab09a059466c9cea74039b", "shasum": "" }, "require": { @@ -7305,20 +7317,20 @@ "type": "tidelift" } ], - "time": "2020-09-13T05:01:27+00:00" + "time": "2020-09-27T14:14:57+00:00" }, { "name": "symfony/http-kernel", - "version": "v5.1.6", + "version": "v5.1.7", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "17227644c3c66dcf32bdfeceff4364d090cd6756" + "reference": "1764b87d2f10d5c9ce6e4850fe27934116d89708" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/17227644c3c66dcf32bdfeceff4364d090cd6756", - "reference": "17227644c3c66dcf32bdfeceff4364d090cd6756", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/1764b87d2f10d5c9ce6e4850fe27934116d89708", + "reference": "1764b87d2f10d5c9ce6e4850fe27934116d89708", "shasum": "" }, "require": { @@ -7419,11 +7431,11 @@ "type": "tidelift" } ], - "time": "2020-09-27T04:33:19+00:00" + "time": "2020-10-04T07:57:28+00:00" }, { "name": "symfony/mime", - "version": "v5.1.6", + "version": "v5.1.7", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", @@ -7500,7 +7512,7 @@ }, { "name": "symfony/options-resolver", - "version": "v5.1.6", + "version": "v5.1.7", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", @@ -8427,7 +8439,7 @@ }, { "name": "symfony/process", - "version": "v5.1.6", + "version": "v5.1.7", "source": { "type": "git", "url": "https://github.com/symfony/process.git", @@ -8491,16 +8503,16 @@ }, { "name": "symfony/routing", - "version": "v5.1.6", + "version": "v5.1.7", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "d36e06eb02a55522a8eed070c1cbc3dc3c389876" + "reference": "720348c2ae011f8c56964c0fc3e992840cb60ccf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/d36e06eb02a55522a8eed070c1cbc3dc3c389876", - "reference": "d36e06eb02a55522a8eed070c1cbc3dc3c389876", + "url": "https://api.github.com/repos/symfony/routing/zipball/720348c2ae011f8c56964c0fc3e992840cb60ccf", + "reference": "720348c2ae011f8c56964c0fc3e992840cb60ccf", "shasum": "" }, "require": { @@ -8579,7 +8591,7 @@ "type": "tidelift" } ], - "time": "2020-09-02T16:23:27+00:00" + "time": "2020-10-02T13:05:43+00:00" }, { "name": "symfony/service-contracts", @@ -8659,7 +8671,7 @@ }, { "name": "symfony/string", - "version": "v5.1.6", + "version": "v5.1.7", "source": { "type": "git", "url": "https://github.com/symfony/string.git", @@ -8744,7 +8756,7 @@ }, { "name": "symfony/translation", - "version": "v5.1.6", + "version": "v5.1.7", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", @@ -8836,16 +8848,16 @@ }, { "name": "symfony/translation-contracts", - "version": "v2.2.0", + "version": "v2.3.0", "source": { "type": "git", "url": "https://github.com/symfony/translation-contracts.git", - "reference": "77ce1c3627c9f39643acd9af086631f842c50c4d" + "reference": "e2eaa60b558f26a4b0354e1bbb25636efaaad105" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/77ce1c3627c9f39643acd9af086631f842c50c4d", - "reference": "77ce1c3627c9f39643acd9af086631f842c50c4d", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/e2eaa60b558f26a4b0354e1bbb25636efaaad105", + "reference": "e2eaa60b558f26a4b0354e1bbb25636efaaad105", "shasum": "" }, "require": { @@ -8857,7 +8869,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev" + "dev-master": "2.3-dev" }, "thanks": { "name": "symfony/contracts", @@ -8907,11 +8919,11 @@ "type": "tidelift" } ], - "time": "2020-09-07T11:33:47+00:00" + "time": "2020-09-28T13:05:58+00:00" }, { "name": "symfony/var-dumper", - "version": "v5.1.6", + "version": "v5.1.7", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", @@ -9849,16 +9861,16 @@ }, { "name": "facade/ignition", - "version": "2.3.7", + "version": "2.3.8", "source": { "type": "git", "url": "https://github.com/facade/ignition.git", - "reference": "b364db8860a63c1fb58b72b9718863c21df08762" + "reference": "e8fed9c382cd1d02b5606688576a35619afdf82c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/facade/ignition/zipball/b364db8860a63c1fb58b72b9718863c21df08762", - "reference": "b364db8860a63c1fb58b72b9718863c21df08762", + "url": "https://api.github.com/repos/facade/ignition/zipball/e8fed9c382cd1d02b5606688576a35619afdf82c", + "reference": "e8fed9c382cd1d02b5606688576a35619afdf82c", "shasum": "" }, "require": { @@ -9917,7 +9929,7 @@ "laravel", "page" ], - "time": "2020-09-06T19:26:27+00:00" + "time": "2020-10-01T23:01:14+00:00" }, { "name": "facade/ignition-contracts", @@ -10657,16 +10669,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.1.11", + "version": "9.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "c9394cb9d07ecfa9351b96f2e296bad473195f4d" + "reference": "53a4b737e83be724efd2bc4e7b929b9a30c48972" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c9394cb9d07ecfa9351b96f2e296bad473195f4d", - "reference": "c9394cb9d07ecfa9351b96f2e296bad473195f4d", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/53a4b737e83be724efd2bc4e7b929b9a30c48972", + "reference": "53a4b737e83be724efd2bc4e7b929b9a30c48972", "shasum": "" }, "require": { @@ -10694,7 +10706,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.1-dev" + "dev-master": "9.2-dev" } }, "autoload": { @@ -10726,7 +10738,7 @@ "type": "github" } ], - "time": "2020-09-19T05:29:17+00:00" + "time": "2020-10-02T03:37:32+00:00" }, { "name": "phpunit/php-file-iterator", @@ -10955,16 +10967,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.3.11", + "version": "9.4.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "f7316ea106df7c9507f4fdaa88c47bc10a3b27a1" + "reference": "ef533467a7974c4b6c354f3eff42a115910bd4e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f7316ea106df7c9507f4fdaa88c47bc10a3b27a1", - "reference": "f7316ea106df7c9507f4fdaa88c47bc10a3b27a1", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ef533467a7974c4b6c354f3eff42a115910bd4e5", + "reference": "ef533467a7974c4b6c354f3eff42a115910bd4e5", "shasum": "" }, "require": { @@ -10980,7 +10992,7 @@ "phar-io/version": "^3.0.2", "php": ">=7.3", "phpspec/prophecy": "^1.11.1", - "phpunit/php-code-coverage": "^9.1.11", + "phpunit/php-code-coverage": "^9.2", "phpunit/php-file-iterator": "^3.0.4", "phpunit/php-invoker": "^3.1", "phpunit/php-text-template": "^2.0.2", @@ -11011,7 +11023,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.3-dev" + "dev-master": "9.4-dev" } }, "autoload": { @@ -11050,7 +11062,7 @@ "type": "github" } ], - "time": "2020-09-24T08:08:49+00:00" + "time": "2020-10-02T03:54:37+00:00" }, { "name": "scrivo/highlight.php", @@ -11181,16 +11193,16 @@ }, { "name": "sebastian/code-unit", - "version": "1.0.6", + "version": "1.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "d3a241b6028ff9d8e97d2b6ebd4090d01f92fad8" + "reference": "59236be62b1bb9919e6d7f60b0b832dc05cef9ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/d3a241b6028ff9d8e97d2b6ebd4090d01f92fad8", - "reference": "d3a241b6028ff9d8e97d2b6ebd4090d01f92fad8", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/59236be62b1bb9919e6d7f60b0b832dc05cef9ab", + "reference": "59236be62b1bb9919e6d7f60b0b832dc05cef9ab", "shasum": "" }, "require": { @@ -11229,7 +11241,7 @@ "type": "github" } ], - "time": "2020-09-28T05:28:46+00:00" + "time": "2020-10-02T14:47:54+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -11928,16 +11940,16 @@ }, { "name": "sebastian/type", - "version": "2.2.2", + "version": "2.3.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "e494dcaeb89d1458c9ccd8c819745245a1669aea" + "reference": "fa592377f3923946cb90bf1f6a71ba2e5f229909" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/e494dcaeb89d1458c9ccd8c819745245a1669aea", - "reference": "e494dcaeb89d1458c9ccd8c819745245a1669aea", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fa592377f3923946cb90bf1f6a71ba2e5f229909", + "reference": "fa592377f3923946cb90bf1f6a71ba2e5f229909", "shasum": "" }, "require": { @@ -11949,7 +11961,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev" + "dev-master": "2.3-dev" } }, "autoload": { @@ -11976,7 +11988,7 @@ "type": "github" } ], - "time": "2020-09-28T06:01:38+00:00" + "time": "2020-10-06T08:41:03+00:00" }, { "name": "sebastian/version", @@ -12029,16 +12041,16 @@ }, { "name": "swagger-api/swagger-ui", - "version": "v3.34.0", + "version": "v3.35.0", "source": { "type": "git", - "url": "git@github.com:swagger-api/swagger-ui.git", - "reference": "c20a8c479eaa7897a2ddabcaf5f75e6d41f4525c" + "url": "https://github.com/swagger-api/swagger-ui.git", + "reference": "db2cca8e8691f48c1e27a543e1cee97e760c0742" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swagger-api/swagger-ui/zipball/c20a8c479eaa7897a2ddabcaf5f75e6d41f4525c", - "reference": "c20a8c479eaa7897a2ddabcaf5f75e6d41f4525c", + "url": "https://api.github.com/repos/swagger-api/swagger-ui/zipball/db2cca8e8691f48c1e27a543e1cee97e760c0742", + "reference": "db2cca8e8691f48c1e27a543e1cee97e760c0742", "shasum": "" }, "type": "library", @@ -12082,11 +12094,11 @@ "swagger", "ui" ], - "time": "2020-09-18T18:46:18+00:00" + "time": "2020-10-01T18:14:37+00:00" }, { "name": "symfony/debug", - "version": "v4.4.14", + "version": "v4.4.15", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", @@ -12157,7 +12169,7 @@ }, { "name": "symfony/yaml", - "version": "v5.1.6", + "version": "v5.1.7", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", diff --git a/database/factories/ProjectFactory.php b/database/factories/ProjectFactory.php index 06083f94302e..ec8ba7bda004 100644 --- a/database/factories/ProjectFactory.php +++ b/database/factories/ProjectFactory.php @@ -34,7 +34,7 @@ class ProjectFactory extends Factory { return [ 'name' => $this->faker->name(), - 'description' => $this->faker->text(50), + 'public_notes' => $this->faker->text(50), ]; } } diff --git a/database/migrations/2014_10_13_000000_create_users_table.php b/database/migrations/2014_10_13_000000_create_users_table.php index 4bc99fdf7db5..f83680924a20 100644 --- a/database/migrations/2014_10_13_000000_create_users_table.php +++ b/database/migrations/2014_10_13_000000_create_users_table.php @@ -1182,19 +1182,19 @@ class CreateUsersTable extends Migration $table->timestamps(6); $table->softDeletes(); $table->unsignedInteger('user_id'); - $table->unsignedInteger('assigned_user_id'); + $table->unsignedInteger('assigned_user_id')->nullable(); $table->unsignedInteger('company_id'); $table->unsignedInteger('currency_id')->nullable(); $table->string('name')->nullable(); - $table->string('address1'); - $table->string('address2'); - $table->string('city'); - $table->string('state'); - $table->string('postal_code'); + $table->string('address1')->nullable(); + $table->string('address2')->nullable(); + $table->string('city')->nullable(); + $table->string('state')->nullable(); + $table->string('postal_code')->nullable(); $table->unsignedInteger('country_id')->nullable(); - $table->string('work_phone'); - $table->text('private_notes'); - $table->string('website'); + $table->string('work_phone')->nullable(); + $table->text('private_notes')->nullable(); + $table->string('website')->nullable(); $table->tinyInteger('is_deleted')->default(0); $table->string('vat_number')->nullable(); $table->string('transaction_name')->nullable(); diff --git a/database/migrations/2020_09_27_215800_update_gateway_table_visible_column.php b/database/migrations/2020_09_27_215800_update_gateway_table_visible_column.php index 607bfdb2865e..e13d117bc586 100644 --- a/database/migrations/2020_09_27_215800_update_gateway_table_visible_column.php +++ b/database/migrations/2020_09_27_215800_update_gateway_table_visible_column.php @@ -18,6 +18,30 @@ class UpdateGatewayTableVisibleColumn extends Migration Gateway::whereIn('id', [1,15,20,39])->update(['visible' => 1]); + Schema::table('recurring_invoice_invitations', function ($t) { + $t->string('transaction_reference')->nullable(); + $t->string('message_id')->nullable(); + $t->mediumText('email_error')->nullable(); + $t->text('signature_base64')->nullable(); + $t->datetime('signature_date')->nullable(); + + $t->datetime('sent_date')->nullable(); + $t->datetime('viewed_date')->nullable(); + $t->datetime('opened_date')->nullable(); + + }); + + + Schema::table('expenses', function ($t){ + $t->renameColumn('invoice_category_id', 'category_id'); + }); + + Schema::table('projects', function ($t){ + $t->text('public_notes')->nullable(); + $t->dropColumn('description'); + $t->decimal('budgeted_hours', 12,2)->change(); + }); + } diff --git a/database/seeders/PaymentTermsSeeder.php b/database/seeders/PaymentTermsSeeder.php index a0c4c62f0087..8267f02e76c5 100644 --- a/database/seeders/PaymentTermsSeeder.php +++ b/database/seeders/PaymentTermsSeeder.php @@ -10,7 +10,6 @@ */ namespace Database\Seeders; - use App\Models\PaymentTerm; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Seeder; diff --git a/resources/views/index/index.blade.php b/resources/views/index/index.blade.php index ccfe1573d83f..efdde9ef8226 100644 --- a/resources/views/index/index.blade.php +++ b/resources/views/index/index.blade.php @@ -1,9 +1,8 @@ - + Invoice Ninja - @@ -11,11 +10,12 @@