Refactoring, moving plugin config options into config field.
[timetracker.git] / WEB-INF / templates / expense_edit.tpl
index 9e447a3..671e868 100644 (file)
@@ -34,8 +34,8 @@ var defined_expenses = new Array();
   idx++;
 {/foreach}
 
-// TODO: improve on conditional confirmSave.
-// Existing entry date for confirm save warnings.
+{* Conditional include of confirmSave handler. *}
+{if $confirm_save}
 var original_date = "{$entry_date}";
 
 function confirmSave() {
@@ -44,7 +44,7 @@ function confirmSave() {
     return confirm("{$i18n.warn.confirm_save}");
   }
 }
-// TODO: improve on conditional confirmSave above.
+{/if}
 
 // The fillProjectDropdown function populates the project combo box with
 // projects associated with a selected client (client id is passed here as id).
@@ -98,7 +98,7 @@ function recalculateCost() {
 
   var comment_control = document.getElementById("item_name");
   var cost_control = document.getElementById("cost");
-  var replaceDecimalMark = ("." != "{$user->decimal_mark}");
+  var replaceDecimalMark = ("." != "{$user->getDecimalMark()}");
 
   // Calculate cost.
   var dropdown = document.getElementById("predefined_expense");
@@ -114,10 +114,10 @@ function recalculateCost() {
     else {
       var expenseCost = defined_expenses[dropdown.selectedIndex - 1][2];
       if (replaceDecimalMark)
-        expenseCost = expenseCost.replace("{$user->decimal_mark}", ".");
+        expenseCost = expenseCost.replace("{$user->getDecimalMark()}", ".");
       var newCost = (quantity_control.value * expenseCost).toFixed(2);
       if (replaceDecimalMark)
-        newCost = newCost.replace(".", "{$user->decimal_mark}");
+        newCost = newCost.replace(".", "{$user->getDecimalMark()}");
       cost_control.value = newCost;
     }
   }
@@ -134,11 +134,11 @@ function recalculateCost() {
     <table border="0">
 {if $user->isPluginEnabled('cl')}
     <tr>
-      <td align="right">{$i18n.label.client} {if $user->isPluginEnabled('cm')}(*){/if}:</td>
+      <td align="right">{$i18n.label.client} {if $user->isOptionEnabled('client_required')}(*){/if}:</td>
       <td>{$forms.expenseItemForm.client.control}</td>
     </tr>
 {/if}
-{if ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}
+{if $show_project}
     <tr>
       <td align="right">{$i18n.label.project} (*):</td>
       <td>{$forms.expenseItemForm.project.control}</td>
@@ -160,7 +160,7 @@ function recalculateCost() {
     </tr>
     <tr>
       <td align="right">{$i18n.label.cost}:</td>
-      <td>{$forms.expenseItemForm.cost.control} {$user->currency|escape}</td>
+      <td>{$forms.expenseItemForm.cost.control} {$user->getCurrency()|escape}</td>
     </tr>
 {if ($user->can('manage_invoices') && $user->isPluginEnabled('ps'))}
     <tr>