Example #1
0
    public function commissionTypeBeforeSaveCheck(Pap_Db_CommissionType $beforeSaveType) {
        if ($beforeSaveType->getParentCommissionTypeId() == '' || $beforeSaveType->getParentCommissionTypeId() == null) {
            return;
        }
        $countries = preg_split('/,/', $beforeSaveType->getCountryCodes());

        $existingcountries = $this->getAllUsedCountryListForType($beforeSaveType);

        $intersection = array_intersect($existingcountries, $countries);
        if (count($intersection)>0) {
            throw new Gpf_Exception($this->_('One or more of countries ('.$this->resolveCountryNames($intersection).'), you selected, is already included in another country group in this commission type.'));
        }
    }