Cleaning up white space
authorNik Okuntseff <support@anuko.com>
Mon, 21 Mar 2016 03:03:10 +0000 (20:03 -0700)
committerNik Okuntseff <support@anuko.com>
Mon, 21 Mar 2016 03:03:10 +0000 (20:03 -0700)
task_add.php
task_delete.php
task_edit.php
time.php
time_delete.php
time_edit.php

index d50998c..f9d5981 100644 (file)
@@ -54,14 +54,14 @@ $form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'name','style'=>
 $form->addInput(array('type'=>'textarea','name'=>'description','style'=>'width: 250px; height: 40px;','value'=>$cl_description));
 $form->addInput(array('type'=>'checkboxgroup','name'=>'projects','layout'=>'H','data'=>$projects,'datakeys'=>array('id','name'),'value'=>$cl_projects));
 $form->addInput(array('type'=>'submit','name'=>'btn_submit','value'=>$i18n->getKey('button.add')));
-       
+
 if ($request->getMethod() == 'POST') {
   // Validate user input.
   if (!ttValidString($cl_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.thing_name'));
   if (!ttValidString($cl_description, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.description'));
 
   if ($errors->isEmpty()) {
-       if (!ttTaskHelper::getTaskByName($cl_name)) {
+    if (!ttTaskHelper::getTaskByName($cl_name)) {
       if (ttTaskHelper::insert(array(
         'team_id' => $user->team_id,
         'name' => $cl_name,
@@ -74,8 +74,8 @@ if ($request->getMethod() == 'POST') {
           $errors->add($i18n->getKey('error.db'));
     } else
       $errors->add($i18n->getKey('error.task_exists'));
-  }                    
-} // post
+  }
+} // POST
 
 $smarty->assign('forms', array($form->getName()=>$form->toArray()));
 $smarty->assign('onload', 'onLoad="document.taskForm.name.focus()"');
index b7b33c2..96044fe 100644 (file)
@@ -59,7 +59,7 @@ if ($request->getMethod() == 'POST') {
     header('Location: tasks.php');
     exit();
   }
-} // post
+} // POST
 
 $smarty->assign('task_to_delete', $task_to_delete);
 $smarty->assign('forms', array($form->getName()=>$form->toArray()));
index 47722f6..549a74f 100644 (file)
@@ -39,7 +39,7 @@ if (!ttAccessCheck(right_manage_team)) {
 
 $cl_task_id = (int)$request->getParameter('id');
 $projects = ttTeamHelper::getActiveProjects($user->team_id);
-       
+
 if ($request->getMethod() == 'POST') {
   $cl_name = trim($request->getParameter('name'));
   $cl_description = trim($request->getParameter('description'));
@@ -50,7 +50,7 @@ if ($request->getMethod() == 'POST') {
   $cl_name = $task['name'];
   $cl_description = $task['description'];
   $cl_status = $task['status'];
-  
+
   $assigned_projects = ttTaskHelper::getAssignedProjects($cl_task_id);
   foreach ($assigned_projects as $project_item)
     $cl_projects[] = $project_item['id'];
@@ -65,14 +65,14 @@ $form->addInput(array('type'=>'combobox','name'=>'status','value'=>$cl_status,
 $form->addInput(array('type'=>'checkboxgroup','name'=>'projects','layout'=>'H','data'=>$projects,'datakeys'=>array('id','name'),'value'=>$cl_projects));
 $form->addInput(array('type'=>'submit','name'=>'btn_save','value'=>$i18n->getKey('button.save')));
 $form->addInput(array('type'=>'submit','name'=>'btn_copy','value'=>$i18n->getKey('button.copy')));
-       
+
 if ($request->getMethod() == 'POST') {
   // Validate user input.
   if (!ttValidString($cl_name)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.thing_name'));
   if (!ttValidString($cl_description, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.description'));
 
   if ($errors->isEmpty()) {
-       if ($request->getParameter('btn_save')) {
+    if ($request->getParameter('btn_save')) {
       $existing_task = ttTaskHelper::getTaskByName($cl_name);
       if (!$existing_task || ($cl_task_id == $existing_task['id'])) {
         // Update task information.
@@ -88,8 +88,8 @@ if ($request->getMethod() == 'POST') {
           $errors->add($i18n->getKey('error.db'));
       } else
         $errors->add($i18n->getKey('error.task_exists'));
-       }
-       
+    }
+
     if ($request->getParameter('btn_copy')) {
       if (!ttTaskHelper::getTaskByName($cl_name)) {
         if (ttTaskHelper::insert(array(
@@ -105,8 +105,8 @@ if ($request->getMethod() == 'POST') {
       } else
         $errors->add($i18n->getKey('error.task_exists'));
     }
-  }                    
-} // post
+  }
+} // POST
 
 $smarty->assign('forms', array($form->getName()=>$form->toArray()));
 $smarty->assign('title', $i18n->getKey('title.edit_task'));
index f290e55..9b20578 100644 (file)
--- a/time.php
+++ b/time.php
@@ -100,24 +100,22 @@ if ($user->canManageTeam()) {
       'style'=>'width: 250px;',
       'value'=>$on_behalf_id,
       'data'=>$user_list,
-      'datakeys'=>array('id','name'),
-    ));
+      'datakeys'=>array('id','name')));
     $smarty->assign('on_behalf_control', 1);
   }
 }
 
 // Dropdown for clients in MODE_TIME. Use all active clients.
 if (MODE_TIME == $user->tracking_mode && in_array('cl', explode(',', $user->plugins))) {
-    $active_clients = ttTeamHelper::getActiveClients($user->team_id, true);
-    $form->addInput(array('type'=>'combobox',
-      'onchange'=>'fillProjectDropdown(this.value);',
-      'name'=>'client',
-      'style'=>'width: 250px;',
-      'value'=>$cl_client,
-      'data'=>$active_clients,
-      'datakeys'=>array('id', 'name'),
-      'empty'=>array(''=>$i18n->getKey('dropdown.select'))
-    ));
+  $active_clients = ttTeamHelper::getActiveClients($user->team_id, true);
+  $form->addInput(array('type'=>'combobox',
+    'onchange'=>'fillProjectDropdown(this.value);',
+    'name'=>'client',
+    'style'=>'width: 250px;',
+    'value'=>$cl_client,
+    'data'=>$active_clients,
+    'datakeys'=>array('id', 'name'),
+    'empty'=>array(''=>$i18n->getKey('dropdown.select'))));
   // Note: in other modes the client list is filtered to relevant clients only. See below.
 }
 
@@ -131,8 +129,7 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t
     'value'=>$cl_project,
     'data'=>$project_list,
     'datakeys'=>array('id','name'),
-    'empty'=>array(''=>$i18n->getKey('dropdown.select'))
-  ));
+    'empty'=>array(''=>$i18n->getKey('dropdown.select'))));
 
   // Dropdown for clients if the clients plugin is enabled.
   if (in_array('cl', explode(',', $user->plugins))) {
@@ -159,8 +156,7 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t
       'value'=>$cl_client,
       'data'=>$client_list,
       'datakeys'=>array('id', 'name'),
-      'empty'=>array(''=>$i18n->getKey('dropdown.select'))
-    ));
+      'empty'=>array(''=>$i18n->getKey('dropdown.select'))));
   }
 }
 
@@ -172,8 +168,7 @@ if (MODE_PROJECTS_AND_TASKS == $user->tracking_mode) {
     'value'=>$cl_task,
     'data'=>$task_list,
     'datakeys'=>array('id','name'),
-    'empty'=>array(''=>$i18n->getKey('dropdown.select'))
-  ));
+    'empty'=>array(''=>$i18n->getKey('dropdown.select'))));
 }
 
 // Add other controls.
