I have a customer where we charge a fixed rate per visit (i.e. per timetracking record) so the organisation, project (and task although we're not using this but I tested it) price mode is fixed and a price is given.
When the timetracking records are are sent to an invoice, the prices are all blank.
This is a new install of Storm.
I have also considered adding a new price mode of "per visit" but I don't know how Storm will handle this on the invoices.
| Comment | File | Size | Author |
|---|---|---|---|
| #38 | storm_735694.patch | 7.39 KB | tchurch |
| #35 | storm_735694.patch | 6.43 KB | tchurch |
| #31 | storm_735694.patch | 6.2 KB | tchurch |
| #18 | stormtimetracking_fix735694.patch | 4.8 KB | tchurch |
| #16 | stormtimetracking_fix735694.patch | 4.8 KB | tchurch |
Comments
Comment #1
tchurch commentedIf anyone is interested, I'm working on changing the timetracking module myself to do this.
I can send someone the updated files to check and add to CVS if you want as I'm not up to speed yet on standards and how to patch.
Comment #2
juliangb commented@tchurch, please do post the files here.
I would strongly encourage you to venture into the world of patching though - it is really useful to be able to see the specific change that has been made. There is a good drupal specific guide about how to do it here - http://drupal.org/patch/create.
Comment #3
tchurch commentedThanks for this.
I think I've managed to make the changes I need to this module to fix this. I'll do some more testing over the next few days.
I'll use this issue as my first try at using CVS/patches and then upload the files.
I think it's about time I started going deeper into Drupal in general and helping out where I can.
I have assigned the issue to me. It this is wrong, please correct and let me know.
Comment #4
tchurch commentedOK. Can someone check this for me. I've managed to check a patch file using diff (not in CVS) for the timetracking.module file.
I created the patch against the current dev version although I see no difference between 1.31 and dev for this file.
It was also created on a windows PC using UltraEdit and cygwin.
It took me a little while to create the patch because I had to separate this update from other changes I've made which are specific for a customer (different calculation for invoice number).
Let me know.
Thanks.
Comment #5
juliangb commentedThe testbot needs the status to be 'needs review' to look at the patch...
Comment #7
tchurch commentedCan someone help me with this?
The patch works for me but maybe I haven't created it properly.
I used 'diff' to create it and not 'cvs diff' (I haven't got around to looking at how this works yet).
Comment #8
juliangb commentedThe testbot is probably complaining because the patch diffs that one file, rather than being relative to the root directory - basically it doesn't know where to find the file. This can be got around by diffing the whole storm directory.
However, when I tried to apply the patch manually, I got errors with the first hunk. Are you sure that the patch is against a clean copy of the file?
Comment #9
tchurch commentedI downloaded the lastest dev version and used a clean stormtimetracking.module file.
I noticed that the dev version and the current 1.31 version of this file were the same.
I've made several other changes to this file in my environment so had to separate each of the changes into separate patch files, each patch file was based on the original dev version.
I placed my new files in the storm/stormtimetracking directory, along with the originals and did the 'diff' commands using cygwin from here to create the patches.
If I apply the patches (both my private one and this one) to the original file, they work OK and the new module file also works.
Not sure what I can do now. Any thoughts?
Comment #10
juliangb commentedWere any of your other patches applied before making this patch?
What happens if you get a clean -dev version and apply the patch. Does it work for you then?
Comment #11
tchurch commentedI downloaded the actual 1.31 version this time (where I applied my patch but 1.31 and -dev versions of the file are the same).
When I created the patch last time, I created it in the timetracking directory.
This time I created it in the root storm directory.
Also, each of my changes I made were made in separate copies of the original file, so that I now have patch files for each of my own changes too.
Hopefully I can keep track of my own changes better.
Comment #12
juliangb commentedOK - testbot is happy, so i've gone through the code in some more detail now. Please don't be offended if we pass the code back and forth a couple of times like this. I know it's annoying, but for things like coding style (see http://drupal.org/coding-standards), it's really helpful for people who later come to make changes to the module if the whole lot follows a similar style.
Please could we avoid using globals whereever possible? (Simply to avoid any conflicts with other modules etc.) Perhaps these could be returned by the function?
Please use two spaces rather than a tab.
Tab indentation - please use two spaces instead.
Tab indentation.
Could we rebalance the lines now? Perhaps split at the sentence break?
As above.
As above.
Tab indentation.
Indentation.
In general though, seems like quite logical changes.
Thanks for your efforts in getting the patch done. Hope that the experience with patching will help you too!
Powered by Dreditor.
Comment #13
tchurch commentedI'm glad it passed this time.
I have this patch installed on my customers website anyway so I can spend some time now working on meeting the standards (I had a feeling I would need to make changes for this anyway and I don't mind the feedback).
This is my first patch and my first time patching in Drupal so I'm glad for the help and glad to get involved.
I'll look at the points you made and make the corrections then repost.
Comment #14
tchurch commentedI think I've changed all these parts now. I also found another problem with getting the tax1_percent.
It was trying to get the wrong variable.
Comment #15
juliangb commentedOne more code style bit, and then I'd just like to apply and test it. Also happy if someone else were to test applying the patch / the functionality and report back / mark rtbc.
Tab indentation. Spelling error on 'use_houlry'.
Powered by Dreditor.
Comment #16
tchurch commentedcorrected.
Comment #17
juliangb commentedNot quite...
Spelling error - 'use_houlry'
Powered by Dreditor.
Comment #18
tchurch commentedNo comment :).
Corrected.
Comment #19
juliangb commentedCode looks good to me now. Will try to test today.
Comment #20
juliangb commentedTesting this - I wonder whether we're going down the right direction with it.
Created a fixed price project, and timetracking from that.
Without the patch - autoinvoice entry shows "1 hour unbilled work...." zeros in price.
With patch - autoinvoice entry shows "1 hour unbilled work..." and cost of project in price.
Wondering whether we're trying to solve the problem the wrong way around - I think what we should actually be working on to get what you want is the ability to add an entire project / task / ticket to an invoice at once. Then you'd get a line for the fixed cost of project, then zeros for the unbilled time.
Am I getting this correctly?
Comment #21
tchurch commentedWell, I think this brings up more issues about what items could be passed onto an invoice (timetracking, whole task or whole project).
In my customers usage, the project/task stays open as it's for an ongoing or open contract for services.
They have agreed a fixed rate per visit (i.e. timetracking record) no matter how long the visit.
I suppose it could be useful to look at the ability to invoice a whole task or project but then one would have to stop users adding new tasks to already billed projects and timetracking to already billed tasks/projects.
At the moment my customer hasn't asked about this but they could always create a manual invoice for the task/project, if needed.
I think my main aim here was to get the fixed rate working for timetracking.
If people still want zero priced timetracking records on the invoices I think it should work with fixed/0 on the project/task.
Comment #22
tchurch commentedAlso, in looking into issue #744690: Names for tax1 and tax2 on all node views not taken from database, I found that the field totalcustomercurr for the invoice is not set correctly when adding a timetracking record to an invoice (existing or new).
Should I raise a new issue/patch or merge with this one?
Comment #23
juliangb commentedAlways separate patches if possible.
OK so we here we have two distinct ways of using the fixed price in the project / task - you're using it as fixed per timetracking, and the other way is fixed per 'item' with all timetrackings included.
Perhaps we could find a way of separating these so that it is as expected for all users?
Comment #24
tchurch commentednew issue #746420: field totalcustomercurr for invoice not set correctly when adding timetracking record to invoice raised
Comment #25
tchurch commentedContinuing on from #20 and #21, I was wondering if we could get this into the next version.
As far as I see, it wouldn't affect existing users of storm as the timetracking/fixed function didn't do anything before.
I have a customer who is going to be using this function for fixed rate timetracking billing.
Would/should I re-write the patch against the current -dev version?
Thanks.
Comment #26
juliangb commentedSorry, I've been a bit lax about getting back on this one.
My issue is that there seem to be a couple of interpretations of 'fixed':
- The project/task/ticket is a fixed price, so all timetrackings as part of that are unbilled and zero cost.
- Each timetracking is fixed price, based upon the price agreed per project.
The former is what it is set up for at the moment, the latter is what you want.
Especially, I think the concept of seeing 'unbilled' followed by a non-zero price a bit confusing.
I had been meaning to set in and code something for this but haven't got around to it yet. What needs to happen though is something that will allow for both those cases above. I'm happy to hold the next snapshot release if this issue seems to be making progress.
Comment #27
tchurch commentedThis could get a bit complex, I think, although it might need to be.
As far as I see in the current module at the moment it works like this:
- only timetracking records can be added to invoices if they are set to billable.
- it uses the hourly/daily or zero (if fixed rate) from organization/project/task/ticket although it doesn't stop at the first one it finds (it ignores "Not applicable").
My current patch would make the following change:
- when adding a billable timetracking record to an invoice, it will take the first houlry/daily or fixed rate from the first one of ticket/task/project/organization that contains an houlry/daily/fixed rate. If it's "Not applicable", it's ignored.
- Fixed rate would now mean that the timetracking record is billed at a fixed rate instead of calculated for hourly/daily.
Currently there is no way to bill for an entire ticket/task/project although one could add a manual item to the invoice for it.
It might be better then to leave the current fixed price mode function as it is and look at creating new pricing modes for "fixed time" (for this issue) and then maybe others for "fixed project", "fixed task" and "fixed ticket" (although this needs more discussion about the correct solution).
That way, the current fixed function is not affected but anyone (like my customer) who wants to charge fixed rate for a timetracking record can do that.
What do you think?
Comment #28
juliangb commentedI like the idea of a 'fixed xxx' mode, whereby the xxx is the type of entity that is that price.
Comment #29
tchurch commentedIf agreed, I'll re-work this solution so that it uses a new price mode ("fixed_timetracking") and the function for "fixed" is kept as it currently is.
I'll then open a feature request issue for the project/task/ticket billing to invoice. I might even be able to work on that solution although that'll be a BIG change for me and could take some time.
:)
Comment #30
juliangb commentedGreat.
There is already a feature request for the project/task/ticket billing: #567558: Extend auto-billing to other types of Storm node.
Comment #31
tchurch commentedOK.
I've attached a CVS diff patch this time against the current dev version.
Comment #32
tchurch commentedsorry, retest against dev.
Comment #33
tchurch commented#31: storm_735694.patch queued for re-testing.
Comment #34
juliangb commentedOk, there are some really minor stuff below - but my main question is - will this patch give a situation where a non-zero price is put onto the invoice but with the description of "unbilled"? For me, that is quite confusing. I'll admit I haven't tested it yet (limited internet access this week), but from my read through I think it will show that.
Lets use "Timetracking" rather than "TimeTracking"
Trailing whitespace.
Trailing whitespace.
Trailing whitespace.
Powered by Dreditor.
Comment #35
tchurch commentedOK. fixed.
To answer your question, I looked at the code again and made a small change.
If the rate returned is 0 it will use the 'unbilled' text for the invoice.
i.e.
if you use 'fixed' ticket/task/project/organization (the original fixed) with a price, it will assume that the rate is 0 for the transfer of the timetracking record to the invoice. Therefore it will use the 'unbilled' text.
If you use 'not applicable' and therefore finds no ticket/task/project/organization it will also assume rate of 0, as above.
Comment #36
juliangb commentedOK. As I said before, my web access is a bit limited this week, but will test it out and feedback.
Comment #37
juliangb commentedThe db update needs a doxygen style comment, as this really helps when updating via drush.
But more importantly, the invoice line needs a bit of clarifying still - we have "01 Apr 10: 0.0333333 hours work at 10000 per hour on Fixed TT mode". I don't think it should be 10000 per hour in one of the fixed modes.
Comment #38
tchurch commentedI've corrected the invoice line description now.
I wasn't sure what and where to put the comment as there are no other comments in the .install file so I've done my best.
Let me know if it's not correct.
Comment #39
juliangb commentedCommitted, thanks for you work pushing this.