From 6dc3668ff69b1d2c734e8bd7f868e6058adfeec0 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 31 May 2021 08:17:42 +1000 Subject: [PATCH 1/7] Fixes for tests --- app/DataMapper/CompanySettings.php | 4 +- app/Http/Controllers/ImportJsonController.php | 4 +- .../Requests/Import/ImportJsonRequest.php | 39 +++++++++++++++++++ 3 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 app/Http/Requests/Import/ImportJsonRequest.php diff --git a/app/DataMapper/CompanySettings.php b/app/DataMapper/CompanySettings.php index f7d4240719fb..1c9bf0c1cbdf 100644 --- a/app/DataMapper/CompanySettings.php +++ b/app/DataMapper/CompanySettings.php @@ -245,8 +245,8 @@ class CompanySettings extends BaseSettings public $hide_paid_to_date = false; //@TODO where? public $embed_documents = false; //@TODO where? - public $all_pages_header = false; //@implemented - public $all_pages_footer = false; //@implemented + public $all_pages_header = false; //@deprecated 31-05-2021 + public $all_pages_footer = false; //@deprecated 31-05-2021 public $pdf_variables = ''; //@implemented public $portal_custom_head = ''; //@TODO @BEN diff --git a/app/Http/Controllers/ImportJsonController.php b/app/Http/Controllers/ImportJsonController.php index 5a95fa23a813..a3ab46344900 100644 --- a/app/Http/Controllers/ImportJsonController.php +++ b/app/Http/Controllers/ImportJsonController.php @@ -11,7 +11,7 @@ namespace App\Http\Controllers; -use App\Http\Requests\Export\StoreExportRequest; +use App\Http\Requests\Import\ImportJsonRequest; use App\Jobs\Company\CompanyExport; use App\Utils\Traits\MakesHash; use Illuminate\Http\Response; @@ -53,7 +53,7 @@ class ImportJsonController extends BaseController * ), * ) */ - public function index(StoreExportRequest $request) + public function index(ImportJsonRequest $request) { // CompanyExport::dispatch(auth()->user()->getCompany(), auth()->user()); diff --git a/app/Http/Requests/Import/ImportJsonRequest.php b/app/Http/Requests/Import/ImportJsonRequest.php new file mode 100644 index 000000000000..732ee2a18880 --- /dev/null +++ b/app/Http/Requests/Import/ImportJsonRequest.php @@ -0,0 +1,39 @@ +user()->isAdmin(); + } + + public function rules() + { + return [ + // 'import_type' => 'required', + // 'files' => 'required_without:hash|array|min:1|max:6', + // 'hash' => 'nullable|string', + // 'column_map' => 'required_with:hash|array', + // 'skip_header' => 'required_with:hash|boolean', + // 'files.*' => 'file|mimes:csv,txt', + ]; + } +} From 5e820bbba7e46c2ba6b8396ee1ee088381a6de99 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 31 May 2021 08:55:27 +1000 Subject: [PATCH 2/7] Working on company importer --- app/Http/Controllers/ImportJsonController.php | 34 ++++- app/Jobs/Company/CompanyImport.php | 124 ++++++++++-------- 2 files changed, 102 insertions(+), 56 deletions(-) diff --git a/app/Http/Controllers/ImportJsonController.php b/app/Http/Controllers/ImportJsonController.php index a3ab46344900..a26280ca7e52 100644 --- a/app/Http/Controllers/ImportJsonController.php +++ b/app/Http/Controllers/ImportJsonController.php @@ -13,8 +13,11 @@ namespace App\Http\Controllers; use App\Http\Requests\Import\ImportJsonRequest; use App\Jobs\Company\CompanyExport; +use App\Jobs\Company\CompanyImport; use App\Utils\Traits\MakesHash; use Illuminate\Http\Response; +use Illuminate\Support\Facades\Cache; +use Illuminate\Support\Str; class ImportJsonController extends BaseController { @@ -56,9 +59,38 @@ class ImportJsonController extends BaseController public function index(ImportJsonRequest $request) { - // CompanyExport::dispatch(auth()->user()->getCompany(), auth()->user()); + $import_file = $request->file('files'); + + $contents = $this->unzipFile($import_file->getPathname()); + + $hash = Str::random(32); + + Cache::put( $hash, base64_encode( $contents ), 3600 ); + + CompanyImport::dispatch(auth()->user()->getCompany(), auth()->user(), $hash, $request->all()); return response()->json(['message' => 'Processing'], 200); } + + private function unzipFile($file_contents) + { + $zip = new ZipArchive(); + $archive = $zip->open($file_contents); + + $filename = pathinfo($file_contents, PATHINFO_FILENAME); + $zip->extractTo(public_path("storage/backups/{$filename}")); + $zip->close(); + $file_location = public_path("storage/backups/$filename/backup.json"); + + if (! file_exists($file_location)) + throw new NonExistingMigrationFile('Backup file does not exist, or it is corrupted.'); + + $data = json_decode(file_get_contents($file_location)); + + unlink($file_contents); + unlink($file_location); + + return $data + } } diff --git a/app/Jobs/Company/CompanyImport.php b/app/Jobs/Company/CompanyImport.php index 7ff1ccc2a627..d7f5d60525da 100644 --- a/app/Jobs/Company/CompanyImport.php +++ b/app/Jobs/Company/CompanyImport.php @@ -28,6 +28,7 @@ use App\Models\RecurringInvoice; use App\Models\RecurringInvoiceInvitation; use App\Models\User; use App\Models\VendorContact; +use App\Utils\Ninja; use App\Utils\Traits\MakesHash; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; @@ -46,48 +47,49 @@ class CompanyImport implements ShouldQueue protected $current_app_version; - public $company; - private $account; - public $file_path; + public $company; - private $backup_file; + public $user; - public $import_company; + private $hash; + + public $backup_file; public $ids = []; - private $options = ''; + private $request_array = []; private $importables = [ 'company', 'users', - // 'payment_terms', - // 'tax_rates', - // 'expense_categories', - // 'task_statuses', - // 'clients', - // 'client_contacts', - // 'products', - // 'vendors', - // 'projects', - // 'company_gateways', - // 'client_gateway_tokens', - // 'group_settings', - // 'credits', - // 'invoices', - // 'recurring_invoices', - // 'quotes', - // 'payments', - // 'subscriptions', - // 'expenses', - // 'tasks', - // 'documents', - // 'webhooks', - // 'system_logs', - // 'company_ledger', - // 'backups', + 'payment_terms', + 'tax_rates', + 'expense_categories', + 'task_statuses', + 'clients', + 'client_contacts', + 'products', + 'vendors', + 'projects', + 'company_gateways', + 'client_gateway_tokens', + 'group_settings', + 'credits', + 'invoices', + 'recurring_invoices', + 'quotes', + 'payments', + 'subscriptions', + 'expenses', + 'tasks', + 'documents', + 'webhooks', + 'activities', + 'backups', + 'system_logs', + 'company_ledger', ]; /** @@ -95,13 +97,14 @@ class CompanyImport implements ShouldQueue * * @param Company $company * @param User $user - * @param string $custom_token_name + * @param string $hash - the cache hash of the import data. + * @param array $request->all() */ - public function __construct(Company $company, string $file_path, array $options) + public function __construct(Company $company, User $user, string $hash, array $request_array) { $this->company = $company; - $this->file_path = $file_path; - $this->options = $options; + $this->hash = $hash; + $this->request_array = $request_array; $this->current_app_version = config('ninja.app_version'); } @@ -112,16 +115,24 @@ class CompanyImport implements ShouldQueue $this->company = Company::where('company_key', $this->company->company_key)->firstOrFail(); $this->account = $this->company->account; - $this->unzipFile() - ->preFlightChecks(); + $this->backup_file = Cache::get($this->hash); - foreach($this->importables as $import){ + if ( empty( $this->import_object ) ) + throw new \Exception('No import data found, has the cache expired?'); + + $this->backup_file = base64_decode($this->backup_file); - $method = Str::ucfirst(Str::camel($import)); - $this->{$method}(); + /* Determine what we have to import now - should we also purge existing data? */ - } + + // foreach($this->importables as $import){ + + // $method = Str::ucfirst(Str::camel($import)); + + // $this->{$method}(); + + // } } @@ -145,28 +156,31 @@ class CompanyImport implements ShouldQueue return $this; } - private function unzipFile() + + private function importSettings() { - $zip = new ZipArchive(); - $archive = $zip->open(public_path("storage/backups/{$this->file_path}")); - $filename = pathinfo($this->filepath, PATHINFO_FILENAME); - $zip->extractTo(public_path("storage/backups/{$filename}")); - $zip->close(); - $file_location = public_path("storage/backups/$filename/backup.json"); - if (! file_exists($file_location)) { - throw new NonExistingMigrationFile('Backup file does not exist, or it is corrupted.'); - } + $this->company->settings = $this->backup_file->company->settings; + $this->company->save(); - $this->backup_file = json_decode(file_get_contents($file_location)); - - return $this; + return $this; } private function importCompany() { + $tmp_company = $this->backup_file->company; + $tmp_company->company_key = $this->createHash(); + $tmp_company->db = config('database.default'); + $tmp_company->account_id = $this->account->id; + + if(Ninja::isHosted()) + $tmp_company->subdomain = MultiDB::randomSubdomainGenerator(); + else + $tmp_company->subdomain = ''; + + $this->company = $tmp_company; + $this->company->save(); - //$this->import_company = .. return $this; } From 631e7cc4a9f9970cc229e74891ab432888698dc4 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 31 May 2021 09:47:14 +1000 Subject: [PATCH 3/7] Working on company importer --- app/Jobs/Company/CompanyImport.php | 540 ++++++++++++++++++++- tests/Feature/Import/ImportCompanyTest.php | 3 - 2 files changed, 520 insertions(+), 23 deletions(-) diff --git a/app/Jobs/Company/CompanyImport.php b/app/Jobs/Company/CompanyImport.php index d7f5d60525da..ef3ad02788bf 100644 --- a/app/Jobs/Company/CompanyImport.php +++ b/app/Jobs/Company/CompanyImport.php @@ -19,13 +19,29 @@ use App\Jobs\Util\UnlinkFile; use App\Libraries\MultiDB; use App\Mail\DownloadBackup; use App\Mail\DownloadInvoices; +use App\Models\Activity; +use App\Models\Client; +use App\Models\ClientContact; use App\Models\Company; +use App\Models\CompanyGateway; +use App\Models\CompanyLedger; use App\Models\CompanyUser; +use App\Models\Credit; use App\Models\CreditInvitation; +use App\Models\Document; +use App\Models\Expense; +use App\Models\ExpenseCategory; use App\Models\InvoiceInvitation; +use App\Models\Payment; +use App\Models\PaymentTerm; +use App\Models\Paymentable; +use App\Models\Product; +use App\Models\Quote; use App\Models\QuoteInvitation; use App\Models\RecurringInvoice; use App\Models\RecurringInvoiceInvitation; +use App\Models\Subscription; +use App\Models\TaxRate; use App\Models\User; use App\Models\VendorContact; use App\Utils\Ninja; @@ -62,8 +78,9 @@ class CompanyImport implements ShouldQueue private $request_array = []; private $importables = [ - 'company', + // 'company', 'users', + 'company_users', 'payment_terms', 'tax_rates', 'expense_categories', @@ -122,18 +139,6 @@ class CompanyImport implements ShouldQueue $this->backup_file = base64_decode($this->backup_file); - - /* Determine what we have to import now - should we also purge existing data? */ - - - // foreach($this->importables as $import){ - - // $method = Str::ucfirst(Str::camel($import)); - - // $this->{$method}(); - - // } - } @@ -156,7 +161,6 @@ class CompanyImport implements ShouldQueue return $this; } - private function importSettings() { @@ -166,6 +170,20 @@ class CompanyImport implements ShouldQueue return $this; } + private function purgeCompanyData() + { + $this->company->clients()->forceDelete(); + $this->company->products()->forceDelete(); + $this->company->projects()->forceDelete(); + $this->company->tasks()->forceDelete(); + $this->company->vendors()->forceDelete(); + $this->company->expenses()->forceDelete(); + + $this->company->save(); + + return $this; + } + private function importCompany() { $tmp_company = $this->backup_file->company; @@ -177,14 +195,202 @@ class CompanyImport implements ShouldQueue $tmp_company->subdomain = MultiDB::randomSubdomainGenerator(); else $tmp_company->subdomain = ''; - + $this->company = $tmp_company; $this->company->save(); return $this; } - private function importUsers() + private function importData() + { + + foreach($this->importables as $import){ + + $method = "import_{$import}"; + + $this->{$method}(); + + } + + } + + private function import_payment_terms() + { + + $this->genericImport(PaymentTerm::class, + ['user_id', 'assigned_user_id', 'company_id', 'id', 'hashed_id'], + [['users' => 'user_id']], + 'payment_terms', + 'num_days'); + + return $this; + + } + + /* Cannot use generic as we are matching on two columns for existing data */ + private function import_tax_rates() + { + + foreach($this->backup_file->tax_rates as $obj) + { + + $user_id = $this->transformId('users', $obj->user_id); + + $obj_array = (array)$obj; + unset($obj_array['user_id']); + unset($obj_array['company_id']); + unset($obj_array['hashed_id']); + unset($obj_array['id']); + unset($obj_array['tax_rate_id']); + + $new_obj = TaxRate::firstOrNew( + ['name' => $obj->name, 'company_id' => $this->company->id, 'rate' => $obj->rate], + $obj_array, + ); + + $new_obj->save(['timestamps' => false]); + + } + + return $this; + } + + private function import_expense_categories() + { + + $this->genericImport(ExpenseCategory::class, + ['user_id', 'company_id', 'id', 'hashed_id'], + [['users' => 'user_id']], + 'expense_categories', + 'name'); + + return $this; + + } + + private function import_task_statuses() + { + + } + + private function import_clients() + { + + } + + private function import_client_contacts() + { + + } + + private function import_products() + { + + } + + private function import_vendors() + { + + } + + private function import_projects() + { + + } + + private function import_company_gateways() + { + + } + + private function import_client_gateway_tokens() + { + + } + + private function import_group_settings() + { + + } + + private function import_credits() + { + + } + + private function import_invoices() + { + + } + + private function import_recurring_invoices() + { + + } + + private function import_quotes() + { + + } + + private function import_quotes() + { + + } + + private function import_payments() + { + + } + + private function import_subscriptions() + { + + } + + private function import_expenses() + { + + } + + private function import_tasks() + { + + } + + private function import_documents() + { + + } + + private function import_webhooks() + { + + } + + private function import_activities() + { + + } + + private function import_backups() + { + + } + + private function import_system_logs() + { + + } + + private function import_company_ledger() + { + + } + + + private function import_users() { User::unguard(); @@ -210,7 +416,7 @@ class CompanyImport implements ShouldQueue } - private function importCompanyUsers() + private function import_company_users() { CompanyUser::unguard(); @@ -232,17 +438,311 @@ class CompanyImport implements ShouldQueue } - - public function transformId(string $resource, string $old): int + private function documentsImport() { + + foreach($this->backup_json_object->documents as $document) + { + + $new_document = new Document(); + $new_document->user_id = $this->transformId('users', $document->user_id); + $new_document->assigned_user_id = $this->transformId('users', $document->assigned_user_id); + $new_document->company_id = $this->company->id; + $new_document->project_id = $this->transformId('projects', $document->project_id); + $new_document->vendor_id = $this->transformId('vendors', $document->vendor_id); + $new_document->url = $document->url; + $new_document->preview = $document->preview; + $new_document->name = $document->name; + $new_document->type = $document->type; + $new_document->disk = $document->disk; + $new_document->hash = $document->hash; + $new_document->size = $document->size; + $new_document->width = $document->width; + $new_document->height = $document->height; + $new_document->is_default = $document->is_default; + $new_document->custom_value1 = $document->custom_value1; + $new_document->custom_value2 = $document->custom_value2; + $new_document->custom_value3 = $document->custom_value3; + $new_document->custom_value4 = $document->custom_value4; + $new_document->deleted_at = $document->deleted_at; + $new_document->documentable_id = $this->transformDocumentId($document->documentable_id, $document->documentable_type); + $new_document->documentable_type = $document->documentable_type; + + $new_document->save(['timestamps' => false]); + + } + } + + private function transformDocumentId($id, $type) + { + switch ($type) { + case Company::class: + return $this->company->id; + break; + case Client::class: + return $this->transformId('clients', $id); + break; + case ClientContact::class: + return $this->transformId('client_contacts', $id); + break; + case Credit::class: + return $this->transformId('credits', $id); + break; + case Expense::class: + return $this->transformId('expenses', $id); + break; + case 'invoices': + return $this->transformId('invoices', $id); + break; + case Payment::class: + return $this->transformId('payments', $id); + break; + case Product::class: + return $this->transformId('products', $id); + break; + case Quote::class: + return $this->transformId('quotes', $id); + break; + case RecurringInvoice::class: + return $this->transformId('recurring_invoices', $id); + break; + case Company::class: + return $this->transformId('clients', $id); + break; + + + default: + # code... + break; + } + } + + private function paymentablesImport() + { + + foreach($this->backup_json_object->payments as $payment) + { + + foreach($payment->paymentables as $paymentable_obj) + { + + $paymentable = new Paymentable(); + $paymentable->payment_id = $this->transformId('payments', $paymentable_obj->payment_id); + $paymentable->paymentable_type = $paymentable_obj->paymentable_type; + $paymentable->amount = $paymentable_obj->amount; + $paymentable->refunded = $paymentable_obj->refunded; + $paymentable->created_at = $paymentable_obj->created_at; + $paymentable->deleted_at = $paymentable_obj->deleted_at; + $paymentable->updated_at = $paymentable_obj->updated_at; + $paymentable->paymentable_id = $this->convertPaymentableId($paymentable_obj->paymentable_type, $paymentable_obj->paymentable_id); + $paymentable->paymentable_type = $paymentable_obj->paymentable_type; + $paymentable->save(['timestamps' => false]); + } + } + } + + private function convertPaymentableId($type, $id) + { + switch ($type) { + case 'invoices': + return $this->transformId('invoices', $id); + break; + case Credit::class: + return $this->transformId('credits', $id); + break; + case Payment::class: + return $this->transformId('payments', $id); + default: + # code... + break; + } + } + + + private function genericNewClassImport($class, $unset, $transforms, $object_property) + { + + $class::unguard(); + + foreach($this->backup_json_object->{$object_property} as $obj) + { + /* Remove unwanted keys*/ + $obj_array = (array)$obj; + foreach($unset as $un){ + unset($obj_array[$un]); + } + + $activity_invitation_key = false; + + if($class instanceof Activity){ + + if(isset($obj->invitation_id)){ + + if(isset($obj->invoice_id)) + $activity_invitation_key = 'invoice_invitations'; + elseif(isset($obj->quote_id)) + $activity_invitation_key = 'quote_invitations'; + elseif($isset($obj->credit_id)) + $activity_invitation_key = 'credit_invitations'; + } + + } + + /* Transform old keys to new keys */ + foreach($transforms as $transform) + { + foreach($transform as $key => $value) + { + if($class instanceof Activity && $activity_invitation_key) + $key = $activity_invitation_key; + + $obj_array["{$value}"] = $this->transformId($key, $obj->{$value}); + } + } + + if($class instanceof CompanyGateway) { + $obj_array['config'] = encrypt($obj_array['config']); + } + + $new_obj = new $class(); + $new_obj->company_id = $this->company->id; + $new_obj->fill($obj_array); + + $new_obj->save(['timestamps' => false]); + + $this->ids["{$object_property}"]["{$obj->hashed_id}"] = $new_obj->id; + + } + + $class::reguard(); + + + } + + private function genericImportWithoutCompany($class, $unset, $transforms, $object_property, $match_key) + { + + $class::unguard(); + + foreach($this->backup_json_object->{$object_property} as $obj) + { + /* Remove unwanted keys*/ + $obj_array = (array)$obj; + foreach($unset as $un){ + unset($obj_array[$un]); + } + + /* Transform old keys to new keys */ + foreach($transforms as $transform) + { + foreach($transform as $key => $value) + { + $obj_array["{$value}"] = $this->transformId($key, $obj->{$value}); + } + } + + /* New to convert product ids from old hashes to new hashes*/ + if($class == 'App\Models\Subscription'){ + $obj_array['product_ids'] = $this->recordProductIds($obj_array['product_ids']); + $obj_array['recurring_product_ids'] = $this->recordProductIds($obj_array['recurring_product_ids']); + } + + $new_obj = $class::firstOrNew( + [$match_key => $obj->{$match_key}], + $obj_array, + ); + + $new_obj->save(['timestamps' => false]); + + if($new_obj instanceof CompanyLedger){ + + } + else + $this->ids["{$object_property}"]["{$obj->hashed_id}"] = $new_obj->id; + + } + + $class::reguard(); + + } + + + private function genericImport($class, $unset, $transforms, $object_property, $match_key) + { + + $class::unguard(); + + foreach($this->backup_json_object->{$object_property} as $obj) + { + /* Remove unwanted keys*/ + $obj_array = (array)$obj; + foreach($unset as $un){ + unset($obj_array[$un]); + } + + /* Transform old keys to new keys */ + foreach($transforms as $transform) + { + foreach($transform as $key => $value) + { + $obj_array["{$value}"] = $this->transformId($key, $obj->{$value}); + } + } + + /* New to convert product ids from old hashes to new hashes*/ + if($class == 'App\Models\Subscription'){ + $obj_array['product_ids'] = $this->recordProductIds($obj_array['product_ids']); + $obj_array['recurring_product_ids'] = $this->recordProductIds($obj_array['recurring_product_ids']); + } + + $new_obj = $class::firstOrNew( + [$match_key => $obj->{$match_key}, 'company_id' => $this->company->id], + $obj_array, + ); + + $new_obj->save(['timestamps' => false]); + + if($new_obj instanceof CompanyLedger){ + } + else + $this->ids["{$object_property}"]["{$obj->hashed_id}"] = $new_obj->id; + + } + + $class::reguard(); + + } + + private function recordProductIds($ids) + { + + $id_array = explode(",", $ids); + + $tmp_arr = []; + + foreach($id_array as $id) { + + $tmp_arr[] = $this->encodePrimaryKey($this->transformId('products', $id)); + } + + return implode(",", $tmp_arr); + } + + private function transformId(string $resource, ?string $old): ?int + { + if(empty($old)) + return null; + if (! array_key_exists($resource, $this->ids)) { throw new \Exception("Resource {$resource} not available."); } if (! array_key_exists("{$old}", $this->ids[$resource])) { - throw new \Exception("Missing resource key: {$old}"); + throw new \Exception("Missing {$resource} key: {$old}"); } return $this->ids[$resource]["{$old}"]; } + + } \ No newline at end of file diff --git a/tests/Feature/Import/ImportCompanyTest.php b/tests/Feature/Import/ImportCompanyTest.php index ae3b5d3ce750..c1ce14e7794d 100644 --- a/tests/Feature/Import/ImportCompanyTest.php +++ b/tests/Feature/Import/ImportCompanyTest.php @@ -283,7 +283,6 @@ class ImportCompanyTest extends TestCase $obj_array = (array)$obj; unset($obj_array['user_id']); unset($obj_array['company_id']); - unset($obj_array['account_id']); unset($obj_array['hashed_id']); unset($obj_array['id']); unset($obj_array['tax_rate_id']); @@ -315,10 +314,8 @@ class ImportCompanyTest extends TestCase $obj_array = (array)$obj; unset($obj_array['user_id']); unset($obj_array['company_id']); - unset($obj_array['account_id']); unset($obj_array['hashed_id']); unset($obj_array['id']); - unset($obj_array['tax_rate_id']); $new_obj = ExpenseCategory::firstOrNew( ['name' => $obj->name, 'company_id' => $this->company->id], From eca644670365253ee4c59dae926f7b339c8df01c Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 31 May 2021 10:10:19 +1000 Subject: [PATCH 4/7] Working on company importer --- app/Jobs/Company/CompanyImport.php | 193 +++++++++++++++++---- tests/Feature/Import/ImportCompanyTest.php | 2 - 2 files changed, 159 insertions(+), 36 deletions(-) diff --git a/app/Jobs/Company/CompanyImport.php b/app/Jobs/Company/CompanyImport.php index ef3ad02788bf..d9895ef52358 100644 --- a/app/Jobs/Company/CompanyImport.php +++ b/app/Jobs/Company/CompanyImport.php @@ -22,6 +22,7 @@ use App\Mail\DownloadInvoices; use App\Models\Activity; use App\Models\Client; use App\Models\ClientContact; +use App\Models\ClientGatewayToken; use App\Models\Company; use App\Models\CompanyGateway; use App\Models\CompanyLedger; @@ -31,6 +32,7 @@ use App\Models\CreditInvitation; use App\Models\Document; use App\Models\Expense; use App\Models\ExpenseCategory; +use App\Models\GroupSetting; use App\Models\InvoiceInvitation; use App\Models\Payment; use App\Models\PaymentTerm; @@ -41,8 +43,10 @@ use App\Models\QuoteInvitation; use App\Models\RecurringInvoice; use App\Models\RecurringInvoiceInvitation; use App\Models\Subscription; +use App\Models\TaskStatus; use App\Models\TaxRate; use App\Models\User; +use App\Models\Vendor; use App\Models\VendorContact; use App\Utils\Ninja; use App\Utils\Traits\MakesHash; @@ -87,18 +91,22 @@ class CompanyImport implements ShouldQueue 'task_statuses', 'clients', 'client_contacts', - 'products', 'vendors', 'projects', + 'products', 'company_gateways', 'client_gateway_tokens', 'group_settings', - 'credits', - 'invoices', - 'recurring_invoices', - 'quotes', - 'payments', 'subscriptions', + 'recurring_invoices', + 'recurring_invoice_invitations', + 'invoices', + 'invoice_invitations', + 'quotes', + 'quote_invitations', + 'credits', + 'credit_invitations', + 'payments', 'expenses', 'tasks', 'documents', @@ -271,45 +279,181 @@ class CompanyImport implements ShouldQueue private function import_task_statuses() { + + $this->genericImport(TaskStatus::class, + ['user_id', 'company_id', 'id', 'hashed_id'], + [['users' => 'user_id']], + 'task_statuses', + 'name'); + + return $this; } private function import_clients() { + + $this->genericImport(Client::class, + ['user_id', 'assigned_user_id', 'company_id', 'id', 'hashed_id', 'gateway_tokens', 'contacts', 'documents'], + [['users' => 'user_id'], ['users' => 'assigned_user_id']], + 'clients', + 'number'); + + return $this; } private function import_client_contacts() { - - } - private function import_products() - { + $this->genericImport(ClientContact::class, + ['user_id', 'assigned_user_id', 'company_id', 'id', 'hashed_id'], + [['users' => 'user_id'], ['users' => 'assigned_user_id']], + 'client_contacts', + 'email'); + + return $this; } private function import_vendors() { - + + $this->genericImport(Vendor::class, + ['user_id', 'assigned_user_id', 'company_id', 'id', 'hashed_id'], + [['users' => 'user_id'], ['users' =>'assigned_user_id']], + 'vendors', + 'number'); + + return $this; } private function import_projects() { - + + $this->genericImport(Project::class, + ['user_id', 'assigned_user_id', 'company_id', 'id', 'hashed_id','client_id'], + [['users' => 'user_id'], ['users' =>'assigned_user_id'], ['clients' => 'client_id']], + 'projects', + 'number'); + + return $this; + } + + private function import_products() + { + + $this->genericNewClassImport(Product::class, + ['user_id', 'company_id', 'hashed_id', 'id'], + [['users' => 'user_id'], ['users' =>'assigned_user_id'], ['vendors' => 'vendor_id'], ['projects' => 'project_id']], + 'products' + ); + + return $this; } private function import_company_gateways() { - + + $this->genericNewClassImport(CompanyGateway::class, + ['user_id', 'company_id', 'hashed_id', 'id'], + [['users' => 'user_id']], + 'company_gateways' + ); + + return $this; } private function import_client_gateway_tokens() { - + + $this->genericNewClassImport(ClientGatewayToken::class, + ['company_id', 'id', 'hashed_id','client_id'], + [['clients' => 'client_id']], + 'client_gateway_tokens'); + + return $this; } private function import_group_settings() + { + + $this->genericImport(GroupSetting::class, + ['user_id', 'company_id', 'id', 'hashed_id',], + [['users' => 'user_id']], + 'group_settings', + 'name'); + + return $this; + } + + private function import_subscriptions() + { + + $this->genericImport(Subscription::class, + ['user_id', 'assigned_user_id', 'company_id', 'id', 'hashed_id',], + [['group_settings' => 'group_id'], ['users' => 'user_id'], ['users' => 'assigned_user_id']], + 'subscriptions', + 'name'); + + return $this; + } + + private function import_recurring_invoices() + { + + $this->genericImport(RecurringInvoice::class, + ['user_id', 'assigned_user_id', 'company_id', 'id', 'hashed_id', 'client_id','subscription_id','project_id','vendor_id','status'], + [ + ['subscriptions' => 'subscription_id'], + ['users' => 'user_id'], + ['users' => 'assigned_user_id'], + ['clients' => 'client_id'], + ['projects' => 'project_id'], + ['vendors' => 'vendor_id'], + ['clients' => 'client_id'], + ], + 'recurring_invoices', + 'number'); + + return $this; + + } + + private function import_recurring_invoice_invitations() + { + + + $this->genericImport(RecurringInvoiceInvitation::class, + ['user_id', 'client_contact_id', 'company_id', 'id', 'hashed_id', 'recurring_invoice_id'], + [ + ['users' => 'user_id'], + ['recurring_invoices' => 'recurring_invoice_id'], + ['client_contacts' => 'client_contact_id'], + ], + 'recurring_invoice_invitations', + 'key'); + + return $this; + + } + + private function import_invoices() + { + + } + + private function import_invoice_invitations() + { + + } + + private function import_quotes() + { + + } + + private function import_quote_invitations() { } @@ -319,22 +463,7 @@ class CompanyImport implements ShouldQueue } - private function import_invoices() - { - - } - - private function import_recurring_invoices() - { - - } - - private function import_quotes() - { - - } - - private function import_quotes() + private function import_credit_invitations() { } @@ -344,10 +473,6 @@ class CompanyImport implements ShouldQueue } - private function import_subscriptions() - { - - } private function import_expenses() { diff --git a/tests/Feature/Import/ImportCompanyTest.php b/tests/Feature/Import/ImportCompanyTest.php index c1ce14e7794d..0028579d493e 100644 --- a/tests/Feature/Import/ImportCompanyTest.php +++ b/tests/Feature/Import/ImportCompanyTest.php @@ -345,10 +345,8 @@ class ImportCompanyTest extends TestCase $obj_array = (array)$obj; unset($obj_array['user_id']); unset($obj_array['company_id']); - unset($obj_array['account_id']); unset($obj_array['hashed_id']); unset($obj_array['id']); - unset($obj_array['tax_rate_id']); $new_obj = TaskStatus::firstOrNew( ['name' => $obj->name, 'company_id' => $this->company->id], From 0b5232162b962f4d3fd40e38acacb23ae597d939 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 31 May 2021 10:22:30 +1000 Subject: [PATCH 5/7] Working on company importer --- app/Jobs/Company/CompanyImport.php | 364 +++++++++++++++++++++++------ 1 file changed, 297 insertions(+), 67 deletions(-) diff --git a/app/Jobs/Company/CompanyImport.php b/app/Jobs/Company/CompanyImport.php index d9895ef52358..766d7b0de265 100644 --- a/app/Jobs/Company/CompanyImport.php +++ b/app/Jobs/Company/CompanyImport.php @@ -29,10 +29,12 @@ use App\Models\CompanyLedger; use App\Models\CompanyUser; use App\Models\Credit; use App\Models\CreditInvitation; +use App\Models\Design; use App\Models\Document; use App\Models\Expense; use App\Models\ExpenseCategory; use App\Models\GroupSetting; +use App\Models\Invoice; use App\Models\InvoiceInvitation; use App\Models\Payment; use App\Models\PaymentTerm; @@ -43,11 +45,13 @@ use App\Models\QuoteInvitation; use App\Models\RecurringInvoice; use App\Models\RecurringInvoiceInvitation; use App\Models\Subscription; +use App\Models\Task; use App\Models\TaskStatus; use App\Models\TaxRate; use App\Models\User; use App\Models\Vendor; use App\Models\VendorContact; +use App\Models\Webhook; use App\Utils\Ninja; use App\Utils\Traits\MakesHash; use Illuminate\Bus\Queueable; @@ -106,15 +110,16 @@ class CompanyImport implements ShouldQueue 'quote_invitations', 'credits', 'credit_invitations', - 'payments', 'expenses', 'tasks', - 'documents', - 'webhooks', + 'payments', 'activities', 'backups', - 'system_logs', 'company_ledger', + 'designs', + 'documents', + 'webhooks', + 'system_logs', ]; /** @@ -440,80 +445,336 @@ class CompanyImport implements ShouldQueue private function import_invoices() { - + + $this->genericImport(Invoice::class, + ['user_id', 'client_id', 'company_id', 'id', 'hashed_id', 'recurring_id','status'], + [ + ['users' => 'user_id'], + ['users' => 'assigned_user_id'], + ['recurring_invoices' => 'recurring_id'], + ['clients' => 'client_id'], + ['subscriptions' => 'subscription_id'], + ['projects' => 'project_id'], + ['vendors' => 'vendor_id'], + ], + 'invoices', + 'number'); + + return $this; } private function import_invoice_invitations() { - + + + $this->genericImport(InvoiceInvitation::class, + ['user_id', 'client_contact_id', 'company_id', 'id', 'hashed_id', 'invoice_id'], + [ + ['users' => 'user_id'], + ['invoices' => 'invoice_id'], + ['client_contacts' => 'client_contact_id'], + ], + 'invoice_invitations', + 'key'); + + return $this; } private function import_quotes() { - + + $this->genericImport(Quote::class, + ['user_id', 'client_id', 'company_id', 'id', 'hashed_id', 'recurring_id','status'], + [ + ['users' => 'user_id'], + ['users' => 'assigned_user_id'], + ['recurring_invoices' => 'recurring_id'], + ['clients' => 'client_id'], + ['subscriptions' => 'subscription_id'], + ['projects' => 'project_id'], + ['vendors' => 'vendor_id'], + ], + 'quotes', + 'number'); + + return $this; + } private function import_quote_invitations() { - + + $this->genericImport(QuoteInvitation::class, + ['user_id', 'client_contact_id', 'company_id', 'id', 'hashed_id', 'quote_id'], + [ + ['users' => 'user_id'], + ['quotes' => 'quote_id'], + ['client_contacts' => 'client_contact_id'], + ], + 'quote_invitations', + 'key'); + + + return $this; } private function import_credits() { - + + + $this->genericImport(Credit::class, + ['user_id', 'client_id', 'company_id', 'id', 'hashed_id', 'recurring_id','status'], + [ + ['users' => 'user_id'], + ['users' => 'assigned_user_id'], + ['recurring_invoices' => 'recurring_id'], + ['clients' => 'client_id'], + ['subscriptions' => 'subscription_id'], + ['projects' => 'project_id'], + ['vendors' => 'vendor_id'], + ], + 'credits', + 'number'); + + return $this; } private function import_credit_invitations() { - - } - private function import_payments() - { - - } + $this->genericImport(CreditInvitation::class, + ['user_id', 'client_contact_id', 'company_id', 'id', 'hashed_id', 'credit_id'], + [ + ['users' => 'user_id'], + ['credits' => 'credit_id'], + ['client_contacts' => 'client_contact_id'], + ], + 'credit_invitations', + 'key'); + return $this; + } private function import_expenses() { - + + + $this->genericImport(Expense::class, + ['assigned_user_id', 'user_id', 'client_id', 'company_id', 'id', 'hashed_id', 'project_id','vendor_id'], + [ + ['users' => 'user_id'], + ['users' => 'assigned_user_id'], + ['clients' => 'client_id'], + ['projects' => 'project_id'], + ['vendors' => 'vendor_id'], + ], + 'expenses', + 'number'); + + return $this; + } private function import_tasks() { - + + $this->genericImport(Task::class, + ['assigned_user_id', 'user_id', 'client_id', 'company_id', 'id', 'hashed_id', 'invoice_id','project_id'], + [ + ['users' => 'user_id'], + ['users' => 'assigned_user_id'], + ['clients' => 'client_id'], + ['projects' => 'project_id'], + ['invoices' => 'invoice_id'], + ], + 'tasks', + 'number'); + + return $this; } - private function import_documents() + private function import_payments() { - - } - private function import_webhooks() - { + $this->genericImport(Payment::class, + ['assigned_user_id', 'user_id', 'client_id', 'company_id', 'id', 'hashed_id', 'client_contact_id','invitation_id','vendor_id','paymentables'], + [ + ['users' => 'user_id'], + ['users' => 'assigned_user_id'], + ['clients' => 'client_id'], + ['client_contacts' => 'client_contact_id'], + ['vendors' => 'vendor_id'], + ['invoice_invitations' => 'invitation_id'], + ['company_gateways' => 'company_gateway_id'], + ], + 'payments', + 'number'); + $this->paymentablesImport(); + + return $this; } private function import_activities() { - + + $activities = []; + + foreach($this->backup_file->activities as $activity) + { + $activity->account_id = $this->account->id; + $activities[] = $activity; + } + + $this->backup_file->activities = $activities; + + $this->genericImport(Activity::class, + [ + 'user_id', + 'company_id', + 'client_id', + 'client_contact_id', + 'project_id', + 'vendor_id', + 'payment_id', + 'invoice_id', + 'credit_id', + 'invitation_id', + 'task_id', + 'expense_id', + 'token_id', + 'quote_id', + 'subscription_id', + 'recurring_invoice_id', + 'hashed_id', + 'company_id', + ], + [ + ['users' => 'user_id'], + ['clients' => 'client_id'], + ['client_contacts' => 'client_contact_id'], + ['projects' => 'project_id'], + ['vendors' => 'vendor_id'], + ['payments' => 'payment_id'], + ['invoices' => 'invoice_id'], + ['credits' => 'credit_id'], + ['tasks' => 'task_id'], + ['expenses' => 'expense_id'], + ['quotes' => 'quote_id'], + ['subscriptions' => 'subscription_id'], + ['recurring_invoices' => 'recurring_invoice_id'], + ['invitations' => 'invitation_id'], + ], + 'activities', + 'created_at'); + + return $this; + } private function import_backups() { - - } - private function import_system_logs() - { - - } + $this->genericImportWithoutCompany(Backup::class, + ['activity_id','hashed_id'], + [ + ['activities' => 'activity_id'], + ], + 'backups', + 'created_at'); + + + return $this; + } private function import_company_ledger() { + + $this->genericImport(CompanyLedger::class, + ['company_id', 'user_id', 'client_id', 'activity_id', 'id','account_id'], + [ + ['users' => 'user_id'], + ['clients' => 'client_id'], + ['activities' => 'activity_id'], + ], + 'company_ledger', + 'created_at'); + + return $this; } - + + private function import_designs() + { + + $this->genericImport(Design::class, + ['company_id', 'user_id'], + [ + ['users' => 'user_id'], + ], + 'designs', + 'name'); + + return $this; + + } + + private function import_documents() + { + + foreach($this->backup_file->documents as $document) + { + + $new_document = new Document(); + $new_document->user_id = $this->transformId('users', $document->user_id); + $new_document->assigned_user_id = $this->transformId('users', $document->assigned_user_id); + $new_document->company_id = $this->company->id; + $new_document->project_id = $this->transformId('projects', $document->project_id); + $new_document->vendor_id = $this->transformId('vendors', $document->vendor_id); + $new_document->url = $document->url; + $new_document->preview = $document->preview; + $new_document->name = $document->name; + $new_document->type = $document->type; + $new_document->disk = $document->disk; + $new_document->hash = $document->hash; + $new_document->size = $document->size; + $new_document->width = $document->width; + $new_document->height = $document->height; + $new_document->is_default = $document->is_default; + $new_document->custom_value1 = $document->custom_value1; + $new_document->custom_value2 = $document->custom_value2; + $new_document->custom_value3 = $document->custom_value3; + $new_document->custom_value4 = $document->custom_value4; + $new_document->deleted_at = $document->deleted_at; + $new_document->documentable_id = $this->transformDocumentId($document->documentable_id, $document->documentable_type); + $new_document->documentable_type = $document->documentable_type; + + $new_document->save(['timestamps' => false]); + + } + + return $this; + } + + private function import_webhooks() + { + + $this->genericImport(Webhook::class, + ['company_id', 'user_id'], + [ + ['users' => 'user_id'], + ], + 'webhooks', + 'created_at'); + + return $this; + } + + + private function import_system_logs() + { + return $this; + } private function import_users() { @@ -563,40 +824,7 @@ class CompanyImport implements ShouldQueue } - private function documentsImport() - { - foreach($this->backup_json_object->documents as $document) - { - - $new_document = new Document(); - $new_document->user_id = $this->transformId('users', $document->user_id); - $new_document->assigned_user_id = $this->transformId('users', $document->assigned_user_id); - $new_document->company_id = $this->company->id; - $new_document->project_id = $this->transformId('projects', $document->project_id); - $new_document->vendor_id = $this->transformId('vendors', $document->vendor_id); - $new_document->url = $document->url; - $new_document->preview = $document->preview; - $new_document->name = $document->name; - $new_document->type = $document->type; - $new_document->disk = $document->disk; - $new_document->hash = $document->hash; - $new_document->size = $document->size; - $new_document->width = $document->width; - $new_document->height = $document->height; - $new_document->is_default = $document->is_default; - $new_document->custom_value1 = $document->custom_value1; - $new_document->custom_value2 = $document->custom_value2; - $new_document->custom_value3 = $document->custom_value3; - $new_document->custom_value4 = $document->custom_value4; - $new_document->deleted_at = $document->deleted_at; - $new_document->documentable_id = $this->transformDocumentId($document->documentable_id, $document->documentable_type); - $new_document->documentable_type = $document->documentable_type; - - $new_document->save(['timestamps' => false]); - - } - } private function transformDocumentId($id, $type) { @@ -645,7 +873,7 @@ class CompanyImport implements ShouldQueue private function paymentablesImport() { - foreach($this->backup_json_object->payments as $payment) + foreach($this->backup_file->payments as $payment) { foreach($payment->paymentables as $paymentable_obj) @@ -664,6 +892,8 @@ class CompanyImport implements ShouldQueue $paymentable->save(['timestamps' => false]); } } + + return $this; } private function convertPaymentableId($type, $id) @@ -689,7 +919,7 @@ class CompanyImport implements ShouldQueue $class::unguard(); - foreach($this->backup_json_object->{$object_property} as $obj) + foreach($this->backup_file->{$object_property} as $obj) { /* Remove unwanted keys*/ $obj_array = (array)$obj; @@ -749,7 +979,7 @@ class CompanyImport implements ShouldQueue $class::unguard(); - foreach($this->backup_json_object->{$object_property} as $obj) + foreach($this->backup_file->{$object_property} as $obj) { /* Remove unwanted keys*/ $obj_array = (array)$obj; @@ -797,7 +1027,7 @@ class CompanyImport implements ShouldQueue $class::unguard(); - foreach($this->backup_json_object->{$object_property} as $obj) + foreach($this->backup_file->{$object_property} as $obj) { /* Remove unwanted keys*/ $obj_array = (array)$obj; From b9191bf67af040af785d7233dc8f5020127e65ef Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 31 May 2021 15:27:26 +1000 Subject: [PATCH 6/7] Company Ledger Adjustment --- app/Console/Commands/SendRemindersCron.php | 7 ++- app/Http/Controllers/ClientController.php | 57 +++++++++++++++++++ .../Client/AdjustClientLedgerRequest.php | 55 ++++++++++++++++++ app/Jobs/Util/WebhookHandler.php | 4 +- routes/api.php | 1 + 5 files changed, 119 insertions(+), 5 deletions(-) create mode 100644 app/Http/Requests/Client/AdjustClientLedgerRequest.php diff --git a/app/Console/Commands/SendRemindersCron.php b/app/Console/Commands/SendRemindersCron.php index 54d00824d2f4..45177ef269c8 100644 --- a/app/Console/Commands/SendRemindersCron.php +++ b/app/Console/Commands/SendRemindersCron.php @@ -12,12 +12,12 @@ namespace App\Console\Commands; use App\Jobs\Ninja\SendReminders; -use App\Jobs\Util\WebHookHandler; use App\Libraries\MultiDB; use App\Models\Invoice; use App\Models\Quote; use App\Models\Webhook; use Illuminate\Console\Command; +use App\Jobs\Util\WebhookHandler; class SendRemindersCron extends Command { @@ -54,8 +54,8 @@ class SendRemindersCron extends Command { SendReminders::dispatchNow(); - $this->webHookOverdueInvoices(); - $this->webHookExpiredQuotes(); + $this->webHookOverdueInvoices(); + $this->webHookExpiredQuotes(); } private function webHookOverdueInvoices() @@ -90,6 +90,7 @@ class SendRemindersCron extends Command $invoices->each(function ($invoice) { WebHookHandler::dispatch(Webhook::EVENT_LATE_INVOICE, $invoice, $invoice->company); + }); $quotes = Quote::where('is_deleted', 0) diff --git a/app/Http/Controllers/ClientController.php b/app/Http/Controllers/ClientController.php index 89e29a16cf44..6b83d04019cd 100644 --- a/app/Http/Controllers/ClientController.php +++ b/app/Http/Controllers/ClientController.php @@ -585,4 +585,61 @@ class ClientController extends BaseController } +/** + * Update the specified resource in storage. + * + * @param UploadClientRequest $request + * @param Client $client + * @return Response + * + * + * + * @OA\Put( + * path="/api/v1/clients/{id}/adjust_ledger", + * operationId="adjustLedger", + * tags={"clients"}, + * summary="Adjust the client ledger to rebalance", + * description="Adjust the client ledger to rebalance", + * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), + * @OA\Parameter(ref="#/components/parameters/X-Api-Token"), + * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), + * @OA\Parameter(ref="#/components/parameters/include"), + * @OA\Parameter( + * name="id", + * in="path", + * description="The Client Hashed ID", + * example="D2J234DFA", + * required=true, + * @OA\Schema( + * type="string", + * format="string", + * ), + * ), + * @OA\Response( + * response=200, + * description="Returns the client object", + * @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"), + * @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), + * @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), + * @OA\JsonContent(ref="#/components/schemas/Client"), + * ), + * @OA\Response( + * response=422, + * description="Validation error", + * @OA\JsonContent(ref="#/components/schemas/ValidationError"), + * + * ), + * @OA\Response( + * response="default", + * description="Unexpected Error", + * @OA\JsonContent(ref="#/components/schemas/Error"), + * ), + * ) + */ + + public function adjustLedger(Request $request, Client $client) + { + + } + } diff --git a/app/Http/Requests/Client/AdjustClientLedgerRequest.php b/app/Http/Requests/Client/AdjustClientLedgerRequest.php new file mode 100644 index 000000000000..7fe6cc8bda64 --- /dev/null +++ b/app/Http/Requests/Client/AdjustClientLedgerRequest.php @@ -0,0 +1,55 @@ +user()->can('edit', $this->client); + } + + public function rules() + { + /* Ensure we have a client name, and that all emails are unique*/ + + $rules = []; + + return $rules; + } + + public function messages() + { + return [ + ]; + } + + protected function prepareForValidation() + { + $input = $this->all(); + + $this->replace($input); + } + + +} diff --git a/app/Jobs/Util/WebhookHandler.php b/app/Jobs/Util/WebhookHandler.php index 970ecc07de86..35fb4274ef88 100644 --- a/app/Jobs/Util/WebhookHandler.php +++ b/app/Jobs/Util/WebhookHandler.php @@ -35,9 +35,9 @@ class WebhookHandler implements ShouldQueue private $company; - public $tries = 5; //number of retries + public $tries = 3; //number of retries - public $backoff = 5; //seconds to wait until retry + public $backoff = 10; //seconds to wait until retry public $deleteWhenMissingModels = true; diff --git a/routes/api.php b/routes/api.php index 1ce7f9bc8ce3..1a8a3e11387e 100644 --- a/routes/api.php +++ b/routes/api.php @@ -34,6 +34,7 @@ Route::group(['middleware' => ['api_db', 'token_auth', 'locale'], 'prefix' => 'a Route::post('claim_license', 'LicenseController@index')->name('license.index'); Route::resource('clients', 'ClientController'); // name = (clients. index / create / show / update / destroy / edit + Route::put('clients/{client}/adjust_ledger', 'ClientController@adjustLedger')->name('clients.adjust_ledger'); Route::put('clients/{client}/upload', 'ClientController@upload')->name('clients.upload'); Route::post('clients/bulk', 'ClientController@bulk')->name('clients.bulk'); From a2a29282b0a05a5f6616aad0d0270202111674e2 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 31 May 2021 17:18:37 +1000 Subject: [PATCH 7/7] v5.1.67 --- VERSION.txt | 2 +- config/ninja.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index 248ea8b88544..8dad1afa6db4 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.1.66 \ No newline at end of file +5.1.67 \ No newline at end of file diff --git a/config/ninja.php b/config/ninja.php index 1c31e50de6a4..a02b576ccfb9 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -14,8 +14,8 @@ return [ 'require_https' => env('REQUIRE_HTTPS', true), 'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'), - 'app_version' => '5.1.66', - 'app_tag' => '5.1.66-release', + 'app_version' => '5.1.67', + 'app_tag' => '5.1.67-release', 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', ''),