This module provide an implementation of the odtphp library to allow the filling of odt template files through one node fields.
Just create a new content type containing the fields needed, upload the ODT template and associate its variable with the content type fields. Then a new button will appear on node view to download the filled in odt. To know how to create ODT templates in order to be used with this module refer to the tutorials described here.
I think there is not another module doing the same at this moment.

Project Page: http://drupal.org/sandbox/DarthDrupal/1334622
Git Repo: git clone --branch master DarthDrupal@git.drupal.org:sandbox/DarthDrupal/1334622.git

The module has been developed for Drupal 7.

CommentFileSizeAuthor
#8 drupalcs-result.txt886 bytesklausi

Comments

chakrapani’s picture

Status: Needs review » Needs work

It 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:

  • Run coder to check your style, some issues were found (please check the Drupal coding standards):
    Severity minor, Drupal Commenting Standards, Internationalization, Drupal Security Checks, Drupal SQL Standards, Drupal Coding Standards
    
    sites/all/modules/pareview_temp/test_candidate/odt_filler.module:
     +12: [minor] indent secondary line of comment one space 
     +12: [minor] Comment should be read "Implements hook_foo()."
     +13: [minor] indent secondary line of comment one space 
     +27: [minor] indent secondary line of comment one space 
     +27: [minor] Comment should be read "Implements hook_foo()."
     +28: [minor] indent secondary line of comment one space 
     +39: [minor] indent secondary line of comment one space 
     +39: [minor] Comment should be read "Implements hook_foo()."
     +40: [minor] indent secondary line of comment one space 
     +82: [minor] indent secondary line of comment one space 
     +82: [minor] Comment should be read "Implements hook_foo()."
     +83: [minor] indent secondary line of comment one space 
     +94: [minor] indent secondary line of comment one space 
     +94: [minor] Comment should be read "Implements hook_foo()."
     +95: [minor] indent secondary line of comment one space 
    
    Status Messages:
     Coder found 1 projects, 1 files, 15 minor warnings, 0 warnings were flagged to be ignored
    
  • Lines in README.txt should not exceed 80 characters, see the guidelines for in-project documentation.
  • Remove the translations folder, translations are done on http://localize.drupal.org
  • Comments: there should be a space after "//", see http://drupal.org/node/1354#inline
    odt_filler.inc:8://check the library existence and include it
    odt_filler.inc:16:    //if the template upload form has been successfully submitted
    odt_filler.inc:17:    //return the association form 
    odt_filler.inc:21:  //define the options array containing the available content types
    odt_filler.inc:71:  //check if it is an edit form
    odt_filler.inc:74:  //recovery all field instances for the selected content type
    odt_filler.inc:75:  //and define the options array for the select to show beside the template variable
    odt_filler.inc:79:    //show only the fields having text or number widget
    odt_filler.inc:80:    //todo: implement other field types
    odt_filler.inc:86:    //create an array to track how many variables exist
    odt_filler.inc:111:  //validate only odt files
    odt_filler.inc:114:    //check template folder existence and create it if it not exists
    odt_filler.inc:118:      //move the uploaded file to the right folder
    odt_filler.inc:119:      //don't move it if it already exists
    odt_filler.inc:123:        //save in storage the moved file object and the path
    odt_filler.inc:143:  //check if the selected content type has field instances
    odt_filler.inc:158:  //generate the odt template path
    odt_filler.inc:161:  //define configuration array for the odf object instance
    odt_filler.inc:167:  //create a new odf object passing the early uploaded template
    odt_filler.inc:170:  //recovery the odt content
    odt_filler.inc:173:  //match all the template variables (having the following form: {var}
    odt_filler.inc:176:  //save all info into the storage bin
    odt_filler.inc:188:  //generate an array into the storage bin in the form 'tpl_variable => content_type_field'
    odt_filler.inc:194:  //set file as permanent and save it
    odt_filler.inc:198:  //serialize the variables/ct_fields array to store it into the db
    odt_filler.inc:201:  //prepare fields for the db_insert query
    odt_filler.inc:219:  //unset storage bin to prevent the form to be rebuilt
    odt_filler.inc:222:  //redirect the user to the overview page
    odt_filler.inc:235:  //check if the form is an edit one
    odt_filler.inc:239:    //if it's an edit form render first the main part of it
    odt_filler.inc:243:  //cicle over the non-property elements of the form element array
    odt_filler.inc:251:  //produce different output if the form as an edit one or not
    odt_filler.inc:263:  //check if is needed to return a confirm form to delete templates
    odt_filler.inc:285:  //prepare the header for the tableselect overview form
    odt_filler.inc:288:  //get all info from the odt_filler_tpl table
    odt_filler.inc:295:  //cicle over the query results to produce the rows of the tableselect overview form
    odt_filler.inc:346:  //reject the non selected templates
    odt_filler.inc:349:  //mark the form to present the delete operation confirm form 
    odt_filler.inc:357:    //check if the same file is used by other templates
    odt_filler.inc:358:    //otherwise delete it
    odt_filler.inc:368:    //delete the row regarding the selected template in od_filler_tpl table
    odt_filler.inc:374:    //unset storage bin to prevent form rebuilding
    odt_filler.inc:383:  //collect all info regarding the template id passed by the $tpl_id variable
    odt_filler.inc:386:  //call upload form and association form functions to get the needed elements
    odt_filler.inc:387:  //and set their default values
    odt_filler.inc:405:  //store result set into the storage bin for using it in the submit function
    odt_filler.inc:412:  //set an index to track if any template_variable/content_type_field association changed
    odt_filler.inc:417:      //if changes occured replace the $field in the result set
    odt_filler.inc:423:  //check if changes occured in the other fields and save them in the $fields array
    odt_filler.inc:432:    //if the $fields array has been set execute the database update
    odt_filler.install:50:  //collect all tpl_fids to remove odt template files
    odt_filler.install:54:      //remove the file and the relative table row
    odt_filler.install:60:  //remove odt template directory and the module defined variables
    odt_filler.module:8://check the library existence and include it
    odt_filler.module:99:    //attach the download form to the node content
    odt_filler.module:128:  //unserialize the template_variables/content_type_fields array
    odt_filler.module:132:  //set the config array to pass to the odf construct function
    odt_filler.module:139:  //cicle over variables/fields array and set the odt template varibles
    odt_filler.module:152:  //save the filled in odt to the temp folder
    odt_filler.module:160:  //send the file to the browser
    
  • ./odt_filler.inc: comment lines should break at 80 characters, see http://drupal.org/node/1354#general
      //and define the options array for the select to show beside the template variable
      //generate an array into the storage bin in the form 'tpl_variable => content_type_field'
      //cicle over the query results to produce the rows of the tableselect overview form
        //$options[$tpl_id]['tpl_name'] = array('data' => array('#title' => check_plain($result->tpl_name)), check_plain($result->tpl_name));
      //set an index to track if any template_variable/content_type_field association changed
      //check if changes occured in the other fields and save them in the $fields array
    
  • Bad line endings were found, always use unix style terminators. See http://drupal.org/coding-standards#indenting
    ./README.txt:                  ASCII English text, with CRLF line terminators
    ./odt_filler.info:             ASCII text, with CRLF line terminators
    README.txt
    odt_filler.admin.inc
    odt_filler.info
    odt_filler.install
    odt_filler.module
    odt_filler_stream.inc
    
  • Remove all old CVS $Id tags, they are not needed anymore.
    translations/it.po:1:# $Id$
    translations/odt_filler.pot:1:# $Id$
    
  • All text files should end in a single newline (\n). See http://drupal.org/node/318#indenting
    ./odt_filler.module ./README.txt ./odt_filler.info ./odt_filler.admin.inc ./odt_filler_stream.inc ./odt_filler.install ./odt_filler.inc
    

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.

