@@ -, +, @@ --- Koha/Upload.pm | 16 ++++++------ .../data/mysql/atomicupdate/14321b_category.sql | 1 + installer/data/mysql/kohastructure.sql | 2 +- .../intranet-tmpl/prog/en/modules/tools/upload.tt | 27 +++++++++++++++++--- t/db_dependent/Upload.t | 6 ++--- 5 files changed, 36 insertions(+), 16 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/14321b_category.sql --- a/Koha/Upload.pm +++ a/Koha/Upload.pm @@ -170,7 +170,7 @@ sub get { my ( @rv, $res); foreach my $r ( @$temp ) { undef $res; - foreach( qw[id hashvalue filesize categorycode public permanent] ) { + foreach( qw[id hashvalue filesize uploadcategorycode public permanent] ) { $res->{$_} = $r->{$_}; } $res->{name} = $r->{filename}; @@ -340,8 +340,8 @@ sub _done { sub _register { my ( $self, $filename, $size ) = @_; my $dbh= C4::Context->dbh; - my $sql= "INSERT INTO uploaded_files (hashvalue, filename, dir, filesize, - owner, categorycode, public, permanent) VALUES (?,?,?,?,?,?,?,?)"; + my $sql= 'INSERT INTO uploaded_files (hashvalue, filename, dir, filesize, + owner, uploadcategorycode, public, permanent) VALUES (?,?,?,?,?,?,?,?)'; my @pars= ( $self->{files}->{$filename}->{hash}, $filename, @@ -361,24 +361,24 @@ sub _lookup { my ( $self, $params ) = @_; my $dbh = C4::Context->dbh; my $sql = q| -SELECT id,hashvalue,filename,dir,filesize,categorycode,public,permanent +SELECT id,hashvalue,filename,dir,filesize,uploadcategorycode,public,permanent FROM uploaded_files |; my @pars; if( $params->{id} ) { return [] if $params->{id} !~ /^\d+(,\d+)*$/; - $sql.= "WHERE id IN ($params->{id})"; + $sql.= 'WHERE id IN ('.$params->{id}.')'; @pars = (); } elsif( $params->{hashvalue} ) { - $sql.= "WHERE hashvalue=?"; + $sql.= 'WHERE hashvalue=?'; @pars = ( $params->{hashvalue} ); } elsif( $params->{term} ) { - $sql.= "WHERE (filename LIKE ? OR hashvalue LIKE ?)"; + $sql.= 'WHERE (filename LIKE ? OR hashvalue LIKE ?)'; @pars = ( '%'.$params->{term}.'%', '%'.$params->{term}.'%' ); } else { return []; } - $sql.= $self->{public}? " AND public=1": ''; + $sql.= $self->{public}? ' AND public=1': ''; $sql.= ' ORDER BY id'; my $temp= $dbh->selectall_arrayref( $sql, { Slice => {} }, @pars ); return $temp; --- a/installer/data/mysql/atomicupdate/14321b_category.sql +++ a/installer/data/mysql/atomicupdate/14321b_category.sql @@ -0,0 +1, @@ +ALTER TABLE uploaded_files CHANGE COLUMN categorycode uploadcategorycode tinytext; --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -3359,7 +3359,7 @@ CREATE TABLE uploaded_files ( dir TEXT NOT NULL, filesize int(11), dtcreated timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - categorycode tinytext, + uploadcategorycode tinytext, owner int(11), public tinyint, permanent tinyint, --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt @@ -70,9 +70,8 @@ [% IF plugin %] [% ELSE %] - + - Allow public downloads [% END %] @@ -133,6 +132,16 @@ [% END %] [% END %] +[% BLOCK back %] + [% IF !plugin %] +
+ [% END %] +[% END %] + [% BLOCK newsearch %]