X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=expense_edit.php;h=7a256d653313c568fb3911865f977a454925c3f4;hb=f7f5a1b8e3f8d12902fa462d7426fb4e0b81ea0d;hp=213cfcba739e8b280ae8a414d7cbaff4e38bbc91;hpb=19f245ff861895c99c3f04fbc53404564bb44267;p=timetracker.git diff --git a/expense_edit.php b/expense_edit.php index 213cfcba..7a256d65 100644 --- a/expense_edit.php +++ b/expense_edit.php @@ -33,7 +33,7 @@ import('DateAndTime'); import('ttExpenseHelper'); // Access check. -if (!ttAccessCheck(right_data_entry)) { +if (!ttAccessCheck(right_data_entry) || !$user->isPluginEnabled('ex')) { header('Location: access_denied.php'); exit(); } @@ -119,7 +119,20 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t 'empty'=>array(''=>$i18n->getKey('dropdown.select')))); } } -$form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'item_name','style'=>'width: 250px;','value'=>$cl_item_name)); +// 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'=>'textarea','maxlength'=>'800','name'=>'item_name','style'=>'width: 250px; height:'.NOTE_INPUT_HEIGHT.'px;','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)); // Hidden control for record id. @@ -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);