source/Application/Model/Voucher.php
protected function _isAvailableInOtherOrder($oUser)
    {
        $oSeries = $this->getSerie();
        if (!$oSeries->oxvoucherseries__oxallowuseanother->value) {
            $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
            $sSelect = 'select count(*) from ' . $this->getViewName() . ' where oxuserid = ' . $oDb->quote($oUser->oxuser__oxid->value) . ' and ';
            $sSelect .= 'oxvoucherserieid = ' . $oDb->quote($this->oxvouchers__oxvoucherserieid->value) . ' and ';
            $sSelect .= '((oxorderid is not NULL and oxorderid != "") or (oxdateused is not NULL and oxdateused != 0)) ';

            if ($oDb->getOne($sSelect)) {
                $oEx = oxNew(\OxidEsales\Eshop\Core\Exception\VoucherException::class);
                $oEx->setMessage('ERROR_MESSAGE_VOUCHER_NOTALLOWEDSAMESERIES');
                $oEx->setVoucherNr($this->oxvouchers__oxvouchernr->value);
                throw $oEx;
            }
        }

        return true;
    }
protected function _isAvailableInOtherOrder($oUser)
    {
        $oSeries = $this->getSerie();
        if (!$oSeries->oxvoucherseries__oxallowuseanother->value) {
            $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
            $sSelect = 'select count(*) from ' . $this->getViewName() . ' where oxuserid = ' . $oDb->quote($oUser->oxuser__oxid->value) . ' and ';
            $sSelect .= 'oxvoucherserieid = ' . $oDb->quote($this->oxvouchers__oxvoucherserieid->value) . ' and ';
            $sSelect .= '((oxorderid is not NULL and oxorderid != "") or (oxdateused is not NULL and oxdateused != 0)) ';

            if ($oDb->getOne($sSelect)) {
                $oEx = oxNew(\OxidEsales\Eshop\Core\Exception\VoucherException::class);
                $oEx->setMessage('ERROR_MESSAGE_VOUCHER_NOTALLOWEDSAMESERIES');
                $oEx->setVoucherNr($this->oxvouchers__oxvouchernr->value);
                throw $oEx;
            }
        }

        return true;
    }
protected function _isAvailableInOtherOrder ( $ oUser ) { $ oSeries = $ this -> getSerie ( ) ; if ( ! $ oSeries -> oxvoucherseries__oxallowuseanother -> value ) { $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sSelect = 'select count(*) from ' . $ this -> getViewName ( ) . ' where oxuserid = ' . $ oDb -> quote ( $ oUser -> oxuser__oxid -> value ) . ' and ' ; $ sSelect .= 'oxvoucherserieid = ' . $ oDb -> quote ( $ this -> oxvouchers__oxvoucherserieid -> value ) . ' and ' ; $ sSelect .= '((oxorderid is not NULL and oxorderid != "") or (oxdateused is not NULL and oxdateused != 0)) ' ; if ( $ oDb -> getOne ( $ sSelect ) ) { $ oEx = oxNew ( \ OxidEsales \ Eshop \ Core \ Exception \ VoucherException :: class ) ; $ oEx -> setMessage ( 'ERROR_MESSAGE_VOUCHER_NOTALLOWEDSAMESERIES' ) ; $ oEx -> setVoucherNr ( $ this -> oxvouchers__oxvouchernr -> value ) ; throw $ oEx ; } } return true ; }
Checks if user already used vouchers from this series and can he use it again.

@param object $oUser user object

@throws oxVoucherException exception

@return boolean
Checks if user already used vouchers from this series and can he use it again .