Patch to remove issuingrules.pl in favor of
using smart-rules.pl to manage loan and fine
rules. Several reasons for this:
* issuingrules.pl's matrix could grow rather large
if the library has a large number of item types
and patron categories
* successfully entering rules via issuingrules.pl
requires placing commas within input fields
* a sparse circulation policy matrix takes the
same amount of screen space as one that uses
rules for a lot of specific patron category/item type
combinations.
* having two administrative interfaces to the same
policy settings could be confusing.
* UI design of smart-rules.pl better lends itself
to adding more policy setting attributes to the
rules matrix.
---
admin/issuingrules.pl | 154 --------------------
.../intranet-tmpl/prog/en/includes/admin-menu.inc | 3 +-
.../prog/en/modules/admin/admin-home.tmpl | 6 +-
.../prog/en/modules/admin/issuingrules.tmpl | 90 ------------
.../prog/en/modules/help/admin/issuingrules.tmpl | 20 ---
5 files changed, 3 insertions(+), 270 deletions(-)
delete mode 100755 admin/issuingrules.pl
delete mode 100644
koha-tmpl/intranet-tmpl/prog/en/modules/admin/issuingrules.tmpl
delete mode 100644
koha-tmpl/intranet-tmpl/prog/en/modules/help/admin/issuingrules.tmpl
diff --git a/admin/issuingrules.pl b/admin/issuingrules.pl
deleted file mode 100755
index 26cec08..0000000
--- a/admin/issuingrules.pl
+++ /dev/null
@@ -1,154 +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::Output;
-use C4::Auth;
-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/issuingrules.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 branchcode FROM issuingrules WHERE
branchcode=? and categorycode=? and itemtype=?");
-
- my $sth_Iinsert = $dbh->prepare("INSERT INTO issuingrules
(branchcode,categorycode,itemtype,maxissueqty,issuelength,rentaldiscount)
VALUES (?,?,?,?,?,?)");
- my $sth_Iupdate=$dbh->prepare("UPDATE issuingrules SET maxissueqty=?,
issuelength=?, rentaldiscount=? WHERE branchcode=? AND categorycode=? AND
itemtype=?");
- my $sth_Idelete=$dbh->prepare("DELETE FROM issuingrules WHERE branchcode=?
AND categorycode=? AND itemtype=?");
- foreach my $key (@names){
- # ISSUES
- if ($key =~ /I-(.*)-(.*)-(.*)/) {
- 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 ($issuelength,$maxissueqty,$rentaldiscount)=split(',',$data);
- if ($maxissueqty) {
- $sth_search->execute($br,$bor,$cat);
- my $res = $sth_search->fetchrow_hashref();
- warn "$br / $bor / $cat = ".$res->{'total'};
- if ( $res->{'branchcode'} ne $br ) {
-
$sth_Iinsert->execute($br,$bor,$cat,$maxissueqty,$issuelength,$rentaldiscount);
- } else {
-
$sth_Iupdate->execute($maxissueqty,$issuelength,$rentaldiscount,$br,$bor,$cat);
- }
- } else {
- $sth_Idelete->execute($br,$bor,$cat);
- }
- }
- }
-}
-my $branches = GetBranches;
-my @branchloop;
-for my $thisbranch (sort { $branches->{$a}->{branchname} cmp
$branches->{$b}->{branchname} } 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;
-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;
-my $toggle= 1;
-my @row_loop;
-my @itemtypes;
-while (my $row=$sth->fetchrow_hashref){
- push @itemtypes,\$row;
-}
-my $line;
-$line->{itemtype} = "*";
-$line->{description} = "*";
-push @itemtypes,\$line;
-
-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'};
- my $maxissueqty = $dat->{'maxissueqty'};
- my $issuelength = $dat->{'issuelength'};
- my $issuingvalue;
- $issuingvalue = "$issuelength,$maxissueqty" if $maxissueqty ne '';
- my $issuingname = join("-", "I", map { str_to_base64($_) } ($branch,
$trow3[$i], $$data->{itemtype}) );
- my %row = (issuingname => $issuingname,
- issuingvalue => $issuingvalue,
- toggle => $toggle,
- );
- push @cell_loop,\%row;
- }
- my %row = (categorycode => $$data->{description},
- total => ($$data->{itemtype} eq '*'?1:0),
- cell =>[EMAIL PROTECTED]
- );
- push @row_loop, \%row;
-}
-
-$sth->finish;
-$template->param(title => [EMAIL PROTECTED],
- row => [EMAIL PROTECTED],
- branchloop => [EMAIL PROTECTED],
- 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 e4bc8d7..df86901 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc
@@ -17,8 +17,7 @@
<li><a href="/cgi-bin/koha/admin/cities.pl">Cities and towns</a></li>
<li><a href="/cgi-bin/koha/admin/roadtype.pl">Road types</a></li>
<li><a href="/cgi-bin/koha/admin/patron-attr-types.pl">Patron attribute
types</a></li>
- <li><a href="/cgi-bin/koha/admin/issuingrules.pl">Circulation
rules</a></li>
- <li><a href="/cgi-bin/koha/admin/smart-rules.pl">Alternate circulation
rules</a></li>
+ <li><a href="/cgi-bin/koha/admin/smart-rules.pl">Circulation and fines
rules</a></li>
</ul>
<h5>Catalogue</h5>
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 97cfb06..32407eb 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
@@ -46,10 +46,8 @@
<dd>Define road types (street, avenue, way, etc.). Road types display
as authorized values when adding/editing patrons and can be used in geographic
statistics.</dd>
<dt><a href="/cgi-bin/koha/admin/patron-attr-types.pl">Patron attribute
types</a></dt>
<dd>Define extended attributes (identifiers and statistical categories)
for patron records</dd>
- <dt><a href="/cgi-bin/koha/admin/issuingrules.pl">Circulation
rules</a></dt>
- <dd>Define circulation rules in a matrix for libraries / patrons /
itemtypes / circ codes (number of checkouts, duration, fee, etc.).</dd>
- <dt><a href="/cgi-bin/koha/admin/smart-rules.pl">Circulation and fines
rules (alternate layout)</a></dt>
- <dd>Define circulation rules and fines as a list</dd>
+ <dt><a href="/cgi-bin/koha/admin/smart-rules.pl">Circulation and fines
rules</a></dt>
+ <dd>Define circulation and fines rules for combinations of libraries,
patron categories, and item types</dd>
</dl>
</div>
<div class="yui-u">
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/issuingrules.tmpl
b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/issuingrules.tmpl
deleted file mode 100644
index c6f131f..0000000
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/issuingrules.tmpl
+++ /dev/null
@@ -1,90 +0,0 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
-<title>Koha › Administration › Circulation Rules</title>
-<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-
-<script type="text/javascript">
-//<![CDATA[
-$(document).ready(function() {
- $('#selectlibrary').find("input:submit").hide();
- $('#branch').change(function() {
- $('#selectlibrary').submit();
- });
-});
-//]]>
-</script>
-
-</head>
-<body>
-<!-- TMPL_INCLUDE NAME="header.inc" -->
-<!-- TMPL_INCLUDE NAME="cat-search.inc" -->
-
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a
href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> ›
Circulation Rules</div>
-
-<div id="doc3" class="yui-t1">
-
-<div id="bd">
- <div id="yui-main">
- <div class="yui-b">
-
- <h1>Defining <!-- TMPL_IF NAME="branch" -->circulation rules for <!--
TMPL_VAR NAME="branch" --><!-- TMPL_ELSE -->default circulation rules<!--
/TMPL_IF --></h1>
- <div class="help">
- <h3>HINT</h3>
- <p>Each box needs to be filled in with <span
class="ex">checkout-length,maxissues</span>. For example: 21,5 enables 5
checkouts for 21 days</p>
- </div>
-
- <div class="help">
- <h3>Default values</h3>
- <ul>
- <li>If a cell is not filled, the value in the default column (top
right) is used</li>
- <li>If a total is filled (last line), the patron must fit both
itemtype and total rule</li>
- <li>If a rule is filled for a given branch, it is used, otherwise,
it's the rule of the "default" branch</li>
- </ul>
- </div>
- <form method="post" id="selectlibrary"
action="/cgi-bin/koha/admin/issuingrules.pl">
- <label for="branch">Select a library :</label>
- <select id="branch" name="branch">
- <option value="">Default</option>
- <!-- TMPL_LOOP NAME="branchloop" -->
- <!-- TMPL_IF NAME="selected" -->
- <option value="<!-- TMPL_VAR NAME="value" -->"
selected="selected"><!-- TMPL_VAR NAME="branchname" --></option>
- <!-- TMPL_ELSE -->
- <option value="<!-- TMPL_VAR NAME="value" -->"><!--
TMPL_VAR NAME="branchname" --></option>
- <!-- /TMPL_IF -->
- <!-- /TMPL_LOOP -->
- </select>
- <input type="submit" value="Select" />
- </form>
- <form method="post" action="/cgi-bin/koha/admin/issuingrules.pl">
- <input type="hidden" name="op" value="save" />
- <input type="hidden" name="branch" value="<!-- TMPL_VAR
NAME="branch" -->" />
-
- <table>
- <caption>Defining circulation rules for <!-- TMPL_VAR
NAME="branch" --></caption>
- <tr>
- <th> </th><!-- TMPL_LOOP NAME="title" --><th
scope="col"><!-- TMPL_IF EXPR="in_title eq '*'" -->Default<!-- TMPL_ELSE
--><!-- TMPL_VAR NAME="in_title" --><!-- /TMPL_IF --></th><!-- /TMPL_LOOP -->
- </tr>
- <!-- TMPL_LOOP NAME="row" -->
- <tr>
- <th scope="row"><!-- TMPL_IF name="total" -->Total
<!-- TMPL_ELSE --><!-- TMPL_VAR NAME="categorycode" --><!-- /TMPL_IF --></th>
- <!-- TMPL_LOOP NAME="cell" -->
- <!-- TMPL_IF NAME="toggle" -->
- <td class="highlight">
- <!-- TMPL_ELSE -->
- <td>
- <!-- /TMPL_IF -->
- <input name="<!-- TMPL_VAR NAME="issuingname"
-->" value="<!-- TMPL_VAR NAME="issuingvalue" -->" size="6" maxlength="10" />
- </td>
- <!-- /TMPL_LOOP -->
- </tr>
- <!-- /TMPL_LOOP -->
- </table>
- <fieldset class="action"><input type="submit" value="Save Changes"
/> <a class="cancel"
href="/cgi-bin/koha/admin/admin-home.pl">Cancel</a></fieldset>
- </form>
-
-</div>
-</div>
-<div class="yui-b">
-<!-- TMPL_INCLUDE NAME="admin-menu.inc" -->
-</div>
-</div>
-<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
diff --git
a/koha-tmpl/intranet-tmpl/prog/en/modules/help/admin/issuingrules.tmpl
b/koha-tmpl/intranet-tmpl/prog/en/modules/help/admin/issuingrules.tmpl
deleted file mode 100644
index 60b5242..0000000
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/admin/issuingrules.tmpl
+++ /dev/null
@@ -1,20 +0,0 @@
-<!-- TMPL_INCLUDE NAME="help-top.inc" -->
-
-<h1>Issuing rules</h1>
-<p>Issuing rules deals with 2 topics :</p>
-<ul>
- <li>Issuing length and quantity : they say how many items and how long
a patron category can check out for an itemtype </li>
- <li>Overdue charges : they are based on the item type and patron type.
These charges are defined on this page.</li>
-</ul>
-<p>Itemtypes and patron categories must be defined before issuing rules are
defined. Your defined items types and patron categories are then displayed in a
grid on this page.</p>
-
-<h2>Issuing length and quantity</h2>
-<p>Each box in the grid contains 2 numbers, separated by commas, defining how
many days a given patron type can check out how many material. For example :
21,5 means the patron can check out up to 5 books for up to 21 days</p>
-<p>The <b>*</b> have a specific meaning. They mean "any". If you set 21,5 for
itemtype=*, patron category=student, branch=main, then a student can't check
out more than 5 items of ANY item type. This "any" box is cumulative with other
boxes. It means that 21,5 as itemtype=book, 14,2 as itemtype=CD and 30,6 as
itemtype=* (with category=student) means a student can check out up to 5 books,
up to 2 CD but a maximum of 6 items (books or CD). In this case the "30 days"
in itemtype=* is discarded and the issuing length is calculated on the exact
itemtype</p>
-
-<h2>Overdue charges</h2>
-<p>Each box in the grid contains three numbers separated by commas, defining
the fine, how many days overdue the item must be before the fine is assessed
and a first notice prepared (the "grace period"), and how many days after that
the fine is assessed again and a second notice sent. For example, if you charge
adults 1 dollar (or euro, or whatever currency) for overdue videos after three
days and add another dollar charge after another five days, put "1,3,5" in the
box in the grid that aligns with "Adult" and "Video." If you charge adults 25
cents for overdue fiction books after a grace period of seven days and repeat
the charge seven days later, then the entry in the corresponding box in the
grid would be ".25,7,7". After the first and second notice are given, Koha
prepares a "final notice" after the number of days set by the final number in
the grid and sets the charge to the maximum, which is 5.</p>
-
-<p>(Note : fines are calculated by the fines2.pl script, located in misc
directory. Ask your system administrator to put this script in crontab, after
midnight, to have fines calculated every night.)</p>
-
-<!-- TMPL_INCLUDE name="help-bottom.inc" -->
\ No newline at end of file
--
1.5.5.GIT
_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches