@EXPORT = qw(
&NewSubscription &ModSubscription &DelSubscription &GetSubscriptions
&GetSubscription &CountSubscriptionFromBiblionumber &GetSubscriptionsFromBiblionumber
+ &SearchSubscriptions
&GetFullSubscriptionsFromBiblionumber &GetFullSubscription &ModSubscriptionHistory
&HasSubscriptionStrictlyExpired &HasSubscriptionExpired &GetExpirationDate &abouttoexpire
return @results;
}
+=head2 SearchSubscriptions
+
+@results = SearchSubscriptions($args);
+$args is a hashref. Its keys can be contained: title, issn, ean, publisher, bookseller and branchcode
+
+this function gets all subscriptions which have title like $title, ISSN like $issn, EAN like $ean, publisher like $publisher, bookseller like $bookseller AND branchcode eq $branch.
+
+return:
+a table of hashref. Each hash containt the subscription.
+
+=cut
+
+sub SearchSubscriptions {
+ my ( $args ) = @_;
+
+ my $query = qq{
+ SELECT subscription.*, subscriptionhistory.*, biblio.*, biblioitems.issn
+ FROM subscription
+ LEFT JOIN subscriptionhistory USING(subscriptionid)
+ LEFT JOIN biblio ON biblio.biblionumber = subscription.biblionumber
+ LEFT JOIN biblioitems ON biblioitems.biblionumber = subscription.biblionumber
+ LEFT JOIN aqbooksellers ON subscription.aqbooksellerid = aqbooksellers.id
+ };
+ my @where_strs;
+ my @where_args;
+ if( $args->{biblionumber} ) {
+ push @where_strs, "biblio.biblionumber = ?";
+ push @where_args, $args->{biblionumber};
+ }
+ if( $args->{title} ){
+ push @where_strs, "biblio.title LIKE ?";
+ push @where_args, "%$args->{title}%";
+ }
+ if( $args->{issn} ){
+ push @where_strs, "biblioitems.issn LIKE ?";
+ push @where_args, "%$args->{issn}%";
+ }
+ if( $args->{ean} ){
+ push @where_strs, "biblioitems.ean LIKE ?";
+ push @where_args, "%$args->{ean}%";
+ }
+ if( $args->{publisher} ){
+ push @where_strs, "biblioitems.publishercode LIKE ?";
+ push @where_args, "%$args->{publisher}%";
+ }
+ if( $args->{bookseller} ){
+ push @where_strs, "aqbooksellers.name LIKE ?";
+ push @where_args, "%$args->{bookseller}%";
+ }
+ if( $args->{branch} ){
+ push @where_strs, "subscription.branchcode = ?";
+ push @where_args, "$args->{branch}";
+ }
+
+ if(@where_strs){
+ $query .= " WHERE " . join(" AND ", @where_strs);
+ }
+
+ my $dbh = C4::Context->dbh;
+ my $sth = $dbh->prepare($query);
+ $sth->execute(@where_args);
+ my $results = $sth->fetchall_arrayref( {} );
+ $sth->finish;
+
+ return @$results;
+}
+
+
=head2 GetSerials
($totalissues,@serials) = GetSerials($subscriptionid);
[% END %]
[% IF ( EasyAnalyticalRecords ) %][% IF ( analyze ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% IF ( object ) %][% object %]&analyze=1[% ELSE %][% biblionumber %]&analyze=1[% END %]">Analytics</a></li>[% END %]
- [% IF ( subscriptionsnumber ) %]<li><a href="/cgi-bin/koha/serials/serials-home.pl?searched=1&biblionumber=[% biblionumber %]">Subscription(s)</a></li>[% END %]
+ [% IF ( subscriptionsnumber ) %]<li><a href="/cgi-bin/koha/serials/serials-search.pl?searched=1&biblionumber=[% biblionumber %]">Subscription(s)</a></li>[% END %]
</ul>
<ul>
[% IF ( issuehistoryview ) %]<li class="active">[% ELSE %]<li>[% END %]
<div class="gradient">
-<h1 id="logo"><a href="/cgi-bin/koha/mainpage.pl">[% LibraryName %]</a></h1><!-- Begin Serials Resident Search Box -->
-<div id="header_search">
- <div id="subscription_search" class="residentsearch">
+ <h1 id="logo"><a href="/cgi-bin/koha/mainpage.pl">[% LibraryName %]</a></h1><!-- Begin Serials Resident Search Box -->
+ <div id="header_search">
+ <div id="subscription_search" class="residentsearch">
<p class="tip">Search subscriptions:</p>
- <form action="/cgi-bin/koha/serials/serials-home.pl" method="get">
- [% IF ( routing ) %]<input type="hidden" name="routing" value="[% routing %]" />[% END %]
- <input type="hidden" name="searched" value="1" />
- <label for="ISSN_filter">ISSN:</label> <input type="text" size="10" maxlength="11" name="ISSN_filter" id="ISSN_filter" value="[% ISSN_filter %]" />
+ <form action="/cgi-bin/koha/serials/serials-search.pl" method="get">
+ [% IF ( routing ) %]
+ <input type="hidden" name="routing" value="[% routing %]" />
+ [% END %]
+ <input type="hidden" name="searched" value="1" />
+ <label for="ISSN_filter">ISSN:</label> <input type="text" size="10" maxlength="11" name="ISSN_filter" id="ISSN_filter" value="[% ISSN_filter %]" />
- [% IF (UNIMARC) %]
- <label for="EAN_filter">EAN:</label> <input type="text" size="20" maxlength="40" name="EAN_filter" id="EAN_filter" value="[% EAN_filter %]" />
- [% END %]
- <label for="title_filter">Title:</label> <input type="text" size="20" maxlength="40" name="title_filter" id="title_filter" value="[% title_filter %]" />
- <input type="submit" value="Search" class="submit" />
- </form>
- </div>
+ [% IF (UNIMARC) %]
+ <label for="EAN_filter">EAN:</label> <input type="text" size="20" maxlength="40" name="EAN_filter" id="EAN_filter" value="[% EAN_filter %]" />
+ [% END %]
+ <label for="title_filter">Title:</label> <input type="text" size="20" maxlength="40" name="title_filter" id="title_filter" value="[% title_filter %]" />
+ <input value="Submit" class="submit" type="submit" /> <a href="/cgi-bin/koha/serials/serials-search.pl">Advanced search</a>
+ </form>
+ </div>
[% INCLUDE 'patron-search-box.inc' %]
- [% IF ( CAN_user_catalogue ) %]
- <div id="catalog_search" class="residentsearch">
- <p class="tip">Enter search keywords:</p>
- <form action="/cgi-bin/koha/catalogue/search.pl" method="get" id="cat-search-block">
- <input type="text" name="q" id="search-form" size="40" value="" title="Enter the terms you wish to search for." class="form-text" />
- <input type="submit" value="Submit" class="submit" />
- </form>
- </div>
- [% END %]
- <ul>
- <li><a href="#subscription_search">Search subscriptions</a></li>
- [% IF ( CAN_user_circulate ) %]<li><a href="#circ_search">Check out</a></li>[% END %]
- [% IF ( CAN_user_catalogue ) %]<li><a href="#catalog_search">Search the catalog</a></li>[% END %]
- </ul>
-</div><!-- /header_search -->
+ [% IF ( CAN_user_catalogue ) %]
+ <div id="catalog_search" class="residentsearch">
+ <p class="tip">Enter search keywords:</p>
+ <form action="/cgi-bin/koha/catalogue/search.pl" method="get" id="cat-search-block">
+ <input type="text" name="q" id="search-form" size="40" value="" title="Enter the terms you wish to search for." class="form-text" />
+ <input type="submit" value="Submit" class="submit" />
+ </form>
+ </div>
+ [% END %]
+ <ul>
+ <li><a href="#subscription_search">Search subscriptions</a></li>
+ [% IF ( CAN_user_circulate ) %]<li><a href="#circ_search">Check out</a></li>[% END %]
+ [% IF ( CAN_user_catalogue ) %]<li><a href="#catalog_search">Search the catalog</a></li>[% END %]
+ </ul>
+ </div><!-- /header_search -->
</div><!-- /gradient -->
<!-- End Serials Resident Search Box -->
<h1>Subscription information for <i>[% bibliotitle %]</i></h1>
<div id="action">
- <a href="/cgi-bin/koha/serials/serials-home.pl?biblionumber=[% biblionumber %]">Subscriptions</a>
+ <a href="/cgi-bin/koha/serials/serials-search.pl?biblionumber=[% biblionumber %]">Subscriptions</a>
<a href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=[% biblionumber %]">Back to biblio</a>
<a href="/cgi-bin/koha/serials/serial-issues.pl?biblionumber=[% biblionumber %]&selectview=full">Complete view</a>
</div>
[% INCLUDE 'doc-head-open.inc' %]
[% USE KohaDates %]
<title>Koha › Serials [% biblionumber %]</title>
-<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
[% INCLUDE 'doc-head-close.inc' %]
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
-[% INCLUDE 'datatables-strings.inc' %]
-<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
-<script type="text/javascript">
-//<![CDATA[
- $(document).ready(function() {
- var srlt = $("#srlt").dataTable($.extend(true, {}, dataTablesDefaults, {
- "aoColumnDefs": [
- { "aTargets": [ -1, -2, -3 ], "bSortable": false, "bSearchable": false },
- ],
- "sPaginationType": "four_button"
- } ) );
-
- srlt.fnAddFilters("filter", 750);
- });
- //]]>
-</script>
</head>
<body id="ser_serials-home" class="ser">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'serials-search.inc' %]
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › [% IF ( done_searched ) %]<a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> › Search results[% ELSE %]Serials [% END %] </div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › Serials </div>
<div id="doc3" class="yui-t2">
-
- <div id="bd">
- <div id="yui-main">
- <div class="yui-b">
- [% INCLUDE 'serials-toolbar.inc' %]
-
-[% IF ( information ) %]
-Serials updated :
-<table>
- <tr>
- <th>
- Serialseq
- </th>
- <th>
- Status
- </th>
- <th>
- Published date
- </th>
- <th>
- Planned date
- </th>
- <th>
- Notes
- </th>
- </tr>
-[% FOREACH informatio IN information %]
- <tr>
- <td>
- [% informatio.serialseq %]
- </td>
- <td>
- [% informatio.status %]
- </td>
- <td>
- [% informatio.publisheddate %]
- </td>
- <td>
- [% informatio.planneddate %]
- </td>
- <td>
- [% informatio.notes %]
- </td>
- </tr>
-[% END %]
-</table>
-[% END %]
- [% IF ( done_searched ) %]
-<h2>Serials subscriptions</h2>
-
- <table id="srlt">
- <thead>
- <tr>
- <th>ISSN</th>
- <th>Title</th>
- <th> Notes </th>
- <th>Library</th>
- <th>Call number</th>
- <th>Expiration date</th>
- [% IF ( routing && CAN_user_serials_routing ) %]
- <th>Routing list</th>
- [% END %]
- <th> </th>
- <th> </th>
- </tr>
- </thead>
- <tfoot>
- <tr>
- <td><input type="text" class="filter" data-column_num="0" placeholder="Search ISSN" /></td>
- <td><input type="text" class="filter" data-column_num="1" placeholder="Search title" /></td>
- <td><input type="text" class="filter" data-column_num="2" placeholder="Search notes" /></td>
- <td><input type="text" class="filter" data-column_num="3" placeholder="Search library" /></td>
- <td><input type="text" class="filter" data-column_num="4" placeholder="Search callnumber" /></td>
- <td><input type="text" class="filter" data-column_num="5" placeholder="Search expiration date" /></td>
- [% IF ( routing && CAN_user_serials_routing ) %]<td></td>[% END %]
- <td></td>
- <td></td>
- </tr>
- </tfoot>
- <tbody>
- [% FOREACH subscription IN subscriptions %]
- <tr>
- <td>
- [% IF ( subscription.issn ) %][% subscription.issn %]
- [% END %]
- </td>
- <td><a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% subscription.subscriptionid %]" class="button" title="subscription detail">[% subscription.title |html %]</a>
- </td>
- <td>[% IF ( subscription.notes ) %][% subscription.notes %][% END %]
- [% IF ( subscription.internalnotes ) %]([% subscription.internalnotes %])[% END %]
- </td>
- <td>
- [% IF ( subscription.branchname ) %][% subscription.branchname %][% END %]
- </td>
- <td>
- [% IF ( subscription.callnumber ) %][% subscription.callnumber %][% END %]
- </td>
- <td>
- [% IF ( subscription.enddate ) %][% subscription.enddate | $KohaDates %][% END %]
- </td>
- [% IF ( routing && CAN_user_serials_routing ) %]
- <td>
- [% IF ( subscription.cannotedit ) %]
-
- [% ELSE %]
- [% IF ( subscription.routingedit ) %]
- <a href="/cgi-bin/koha/serials/routing.pl?subscriptionid=[% subscription.subscriptionid %]">Edit</a>
- ([% subscription.routingedit %])
- [% ELSE %]
- <a href="/cgi-bin/koha/serials/routing.pl?subscriptionid=[% subscription.subscriptionid %]&op=new">New</a>
- [% END %]
- [% END %]
- </td>
- [% END %]
- <td><a href="/cgi-bin/koha/serials/serials-collection.pl?subscriptionid=[% subscription.subscriptionid %]">Issue history</a>
- </td>
- <td>
- [% IF ( subscription.cannotedit ) %]
-
- [% ELSE %]
- [% IF ( CAN_user_serials_receive_serials ) %]<a href="/cgi-bin/koha/serials/serials-edit.pl?subscriptionid=[% subscription.subscriptionid %]&serstatus=1,3,7">Serial receive</a>[% END %]
- [% END %]
- </td>
- </tr>
- [% END %]
- </tbody>
- </table>
-
- [% END %]
-
-</div>
-</div>
-
-<div class="yui-b">
-[% INCLUDE 'serials-menu.inc' %]
-</div>
+<div id="bd">
+ <div id="yui-main">
+ <div class="yui-b">
+ [% INCLUDE 'serials-toolbar.inc' %]
+ </div>
+ </div>
+ <div class="yui-b">
+ [% INCLUDE 'serials-menu.inc' %]
+ </div>
</div>
[% INCLUDE 'intranet-bottom.inc' %]
--- /dev/null
+[% INCLUDE 'doc-head-open.inc' %]
+[% USE KohaDates %]
+<title>Koha › Serials [% biblionumber %]</title>
+<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
+[% INCLUDE 'doc-head-close.inc' %]
+<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
+[% INCLUDE 'datatables-strings.inc' %]
+<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
+<script type="text/javascript">
+//<![CDATA[
+ $(document).ready(function() {
+ var srlt = $("#srlt").dataTable($.extend(true, {}, dataTablesDefaults, {
+ "aoColumnDefs": [
+ { "aTargets": [ -1, -2, -3 ], "bSortable": false, "bSearchable": false },
+ ],
+ "sPaginationType": "four_button"
+ } ) );
+
+ srlt.fnAddFilters("filter", 750);
+ });
+ //]]>
+</script>
+</head>
+<body id="ser_serials-home" class="ser">
+[% INCLUDE 'header.inc' %]
+[% INCLUDE 'serials-search.inc' %]
+
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › [% IF ( done_searched ) %]<a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> › Search results[% ELSE %]Serials [% END %] </div>
+
+<div id="doc3" class="yui-t2">
+ <div id="bd">
+ <div id="yui-main">
+ <div class="yui-b">
+ [% INCLUDE 'serials-toolbar.inc' %]
+
+ <h2>Serials subscriptions</h2>
+
+ <div id="advsearch">
+ <form action="/cgi-bin/koha/serials/serials-search.pl" method="get">
+ <fieldset class="brief">
+ [% IF ( done_searched ) %]
+ <div onclick="$('#advsearch_form').slideToggle(400);" style="width:100%;">
+ <a id="unfold_advsearch" style="cursor:pointer">Advanced search</a>
+ </div>
+ <div id="advsearch_form" style="display:none">
+ [% ELSE %]
+ <div>
+ [% END %]
+ <ol>
+ <li>
+ <label for="issn">ISSN:</label>
+ <input type="text" id="issn" name="ISSN_filter" value="[% ISSN_filter %]" />
+ </li>
+ <li>
+ <label for="title">Title:</label>
+ <input type="text" id="title" name="title_filter" value="[% title_filter %]" />
+ </li>
+ <li>
+ <label for="ean">EAN:</label>
+ <input type="text" id="ean" name="EAN_filter" value="[% EAN_filter %]" />
+ </li>
+ <li>
+ <label for="publisher">Publisher:</label>
+ <input type="text" id="publisher" name="publisher_filter" value="[% publisher_filter %]" />
+ </li>
+ <li>
+ <label for="bookseller">Bookseller:</label>
+ <input type="text" id="bookseller" name="bookseller_filter" value="[% bookseller_filter %]" />
+ </li>
+ <li>
+ <label for="branch">Branch:</label>
+ <select id="branch" name="branch_filter">
+ <option value="">All</option>
+ [% FOREACH branch IN branches_loop %]
+ [% IF ( branch.selected ) %]
+ <option selected="selected" value="[% branch.branchcode %]">[% branch.branchname %]</option>
+ [% ELSE %]
+ <option value="[% branch.branchcode %]">[% branch.branchname %]</option>
+ [% END %]
+ [% END %]
+ </select>
+ </li>
+ </ol>
+ <input type="hidden" name="searched" value="1" />
+ <fieldset class="action">
+ <input type="submit" value="Search" />
+ </fieldset>
+ </div>
+ </fieldset>
+ </form>
+ </div>
+
+ [% IF ( done_searched ) %]
+ [% IF ( subscriptions ) %]
+ <table id="srlt">
+ <thead>
+ <tr>
+ <th>ISSN</th>
+ <th>Title</th>
+ <th> Notes </th>
+ <th>Library</th>
+ <th>Call number</th>
+ <th>Expiration date</th>
+ [% IF ( routing && CAN_user_serials_routing ) %]
+ <th>Routing list</th>
+ [% END %]
+ <th> </th>
+ <th> </th>
+ </tr>
+ </thead>
+ <tfoot>
+ <tr>
+ <td><input type="text" class="filter" data-column_num="0" placeholder="Search ISSN" /></td>
+ <td><input type="text" class="filter" data-column_num="1" placeholder="Search title" /></td>
+ <td><input type="text" class="filter" data-column_num="2" placeholder="Search notes" /></td>
+ <td><input type="text" class="filter" data-column_num="3" placeholder="Search library" /></td>
+ <td><input type="text" class="filter" data-column_num="4" placeholder="Search callnumber" /></td>
+ <td><input type="text" class="filter" data-column_num="5" placeholder="Search expiration date" /></td>
+ [% IF ( routing && CAN_user_serials_routing ) %]<td></td>[% END %]
+ <td></td>
+ <td></td>
+ </tr>
+ </tfoot>
+ <tbody>
+ [% FOREACH subscription IN subscriptions %]
+ <tr>
+ <td>
+ [% IF ( subscription.issn ) %][% subscription.issn %]
+ [% END %]
+ </td>
+ <td><a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% subscription.subscriptionid %]" class="button" title="subscription detail">[% subscription.title |html %]</a>
+ </td>
+ <td>[% IF ( subscription.notes ) %][% subscription.notes %][% END %]
+ [% IF ( subscription.internalnotes ) %]([% subscription.internalnotes %])[% END %]
+ </td>
+ <td>
+ [% IF ( subscription.branchname ) %][% subscription.branchname %][% END %]
+ </td>
+ <td>
+ [% IF ( subscription.callnumber ) %][% subscription.callnumber %][% END %]
+ </td>
+ <td>
+ [% IF ( subscription.enddate ) %][% subscription.enddate | $KohaDates %][% END %]
+ </td>
+ [% IF ( routing && CAN_user_serials_routing ) %]
+ <td>
+ [% IF ( subscription.cannotedit ) %]
+
+ [% ELSE %]
+ [% IF ( subscription.routingedit ) %]
+ <a href="/cgi-bin/koha/serials/routing.pl?subscriptionid=[% subscription.subscriptionid %]">Edit</a>
+ ([% subscription.routingedit %])
+ [% ELSE %]
+ <a href="/cgi-bin/koha/serials/routing.pl?subscriptionid=[% subscription.subscriptionid %]&op=new">New</a>
+ [% END %]
+ [% END %]
+ </td>
+ [% END %]
+ <td><a href="/cgi-bin/koha/serials/serials-collection.pl?subscriptionid=[% subscription.subscriptionid %]">Issue history</a>
+ </td>
+ <td>
+ [% IF ( subscription.cannotedit ) %]
+
+ [% ELSE %]
+ [% IF ( CAN_user_serials_receive_serials ) %]<a href="/cgi-bin/koha/serials/serials-edit.pl?subscriptionid=[% subscription.subscriptionid %]&serstatus=1,3,7">Serial receive</a>[% END %]
+ [% END %]
+ </td>
+ </tr>
+ [% END %]
+ </tbody>
+ </table>
+ [% ELSE %]
+ There is no subscription for your search.
+ [% END %]
+ [% END %]
+ </div>
+ </div>
+
+ <div class="yui-b">
+ [% INCLUDE 'serials-menu.inc' %]
+ </div>
+</div>
+[% INCLUDE 'intranet-bottom.inc' %]
this script is the main page for serials/
-=head1 PARAMETERS
-
-=over 4
-
-=item title
-
-=item ISSN
-
-=item biblionumber
-
-=back
-
=cut
-use strict;
-use warnings;
+use Modern::Perl;
use CGI;
use C4::Auth;
-use C4::Serials;
-use C4::Output;
-use C4::Context;
use C4::Branch;
+use C4::Context;
+use C4::Output;
+use C4::Serials;
-my $query = new CGI;
-my $title = $query->param('title_filter');
-my $ISSN = $query->param('ISSN_filter');
-my $EAN = $query->param('EAN_filter');
-my $routing = $query->param('routing') || C4::Context->preference("RoutingSerials");
-my $searched = $query->param('searched');
-my $biblionumber = $query->param('biblionumber');
-
-my @serialseqs = $query->param('serialseq');
-my @planneddates = $query->param('planneddate');
-my @publisheddates = $query->param('publisheddate');
-my @status = $query->param('status');
-my @notes = $query->param('notes');
+my $query = new CGI;
+my $routing = $query->param('routing') || C4::Context->preference("RoutingSerials");
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
}
);
-if (@serialseqs){
- my @information;
- my $index;
- foreach my $seq (@serialseqs){
- if ($seq){
- ### FIXME This limitation that a serial must be given a title may not be very efficient for some library who do not update serials titles.
- push @information,
- { serialseq=>$seq,
- publisheddate=>$publisheddates[$index],
- planneddate=>$planneddates[$index],
- notes=>$notes[$index],
- status=>$status[$index]
- }
- }
- $index++;
- }
- $template->param('information'=>\@information);
-}
-my @subscriptions;
-if ($searched) {
- @subscriptions = GetSubscriptions( $title, $ISSN, $EAN, $biblionumber );
-}
-
-# to toggle between create or edit routing list options
-if ($routing) {
- for my $subscription ( @subscriptions) {
- $subscription->{routingedit} = check_routing( $subscription->{subscriptionid} );
- $subscription->{branchname} = GetBranchName ( $subscription->{branchcode} );
- }
-}
-
$template->param(
- subscriptions => \@subscriptions,
- title_filter => $title,
- ISSN_filter => $ISSN,
- done_searched => $searched,
routing => $routing,
(uc(C4::Context->preference("marcflavour"))) => 1
);
--- /dev/null
+#!/usr/bin/perl
+
+# Copyright 2012 Koha Team
+#
+# 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.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+
+=head1 NAME
+
+serials-search.pl
+
+=head1 DESCRIPTION
+
+this script is the search page for serials
+
+=cut
+
+use Modern::Perl;
+use CGI;
+use C4::Auth;
+use C4::Branch;
+use C4::Context;
+use C4::Output;
+use C4::Serials;
+
+my $query = new CGI;
+my $title = $query->param('title_filter') || '';
+my $ISSN = $query->param('ISSN_filter') || '';
+my $EAN = $query->param('EAN_filter') || '';
+my $publisher = $query->param('publisher_filter') || '';
+my $bookseller = $query->param('bookseller_filter') || '';
+my $biblionumber = $query->param('biblionumber') || '';
+my $branch = $query->param('branch_filter') || '';
+my $routing = $query->param('routing') || C4::Context->preference("RoutingSerials");
+my $searched = $query->param('searched') || 0;
+
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ {
+ template_name => "serials/serials-search.tmpl",
+ query => $query,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => { serials => '*' },
+ debug => 1,
+ }
+);
+
+my @subscriptions;
+if ($searched){
+ @subscriptions = SearchSubscriptions(
+ {
+ biblionumber => $biblionumber,
+ title => $title,
+ issn => $ISSN,
+ ean => $EAN,
+ publisher => $publisher,
+ bookseller => $bookseller,
+ branch => $branch,
+ }
+ );
+}
+
+# to toggle between create or edit routing list options
+if ($routing) {
+ for my $subscription ( @subscriptions) {
+ $subscription->{routingedit} = check_routing( $subscription->{subscriptionid} );
+ $subscription->{branchname} = GetBranchName ( $subscription->{branchcode} );
+ }
+}
+
+my $branches = GetBranches();
+my @branches_loop;
+foreach (sort keys %$branches){
+ my $selected = 0;
+ $selected = 1 if( $branch eq $_ );
+ push @branches_loop, {
+ branchcode => $_,
+ branchname => $branches->{$_}->{'branchname'},
+ selected => $selected,
+ };
+}
+
+$template->param(
+ subscriptions => \@subscriptions,
+ title_filter => $title,
+ ISSN_filter => $ISSN,
+ EAN_filter => $EAN,
+ publisher_filter => $publisher,
+ bookseller_filter => $bookseller,
+ branch_filter => $branch,
+ branches_loop => \@branches_loop,
+ done_searched => $searched,
+ routing => $routing,
+ (uc(C4::Context->preference("marcflavour"))) => 1
+);
+
+output_html_with_http_headers $query, $cookie, $template->output;