From ee2b5cf164f2fb13f9e65c00d60bb150d24dc675 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 13 Jul 2009 08:17:41 +0000 Subject: [PATCH] new param to delete method only return ids: can be used in extended class for deletes in other tables --- etemplate/inc/class.so_sql_cf.inc.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/etemplate/inc/class.so_sql_cf.inc.php b/etemplate/inc/class.so_sql_cf.inc.php index 79ceda4d12..b2c7959da7 100644 --- a/etemplate/inc/class.so_sql_cf.inc.php +++ b/etemplate/inc/class.so_sql_cf.inc.php @@ -299,11 +299,12 @@ class so_sql_cf extends so_sql * reimplented to also delete the custom fields * * @param array $keys if given array with col => value pairs to characterise the rows to delete + * @param boolean $only_return_ids=false return $ids of delete call to db object, but not run it (can be used by extending classes!) * @return int affected rows, should be 1 if ok, 0 if an error */ - function delete($keys=null) + function delete($keys=null,$only_return_ids=false) { - if ($this->customfields) + if ($this->customfields || $only_return_query) { $query = parent::delete($keys,true); // check if query contains more then the id's @@ -319,6 +320,7 @@ class so_sql_cf extends so_sql { $ids = $query[$this->autoinc_id]; } + if ($only_return_query) return $ids; $this->db->delete($this->extra_table,array($this->extra_id => $ids),__LINE__,__FILE__); } return parent::delete($keys);