// update - updates a record in tt_expense_items table.
static function update($fields)
{
+ global $user;
$mdb2 = getConnection();
$id = (int) $fields['id'];
$cost = str_replace(',', '.', $fields['cost']);
$invoice_id = $fields['invoice_id'];
+ $paid_part = '';
+ if ($user->canManageTeam() && $user->isPluginEnabled('ps')) {
+ $paid_part = $fields['paid'] ? ', paid = 1' : ', paid = 0';
+ }
+
$sql = "UPDATE tt_expense_items set date = ".$mdb2->quote($date).", user_id = $user_id, client_id = ".$mdb2->quote($client_id).
", project_id = ".$mdb2->quote($project_id).", name = ".$mdb2->quote($name).
- ", cost = ".$mdb2->quote($cost).", invoice_id = ".$mdb2->quote($invoice_id).
+ ", cost = ".$mdb2->quote($cost)."$paid_part, invoice_id = ".$mdb2->quote($invoice_id).
" WHERE id = $id";
$affected = $mdb2->exec($sql);
if ($user->isPluginEnabled('cl'))
$left_joins .= " left join tt_clients c on (ei.client_id = c.id)";
- $sql = "select ei.id, ei.date, ei.client_id, ei.project_id, ei.name, ei.cost, ei.invoice_id $client_field, p.name as project_name
+ $sql = "select ei.id, ei.date, ei.client_id, ei.project_id, ei.name, ei.cost, ei.invoice_id, ei.paid $client_field, p.name as project_name
from tt_expense_items ei
$left_joins
where ei.id = $id and ei.user_id = $user_id and ei.status = 1";
<td align="right">{$i18n.label.cost}:</td>
<td>{$forms.expenseItemForm.cost.control} {$user->currency|escape}</td>
</tr>
+{if ($user->canManageTeam() && $user->isPluginEnabled('ps'))}
+ <tr>
+ <td align="right"> </td>
+ <td><label>{$forms.expenseItemForm.paid.control}{$i18n.label.paid}</label></td>
+ </tr>
+{/if}
<tr>
<td align="right">{$i18n.label.date}:</td>
<td>{$forms.expenseItemForm.date.control}</td>
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.17.0.3776 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.17.1.3777 | 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>
$cl_project = $request->getParameter('project');
$cl_item_name = trim($request->getParameter('item_name'));
$cl_cost = trim($request->getParameter('cost'));
+ if ($user->isPluginEnabled('ps'))
+ $cl_paid = $request->getParameter('paid');
} else {
$cl_date = $item_date->toString($user->date_format);
$cl_client = $expense_item['client_id'];
$cl_project = $expense_item['project_id'];
$cl_item_name = $expense_item['name'];
$cl_cost = $expense_item['cost'];
+ $cl_paid = $expense_item['paid'];
}
// Initialize elements of 'expenseItemForm'.
}
$form->addInput(array('type'=>'textarea','maxlength'=>'800','name'=>'item_name','style'=>'width: 250px; height:'.NOTE_INPUT_HEIGHT.'px;','value'=>$cl_item_name));
$form->addInput(array('type'=>'text','maxlength'=>'40','name'=>'cost','style'=>'width: 100px;','value'=>$cl_cost));
+if ($user->canManageTeam() && $user->isPluginEnabled('ps'))
+ $form->addInput(array('type'=>'checkbox','name'=>'paid','value'=>$cl_paid));
$form->addInput(array('type'=>'datefield','name'=>'date','maxlength'=>'20','value'=>$cl_date));
// Hidden control for record id.
$form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_id));
// Now, an update.
if ($err->no()) {
if (ttExpenseHelper::update(array('id'=>$cl_id,'date'=>$new_date->toString(DB_DATEFORMAT),'user_id'=>$user->getActiveUser(),
- 'client_id'=>$cl_client,'project_id'=>$cl_project,'name'=>$cl_item_name,'cost'=>$cl_cost))) {
+ 'client_id'=>$cl_client,'project_id'=>$cl_project,'name'=>$cl_item_name,'cost'=>$cl_cost,'paid'=>$cl_paid))) {
header('Location: expenses.php?date='.$new_date->toString(DB_DATEFORMAT));
exit();
}
$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'))
+if ($user->canManageTeam() && $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')));