CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Errors when trying to Schedule Reminders
Pages: [1]

Author Topic: Errors when trying to Schedule Reminders  (Read 850 times)

jmickela

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 0
  • CiviCRM version: 4.1.1
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5
Errors when trying to Schedule Reminders
July 16, 2012, 02:11:00 pm
Just going to the Schedule Reminders tab gives these errors:

Code: [Select]
Notice: Undefined offset: 3 in CRM_Event_Form_ManageEvent_ScheduleReminders->buildQuickForm() (line 120 of /var/www/sites/all/modules/civicrm/CRM/Event/Form/ManageEvent/ScheduleReminders.php).
Notice: Undefined index: event_contacts in CRM_Event_Form_ManageEvent_ScheduleReminders->buildQuickForm() (line 162 of /var/www/sites/all/modules/civicrm/CRM/Event/Form/ManageEvent/ScheduleReminders.php).
Notice: Undefined offset: 3 in CRM_Event_Form_ManageEvent_ScheduleReminders->buildQuickForm() (line 166 of /var/www/sites/all/modules/civicrm/CRM/Event/Form/ManageEvent/ScheduleReminders.php).

The recipients list is empty, and  the form is unsubmitable since you have to select a recipient.

I found this in ScheduleReminders.php:

Code: [Select]
$mappingID = 3;
$selectionOptions = CRM_Core_BAO_ActionSchedule::getSelection( $mappingID );
extract( $selectionOptions );

$entity = $this->add( 'select', 'entity', ts('Recipient(s)'), $sel3[$mappingID][0], true );

I checked and $sel3 is an empty array.

I've been looking all over and can't find anyone else having this issue. I haven't hacked this code or anything, so what's the deal? Why is this bombing out?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Errors when trying to Schedule Reminders
July 16, 2012, 02:33:50 pm

1. can you upgrade to 4.1.5 and see if it is working there

2. can you try and get the same behavior on our demo machine

thanx

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

jmickela

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 0
  • CiviCRM version: 4.1.1
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5
Re: Errors when trying to Schedule Reminders
July 16, 2012, 02:58:00 pm
Upgrading isn't really an option right now.

I tried on the test server and couldn't reproduce the error.

Just selecting the Schedule Reminders link causes the error to show on every event on my site.

Edit:

Following the code further:

Code: [Select]
static function getSelection( $id = null  )
{
     $mapping  = self::getMapping( $id );

$mapping is an empty array, which causes virtually all of the getSelection code to be bypassed.
« Last Edit: July 16, 2012, 03:07:23 pm by jmickela »

jmickela

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 0
  • CiviCRM version: 4.1.1
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5
Re: Errors when trying to Schedule Reminders
July 16, 2012, 03:20:40 pm
I have managed to "fix" this, but I'm not super confident that I didn't mess things up more.

After my last posted code observation I looked in:

Code: [Select]
static function getMapping( $id = null )
    {
        static $_action_mapping;
       
        if ( $id && !is_null($_action_mapping) && isset($_action_mapping[$id]) ) {
            return $_action_mapping[$id];
        }

        $dao = new CRM_Core_DAO_ActionMapping( );
        if ($id) {
            $dao->id = $id;
        }
        $dao->find(  );

        $mapping = $defaults = array();
        while ( $dao->fetch( ) ) {
            CRM_Core_DAO::storeValues( $dao, $defaults );
            $mapping[$dao->id] = $defaults;
        }
        $_action_mapping = $mapping;

        return $mapping;
    }

And used dsm() to figure out that the code was looking in the civicrm_action_mapping table. I guessed that the id being used throughout the code would be the id being looked for in that table (this is where I might be seriously wrong).

The id was hardcoded as being 3,  but the table only had two rows (ids 1 and 2). This database had been upgraded from a previous version of CiviCRM, but I happen to have a clean database handy and that table did in fact have three rows in it. I added the missing row and adjusted the ids to match the clean install version and this seems to fix the problem.

My only concern is that this is a superficial fix that will open other cans of worms. If anyone knows anything about this please let me know.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Errors when trying to Schedule Reminders
July 16, 2012, 05:07:49 pm

Not sure why you did not have 3 entries in your action_mapping table. I just checked and they were added in the 4.1.alpha1 upgrade

Do you remember what 2 mapping were in there?

In any event, having a hardcoded DB id (3) is not very good coding. We should do a retrieve from that table to get the ID. Can you please file an issue and we'll fix this for 4.2

thanx

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

jmickela

  • I post occasionally
  • **
  • Posts: 33
  • Karma: 0
  • CiviCRM version: 4.1.1
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5
Re: Errors when trying to Schedule Reminders
July 16, 2012, 05:50:45 pm
The missing row is the one that was supposed to have an ID of 1.

I checked the original database I was given and the action_mapping table is there but totally empty. This site was upgraded from an early 3.x version, it shouldn't have had the table at all from what I can tell. It may be that the fact that the table existed caused some code to not execute, some code that is supposed to insert the first row.

Yashodha Chaku

  • Forum Godess / God
  • Ask me questions
  • *****
  • Posts: 755
  • Karma: 57
    • CiviCRM
Re: Errors when trying to Schedule Reminders
July 18, 2012, 05:40:35 am
filed and fixed http://issues.civicrm.org/jira/browse/CRM-10544 for the same

-Yashodha
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Errors when trying to Schedule Reminders

This forum was archived on 2017-11-26.