[Koha-patches] [PATCH] Fix for Bug 2970, Create a permission for modifying holds priority
Owen Leonard
oleonard at myacpl.org
Wed Feb 10 21:38:46 CET 2010
Adding two new granular permissions under 'reserveforothers,' place_holds
and modify_holds_priority. If a user does not have modify_holds_priority
permission, the option to change the priority of a hold is hidden.
---
installer/data/mysql/updatedatabase.pl | 13 +++++++++++++
.../prog/en/modules/reserve/request.tmpl | 12 ++++++------
reserve/request.pl | 2 +-
3 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 32ad48b..dc3fffe 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -3445,6 +3445,19 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
SetVersion ($DBversion);
}
+$DBversion = "3.01.00.XXX";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("INSERT INTO `permissions` (`module_bit`, `code`, `description`) VALUES
+ (6, 'place_holds', 'Place holds for patrons')");
+ $dbh->do("INSERT INTO `permissions` (`module_bit`, `code`, `description`) VALUES
+ (6, 'modify_holds_priority', 'Modify holds priority')");
+ $dbh->do("UPDATE `userflags` SET `flagdesc` = 'Place and modify holds for patrons' WHERE `flag` = 'reserveforothers'");
+ print "Upgrade to $DBversion done (Add granular permission for holds modification and update description of reserveforothers permission)\n";
+ SetVersion ($DBversion);
+}
+
+
+
=item DropAllForeignKeys($table)
Drop all foreign keys of the table $table
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tmpl
index 51c4e0a..ffc84b6 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tmpl
@@ -270,7 +270,7 @@ function checkMultiHold() {
</li>
<!-- TMPL_UNLESS NAME="multi_hold" -->
<li>
- <span class="label">Priority:</span>
+ <span class="label">Priority:</span>
<strong><!-- TMPL_VAR Name="fixedRank" --></strong>
</li>
<!-- /TMPL_UNLESS -->
@@ -463,7 +463,7 @@ function checkMultiHold() {
<img src="<!-- TMPL_VAR name="imageurl" -->" alt="<!-- TMPL_VAR NAME="itypename" -->" title="<!-- TMPL_VAR NAME="itypename" -->" />
</td>
<!-- /TMPL_UNLESS -->
- <td><!-- TMPL_VAR NAME="rank" --></td>
+ <td><!-- TMPL_VAR NAME="rank" --></td>
<td>
<!-- TMPL_IF NAME="alreadyres" -->
<ul>
@@ -529,7 +529,7 @@ function checkMultiHold() {
<caption><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->"><!-- TMPL_VAR NAME="title" ESCAPE="html" --></a></caption>
<!-- /TMPL_IF -->
<tr>
- <th>Priority</th>
+ <!-- TMPL_IF NAME="CAN_user_reserveforothers_modify_holds_priority" --><th>Priority</th><!-- TMPL_ELSE --><th>Delete?</th><!-- /TMPL_IF -->
<th>Patron</th>
<th>Notes</th>
<th>Date</th>
@@ -545,9 +545,9 @@ function checkMultiHold() {
<!-- TMPL_IF Name="wait" -->
<option value="W" selected="selected">Waiting</option>
<!-- /TMPL_IF -->
- <!-- TMPL_LOOP Name="optionloop" -->
- <!-- TMPL_IF Name="selected" --><option value="<!-- TMPL_VAR NAME="num" -->" selected="selected"><!-- TMPL_VAR NAME="num" --></option><!-- TMPL_ELSE --><option value="<!-- TMPL_VAR NAME="num" -->"><!-- TMPL_VAR NAME="num" --></option><!-- /TMPL_IF -->
- <!-- /TMPL_LOOP -->
+ <!-- TMPL_IF NAME="CAN_user_reserveforothers_modify_holds_priority" --><!-- TMPL_LOOP Name="optionloop" -->
+ <!-- TMPL_IF Name="selected" --><option value="<!-- TMPL_VAR NAME="num" -->" selected="selected"><!-- TMPL_VAR NAME="num" --></option><!-- TMPL_ELSE --><option value="<!-- TMPL_VAR NAME="num" -->"><!-- TMPL_VAR NAME="num" --></option><!-- /TMPL_IF -->
+ <!-- /TMPL_LOOP --><!-- TMPL_ELSE --><option value=""></option><!-- /TMPL_IF -->
<option value="del">del</option>
</select>
</td>
diff --git a/reserve/request.pl b/reserve/request.pl
index 908a626..3c6ac59 100755
--- a/reserve/request.pl
+++ b/reserve/request.pl
@@ -51,7 +51,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
query => $input,
type => "intranet",
authnotrequired => 0,
- flagsrequired => { reserveforothers => 1 },
+ flagsrequired => { reserveforothers => 'place_holds' },
}
);
--
1.6.3.3
More information about the Koha-patches
mailing list