3 # This file is part of Koha
5 # Koha is free software; you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation; either version 2 of the License, or (at your option) any later
10 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License along with
15 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
16 # Suite 330, Boston, MA 02111-1307 USA
21 script used to create a routing list for a serial subscription
22 In this instance it is in fact a setting up of a list of reserves for the item
23 where the hierarchical order can be changed on the fly and a routing list can be
42 my $subscriptionid = $query->param('subscriptionid');
43 my $serialseq = $query->param('serialseq');
44 my $routingid = $query->param('routingid');
45 my $borrowernumber = $query->param('borrowernumber');
46 my $notes = $query->param('notes');
47 my $op = $query->param('op');
48 my $date_selected = $query->param('date_selected');
49 my $dbh = C4
::Context
->dbh;
52 delroutingmember
($routingid,$subscriptionid);
56 addroutingmember
($borrowernumber,$subscriptionid);
59 my $sth = $dbh->prepare("UPDATE serial SET routingnotes = ? WHERE subscriptionid = ?");
60 $sth->execute($notes,$subscriptionid);
61 print $query->redirect("routing-preview.pl?subscriptionid=$subscriptionid&issue=$date_selected");
64 my ($routing, @routinglist) = getroutinglist
($subscriptionid);
65 my $subs = GetSubscription
($subscriptionid);
66 my ($count,@serials) = GetSerials
($subscriptionid);
67 my ($serialdates) = GetLatestSerials
($subscriptionid,$count);
71 foreach my $dateseq (@
$serialdates) {
72 $dates[$i]->{'planneddate'} = $dateseq->{'planneddate'};
73 $dates[$i]->{'serialseq'} = $dateseq->{'serialseq'};
74 $dates[$i]->{'serialid'} = $dateseq->{'serialid'};
75 if($date_selected eq $dateseq->{'serialid'}){
76 $dates[$i]->{'selected'} = ' selected';
78 $dates[$i]->{'selected'} = '';
83 my ($template, $loggedinuser, $cookie)
84 = get_template_and_user
({template_name
=> "serials/routing.tmpl",
88 flagsrequired
=> {serials
=> 1},
93 # for(my $i = 0;$i<@serials; $i++){
94 # if($serials[$i]->{'serialseq'} eq $serialseq){
95 # $date = $serials[$i]->{'planneddate'}
99 # $serialseq = $serials[0]->{'serialseq'};
100 # $date = $serials[0]->{'planneddate'};
103 # my $issue = "$serialseq ($date)";
107 for(my $i=0;$i<$routing;$i++){
108 $data=GetMember
($routinglist[$i]->{'borrowernumber'},'borrowernumber');
109 $data->{'location'}=$data->{'streetaddress'};
110 $data->{'name'}="$data->{'firstname'} $data->{'surname'}";
111 $data->{'routingid'}=$routinglist[$i]->{'routingid'};
112 $data->{'subscriptionid'}=$subscriptionid;
113 my $rankingbox = '<select name="itemrank" onchange="reorder_item('.$subscriptionid.','.$routinglist[$i]->{'routingid'}.',this.options[this.selectedIndex].value)">';
114 for(my $j=1; $j <= $routing; $j++) {
115 $rankingbox .= "<option ";
116 if($routinglist[$i]->{'ranking'} == $j){
117 $rankingbox .= " selected=\"selected\"";
119 $rankingbox .= " value=\"$j\">$j</option>";
121 $rankingbox .= "</select>";
122 $data->{'routingbox'} = $rankingbox;
124 push(@results, $data);
127 # for adding routing list
132 # for modify routing list default
137 title
=> $subs->{'bibliotitle'},
138 subscriptionid
=> $subscriptionid,
139 memberloop
=> \
@results,
142 routingnotes
=> $serials[0]->{'routingnotes'},
145 output_html_with_http_headers
$query, $cookie, $template->output;