Koha/koha-tmpl/intranet-tmpl/prog/en/modules/serials/routing.tt
Colin Campbell d2c24f3bbf Bug 6790: Remove unnecessary variable from getroutinglist return
getroutinglist returns a count variable to indicate how many elements
are in the array. This is almost always a serious code smell. (We are
programming in a list manipulating language) The routine was executing
am unnecessary loop just to maintain that var.
Removed the variable from the routine and perldoc
refactored calls of the routine removed the c-style loops for
more idiomatic and maintainable for loops
renamed some opaquely named variables
removed a call to the routine where nothing was done with the data
moved some html out of the calling script and into the template

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
2012-01-23 17:59:27 +01:00

97 lines
4 KiB
Text

[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Serials &rsaquo; [% title |html %] &rsaquo; [% IF ( op ) %]Create Routing List[% ELSE %]Edit Routing List[% END %]</title>
[% INCLUDE 'doc-head-close.inc' %]
<script language="javascript" type="text/javascript">
<!--
function reorder_item(sid,rid,rank){
var mylocation = 'reorder_members.pl?subscriptionid='+sid+'&routingid='+rid+'&rank='+rank;
window.location.href=mylocation;
}
function search_member(subscriptionid){
var myurl = 'member-search.pl?subscriptionid='+subscriptionid; window.open(myurl,'FindAMember','width=550,height=480,toolbar=no,scrollbars=yes');
}
//-->
</script>
</head>
<body>
[% INCLUDE 'header.inc' %]
[% INCLUDE 'serials-search.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> &rsaquo; <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% subscriptionid %]"><i>[% title |html %]</i></a> &rsaquo; [% IF ( op ) %]Create Routing List[% ELSE %]Edit Routing List[% END %]</div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
[% IF ( op ) %]
<h1>Create Routing List for <i>[% title |html %]</i></h1>
[% ELSE %]
<h1>Edit Routing List for <i>[% title |html %]</i></h1>
[% END %]
<form method="post" action="routing.pl">
<input type="hidden" name="op" value="save" />
<input type="hidden" name="subscriptionid" value="[% subscriptionid %]" />
<fieldset class="rows">
<ol>
<li><label for="date_selected">Issue: </label>
<select name="date_selected" id="date_selected">
[% FOREACH date IN dates %]
[% IF ( date.selected ) %]<option value="[% date.serialseq %] ([% date.planneddate %])" selected="selected">[% date.serialseq %] ([% date.planneddate %])</option>[% ELSE %]<option value="[% date.serialseq %] ([% date.planneddate %])">[% date.serialseq %] ([% date.planneddate %])</option>[% END %]
[% END %]
</select> [% issue %]</li>
[% IF memberloop %]
<li><span class="label">Recipients:</span><table style="clear:none;margin:0;">
<tr><th>Name</th>
<th>Rank</th>
<th>Delete</th>
</tr>
[% USE m_loop = iterator(memberloop) %]
[% FOREACH member IN m_loop %]
<tr><td>[% member.name %]</td>
<td>
<select name="itemrank" onchange="reorder_item([%- subscriptionid -%], [%- member.routingid -%], this.option[this.selectedIndex].value)">
[% rankings = [1 .. m_loop.size] %]
[% FOREACH r IN rankings %]
[% IF r == member.ranking %]
<option selected="selected" value="[% r %]">[% r %]</option>
[% ELSE %]
<option value="[% r %]">[% r %]</option>
[% END %]
[% END %]
</select>
</td>
<td><a href="/cgi-bin/koha/serials/routing.pl?routingid=[% member.routingid %]&amp;subscriptionid=[% subscriptionid %]&amp;op=delete">Delete</a></td>
</tr>
[% END %]
</table><p style="margin-left:10em;"><a onclick="search_member([% subscriptionid %]); return false"
href="/cgi-bin/koha/serials/member-search.pl?subscriptionid=[% subscriptionid %]" class="button">Add recipients</a> &nbsp; <a
href="/cgi-bin/koha/serials/routing.pl?subscriptionid=[% subscriptionid %]&amp;op=delete" class="button">Delete All</a></p></li>
[% ELSE %]
<li><span class="label">Recipients:</span>
<a onclick="search_member([% subscriptionid %]); return false" href="/cgi-bin/koha/serials/member-search.pl?subscriptionid=[% subscriptionid %]" class="button">Add recipients</a></li>
[% END %]
<li><label for="notes">Notes:</label><textarea name="notes" id="notes" rows="3" cols="50">[% routingnotes %]</textarea></li>
</ol>
</fieldset>
<fieldset class="action"><input type="submit" name="submit" value="Save" /></fieldset>
</form>
</div>
</div>
<div class="yui-b">
[% INCLUDE 'serials-menu.inc' %]
</div>
</div>
[% INCLUDE 'intranet-bottom.inc' %]