Lines 55-60
use Koha::StockRotationItem;
Link Here
|
55 |
use Koha::StockRotationRotas; |
55 |
use Koha::StockRotationRotas; |
56 |
use Koha::TrackedLinks; |
56 |
use Koha::TrackedLinks; |
57 |
use Koha::Policy::Holds; |
57 |
use Koha::Policy::Holds; |
|
|
58 |
use Koha::Cache::Memory::Lite; |
58 |
|
59 |
|
59 |
use base qw(Koha::Object); |
60 |
use base qw(Koha::Object); |
60 |
|
61 |
|
Lines 1857-1863
Returns whether the item is a bundle or not
Link Here
|
1857 |
|
1858 |
|
1858 |
sub is_bundle { |
1859 |
sub is_bundle { |
1859 |
my ($self) = @_; |
1860 |
my ($self) = @_; |
1860 |
return $self->bundle_items->count ? 1 : 0; |
1861 |
my $memory_cache = Koha::Cache::Memory::Lite->get_instance; |
|
|
1862 |
my $cache_key = 'Koha::Item:is_bundle_dbi_sth'; |
1863 |
my $sth = $memory_cache->get_from_cache($cache_key); |
1864 |
unless (defined $sth) { |
1865 |
my $query = "SELECT COUNT(*) FROM items i LEFT JOIN item_bundles ib ON i.itemnumber = ib.item WHERE ib.host = ?"; |
1866 |
my $dbh = C4::Context->dbh; |
1867 |
$sth = $dbh->prepare($query); |
1868 |
$memory_cache->set_in_cache($cache_key, $sth); |
1869 |
} |
1870 |
$sth->execute($self->itemnumber); |
1871 |
return $sth->fetchrow_arrayref()->[0] ? 1 : 0; |
1861 |
} |
1872 |
} |
1862 |
|
1873 |
|
1863 |
=head3 bundle_host |
1874 |
=head3 bundle_host |
1864 |
- |
|
|