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-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
* 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
|
||||
@@ -60,47 +61,31 @@ if (! $sortfield) $sortfield="name";
|
||||
|
||||
|
||||
$upload_dir = $conf->adherent->dir_output . "/" . get_exdir($id,2,0,1) . '/' . $id;
|
||||
|
||||
|
||||
|
||||
$form = new Form($db);
|
||||
$object=new Adherent($db);
|
||||
$membert=new AdherentType($db);
|
||||
$result=$object->fetch($id);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Envoie fichier
|
||||
if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
dol_add_file_process($upload_dir,0,1,'userfile');
|
||||
}
|
||||
|
||||
// Suppression fichier
|
||||
if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
{
|
||||
$langs->load("other");
|
||||
$file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||
$ret=dol_delete_file($file);
|
||||
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';
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$object=new Adherent($db);
|
||||
$membert=new AdherentType($db);
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($id > 0)
|
||||
{
|
||||
$result=$object->fetch($id);
|
||||
$result=$membert->fetch($object->typeid);
|
||||
if ($result > 0)
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.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
|
||||
@@ -79,26 +80,9 @@ if (! $sortfield) $sortfield="name";
|
||||
|
||||
|
||||
/*
|
||||
* Action envoie fichier
|
||||
* Actions
|
||||
*/
|
||||
if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
$upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($objectid);
|
||||
dol_add_file_process($upload_dir,0,1,'userfile');
|
||||
}
|
||||
|
||||
/*
|
||||
* Efface fichier
|
||||
*/
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($objectid);
|
||||
$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,$act);
|
||||
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
|
||||
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
|
||||
$action='';
|
||||
}
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions.tpl.php';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2004-2009 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
|
||||
@@ -64,38 +65,14 @@ $object->fetch($id,$ref);
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
$upload_dir = $conf->propal->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions.tpl.php';
|
||||
}
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Envoi fichier
|
||||
if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$upload_dir = $conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
dol_add_file_process($upload_dir,0,1,'userfile');
|
||||
}
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$langs->load("other");
|
||||
|
||||
$upload_dir = $conf->propal->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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
$upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
dol_add_file_process($upload_dir,0,1,'userfile');
|
||||
}
|
||||
}
|
||||
|
||||
// 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';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
||||
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* 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
|
||||
@@ -71,29 +72,7 @@ $modulepart='trip';
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('sendit','alpha') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
dol_add_file_process($upload_dir,0,1,'userfile');
|
||||
}
|
||||
|
||||
// Delete
|
||||
else if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$langs->load("other");
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$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';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -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-2011 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
|
||||
@@ -64,40 +65,17 @@ if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="name";
|
||||
|
||||
$object = new Facture($db);
|
||||
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
$upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
}
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions.tpl.php';
|
||||
|
||||
// Envoi fichier
|
||||
if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
$upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
dol_add_file_process($upload_dir,0,1,'userfile');
|
||||
}
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
$langs->load("other");
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$upload_dir = $conf->facture->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;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* 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
|
||||
@@ -71,18 +72,7 @@ $modulepart='tax';
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
dol_add_file_process($upload_dir,0,1,'userfile');
|
||||
}
|
||||
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$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');
|
||||
}
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions.tpl.php';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -74,28 +74,9 @@ $modulepart='contract';
|
||||
|
||||
|
||||
/*
|
||||
* Action envoie fichier
|
||||
* Actions
|
||||
*/
|
||||
if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
dol_add_file_process($upload_dir,0,1,'userfile');
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->id)
|
||||
{
|
||||
$langs->load("other");
|
||||
|
||||
$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='.$object->id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions.tpl.php';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
35
htdocs/core/tpl/document_actions.tpl.php
Normal file
35
htdocs/core/tpl/document_actions.tpl.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
// Envoi fichier
|
||||
if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
if ($object->id)
|
||||
{
|
||||
dol_add_file_process($upload_dir,0,1,'userfile');
|
||||
}
|
||||
}
|
||||
//test code for the link feature, need to mutualize it to avoid copy/paste on every document page
|
||||
elseif (GETPOST('linkit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) {
|
||||
if ($object->id) {
|
||||
$link = GETPOST('link', 'alpha');
|
||||
if (!strpos(substr($link, 0, 7), 'http://') && !strpos(substr($link, 0, 8), 'https://')) {
|
||||
$link = 'http://' . $link;
|
||||
}
|
||||
dol_add_file_process($upload_dir,0,1,'userfile', $link);
|
||||
}
|
||||
}
|
||||
|
||||
// Delete file
|
||||
if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->id)
|
||||
{
|
||||
$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='.$object->id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -71,29 +71,7 @@ $modulepart='fichinter';
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('sendit','alpha') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
dol_add_file_process($upload_dir,0,1,'userfile');
|
||||
}
|
||||
|
||||
// Delete
|
||||
else if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$langs->load("other");
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$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';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.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
|
||||
@@ -77,26 +78,7 @@ $object->fetch_thirdparty();
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Envoi fichier
|
||||
if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
dol_add_file_process($upload_dir,0,1,'userfile');
|
||||
}
|
||||
|
||||
else if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$langs->load("other");
|
||||
|
||||
$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';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -71,29 +71,7 @@ if ($object->fetch($id, $ref))
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Envoi fichier
|
||||
if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
if ($object->id > 0)
|
||||
{
|
||||
dol_add_file_process($upload_dir, 0, 1, 'userfile', GETPOST('savingdocmask'));
|
||||
}
|
||||
}
|
||||
|
||||
// Delete
|
||||
else if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$langs->load("other");
|
||||
$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';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* 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
|
||||
@@ -80,22 +81,7 @@ $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action);
|
||||
* Action envoie fichier
|
||||
*/
|
||||
|
||||
if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
dol_add_file_process($upload_dir,0,1,'userfile');
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($action=='delete')
|
||||
{
|
||||
$langs->load("other");
|
||||
$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';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* 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
|
||||
@@ -49,6 +50,7 @@ $object->fetch($id,$ref);
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
$upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
}
|
||||
|
||||
// Get parameters
|
||||
@@ -68,25 +70,7 @@ if (! $sortfield) $sortfield="name";
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Envoi fichier
|
||||
if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
$upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
dol_add_file_process($upload_dir,0,1,'userfile');
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->projet->supprimer)
|
||||
{
|
||||
$langs->load("other");
|
||||
$upload_dir = $conf->projet->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='.$object->id);
|
||||
exit;
|
||||
}
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions.tpl.php';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Florian Henry <florian.henry@open-concept.pro>
|
||||
* 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
|
||||
@@ -107,23 +108,7 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
}
|
||||
|
||||
// Envoi fichier
|
||||
if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
dol_add_file_process($upload_dir,0,1,'userfile');
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($action=='delete')
|
||||
{
|
||||
$langs->load("other");
|
||||
$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';
|
||||
|
||||
/*
|
||||
* View
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
* 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
|
||||
@@ -72,31 +73,7 @@ if ($id > 0 || ! empty($ref))
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// TODO Use an include to mutualize this code for action sendit and confirm_deletefile
|
||||
|
||||
// Post file
|
||||
if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
if ($object->id)
|
||||
{
|
||||
dol_add_file_process($upload_dir,0,1,'userfile');
|
||||
}
|
||||
}
|
||||
|
||||
// Delete file
|
||||
if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->id)
|
||||
{
|
||||
$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='.$object->id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions.tpl.php';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user