New function to format small and short dates

This commit is contained in:
Manuel Cillero 2017-09-17 08:14:59 +02:00
parent e2d79c1bb4
commit ce5f89b38f
18 changed files with 119 additions and 118 deletions

View file

@ -1721,7 +1721,7 @@ function storm_trash_list() {
l($node->title, "node/$node->nid"),
t($node_types[$node->type]),
t('!date by !username', array(
'!date' => format_date($node->changed, 'small'),
'!date' => _format_small_date($node->changed),
'!username' => theme('username', $node))),
$node->log,
array(
@ -2536,6 +2536,15 @@ function _timetostr($time=array()) {
return $timestr;
}
function _format_small_date($date = NULL) {
return format_date(empty($date) ? time() : $date, 'small');
}
function _format_short_date($date = NULL) {
$format_date = format_date(empty($date) ? time() : $date, 'small');
return substr($format_date, 0, strpos($format_date, ' '));
}
/**
* @function
@ -2834,7 +2843,6 @@ function storm_rewrite_sql($sql, $where = array(), $join = array()) {
$sql = str_replace($replace, $insert . $replace, $sql);
}
}
# drupal_set_message(print_r($sql, TRUE));
return $sql;
}
@ -2872,7 +2880,6 @@ function storm_db_rewrite_sql($query, $primary_table, $primary_field, $args) {
break;
}
}
# drupal_set_message(print_r($return, TRUE));
return $return;
}
}

View file

@ -268,7 +268,6 @@ function stormdok_db_rewrite_sql($query, $primary_table, $primary_field, $args)
break;
}
}
# drupal_set_message(print_r($return, TRUE));
return $return;
}
}

View file

@ -16,8 +16,8 @@ function theme_stormdok_list($header, $doks) {
(!empty($dok->project_title) ? ' » ' . l($dok->project_title, 'node/'. $dok->project_nid) : '' ) .
(!empty($dok->task_title) ? ' » ' . l($dok->task_title, 'node/'. $dok->task_nid) : '' ),
$dok->clip ? storm_icon('attached', t('Has attached files')) : ' ',
format_date($dok->created, 'small'),
format_date($dok->changed, 'small'),
_format_small_date($dok->created),
_format_small_date($dok->changed),
$dok->version,
array(
'data' => storm_icon_edit_node($dok, $_GET) . storm_icon_delete_node($dok, $_GET),
@ -76,14 +76,14 @@ function theme_stormdok_view($node, $teaser = FALSE, $page = FALSE) {
$node->content['group1']['created'] = array(
'#prefix' => '<div class="created">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Created'), format_date($node->created, 'small')),
'#value' => theme('storm_view_item', t('Created'), _format_small_date($node->created)),
'#weight' => 12,
);
if ($node->changed != $node->created) {
$node->content['group1']['modified'] = array(
'#prefix' => '<div class="modified">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Modified'), format_date($node->changed, 'small')),
'#value' => theme('storm_view_item', t('Modified'), _format_small_date($node->changed)),
'#weight' => 13,
);
}

View file

@ -34,7 +34,7 @@ function theme_stormevent_list($header, $events) {
(!empty($event->task_title) ? ' » ' . l($event->task_title, 'node/'. $event->task_nid) : '' ),
$event->clip ? storm_icon('attached', t('Has attached files')) : '&nbsp;',
$eventdate,
format_date($event->changed, 'small'),
_format_small_date($event->changed),
$event->version,
array(
'data' => storm_icon_edit_node($event, $_GET) . storm_icon_delete_node($event, $_GET),
@ -100,14 +100,14 @@ function theme_stormevent_view($node, $teaser = FALSE, $page = FALSE) {
$node->content['group1']['created'] = array(
'#prefix' => '<div class="created">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Created'), format_date($node->created, 'small')),
'#value' => theme('storm_view_item', t('Created'), _format_small_date($node->created)),
'#weight' => 12,
);
if ($node->changed != $node->created) {
$node->content['group1']['modified'] = array(
'#prefix' => '<div class="modified">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Modified'), format_date($node->changed, 'small')),
'#value' => theme('storm_view_item', t('Modified'), _format_small_date($node->changed)),
'#weight' => 13,
);
}

View file

@ -7,15 +7,13 @@
function theme_stormexpense_list($header, $expenses, $totals) {
$rows = array();
foreach ($expenses as $expense) {
$expensedate = format_date($expense->expensedate, 'small');
$expensedate = substr($expensedate, 0, strpos($expensedate, ' '));
$rows[] = array(
'<span class="expense-title">' . l($expense->title, 'node/'. $expense->nid) . theme('mark', node_mark($expense->nid, $expense->changed)) . '</span><br />' .
l($expense->organization_title, 'node/'. $expense->organization_nid) .
(!empty($expense->project_title) ? ' » ' . l($expense->project_title, 'node/'. $expense->project_nid) : '' ) .
(!empty($expense->task_title) ? '<br />' . l($expense->task_title, 'node/'. $expense->task_nid) . ' (' . t('task') . ')' : '' ) .
(!empty($expense->ticket_title) ? '<br />' . l($expense->ticket_title, 'node/'. $expense->ticket_nid) . ' (' . t('ticket') . ')' : '' ),
$expensedate,
_format_short_date($expense->expensedate),
array('data' => sprintf('%.2f', $expense->total), 'align' => 'right'),
array(
'data' => storm_icon_edit_node($expense, $_GET) .'&nbsp;'. storm_icon_delete_node($expense, $_GET),
@ -138,14 +136,14 @@ function theme_stormexpense_view($node, $teaser = FALSE, $page = FALSE) {
$node->content['group1']['created'] = array(
'#prefix' => '<div class="created">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Created'), format_date($node->created, 'small')),
'#value' => theme('storm_view_item', t('Created'), _format_small_date($node->created)),
'#weight' => 6,
);
if ($node->changed != $node->created) {
$node->content['group1']['modified'] = array(
'#prefix' => '<div class="modified">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Modified'), format_date($node->changed, 'small')),
'#value' => theme('storm_view_item', t('Modified'), _format_small_date($node->changed)),
'#weight' => 7,
);
}
@ -159,7 +157,7 @@ function theme_stormexpense_view($node, $teaser = FALSE, $page = FALSE) {
$node->content['group2']['expensedate'] = array(
'#prefix' => '<div class="expensedate">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Date'), format_date($node->expensedate, 'custom', 'Y-m-d')),
'#value' => theme('storm_view_item', t('Date'), _format_short_date($node->expensedate)),
'#weight' => 1,
);
@ -250,13 +248,11 @@ function theme_stormexpense_list_report($report, $language, $expenses) {
$expenses_total = 0;
$rows = array();
foreach ($expenses as $expense) {
$expensedate = format_date($expense->expensedate, 'small');
$expensedate = substr($expensedate, 0, strpos($expensedate, ' '));
$rows[] = array(
check_plain($expense->organization_title),
check_plain($expense->project_title),
check_plain($expense->title),
$expensedate,
_format_short_date($expense->expensedate),
array('data' => sprintf('%.2f', $expense->total), 'align' => 'right'),
);
$expenses_total += $expense->total;
@ -272,12 +268,10 @@ function theme_stormexpense_list_report($report, $language, $expenses) {
t('Total', array(), $language));
$expenses_total = 0;
foreach ($expenses as $expense) {
$expensedate = format_date($expense->expensedate, 'small');
$expensedate = substr($expensedate, 0, strpos($expensedate, ' '));
$rows[] = array(
check_plain($expense->project_title),
check_plain($expense->title),
$expensedate,
_format_short_date($expense->expensedate),
array('data' => sprintf('%.2f', $expense->total), 'align' => 'right'),
);
$expenses_total += $expense->total;
@ -295,13 +289,11 @@ function theme_stormexpense_list_report($report, $language, $expenses) {
t('Total', array(), $language));
$total_duration = 0;
foreach ($expenses as $expense) {
$expensedate = format_date($expense->expensedate, 'small');
$expensedate = substr($expensedate, 0, strpos($expensedate, ' '));
$rows[] = array(
check_plain($expense->project_title),
check_plain($expense->task_title),
check_plain($expense->title),
$expensedate,
_format_short_date($expense->expensedate),
array('data' => sprintf('%.2f', $expense->total), 'align' => 'right'),
);
$expenses_total += $expense->total;
@ -320,12 +312,10 @@ function theme_stormexpense_list_report($report, $language, $expenses) {
t('Total', array(), $language));
$total_duration = 0;
foreach ($expenses as $expense) {
$expensedate = format_date($expense->expensedate, 'small');
$expensedate = substr($expensedate, 0, strpos($expensedate, ' '));
$rows[] = array(
check_plain($expense->task_title),
check_plain($expense->title),
$expensedate,
_format_short_date($expense->expensedate),
array('data' => sprintf('%.2f', $expense->total), 'align' => 'right'),
);
$expenses_total += $expense->total;

View file

@ -10,7 +10,7 @@ function theme_stormidea_list($header, $ideas) {
foreach ($ideas as $idea) {
$rows[] = array(
'<span class="idea-title">' . $idea->title . '</span>',
format_date($idea->changed, 'small'),
_format_small_date($idea->changed),
array(
'data' => storm_icon_edit_node($idea, $_GET) . storm_icon_delete_node($idea, $_GET),
'class' => 'storm_list_operations',
@ -38,14 +38,14 @@ function theme_stormidea_view($node, $teaser = FALSE, $page = FALSE) {
$node->content['group1']['created'] = array(
'#prefix' => '<div class="created">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Idea recorded'), format_date($node->created, 'small')),
'#value' => theme('storm_view_item', t('Idea recorded'), _format_small_date($node->created)),
'#weight' => 12,
);
if ($node->changed != $node->created) {
$node->content['group1']['modified'] = array(
'#prefix' => '<div class="created">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Note updated'), format_date($node->changed, 'small')),
'#value' => theme('storm_view_item', t('Note updated'), _format_small_date($node->changed)),
'#weight' => 13,
);
}

View file

@ -5,35 +5,43 @@
* (creating invoices based on other SuiteDesk nodes)
*/
function storminvoice_auto_add($node, $invoice = NULL) {
$type = $node->type;
switch ($node->type) {
case 'stormorganization':
$type = 'organization';
$invoice_nid = stormorganization_storminvoice_auto_add($node, $invoice);
break;
case 'stormproject':
$type = 'project';
$invoice_nid = stormproject_storminvoice_auto_add($node, $invoice);
break;
case 'stormtask':
$type = 'task';
$invoice_nid = stormtask_storminvoice_auto_add($node, $invoice);
break;
case 'stormticket':
$type = 'ticket';
$invoice_nid = stormticket_storminvoice_auto_add($node, $invoice);
break;
case 'stormtimetracking':
$type = 'timetracking';
$invoice_nid = stormtimetracking_storminvoice_auto_add($node, $invoice);
break;
case 'stormexpense':
$type = 'expense';
$invoice_nid = stormexpense_storminvoice_auto_add($node, $invoice);
break;
default:
drupal_set_message(t('This type of node cannot be automatically added to an invoice'), 'error');
drupal_set_message(t('This type of content cannot be automatically added to an invoice.'), 'error');
// watchdog - add link to record error in more detail?
drupal_goto('node/'. $node->nid);
}
if ($invoice) {
drupal_set_message(t('The @type has been added to the selected invoice.', array('@type' => $node->type)));
drupal_set_message(t('The @type has been added to the selected invoice.', array('@type' => t($type))));
}
else {
drupal_set_message(t('This invoice was created automatically from the selected @type.', array('@type' => $node->type)));
drupal_set_message(t('This invoice was created automatically from the selected @type.', array('@type' => t($type))));
}
drupal_goto('node/'. $invoice_nid);
}
@ -42,7 +50,7 @@ function storminvoice_auto_add_select() {
$form['node'] = array(
'#title' => t('Node'),
'#type' => 'hidden',
'#value' => arg(4),
'#value' => arg(3),
);
$form['invoice'] = array(
@ -54,7 +62,7 @@ function storminvoice_auto_add_select() {
// THIS CODE LOADS OPTIONS INTO THE INVOICE SELECTOR
// Load the node object, but don't know how to handle it yet because it could be a node of several types.
$node = node_load(arg(4));
$node = node_load(arg(3));
/* This function does not know the type of node that is being billed for. To avoid recording all relationships between the SuiteDesk nodes,
* we simply check for the existance of a parent node (perhaps project, task, ticket etc). Organization will always be set.
* The invoices we show in the list are those that match these parents or where these attributes are not set.

View file

@ -742,31 +742,33 @@ function _storminvoice_beforesave(&$node) {
}
function _storminvoice_insert_items($node) {
foreach ($node->items as $j => $item) {
$node->items[$j]->src_nid = (isset($node->items[$j]->src_nid)) ? $node->items[$j]->src_nid : $node->src_nid;
$node->items[$j]->src_vid = (isset($node->items[$j]->src_vid)) ? $node->items[$j]->src_vid : $node->src_vid;
if (!empty($node->items)) {
foreach ($node->items as $j => $item) {
$node->items[$j]->src_nid = (isset($node->items[$j]->src_nid)) ? $node->items[$j]->src_nid : $node->src_nid;
$node->items[$j]->src_vid = (isset($node->items[$j]->src_vid)) ? $node->items[$j]->src_vid : $node->src_vid;
db_query("INSERT INTO {storminvoice_items}
(invoice_nid, invoice_vid, amount, description,
tax1app, tax1percent, tax1,
tax2app, tax2percent, tax2,
total, weight,
src_nid, src_vid
) VALUES
(%d, %d, %f, '%s',
%d, %f, %f,
%d, %f, %f,
%f, %d,
%d, %d
)",
$node->nid, $node->vid, $node->items[$j]->amount, $node->items[$j]->description,
$node->items[$j]->tax1app, $node->items[$j]->tax1percent, $node->items[$j]->tax1,
$node->items[$j]->tax2app, $node->items[$j]->tax2percent, $node->items[$j]->tax2,
$node->items[$j]->total, $node->items[$j]->weight,
$node->items[$j]->src_nid, $node->items[$j]->src_vid
db_query("INSERT INTO {storminvoice_items}
(invoice_nid, invoice_vid, amount, description,
tax1app, tax1percent, tax1,
tax2app, tax2percent, tax2,
total, weight,
src_nid, src_vid
) VALUES
(%d, %d, %f, '%s',
%d, %f, %f,
%d, %f, %f,
%f, %d,
%d, %d
)",
$node->nid, $node->vid, $node->items[$j]->amount, $node->items[$j]->description,
$node->items[$j]->tax1app, $node->items[$j]->tax1percent, $node->items[$j]->tax1,
$node->items[$j]->tax2app, $node->items[$j]->tax2percent, $node->items[$j]->tax2,
$node->items[$j]->total, $node->items[$j]->weight,
$node->items[$j]->src_nid, $node->items[$j]->src_vid
);
}
db_query("DELETE FROM {storminvoice_items} WHERE invoice_vid=%d AND total=0 AND description='' ", $node->vid);
}
db_query("DELETE FROM {storminvoice_items} WHERE invoice_vid=%d AND total=0 AND description='' ", $node->vid);
}
function _storminvoice_aftersave($node) {
@ -1016,32 +1018,32 @@ function storminvoice_get_item_desc($rate_array, $node) {
switch ($rate_array['pricemode_used']) {
case 'hourly':
if ($node->type == 'stormtimetracking') {
$description = date('d M y', $node->trackingdate) . ': ' . t('@dur @units work at @rate per hour on @desc', array('@dur' => $node->billing_duration, '@unit' => $node->durationunit, '@rate' => $node->price, '@desc' => $node->title));
$description = _format_small_date($node->trackingdate) . ' - ' . t('@dur @units work at @rate per hour on @desc', array('@dur' => $node->billing_duration, '@unit' => t($node->durationunit), '@rate' => $node->price, '@desc' => $node->title));
}
else {
$description = date('d M y') . ': ' . t('@dur @units work at @rate per hour on @desc', array('@dur' => $node->duration, '@unit' => $node->durationunit, '@rate' => $node->price, '@desc' => $node->title));
$description = _format_small_date() . ' - ' . t('@dur @units work at @rate per hour on @desc', array('@dur' => $node->duration, '@unit' => t($node->durationunit), '@rate' => $node->price, '@desc' => $node->title));
}
break;
case 'daily':
if ($node->type == 'stormtimetracking') {
$description = date('d M y', $node->trackingdate) . ': ' . t('@dur @units work at @rate per day on @desc', array('@dur' => $node->billing_duration, '@unit' => $node->durationunit, '@rate' => $node->price, '@desc' => $node->title));
$description = _format_small_date($node->trackingdate) . ' - ' . t('@dur @units work at @rate per day on @desc', array('@dur' => $node->billing_duration, '@unit' => t($node->durationunit), '@rate' => $node->price, '@desc' => $node->title));
}
else {
$description = date('d M y') . ': ' . t('@dur @units work at @rate per day on @desc', array('@dur' => $node->duration, '@unit' => $node->durationunit, '@rate' => $node->price, '@desc' => $node->title));
$description = _format_small_date() . ' - ' . t('@dur @units work at @rate per day on @desc', array('@dur' => $node->duration, '@unit' => t($node->durationunit), '@rate' => $node->price, '@desc' => $node->title));
}
break;
case 'fixed':
if ($node->type == 'stormtimetracking') {
$description = date('d M y', $node->trackingdate) . ': ' . t('@dur @units unbilled work on @desc', array('@dur' => $node->billing_duration, '@unit' => $node->durationunit, '@desc' => $node->title));
$description = _format_small_date($node->trackingdate) . ' - ' . t('@dur @units unbilled work on @desc', array('@dur' => $node->billing_duration, '@unit' => t($node->durationunit), '@desc' => $node->title));
}
else {
$description = date('d M y') . ': ' . t('@dur @units unbilled work on @desc', array('@dur' => $node->duration, '@unit' => $node->durationunit, '@desc' => $node->title));
$description = _format_small_date() . ' - ' . t('@dur @units unbilled work on @desc', array('@dur' => $node->duration, '@unit' => t($node->durationunit), '@desc' => $node->title));
}
break;
case 'fixed_price':
switch ($node->type) {
case 'stormtimetracking':
$description = date('d M y', $node->trackingdate) . ': ' . t('work billed for @desc', array('@desc' => $node->title));
$description = _format_small_date($node->trackingdate) . ' - ' . t('Work billed for @desc', array('@desc' => $node->title));
break;
case 'stormproject':
$description = t('Project billed: @desc', array('@desc' => $node->title));

View file

@ -34,9 +34,6 @@ function theme_storminvoice_list($header, $invoices, $itemsperpage, $totals_topa
$invoice->status = 'overdue';
}
$requestdate = format_date($invoice->requestdate, 'small');
$requestdate = substr($requestdate, 0, strpos($requestdate, ' '));
$rows[] = array(
array(
'data' => storm_icon('invoice_status_'. check_plain($invoice->status), storm_attribute_value('Invoice status', $invoice->status)),
@ -49,7 +46,7 @@ function theme_storminvoice_list($header, $invoices, $itemsperpage, $totals_topa
'<span class="invoice-title">' . l($invoice->title, 'node/'. $invoice->nid) . theme('mark', node_mark($invoice->nid, $invoice->changed)) . '</span><br />' .
l($invoice->organization_title, 'node/'. $invoice->organization_nid) .' » '.
l($invoice->project_title, 'node/'. $invoice->project_nid),
$requestdate,
_format_short_date($invoice->requestdate),
array('data' => sprintf('%.2f', $invoice->total), 'align' => 'right'),
array(
'data' => storm_icon_edit_node($invoice, $_GET) .'&nbsp;'. storm_icon_delete_node($invoice, $_GET),
@ -270,14 +267,14 @@ function theme_storminvoice_view($node, $teaser = FALSE, $page = FALSE) {
$node->content['group3']['requestdate'] = array(
'#prefix' => '<div class="requestdate">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Request date'), format_date($node->requestdate, 'custom', 'Y-m-d')),
'#value' => theme('storm_view_item', t('Request date'), _format_short_date($node->requestdate)),
'#weight' => 1,
);
$node->content['group3']['duedate'] = array(
'#prefix' => '<div class="duedate">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Due date'), format_date($node->duedate, 'custom', 'Y-m-d')),
'#value' => theme('storm_view_item', t('Due date'), _format_short_date($node->duedate)),
'#weight' => 2,
);
@ -285,7 +282,7 @@ function theme_storminvoice_view($node, $teaser = FALSE, $page = FALSE) {
$node->content['group3']['paymentdate'] = array(
'#prefix' => '<div class="paymentdate">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Payment date'), $node->paymentdate? format_date($node->paymentdate, 'custom', 'Y-m-d') : ''),
'#value' => theme('storm_view_item', t('Payment date'), $node->paymentdate ? _format_short_date($node->paymentdate) : ''),
'#weight' => 3,
);
}
@ -449,14 +446,14 @@ function theme_storminvoice_view($node, $teaser = FALSE, $page = FALSE) {
$node->content['group_item']['created'] = array(
'#prefix' => '<div class="created">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Created'), format_date($node->created, 'small')),
'#value' => theme('storm_view_item', t('Created'), _format_small_date($node->created)),
'#weight' => 2,
);
if ($node->changed != $node->created) {
$node->content['group_item']['modified'] = array(
'#prefix' => '<div class="modified">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Modified'), format_date($node->changed, 'small')),
'#value' => theme('storm_view_item', t('Modified'), _format_small_date($node->changed)),
'#weight' => 3,
);
}
@ -584,7 +581,7 @@ function theme_storminvoice_report_pdf($node, $language, $output = 'screen') {
$h = $pdf->getY() - $h;
$pdf->MultiCell($w-2, $h, $node->number, 1, 'L', 0, 0, PDF_MARGIN_LEFT + $pageWidth *.5, $pdf->getY() - $h);
$pdf->MultiCell($w-3, $h, $mycurrency, 1, 'L', 0, 0);
$pdf->MultiCell($w+5, $h, format_date($node->requestdate, 'custom', 'Y-m-d'), 1, 'L', 0, 1);
$pdf->MultiCell($w+5, $h, _format_short_date($node->requestdate), 1, 'L', 0, 1);
$pdf->SetFont("times", "B", 10);
@ -607,7 +604,7 @@ function theme_storminvoice_report_pdf($node, $language, $output = 'screen') {
}
$pdf->MultiCell($w * 2 - 5, 12, $o, 1, 'C', 0, 0, PDF_MARGIN_LEFT + $pageWidth * .5);
$pdf->SetFont("times", "N", 10);
$pdf->MultiCell($w + 5, 12, format_date($node->duedate, 'custom', 'Y-m-d'), 1, 'L', 0, 0);
$pdf->MultiCell($w + 5, 12, _format_short_date($node->duedate), 1, 'L', 0, 0);
$pdf->MultiCell($w, 12, variable_get('storminvoice_payment_terms', ''), 1, 'L', 0, 1);
$y = $pdf->getY();
@ -775,7 +772,7 @@ function theme_storminvoice_report_html($node, $language) {
$o .= '<tr>';
$o .= '<td>'. $node->number .'</td>';
$o .= '<td>'. $mycurrency .'</td>';
$o .= '<td>'. format_date($node->requestdate, 'custom', 'Y-m-d') .'</td>';
$o .= '<td>'. _format_short_date($node->requestdate) .'</td>';
$o .= '<td>'. $node->reference .'</td>';
$o .= '</tr>';
$o .= '<tr>';
@ -800,7 +797,7 @@ function theme_storminvoice_report_html($node, $language) {
$o .= '('. $organization->currency .' '. sprintf('%.2f', $node->totalcustomercurr) .')';
}
$o .= '</td>';
$o .= '<td>'. format_date($node->duedate, 'custom', 'Y-m-d') .'</td>';
$o .= '<td>'. _format_short_date($node->duedate) .'</td>';
$o .= '<td>'. variable_get('storminvoice_payment_terms', '') .'</td>';
$o .= '</tr>';
$o .= '</table></div>';

View file

@ -14,8 +14,8 @@ function theme_stormnote_list($header, $notes) {
(!empty($note->project_title) ? ' » ' . l($note->project_title, 'node/'. $note->project_nid) : '' ) .
(!empty($note->task_title) ? ' » ' . l($note->task_title, 'node/'. $note->task_nid) : '' ),
$note->clip ? storm_icon('attached', t('Has attached files')) : '&nbsp;',
format_date($note->created, 'small'),
format_date($note->changed, 'small'),
_format_small_date($note->created),
_format_small_date($note->changed),
$note->version,
array(
'data' => storm_icon_edit_node($note, $_GET) . storm_icon_delete_node($note, $_GET),
@ -68,14 +68,14 @@ function theme_stormnote_view($node, $teaser = FALSE, $page = FALSE) {
$node->content['group1']['created'] = array(
'#prefix' => '<div class="created">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Note created'), format_date($node->created, 'small')),
'#value' => theme('storm_view_item', t('Note created'), _format_small_date($node->created)),
'#weight' => 12,
);
if ($node->changed != $node->created) {
$node->content['group1']['modified'] = array(
'#prefix' => '<div class="created">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Note updated'), format_date($node->changed, 'small')),
'#value' => theme('storm_view_item', t('Note updated'), _format_small_date($node->changed)),
'#weight' => 13,
);
}

View file

@ -165,14 +165,14 @@ function theme_stormorganization_view($node, $teaser = FALSE, $page = FALSE) {
$node->content['group_item']['created'] = array(
'#prefix' => '<div class="created">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Created'), format_date($node->created, 'small')),
'#value' => theme('storm_view_item', t('Created'), _format_small_date($node->created)),
'#weight' => 2,
);
if ($node->changed != $node->created) {
$node->content['group_item']['modified'] = array(
'#prefix' => '<div class="modified">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Modified'), format_date($node->changed, 'small')),
'#value' => theme('storm_view_item', t('Modified'), _format_small_date($node->changed)),
'#weight' => 3,
);
}

View file

@ -97,14 +97,14 @@ function theme_stormperson_view($node, $teaser = FALSE, $page = FALSE) {
$node->content['group_item']['created'] = array(
'#prefix' => '<div class="created">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Created'), format_date($node->created, 'small')),
'#value' => theme('storm_view_item', t('Created'), _format_small_date($node->created)),
'#weight' => 2,
);
if ($node->changed != $node->created) {
$node->content['group_item']['modified'] = array(
'#prefix' => '<div class="modified">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Modified'), format_date($node->changed, 'small')),
'#value' => theme('storm_view_item', t('Modified'), _format_small_date($node->changed)),
'#weight' => 3,
);
}

View file

@ -15,8 +15,8 @@ function theme_stormproject_list($header, $projects) {
'<span class="project-title status_' . str_replace(' ', '_', $project->projectstatus) . '">' . l($project->title, 'node/'. $project->nid) . theme('mark', node_mark($project->nid, $project->changed)) . '</span><br />' .
l($project->organization_title, 'node/'. $project->organization_nid) .
(!empty($project->manager_title) ? ' » ' . l($project->manager_title, 'node/'. $project->manager_nid) : '' ),
format_date($project->created, 'small'),
format_date($project->changed, 'small'),
_format_small_date($project->created),
_format_small_date($project->changed),
$project->version,
storm_icon('priority_'. $project->projectpriority, storm_attribute_value('Project priority', $project->projectpriority)),
array(
@ -81,14 +81,14 @@ function theme_stormproject_view($node, $teaser = FALSE, $page = FALSE) {
$node->content['group1']['created'] = array(
'#prefix' => '<div class="created">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Created'), format_date($node->created, 'small')),
'#value' => theme('storm_view_item', t('Created'), _format_small_date($node->created)),
'#weight' => 12,
);
if ($node->changed != $node->created) {
$node->content['group1']['modified'] = array(
'#prefix' => '<div class="modified">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Modified'), format_date($node->changed, 'small')),
'#value' => theme('storm_view_item', t('Modified'), _format_small_date($node->changed)),
'#weight' => 13,
);
}
@ -135,14 +135,14 @@ function theme_stormproject_view($node, $teaser = FALSE, $page = FALSE) {
$node->content['group3']['datebegin'] = array(
'#prefix' => '<div class="datebegin">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Date begin'), empty($node->datebegin) ? '' : substr(format_date($node->datebegin, 'small'), 0, 10)),
'#value' => theme('storm_view_item', t('Date begin'), empty($node->datebegin) ? '' : _format_short_date($node->datebegin)),
'#weight' => 2,
);
$node->content['group3']['dateend'] = array(
'#prefix' => '<div class="dateend">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Date end'), empty($node->dateend) ? '' : substr(format_date($node->dateend, 'small'), 0, 10)),
'#value' => theme('storm_view_item', t('Date end'), empty($node->dateend) ? '' : _format_short_date($node->dateend)),
'#weight' => 3,
);

View file

@ -339,14 +339,12 @@ function stormtask_tasks_form($form_id, $header, $tasks, $project) {
'#value' => storm_icon('priority_'. $task->taskpriority, storm_attribute_value('Task priority', $task->taskpriority)),
);
$datebegin = format_date($task->datebegin, 'small');
$form['tasks']['tasks'][$task->nid]['task_datebegin_'. $task->nid] = array(
'#value' => empty($task->datebegin) ? '' : substr($datebegin, 0, strpos($datebegin, ' ')),
'#value' => empty($task->datebegin) ? '' : _format_short_date($task->datebegin),
);
$dateend = format_date($task->dateend, 'small');
$form['tasks']['tasks'][$task->nid]['task_dateend_'. $task->nid] = array(
'#value' => empty($task->dateend) ? '' : substr($dateend, 0, strpos($dateend, ' ')),
'#value' => empty($task->dateend) ? '' : _format_short_date($task->dateend),
);
$form['tasks']['tasks'][$task->nid]['task_duration_'. $task->nid] = array(

View file

@ -56,8 +56,8 @@ function theme_stormtask_tasks($form) {
function theme_stormtask_list($header, $tasks) {
$rows = array();
foreach ($tasks as $task) {
$datebegin = !empty($task->datebegin) ? format_date($task->datebegin, 'small') : '';
$dateend = !empty($task->dateend) ? format_date($task->dateend, 'small') : '';
$datebegin = !empty($task->datebegin) ? _format_short_date($task->datebegin) . '<br />' : '&nbsp;';
$dateend = !empty($task->dateend) ? _format_short_date($task->dateend) : '';
$rows[] = array(
// Add classes to each row in table.
// Allows customisation of row via css depending on the task's attributes (category, status, priority)
@ -71,9 +71,9 @@ function theme_stormtask_list($header, $tasks) {
'<span class="task-title status_' . str_replace(' ', '_', $task->taskstatus) . '">' . l($task->title, 'node/'. $task->nid) . theme('mark', node_mark($task->nid, $task->changed)) . '</span><br />' .
l($task->organization_title, 'node/'. $task->organization_nid) .' » '.
l($task->project_title, 'node/'. $task->project_nid),
substr($datebegin, 0, strpos($datebegin, ' ')) . '<br />' . substr($dateend, 0, strpos($dateend, ' ')),
$datebegin . $dateend,
$task->clip ? storm_icon('attached', t('Has attached files')) : '&nbsp;',
format_date($task->changed, 'small'),
_format_small_date($task->changed),
storm_icon('priority_'. $task->taskpriority, storm_attribute_value('Task priority', $task->taskpriority)),
array(
'data' => $task->comment_count,
@ -154,14 +154,14 @@ function theme_stormtask_view($node, $teaser = FALSE, $page = FALSE) {
$node->content['group1']['created'] = array(
'#prefix' => '<div class="created">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Created'), format_date($node->created, 'small')),
'#value' => theme('storm_view_item', t('Created'), _format_small_date($node->created)),
'#weight' => 12,
);
if ($node->changed != $node->created) {
$node->content['group1']['modified'] = array(
'#prefix' => '<div class="modified">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Modified'), format_date($node->changed, 'small')),
'#value' => theme('storm_view_item', t('Modified'), _format_small_date($node->changed)),
'#weight' => 13,
);
}
@ -202,14 +202,14 @@ function theme_stormtask_view($node, $teaser = FALSE, $page = FALSE) {
$node->content['group3']['datebegin'] = array(
'#prefix' => '<div class="datebegin">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Date begin'), empty($node->datebegin) ? '' : substr(format_date($node->datebegin, 'small'), 0, 10)),
'#value' => theme('storm_view_item', t('Date begin'), empty($node->datebegin) ? '' : _format_short_date($node->datebegin)),
'#weight' => 2,
);
$node->content['group3']['dateend'] = array(
'#prefix' => '<div class="dateend">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Date end'), empty($node->dateend) ? '' : substr(format_date($node->dateend, 'small'), 0, 10)),
'#value' => theme('storm_view_item', t('Date end'), empty($node->dateend) ? '' : _format_short_date($node->dateend)),
'#weight' => 3,
);

View file

@ -58,14 +58,14 @@ function theme_stormteam_view($node, $teaser = FALSE, $page = FALSE) {
$node->content['group_item']['created'] = array(
'#prefix' => '<div class="created">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Created'), format_date($node->created, 'small')),
'#value' => theme('storm_view_item', t('Created'), _format_small_date($node->created)),
'#weight' => 2,
);
if ($node->changed != $node->created) {
$node->content['group_item']['modified'] = array(
'#prefix' => '<div class="modified">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Modified'), format_date($node->changed, 'small')),
'#value' => theme('storm_view_item', t('Modified'), _format_small_date($node->changed)),
'#weight' => 3,
);
}

View file

@ -15,7 +15,7 @@ function theme_stormticket_list($header, $tickets) {
l($ticket->organization_title, 'node/'. $ticket->organization_nid) .
(!empty($ticket->project_title) ? ' » ' . l($ticket->project_title, 'node/'. $ticket->project_nid) : '' ),
$ticket->clip ? storm_icon('attached', t('Has attached files')) : '&nbsp;',
format_date($ticket->changed, 'small'),
_format_small_date($ticket->changed),
storm_icon('priority_'. $ticket->ticketpriority, storm_attribute_value('Ticket priority', $ticket->ticketpriority)),
array(
'data' => $ticket->comment_count,
@ -90,14 +90,14 @@ function theme_stormticket_view($node, $teaser = FALSE, $page = FALSE) {
$node->content['group1']['created'] = array(
'#prefix' => '<div class="created">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Created'), format_date($node->created, 'small')),
'#value' => theme('storm_view_item', t('Created'), _format_small_date($node->created)),
'#weight' => 12,
);
if ($node->changed != $node->created) {
$node->content['group1']['modified'] = array(
'#prefix' => '<div class="modified">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Modified'), format_date($node->changed, 'small')),
'#value' => theme('storm_view_item', t('Modified'), _format_small_date($node->changed)),
'#weight' => 13,
);
}

View file

@ -13,7 +13,7 @@ function theme_stormtimetracking_list($header, $timetrackings, $billing_duration
(!empty($timetracking->project_title) ? ' » ' . l($timetracking->project_title, 'node/'. $timetracking->project_nid) : '' ) .
(!empty($timetracking->task_title) ? '<br />' . l($timetracking->task_title, 'node/'. $timetracking->task_nid) . ' (' . t('task') . ')' : '' ) .
(!empty($timetracking->ticket_title) ? '<br />' . l($timetracking->ticket_title, 'node/'. $timetracking->ticket_nid) . ' (' . t('ticket') . ')' : '' ),
format_date($timetracking->trackingdate, 'small'),
_format_small_date($timetracking->trackingdate),
array('data' => stormtimetracking_duration($timetracking->billing_duration), 'align' => 'right'),
array(
'data' => storm_icon_edit_node($timetracking, $_GET) .'&nbsp;'. storm_icon_delete_node($timetracking, $_GET),
@ -90,7 +90,7 @@ function theme_stormtimetracking_view($node, $teaser = FALSE, $page = FALSE) {
$node->content['group2']['trackingdate'] = array(
'#prefix' => '<div class="trackingdate">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Date'), empty($node->trackingdate) ? '' : substr(format_date($node->trackingdate, 'small'), 0, 10)),
'#value' => theme('storm_view_item', t('Date'), empty($node->trackingdate) ? '' : _format_short_date($node->trackingdate)),
'#weight' => 2,
);
@ -121,14 +121,14 @@ function theme_stormtimetracking_view($node, $teaser = FALSE, $page = FALSE) {
$node->content['group_item']['created'] = array(
'#prefix' => '<div class="created">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Created'), format_date($node->created, 'small')),
'#value' => theme('storm_view_item', t('Created'), _format_small_date($node->created)),
'#weight' => 2,
);
if ($node->changed != $node->created) {
$node->content['group_item']['modified'] = array(
'#prefix' => '<div class="modified">',
'#suffix' => '</div>',
'#value' => theme('storm_view_item', t('Modified'), format_date($node->changed, 'small')),
'#value' => theme('storm_view_item', t('Modified'), _format_small_date($node->changed)),
'#weight' => 3,
);
}
@ -172,7 +172,7 @@ function theme_stormtimetracking_list_report($report, $language, $timetrackings)
check_plain($timetracking->organization_title),
check_plain($timetracking->project_title),
check_plain($timetracking->title),
format_date($timetracking->trackingdate, 'small'),
_format_small_date($timetracking->trackingdate),
array('data' => stormtimetracking_duration($timetracking->billing_duration), 'align' => 'right'),
);
$total_billing_duration += $timetracking->billing_duration;
@ -191,7 +191,7 @@ function theme_stormtimetracking_list_report($report, $language, $timetrackings)
$rows[] = array(
check_plain($timetracking->project_title),
check_plain($timetracking->title),
format_date($timetracking->trackingdate, 'small'),
_format_small_date($timetracking->trackingdate),
array('data' => stormtimetracking_duration($timetracking->billing_duration), 'align' => 'right'),
);
$total_billing_duration += $timetracking->billing_duration;
@ -213,7 +213,7 @@ function theme_stormtimetracking_list_report($report, $language, $timetrackings)
check_plain($timetracking->project_title),
check_plain($timetracking->task_title),
check_plain($timetracking->title),
format_date($timetracking->trackingdate, 'small'),
_format_small_date($timetracking->trackingdate),
array('data' => stormtimetracking_duration($timetracking->billing_duration), 'align' => 'right'),
);
$total_billing_duration += $timetracking->billing_duration;
@ -235,7 +235,7 @@ function theme_stormtimetracking_list_report($report, $language, $timetrackings)
$rows[] = array(
check_plain($timetracking->task_title),
check_plain($timetracking->title),
format_date($timetracking->trackingdate, 'small'),
_format_small_date($timetracking->trackingdate),
array('data' => stormtimetracking_duration($timetracking->billing_duration), 'align' => 'right'),
);
$total_billing_duration += $timetracking->billing_duration;