@@ -184,7 +179,7 @@ if ((TYPE_START_FINISH == $user->record_type) || (TYPE_ALL == $user->record_type
 if (!$user->canManageTeam() && defined('READONLY_START_FINISH') && isTrue(READONLY_START_FINISH)) {
   // Make the start and finish fields read-only.
   $form->getElement('start')->setEnable(false);
-  $form->getElement('finish')->setEnable(false);       
+  $form->getElement('finish')->setEnable(false);
 }
 if ((TYPE_DURATION == $user->record_type) || (TYPE_ALL == $user->record_type))
   $form->addInput(array('type'=>'text','name'=>'duration','value'=>$cl_duration,'onchange'=>"formDisable('duration');"));
@@ -194,23 +189,22 @@ if (in_array('iv', explode(',', $user->plugins)))
   $form->addInput(array('type'=>'checkbox','name'=>'billable','data'=>1,'value'=>$cl_billable));
 $form->addInput(array('type'=>'hidden','name'=>'browser_today','value'=>'')); // User current date, which gets filled in on btn_submit click.
 $form->addInput(array('type'=>'submit','name'=>'btn_submit','onclick'=>'browser_today.value=get_date()','value'=>$i18n->getKey('button.submit')));
-  
+
 // If we have custom fields - add controls for them.
 if ($custom_fields && $custom_fields->fields[0]) {
   // Only one custom field is supported at this time.
   if ($custom_fields->fields[0]['type'] == CustomFields::TYPE_TEXT) {
-       $form->addInput(array('type'=>'text','name'=>'cf_1','value'=>$cl_cf_1));
+    $form->addInput(array('type'=>'text','name'=>'cf_1','value'=>$cl_cf_1));
   } else if ($custom_fields->fields[0]['type'] == CustomFields::TYPE_DROPDOWN) {
     $form->addInput(array('type'=>'combobox','name'=>'cf_1',
       'style'=>'width: 250px;',
       'value'=>$cl_cf_1,
       'data'=>$custom_fields->options,
-      'empty'=>array(''=>$i18n->getKey('dropdown.select'))
-    ));
+      'empty'=>array(''=>$i18n->getKey('dropdown.select'))));
   }
 }
 
