Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-2872

White screen with PHP code displayed when contact is deleted

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.9
    • Fix Version/s: 2.0
    • Component/s: None
    • Labels:
      None

      Description

      When deleting a user, when you click on the "Delete user" button, an entire page of nothing but PHP is displayed:

      static function checkPermission( $id ) { if ( ! $id )

      { return; }

      $mailingIDs =& CRM_Mailing_BAO_Mailing::mailingACLIDs( ); if ( ! in_array( $id, $mailingIDs ) )

      { CRM_Core_Error::fatal( ts( 'You do not have permission to access this mailing report' ) ); }

      return; } static function mailingACL( ) { $mailingACL = " ( 0 ) "; $mailingIDs =& self::mailingACLIDs( ); if ( ! empty( $mailingIDs ) )

      { $mailingIDs = implode( ',', $mailingIDs ); $mailingACL = " civicrm_mailing.id IN ( $mailingIDs ) "; }

      return $mailingACL; } static function &mailingACLIDs( ) { $mailingIDs = array( ); // get all the groups that this user can access // if they dont have universal access $groups = CRM_Core_PseudoConstant::group( ); if ( ! empty( $groups ) ) { $groupIDs = implode( ',', array_keys( $groups ) ); // get all the mailings that are in this subset of groups $query = " SELECT DISTINCT( m.id ) as id FROM civicrm_mailing m, civicrm_mailing_group g WHERE g.mailing_id = m.id AND g.entity_table = 'civicrm_group' AND g.entity_id IN ( $groupIDs )"; $dao = CRM_Core_DAO::executeQuery( $query, CRM_Core_DAO::$_nullArray ); $mailingIDs = array( ); while ( $dao->fetch( ) )

      { $mailingIDs[] = $dao->id; }

      } return $mailingIDs; } /** * Get the rows for a browse operation * * @param int $offset The row number to start from * @param int $rowCount The nmber of rows to return * @param string $sort The sql string that describes the sort order * * @return array The rows * @access public */ public function &getRows($offset, $rowCount, $sort, $additionalClause = null, $additionalParams = null ) { $mailing = self::getTableName(); $job = CRM_Mailing_BAO_Job::getTableName(); $group = CRM_Mailing_DAO_Group::getTableName( ); $session =& CRM_Core_Session::singleton(); $domain_id = $session->get('domainID'); $mailingACL = self::mailingACL( ); $query = " SELECT $mailing.id, $mailing.name, $job.status, MIN($job.scheduled_date) as scheduled_date, MIN($job.start_date) as start_date, MAX($job.end_date) as end_date FROM $mailing LEFT JOIN $job ON ( $job.mailing_id = $mailing.id AND $job.is_test = 0) WHERE $mailing.domain_id = $domain_id AND $mailingACL $additionalClause GROUP BY $mailing.id "; if ($sort) { $orderBy = trim( $sort->orderBy() ); if ( ! empty( $orderBy ) )

      { $query .= " ORDER BY $orderBy"; }

      } if ($rowCount)

      { $query .= " LIMIT $offset, $rowCount "; }

      if ( ! $additionalParams )

      { $additionalParams = array( ); }

      $dao = CRM_Core_DAO::executeQuery( $query, $additionalParams ); $rows = array(); while ($dao->fetch())

      { $rows[] = array( 'id' => $dao->id, 'name' => $dao->name, 'status' => CRM_Mailing_BAO_Job::status($dao->status), 'scheduled' => CRM_Utils_Date::customFormat($dao->scheduled_date), 'scheduled_iso' => $dao->scheduled_date, 'start' => CRM_Utils_Date::customFormat($dao->start_date), 'end' => CRM_Utils_Date::customFormat($dao->end_date) ); }

      return $rows; } /** * compose the url to show details of activityHistory for CiviMail * * @param int $id * * @static * @access public */ static function showEmailDetails( $id )

      { return CRM_Utils_System::url('civicrm/mailing/report', "mid=$id"); }

      /** * Delete Mails and all its associated records * * @param int $id id of the mail to delete * * @return void * @access public * @static */ public static function del($id) { $dependencies = array( 'CRM_Mailing_DAO_Job','CRM_Mailing_DAO_Group', 'CRM_Mailing_DAO_TrackableURL'); foreach ($dependencies as $className) { eval('$dao = & new ' . $className . '();'); $dao->mailing_id = $id; if ( $className == 'CRM_Mailing_DAO_Job' ) { $dao->find( ); while ($dao->fetch()) { if ( $dao->status == 'Complete' || $dao->status == 'Canceled') { $daoSpool = new CRM_Mailing_BAO_Spool(); $daoSpool->job_id = $dao->id; if ( $daoSpool->find( true ) )

      { CRM_Core_Session::setStatus(ts('Selected mailing can not be deleted as mails are still pending in spool table.')); return; }

      } elseif ( $dao->status == 'Running' )

      { CRM_Core_Session::setStatus(ts('Selected mailing can not be deleted since it is in process.')); return; }

      $daoQueue = new CRM_Mailing_Event_BAO_Queue(); $daoQueue->deleteEventQueue( $dao->id, 'job'); $dao->delete(); } continue; } $dao->delete(); } $dao = & new CRM_Mailing_DAO_Mailing(); $dao->id = $id; $dao->delete(); CRM_Core_Session::setStatus(ts('Selected mailing has been deleted.')); } /** * Delete Jobss and all its associated records * related to test Mailings * * @param int $id id of the Job to delete * * @return void * @access public * @static */ public static function delJob($id) { $daoJob = new CRM_Mailing_BAO_Job(); $daoJob->id = $id; if ( $daoJob->find() )

      { $daoQueue = new CRM_Mailing_Event_BAO_Queue(); $daoQueue->deleteEventQueue( $daoJob->id, 'job'); }

      $daoJob->delete(); } function getReturnProperties( ) { $tokens =& $this->getTokens( ); $properties = array( ); if ( isset( $tokens['html'] ) && isset( $tokens['html']['contact'] ) )

      { $properties = array_merge( $properties, $tokens['html']['contact'] ); }

      if ( isset( $tokens['text'] ) && isset( $tokens['text']['contact'] ) )

      { $properties = array_merge( $properties, $tokens['text']['contact'] ); }

      $returnProperties = array( ); $returnProperties['display_name'] = $returnProperties['contact_id'] = $returnProperties['preferred_mail_format'] = 1; foreach ( $properties as $p )

      { $returnProperties[$p] = 1; }

      return $returnProperties; } } ?>

      I have to manually go back to the site (either by typing in the address or using a shortcut). When I log back into CiviCRM, it takes me back to the next screen with the message that says the contact has been deleted.

        Attachments

          Activity

            People

            • Assignee:
              lobo Donald A. Lobo
              Reporter:
              wonder95 Steve Edwards
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: