[open-ils-commits] r13245 - in trunk/Open-ILS: examples src/support-scripts/test-scripts web/js/ui/default/conify/global/config web/templates/default/conify/global/config xul/staff_client/server/patron (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue May 26 23:45:06 EDT 2009


Author: erickson
Date: 2009-05-26 23:45:04 -0400 (Tue, 26 May 2009)
New Revision: 13245

Modified:
   trunk/Open-ILS/examples/fm_IDL.xml
   trunk/Open-ILS/src/support-scripts/test-scripts/print_po.pl
   trunk/Open-ILS/web/js/ui/default/conify/global/config/circ_matrix_matchpoint.js
   trunk/Open-ILS/web/templates/default/conify/global/config/circ_matrix_matchpoint.tt2
   trunk/Open-ILS/xul/staff_client/server/patron/summary_overlay_horiz.xul
Log:
add pcrud controller for ccmcmtm and ccmcmt

Modified: trunk/Open-ILS/examples/fm_IDL.xml
===================================================================
--- trunk/Open-ILS/examples/fm_IDL.xml	2009-05-27 03:09:58 UTC (rev 13244)
+++ trunk/Open-ILS/examples/fm_IDL.xml	2009-05-27 03:45:04 UTC (rev 13245)
@@ -921,7 +921,7 @@
         </permacrud>
 	</class>
 
-	<class id="ccmcmt" controller="open-ils.cstore" oils_obj:fieldmapper="config::circ_matrix_circ_mod_test" oils_persist:tablename="config.circ_matrix_circ_mod_test" reporter:label="Circulation Matrix Circulation Modifier Subtest">
+	<class id="ccmcmt" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="config::circ_matrix_circ_mod_test" oils_persist:tablename="config.circ_matrix_circ_mod_test" reporter:label="Circulation Matrix Circulation Modifier Subtest">
 		<fields oils_persist:primary="id" oils_persist:sequence="config.circ_matrix_circ_mod_test_id_seq">
 			<field reporter:label="Test ID" name="id" reporter:datatype="id"/>
 			<field reporter:label="Matchpoint ID" name="matchpoint" reporter:datatype="link"/>
@@ -946,7 +946,7 @@
         </permacrud>
 	</class>
 
-	<class id="ccmcmtm" controller="open-ils.cstore" oils_obj:fieldmapper="config::circ_matrix_circ_mod_test_map" oils_persist:tablename="config.circ_matrix_circ_mod_test_map" reporter:label="Circulation Matrix Circulation Modifier Subtest Circulation Modifier Set">
+	<class id="ccmcmtm" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="config::circ_matrix_circ_mod_test_map" oils_persist:tablename="config.circ_matrix_circ_mod_test_map" reporter:label="Circulation Matrix Circulation Modifier Subtest Circulation Modifier Set">
 		<fields oils_persist:primary="id" oils_persist:sequence="config.circ_matrix_circ_mod_test_map_id_seq">
 			<field reporter:label="Entry ID" name="id" reporter:datatype="id"/>
 			<field reporter:label="Circulation Modifier Subtest ID" name="circ_mod_test" reporter:datatype="link"/>

Modified: trunk/Open-ILS/src/support-scripts/test-scripts/print_po.pl
===================================================================
--- trunk/Open-ILS/src/support-scripts/test-scripts/print_po.pl	2009-05-27 03:09:58 UTC (rev 13244)
+++ trunk/Open-ILS/src/support-scripts/test-scripts/print_po.pl	2009-05-27 03:45:04 UTC (rev 13245)
@@ -18,14 +18,27 @@
 oils_login($username, $password);
 my $e = OpenILS::Utils::CStoreEditor->new;
 
+use OpenILS::Utils::Fieldmapper;
+$e->xact_begin;
+my $bt = $e->retrieve_acq_currency_type('USD');
+$bt->label('vvvv');
+my $resp = $e->update_acq_currency_type($bt);
+print Dumper($resp);
+$e->xact_rollback;
+
+
 my $po = $e->retrieve_acq_purchase_order($po_id) or oils_event_die($e->event);
 my $orgs = $apputils->get_org_ancestors($po->ordering_agency);
-my $defs = $e->search_action_trigger_event_definition({hook => $hook, owner => $orgs});
-$defs = [sort { $a->id cmp $b->id } @$defs ]; # this is a brittle hack, but.. meh
-my $def = pop @$defs;
-print "using def " . $def->id . " at org_unit " . $def->owner . "\n";
+$orgs = $e->search_actor_org_unit([{id => $orgs}, {flesh => 1, flesh_fields => {aou => ['ou_type']}}]);
+$orgs = [ sort { $a->ou_type->depth cmp $b->ou_type->depth } @$orgs ];
+my $def;
+for my $org (reverse @$orgs) { 
+    $def = $e->search_action_trigger_event_definition({hook => $hook, owner => $org->id})->[0];
+    last if $def;
+}
 
 die "No event_definition found with hook $hook\n" unless $def;
+print "using def " . $def->id . " at org_unit " . $def->owner . "\n";
 
 my $event_id = $apputils->simplereq(
     'open-ils.trigger', 
@@ -47,6 +60,8 @@
     ]
 );
 
+print "$event\n";
+
 if($event->template_output) {
     print $event->template_output->data . "\n";
 }

Modified: trunk/Open-ILS/web/js/ui/default/conify/global/config/circ_matrix_matchpoint.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/conify/global/config/circ_matrix_matchpoint.js	2009-05-27 03:09:58 UTC (rev 13244)
+++ trunk/Open-ILS/web/js/ui/default/conify/global/config/circ_matrix_matchpoint.js	2009-05-27 03:45:04 UTC (rev 13245)
@@ -3,9 +3,13 @@
 dojo.require('openils.widget.AutoGrid');
 dojo.require('openils.widget.AutoFieldWidget');
 dojo.require('openils.PermaCrud');
+dojo.require('openils.widget.ProgressDialog');
 
 var circModEditor = null;
 var circModGroupTables = [];
+var circModGroupCache = {};
+var circModEntryCache = {};
+var matchPoint;
 
 function load(){
     cmGrid.loadAll({order_by:{ccmm:'circ_modifier'}});
@@ -21,14 +25,15 @@
     var node = circModEditor.cloneNode(true);
     var tableTmpl = node.removeChild(byName('circ-mod-group-table', node));
     circModGroupTables = [];
+    matchPoint = editPane.fmObject.id();
 
     byName('add-circ-mod-group', node).onclick = function() {
         addCircModGroup(node, tableTmpl)
     }
 
-    var group = null;
     if(editPane.mode == 'update') {
-        //group = 
+        var groups = new openils.PermaCrud().search('ccmcmt', {matchpoint: editPane.fmObject.id()});
+        dojo.forEach(groups, function(g) { addCircModGroup(node, tableTmpl, g); } );
     } 
 
     editPane.domNode.appendChild(node);
@@ -41,7 +46,14 @@
     var circModRowTmpl = byName('circ-mod-entry-tbody', table).removeChild(byName('circ-mod-entry-row', table));
     circModGroupTables.push(table);
 
+    var entries = [];
+    if(group) {
+        entries = new openils.PermaCrud().search('ccmcmtm', {circ_mod_test : group.id()});
+        table.setAttribute('group', group.id());
+    }
+
     function addMod(code, name) {
+        name = name || code; // XXX
         var row = circModRowTmpl.cloneNode(true);
         byName('circ-mod', row).innerHTML = name;
         byName('circ-mod', row).setAttribute('code', code);
@@ -51,6 +63,8 @@
         }
     }
 
+    dojo.forEach(entries, function(e) { addMod(e.circ_mod()); });
+
     byName('circ-mod-count', table).value = (group) ? group.items_out() : 0;
 
     var selector = new openils.widget.AutoFieldWidget({
@@ -69,17 +83,59 @@
 }
 
 function applyCircModChanges() {
+    var pcrud = new openils.PermaCrud();
+    progressDialog.show(true);
 
     for(var idx in circModGroupTables) {
         var table = circModGroupTables[idx];
+        var gp = table.getAttribute('group');
 
         var count = byName('circ-mod-count', table).value;
         var mods = [];
+        var entries = [];
+
         dojo.forEach(dojo.query('[name=circ-mod]', table), function(td) { 
             mods.push(td.getAttribute('code'));
         });
 
-        alert(count + ' : ' + mods);
+        var group = circModGroupCache[gp];
+
+        if(!group) {
+
+            group = new fieldmapper.ccmcmt();
+            group.isnew(true);
+            dojo.forEach(mods, function(mod) {
+                var entry = new fieldmapper.ccmcmtm();
+                entry.isnew(true);
+                entry.circ_mod(mod);
+                entries.push(entry);
+            });
+
+
+        } else {
+        }
+
+        group.items_out(count);
+        group.matchpoint(matchPoint);
+
+        if(group.isnew()) {
+
+            pcrud.create(group, {
+                oncomplete : function(r) {
+                    var group = openils.Util.readResponse(r);
+                    dojo.forEach(entries, function(e) { e.circ_mod_test(group.id()) } );
+                    pcrud.create(entries, {
+                        oncomplete : function() {
+                            progressDialog.hide();
+                        }
+                    });
+                }
+            });
+
+        } else {
+
+        }
+
     }
 }
 

Modified: trunk/Open-ILS/web/templates/default/conify/global/config/circ_matrix_matchpoint.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/conify/global/config/circ_matrix_matchpoint.tt2	2009-05-27 03:09:58 UTC (rev 13244)
+++ trunk/Open-ILS/web/templates/default/conify/global/config/circ_matrix_matchpoint.tt2	2009-05-27 03:45:04 UTC (rev 13245)
@@ -50,5 +50,7 @@
     </div>
 </div>
 
+<div class='hidden'><div dojoType='openils.widget.ProgressDialog' jsId='progressDialog'/></div>
+
 [% END %]
 

Modified: trunk/Open-ILS/xul/staff_client/server/patron/summary_overlay_horiz.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/summary_overlay_horiz.xul	2009-05-27 03:09:58 UTC (rev 13244)
+++ trunk/Open-ILS/xul/staff_client/server/patron/summary_overlay_horiz.xul	2009-05-27 03:45:04 UTC (rev 13245)
@@ -25,7 +25,7 @@
                     <column/>
                 </columns>
                 <rows>
-                    <row>
+                    <row hidden='true'>
                         <label id="PatronSummaryContact_date_of_birth_label" click_to_hide_dob="true" class="text_left dob label click_link" value="&staff.patron_display.date_of_birth.label;"/>
                         <label id="patron_date_of_birth" class="dob value" hide_value="true" persist="hide_value"/><!-- FIXME: persist doesn't work for this -->
                     </row>



More information about the open-ils-commits mailing list