-// Determine lock date. Time entries earlier than lock date cannot be created or modified. 
+// Determine lock date. Time entries earlier than lock date cannot be created or modified.
 $lock_interval = $user->lock_interval;
 $lockdate = 0;
 if ($lock_interval > 0) {
@@ -221,7 +215,7 @@ if ($lock_interval > 0) {
 // Submit.
 if ($request->getMethod() == 'POST') {
   if ($request->getParameter('btn_submit')) {
-       
+
     // Validate user input.
     if (in_array('cl', explode(',', $user->plugins)) && in_array('cm', explode(',', $user->plugins)) && !$cl_client)
       $errors->add($i18n->getKey('error.client'));
@@ -229,11 +223,11 @@ if ($request->getMethod() == 'POST') {
       if (!ttValidString($cl_cf_1, !$custom_fields->fields[0]['required'])) $errors->add($i18n->getKey('error.field'), $custom_fields->fields[0]['label']);
     }
     if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode) {
-      if (!$cl_project) $errors->add($i18n->getKey('error.project'));          
+      if (!$cl_project) $errors->add($i18n->getKey('error.project'));
     }
     if (MODE_PROJECTS_AND_TASKS == $user->tracking_mode) {
       if (!$cl_task) $errors->add($i18n->getKey('error.task'));
-    }      
+    }
     if (!$cl_duration) {
       if ('0' == $cl_duration)
         $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.duration'));
@@ -247,10 +241,10 @@ if ($request->getMethod() == 'POST') {
             $errors->add($i18n->getKey('error.interval'), $i18n->getKey('label.finish'), $i18n->getKey('label.start'));
         }
       } else {
-       if ((TYPE_START_FINISH == $user->record_type) || (TYPE_ALL == $user->record_type)) {
+        if ((TYPE_START_FINISH == $user->record_type) || (TYPE_ALL == $user->record_type)) {
           $errors->add($i18n->getKey('error.empty'), $i18n->getKey('label.start'));
           $errors->add($i18n->getKey('error.empty'), $i18n->getKey('label.finish'));
-       }
+        }
         if ((TYPE_DURATION == $user->record_type) || (TYPE_ALL == $user->record_type))
           $errors->add($i18n->getKey('error.empty'), $i18n->getKey('label.duration'));
       }
@@ -267,22 +261,22 @@ if ($request->getMethod() == 'POST') {
       if ($selected_date->after($browser_today))
         $errors->add($i18n->getKey('error.future_date'));
     }
-    
+
     // Prohibit creating time entries in locked interval.
     if($lockdate && $selected_date->before($lockdate))
       $errors->add($i18n->getKey('error.period_locked'));
-    
+
     // Prohibit creating another uncompleted record.
     if ($errors->isEmpty()) {
       if (($not_completed_rec = ttTimeHelper::getUncompleted($user->getActiveUser())) && (($cl_finish == '') && ($cl_duration == '')))
         $errors->add($i18n->getKey('error.uncompleted_exists')." <a href = 'time_edit.php?id=".$not_completed_rec['id']."'>".$i18n->getKey('error.goto_uncompleted')."</a>");
     }
-    
+
     // Prohibit creating an overlapping record.
     if ($errors->isEmpty()) {
       if (ttTimeHelper::overlaps($user->getActiveUser(), $cl_date, $cl_start, $cl_finish))
         $errors->add($i18n->getKey('error.overlap'));
-    }  
+    }
 
     // Insert record.
     if ($errors->isEmpty()) {
@@ -297,7 +291,7 @@ if ($request->getMethod() == 'POST') {
         'duration' => $cl_duration,
         'note' => $cl_note,
         'billable' => $cl_billable));
-               
+
       // Insert a custom field if we have it.
       $result = true;
       if ($id && $custom_fields && $cl_cf_1) {
@@ -314,49 +308,49 @@ if ($request->getMethod() == 'POST') {
     }
   }
   else if ($request->getParameter('btn_stop')) {
-       // Stop button pressed to finish an uncompleted record.
-       $record_id = $request->getParameter('record_id');
-       $record = ttTimeHelper::getRecord($record_id, $user->getActiveUser());
-       $browser_date = $request->getParameter('browser_date');
-       $browser_time = $request->getParameter('browser_time');
-       
-       // Can we complete this record?
-       if ($record['date'] == $browser_date                                // closing today's record
-         && ttTimeHelper::isValidInterval($record['start'], $browser_time) // finish time is greater than start time
-         && !ttTimeHelper::overlaps($user->getActiveUser(), $browser_date, $record['start'], $browser_time)) { // no overlap
+    // Stop button pressed to finish an uncompleted record.
+    $record_id = $request->getParameter('record_id');
+    $record = ttTimeHelper::getRecord($record_id, $user->getActiveUser());
+    $browser_date = $request->getParameter('browser_date');
+    $browser_time = $request->getParameter('browser_time');
+
+    // Can we complete this record?
+    if ($record['date'] == $browser_date                                // closing today's record
+      && ttTimeHelper::isValidInterval($record['start'], $browser_time) // finish time is greater than start time
+      && !ttTimeHelper::overlaps($user->getActiveUser(), $browser_date, $record['start'], $browser_time)) { // no overlap
       $res = ttTimeHelper::update(array(
-          'id'=>$record['id'],  
-          'date'=>$record['date'],  
+          'id'=>$record['id'],
+          'date'=>$record['date'],
           'user_id'=>$user->getActiveUser(),
-          'client'=>$record['client_id'],  
-          'project'=>$record['project_id'],  
-          'task'=>$record['task_id'],  
-          'start'=>$record['start'],  
+          'client'=>$record['client_id'],
+          'project'=>$record['project_id'],
+          'task'=>$record['task_id'],
+          'start'=>$record['start'],
           'finish'=>$browser_time,
           'note'=>$record['comment'],
           'billable'=>$record['billable']));
       if (!$res)
         $errors->add($i18n->getKey('error.db'));
-       } else {
+    } else {
       // Cannot complete, redirect for manual edit.
       header('Location: time_edit.php?id='.$record_id);
-      exit();          
-       }
+      exit();
+    }
   }
   else if ($request->getParameter('onBehalfUser')) {
     if($user->canManageTeam()) {
       unset($_SESSION['behalf_id']);
       unset($_SESSION['behalf_name']);
-       
+
       if($on_behalf_id != $user->id) {
         $_SESSION['behalf_id'] = $on_behalf_id;
-       $_SESSION['behalf_name'] = ttUserHelper::getUserName($on_behalf_id);                    
+        $_SESSION['behalf_name'] = ttUserHelper::getUserName($on_behalf_id);
       }
       header('Location: time.php');
       exit();
     }
   }
-}
+} // POST
 
 $week_total = ttTimeHelper::getTimeForWeek($user->getActiveUser(), $selected_date);
 
