New function to format small and short dates
This commit is contained in:
parent
e2d79c1bb4
commit
ce5f89b38f
18 changed files with 119 additions and 118 deletions
|
@ -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));
|
||||
|
|
Reference in a new issue