Update template fo class. delete actions must be done in opposite order
of create actions.
This commit is contained in:
parent
4208212924
commit
0b7cbb50ac
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) ---Put here your own copyright and developer email---
|
* Copyright (C) ---Put here your own copyright and developer email---
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -30,8 +30,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \class Skeleton_Class
|
* Put here description of your class
|
||||||
* \brief Put here description of your class
|
|
||||||
*/
|
*/
|
||||||
class Skeleton_Class // extends CommonObject
|
class Skeleton_Class // extends CommonObject
|
||||||
{
|
{
|
||||||
@ -256,15 +255,8 @@ class Skeleton_Class // extends CommonObject
|
|||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."mytable";
|
|
||||||
$sql.= " WHERE rowid=".$this->id;
|
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
|
||||||
$resql = $this->db->query($sql);
|
|
||||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
@ -281,6 +273,16 @@ class Skeleton_Class // extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."mytable";
|
||||||
|
$sql.= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||||
|
}
|
||||||
|
|
||||||
// Commit or rollback
|
// Commit or rollback
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
@ -339,7 +341,6 @@ class Skeleton_Class // extends CommonObject
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// End
|
// End
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user