[open-ils-commits] [GIT] Evergreen ILS branch master updated. b9bb6d473cfc5e500218dcdf9f0cbd2875bdbac4

Evergreen Git git at git.evergreen-ils.org
Thu Mar 29 10:10:53 EDT 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  b9bb6d473cfc5e500218dcdf9f0cbd2875bdbac4 (commit)
       via  960d2ae634e12b4ba67a919aa6680deb536c9be8 (commit)
       via  d3de5ff3b6335fec710ae778423b159673427535 (commit)
       via  9f7d2416b370b1d87ddd4bfc7a731eb0d89abedb (commit)
      from  95a203d055bf2452e58621b396e54d45cccc44a0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b9bb6d473cfc5e500218dcdf9f0cbd2875bdbac4
Author: Bill Erickson <berick at esilibrary.com>
Date:   Thu Mar 22 11:56:00 2012 -0400

    ACQ fund admin UI improvements
    
    * Fund retrieval directly via AutoGrid/pcrud, now that pcrud supports fleshing.
    * Sort funds I can edit to the front of the list
    * Enable the new improved grid filter dialog
    * Leverage onItemReceived for caching funds for balanceInfo getter
    * Add some height to the grid to allow more rows to be visible in the page (without scrolling)
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Jason Stephenson <jstephenson at mvlc.org>

diff --git a/Open-ILS/src/templates/acq/fund/list.tt2 b/Open-ILS/src/templates/acq/fund/list.tt2
index 83f2320..95eac5f 100644
--- a/Open-ILS/src/templates/acq/fund/list.tt2
+++ b/Open-ILS/src/templates/acq/fund/list.tt2
@@ -139,14 +139,14 @@
     </div>
 </div>
 
-<div dojoType="dijit.layout.ContentPane" layoutAlign="client">
+<div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:80%'>
     <table  jsId="lfGrid"
             dojoType="openils.widget.AutoGrid"
             fieldOrder="['id', 'name', 'code', 'year', 'org', 'currency_type', 'combined_balance']"
             requiredFields="['name', 'code', 'year', 'org', 'currency_type']"
             query="{id: '*'}"
-            defaultCellWidth='"auto"'
             fmClass='acqf'
+            showLoadFilter='true'
             showPaginator='true'
             editOnEnter='true'>
         <thead>
diff --git a/Open-ILS/web/js/ui/default/acq/financial/list_funds.js b/Open-ILS/web/js/ui/default/acq/financial/list_funds.js
index 7da788d..5b212c6 100644
--- a/Open-ILS/web/js/ui/default/acq/financial/list_funds.js
+++ b/Open-ILS/web/js/ui/default/acq/financial/list_funds.js
@@ -12,7 +12,7 @@ dojo.require('openils.Event');
 dojo.require('openils.Util');
 dojo.require('openils.User');
 dojo.require('openils.CGI');
-dojo.require('openils.acq.Fund');
+dojo.require('openils.PermaCrud');
 dojo.require('openils.widget.AutoGrid');
 dojo.require('openils.widget.ProgressDialog');
 dojo.require('fieldmapper.OrgUtils');
@@ -22,18 +22,19 @@ var localeStrings = dojo.i18n.getLocalization('openils.acq', 'acq');
 var contextOrg;
 var rolloverResponses;
 var rolloverMode = false;
-
-function getBalanceInfo(rowIndex, item) {
-    if(!item) return '';
-    var id = this.grid.store.getValue( item, 'id');   
-    var fund = openils.acq.Fund.cache[id];
-    if(fund && fund.summary()) 
-        return fund.summary().combined_balance;
-    return 0;
-}
+var fundFleshFields = [
+    'spent_balance', 
+    'combined_balance', 
+    'spent_total', 
+    'encumbrance_total', 
+    'debit_total', 
+    'allocation_total'
+];
+
+var adminPermOrgs = [];
+var cachedFunds = [];
 
 function initPage() {
-
     contextOrg = openils.User.user.ws_ou();
 
     var connect = function() {
@@ -48,17 +49,29 @@ function initPage() {
         );
     };
 
-    dojo.connect(refreshButton, 'onClick', function() { rolloverMode = false; gridDataLoader(); });
+    dojo.connect(refreshButton, 'onClick', 
+        function() { rolloverMode = false; gridDataLoader(); });
 
     new openils.User().buildPermOrgSelector(
-        'ADMIN_ACQ_FUND', contextOrgSelector, contextOrg, connect);
+        ['ADMIN_ACQ_FUND', 'VIEW_FUND'], 
+        contextOrgSelector, contextOrg, connect);
 
     dojo.byId('oils-acq-rollover-ctxt-org').innerHTML = 
         fieldmapper.aou.findOrgUnit(contextOrg).shortname();
 
     loadYearSelector();
