104 $dAmount = str_replace(
',',
'.', $dAmount );
106 if ( !is_numeric( $dAmount ) || $dAmount < 0) {
110 $oEx =
oxNew(
'oxArticleInputException' );
111 $oEx->setMessage(
'ERROR_MESSAGE_INPUT_INVALIDAMOUNT');
116 $dAmount = round( (
string ) $dAmount );
143 if ( $oUser->oxuser__oxpassword->value && $sLogin != $oUser->oxuser__oxusername->value ) {
146 $sNewPass = (isset( $aInvAddress[
'oxuser__oxpassword']) && $aInvAddress[
'oxuser__oxpassword'] )?$aInvAddress[
'oxuser__oxpassword']:
oxConfig::getParameter(
'user_password' );
150 $oEx =
oxNew(
'oxInputException' );
151 $oEx->setMessage(
'ERROR_MESSAGE_INPUT_NOTALLFIELDS');
157 if ( !$oUser->isSamePassword( $sNewPass ) ) {
158 $oEx =
oxNew(
'oxUserException' );
159 $oEx->setMessage(
'ERROR_MESSAGE_USER_PWDDONTMATCH');
166 if ( $oUser->checkIfEmailExists( $sLogin ) ) {
168 $oEx =
oxNew(
'oxUserException' );
170 $oEx->setMessage( sprintf( $oLang->translateString(
'ERROR_MESSAGE_USER_USEREXISTS', $oLang->getTplLanguage() ), $sLogin ) );
189 $oEx =
oxNew(
'oxInputException' );
190 $oEx->setMessage(
'ERROR_MESSAGE_INPUT_NOTALLFIELDS');
197 $oEx =
oxNew(
'oxInputException' );
198 $oEx->setMessage(
'ERROR_MESSAGE_INPUT_NOVALIDEMAIL' );
215 public function checkPassword( $oUser, $sNewPass, $sConfPass, $blCheckLength =
false )
218 if ( $blCheckLength &&
getStr()->strlen( $sNewPass ) == 0 ) {
219 $oEx =
oxNew(
'oxInputException' );
220 $oEx->setMessage(
'ERROR_MESSAGE_INPUT_EMPTYPASS');
226 if ( $blCheckLength &&
getStr()->strlen( $sNewPass ) < 6 ) {
227 $oEx =
oxNew(
'oxInputException' );
228 $oEx->setMessage(
'ERROR_MESSAGE_PASSWORD_TOO_SHORT');
234 if ( $sNewPass != $sConfPass ) {
235 $oEx =
oxNew(
'oxUserException' );
236 $oEx->setMessage(
'ERROR_MESSAGE_USER_PWDDONTMATCH');
255 $aMustFields = array(
'oxuser__oxfname',
257 'oxuser__oxstreetnr',
263 $aMustFillFields = $this->
getConfig()->getConfigParam(
'aMustFillFields' );
264 if ( is_array( $aMustFillFields ) ) {
265 $aMustFields = $aMustFillFields;
269 $aInvAddress = is_array( $aInvAddress )?$aInvAddress:array();
270 $aDelAddress = is_array( $aDelAddress )?$aDelAddress:array();
273 $aFields = array_merge( $aInvAddress, $aDelAddress );
278 if ( count( $aDelAddress ) ) {
283 foreach ( $aMustFields as $sMustField ) {
286 if ( !$blCheckDel && strpos( $sMustField,
'oxaddress__' ) === 0 ) {
290 if ( isset( $aFields[$sMustField] ) && is_array( $aFields[$sMustField] ) ) {
292 } elseif ( !isset( $aFields[$sMustField] ) || !trim( $aFields[$sMustField] ) ) {
293 $oEx =
oxNew(
'oxInputException' );
294 $oEx->setMessage(
'ERROR_MESSAGE_INPUT_NOTALLFIELDS');
312 foreach ( $aFieldValues as $sValue ) {
313 if ( !trim( $sValue ) ) {
314 $oEx =
oxNew(
'oxInputException' );
315 $oEx->setMessage(
'ERROR_MESSAGE_INPUT_NOTALLFIELDS');
333 $sBillCtry = isset( $aInvAddress[
'oxuser__oxcountryid'] ) ? $aInvAddress[
'oxuser__oxcountryid'] : null;
334 $sDelCtry = isset( $aDelAddress[
'oxaddress__oxcountryid'] ) ? $aDelAddress[
'oxaddress__oxcountryid'] : null;
336 if ( $sBillCtry || $sDelCtry ) {
339 if ( ( $sBillCtry == $sDelCtry ) || ( !$sBillCtry && $sDelCtry ) || ( $sBillCtry && !$sDelCtry ) ) {
340 $sBillCtry = $sBillCtry ? $sBillCtry : $sDelCtry;
341 $sQ =
"select oxactive from oxcountry where oxid = ".$oDb->quote( $sBillCtry ).
" ";
343 $sQ =
"select ( select oxactive from oxcountry where oxid = ".$oDb->quote( $sBillCtry ).
" ) and
344 ( select oxactive from oxcountry where oxid = ".$oDb->quote( $sDelCtry ).
" ) ";
347 if ( !$oDb->getOne( $sQ ) ) {
348 $oEx =
oxNew(
'oxUserException' );
349 $oEx->setMessage(
'ERROR_MESSAGE_INPUT_NOTALLFIELDS' );
367 if ( $aInvAddress[
'oxuser__oxustid'] ) {
369 if (!($sCountryId = $aInvAddress[
'oxuser__oxcountryid'])) {
373 $oCountry =
oxNew(
'oxCountry');
375 if ( $oCountry->load( $sCountryId ) && $oCountry->isInEU() ) {
377 if ( strncmp( $aInvAddress[
'oxuser__oxustid'], $oCountry->getVATIdentificationNumberPrefix(), 2 ) ) {
378 $oEx =
oxNew(
'oxInputException' );
379 $oEx->setMessage(
'VAT_MESSAGE_ID_NOT_VALID' );
405 $aErr = reset( $this->_aInputValidationErrors );
406 if ( is_array( $aErr ) ) {
407 $oErr = reset( $aErr );
422 $mxValidationResult =
true;
424 switch( $sPaymentId ) {
425 case 'oxidcreditcard':
426 $mxValidationResult =
false;
429 $blCreditCardTypeExist = in_array( $aDynValue[
'kktype'], $this->_aPossibleCCType );
431 if ( $blAllCreditCardInformationSet && $blCreditCardTypeExist ) {
432 $oCardValidator =
oxNew(
"oxccvalidator" );
433 $mxValidationResult = $oCardValidator->isValidCard(
434 $aDynValue[
'kknumber'],
435 $aDynValue[
'kktype'],
436 $aDynValue[
'kkmonth'].substr( $aDynValue[
'kkyear'], 2, 2 )
441 case "oxiddebitnote":
442 $mxValidationResult =
false;
451 return $mxValidationResult;
465 return $this->_aInputValidationErrors[$sFieldName][] = $oErr;
476 $sBankCode = $aDebitInformation[
'lsblz'];
477 $sAccountNumber = $aDebitInformation[
'lsktonr'];
478 $oSepaValidator =
oxNew(
"oxSepaValidator" );
480 if ( empty( $sBankCode ) || $oSepaValidator->isValidBIC( $sBankCode ) ) {
481 $mxValidationResult =
true;
482 if ( !$oSepaValidator->isValidIBAN( $sAccountNumber ) ) {
492 return $mxValidationResult;
504 $mxValidationResult =
true;
506 if ( !$oStr->preg_match(
"/^\d{5,8}$/", $aDebitInfo[
'lsblz'] ) ) {
511 if (
true === $mxValidationResult && !$oStr->preg_match(
"/^\d{10,12}$/", $aDebitInfo[
'lsktonr'] ) ) {
517 return $mxValidationResult;
529 if ( $oStr->strlen( $aDebitInfo[
'lsktonr'] ) < 10 ) {
530 $sNewNum = str_repeat(
531 '0', 10 - $oStr->strlen( $aDebitInfo[
'lsktonr'] )
532 ) . $aDebitInfo[
'lsktonr'];
533 $aDebitInfo[
'lsktonr'] = $sNewNum;
548 foreach ( $aRequiredFields as $sFieldName ) {
549 if ( !isset( $aBankInformation[$sFieldName] ) || !trim( $aBankInformation[$sFieldName] ) ) {
565 $aDebitInformation[
'lsblz'] = str_replace(
' ',
'', $aDebitInformation[
'lsblz'] );
566 $aDebitInformation[
'lsktonr'] = str_replace(
' ',
'', $aDebitInformation[
'lsktonr'] );
568 return $aDebitInformation;
581 return (
bool) strncmp( $aInvAddress[
'oxuser__oxustid'], $oCountry->getVATIdentificationNumberPrefix(), 2 );
589 $oVatCheck =
oxNew(
'oxOnlineVatIdCheck' );