#
# This file is part of Koha.
#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with Koha; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
use Data::Dumper;
is( $results[0]->{ restrictedvalueopac }, "Restricted Access OPAC",
'GetItemsInfo returns a restricted value description (OPAC)' );
- t::lib::Mocks::mock_preference( 'AllowItemsOnHoldCheckout', 0 );
#place item into holds queue
my $dbh = C4::Context->dbh;
+ @results = GetItemsInfo( $biblio->biblionumber );
+ is( $results[0]->{ has_pending_hold }, "0",
+ 'Hold not marked as pending/unavailable if nothing in tmp_holdsqueue for item' );
+
$dbh->do(q{INSERT INTO tmp_holdsqueue (biblionumber, itemnumber, surname, borrowernumber ) VALUES (?, ?, "Zorro", 42)}, undef, $item_bibnum, $itemnumber);
@results = GetItemsInfo( $biblio->biblionumber );
is( $results[0]->{ has_pending_hold }, "1",
- 'Hold marked as pending/unavailable if not AllowItemsOnHoldCheckout' );
- t::lib::Mocks::mock_preference( 'AllowItemsOnHoldCheckout', 1 );
- @results = GetItemsInfo( $biblio->biblionumber );
- is( $results[0]->{ has_pending_hold }, undef,
- 'Hold not marked as pending/unavailable if AllowItemsOnHoldCheckout' );
-
+ 'Hold marked as pending/unavailable if tmp_holdsqueue is not empty for item' );
$schema->storage->txn_rollback;
};
};
subtest 'SearchItems test' => sub {
- plan tests => 14;
+ plan tests => 15;
$schema->storage->txn_begin;
my $dbh = C4::Context->dbh;
homebranch => $library2->{branchcode},
holdingbranch => $library2->{branchcode},
itype => $itemtype->{itemtype},
+ issues => 3,
}, $biblio->biblionumber);
my ($items, $total_results);
my $cpl_items_after = SearchItemsByField( 'homebranch', $library1->{branchcode});
is( ( scalar( @$cpl_items_after ) - scalar ( @$cpl_items_before ) ), 1, 'SearchItemsByField should return something' );
+ # Issues count may be NULL
+ $filter = {
+ conjunction => 'AND',
+ filters => [
+ {
+ field => 'issues',
+ query => 0,
+ operator => '=',
+ },
+ {
+ field => 'homebranch',
+ query => $library1->{branchcode},
+ operator => '=',
+ },
+ ],
+ };
+ ($items, $total_results) = SearchItems($filter);
+ is($total_results, 1, "Search items.issues is NULL with filter issues = 0");
+
$schema->storage->txn_rollback;
};