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