index 84e7bc1..dd694f7 100644 (file)
@@ -49,13 +49,13 @@ $time_rec = ttTimeHelper::getRecord($cl_id, $user->getActiveUser());
 
 // Prohibit deleting invoiced records.
 if ($time_rec['invoice_id']) die($i18n->getKey('error.sys'));
-  
+
 // Escape comment for presentation.
 $time_rec['comment'] = htmlspecialchars($time_rec['comment']);
-        
+
 if ($request->getMethod() == 'POST') {
   if ($request->getParameter('delete_button'))  {  // Delete button pressed.
-  
+
     // Determine if it's okay to delete the record.
     $item_date = new DateAndTime(DB_DATEFORMAT, $time_rec['date']);
     // Determine lock date.
@@ -67,13 +67,13 @@ if ($request->getMethod() == 'POST') {
     }
     // Determine if the record is uncompleted.
     $uncompleted = ($time_rec['duration'] == '0:00');
-       
+
     if($lockdate && $item_date->before($lockdate) && !$uncompleted) {
       $errors->add($i18n->getKey('error.period_locked'));
     }
-           
+
     if ($errors->isEmpty()) {
-       
+
       // Delete the record.
       $result = ttTimeHelper::delete($cl_id, $user->getActiveUser());
 
@@ -86,11 +86,11 @@ if ($request->getMethod() == 'POST') {
     }
   }
   if ($request->getParameter('cancel_button')) { // Cancel button pressed.
-       header('Location: time.php');
-       exit();
+    header('Location: time.php');
+    exit();
   }
-}
-               
+} // POST
+
 $form = new Form('timeRecordForm');
 $form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_id));
 $form->addInput(array('type'=>'submit','name'=>'delete_button','value'=>$i18n->getKey('label.delete')));
