New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time Format in Invoice #1032

Closed
dhe001 opened this Issue Aug 22, 2017 · 7 comments

Comments

Projects
None yet
5 participants
@dhe001

dhe001 commented Aug 22, 2017

HI,

in the invoice we have date and time (start/end) of the work. this is fomated with [row.date;frm='dd.mm.yyyy'] for the date and [row.start;frm='hh:nn:ss'] for start and [row.end;frm='hh:nn:ss'] endtime.

Now it comes to the stage that this is sometimes not working - have no idea why.
If we use the linux timestamp and recalculate this manually - this is working. so looks like that the entry in the database is correct.

Current Version : v1.1.0.1389
Upgrade to latest dev - Version: no Changes
Export from Kimai (not with invoice): correct format

This was working before always....
Have attached some screenshots.
Any Ideas ?

Many thanks
Dirk
with linux time - correct
word template
with formated time - red are wrong

@simonschaufi

This comment has been minimized.

Show comment
Hide comment
@simonschaufi

simonschaufi Aug 23, 2017

Member

no idea where the problem could be.

Member

simonschaufi commented Aug 23, 2017

no idea where the problem could be.

@pfabrici

This comment has been minimized.

Show comment
Hide comment
@pfabrici

pfabrici Nov 8, 2017

Same problem here. So far I built a workaround for that by replacing a couple of lines in kimai/extensions/ki_invoice/print.php and private_func.php.

In print.php (line 159ff)

//$model->setBeginDate($beginDate);
$model->setBeginDate(date("d.m.Y",$beginDate));
//$model->setEndDate($endDate);
$model->setEndDate(date("d.m.Y",$endDate));
//$model->setInvoiceDate(time());

In private_func.php (lines 241ff / version 1.19 )

// added date function to the format start and end properly
// $arr['start'] = $entry['start'];
$arr['start'] = date("H:i",$entry['start']);
//$arr['end'] = $entry['end'];
$arr['end'] = date("H:i",$entry['end']);

With that change I was able to use row.start and row.end in the odt templates again. Still, I am mising ome other vars I used before in my templates.
As I do not know the side - effects of my change I am unsure if its safe to change

pfabrici commented Nov 8, 2017

Same problem here. So far I built a workaround for that by replacing a couple of lines in kimai/extensions/ki_invoice/print.php and private_func.php.

In print.php (line 159ff)

//$model->setBeginDate($beginDate);
$model->setBeginDate(date("d.m.Y",$beginDate));
//$model->setEndDate($endDate);
$model->setEndDate(date("d.m.Y",$endDate));
//$model->setInvoiceDate(time());

In private_func.php (lines 241ff / version 1.19 )

// added date function to the format start and end properly
// $arr['start'] = $entry['start'];
$arr['start'] = date("H:i",$entry['start']);
//$arr['end'] = $entry['end'];
$arr['end'] = date("H:i",$entry['end']);

With that change I was able to use row.start and row.end in the odt templates again. Still, I am mising ome other vars I used before in my templates.
As I do not know the side - effects of my change I am unsure if its safe to change

@dhe001

This comment has been minimized.

Show comment
Hide comment
@dhe001

dhe001 Nov 8, 2017

sorry for my late response ... we changed in the meantime the

private_func.php
...
//$arr['start'] = $entry['start'];
$arr['start'] = date('Y-m-d H:i:s', $entry['start']); // Changed after ODBC Problem
//$arr['end'] = $entry['end'];
$arr['end'] = date('Y-m-d H:i:s', $entry['end']); // Changed after ODBC Problem
...

This works for us, all the Dates/Times are correct now. Please have in mind that this may not work for all environments...

dhe001 commented Nov 8, 2017

sorry for my late response ... we changed in the meantime the

private_func.php
...
//$arr['start'] = $entry['start'];
$arr['start'] = date('Y-m-d H:i:s', $entry['start']); // Changed after ODBC Problem
//$arr['end'] = $entry['end'];
$arr['end'] = date('Y-m-d H:i:s', $entry['end']); // Changed after ODBC Problem
...

