Refactored predefined expenses config for subgroups.
authorNik Okuntseff <support@anuko.com>
Sat, 8 Dec 2018 22:50:43 +0000 (22:50 +0000)
committerNik Okuntseff <support@anuko.com>
Sat, 8 Dec 2018 22:50:43 +0000 (22:50 +0000)
WEB-INF/templates/footer.tpl
WEB-INF/templates/predefined_expense_add.tpl
WEB-INF/templates/predefined_expense_edit.tpl
predefined_expense_delete.php
predefined_expense_edit.php
predefined_expenses.php

index 507e6e5..ed2a2f0 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.18.29.4616 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.18.29.4617 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
index 1bb788d..fd2983a 100644 (file)
@@ -9,7 +9,7 @@
         </tr>
         <tr>
           <td align="right">{$i18n.label.cost} (*):</td>
-          <td>{$forms.predefinedExpenseForm.cost.control} {$user->currency|escape}</td>
+          <td>{$forms.predefinedExpenseForm.cost.control} {$user->getCurrency()|escape}</td>
         </tr>
         <tr>
           <td height="40"></td>
index c9947ae..f53b512 100644 (file)
@@ -9,7 +9,7 @@
         </tr>
         <tr>
           <td align="right">{$i18n.label.cost} (*):</td>
-          <td>{$forms.predefinedExpenseForm.cost.control} {$user->currency|escape}</td>
+          <td>{$forms.predefinedExpenseForm.cost.control} {$user->getCurrency()|escape}</td>
         </tr>
         <tr>
           <td height="40"></td>
index 9b44503..d8fc057 100644 (file)
@@ -39,9 +39,15 @@ if (!$user->isPluginEnabled('ex')) {
   header('Location: feature_disabled.php');
   exit();
 }
-
 $cl_predefined_expense_id = (int)$request->getParameter('id');
 $predefined_expense = ttPredefinedExpenseHelper::get($cl_predefined_expense_id);
+if (!$predefined_expense) {
+  header('Location: access_denied.php');
+  exit();
+}
+// End of access checks.
+
+
 $predefined_expense_to_delete = $predefined_expense['name'];
 
 $form = new Form('predefinedExpenseDeleteForm');
@@ -51,12 +57,9 @@ $form->addInput(array('type'=>'submit','name'=>'btn_cancel','value'=>$i18n->get(
 
 if ($request->isPost()) {
   if ($request->getParameter('btn_delete')) {
-    if(ttPredefinedExpenseHelper::get($cl_predefined_expense_id)) {
-      if (ttPredefinedExpenseHelper::delete($cl_predefined_expense_id)) {
-        header('Location: predefined_expenses.php');
-        exit();
-      } else
-        $err->add($i18n->get('error.db'));
+    if (ttPredefinedExpenseHelper::delete($cl_predefined_expense_id)) {
+      header('Location: predefined_expenses.php');
+      exit();
     } else
       $err->add($i18n->get('error.db'));
   } elseif ($request->getParameter('btn_cancel')) {
index ab2299c..3f0cb0c 100644 (file)
@@ -39,14 +39,18 @@ if (!$user->isPluginEnabled('ex')) {
   header('Location: feature_disabled.php');
   exit();
 }
-
 $predefined_expense_id = (int) $request->getParameter('id');
+$predefined_expense = ttPredefinedExpenseHelper::get($predefined_expense_id);
+if (!$predefined_expense) {
+  header('Location: access_denied.php');
+  exit();
+}
+// End of access checks.
 
 if ($request->isPost()) {
   $cl_name = trim($request->getParameter('name'));
   $cl_cost = trim($request->getParameter('cost'));
 } else {
-  $predefined_expense = ttPredefinedExpenseHelper::get($predefined_expense_id);
   $cl_name = $predefined_expense['name'];
   $cl_cost = $predefined_expense['cost'];
 }
index 99c2c89..e1c14d8 100644 (file)
@@ -39,6 +39,7 @@ if (!$user->isPluginEnabled('ex')) {
   header('Location: feature_disabled.php');
   exit();
 }
+// End of access checks.
 
 $form = new Form('predefinedExpensesForm');