PERL Basics for interacting or debugging the Koha System

Join Nick Clemens as he walks you through using PERL to interact or debug the koha system.

Simple script to demonstrate

# /usr/bin/perl

use Data::Dumper;
use Getopt::Long;

use C4::Reserves;

use Koha::CirculationRules;
use Koha::Items;
use Koha::Patrons;

my $cardnumber;
my $barcode;

GetOptions(
 "cardnumber=s" => \$cardnumber,
 "barcode=s" => \$barcode
);

my $item = Koha::Items->find({ barcode => $barcode });
my $patron = Koha::Patrons->find({ cardnumber => $cardnumber });

print "++\n";
print Koha::CirculationRules->get_opacitemholds_policy( { item => $item, patron => $patron } ) . "\n";
print "++\n";

my $rule = Koha::CirculationRules->get_effective_rule(
 {
 categorycode => $patron->categorycode,
 itemtype => $item->effective_itemtype,
 branchcode => $patron->branchcode,
 rule_name => 'opacitemholds',
 }
); 



warn Data::Dumper::Dumper( $rule->unblessed );

my $avail = IsAvailableForItemLevelRequest($item, $patron); 
my $can = CanItemBeReserved( $patron->borrowernumber, $item->itemnumber );

print "Is available: $avail and my can is: \n";

warn Data::Dumper::Dumper( $can );


Koha Testing Docker

How to Install a Koha Testing Docker: This tutorial will walk you through setting up a Koha Testing Docker on your computer. The post includes step by step instructions and a how-to video.

Webinar

When: April 30, 2020

Time: 2:00 PM Eastern Time (US and Canada)

Topic: PERL Basics for interacting or debugging the Koha System

Register in advance for this webinar.

After registering, you will receive a confirmation email containing information about joining the webinar. This will be recorded and made available on-demand.

Read more by Nick Clemens

Tags