use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Context;
-use C4::Output;
-use C4::Auth;
-use C4::Koha;
-use C4::Debug;
-use Koha::DateUtils;
+use C4::Output qw( output_html_with_http_headers );
+use C4::Auth qw( get_template_and_user );
+use Koha::Exception;
+use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::Database;
use Koha::Logger;
use Koha::Libraries;
if ($op eq 'delete') {
my $itemtype = $input->param('itemtype');
my $categorycode = $input->param('categorycode');
- $debug and warn "deleting $1 $2 $branch";
Koha::CirculationRules->set_rules(
{
cap_fine_to_replacement_price => undef,
article_requests => undef,
note => undef,
+ recalls_allowed => undef,
+ recalls_per_record => undef,
+ on_shelf_recalls => undef,
+ recall_due_date_interval => undef,
+ recall_overdue_fine => undef,
+ recall_shelf_time => undef,
}
}
);
my $cap_fine_to_replacement_price = ($input->param('cap_fine_to_replacement_price') || '') eq 'on';
my $note = $input->param('note');
my $decreaseloanholds = $input->param('decreaseloanholds') || undef;
- $debug and warn "Adding $br, $bor, $itemtype, $fine, $maxissueqty, $maxonsiteissueqty, $cap_fine_to_replacement_price";
+ my $recalls_allowed = $input->param('recalls_allowed');
+ my $recalls_per_record = $input->param('recalls_per_record');
+ my $on_shelf_recalls = $input->param('on_shelf_recalls');
+ my $recall_due_date_interval = $input->param('recall_due_date_interval');
+ my $recall_overdue_fine = $input->param('recall_overdue_fine');
+ my $recall_shelf_time = $input->param('recall_shelf_time');
my $rules = {
maxissueqty => $maxissueqty,
article_requests => $article_requests,
note => $note,
decreaseloanholds => $decreaseloanholds,
+ recalls_allowed => $recalls_allowed,
+ recalls_per_record => $recalls_per_record,
+ on_shelf_recalls => $on_shelf_recalls,
+ recall_due_date_interval => $recall_due_date_interval,
+ recall_overdue_fine => $recall_overdue_fine,
+ recall_shelf_time => $recall_shelf_time,
};
Koha::CirculationRules->set_rules(
);
}
}
+elsif ( $op eq "add-open-article-requests-limit" ) {
+ my $categorycode = $input->param('categorycode');
+ my $open_article_requests_limit = strip_non_numeric( scalar $input->param('open_article_requests_limit') );
+
+ Koha::Exception->throw("No value passed for article request limit")
+ if not defined $open_article_requests_limit # There is a JS check for that
+ || $open_article_requests_limit eq '';
+
+ if ( $branch eq "*" ) {
+ if ( $categorycode eq "*" ) {
+ Koha::CirculationRules->set_rules(
+ { categorycode => undef,
+ branchcode => undef,
+ rules => { open_article_requests_limit => $open_article_requests_limit, }
+ }
+ );
+ } else {
+ Koha::CirculationRules->set_rules(
+ { categorycode => $categorycode,
+ branchcode => undef,
+ rules => { open_article_requests_limit => $open_article_requests_limit, }
+ }
+ );
+ }
+ } elsif ( $categorycode eq "*" ) {
+ Koha::CirculationRules->set_rules(
+ { categorycode => undef,
+ branchcode => $branch,
+ rules => { open_article_requests_limit => $open_article_requests_limit, }
+ }
+ );
+ } else {
+ Koha::CirculationRules->set_rules(
+ { categorycode => $categorycode,
+ branchcode => $branch,
+ rules => { open_article_requests_limit => $open_article_requests_limit, }
+ }
+ );
+ }
+} elsif ( $op eq 'del-open-article-requests-limit' ) {
+ my $categorycode = $input->param('categorycode');
+ if ( $branch eq "*" ) {
+ if ( $categorycode eq "*" ) {
+ Koha::CirculationRules->set_rules(
+ { branchcode => undef,
+ categorycode => undef,
+ rules => { open_article_requests_limit => undef, }
+ }
+ );
+ } else {
+ Koha::CirculationRules->set_rules(
+ { categorycode => $categorycode,
+ branchcode => undef,
+ rules => { open_article_requests_limit => undef, }
+ }
+ );
+ }
+ } elsif ( $categorycode eq "*" ) {
+ Koha::CirculationRules->set_rules(
+ { branchcode => $branch,
+ categorycode => undef,
+ rules => { open_article_requests_limit => undef, }
+ }
+ );
+ } else {
+ Koha::CirculationRules->set_rules(
+ { categorycode => $categorycode,
+ branchcode => $branch,
+ rules => { open_article_requests_limit => undef, }
+ }
+ );
+ }
+}
+elsif ( $op eq "set-article-request-fee" ) {
+
+ my $category = $input->param('article_request_fee_category');
+ my $fee = strip_non_numeric( scalar $input->param('article_request_fee') );
+
+ Koha::Exception->throw("No value passed for article request fee")
+ if not defined $fee # There is a JS check for that
+ || $fee eq '';
+
+ Koha::CirculationRules->set_rules(
+ { categorycode => ( $category eq '*' ) ? undef : $category,
+ branchcode => ( $branch eq '*' ) ? undef : $branch,
+ rules => { article_request_fee => $fee },
+ }
+ );
+
+} elsif ( $op eq 'del-article-request-fee' ) {
+
+ my $category = $input->param('article_request_fee_category');
+
+ Koha::CirculationRules->set_rules(
+ { categorycode => ( $category eq '*' ) ? undef : $category,
+ branchcode => ( $branch eq '*' ) ? undef : $branch,
+ rules => { article_request_fee => undef },
+ }
+ );
+}
elsif ($op eq "add-branch-item") {
my $itemtype = $input->param('itemtype');
my $holdallowed = $input->param('holdallowed');