4.7.16 release notes - result of initial automated run
[civicrm-core.git] / ang / crmUtil.js
index b6a0d013104490866993547922f3a2a4368b7ea1..8cb6242689a559b5027862bffdcd8c816e7147ec 100644 (file)
@@ -2,8 +2,8 @@
 (function (angular, $, _) {
   angular.module('crmUtil', []);
 
-  // usage:
-  //   crmApi('Entity', 'action', {...}).then(function(apiResult){...})
+  // Angular implementation of CRM.api3
+  // @link http://wiki.civicrm.org/confluence/display/CRMDOC/AJAX+Interface#AJAXInterface-CRM.api3
   //
   // Note: To mock API results in unit-tests, override crmApi.backend, e.g.
   //   var apiSpy = jasmine.createSpy('crmApi');
       var deferred = $q.defer();
       var p;
       var backend = crmApi.backend || CRM.api3;
+      if (params && params.body_html) {
+        // CRM-18474 - remove Unicode Character 'LINE SEPARATOR' (U+2028)
+        // and 'PARAGRAPH SEPARATOR' (U+2029) from the html if present.
+        params.body_html = params.body_html.replace(/([\u2028]|[\u2029])/g, '\n');
+      }
       if (_.isObject(entity)) {
         // eval content is locally generated.
         /*jshint -W061 */
-        p = backend(eval('('+angular.toJson(entity)+')'), message);
+        p = backend(eval('('+angular.toJson(entity)+')'), action);
       } else {
         // eval content is locally generated.
         /*jshint -W061 */