From 9c53d68840551aafc5dabe548b2a4d65f1b7d27d Mon Sep 17 00:00:00 2001 From: Amit Gupta Date: Mon, 17 Jan 2011 14:58:55 +0530 Subject: [PATCH] Bug-5620 Capture Mode of payment, receipt number and notes in pay fines. --- 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 @@ Description of charges Amount Outstanding + Mode of Payment + Receipt No. + Notes   @@ -46,6 +49,9 @@  &itemnumber=">View item  + + + @@ -67,7 +73,7 @@ - Total due + Total due 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 @@ + + + @@ -60,6 +63,13 @@ " value="" /> " value="" /> + + + @@ -71,13 +81,13 @@ - + - +
Fines & Charges Mode of Payment Receipt No Notes Description Account Type Notify id + "" />
Sub TotalSub Total
Total DueTotal Due
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