Add to Picklist function for acq user requests. Disable EditOnEnter for list view.
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 22 Mar 2010 21:31:15 +0000 (21:31 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 22 Mar 2010 21:31:15 +0000 (21:31 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@15932 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/ui/default/acq/picklist/brief_record.js
Open-ILS/web/js/ui/default/acq/picklist/user_request.js
Open-ILS/web/templates/default/acq/picklist/user_request.tt2

index d5ea700..17be135 100644 (file)
@@ -13,6 +13,7 @@ dojo.require('openils.CGI');
 var attrDefs = {};
 var paramPL = null;
 var paramPO = null;
+var paramUR = null; // User Request ID
 
 function drawBriefRecordForm(fields) {
 
@@ -21,6 +22,7 @@ function drawBriefRecordForm(fields) {
     var cgi = new openils.CGI();
     paramPL = cgi.param('pl');
     paramPO = cgi.param('po');
+    paramUR = cgi.param('ur');
     prepop = JSON2js(cgi.param('prepop'));
 
 
@@ -213,6 +215,17 @@ function compileBriefRecord(fields, editMarc) {
                 if(!id) return;
                 if(editMarc) {
                     // XXX load marc editor
+                } else if (paramUR) {
+                    // update User Request with Lineitem and reload request interface
+                    var pcrud = new openils.PermaCrud({ authtoken : openils.User.authtoken });
+                    var aur_obj = pcrud.retrieve('aur',paramUR);
+                    aur_obj.lineitem( id );
+                    pcrud.update( aur_obj, {
+                        'oncomplete' : function(r, cudResults) {
+                            // Goes back to the list view
+                            location.href = oilsBasePath + '/acq/picklist/user_request';
+                        }
+                    });
                 } else {
                     if(fields.picklist) 
                         location.href = oilsBasePath + '/acq/picklist/view/' + fields.picklist;
index 2459152..ca0f04c 100644 (file)
@@ -8,6 +8,7 @@ dojo.require("dijit.layout.StackContainer");
 dojo.require('openils.PermaCrud');
 
 var contextOrg;
+var aur_obj;
 
 function setup() {
 
@@ -22,7 +23,7 @@ function setup() {
 
 function drawRequest() {
     var pcrud = new openils.PermaCrud({ authtoken : openils.User.authtoken });
-    var aur_obj = pcrud.retrieve('aur',reqId);
+    aur_obj = pcrud.retrieve('aur',reqId);
 
     // hide the grid and the context selector
     dijit.byId('stackContainer').forward();
@@ -44,7 +45,13 @@ function drawRequest() {
 
 function addToPicklist() {
     // reqId
-    alert('stub');
+    location.href = oilsBasePath + "/acq/picklist/brief_record?ur=" + reqId + "&prepop=" + encodeURIComponent(js2JSON({
+        "1": aur_obj.title() || aur_obj.article_title() || aur_obj.volume(),
+        "2": aur_obj.author(),
+        "5": aur_obj.isxn(),
+        "9": aur_obj.publisher(),
+        "10": aur_obj.pubdate()
+    }));
 }
 
 function setNoHold() {
index 0917e8c..f89553c 100644 (file)
@@ -4,6 +4,7 @@
 <script>var reqId = '[% ctx.page_args.0 %]';</script>
 
     <div dojoType="dijit.layout.StackContainer" id="stackContainer" doLayout="false">
+        <!-- *** List View ********************************************************************************* -->
         <div dojoType="dijit.layout.ContentPane">
             <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
                 <div>[% ctx.page_title %]</div>
@@ -33,8 +34,7 @@
                     suppressFields="['id']"
                     showPaginator='true'
                     showColumnPicker='true'
-                    columnPickerPrefix='"acq.picklist.user_request"'
-                    editOnEnter='true'>
+                    columnPickerPrefix='"acq.picklist.user_request"'>
                     <thead>
                         <tr>
                             <th field='title' get='getTitle' formatter='formatTitle'/>
@@ -42,6 +42,7 @@
                     </thead>
             </table>
         </div>
+        <!-- *** Detail View ********************************************************************************* -->
         <div dojoType="dijit.layout.ContentPane" style="height: 100%;">
             <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class='oils-header-panel'>
                 <div>Patron Request</div>