Commit 3b0fb236 authored by RobertPlummer's avatar RobertPlummer

[FIX] Profile check on user with right permissions, migrated from the nast...

[FIX] Profile check on user with right permissions, migrated from the nast hack into trackers from request to a mildy nast hack of using the $.trackerForm, which isn't so bad, but will be on large sets of items.  It works well though.
[REM] Deleted replaceItemFromRequestValues and replaceItemFromRequestValue from tracker lib, they were just hacks and did not work
[FIX] Commented out the reference to the above in tiki-edit_invoice, will find a better way once tracker query lib matures, it wasen't really working anyway
parent b604120a
{if $timeSheetProfileLoaded neq true}
{if $timeSheetProfileLoaded neq true AND $tiki_p_admin eq 'y'}
{tr}Apply the following profile for enhancements: {/tr}
{button href="tiki-admin.php" profile="time_sheet" page="profiles" list="List" _text="Time_Sheet"}
{/if}
......
......@@ -23,6 +23,7 @@ if ($trklib->get_tracker_by_name("Invoice Items") < 1) {
//handle saving data (edit or update)
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
//start invoice
/*
$_REQUEST['InvoiceId'] = $trklib->replaceItemFromRequestValues(
$trklib->get_tracker_by_name("Invoices"),
array(
......@@ -38,7 +39,8 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
"Days Payment Due",
),
$_REQUEST, $_REQUEST['InvoiceId']
);
);*/
die;
//end invoice
//start invoice items
......@@ -190,6 +192,8 @@ $headerlib->add_jq_onready(
var InvoiceId = $('#InvoiceId');
InvoiceId.val(InvoiceId.val() ? InvoiceId.val() : 0);
return false;
});"
);
......
......@@ -9,7 +9,7 @@ require_once('tiki-setup.php');
$access->check_feature(array('feature_time_sheet','feature_trackers'));
$access->check_permission_either(array('tiki_p_view_trackers', 'tiki_p_create_tracker_items'));
global $user;
global $user, $prefs, $tiki_p_admin;
$auto_query_args = array(
'all',
'profile',
......@@ -17,6 +17,10 @@ $auto_query_args = array(
'list'
);
$trackerId = (int)TikiLib::lib('trk')->get_tracker_by_name('Time sheet');
$smarty->assign("tiki_p_admin", $tiki_p_admin);
$smarty->assign("timeSheetProfileLoaded", $trackerId > 0 ? true : false);
$projectList = Tracker_Query::tracker("Project list")->byName()->query();
if (isset($_REQUEST['all'])) { //all views all sheet items
......@@ -36,35 +40,25 @@ if (isset($_REQUEST['all'])) { //all views all sheet items
if (isset($projectList)) {
if (isset($_REQUEST['save'])) {
$_REQUEST['Done_by'] = $user;
TikiLib::lib("trk")->replaceItemFromRequestValuesByName(
"Time sheet",
array(
"Summary",
"Associated project",
"Description",
"Amount of time spent",
"Done by"
),
$_REQUEST
);
echo json_encode(
$timeSheetNewInputs = Tracker_Query::tracker("Time sheet")
->byName()
->queryInput()
);
die;
}
$timeSheetProfileLoaded = true;
$smarty->assign("timeSheetProfileLoaded", $timeSheetProfileLoaded);
$smarty->assign("projectList", $projectList);
$smarty->assign("timeSheet", $timeSheet);
}
TikiLib::lib("sheet")->setup_jquery_sheet();
$headerlib = TikiLib::lib("header");
$headerlib->add_cssfile("lib/jquery/jtrack/css/jtrack.css");
$headerlib->add_jsfile("lib/jquery/jtrack/js/domcached-0.1-jquery.js");
$headerlib->add_jsfile("lib/jquery/jtrack/js/jtrack.js");
$headerlib->add_jq_onready(
"
$headerlib = TikiLib::lib("header")
->add_cssfile("lib/jquery/jtrack/css/jtrack.css")
->add_jsfile("lib/jquery/jtrack/js/domcached-0.1-jquery.js")
->add_jsfile("lib/jquery/jtrack/js/jtrack.js")
->add_jq_onready("
jTask.init();
$.timesheetSpreadsheet = function() {
......@@ -123,29 +117,49 @@ $headerlib->add_jq_onready(
$('#timeSheetCommit').click(function() {
$('#timeSheetTabs').modal(tr('Committing...'));
var stack = [];
for (var namespace in $.DOMCached.getStorage()) {
stack.push(namespace);
$.post('tiki-timesheet.php?save', {
'Summary': namespace,
'Description': '',
'Amount of time spent': $.DOMCached.get('timer', namespace) / 60
}, function(o) {
$.DOMCached.deleteNamespace(namespace);
stack.pop();
if (stack.length == 0) {
$('#timeSheetTabs').modal();
document.location = document.location + '';
}
});
}
$.getJSON('tiki-timesheet.php?save', function(inputs) {
for (var namespace in $.DOMCached.getStorage()) {
var summary = namespace + '',
time = $.DOMCached.get('timer', summary) / 60;
stack.push(summary);
var form = $.trackerForm($trackerId).submit(function() {
$.post(form.attr('action') + '?' + form.serialize(), function() {
$.DOMCached.deleteNamespace(namespace);
stack.pop();
if (stack.length == 0) {
document.location = document.location + '';
}
});
return false;
});
var input = {
'Summary': $(inputs['Summary']),
'Description': $(inputs['Description']),
'Amount of time spent': $(inputs['Amount of time spent'])
};
input['Summary'].val(summary);
input['Amount of time spent'].val(time);
console.log(input);
form.append(input['Summary']);
form.append(input['Description']);
form.append(input['Amount of time spent']);
form.submit();
}
});
return false;
});
$('#timeSheetTabs')
.width($('#timeSheetTabs').parent().width())
.tabs();
"
);
");
$smarty->assign('mid', 'tiki-timesheet.tpl');
// use tiki_full to include include CSS and JavaScript
$smarty->display("tiki.tpl");
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