From 5a7905f44077d2e257ef47fcbb2983f434add550 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 20 Jun 2008 08:11:21 -0500 Subject: [PATCH] bug 2000 - removed finesrules.pl Removed the separate admin/finesrules.pl script to set the fines policy matrix: since admin/finesrules.pl and admin/issuingrules.pl both touch issuingrules.pl, creating a specific fine rule could silently override a default issuing rule and prevent items from being checked out. Circulation policy matrix settings for fines are now handled in admin/smart-rules.pl Signed-off-by: Joshua Ferraro --- admin/finesrules.pl | 151 ------------------ .../prog/en/includes/admin-menu.inc | 1 - .../prog/en/modules/admin/admin-home.tmpl | 2 - .../prog/en/modules/admin/finesrules.tmpl | 89 ----------- 4 files changed, 243 deletions(-) delete mode 100755 admin/finesrules.pl delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/admin/finesrules.tmpl diff --git a/admin/finesrules.pl b/admin/finesrules.pl deleted file mode 100755 index e89e7adee3..0000000000 --- a/admin/finesrules.pl +++ /dev/null @@ -1,151 +0,0 @@ -#!/usr/bin/perl - -# Copyright 2000-2002 Katipo Communications -# -# This file is part of Koha. -# -# Koha is free software; you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation; either version 2 of the License, or (at your option) any later -# version. -# -# Koha is distributed in the hope that it will be useful, but WITHOUT ANY -# 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 - -use strict; -use CGI; -use C4::Context; -use C4::Auth; -use C4::Output; - -use C4::Koha; -use C4::Branch; # GetBranches - -my $input = new CGI; -my $dbh = C4::Context->dbh; - -my $type=$input->param('type'); -my $branch = $input->param('branch'); -$branch="*" unless $branch; -my $op = $input->param('op'); - -# my $flagsrequired; -# $flagsrequired->{circulation}=1; -my ($template, $loggedinuser, $cookie) - = get_template_and_user({template_name => "admin/finesrules.tmpl", - query => $input, - type => "intranet", - authnotrequired => 0, - flagsrequired => {parameters => 1}, - debug => 1, - }); -# save the values entered -if ($op eq 'save') { - my @names=$input->param(); - my $sth_search = $dbh->prepare("SELECT count(*) AS total FROM issuingrules WHERE branchcode=? AND categorycode=? AND itemtype=?"); - - my $sth_Finsert = $dbh->prepare("INSERT INTO issuingrules (branchcode,categorycode,itemtype,fine,firstremind,chargeperiod) VALUES (?,?,?,?,?,?)"); - my $sth_Fupdate=$dbh->prepare("UPDATE issuingrules SET fine=?,firstremind=?,chargeperiod=? WHERE branchcode=? AND categorycode=? AND itemtype=?"); - my $sth_Fdelete=$dbh->prepare("DELETE FROM issuingrules WHERE branchcode=? AND categorycode=? AND itemtype=? AND issuelength=0"); - - foreach my $key (@names){ - # FINES - if ($key =~ /F-(.*)-(.*)-(.*)/) { - my $br = base64_to_str($1); # branch - my $bor = base64_to_str($2); # borrower category - my $cat = base64_to_str($3); # item type - my $data=$input->param($key); - my ($fine,$firstremind,$chargeperiod)=split(',',$data); - $bor="*" unless ($bor); - $cat="*" unless ($cat); - $sth_search->execute($br,$bor,$cat); - my $res = $sth_search->fetchrow_hashref(); - if ($res->{total} >0) { - $sth_Fupdate->execute($fine,$firstremind,$chargeperiod,$br,$bor,$cat); - } else { - $sth_Finsert->execute($br,$bor,$cat,$fine,$firstremind,$chargeperiod); - } - } - } - -} -my $branches = GetBranches; -my @branchloop; -foreach my $thisbranch (keys %$branches) { - my $selected = 1 if $thisbranch eq $branch; - my %row =(value => $thisbranch, - selected => $selected, - branchname => $branches->{$thisbranch}->{'branchname'}, - ); - push @branchloop, \%row; -} - -my $sth=$dbh->prepare("Select description,categorycode from categories order by description"); -$sth->execute; -my @trow3; -my @title_loop; -# my $i=0; -while (my $data=$sth->fetchrow_hashref){ - my %row = (in_title => $data->{'description'}); - push @title_loop,\%row; - push @trow3,$data->{'categorycode'}; -} - -my %row = (in_title => "*"); -push @title_loop, \%row; -push @trow3,'*'; - -$sth->finish; -$sth=$dbh->prepare("Select description,itemtype from itemtypes order by description"); -$sth->execute; -# $i=0; -my $toggle= 1; -my @row_loop; -my @itemtypes; -while (my $row=$sth->fetchrow_hashref){ - push @itemtypes,\$row; -} - -foreach my $data (@itemtypes) { - my @trow2; - my @cell_loop; - if ( $toggle eq 1 ) { - $toggle = 0; - } else { - $toggle = 1; - } - for (my $i=0;$i<=$#trow3;$i++){ - my $sth2=$dbh->prepare("SELECT * FROM issuingrules WHERE branchcode=? AND categorycode=? AND itemtype=?"); - $sth2->execute($branch,$trow3[$i],$$data->{'itemtype'}); - my $dat=$sth2->fetchrow_hashref; - $sth2->finish; - my $fine=$dat->{'fine'}; - # remove trailing 0s - $fine =~ s/\.*0*$//g; - my $finesvalue; - $finesvalue= "$fine,$dat->{'firstremind'},$dat->{'chargeperiod'}" if $fine ne ''; - my $finesname = join("-", "F", map { str_to_base64($_) } ($branch, $trow3[$i], $$data->{'itemtype'})); - my %row = (finesname=> $finesname, - finesvalue => $finesvalue, - toggle => $toggle, - ); - push @cell_loop,\%row; - } - my %row = (categorycode => $$data->{description}, - cell =>\@cell_loop, - ); - push @row_loop, \%row; -} - -$sth->finish; -$template->param(title => \@title_loop, - row => \@row_loop, - branchloop => \@branchloop, - branch => $branch, - ); -output_html_with_http_headers $input, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc index 432186f276..e4bc8d75f0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc @@ -19,7 +19,6 @@
  • Patron attribute types
  • Circulation rules
  • Alternate circulation rules
  • -
  • Fines rules
  • Catalogue
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tmpl index 55b57ebd06..97cfb061c0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tmpl @@ -48,8 +48,6 @@
    Define extended attributes (identifiers and statistical categories) for patron records
    Circulation rules
    Define circulation rules in a matrix for libraries / patrons / itemtypes / circ codes (number of checkouts, duration, fee, etc.).
    -
    Fines rules
    -
    Define fines in a matrix for libraries / patrons / itemtypes (cost, grace period, etc.).
    Circulation and fines rules (alternate layout)
    Define circulation rules and fines as a list
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/finesrules.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/finesrules.tmpl deleted file mode 100644 index 097efa37ce..0000000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/finesrules.tmpl +++ /dev/null @@ -1,89 +0,0 @@ - -Koha › Administration › Fines - - - - - - - - - -
    - -
    -
    -
    - -

    Defining fining rules for default fining rules

    - -
    -

    HINT for fines

    -

    Each box needs to be filled in with fine,time to start charging,charging cycle

    -

    eg 1,7,7 = 1 [USD,EUR,etc] fine after 7 days, every 7 days

    -

    Fines are calculated by the fines2.pl script, located in misc directory. Ask your administrator to put this script in crontab, after midnight, to have fines calculated every night

    -

    The rules are applied from most specific to less specific, the 1st who is filled :

    -
      -
    • same branch, same category
    • -
    • same branch, default category
    • -
    • default branch, same category
    • -
    • default branch, default category
    • -
    -
    -
    - - - -
    -
    - - " /> - - - - - - - - - - - - - - - -
    Defining fines rules for
     Default
    Total - - - - " value="" size="6" maxlength="10" /> -
    -
    Cancel
    -
    - -
    -
    -
    - -
    -
    - -- 2.20.1