]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/xul/staff_client/server/patron/summary.js
Remove Standing Penalty summary. This was an incomplete experiment that didn't pan...
[Evergreen.git] / Open-ILS / xul / staff_client / server / patron / summary.js
1 dump('entering patron.summary.js\n');
2
3 function $(id) { return document.getElementById(id); }
4 var patronStrings = $('patronStrings');
5
6 if (typeof patron == 'undefined') patron = {};
7 patron.summary = function (params) {
8
9         JSAN.use('util.error'); this.error = new util.error();
10         JSAN.use('util.window'); this.window = new util.window();
11         JSAN.use('util.network'); this.network = new util.network();
12     JSAN.use('util.widgets');
13         this.w = window;
14 }
15
16 patron.summary.prototype = {
17
18         'init' : function( params ) {
19
20                 var obj = this;
21
22                 obj.barcode = params['barcode'];
23                 obj.id = params['id'];
24                 if (params['show_name']) {
25                         document.getElementById('patron_name').hidden = false;
26                         document.getElementById('patron_name').setAttribute('hidden','false');
27                 }
28
29                 JSAN.use('OpenILS.data'); this.OpenILS = {}; 
30                 obj.OpenILS.data = new OpenILS.data(); obj.OpenILS.data.init({'via':'stash'});
31
32                 JSAN.use('util.controller'); obj.controller = new util.controller();
33                 obj.controller.init(
34                         {
35                                 control_map : {
36                                         'cmd_broken' : [
37                                                 ['command'],
38                                                 function() { alert($("commonStrings").getString('common.unimplemented')); }
39                                         ],
40                                         'patron_alert' : [
41                                                 ['render'],
42                                                 function(e) {
43                                                         return function() {
44                                                                 util.widgets.set_text( e, obj.patron.alert_message() || '' );
45                                                                 if (obj.patron.alert_message()) {
46                                                                         e.parentNode.hidden = false;
47                                                                 } else {
48                                                                         e.parentNode.hidden = true;
49                                                                 }
50                                                         };
51                                                 }
52                                         ],
53                                         'patron_usrname' : [
54                                                 ['render'],
55                                                 function(e) {
56                                                         return function() {
57                                                                 util.widgets.set_text(e,obj.patron.usrname());
58                                                         };
59                                                 }
60                                         ],
61                                         'patron_profile' : [
62                                                 ['render'],
63                                                 function(e) {
64                                                         return function() { 
65                                                                 util.widgets.set_text(e,
66                                                                         obj.OpenILS.data.hash.pgt[
67                                                                                 obj.patron.profile()
68                                                                         ].name()
69                                                                 );
70                                                         };
71                                                 }
72                                         ],
73                                         'patron_net_access' : [
74                                                 ['render'],
75                                                 function(e) {
76                                                         return function() { 
77                                                                 util.widgets.set_text(e,
78                                                                         patronStrings.getString('staff.patron.summary.patron_net_access') + 
79                                                                         ' ' + obj.OpenILS.data.hash.cnal[
80                                                                                 obj.patron.net_access_level()
81                                                                         ].name()
82                                                                 );
83                                                         };
84                                                 }
85                                         ],
86                                         'patron_credit' : [
87                                                 ['render'],
88                                                 function(e) {
89                                                         return function() { 
90                                                                 JSAN.use('util.money');
91                                                                 util.widgets.set_text(e,
92                                                                         '$' + 
93                                                                         util.money.sanitize(
94                                                                                 obj.patron.credit_forward_balance()
95                                                                         )
96                                                                 );
97                                                         };
98                                                 }
99                                         ],
100                                         'patron_bill' : [
101                                                 ['render'],
102                                                 function(e) {
103                                                         return function() { 
104                                                                 util.widgets.set_text(e,'...');
105                                 var under_btn; 
106                                 if (xulG) {
107                                     if (xulG.display_window) {
108                                         under_btn = xulG.display_window.document.getElementById('under_bills');
109                                         if (under_btn) util.widgets.set_text(under_btn,'...');
110                                     }
111                                 }
112                                                                 obj.network.simple_request(
113                                                                         'FM_MOUS_RETRIEVE.authoritative',
114                                                                         [ ses(), obj.patron.id() ],
115                                                                         function(req) {
116                                                                                 JSAN.use('util.money');
117                                                                                 var robj = req.getResultObject();
118                                                                                 util.widgets.set_text(e, patronStrings.getFormattedString('staff.patron.summary.patron_bill.money', [util.money.sanitize( robj.balance_owed() )]));
119                                                                                 if (under_btn) util.widgets.set_text(under_btn, 
120                                             patronStrings.getFormattedString('staff.patron.summary.patron_bill.money', [util.money.sanitize( robj.balance_owed() )]));
121                                                                         }
122                                                                 );
123                                                                 /*
124                                                                 obj.network.simple_request(
125                                                                         'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_BALANCE.authoritative',
126                                                                         [ ses(), obj.patron.id() ],
127                                                                         function(req) {
128                                                                                 JSAN.use('util.money');
129                                                                                 var list = req.getResultObject();
130                                                                                 if (typeof list.ilsevent != 'undefined') {
131                                                                                         util.widgets.set_text(e, '??? See Bills');
132                                                                                         return;
133                                                                                 }
134                                                                                 var sum = 0;
135                                                                                 for (var i = 0; i < list.length; i++) {
136                                                                                         var robj = typeof list[i] == 'object' ? list[i] : obj.network.simple_request('FM_MBTS_RETRIEVE.authoritative',[ses(),list[i]]);
137                                                                                         sum += util.money.dollars_float_to_cents_integer( robj.balance_owed() );
138                                                                                 } 
139                                                                                 if (sum > 0) addCSSClass(document.documentElement,'PATRON_HAS_BILLS');
140                                                                                 JSAN.use('util.money');
141                                                                                 util.widgets.set_text(e, '$' + util.money.sanitize( util.money.cents_as_dollars( sum ) ));
142                                                                         }
143                                                                 );
144                                                                 */
145                                                         };
146                                                 }
147                                         ],
148                                         'patron_checkouts' : [
149                                                 ['render'],
150                                                 function(e) {
151                                                         return function() { 
152                                                                 util.widgets.set_text(e,'...');
153                                                                 var e2 = document.getElementById( 'patron_overdue' ); if (e2) util.widgets.set_text(e2,'...');
154                                                                 var e3 = document.getElementById( 'patron_claimed_returned' ); if (e3) util.widgets.set_text(e3,'...');
155                                                                 var e4 = document.getElementById( 'patron_long_overdue' ); if (e4) util.widgets.set_text(e4,'...');
156                                                                 var e5 = document.getElementById( 'patron_lost' ); if (e5) util.widgets.set_text(e5,'...');
157                                                                 var e6 = document.getElementById( 'patron_noncat' ); if (e6) util.widgets.set_text(e6,'...');
158                                 var under_btn; 
159                                 if (xulG) {
160                                     if (xulG.display_window) {
161                                         under_btn = xulG.display_window.document.getElementById('under_items');
162                                         if (under_btn) util.widgets.set_text(under_btn,'...');
163                                     }
164                                 }
165                                                                 obj.network.simple_request(
166                                                                         'FM_CIRC_COUNT_RETRIEVE_VIA_USER.authoritative',
167                                                                         [ ses(), obj.patron.id() ],
168                                                                         function(req) {
169                                                                                 try {
170                                                                                         var robj = req.getResultObject();
171                                                                                         util.widgets.set_text(e, robj.out + robj.overdue + robj.claims_returned + robj.long_overdue );
172                                                                                         if (e2) util.widgets.set_text(e2, robj.overdue  );
173                                                                                         if (e3) util.widgets.set_text(e3, robj.claims_returned  );
174                                                                                         if (e4) util.widgets.set_text(e4, robj.long_overdue     );
175                                                                                         if (e5) util.widgets.set_text(e5, robj.lost     );
176                                             if (under_btn) util.widgets.set_text(under_btn, 
177                                                 String( robj.out + robj.overdue + robj.claims_returned + robj.long_overdue) + 
178                                                 ( robj.overdue > 0 ? '*' : '' )
179                                             );
180                                                                                 } catch(E) {
181                                                                                         alert(E);
182                                                                                 }
183                                                                         }
184                                                                 );
185                                                                 obj.network.simple_request(
186                                                                         'FM_ANCC_RETRIEVE_VIA_USER.authoritative',
187                                                                         [ ses(), obj.patron.id() ],
188                                                                         function(req) {
189                                                                                 var robj = req.getResultObject();
190                                                                                 if (e6) util.widgets.set_text(e6,robj.length);
191                                                                         }
192                                                                 );
193                                                         };
194                                                 }
195                                         ],
196                                         'patron_overdue' : [
197                                                 ['render'],
198                                                 function(e) {
199                                                         return function() { 
200                                                                 /* handled by 'patron_checkouts' */
201                                                         };
202                                                 }
203                                         ],
204                                         'patron_holds' : [
205                                                 ['render'],
206                                                 function(e) {
207                                                         return function() { 
208                                                                 util.widgets.set_text(e,'...');
209                                                                 var e2 = document.getElementById('patron_holds_available');
210                                                                 if (e2) util.widgets.set_text(e2,'...');
211                                 var under_btn; 
212                                 if (xulG) {
213                                     if (xulG.display_window) {
214                                         under_btn = xulG.display_window.document.getElementById('under_holds');
215                                         if (under_btn) util.widgets.set_text(under_btn,'...');
216                                     }
217                                 }
218                                                                 obj.network.simple_request(
219                                                                         'FM_AHR_COUNT_RETRIEVE.authoritative',
220                                                                         [ ses(), obj.patron.id() ],
221                                                                         function(req) {
222                                                                                 util.widgets.set_text(e,
223                                                                                         req.getResultObject().total
224                                                                                 );
225                                                                                 if (e2) util.widgets.set_text(e2,
226                                                                                         req.getResultObject().ready
227                                                                                 );
228                                         if (under_btn) util.widgets.set_text(under_btn, req.getResultObject().ready + '/' + req.getResultObject().total );
229                                                                         }
230                                                                 );
231                                                         };
232                                                 }
233                                         ],
234                                         'patron_holds_available' : [
235                                                 ['render'],
236                                                 function(e) {
237                                                         return function() { 
238                                                                 /* handled by 'patron_holds' */
239                                                         };
240                                                 }
241                                         ],
242                                         'patron_card' : [
243                                                 ['render'],
244                                                 function(e) {
245                                                         return function() { 
246                                                                 util.widgets.set_text(e,
247                                                                         obj.patron.card().barcode()
248                                                                 );
249                                                         };
250                                                 }
251                                         ],
252                                         'patron_ident_type_1' : [
253                                                 ['render'],
254                                                 function(e) {
255                                                         return function() { 
256                                                                 var ident_string = '';
257                                                                 var ident = obj.OpenILS.data.hash.cit[
258                                                                         obj.patron.ident_type()
259                                                                 ];
260                                                                 if (ident) ident_string = ident.name()
261                                                                 util.widgets.set_text(e,
262                                                                         ident_string
263                                                                 );
264                                                         };
265                                                 }
266                                         ],
267                                         'patron_ident_value_1' : [
268                                                 ['render'],
269                                                 function(e) {
270                                                         return function() { 
271                                                                 var val = obj.patron.ident_value();
272                                                                 val = val.replace(/.+(\d\d\d\d)$/,'xxxx$1');
273                                                                 util.widgets.set_text(e, val);
274                                                         };
275                                                 }
276                                         ],
277                                         'patron_ident_type_2' : [
278                                                 ['render'],
279                                                 function(e) {
280                                                         return function() { 
281                                                                 var ident_string = '';
282                                                                 var ident = obj.OpenILS.data.hash.cit[
283                                                                         obj.patron.ident_type2()
284                                                                 ];
285                                                                 if (ident) ident_string = ident.name()
286                                                                 util.widgets.set_text(e,
287                                                                         ident_string
288                                                                 );
289                                                         };
290                                                 }
291                                         ],
292                                         'patron_ident_value_2' : [
293                                                 ['render'],
294                                                 function(e) {
295                                                         return function() { 
296                                                                 var val = obj.patron.ident_value2();
297                                                                 val = val.replace(/.+(\d\d\d\d)$/,'xxxx$1');
298                                                                 util.widgets.set_text(e, val);
299                                                         };
300                                                 }
301                                         ],
302                                         'patron_date_of_exp' : [
303                                                 ['render'],
304                                                 function(e) {
305                                                         return function() { 
306                                                                 util.widgets.set_text(e,
307                                                                         patronStrings.getString('staff.patron.summary.expires_on') + ' ' + (
308                                                                                 obj.patron.expire_date() ?
309                                                                                 obj.patron.expire_date().substr(0,10) :
310                                                                             patronStrings.getString('staff.patron.field.unset') 
311                                                                         )
312                                                                 );
313                                                         };
314                                                 }
315                                         ],
316                                         'patron_date_of_birth' : [
317                                                 ['render'],
318                                                 function(e) {
319                                                         return function() { 
320                                 var hide_value = e.getAttribute('hide_value');
321                                 if ( hide_value == 'true' ) {
322                                     e.setAttribute( 'hidden_value',
323                                         obj.patron.dob() ?
324                                         obj.patron.dob().substr(0,10) :
325                                         patronStrings.getString('staff.patron.field.unset') 
326                                     );
327                                     util.widgets.set_text(e,
328                                         patronStrings.getString('staff.patron.field.hidden') 
329                                     );
330                                 } else {
331                                     util.widgets.set_text(e,
332                                         obj.patron.dob() ?
333                                         obj.patron.dob().substr(0,10) :
334                                         patronStrings.getString('staff.patron.field.unset') 
335                                     );
336                                     e.setAttribute( 'hidden_value',
337                                         patronStrings.getString('staff.patron.field.hidden') 
338                                     );
339                                 }
340                                 var x = document.getElementById('PatronSummaryContact_date_of_birth_label');
341                                 if (x) {
342                                     var click_to_hide_dob = x.getAttribute('click_to_hide_dob');
343                                     if (click_to_hide_dob == 'true') {
344                                         x.onclick = function() {
345                                             hide_value = e.getAttribute('hide_value');
346                                             e.setAttribute('hide_value', hide_value == 'true' ? 'false' : 'true'); 
347                                             var value = util.widgets.get_text(e);
348                                             var hidden_value = e.getAttribute('hidden_value');
349                                             util.widgets.set_text(e,hidden_value);
350                                             e.setAttribute('hidden_value',value);
351                                         }
352                                     }
353                                 }
354                                                         };
355                                                 }
356                                         ],
357                                         'patron_day_phone' : [
358                                                 ['render'],
359                                                 function(e) {
360                                                         return function() { 
361                                                                 util.widgets.set_text(e,
362                                                                         obj.patron.day_phone()
363                                                                 );
364                                                         };
365                                                 }
366                                         ],
367                                         'patron_evening_phone' : [
368                                                 ['render'],
369                                                 function(e) {
370                                                         return function() { 
371                                                                 util.widgets.set_text(e,
372                                                                         obj.patron.evening_phone()
373                                                                 );
374                                                         };
375                                                 }
376                                         ],
377                                         'patron_other_phone' : [
378                                                 ['render'],
379                                                 function(e) {
380                                                         return function() { 
381                                                                 util.widgets.set_text(e,
382                                                                         obj.patron.other_phone()
383                                                                 );
384                                                         };
385                                                 }
386                                         ],
387                                         'patron_email' : [
388                                                 ['render'],
389                                                 function(e) {
390                                                         return function() { 
391                                                                 util.widgets.set_text(e,
392                                                                         obj.patron.email()
393                                                                 );
394                                                         };
395                                                 }
396                                         ],
397                                         'patron_alias' : [
398                                                 ['render'],
399                                                 function(e) {
400                                                         return function() { 
401                                                                 util.widgets.set_text(e,
402                                                                         obj.patron.alias()
403                                                                 );
404                                                         };
405                                                 }
406                                         ],
407                                         'patron_photo_url' : [
408                                                 ['render'],
409                                                 function(e) {
410                                                         return function() { 
411                                                                 e.setAttribute('src',
412                                                                         obj.patron.photo_url()
413                                                                 );
414                                                         };
415                                                 }
416                                         ],
417                                         'patron_library' : [
418                                                 ['render'],
419                                                 function(e) {
420                                                         return function() { 
421                                                                 util.widgets.set_text(e,
422                                                                         obj.OpenILS.data.hash.aou[
423                                                                                 obj.patron.home_ou()
424                                                                         ].shortname()
425                                                                 );
426                                                                 e.setAttribute('tooltiptext',
427                                                                         obj.OpenILS.data.hash.aou[
428                                                                                 obj.patron.home_ou()
429                                                                         ].name()
430                                                                 );
431                                                         };
432                                                 }
433                                         ],
434                                         'patron_last_library' : [
435                                                 ['render'],
436                                                 function(e) {
437                                                         return function() { 
438                                                                 util.widgets.set_text(e,
439                                                                         obj.OpenILS.data.hash.aou[
440                                                                                 obj.patron.home_ou()
441                                                                         ].shortname()
442                                                                 );
443                                                                 e.setAttribute('tooltiptext',
444                                                                         obj.OpenILS.data.hash.aou[
445                                                                                 obj.patron.home_ou()
446                                                                         ].name()
447                                                                 );
448                                                         };
449                                                 }
450                                         ],
451                                         'patron_mailing_address_street1' : [
452                                                 ['render'],
453                                                 function(e) {
454                                                         return function() { 
455                                                                 util.widgets.set_text(e,
456                                                                         obj.patron.mailing_address().street1()
457                                                                 );
458                                                                 if (!get_bool(obj.patron.mailing_address().valid())){e.setAttribute('style','color: red');}
459                                                         };
460                                                 }
461                                         ],
462                                         'patron_mailing_address_street2' : [
463                                                 ['render'],
464                                                 function(e) {
465                                                         return function() { 
466                                                                 util.widgets.set_text(e,
467                                                                         obj.patron.mailing_address().street2()
468                                                                 );
469                                                                 if (!get_bool(obj.patron.mailing_address().valid())){e.setAttribute('style','color: red');}
470                                                         };
471                                                 }
472                                         ],
473                                         'patron_mailing_address_city' : [
474                                                 ['render'],
475                                                 function(e) {
476                                                         return function() { 
477                                                                 util.widgets.set_text(e,
478                                                                         obj.patron.mailing_address().city()
479                                                                 );
480                                                                 if (!get_bool(obj.patron.mailing_address().valid())){e.setAttribute('style','color: red');}
481                                                         };
482                                                 }
483                                         ],
484                                         'patron_mailing_address_state' : [
485                                                 ['render'],
486                                                 function(e) {
487                                                         return function() { 
488                                                                 util.widgets.set_text(e,
489                                                                         obj.patron.mailing_address().state()
490                                                                 );
491                                                                 if (!get_bool(obj.patron.mailing_address().valid())){e.setAttribute('style','color: red');}
492                                                         };
493                                                 }
494                                         ],
495                                         'patron_mailing_address_post_code' : [
496                                                 ['render'],
497                                                 function(e) {
498                                                         return function() { 
499                                                                 util.widgets.set_text(e,
500                                                                         obj.patron.mailing_address().post_code()
501                                                                 );
502                                                                 if (!get_bool(obj.patron.mailing_address().valid())){e.setAttribute('style','color: red');}
503                                                         };
504                                                 }
505                                         ],
506                                         'patron_physical_address_street1' : [
507                                                 ['render'],
508                                                 function(e) {
509                                                         return function() { 
510                                                                 util.widgets.set_text(e,
511                                                                         obj.patron.billing_address().street1()
512                                                                 );
513                                                                 if (!get_bool(obj.patron.billing_address().valid())){e.setAttribute('style','color: red');}
514                                                         };
515                                                 }
516                                         ],
517                                         'patron_physical_address_street2' : [
518                                                 ['render'],
519                                                 function(e) {
520                                                         return function() { 
521                                                                 util.widgets.set_text(e,
522                                                                         obj.patron.billing_address().street2()
523                                                                 );
524                                                                 if (!get_bool(obj.patron.billing_address().valid())){e.setAttribute('style','color: red');}
525                                                         };
526                                                 }
527                                         ],
528                                         'patron_physical_address_city' : [
529                                                 ['render'],
530                                                 function(e) {
531                                                         return function() { 
532                                                                 util.widgets.set_text(e,
533                                                                         obj.patron.billing_address().city()
534                                                                 );
535                                                                 if (!get_bool(obj.patron.billing_address().valid())){e.setAttribute('style','color: red');}
536                                                         };
537                                                 }
538                                         ],
539                                         'patron_physical_address_state' : [
540                                                 ['render'],
541                                                 function(e) {
542                                                         return function() { 
543                                                                 util.widgets.set_text(e,
544                                                                         obj.patron.billing_address().state()
545                                                                 );
546                                                                 if (!get_bool(obj.patron.billing_address().valid())){e.setAttribute('style','color: red');}
547                                                         };
548                                                 }
549                                         ],
550                                         'patron_physical_address_post_code' : [
551                                                 ['render'],
552                                                 function(e) {
553                                                         return function() { 
554                                                                 util.widgets.set_text(e,
555                                                                         obj.patron.billing_address().post_code()
556                                                                 );
557                                                                 if (!get_bool(obj.patron.billing_address().valid())){e.setAttribute('style','color: red');}
558                                                         };
559                                                 }
560                                         ]
561                                 }
562                         }
563                 );
564
565                 obj.retrieve();
566
567                 try {
568                         var caption = document.getElementById("PatronSummaryContact_caption");
569                         var arrow = document.getAnonymousNodes(caption)[0];
570                         var gb_content = document.getAnonymousNodes(caption.parentNode)[1];
571                         arrow.addEventListener(
572                                 'click',
573                                 function() {
574                                         setTimeout(
575                                                 function() {
576                                                         //alert('setting shrink_state to ' + gb_content.hidden);
577                                                         //caption.setAttribute('shrink_state',gb_content.hidden);
578                                                         netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
579                                                         JSAN.use('util.file'); var file = new util.file('patron_id_shrink');
580                                                         file.set_object(String(gb_content.hidden)); file.close();
581                                                 }, 0
582                                         );
583                                 }, false
584                         );
585                         //var shrink_state = caption.getAttribute('shrink_state');
586                         var shrink_state = false;
587                         netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
588                         JSAN.use('util.file'); var file = new util.file('patron_id_shrink');
589                         if (file._file.exists()) {
590                                 shrink_state = file.get_object(); file.close();
591                         }
592                         //alert('shrink_state retrieved as ' + shrink_state);
593                         if (shrink_state != 'false' && shrink_state) {
594                                 //alert('clicking the widget');
595                                 util.widgets.click( arrow );
596                         }
597                 } catch(E) {
598                         obj.error.sdump('D_ERROR','with shrink_state in summary.js: ' + E);
599                 }
600         },
601
602         'retrieve' : function() {
603
604                 try {
605
606                         var obj = this;
607
608                         var chain = [];
609
610                         // Retrieve the patron
611                                 function blah_retrieve() {
612                                         try {
613                                                 var robj;
614                                                 if (obj.barcode && obj.barcode != 'null') {
615                                                         robj = obj.network.simple_request(
616                                                                 'FM_AU_RETRIEVE_VIA_BARCODE.authoritative',
617                                                                 [ ses(), obj.barcode ]
618                                                         );
619                                                 } else if (obj.id && obj.id != 'null') {
620                                                         robj = obj.network.simple_request(
621                                                                 'FM_AU_FLESHED_RETRIEVE_VIA_ID',
622                                                                 [ ses(), obj.id ]
623                                                         );
624                                                 } else {
625                                                         throw(patronStrings.getString('staff.patron.summary.retrieve.no_barcode'));
626                                                 }
627                                                 if (robj) {
628
629                                                         if (instanceOf(robj,au)) {
630
631                                                                 obj.patron = robj;
632                                                                 JSAN.use('patron.util');
633                                                                 util.widgets.set_text('patron_name',
634                                                                         ( obj.patron.prefix() ? obj.patron.prefix() + ' ' : '') + 
635                                                                         obj.patron.family_name() + ', ' + 
636                                                                         obj.patron.first_given_name() + ' ' +
637                                                                         ( obj.patron.second_given_name() ? obj.patron.second_given_name() + ' ' : '' ) +
638                                                                         ( obj.patron.suffix() ? obj.patron.suffix() : '')
639                                                                 );
640                                                                 patron.util.set_penalty_css(obj.patron);
641                                                                 JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
642                                                                 data.last_patron = obj.patron.id(); data.stash('last_patron');
643
644                                                         } else {
645
646                                                                 throw(robj);
647
648                                                         }
649                                                 } else {
650
651                                                         throw(robj);
652
653                                                 }
654
655                                         } catch(E) {
656                                                 throw(E);
657                                         }
658                                 };
659                                 blah_retrieve();
660
661                         /*
662                         // Retrieve the survey responses for required surveys
663                         chain.push(
664                                 function() {
665                                         try {
666                                                 var surveys = obj.OpenILS.data.list.my_asv;
667                                                 var survey_responses = {};
668                                                 for (var i = 0; i < surveys.length; i++) {
669                                                         var s = obj.network.request(
670                                                                 api.FM_ASVR_RETRIEVE.app,
671                                                                 api.FM_ASVR_RETRIEVE.method,
672                                                                 [ ses(), surveys[i].id(), obj.patron.id() ]
673                                                         );
674                                                         survey_responses[ surveys[i].id() ] = s;
675                                                 }
676                                                 obj.patron.survey_responses( survey_responses );
677                                         } catch(E) {
678                                                 var error = ('patron.summary.retrieve : ' + js2JSON(E));
679                                                 obj.error.sdump('D_ERROR',error);
680                                                 throw(error);
681                                         }
682                                 }
683                         );
684                         */
685
686                         // Update the screen
687                         chain.push( function() { obj.controller.render(); } );
688
689                         // On Complete
690
691                         chain.push( function() {
692
693                                 if (typeof window.xulG == 'object' && typeof window.xulG.on_finished == 'function') {
694                                         obj.error.sdump('D_PATRON_SUMMARY',
695                                                 'patron.summary: Calling external .on_finished()\n');
696                                         window.xulG.on_finished(obj.patron);
697                                 } else {
698                                         obj.error.sdump('D_PATRON_SUMMARY','patron.summary: No external .on_finished()\n');
699                                 }
700
701                         } );
702
703                         // Do it
704                         JSAN.use('util.exec'); obj.exec = new util.exec();
705                         obj.exec.on_error = function(E) {
706
707                                 if (typeof window.xulG == 'object' && typeof window.xulG.on_error == 'function') {
708                                         window.xulG.on_error(E);
709                                 } else {
710                                         alert(js2JSON(E));
711                                 }
712
713                         }
714                         this.exec.chain( chain );
715
716                 } catch(E) {
717                         if (typeof window.xulG == 'object' && typeof window.xulG.on_error == 'function') {
718                                 window.xulG.on_error(E);
719                         } else {
720                                 alert(js2JSON(E));
721                         }
722                 }
723         }
724 }
725
726 dump('exiting patron.summary.js\n');