LP1751800 - fix fields fields reversing
authorJames Fournie <jamesrf@users.noreply.github.com>
Thu, 2 May 2019 16:53:35 +0000 (09:53 -0700)
committerDan Wells <dbw2@calvin.edu>
Wed, 14 Aug 2019 13:14:06 +0000 (09:14 -0400)
The pop() here will remove the last item in the array, only to add it
later with a push() a few lines later.  Instead use a shift() to
preserve the order.

Signed-off-by: James Fournie <james.fournie@gmail.com>
Signed-off-by: Remington Steed <rjs7@calvin.edu>
Signed-off-by: Dan Wells <dbw2@calvin.edu>
Open-ILS/web/js/ui/default/staff/reporter/services/template.js

index 043dd47..3908654 100644 (file)
@@ -406,7 +406,7 @@ function($uibModal , $q , egCore , egConfirmDialog , egAlertDialog) {
     service.removeField = function (type, field) {
         var new_list = [];
         while (service[type].length) {
-            var f = service[type].pop();
+            var f = service[type].shift();
             if (field.index != f.index ) new_list.push(f);
         }
         new_list.forEach(function(f) {