source/Application/Controller/Admin/VoucherSerieGenerate.php
public function generateVoucher($iCnt)
    {
        $iAmount = abs((int) \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("voucherAmount"));

        // creating new vouchers
        if ($iCnt < $iAmount && ($oVoucherSerie = $this->_getVoucherSerie())) {
            if (!$this->_iGenerated) {
                $this->_iGenerated = $iCnt;
            }

            $blRandomNr = ( bool ) \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("randomVoucherNr");
            $sVoucherNr = $blRandomNr ? \OxidEsales\Eshop\Core\Registry::getUtilsObject()->generateUID() : \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("voucherNr");

            $oNewVoucher = oxNew(\OxidEsales\Eshop\Application\Model\Voucher::class);
            $oNewVoucher->oxvouchers__oxvoucherserieid = new \OxidEsales\Eshop\Core\Field($oVoucherSerie->getId());
            $oNewVoucher->oxvouchers__oxvouchernr = new \OxidEsales\Eshop\Core\Field($sVoucherNr);
            $oNewVoucher->save();

            $this->_iGenerated++;
        }

        return $this->_iGenerated;
    }
public function generateVoucher($iCnt)
    {
        $iAmount = abs((int) \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("voucherAmount"));

        // creating new vouchers
        if ($iCnt < $iAmount && ($oVoucherSerie = $this->_getVoucherSerie())) {
            if (!$this->_iGenerated) {
                $this->_iGenerated = $iCnt;
            }

            $blRandomNr = ( bool ) \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("randomVoucherNr");
            $sVoucherNr = $blRandomNr ? \OxidEsales\Eshop\Core\Registry::getUtilsObject()->generateUID() : \OxidEsales\Eshop\Core\Registry::getSession()->getVariable("voucherNr");

            $oNewVoucher = oxNew(\OxidEsales\Eshop\Application\Model\Voucher::class);
            $oNewVoucher->oxvouchers__oxvoucherserieid = new \OxidEsales\Eshop\Core\Field($oVoucherSerie->getId());
            $oNewVoucher->oxvouchers__oxvouchernr = new \OxidEsales\Eshop\Core\Field($sVoucherNr);
            $oNewVoucher->save();

            $this->_iGenerated++;
        }

        return $this->_iGenerated;
    }
public function generateVoucher ( $ iCnt ) { $ iAmount = abs ( ( int ) \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( "voucherAmount" ) ) ; // creating new vouchers if ( $ iCnt < $ iAmount && ( $ oVoucherSerie = $ this -> _getVoucherSerie ( ) ) ) { if ( ! $ this -> _iGenerated ) { $ this -> _iGenerated = $ iCnt ; } $ blRandomNr = ( bool ) \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( "randomVoucherNr" ) ; $ sVoucherNr = $ blRandomNr ? \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsObject ( ) -> generateUID ( ) : \ OxidEsales \ Eshop \ Core \ Registry :: getSession ( ) -> getVariable ( "voucherNr" ) ; $ oNewVoucher = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Voucher :: class ) ; $ oNewVoucher -> oxvouchers__oxvoucherserieid = new \ OxidEsales \ Eshop \ Core \ Field ( $ oVoucherSerie -> getId ( ) ) ; $ oNewVoucher -> oxvouchers__oxvouchernr = new \ OxidEsales \ Eshop \ Core \ Field ( $ sVoucherNr ) ; $ oNewVoucher -> save ( ) ; $ this -> _iGenerated ++ ; } return $ this -> _iGenerated ; }
Generates and saves vouchers. Returns number of saved records

@param int $iCnt voucher counter offset

@return int saved record count
Generates and saves vouchers . Returns number of saved records