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