28 $this->
init(
'oxvoucherseries');
38 public function delete( $sOxId = null )
41 $sOxId = $this->
getId();
58 if ( $this->_oGroups === null ) {
59 $this->_oGroups =
oxNew(
'oxlist' );
60 $this->_oGroups->init(
'oxgroups' );
62 $sSelect =
"select gr.* from {$sViewName} as gr, oxobject2group as o2g where
63 o2g.oxobjectid = ".
oxDb::getDb()->quote( $this->
getId() ) .
" and gr.oxid = o2g.oxgroupsid ";
64 $this->_oGroups->selectString( $sSelect );
78 $sDelete =
'delete from oxobject2group where oxobjectid = ' . $oDb->quote( $this->
getId() );
79 $oDb->execute( $sDelete );
90 $sDelete =
'delete from oxobject2discount where oxobject2discount.oxdiscountid = ' . $oDb->quote( $this->
getId() );
91 $oDb->execute( $sDelete );
101 $oVoucherList =
oxNew(
'oxvoucherlist' );
102 $sSelect =
'select * from oxvouchers where oxvoucherserieid = ' .
oxDb::getDb()->quote( $this->
getId() );
103 $oVoucherList->selectString( $sSelect );
104 return $oVoucherList;
115 $sDelete =
'delete from oxvouchers where oxvoucherserieid = ' . $oDb->quote( $this->
getId() );
116 $oDb->execute( $sDelete );
129 $sQuery =
'select count(*) as total from oxvouchers where oxvoucherserieid = ' .$oDb->quote( $this->
getId() );
130 $aStatus[
'total'] = $oDb->getOne( $sQuery );
132 $sQuery =
'select count(*) as used from oxvouchers where oxvoucherserieid = ' . $oDb->quote( $this->
getId() ) .
' and ((oxorderid is not NULL and oxorderid != "") or (oxdateused is not NULL and oxdateused != 0))';
133 $aStatus[
'used'] = $oDb->getOne( $sQuery );
135 $aStatus[
'available'] = $aStatus[
'total'] - $aStatus[
'used'];