[open-ils-commits] r15564 - in trunk/Open-ILS: src/perlmods/OpenILS/Application/Acq web/css/skin/default web/js/dojo/openils/acq/nls web/js/ui/default/acq/common web/js/ui/default/acq/lineitem web/templates/default/acq/common (senator)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Feb 17 09:33:12 EST 2010


Author: senator
Date: 2010-02-17 09:33:11 -0500 (Wed, 17 Feb 2010)
New Revision: 15564

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm
   trunk/Open-ILS/web/css/skin/default/acq.css
   trunk/Open-ILS/web/js/dojo/openils/acq/nls/acq.js
   trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js
   trunk/Open-ILS/web/js/ui/default/acq/lineitem/search.js
   trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2
Log:
Acq: more LI search interface improvements

Another bug fixed that made LI searches sometimes not find LIs that
    didn't belong to a PO already

Generalized the ISBN export feature in the LI table to be an exporter of
    more attributes.


Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm	2010-02-17 14:22:56 UTC (rev 15563)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm	2010-02-17 14:33:11 UTC (rev 15564)
@@ -320,7 +320,11 @@
                     "field" => "id",
                     "fkey" => "lineitem",
                     "join" => {
-                        "acqpo" => {"field" => "id", "fkey" => "purchase_order"}
+                        "acqpo" => {
+                            "type" => "left",
+                            "field" => "id",
+                            "fkey" => "purchase_order"
+                        }
                     }
                 }
             }

Modified: trunk/Open-ILS/web/css/skin/default/acq.css
===================================================================
--- trunk/Open-ILS/web/css/skin/default/acq.css	2010-02-17 14:22:56 UTC (rev 15563)
+++ trunk/Open-ILS/web/css/skin/default/acq.css	2010-02-17 14:33:11 UTC (rev 15564)
@@ -136,6 +136,7 @@
 #acq-lit-li-details-table th {padding:0px 3px 1px 3px; font-weight:bold;}
 #acq-lit-li-details-table .dijit {width:130px;}
 #acq-lit-li-details-table td input {width:100px;}
+#acq-lit-export-attr { margin-left: 10px; }
 .acq-lit-note-textarea { border-right: 2px solid #aaa; width:50%;}
 .acq-lit-note-textarea div { padding: 4px; font-weight: bold; }
 #acq-lit-notes-tbody td {padding: 20px 10px 20px 10px; border-bottom:2px solid #aaa;}

Modified: trunk/Open-ILS/web/js/dojo/openils/acq/nls/acq.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/acq/nls/acq.js	2010-02-17 14:22:56 UTC (rev 15563)
+++ trunk/Open-ILS/web/js/dojo/openils/acq/nls/acq.js	2010-02-17 14:33:11 UTC (rev 15564)
@@ -15,7 +15,7 @@
     'LI_ATTR_SEARCH_TOO_LARGE': "That file is too large for this operation.",
     'SELECT_AN_LI_ATTRIBUTE': "You must select an LI attribute.",
     'NO_RESULTS': "No results.",
-    'ISBN_SAVE_DIALOG_TITLE': "Save ISBNs to a file",
-    'ISBN_SHORT_LIST': "Not all of the selected items had ISBNs.\nChoose OK to save the ISBNs that could be found.",
-    'ISBN_EMPTY_LIST': "No ISBNs found."
+    'EXPORT_SAVE_DIALOG_TITLE': "Save field values to a file",
+    'EXPORT_SHORT_LIST': "Not all of the selected items had the attribute '${0}'.\nChoose OK to save those values that could be found.",
+    'EXPORT_EMPTY_LIST': "No values for attribute '${0}' found."
 }

Modified: trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js	2010-02-17 14:22:56 UTC (rev 15563)
+++ trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js	2010-02-17 14:33:11 UTC (rev 15564)
@@ -19,6 +19,7 @@
 dojo.requireLocalization('openils.acq', 'acq');
 var localeStrings = dojo.i18n.getLocalization('openils.acq', 'acq');
 const XUL_OPAC_WRAPPER = 'chrome://open_ils_staff_client/content/cat/opac.xul';
+var li_exportable_attrs = ["issn", "isbn", "upc"];
 
 function nodeByName(name, context) {
     return dojo.query('[name='+name+']', context)[0];
@@ -1024,8 +1025,8 @@
                 this.createAssets();
                 break;
 
-            case 'export_isbn_list':
-                this.exportISBNList();
+            case 'export_attr_list':
+                this.chooseExportAttr();
                 break;
 
             case 'add_brief_record':
@@ -1053,34 +1054,61 @@
         );
     }
 
