Skip to content
Snippets Groups Projects
Commit 058d0b1b authored by Regis Houssin's avatar Regis Houssin
Browse files

Fix: [ bug #503 ] Unable to delete linked file to a deposit

parent bd99c2d2
No related branches found
No related tags found
No related merge requests found
......@@ -158,7 +158,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->c
if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->banque->cheque)
{
$result = $object->fetch($_GET["id"]);
$result = $object->fetch($id);
$result = $object->validate($user);
if ($result >= 0)
{
......@@ -185,7 +185,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->banque->c
if ($action == 'builddoc' && $user->rights->banque->cheque)
{
$result = $object->fetch($_GET["id"]);
$result = $object->fetch($id);
/*if ($_REQUEST['model'])
{
......@@ -214,6 +214,22 @@ if ($action == 'builddoc' && $user->rights->banque->cheque)
}
}
// Remove file in doc form
else if ($action == 'remove_file' && $user->rights->banque->cheque)
{
if ($object->fetch($id) > 0)
{
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
$langs->load("other");
$file=$dir.get_exdir($object->number,2,1) . GETPOST('file');
$ret=dol_delete_file($file,0,0,0,$object);
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('file')));
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), 'errors');
}
}
/*
* View
......@@ -608,8 +624,12 @@ if ($action != 'new')
{
if ($object->statut == 1)
{
$dirchequereceipts = $dir.get_exdir($object->number,2,1).$object->ref;
$formfile->show_documents("remisecheque",$object->ref,$dirchequereceipts,$_SERVER["PHP_SELF"].'?id='.$object->id,1,1);
$filename=dol_sanitizeFileName($object->ref);
$filedir=$dir.get_exdir($object->number,2,1) . dol_sanitizeFileName($object->ref);
$urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id;
$formfile->show_documents('remisecheque', $filename, $filedir, $urlsource, 1, 1);
print '<br>';
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment