Bug 19469: (QA follow-up) When altering priorities, use the existing priority numbers...
authorKyle M Hall <kyle@bywatersolutions.com>
Fri, 27 Apr 2018 09:21:28 +0000 (09:21 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Fri, 14 Sep 2018 17:50:20 +0000 (17:50 +0000)
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt

index 6b04892..de06a44 100644 (file)
                 }
             });
             var prev_rank_request;
+            var priorities;
             $("select[name=rank-request]").on("focus", function() {
                 prev_rank_request = $(this).val();
+                var row = $(this).parents("tr:first");
+                priorities = row.parent().find("select[name=rank-request]").map( function() {
+                    return $(this).val();
+                }).get();
             }).change(function() {
                 var row = $(this).parents("tr:first");
                 var value = parseInt($(this).val());
                     row.insertAfter(after);
                 }
 
-                var next_priority = 1;
+                var next_priority = 0;
                 row.parent().find("select[name=rank-request]").each(function () {
-                    $(this).val(next_priority);
+                    $(this).val(priorities[next_priority]);
                     next_priority++;
                 });
             });