Refactoring custom fields in progress.
[timetracker.git] / mobile / time.php
index b9ee3bc..9965216 100644 (file)
@@ -223,7 +223,7 @@ if ($custom_fields && $custom_fields->fields[0]) {
     $form->addInput(array('type'=>'combobox','name'=>'cf_1',
       'style'=>'width: 250px;',
       'value'=>$cl_cf_1,
-      'data'=>$custom_fields->options,
+      'data'=>CustomFields::getOptions($custom_fields->fields[0]['id']),
       'empty'=>array(''=>$i18n->get('dropdown.select'))));
   }
 }
@@ -249,7 +249,7 @@ if ($request->isPost()) {
   if ($request->getParameter('btn_submit')) {
 
     // Validate user input.
-    if ($user->isPluginEnabled('cl') && $user->isPluginEnabled('cm') && !$cl_client)
+    if ($user->isPluginEnabled('cl') && $user->isOptionEnabled('client_required') && !$cl_client)
       $err->add($i18n->get('error.client'));
     if ($custom_fields) {
       if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $err->add($i18n->get('error.field'), $custom_fields->fields[0]['label']);
@@ -283,8 +283,7 @@ if ($request->isPost()) {
         $err->add($i18n->get('error.field'), $i18n->get('label.duration'));
     }
     if (!ttValidString($cl_note, true)) $err->add($i18n->get('error.field'), $i18n->get('label.note'));
-    if ($user->isPluginEnabled('tp') && strpos($cl_note, '%req%') !== false) {
-      // A %req% element is found in note. They have to be replaced by user.
+    if ($user->isPluginEnabled('tp') && !ttValidTemplateText($cl_note)) {
       $err->add($i18n->get('error.field'), $i18n->get('label.note'));
     }
     if (!ttTimeHelper::canAdd()) $err->add($i18n->get('error.expired'));
@@ -348,7 +347,7 @@ if ($request->isPost()) {
 
 $smarty->assign('next_date', $next_date);
 $smarty->assign('prev_date', $prev_date);
-$smarty->assign('time_records', ttTimeHelper::getRecords($user_id, $cl_date));
+$smarty->assign('time_records', ttTimeHelper::getRecords($cl_date));
 $smarty->assign('day_total', ttTimeHelper::getTimeForDay($cl_date));
 $smarty->assign('client_list', $client_list);
 $smarty->assign('project_list', $project_list);