Closed (fixed)
Project:
Drupal.org CVS applications
Component:
new project application
Priority:
Normal
Category:
Task
Assigned:
Issue tags:
Reporter:
Created:
7 Mar 2010 at 02:16 UTC
Updated:
3 Nov 2018 at 16:03 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
fathershawnHere's my module
Comment #2
fathershawnComment #3
fathershawnUpdated code - forgot to implement hook_uninstall to remove the two variables set by this module.
Comment #4
avpadernoHello, and thanks for applying for a CVS account. I am adding the review tags, and some volunteers will review your code, pointing out what needs to be changed.
As per http://drupal.org/cvs-application/requirements, the motivation message should be expanded to contain more details about the features of the proposed module, and it should include also a comparison with the existing solutions.
Comment #5
fathershawnThanks, and I'm happy to give more detail about the purpose of the module.
CiviCRM provides hooks (http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+hook+specifica...) and APIs (http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs) in a manner inspired by Drupal that allow the extension of CiviCRM or the manipulation of its data. One of the core functions of CiviCRM is the ability to expose to a user a form (a profile in CiviCRM terms) to collect contact information. Another core function is the ability to define relationship types and to create a relationship between two contacts. CiviCRM Relate uses Civi's hooks and APIs to combine those two functions.
This is "one-trick pony". It solves a specific problem. There is no other module in contrib that addresses this. The only current solution is to create custom code for each project using hooks and APIs. I had originally written a custom module with the profile and relationship hard coded into the module because I needed this feature for a Drupal/CiviCRM base app that I'm creating. In the course of that work, I hit a snag and sought help on the CiviCRM developer forums (http://forum.civicrm.org/). Other CiviCRM developers said essentially, "That's cool!" so I decided to add code to make it a general solution.
In it's current form, it loads from the civicrm db all the appropriately defined profiles and all the relationships and displays those via select fields in a Site Config. settings page. Those selections are stored as variables and used to match against the profile id, creating the relationship when the appropriate profile id is saved.
Comment #6
avpadernoThank you for your reply.
Comment #7
fathershawnChanged some code formatting to match Drupal standards.
Note that Coder flags the lack of curly braces around table names, but placing them breaks the query syntax and the query is to CiviCRM and is not sanitized through Drupal.Comment #8
fathershawnRevised again, now uses CiviCRM API for all database access and satisfies coding standards.
Comment #9
fathershawnAdded a README with installation and configuration instructions
Comment #10
dman commentedI'm probably unable to judge the actual code going on here without going through a whole civicrm install, but WRT Drupal expectations...
1. use of require_once()
I presume civicrm_initialize() has done something to the include_path already? Because that require_once wouldn't normally work. Not a bug if it does indeed work, and if civicrm isn't set up in a way that allows module_load_include like we'd normally expect. I appreciate that as a 'bridge' module sometimes you have to use non-Drupal conventions when talking to the other side. It just looks like non-drupal-style code.
2. Uneven indentation
Throughout, the close braces seem to be floating a bit. Drupal coding standards have them match.
Seeing as you've run coder.module, I would have thought it would have caught that.
Indenting is uneven in many places.
3. Use t()
Throughout, any place you enter user-facing English text, you should wrap it in t(). This helps English folk too who just want to override the wording.
4. Declare the use of hooks
This was the only func I recognized as a Drupal hook, should probably have had "implementation of HOOK_menu()" or something. I'm not sure from looking at the code if any of the other functions are hooks or unique local functions or specific to the civicrm side of things.
5. CamelCase?
Didn't coder.module warn about this?
If it is due to the civicrm side of things, that's why a doc saying "this is a civicrm callback function" would be the thing here.
6. operators?
I don't think there's anything in the standards about this, but everywhere else in Drupal, we use
&¬and. Is there a reason you need to change the operator precedence here?Also spacing.
Also camelCase. I'd forgive camelCase if it's a civicrm convention for that variable.
...
I'm unable to evaluate it for security WRT integrity of data and data access permissions, but it doesn't introduce anything blatantly unsafe like uploads, XSS or injection. So it's doing nothing wrong there. Which is to say, "probably safe".
Comment #11
fathershawnThank you so much for helping me learn to do things the Drupal way!
The CamelCase names are in fact CiviCRM conventions. I think I've addressed everything else and I've retested the module and it still works!
Comment #12
fathershawnForgot to switch the status...
Comment #13
dgeilhufe@yahoo.com commentedCan't comment on the coding standards which seem to have already been resolved. I can confirm it installs and works as expected with CiviCRM.
Comment #14
avpadernoReviews are not supposed to check if the module installs, and if the module works as expected (in that case, reviews will become a debugging session, and that is not what we want).
I am setting the previous status, waiting for somebody to make a review of the code, and to confirm the previous issues have been resolved.
Comment #15
dman commentedI commented "I'm probably unable to judge the actual code going on here without going through a whole civicrm install, " above. So someone elses assertion that it does indeed work as expected is a constructive addition, thanks for that!
Comment #16
avpadernoThanks, dman, for the confirmation.
Thank you for your contribution! I am going to update your account.
These are some recommended readings to help with excellent maintainership:
You can find more contributors chatting on the IRC #drupal-contribute channel. So, come hang out and stay involved.
Thank you, also, for your patience with the review process.
Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
I thank all the dedicated reviewers as well.
Comment #17
fathershawnProject set up - thanks!
Comment #18
avpadernoComment #19
avpadernoComment #20
fathershawnBulk change? This issue has been closed for 8 years ;-)
Comment #21
avpadernoI am giving credit to the users who participated and adding the default message with the useful links.