diff --git a/app/Jobs/Util/Import.php b/app/Jobs/Util/Import.php index fdb46be634dd..a50b64db9383 100644 --- a/app/Jobs/Util/Import.php +++ b/app/Jobs/Util/Import.php @@ -192,6 +192,15 @@ class Import implements ShouldQueue $array = json_decode(file_get_contents($this->file_path), 1); $data = $array['data']; + + // disable some functionality here: + // 1. disable update_products + + $update_product_state = $this->company->update_products; + + $this->company->update_products = false; + $this->company->save(); + foreach ($this->available_imports as $import) { if (! array_key_exists($import, $data)) { //throw new ResourceNotAvailableForMigration("Resource {$key} is not available for migration."); @@ -211,9 +220,10 @@ class Import implements ShouldQueue // $this->fixClientBalances(); $check_data = CheckCompanyData::dispatchNow($this->company, md5(time())); - // if($check_data['status'] == 'errors') - // throw new ProcessingMigrationArchiveFailed(implode("\n", $check_data)); - + //reset functionality here + $this->company->update_products = $update_product_state; + $this->company->save(); + try{ Mail::to($this->user->email, $this->user->name()) ->send(new MigrationCompleted($this->company, implode("
",$check_data))); @@ -224,7 +234,12 @@ class Import implements ShouldQueue /*After a migration first some basic jobs to ensure the system is up to date*/ VersionCheck::dispatch(); - CompanySizeCheck::dispatch(); + + //company size check + if ($this->company->invoices()->count() > 1000 || $this->company->products()->count() > 1000 || $this->company->clients()->count() > 1000) { + $company->is_large = true; + $company->save(); + } info('CompletedπŸš€πŸš€πŸš€πŸš€πŸš€ at '.now()); diff --git a/database/factories/ProductFactory.php b/database/factories/ProductFactory.php index 12f41ccd03cc..3ef22ae4bade 100644 --- a/database/factories/ProductFactory.php +++ b/database/factories/ProductFactory.php @@ -35,12 +35,12 @@ class ProductFactory extends Factory 'cost' => $this->faker->numberBetween(1, 1000), 'price' => $this->faker->numberBetween(1, 1000), 'quantity' => $this->faker->numberBetween(1, 100), - 'tax_name1' => 'GST', - 'tax_rate1' => 10, - 'tax_name2' => 'VAT', - 'tax_rate2' => 17.5, - 'tax_name3' => 'THIRDTAX', - 'tax_rate3' => 5, + // 'tax_name1' => 'GST', + // 'tax_rate1' => 10, + // 'tax_name2' => 'VAT', + // 'tax_rate2' => 17.5, + // 'tax_name3' => 'THIRDTAX', + // 'tax_rate3' => 5, 'custom_value1' => $this->faker->text(20), 'custom_value2' => $this->faker->text(20), 'custom_value3' => $this->faker->text(20),