X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=cf_custom_field_delete.php;h=caf858a292ec595c6b0a25b41e4f1cb59d3d80ac;hb=3f7ed883e1c7d75aacc49900b403f8e84a68dc3f;hp=7ae62ac40fd9cc9817d4a340e604dfba8aef53bc;hpb=5ef582473f6b329be18ad83c61e053fdcd9c6ed5;p=timetracker.git diff --git a/cf_custom_field_delete.php b/cf_custom_field_delete.php index 7ae62ac4..caf858a2 100644 --- a/cf_custom_field_delete.php +++ b/cf_custom_field_delete.php @@ -31,7 +31,7 @@ require_once('plugins/CustomFields.class.php'); import('form.Form'); // Access check. -if (!ttAccessCheck(right_manage_team)) { +if (!ttAccessAllowed('manage_custom_fields') || !$user->isPluginEnabled('cf')) { header('Location: access_denied.php'); exit(); } @@ -40,34 +40,33 @@ $id = $request->getParameter('id'); $form = new Form('fieldDeleteForm'); -if ($request->getMethod() == 'POST') { - if ($request->getParameter('btn_delete')) { - // Delete button pressed. - $res = CustomFields::deleteField($id); +if ($request->isPost()) { + if ($request->getParameter('btn_delete')) { + // Delete button pressed. + $res = CustomFields::deleteField($id); if ($res) { header('Location: cf_custom_fields.php'); exit(); - } else { - $errors->add($i18n->getKey('error.db')); - } + } else + $err->add($i18n->getKey('error.db')); } if ($request->getParameter('btn_cancel')) { - // Cancel button pressed. - header('Location: cf_custom_fields.php'); - exit(); + // Cancel button pressed. + header('Location: cf_custom_fields.php'); + exit(); } } else { $field = CustomFields::getField($id); if (false === $field) - $errors->add($i18n->getKey('error.db')); + $err->add($i18n->getKey('error.db')); - if ($errors->isEmpty()) { + if ($err->no()) { $form->addInput(array('type'=>'hidden','name'=>'id','value'=>$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'))); } } - + $smarty->assign('field', $field['label']); $smarty->assign('forms', array($form->getName()=>$form->toArray())); $smarty->assign('onload', 'onLoad="document.fieldDeleteForm.btn_cancel.focus()"');