DarthDrupal’s picture

Thanks for the tips! I'll correct them as soon as possible! It's the first time I develop a drupal module. :)

DarthDrupal’s picture

Ok, I created the 7.x-1.x branch, fixed all minor warnings and removed the translations folder.
You can test the module again.
Thanks.

chakrapani’s picture

All text files should end in a single newline (\n). See http://drupal.org/node/318#indenting
./odt_filler.module ./README.txt ./odt_filler.info ./odt_filler.admin.inc ./odt_filler_stream.inc ./odt_filler.install ./odt_filler.inc

Don't forget to change the status to 'needs review' after you make the changes.

DarthDrupal’s picture

Status: Needs work » Needs review

Fixed in 7.x-1.x

doitDave’s picture

Status: Needs review » Needs work

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:

  • Drupal Code Sniffer has found some code style issues (please check the Drupal coding standards):
    
    FILE: ...709/sites/all/modules/pareview_temp/test_candidate/odt_filler.admin.inc
    --------------------------------------------------------------------------------
    FOUND 1 ERROR(S) AFFECTING 1 LINE(S)
    --------------------------------------------------------------------------------
     8 | ERROR | Missing function doc comment
    --------------------------------------------------------------------------------
    
    
    FILE: ...web/dp709/sites/all/modules/pareview_temp/test_candidate/odt_filler.inc
    --------------------------------------------------------------------------------
    FOUND 7 ERROR(S) AND 3 WARNING(S) AFFECTING 10 LINE(S)
    --------------------------------------------------------------------------------
     109 | ERROR   | You must use "/**" style comments for a function comment
     145 | WARNING | Avoid backslash escaping in translatable strings when
         |         | possible, use "" quotes instead
     151 | WARNING | Line exceeds 80 characters; contains 83 characters
     157 | ERROR   | Missing function doc comment
     164 | WARNING | A comma should follow the last multiline array item. Found: )
     191 | ERROR   | You must use "/**" style comments for a function comment
     336 | ERROR   | You must use "/**" style comments for a function comment
     344 | ERROR   | Missing function doc comment
     361 | ERROR   | Line indented incorrectly; expected at least 6 spaces, found 4
     410 | ERROR   | You must use "/**" style comments for a function comment
    --------------------------------------------------------------------------------
    
    
    FILE: .../dp709/sites/all/modules/pareview_temp/test_candidate/odt_filler.module
    --------------------------------------------------------------------------------
    FOUND 3 ERROR(S) AND 1 WARNING(S) AFFECTING 3 LINE(S)
    --------------------------------------------------------------------------------
     126 | ERROR   | Missing function doc comment
     134 | WARNING | A comma should follow the last multiline array item. Found: )
     195 | ERROR   | "require_once" is a statement not a function; no parentheses
         |         | are required
     195 | ERROR   | File is being conditionally included; use "include_once"
         |         | instead
    --------------------------------------------------------------------------------
    

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.

