X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=admin%2Fsmart-rules.pl;h=9ad132c6ba07274b27f79d51ded20477060c145e;hb=ddbedbfc2f17bff016736afb5beae39a768a298a;hp=60866368591c2bca59d72c898df6b2b1a2d3f118;hpb=ee83c4ae809e79c54ab43c93a28d578d1e87ed5a;p=koha_fer diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl index 6086636859..9ad132c6ba 100755 --- a/admin/smart-rules.pl +++ b/admin/smart-rules.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl -# vim: et ts=4 sw=4 # Copyright 2000-2002 Katipo Communications +# copyright 2010 BibLibre # # This file is part of Koha. # @@ -13,11 +13,12 @@ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License along with -# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, -# Suite 330, Boston, MA 02111-1307 USA +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. use strict; +#use warnings; FIXME - Bug 2505 use CGI; use C4::Context; use C4::Output; @@ -99,27 +100,31 @@ elsif ($op eq 'delete-branch-item') { # save the values entered elsif ($op eq 'add') { my $sth_search = $dbh->prepare("SELECT COUNT(*) AS total FROM issuingrules WHERE branchcode=? AND categorycode=? AND itemtype=?"); - my $sth_insert = $dbh->prepare("INSERT INTO issuingrules (branchcode, categorycode, itemtype, maxissueqty, issuelength, fine, firstremind, chargeperiod) VALUES(?,?,?,?,?,?,?,?)"); - my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, firstremind=?, chargeperiod=?, maxissueqty=?, issuelength=? WHERE branchcode=? AND categorycode=? AND itemtype=?"); + my $sth_insert = $dbh->prepare("INSERT INTO issuingrules (branchcode, categorycode, itemtype, maxissueqty, renewalsallowed, reservesallowed, issuelength, fine, finedays, firstremind, chargeperiod,rentaldiscount) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)"); + my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, reservesallowed=?, issuelength=?, rentaldiscount=? WHERE branchcode=? AND categorycode=? AND itemtype=?"); my $br = $branch; # branch my $bor = $input->param('categorycode'); # borrower category my $cat = $input->param('itemtype'); # item type my $fine = $input->param('fine'); + my $finedays = $input->param('finedays'); my $firstremind = $input->param('firstremind'); my $chargeperiod = $input->param('chargeperiod'); my $maxissueqty = $input->param('maxissueqty'); + my $renewalsallowed = $input->param('renewalsallowed'); + my $reservesallowed = $input->param('reservesallowed'); $maxissueqty =~ s/\s//g; $maxissueqty = undef if $maxissueqty !~ /^\d+/; my $issuelength = $input->param('issuelength'); + my $rentaldiscount = $input->param('rentaldiscount'); $debug and warn "Adding $br, $bor, $cat, $fine, $maxissueqty"; $sth_search->execute($br,$bor,$cat); my $res = $sth_search->fetchrow_hashref(); if ($res->{total}) { - $sth_update->execute($fine, $firstremind, $chargeperiod, $maxissueqty,$issuelength,$br,$bor,$cat); + $sth_update->execute($fine, $finedays,$firstremind, $chargeperiod, $maxissueqty, $renewalsallowed,$reservesallowed, $issuelength,$rentaldiscount, $br,$bor,$cat); } else { - $sth_insert->execute($br,$bor,$cat,$maxissueqty,$issuelength,$fine,$firstremind,$chargeperiod); + $sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed,$reservesallowed,$issuelength,$fine,$finedays,$firstremind,$chargeperiod,$rentaldiscount); } } elsif ($op eq "set-branch-defaults") { @@ -476,7 +481,8 @@ $template->param(categoryloop => \@category_loop, rules => \@sorted_row_loop, branchloop => \@branchloop, humanbranch => ($branch ne '*' ? $branches->{$branch}->{branchname} : ''), - branch => $branch + current_branch => $branch, + definedbranch => scalar(@sorted_row_loop)>0 ); output_html_with_http_headers $input, $cookie, $template->output;