CRM-13296 deal with possibility minimum_fee is NULL
authoreileen <eileen@fuzion.co.nz>
Thu, 29 Aug 2013 02:51:34 +0000 (14:51 +1200)
committereileen <eileen@fuzion.co.nz>
Thu, 29 Aug 2013 02:51:34 +0000 (14:51 +1200)
CRM/Utils/Token.php

index 73ce56a018d47fc99b82380e6adcbab42cd4a648..f5a3985f832f0359452b6fe847371c8d4831e3eb 100644 (file)
@@ -1411,7 +1411,14 @@ class CRM_Utils_Token {
        $value = $statuses[$membership['status_id']];
        break;
      case 'fee':
-       $value = civicrm_api3('membership_type', 'getvalue', array('id' => $membership['membership_type_id'], 'return' => 'minimum_fee'));
+       try{
+         $value = civicrm_api3('membership_type', 'getvalue', array('id' => $membership['membership_type_id'], 'return' => 'minimum_fee'));
+       }
+       catch (CiviCRM_API3_Exception $e) {
+         // we can anticipate we will get an error if the minimum fee is set to 'NULL' because of the way the
+         // api handles NULL (4.4)
+         $value = 0;
+       }
        break;
      default:
        if (in_array($token, self::$_tokens[$entity])) {