@@ -, +, @@ of being applied directly. --- C4/Circulation.pm | 17 +- installer/data/mysql/kohastructure.sql | 18 +- installer/data/mysql/updatedatabase.pl | 11 +- .../prog/en/modules/circ/circulation-home.tt | 8 +- .../prog/en/modules/offline_circ/enqueue_koc.tt | 31 +++ .../prog/en/modules/offline_circ/list.tt | 6 +- .../prog/en/modules/offline_circ/process_koc.tt | 34 ++-- offline_circ/enqueue_koc.pl | 197 ++++++++++++++++++++ offline_circ/list.pl | 1 + 9 files changed, 294 insertions(+), 29 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/offline_circ/enqueue_koc.tt create mode 100755 offline_circ/enqueue_koc.pl --- a/C4/Circulation.pm +++ a/C4/Circulation.pm @@ -3328,9 +3328,10 @@ sub GetOfflineOperation { } sub AddOfflineOperation { + my ( $userid, $branchcode, $timestamp, $action, $barcode, $cardnumber, $amount ) = @_; my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare("INSERT INTO pending_offline_operations (userid, branchcode, timestamp, action, barcode, cardnumber) VALUES(?,?,?,?,?,?)"); - $sth->execute( @_ ); + my $sth = $dbh->prepare("INSERT INTO pending_offline_operations (userid, branchcode, timestamp, action, barcode, cardnumber, amount) VALUES(?,?,?,?,?,?,?)"); + $sth->execute( $userid, $branchcode, $timestamp, $action, $barcode, $cardnumber, $amount ); return "Added."; } @@ -3349,6 +3350,8 @@ sub ProcessOfflineOperation { $report = ProcessOfflineReturn( $operation ); } elsif ( $operation->{action} eq 'issue' ) { $report = ProcessOfflineIssue( $operation ); + } elsif ( $operation->{action} eq 'payment' ) { + $report = ProcessOfflinePayment( $operation ); } DeleteOfflineOperation( $operation->{operationid} ) if $operation->{operationid}; @@ -3418,6 +3421,16 @@ sub ProcessOfflineIssue { } } +sub ProcessOfflinePayment { + my $operation = shift; + + my $borrower = C4::Members::GetMemberDetails( undef, $operation->{cardnumber} ); # Get borrower from operation cardnumber + my $amount = $operation->{amount}; + + recordpayment( $borrower->{borrowernumber}, $amount ); + + return "Success." +} =head2 TransferSlip --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -1573,17 +1573,17 @@ CREATE TABLE `patronimage` ( -- information related to patron images -- so MyISAM is better in this case DROP TABLE IF EXISTS `pending_offline_operations`; -CREATE TABLE `pending_offline_operations` ( - `operationid` int(11) NOT NULL AUTO_INCREMENT, - `userid` varchar(30) NOT NULL, - `branchcode` varchar(10) NOT NULL, +CREATE TABLE pending_offline_operations ( + operationid int(11) NOT NULL AUTO_INCREMENT, + userid varchar(30) NOT NULL, + branchcode varchar(10) NOT NULL, `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `action` varchar(10) NOT NULL, - `barcode` varchar(20) NOT NULL, - `cardnumber` varchar(16) DEFAULT NULL, - PRIMARY KEY (`operationid`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - + barcode varchar(20) DEFAULT NULL, + cardnumber varchar(16) DEFAULT NULL, + amount decimal(28,6) DEFAULT NULL, + PRIMARY KEY (operationid) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -5828,8 +5828,6 @@ if(C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } - - $DBversion = "3.09.00.050"; if (C4::Context->preference("Version") < TransformToNum($DBversion)) { $dbh->do("ALTER TABLE authorised_values MODIFY category varchar(16) NOT NULL DEFAULT '';"); @@ -6505,6 +6503,15 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } + +$DBversion = "3.11.00.XXX"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("ALTER TABLE `pending_offline_operations` CHANGE `barcode` `barcode` VARCHAR( 20 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL"); + $dbh->do("ALTER TABLE `pending_offline_operations` ADD `amount` DECIMAL( 28, 6 ) NULL DEFAULT NULL"); + print "Upgrade to $DBversion done (Bug 8220 - Allow koc uploads to go to process queue)\n"; + SetVersion ($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt @@ -53,8 +53,12 @@
Offline circulation
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/offline_circ/enqueue_koc.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/offline_circ/enqueue_koc.tt @@ -0,0 +1,31 @@ +[% INCLUDE 'doc-head-open.inc' %] +Koha › Circulation › Add offline circulations to queue +[% INCLUDE 'doc-head-close.inc' %] + + +[% INCLUDE 'header.inc' %] +[% INCLUDE 'circ-search.inc' %] + + + +
+ +
+ +

Koha offline circulation

+

Your file was processed.

+ +[% FOREACH message IN messages %] + [% IF ( message.message ) %] + [% IF ( message.ERROR_file_version ) %] +

Warning: This file is version [% message.upload_version %], but I only know how to import version [% message.current_version %]. I'll try my best.

+ [% END %] + [% END %] +[% END %] + +

Upload another KOC file

+ +

View pending offline circulation actions

+ +
+[% INCLUDE 'intranet-bottom.inc' %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/offline_circ/list.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/offline_circ/list.tt @@ -78,7 +78,8 @@ Date Action Barcode - Card number + Card number + Amount @@ -95,7 +96,7 @@ [% END %] - [% IF ( operation.actionissue ) %] + [% IF ( operation.actionissue || operation.actionpayment) %] [% IF ( operation.borrowernumber ) %] [% operation.cardnumber %] [% ELSE %] @@ -103,6 +104,7 @@ [% END %] [% END %] + [% operation.amount %] [% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/offline_circ/process_koc.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/offline_circ/process_koc.tt @@ -6,22 +6,25 @@