From b346795d3a2207f936301fedfdfd53f1e98b6426 Mon Sep 17 00:00:00 2001 From: 4Giedrius <4giedrius@gmail.com> Date: Tue, 25 Nov 2014 13:20:44 +0200 Subject: [PATCH] canChangeCurrency() method updated --- src/bb-modules/Client/Service.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bb-modules/Client/Service.php b/src/bb-modules/Client/Service.php index 778257873..8fec375e6 100644 --- a/src/bb-modules/Client/Service.php +++ b/src/bb-modules/Client/Service.php @@ -221,13 +221,13 @@ class Service implements InjectionAwareInterface return false; } - $invoice = $this->di['db']->load('Invoice', 'client_id = ?', $model->client_id); - if($invoice) { + $invoice = $this->di['db']->findOne('Invoice', 'client_id = ?', $model->id); + if($invoice instanceof \Model_Invoice) { throw new \Box_Exception('Currency can not be changed. Client already have invoices issued.'); } - $order = $this->di['db']->load('ClientOrder', 'client_id = ?', $model->client_id); - if($order) { + $order = $this->di['db']->findOne('ClientOrder', 'client_id = ?', $model->id); + if ($order instanceof \Model_ClientOrder) { throw new \Box_Exception('Currency can not be changed. Client already have orders.'); }