If there is promo with same code created already, do not let create new one

This commit is contained in:
4Giedrius committed 2015-01-29 13:08:57 +02:00
1 parent a321d50fdf
commit 199cddba21
1 file changed
+4
+4
View File
@@ -567,6 +567,10 @@ class Service implements InjectionAwareInterface
public function createPromo($code, $type, $value, $products = array(), $periods = array(), $clientGroups = array(), $data)
{
if ($this->di['db']->findOne('Promo', 'code = :code', array(':code' => $code))){
throw new \Box_Exception('This promo code already exists.');
}
$systemService = $this->di['mod_service']('system');
$systemService->checkLimits('Model_Promo', 2);