There are several things here:
1) When adding an item to the invoice, it seems that the weight is always 0, there it doesn't display in the order added.
2) You cannot use the screens to change the order (i.e. the weight field) for invoice items (but you can for tasks.
3) Even if you manually update the weight in the database (as I do for a customer workaround) the order of the items on the HTML and PDF printouts are not using the weight.
Proposed changes:
1) when a new invoice item is created, it will automatically add 1 to the max weight already in the invoice item table.
2a) Add weight field on the screens for each item (already exists in the database) so that users can edit. This would be a free number not a controlled list as with tasks as the numbers could be high. i.e. My customer has nearly 100 items on some invoices.
AND/OR
2b) create a similar tab as the tasks (under a project node) so that a user can drag/drop items to re-order. This might require more research on my part.
3) Change the sql to order by weight.
I can start this once I get my current issue (#567558: Extend auto-billing to other types of Storm node) committed in the next few days (I hope).
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | 887638.patch | 2.24 KB | tchurch |
| #8 | 887638.patch | 1.86 KB | tchurch |
| #8 | 887638.jpg | 117.54 KB | tchurch |
| #6 | 887638.jpg | 102.74 KB | tchurch |
Comments
Comment #1
juliangb commentedSee also: #771244: Item ordering in Print HTML .
Comment #2
tchurch commentedI have closed #771244: Item ordering in Print HTML as duplicate and will fix the issue along with the other fixes mentioned here.
Comment #3
tchurch commentedNote - fix for point 3 (as from #771244: Item ordering in Print HTML ):
In storminvoice.module, the ordering should be added in the function storminvoice_getitems(), like this:
function storminvoice_getitems($invoice_vid) {
$s = "SELECT sit.* FROM {storminvoice_items} AS sit WHERE sit.invoice_vid = %d ORDER BY sit.weight ASC";
$r = db_query($s, $invoice_vid);
$items = array();
while ($i = db_fetch_object($r)) {
$items[] = $i;
}
return $items;
}
Comment #4
tchurch commentedI'd like to work on this for 1.35.
I have a customer who would like this and I have to keep running manual database updates for it.
Any thoughts?
Comment #5
juliangb commentedNothing to add to your proposed changes.
Comment #6
tchurch commentedI've attached a screen shot of the invoice edit page. It shows a new field for weight. Users can put a number in there.
The smaller the number, the higher on the list (like all other Drupal weight fields).
This field already existed in the DB. I've added it to the edit page.
I'll work on the other bits (and the patch) later.
Any comments?
Comment #7
juliangb commentedHow about moving the weight field to the right of the amount field? This might be a bit easier for those who don't want to change the weight.
As an aside, a nice to have might be to have click-draggable fieldsets. Unless you're particularly keen on working on this though, I'd suggest we make the bug fix as you have been doing and open a new feature request for that.
Comment #8
tchurch commentedPatch and new image.
Comment #9
juliangb commentedWe should use the 'weight' #type.
What does this bit do?
Powered by Dreditor.
Comment #10
tchurch commentedI also forgot to add the fix from #3. Now done.
#withnull - no idea. I copied the code from another field. Now removed.
I'm not too happy with type 'weight'. It makes it a dropdown box, limiting the list to -10 to 10.
I have customers who add (sometimes) approx. 100 items to an invoice and the only real way to get them in the correct order is to have a freetext field.
Currently, I'm running a manual database update against storminvoice_items to order them so numbers can go up to 100 or more.
type 'weight' seems too restrictive to me.
I can set it if that's the general opinion.
Comment #11
juliangb commentedOk, agreed.
Comment #12
tchurch commentedComment #13
juliangb commentedOk, seems good.
Comment #14
tchurch commentedcommitted.