Fix: Can remove a sending sheet.

This commit is contained in:
Laurent Destailleur 2009-04-05 19:30:37 +00:00
parent b104a84992
commit 8b72727684
2 changed files with 33 additions and 23 deletions

View File

@ -528,6 +528,9 @@ class Expedition extends CommonObject
$sql = "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet WHERE fk_expedition = ".$this->id; $sql = "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet WHERE fk_expedition = ".$this->id;
if ( $this->db->query($sql) ) if ( $this->db->query($sql) )
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."co_exp WHERE rowid = ".$this->id;
if ( $this->db->query($sql) )
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."expedition WHERE rowid = ".$this->id; $sql = "DELETE FROM ".MAIN_DB_PREFIX."expedition WHERE rowid = ".$this->id;
if ( $this->db->query($sql) ) if ( $this->db->query($sql) )
@ -558,6 +561,12 @@ class Expedition extends CommonObject
} }
} }
return 1; return 1;
}
else
{
$this->db->rollback();
return -3;
}
} }
else else
{ {

View File

@ -59,6 +59,7 @@ if ($user->societe_id > 0)
$origin = $_GET["origin"]?$_GET["origin"]:$_POST["origin"]; // Example: commande, propal $origin = $_GET["origin"]?$_GET["origin"]:$_POST["origin"]; // Example: commande, propal
$origin_id = $_GET["object_id"]?$_GET["object_id"]:$_POST["object_id"]; // Id of order or propal $origin_id = $_GET["object_id"]?$_GET["object_id"]:$_POST["object_id"]; // Id of order or propal
/* /*
* Actions * Actions
*/ */
@ -831,7 +832,7 @@ else
print '<a class="butAction" href="fiche.php?id='.$expedition->id.'&amp;action=create_delivery">'.$langs->trans("DeliveryOrder").'</a>'; print '<a class="butAction" href="fiche.php?id='.$expedition->id.'&amp;action=create_delivery">'.$langs->trans("DeliveryOrder").'</a>';
} }
if ($expedition->brouillon && $user->rights->expedition->supprimer) if ($user->rights->expedition->supprimer)
{ {
print '<a class="butActionDelete" href="fiche.php?id='.$expedition->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>'; print '<a class="butActionDelete" href="fiche.php?id='.$expedition->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>';
} }