This works for us, all the Dates/Times are correct now. Please have in mind that this may not work for all environments...

@simonschaufi

This comment has been minimized.

Show comment
Hide comment
@simonschaufi

simonschaufi Jan 14, 2018

Member

since we don't have any data how to reproduce this bug, we can't do anything about it. Could you please provide a dummy database dump with the odt file? Then we might be able to do something about it.

Member

simonschaufi commented Jan 14, 2018

since we don't have any data how to reproduce this bug, we can't do anything about it. Could you please provide a dummy database dump with the odt file? Then we might be able to do something about it.

@simonschaufi simonschaufi reopened this Jan 14, 2018

@mindhaq

This comment has been minimized.

Show comment
Hide comment
@mindhaq

mindhaq May 3, 2018

Contributor

I can confirm having this bug, running Kimai v1.2.2.1394

When exporting the timesheet with a custom ODS template, some begin and end times end up being wrong times around 15 o`clock. This is not during export or anywhere else, only in the invoice, and for six out of 30 entries on that invoice.

I can't create a complete dump right now, but the following line (exported from phpMyAdmin)

INSERT INTO `kimai_timeSheet` (`timeEntryID`, `start`, `end`, `duration`, `userID`, `projectID`, `activityID`, `description`, `comment`, `commentType`, `cleared`, `location`, `trackingNumber`, `rate`, `fixedRate`, `budget`, `approved`, `statusID`, `billable`) VALUES
(432, 1523447097, 1523461522, 14425, 552507799, 6, 3, NULL, NULL, 0, 0, NULL, NULL, '0.00', NULL, NULL, NULL, 1, NULL);

turns into

11.04.2018 15:23:43 15:23:44

where it should be

11.04.2018  13:44:57  17:45:22

This is the template I'm using:
timesheetRS.ods.zip

Because of the random nature of the bug, this is hard to spot. I almost sent out an incorrect invoice, but luckily double-checked if the template is working (I used CSV exports before, which don't have the problem)

Contributor

mindhaq commented May 3, 2018

I can confirm having this bug, running Kimai v1.2.2.1394

When exporting the timesheet with a custom ODS template, some begin and end times end up being wrong times around 15 o`clock. This is not during export or anywhere else, only in the invoice, and for six out of 30 entries on that invoice.

I can't create a complete dump right now, but the following line (exported from phpMyAdmin)

INSERT INTO `kimai_timeSheet` (`timeEntryID`, `start`, `end`, `duration`, `userID`, `projectID`, `activityID`, `description`, `comment`, `commentType`, `cleared`, `location`, `trackingNumber`, `rate`, `fixedRate`, `budget`, `approved`, `statusID`, `billable`) VALUES
(432, 1523447097, 1523461522, 14425, 552507799, 6, 3, NULL, NULL, 0, 0, NULL, NULL, '0.00', NULL, NULL, NULL, 1, NULL);

turns into

11.04.2018 15:23:43 15:23:44

where it should be

11.04.2018  13:44:57  17:45:22

This is the template I'm using:
timesheetRS.ods.zip

Because of the random nature of the bug, this is hard to spot. I almost sent out an incorrect invoice, but luckily double-checked if the template is working (I used CSV exports before, which don't have the problem)

@simonschaufi simonschaufi self-assigned this May 8, 2018

@mindhaq

This comment has been minimized.

Show comment
Hide comment
@mindhaq

mindhaq Jun 3, 2018

Contributor

I can confirm this bug again with Kimai v1.3.1.1394

Contributor

mindhaq commented Jun 3, 2018

I can confirm this bug again with Kimai v1.3.1.1394

simonschaufi added a commit that referenced this issue Jun 11, 2018

Convert timestamps to ints for proper rendering (Fix for #1032) (#1204)
* Convert timestamps to ints for proper rendering (Fix for #1032)

@simonschaufi simonschaufi added this to the 1.4 milestone Jun 24, 2018

@simonschaufi

This comment has been minimized.

Show comment
Hide comment
@simonschaufi

simonschaufi Jun 24, 2018

Member

fixed.

Member

simonschaufi commented Jun 24, 2018

fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment