Fix: delete of documents is done by page of element, not by the view

wrapper.

Conflicts:
	htdocs/langs/en_US/main.lang
	htdocs/langs/fr_FR/main.lang
	htdocs/projet/fiche.php
This commit is contained in:
Laurent Destailleur
2012-05-30 00:18:11 +02:00
committed by Regis Houssin
parent caadf396e2
commit 514babeab1
27 changed files with 324 additions and 195 deletions

View File

@@ -27,6 +27,7 @@
require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php');
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/lib/images.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
require_once(DOL_DOCUMENT_ROOT ."/commande/class/commande.class.php");
@@ -80,7 +81,16 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
$resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0,0,$_FILES['userfile']['error']);
if (is_numeric($resupload) && $resupload > 0)
{
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1)
{
// Create small thumbs for image (Ratio is near 16/9)
// Used on logon for example
$imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs");
// Create mini thumbs for image (Ratio is near 16/9)
// Used on menu or for setup page for example
$imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'], $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
}
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
}
else
{
@@ -107,12 +117,13 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
{
if ($object->fetch($id))
{
$object->fetch_thirdparty();
$langs->load("other");
$object->fetch_thirdparty();
$upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref);
$file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
dol_delete_file($file,0,0,0,$object);
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
}
}

View File

@@ -472,11 +472,11 @@ else if ($action == 'setconditions' && $user->rights->commande->creer)
$object->fetch($id);
$result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int'));
if ($result < 0)
{
{
dol_print_error($db,$object->error);
}
else
{
{
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
// Define output language
@@ -492,7 +492,7 @@ else if ($action == 'setconditions' && $user->rights->commande->creer)
$ret=$object->fetch($id); // Reload to get new records
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager);
}
}
}
}
else if ($action == 'setremisepercent' && $user->rights->commande->creer)
@@ -1024,10 +1024,11 @@ else if ($action == 'remove_file')
{
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
$langs->load("other");
$upload_dir = $conf->commande->dir_output;
$file = $upload_dir . '/' . $_GET['file'];
$file = $upload_dir . '/' . GETPOST('file');
dol_delete_file($file);
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved").'</div>';
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('file')).'</div>';
}
}