When I add a timetracking to an invoice, it doesn't fill in the duration unit nor the rate for the item description. It is calculating the total correctly, though.

I've attached an image showing what it generates.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

juliangb’s picture

Which price mode are you using on the organization and project?

Francewhoa’s picture

davad, have you tried the steps at http://drupal.org/node/854056 ?

davad’s picture

#1 I'm using the hourly price mode for both organization and project.

#2 I'm sorry, I don't see how that link helps. I've been using storm as a timetracker/invoice generator for some time now. After the latest time I upgraded the storm modules, I now have this problem when I add timetrackings to an invoice. For some reason it doesn't pull the duration unit or the rate for my hourly timetrackings.

juliangb’s picture

Do you remember which version you updated from?

If we can narrow down when this worked for you, and when it didn't, it will help us figure out if there is a specific change that stopped this from working.

davad’s picture

Looks like I upgraded from 6x-2.0 to 6.x-2.1 on December 27, 2012.

juliangb’s picture

That's odd - there weren't many changes between then.

(Do you remember whether it was working in 2.0?)

Is there any chance that you could try reproducing the problem on the demo site at http://live.d6-storm.gotpantheon.com/storm ? That way, if the problem exists there, I can see all of the settings and debug more easily.

juliangb’s picture

I've now reproduced this error.

Note, I also get a PHP error, which may be related:

warning: Invalid argument supplied for foreach() in /[path]/modules/storm/storminvoice/storminvoice.module on line 754.

http://drupal-6-storm-project-management.beta-web.co.uk/node/4

juliangb’s picture

Another link, that reproduces the problem more closely to the original screenshot.

http://drupal-6-storm-project-management.beta-web.co.uk/node/6

juliangb’s picture

I think I've spotted what is going on...

Just noting here to capture the info.

- In storminvoice.module (lines 1022 onwards), the text string is prepared
- It uses elements of $node, which will be the timetracking
- Whereas, the node that the info comes from is actually the project.

Needs to be changed to use the correct element of the "rate array", where this information is stored.

davad’s picture

Glad to hear it's reproducible :)

How is it supposed to grab the rate info? I've noticed that there are a couple places that you can set the rate (under organization, project, and task I think). Is it supposed to check each in turn or are some of those rates meant to capture other information?

juliangb’s picture

The logic is actually quite clever (I didn't design it, so can say that!)

For a timetracking, it will first try to capture the information from a ticket, then move up the hierarchy through to task, project, and finally organization.

This means that you could set a default method for an organization, then override for a particular project or task.

davad’s picture

Anything I can do to help? If I don't get a response, I'll probably try to dig into the code from the notes from #9.

juliangb’s picture

Sorry for the delay - lots to do on Storm at the moment and had been working on the rename.

I will try to post one soon.

juliangb’s picture

Version: 6.x-2.1 » 6.x-2.x-dev
Status: Active » Needs review
FileSize
3 KB

Here's an initial patch.

It will probably fail the testbot - this is expected at the moment.

It also needs significant manual testing.

juliangb’s picture

Note, from my testing, this doesn't get rid of the PHP warning, but I think it fixes the invoice item description.

Francewhoa’s picture

Status: Needs review » Needs work
FileSize
37.17 KB
84.65 KB

I tested patch in #14. Thx :) Bug is fix for rate, but bug is still present for hours.

Steps to reproduce bug
* Set Organization "Price mode" to "Hourly" $101
* Set Project "Price mode" to "Hourly" $102
* Set Task "Price mode" to "Hourly" $103
* Create ticket set "Price mode" to "Not Applicable"
* Add timetracking 1h
* Add timetracking to a new invoice. Storm will display the rate, the hours read 0h. Expected result is Hours should read 1h.

Notes
* Possible source of the bug. If you edit the ticket, set the "Duration" field to 2h, then add timetracking to a new invoice the invoice will display 2h. If you go back to edit the invoice set "Duration" to 0h and the "Price mode" to "Not applicable". Then add timetracking to a new invoice the invoice will display 0h. But it should display the rate set in the organization, or project, or task. In other words the hourly rate should be read in the following order: ticket > task > project > organization. If no hourly rate set in those then storm should display the usual message "Error whilst finding a rate from ticket, task, project and organization. Consider setting the pricemode and price for your client organizations to avoid this error."
* I also see the following error message but I ignored it as it's not yet fixed
warning: Invalid argument supplied for foreach() in [***]/storm/storminvoice/storminvoice.module on line 754.

Tested with
* Fresh D6.27
* Fresh Storm 6.x-2.x_2013-Feb-9
* Hourly rate under organization, project, task, ticket
* Tested by creating a ticket then create a timetracking item

Francewhoa’s picture

FileSize
77.94 KB

Confirming same bug is present in Storm 6.x-2.0 Last updated: February 19, 2012 - 03:35

Steps to reproduce: Find above comment #16

Tested with Drupal 6.28

Francewhoa’s picture

Hope this helps to narrow down the source :)
Confirming same bug is present in Storm 6.x-2.0-beta1 Last updated: January 21, 2012 - 06:55

Steps to reproduce: Find above comment #16

Tested with Drupal 6.28

Francewhoa’s picture

Good news :)
Confirming bug is not present in Storm 6.x-1.37 Last updated: January 3, 2012 - 11:35

Tested with Drupal 6.27

Tests show that bug was introduced in Storm 6.x-2.0-beta1 Last updated: January 21, 2012 - 06:55

List of all changes in 6.x-2.0-beta1

Changes related to invoice only
- Feature #902962 by kfritsche: Added views support for storm icon and invoice status
- Feature #1178694 by juliangb | asb: Add currency to invoice node display.
- Bug fix by kfritsche: Fixed cannot paginate through expenses, invoiced and timetrackings without filtering date
- Task #1153672 by kfritsche: Added Views dateAPI support for expenses, invoices, tickets and timetrackings
- Feature #1018304 by jalama: Added Token support for Storm invoice.

juliangb’s picture

Assigned: Unassigned » juliangb

Thanks for the testing Francois!

I'll take another look at this.