use Modern::Perl;
use CGI qw ( -utf8 );
-use Carp;
-use C4::Output;
-use C4::Auth;
-use C4::Koha;
+use C4::Output qw( output_html_with_http_headers );
+use C4::Auth qw( get_template_and_user );
use C4::Context;
-use C4::Biblio;
use C4::Accounts;
-use C4::Circulation;
-use C4::Items;
+use C4::Circulation qw( barcodedecode GetOpenIssue AddRenewal AddIssue MarkIssueReturned );
+use C4::Items qw( ModDateLastSeen );
use C4::Members;
use C4::Stats;
use C4::BackgroundJob;
use Koha::Checkouts;
use Koha::Patrons;
-use Date::Calc qw( Add_Delta_Days Date_to_Days );
+use Date::Calc qw( Date_to_Days );
use constant DEBUG => 0;
template_name => "offline_circ/process_koc.tt",
query => $query,
type => "intranet",
- authnotrequired => 0,
flagsrequired => { circulate => "circulate_remaining_permissions" },
});
my $fileID=$query->param('uploadedfileid');
my $runinbackground = $query->param('runinbackground');
my $completedJobID = $query->param('completedJobID');
-my %cookies = parse CGI::Cookie($cookie);
+my %cookies = CGI::Cookie->fetch();
my $sessionID = $cookies{'CGISESSID'}->value;
## 'Local' globals.
our $dbh = C4::Context->dbh();
sub kocIssueItem {
my $circ = shift;
- $circ->{ 'barcode' } = barcodedecode($circ->{'barcode'}) if( $circ->{'barcode'} && C4::Context->preference('itemBarcodeInputFilter'));
+ $circ->{barcode} = barcodedecode( $circ->{barcode} ) if $circ->{barcode};
+
my $branchcode = C4::Context->userenv->{branch};
my $patron = Koha::Patrons->find( { cardnumber => $circ->{cardnumber} } );
my $borrower = $patron->unblessed;
undef, # branch
undef, # datedue - let AddRenewal calculate it automatically
$circ->{'date'}, # issuedate
- ) unless ($DEBUG);
+ ) unless (DEBUG);
push @output, {
renew => 1,
sub kocReturnItem {
my ( $circ ) = @_;
- $circ->{'barcode'} = barcodedecode($circ->{'barcode'}) if( $circ->{'barcode'} && C4::Context->preference('itemBarcodeInputFilter'));
+
+ $circ->{barcode} = barcodedecode( $circ->{barcode} ) if $circ->{barcode};
+
my $item = Koha::Items->find({ barcode => $circ->{barcode} });
my $biblio = $item->biblio;
my $borrowernumber = _get_borrowernumber_from_barcode( $circ->{'barcode'} );
C4::Circulation::MarkIssueReturned(
$borrowernumber,
$item->itemnumber,
- undef,
$circ->{'date'},
$patron->privacy
);
- ModItem({ onloan => undef }, $biblio->biblionumber, $item->itemnumber);
+ $item->onloan(undef)->store;
ModDateLastSeen( $item->itemnumber );
push @output,
my $patron = Koha::Patrons->find( { cardnumber => $cardnumber } );
Koha::Account->new( { patron_id => $patron->id } )
- ->pay( { amount => $amount } );
+ ->pay( { amount => $amount, interface => C4::Context->interface } );
push @output,
{