mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-12-02 21:30:16 +09:00
Finish canChangeCurrency() named slots
This commit is contained in:
commit
adf64d2f73
1 file changed
+5
-5
@@ -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.');
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user