MT2464 : branch_transfer_limit.pl usability change
Adds branchnames along with branchcodes for display Signed-off-by: Henri-Damien LAURENT <henridamien.laurent@biblibre.com> Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
This commit is contained in:
parent
c2f0fb370f
commit
e40728f4d5
|
|
@ -40,6 +40,20 @@ my ($template, $loggedinuser, $cookie)
|
|||
|
||||
my $dbh = C4::Context->dbh;
|
||||
|
||||
my $branchcode = $input->param('branchcode');
|
||||
my $branchname = GetBranchName($branchcode);
|
||||
|
||||
# Getting the branches for user selection
|
||||
my $branches = GetBranches();
|
||||
my @branch_loop;
|
||||
for my $thisbranch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) {
|
||||
my %row =(value => $thisbranch,
|
||||
branchname => $branches->{$thisbranch}->{'branchname'},
|
||||
);
|
||||
push @branch_loop, \%row;
|
||||
}
|
||||
|
||||
|
||||
# Set the template language for the correct limit type
|
||||
my $limit_phrase = 'Collection Code';
|
||||
my $limitType = C4::Context->preference("BranchTransferLimitsType");
|
||||
|
|
@ -69,15 +83,13 @@ while ( my $row = $sth->fetchrow_hashref ) {
|
|||
|
||||
## If Form Data Passed, Update the Database
|
||||
if ( $input->param('updateLimits') ) {
|
||||
DeleteBranchTransferLimits();
|
||||
DeleteBranchTransferLimits();
|
||||
|
||||
foreach my $code ( @codes ) {
|
||||
foreach my $toBranch ( @branchcodes ) {
|
||||
foreach my $fromBranch ( @branchcodes ) {
|
||||
my $isSet = $input->param( $code . "_" . $toBranch . "_" . $fromBranch );
|
||||
if ( $isSet ) {
|
||||
CreateBranchTransferLimit( $toBranch, $fromBranch, $code );
|
||||
}
|
||||
my $isSet = not $input->param( $code . "_" . $toBranch);
|
||||
if ( $isSet ) {
|
||||
CreateBranchTransferLimit( $toBranch, $branchcode, $code );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -100,23 +112,12 @@ foreach my $code ( @codes ) {
|
|||
$row_data{ code } = $code;
|
||||
$row_data{ to_branch_loop } = \@to_branch_loop;
|
||||
foreach my $toBranch ( @branchcodes ) {
|
||||
my @from_branch_loop;
|
||||
my %row_data;
|
||||
$row_data{ code } = $code;
|
||||
$row_data{ toBranch } = $toBranch;
|
||||
$row_data{ from_branch_loop } = \@from_branch_loop;
|
||||
|
||||
foreach my $fromBranch ( @branchcodes ) {
|
||||
my %row_data;
|
||||
my $isChecked = ! IsBranchTransferAllowed( $toBranch, $fromBranch, $code );
|
||||
$row_data{ code } = $code;
|
||||
$row_data{ toBranch } = $toBranch;
|
||||
$row_data{ fromBranch } = $fromBranch;
|
||||
$row_data{ isChecked } = $isChecked;
|
||||
|
||||
push( @from_branch_loop, \%row_data );
|
||||
}
|
||||
|
||||
my $isChecked = IsBranchTransferAllowed( $toBranch, $branchcode, $code );
|
||||
$row_data{ code } = $code;
|
||||
$row_data{ toBranch } = $toBranch;
|
||||
$row_data{ isChecked } = $isChecked;
|
||||
$row_data{ toBranchname } = GetBranchName($toBranch);
|
||||
push( @to_branch_loop, \%row_data );
|
||||
}
|
||||
|
||||
|
|
@ -127,7 +128,10 @@ foreach my $code ( @codes ) {
|
|||
$template->param(
|
||||
branchcount => $branchcount,
|
||||
codes_loop => \@codes_loop,
|
||||
branch_loop => \@branch_loop,
|
||||
branchcode_loop => \@branchcode_loop,
|
||||
branchcode => $branchcode,
|
||||
branchname => $branchname,
|
||||
limit_phrase => $limit_phrase,
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
|
||||
<title>Koha › Administration › Library Transfer Limits</title>
|
||||
<title>Koha › Administration › Library Checkin and Transfer Policy</title>
|
||||
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
|
||||
<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
|
@ -9,11 +9,15 @@
|
|||
$("#SwapAll").click(function(){ $("#transferlimit_tabs").toggleCheckboxes();});
|
||||
$('#transferlimit_tabs > ul').tabs();
|
||||
|
||||
$('#branchselect').change(function() {
|
||||
$('#selectlibrary').submit();
|
||||
});
|
||||
|
||||
|
||||
var checkcolumn = $(".checkcolumn");
|
||||
var checkrow = $(".checkrow");
|
||||
var checkall = $(".checkall");
|
||||
var uncheckall = $(".uncheckall");
|
||||
var swapall = $(".swapall");
|
||||
|
||||
$(checkcolumn).click(function(){
|
||||
if(this.checked){ status = "checked" } else { status = "" }
|
||||
|
|
@ -44,12 +48,6 @@
|
|||
return false;
|
||||
});
|
||||
|
||||
$(swapall).click(function(){
|
||||
var tid = $(this).attr("id");
|
||||
tid = tid.replace("SwapAll","");
|
||||
$("#"+tid).toggleCheckboxes();
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<style type="text/css">td { text-align: center; }</style>
|
||||
|
|
@ -58,7 +56,7 @@
|
|||
<!-- 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> › Set Library Transfer Limits</div>
|
||||
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> › Set Library Checkin and Transfer Policy</div>
|
||||
|
||||
<div id="doc3" class="yui-t1">
|
||||
|
||||
|
|
@ -66,9 +64,19 @@
|
|||
<div id="yui-main">
|
||||
<div class="yui-b">
|
||||
|
||||
<h1>Library Transfer Limits</h1>
|
||||
<p class="help">Check the boxes for the items that should <strong><em>not</em></strong> be transferable.</p>
|
||||
<fieldset>For <strong>all</strong> <!--TMPL_VAR NAME="limit_phrase" -->s: <a id="CheckAll" href="#">Check All</a> | <a id="UncheckAll" href="#">Uncheck All</a> | <a id="SwapAll" href="#">Toggle All</a></fieldset>
|
||||
<h1>Library <!-- TMPL_VAR NAME="branchcode" --> - <!-- TMPL_VAR NAME="branchname" --> Checkin and Transfer Policy</h1>
|
||||
<form method="get" action="/cgi-bin/koha/admin/branch_transfer_limits.pl" id="selectlibrary">
|
||||
<label for="branchselect">Select a library :</label>
|
||||
<select name="branchcode" id="branchselect">
|
||||
<!-- TMPL_LOOP NAME="branch_loop" -->
|
||||
<option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="branchname" --></option>
|
||||
<!-- /TMPL_LOOP -->
|
||||
</select>
|
||||
<input type="submit" value="Choose" />
|
||||
</form>
|
||||
|
||||
<p class="help">Check the boxes for the libraries you accept to checkin items from.</p>
|
||||
<fieldset>For <strong>all</strong> <!--TMPL_VAR NAME="limit_phrase" -->s: <a id="CheckAll" href="#">Check All</a> | <a id="UncheckAll" href="#">Uncheck All</a></fieldset>
|
||||
|
||||
|
||||
<div id="transferlimit_tabs" class="toptabs">
|
||||
|
|
@ -80,20 +88,13 @@
|
|||
|
||||
<!-- TMPL_LOOP NAME="codes_loop" -->
|
||||
<div id="<!-- TMPL_VAR NAME="code" -->set">
|
||||
<h4>Limits for <!--TMPL_VAR NAME="limit_phrase" -->: <!-- TMPL_VAR NAME="code" --></h4>
|
||||
<p><a id="CheckAll<!-- TMPL_VAR NAME="code" -->table" class="checkall" href="#">Check All</a> | <a id="UncheckAll<!-- TMPL_VAR NAME="code" -->table" class="uncheckall" href="#">Uncheck All</a> | <a id="SwapAll<!-- TMPL_VAR NAME="code" -->table" class="swapall" href="#">Toggle All</a></p>
|
||||
<h4>Policy for <!--TMPL_VAR NAME="limit_phrase" -->: <!-- TMPL_VAR NAME="code" --></h4>
|
||||
<p><a id="CheckAll<!-- TMPL_VAR NAME="code" -->table" class="checkall" href="#">Check All</a> | <a id="UncheckAll<!-- TMPL_VAR NAME="code" -->table" class="uncheckall" href="#">Uncheck All</a></p>
|
||||
<table id="<!-- TMPL_VAR NAME="code" -->table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th> </th><th>To:</th>
|
||||
<!-- TMPL_LOOP NAME="to_branch_loop" -->
|
||||
<th><!-- TMPL_VAR NAME="toBranch" --></th>
|
||||
<!-- /TMPL_LOOP -->
|
||||
</tr>
|
||||
<tr><th colspan="2">From:</th>
|
||||
<!-- TMPL_LOOP NAME="to_branch_loop" -->
|
||||
<th><input type="checkbox" name="checkcolumn" class="checkcolumn" /></th>
|
||||
<!-- /TMPL_LOOP -->
|
||||
<th>Library</th>
|
||||
<th>Allow transfer?</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
|
|
@ -101,22 +102,8 @@
|
|||
<!-- TMPL_LOOP NAME="to_branch_loop" -->
|
||||
<!-- TMPL_UNLESS NAME="__odd__" --><tr class="highlight"><!-- TMPL_ELSE
|
||||
--><tr><!-- /TMPL_UNLESS -->
|
||||
<td><input type="checkbox" name="checkrow" id="<!-- TMPL_VAR NAME="code" --><!-- TMPL_VAR NAME="toBranch" -->row" class="checkrow" /></td>
|
||||
<td><label for="<!-- TMPL_VAR NAME="code" --><!-- TMPL_VAR NAME="toBranch" -->row"><!-- TMPL_VAR NAME="toBranch" --></label></td>
|
||||
<!-- TMPL_LOOP NAME="from_branch_loop" -->
|
||||
<td>
|
||||
<!-- TMPL_IF NAME="isChecked" -->
|
||||
<input
|
||||
name="<!-- TMPL_VAR NAME="code" -->_<!-- TMPL_VAR NAME="toBranch" -->_<!-- TMPL_VAR NAME="fromBranch" -->"
|
||||
type="checkbox" value="1" checked="checked" />
|
||||
<!-- TMPL_ELSE-->
|
||||
<input
|
||||
name="<!-- TMPL_VAR NAME="code" -->_<!-- TMPL_VAR NAME="toBranch" -->_<!-- TMPL_VAR NAME="fromBranch" -->"
|
||||
type="checkbox" value="1" />
|
||||
<!-- TMPL_ELSE-->
|
||||
<!-- /TMPL_IF -->
|
||||
</td>
|
||||
<!-- /TMPL_LOOP -->
|
||||
<td><label style="min-width:400px;" for="<!-- TMPL_VAR NAME="code" --><!-- TMPL_VAR NAME="toBranch" -->row"><!-- TMPL_VAR NAME="toBranch" --> - <!-- TMPL_VAR NAME="toBranchname" --></label></td>
|
||||
<td><input type="checkbox" id="<!-- TMPL_VAR NAME="code" --><!-- TMPL_VAR NAME="toBranch" -->row" name="<!-- TMPL_VAR NAME="code" -->_<!-- TMPL_VAR NAME="toBranch" -->" <!-- TMPL_IF NAME="isChecked" -->checked="checked" <!-- /TMPL_IF --> /></td>
|
||||
</tr>
|
||||
<!-- /TMPL_LOOP -->
|
||||
</tbody>
|
||||
|
|
@ -125,9 +112,14 @@
|
|||
<!-- /TMPL_LOOP -->
|
||||
</div>
|
||||
|
||||
<fieldset class="action"><input type="hidden" name="updateLimits" value="1" />
|
||||
<input type="submit" value="Save" /> <a class="cancel" href="/cgi-bin/koha/admin/admin-home.pl">Cancel</a></fieldset>
|
||||
<fieldset class="action">
|
||||
<input type="hidden" name="updateLimits" value="1" />
|
||||
<input type="hidden" name="branchcode" value="<!-- TMPL_VAR NAME="branchcode" -->" />
|
||||
<input type="submit" value="Save" />
|
||||
<a class="cancel" href="/cgi-bin/koha/admin/admin-home.pl">Cancel</a>
|
||||
</fieldset>
|
||||
</form>
|
||||
<!-- /TMPL_UNLESS --> <!-- /defined homebranch -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="yui-b">
|
||||
|
|
|
|||
Loading…
Reference in New Issue