Chinese identity card

Description

The Chinese Identity Card module is a small module and just provide a field type only for chinese identity card.
But it's useful for entering ID Card in china. No need to install field validation module or using drupal
form alter api to add validation handler. This module using text form element,
And adding module defined widget and validation.
Now this module only accepts valid ID Numbers in china (For example: 511702197701193532 or 320311770706001).

Link to sandbox page

https://www.drupal.org/sandbox/ivanzhu/2513696

Setting up repository for the first time

git clone --branch 7.x-1.x http://git.drupal.org/sandbox/ivanzhu/2513696.git chinese_identity_card
cd chinese_identity_card

Pareview review link

http://pareview.sh/pareview/httpgitdrupalorgsandboxivanzhu2513696git

Some data for testing

140925198206176495
652324197909253715
230307199306056993
652828197504263336
542329198601085912
33080219771222207X

320311770706001
320311770706002

Reviews of other projects

https://www.drupal.org/node/2545164#comment-10211051
https://www.drupal.org/node/2548277#comment-10203795
https://www.drupal.org/node/2548277#comment-10206337
https://www.drupal.org/node/2576111#comment-10434941

https://www.drupal.org/node/2574025#comment-10516618
https://www.drupal.org/node/2587323#comment-10517604
https://www.drupal.org/node/2605018#comment-10535762

Comments

perignon’s picture

This is a quick review. First code documentation should be in English for the Doc blocks. Also refer to Drupal coding standards.

You have numerous coding issues that need to be addressed:
http://pareview.sh/pareview/httpgitdrupalorgsandboxivanzhu2513696git

ivanzhu’s picture

Hi,
The test for codes has been passed.
Please review it again.

Thanks,

ajalan065’s picture

Hi ivanzhu,
1. Your README file is not as per the Drupal Guidelines. Please refer to guidelines for in-project documentation and/or the README Template.
2. Please rename your *.test file to *.inc and make the changes wherever the name for this file is concerned.
3. Instead of using array_key_exists(), please use isset() in your *.module.
4. As far as I could get from your code, you are attempting to create a textfield, which is working fine. Does it accepts the date of birth or something else? I have tried all possible inputs including the DOB, numbers or characters. But irrespective of the input, it gives the error message "the input may not be valid". So is it a misunderstanding on my part regarding the inputs or something to be done from your side. Your README also explains nothing about the things.

Change the status to "Needs Review" when all things are sorted.
And take part in Review Bonus Program to have a higher priority.

ivanzhu’s picture

Status: Needs work » Needs review

Hi

Thank you for your reviewing.

For the last question: because this module only accepts a valid ID Number in china. like: 511702197701193532 .

babusaheb.vikas’s picture

1) It would be better if your *.info file looks like:

name = Chinese identity card
description = A specifc field for chinese identity card.
core = 7.x
package = Fields
dependencies[] = field

files[] = chinese_identity_card.inc

2) You should provide the hook_help to allow site builders to find information about your module using Drupal UI.

3) I have found below error when I entered 15 digit(511702197701193) ID Numbers for 'Chinese Identity card' field and save that new node.
Exception: DateTime::__construct(): Failed to parse time string (1919-77-01) at position 6 (7): Unexpected character in DateTime->__construct() (line 277 of D:\xampp\htdocs\demosite\sites\all\modules\chinese_identity_card\chinese_identity_card.module).

ivanzhu’s picture

Thank you for your review.
Now problems are fixed.

xavip’s picture

Automatic Review

Pareview says: error in chinese_identity_card.module line 26.
It would be nice to put the link to your pareview review on the issue summary.

Manual Review

Individual user account
Yes
No duplication
Yes
Master Branch
Yes
Licensing
Yes
3rd party assets/code
Yes
README.txt/README.md
Yes
Code long/complex enough for review
Yes
Secure code
Yes
Coding style & Drupal API usage
Just some recommendations:
  1. Correct errors marked on pareview.
  2. Please, provide on your issue summary some valid chinese identity card numbers for testing proposals.
  3. Please, provide a link to your pareview review on the issue summary..
  4. I doesn't agree with comment #3: the test file should be called .test, not .inc

This review uses the Project Application Review Template.

ivanzhu’s picture

Issue summary: View changes

@XaviP , Thank you for reviewing.

All problems updated.

ivanzhu’s picture

Issue summary: View changes
tr’s picture

@ajalan065: In #3 you said:

2. Please rename your *.test file to *.inc and make the changes wherever the name for this file is concerned.

That is wrong. The .test extension is the proper file extension to use for SimpleTest test cases. You can read this in the Drupal SimpleTest coding standards.

ivanzhu’s picture

@ TR, Yes, I agree with you. It's should be .test for SimpleTest test cases.

ivanzhu’s picture

Issue summary: View changes
ivanzhu’s picture

Issue tags: +PAreview: review bonus
ivanzhu’s picture

Status: Needs review » Reviewed & tested by the community
ivanzhu’s picture

ivanzhu’s picture

Issue summary: View changes
klausi’s picture

Assigned: Unassigned » naveenvalecha
Issue tags: -PAreview: review bonus

Please don't RTBC your own issues, only another reviewer should do that.

manual review:

  1. project page is too short. What is the use case of this module? How does it work? How does it extend Drupal? See also https://www.drupal.org/node/997024
  2. chinese_identity_card_field_formatter_view(): I think #value should be sanitized with check_plain() since theme_html_tag() does not sanitize it to prevent XSS exploits. Usually the field values get validated when they are entered, but I would still always sanitize them since you never know how they ended up in the database (data migration or another module writing to the field or whatever).

Otherwise looks good to me, so I think this is RTBC. Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.

Assigning to Naveen as he might have time to take a final look at this.

jimmyko’s picture

Is this module re-inventing wheels?

klausi’s picture

@jimmyko: you mean there is already a similar module? Could you provide a link?

ivanzhu’s picture

@jimmyko @klausi
I don't think so. before I want to push this module to drupal.org. I had found a similar module with some key words(identity, id card. ). No result showed me.

ivanzhu’s picture

Issue summary: View changes
ivanzhu’s picture

Issue summary: View changes
Issue tags: +PAreview: review bonus
ivanzhu’s picture

@klausi

Problems had fixed.

klausi’s picture

Assigned: naveenvalecha » Unassigned
Status: Reviewed & tested by the community » Fixed

No objections for a week, so ...

Thanks for your contribution, ivanzhu!

I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!

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.

Thanks to the dedicated reviewer(s) as well.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.