DarthDrupal’s picture

Status: Needs work » Needs review

Fixed in 7.x-1.x

klausi’s picture

Status: Needs review » Needs work
StatusFileSize
new886 bytes

There are still files other than README.txt in the master branch, make sure to remove them. See also step 5 in http://drupal.org/node/1127732
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.

manual review:

  • odt_filler_requirements(): you are hard-coding the library path to odtphp. If I have a Drupal distribution where I use profiles/recruiter/libraries instead of sites/all/libraries I will run into problems.
  • odt_filler_requirements(): the 'here' link label should also be translated.
  • odt_filler_install(): no need to use variable_set() here, as you can use default values in variable_get() anyway.
  • odt_filler_schema(): do not prefix the DB columns with "tpl" everywhere.
  • odt_filler.module: do not call odt_filler_check_library() unconditionally here, as this will be executed on every page request even if your module isn't even needed. Include the library when you need it. Also in odt_filler.inc.
  • odt_filler_node_view(): you should line break this long DB statement like here: http://drupal.org/node/1060924 . Also in odt_filler_upload_form_validate(), check all your DB statement style.
  • odt_filler_association_form(): "'#options' => (isset($options)) ? $options : '',": $options is always set, so the isset() is not needed.
  • odt_filler_association_form_validate() doesn't do anything, so remove it.
  • odt_filler_upload_form_submit(): there are dpm() debug statements, remove all of them from your code.
DarthDrupal’s picture

Status: Needs work » Needs review

Thanks klausi.
- fixed the master branch
- fixed issues of the automatic review
- fixed all issues of the manual review but the first regarding the library path. I looked for a solution but the only alternative way seems to be the Libraries API implementation. I would avoid other module dependencies is possible. Can you provide me another solution for this issue?

Thanks

klausi’s picture

Status: Needs review » Reviewed & tested by the community

"'#value' => $tpl->button_name,": button_name is user provided input, so you should run it through check_plain().

Otherwise looks good to me.

avpaderno’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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