88 $dAmount = str_replace(
',',
'.', $dAmount);
90 if (!is_numeric($dAmount) || $dAmount < 0) {
94 $oEx =
oxNew(
'oxArticleInputException');
95 $oEx->setMessage(
oxRegistry::getLang()->translateString(
'ERROR_MESSAGE_INPUT_INVALIDAMOUNT'));
100 $dAmount = round((
string ) $dAmount);
125 $sLogin = (isset($aInvAddress[
'oxuser__oxusername'])) ? $aInvAddress[
'oxuser__oxusername'] : $sLogin;
129 if ($oUser->oxuser__oxpassword->value && $sLogin != $oUser->oxuser__oxusername->value) {
132 $sNewPass = (isset($aInvAddress[
'oxuser__oxpassword']) && $aInvAddress[
'oxuser__oxpassword']) ? $aInvAddress[
'oxuser__oxpassword'] :
oxRegistry::getConfig()->getRequestParameter(
'user_password');
136 $oEx =
oxNew(
'oxInputException');
137 $oEx->setMessage(
oxRegistry::getLang()->translateString(
'ERROR_MESSAGE_INPUT_NOTALLFIELDS'));
143 if (!$oUser->isSamePassword($sNewPass)) {
144 $oEx =
oxNew(
'oxUserException');
145 $oEx->setMessage(
oxRegistry::getLang()->translateString(
'ERROR_MESSAGE_PASSWORD_DO_NOT_MATCH'));
152 if ($oUser->checkIfEmailExists($sLogin)) {
154 $oEx =
oxNew(
'oxUserException');
155 $oEx->setMessage(sprintf(
oxRegistry::getLang()->translateString(
'ERROR_MESSAGE_USER_USEREXISTS'), $sLogin));
176 $oEx =
oxNew(
'oxInputException');
177 $oEx->setMessage(
oxRegistry::getLang()->translateString(
'ERROR_MESSAGE_INPUT_NOTALLFIELDS'));
184 $oEx =
oxNew(
'oxInputException');
185 $oEx->setMessage(
oxRegistry::getLang()->translateString(
'ERROR_MESSAGE_INPUT_NOVALIDEMAIL'));
202 public function checkPassword($oUser, $sNewPass, $sConfPass, $blCheckLength =
false)
205 if ($blCheckLength &&
getStr()->strlen($sNewPass) == 0) {
206 $oEx =
oxNew(
'oxInputException');
213 if ($blCheckLength &&
getStr()->strlen($sNewPass) < 6) {
214 $oEx =
oxNew(
'oxInputException');
215 $oEx->setMessage(
oxRegistry::getLang()->translateString(
'ERROR_MESSAGE_PASSWORD_TOO_SHORT'));
221 if ($sNewPass != $sConfPass) {
222 $oEx =
oxNew(
'oxUserException');
223 $oEx->setMessage(
oxRegistry::getLang()->translateString(
'ERROR_MESSAGE_PASSWORD_DO_NOT_MATCH'));
240 $oRequiredAddressFields =
oxNew(
'oxRequiredAddressFields');
243 $oFieldsValidator =
oxNew(
'oxRequiredFieldsValidator');
246 $oUser =
oxNew(
'oxUser');
247 $oBillingAddress = $this->
_setFields($oUser, $aBillingAddress);
248 $oFieldsValidator->setRequiredFields($oRequiredAddressFields->getBillingFields());
249 $oFieldsValidator->validateFields($oBillingAddress);
250 $aInvalidFields = $oFieldsValidator->getInvalidFields();
252 if (!empty($aDeliveryAddress)) {
254 $oDeliveryAddress = $this->
_setFields(
oxNew(
'oxAddress'), $aDeliveryAddress);
255 $oFieldsValidator->setRequiredFields($oRequiredAddressFields->getDeliveryFields());
256 $oFieldsValidator->validateFields($oDeliveryAddress);
257 $aInvalidFields = array_merge($aInvalidFields, $oFieldsValidator->getInvalidFields());
260 foreach ($aInvalidFields as $sField) {
261 $oEx =
oxNew(
'oxInputException');
262 $oEx->setMessage(
oxRegistry::getLang()->translateString(
'ERROR_MESSAGE_INPUT_NOTALLFIELDS'));
278 $aFields = is_array($aFields) ? $aFields : array();
279 foreach ($aFields as $sKey => $sValue) {
280 $oObject->$sKey =
oxNew(
'oxField', $sValue);
297 foreach ($aFieldValues as $sValue) {
298 if (!trim($sValue)) {
299 $oEx =
oxNew(
'oxInputException');
300 $oEx->setMessage(
oxRegistry::getLang()->translateString(
'ERROR_MESSAGE_INPUT_NOTALLFIELDS'));
316 $sBillCtry = isset($aInvAddress[
'oxuser__oxcountryid']) ? $aInvAddress[
'oxuser__oxcountryid'] : null;
317 $sDelCtry = isset($aDelAddress[
'oxaddress__oxcountryid']) ? $aDelAddress[
'oxaddress__oxcountryid'] : null;
319 if ($sBillCtry || $sDelCtry) {
322 if (($sBillCtry == $sDelCtry) || (!$sBillCtry && $sDelCtry) || ($sBillCtry && !$sDelCtry)) {
323 $sBillCtry = $sBillCtry ? $sBillCtry : $sDelCtry;
324 $sQ =
"select oxactive from oxcountry where oxid = " . $oDb->quote($sBillCtry) .
" ";
326 $sQ =
"select ( select oxactive from oxcountry where oxid = " . $oDb->quote($sBillCtry) .
" ) and
327 ( select oxactive from oxcountry where oxid = " . $oDb->quote($sDelCtry) .
" ) ";
330 if (!$oDb->getOne($sQ)) {
331 $oEx =
oxNew(
'oxUserException');
332 $oEx->setMessage(
oxRegistry::getLang()->translateString(
'ERROR_MESSAGE_INPUT_NOTALLFIELDS'));
352 $oCountry = $this->
_getCountry($aInvAddress[
'oxuser__oxcountryid']);
354 if ($oCountry && $oCountry->isInEU()) {
359 $oVatIn =
oxNew(
'oxCompanyVatIn', $aInvAddress[
'oxuser__oxustid']);
361 if (!$oVatInValidator->validate($oVatIn)) {
363 $oEx =
oxNew(
'oxInputException');
364 $oEx->setMessage(
oxRegistry::getLang()->translateString(
'VAT_MESSAGE_' . $oVatInValidator->getError()));
369 } elseif ($aInvAddress[
'oxuser__oxustid'] && !$aInvAddress[
'oxuser__oxcompany']) {
371 $oEx =
oxNew(
'oxInputException');
388 $oCountry =
oxNew(
'oxCountry');
389 $oCountry->load($sCountryId);
412 $aErr = reset($this->_aInputValidationErrors);
413 if (is_array($aErr)) {
414 $oErr = reset($aErr);
430 $mxValidationResult =
true;
432 switch ($sPaymentId) {
433 case 'oxidcreditcard':
434 $mxValidationResult =
false;
437 $blCreditCardTypeExist = in_array($aDynValue[
'kktype'], $this->_aPossibleCCType);
439 if ($blAllCreditCardInformationSet && $blCreditCardTypeExist) {
440 $oCardValidator =
oxNew(
"oxccvalidator");
441 $mxValidationResult = $oCardValidator->isValidCard(
442 $aDynValue[
'kknumber'],
443 $aDynValue[
'kktype'],
444 $aDynValue[
'kkmonth'] . substr($aDynValue[
'kkyear'], 2, 2)
449 case "oxiddebitnote":
450 $mxValidationResult =
false;
459 return $mxValidationResult;
473 return $this->_aInputValidationErrors[$sFieldName][] = $oErr;
486 $sBankCode = $aDebitInformation[
'lsblz'];
487 $sAccountNumber = $aDebitInformation[
'lsktonr'];
488 $oSepaValidator =
oxNew(
"oxSepaValidator");
490 if (empty($sBankCode) || $oSepaValidator->isValidBIC($sBankCode)) {
491 $mxValidationResult =
true;
492 if (!$oSepaValidator->isValidIBAN($sAccountNumber)) {
502 return $mxValidationResult;
517 $mxValidationResult =
true;
519 if (!$oStr->preg_match(
"/^\d{5,8}$/", $aDebitInfo[
'lsblz'])) {
524 if (
true === $mxValidationResult && !$oStr->preg_match(
"/^\d{10,12}$/", $aDebitInfo[
'lsktonr'])) {
530 return $mxValidationResult;
544 if ($oStr->strlen($aDebitInfo[
'lsktonr']) < 10) {
545 $sNewNum = str_repeat(
547 10 - $oStr->strlen($aDebitInfo[
'lsktonr'])
548 ) . $aDebitInfo[
'lsktonr'];
549 $aDebitInfo[
'lsktonr'] = $sNewNum;
566 foreach ($aRequiredFields as $sFieldName) {
567 if (!isset($aBankInformation[$sFieldName]) || !trim($aBankInformation[$sFieldName])) {
585 $aDebitInformation[
'lsblz'] = str_replace(
' ',
'', $aDebitInformation[
'lsblz']);
586 $aDebitInformation[
'lsktonr'] = str_replace(
' ',
'', $aDebitInformation[
'lsktonr']);
588 return $aDebitInformation;
600 return $aInvAddress[
'oxuser__oxustid'] && $aInvAddress[
'oxuser__oxcountryid'] && $aInvAddress[
'oxuser__oxcompany'];
615 return (
bool) strncmp($aInvAddress[
'oxuser__oxustid'], $oCountry->getVATIdentificationNumberPrefix(), 2);
628 $oVatCheck =
oxNew(
'oxOnlineVatIdCheck');
640 $this->_oCompanyVatInValidator = $oCompanyVatInValidator;
652 if (is_null($this->_oCompanyVatInValidator)) {
655 $oVatInValidator =
oxNew(
'oxCompanyVatInValidator', $oCountry);
658 $oValidator =
oxNew(
'oxCompanyVatInCountryChecker');
660 $oVatInValidator->addChecker($oValidator);
664 $oOnlineValidator =
oxNew(
'oxOnlineVatIdCheck');
665 $oVatInValidator->addChecker($oOnlineValidator);