WWW Perl mod changes
authorLlewellyn Marshall <llewellyn.marshall@ncdcr.gov>
Tue, 23 Jun 2020 20:32:27 +0000 (16:32 -0400)
committerLlewellyn Marshall <llewellyn.marshall@ncdcr.gov>
Tue, 23 Jun 2020 20:32:27 +0000 (16:32 -0400)
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Tattler.pm [new file with mode: 0644]

index 19a3b25..b49107a 100644 (file)
@@ -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 (file)
index 0000000..e2ef953
--- /dev/null
@@ -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