[Koha-bugs] [Bug 13736] Enable EDS Plugin Patch

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Sat Sep 26 16:43:08 CEST 2015


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13736

Alvet <contact at alvet.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #36060|0                           |1
        is obsolete|                            |

--- Comment #2 from Alvet <contact at alvet.com.au> ---
Created attachment 42894
  -->
http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=42894&action=edit
EDS Plugin Patches Code checks to see if  setting EDSEnabled is ON and
integrates the EDS Plugin to the Opac

>From 5851a06cc13c93f40c2d58613e16aa4bf2c2e1b7 Mon Sep 17 00:00:00 2001
From: Alvet <contact at alvet.com.au>
Date: Sun, 27 Sep 2015 00:01:57 +1000
Subject: [PATCH] BUG 13736 [ENH] EDS Plugin Patches Code checks to see if
 setting EDSEnabled is ON and integrates the EDS Plugin to the Opac Auth.pm
 makes EDSEnabled accessible to the Opac doc-head-close.inc adds EDSScript.js
 to the opac opac-downloadcart.pl; contains code to add EDS records to the
 download list opac-sendbasket.pl; contains code to add EDS records to the
 email message

Test Plan
- Without Plugin
1) Apply the patch
2) Use Koha as normal.
- With Plugin (optional test)
1) Apply the patch
2) Install the EDS Koha Plugin
3) A Discovery Dropdown appears in the search dropdown to search subscription
resources
-Updating the EDS plugin.(optional test)
1) Visit https://github.com/ebsco/edsapi-koha-plugin
2) Download the .kpz file
3) Upload file using Koha's plugin manager
---
 C4/Auth.pm                                                |  1 +
 .../opac-tmpl/bootstrap/en/includes/doc-head-close.inc    |  1 +
 opac/opac-downloadcart.pl                                 | 15 +++++++++++++++
 opac/opac-sendbasket.pl                                   | 15 +++++++++++++++
 4 files changed, 32 insertions(+)

diff --git a/C4/Auth.pm b/C4/Auth.pm
index ef0c585..266c29a 100644
--- a/C4/Auth.pm
+++ b/C4/Auth.pm
@@ -471,6 +471,7 @@ sub get_template_and_user {
             AuthorisedValueImages                 =>
C4::Context->preference("AuthorisedValueImages"),
             BranchesLoop                          =>
GetBranchesLoop($opac_name),
             BranchCategoriesLoop                  => GetBranchCategories(
'searchdomain', 1, $opac_name ),
+           EDSEnabled                            =>
C4::Context->preference("EDSEnabled"),
             LibraryName                           => "" .
C4::Context->preference("LibraryName"),
             LibraryNameTitle                      => "" . $LibraryNameTitle,
             LoginBranchname                       => C4::Context->userenv ?
C4::Context->userenv->{"branchname"} : "",
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc
b/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc
index bce0da2..e8b819c 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc
@@ -48,3 +48,4 @@
     function _(s) { return s } // dummy function for gettext
 </script>
 <script type="text/javascript" src="[% interface %]/[% theme
%]/lib/modernizr.min.js"></script>
+[% IF ( EDSEnabled ) %]<script type="text/javascript" language="javascript"
src="/plugin/Koha/Plugin/EDS/js/EDSScript.js"></script>[% END %]
diff --git a/opac/opac-downloadcart.pl b/opac/opac-downloadcart.pl
index f14eb9e..10d1fcd 100755
--- a/opac/opac-downloadcart.pl
+++ b/opac/opac-downloadcart.pl
@@ -34,6 +34,14 @@ use C4::Csv;
 use utf8;
 my $query = new CGI;

+my $eds_data = "";
+if ( ( eval { C4::Context->preference('EDSEnabled') } ) ) {
+    my $PluginDir = C4::Context->config("pluginsdir");
+    $PluginDir = $PluginDir . '/Koha/Plugin/EDS';
+    require $PluginDir . '/opac/eds-methods.pl';
+    $eds_data = $query->param('eds_data');
+}
+
 my ( $template, $borrowernumber, $cookie ) = get_template_and_user (
     {
         template_name   => "opac-downloadcart.tt",
@@ -66,6 +74,13 @@ if ($bib_list && $format) {
         foreach my $biblio (@bibs) {

             my $record = GetMarcBiblio($biblio, 1);
+            if ( ( eval { C4::Context->preference('EDSEnabled') } ) ) {
+                my $dat = "";
+                if ( $biblio =~ m/\|/ ) {
+                    ( $record, $dat ) =
+                      ProcessEDSCartItems( $biblio, $eds_data, $record, $dat
);
+                }
+            }
             next unless $record;

             if ($format eq 'iso2709') {
diff --git a/opac/opac-sendbasket.pl b/opac/opac-sendbasket.pl
index 6b2d62f..7f7d616 100755
--- a/opac/opac-sendbasket.pl
+++ b/opac/opac-sendbasket.pl
@@ -36,6 +36,13 @@ use C4::Members;
 use Koha::Email;

 my $query = new CGI;
+my $eds_data = "";
+if ( ( eval { C4::Context->preference('EDSEnabled') } ) ) {
+    my $PluginDir = C4::Context->config("pluginsdir");
+    $PluginDir = $PluginDir . '/Koha/Plugin/EDS';
+    require $PluginDir . '/opac/eds-methods.pl';
+    $eds_data = $query->param('eds_data');
+}

 my ( $template, $borrowernumber, $cookie ) = get_template_and_user (
     {
@@ -86,6 +93,11 @@ if ( $email_add ) {
         my $dat              = GetBiblioData($biblionumber);
         next unless $dat;
         my $record           = GetMarcBiblio($biblionumber, 1);
+       if((eval{C4::Context->preference('EDSEnabled')})){
+               if($biblionumber =~m/\|/){
+                       ($record,$dat)=
ProcessEDSCartItems($biblionumber,$eds_data,$record,$dat);
+               }
+       }
         my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
         my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
         my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
@@ -122,6 +134,9 @@ if ( $email_add ) {
     # Getting template result
     my $template_res = $template2->output();
     my $body;
+       if((eval{C4::Context->preference('EDSEnabled')})){
+               $template_res = CartSendLinks($template_res, at bibs);
+       }

     # Analysing information and getting mail properties

-- 
1.9.1

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list