--- /dev/null
+<?php
+// +----------------------------------------------------------------------+
+// | Anuko Time Tracker
+// +----------------------------------------------------------------------+
+// | Copyright (c) Anuko International Ltd. (https://www.anuko.com)
+// +----------------------------------------------------------------------+
+// | LIBERAL FREEWARE LICENSE: This source code document may be used
+// | by anyone for any purpose, and freely redistributed alone or in
+// | combination with other software, provided that the license is obeyed.
+// |
+// | There are only two ways to violate the license:
+// |
+// | 1. To redistribute this code in source form, with the copyright
+// | notice or license removed or altered. (Distributing in compiled
+// | forms without embedded copyright notices is permitted).
+// |
+// | 2. To redistribute modified versions of this code in *any* form
+// | that bears insufficient indications that the modifications are
+// | not the work of the original author(s).
+// |
+// | This license applies to this document only, not any other software
+// | that it may be combined with.
+// |
+// +----------------------------------------------------------------------+
+// | Contributors:
+// | https://www.anuko.com/time_tracker/credits.htm
+// +----------------------------------------------------------------------+
+
+
+// Class ttWorkHelper is used to help with operations with the Remote work plugin.
+class ttWorkHelper {
+
+ // getCurrencies - obtains a list of supported currencies.
+ static function getCurrencies() {
+ $mdb2 = getConnection();
+
+ $sql = "select id, name from tt_work_currencies order by id";
+ $res = $mdb2->query($sql);
+ if (is_a($res, 'PEAR_Error')) return false;
+
+ while ($val = $res->fetchRow()) {
+ $result[] = $val;
+ }
+ return $result;
+ }
+}
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.19.2.4973 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.19.2.4974 | Copyright © <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>
<td>{$forms.workForm.newfile.control}</td>
</tr>
{/if}
+ <tr>
+ <td align="right">{$i18n.label.currency}:</td>
+ <td>{$forms.workForm.currency.control}</td>
+ </tr>
<tr>
<td></td>
<td>{$i18n.label.required_fields}</td>
INSERT INTO `tt_work_currencies` (`id`, `name`) VALUES ('1', 'USD'), ('2', 'CAD'), ('3', 'AUD'), ('4', 'EUR'), ('5', 'NZD');
+#
+# Structure for table tt_work_categories. WORK IN PROGRESS!
+# This table keeps work categories supported by remote work plugin.
+#
+# CREATE TABLE `tt_work_categories` (
+# `id` int(10) unsigned NOT NULL, # category id
+# `parent_id` int(10) unsigned default NULL, # parent category id
+# `level` tinyint(4) default 0, # sub-category level
+#
+# Localized name fields below for all supported languages?
+# `name_en` varhar(64) NOT NULL, # English.
+# `name_de` varhar(64) default NULL, # German.
+# `name_fr` varhar(64) default NULL, # French.
+# `name_ru` varhar(64) default NULL, # Russian.
+#
+# PRIMARY KEY (`id`)
+# );
+
+
#
# Structure for table tt_site_config. This table stores configuration data
# for Time Tracker site as a whole.
import('ttProjectHelper');
import('ttGroupHelper');
import('ttFileHelper');
+import('ttWorkHelper');
// Access checks.
if (!ttAccessAllowed('manage_work')) {
if ($request->isPost()) {
$cl_name = trim($request->getParameter('work_name'));
$cl_description = trim($request->getParameter('description'));
+ $cl_currency = $request->getParameter('currency');
}
$form = new Form('workForm');
-
-
-
-
$form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'work_name','style'=>'width: 250px;','value'=>$cl_name));
$form->addInput(array('type'=>'textarea','name'=>'description','style'=>'width: 250px; height: 40px;','value'=>$cl_description));
if ($showFiles)
$form->addInput(array('type'=>'upload','name'=>'newfile','value'=>$i18n->get('button.submit')));
+// Add a dropdown for currency.
+$currencies = ttWorkHelper::getCurrencies();
+$form->addInput(array('type'=>'combobox','name'=>'currency','data'=>$currencies,'datakeys'=>array('id','name'),'value'=>$cl_currency));
-// Should not we get it from server?
-// $CURRENCY_OPTIONS = array(array('id'=>'.','name'=>'.'),array('id'=>',','name'=>','));
-// $form->addInput(array('type'=>'combobox','name'=>'decimal_mark','style'=>'width: 150px','data'=>$DECIMAL_MARK_OPTIONS,'datakeys'=>array('id','name'),'value'=>$cl_decimal_mark,
-// 'onchange'=>'adjustDecimalPreview()'));
+// TODO: design how to handle one-time vs ongoing work. Apparently, with a conditional display of relevant controls.
+// Ongoing work - rate per hour control.
+// One-time work - budget dropdown control.
+// When selection changes, we hide and show required controls.
+// TODO: design how to handle categories and sub-categories.
+// One major complication is localization of names.
+// Coding and design are currently ongoing.
if ($request->isPost()) {