/**
  * Override delete function so we can delete user group and article or category relations first.
  *
  * @param string $sOxId object ID (default null)
  *
  * @return null
  */
 public function delete($sOxId = null)
 {
     if (!$sOxId) {
         $sOxId = $this->getId();
     }
     $this->unsetDiscountRelations();
     $this->unsetUserGroups();
     $this->deleteVoucherList();
     return parent::delete($sOxId);
 }
Beispiel #2
0
 /**
  * Deletes object information from DB, returns true on success.
  *
  * @param string $sOxId object ID (default null)
  *
  * @return bool
  */
 public function delete($sOxId = null)
 {
     if (!$sOxId) {
         $sOxId = $this->getId();
     }
     if (!$sOxId) {
         return false;
     }
     $blDeleted = parent::delete($sOxId);
     if ($blDeleted) {
         $oDb = oxDb::getDb();
         $sDelete = "delete from oxobject2group where oxobject2group.oxshopid = '" . $this->getShopId() . "' and oxobject2group.oxobjectid = " . $oDb->quote($sOxId);
         $oDb->execute($sDelete);
     }
     return $blDeleted;
 }
Beispiel #3
0
 /**
  * Deletes oxFile record from DB, removes orphan files.
  *
  * @param string $sOxId default null
  *
  * @return bool
  */
 public function delete($sOxId = null)
 {
     $sOxId = $sOxId ? $sOxId : $this->getId();
     $this->load($sOxId);
     // if record cannot be delete, abort deletion
     if ($blDeleted = parent::delete($sOxId)) {
         $this->_deleteFile();
     }
     return $blDeleted;
 }
 /**
  * Deletes order article object. If deletion succeded - updates
  * article stock information. Returns deletion status
  *
  * @param string $sOXID Article id
  *
  * @return bool
  */
 public function delete($sOXID = null)
 {
     if ($blDelete = parent::delete($sOXID)) {
         $myConfig = $this->getConfig();
         if ($this->oxorderarticles__oxstorno->value != 1) {
             $this->updateArticleStock($this->oxorderarticles__oxamount->value, $myConfig->getConfigParam('blAllowNegativeStock'));
         }
     }
     return $blDelete;
 }
 /**
  * Removes articles from the recommlist and deletes list
  *
  * @param string $sOXID Object ID(default null)
  *
  * @return bool
  */
 public function delete($sOXID = null)
 {
     if (!$sOXID) {
         $sOXID = $this->getId();
     }
     if (!$sOXID) {
         return false;
     }
     if ($blDelete = parent::delete($sOXID)) {
         $oDb = oxDb::getDb();
         // cleaning up related data
         $oDb->execute("delete from oxobject2list where oxlistid = " . $oDb->quote($sOXID));
     }
     return $blDelete;
 }
Beispiel #6
0
 /**
  * Deletes current basket history
  *
  * @param string $sOXID Object ID(default null)
  *
  * @return bool
  */
 public function delete($sOXID = null)
 {
     if (!$sOXID) {
         $sOXID = $this->getId();
     }
     $blDelete = false;
     if ($sOXID && ($blDelete = parent::delete($sOXID))) {
         // cleaning up related data
         $oDb = oxDb::getDb();
         $sQ = "delete from oxuserbasketitems where oxbasketid = " . $oDb->quote($sOXID);
         $oDb->execute($sQ);
     }
     return $blDelete;
 }
Beispiel #7
0
 /**
  * Delete this object from the database, returns true on success.
  *
  * @param string $sOXID Object ID(default null)
  *
  * @return bool
  */
 public function delete($sOXID = null)
 {
     $blDeleted = parent::delete($sOXID);
     if ($blDeleted) {
         $oDB = oxDb::getDb();
         $sOXID = $oDB->quote($sOXID);
         //delete the record
         foreach ($this->_getLanguageSetTables() as $sSetTbl) {
             $oDB->execute("delete from {$sSetTbl} where oxid = {$sOXID}");
         }
     }
     return $blDeleted;
 }
Beispiel #8
0
 /**
  * Removes user data stored in some DB tables (such as oxuserpayments, oxaddress
  * oxobject2group, oxremark, etc). Return true on success.
  *
  * @param string $sOXID object ID (default null)
  *
  * @return bool
  */
 public function delete($sOXID = null)
 {
     if (!$sOXID) {
         $sOXID = $this->getId();
     }
     if (!$sOXID) {
         return false;
     }
     $blDeleted = parent::delete($sOXID);
     if ($blDeleted) {
         $oDb = oxDb::getDb();
         $sOXIDQuoted = $oDb->quote($sOXID);
         // deleting stored payment, address, group dependencies, remarks info
         $oDb->execute("delete from oxaddress where oxaddress.oxuserid = {$sOXIDQuoted}");
         $oDb->execute("delete from oxobject2group where oxobject2group.oxobjectid = {$sOXIDQuoted}");
         // deleting notice/wish lists
         $oDb->execute("delete oxuserbasketitems.* from oxuserbasketitems, oxuserbaskets where oxuserbasketitems.oxbasketid = oxuserbaskets.oxid and oxuserid = {$sOXIDQuoted}");
         $oDb->execute("delete from oxuserbaskets where oxuserid = {$sOXIDQuoted}");
         // deleting newsletter subscription
         $oDb->execute("delete from oxnewssubscribed where oxuserid = {$sOXIDQuoted}");
         // delivery and delivery sets
         $oDb->execute("delete from oxobject2delivery where oxobjectid = {$sOXIDQuoted}");
         // discounts
         $oDb->execute("delete from oxobject2discount where oxobjectid = {$sOXIDQuoted}");
         $this->deleteAdditionally($sOXIDQuoted);
         // and leaving all order related information
         $rs = $oDb->execute("delete from oxremark where oxparentid = {$sOXIDQuoted} and oxtype !='o'");
         $blDeleted = $rs->EOF;
     }
     return $blDeleted;
 }
Beispiel #9
0
 /**
  * Updates stock information, deletes current ordering details from DB,
  * returns true on success.
  *
  * @param string $sOxId Ordering ID (default null)
  *
  * @return bool
  */
 public function delete($sOxId = null)
 {
     if ($sOxId) {
         if (!$this->load($sOxId)) {
             // such order does not exist
             return false;
         }
     } elseif (!$sOxId) {
         $sOxId = $this->getId();
     }
     // no order id is passed
     if (!$sOxId) {
         return false;
     }
     // delete order articles
     $oOrderArticles = $this->getOrderArticles(false);
     foreach ($oOrderArticles as $oOrderArticle) {
         $oOrderArticle->delete();
     }
     // #440 - deleting user payment info
     if ($oPaymentType = $this->getPaymentType()) {
         $oPaymentType->delete();
     }
     return parent::delete($sOxId);
 }
 /**
  * Delete this object from the database, returns true on success.
  *
  * @param string $oxid Object ID(default null)
  *
  * @return bool
  */
 public function delete($oxid = null)
 {
     $deleted = parent::delete($oxid);
     if ($deleted) {
         $db = oxDb::getDb();
         $oxid = $db->quote($oxid);
         //delete the record
         foreach ($this->_getLanguageSetTables() as $setTbl) {
             $db->execute("delete from {$setTbl} where oxid = {$oxid}");
         }
     }
     return $deleted;
 }