diff --git a/app/Jobs/Product/UpdateOrCreateProduct.php b/app/Jobs/Product/UpdateOrCreateProduct.php index 156159791934..b5149e6b84cd 100644 --- a/app/Jobs/Product/UpdateOrCreateProduct.php +++ b/app/Jobs/Product/UpdateOrCreateProduct.php @@ -55,6 +55,9 @@ class UpdateOrCreateProduct implements ShouldQueue { MultiDB::setDB($this->company->db); + if(strval($this->invoice->client->getSetting('currency_id')) != strval($this->company->settings->currency_id)) + return; + /* * If the invoice was generated from a Task or Expense then * we do NOT update the product details this short block we diff --git a/tests/Unit/CompanySettingsTest.php b/tests/Unit/CompanySettingsTest.php index fca71d397064..de748e2f2839 100644 --- a/tests/Unit/CompanySettingsTest.php +++ b/tests/Unit/CompanySettingsTest.php @@ -55,4 +55,36 @@ class CompanySettingsTest extends TestCase $this->assertEquals(1, count($diff)); } + + public function testStringEquivalence() + { + + $value = (strval(4) != strval(3)); + + $this->assertTrue($value); + + $value = (strval(4) != strval(4)); + + $this->assertFalse($value); + + $value = (strval('4') != strval(4)); + $this->assertFalse($value); + + $value = (strval('4') != strval('4')); + + $this->assertFalse($value); + + $value = (strval('4') != strval(3)); + + $this->assertTrue($value); + + $value = (strval(4) != strval('3')); + + $this->assertTrue($value); + + $value = (strval('4') != strval('3')); + + $this->assertTrue($value); + + } }