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
44 my $subscriptionid = $query->param('subscriptionid');
45 my $serialseq = $query->param('serialseq');
46 my $routingid = $query->param('routingid');
47 my $borrowernumber = $query->param('borrowernumber');
48 my $notes = $query->param('notes');
49 my $op = $query->param('op');
50 my $date_selected = $query->param('date_selected');
51 my $dbh = C4::Context->dbh;
54 delroutingmember($routingid,$subscriptionid);
58 addroutingmember($borrowernumber,$subscriptionid);
61 my $sth = $dbh->prepare("UPDATE serial SET routingnotes = ? WHERE subscriptionid = ?");
62 $sth->execute($notes,$subscriptionid);
63 my $urldate = URI::Escape::uri_escape($date_selected);
64 print $query->redirect("routing-preview.pl?subscriptionid=$subscriptionid&issue=$urldate");
67 my ($routing, @routinglist) = getroutinglist($subscriptionid);
68 my $subs = GetSubscription($subscriptionid);
69 my ($count,@serials) = GetSerials($subscriptionid);
70 my ($serialdates) = GetLatestSerials($subscriptionid,$count);
74 foreach my $dateseq (@$serialdates) {
75 $dates[$i]->{'planneddate'} = $dateseq->{'planneddate'};
76 $dates[$i]->{'serialseq'} = $dateseq->{'serialseq'};
77 $dates[$i]->{'serialid'} = $dateseq->{'serialid'};
78 if($date_selected eq $dateseq->{'serialid'}){
79 $dates[$i]->{'selected'} = ' selected';
81 $dates[$i]->{'selected'} = '';
86 my ($template, $loggedinuser, $cookie)
87 = get_template_and_user({template_name => "serials/routing.tmpl",
91 flagsrequired => {serials => 1},
96 # for(my $i = 0;$i<@serials; $i++){
97 # if($serials[$i]->{'serialseq'} eq $serialseq){
98 # $date = $serials[$i]->{'planneddate'}
102 # $serialseq = $serials[0]->{'serialseq'};
103 # $date = $serials[0]->{'planneddate'};
106 # my $issue = "$serialseq ($date)";
110 for(my $i=0;$i<$routing;$i++){
111 $data=GetMember($routinglist[$i]->{'borrowernumber'},'borrowernumber');
112 $data->{'location'}=$data->{'branchcode'};
113 $data->{'name'}="$data->{'firstname'} $data->{'surname'}";
114 $data->{'routingid'}=$routinglist[$i]->{'routingid'};
115 $data->{'subscriptionid'}=$subscriptionid;
116 my $rankingbox = '<select name="itemrank" onchange="reorder_item('.$subscriptionid.','.$routinglist[$i]->{'routingid'}.',this.options[this.selectedIndex].value)">';
117 for(my $j=1; $j <= $routing; $j++) {
118 $rankingbox .= "<option ";
119 if($routinglist[$i]->{'ranking'} == $j){
120 $rankingbox .= " selected=\"selected\"";
122 $rankingbox .= " value=\"$j\">$j</option>";
124 $rankingbox .= "</select>";
125 $data->{'routingbox'} = $rankingbox;
127 push(@results, $data);
130 # for adding routing list
135 # for modify routing list default
140 title => $subs->{'bibliotitle'},
141 subscriptionid => $subscriptionid,
142 memberloop => \@results,
145 routingnotes => $serials[0]->{'routingnotes'},
148 output_html_with_http_headers $query, $cookie, $template->output;