@@ -, +, @@ - go on the serial module - click on the 'Advanced search' link (right of subscriptions search in - Search subscriptions (by ISSN, title, EAN, Publisher, Supplier and/or Branch) - Check results are correct --- C4/Serials.pm | 69 ++++++++ .../prog/en/includes/biblio-view-menu.inc | 2 +- .../prog/en/includes/serials-search.inc | 60 +++---- .../prog/en/modules/serials/serial-issues.tt | 2 +- .../prog/en/modules/serials/serials-home.tt | 165 ++---------------- .../prog/en/modules/serials/serials-search.tt | 183 ++++++++++++++++++++ serials/serials-home.pl | 71 +------- serials/serials-search.pl | 110 ++++++++++++ 8 files changed, 411 insertions(+), 251 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt create mode 100755 serials/serials-search.pl --- a/C4/Serials.pm +++ a/C4/Serials.pm @@ -36,6 +36,7 @@ BEGIN { @EXPORT = qw( &NewSubscription &ModSubscription &DelSubscription &GetSubscriptions &GetSubscription &CountSubscriptionFromBiblionumber &GetSubscriptionsFromBiblionumber + &SearchSubscriptions &GetFullSubscriptionsFromBiblionumber &GetFullSubscription &ModSubscriptionHistory &HasSubscriptionStrictlyExpired &HasSubscriptionExpired &GetExpirationDate &abouttoexpire @@ -631,6 +632,74 @@ sub GetSubscriptions { 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); --- a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/biblio-view-menu.inc @@ -25,7 +25,7 @@ [% END %] [% IF ( EasyAnalyticalRecords ) %][% IF ( analyze ) %]
Search subscriptions:
- -Enter search keywords:
- -Enter search keywords:
+ +- Serialseq - | -- Status - | -- Published date - | -- Planned date - | -- Notes - | -
---|---|---|---|---|
- [% informatio.serialseq %] - | -- [% informatio.status %] - | -- [% informatio.publisheddate %] - | -- [% informatio.planneddate %] - | -- [% informatio.notes %] - | -
ISSN | -Title | -Notes | -Library | -Call number | -Expiration date | - [% IF ( routing && CAN_user_serials_routing ) %] -Routing list | - [% END %] -- | - |
---|---|---|---|---|---|---|---|---|
- | - | - | - | - | - [% IF ( routing && CAN_user_serials_routing ) %] | [% END %] - | - | - |
- [% IF ( subscription.issn ) %][% subscription.issn %] - [% END %] - | -[% subscription.title |html %] - | -[% IF ( subscription.notes ) %][% subscription.notes %][% END %] - [% IF ( subscription.internalnotes ) %]([% subscription.internalnotes %])[% END %] - | -- [% IF ( subscription.branchname ) %][% subscription.branchname %][% END %] - | -- [% IF ( subscription.callnumber ) %][% subscription.callnumber %][% END %] - | -- [% IF ( subscription.enddate ) %][% subscription.enddate | $KohaDates %][% END %] - | - [% IF ( routing && CAN_user_serials_routing ) %] -- [% IF ( subscription.cannotedit ) %] - - [% ELSE %] - [% IF ( subscription.routingedit ) %] - Edit - ([% subscription.routingedit %]) - [% ELSE %] - New - [% END %] - [% END %] - | - [% END %] -Issue history - | -- [% IF ( subscription.cannotedit ) %] - - [% ELSE %] - [% IF ( CAN_user_serials_receive_serials ) %]Serial receive[% END %] - [% END %] - | -