Closed (fixed)
Project:
Commerce Discount
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
23 Oct 2015 at 19:08 UTC
Updated:
8 Dec 2015 at 22:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
nvahalik commentedFirst stab. I somehow managed to do this patch just as mglaman was working on his vertical tabs stuff, so I had to rework it a bit. The only change required was to undo a part of the alter function he added that blew away the additional_settings changes. Otherwise, this patch seems to work OK testing against the latest Commerce Kickstart 2.x.
This patch also adds an update hook which disables the modules, but it likely needs to best tested thoroughly. It disables the modules in the update but might very well break because not all of the functions were renamed, so that is some clobbering that might happen. I'm thinking that what might need to happen is just emptying out the existing modules and leaving a .module and a .info so that the parent module can disable them but there won't be any functions laying around. Then again, this is my first time to try something like this and I'm not sure what's the best way to approach it. Caveat utilitor and all that.
As much as possible the individual modules' logic and such were put into the main commerce_discount module. If there is something missing, it likely got left out in the mess that the git pull did. Oh well.
Comment #3
nvahalik commentedScratch that. I swapped my diff params!
Comment #6
nvahalik commentedMaybe I should say "please?"
Comment #7
nvahalik commentedMaybe I should say "please?"
Comment #9
mglamanYour patch doesn't delete the submodule, so the test class exists twice, giving error.
Comment #10
nvahalik commentedFixed the URLs in the test suites. Delete the test modules and comment them out in the .info files.
Also, the patch in #2557247: Add vertical tabs to the discount configuration form blows away anything in $form['commerce_discount_fields']['additional_settings'], so I had to change it a bit so that it doesn't remove anything:
Comment #12
nvahalik commentedPatched against latest HEAD.
Comment #13
joelpittetSorry I made a change that I should have mentioned earlier to you.
It got mixed about in this patch.
don't change.
sass not scss folder.
Comment #14
mglamanWe should consider #1838350: Make usage transactional when working on this. Or at least discuss it.
Comment #15
nvahalik commented@joelpittet, No worries. I've been rebasing before re-rolling and it has been doing the hard work of fixing the patch. ;)
@mglaman, Re #14, That's a feature request and is outside the scope of a patch like this.
Comment #16
nvahalik commentedAdding fieldset summaries.
Comment #17
nvahalik commentedMeh. Fixed some missing newlines.
Comment #20
nvahalik commentedFixing the test.
Comment #21
mglamanTagging for manual testing. It'd be great to find some sites using Discount heavily and running this patch and upgrade process on a dev server.
Comment #22
joelpittetI've manually tested this and it updated without a hitch. I'm looking for at least one more manual test on an existing site (hopefully in dev environment) to try this.
Comment #23
neograph734I have been clicking through the patched version, but it seems to be working fine.
Update went smooth and all pages and discounts apply as expected.
The only thing I somewhat dislike is the remains of the submodules which are now marked incompatible with D7. I suppose this is done to prevent function name conflicts as explained in #2. And under no circumstance we want the old function in the submodule and the new function in the core module to be enabled at the same time. I suppose we'd need to get rid of them now or have them stick around forever.
This made me wonder what would happen if I would just delete the submodules. So I enabled the core and submodules, patched them, removed the folder containing the submodules and requested another page. Then I ran update.php.
This worked fine, so I suggest removing the submodules completely and not to leave them hang around as an incompatible module.
Apart from the issue above I'd say this is RTBC.
Comment #24
mglamanThe problem is the record left in the system table. Commerce Kickstart 2 actually has a function for this we could copy and run in the upgrade
Comment #25
neograph734After patching the module, the info files (and submodules) remained in place, but the 'core' property has been removed from the info files. So I doubt it is the system table. In fact I think it persists in the system table because module_rebuild_cache() is still detecting an info file.
I believe the patch should delete the old module files and then we can start thinking about deleting the records in the system table.
Comment #26
nvahalik commentedRemoved the module stubs.
Updated the update hook to forcibly remove the old sub-modules.
Tested in latest Commerce Kickstart... works like a charm.
Comment #27
nvahalik commentedComment #28
neograph734Interdiff looks ok, will try this in dev tomorrow.
Comment #29
joelpittetThis looks better to me @nvahalik. Just a little nitpick.
Good idea, then it won't try to delete the fields and run the uninstall hooks and field deletions
Can you add the comment about this being "Migrate from commerce_discount_max_uses to discount_usage_limit." So that it's clear what this is doing?
Comment #30
mglamanI'm going to RTBC ahead of nvahalik addressing nitpic in #29. Just tested this on a site with 35+ discounts using usages and dates. No integrity issues!
Comment #31
joelpittetOk great, fixed nit on commit.