forked from Wavyzz/dolibarr
factorized document actions
Conflicts: htdocs/societe/document.php
This commit is contained in:
committed by
Raphaël Doursenaud
parent
9a0471286a
commit
23008c3b31
@@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -65,35 +66,13 @@ $object = new Commande($db);
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Envoi fichier
|
||||
if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
$upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
dol_add_file_process($upload_dir,0,1,'userfile');
|
||||
}
|
||||
$object->fetch_thirdparty();
|
||||
$upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
}
|
||||
|
||||
// Delete
|
||||
else if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
$langs->load("other");
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||
$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');
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions.tpl.php';
|
||||
|
||||
|
||||
/*
|
||||
@@ -107,10 +86,10 @@ $form = new Form($db);
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
if ($object->fetch($id, $ref))
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$upload_dir = $conf->commande->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||
$upload_dir = $conf->commande->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||
|
||||
$head = commande_prepare_head($object);
|
||||
dol_fiche_head($head, 'documents', $langs->trans('CustomerOrder'), 0, 'order');
|
||||
@@ -140,7 +119,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print "</table>\n";
|
||||
print "</div>\n";
|
||||
|
||||
/*
|
||||
/*
|
||||
* Confirmation suppression fichier
|
||||
*/
|
||||
if ($action == 'delete')
|
||||
|
||||
Reference in New Issue
Block a user