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 CiviCase (Moderator: Dave Greenberg) »
  • Undefined variable: null in CRM_Case_BAO_Case::create() (line 125
Pages: [1]

Author Topic: Undefined variable: null in CRM_Case_BAO_Case::create() (line 125  (Read 1180 times)

eCnet

  • I’m new here
  • *
  • Posts: 11
  • Karma: 0
    • 100 Black Men Omaha
  • CiviCRM version: 4.0
  • CMS version: Drupal 7.x
  • MySQL version: latest
  • PHP version: 5.x
Undefined variable: null in CRM_Case_BAO_Case::create() (line 125
October 06, 2011, 06:00:59 pm
Drupal 7.08
CiviCRM 4.05
Getting this error when creating a case

Undefined variable: null in CRM_Case_BAO_Case::create() (line 125 of /home/jmason27/public_html/sites/all/modules/civicrm/CRM/Case/BAO/Case.php)

/**
     * Given the list of params in the params array, fetch the object
     * and store the values in the values array
     *
     * @param array $params input parameters to find object
     * @param array $values output values of the object
     * @param array $ids    the array that holds all the db ids
     *
     * @return CRM_Case_BAO_Case|null the found object or null
     * @access public
     * @static
     */
    static function &getValues( &$params, &$values, &$ids )
    {
        $case = new CRM_Case_BAO_Case( );

        $case->copyValues( $params );
       
        if ( $case->find(true) ) {
            $ids['case']    = $case->id;
            CRM_Core_DAO::storeValues( $case, $values );
            return $case;
        }
        return null;
    }

    /**
     * takes an associative array and creates a case object
     *
     * @param array $params (reference ) an assoc array of name/value pairs
     * @param array $ids    the array that holds all the db ids
     *
     * @return object CRM_Case_BAO_Case object
     * @access public
     * @static
     */
    static function &create( &$params )
    {
        require_once 'CRM/Core/Transaction.php';
        $transaction = new CRM_Core_Transaction( );
       
        if ( CRM_Utils_Array::value( 'id', $params ) ) {
            CRM_Utils_Hook::pre( 'edit', 'Case', $params['id'], $params );
        } else {
            CRM_Utils_Hook::pre( 'create', 'Case', $null, $params );
        }
       
        $case = self::add( $params );

        if ( is_a( $case, 'CRM_Core_Error') ) {
            $transaction->rollback( );
            return $case;
        }

        if ( CRM_Utils_Array::value( 'id', $params ) ) {
            CRM_Utils_Hook::post( 'edit', 'Case', $case->id, $case );
        } else {
            CRM_Utils_Hook::post( 'create', 'Case', $case->id, $case );
        }
        $transaction->commit( );
               
        //we are not creating log for case
        //since case log can be tracked using log for activity.
        return $case;
    }

Any assistance is appreciated.

demeritcowboy

  • Ask me questions
  • ****
  • Posts: 570
  • Karma: 42
  • CiviCRM version: Always the latest!
  • CMS version: Drupal 6 mostly, still evaluating 7.
  • MySQL version: Mix of 5.0 / 5.1 / 5.5
  • PHP version: 5.3, usually on Windows
Re: Undefined variable: null in CRM_Case_BAO_Case::create() (line 125
October 07, 2011, 06:13:19 am
I remember this being fixed but don't remember what version - remove the $ from $null, i.e.
CRM_Utils_Hook::pre( 'create', 'Case', null, $params );

eCnet

  • I’m new here
  • *
  • Posts: 11
  • Karma: 0
    • 100 Black Men Omaha
  • CiviCRM version: 4.0
  • CMS version: Drupal 7.x
  • MySQL version: latest
  • PHP version: 5.x
Re: Undefined variable: null in CRM_Case_BAO_Case::create() (line 125
October 07, 2011, 03:24:53 pm
It worked thank you

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviCase (Moderator: Dave Greenberg) »
  • Undefined variable: null in CRM_Case_BAO_Case::create() (line 125

This forum was archived on 2017-11-26.