Disable product price updating if currencies do not match

This commit is contained in:
David Bomba 2021-04-06 07:36:20 +10:00
parent d293c28a55
commit d9047b413a
2 changed files with 35 additions and 0 deletions

View File

@ -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

View File

@ -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);
}
}