diff --git a/C4/Auth.pm b/C4/Auth.pm index e8469263c6..874b870d2c 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -145,19 +145,19 @@ sub get_template_and_user { $template->param( loggedinusername => $user ); $template->param( sessionID => $sessionID ); - my ($total, $pubshelves, $barshelves) = C4::Context->get_shelves_userenv(); - if (defined($pubshelves)) { - $template->param( pubshelves => scalar (@$pubshelves), - pubshelvesloop => $pubshelves, - ); - $template->param( pubtotal => $total->{'pubtotal'}, ) if ($total->{'pubtotal'} > scalar (@$pubshelves)); - } - if (defined($barshelves)) { - $template->param( barshelves => scalar (@$barshelves), - barshelvesloop => $barshelves, - ); - $template->param( bartotal => $total->{'bartotal'}, ) if ($total->{'bartotal'} > scalar (@$barshelves)); - } + my ($total, $pubshelves, $barshelves) = C4::Context->get_shelves_userenv(); + if (defined($pubshelves)) { + $template->param( pubshelves => scalar (@$pubshelves), + pubshelvesloop => $pubshelves, + ); + $template->param( pubtotal => $total->{'pubtotal'}, ) if ($total->{'pubtotal'} > scalar (@$pubshelves)); + } + if (defined($barshelves)) { + $template->param( barshelves => scalar (@$barshelves), + barshelvesloop => $barshelves, + ); + $template->param( bartotal => $total->{'bartotal'}, ) if ($total->{'bartotal'} > scalar (@$barshelves)); + } $borrowernumber = getborrowernumber($user); my ( $borr ) = GetMemberDetails( $borrowernumber ); @@ -229,7 +229,7 @@ sub get_template_and_user { } } } - else { # if this is an anonymous session, setup to display public lists... + else { # if this is an anonymous session, setup to display public lists... # load the template variables for stylesheets and JavaScript $template->param( css_libs => $in->{'css_libs'} ); @@ -243,16 +243,16 @@ sub get_template_and_user { $template->param( js_widgets => $in->{'js_widgets'} ); $template->param( sessionID => $sessionID ); - - my ($total, $pubshelves) = C4::Context->get_shelves_userenv(); # an anonymous user has no 'barshelves'... - if (defined(($pubshelves))) { - $template->param( pubshelves => scalar (@$pubshelves), - pubshelvesloop => $pubshelves, - ); - $template->param( pubtotal => $total->{'pubtotal'}, ) if ($total->{'pubtotal'} > scalar (@$pubshelves)); - } + + my ($total, $pubshelves) = C4::Context->get_shelves_userenv(); # an anonymous user has no 'barshelves'... + if (defined(($pubshelves))) { + $template->param( pubshelves => scalar (@$pubshelves), + pubshelvesloop => $pubshelves, + ); + $template->param( pubtotal => $total->{'pubtotal'}, ) if ($total->{'pubtotal'} > scalar (@$pubshelves)); + } - } + } # these template parameters are set the same regardless of $in->{'type'} $template->param( @@ -269,22 +269,24 @@ sub get_template_and_user { 'item-level_itypes' => C4::Context->preference('item-level_itypes'), patronimages => C4::Context->preference("patronimages"), singleBranchMode => C4::Context->preference("singleBranchMode"), - SyndeticsClientCode => C4::Context->preference("SyndeticsClientCode"), - SyndeticsEnabled => C4::Context->preference("SyndeticsEnabled"), - SyndeticsCoverImages => C4::Context->preference("SyndeticsCoverImages"), - SyndeticsTOC => C4::Context->preference("SyndeticsTOC"), - SyndeticsSummary => C4::Context->preference("SyndeticsSummary"), - SyndeticsEditions => C4::Context->preference("SyndeticsEditions"), - SyndeticsExcerpt => C4::Context->preference("SyndeticsExcerpt"), - SyndeticsReviews => C4::Context->preference("SyndeticsReviews"), - SyndeticsAuthorNotes => C4::Context->preference("SyndeticsAuthorNotes"), - SyndeticsAwards => C4::Context->preference("SyndeticsAwards"), - SyndeticsSeries => C4::Context->preference("SyndeticsSeries"), + SyndeticsClientCode => C4::Context->preference("SyndeticsClientCode"), + SyndeticsEnabled => C4::Context->preference("SyndeticsEnabled"), + SyndeticsCoverImages => C4::Context->preference("SyndeticsCoverImages"), + SyndeticsTOC => C4::Context->preference("SyndeticsTOC"), + SyndeticsSummary => C4::Context->preference("SyndeticsSummary"), + SyndeticsEditions => C4::Context->preference("SyndeticsEditions"), + SyndeticsExcerpt => C4::Context->preference("SyndeticsExcerpt"), + SyndeticsReviews => C4::Context->preference("SyndeticsReviews"), + SyndeticsAuthorNotes => C4::Context->preference("SyndeticsAuthorNotes"), + SyndeticsAwards => C4::Context->preference("SyndeticsAwards"), + SyndeticsSeries => C4::Context->preference("SyndeticsSeries"), + SyndeticsCoverImageSize => C4::Context->preference("SyndeticsCoverImageSize"), ); if ( $in->{'type'} eq "intranet" ) { $template->param( - AmazonContent => C4::Context->preference("AmazonContent"), + AmazonEnabled => C4::Context->preference("AmazonEnabled"), + AmazonCoverImages => C4::Context->preference("AmazonCoverImages"), AmazonSimilarItems => C4::Context->preference("AmazonSimilarItems"), AutoLocation => C4::Context->preference("AutoLocation"), "BiblioDefaultView".C4::Context->preference("IntranetBiblioDefaultView") => 1, @@ -313,12 +315,13 @@ sub get_template_and_user { $LibraryNameTitle =~ s/<(?:\/?)(?:br|p)\s*(?:\/?)>/ /sgi; $LibraryNameTitle =~ s/<(?:[^<>'"]|'(?:[^']*)'|"(?:[^"]*)")*>//sg; $template->param( - AmazonContent => "" . C4::Context->preference("AmazonContent"), AnonSuggestions => "" . C4::Context->preference("AnonSuggestions"), AuthorisedValueImages => C4::Context->preference("AuthorisedValueImages"), LibraryName => "" . C4::Context->preference("LibraryName"), LibraryNameTitle => "" . $LibraryNameTitle, LoginBranchname => C4::Context->userenv?C4::Context->userenv->{"branchname"}:"", + OPACAmazonEnabled => C4::Context->preference("OPACAmazonEnabled"), + OPACAmazonCoverImages => C4::Context->preference("OPACAmazonCoverImages"), OPACAmazonSimilarItems => "" . C4::Context->preference("OPACAmazonSimilarItems"), OPACFRBRizeEditions => C4::Context->preference("OPACFRBRizeEditions"), OPACItemHolds => C4::Context->preference("OPACItemHolds"), @@ -444,11 +447,11 @@ sub _version_check ($$) { my $version; # If Version syspref is unavailable, it means Koha is beeing installed, # and so we must redirect to OPAC maintenance page or to the WebInstaller - # also, if OpacMaintenance is ON, OPAC should redirect to maintenance - if (C4::Context->preference('OpacMaintenance') && $type eq 'opac') { - warn "OPAC Install required, redirecting to maintenance"; - print $query->redirect("/cgi-bin/koha/maintenance.pl"); - } + # also, if OpacMaintenance is ON, OPAC should redirect to maintenance + if (C4::Context->preference('OpacMaintenance') && $type eq 'opac') { + warn "OPAC Install required, redirecting to maintenance"; + print $query->redirect("/cgi-bin/koha/maintenance.pl"); + } unless ($version = C4::Context->preference('Version')) { # assignment, not comparison if ($type ne 'opac') { warn "Install required, redirecting to Installer"; @@ -491,7 +494,7 @@ sub _session_log { sub checkauth { my $query = shift; - $debug and warn "Checking Auth"; + $debug and warn "Checking Auth"; # $authnotrequired will be set for scripts which will run without authentication my $authnotrequired = shift; my $flagsrequired = shift; @@ -541,19 +544,19 @@ sub checkauth { $ip = $session->param('ip'); $lasttime = $session->param('lasttime'); $userid = $session->param('id'); - $sessiontype = $session->param('sessiontype'); + $sessiontype = $session->param('sessiontype'); } - if ( ($query->param('koha_login_context')) && ($query->param('userid') ne $session->param('id')) ) { - #if a user enters an id ne to the id in the current session, we need to log them in... - #first we need to clear the anonymous session... - $debug and warn "query id = " . $query->param('userid') . " but session id = " . $session->param('id'); + if ( ($query->param('koha_login_context')) && ($query->param('userid') ne $session->param('id')) ) { + #if a user enters an id ne to the id in the current session, we need to log them in... + #first we need to clear the anonymous session... + $debug and warn "query id = " . $query->param('userid') . " but session id = " . $session->param('id'); $session->flush; $session->delete(); C4::Context->_unset_userenv($sessionID); - $sessionID = undef; - $userid = undef; - } + $sessionID = undef; + $userid = undef; + } elsif ($logout) { # voluntary logout the user $session->flush; @@ -563,205 +566,205 @@ sub checkauth { $sessionID = undef; $userid = undef; } - elsif ( $lasttime < time() - $timeout ) { - # timed logout - $info{'timed_out'} = 1; - $session->delete(); - C4::Context->_unset_userenv($sessionID); - _session_log(sprintf "%20s from %16s logged out at %30s (inactivity).\n", $userid,$ip,localtime); - $userid = undef; - $sessionID = undef; - } - elsif ( $ip ne $ENV{'REMOTE_ADDR'} ) { - # Different ip than originally logged in from - $info{'oldip'} = $ip; - $info{'newip'} = $ENV{'REMOTE_ADDR'}; - $info{'different_ip'} = 1; - $session->delete(); - C4::Context->_unset_userenv($sessionID); - _session_log(sprintf "%20s from %16s logged out at %30s (ip changed to %16s).\n", $userid,$ip,localtime, $info{'newip'}); - $sessionID = undef; - $userid = undef; - } - else { - $cookie = $query->cookie( CGISESSID => $session->id ); - $session->param('lasttime',time()); - unless ( $sessiontype eq 'anon' ) { #if this is an anonymous session, we want to update the session, but not behave as if they are logged in... - $flags = haspermission( $dbh, $userid, $flagsrequired ); - if ($flags) { - $loggedin = 1; - } else { - $info{'nopermission'} = 1; - } - } - } + elsif ( $lasttime < time() - $timeout ) { + # timed logout + $info{'timed_out'} = 1; + $session->delete(); + C4::Context->_unset_userenv($sessionID); + _session_log(sprintf "%20s from %16s logged out at %30s (inactivity).\n", $userid,$ip,localtime); + $userid = undef; + $sessionID = undef; + } + elsif ( $ip ne $ENV{'REMOTE_ADDR'} ) { + # Different ip than originally logged in from + $info{'oldip'} = $ip; + $info{'newip'} = $ENV{'REMOTE_ADDR'}; + $info{'different_ip'} = 1; + $session->delete(); + C4::Context->_unset_userenv($sessionID); + _session_log(sprintf "%20s from %16s logged out at %30s (ip changed to %16s).\n", $userid,$ip,localtime, $info{'newip'}); + $sessionID = undef; + $userid = undef; + } + else { + $cookie = $query->cookie( CGISESSID => $session->id ); + $session->param('lasttime',time()); + unless ( $sessiontype eq 'anon' ) { #if this is an anonymous session, we want to update the session, but not behave as if they are logged in... + $flags = haspermission( $dbh, $userid, $flagsrequired ); + if ($flags) { + $loggedin = 1; + } else { + $info{'nopermission'} = 1; + } + } + } } unless ($userid || $sessionID) { #we initiate a session prior to checking for a username to allow for anonymous sessions... - my $session = get_session("") or die "Auth ERROR: Cannot get_session()"; + my $session = get_session("") or die "Auth ERROR: Cannot get_session()"; my $sessionID = $session->id; - C4::Context->_new_userenv($sessionID); + C4::Context->_new_userenv($sessionID); $cookie = $query->cookie(CGISESSID => $sessionID); - if ( $userid = $query->param('userid') ) { - my $password = $query->param('password'); - my ( $return, $cardnumber ) = checkpw( $dbh, $userid, $password ); - if ($return) { - _session_log(sprintf "%20s from %16s logged in at %30s.\n", $userid,$ENV{'REMOTE_ADDR'},localtime); - if ( $flags = haspermission( $dbh, $userid, $flagsrequired ) ) { - $loggedin = 1; - } - else { - $info{'nopermission'} = 1; - C4::Context->_unset_userenv($sessionID); - } + if ( $userid = $query->param('userid') ) { + my $password = $query->param('password'); + my ( $return, $cardnumber ) = checkpw( $dbh, $userid, $password ); + if ($return) { + _session_log(sprintf "%20s from %16s logged in at %30s.\n", $userid,$ENV{'REMOTE_ADDR'},localtime); + if ( $flags = haspermission( $dbh, $userid, $flagsrequired ) ) { + $loggedin = 1; + } + else { + $info{'nopermission'} = 1; + C4::Context->_unset_userenv($sessionID); + } - my ($borrowernumber, $firstname, $surname, $userflags, - $branchcode, $branchname, $branchprinter, $emailaddress); + my ($borrowernumber, $firstname, $surname, $userflags, + $branchcode, $branchname, $branchprinter, $emailaddress); - if ( $return == 1 ) { - my $select = " - SELECT borrowernumber, firstname, surname, flags, borrowers.branchcode, - branches.branchname as branchname, - branches.branchprinter as branchprinter, - email - FROM borrowers - LEFT JOIN branches on borrowers.branchcode=branches.branchcode - "; - my $sth = $dbh->prepare("$select where userid=?"); - $sth->execute($userid); - unless ($sth->rows) { - $debug and print STDERR "AUTH_1: no rows for userid='$userid'\n"; - $sth = $dbh->prepare("$select where cardnumber=?"); - $sth->execute($cardnumber); - unless ($sth->rows) { - $debug and print STDERR "AUTH_2a: no rows for cardnumber='$cardnumber'\n"; - $sth->execute($userid); - unless ($sth->rows) { - $debug and print STDERR "AUTH_2b: no rows for userid='$userid' AS cardnumber\n"; - } - } - } - if ($sth->rows) { - ($borrowernumber, $firstname, $surname, $userflags, - $branchcode, $branchname, $branchprinter, $emailaddress) = $sth->fetchrow; - $debug and print STDERR "AUTH_3 results: " . - "$cardnumber,$borrowernumber,$userid,$firstname,$surname,$userflags,$branchcode,$emailaddress\n"; - } else { - print STDERR "AUTH_3: no results for userid='$userid', cardnumber='$cardnumber'.\n"; - } + if ( $return == 1 ) { + my $select = " + SELECT borrowernumber, firstname, surname, flags, borrowers.branchcode, + branches.branchname as branchname, + branches.branchprinter as branchprinter, + email + FROM borrowers + LEFT JOIN branches on borrowers.branchcode=branches.branchcode + "; + my $sth = $dbh->prepare("$select where userid=?"); + $sth->execute($userid); + unless ($sth->rows) { + $debug and print STDERR "AUTH_1: no rows for userid='$userid'\n"; + $sth = $dbh->prepare("$select where cardnumber=?"); + $sth->execute($cardnumber); + unless ($sth->rows) { + $debug and print STDERR "AUTH_2a: no rows for cardnumber='$cardnumber'\n"; + $sth->execute($userid); + unless ($sth->rows) { + $debug and print STDERR "AUTH_2b: no rows for userid='$userid' AS cardnumber\n"; + } + } + } + if ($sth->rows) { + ($borrowernumber, $firstname, $surname, $userflags, + $branchcode, $branchname, $branchprinter, $emailaddress) = $sth->fetchrow; + $debug and print STDERR "AUTH_3 results: " . + "$cardnumber,$borrowernumber,$userid,$firstname,$surname,$userflags,$branchcode,$emailaddress\n"; + } else { + print STDERR "AUTH_3: no results for userid='$userid', cardnumber='$cardnumber'.\n"; + } # launch a sequence to check if we have a ip for the branch, i # if we have one we replace the branchcode of the userenv by the branch bound in the ip. - my $ip = $ENV{'REMOTE_ADDR'}; - # if they specify at login, use that - if ($query->param('branch')) { - $branchcode = $query->param('branch'); - $branchname = GetBranchName($branchcode); - } - my $branches = GetBranches(); - if (C4::Context->boolean_preference('IndependantBranches') && C4::Context->boolean_preference('Autolocation')){ - # we have to check they are coming from the right ip range - my $domain = $branches->{$branchcode}->{'branchip'}; - if ($ip !~ /^$domain/){ - $loggedin=0; - $info{'wrongip'} = 1; - } - } + my $ip = $ENV{'REMOTE_ADDR'}; + # if they specify at login, use that + if ($query->param('branch')) { + $branchcode = $query->param('branch'); + $branchname = GetBranchName($branchcode); + } + my $branches = GetBranches(); + if (C4::Context->boolean_preference('IndependantBranches') && C4::Context->boolean_preference('Autolocation')){ + # we have to check they are coming from the right ip range + my $domain = $branches->{$branchcode}->{'branchip'}; + if ($ip !~ /^$domain/){ + $loggedin=0; + $info{'wrongip'} = 1; + } + } - my @branchesloop; - foreach my $br ( keys %$branches ) { - # now we work with the treatment of ip - my $domain = $branches->{$br}->{'branchip'}; - if ( $domain && $ip =~ /^$domain/ ) { - $branchcode = $branches->{$br}->{'branchcode'}; + my @branchesloop; + foreach my $br ( keys %$branches ) { + # now we work with the treatment of ip + my $domain = $branches->{$br}->{'branchip'}; + if ( $domain && $ip =~ /^$domain/ ) { + $branchcode = $branches->{$br}->{'branchcode'}; - # new op dev : add the branchprinter and branchname in the cookie - $branchprinter = $branches->{$br}->{'branchprinter'}; - $branchname = $branches->{$br}->{'branchname'}; - } - } - $session->param('number',$borrowernumber); - $session->param('id',$userid); - $session->param('cardnumber',$cardnumber); - $session->param('firstname',$firstname); - $session->param('surname',$surname); - $session->param('branch',$branchcode); - $session->param('branchname',$branchname); - $session->param('flags',$userflags); - $session->param('emailaddress',$emailaddress); - $session->param('ip',$session->remote_addr()); - $session->param('lasttime',time()); - $debug and printf STDERR "AUTH_4: (%s)\t%s %s - %s\n", map {$session->param($_)} qw(cardnumber firstname surname branch) ; - } - elsif ( $return == 2 ) { - #We suppose the user is the superlibrarian - $borrowernumber = 0; - $session->param('number',0); - $session->param('id',C4::Context->config('user')); - $session->param('cardnumber',C4::Context->config('user')); - $session->param('firstname',C4::Context->config('user')); - $session->param('surname',C4::Context->config('user')); - $session->param('branch','NO_LIBRARY_SET'); - $session->param('branchname','NO_LIBRARY_SET'); - $session->param('flags',1); - $session->param('emailaddress', C4::Context->preference('KohaAdminEmailAddress')); - $session->param('ip',$session->remote_addr()); - $session->param('lasttime',time()); - } - C4::Context::set_userenv( - $session->param('number'), $session->param('id'), - $session->param('cardnumber'), $session->param('firstname'), - $session->param('surname'), $session->param('branch'), - $session->param('branchname'), $session->param('flags'), - $session->param('emailaddress'), $session->param('branchprinter') - ); + # new op dev : add the branchprinter and branchname in the cookie + $branchprinter = $branches->{$br}->{'branchprinter'}; + $branchname = $branches->{$br}->{'branchname'}; + } + } + $session->param('number',$borrowernumber); + $session->param('id',$userid); + $session->param('cardnumber',$cardnumber); + $session->param('firstname',$firstname); + $session->param('surname',$surname); + $session->param('branch',$branchcode); + $session->param('branchname',$branchname); + $session->param('flags',$userflags); + $session->param('emailaddress',$emailaddress); + $session->param('ip',$session->remote_addr()); + $session->param('lasttime',time()); + $debug and printf STDERR "AUTH_4: (%s)\t%s %s - %s\n", map {$session->param($_)} qw(cardnumber firstname surname branch) ; + } + elsif ( $return == 2 ) { + #We suppose the user is the superlibrarian + $borrowernumber = 0; + $session->param('number',0); + $session->param('id',C4::Context->config('user')); + $session->param('cardnumber',C4::Context->config('user')); + $session->param('firstname',C4::Context->config('user')); + $session->param('surname',C4::Context->config('user')); + $session->param('branch','NO_LIBRARY_SET'); + $session->param('branchname','NO_LIBRARY_SET'); + $session->param('flags',1); + $session->param('emailaddress', C4::Context->preference('KohaAdminEmailAddress')); + $session->param('ip',$session->remote_addr()); + $session->param('lasttime',time()); + } + C4::Context::set_userenv( + $session->param('number'), $session->param('id'), + $session->param('cardnumber'), $session->param('firstname'), + $session->param('surname'), $session->param('branch'), + $session->param('branchname'), $session->param('flags'), + $session->param('emailaddress'), $session->param('branchprinter') + ); - # Grab borrower's shelves and public shelves and add them to the session - # $row_count determines how many records are returned from the db query - # and the number of lists to be displayed of each type in the 'Lists' button drop down - my $row_count = 10; # FIXME:This probably should be a syspref - my ($total, $totshelves, $barshelves, $pubshelves); - ($barshelves, $totshelves) = C4::VirtualShelves::GetRecentShelves(1, $row_count, $borrowernumber); - $total->{'bartotal'} = $totshelves; - ($pubshelves, $totshelves) = C4::VirtualShelves::GetRecentShelves(2, $row_count, undef); - $total->{'pubtotal'} = $totshelves; - $session->param('barshelves', $barshelves->[0]); - $session->param('pubshelves', $pubshelves->[0]); - $session->param('totshelves', $total); - - C4::Context::set_shelves_userenv('bar',$barshelves->[0]); - C4::Context::set_shelves_userenv('pub',$pubshelves->[0]); - C4::Context::set_shelves_userenv('tot',$total); - } - else { - if ($userid) { - $info{'invalid_username_or_password'} = 1; - C4::Context->_unset_userenv($sessionID); - } - } - } # END if ( $userid = $query->param('userid') ) - elsif ($type eq "opac") { + # Grab borrower's shelves and public shelves and add them to the session + # $row_count determines how many records are returned from the db query + # and the number of lists to be displayed of each type in the 'Lists' button drop down + my $row_count = 10; # FIXME:This probably should be a syspref + my ($total, $totshelves, $barshelves, $pubshelves); + ($barshelves, $totshelves) = C4::VirtualShelves::GetRecentShelves(1, $row_count, $borrowernumber); + $total->{'bartotal'} = $totshelves; + ($pubshelves, $totshelves) = C4::VirtualShelves::GetRecentShelves(2, $row_count, undef); + $total->{'pubtotal'} = $totshelves; + $session->param('barshelves', $barshelves->[0]); + $session->param('pubshelves', $pubshelves->[0]); + $session->param('totshelves', $total); + + C4::Context::set_shelves_userenv('bar',$barshelves->[0]); + C4::Context::set_shelves_userenv('pub',$pubshelves->[0]); + C4::Context::set_shelves_userenv('tot',$total); + } + else { + if ($userid) { + $info{'invalid_username_or_password'} = 1; + C4::Context->_unset_userenv($sessionID); + } + } + } # END if ( $userid = $query->param('userid') ) + elsif ($type eq "opac") { # if we are here this is an anonymous session; add public lists to it and a few other items... # anonymous sessions are created only for the OPAC - $debug and warn "Initiating an anonymous session..."; + $debug and warn "Initiating an anonymous session..."; - # Grab the public shelves and add to the session... - my $row_count = 20; # FIXME:This probably should be a syspref - my ($total, $totshelves, $pubshelves); - ($pubshelves, $totshelves) = C4::VirtualShelves::GetRecentShelves(2, $row_count, undef); - $total->{'pubtotal'} = $totshelves; - $session->param('pubshelves', $pubshelves->[0]); - $session->param('totshelves', $total); - C4::Context::set_shelves_userenv('pub',$pubshelves->[0]); - C4::Context::set_shelves_userenv('tot',$total); - - # setting a couple of other session vars... - $session->param('ip',$session->remote_addr()); - $session->param('lasttime',time()); - $session->param('sessiontype','anon'); - } - } # END unless ($userid) + # Grab the public shelves and add to the session... + my $row_count = 20; # FIXME:This probably should be a syspref + my ($total, $totshelves, $pubshelves); + ($pubshelves, $totshelves) = C4::VirtualShelves::GetRecentShelves(2, $row_count, undef); + $total->{'pubtotal'} = $totshelves; + $session->param('pubshelves', $pubshelves->[0]); + $session->param('totshelves', $total); + C4::Context::set_shelves_userenv('pub',$pubshelves->[0]); + C4::Context::set_shelves_userenv('tot',$total); + + # setting a couple of other session vars... + $session->param('ip',$session->remote_addr()); + $session->param('lasttime',time()); + $session->param('sessiontype','anon'); + } + } # END unless ($userid) my $insecure = C4::Context->boolean_preference('insecure'); # finished authentification, now respond @@ -791,7 +794,7 @@ sub checkauth { my $branches = GetBranches(); my @branch_loop; for my $branch_hash (sort keys %$branches) { - push @branch_loop, {branchcode => "$branch_hash", branchname => $branches->{$branch_hash}->{'branchname'}, }; + push @branch_loop, {branchcode => "$branch_hash", branchname => $branches->{$branch_hash}->{'branchname'}, }; } my $template_name = ( $type eq 'opac' ) ? 'opac-auth.tmpl' : 'auth.tmpl'; @@ -821,14 +824,14 @@ sub checkauth { TagsEnabled => C4::Context->preference("TagsEnabled"), OPACUserCSS => C4::Context->preference("OPACUserCSS"), intranetcolorstylesheet => - C4::Context->preference("intranetcolorstylesheet"), + C4::Context->preference("intranetcolorstylesheet"), intranetstylesheet => C4::Context->preference("intranetstylesheet"), IntranetNav => C4::Context->preference("IntranetNav"), intranetuserjs => C4::Context->preference("intranetuserjs"), TemplateEncoding => C4::Context->preference("TemplateEncoding"), IndependantBranches=> C4::Context->preference("IndependantBranches"), AutoLocation => C4::Context->preference("AutoLocation"), - wrongip => $info{'wrongip'} + wrongip => $info{'wrongip'} ); $template->param( loginprompt => 1 ) unless $info{'nopermission'}; diff --git a/C4/External/Amazon.pm b/C4/External/Amazon.pm index f86e197d7e..7d0c1b546a 100644 --- a/C4/External/Amazon.pm +++ b/C4/External/Amazon.pm @@ -21,6 +21,7 @@ use XML::Simple; use LWP::Simple; use LWP::UserAgent; use HTTP::Request::Common; +use C4::Koha; use strict; use warnings; @@ -60,11 +61,10 @@ Get editorial reviews, customer reviews, and similar products using Amazon Web S sub get_amazon_details { my ( $isbn, $record, $marcflavour ) = @_; - #normalize the ISBN - $isbn = _normalize_match_point ($isbn); - - my $upc = _get_amazon_upc($record,$marcflavour); - my $ean = _get_amazon_ean($record,$marcflavour); + # Normalize the fields + $isbn = GetNormalizedISBN($isbn); + my $upc = GetNormalizedUPC($record,$marcflavour); + my $ean = GetNormalizedEAN($record,$marcflavour); # warn "ISBN: $isbn | UPC: $upc | EAN: $ean"; @@ -155,64 +155,6 @@ sub check_search_inside { return $available; } -sub _get_amazon_upc { - my ($record,$marcflavour) = @_; - my (@fields,$upc); - - if ($marcflavour eq 'MARC21') { - @fields = $record->field('024'); - foreach my $field (@fields) { - my $indicator = $field->indicator(1); - my $upc = _normalize_match_point($field->subfield('a')); - if ($indicator == 1 and $upc ne '') { - return $upc; - } - } - } - else { # assume unimarc if not marc21 - @fields = $record->field('072'); - foreach my $field (@fields) { - my $upc = _normalize_match_point($field->subfield('a')); - if ($upc ne '') { - return $upc; - } - } - } -} - -sub _get_amazon_ean { - my ($record,$marcflavour) = @_; - my (@fields,$ean); - - if ($marcflavour eq 'MARC21') { - @fields = $record->field('024'); - foreach my $field (@fields) { - my $indicator = $field->indicator(1); - my $upc = _normalize_match_point($field->subfield('a')); - if ($indicator == 3 and $upc ne '') { - return $upc; - } - } - } - else { # assume unimarc if not marc21 - @fields = $record->field('073'); - foreach my $field (@fields) { - my $upc = _normalize_match_point($field->subfield('a')); - if ($upc ne '') { - return $upc; - } - } - } -} - -sub _normalize_match_point { - my $match_point = shift; - (my $normalized_match_point) = $match_point =~ /([\d-]*[X]*)/; - $normalized_match_point =~ s/-//g; - - return $normalized_match_point; -} - 1; __END__ diff --git a/C4/External/Syndetics.pm b/C4/External/Syndetics.pm index b54a6d5b8f..3be2a29833 100644 --- a/C4/External/Syndetics.pm +++ b/C4/External/Syndetics.pm @@ -54,7 +54,7 @@ This module provides facilities for retrieving Syndetics.com content in Koha =over 4 -my $syndetics_summary= &get_syndetics_summary( $xisbn ); +my $syndetics_summary= &get_syndetics_summary( $isbn ); =back @@ -63,10 +63,7 @@ Get Summary data from Syndetics =cut sub get_syndetics_index { - my ( $isbn ) = @_; - - #normalize the ISBN - $isbn = _normalize_match_point ($isbn); + my ( $isbn,$upc,$oclc ) = @_; # grab the AWSAccessKeyId: mine is '0V5RRRRJZ3HR2RQFNHR2' my $syndetics_client_code = C4::Context->preference('SyndeticsClientCode'); @@ -98,10 +95,7 @@ sub get_syndetics_index { } sub get_syndetics_summary { - my ( $isbn ) = @_; - - #normalize the ISBN - $isbn = _normalize_match_point ($isbn); + my ( $isbn,$upc,$oclc ) = @_; # grab the AWSAccessKeyId: mine is '0V5RRRRJZ3HR2RQFNHR2' my $syndetics_client_code = C4::Context->preference('SyndeticsClientCode'); @@ -130,10 +124,7 @@ sub get_syndetics_summary { } sub get_syndetics_toc { - my ( $isbn ) = @_; - - #normalize the ISBN - $isbn = _normalize_match_point ($isbn); + my ( $isbn,$upc,$oclc ) = @_; # grab the AWSAccessKeyId: mine is '0V5RRRRJZ3HR2RQFNHR2' my $syndetics_client_code = C4::Context->preference('SyndeticsClientCode'); @@ -162,10 +153,7 @@ sub get_syndetics_toc { } sub get_syndetics_excerpt { - my ( $isbn ) = @_; - - #normalize the ISBN - $isbn = _normalize_match_point ($isbn); + my ( $isbn,$upc,$oclc ) = @_; # grab the AWSAccessKeyId: mine is '0V5RRRRJZ3HR2RQFNHR2' my $syndetics_client_code = C4::Context->preference('SyndeticsClientCode'); @@ -193,10 +181,7 @@ sub get_syndetics_excerpt { } sub get_syndetics_reviews { - my ( $isbn, $syndetics_elements ) = @_; - - #normalize the ISBN - $isbn = _normalize_match_point ($isbn); + my ( $isbn,$upc,$oclc,$syndetics_elements ) = @_; # grab the AWSAccessKeyId: mine is '0V5RRRRJZ3HR2RQFNHR2' my $syndetics_client_code = C4::Context->preference('SyndeticsClientCode'); @@ -260,10 +245,7 @@ sub get_syndetics_reviews { } sub get_syndetics_editions { - my ( $isbn ) = @_; - - #normalize the ISBN - $isbn = _normalize_match_point ($isbn); + my ( $isbn,$upc,$oclc ) = @_; # grab the AWSAccessKeyId: mine is '0V5RRRRJZ3HR2RQFNHR2' my $syndetics_client_code = C4::Context->preference('SyndeticsClientCode'); @@ -293,10 +275,7 @@ sub get_syndetics_editions { } sub get_syndetics_anotes { - my ( $isbn ) = @_; - - #normalize the ISBN - $isbn = _normalize_match_point ($isbn); + my ( $isbn,$upc,$oclc) = @_; # grab the AWSAccessKeyId: mine is '0V5RRRRJZ3HR2RQFNHR2' my $syndetics_client_code = C4::Context->preference('SyndeticsClientCode'); @@ -336,14 +315,6 @@ sub get_syndetics_anotes { return \@anotes; } -sub _normalize_match_point { - my $match_point = shift; - (my $normalized_match_point) = $match_point =~ /([\d-]*[X]*)/; - $normalized_match_point =~ s/-//g; - - return $normalized_match_point; -} - 1; __END__ diff --git a/C4/Koha.pm b/C4/Koha.pm index 10fccbebd8..290ef40db6 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -53,6 +53,10 @@ BEGIN { &GetKohaAuthorisedValues &GetAuthValCode &GetManagedTagSubfields + &GetNormalizedUPC + &GetNormalizedISBN + &GetNormalizedEAN + &GetNormalizedOCLCNumber $DEBUG ); @@ -1132,6 +1136,131 @@ sub display_marc_indicators { return $indicators; } +sub GetNormalizedUPC { + my ($record,$marcflavour) = @_; + my (@fields,$upc); + + if ($marcflavour eq 'MARC21') { + @fields = $record->field('024'); + foreach my $field (@fields) { + my $indicator = $field->indicator(1); + my $upc = _normalize_match_point($field->subfield('a')); + if ($indicator == 1 and $upc ne '') { + return $upc; + } + } + } + else { # assume unimarc if not marc21 + @fields = $record->field('072'); + foreach my $field (@fields) { + my $upc = _normalize_match_point($field->subfield('a')); + if ($upc ne '') { + return $upc; + } + } + } +} + +# Normalizes and returns the first valid ISBN found in the record +sub GetNormalizedISBN { + my ($isbn,$record,$marcflavour) = @_; + my @fields; + if ($isbn) { + return _isbn_cleanup($isbn); + } + return undef unless $record; + + if ($marcflavour eq 'MARC21') { + @fields = $record->field('020'); + foreach my $field (@fields) { + $isbn = $field->subfield('a'); + if ($isbn) { + return _isbn_cleanup($isbn); + } else { + return undef; + } + } + } + else { # assume unimarc if not marc21 + @fields = $record->field('010'); + foreach my $field (@fields) { + my $isbn = $field->subfield('a'); + if ($isbn) { + return _isbn_cleanup($isbn); + } else { + return undef; + } + } + } + +} + +sub GetNormalizedEAN { + my ($record,$marcflavour) = @_; + my (@fields,$ean); + + if ($marcflavour eq 'MARC21') { + @fields = $record->field('024'); + foreach my $field (@fields) { + my $indicator = $field->indicator(1); + $ean = _normalize_match_point($field->subfield('a')); + if ($indicator == 3 and $ean ne '') { + return $ean; + } + } + } + else { # assume unimarc if not marc21 + @fields = $record->field('073'); + foreach my $field (@fields) { + $ean = _normalize_match_point($field->subfield('a')); + if ($ean ne '') { + return $ean; + } + } + } +} +sub GetNormalizedOCLCNumber { + my ($record,$marcflavour) = @_; + my (@fields,$oclc); + + if ($marcflavour eq 'MARC21') { + @fields = $record->field('035'); + foreach my $field (@fields) { + $oclc = $field->subfield('a'); + if ($oclc =~ /OCoLC/) { + $oclc =~ s/\(OCoLC\)//; + return $oclc; + } else { + return undef; + } + } + } + else { # TODO: add UNIMARC fields + } +} + +sub _normalize_match_point { + my $match_point = shift; + (my $normalized_match_point) = $match_point =~ /([\d-]*[X]*)/; + $normalized_match_point =~ s/-//g; + + return $normalized_match_point; +} + +sub _isbn_cleanup ($) { + my $normalized_isbn = shift; + $normalized_isbn =~/([0-9]{1,})/; + $normalized_isbn = $1; + if ( + $normalized_isbn =~ /\b(\d{13})\b/ or + $normalized_isbn =~ /\b(\d{10})\b/ or + $normalized_isbn =~ /\b(\d{9}X)\b/i + ) { + return $1; + } + return undef; +} + 1; __END__ diff --git a/C4/Search.pm b/C4/Search.pm index 8bcf2389e1..5a3a3a69ed 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1263,6 +1263,7 @@ sub searchResults { $times = $hits; # FIXME: if $hits is undefined, why do we want to equal it? } + my $marcflavour = C4::Context->preference("marcflavour"); # loop through all of the records we've retrieved for ( my $i = $offset ; $i <= $times - 1 ; $i++ ) { my $marcrecord = MARC::File::USMARC::decode( $marcresults[$i] ); @@ -1274,9 +1275,10 @@ sub searchResults { $oldbiblio->{imageurl} = getitemtypeimagelocation( 'opac', $itemtypes{ $oldbiblio->{itemtype} }->{imageurl} ); $oldbiblio->{'authorised_value_images'} = C4::Items::get_authorised_value_images( C4::Biblio::get_biblio_authorised_values( $oldbiblio->{'biblionumber'}, $marcrecord ) ); - (my $aisbn) = $oldbiblio->{isbn} =~ /([\d-]*[X]*)/; - $aisbn =~ s/-//g; - $oldbiblio->{amazonisbn} = $aisbn; + $oldbiblio->{normalized_upc} = GetNormalizedUPC($marcrecord,$marcflavour); + $oldbiblio->{normalized_ean} = GetNormalizedEAN($marcrecord,$marcflavour); + $oldbiblio->{normalized_oclc} = GetNormalizedOCLCNumber($marcrecord,$marcflavour); + $oldbiblio->{normalized_isbn} = GetNormalizedISBN(undef,$marcrecord,$marcflavour); $oldbiblio->{description} = $itemtypes{ $oldbiblio->{itemtype} }->{description}; # Build summary if there is one (the summary is defined in the itemtypes table) # FIXME: is this used anywhere, I think it can be commented out? -- JF @@ -1527,8 +1529,6 @@ s/\[(.?.?.?.?)$tagsubf(.*?)]/$1$subfieldvalue$2\[$1$tagsubf$2]/g; $oldbiblio->{damagedcount} = $itemdamaged_count; $oldbiblio->{intransitcount} = $item_in_transit_count; $oldbiblio->{orderedcount} = $ordered_count; - $oldbiblio->{isbn} =~ - s/-//g; # deleting - in isbn to enable amazon content push( @newresults, $oldbiblio ); } return @newresults; diff --git a/C4/XISBN.pm b/C4/XISBN.pm index 58a75b5502..8e97b6afc4 100644 --- a/C4/XISBN.pm +++ b/C4/XISBN.pm @@ -21,6 +21,7 @@ use XML::Simple; #use LWP::Simple; use C4::Biblio; use C4::Items; +use C4::Koha; use C4::External::Syndetics qw(get_syndetics_editions); use LWP::UserAgent; use HTTP::Request::Common; @@ -34,16 +35,13 @@ BEGIN { @ISA = qw(Exporter); @EXPORT_OK = qw( &get_xisbns - &get_biblio_from_xisbn &get_biblionumber_from_isbn ); } sub get_biblionumber_from_isbn { my $isbn = shift; - if ($isbn =~ /(\d{9,}[X]*)/) { - $isbn = $1.'%'; - } + $isbn.='%'; my @biblionumbers; my $dbh=C4::Context->dbh; my $query = "SELECT biblionumber FROM biblioitems WHERE isbn LIKE ? LIMIT 10"; @@ -61,9 +59,9 @@ This module provides facilities for retrieving ThingISBN and XISBN content in Ko =cut -sub get_biblio_from_xisbn { +sub _get_biblio_from_xisbn { my $xisbn = shift; - $xisbn .='%' if ($xisbn =~ /(\d{9,}[X]*)/); + $xisbn.='%'; my $dbh = C4::Context->dbh; my $query = "SELECT biblionumber FROM biblioitems WHERE isbn LIKE ?"; my $sth = $dbh->prepare($query); @@ -72,8 +70,7 @@ sub get_biblio_from_xisbn { my $xbiblio; if ($xbib_data->{biblionumber}) { $xbiblio = GetBiblioData($xbib_data->{biblionumber}); - $xbiblio->{isbn} =~ /(\d{9,}[X]*)/; - $xbiblio->{amazonisbn} = $1; + $xbiblio->{normalized_isbn} = GetNormalizedISBN($xbiblio->{isbn}); $xbiblio->{items} = GetItemsByBiblioitemnumber($xbib_data->{biblionumber}); } return ($xbiblio); @@ -88,8 +85,6 @@ sub get_biblio_from_xisbn { sub get_xisbns { my ( $isbn ) = @_; my ($response,$thing_response,$xisbn_response,$gapines_response,$syndetics_response); - $isbn =~ /(\d{9,}[X]*)/; - $isbn = $1; # THINGISBN if ( C4::Context->preference('ThingISBN') ) { my $url = "http://www.librarything.com/api/thingISBN/".$isbn; @@ -132,8 +127,8 @@ sub get_xisbns { next if $isbn eq $response_data; next if $unique_xisbns->{ $response_data->{content} }; $unique_xisbns->{ $response_data->{content} }++; - my $xbiblio= get_biblio_from_xisbn($response_data->{content}); - push @xisbns, $xbiblio if $xbiblio; #response_data->{xbiblio}; #->{biblionumber}; # if $xbiblionumber; + my $xbiblio= _get_biblio_from_xisbn($response_data->{content}); + push @xisbns, $xbiblio if $xbiblio; } return \@xisbns; } diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl index 3f92a77aad..a33cc169ea 100755 --- a/admin/systempreferences.pl +++ b/admin/systempreferences.pl @@ -217,12 +217,14 @@ $tabsysprefs{QueryRemoveStopwords} = "Searching"; $tabsysprefs{AdvancedSearchTypes} = "Searching"; # EnhancedContent -$tabsysprefs{AmazonContent} = "EnhancedContent"; +$tabsysprefs{AmazonEnabled} = "EnhancedContent"; +$tabsysprefs{OPACAmazonEnabled} = "EnhancedContent"; +$tabsysprefs{AmazonCoverImages} = "EnhancedContent"; +$tabsysprefs{OPACAmazonCoverImages} = "EnhancedContent"; $tabsysprefs{AWSAccessKeyID} = "EnhancedContent"; $tabsysprefs{AmazonLocale} = "EnhancedContent"; $tabsysprefs{AmazonAssocTag} = "EnhancedContent"; $tabsysprefs{AmazonSimilarItems} = "EnhancedContent"; -$tabsysprefs{OPACAmazonContent} = "EnhancedContent"; $tabsysprefs{OPACAmazonSimilarItems} = "EnhancedContent"; # Baker & Taylor @@ -243,6 +245,7 @@ $tabsysprefs{SyndeticsReviews} = 'EnhancedContent'; $tabsysprefs{SyndeticsAuthorNotes} = 'EnhancedContent'; $tabsysprefs{SyndeticsAwards} = 'EnhancedContent'; $tabsysprefs{SyndeticsSeries} = 'EnhancedContent'; +$tabsysprefs{SyndeticsCoverImageSize} = 'EnhancedContent'; # FRBR diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 363f2dc657..bdc935c20a 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -32,7 +32,7 @@ use C4::Branch; use C4::Reserves; use C4::Members; use C4::Serials; -use C4::XISBN qw(get_xisbns get_biblionumber_from_isbn get_biblio_from_xisbn); +use C4::XISBN qw(get_xisbns get_biblionumber_from_isbn); use C4::External::Amazon; # use Smart::Comments; @@ -55,6 +55,21 @@ my $fw = GetFrameworkCode($biblionumber); my $marcflavour = C4::Context->preference("marcflavour"); my $record = GetMarcBiblio($biblionumber); +# some useful variables for enhanced content; +# in each case, we're grabbing the first value we find in +# the record and normalizing it +my $upc = GetNormalizedUPC($record,$marcflavour); +my $ean = GetNormalizedEAN($record,$marcflavour); +my $oclc = GetNormalizedOCLCNumber($record,$marcflavour); +my $isbn = GetNormalizedISBN(undef,$record,$marcflavour); + +$template->param( + normalized_upc => $upc, + normalized_ean => $ean, + normalized_oclc => $oclc, + normalized_isbn => $isbn, +); + unless (defined($record)) { print $query->redirect("/cgi-bin/koha/errors/404.pl"); exit; @@ -195,21 +210,17 @@ $template->param( # $debug and $template->param(debug_display => 1); # XISBN Stuff -my $xisbn=$dat->{'isbn'}; -$xisbn =~ /(\d*[X]*)/ if ( $xisbn ); -$template->param(amazonisbn => $1); # FIXME: so it is OK if the ISBN = 'XXXXX' ? if (C4::Context->preference("FRBRizeEditions")==1) { eval { $template->param( - xisbn => $xisbn, - XISBNS => get_xisbns($xisbn) + XISBNS => get_xisbns($isbn) ); }; if ($@) { warn "XISBN Failed $@"; } } -if ( C4::Context->preference("AmazonContent") == 1 ) { +if ( C4::Context->preference("AmazonEnabled") == 1 ) { my $similar_products_exist; - my $amazon_details = &get_amazon_details( $xisbn, $record, $marcflavour ); + my $amazon_details = &get_amazon_details( $isbn, $record, $marcflavour ); my $item_attributes = \%{$amazon_details->{Items}->{Item}->{ItemAttributes}}; my $customer_reviews = \@{$amazon_details->{Items}->{Item}->{CustomerReviews}->{Review}}; my @similar_products; diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql index c79a727e67..ef70ba651e 100644 --- a/installer/data/mysql/en/mandatory/sysprefs.sql +++ b/installer/data/mysql/en/mandatory/sysprefs.sql @@ -1,8 +1,8 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('acquisitions','normal','Choose Normal, budget-based acquisitions, or Simple bibliographic-data acquisitions','simple|normal','Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('advancedMARCeditor',0,'If ON, the MARC editor won\'t display field/subfield descriptions','','YesNo'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AmazonContent',0,'Turn ON Amazon Content - You MUST set AWSAccessKeyID and AmazonAssocTag if enabled','','YesNo'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AmazonEnabled',0,'Turn ON Amazon Content - You MUST set AWSAccessKeyID and AmazonAssocTag if enabled','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AmazonSimilarItems',0,'Turn ON Amazon Similar Items feature - You MUST set AWSAccessKeyID and AmazonAssocTag if enabled','','YesNo'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACAmazonContent',0,'Turn ON Amazon Content in the OPAC - You MUST set AWSAccessKeyID and AmazonAssocTag if enabled','','YesNo'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACAmazonEnabled',0,'Turn ON Amazon Content in the OPAC - You MUST set AWSAccessKeyID and AmazonAssocTag if enabled','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACAmazonSimilarItems',0,'Turn ON Amazon Similar Items feature - You MUST set AWSAccessKeyID and AmazonAssocTag if enabled','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AmazonLocale','US','Use to set the Locale of your Amazon.com Web Services','US|CA|DE|FR|JP|UK','Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AWSAccessKeyID','','See: http://aws.amazon.com','','free'); @@ -215,3 +215,17 @@ INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'UseBranchTransferLimits', '0', '', 'If ON, Koha will will use the rules defined in branch_transfer_limits to decide if an item transfer should be allowed.', 'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowHoldPolicyOverride', '0', 'Allow staff to override hold policies when placing holds',NULL,'YesNo'); INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'BranchTransferLimitsType', 'ccode', 'itemtype|ccode', 'When using branch transfer limits, choose whether to limit by itemtype or collection code.', 'Choice'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsClientCode', '0', 'Client Code for using Syndetics Solutions content','','free'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsEnabled', '0', 'Turn on Syndetics Enhanced Content','','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsCoverImages', '0', 'Display Cover Images from Syndetics','','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsTOC', '0', 'Display Table of Content information from Syndetics','','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsSummary', '0', 'Display Summary Information from Syndetics','','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsEditions', '0', 'Display Editions from Syndetics','','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsExcerpt', '0', 'Display Excerpts and first chapters on OPAC from Syndetics','','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsReviews', '0', 'Display Reviews on OPAC from Syndetics','','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsAuthorNotes', '0', 'Display Notes about the Author on OPAC from Syndetics','','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsAwards', '0', 'Display Awards on OPAC from Syndetics','','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsSeries', '0', 'Display Series information on OPAC from Syndetics','','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsCoverImageSize', 'MC', 'Choose the size of the Syndetics Cover Image to display on the OPAC detail page, MC is Medium, LC is Large','MC|LC','Choice'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACAmazonCoverImages', '0', 'Display cover images on OPAC from Amazon Web Services','','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('AmazonCoverImages', '0', 'Display Cover Images in Staff Client from Amazon Web Services','','YesNo'); diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql index 34691062d2..877b493eee 100644 --- a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql +++ b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql @@ -1,8 +1,8 @@ set NAMES 'utf8'; INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('advancedMARCeditor', '0', 'Si ce paramètre est mis à 1, l''éditeur MARC n''affichera pas les libellés des champs/sous-champs, seulement leur code. Devrait être à 0 dans la plupart des cas.', '', ''); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AmazonContent', '0', 'Ce paramètre active la récupération des images de couverture sur Amazon. Vous DEVEZ positionner AmazonDevKey AmazonAssocTag si vous activez cette option', '', 'YesNo'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AmazonEnabled', '0', 'Ce paramètre active la récupération des images de couverture sur Amazon. Vous DEVEZ positionner AmazonDevKey AmazonAssocTag si vous activez cette option', '', 'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AmazonSimilarItems','0','Active ou non les fonctions Amazon ''les lecteurs ayant acheté...'' - Vous DEVEZ définir AmazonDevKey et AmazonAssocTag si vous activez cette fonction','','YesNo'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACAmazonContent','0','Active ou non l''affichage du contenu Amazon à l''OPAC. - Vous DEVEZ définir AmazonDevKey et AmazonAssocTag si vous activez cette fonction','','YesNo'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACAmazonEnabled','0','Active ou non l''affichage du contenu Amazon à l''OPAC. - Vous DEVEZ définir AmazonDevKey et AmazonAssocTag si vous activez cette fonction','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACAmazonSimilarItems','0','Active ou non les fonctions Amazon ''Les lecteurs ayant acheté...'' - Vous DEVEZ définir AmazonDevKey et AmazonAssocTag si vous activez cette fonction','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AmazonLocale','US','Use to set the Locale of your Amazon.com Web Services','US|CA|DE|FR|JP|UK','Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AWSAccessKeyID','','See: http://aws.amazon.com','','free'); @@ -217,3 +217,17 @@ INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'UseBranchTransferLimits', '0', '', 'If ON, Koha will will use the rules defined in branch_transfer_limits to decide if an item transfer should be allowed.', 'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowHoldPolicyOverride', '0', "Autorise le personnel á outrepasser la politique de réservation au moment d'une réservation",NULL,'YesNo'); INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ('BranchTransferLimitsType', 'ccode', 'itemtype|ccode', 'When using branch transfer limits, choose whether to limit by itemtype or collection code.', 'Choice'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsClientCode', '0', 'Client Code for using Syndetics Solutions content','','free'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsEnabled', '0', 'Turn on Syndetics Enhanced Content','','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsCoverImages', '0', 'Display Cover Images from Syndetics','','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsTOC', '0', 'Display Table of Content information from Syndetics','','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsSummary', '0', 'Display Summary Information from Syndetics','','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsEditions', '0', 'Display Editions from Syndetics','','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsExcerpt', '0', 'Display Excerpts and first chapters on OPAC from Syndetics','','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsReviews', '0', 'Display Reviews on OPAC from Syndetics','','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsAuthorNotes', '0', 'Display Notes about the Author on OPAC from Syndetics','','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsAwards', '0', 'Display Awards on OPAC from Syndetics','','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsSeries', '0', 'Display Series information on OPAC from Syndetics','','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsCoverImageSize', 'MC', 'Choose the size of the Syndetics Cover Image to display on the OPAC detail page, MC is Medium, LC is Large','MC|LC','Choice'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACAmazonCoverImages', '0', 'Display cover images on OPAC from Amazon Web Services','','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('AmazonCoverImages', '0', 'Display Cover Images in Staff Client from Amazon Web Services','','YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 140c26d4f6..7e161b5cb1 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -2219,33 +2219,6 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { print "Upgrade to $DBversion done (data for Email Checkout Slips project)\n"; SetVersion ($DBversion); - } - $DBversion = '3.01.00.013'; - if (C4::Context->preference("Version") < TransformToNum($DBversion)) { - $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsClientCode', '0', 'Client Code for using Syndetics Solutions content','','free')"); - - $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsEnabled', '0', 'Turn on Syndetics Enhanced Content','','YesNo')"); - - $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsCoverImages', '0', 'Display Cover Images from Syndetics','','YesNo')"); - - $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsTOC', '0', 'Display Table of Content information from Syndetics','','YesNo')"); - - $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsSummary', '0', 'Display Summary Information from Syndetics','','YesNo')"); - - $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsEditions', '0', 'Display Editions from Syndetics','','YesNo')"); - - $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsExcerpt', '0', 'Display Excerpts and first chapters on OPAC from Syndetics','','YesNo')"); - - $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsReviews', '0', 'Display Reviews on OPAC from Syndetics','','YesNo')"); - - $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsAuthorNotes', '0', 'Display Notes about the Author on OPAC from Syndetics','','YesNo')"); - - $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsAwards', '0', 'Display Awards on OPAC from Syndetics','','YesNo')"); - - $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsSeries', '0', 'Display Series information on OPAC from Syndetics','','YesNo')"); - - print "Upgrade to $DBversion done (added Syndetics Enhanced Content system preferences)\n"; - SetVersion ($DBversion); } $DBversion = "3.01.00.014"; @@ -2261,6 +2234,43 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = '3.01.00.015'; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsClientCode', '0', 'Client Code for using Syndetics Solutions content','','free')"); + + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsEnabled', '0', 'Turn on Syndetics Enhanced Content','','YesNo')"); + + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsCoverImages', '0', 'Display Cover Images from Syndetics','','YesNo')"); + + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsTOC', '0', 'Display Table of Content information from Syndetics','','YesNo')"); + + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsSummary', '0', 'Display Summary Information from Syndetics','','YesNo')"); + + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsEditions', '0', 'Display Editions from Syndetics','','YesNo')"); + + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsExcerpt', '0', 'Display Excerpts and first chapters on OPAC from Syndetics','','YesNo')"); + + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsReviews', '0', 'Display Reviews on OPAC from Syndetics','','YesNo')"); + + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsAuthorNotes', '0', 'Display Notes about the Author on OPAC from Syndetics','','YesNo')"); + + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsAwards', '0', 'Display Awards on OPAC from Syndetics','','YesNo')"); + + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsSeries', '0', 'Display Series information on OPAC from Syndetics','','YesNo')"); + + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsCoverImageSize', 'MC', 'Choose the size of the Syndetics Cover Image to display on the OPAC detail page, MC is Medium, LC is Large','MC|LC','Choice')"); + + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACAmazonCoverImages', '0', 'Display cover images on OPAC from Amazon Web Services','','YesNo')"); + + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('AmazonCoverImages', '0', 'Display Cover Images in Staff Client from Amazon Web Services','','YesNo')"); + + $dbh->do("UPDATE systempreferences SET variable='AmazonEnabled' WHERE variable = 'AmazonContent'"); + + $dbh->do("UPDATE systempreferences SET variable='OPACAmazonEnabled' WHERE variable = 'OPACAmazonContent'"); + + print "Upgrade to $DBversion done (added Syndetics Enhanced Content system preferences)\n"; + SetVersion ($DBversion); +} =item DropAllForeignKeys($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl index eed75363ba..194da801ff 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl @@ -32,7 +32,7 @@ function verify_images() { $(document).ready(function() { $('#bibliodetails > ul').tabs(); }); - $(window).load(function() { + $(window).load(function() { verify_images(); }); //]]> @@ -53,7 +53,7 @@ function verify_images() {
-
+

@@ -98,13 +98,13 @@ function verify_images() {
- +
    - -
  • ISBN:
  • + +
  • ISBN:
  • ISSN:
  • @@ -291,7 +291,7 @@ function verify_images() {
    - +

    From :

    @@ -314,7 +314,7 @@ function verify_images() {

    Editions

    -
    /ref=sib_dp_pt/002-7879865-0184864#reader-link">.01._AA75_PU_PU-5_.jpg" />" alt="" title=""> +
    /ref=sib_dp_pt/002-7879865-0184864#reader-link">.01._AA75_PU_PU-5_.jpg" />" alt="" title=""> "> by © () , @@ -327,7 +327,7 @@ function verify_images() {
    - +