This is CiviCRM - Drupal integration module, currently it is for Drupal7.
By default CiviCRM provides module (civicrm_contact_ref), to create CiviCRM contact reference field for drupal.
This module uses field api and allow to create different types civicrm reference fields, currently it support CiviCRM Event Page reference, Contribution page reference and PCP page reference.
Detail Module functionality is as follow:
Allow following CiviCRM reference fields of type 'Select', 'Radio', 'Check-box', 'Autocomplete'
- Contribution pages with different start date, end date criteria.
- Event Pages with different event start date, end date criteria.
- PCP ( Personal Campaign pages )
Sandbox Project Page: http://drupal.org/sandbox/rajanmayekar/1292200
Git Repository link:git clone --branch 7.x-1.x http://git.drupal.org/sandbox/rajanmayekar/1292200.git civicrm_reference_field
Reviews for other projects
http://drupal.org/node/1538594#comment-6116896
http://drupal.org/node/1605798#comment-6199880
http://drupal.org/node/1538594#comment-6199740
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | drupalcs-result.txt | 1.91 KB | klausi |
Comments
Comment #1
gregglesIt's hard to get a review of civicrm projects. If you can I suggest getting someone familiar with civicrm to provide a review. http://groups.drupal.org/code-review has details on how to do that.
Suggestions:
Please take a moment to make your project page follow tips for a great project page.
Please take a moment to make your README.txt follow the guidelines for in-project documentation.
I noticed some very small code style issues. Please run the coder module on "minor" setting to help catch these. The coding standards have even more information in this area. I noticed non-standard whitespace.
These should be removed. It's only necessary to declare files[] if they declare a class or interface.
Required changes
These should be removed as they are added by the packaging script:
Comment #2
Rajan M commentedHi Greg,
Thanks for the code review.
I have done with the changes told by you.
I don't know someone who is familiar with the CiviCRM from Code Review team.
Comment #3
gregglesThey don't have to be on the code review team, they can be anyone familiar with CiviCRM.
Thanks for making the updates.
Comment #4
klausiIt appears you are working in the "master" branch in git. You should really be working in a version specific branch. The most direct documentation on this is Moving from a master branch to a version branch. For additional resources please see the documentation about release naming conventions and creating a branch in git.
Review of the master branch:
This automated report was generated with PAReview.sh, your friendly project application review script. Please report any bugs to klausi.
Comment #5
Rajan M commentedRegarding {curly_brackets} (checked by coder module), this is fine since module executing query for CiviCRM not for Drupal hence it don't need {curly_brackets}.
I have done with the other fixes.
Thanks
Comment #6
doitDave commentedReview of the 7.x-1.x branch:
This automated report was generated with PAReview.sh, your friendly project application review script. Go and review some other project applications, so we can get back to yours sooner.
Manual review:
HTH, dave
Comment #7
Rajan M commentedHi Dave,
Thanks for the code review.
I have done with changes
# Fixes for 'space before and after the operator' and
'All text files should end in a single newline' - README.txt.
# Removed the master branch, now command 'git branch -v' showing only one branch 7.x-1.x (I am still learning git).
# Added linebreak + indentation for all arrays in the code.
# Added doxygen blocks for remaining functions + added @see, which will make easy to track the code.
Regarding function _civicrm_reference_fields_get_values_contribution() :
functions
_civicrm_reference_fields_get_values_contribution( ),
_civicrm_reference_fields_get_values_event( ),
_civicrm_reference_fields_get_values_pcp( )
getting called from functions
_civicrm_reference_fields_get_details(),
_civicrm_reference_fields_find_references() and
_civicrm_reference_fields_allowed_values()
eg :
line no. 644
(please check code from my recent commit, $type is nothing but 'contribution' / 'event' / 'pcp')
Please let me know if anything I am missing!
Comment #8
doitDave commentedManual review:
vs.
avoids some horizontal scrolling while debugging or simply reading, you know what I mean? Don't get me wrong, no big thing, and perhaps you have good reasons to do it the other way? But I personally love code being structured for quickest possible understanding, and I guess that's what most Drupalers do. As for control structures etc. you widely follow this approach anyway :)
Hope this helps and you don't find my comments too fussy.
-dave
Comment #9
doitDave commentedComment #9.0
doitDave commentedChanged git clone link.
Comment #10
Rajan M commentedHi Dave,
I had made these changes but it was on 7.x-1.x, my sandbox project was pointing to the old (master branch git clone url)
After taking irc help I have updated it to:
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/rajanmayekar/1292200.git civicrm_reference_fieldsSorry for inconvenience!
I have removed all files from master branch but README.txt is still there, mentioning the correct (above) git clone branch (suggested on irc #drupal-codereview).
also I have updated doxygen header to mention external DAO source.
Thanks,
Rajan
Comment #11
doitDave commentedHi,
just updated my review tools, here are the results (I left the curly brackets warning in it but I know it is not relevant here as we already discussed):
Automated review (Please keep in mind that this is primarily a high level check that does not replace but, after all, eases the review process. There is no guarantee that no other issues could show up in a more in-depth manual follow-up review.)
Review of the 7.x-1.x branch:
This automated report was generated with PAReview.sh, your friendly project application review script. Go and review some other project applications, so we can get back to yours sooner.
HTH, dave
Comment #12
Rajan M commentedHi,
Done with fixes, assigning issue for 'needs review'.
Comment #13
Rajan M commentedComment #14
klausiReview of the 7.x-1.x branch:
This automated report was generated with PAReview.sh, your friendly project application review script. Go and review some other project applications, so we can get back to yours sooner.
manual review:
Comment #15
Rajan M commentedHi,
I have done with the fixes
Just one issue,
http://ventral.org/pareview/httpgitdrupalorgsandboxrajanmayekar1292200git
not getting what is wrong, can u please explain me!
Regarding some points from manual review
- As I am building query on CiviCRM DAO, that is need to be concatenate to satisfy different conditions, please note that I am already implementing placeholder according to the CiviCRM DAO standard.
eg: CRM_Core_DAO::executeQuery($query, $params);
I have put the comments in doc block accordingly
" This function builds a query that will retrieve the data
related to event pages from external DAO source
(CiviCRM Database)."
- No need to do it, CiviCRM is already doing it while putting it in to the db.
- Yes, am already doing it.
Thanks!
Comment #16
misc commentedSeems like you have done the updates? I do not get the coding standards errors you are referring to.
Comment #17
Rajan M commentedHi MiSc,
Yes, I have done with the coding standards fixes.
Thanks for noticing the issue queue of this project, can you please approve the project?
Rajan
Comment #18
klausiSorry for the delay, but you have not listed any reviews of other project applications in your issue summary as strongly recommended here: http://drupal.org/node/1011698
Review of the 7.x-1.x branch:
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. Get a review bonus and we will come back to your application sooner.
manual review:
Comment #19
obowden commentedHi Rajan,
Can you give some examples of how this module might be used? We may be able to test.
Thanks,
Owen.
Comment #20
Rajan M commentedHi Owen,
This module is integration for CiviCRM, currently CiviCRM has inbuilt integration for contact reference field with drupal's field api, for CiviCRM I had upgraded this (civicrm contact reference) module from drupal6 to drupal7.
Inspired by this module I created CiviCRM Reference fields module, which allow us to use CiviCRM Event, Contribution, PCP page reference as a drupal field.
So you can create one or more CiviCRM event / Contribution / PCP page and create drupal field for the same, it is similar like node reference module of Drupal :)
I will fix the remaining code standard issues soon!
Thanks
Comment #21
Rajan M commentedI have done with code indentation fixes.
Regarding manual review
Fixed.
In this kind of functions I am firing the query on CiviCRM DAO source, which is not similar like drupal query placeholders. Also $ids and $limit are internal data driven values so wont be the issue.
Fixed.
Thanks
Comment #22
prathK commentedHi Rajan,
I have reviewed your module with coder manually and found following issues.
civicrm_contact_ref.module
severity: normal
Line 10: Menu item titles and descriptions should NOT be enclosed within t(). (Drupal Docs)
'title' => t('Contacts'),
severity: minor
Line 91: Missing period
* Implements hook_field_formatter_view()
severity: critical
Line 204: Potential problem: FAPI elements '#title' and '#description' only accept filtered text, be sure to use check_plain(), filter_xss() or similar to ensure your $variable is fully sanitized.
'#title' => ts('CiviCRM Contact Type %1', array(1 => $label)),
severity: minor
Line 365: use lowercase html tags to comply with XHTML
AND sort_name NOT LIKE '%%'
civicrm_contact_ref.install
severity: normal
Line -1: @file block missing
Thanks & Regards,
prathK
http://extrimity.in
Comment #23
Rajan M commentedHi prathK,
Might be you are looking at another module?
'civicrm_contact_ref' is not my module (it comes by-default with CiviCRM).
My module name is 'civicrm_reference_field'.
Thanks,
Rajan
Comment #24
prathK commentedHi rajan,
OOoops !!! Sorry for the earlier misunderstanding.
It was because of similar names of modules.
I have done review of your module with coder. I found following errors :
Line 263: table names should be enclosed in {curly_brackets}
$query = "SELECT id, title FROM civicrm_contribution_page WHERE is_active = 1 ";
severity: critical
Line 324: table names should be enclosed in {curly_brackets}
$query = "SELECT id, title FROM civicrm_event WHERE ( civicrm_event.is_template IS NULL OR civicrm_event.is_template = 0 ) AND is_active = 1 ";
severity: critical
Line 387: table names should be enclosed in {curly_brackets}
$query = "SELECT id, title FROM civicrm_pcp WHERE is_active = 1 ";
severity: normal
Line 451: String concatenation should be formatted with a space separating the operators (dot .) and the surrounding terms
'#autocomplete_path' => $instance['widget']['settings']['autocomplete_path'] . '/' . $instance['entity_type'] . '/' . $instance['bundle'] . '/' . $field['field_name'],
severity: critical
Line 488: Potential problem: FAPI elements '#title' and '#description' only accept filtered text, be sure to use check_plain(), filter_xss() or similar to ensure your $variable is fully sanitized.
'#title' => ($type == 'event') ? t('CiviCRM Event Start date is') : t('CiviCRM Contribution Start date is'),
severity: critica
lLine 495: Potential problem: FAPI elements '#title' and '#description' only accept filtered text, be sure to use check_plain(), filter_xss() or similar to ensure your $variable is fully sanitized.
'#title' => ($type == 'event') ? t('CiviCRM Event End date is') : t('CiviCRM Contribution End date is'),
Thanks & Regards,
PrathK
http://extrimity.in
Comment #25
Rajan M commentedHi,
Regarding {curly_brackets} I have already mentioned in the above comments, since I am using CiviCRM DAO.
I have fixed the issue of Line 451.
Also if you take the close look at the module code issues regarding check_plain() ie Line 488 and Line 495 are not valid :)
Thanks,
Rajan
Comment #26
prathK commentedHi Rajan,
I have reviewed it with devel and for functionality wise as well.
Module seems ready to go for me after all these fixes related to the module.
Nice job !! very useful module if we want to put contribution pages as field reference itself.
Cheers,
PrathK
extrimity.in
Comment #27
Rajan M commentedThanks prathK for module review!
I have done other project reviews
http://drupal.org/node/1538594#comment-6116896
http://drupal.org/node/1605798#comment-6199880
http://drupal.org/node/1538594#comment-6199740
Comment #27.0
Rajan M commentedchanging git clone url.
Comment #28
klausiThere is still a master branch, make sure to remove it. See also step 6 and 7 in http://drupal.org/node/1127732
manual review:
Otherwise looks good to me, so ...
Thanks for your contribution, Rajan M! Welcome to the community of project contributors on drupal.org.
I've granted you the git vetted user role which will let you promote this to a full project and also create new projects as either sandbox or "full" projects depending on which you feel is best.
Thanks, 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.
As you continue to work on your module, keep in mind: Commit messages - providing history and credit and Release naming conventions.
Thanks to the dedicated reviewer(s) as well.
Comment #29
Rajan M commentedHi,
I have removed the master branch!
civicrm_reference_fields_field_formatter_view(): "'#markup' => $values[$item[$field_id]]['title'],": I assume the title is already sanitized, so this is not vulnerable to XSS?It is already sanitized.
Thanks for the review, and grating me access for full project!
I will continue my contribution ....
Thanks to the dedicated reviewers!
Cheers!
Rajan
Comment #30.0
(not verified) commentedadded reviews for other projects!