I get this pop up after running a rule:
An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /~dacapo5/rc/system/ajax
StatusText: parsererror
ResponseText:
Fatal error: Class name must be a valid object or a string in /home/dacapo5/public_html/rc/includes/common.inc on line 7837
Rule:
Event - User clicks a button field
Conditions: Entity is of type: Registration (Entity Registration)
Actions: Execute Custom PHP Code
Custom PHP Code -
The code gets values from the registration and the entity that created the registration (Event Calendar Content type).
It will then create a JSON file and sign it to create an Apple Passbook PKPass object
It will create an HTML email with attachments (PKpass obhect) and send it out to the user.
The line in common.inc is the following:
function entity_get_controller($entity_type) {
$controllers = &drupal_static(__FUNCTION__, array());
if (!isset($controllers[$entity_type])) {
$type_info = entity_get_info($entity_type);
$class = $type_info['controller class'];
$controllers[$entity_type] = new $class($entity_type);
}
return $controllers[$entity_type];
}
Note, the PHP code has no reference to common.inc directly its interface with drupal is as follow:
require('sites/all/libraries/QRUPass/src/PKPass/PKPass.php');
// rcbd demo event ticket
$fname = $registration->field_first_name[0][0]['value'];
$lname = $registration->field_surname[0][0]['value'];
$emailto = $registration->field_registration_email[0][0]['value'];
$fullname = $fname.''.$lname;
$din = $registration->field_din[0][0]['value'];
$photoid = $registration->field_photoid[0][0]['uri'];
$event_type = $registration->type;
$event = entity_load_single($registration->entity_type, $registration->entity_id);
if (empty($event)) {
echo "severe error cannot get event :".$registration->entity_id."type = ".$registration->entity_type;
return false;
}
$event_title = $event->title;
$event_image = $event->field_image[0][0]['uri'];
$event_from = $event->field_date[0][0]['value'];
$event_to = $event->field_date[0][0]['value2'];
$event_organizer = $event->field_event_organizer[0][0]['value'];
$event_contact_number = $event->field_event_contact_number[0][0]['value'];
$event_rc_chapter = $event->field_red_cross_chapter[0][0]['value'];
$event_location = $event->field_event_location[0][0]['name'];
$event_street = $event->field_event_location[0][0]['street'];
$event_street2 = $event->field_event_location[0][0]['additional'];
$event_city = $event->field_event_location[0][0]['city'];
$event_province = $event->field_event_location[0][0]['province'];
$event_country = $event->field_event_location[0][0]['country'];
$event_address = $event_location.",\n".$event_street;
if (!empty($event_street2)) {
$event_address .= "\n".$event_street2;
}
$event_address = ",\n".$event_city;
if (!empty($event_province)) {
$event_address .= ", ".$event_province;
}
$serialnumber = $din;
$pass = new PKPass\PKPass();
Comments
Comment #1
paulovg12 commentedComment #2
paulovg12 commentedThe common.inc error maybe related to the use of $registration - I should be using the $entity variable instead. ($registration is used for specific registration events), or this command -
$event = entity_load_single($registration->entity_type, $registration->entity_id);
I changed the code to use the appropriate $entity variable and read directly from the DB using the dbquery function. My current error code is currently HTTP 500 with no other messages. ... The rules provide good functionality but there should be a way to get more debugging information to the developer.I am not sure if I am simply missing it but a simple function (from PHP eval) to echo the variable values and status will greatly facilitate development using this Module. As it is right now, with data selectors and other I think this can be closed.
Comment #3
paulovg12 commentedUse of the appropriate variable $entity instead of $registration fixed the issue.