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) »
  • Error during adding Case type
Pages: [1]

Author Topic: Error during adding Case type  (Read 2190 times)

happyHacker

  • Guest
Error during adding Case type
April 20, 2009, 07:52:32 am
warning: max() [function.max]: Array must contain at least one element in /var/www/clients/sites/all/modules/civicrm/CRM/Utils/Weight.php on line 198.

The case type was added but I do not know if it fully works.

When I added a further case type no error was reported.

Should I check anything here?

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Error during adding Case type
April 20, 2009, 08:35:23 am
Can you give exact steps to replicate this behavior on demo. Also please upgrade to latest 2.2 stable.

Kurund
Found this reply helpful? Support CiviCRM

Shailesh Lende

  • Guest
Re: Error during adding Case type
April 22, 2009, 05:39:02 am
Hi,
Quote
warning: max() [function.max]: Array must contain at least one element in /var/www/clients/sites/all/modules/civicrm/CRM/Utils/Weight.php on line 198.

The case type was added but I do not know if it fully works.
This is minor fix and can get fixed in CiviCRM latest future release.
You can fix this locally by insert following code in CRM/ Utils/Weight.php at line No 197 as
Code: [Select]
-        } else {
+        } elseif( !empty($weights) ) {


Hth
-Shailesh

happyHacker

  • Guest
Re: Error during adding Case type
June 06, 2009, 02:11:32 am
Unsure how to do this. This is the code in the area you point to:

        $newWeight = 1;
        if ( $sameWeightCount ) {
            $newWeight = max( $weights ) + 1;
           
            //check for max wt should not greater than cal max wt.
            $calMaxWt  = min( $weights ) + count( $weights ) - 1;
            if ( $newWeight > $calMaxWt ) {
                $newWeight = $calMaxWt;
            }
        } else {
            $newWeight = max( $weights );
        }
       
        return $newWeight;
    }

Can you show me the mod?

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Error during adding Case type
June 08, 2009, 09:27:19 pm
I think fix is already part of latest stable release, so you should consider upgrading. Note that there were changes to code base so patch provided by Shailesh may not be valid.

Kurund
Found this reply helpful? Support CiviCRM

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviCase (Moderator: Dave Greenberg) »
  • Error during adding Case type

This forum was archived on 2017-11-26.