Closed (fixed)
Project:
Ubercart Price Per Role
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
4 Mar 2011 at 01:12 UTC
Updated:
20 Sep 2011 at 22:21 UTC
Jump to comment: Most recent file
Comments
Comment #1
horuskol commentedI have a patch ready to commit in git, but I don't know what version to apply - should it be 6.x-1.1 or master?
Comment #2
horuskol commentedPatch file built against master (6.x-1.1)
Comment #3
horuskol commentedForgot to set to "needs review"
Comment #4
fenstratYour patch includes uc_price_per_role.module twice, once diff'd against itself and once against /dev/null - you need to remove the second one.
As for the change it does seem logical. The {uc_price_per_role_prices} table is storing prices per revision but as you've noted hook_nodeapi() is deleting all revisions when a node is updated.
Comment #5
horuskol commentedI just had a look, and it seems the patch has also caught the backup file that Kate automatically generates (you can tell by the ~ at the end). I guess because this file doesn't exist, it's diff'd against /dev/null - sorry. I've learnt to read the patch file to make sure this happens again.
I have rebuilt and re-uploaded the patch (after checking).
In hindsight - I think the problem was the use of 'git add -a' from the instructions... looks like git doesn't ignore "hidden" files on that switch.
Comment #6
fenstratGood to go. Does what it says on the box. Revision prices don't get nuked on node update.
Also, I'd say that this is totally superfluous as it's not run on node update any more. There should never be any prices in {uc_price_per_role_prices} on node insert as this is a new node.
Comment #7
fenstratWhoo, I just realised that the patch in #5 doesn't do what is intended in all cases.
It does achieve the goal of not nuking any previous revision prices. However if you resave a node with revisioning disabled then you'll get 2 entries in the {uc_price_per_role_prices} with the same nid and vid. Problem. So what needs to be done is a query to see if there is any entry with the nid and vid if so update, otherwise insert.
Comment #8
fenstratThis is a far more straight forward approach. It only removes the current vid about to be saved.
Comment #9
horuskol commentednice catch - hadn't thought about non-revisioned systems.
Comment #10
fenstratRTBC as per #9
Comment #11
longwaveCommitted #8 to 6.x and 7.x, thanks for the patch.