adding work_payment type and the /strong/ urging of PINES; extending the auth proxy...
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 30 Oct 2007 18:35:45 +0000 (18:35 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 30 Oct 2007 18:35:45 +0000 (18:35 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@7945 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/examples/apache/eg_vhost.conf
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/money.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/dbi.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/money.pm
Open-ILS/src/perlmods/OpenILS/WWW/Proxy.pm
Open-ILS/src/sql/Pg/080.schema.money.sql
Open-ILS/web/opac/common/js/fm_table_conf.js
Open-ILS/xul/staff_client/server/patron/bills_overlay.xul

index 1c945bd..d6838fe 100644 (file)
@@ -212,9 +212,9 @@ OSRFGatewayConfig /openils/conf/opensrf_core.xml
 # ----------------------------------------------------------------------------------
 <Location /reporter/>
     SetHandler perl-script
-    PerlSetVar ProxyTitle "Report Login"
-    PerlSetVar ProxyDescription "Please log in to view this report"
-    PerlSetVar ProxyPermissions "VIEW_REPORT_OUTPUT"
+    PerlSetVar OILSProxyTitle "Report Login"
+    PerlSetVar OILSProxyDescription "Please log in to view this report"
+    PerlSetVar OILSProxyPermissions "VIEW_REPORT_OUTPUT"
     PerlHandler OpenILS::WWW::Proxy
     Options +ExecCGI
     PerlSendHeader On
index dd34678..ac4dfd3 100644 (file)
@@ -10,6 +10,7 @@
                        <field name="forgive_payment" oils_obj:array_position="4" oils_persist:virtual="true" />
                        <field name="work_payment" oils_obj:array_position="5" oils_persist:virtual="true" />
                        <field name="credit_payment" oils_obj:array_position="6" oils_persist:virtual="true" />
+                       <field name="goods_payment" oils_obj:array_position="7" oils_persist:virtual="true" />
                </fields>
                <links>
                        <link field="usr" reltype="has_a" key="id" map="" class="au"/>
                        <link field="xact" reltype="has_a" key="id" map="" class="mbt"/>
                </links>
        </class>
+       <class id="mgp" controller="open-ils.cstore" oils_obj:fieldmapper="money::goods_payment" oils_persist:tablename="money.goods_payment" reporter:label="Goods Payment">
+               <fields oils_persist:primary="id" oils_persist:sequence="money.payment_id_seq">
+                       <field name="isnew" oils_obj:array_position="0" oils_persist:virtual="true" />
+                       <field name="ischanged" oils_obj:array_position="1" oils_persist:virtual="true" />
+                       <field name="isdeleted" oils_obj:array_position="2" oils_persist:virtual="true" />
+                       <field reporter:label="Accepting Staff Member" name="accepting_usr" oils_obj:array_position="3" oils_persist:virtual="false" reporter:datatype="link"/>
+                       <field reporter:label="Amount" name="amount" oils_obj:array_position="4" oils_persist:virtual="false" reporter:datatype="money" />
+                       <field reporter:label="Amount Collected" name="amount_collected" oils_obj:array_position="5" oils_persist:virtual="false" reporter:datatype="money" />
+                       <field reporter:label="Payment ID" name="id" oils_obj:array_position="6" oils_persist:virtual="false" reporter:datatype="id" />
+                       <field reporter:label="Note" name="note" oils_obj:array_position="7" oils_persist:virtual="false" reporter:datatype="text"/>
+                       <field reporter:label="Payment Timestamp" name="payment_ts" oils_obj:array_position="8" oils_persist:virtual="false" reporter:datatype="timestamp"/>
+                       <field reporter:label="Transaction ID" name="xact" oils_obj:array_position="9" oils_persist:virtual="false" reporter:datatype="link"/>
+                       <field reporter:label="Payment link" name="payment" oils_obj:array_position="10" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Payment Type" name="payment_type" oils_obj:array_position="11" oils_persist:virtual="true" reporter:datatype="text"/>
+               </fields>
+               <links>
+                       <link field="payment" reltype="might_have" key="id" map="" class="mp"/>
+                       <link field="accepting_usr" reltype="has_a" key="id" map="" class="au"/>
+                       <link field="xact" reltype="has_a" key="id" map="" class="mbt"/>
+               </links>
+       </class>
        <class id="aoc" controller="open-ils.cstore" oils_obj:fieldmapper="action::open_circulation" oils_persist:tablename="action.open_circulation">
                <fields oils_persist:primary="id" oils_persist:sequence="">
                        <field name="isnew" oils_obj:array_position="0" oils_persist:virtual="true" />
                        <field reporter:label="Check Payment Detail" name="check_payment" oils_obj:array_position="13" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Work Payment Detail" name="work_payment" oils_obj:array_position="14" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Forgive Payment Detail" name="forgive_payment" oils_obj:array_position="15" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Goods Payment Detail" name="goods_payment" oils_obj:array_position="16" oils_persist:virtual="true" reporter:datatype="link"/>
                </fields>
                <links>
                        <link field="cash_payment" reltype="might_have" key="id" map="" class="mcp"/>
                        <link field="check_payment" reltype="might_have" key="id" map="" class="mckp"/>
                        <link field="work_payment" reltype="might_have" key="id" map="" class="mwp"/>
                        <link field="forgive_payment" reltype="might_have" key="id" map="" class="mfp"/>
+                       <link field="goods_payment" reltype="might_have" key="id" map="" class="mgp"/>
                        <link field="xact" reltype="has_a" key="id" map="" class="mbt"/>
                </links>
        </class>
                        <field reporter:label="Check Payment Detail" name="check_payment" oils_obj:array_position="13" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Work Payment Detail" name="work_payment" oils_obj:array_position="14" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Forgive Payment Detail" name="forgive_payment" oils_obj:array_position="15" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Goods Payment Detail" name="goods_payment" oils_obj:array_position="16" oils_persist:virtual="true" reporter:datatype="link"/>
                </fields>
                <links>
                        <link field="cash_payment" reltype="might_have" key="id" map="" class="mcp"/>
                        <link field="check_payment" reltype="might_have" key="id" map="" class="mckp"/>
                        <link field="work_payment" reltype="might_have" key="id" map="" class="mwp"/>
                        <link field="forgive_payment" reltype="might_have" key="id" map="" class="mfp"/>
+                       <link field="goods_payment" reltype="might_have" key="id" map="" class="mgp"/>
                        <link field="xact" reltype="has_a" key="id" map="" class="mbt"/>
                </links>
        </class>
                        <field reporter:label="Voided?" name="voided" oils_obj:array_position="9" oils_persist:virtual="false" reporter:datatype="bool"/>
                        <field reporter:label="Work Payment Detail" name="work_payment" oils_obj:array_position="10" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Forgive Payment Detail" name="forgive_payment" oils_obj:array_position="11" oils_persist:virtual="true" reporter:datatype="link"/>
+                       <field reporter:label="Goods Payment Detail" name="goods_payment" oils_obj:array_position="12" oils_persist:virtual="true" reporter:datatype="link"/>
                </fields>
                <links>
                        <link field="work_payment" reltype="might_have" key="id" map="" class="mwp"/>
                        <link field="forgive_payment" reltype="might_have" key="id" map="" class="mfp"/>
+                       <link field="goods_payment" reltype="might_have" key="id" map="" class="mgp"/>
                        <link field="xact" reltype="has_a" key="id" map="" class="mbt"/>
                </links>
        </class>
index a3df1aa..1388d81 100644 (file)
@@ -664,6 +664,10 @@ sub modify_from_fieldmapper {
        money::work_payment->has_a( accepting_usr => 'actor::user' );
        #money::work_payment->might_have( payment => 'money::payment' );
 
+       money::goods_payment->has_a( xact => 'money::billable_transaction' );
+       money::goods_payment->has_a( accepting_usr => 'actor::user' );
+       #money::goods_payment->might_have( payment => 'money::payment' );
+
        money::credit_payment->has_a( xact => 'money::billable_transaction' );
        money::credit_payment->has_a( accepting_usr => 'actor::user' );
        #money::credit_payment->might_have( payment => 'money::payment' );
index 0864ff3..af1cb89 100644 (file)
@@ -132,6 +132,11 @@ use base qw/money::forgive_payment/;
 __PACKAGE__->table('money_work_payment');
 #-------------------------------------------------------------------------------
 
+package money::goods_payment;
+use base qw/money::forgive_payment/;
+__PACKAGE__->table('money_goods_payment');
+#-------------------------------------------------------------------------------
+
 package money::credit_payment;
 use base qw/money::forgive_payment/;
 __PACKAGE__->table('money_credit_payment');
index fdd10d2..058fc86 100644 (file)
        money::work_payment->sequence( 'money.payment_id_seq' );
 
        #---------------------------------------------------------------------
+       package money::goods_payment;
+       
+       money::goods_payment->table( 'money.goods_payment' );
+       money::goods_payment->sequence( 'money.payment_id_seq' );
+
+       #---------------------------------------------------------------------
        package money::forgive_payment;
        
        money::forgive_payment->table( 'money.forgive_payment' );
index 3d6ee3f..4230b2a 100644 (file)
@@ -475,14 +475,15 @@ sub ou_user_payments {
                SELECT  au.id as usr,
                SUM( CASE WHEN p.payment_type = 'forgive_payment' THEN p.amount ELSE 0.0 END ) as forgive_payment,
                SUM( CASE WHEN p.payment_type = 'work_payment' THEN p.amount ELSE 0.0 END ) as work_payment,
-               SUM( CASE WHEN p.payment_type = 'credit_payment' THEN p.amount ELSE 0.0 END ) as credit_payment
+               SUM( CASE WHEN p.payment_type = 'credit_payment' THEN p.amount ELSE 0.0 END ) as credit_payment,
+               SUM( CASE WHEN p.payment_type = 'goods_payment' THEN p.amount ELSE 0.0 END ) as goods_payment
           FROM  money.bnm_payment_view p
                 JOIN actor.usr au ON (au.id = p.accepting_usr)
           WHERE p.payment_ts >= '$startdate'
                 AND p.payment_ts < '$enddate'::TIMESTAMPTZ + INTERVAL '1 day'
                 AND p.voided IS FALSE
                 AND au.home_ou = $lib
-               AND p.payment_type IN ('credit_payment','forgive_payment','work_payment')
+               AND p.payment_type IN ('credit_payment','forgive_payment','work_payment','goods_payment')
          GROUP BY 1
          ORDER BY 1;
 
@@ -496,6 +497,7 @@ sub ou_user_payments {
                $x->forgive_payment($$r[1]);
                $x->work_payment($$r[2]);
                $x->credit_payment($$r[3]);
+               $x->goods_payment($$r[4]);
 
                $client->respond($x);
        }
index 31d7740..8b34856 100644 (file)
@@ -29,11 +29,14 @@ sub child_init {
 
 sub handler {
        my $apache = shift;
-       my $title = $apache->dir_config('ProxyTitle');
-       my $desc = $apache->dir_config('ProxyDescription');
-       my $perms = [ split ' ', $apache->dir_config('ProxyPermissions') ];
 
-       return Apache2::Const::NOT_FOUND unless ($title);
+       my $proxyhtml = $apache->dir_config('OILSProxyHTML');
+       my $title = $apache->dir_config('OILSProxyTitle');
+       my $desc = $apache->dir_config('OILSProxyDescription');
+       my $ltype = $apache->dir_config('OILSProxyLoginType');
+       my $perms = [ split ' ', $apache->dir_config('OILSProxyPermissions') ];
+
+       return Apache2::Const::NOT_FOUND unless ($title || $proxyhtml);
        return Apache2::Const::NOT_FOUND unless (@$perms);
 
        my $cgi = new CGI;
@@ -56,40 +59,19 @@ sub handler {
                if (!$u) {
 
                        print $cgi->header(-type=>'text/html', -expires=>'-1d');
-                       print <<"                       HTML";
-
-<html>
-       <head>
-               <title>$title</title>
-       </head>
-       <body>
-               <br/><br/><br/>
-               <center>
-               <form method='POST'>
-                       <table style='border-collapse: collapse; border: 1px solid black;'>
-                               <tr>
-                                       <th colspan='2' align='center'><u>$desc</u></th>
-                               </tr>
-                               <tr>
-                                       <th align="right">Username or barcode:</th>
-                                       <td><input type="text" name="user"/></td>
-                               </tr>
-                               <tr>
-                                       <th align="right">Password:</th>
-                                       <td><input type="password" name="passwd"/></td>
-                               </tr>
-                       </table>
-                       <input type="submit" value="Log in"/>
-               </form>
-               </center>
-       </body>
-</html>
-
-                       HTML
+                       if (!$proxyhtml) {
+                               $proxyhtml = join '', <DATA>;
+                               $proxyhtml =~ s/TITLE/$title/gso;
+                               $proxyhtml =~ s/DESCRIPTION/$desc/gso;
+                       } else {
+                               # XXX template toolkit??
+                       }
+
+                       print $proxyhtml;
                        return Apache2::Const::OK;
                }
 
-               $auth_ses = oils_login($u, $p);
+               $auth_ses = oils_login($u, $p, $ltype);
                if ($auth_ses) {
                        print $cgi->redirect(
                                -uri=>$url,
@@ -118,10 +100,7 @@ sub handler {
        return Apache2::Const::FORBIDDEN if (@$failures > 0);
 
        # they're good, let 'em through
-       return Apache2::Const::DECLINED if (-e $apache->filename);
-
-       # oops, file not found
-       return Apache2::Const::NOT_FOUND;
+       return Apache2::Const::DECLINED;
 }
 
 # returns the user object if the session is valid, 0 otherwise
@@ -172,3 +151,32 @@ sub oils_login {
 
 
 1;
+
+__DATA__
+<html>
+       <head>
+               <title>TITLE</title>
+       </head>
+       <body>
+               <br/><br/><br/>
+               <center>
+               <form method='POST'>
+                       <table style='border-collapse: collapse; border: 1px solid black;'>
+                               <tr>
+                                       <th colspan='2' align='center'><u>DESCRIPTION</u></th>
+                               </tr>
+                               <tr>
+                                       <th align="right">Username or barcode:</th>
+                                       <td><input type="text" name="user"/></td>
+                               </tr>
+                               <tr>
+                                       <th align="right">Password:</th>
+                                       <td><input type="password" name="passwd"/></td>
+                               </tr>
+                       </table>
+                       <input type="submit" value="Log in"/>
+               </form>
+               </center>
+       </body>
+</html>
+
index 1e6f1e4..a6c966a 100644 (file)
@@ -316,6 +316,13 @@ CREATE INDEX money_credit_payment_xact_idx ON money.credit_payment (xact);
 CREATE INDEX money_credit_payment_payment_ts_idx ON money.credit_payment (payment_ts);
 CREATE INDEX money_credit_payment_accepting_usr_idx ON money.credit_payment (accepting_usr);
 
+CREATE TABLE money.goods_payment () INHERITS (money.bnm_payment);
+ALTER TABLE money.goods_payment ADD PRIMARY KEY (id);
+CREATE INDEX money_goods_id_idx ON money.goods_payment (id);
+CREATE INDEX money_goods_payment_xact_idx ON money.goods_payment (xact);
+CREATE INDEX money_goods_payment_payment_ts_idx ON money.goods_payment (payment_ts);
+CREATE INDEX money_goods_payment_accepting_usr_idx ON money.goods_payment (accepting_usr);
+
 CREATE TABLE money.bnm_desk_payment (
        cash_drawer     INT     REFERENCES actor.workstation (id)
 ) INHERITS (money.bnm_payment);
index e3f728f..964c3a0 100644 (file)
@@ -73,7 +73,8 @@ var FM_TABLE_DISPLAY = {
                        'usr',
                        'credit_payment',
                        'forgive_payment',
-                       'work_payment'
+                       'work_payment',
+                       'goods_payment'
                ]
        },
        'rr' : {
index 0b9bcce..ce6c427 100644 (file)
@@ -72,6 +72,7 @@
                                                                -->
                                                                <menuitem id="payment_type_menuitem5" label="Work" value="work_payment"/>
                                                                <menuitem id="payment_type_menuitem6" label="Forgive" value="forgive_payment"/>
+                                                               <menuitem id="payment_type_menuitem7" label="Goods" value="goods_payment"/>
                                                        </menupopup>
                                                </menulist>
                                        </row>