Skip to content
Snippets Groups Projects
Commit 0b7cbb50 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Update template fo class. delete actions must be done in opposite order

of create actions.
parent 42082129
No related branches found
No related tags found
No related merge requests found
<?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 @@ ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -339,7 +341,6 @@ class Skeleton_Class // extends CommonObject
{ {
} }
// End // End
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment