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