mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 18:54:30 -04:00
Minor fixes for impmort
This commit is contained in:
parent
b0f5ca8638
commit
d2bb8d6d81
@ -192,6 +192,15 @@ class Import implements ShouldQueue
|
|||||||
$array = json_decode(file_get_contents($this->file_path), 1);
|
$array = json_decode(file_get_contents($this->file_path), 1);
|
||||||
$data = $array['data'];
|
$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) {
|
foreach ($this->available_imports as $import) {
|
||||||
if (! array_key_exists($import, $data)) {
|
if (! array_key_exists($import, $data)) {
|
||||||
//throw new ResourceNotAvailableForMigration("Resource {$key} is not available for migration.");
|
//throw new ResourceNotAvailableForMigration("Resource {$key} is not available for migration.");
|
||||||
@ -211,9 +220,10 @@ class Import implements ShouldQueue
|
|||||||
// $this->fixClientBalances();
|
// $this->fixClientBalances();
|
||||||
$check_data = CheckCompanyData::dispatchNow($this->company, md5(time()));
|
$check_data = CheckCompanyData::dispatchNow($this->company, md5(time()));
|
||||||
|
|
||||||
// if($check_data['status'] == 'errors')
|
//reset functionality here
|
||||||
// throw new ProcessingMigrationArchiveFailed(implode("\n", $check_data));
|
$this->company->update_products = $update_product_state;
|
||||||
|
$this->company->save();
|
||||||
|
|
||||||
try{
|
try{
|
||||||
Mail::to($this->user->email, $this->user->name())
|
Mail::to($this->user->email, $this->user->name())
|
||||||
->send(new MigrationCompleted($this->company, implode("<br>",$check_data)));
|
->send(new MigrationCompleted($this->company, implode("<br>",$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*/
|
/*After a migration first some basic jobs to ensure the system is up to date*/
|
||||||
VersionCheck::dispatch();
|
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());
|
info('Completed🚀🚀🚀🚀🚀 at '.now());
|
||||||
|
|
||||||
|
@ -35,12 +35,12 @@ class ProductFactory extends Factory
|
|||||||
'cost' => $this->faker->numberBetween(1, 1000),
|
'cost' => $this->faker->numberBetween(1, 1000),
|
||||||
'price' => $this->faker->numberBetween(1, 1000),
|
'price' => $this->faker->numberBetween(1, 1000),
|
||||||
'quantity' => $this->faker->numberBetween(1, 100),
|
'quantity' => $this->faker->numberBetween(1, 100),
|
||||||
'tax_name1' => 'GST',
|
// 'tax_name1' => 'GST',
|
||||||
'tax_rate1' => 10,
|
// 'tax_rate1' => 10,
|
||||||
'tax_name2' => 'VAT',
|
// 'tax_name2' => 'VAT',
|
||||||
'tax_rate2' => 17.5,
|
// 'tax_rate2' => 17.5,
|
||||||
'tax_name3' => 'THIRDTAX',
|
// 'tax_name3' => 'THIRDTAX',
|
||||||
'tax_rate3' => 5,
|
// 'tax_rate3' => 5,
|
||||||
'custom_value1' => $this->faker->text(20),
|
'custom_value1' => $this->faker->text(20),
|
||||||
'custom_value2' => $this->faker->text(20),
|
'custom_value2' => $this->faker->text(20),
|
||||||
'custom_value3' => $this->faker->text(20),
|
'custom_value3' => $this->faker->text(20),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user