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