29 $this->
init(
'oxvoucherseries');
39 public function delete($sOxId = null)
42 $sOxId = $this->
getId();
60 if ($this->_oGroups === null) {
61 $this->_oGroups =
oxNew(
'oxlist');
62 $this->_oGroups->init(
'oxgroups');
64 $sSelect =
"select gr.* from {$sViewName} as gr, oxobject2group as o2g where
65 o2g.oxobjectid = " .
oxDb::getDb()->quote($this->
getId()) .
" and gr.oxid = o2g.oxgroupsid ";
66 $this->_oGroups->selectString($sSelect);
78 $sDelete =
'delete from oxobject2group where oxobjectid = ' . $oDb->quote($this->
getId());
79 $oDb->execute($sDelete);
88 $sDelete =
'delete from oxobject2discount where oxobject2discount.oxdiscountid = ' . $oDb->quote($this->
getId());
89 $oDb->execute($sDelete);
99 $oVoucherList =
oxNew(
'oxvoucherlist');
100 $sSelect =
'select * from oxvouchers where oxvoucherserieid = ' .
oxDb::getDb()->quote($this->
getId());
101 $oVoucherList->selectString($sSelect);
103 return $oVoucherList;
112 $sDelete =
'delete from oxvouchers where oxvoucherserieid = ' . $oDb->quote($this->
getId());
113 $oDb->execute($sDelete);
126 $sQuery =
'select count(*) as total from oxvouchers where oxvoucherserieid = ' . $oDb->quote($this->
getId());
127 $aStatus[
'total'] = $oDb->getOne($sQuery);
129 $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))';
130 $aStatus[
'used'] = $oDb->getOne($sQuery);
132 $aStatus[
'available'] = $aStatus[
'total'] - $aStatus[
'used'];
152 $sBeginDate = $this->oxvoucherseries__oxbegindate->value;
153 $sEndDate = $this->oxvoucherseries__oxenddate->value;
157 $sNow = date(
'Y-m-d H:i:s', $oUtilsDate->getTime());
161 if (($sBeginDate ==
'0000-00-00 00:00:00' && $sEndDate ==
'0000-00-00 00:00:00') ||
162 ($sBeginDate ==
'0000-00-00 00:00:00' && $sNow <= $sEndDate) ||
163 ($sBeginDate <= $sNow && $sEndDate ==
'0000-00-00 00:00:00') ||
164 ($sBeginDate <= $sNow && $sNow <= $sEndDate)