I am trying to update a bunch of content_profile profile nodes in an update_N hook. Signup is installed on my site for my event nodes not enabled on the profile nodes.

However when I run the update, it errors with "Call to undefined function _signup_node_completed()" in node_form.inc on line 74. It seems weird that this function is being called as the node I am saving is not related to signup whatsoever.

Here is the block of code causing issue, at the end of the signup_save_node function called by signup_nodeapi:

$node = node_load($node->nid);
  if ( _signup_node_completed($node) && !empty($node->signup_status)) {
    // If this is an time-based node, and it's already past the close in
    // advance time (e.g. someone just changed the node start time), and
    // signups are still open, close them now.
    signup_close_signup($node->nid);
    drupal_set_message(t('%node_type start time is already past the signup close-in-advance time, signups now closed.', array('%node_type' => node_get_types('name', $node->type))));
  }

Looks like the operands are on the wrong sides of the && operator, the !empty($node->signup_status) should be checked before _signup_node_completed($node) but I am wondering whether logic should actually be placed in hook_nodeapi to ensure this function only gets run on signup-enabled nodes.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tnightingale’s picture

FileSize
788 bytes

Here is a patch which replaces the operands for the time being. Rolled against 2.x-dev

tnightingale’s picture

Assigned: Unassigned » tnightingale
Status: Active » Needs review

Changing status

joachim’s picture

I don't have the code in front of me now, but I am all in favour of moving a check that we're actually looking at a signup node up to hook_nodeapi() itself, if you want to add that to the patch :)

Artusamak’s picture

Status: Needs review » Fixed

Apparently it has been fixed in 1.0

Magnus’s picture

Status: Fixed » Needs review

Apparently it has been fixed in 1.0

But the issue and the patch is against 6.x-2.x-dev...

Artusamak’s picture

Status: Needs review » Reviewed & tested by the community

In any case the patch is working (for 1.x and 2.x).

robbieferrero’s picture

Status: Reviewed & tested by the community » Needs review

I was having the same issue when using an update script where I was calling node_save to create a new node. My workaround was to include the following code at the top of my script:

module_load_include('inc', 'signup', 'includes/scheduler');

The issue also fixed a co-workers update script that caused the same error to be displayed.
I hope this helps.

BarisW’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev
Assigned: tnightingale » Unassigned
FileSize
680 bytes

This bug still applies to the D7 version and the attached patch, based on #1, fixes this issue.

protitude’s picture

Issue summary: View changes

Confirmed this bug still exists in 7.x-1.x-dev and the patch in #8 fixes the issue.