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) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
* 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
|
* 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
|
* 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;
|
$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
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Envoie fichier
|
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions.tpl.php';
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$form = new Form($db);
|
|
||||||
$object=new Adherent($db);
|
|
||||||
$membert=new AdherentType($db);
|
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
{
|
{
|
||||||
$result=$object->fetch($id);
|
|
||||||
$result=$membert->fetch($object->typeid);
|
$result=$membert->fetch($object->typeid);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.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
|
* 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
|
* 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))
|
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions.tpl.php';
|
||||||
{
|
|
||||||
$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='';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.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
|
* 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
|
* 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)
|
if ($object->id > 0)
|
||||||
{
|
{
|
||||||
$object->fetch_thirdparty();
|
$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
|
* 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) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -65,35 +66,13 @@ $object = new Commande($db);
|
|||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
if ($object->fetch($id))
|
||||||
// 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);
|
||||||
$object->fetch_thirdparty();
|
|
||||||
$upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
|
||||||
dol_add_file_process($upload_dir,0,1,'userfile');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete
|
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions.tpl.php';
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -107,10 +86,10 @@ $form = new Form($db);
|
|||||||
if ($id > 0 || ! empty($ref))
|
if ($id > 0 || ! empty($ref))
|
||||||
{
|
{
|
||||||
if ($object->fetch($id, $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);
|
$head = commande_prepare_head($object);
|
||||||
dol_fiche_head($head, 'documents', $langs->trans('CustomerOrder'), 0, 'order');
|
dol_fiche_head($head, 'documents', $langs->trans('CustomerOrder'), 0, 'order');
|
||||||
@@ -140,7 +119,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
print "</div>\n";
|
print "</div>\n";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Confirmation suppression fichier
|
* Confirmation suppression fichier
|
||||||
*/
|
*/
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
||||||
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
|
* 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -71,29 +72,7 @@ $modulepart='trip';
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('sendit','alpha') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions.tpl.php';
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.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
|
* 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
|
* 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";
|
if (! $sortfield) $sortfield="name";
|
||||||
|
|
||||||
$object = new Facture($db);
|
$object = new Facture($db);
|
||||||
|
if ($object->fetch($id))
|
||||||
|
{
|
||||||
|
$object->fetch_thirdparty();
|
||||||
|
$upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* 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
|
* View
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
||||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
* 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -71,18 +72,7 @@ $modulepart='tax';
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions.tpl.php';
|
||||||
{
|
|
||||||
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');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -74,28 +74,9 @@ $modulepart='contract';
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action envoie fichier
|
* Actions
|
||||||
*/
|
*/
|
||||||
if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions.tpl.php';
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
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
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('sendit','alpha') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions.tpl.php';
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -77,26 +78,7 @@ $object->fetch_thirdparty();
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Envoi fichier
|
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions.tpl.php';
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -71,29 +71,7 @@ if ($object->fetch($id, $ref))
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Envoi fichier
|
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions.tpl.php';
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -218,4 +196,4 @@ else
|
|||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
|
||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* 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
|
* 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
|
* 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
|
* Action envoie fichier
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions.tpl.php';
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
|
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
* 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
|
* 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
|
* 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)
|
if ($object->id > 0)
|
||||||
{
|
{
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
$upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get parameters
|
// Get parameters
|
||||||
@@ -68,25 +70,7 @@ if (! $sortfield) $sortfield="name";
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Envoi fichier
|
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions.tpl.php';
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2012 Florian Henry <florian.henry@open-concept.pro>
|
* 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -107,23 +108,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Envoi fichier
|
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions.tpl.php';
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
* 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -72,31 +73,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// TODO Use an include to mutualize this code for action sendit and confirm_deletefile
|
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions.tpl.php';
|
||||||
|
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user