INFRA-132 - CRM/Core - phpcbf
[civicrm-core.git] / CRM / Core / Smarty / plugins / function.crmAPI.php
index 44167bc0a1251d24ec164bbf1f62f1f3eb2ba19d..1177c2f48250822e9ee3ae79abbeaf2d2d272814 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.4                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -46,7 +46,7 @@ function smarty_function_crmAPI($params, &$smarty) {
     $smarty->trigger_error("assign: missing 'entity' parameter");
     return "crmAPI: missing 'entity' parameter";
   }
-  CRM_Core_Error::setCallback(array('CRM_Utils_REST', 'fatal'));
+  $errorScope = CRM_Core_TemporaryErrorScope::create(array('CRM_Utils_REST', 'fatal'));
   $action = $params['action'];
   $entity = $params['entity'];
   unset($params['entity']);
@@ -55,7 +55,7 @@ function smarty_function_crmAPI($params, &$smarty) {
   $params['version'] = 3;
   require_once 'api/api.php';
   $result = civicrm_api($entity, $action, $params);
-  CRM_Core_Error::setCallback();
+  unset($errorScope);
   if ($result === FALSE) {
     $smarty->trigger_error("Unkown error");
     return;
@@ -75,7 +75,3 @@ function smarty_function_crmAPI($params, &$smarty) {
     $smarty->assign($params["var"], $result);
   }
 }
-
-
-
-