-    /* Should really think about generalizing this to do more than ISBN #s */
-    this.exportISBNList = function() {
-        var selected = this.getSelected();
-        var isbn_list = selected.map(
+    this.chooseExportAttr = function() {
+        if (!acqLitExportAttrSelector._li_setup) {
+            var self = this;
+            acqLitExportAttrSelector.store = new dojo.data.ItemFileReadStore(
+                {
+                    "data": acqliad.toStoreData(
+                        (new openils.PermaCrud()).search(
+                            "acqliad", {"code": li_exportable_attrs}
+                        )
+                    )
+                }
+            );
+            acqLitExportAttrSelector.setValue();
+            acqLitExportAttrButton.onClick = function(){self.exportAttrList();};
+            acqLitExportAttrSelector._li_setup = true;
+        }
+        openils.Util.show("acq-lit-export-attr-holder", "inline");
+    };
+
+    this.exportAttrList = function() {
+        var attr_def = acqLitExportAttrSelector.item;
+        var li_list = this.getSelected();
+        var value_list = li_list.map(
             function(li) {
                 return (new openils.acq.Lineitem({"lineitem": li})).findAttr(
-                    "isbn", "lineitem_marc_attr_definition"
+                    attr_def.code, "lineitem_marc_attr_definition"
                 );
             }
         ).filter(function(attr) { return Boolean(attr); });
 
-        if (isbn_list.length > 0) {
-            if (isbn_list.length < selected.length) {
-                if (!confirm(localeStrings.ISBN_SHORT_LIST)) {
+        if (value_list.length > 0) {
+            if (value_list.length < li_list.length) {
+                if (!confirm(
+                    dojo.string.substitute(
+                        localeStrings.EXPORT_SHORT_LIST, [attr_def.description]
+                    )
+                )) {
                     return;
                 }
             }
             try {
                 openils.XUL.contentToFileSaveDialog(
-                    isbn_list.join("\n"),
-                    localeStrings.ISBN_SAVE_DIALOG_TITLE
+                    value_list.join("\n"),
+                    localeStrings.EXPORT_SAVE_DIALOG_TITLE
                 );
             } catch (E) {
                 alert(E);
             }
         } else {
-            alert(localeStrings.ISBN_EMPTY_LIST);
+            alert(dojo.string.substitute(
+                localeStrings.EXPORT_EMPTY_LIST, [attr_def.description]
+            ));
         }
+
+        openils.Util.hide("acq-lit-export-attr-holder");
     };
 
     this.printPO = function() {

Modified: trunk/Open-ILS/web/js/ui/default/acq/lineitem/search.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/lineitem/search.js	2010-02-17 14:22:56 UTC (rev 15563)
+++ trunk/Open-ILS/web/js/ui/default/acq/lineitem/search.js	2010-02-17 14:33:11 UTC (rev 15564)
@@ -10,7 +10,6 @@
 dojo.require("openils.XUL");
 dojo.require("openils.widget.AutoFieldWidget");
 
-var _searchable_by_array = ["issn", "isbn", "upc"];
 var combinedAttrValueArray = [];
 var scalarAttrSearchManager;
 var liTable;
@@ -36,7 +35,7 @@
 function prepareArraySearchStore(pcrud) {
     attrArrayDefSelector.store = new dojo.data.ItemFileReadStore({
         "data": acqliad.toStoreData(
-            pcrud.search("acqliad", {"code": _searchable_by_array})
+            pcrud.search("acqliad", {"code": li_exportable_attrs})
         )
     });
 }

Modified: trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2	2010-02-17 14:22:56 UTC (rev 15563)
+++ trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2	2010-02-17 14:33:11 UTC (rev 15564)
@@ -18,7 +18,7 @@
                                             <option mask='pl' value='order_ready'>Mark Ready for Order</option>
                                             <option mask='*'  value='delete_selected'>Delete Selected Items</option>
                                             <option mask='*'  value='add_brief_record'>Add Brief Record</option>
-                                            <option mask='*'  value='export_isbn_list'>Export ISBN List</option>
+                                            <option mask='*'  value='export_attr_list'>Export Single Attribute List</option>
                                             <option mask='po' value='' disabled='disabled'>----PO----</option>
                                             <option mask='sr|pl' value='create_order'>Create Purchase Order</option>
                                             <option mask='po' value='create_assets'>Load Bibs and Items</option>
@@ -26,6 +26,10 @@
                                             <option mask='po' value='rollback_receive_po'>Un-Receive Purchase Order</option>
                                             <option mask='po' value='print_po'>Print Purchase Order</option>
                                         </select>
+                                        <span id="acq-lit-export-attr-holder" class="hidden">
+                                            <input dojoType="dijit.form.FilteringSelect" id="acq-lit-export-attr" jsId="acqLitExportAttrSelector" labelAttr="description" searchAttr="description" />
+                                            <span dojoType="dijit.form.Button" jsId="acqLitExportAttrButton">Export List</span>
+                                        </span>
                                     </span>
                                     <span id='acq-lit-generic-progress' class='hidden'>
                                         <span dojoType="dijit.ProgressBar" style="width:300px" jsId="litGenericProgress"></span>



More information about the open-ils-commits mailing list