Fix: Can remove a sending sheet.
This commit is contained in:
parent
b104a84992
commit
8b72727684
@ -529,36 +529,45 @@ 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."expedition WHERE rowid = ".$this->id;
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."co_exp WHERE rowid = ".$this->id;
|
||||||
if ( $this->db->query($sql) )
|
if ( $this->db->query($sql) )
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."expedition WHERE rowid = ".$this->id;
|
||||||
|
if ( $this->db->query($sql) )
|
||||||
|
{
|
||||||
|
$this->db->commit();
|
||||||
|
|
||||||
// On efface le répertoire de pdf provisoire
|
// On efface le répertoire de pdf provisoire
|
||||||
$expref = sanitizeFileName($this->ref);
|
$expref = sanitizeFileName($this->ref);
|
||||||
if ($conf->expedition->dir_output)
|
if ($conf->expedition->dir_output)
|
||||||
{
|
|
||||||
$dir = $conf->expedition->dir_output . "/" . $expref ;
|
|
||||||
$file = $conf->expedition->dir_output . "/" . $expref . "/" . $expref . ".pdf";
|
|
||||||
if (file_exists($file))
|
|
||||||
{
|
{
|
||||||
if (!dol_delete_file($file))
|
$dir = $conf->expedition->dir_output . "/" . $expref ;
|
||||||
|
$file = $conf->expedition->dir_output . "/" . $expref . "/" . $expref . ".pdf";
|
||||||
|
if (file_exists($file))
|
||||||
{
|
{
|
||||||
$this->error=$langs->trans("ErrorCanNotDeleteFile",$file);
|
if (!dol_delete_file($file))
|
||||||
return 0;
|
{
|
||||||
}
|
$this->error=$langs->trans("ErrorCanNotDeleteFile",$file);
|
||||||
}
|
return 0;
|
||||||
if (file_exists($dir))
|
}
|
||||||
{
|
}
|
||||||
if (!dol_delete_dir($dir))
|
if (file_exists($dir))
|
||||||
{
|
{
|
||||||
$this->error=$langs->trans("ErrorCanNotDeleteDir",$dir);
|
if (!dol_delete_dir($dir))
|
||||||
return 0;
|
{
|
||||||
|
$this->error=$langs->trans("ErrorCanNotDeleteDir",$dir);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
return 1;
|
else
|
||||||
}
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
return -3;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
|
|||||||
@ -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.'&action=create_delivery">'.$langs->trans("DeliveryOrder").'</a>';
|
print '<a class="butAction" href="fiche.php?id='.$expedition->id.'&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.'&action=delete">'.$langs->trans("Delete").'</a>';
|
print '<a class="butActionDelete" href="fiche.php?id='.$expedition->id.'&action=delete">'.$langs->trans("Delete").'</a>';
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user