// update - updates a record in log table. Does not update its custom fields.
static function update($fields)
{
+ global $user;
$mdb2 = getConnection();
$id = $fields['id'];
$finish = $fields['finish'];
$duration = $fields['duration'];
$note = $fields['note'];
- $billable = $fields['billable'];
+
+ $billable_part = '';
+ if ($user->isPluginEnabled('iv')) {
+ $billable_part = $fields['billable'] ? ', billable = 1' : ', billable = 0';
+ }
+ $paid_part = '';
+ if ($user->canManageTeam() && $user->isPluginEnabled('ps')) {
+ $paid_part = $fields['paid'] ? ', paid = 1' : ', paid = 0';
+ }
$start = ttTimeHelper::to24HourFormat($start);
$finish = ttTimeHelper::to24HourFormat($finish);
if ('00:00' == $finish) $finish = '24:00';
$duration = ttTimeHelper::normalizeDuration($duration);
- if (!$billable) $billable = 0;
if ($start) $duration = '';
if ($duration) {
$sql = "UPDATE tt_log set start = NULL, duration = '$duration', client_id = ".$mdb2->quote($client).", project_id = ".$mdb2->quote($project).", task_id = ".$mdb2->quote($task).", ".
- "comment = ".$mdb2->quote($note).", billable = $billable, date = '$date' WHERE id = $id";
+ "comment = ".$mdb2->quote($note)."$billable_part $paid_part, date = '$date' WHERE id = $id";
$affected = $mdb2->exec($sql);
if (is_a($affected, 'PEAR_Error'))
return false;
return false;
$sql = "UPDATE tt_log SET start = '$start', duration = '$duration', client_id = ".$mdb2->quote($client).", project_id = ".$mdb2->quote($project).", task_id = ".$mdb2->quote($task).", ".
- "comment = ".$mdb2->quote($note).", billable = $billable, date = '$date' WHERE id = $id";
+ "comment = ".$mdb2->quote($note)."$billable_part $paid_part, date = '$date' WHERE id = $id";
$affected = $mdb2->exec($sql);
if (is_a($affected, 'PEAR_Error'))
return false;
$sql = "select l.id as id, l.timestamp as timestamp, TIME_FORMAT(l.start, $sql_time_format) as start,
TIME_FORMAT(sec_to_time(time_to_sec(l.start) + time_to_sec(l.duration)), $sql_time_format) as finish,
TIME_FORMAT(l.duration, '%k:%i') as duration,
- p.name as project_name, t.name as task_name, l.comment, l.client_id, l.project_id, l.task_id, l.invoice_id, l.billable, l.date
+ p.name as project_name, t.name as task_name, l.comment, l.client_id, l.project_id, l.task_id, l.invoice_id, l.billable, l.paid, l.date
from tt_log l
left join tt_projects p on (p.id = l.project_id)
left join tt_tasks t on (t.id = l.task_id)
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.15.2.3764 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.15.2.3765 | 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>
{/if}
{if ($smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}
<tr>
- <td align="right">{$i18n.label.task}:</td>
+ <td align="right">{$i18n.label.task}{if $user->task_required} (*){/if}:</td>
<td>{$forms.timeRecordForm.task.control}</td>
</tr>
{/if}
<td><label>{$forms.timeRecordForm.billable.control}{$i18n.form.time.billable}</label></td>
</tr>
{/if}
+{if ($user->canManageTeam() && $user->isPluginEnabled('ps'))}
+ <tr>
+ <td align="right"> </td>
+ <td><label>{$forms.timeRecordForm.paid.control}{$i18n.label.paid}</label></td>
+ </tr>
+{/if}
{if ($custom_fields && $custom_fields->fields[0])}
<tr>
<td align="right">{$custom_fields->fields[0]['label']|escape}{if $custom_fields->fields[0]['required']} (*){/if}:</td><td>{$forms.timeRecordForm.cf_1.control}</td>
{/if}
{if ($smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}
<tr>
- <td align="right">{$i18n.label.task}:</td>
+ <td align="right">{$i18n.label.task}{if $user->task_required} (*){/if}:</td>
<td>{$forms.timeRecordForm.task.control}</td>
</tr>
{/if}
$cl_billable = 1;
if ($user->isPluginEnabled('iv'))
$cl_billable = $request->getParameter('billable');
+ if ($user->isPluginEnabled('ps'))
+ $cl_paid = $request->getParameter('paid');
} else {
$cl_client = $time_rec['client_id'];
$cl_project = $time_rec['project_id'];
}
$cl_billable = $time_rec['billable'];
+ $cl_paid = $time_rec['paid'];
// Add an info message to the form if we are editing an uncompleted record.
if (strlen($cl_start) > 0 && $cl_start == $cl_finish && $cl_duration == '0:00') {
$form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_id));
if ($user->isPluginEnabled('iv'))
$form->addInput(array('type'=>'checkbox','name'=>'billable','value'=>$cl_billable));
+if ($user->isPluginEnabled('ps'))
+ $form->addInput(array('type'=>'checkbox','name'=>'paid','value'=>$cl_paid));
$form->addInput(array('type'=>'hidden','name'=>'browser_today','value'=>'')); // User current date, which gets filled in on btn_save or btn_copy click.
$form->addInput(array('type'=>'submit','name'=>'btn_save','onclick'=>'browser_today.value=get_date()','value'=>$i18n->getKey('button.save')));
$form->addInput(array('type'=>'submit','name'=>'btn_copy','onclick'=>'browser_today.value=get_date()','value'=>$i18n->getKey('button.copy')));
'finish'=>$cl_finish,
'duration'=>$cl_duration,
'note'=>$cl_note,
- 'billable'=>$cl_billable));
+ 'billable'=>$cl_billable,
+ 'paid'=>$cl_paid));
// If we have custom fields - update values.
if ($res && $custom_fields) {
'finish'=>$cl_finish,
'duration'=>$cl_duration,
'note'=>$cl_note,
- 'billable'=>$cl_billable));
+ 'billable'=>$cl_billable,
+ 'paid'=>$cl_paid));
// Insert a custom field if we have it.
$res = true;