use Koha::RefundLostItemFeeRule;
use Koha::RefundLostItemFeeRules;
use Koha::Libraries;
+use Koha::CirculationRules;
use Koha::Patron::Categories;
+use Koha::Caches;
my $input = CGI->new;
my $dbh = C4::Context->dbh;
my $op = $input->param('op') || q{};
my $language = C4::Languages::getlanguage();
+my $cache = Koha::Caches->get_instance;
+$cache->clear_from_cache( Koha::IssuingRules::GUESSED_ITEMTYPES_KEY );
+
if ($op eq 'delete') {
my $itemtype = $input->param('itemtype');
my $categorycode = $input->param('categorycode');
AND categorycode = ?");
$sth_delete->execute($branch, $categorycode);
}
+ Koha::CirculationRules->set_rule(
+ {
+ branchcode => $branch,
+ categorycode => $categorycode,
+ itemtype => undef,
+ rule_name => 'max_holds',
+ rule_value => undef,
+ }
+ );
}
elsif ($op eq 'delete-branch-item') {
my $itemtype = $input->param('itemtype');
$sth_search->execute();
my $res = $sth_search->fetchrow_hashref();
if ($res->{total}) {
- $sth_update->execute( $maxissueqty, $maxonsiteissueqty, $max_holds );
+ $sth_update->execute( $maxissueqty, $maxonsiteissueqty );
} else {
- $sth_insert->execute( $maxissueqty, $maxonsiteissueqty, $max_holds );
+ $sth_insert->execute( $maxissueqty, $maxonsiteissueqty );
}
+
+ Koha::CirculationRules->set_rule(
+ {
+ branchcode => undef,
+ categorycode => undef,
+ itemtype => undef,
+ rule_name => 'max_holds',
+ rule_value => $max_holds,
+ }
+ );
} else {
my $sth_search = $dbh->prepare("SELECT count(*) AS total
FROM default_borrower_circ_rules
$sth_search->execute($categorycode);
my $res = $sth_search->fetchrow_hashref();
if ($res->{total}) {
- $sth_update->execute( $maxissueqty, $maxonsiteissueqty, $categorycode, $max_holds );
+ $sth_update->execute( $maxissueqty, $maxonsiteissueqty, $categorycode );
} else {
- $sth_insert->execute( $categorycode, $maxissueqty, $maxonsiteissueqty, $max_holds );
+ $sth_insert->execute( $categorycode, $maxissueqty, $maxonsiteissueqty );
}
+
+ Koha::CirculationRules->set_rule(
+ {
+ branchcode => undef,
+ categorycode => $categorycode,
+ itemtype => undef,
+ rule_name => 'max_holds',
+ rule_value => $max_holds,
+ }
+ );
}
} elsif ($categorycode eq "*") {
my $sth_search = $dbh->prepare("SELECT count(*) AS total
} else {
$sth_insert->execute($branch, $categorycode, $maxissueqty, $maxonsiteissueqty, $max_holds);
}
+
+ Koha::CirculationRules->set_rule(
+ {
+ branchcode => $branch,
+ categorycode => $categorycode,
+ itemtype => undef,
+ rule_name => 'max_holds',
+ rule_value => $max_holds,
+ }
+ );
}
}
elsif ($op eq "add-branch-item") {