mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-14 18:08:21 +01:00
new param to delete method only return ids: can be used in extended class for deletes in other tables
This commit is contained in:
parent
919aea627e
commit
ee2b5cf164
@ -299,11 +299,12 @@ class so_sql_cf extends so_sql
|
|||||||
* reimplented to also delete the custom fields
|
* reimplented to also delete the custom fields
|
||||||
*
|
*
|
||||||
* @param array $keys if given array with col => value pairs to characterise the rows to delete
|
* @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
|
* @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);
|
$query = parent::delete($keys,true);
|
||||||
// check if query contains more then the id's
|
// 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];
|
$ids = $query[$this->autoinc_id];
|
||||||
}
|
}
|
||||||
|
if ($only_return_query) return $ids;
|
||||||
$this->db->delete($this->extra_table,array($this->extra_id => $ids),__LINE__,__FILE__);
|
$this->db->delete($this->extra_table,array($this->extra_id => $ids),__LINE__,__FILE__);
|
||||||
}
|
}
|
||||||
return parent::delete($keys);
|
return parent::delete($keys);
|
||||||
|
Loading…
Reference in New Issue
Block a user