There seems to be some sort of incompatibility issue when using Private Number in conjunction with the Workflow module. When a user changes workflow state (from the tab page) the private number value will be encrypt the already encrypted value. This process continues for every subsequent workflow change.

The fix involved hardcoding the private number decryption method into the workflow module prior to node_save(). I'm not sure if it's possible to hook into it.

Comments

john.money’s picture

Assigned: Unassigned » john.money

Investigating...

Anonymous’s picture

What's the status on this?

adnasa’s picture

Status: Active » Needs review

I fixed this.
On lin 92 in private_number.module
previously the 'presave' operation doesn't check if the node actually already existed or not.

        foreach ($items as $delta => $item) {
          if (!private_number_content_is_empty($item)) {
            $items[$delta]['private_number'] = (substr($item['private_number'], 0, 6) == 'md5___') ? substr($item['private_number'], 6) : _private_number_md5_encrypt($item['private_number'], _private_number_get_key());
          }
        }

Since workflow again saves the node when changing a state,
somehow it doesn't go through the CCK fields and re-evaluate values.
But we could change that just by encrypting the fields only if the $node->nid doesn't exist and if it is new content

      if(!$node->nid) {
        foreach ($items as $delta => $item) {
          if (!private_number_content_is_empty($item)) {
            $items[$delta]['private_number'] = (substr($item['private_number'], 0, 6) == 'md5___') ? substr($item['private_number'], 6) : _private_number_md5_encrypt($item['private_number'], _private_number_get_key());
          }
        }
      }

Enjoy!