Instead of DBIx::Class objects.
Test plan:
1/ Add content to a list and share it with another patron
2/ Try to view the list with the other patron
3/ download and send a shelf and check if the biblio list is correct
4/ prove t/db_dependent/Virtualshelves.t should return green
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
use Koha::Virtualshelfshare;
use Koha::Virtualshelfshares;
use Koha::Virtualshelfcontent;
+use Koha::Virtualshelfcontents;
use base qw(Koha::Object);
sub get_shares {
my ( $self ) = @_;
- my $shares = $self->{_result}->virtualshelfshares;
+ my $rs = $self->{_result}->virtualshelfshares;
+ my $shares = Koha::Virtualshelfshares->_new_from_dbic( $rs );
return $shares;
}
sub get_contents {
my ( $self ) = @_;
- my $contents = $self->{_result}->virtualshelfcontents;
+ my $rs = $self->{_result}->virtualshelfcontents;
+ my $contents = Koha::Virtualshelfcontents->_new_from_dbic( $rs );
return $contents;
}
if ($format =~ /^\d+$/) {
my @biblios;
while ( my $content = $contents->next ) {
- push @biblios, $content->biblionumber->biblionumber;
+ push @biblios, $content->biblionumber;
}
$output = marc2csv(\@biblios, $format);
# Other formats
filters => 'ViewPolicy'
});
while ( my $content = $contents->next ) {
- my $biblionumber = $content->biblionumber->biblionumber;
+ my $biblionumber = $content->biblionumber;
my $record = GetMarcBiblio($biblionumber, 1);
my $framework = &GetFrameworkCode( $biblionumber );
my @results;
while ( my $content = $contents->next ) {
- my $biblionumber = $content->biblionumber->biblionumber;
+ my $biblionumber = $content->biblionumber;
my $fw = GetFrameworkCode($biblionumber);
my $dat = GetBiblioData($biblionumber);
my $record = GetMarcBiblio($biblionumber, 1);
use C4::Output;
use C4::Tags qw( get_tags );
use C4::XSLT;
+
+use Koha::Biblioitems;
use Koha::Virtualshelves;
use Koha::RecordProcessor;
my $record_processor = Koha::RecordProcessor->new({ filters => 'ViewPolicy' });
my @items;
while ( my $content = $contents->next ) {
- my $biblionumber = $content->biblionumber->biblionumber;
+ my $biblionumber = $content->biblionumber;
my $this_item = GetBiblioData($biblionumber);
my $record = GetMarcBiblio($biblionumber);
my $framework = GetFrameworkCode( $biblionumber );
}
my $marcflavour = C4::Context->preference("marcflavour");
- my $itemtypeinfo = getitemtypeinfo( $content->biblionumber->biblioitems->first->itemtype, 'opac' );
+ my $itemtype = Koha::Biblioitems->search({ biblionumber => $content->biblionumber })->next->itemtype;
+ my $itemtypeinfo = getitemtypeinfo( $itemtype, 'opac' );
$this_item->{imageurl} = $itemtypeinfo->{imageurl};
$this_item->{description} = $itemtypeinfo->{description};
$this_item->{notforloan} = $itemtypeinfo->{notforloan};
if ($format =~ /^\d+$/) {
my @biblios;
while ( my $content = $contents->next ) {
- push @biblios, $content->biblionumber->biblionumber;
+ push @biblios, $content->biblionumber;
}
$output = marc2csv(\@biblios, $format);
}
else { #Other formats
while ( my $content = $contents->next ) {
- my $biblionumber = $content->biblionumber->biblionumber;
+ my $biblionumber = $content->biblionumber;
my $record = GetMarcBiblio($biblionumber, 1);
if ($format eq 'iso2709') {
$output .= $record->as_usmarc();
my @results;
while ( my $content = $contents->next ) {
- my $biblionumber = $content->biblionumber->biblionumber;
+ my $biblionumber = $content->biblionumber;
my $fw = GetFrameworkCode($biblionumber);
my $dat = GetBiblioData($biblionumber);
my $record = GetMarcBiblio($biblionumber, 1);
use C4::Output;
use C4::XSLT;
+use Koha::Biblios;
+use Koha::Biblioitems;
use Koha::CsvProfiles;
use Koha::Virtualshelves;
my @items;
while ( my $content = $contents->next ) {
my $this_item;
- my $biblionumber = $content->biblionumber->biblionumber;
+ my $biblionumber = $content->biblionumber;
my $record = GetMarcBiblio($biblionumber);
if ( $xslfile ) {
}
my $marcflavour = C4::Context->preference("marcflavour");
- my $itemtypeinfo = getitemtypeinfo( $content->biblionumber->biblioitems->first->itemtype, 'intranet' );
- $this_item->{title} = $content->biblionumber->title;
- $this_item->{author} = $content->biblionumber->author;
+ my $itemtype = Koha::Biblioitems->search({ biblionumber => $content->biblionumber })->next->itemtype;
+ my $itemtypeinfo = getitemtypeinfo( $itemtype, 'intranet' );
+ my $biblio = Koha::Biblios->find( $content->biblionumber );
+ $this_item->{title} = $biblio->title;
+ $this_item->{author} = $biblio->author;
$this_item->{dateadded} = $content->dateadded;
$this_item->{imageurl} = $itemtypeinfo->{imageurl};
$this_item->{description} = $itemtypeinfo->{description};