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