What is this?
State Transition Control (STC) module enable workflow control on select list fields. If you enable state transition control on a field, you can set each (current) value of this field that which values can be set in next time (if the field current value is a particular one). If you didn't set any transition for a value than all values can be selected.
State Transition Control module can be very useful in case tracker systems or in any other systems with a special form where it's necessary to control the value transitions of a field (ex.: an administration field).
Module settings can be exported with Features module.
If you want to test this:
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/mxr576/2150643.git
OR
http://simplytest.me/project/2150643
Project page: https://drupal.org/sandbox/mxr576/2150643
Reviews of other projects
https://www.drupal.org/node/2304051#comment-9030947
https://www.drupal.org/node/2275135#comment-9030721
https://www.drupal.org/node/2315539#comment-9030663
https://www.drupal.org/node/2267611#comment-9030987
https://www.drupal.org/node/2304051#comment-9047377
https://www.drupal.org/node/2327911#comment-9097273
Comments
Comment #1
PA robot commentedWe are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #2
hayashi commentedHi @mxr576
I tried your module and find some issues.
・README.txt is missing.
https://drupal.org/node/161085
・Following messages is shown when save field setting.
Try to make 'Allowed values list' empty and save.
・Undesired item is shown.
Allowed values list:
0|State 0
1|State 1
2|State 2
Workflow control settings:
State 0: State 0, State 1
State 1: State 1, State 2
State 2: State 2
Edit node, set field value to 'State 2' and save.
Edit node again, only 'State 2' should be shown but 'State 0' is also selectable.
Comment #3
j.branson commentedOutside of the comment above, I ran this through PAreview.sh (http://pareview.sh/pareview/httpgitdrupalorgsandboxmxr5762150643git). As far as code review goes, it looks like you're basically good to go, but for two things: 1) There is still a master branch, you should switch default to 7.x-1x and delete the master branch. 2) Do you need to extract the keys in the foreach under field_workflow_control_features_export_alter? Having the keys doesn't affect the functionality one way or another, but it does leave two unused variables, which is odd.
...Nice job!
Comment #4
PA robot commentedClosing due to lack of activity. Feel free to reopen if you are still working on this application (see also the project application workflow).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #5
mxr576First of all thank you guys for your reviews!
Sorry, because I disappeared, but I've some school related works to do. But now I've some free time and I've made a big rework of this module. I think this version has more user friendlier UI than the previous one. (Of course I've fixed bugs too! :))
Please test this module again and provide some feedback.
Regards: mxr576
Comment #6
mxr576Comment #7
mxr576Comment #8
mxr576Comment #9
mxr576Comment #10
pushpinderchauhan commented@mxr576, thanks for your contribution.
I saw your module and also installed and tested functionality, working as expected. Its looks like a great improvement from your previous code. Good Work!
Your git command is not correct, it should be
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/mxr576/2150643.gitAutomated Review:
http://pareview.sh/pareview/httpgitdrupalorgsandboxmxr5762150643git reported following two minor issues.
Manual Review:
1. In Readme.txt file some special character is coming in following line, fix it.
If you didn’t set any transition for value than all values can be selected2. Your module name is
field_workflow_controlthat sound like it is something similar to Workflow module but in your case you are just managing field values as a states. There can be a better name for this module, something related to states as this is my personal opinion, might be other people find this name good :).3. hook_help() function is missing in your module.
4. Inline comments looks good in your code.
Certainly your module looks good to me.
Thanks again!
Comment #11
mxr576Thanks for your review and your kind words @er.pushpinderrana!
I've fixed all mentioned problems, after that left only this one. I'm not sure how to solve this in my case. (I've read this part of documentation.)
I'm also understand your problems with my module name. This name was born when we have started to work on our issue tracker and we were need a module that could control the value transition of select fields (ex.: issue statuses). That's why the module renamed their first name to something that contains "workflow", because it is something that surrounding with an issue tracker.
The original name was "Field Value Transition Control" which were not sounds as good as Field Workflow Control, but it's describe much better what my module could do. What do you think about this name or "Select Value Transition Control"? Any other idea or I can stay in the current name?
Comment #12
mxr576Comment #13
j.branson commentedHey,
For line 214 - you just need to define that the $all_values parameter accepts only an array. So:
function _field_workflow_control_get_selected_values(array $all_values) {...}That should do the trick.
For more on type hinting: http://php.net/manual/en/language.oop5.typehinting.php
Comment #14
mxr576Comment #15
mxr576Hi!
Thanks, your idea worked! I thought the problem in the comment part not in the code. Now I know how to solve this warnings.
Also, the module renamed to State Transition Control, maybe it will be a better name for this module. (@see #10-11).
There is no errors now on paraview.sh .
Comment #16
mxr576Comment #17
pushpinderchauhan commentedLooks better module name this time.
Automated Review
PAReview came up clean.
Manual Review
Individual user account
Yes: Follows the guidelines for individual user accounts.
No multiple applications
Yes: No multiple application found.
No duplication
Yes: Not found any similar project.
Master Branch
Yes: Follows the guidelines for master branch.
3rd party code
Yes: Follows the guidelines for 3rd party code.
README.txt
No. The format of README.txt does not follow the guidelines for in-project documentation. In particular, see the README.txt Template.
Code long/complex enough for review
Yes. About 300 lines. Follows the guidelines for project length and complexity.
Secure code
Yes.
Coding style & Drupal API usage
1. Your code looks good to me.
2. It would be good, if you extend Project page little bit more.
3. Similarly Readme.txt file need to be enhanced.
4. Inline comments looks good to me.
It looks RTBC from my side.
As I am not a git administrator, so I would recommend you, please help to review other project applications to get a review bonus. This will put you on the high priority list, then git administrators will take a look at your project right away :-)
Comment #18
mxr576Comment #19
klausiReview of the 7.x-1.x branch (commit 156668e):
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. You have to get a review bonus to get a review from me.
manual review:
<script>alert('XSS');</script>as possible field value then I will get a nasty javascript popup. You need to sanitize user provided text before printing. In your case you must use an "@" placeholder with t(). Make sure to read https://www.drupal.org/node/28984 again. And please don't remove the security tag, we keep that for statistics and to show examples of security problems.Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Comment #20
mxr576Dear @klausi!
Thanks for your detailed review. I think I've managed to fix all missing stuff as you can in here and here.
Special thanks for XSS notice which somehow I've overlooked.
Comment #21
mxr576Comment #22
pushpinderchauhan commented@mxr576, you can not switch status to RTBC yourself, moving back to Needs Review :).
Also I would recommend you, please help to review other project applications to get a review bonus back. This will put you on the high priority list, then git administrators will take a look at your project right away :)
Thanks to you for your hard work and patience.
Comment #23
mxr576Comment #24
potop commentedSeems like you fixed all the issues found by the previous review and module works just like it is described.
I just have one usability suggestion: when selecting possible transitions on field settings page, it would make sence to make mandatory transition (from "state 1" to "state 1") checkboxes "readonly" so user have no chance to deselect them by mistake.
Comment #25
mxr576Thanks your idea potop!
Honestly, I also have the same idea when I've made this module, but I've sadly seen that "checkboxes" form elements can not be manipulated easily. I've try to set the mandatory ones to disabled, but I couldn't do it inside the checkboxes form element if I remember well . Maybe I could write a little jQuery hack around this later, but now I think it isn't a release blocker issue, because the validator function prevents from unchecking the mandatory transitions.
Comment #26
mxr576Comment #27
mxr576Comment #28
mxr576Comment #29
klausiReview of the 7.x-1.x branch (commit e50ac33):
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. You have to get a review bonus to get a review from me.
manual review:
<script>alert('XSS');</script>as possible field value then I will get a nasty javascript popup as soon as the form error triggers. You need to sanitize user provided text before printing. In your case you must use an "@" placeholder with t(). Make sure to read https://www.drupal.org/node/28984 again.Comment #30
mxr576Thanks for reviewing (again) @klausi!
I'm sorry because I've missed the "same type of bugs" in the code as you have mentioned before.
I have to confess that I've focused only those things that have been mentioned in the previous comment because I was quite busy nowadays.
I hope that everything is OK from now.
Regards, mxr576
Comment #31
klausiLooks RTBC to me now after a manual review.
Assigning to mpdonadio as he might have time to take a final look at this.
Comment #32
mpdonadioAutomated Review
Review of the 7.x-1.x branch (commit 3c67961):
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. You have to get a review bonus to get a review from me.
Manual Review
The code is pretty dense. It could use a little vertical whitespace between logical breaks.
Will this be translation safe with all of the LANGUAGE_NONE usage? Double check this.
Not seeing any blockers here. Placeholders all look appropriate.
If added, please don't remove the security tag, we keep that for statistics and to show examples of security problems.
This review uses the Project Application Review Template.
Comment #33
mpdonadioThanks for your contribution, mxr576!
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.