src/ShopBundle/pkgExtranet/objects/db/TShopDataExtranetUser.class.php
public function ValidateData($sFormDataName = null)
    {
        if (is_null($sFormDataName)) {
            $sFormDataName = TdbDataExtranetUser::MSG_FORM_FIELD;
        }
        $bIsValid = parent::ValidateData($sFormDataName);
        $oMsgManager = TCMSMessageManager::GetInstance();

        // check postal code for country
        $bHasCountry = (array_key_exists('data_country_id', $this->sqlData) && !empty($this->sqlData['data_country_id']));
        $bHasPostalcode = (array_key_exists('postalcode', $this->sqlData) && !empty($this->sqlData['postalcode']));
        if ($bHasCountry && $bHasPostalcode) {
            $oCountry = TdbDataCountry::GetNewInstance();
            /** @var $oCountry TdbDataCountry */
            if ($oCountry->Load($this->sqlData['data_country_id'])) {
                if (!$oCountry->IsValidPostalcode($this->sqlData['postalcode'])) {
                    $oMsgManager->AddMessage($sFormDataName.'-postalcode', 'ERROR-USER-FIELD-INVALID-POSTALCODE');
                    $bIsValid = false;
                }
            }
        }

        return $bIsValid;
    }
public function ValidateData($sFormDataName = null)
    {
        if (is_null($sFormDataName)) {
            $sFormDataName = TdbDataExtranetUser::MSG_FORM_FIELD;
        }
        $bIsValid = parent::ValidateData($sFormDataName);
        $oMsgManager = TCMSMessageManager::GetInstance();

        // check postal code for country
        $bHasCountry = (array_key_exists('data_country_id', $this->sqlData) && !empty($this->sqlData['data_country_id']));
        $bHasPostalcode = (array_key_exists('postalcode', $this->sqlData) && !empty($this->sqlData['postalcode']));
        if ($bHasCountry && $bHasPostalcode) {
            $oCountry = TdbDataCountry::GetNewInstance();
            /** @var $oCountry TdbDataCountry */
            if ($oCountry->Load($this->sqlData['data_country_id'])) {
                if (!$oCountry->IsValidPostalcode($this->sqlData['postalcode'])) {
                    $oMsgManager->AddMessage($sFormDataName.'-postalcode', 'ERROR-USER-FIELD-INVALID-POSTALCODE');
                    $bIsValid = false;
                }
            }
        }

        return $bIsValid;
    }
public function ValidateData ( $ sFormDataName = null ) { if ( is_null ( $ sFormDataName ) ) { $ sFormDataName = TdbDataExtranetUser :: MSG_FORM_FIELD ; } $ bIsValid = parent :: ValidateData ( $ sFormDataName ) ; $ oMsgManager = TCMSMessageManager :: GetInstance ( ) ; // check postal code for country $ bHasCountry = ( array_key_exists ( 'data_country_id' , $ this -> sqlData ) && ! empty ( $ this -> sqlData [ 'data_country_id' ] ) ) ; $ bHasPostalcode = ( array_key_exists ( 'postalcode' , $ this -> sqlData ) && ! empty ( $ this -> sqlData [ 'postalcode' ] ) ) ; if ( $ bHasCountry && $ bHasPostalcode ) { $ oCountry = TdbDataCountry :: GetNewInstance ( ) ; /** @var $oCountry TdbDataCountry */ if ( $ oCountry -> Load ( $ this -> sqlData [ 'data_country_id' ] ) ) { if ( ! $ oCountry -> IsValidPostalcode ( $ this -> sqlData [ 'postalcode' ] ) ) { $ oMsgManager -> AddMessage ( $ sFormDataName . '-postalcode' , 'ERROR-USER-FIELD-INVALID-POSTALCODE' ) ; $ bIsValid = false ; } } } return $ bIsValid ; }
validates the user data.

@param string $sFormDataName - the array name used for the form. send error messages here

@return bool
validates the user data .