"Fossies" - the Fresh Open Source Software Archive

Member "koha-19.11.15/opac/opac-alert-subscribe.pl" (23 Feb 2021, 2872 Bytes) of package /linux/misc/koha-19.11.15.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "opac-alert-subscribe.pl" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 20.05.06_vs_20.11.00.

    1 #!/usr/bin/perl
    2 
    3 # Copyright 2000-2002 Katipo Communications
    4 #
    5 # This file is part of Koha.
    6 #
    7 # Koha is free software; you can redistribute it and/or modify it
    8 # under the terms of the GNU General Public License as published by
    9 # the Free Software Foundation; either version 3 of the License, or
   10 # (at your option) any later version.
   11 #
   12 # Koha is distributed in the hope that it will be useful, but
   13 # WITHOUT ANY WARRANTY; without even the implied warranty of
   14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   15 # GNU General Public License for more details.
   16 #
   17 # You should have received a copy of the GNU General Public License
   18 # along with Koha; if not, see <http://www.gnu.org/licenses>.
   19 
   20 
   21 use Modern::Perl;
   22 use CGI qw ( -utf8 );
   23 use C4::Auth;
   24 use C4::Output;
   25 use C4::Context;
   26 use C4::Koha;
   27 use C4::Letters;
   28 use C4::Serials;
   29 
   30 
   31 my $query = new CGI;
   32 my $op    = $query->param('op') || '';
   33 my $dbh   = C4::Context->dbh;
   34 
   35 my $sth;
   36 my ( $template, $loggedinuser, $cookie );
   37 my $subscriptionid = $query->param('subscriptionid');
   38 my $referer      = $query->param('referer') || 'detail';
   39 my $biblionumber = $query->param('biblionumber');
   40 
   41 ( $template, $loggedinuser, $cookie ) = get_template_and_user(
   42     {
   43         template_name   => "opac-alert-subscribe.tt",
   44         query           => $query,
   45         type            => "opac",
   46         authnotrequired => 0, # user must logged in to request
   47                               # subscription notifications
   48         debug           => 1,
   49     }
   50 );
   51 
   52 my $subscription = Koha::Subscriptions->find( $subscriptionid );
   53 my $logged_in_patron = Koha::Patrons->find( $loggedinuser );
   54 
   55 if ( $op eq 'alert_confirmed' ) {
   56     $subscription->add_subscriber( $logged_in_patron );
   57     if ( $referer eq 'serial' ) {
   58         print $query->redirect(
   59             "opac-serial-issues.pl?biblionumber=$biblionumber");
   60         exit;
   61     } else {
   62         print $query->redirect(
   63             "opac-detail.pl?biblionumber=$biblionumber");
   64         exit;
   65     }
   66 }
   67 elsif ( $op eq 'cancel_confirmed' ) {
   68     $subscription->remove_subscriber( $logged_in_patron );
   69     warn "CANCEL confirmed : $loggedinuser, $subscriptionid";
   70     if ( $referer eq 'serial' ) {
   71         print $query->redirect(
   72             "opac-serial-issues.pl?biblionumber=$biblionumber");
   73         exit;
   74     } else {
   75         print $query->redirect(
   76             "opac-detail.pl?biblionumber=$biblionumber");
   77         exit;
   78     }
   79 
   80 
   81 }
   82 else {
   83     my $subscription = &GetSubscription($subscriptionid);
   84     $template->param(
   85         referer        => $referer,
   86         "typeissue$op" => 1,
   87         bibliotitle    => $subscription->{bibliotitle},
   88         notes          => $subscription->{notes},
   89         subscriptionid     => $subscriptionid,
   90         biblionumber   => $biblionumber,
   91     );
   92 }
   93 output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };