3 # Routing Preview.pl script used to view a routing list after creation
4 # lets one print out routing slip and create (in this instance) the heirarchy
5 # of reserves for the serial
25 my $subscriptionid = $query->param('subscriptionid');
26 my $issue = $query->param('issue');
28 my $ok = $query->param('ok');
29 my $edit = $query->param('edit');
30 my $delete = $query->param('delete');
31 my $dbh = C4
::Context
->dbh;
34 delroutingmember
($routingid,$subscriptionid);
35 my $sth = $dbh->prepare("UPDATE serial SET routingnotes = NULL WHERE subscriptionid = ?");
36 $sth->execute($subscriptionid);
37 print $query->redirect("routing.pl?subscriptionid=$subscriptionid&op=new");
41 print $query->redirect("routing.pl?subscriptionid=$subscriptionid");
44 my ($routing, @routinglist) = getroutinglist
($subscriptionid);
45 my $subs = GetSubscription
($subscriptionid);
46 my ($count,@serials) = GetSerials
($subscriptionid);
47 my ($template, $loggedinuser, $cookie);
50 # get biblio information....
51 my $biblio = $subs->{'biblionumber'};
53 if (C4
::Context
->preference('RoutingListAddReserves')){
54 # get existing reserves .....
55 my ($count,$reserves) = GetReservesFromBiblionumber
($biblio);
56 my $totalcount = $count;
57 foreach my $res (@
$reserves) {
58 if ($res->{'found'} eq 'W') {
62 my ($count2,@bibitems) = GetBiblioItemByBiblioNumber
($biblio);
63 my @itemresults = GetItemsInfo
($subs->{'biblionumber'}, 'intra');
64 my $branch = $itemresults[0]->{'holdingbranch'};
65 my $branchname = GetBranchName
($branch);
68 my $title = $subs->{'bibliotitle'};
69 for(my $i=0;$i<$routing;$i++){
70 my $sth = $dbh->prepare("SELECT * FROM reserves WHERE biblionumber = ? AND borrowernumber = ?");
71 $sth->execute($biblio,$routinglist[$i]->{'borrowernumber'});
72 my $data = $sth->fetchrow_hashref;
74 # warn "$routinglist[$i]->{'borrowernumber'} is the same as $data->{'borrowernumber'}";
75 if($routinglist[$i]->{'borrowernumber'} == $data->{'borrowernumber'}){
76 ModReserve
($routinglist[$i]->{'ranking'},$biblio,$routinglist[$i]->{'borrowernumber'},$branch);
78 AddReserve
($branch,$routinglist[$i]->{'borrowernumber'},$biblio,$const,\
@bibitems,$routinglist[$i]->{'ranking'},'',$notes,$title);
83 ($template, $loggedinuser, $cookie)
84 = get_template_and_user
({template_name
=> "serials/routing-preview-slip.tmpl",
88 flagsrequired
=> {serials
=> 1},
91 $template->param("libraryname"=>$branchname);
93 ($template, $loggedinuser, $cookie)
94 = get_template_and_user
({template_name
=> "serials/routing-preview.tmpl",
98 flagsrequired
=> {serials
=> 1},
105 for(my $i=0;$i<$routing;$i++){
106 $data=GetMember
($routinglist[$i]->{'borrowernumber'},'borrowernumber');
107 $data->{'location'}=$data->{'branchcode'};
108 $data->{'name'}="$data->{'firstname'} $data->{'surname'}";
109 $data->{'routingid'}=$routinglist[$i]->{'routingid'};
110 $data->{'subscriptionid'}=$subscriptionid;
111 push(@results, $data);
114 my $routingnotes = $serials[0]->{'routingnotes'};
115 $routingnotes =~ s/\n/\<br \/\
>/g
;
118 title
=> $subs->{'bibliotitle'},
120 issue_escaped
=> URI
::Escape
::uri_escape
($issue),
121 subscriptionid
=> $subscriptionid,
122 memberloop
=> \
@results,
123 routingnotes
=> $routingnotes,
126 output_html_with_http_headers
$query, $cookie, $template->output;