Error: Failed to upload file. See logs for details.
+ + [% ELSE %] +A file has already been uploaded for this field. Do you want to delete it?
+ + [% END %] + +[% END %] + + + --- a/kohaversion.pl +++ a/kohaversion.pl @@ -16,7 +16,7 @@ the kohaversion is divided in 4 parts : use strict; sub kohaversion { - our $VERSION = '3.07.00.007'; + our $VERSION = 'XXX'; # version needs to be set this way # so that it can be picked up by Makefile.PL # during install --- a/misc/strip_value_from_tag.pl +++ a/misc/strip_value_from_tag.pl @@ -0,0 +1,60 @@ +#!/usr/bin/perl + +# This script takes every biblio record in the database, +# looks for a value beginning with $find in $fieldtag$$subfieldtag +# and strips $find from this value. +# This was originally made for the file upload plugin, but might +# be used for other purposes. + +use strict; + +use Getopt::Long; +use C4::Context; +use C4::Biblio; + +my $debug = 0; + +# Which field are we processing? +my $fieldtag = "857"; +my $subfieldtag = "u"; + +# Whichi beginning pattern are we looking to delete? +my $find = "http://myurl.tld/"; +my $length = length($find); +my $pattern = qr|^$find|; + +print "Field $fieldtag\$$subfieldtag\n"; + +# Getting db connection +my $dbh = C4::Context->dbh; + +# Getting max bibnumber +my $query = "SELECT MAX(biblionumber) from biblio"; +my $sth = $dbh->prepare($query); +$sth->execute(); +my $bibliocount = $sth->fetchrow; + +warn "unable to get biblio count" and exit -1 unless $bibliocount; + +print "Biblio count : $bibliocount\n"; + +# Foreach each biblio +foreach (1..$bibliocount) { + my $found = 0; + my $record = GetMarcBiblio($_); + $debug and warn "unable to get marc for record $_" unless $record; + next unless $record; + foreach my $field ($record->field($fieldtag)) { + my $newfield = $field->clone(); + my $subfield = $newfield->subfield($subfieldtag); + if ($subfield and $subfield =~ $pattern) { + my $newsubfield = substr $subfield, $length; + $newsubfield =~ s/\s+$//; + $newfield->update($subfieldtag, $newsubfield); + $field->replace_with($newfield); + $found = 1; + } + } + print "processing $_\n" if ($found == 1); + ModBiblioMarc($record, $_, GetFrameworkCode($_)) if ($found == 1); +} --- a/opac/opac-MARCdetail.pl +++ a/opac/opac-MARCdetail.pl @@ -90,6 +90,11 @@ if (C4::Context->preference("RequestOnOpac")) { $RequestOnOpac = 1; } +my $uploadWebPath; +if (C4::Context->preference('uploadWebPath')) { + $uploadWebPath = C4::Context->preference('uploadWebPath'); +} + # fill arrays my @loop_data = (); my $tag; @@ -161,6 +166,11 @@ for ( my $tabloop = 0 ; $tabloop <= 10 ; $tabloop++ ) { } $subfield_data{marc_value} = GetAuthorisedValueDesc( $fields[$x_i]->tag(), $subf[$i][0], $subf[$i][1], '', $tagslib, '', 'opac' ); + if ($tagslib->{ $fields[$x_i]->tag() }->{ $subf[$i][0] }->{value_builder} eq "upload.pl" and $uploadWebPath) { + my $file_uri = qq($uploadWebPath/$subf[$i][1]); + $subfield_data{marc_value} = qq/$subfield_data{marc_value}<\/a>/; + } + } $subfield_data{marc_subfield} = $subf[$i][0]; $subfield_data{marc_tag} = $fields[$x_i]->tag(); --- a/opac/opac-basket.pl +++ a/opac/opac-basket.pl @@ -67,7 +67,7 @@ foreach my $biblionumber ( @bibs ) { my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour ); my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); my $marcseriesarray = GetMarcSeries ($record,$marcflavour); - my $marcurlsarray = GetMarcUrls ($record,$marcflavour); + my $marcurlsarray = GetMarcUrls ($record, $marcflavour, GetFrameworkCode($biblionumber)); my @items = &GetItemsLocationInfo( $biblionumber ); my $subtitle = GetRecordValue('subtitle', $record, GetFrameworkCode($biblionumber)); --- a/opac/opac-detail.pl +++ a/opac/opac-detail.pl @@ -529,7 +529,7 @@ my $marcisbnsarray = GetMarcISBN ($record,$marcflavour); my $marcauthorsarray = GetMarcAuthors ($record,$marcflavour); my $marcsubjctsarray = GetMarcSubjects($record,$marcflavour); my $marcseriesarray = GetMarcSeries ($record,$marcflavour); -my $marcurlsarray = GetMarcUrls ($record,$marcflavour); +my $marcurlsarray = GetMarcUrls ($record, $marcflavour, $dat->{'frameworkcode'}); my $marchostsarray = GetMarcHosts($record,$marcflavour); my $subtitle = GetRecordValue('subtitle', $record, GetFrameworkCode($biblionumber)); --- a/opac/opac-retrieve-file.pl +++ a/opac/opac-retrieve-file.pl @@ -0,0 +1,33 @@ +#!/usr/bin/perl + +use Modern::Perl; + +use CGI; + +use C4::Context; +use C4::UploadedFiles; + +my $input = new CGI; + +my $id = $input->param('id'); +my $file = C4::UploadedFiles::GetUploadedFile($id); +exit 1 if not $file; + +my $upload_path = C4::Context->preference("uploadPath"); +$upload_path =~ s#/$##; +my $file_path = "$upload_path/$file->{id}"; + +if( -f $file_path ) { + open FH, '<', $file_path or die "Can't open file: $!"; + print $input->header( + -type => "application/octet-stream", + -attachment => $file->{filename} + ); + while(