bugfix
This commit is contained in:
parent
e2bb182a77
commit
4dbe1334fe
@ -41,6 +41,7 @@ class Commande
|
||||
{
|
||||
var $db ;
|
||||
var $id ;
|
||||
var $ref;
|
||||
var $socidp;
|
||||
var $contactid;
|
||||
var $projet_id;
|
||||
@ -1926,7 +1927,7 @@ class Commande
|
||||
$file = $conf->commande->dir_output . "/" . $comref . "/" . $comref . ".pdf";
|
||||
if (file_exists($file))
|
||||
{
|
||||
commande_delete_preview($this->db, $this->id);
|
||||
commande_delete_preview($this->db, $this->id, $this->ref);
|
||||
|
||||
if (!dol_delete_file($file))
|
||||
{
|
||||
|
||||
@ -287,7 +287,6 @@ if ($_POST['action'] == 'confirm_delete' && $_POST['confirm'] == 'yes')
|
||||
if ($user->rights->commande->supprimer )
|
||||
{
|
||||
$commande = new Commande($db);
|
||||
//$commande->id = $_GET['id'];
|
||||
$commande->fetch($_GET['id']);
|
||||
$commande->delete();
|
||||
Header('Location: index.php');
|
||||
|
||||
@ -212,25 +212,39 @@ function commande_pdf_create($db, $id, $modele='', $outputlangs='')
|
||||
}
|
||||
|
||||
|
||||
function commande_delete_preview($db, $commandeid)
|
||||
function commande_delete_preview($db, $commandeid, $commanderef='')
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
$com = new Commande($db,"",$commandeid);
|
||||
$com->fetch($commandeid);
|
||||
$client = new Societe($db);
|
||||
$client->fetch($com->soc_id);
|
||||
if (!$commanderef)
|
||||
{
|
||||
$com = new Commande($db,"",$commandeid);
|
||||
$com->fetch($commandeid);
|
||||
$commanderef = $com->ref;
|
||||
}
|
||||
//$client = new Societe($db);
|
||||
//$client->fetch($com->soc_id);
|
||||
|
||||
if ($conf->commande->dir_output)
|
||||
{
|
||||
$comref = sanitize_string($com->ref);
|
||||
$comref = sanitize_string($commanderef);
|
||||
$dir = $conf->commande->dir_output . "/" . $comref ;
|
||||
$file = $dir . "/" . $comref . ".pdf.png";
|
||||
$multiple = $file . ".";
|
||||
|
||||
for ($i = 0; $i < 20; $i++)
|
||||
if ( file_exists( $file ) && is_writable( $file ) )
|
||||
{
|
||||
$preview = $multiple.$i;
|
||||
if ( ! unlink($file) )
|
||||
{
|
||||
$this->error=$langs->trans("ErrorFailedToOpenFile",$file);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ($i = 0; $i < 20; $i++)
|
||||
{
|
||||
$preview = $multiple.$i;
|
||||
|
||||
if ( file_exists( $preview ) && is_writable( $preview ) )
|
||||
{
|
||||
@ -240,15 +254,8 @@ function commande_delete_preview($db, $commandeid)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if ( file_exists( $file ) && is_writable( $file ) )
|
||||
{
|
||||
if ( ! unlink($file) )
|
||||
{
|
||||
$this->error=$langs->trans("ErrorFailedToOpenFile",$file);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user