From 2d6b32736e273f5f7fe61d145e22c2f0fa3f22fd Mon Sep 17 00:00:00 2001 From: 4Giedrius <4giedrius@gmail.com> Date: Tue, 25 Nov 2014 13:50:47 +0200 Subject: [PATCH] Using named slots for canChangeCurrency() method --- src/bb-modules/Client/Service.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bb-modules/Client/Service.php b/src/bb-modules/Client/Service.php index 8fec375e6..c1d34c8c2 100644 --- a/src/bb-modules/Client/Service.php +++ b/src/bb-modules/Client/Service.php @@ -213,20 +213,20 @@ class Service implements InjectionAwareInterface public function canChangeCurrency(\Model_Client $model, $currency = null) { - if(!$model->currency) { + if (!$model->currency) { return true; } - if($model->currency == $currency) { + if ($model->currency == $currency) { return false; } - $invoice = $this->di['db']->findOne('Invoice', 'client_id = ?', $model->id); - if($invoice instanceof \Model_Invoice) { + $invoice = $this->di['db']->findOne('Invoice', 'client_id = :client_id', array(':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']->findOne('ClientOrder', 'client_id = ?', $model->id); + $order = $this->di['db']->findOne('ClientOrder', 'client_id = :client_id', array(':client_id' => $model->id)); if ($order instanceof \Model_ClientOrder) { throw new \Box_Exception('Currency can not be changed. Client already have orders.'); }