index 01d1797..d362709 100644 (file)
@@ -56,7 +56,7 @@ $time_rec = ttTimeHelper::getRecord($cl_id, $user->getActiveUser());
 if ($time_rec['invoice_id']) die($i18n->getKey('error.sys'));
 
 $item_date = new DateAndTime(DB_DATEFORMAT, $time_rec['date']);
-  
+
 // Initialize variables.
 $cl_start = $cl_finish = $cl_duration = $cl_date = $cl_note = $cl_project = $cl_task = $cl_billable = null;
 if ($request->getMethod() == 'POST') {
@@ -79,21 +79,21 @@ if ($request->getMethod() == 'POST') {
   $cl_start = $time_rec['start'];
   $cl_finish = $time_rec['finish'];
   $cl_duration = $time_rec['duration'];
-  $cl_date     = $item_date->toString($user->date_format);
+  $cl_date = $item_date->toString($user->date_format);
   $cl_note = $time_rec['comment'];
-    
+
   // If we have custom fields - obtain values for them.
   if ($custom_fields) {
     // Get custom field value for time record.
-       $fields = $custom_fields->get($time_rec['id']);
-       if ($custom_fields->fields[0]['type'] == CustomFields::TYPE_TEXT)
+    $fields = $custom_fields->get($time_rec['id']);
+    if ($custom_fields->fields[0]['type'] == CustomFields::TYPE_TEXT)
       $cl_cf_1 = $fields[0]['value'];
     else if ($custom_fields->fields[0]['type'] == CustomFields::TYPE_DROPDOWN)
       $cl_cf_1 = $fields[0]['option_id'];
   }
-  
+
   $cl_billable = $time_rec['billable'];
-  
+
   // Add an info message to the form if we are editing an uncompleted record.
   if (($cl_start == $cl_finish) && ($cl_duration == '0:00')) {
     $cl_finish = '';
@@ -101,22 +101,21 @@ if ($request->getMethod() == 'POST') {
     $messages->add($i18n->getKey('form.time_edit.uncompleted'));
   }
 }
-  
+
 // Initialize elements of 'timeRecordForm'.
 $form = new Form('timeRecordForm');
 
 // Dropdown for clients in MODE_TIME. Use all active clients.
 if (MODE_TIME == $user->tracking_mode && in_array('cl', explode(',', $user->plugins))) {
-    $active_clients = ttTeamHelper::getActiveClients($user->team_id, true);
-    $form->addInput(array('type'=>'combobox',
-      'onchange'=>'fillProjectDropdown(this.value);',
-      'name'=>'client',
-      'style'=>'width: 250px;',
-      'value'=>$cl_client,
-      'data'=>$active_clients,
-      'datakeys'=>array('id', 'name'),
-      'empty'=>array(''=>$i18n->getKey('dropdown.select'))
-    ));
+  $active_clients = ttTeamHelper::getActiveClients($user->team_id, true);
+  $form->addInput(array('type'=>'combobox',
+    'onchange'=>'fillProjectDropdown(this.value);',
+    'name'=>'client',
+    'style'=>'width: 250px;',
+    'value'=>$cl_client,
+    'data'=>$active_clients,
+    'datakeys'=>array('id', 'name'),
+    'empty'=>array(''=>$i18n->getKey('dropdown.select'))));
   // Note: in other modes the client list is filtered to relevant clients only. See below.
 }
 
@@ -130,13 +129,12 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t
     'value'=>$cl_project,
     'data'=>$project_list,
     'datakeys'=>array('id','name'),
-    'empty'=>array(''=>$i18n->getKey('dropdown.select'))
-  ));
+    'empty'=>array(''=>$i18n->getKey('dropdown.select'))));
 
   // Dropdown for clients if the clients plugin is enabled.
   if (in_array('cl', explode(',', $user->plugins))) {
     $active_clients = ttTeamHelper::getActiveClients($user->team_id, true);
-    // We need an array of assigned project ids to do some trimming. 
+    // We need an array of assigned project ids to do some trimming.
     foreach($project_list as $project)
       $projects_assigned_to_user[] = $project['id'];
 
@@ -158,8 +156,7 @@ if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->t
       'value'=>$cl_client,
       'data'=>$client_list,
       'datakeys'=>array('id', 'name'),
-      'empty'=>array(''=>$i18n->getKey('dropdown.select'))
-    ));
+      'empty'=>array(''=>$i18n->getKey('dropdown.select'))));
   }
 }
 
