Fix: Miscellaneous problems on task tabs (withproject parameter lost and
download fails).
This commit is contained in:
parent
c8f63d6160
commit
561a1a1aac
@ -764,8 +764,9 @@ class FormFile
|
||||
if (empty($relativepath))
|
||||
{
|
||||
$relativepath=(! empty($object->ref)?dol_sanitizeFileName($object->ref):'').'/';
|
||||
if ($object->element == 'invoice_supplier') $relativepath=get_exdir($object->id,2).$relativepath;
|
||||
if ($object->element == 'member') $relativepath=get_exdir($object->id,2).$relativepath;
|
||||
if ($object->element == 'invoice_supplier') $relativepath=get_exdir($object->id,2).$relativepath; // TODO Call using a defined value for $relativepath
|
||||
if ($object->element == 'member') $relativepath=get_exdir($object->id,2).$relativepath; // TODO Call using a defined value for $relativepath
|
||||
if ($object->element == 'project_task') $relativepath='Call_not_supported_._Call_function_using_a_defined_relative_path_.';
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
@ -1052,9 +1053,10 @@ class FormFile
|
||||
* @param int $permtodelete Deletion is allowed
|
||||
* @param string $action Action
|
||||
* @param string $selected ???
|
||||
* @param string $param More param to add into URL
|
||||
* @return int Number of links
|
||||
*/
|
||||
public function listOfLinks($object, $permtodelete=1, $action=null, $selected=null)
|
||||
public function listOfLinks($object, $permtodelete=1, $action=null, $selected=null, $param='')
|
||||
{
|
||||
global $user, $conf, $langs, $user;
|
||||
global $bc;
|
||||
@ -1071,17 +1073,17 @@ class FormFile
|
||||
$sortfield = null;
|
||||
}
|
||||
$res = $link->fetchAll($links, $object->element, $object->id, $sortfield, $sortorder);
|
||||
$param = (isset($object->id)?'&id=' . $object->id : '');
|
||||
$param .= (isset($object->id)?'&id=' . $object->id : '');
|
||||
|
||||
// Show list of associated links
|
||||
print_titre($langs->trans("LinkedFiles"));
|
||||
|
||||
print '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST">';
|
||||
print '<form action="' . $_SERVER['PHP_SELF'] . ($param?'?'.$param:'') . '" method="POST">';
|
||||
|
||||
print '<table width="100%" class="liste">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre(
|
||||
$langs->trans("Documents2"),
|
||||
$langs->trans("Links"),
|
||||
$_SERVER['PHP_SELF'],
|
||||
"name",
|
||||
"",
|
||||
@ -1135,34 +1137,34 @@ class FormFile
|
||||
print '<input type="hidden" name="action" value="confirm_updateline">';
|
||||
print $langs->trans('Link') . ': <input type="text" name="link" size="50" value="' . $link->url . '">';
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
print '<td>';
|
||||
print $langs->trans('Label') . ': <input type="text" name="label" value="' . $link->label . '">';
|
||||
print '</td>';
|
||||
print '<td align="center">' . dol_print_date(dol_now(), "dayhour", "tzuser") . '</td>';
|
||||
print '<td align="right"></td>';
|
||||
print '<td align="right" colspan="2"><input type="submit" name="save" class="button" value="' . $langs->trans('Save') . '">';
|
||||
print '<input type="submit" name="cancel" class="button" value="' . $langs->trans('Cancel') . '">';
|
||||
print '<td align="right" colspan="2">';
|
||||
print '<input type="submit" name="save" class="button" value="' . dol_escape_htmltag($langs->trans('Save')) . '">';
|
||||
print '<input type="submit" name="cancel" class="button" value="' . dol_escape_htmltag($langs->trans('Cancel')) . '">';
|
||||
print '</td>';
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
print '<td>';
|
||||
print '<a data-ajax="false" href="'. $link->url . '" target="_blank">';
|
||||
print '<a data-ajax="false" href="' . $link->url . '" target="_blank">';
|
||||
print $link->label;
|
||||
print '</a>';
|
||||
print "</td>\n";
|
||||
print '</td>'."\n";
|
||||
print '<td align="right"></td>';
|
||||
print '<td align="center">' . dol_print_date($link->datea, "dayhour", "tzuser") . '</td>';
|
||||
print '<td align="center"></td>';
|
||||
print '<td align="right" colspan="2">';
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=update&linkid=' . $link->id
|
||||
. '&id=' . $object->id . '" class="editfilelink" >' . img_edit().'</a>';
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=update&linkid=' . $link->id . $param . '" class="editfilelink" >' . img_edit() . '</a>'; // id= is included into $param
|
||||
if ($permtodelete) {
|
||||
print ' <a href="'. $_SERVER['PHP_SELF'] .'?action=delete&linkid=' . $link->id
|
||||
. '&id=' . $object->id . '" class="deletefilelink" >' . img_delete() . '</a>';
|
||||
print ' <a href="'. $_SERVER['PHP_SELF'] .'?action=delete&linkid=' . $link->id . $param . '" class="deletefilelink">' . img_delete() . '</a>'; // id= is included into $param
|
||||
} else {
|
||||
print ' ';
|
||||
}
|
||||
print "</td>";
|
||||
print '</td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
@ -18,16 +18,17 @@
|
||||
*/
|
||||
|
||||
$langs->load("link");
|
||||
if (empty($relativepathwithnofile)) $relativepathwithnofile='';
|
||||
|
||||
/*
|
||||
* Confirm suppression
|
||||
* Confirm form to delete
|
||||
*/
|
||||
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$langs->load("companies"); // Need for string DeleteFile+ConfirmDeleteFiles
|
||||
$ret = $form->form_confirm(
|
||||
$_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode(GETPOST("urlfile")) . '&linkid=' . GETPOST('linkid', 'int'),
|
||||
$_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode(GETPOST("urlfile")) . '&linkid=' . GETPOST('linkid', 'int') . (empty($param)?'':$param),
|
||||
$langs->trans('DeleteFile'),
|
||||
$langs->trans('ConfirmDeleteFile'),
|
||||
'confirm_deletefile',
|
||||
@ -58,11 +59,11 @@ $formfile->list_of_documents(
|
||||
$modulepart,
|
||||
$param,
|
||||
0,
|
||||
'',
|
||||
$relativepathwithnofile, // relative path with no file. For example "moduledir/0/1"
|
||||
$permission
|
||||
);
|
||||
|
||||
print "<br>";
|
||||
//List of links
|
||||
$formfile->listOfLinks($object, $permission, $action, GETPOST('linkid', 'int'));
|
||||
$formfile->listOfLinks($object, $permission, $action, GETPOST('linkid', 'int'), $param);
|
||||
print "<br>";
|
||||
|
||||
@ -74,7 +74,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
setEventMessage($langs->trans("ErrorFailedToDeleteLink", $link->label), 'errors');
|
||||
}
|
||||
}
|
||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
|
||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id.($withproject?'&withproject=1':''));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,9 +144,8 @@ if ($object->id > 0)
|
||||
print "</table>\n";
|
||||
print "</div>\n";
|
||||
|
||||
$modulepart = 'projet';
|
||||
$modulepart = 'project';
|
||||
$permission = ($userWrite > 0);
|
||||
$param = '&id=' . $object->id;
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
||||
|
||||
}
|
||||
|
||||
@ -110,6 +110,7 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -229,9 +230,11 @@ if ($object->id > 0)
|
||||
|
||||
print '<br>';
|
||||
|
||||
$modulepart = 'projet';
|
||||
$param='';
|
||||
if ($withproject) $param .= '&withproject=1';
|
||||
$modulepart = 'project_task';
|
||||
$permission = $user->rights->projet->creer;
|
||||
$param = '&id=' . $object->id;
|
||||
$relativepathwithnofile=dol_sanitizeFileName($projectstatic->ref).'/'.dol_sanitizeFileName($object->ref).'/';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
||||
}
|
||||
else
|
||||
|
||||
Loading…
Reference in New Issue
Block a user