Commit 55ca1dca authored by Jonny Bradley's avatar Jonny Bradley

[FIX] trackerfilter: Make export action obey itemId if not doing ignoreRequestItemId (thanks Geoff)

parent 65e5dfb0
......@@ -326,6 +326,10 @@ function wikiplugin_trackerfilter($data, $params)
$smarty->assign('export_created', $export_created == 'y' ? 'on' : '');
$smarty->assign('export_modif', $export_modif == 'y' ? 'on' : '');
$smarty->assign('export_charset', $export_charset);
if (!empty($_REQUEST['itemId']) && (empty($ignoreRequestItemId) || $ignoreRequestItemId != 'y') ) {
$smarty->assign('export_itemId', $_REQUEST['itemId']);
}
if (empty($params['filters'])) {
if (!empty($filterfield)) { // convert param filters to export params
......
......@@ -19,6 +19,7 @@ function tf_export_submit(fm) {
{/jq}
<form action="tiki-export_tracker.php" method="post" onsubmit="tf_export_submit(this);">
{query _type='form_input' listfields=$export_fields showItemId=$export_itemid showStatus=$export_status showCreated=$export_created showLastModif=$export_modif encoding=$export_charset}
{if not empty($export_itemId)}<input type="hidden" name="itemId" value="{$export_itemId}">{/if}
{foreach from=$f_fields item=f_v key=f_k}
<input type="hidden" name="{$f_k}" value="{$f_v}">
{/foreach}
......
......@@ -215,36 +215,54 @@ if (isset($tracker_info['defaultOrderDir'])) {
}
$heading = 'y';
$smarty->assign_by_ref('heading', $heading);
while (($items = $trklib->list_items($_REQUEST['trackerId'], $offset, $maxRecords, $sort_mode, $listfields, $filterFields, $values, $_REQUEST['status'], $_REQUEST['initial'], $exactValues)) && !empty($items['data'])) {
// still need to filter the fields that are view only by the admin and the item creator
if ($tracker_info['useRatings'] == 'y')
foreach ($items['data'] as $f=>$v) {
$items['data'][$f]['my_rate'] = $tikilib->get_user_vote("tracker.".$_REQUEST['trackerId'].'.'.$items['data'][$f]['itemId'], $user);
if (empty($_REQUEST['itemId'])) {
while (($items = $trklib->list_items($_REQUEST['trackerId'], $offset, $maxRecords, $sort_mode, $listfields, $filterFields, $values, $_REQUEST['status'], $_REQUEST['initial'], $exactValues)) && !empty($items['data'])) {
// still need to filter the fields that are view only by the admin and the item creator
if ($tracker_info['useRatings'] == 'y')
foreach ($items['data'] as $f => $v) {
$items['data'][$f]['my_rate'] = $tikilib->get_user_vote("tracker." . $_REQUEST['trackerId'] . '.' . $items['data'][$f]['itemId'], $user);
}
$smarty->assign_by_ref('items', $items["data"]);
$data = $smarty->fetch('tiki-export_tracker_item.tpl');
$data = preg_replace("/^\n/", "", $data);
if (empty($_REQUEST['encoding']) || $_REQUEST['encoding'] == 'ISO-8859-1') {
$data = utf8_decode($data);
}
$smarty->assign_by_ref('items', $items["data"]);
$offset += $maxRecords;
$heading = 'n';
if (!empty($fp)) {
fwrite($fp, $data);
} else {
echo $data;
}
if ($tracker_info['useAttachments'] == 'y' && !empty($_REQUEST['zip'])) {
foreach ($items['data'] as $v) {
if (!$trklib->export_attachment($v['itemId'], $archive)) {
$smarty->assign('msg', tra('Problem zip'));
$smarty->display('error.tpl');
die;
}
}
}
}
} else {
$items = array();
$items[] = $trklib->get_tracker_item($_REQUEST['itemId']);
$items[0]['field_values'] = $trklib->get_item_fields($_REQUEST['trackerId'], $_REQUEST['itemId'], $listfields);
$smarty->assign_by_ref('items',$items);
$data = $smarty->fetch('tiki-export_tracker_item.tpl');
$data = preg_replace("/^\n/", "", $data);
if (empty($_REQUEST['encoding']) || $_REQUEST['encoding'] == 'ISO-8859-1') {
$data = utf8_decode($data);
}
$offset += $maxRecords;
$heading = 'n';
if (!empty($fp)) {
fwrite($fp, $data);
} else {
echo $data;
}
if ($tracker_info['useAttachments'] == 'y' && !empty($_REQUEST['zip'])) {
foreach ($items['data'] as $v) {
if (!$trklib->export_attachment($v['itemId'], $archive)) {
$smarty->assign('msg', tra('Problem zip'));
$smarty->display('error.tpl');
die;
}
}
}
}
if (!empty($fp)) {
fclose($fp);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment