[Koha-patches] [PATCH] Bug-5620 Capture Mode of payment, receipt number and notes in pay fines.

Amit Gupta amit.gupta at osslabs.biz
Mon Jan 17 12:03:23 CET 2011


---
 C4/Accounts.pm                                     |   12 +++++++-----
 installer/data/mysql/kohastructure.sql             |    3 +++
 installer/data/mysql/updatedatabase.pl             |    9 +++++++++
 .../prog/en/modules/members/boraccount.tmpl        |    8 +++++++-
 .../intranet-tmpl/prog/en/modules/members/pay.tmpl |   14 ++++++++++++--
 kohaversion.pl                                     |    2 +-
 members/pay.pl                                     |    8 +++++++-
 7 files changed, 46 insertions(+), 10 deletions(-)

diff --git a/C4/Accounts.pm b/C4/Accounts.pm
index d73fc2e..f65bf7b 100644
--- a/C4/Accounts.pm
+++ b/C4/Accounts.pm
@@ -135,7 +135,7 @@ sub recordpayment {
 
 =head2 makepayment
 
-  &makepayment($borrowernumber, $acctnumber, $amount, $branchcode);
+  &makepayment($borrowernumber, $acctnumber, $amount, $branchcode, $modeofpayment, $receiptno, $notes);
 
 Records the fact that a patron has paid off the entire amount he or
 she owes.
@@ -144,7 +144,9 @@ C<$borrowernumber> is the patron's borrower number. C<$acctnumber> is
 the account that was credited. C<$amount> is the amount paid (this is
 only used to record the payment. It is assumed to be equal to the
 amount owed). C<$branchcode> is the code of the branch where payment
-was made.
+was made. C<$modeofpayment> is the code to capture mode of payment via cash, cheque etc.
+C<$receiptno> is the code to capture receiptnumber.
+C<$notes> is the code to capture notes.
 
 =cut
 
@@ -156,7 +158,7 @@ sub makepayment {
     #here we update both the accountoffsets and the account lines
     #updated to check, if they are paying off a lost item, we return the item
     # from their card, and put a note on the item record
-    my ( $borrowernumber, $accountno, $amount, $user, $branch ) = @_;
+    my ( $borrowernumber, $accountno, $amount, $user, $branch, $modeofpayment, $receiptno, $notes) = @_;
     my $dbh = C4::Context->dbh;
 
     # begin transaction
@@ -190,9 +192,9 @@ sub makepayment {
     $dbh->do( "
         INSERT INTO     accountlines
                         (borrowernumber, accountno, date, amount,
-                         description, accounttype, amountoutstanding)
+                         description, accounttype, amountoutstanding, modeofpayment, receiptno, notes)
         VALUES          ($borrowernumber, $nextaccntno, now(), $payment,
-                        'Payment,thanks - $user', 'Pay', 0)
+                        'Payment,thanks - $user', 'Pay', 0, '$modeofpayment', '$receiptno', '$notes')
         " );
 
     # FIXME - The second argument to &UpdateStats is supposed to be the
diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index 5e0c6b6..0ff6802 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -2289,6 +2289,9 @@ CREATE TABLE `accountlines` (
   `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
   `notify_id` int(11) NOT NULL default 0,
   `notify_level` int(2) NOT NULL default 0,
+  `modeofpayment`  varchar(5) default NULL,
+  `receiptno`  varchar(10) default NULL,
+  `notes`  varchar(100) default NULL,
   KEY `acctsborridx` (`borrowernumber`),
   KEY `timeidx` (`timestamp`),
   KEY `itemnumber` (`itemnumber`),
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index cb88827..bbdd4dd 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -3937,6 +3937,15 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
    SetVersion ($DBversion);
 }
 
+$DBversion = '3.03.00.013';
+if ( C4::Context->preference('Version') < TransformToNum($DBversion) ) {
+    $dbh->do('ALTER TABLE accountlines ADD modeofpayment varchar(5) default NULL');
+    $dbh->do('ALTER TABLE accountlines ADD receiptno varchar(10) default NULL');
+    $dbh->do('ALTER TABLE accountlines ADD notes varchar(100) default NULL');
+    print "Upgrade to $DBversion done (updating 3 fields in accountlines table)\n";
+    SetVersion($DBversion);
+}
+
 =head1 FUNCTIONS
 
 =head2 DropAllForeignKeys($table)
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tmpl
index ef59ad2..1391951 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tmpl
@@ -32,6 +32,9 @@
     <th>Description of charges</th>
     <th>Amount</th>
     <th>Outstanding</th>
+    <th>Mode of Payment</th>
+    <th>Receipt No.</th>
+    <th>Notes</th>
     <!-- TMPL_IF NAME="reverse_col" -->
     <th>&nbsp;</th>
     <!-- /TMPL_IF -->
@@ -46,6 +49,9 @@
       <td><!-- TMPL_VAR NAME="description" -->&nbsp;<!-- TMPL_IF NAME="itemnumber" --><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->">View item</a>&nbsp;<!-- /TMPL_IF --><!-- TMPL_IF NAME="printtitle" --> <!-- TMPL_VAR NAME="title" escape="html" --><!-- /TMPL_IF --></td>
       <!-- TMPL_IF NAME="amountcredit" --><td class="credit"><!-- TMPL_ELSE --><td class="debit"><!-- /TMPL_IF --><!-- TMPL_VAR NAME="amount" --></td>
       <!-- TMPL_IF NAME="amountoutstandingcredit" --><td class="credit"><!-- TMPL_ELSE --><td class="debit"><!-- /TMPL_IF --><!-- TMPL_VAR NAME="amountoutstanding" --></td>
+      <td><!-- TMPL_VAR NAME="modeofpayment" --></td>
+      <td><!-- TMPL_VAR NAME="receiptno" --></td>
+      <td><!-- TMPL_VAR NAME="notes" --></td>
     <!-- TMPL_IF NAME="reverse_col" -->
       <td>
 	<!-- TMPL_IF NAME="payment" -->
@@ -67,7 +73,7 @@
   <!-- /TMPL_LOOP -->
 <tfoot>
   <tr>
-    <td colspan="4">Total due</td>
+    <td colspan="7">Total due</td>
     <!-- TMPL_IF NAME="totalcredit" --><td colspan="2" class="credit"><!-- TMPL_ELSE --><td colspan="2" class="debit"><!-- /TMPL_IF --><!-- TMPL_VAR NAME="total" --></td>
   </tr>
   </tfoot>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tmpl
index 1177ba2..81dbea5 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tmpl
@@ -31,6 +31,9 @@
 <table>
 <tr>
 	<th>Fines &amp; Charges</th>
+	<th> Mode of Payment </th>
+        <th> Receipt No </th>
+        <th> Notes </th>
 	<th>Description</th>
 	<th>Account Type</th>
 	<th>Notify id</th>
@@ -60,6 +63,13 @@
 	<input type="hidden" name="notify_level<!-- TMPL_VAR name="i" -->" value="<!-- TMPL_VAR name="notify_level" -->" />
 	<input type="hidden" name="totals<!-- TMPL_VAR name="i" -->" value="<!-- TMPL_VAR name="totals" -->" />
 	</td>
+	 <td>
+        <select name="modeofpayment" id="modeofpayment<!-- TMPL_VAR name="i" -->">
+ 	<option value="Cash">Cash</option>
+	<option value="Cheque">Cheque</option>
+	</select></td>
+        <td><input type="text" size=20 id="receiptno" name="receiptno<!-- TMPL_VAR name="i" -->"</td>
+        <td><input type="text" size=20 name="notes<!-- TMPL_VAR name="i" -->" /></td>
 	<td><!-- TMPL_VAR name="description" --> <!-- TMPL_VAR name="title" escape="html" --></td>
 	<td><!-- TMPL_VAR name="accounttype" --></td>
 	<td><!-- TMPL_VAR name="notify_id" --></td>
@@ -71,13 +81,13 @@
 <!-- TMPL_IF  NAME="total"-->
 <tr>
 
-	<td colspan="6">Sub Total</td>
+	<td colspan="9">Sub Total</td>
 	<td><!-- TMPL_VAR name="total" --></td>
 </tr>
 <!--/TMPL_IF-->
 <!-- /TMPL_LOOP  -->
 <tr>
-	<td colspan="6">Total Due</td>
+	<td colspan="9">Total Due</td>
 	<td><!-- TMPL_VAR name="total" --></td>
 </tr>
 </table>
diff --git a/kohaversion.pl b/kohaversion.pl
index fc595a0..270e2d0 100644
--- a/kohaversion.pl
+++ b/kohaversion.pl
@@ -16,7 +16,7 @@ the kohaversion is divided in 4 parts :
 use strict;
 
 sub kohaversion {
-    our $VERSION = '3.03.00.012';
+    our $VERSION = '3.03.00.013';
     # version needs to be set this way
     # so that it can be picked up by Makefile.PL
     # during install
diff --git a/members/pay.pl b/members/pay.pl
index 5a36bd7..e3f1e97 100755
--- a/members/pay.pl
+++ b/members/pay.pl
@@ -80,7 +80,10 @@ for ( my $i = 0 ; $i < @names ; $i++ ) {
         my $amount         = $input->param( $names[ $i + 4 ] );
         my $borrowernumber = $input->param( $names[ $i + 5 ] );
         my $accountno      = $input->param( $names[ $i + 6 ] );
-        makepayment( $borrowernumber, $accountno, $amount, $user, $branch );
+	my $modeofpayment  = $input->param( $names[ $i + 10 ] ); 
+        my $receiptno      = $input->param( $names[ $i + 11 ] ); 
+        my $notes          = $input->param( $names[ $i + 12 ] ); 
+        makepayment( $borrowernumber, $accountno, $amount, $user, $branch, $modeofpayment, $receiptno, $notes);
         $check = 2;
     }
 }
@@ -118,6 +121,9 @@ if ( $check == 0 ) {
                 $line{notify_id}      = $accts->[$i]{'notify_id'};
                 $line{notify_level}   = $accts->[$i]{'notify_level'};
                 $line{net_balance} = 1 if($accts->[$i]{'amountoutstanding'} > 0); # you can't pay a credit.
+		$line{modeofpayment}  = $accts->[$i]{'modeofpayment'};
+		$line{receiptno}  = $accts->[$i]{'receiptno'};
+		$line{notes}  = $accts->[$i]{'notes'};
                 push( @loop_pay, \%line );
             }
         }
-- 
1.6.4.2



More information about the Koha-patches mailing list