-    lfGrid.dataLoader = gridDataLoader;
-    loadFundGrid(new openils.CGI().param('year') || new Date().getFullYear().toString());
+    lfGrid.onItemReceived = function(item) {cachedFunds.push(item)};
+
+    new openils.User().getPermOrgList(
+        'ADMIN_ACQ_FUND',
+        function(list) {
+            adminPermOrgs = list;
+            loadFundGrid(
+                new openils.CGI().param('year') 
+                    || new Date().getFullYear().toString());
+        },
+        true, true
+    );
 }
 
 function gridDataLoader() {
@@ -75,36 +88,39 @@ function gridDataLoader() {
     }
 }
 
-function loadFundGrid(year) {
+function getBalanceInfo(rowIdx, item) {
+    if (!item) return '';
+    var fundId = this.grid.store.getValue(item, 'id');
+    var fund = cachedFunds.filter(function(f) { return f.id() == fundId })[0];
+    var cb = fund.combined_balance();
+    return cb ? cb.amount() : '0';
+}
 
+function loadFundGrid(year) {
     openils.Util.hide('acq-fund-list-rollover-summary');
     year = year || fundFilterYearSelect.attr('value');
+    cachedFunds = [];
 
-    fieldmapper.standardRequest(
-       [ 'open-ils.acq', 'open-ils.acq.fund.org.retrieve'],
-       {    async: true,
-
-            params: [
-                openils.User.authtoken, 
-                {year : year, org : fieldmapper.aou.descendantNodeList(contextOrg, true)}, 
-                {
-                    flesh_summary:1, 
-                    limit: lfGrid.displayLimit,
-                    offset: lfGrid.displayOffset
-                }
-            ],
-
-            onresponse : function(r) {
-                if(lf = openils.Util.readResponse(r)) {
-                   openils.acq.Fund.cache[lf.id()] = lf;
-                   lfGrid.store.newItem(acqf.toStoreItem(lf));
+    lfGrid.loadAll(
+        {
+            flesh : 1,  
+            flesh_fields : {acqf : fundFleshFields},
+            
+            // by default, sort funds I can edit to the front
+            order_by : [
+                {   'class' : 'acqf',
+                    field : 'org',
+                    compare : {'in' : adminPermOrgs},
+                    direction : 'desc'
+                },
+                {   'class' : 'acqf',
+                    field : 'name'
                 }
-            },
-
-            oncomplete : function(r) {
-                lfGrid.hideLoadProgressIndicator();
-            }
-        }
+            ]
+        }, {   
+            year : year, 
+            org : fieldmapper.aou.descendantNodeList(contextOrg, true) 
+        } 
     );
 }
 
@@ -113,7 +129,7 @@ function loadYearSelector() {
     fieldmapper.standardRequest(
         ['open-ils.acq', 'open-ils.acq.fund.org.years.retrieve'],
         {   async : true,
-            params : [openils.User.authtoken],
+            params : [openils.User.authtoken, {}, {limit_perm : 'VIEW_FUND'}],
             oncomplete : function(r) {
 
                 var yearList = openils.Util.readResponse(r);

commit 960d2ae634e12b4ba67a919aa6680deb536c9be8
Author: Bill Erickson <berick at esilibrary.com>
Date:   Thu Mar 22 16:07:34 2012 -0400

    ACQ Fund retrieval API permission improvements
    
    Allow users with ADMIN_ACQ_FUND (in addition to the deprecated
    ADMIN_FUND) permission to retrieve fund year information via
    open-ils.acq.fund.org[.years].retrieve
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Jason Stephenson <jstephenson at mvlc.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Financials.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Financials.pm
index acdcd31..57eb88c 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Financials.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Financials.pm
@@ -305,7 +305,7 @@ sub retrieve_org_funds {
 
     my $limit_perm = ($$options{limit_perm}) ? $$options{limit_perm} : 'ADMIN_FUND';
     return OpenILS::Event->new('BAD_PARAMS') 
-        unless $limit_perm =~ /(ADMIN|MANAGE|VIEW)_FUND/;
+        unless $limit_perm =~ /(ADMIN|MANAGE|VIEW)_(ACQ_)?FUND/;
 
     $filter->{org}  = $filter->{org} || 
         $U->user_has_work_perm_at($e, $limit_perm, {descendants =>1});

commit d3de5ff3b6335fec710ae778423b159673427535
Author: Bill Erickson <berick at esilibrary.com>
Date:   Thu Mar 22 11:53:40 2012 -0400

    ACQ fund summary object fleshing in IDL
    
    Add links for fund summary classes in the IDL to allow for direct
    fleshing of summary objects via pcrud.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Jason Stephenson <jstephenson at mvlc.org>

diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml
index 484c1ed..f4127c2 100644
--- a/Open-ILS/examples/fm_IDL.xml
+++ b/Open-ILS/examples/fm_IDL.xml
@@ -6759,6 +6759,12 @@ SELECT  usr,
 			<field reporter:label="Allocations" name="allocations" oils_persist:virtual="true" reporter:datatype="link"/>
 			<field reporter:label="Debits" name="debits" oils_persist:virtual="true" reporter:datatype="link"/>
 			<field reporter:label="Tags" name="tags" oils_persist:virtual="true" reporter:datatype="link"/>
+			<field reporter:label="Allocation Total" name="allocation_total" oils_persist:virtual="true" reporter:datatype="link"/>
+			<field reporter:label="Debit Total" name="debit_total" oils_persist:virtual="true" reporter:datatype="link"/>
+			<field reporter:label="Encumbrance Total" name="encumbrance_total" oils_persist:virtual="true" reporter:datatype="link"/>
+			<field reporter:label="Spent Total" name="spent_total" oils_persist:virtual="true" reporter:datatype="link"/>
+			<field reporter:label="Combined Balance" name="combined_balance" oils_persist:virtual="true" reporter:datatype="link"/>
+			<field reporter:label="Spent Balance" name="spent_balance" oils_persist:virtual="true" reporter:datatype="link"/>
 		</fields>
 		<links>
 			<link field="org" reltype="has_a" key="id" map="" class="aou"/>
@@ -6766,6 +6772,12 @@ SELECT  usr,
             <link field="allocations" reltype="has_many" key="fund" map="" class="acqfa"/>
             <link field="debits" reltype="has_many" key="fund" map="" class="acqfdeb"/>
             <link field="tags" reltype="has_many" key="fund" map="" class="acqftm"/>
+            <link field="allocation_total" reltype="might_have" key="fund" map="" class="acqfat"/>
+            <link field="debit_total" reltype="might_have" key="fund" map="" class="acqfdt"/>
+            <link field="encumbrance_total" reltype="might_have" key="fund" map="" class="acqfet"/>
+            <link field="spent_total" reltype="might_have" key="fund" map="" class="acqfst"/>
+            <link field="combined_balance" reltype="might_have" key="fund" map="" class="acqfcb"/>
+            <link field="spent_balance" reltype="might_have" key="fund" map="" class="acqfsb"/>
 		</links>
         <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
             <actions>
@@ -6777,7 +6789,7 @@ SELECT  usr,
         </permacrud>
 	</class>
 
-	<class id="acqfat" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::fund_allocation_total" oils_persist:readonly="true" oils_persist:tablename="acq.fund_allocation_total" reporter:label="Fund Allocation Total">
+	<class id="acqfat" controller="open-ils.cstore open-ils.pcrud open-ils.reporter-store" oils_obj:fieldmapper="acq::fund_allocation_total" oils_persist:readonly="true" oils_persist:tablename="acq.fund_allocation_total" reporter:label="Fund Allocation Total">
 		<fields oils_persist:primary="fund">
 			<field reporter:label="Fund ID" name="fund" reporter:datatype="link" />
 			<field reporter:label="Total Allocation Amount" name="amount" reporter:datatype="money" />
@@ -6785,9 +6797,16 @@ SELECT  usr,
 		<links>
 			<link field="fund" reltype="has_a" key="id" map="" class="acqf"/>
 		</links>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <retrieve permission="ADMIN_ACQ_FUND VIEW_FUND MANAGE_FUND">
+					<context link="fund" field="org" />
+                </retrieve>
+            </actions>
+        </permacrud>
 	</class>
 
-	<class id="acqfdt" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::fund_debit_total" oils_persist:readonly="true" oils_persist:tablename="acq.fund_debit_total" reporter:label="Total Debit from Fund">
+	<class id="acqfdt" controller="open-ils.cstore open-ils.pcrud open-ils.reporter-store" oils_obj:fieldmapper="acq::fund_debit_total" oils_persist:readonly="true" oils_persist:tablename="acq.fund_debit_total" reporter:label="Total Debit from Fund">
 		<fields oils_persist:primary="fund">
 			<field reporter:label="Fund ID" name="fund" reporter:datatype="link" />
 			<field reporter:label="Total Debit Amount" name="amount" reporter:datatype="money" />
@@ -6795,9 +6814,16 @@ SELECT  usr,
 		<links>
 			<link field="fund" reltype="has_a" key="id" map="" class="acqf"/>
 		</links>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <retrieve permission="ADMIN_ACQ_FUND VIEW_FUND MANAGE_FUND">
+					<context link="fund" field="org" />
+                </retrieve>
+            </actions>
+        </permacrud>
 	</class>
 
-	<class id="acqfet" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::fund_encumbrance_total" oils_persist:readonly="true" oils_persist:tablename="acq.fund_encumbrance_total" reporter:label="Total Fund Encumbrance">
+	<class id="acqfet" controller="open-ils.cstore open-ils.pcrud open-ils.reporter-store" oils_obj:fieldmapper="acq::fund_encumbrance_total" oils_persist:readonly="true" oils_persist:tablename="acq.fund_encumbrance_total" reporter:label="Total Fund Encumbrance">
 		<fields oils_persist:primary="fund">
 			<field reporter:label="Fund ID" name="fund" reporter:datatype="link" />
 			<field reporter:label="Total Encumbrance Amount" name="amount" reporter:datatype="money" />
@@ -6805,9 +6831,16 @@ SELECT  usr,
 		<links>
 			<link field="fund" reltype="has_a" key="id" map="" class="acqf"/>
 		</links>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <retrieve permission="ADMIN_ACQ_FUND VIEW_FUND MANAGE_FUND">
+					<context link="fund" field="org" />
+                </retrieve>
+            </actions>
+        </permacrud>
 	</class>
 
-	<class id="acqfst" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::fund_spent_total" oils_persist:readonly="true" oils_persist:tablename="acq.fund_spent_total" reporter:label="Total Spent from Fund">
+	<class id="acqfst" controller="open-ils.cstore open-ils.pcrud open-ils.reporter-store" oils_obj:fieldmapper="acq::fund_spent_total" oils_persist:readonly="true" oils_persist:tablename="acq.fund_spent_total" reporter:label="Total Spent from Fund">
 		<fields oils_persist:primary="fund">
 			<field reporter:label="Fund ID" name="fund" reporter:datatype="link" />
 			<field reporter:label="Total Spent Amount" name="amount" reporter:datatype="money" />
@@ -6815,9 +6848,16 @@ SELECT  usr,
 		<links>
 			<link field="fund" reltype="has_a" key="id" map="" class="acqf"/>
 		</links>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <retrieve permission="ADMIN_ACQ_FUND VIEW_FUND MANAGE_FUND">
+					<context link="fund" field="org" />
+                </retrieve>
+            </actions>
+        </permacrud>
 	</class>
 
-	<class id="acqfcb" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::fund_combined_balance" oils_persist:readonly="true" oils_persist:tablename="acq.fund_combined_balance" reporter:label="Fund Combined Balance">
+	<class id="acqfcb" controller="open-ils.cstore open-ils.pcrud open-ils.reporter-store" oils_obj:fieldmapper="acq::fund_combined_balance" oils_persist:readonly="true" oils_persist:tablename="acq.fund_combined_balance" reporter:label="Fund Combined Balance">
 		<fields oils_persist:primary="fund">
 			<field reporter:label="Fund ID" name="fund" reporter:datatype="link" />
 			<field reporter:label="Balance after Spent and Encumbered" name="amount" reporter:datatype="money" />
@@ -6825,6 +6865,13 @@ SELECT  usr,
 		<links>
 			<link field="fund" reltype="has_a" key="id" map="" class="acqf"/>
 		</links>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <retrieve permission="ADMIN_ACQ_FUND VIEW_FUND MANAGE_FUND">
+					<context link="fund" field="org" />
+                </retrieve>
+            </actions>
+        </permacrud>
 	</class>
 
    <class id="acqafat" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::all_fund_allocation_total" oils_persist:readonly="true" oils_persist:tablename="acq.all_fund_allocation_total" reporter:label="All Fund Allocation Total">
@@ -6907,7 +6954,7 @@ SELECT  usr,
 		</links>
 	</class>
 
-	<class id="acqfsb" controller="open-ils.cstore open-ils.reporter-store" oils_obj:fieldmapper="acq::fund_spent_balance" oils_persist:readonly="true" oils_persist:tablename="acq.fund_spent_balance" reporter:label="Fund Spent Balance">
+	<class id="acqfsb" controller="open-ils.cstore open-ils.pcrud open-ils.reporter-store" oils_obj:fieldmapper="acq::fund_spent_balance" oils_persist:readonly="true" oils_persist:tablename="acq.fund_spent_balance" reporter:label="Fund Spent Balance">
 		<fields oils_persist:primary="fund">
 			<field reporter:label="Fund ID" name="fund" reporter:datatype="link" />
 			<field reporter:label="Balance after Spent" name="amount" reporter:datatype="money" />
@@ -6915,7 +6962,14 @@ SELECT  usr,
 		<links>
 			<link field="fund" reltype="has_a" key="id" map="" class="acqf"/>
 		</links>
-	</class>
+        <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+            <actions>
+                <retrieve permission="ADMIN_ACQ_FUND VIEW_FUND MANAGE_FUND">
+					<context link="fund" field="org" />
+                </retrieve>
+            </actions>
+        </permacrud>
+    </class>
 
 	<class id="acqfa" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="acq::fund_allocation" oils_persist:tablename="acq.fund_allocation" reporter:label="Fund Allocation">
 		<fields oils_persist:primary="id" oils_persist:sequence="acq.fund_allocation_id_seq">

commit 9f7d2416b370b1d87ddd4bfc7a731eb0d89abedb
Author: Bill Erickson <berick at esilibrary.com>
Date:   Fri Mar 23 12:04:02 2012 -0400

    AutoGrid onItemReceived support
    
    Adds support for a new call-back, called when a grid row item is
    received (via pcrud onresponse).  If defined, The call-back is passed
    the received item before the it's added to the data store.  This allows
    users to get a direct handle on received objects.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Jason Stephenson <jstephenson at mvlc.org>

diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
index 715a7c0..e570d98 100644
--- a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
+++ b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
@@ -36,6 +36,7 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
             requiredFields : null,
             hidePaginator : false,
             showLoadFilter : false,
+            onItemReceived : null,
             suppressLinkedFields : null, // list of fields whose linked display data should not be fetched from the server
 
             /* by default, don't show auto-generated (sequence) fields */
@@ -626,6 +627,8 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
                     streaming : true,
                     onresponse : function(r) {
                         var item = openils.Util.readResponse(r);
+                        if (self.onItemReceived) 
+                            self.onItemReceived(item);
                         self.store.newItem(item.toStoreItem());
                     },
                     oncomplete : function() {

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/examples/fm_IDL.xml                       |   68 ++++++++++++--
 .../lib/OpenILS/Application/Acq/Financials.pm      |    2 +-
 Open-ILS/src/templates/acq/fund/list.tt2           |    4 +-
 Open-ILS/web/js/dojo/openils/widget/AutoGrid.js    |    3 +
 .../web/js/ui/default/acq/financial/list_funds.js  |  100 +++++++++++--------
 5 files changed, 125 insertions(+), 52 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list