Fix: Correct directory where the donation is generated & add the action to remove_file who are generated
This commit is contained in:
parent
478947d630
commit
73d8f20c6b
@ -105,7 +105,7 @@ class html_cerfafr extends ModeleDon
|
||||
else
|
||||
{
|
||||
$donref = dol_sanitizeFileName($don->ref);
|
||||
$dir = $conf->don->dir_output . "/" . get_exdir($donref,2,0,1,$don,'donation') . "/" . dol_sanitizeFileName($don->ref);
|
||||
$dir = $conf->don->dir_output . "/" . $donref;
|
||||
$file = $dir . "/" . $donref . ".html";
|
||||
}
|
||||
|
||||
|
||||
@ -229,6 +229,25 @@ if ($action == 'set_paid')
|
||||
setEventMessage($object->error, 'errors');
|
||||
}
|
||||
}
|
||||
// Remove file in doc form
|
||||
if ($action == 'remove_file')
|
||||
{
|
||||
$object = new Don($db, 0, $_GET['id']);
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$langs->load("other");
|
||||
$upload_dir = $conf->don->dir_output;
|
||||
$file = $upload_dir . '/' . GETPOST('file');
|
||||
$ret=dol_delete_file($file,0,0,0,$object);
|
||||
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
|
||||
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Build doc
|
||||
@ -743,13 +762,11 @@ if (! empty($id) && $action != 'edit')
|
||||
/*
|
||||
* Documents generes
|
||||
*/
|
||||
$filename=dol_sanitizeFileName($object->id);
|
||||
$filedir=$conf->don->dir_output . '/' . get_exdir($filename,2,0,1,$object,'donation'). '/'. dol_sanitizeFileName($object->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?rowid='.$object->id;
|
||||
// $genallowed=($fac->statut == 1 && ($fac->paye == 0 || $user->admin) && $user->rights->facture->creer);
|
||||
// $delallowed=$user->rights->facture->supprimer;
|
||||
$genallowed=1;
|
||||
$delallowed=0;
|
||||
$filename = dol_sanitizeFileName($object->id);
|
||||
$filedir = $conf->don->dir_output . "/" . dol_sanitizeFileName($object->id);
|
||||
$urlsource = $_SERVER['PHP_SELF'].'?rowid='.$object->id;
|
||||
$genallowed = ($object->statut == 2 && ($object->paid == 0 || $user->admin) && $user->rights->don->creer);
|
||||
$delallowed = $user->rights->don->supprimer;
|
||||
|
||||
$var=true;
|
||||
|
||||
|
||||
@ -695,7 +695,6 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->
|
||||
dol_fiche_head('');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tbody>';
|
||||
|
||||
// VAT
|
||||
print '<tr><td>' . $langs->trans("VATRate") . '</td><td>';
|
||||
@ -774,7 +773,6 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '</tbody>';
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user