Lines 28-33
use C4::Debug;
Link Here
|
28 |
use C4::Branch; # GetBranches |
28 |
use C4::Branch; # GetBranches |
29 |
use Koha::DateUtils; |
29 |
use Koha::DateUtils; |
30 |
use Koha::Database; |
30 |
use Koha::Database; |
|
|
31 |
use Koha::IssuingRule; |
32 |
use Koha::IssuingRules; |
31 |
|
33 |
|
32 |
my $input = CGI->new; |
34 |
my $input = CGI->new; |
33 |
my $dbh = C4::Context->dbh; |
35 |
my $dbh = C4::Context->dbh; |
Lines 136-144
elsif ($op eq 'add') {
Link Here
|
136 |
my $overduefinescap = $input->param('overduefinescap') || undef; |
138 |
my $overduefinescap = $input->param('overduefinescap') || undef; |
137 |
$debug and warn "Adding $br, $bor, $itemtype, $fine, $maxissueqty, $maxonsiteissueqty"; |
139 |
$debug and warn "Adding $br, $bor, $itemtype, $fine, $maxissueqty, $maxonsiteissueqty"; |
138 |
|
140 |
|
139 |
my $schema = Koha::Database->new()->schema(); |
|
|
140 |
my $rs = $schema->resultset('Issuingrule'); |
141 |
|
142 |
my $params = { |
141 |
my $params = { |
143 |
branchcode => $br, |
142 |
branchcode => $br, |
144 |
categorycode => $bor, |
143 |
categorycode => $bor, |
Lines 166-172
elsif ($op eq 'add') {
Link Here
|
166 |
overduefinescap => $overduefinescap, |
165 |
overduefinescap => $overduefinescap, |
167 |
}; |
166 |
}; |
168 |
|
167 |
|
169 |
$rs->update_or_create($params); |
168 |
my $issuingrule = Koha::IssuingRules->find({categorycode => $bor, itemtype => $itemtype, branchcode => $br}); |
|
|
169 |
if ($issuingrule) { |
170 |
$issuingrule->set($params)->store(); |
171 |
} else { |
172 |
Koha::IssuingRule->new()->set($params)->store(); |
173 |
} |
170 |
|
174 |
|
171 |
} |
175 |
} |
172 |
elsif ($op eq "set-branch-defaults") { |
176 |
elsif ($op eq "set-branch-defaults") { |
173 |
- |
|
|