Lines 75-80
use base qw(Class::Accessor);
Link Here
|
75 |
|
75 |
|
76 |
use C4::Context; |
76 |
use C4::Context; |
77 |
use C4::Koha; |
77 |
use C4::Koha; |
|
|
78 |
use Koha::UploadedFile; |
78 |
|
79 |
|
79 |
__PACKAGE__->mk_ro_accessors( qw|| ); |
80 |
__PACKAGE__->mk_ro_accessors( qw|| ); |
80 |
|
81 |
|
Lines 365-386
sub _done {
Link Here
|
365 |
|
366 |
|
366 |
sub _register { |
367 |
sub _register { |
367 |
my ( $self, $filename, $size ) = @_; |
368 |
my ( $self, $filename, $size ) = @_; |
368 |
my $dbh= C4::Context->dbh; |
369 |
my $rec = Koha::UploadedFile->new({ |
369 |
my $sql= 'INSERT INTO uploaded_files (hashvalue, filename, dir, filesize, |
370 |
hashvalue => $self->{files}->{$filename}->{hash}, |
370 |
owner, uploadcategorycode, public, permanent) VALUES (?,?,?,?,?,?,?,?)'; |
371 |
filename => $filename, |
371 |
my @pars= ( |
372 |
dir => $self->{category}, |
372 |
$self->{files}->{$filename}->{hash}, |
373 |
filesize => $size, |
373 |
$filename, |
374 |
owner => $self->{uid}, |
374 |
$self->{category}, |
375 |
uploadcategorycode => $self->{category}, |
375 |
$size, |
376 |
public => $self->{public}, |
376 |
$self->{uid}, |
377 |
permanent => $self->{temporary}? 0: 1, |
377 |
$self->{category}, |
378 |
})->store; |
378 |
$self->{public}, |
379 |
$self->{files}->{$filename}->{id} = $rec->id if $rec; |
379 |
$self->{temporary}? 0: 1, |
|
|
380 |
); |
381 |
$dbh->do( $sql, undef, @pars ); |
382 |
my $i = $dbh->last_insert_id(undef, undef, 'uploaded_files', undef); |
383 |
$self->{files}->{$filename}->{id} = $i if $i; |
384 |
} |
380 |
} |
385 |
|
381 |
|
386 |
sub _lookup { |
382 |
sub _lookup { |
387 |
- |
|
|