Hi, I use uploadpath and workflow module together.
But when i use workflow tab to change state it get error:

Fatal error: Cannot use object of type stdClass as array in C:\wamp\www\modules\uploadpath\uploadpath.module on line 36

Although if I use "Edit" tab to change state, it ok.

Can you resolve this conflict ?

Upload path Ver 6.x-1.0
Workflow Ver 6.x-1.0-rc3

Sorry, because I don't know to ask for support in Uploadpath module or Workflow module.

Comments

jvandyk’s picture

Project: Workflow » Upload path
Version: 6.x-1.0-rc3 » 6.x-1.0

Looks like a bug in uploadpath module where it is not handling the case where a node is being updated via node_save() programatically instead of through the node form?

Alpha5’s picture

Seem this module do not have support. I will try other module.

davidwhthomas’s picture

Have patience ;-)

Please try this patch to see if it fixes the problem, you'll need to edit your uploadpath.module file

This is for the D6 version

<?php
/**
 * Implementation of hook_nodeapi().
 */
function uploadpath_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch ($op) {
    case 'insert':
    case 'update':
    if( !in_array($node->type, variable_get('uploadpath_excluded_node_types',array())) ){
      if(isset($node->files) && user_access('upload files')) {
        foreach ($node->files as $key => $file) {
          // INSERT THIS
	  if(is_object($file)){
	    $file = (array)$file; // if object then type cast as array
	  }
         // rest of the code....
?>
Alpha5’s picture

Hi, I have try your patch and it worked great. Thanks for your support.

<?php
/**
* Implementation of hook_nodeapi().
*/
function uploadpath_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch ($op) {
    case 'insert':
    case 'update':
    if( !in_array($node->type, variable_get('uploadpath_excluded_node_types',array())) ){
      if(isset($node->files) && user_access('upload files')) {
        foreach ($node->files as $key => $file) {
          // INSERT THIS
      if(is_object($file)){
        $file = (array)$file; // if object then type cast as array
      }
         // rest of the code....
?>
davidwhthomas’s picture

Status: Active » Fixed

committed to dev branch

Status: Fixed » Closed (fixed)

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