As suggested in PR#33, allowed entry of decimal values with a comma for teams with...
[timetracker.git] / cf_dropdown_option_delete.php
index a1f4b13..ec06b49 100644 (file)
@@ -31,7 +31,7 @@ require_once('plugins/CustomFields.class.php');
 import('form.Form');
 
 // Access check.
-if (!ttAccessCheck(right_manage_team)) {
+if (!ttAccessCheck(right_manage_team) || !$user->isPluginEnabled('cf')) {
   header('Location: access_denied.php');
   exit();
 }
@@ -39,7 +39,7 @@ if (!ttAccessCheck(right_manage_team)) {
 $cl_id = $request->getParameter('id');
 $form = new Form('optionDeleteForm');
 
-if ($request->getMethod() == 'POST') {
+if ($request->isPost()) {
 
   // Determine field id for redirect.
   $field_id = CustomFields::getFieldIdForOption($cl_id);
@@ -50,7 +50,7 @@ if ($request->getMethod() == 'POST') {
       header("Location: cf_dropdown_options.php?field_id=$field_id");
       exit();
     } else
-      $errors->add($i18n->getKey('error.db'));
+      $err->add($i18n->getKey('error.db'));
   }
   if ($request->getParameter('btn_cancel')) {
     // Cancel button pressed.
@@ -60,9 +60,9 @@ if ($request->getMethod() == 'POST') {
 } else {
   $option = CustomFields::getOptionName($cl_id);
   if (false === $option)
-    $errors->add($i18n->getKey('error.db'));
+    $err->add($i18n->getKey('error.db'));
 
-  if ($errors->no()) {
+  if ($err->no()) {
     $form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_id));
     $form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->getKey('label.delete')));
     $form->addInput(array('type'=>'submit','name'=>'btn_cancel','value'=>$i18n->getKey('button.cancel')));