+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 },
+ }
+ );
+}