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 # get existing reserves .....
54 my ($count,$reserves) = GetReservesFromBiblionumber($biblio);
55 my $totalcount = $count;
56 foreach my $res (@$reserves) {
57 if ($res->{'found'} eq 'W') {
61 my ($count2,@bibitems) = GetBiblioItemByBiblioNumber($biblio);
62 my @itemresults = GetItemsInfo($subs->{'biblionumber'}, 'intra');
63 my $branch = $itemresults[0]->{'holdingbranch'};
64 my $branchname = GetBranchName($branch);
67 my $title = $subs->{'bibliotitle'};
68 for(my $i=0;$i<$routing;$i++){
69 my $sth = $dbh->prepare("SELECT * FROM reserves WHERE biblionumber = ? AND borrowernumber = ?");
70 $sth->execute($biblio,$routinglist[$i]->{'borrowernumber'});
71 my $data = $sth->fetchrow_hashref;
73 # warn "$routinglist[$i]->{'borrowernumber'} is the same as $data->{'borrowernumber'}";
74 if($routinglist[$i]->{'borrowernumber'} == $data->{'borrowernumber'}){
75 ModReserve($routinglist[$i]->{'ranking'},$biblio,$routinglist[$i]->{'borrowernumber'},$branch);
77 AddReserve($branch,$routinglist[$i]->{'borrowernumber'},$biblio,$const,\@bibitems,$routinglist[$i]->{'ranking'},'',$notes,$title);
82 ($template, $loggedinuser, $cookie)
83 = get_template_and_user({template_name => "serials/routing-preview-slip.tmpl",
87 flagsrequired => {serials => 1},
90 $template->param("libraryname"=>$branchname);
92 ($template, $loggedinuser, $cookie)
93 = get_template_and_user({template_name => "serials/routing-preview.tmpl",
97 flagsrequired => {serials => 1},
104 for(my $i=0;$i<$routing;$i++){
105 <<<<<<< HEAD:serials/routing-preview.pl
106 $data=GetMember('borrowernumber' => $routinglist[$i]->{'borrowernumber'});
107 $data->{'location'}=$data->{'branchcode'};
109 $data=GetMember($routinglist[$i]->{'borrowernumber'},'borrowernumber');
110 >>>>>>> 704d6c9... [3.0.x](bug #3563) This replaces the library name by the branchname attached to the subscription, and hide streetaddesses in serials routing:serials/routing-preview.pl
111 $data->{'name'}="$data->{'firstname'} $data->{'surname'}";
112 $data->{'routingid'}=$routinglist[$i]->{'routingid'};
113 $data->{'subscriptionid'}=$subscriptionid;
114 push(@results, $data);
117 my $routingnotes = $serials[0]->{'routingnotes'};
118 $routingnotes =~ s/\n/\<br \/\>/g;
121 title => $subs->{'bibliotitle'},
123 issue_escaped => URI::Escape::uri_escape($issue),
124 subscriptionid => $subscriptionid,
125 memberloop => \@results,
126 routingnotes => $routingnotes,
129 output_html_with_http_headers $query, $cookie, $template->output;