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 $dbi_cache = Koha::Cache::Memory::Lite->get_instance; |
|
|
1862 |
my $cache_key = "DBI->count:is_bundle_count"; |
1863 |
my $sth = $dbi_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 |
$dbi_cache->set_in_cache( $cache_key, $sth ); |
1869 |
} |
1870 |
|
1871 |
$sth->execute($self->itemnumber); |
1872 |
my $count = $sth->fetchrow_arrayref()->[0]; |
1873 |
|
1874 |
return $count ? 1 : 0; |
1861 |
} |
1875 |
} |
1862 |
|
1876 |
|
1863 |
=head3 bundle_host |
1877 |
=head3 bundle_host |
1864 |
- |
|
|