Hello,

I noticed that in the hook_form_alter the #default_value was overwritten instead of only set.
This might result an unwanted edit of the including tax.

I attached a patch to fix this.
I'm not entirely sure if I should have included an if-check in the first alter case as well(strpos 'node-form'), so I didn't include one.

Comments

andyd328’s picture

Hi zekvyrin,

Many thanks for the patch, I'm not seeing a change though - both lines look the same to me. I understand the issue though and am either missing something or would welcome another patch :)

Cheers

Andy

zekvyrin’s picture

You don't see anything because i probably messed up something when creating the patch...
the "if" line is missing.. sorry

I uploaded the proper patch.

andyd328’s picture

Many thanks zekvyrin, patch added and new release made.

andyd328’s picture

Assigned: Unassigned » andyd328
Status: Active » Fixed

Thanks for the patch zekvyrin

andyd328’s picture

Status: Fixed » Closed (fixed)
zekvyrin’s picture

Thanks for adding it to the module Andy!

Please commit it as well on drupal.org's git (and add me as author if you can)

Thanks!

andyd328’s picture

Hi Vasilis,

I think it's too late to add you as author the way I should have - sorry, will do better next time.

I've made a new release with your patch in it - is there something else I should be doing on git?

Cheers!

zekvyrin’s picture

I think you should use drupal.org's git somehow to "add" commits to the project so they appear like this:
https://drupal.org/node/2184095/commits

This way, anyone can get the repository (with latest commits) and work with the project's latest version (for any development reason),
using these instructions:
https://drupal.org/project/commerce_default_tax_rate/git-instructions

Now by cloning the repository I get the previous version, and any new patch created using it, might fail (conflict).

I'm not exactly familiar with the procedure as I don't have a project on my own. Maybe this documentation can help:
https://drupal.org/node/1013552

I guess you simply need to clone it, make your commits (and possibly attribute authorship) and push the code.

zekvyrin’s picture

Status: Closed (fixed) » Active
StatusFileSize
new859 bytes

Hello again,

I found out that the "if" I added might not work well (not applying default value), because tax module sets empty "#default_value" for tax (but it sets it). Sorry.

Instead of this line:
if (!isset($form['commerce_price'][LANGUAGE_NONE]['0']['include_tax']['#default_value'])) {

I propose this (which checks if the product is new and applies the default value):
if (isset($form['#entity']->is_new)) {

The patch is an edit from the previous one.. Will not apply to version 1.2

Sorry for the confusion.. My fault.

andyd328’s picture

Status: Active » Closed (fixed)

Many thanks - have patched and committed, it should be available shortly. And hopefully the repository will be in sync with the releases.

zekvyrin’s picture

StatusFileSize
new3.78 KB

Hello Andy,

Thanks for the update.

Just a notice for the repository thought (the module is fine).
It has been updated, but for some reason, it's not "clean" and not correct.

It has some differences with the module (not going to work well),
there are some commented lines (ini_set & error_reporting commands )
and my previous .patch files (first 2) are included.

I'm uploading you a patch to help you fix these. This is just a patch for the repo I got by cloning (https://drupal.org/project/commerce_default_tax_rate/git-instructions), not for the actual module.