Closed (won't fix)
Project:
CiviEvent Discount
Version:
6.x-1.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
31 Jan 2012 at 02:46 UTC
Updated:
23 Mar 2012 at 17:08 UTC
Hi - a client has expressed some curiousity about this module - they are on D7 - and I gather the MIH didn't happen on this. So just wondering where you are at with the module - whether you see a D7 version as a wise move - or what?
Comments
Comment #1
dharmatech commentedPete,
A D7 version would be nice... several folks have asked about it and there have been rumblings that someone started it but I haven't seen any code yet. I would guess it's 20-30 hours of work and I don't think it will be a simple copy/paste job into a D7 module. It's too bad the MIH didn't happen as that would have been the most cost effective (and long-term) solution.
Comment #2
petednz commentedYep shame indeed. These clients could probably see value in funding about 10% of the work. Hard to track down the old MIH - do you recall what the core team were thinking?
Comment #3
dharmatech commentedhttp://forum.civicrm.org/index.php?topic=19249.0
The MIH would have paid to incorporate all current functionality of discounts (events, price sets, memberships) into core. Really surprised the Joomla guys didn't push harder for this as they would benefit the most.
If your client is interested in sponsoring the D7 version, it might be worth throwing everything "as-is" into a D7 compatible module just to see what works and what doesn't.
Comment #4
lobo commentedThere is talk about a "CMS" independent module extension to CiviCRM MIH for 4.2 i.e. use only civi hooks dont use any cms specific hooks. I think if that happens, we should try to get another MIH going to port event discount to that structure.
Eventually we'll have some joomla or wp folks wanting it and willing to fund it
lobo
Comment #5
dharmatech commented@lobo the CMS independent module approach would be great. Might give us an opportunity to improve some of the hooks as well. We hit some limitations with things we just can't do (like removing the discount "count" when contacts are deleted or removed from events). In addition, the code gets pretty hairy trying to handle memberships, events and price sets exclusively with hooks.
@petednz in the meantime, anyone on staff want to take a stab at the D7 version... just pulling the D6 code into a D7 module and see what happens?
Comment #6
petednz commentedsure - we can sink a couple of hours exploration in to this
Comment #7
petednz commentedooh - never assigned a Drupal Issue to us before ;-)
Comment #8
dharmatech commentedThanks Pete, should provide a good starting point for the D7 version. Feel free to post back a patch or tarball and I'll create the 7.x-1.x-dev branch.
Comment #9
dharmatech commentedPete, have you guys had a chance to dig into a D7 version?
Comment #10
torrance123 commentedI put in about an hour and a half into migrating this module. I made some rapid initial progress in rewriting the civievent_discount.install file and the hook_menu calls to be d7 compatible (and came across numerous bugs in the install file too — there were a lot of naked strings that were improperly behaving as constants).
However as I moved into the civievent_discount.admin.inc file to start getting some of the page callbacks working, I quickly ground to a halt. The code here is quite dense, the functions are mostly very large and there's a lot of d6 db api use here that needs to be turned into d7 db api calls. I would estimate a couple days work to get this file migrated and I think it would benefit enormously from a bit of a refactor to bring down those functions to smaller sizes and make the code a bit more manageable. Same goes for the main .module file.
Sorry I can't be of more help at this stage, though I might return to this at some stage with a more reduced scope for the initial migration.
Comment #11
dharmatech commentedI'm not sure I agree that the module would "benefit enormously" from refactoring since function size of "mostly very large" is subjective. It's broken into manageable (read logical) chunks without turning it into a game of follow the leader. I tend to value refactoring more in cases where the code needs to be shared (w/other modules, APIs, data sets, etc.) or where there are performance benefits. In my experience, if it's concise and logical and limits the use of comments only to describe "the what" and not "the how" it's far more readable and manageable by the community as a whole.
Of the 45 functions in civievent_discount.admin.inc there are only a couple that don't comfortably fit into "one page" on the screen. One builds a large form, so no getting around it really and the other spits out a table of how the codes have been used. If there's a chunk of discrete logic that can be thrown into a function, I've tried to do that. If you see room for improvement, patches are always gladly accepted.
On that same note, please submit any improvements you've made to the .install file especially if you've found bugs.
Comment #12
kenyan commentedAny progress guys?
What would it take in help (financial) to get this running?
Comment #13
dharmatech commentedAndrew,
Lobo and I ported this module as a CiviCRM extension (v4.1.x+) ... which means it's independent of the CMS and works on any Civi supported platform. It's on github currently and still being tested but should be released very soon.
Comment #14
kenyan commentedOh Bless you guys then.
Comment #15
boyron commented@dharmatech, can you give us the github link? That would be really helpful.
Comment #16
dharmatech commented@boyron, I added the link on the project page under CiviCRM 4.1.x and above (Drupal 6 or 7). The extension should be considered beta and the schema could change again in the future, so keep that in mind when/if you deploy it to production.