Skip to content
Snippets Groups Projects
Commit 561a1a1a authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix: Miscellaneous problems on task tabs (withproject parameter lost and

download fails).
parent c8f63d61
Branches
No related tags found
No related merge requests found
...@@ -764,8 +764,9 @@ class FormFile ...@@ -764,8 +764,9 @@ class FormFile
if (empty($relativepath)) if (empty($relativepath))
{ {
$relativepath=(! empty($object->ref)?dol_sanitizeFileName($object->ref):'').'/'; $relativepath=(! empty($object->ref)?dol_sanitizeFileName($object->ref):'').'/';
if ($object->element == 'invoice_supplier') $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; 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; $var=!$var;
...@@ -1052,9 +1053,10 @@ class FormFile ...@@ -1052,9 +1053,10 @@ class FormFile
* @param int $permtodelete Deletion is allowed * @param int $permtodelete Deletion is allowed
* @param string $action Action * @param string $action Action
* @param string $selected ??? * @param string $selected ???
* @param string $param More param to add into URL
* @return int Number of links * @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 $user, $conf, $langs, $user;
global $bc; global $bc;
...@@ -1071,17 +1073,17 @@ class FormFile ...@@ -1071,17 +1073,17 @@ class FormFile
$sortfield = null; $sortfield = null;
} }
$res = $link->fetchAll($links, $object->element, $object->id, $sortfield, $sortorder); $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 // Show list of associated links
print_titre($langs->trans("LinkedFiles")); 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 '<table width="100%" class="liste">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre( print_liste_field_titre(
$langs->trans("Documents2"), $langs->trans("Links"),
$_SERVER['PHP_SELF'], $_SERVER['PHP_SELF'],
"name", "name",
"", "",
...@@ -1135,34 +1137,34 @@ class FormFile ...@@ -1135,34 +1137,34 @@ class FormFile
print '<input type="hidden" name="action" value="confirm_updateline">'; print '<input type="hidden" name="action" value="confirm_updateline">';
print $langs->trans('Link') . ': <input type="text" name="link" size="50" value="' . $link->url . '">'; print $langs->trans('Link') . ': <input type="text" name="link" size="50" value="' . $link->url . '">';
print '</td>'; print '</td>';
print '<td align="right">'; print '<td>';
print $langs->trans('Label') . ': <input type="text" name="label" value="' . $link->label . '">'; print $langs->trans('Label') . ': <input type="text" name="label" value="' . $link->label . '">';
print '</td>'; print '</td>';
print '<td align="center">' . dol_print_date(dol_now(), "dayhour", "tzuser") . '</td>'; print '<td align="center">' . dol_print_date(dol_now(), "dayhour", "tzuser") . '</td>';
print '<td align="right"></td>'; print '<td align="right"></td>';
print '<td align="right" colspan="2"><input type="submit" name="save" class="button" value="' . $langs->trans('Save') . '">'; print '<td align="right" colspan="2">';
print '<input type="submit" name="cancel" class="button" value="' . $langs->trans('Cancel') . '">'; 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>'; print '</td>';
} }
else { else
{
print '<td>'; 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 $link->label;
print '</a>'; print '</a>';
print "</td>\n"; print '</td>'."\n";
print '<td align="right"></td>'; print '<td align="right"></td>';
print '<td align="center">' . dol_print_date($link->datea, "dayhour", "tzuser") . '</td>'; print '<td align="center">' . dol_print_date($link->datea, "dayhour", "tzuser") . '</td>';
print '<td align="center"></td>'; print '<td align="center"></td>';
print '<td align="right" colspan="2">'; print '<td align="right" colspan="2">';
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=update&linkid=' . $link->id print '<a href="' . $_SERVER['PHP_SELF'] . '?action=update&linkid=' . $link->id . $param . '" class="editfilelink" >' . img_edit() . '</a>'; // id= is included into $param
. '&id=' . $object->id . '" class="editfilelink" >' . img_edit().'</a>';
if ($permtodelete) { if ($permtodelete) {
print ' &nbsp; <a href="'. $_SERVER['PHP_SELF'] .'?action=delete&linkid=' . $link->id print ' &nbsp; <a href="'. $_SERVER['PHP_SELF'] .'?action=delete&linkid=' . $link->id . $param . '" class="deletefilelink">' . img_delete() . '</a>'; // id= is included into $param
. '&id=' . $object->id . '" class="deletefilelink" >' . img_delete() . '</a>';
} else { } else {
print '&nbsp;'; print '&nbsp;';
} }
print "</td>"; print '</td>';
} }
print "</tr>\n"; print "</tr>\n";
} }
......
<?php <?php
/* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> /* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* 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
...@@ -18,16 +18,17 @@ ...@@ -18,16 +18,17 @@
*/ */
$langs->load("link"); $langs->load("link");
if (empty($relativepathwithnofile)) $relativepathwithnofile='';
/* /*
* Confirm suppression * Confirm form to delete
*/ */
if ($action == 'delete') if ($action == 'delete')
{ {
$langs->load("companies"); // Need for string DeleteFile+ConfirmDeleteFiles $langs->load("companies"); // Need for string DeleteFile+ConfirmDeleteFiles
$ret = $form->form_confirm( $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('DeleteFile'),
$langs->trans('ConfirmDeleteFile'), $langs->trans('ConfirmDeleteFile'),
'confirm_deletefile', 'confirm_deletefile',
...@@ -58,11 +59,11 @@ $formfile->list_of_documents( ...@@ -58,11 +59,11 @@ $formfile->list_of_documents(
$modulepart, $modulepart,
$param, $param,
0, 0,
'', $relativepathwithnofile, // relative path with no file. For example "moduledir/0/1"
$permission $permission
); );
print "<br>"; print "<br>";
//List of links //List of links
$formfile->listOfLinks($object, $permission, $action, GETPOST('linkid', 'int')); $formfile->listOfLinks($object, $permission, $action, GETPOST('linkid', 'int'), $param);
print "<br>"; print "<br>";
...@@ -74,7 +74,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') ...@@ -74,7 +74,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
setEventMessage($langs->trans("ErrorFailedToDeleteLink", $link->label), 'errors'); 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; exit;
} }
} }
......
...@@ -144,9 +144,8 @@ if ($object->id > 0) ...@@ -144,9 +144,8 @@ if ($object->id > 0)
print "</table>\n"; print "</table>\n";
print "</div>\n"; print "</div>\n";
$modulepart = 'projet'; $modulepart = 'project';
$permission = ($userWrite > 0); $permission = ($userWrite > 0);
$param = '&id=' . $object->id;
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
} }
......
...@@ -110,6 +110,7 @@ if ($id > 0 || ! empty($ref)) ...@@ -110,6 +110,7 @@ if ($id > 0 || ! empty($ref))
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
/* /*
* View * View
*/ */
...@@ -229,9 +230,11 @@ if ($object->id > 0) ...@@ -229,9 +230,11 @@ if ($object->id > 0)
print '<br>'; print '<br>';
$modulepart = 'projet'; $param='';
if ($withproject) $param .= '&withproject=1';
$modulepart = 'project_task';
$permission = $user->rights->projet->creer; $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'; include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
} }
else else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment