addElement('email', 'email', [ 'label' => 'Email', 'required' => true, 'autocomplete' => 'off', 'maxlength' => 255, ]); $uniqueValidator = new Qs_Validate_Unique(new Qs_Db_Table('User'), 'email', $userId); $uniqueValidator->setMessage('Email should be unique', Qs_Validate_Unique::NOT_UNIQUE); $this->getElement('email')->addValidator($uniqueValidator); return $this; } protected function _initNaicsElements() { $this->addPrefixPath('App\License\Form\Element', 'App/License/Form/Element/', 'element'); $this->getView()->addHelperPath('App/License/View/Helper/', 'App\License\View\Helper\\'); $this->addElement('naics', 'naicsCodes', ['required' => true]); return $this; } protected function _initTribeSurchargeElements() { $tribeUseSurcharge = (new Admin\Obj())->getModel()->getTribeUseSurcharge(); if((AclPermission::isTribalAccount() && $tribeUseSurcharge[AclPermission::getAdminTribeId()] == 'y') || (!AclPermission::isTribalAccount() && in_array('y', $tribeUseSurcharge)) ) { $this->addElement('html', 'tribesSurchargesTitle', [ 'value' => '
License Premium for Tribes
' ]); } if ($this->_controllerAction == 'update') { $licenseTribesData = (new Admin\Obj())->getModel()->getLicenseTribes($this->_getData('id'), true); if ($licenseTribesData) { $licenseTribesStatus = Qs_Array::fetchPairs($licenseTribesData, ['tribeId', 'status']); } } if ($this->_controllerAction == 'update') { if(AclPermission::isTribalAccount()) { $tribeId = AclPermission::getAdminTribeId(); if ($tribeUseSurcharge[$tribeId] == 'y') { if (!in_array($licenseTribesStatus[$tribeId], [Entity::TRIBE_STATUS_PENDING, Entity::TRIBE_STATUS_DECLINED])) { $this->addElement('hidden', 'surcharge_' . $tribeId); $this->addElement('numeric', 'surchargeDisabled_' . $tribeId, [ 'label' => 'Tribe Premium ($)', 'disabled' => 'disabled', 'value' => $this->_getData('surcharge_' . $tribeId) ]); } else { $this->addElement('numeric', 'surcharge_' . $tribeId, ['label' => 'Tribe Premium ($)']); } } } else { $tribes = (new Qs_Db_Table('Tribe'))->get4Select(); foreach ($tribes as $tribeId => $title) { if ($tribeUseSurcharge[$tribeId] == 'y') { if (!in_array($licenseTribesStatus[$tribeId], [Entity::TRIBE_STATUS_PENDING, Entity::TRIBE_STATUS_DECLINED])) { $this->addElement('hidden', 'surcharge_' . $tribeId); $this->addElement('numeric', 'surchargeDisabled_' . $tribeId, [ 'label' => $title . ' Premium ($)', 'disabled' => 'disabled', 'value' => $this->_getData('surcharge_' . $tribeId) ]); } else { $this->addElement('numeric', 'surcharge_' . $tribeId, ['label' => $title . ' Premium ($)']); } } } } } else { if(AclPermission::isTribalAccount()) { $tribeId = AclPermission::getAdminTribeId(); if ($tribeUseSurcharge[$tribeId] == 'y') { $this->addElement('numeric', 'surcharge_' . $tribeId, ['label' => 'Tribe Premium ($)']); } } else { $tribes = (new Qs_Db_Table('Tribe'))->get4Select(); foreach ($tribes as $tribeId => $title) { if ($tribeUseSurcharge[$tribeId] == 'y') { $this->addElement('numeric', 'surcharge_' . $tribeId, ['label' => $title . ' Premium ($)']); } } } } return $this; } }