Hook and Plugin Question

This forum is for programmers who have questions about the source code.
Post Reply
User avatar
drtech
Posts: 1647
Joined: Wed Jun 20, 2007 8:44 am
Location: Springfield, MO
Contact:

Hook and Plugin Question

Post by drtech » Sun Feb 24, 2013 7:07 pm

I have utilized many hooks for my plugin, but can't seem to grasp what should be a simple concept...

Can we create a hook that simply replaces one "if" statement and then returns directly to the original code and follows the plugin hook's "if" result rather than the original?

Previously all my hooks have been at the beginning or end of a code block and do not need to pass that kind of logic info back to the existing code...

The only way I am seeing something like that working is to actually pass a value back from the plugin and then have to modify the original "if" statement in accordance with the new value...is there a better way that I don't know about? Currently, I keep having periodically patch one line in the downloaded svn main file to make OD behave the way I want without replacing that entire block of code in my plugin...

Thanks.
David Fuchs
Dentist - Springfield, MO
Smile Dental http://www.887-smile.com

User avatar
jordansparks
Site Admin
Posts: 5739
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Re: Hook and Plugin Question

Post by jordansparks » Mon Mar 18, 2013 11:02 am

I think it's a good idea for us to consider and to look into. But it would take days of valuable programming time. I don't think we have the resources to add any more "features" to plug-ins right now. We're really swamped with EHR 2014, etc.
Jordan Sparks, DMD
http://www.opendental.com

User avatar
drtech
Posts: 1647
Joined: Wed Jun 20, 2007 8:44 am
Location: Springfield, MO
Contact:

Re: Hook and Plugin Question

Post by drtech » Mon Mar 18, 2013 7:22 pm

How about if the hook returns false, then nothing happens, but if it returns positive(hook exists), then we could add a "goto:label" line to skip a section of code? That would seem to be simple to implement...
David Fuchs
Dentist - Springfield, MO
Smile Dental http://www.887-smile.com

User avatar
jordansparks
Site Admin
Posts: 5739
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Re: Hook and Plugin Question

Post by jordansparks » Thu Mar 21, 2013 9:08 pm

Yeah, that's fine. Oh goodie, an excuse to finally use the goto.
Jordan Sparks, DMD
http://www.opendental.com

Post Reply