@@ -171,10 +168,9 @@ if (MODE_PROJECTS_AND_TASKS == $user->tracking_mode) {
     'value'=>$cl_task,
     'data'=>$task_list,
     'datakeys'=>array('id','name'),
-    'empty'=>array(''=>$i18n->getKey('dropdown.select'))
-  ));
+    'empty'=>array(''=>$i18n->getKey('dropdown.select'))));
 }
-  
+
 // Add other controls.
 if ((TYPE_START_FINISH == $user->record_type) || (TYPE_ALL == $user->record_type)) {
   $form->addInput(array('type'=>'text','name'=>'start','value'=>$cl_start,'onchange'=>"formDisable('start');"));
@@ -183,7 +179,7 @@ if ((TYPE_START_FINISH == $user->record_type) || (TYPE_ALL == $user->record_type
 if (!$user->canManageTeam() && defined('READONLY_START_FINISH') && isTrue(READONLY_START_FINISH)) {
   // Make the start and finish fields read-only.
   $form->getElement('start')->setEnable(false);
-  $form->getElement('finish')->setEnable(false);       
+  $form->getElement('finish')->setEnable(false);
 }
 if ((TYPE_DURATION == $user->record_type) || (TYPE_ALL == $user->record_type))
   $form->addInput(array('type'=>'text','name'=>'duration','value'=>$cl_duration,'onchange'=>"formDisable('duration');"));
@@ -193,15 +189,14 @@ $form->addInput(array('type'=>'textarea','name'=>'note','style'=>'width: 250px;
 if ($custom_fields && $custom_fields->fields[0]) {
   // Only one custom field is supported at this time.
   if ($custom_fields->fields[0]['type'] == CustomFields::TYPE_TEXT) {
-       $form->addInput(array('type'=>'text','name'=>'cf_1','value'=>$cl_cf_1));
+    $form->addInput(array('type'=>'text','name'=>'cf_1','value'=>$cl_cf_1));
   } else if ($custom_fields->fields[0]['type'] == CustomFields::TYPE_DROPDOWN) {
     $form->addInput(array('type'=>'combobox',
       'name'=>'cf_1',
       'style'=>'width: 250px;',
       'value'=>$cl_cf_1,
       'data'=>$custom_fields->options,
-      'empty' => array('' => $i18n->getKey('dropdown.select'))
-    ));
+      'empty' => array('' => $i18n->getKey('dropdown.select'))));
   }
 }
 // Hidden control for record id.
@@ -254,7 +249,7 @@ if ($request->getMethod() == 'POST') {
   if (!ttValidDate($cl_date)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.date'));
   if (!ttValidString($cl_note, true)) $errors->add($i18n->getKey('error.field'), $i18n->getKey('label.note'));
   // Finished validating user input.
-      
+
   // Determine lock date.
   $lock_interval = $user->lock_interval;
   $lockdate = 0;
@@ -279,15 +274,15 @@ if ($request->getMethod() == 'POST') {
     // 1) Prohibit saving locked time entries in any form.
     // 2) Prohibit saving completed unlocked entries into locked interval.
     // 3) Prohibit saving uncompleted unlocked entries when another uncompleted entry exists.
-      
+
     // Now, step by step.
     if ($errors->isEmpty()) {
       // 1) Prohibit saving locked time entries in any form.
       if($lockdate && $item_date->before($lockdate))
-        $errors->add($i18n->getKey('error.period_locked'));        
+        $errors->add($i18n->getKey('error.period_locked'));
       // 2) Prohibit saving completed unlocked entries into locked interval.
       if($errors->isEmpty() && $lockdate && $new_date->before($lockdate))
-        $errors->add($i18n->getKey('error.period_locked'));        
+        $errors->add($i18n->getKey('error.period_locked'));
       // 3) Prohibit saving uncompleted unlocked entries when another uncompleted entry exists.
       $uncompleted = ($cl_finish == '' && $cl_duration == '');
       if ($uncompleted) {
@@ -298,28 +293,28 @@ if ($request->getMethod() == 'POST') {
         }
       }
     }
-    
+
     // Prohibit creating an overlapping record.
     if ($errors->isEmpty()) {
       if (ttTimeHelper::overlaps($user->getActiveUser(), $new_date->toString(DB_DATEFORMAT), $cl_start, $cl_finish, $cl_id))
         $errors->add($i18n->getKey('error.overlap'));
-    } 
+    }
 
     // Now, an update.
     if ($errors->isEmpty()) {
       $res = ttTimeHelper::update(array(
-          'id'=>$cl_id,  
-          'date'=>$new_date->toString(DB_DATEFORMAT),
-          'user_id'=>$user->getActiveUser(),
-          'client'=>$cl_client,
-          'project'=>$cl_project,
-          'task'=>$cl_task,
-          'start'=>$cl_start,
-          'finish'=>$cl_finish,
-          'duration'=>$cl_duration,
-          'note'=>$cl_note,
-          'billable'=>$cl_billable));
-       
+        'id'=>$cl_id,
+        'date'=>$new_date->toString(DB_DATEFORMAT),
+        'user_id'=>$user->getActiveUser(),
+        'client'=>$cl_client,
+        'project'=>$cl_project,
+        'task'=>$cl_task,
+        'start'=>$cl_start,
+        'finish'=>$cl_finish,
+        'duration'=>$cl_duration,
+        'note'=>$cl_note,
+        'billable'=>$cl_billable));
+
       // If we have custom fields - update values.
       if ($res && $custom_fields) {
         if ($custom_fields->fields[0]['type'] == CustomFields::TYPE_TEXT)
@@ -334,13 +329,13 @@ if ($request->getMethod() == 'POST') {
       }
     }
   }
-      
+
   // Save as new record.
   if ($request->getParameter('btn_copy')) {
     // We need to:
     // 1) Prohibit saving into locked interval.
     // 2) Prohibit saving uncompleted unlocked entries when another uncompleted entry exists.
-      
+
     // Now, step by step.
     if ($errors->isEmpty()) {
       // 1) Prohibit saving into locked interval.
@@ -356,7 +351,7 @@ if ($request->getMethod() == 'POST') {
         }
       }
     }
-    
+
     // Prohibit creating an overlapping record.
     if ($errors->isEmpty()) {
       if (ttTimeHelper::overlaps($user->getActiveUser(), $new_date->toString(DB_DATEFORMAT), $cl_start, $cl_finish))
@@ -365,7 +360,7 @@ if ($request->getMethod() == 'POST') {
 
     // Now, a new insert.
     if ($errors->isEmpty()) {
-       
+
       $id = ttTimeHelper::insert(array(
         'date'=>$new_date->toString(DB_DATEFORMAT),
         'user_id'=>$user->getActiveUser(),
@@ -393,12 +388,12 @@ if ($request->getMethod() == 'POST') {
       $errors->add($i18n->getKey('error.db'));
     }
   }
-  
+
   if ($request->getParameter('btn_delete')) {
     header("Location: time_delete.php?id=$cl_id");
     exit();
   }
-} // End of if ($request->getMethod() == "POST")
+} // POST
 
 $smarty->assign('client_list', $client_list);
 $smarty->assign('project_list', $project_list);