CRM-15857 - crmMetadata - Use 'sequential' so that options are returned in ordered...
authorTim Otten <totten@civicrm.org>
Sun, 15 Feb 2015 00:41:16 +0000 (16:41 -0800)
committerTim Otten <totten@civicrm.org>
Mon, 16 Feb 2015 20:48:59 +0000 (12:48 -0800)
js/angular-crm-util.js
partials/crmMailing/dialog/recipientOptions.html

index 2349fcff97c472730b277d5b6fe75d44ca104b1f..02708afe1bd374d667c2337f46f62b18dbbba2b4 100644 (file)
         deferreds[cacheKey].push(deferred);
 
         if (needFetch) {
-          crmApi(entity, 'getfields', {action: action, options: {get_options: 'all'}})
+          crmApi(entity, 'getfields', {action: action, sequential: 1, options: {get_options: 'all'}})
             .then(
             // on success:
             function(fields) {
-              cache[cacheKey] = fields.values;
+              cache[cacheKey] = _.indexBy(fields.values, 'name');
               angular.forEach(deferreds[cacheKey], function(dfr) {
-                dfr.resolve(fields.values);
+                dfr.resolve(cache[cacheKey]);
               });
               delete deferreds[cacheKey];
             },
index 4454dd2f98398611f133ae82a9cf5f363bdb626a..3deb9f769e3cdd49cf2eb27ebf5e1ee108dd5056 100644 (file)
@@ -27,8 +27,8 @@
           >
 
           <option value="">{{ts('Automatic')}}</option>
-          <option ng-repeat="(locTypeId,locType) in model.fields.location_type_id.options | orderBy:'locType'"
-                  ng-value="locTypeId">{{locType}}</option>
+          <option ng-repeat="locType in model.fields.location_type_id.options"
+                  ng-value="locType.key">{{locType.value}}</option>
         </select>
       </div>
 
@@ -40,8 +40,8 @@
           ng-model="model.mailing.email_selection_method"
           required
           >
-          <option ng-repeat="(selMetId,selMet) in model.fields.email_selection_method.options | orderBy:'selMet'"
-                  ng-value="selMetId">{{selMet}}</option>
+          <option ng-repeat="selMet in model.fields.email_selection_method.options"
+                  ng-value="selMet.key">{{selMet.value}}</option>
         </select>
       </div>