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