X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=mobile%2Fexpense_edit.php;h=fff249e7709a25fe705c88409efd9774986b03c0;hb=3f7ed883e1c7d75aacc49900b403f8e84a68dc3f;hp=c2df1abb65e1bfd4a2d91c7907dcbe12ab5d75da;hpb=e4fd9dd2dc0e3920d001b52e325b47fe0c9c65a3;p=timetracker.git diff --git a/mobile/expense_edit.php b/mobile/expense_edit.php index c2df1abb..fff249e7 100644 --- a/mobile/expense_edit.php +++ b/mobile/expense_edit.php @@ -33,7 +33,7 @@ import('DateAndTime'); import('ttExpenseHelper'); // Access check. -if (!ttAccessCheck(right_data_entry) || !$user->isPluginEnabled('ex')) { +if (!ttAccessAllowed('track_own_expenses') || !$user->isPluginEnabled('ex')) { header('Location: access_denied.php'); exit(); } @@ -119,6 +119,19 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t 'empty'=>array(''=>$i18n->getKey('dropdown.select')))); } } +// If predefined expenses are configured, add controls to select an expense and quantity. +$predefined_expenses = ttTeamHelper::getPredefinedExpenses($user->team_id); +if ($predefined_expenses) { + $form->addInput(array('type'=>'combobox', + 'onchange'=>'recalculateCost();', + 'name'=>'predefined_expense', + 'style'=>'width: 250px;', + 'value'=>$cl_predefined_expense, + 'data'=>$predefined_expenses, + 'datakeys'=>array('id', 'name'), + 'empty'=>array(''=>$i18n->getKey('dropdown.select')))); + $form->addInput(array('type'=>'text','onchange'=>'recalculateCost();','maxlength'=>'40','name'=>'quantity','style'=>'width: 100px;','value'=>$cl_quantity)); +} $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'item_name','style'=>'width: 250px;','value'=>$cl_item_name)); $form->addInput(array('type'=>'text','maxlength'=>'40','name'=>'cost','style'=>'width: 100px;','value'=>$cl_cost)); $form->addInput(array('type'=>'datefield','name'=>'date','maxlength'=>'20','value'=>$cl_date)); @@ -144,7 +157,7 @@ if ($request->isPost()) { $new_date = new DateAndTime($user->date_format, $cl_date); // Prohibit creating entries in future. - if (defined('FUTURE_ENTRIES') && !isTrue(FUTURE_ENTRIES)) { + if (!$user->future_entries) { $browser_today = new DateAndTime(DB_DATEFORMAT, $request->getParameter('browser_today', null)); if ($new_date->after($browser_today)) $err->add($i18n->getKey('error.future_date')); @@ -198,6 +211,7 @@ if ($request->isPost()) { } } // isPost +$smarty->assign('predefined_expenses', $predefined_expenses); $smarty->assign('client_list', $client_list); $smarty->assign('project_list', $project_list); $smarty->assign('task_list', $task_list);