LP1182605 : LC call numbers sort improperly in tabular displays
authorKyle Tomita <tomitakyle@gmail.com>
Mon, 2 Dec 2013 23:50:17 +0000 (15:50 -0800)
committerDan Wells <dbw2@calvin.edu>
Wed, 27 Aug 2014 01:45:08 +0000 (21:45 -0400)
The issue was that the column was sorting on the label (call number)
and not label_sortkey.  An attribute 'sort_value' was added that used
label_sortkey.

Signed-off-by: Kyle Tomita <tomitakyle@gmail.com>
modified:   Open-ILS/xul/staff_client/server/circ/util.js
(cherry picked from commit 696ce9e6c36bffd1d8c884baab2f5d36687e741b)

Signed-off-by: Victoria Lewis <vcamklewis@gmail.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Signed-off-by: Remington Steed <rjs7@calvin.edu>
Signed-off-by: Dan Wells <dbw2@calvin.edu>
Open-ILS/xul/staff_client/server/circ/util.js

index 058eb92..991b62c 100644 (file)
@@ -565,6 +565,50 @@ circ.util.columns = function(modify,params) {
             'flex' : 1,
             'primary' : false,
             'hidden' : true,
+            'sort_value' : function(my,scratch_data) {
+                var acn_id;
+                if (my.acn) {
+                    if (typeof my.acn == 'object') {
+                        acn_id = my.acn.id();
+                    } else {
+                        acn_id = my.acn;
+                    }
+                } else if (my.acp) {
+                    if (typeof my.acp.call_number() == 'object' && my.acp.call_number() != null) {
+                        acn_id = my.acp.call_number().id();
+                    } else {
+                        acn_id = my.acp.call_number();
+                    }
+                }
+                if (!acn_id && acn_id != 0) {
+                    return '';
+                } else if (acn_id == -1) {
+                    return document.getElementById('circStrings').getString('staff.circ.utils.not_cataloged');
+                } else if (acn_id == -2) {
+                    return document.getElementById('circStrings').getString('staff.circ.utils.retrieving');
+                } else {
+                    if (!my.acn) {
+                        if (typeof scratch_data == 'undefined' || scratch_data == null) {
+                            scratch_data = {};
+                        }
+                        if (typeof scratch_data['acn_map'] == 'undefined') {
+                            scratch_data['acn_map'] = {};
+                        }
+                        if (typeof scratch_data['acn_map'][ acn_id ] == 'undefined') {
+                            var x = network.simple_request("FM_ACN_RETRIEVE.authoritative",[ acn_id ]);
+                            if (x.ilsevent) {
+                                return document.getElementById('circStrings').getString('staff.circ.utils.not_cataloged');
+                            } else {
+                                my.acn = x;
+                                scratch_data['acn_map'][ acn_id ] = my.acn;
+                            }
+                        } else {
+                            my.acn = scratch_data['acn_map'][ acn_id ];
+                        }
+                    }
+                    return my.acn.label_sortkey();
+                }
+            },
             'editable' : false, 'render' : function(my,scratch_data) {
                 var acn_id;
                 if (my.acn) {