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

@ -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>';