diff --git a/bull/claims.pl b/bull/claims.pl
new file mode 100755
index 0000000000..c771b2114f
--- /dev/null
+++ b/bull/claims.pl
@@ -0,0 +1,84 @@
+#!/usr/bin/perl
+
+use strict;
+use CGI;
+use C4::Auth;
+use C4::Bull;
+use C4::Acquisition;
+use C4::Output;
+use C4::Interface::CGI::Output;
+use C4::Context;
+use HTML::Template;
+use Data::Dumper;
+
+my $query = new CGI;
+
+my $serialid = $query->param('serialid');
+my $op = $query->param('op');
+my $claimletter = $query->param('claimletter');
+my $supplierid = $query->param('supplierid');
+my %supplierlist = getSupplierListWithLateIssues;
+my @select_supplier;
+
+foreach my $supplierid (keys %supplierlist){
+ my ($count, @dummy) = GetMissingIssues($supplierid);
+ my $counting = $count;
+ $supplierlist{$supplierid} = $supplierlist{$supplierid}." ($counting)";
+ push @select_supplier, $supplierid
+}
+
+my @select_letter = (1,2,3,4);
+my %letters = (1=>'Claim Form 1',2=>'Claim Form 2',3=>'Claim Form 3',4=>'Claim Form 4');
+my ($count2, @missingissues) = GetMissingIssues($supplierid,$serialid);
+
+my $CGIsupplier=CGI::scrolling_list( -name => 'supplierid',
+ -values => \@select_supplier,
+ -default => $supplierid,
+ -labels => \%supplierlist,
+ -size => 1,
+ -multiple => 0 );
+
+my $CGIletter=CGI::scrolling_list( -name => 'claimletter',
+ -values => \@select_letter,
+ -default => $claimletter,
+ -labels => \%letters,
+ -size => 1,
+ -multiple => 0 );
+my ($singlesupplier,@supplierinfo);
+if($supplierid){
+ ($singlesupplier,@supplierinfo)=bookseller($supplierid);
+} else { # set up supplierid for the claim links out of main table if all suppliers is chosen
+ for(my $i=0; $i<@missingissues;$i++){
+ $missingissues[$i]->{'supplierid'} = getsupplierbyserialid($missingissues[$i]->{'serialid'});
+ }
+}
+ warn Dumper(\@missingissues);
+
+my $preview=0;
+if($op eq 'preview'){
+ $preview = 1;
+}
+
+my ($template, $loggedinuser, $cookie)
+= get_template_and_user({template_name => "bull/claims.tmpl",
+ query => $query,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => {catalogue => 1},
+ debug => 1,
+ });
+
+$template->param(
+ CGIsupplier => $CGIsupplier,
+ CGIletter => $CGIletter,
+ preview => $preview,
+ missingissues => \@missingissues,
+ supplierid => $supplierid,
+ claimletter => $claimletter,
+ singlesupplier => $singlesupplier,
+ supplierloop => \@supplierinfo,
+ intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
+ intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+ IntranetNav => C4::Context->preference("IntranetNav"),
+ );
+output_html_with_http_headers $query, $cookie, $template->output;
diff --git a/bull/lateissues-excel.pl b/bull/lateissues-excel.pl
new file mode 100755
index 0000000000..15dd669dc5
--- /dev/null
+++ b/bull/lateissues-excel.pl
@@ -0,0 +1,121 @@
+#!/usr/bin/perl
+
+use strict;
+use CGI;
+use C4::Auth;
+use C4::Bull;
+use C4::Acquisition;
+use C4::Output;
+use C4::Interface::CGI::Output;
+use C4::Context;
+use HTML::Template;
+# use Date::Manip;
+use Text::CSV_XS;
+use Data::Dumper;
+
+# &Date_Init("DateFormat=non-US"); # set non-USA date, eg:19/08/2005
+
+
+my $csv = Text::CSV_XS->new(
+ {
+ 'quote_char' => '"',
+ 'escape_char' => '"',
+ 'sep_char' => ',',
+ 'binary' => 1
+ }
+ );
+
+
+my $query = new CGI;
+my $supplierid = $query->param('supplierid');
+my @serialid = $query->param('serialid');
+my $op = $query->param('op');
+my $serialidcount = @serialid;
+warn "Chosen: ".Dumper(\@serialid);
+my %supplierlist = getSupplierListWithLateIssues;
+my @select_supplier;
+
+my @loop1;
+my ($count, @lateissues);
+if($op ne 'claims'){
+ ($count, @lateissues) = GetLateIssues($supplierid);
+ for (my $i=0;$i<@lateissues;$i++){
+ my @rows1 = ($lateissues[$i]->{'name'}, # lets build up a row
+ $lateissues[$i]->{'title'},
+ $lateissues[$i]->{'serialseq'},
+ $lateissues[$i]->{'planneddate'},
+ );
+ push (@loop1, \@rows1);
+ }
+}
+my $totalcount2 = 0;
+my @loop2;
+my ($count2, @missingissues);
+for (my $k=0;$k<@serialid;$k++){
+ ($count2, @missingissues) = GetMissingIssues($supplierid, $serialid[$k]);
+
+ for (my $j=0;$j<@missingissues;$j++){
+ my @rows2 = ($missingissues[$j]->{'name'}, # lets build up a row
+ $missingissues[$j]->{'title'},
+ $missingissues[$j]->{'serialseq'},
+ $missingissues[$j]->{'planneddate'},
+ );
+ push (@loop2, \@rows2);
+ }
+ $totalcount2 = $totalcount2 + $count2;
+ # update claim date to let one know they have looked at this missing item
+ updateClaim($serialid[$k]);
+}
+
+my $heading ='';
+my $filename ='';
+if($supplierid){
+ if($missingissues[0]->{'name'}){ # if exists display supplier name in heading for neatness
+ # not necessarily needed as the name will appear in supplier column also
+ $heading = "FOR $missingissues[0]->{'name'}";
+ $filename = "_$missingissues[0]->{'name'}";
+ }
+}
+
+print $query->header(
+ -type => 'application/vnd.ms-excel',
+ -attachment => "claims".$filename.".csv",
+ );
+
+if($op ne 'claims'){
+ print "LATE ISSUES ".$heading."\n\n";
+ print "SUPPLIER,TITLE,ISSUE NUMBER,LATE SINCE\n";
+
+ for my $row ( @loop1 ) {
+
+ $csv->combine(@$row);
+ my $string = $csv->string;
+ print $string, "\n";
+ }
+
+ print ",,,,,,,\n\n";
+}
+if($serialidcount == 1){
+ print "MISSING ISSUE ".$heading."\n\n";
+} else {
+ print "MISSING ISSUES ".$heading."\n\n";
+}
+print "SUPPLIER,TITLE,ISSUE NUMBER,LATE SINCE\n";
+
+for my $row ( @loop2 ) {
+
+ $csv->combine(@$row);
+ my $string = $csv->string;
+ print $string, "\n";
+ }
+
+print ",,,,,,,\n";
+print ",,,,,,,\n";
+if($op ne 'claims'){
+ print ",,Total Number Late, $count\n";
+}
+if($serialidcount == 1){
+
+} else {
+ print ",,Total Number Missing, $totalcount2\n";
+}
diff --git a/bull/member-search.pl b/bull/member-search.pl
new file mode 100755
index 0000000000..5f6f0916f8
--- /dev/null
+++ b/bull/member-search.pl
@@ -0,0 +1,51 @@
+#!/usr/bin/perl
+
+# Member Search.pl script used to search for members to add to a routing list
+use strict;
+use CGI;
+use C4::Koha;
+use C4::Auth;
+use C4::Date;
+use C4::Output;
+use C4::Acquisition;
+use C4::Interface::CGI::Output;
+use C4::Context;
+use HTML::Template;
+use C4::Search;
+use C4::Bull;
+use Data::Dumper;
+
+my $query = new CGI;
+my $subscriptionid = $query->param('subscriptionid');
+my $op = $query->param('op');
+my $searchstring = $query->param('member');
+my $dbh = C4::Context->dbh;
+
+my $env;
+
+ my ($template, $loggedinuser, $cookie)
+= get_template_and_user({template_name => "bull/member-search.tmpl",
+ query => $query,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => {catalogue => 1},
+ debug => 1,
+ });
+
+
+if($searchstring){
+ my ($count, $members) = &BornameSearch($env, $searchstring, "surname", "advanced");
+ warn Dumper($count);
+ warn Dumper($members);
+
+ $template->param(
+ subscriptionid => $subscriptionid,
+ memberloop => $members,
+ member => $searchstring,
+ );
+} else {
+ $template->param(
+ subscriptionid => $subscriptionid,
+ );
+}
+ output_html_with_http_headers $query, $cookie, $template->output;
diff --git a/bull/reorder_members.pl b/bull/reorder_members.pl
new file mode 100755
index 0000000000..dc745a518d
--- /dev/null
+++ b/bull/reorder_members.pl
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+
+# Routing.pl script used to create a routing list for a serial subscription
+# In this instance it is in fact a setting up of a list of reserves for the item
+# where the hierarchical order can be changed on the fly and a routing list can be
+# printed out
+use strict;
+use CGI;
+use C4::Koha;
+use C4::Auth;
+use C4::Date;
+use C4::Output;
+use C4::Acquisition;
+use C4::Interface::CGI::Output;
+use C4::Context;
+use HTML::Template;
+use C4::Search;
+use C4::Bull;
+use Data::Dumper;
+
+my $query = new CGI;
+my $subscriptionid = $query->param('subscriptionid');
+my $routingid = $query->param('routingid');
+my $rank = $query->param('rank');
+
+reorder_members($subscriptionid,$routingid,$rank);
+
+print $query->redirect("/cgi-bin/koha/bull/routing.pl?subscriptionid=$subscriptionid");
+
diff --git a/bull/routing-preview.pl b/bull/routing-preview.pl
new file mode 100755
index 0000000000..e74a1f75d1
--- /dev/null
+++ b/bull/routing-preview.pl
@@ -0,0 +1,123 @@
+#!/usr/bin/perl
+
+# Routing Preview.pl script used to view a routing list after creation
+# lets one print out routing slip and create (in this instance) the heirarchy
+# of reserves for the serial
+use strict;
+use CGI;
+use C4::Koha;
+use C4::Auth;
+use C4::Date;
+use C4::Output;
+use C4::Acquisition;
+use C4::Reserves2;
+use C4::Circulation::Circ2;
+use C4::Interface::CGI::Output;
+use C4::Context;
+use HTML::Template;
+use C4::Search;
+use C4::Bull;
+use Data::Dumper;
+
+my $query = new CGI;
+my $subscriptionid = $query->param('subscriptionid');
+my $issue = $query->param('issue');
+my $routingid;
+my $ok = $query->param('ok');
+my $edit = $query->param('edit');
+my $delete = $query->param('delete');
+my $dbh = C4::Context->dbh;
+
+if($delete){
+ delroutingmember($routingid,$subscriptionid);
+ my $sth = $dbh->prepare("UPDATE serial SET routingnotes = NULL WHERE subscriptionid = ?");
+ $sth->execute($subscriptionid);
+ print $query->redirect("routing.pl?subscriptionid=$subscriptionid&op=new");
+}
+
+if($edit){
+ print $query->redirect("routing.pl?subscriptionid=$subscriptionid");
+}
+
+my ($routing, @routinglist) = getroutinglist($subscriptionid);
+my $subs = getsubscription($subscriptionid);
+my ($count,@serials) = getserials($subscriptionid);
+my ($template, $loggedinuser, $cookie);
+
+if($ok){
+ my $env;
+ # get biblio information....
+ my $biblio = $subs->{'biblionumber'};
+
+ # get existing reserves .....
+ my ($count,$reserves) = FindReserves($biblio);
+ my $totalcount = $count;
+ foreach my $res (@$reserves) {
+ if ($res->{'found'} eq 'W') {
+ $count--;
+ }
+ }
+ my ($count2,@bibitems) = bibitems($biblio);
+ my @itemresults = ItemInfo($env, $subs->{'biblionumber'}, 'intra');
+ my $branch = $itemresults[0]->{'holdingbranch'};
+ my $const = 'o';
+ my $notes;
+ my $title = $subs->{'bibliotitle'};
+ for(my $i=0;$i<$routing;$i++){
+ my $sth = $dbh->prepare("SELECT * FROM reserves WHERE biblionumber = ? AND borrowernumber = ?
+ AND cancellationdate is NULL AND (found <> 'F' or found is NULL)");
+ $sth->execute($biblio,$routinglist[$i]->{'borrowernumber'});
+ my $data = $sth->fetchrow_hashref;
+# warn Dumper($data);
+# warn "$routinglist[$i]->{'borrowernumber'} is the same as $data->{'borrowernumber'}";
+ if($routinglist[$i]->{'borrowernumber'} == $data->{'borrowernumber'}){
+ UpdateReserve($routinglist[$i]->{'ranking'},$biblio,$routinglist[$i]->{'borrowernumber'},$branch);
+ } else {
+ CreateReserve(\$env,$branch,$routinglist[$i]->{'borrowernumber'},$biblio,$const,\@bibitems,$routinglist[$i]->{'ranking'},$notes,$title);
+ }
+ }
+
+
+ ($template, $loggedinuser, $cookie)
+= get_template_and_user({template_name => "bull/routing-preview-slip.tmpl",
+ query => $query,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => {catalogue => 1},
+ debug => 1,
+ });
+} else {
+ ($template, $loggedinuser, $cookie)
+= get_template_and_user({template_name => "bull/routing-preview.tmpl",
+ query => $query,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => {catalogue => 1},
+ debug => 1,
+ });
+}
+
+# my $firstdate = "$serials[0]->{'serialseq'} ($serials[0]->{'planneddate'})";
+my @results;
+my $data;
+for(my $i=0;$i<$routing;$i++){
+ $data=borrdata('',$routinglist[$i]->{'borrowernumber'});
+ $data->{'location'}=$data->{'streetaddress'};
+ $data->{'name'}="$data->{'firstname'} $data->{'surname'}";
+ $data->{'routingid'}=$routinglist[$i]->{'routingid'};
+ $data->{'subscriptionid'}=$subscriptionid;
+ push(@results, $data);
+}
+
+my $routingnotes = $serials[0]->{'routingnotes'};
+$routingnotes =~ s/\n/\
/g;
+
+$template->param(
+ title => $subs->{'bibliotitle'},
+ issue => $issue,
+ subscriptionid => $subscriptionid,
+ memberloop => \@results,
+ routingnotes => $routingnotes,
+ );
+
+ output_html_with_http_headers $query, $cookie, $template->output;
diff --git a/bull/routing-reserves.pl b/bull/routing-reserves.pl
new file mode 100755
index 0000000000..1c07e443f7
--- /dev/null
+++ b/bull/routing-reserves.pl
@@ -0,0 +1,205 @@
+#!/usr/bin/perl
+
+# script to place the hierarchy of reserves onto serial
+
+# Copyright 2000-2002 Katipo Communications
+#
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+# Suite 330, Boston, MA 02111-1307 USA
+
+use strict;
+use C4::Search;
+use C4::Output;
+use C4::Interface::CGI::Output;
+use C4::Auth;
+use C4::Reserves2;
+use C4::Biblio;
+use C4::Koha;
+use C4::Circulation::Circ2;
+use HTML::Template;
+use C4::Acquisition;
+use CGI;
+use C4::Date;
+
+my $input = new CGI;
+
+# get biblio information....
+my $bib = $input->param('bib');
+my $dat = bibdata($bib);
+
+# get existing reserves .....
+my ($count,$reserves) = FindReserves($bib);
+my $totalcount = $count;
+foreach my $res (@$reserves) {
+ if ($res->{'found'} eq 'W') {
+ $count--;
+ }
+ }
+
+# make priorities options
+my $num = $count + 1;
+
+#priorityoptions building
+my @optionloop;
+for (my $i=1; $i<=$num; $i++){
+ my %option;
+ $option{num}=$i;
+ $option{selected}=($i==$num);
+ push(@optionloop, \%option);
+ }
+
+# todays date
+my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =localtime(time);
+$year=$year+1900;
+$mon++;
+my $date=format_date("$year-$mon-$mday");
+
+
+# get biblioitem information and build rows for form
+my ($count2,@data) = bibitems($bib);
+
+my @bibitemloop;
+foreach my $dat (sort {$b->{'dateaccessioned'} cmp $a->{'dateaccessioned'}} @data) {
+ $dat->{'dewey'}="" if ($dat->{'dewey'} == 0);
+ $dat->{'volumeddesc'} = " " unless $dat->{'volumeddesc'};
+ $dat->{'dewey'}=~ s/\.0000$//;
+ $dat->{'dewey'}=~ s/00$//;
+
+ my %abibitem;
+ my @barcodeloop;
+ my @barcodes = barcodes($dat->{'biblioitemnumber'});
+ foreach my $num (@barcodes) {
+ my %barcode;
+ $barcode{'barcode'}=$num->{'barcode'};
+ $barcode{'message'}=$num->{'itemlost'} == 1 ? "(lost)" :
+ $num->{'itemlost'} == 2 ? "(long overdue)" : "";
+ push(@barcodeloop, \%barcode);
+ }
+ $abibitem{'barcodeloop'}=\@barcodeloop;
+ $abibitem{'class'}="$dat->{'classification'}$dat->{'dewey'}$dat->{'subclass'}";
+ my $select;
+ $abibitem{'itemlost'}=(($dat->{'notforloan'})|| ($dat->{'itemlost'} == 1)) ;
+ $abibitem{'biblioitemnumber'}=$dat->{'biblioitemnumber'};
+ $abibitem{'description'}=$dat->{'description'};
+ $abibitem{'volumeddesc'}=$dat->{'volumeddesc'};
+ $abibitem{'publicationyear'}=$dat->{'publicationyear'};
+ push(@bibitemloop,\%abibitem);
+ }
+
+
+
+#existingreserves building
+my @reserveloop;
+my $branches = getbranches('IS');
+foreach my $res (sort {$a->{'found'} cmp $b->{'found'}} @$reserves){
+ my %reserve;
+ # my $prioropt = priorityoptions($totalcount, $res->{'priority'});
+ my @optionloop;
+ for (my $i=1; $i<=$totalcount; $i++){
+ my %option;
+ $option{num}=$i;
+ $option{selected}=($i==$res->{'priority'});
+ push(@optionloop, \%option);
+ }
+ my @branchloop;
+ foreach my $br (keys %$branches) {
+ # (next) unless $branches->{$br}->{'IS'};
+ # Only branches with the 'IS' branchrelation
+ # can issue books
+ my %abranch;
+ $abranch{'selected'}=($br eq $res->{'branchcode'});
+ $abranch{'branch'}=$br;
+ $abranch{'branchname'}=$branches->{$br}->{'branchname'};
+ push(@branchloop,\%abranch);
+ }
+
+ if ($res->{'found'} eq 'W') {
+ my %env;
+ my $item = $res->{'itemnumber'};
+ $item = getiteminformation(\%env,$item);
+ $reserve{'holdingbranch'}=$item->{'holdingbranch'};
+ $reserve{'barcode'}=$item->{'barcode'};
+ $reserve{'biblionumber'}=$item->{'biblionumber'};
+ $reserve{'wbrcode'} = $res->{'branchcode'};
+ $reserve{'wbrname'} = $branches->{$res->{'branchcode'}}->{'branchname'};
+ if($reserve{'holdingbranch'} eq $reserve{'wbrcode'}){
+ $reserve{'atdestination'} = 1;
+ }
+ }
+
+ $reserve{'date'} = format_date($res->{'reservedate'});
+ $reserve{'borrowernumber'}=$res->{'borrowernumber'};
+ $reserve{'biblionumber'}=$res->{'biblionumber'};
+ $reserve{'bornum'}=$res->{'borrowernumber'};
+ $reserve{'firstname'}=$res->{'firstname'};
+ $reserve{'surname'}=$res->{'surname'};
+ $reserve{'bornum'}=$res->{'borrowernumber'};
+ $reserve{'notes'}=$res->{'reservenotes'};
+ $reserve{'wait'}=($res->{'found'} eq 'W');
+ $reserve{'constrainttypea'}=($res->{'constrainttype'} eq 'a');
+ $reserve{'constrainttypeo'}=($res->{'constrainttype'} eq 'o');
+ $reserve{'voldesc'}=$res->{'volumeddesc'};
+ $reserve{'itemtype'}=$res->{'itemtype'};
+ $reserve{'branchloop'}=\@branchloop;
+ $reserve{'optionloop'}=\@optionloop;
+ push(@reserveloop,\%reserve);
+ }
+
+my @branches;
+# re-uses getbranches('IS') from above (approx line 110)
+ foreach my $br (keys %$branches) {
+ my %abranch;
+ $abranch{'branch'}=$br;
+ $abranch{'branchname'}=$branches->{$br}->{'branchname'};
+ push(@branches,\%abranch);
+ }
+# my @select_branch;
+# my %select_branches;
+# my ($count2,@branches)=branches();
+# for (my $i=0;$i<$count2;$i++){
+#push @select_branch, $branches[$i]->{'branchcode'};#
+#$select_branches{$branches[$i]->{'branchcode'}} = $branches[$i]->{'branchname'};
+# }
+# my $CGIbranch=CGI::scrolling_list( -name => 'pickup',
+#-values => \@select_branch,
+#-labels => \%select_branches,
+#-size => 1,
+#-multiple => 0 );
+
+#get the time for the form name...
+my $time = time();
+
+#setup colours
+my ($template, $borrowernumber, $cookie)
+ = get_template_and_user({template_name => "request.tmpl",
+ query => $input,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => {parameters => 1},
+ });
+$template->param(optionloop =>\@optionloop,
+ #CGIbranch => $CGIbranch,
+ branches => \@branches,
+ reserveloop => \@reserveloop,
+ 'time' => $time,
+ bibitemloop => \@bibitemloop,
+ date => $date,
+ bib => $bib,
+ title =>$dat->{title});
+# printout the page
+print $input->header(
+ -type => C4::Interface::CGI::Output::guesstype($template->output),
+ -expires=>'now'
+ ), $template->output;
diff --git a/bull/routing.pl b/bull/routing.pl
new file mode 100755
index 0000000000..abfd03ea68
--- /dev/null
+++ b/bull/routing.pl
@@ -0,0 +1,129 @@
+#!/usr/bin/perl
+
+# Routing.pl script used to create a routing list for a serial subscription
+# In this instance it is in fact a setting up of a list of reserves for the item
+# where the hierarchical order can be changed on the fly and a routing list can be
+# printed out
+use strict;
+use CGI;
+use C4::Koha;
+use C4::Auth;
+use C4::Date;
+use C4::Output;
+use C4::Acquisition;
+use C4::Interface::CGI::Output;
+use C4::Context;
+use HTML::Template;
+use C4::Search;
+use C4::Bull;
+use Data::Dumper;
+
+my $query = new CGI;
+my $subscriptionid = $query->param('subscriptionid');
+my $serialseq = $query->param('serialseq');
+my $routingid = $query->param('routingid');
+my $bornum = $query->param('bornum');
+my $notes = $query->param('notes');
+my $op = $query->param('op');
+my $date_selected = $query->param('date_selected');
+my $dbh = C4::Context->dbh;
+
+if($op eq 'delete'){
+ delroutingmember($routingid,$subscriptionid);
+}
+
+if($op eq 'add'){
+ addroutingmember($bornum,$subscriptionid);
+}
+if($op eq 'save'){
+ my $sth = $dbh->prepare("UPDATE serial SET routingnotes = ? WHERE subscriptionid = ?");
+ $sth->execute($notes,$subscriptionid);
+ print $query->redirect("routing-preview.pl?subscriptionid=$subscriptionid&issue=$date_selected");
+}
+
+my ($routing, @routinglist) = getroutinglist($subscriptionid);
+my $subs = getsubscription($subscriptionid);
+my ($count,@serials) = old_getserials($subscriptionid);
+my ($serialdates) = getlatestserials($subscriptionid,$count);
+
+use Data::Dumper;
+warn "count $count";
+warn Dumper($serialdates);
+my @dates;
+my $i=0;
+foreach my $dateseq (@$serialdates) {
+ $dates[$i]->{'planneddate'} = $dateseq->{'planneddate'};
+ $dates[$i]->{'serialseq'} = $dateseq->{'serialseq'};
+ $dates[$i]->{'serialid'} = $dateseq->{'serialid'};
+ if($date_selected eq $dateseq->{'serialid'}){
+ $dates[$i]->{'selected'} = ' selected';
+ } else {
+ $dates[$i]->{'selected'} = '';
+ }
+ $i++;
+}
+warn Dumper(@dates);
+
+my ($template, $loggedinuser, $cookie)
+= get_template_and_user({template_name => "bull/routing.tmpl",
+ query => $query,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => {catalogue => 1},
+ debug => 1,
+ });
+# my $date;
+# if($serialseq){
+# for(my $i = 0;$i<@serials; $i++){
+# if($serials[$i]->{'serialseq'} eq $serialseq){
+# $date = $serials[$i]->{'planneddate'}
+# }
+# }
+# } else {
+# $serialseq = $serials[0]->{'serialseq'};
+# $date = $serials[0]->{'planneddate'};
+# }
+
+# my $issue = "$serialseq ($date)";
+
+my @results;
+my $data;
+for(my $i=0;$i<$routing;$i++){
+ $data=borrdata('',$routinglist[$i]->{'borrowernumber'});
+ $data->{'location'}=$data->{'streetaddress'};
+ $data->{'name'}="$data->{'firstname'} $data->{'surname'}";
+ $data->{'routingid'}=$routinglist[$i]->{'routingid'};
+ $data->{'subscriptionid'}=$subscriptionid;
+ my $rankingbox = '";
+ $data->{'routingbox'} = $rankingbox;
+
+ push(@results, $data);
+}
+# warn Dumper(@results);
+# for adding routing list
+my $new;
+if ($op eq 'new') {
+ $new = 1;
+} else {
+# for modify routing list default
+ $new => 0;
+}
+
+$template->param(
+ title => $subs->{'bibliotitle'},
+ subscriptionid => $subscriptionid,
+ memberloop => \@results,
+ op => $new,
+ dates => \@dates,
+ routingnotes => $serials[0]->{'routingnotes'},
+ );
+
+ output_html_with_http_headers $query, $cookie, $template->output;
diff --git a/koha-tmpl/intranet-tmpl/npl/en/bull/claims.tmpl b/koha-tmpl/intranet-tmpl/npl/en/bull/claims.tmpl
new file mode 100755
index 0000000000..c3f09199cf
--- /dev/null
+++ b/koha-tmpl/intranet-tmpl/npl/en/bull/claims.tmpl
@@ -0,0 +1,163 @@
+
+
+Koha -- Subscription Claims
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/koha-tmpl/intranet-tmpl/npl/en/bull/member-search.tmpl b/koha-tmpl/intranet-tmpl/npl/en/bull/member-search.tmpl
new file mode 100755
index 0000000000..35b7651791
--- /dev/null
+++ b/koha-tmpl/intranet-tmpl/npl/en/bull/member-search.tmpl
@@ -0,0 +1,44 @@
+
+
+
+
+
+
diff --git a/koha-tmpl/intranet-tmpl/npl/en/bull/routing-preview-slip.tmpl b/koha-tmpl/intranet-tmpl/npl/en/bull/routing-preview-slip.tmpl
new file mode 100755
index 0000000000..50fcda3ce1
--- /dev/null
+++ b/koha-tmpl/intranet-tmpl/npl/en/bull/routing-preview-slip.tmpl
@@ -0,0 +1,23 @@
+
+
+
+
+Opus International Consultants - Information Centre |
+Title:
+ |
+| Name/Location |
+ Date Due |
+
+ | |
+ |
+
+
+
Notes: Please return this journal
+promptly as others are waiting.
+
+
+
+
+
diff --git a/koha-tmpl/intranet-tmpl/npl/en/bull/routing-preview.tmpl b/koha-tmpl/intranet-tmpl/npl/en/bull/routing-preview.tmpl
new file mode 100755
index 0000000000..0062fc1b91
--- /dev/null
+++ b/koha-tmpl/intranet-tmpl/npl/en/bull/routing-preview.tmpl
@@ -0,0 +1,45 @@
+Koha -- Routing List
+
+
+
+
+
+
Preview Routing List
+
+
+
+
+
+
diff --git a/koha-tmpl/intranet-tmpl/npl/en/bull/routing.tmpl b/koha-tmpl/intranet-tmpl/npl/en/bull/routing.tmpl
new file mode 100755
index 0000000000..ad6b8584be
--- /dev/null
+++ b/koha-tmpl/intranet-tmpl/npl/en/bull/routing.tmpl
@@ -0,0 +1,76 @@
+Koha -- Routing List
+
+
+
+
+
+
+
+
+
Create Routing List
+
+
Edit Routing List
+
+
+