X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=expenses.php;h=4cfc0ea55ad1746ea523a0dbcf4b0b9198e898b3;hb=b35ed34767de056ad0adef9d85060b587c1f6ce2;hp=307c9c010922cc0617b50995997da831ea05a3ce;hpb=70272dc970919c348288bd09ff835f05e7538949;p=timetracker.git diff --git a/expenses.php b/expenses.php index 307c9c01..4cfc0ea5 100644 --- a/expenses.php +++ b/expenses.php @@ -34,7 +34,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(); } @@ -75,7 +75,7 @@ if ($user->canManageTeam()) { } // Dropdown for clients in MODE_TIME. Use all active clients. -if (MODE_TIME == $user->tracking_mode && in_array('cl', explode(',', $user->plugins))) { +if (MODE_TIME == $user->tracking_mode && $user->isPluginEnabled('cl')) { $active_clients = ttTeamHelper::getActiveClients($user->team_id, true); $form->addInput(array('type'=>'combobox', 'onchange'=>'fillProjectDropdown(this.value);', @@ -101,7 +101,7 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t 'empty'=>array(''=>$i18n->getKey('dropdown.select')))); // Dropdown for clients if the clients plugin is enabled. - if (in_array('cl', explode(',', $user->plugins))) { + if ($user->isPluginEnabled('cl')) { $active_clients = ttTeamHelper::getActiveClients($user->team_id, true); // We need an array of assigned project ids to do some trimming. foreach($project_list as $project) @@ -127,25 +127,17 @@ 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)); +$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'=>'calendar','name'=>'date','highlight'=>'expenses','value'=>$cl_date)); // calendar $form->addInput(array('type'=>'hidden','name'=>'browser_today','value'=>'')); // User current date, which gets filled in on btn_submit click. $form->addInput(array('type'=>'submit','name'=>'btn_submit','onclick'=>'browser_today.value=get_date()','value'=>$i18n->getKey('button.submit'))); -// Determine lock date. Time entries earlier than lock date cannot be created or modified. -$lock_interval = $user->lock_interval; -$lockdate = 0; -if ($lock_interval > 0) { - $lockdate = new DateAndTime(); - $lockdate->decDay($lock_interval); -} - // Submit. if ($request->isPost()) { if ($request->getParameter('btn_submit')) { // Validate user input. - if (in_array('cl', explode(',', $user->plugins)) && in_array('cm', explode(',', $user->plugins)) && !$cl_client) + if ($user->isPluginEnabled('cl') && $user->isPluginEnabled('cm') && !$cl_client) $err->add($i18n->getKey('error.client')); if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode) { if (!$cl_project) $err->add($i18n->getKey('error.project')); @@ -161,9 +153,9 @@ if ($request->isPost()) { } // Finished validating input data. - // Prohibit creating time entries in locked interval. - if($lockdate && $selected_date->before($lockdate)) - $err->add($i18n->getKey('error.period_locked')); + // Prohibit creating entries in locked range. + if ($user->isDateLocked($selected_date)) + $err->add($i18n->getKey('error.range_locked')); // Insert record. if ($err->no()) {