Download & Extend

Error when saving non-signup nodes: Call to undefined function _signup_node_completed()

Project:Signup
Version:7.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review

Issue Summary

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.

Comments

#1

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

AttachmentSize
signup-824232.patch 788 bytes

#2

Assigned to:Anonymous» tnightingale
Status:active» needs review

Changing status

#3

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

#4

Status:needs review» fixed

Apparently it has been fixed in 1.0

#5

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...

#6

Status:needs review» reviewed & tested by the community

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

#7

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.

#8

Version:6.x-2.x-dev» 7.x-1.x-dev
Assigned to:tnightingale» Anonymous

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

AttachmentSize
824232-8-signup-undefined-function-_signup_node_completed.patch 680 bytes
nobody click here