From dfd3ace803da5887e45ee220d036028e28490e82 Mon Sep 17 00:00:00 2001 From: Llewellyn Marshall Date: Tue, 23 Jun 2020 16:32:27 -0400 Subject: [PATCH] WWW Perl mod changes --- .../src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm | 3 ++ .../lib/OpenILS/WWW/EGCatLoader/Tattler.pm | 41 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Tattler.pm diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm index 19a3b258a8..b49107a394 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm @@ -21,6 +21,7 @@ use OpenILS::WWW::EGCatLoader::Util; use OpenILS::WWW::EGCatLoader::Account; use OpenILS::WWW::EGCatLoader::Browse; use OpenILS::WWW::EGCatLoader::Library; +use OpenILS::WWW::EGCatLoader::Tattler; use OpenILS::WWW::EGCatLoader::Search; use OpenILS::WWW::EGCatLoader::Record; use OpenILS::WWW::EGCatLoader::Container; @@ -163,6 +164,7 @@ sub load { # Everything below here requires SSL # ---------------------------------------------------------------- return $self->redirect_ssl unless $self->cgi->https; + return $self->update_tattle_list if $path =~ m|opac/tattler|; return $self->load_password_reset if $path =~ m|opac/password_reset|; return $self->load_logout if $path =~ m|opac/logout|; return $self->load_patron_reg if $path =~ m|opac/register|; @@ -232,6 +234,7 @@ sub load { return $self->load_myopac_reservations if $path =~ m|opac/myopac/reservations|; return $self->load_sms_cn if $path =~ m|opac/sms_cn|; + return Apache2::Const::OK; } diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Tattler.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Tattler.pm new file mode 100644 index 0000000000..e2ef953cc3 --- /dev/null +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Tattler.pm @@ -0,0 +1,41 @@ +package OpenILS::WWW::EGCatLoader; +use strict; use warnings; +use Apache2::Const -compile => qw(OK DECLINED FORBIDDEN HTTP_INTERNAL_SERVER_ERROR REDIRECT HTTP_BAD_REQUEST); +use OpenSRF::Utils::JSON; +use OpenSRF::Utils::Logger qw/$logger/; +use OpenILS::Utils::CStoreEditor qw/:funcs/; +use OpenILS::Utils::Fieldmapper; +use OpenILS::Application::AppUtils; + +my $U = 'OpenILS::Application::AppUtils'; + +sub update_tattle_list { + my $self = shift; + my %kwargs = @_; + my $ctx = $self->ctx; + my $cgi = $self->cgi; + my $usr = $ctx->{user}; + my $permission = $usr && $self->{editor}->allowed('UPDATE_RECORD'); + return Apache2::Const::FORBIDDEN unless $permission == 1; + if( $cgi->request_method eq 'POST'){ + $self->{editor}->xact_begin; + my $sysID = $cgi->param('systemID'); + my $report = $cgi->param('reportName'); + $ctx->{report} = $report; + $ctx->{copies} = []; + my @copy_array = $cgi->param("copyID[]"); + $ctx->{copies} = [@copy_array]; + foreach(@copy_array){ + my $rec = Fieldmapper::tattler::ignore_list->new; + $logger->info("Adding Copy ".$_." to tattler ignore list for ".$report." at system ".$sysID); + $rec->org_unit($sysID); + $rec->target_copy($_); + $rec->report_name($report); + $self->{editor}->create_tattler_ignore_list($rec); + } + $self->{editor}->xact_commit; + } + return Apache2::Const::OK; +} + +1; \ No newline at end of file -- 2.11.0