use Modern::Perl;
use Test::More tests => 57;
use t::lib::Mocks qw(mock_preference);
+use t::lib::TestBuilder;
use POSIX qw(strftime);
use Data::Dumper;
use Koha::Biblios;
use_ok( 'C4::AuthoritiesMarc', qw(AddAuthority) );
use_ok('C4::Reserves');
use_ok('MARC::Record');
- use_ok('Koha::Acquisition::Order');
+ use_ok('Koha::Acquisition::Orders');
}
can_ok(
_count )
);
+my $schema = Koha::Database->new->schema;
+$schema->storage->txn_begin;
+my $builder = t::lib::TestBuilder->new;
my $dbh = C4::Context->dbh;
-$dbh->{AutoCommit} = 0;
-$dbh->{RaiseError} = 1;
$dbh->do('DELETE FROM issues');
$dbh->do('DELETE FROM biblio');
my $cardnumber1 = 'test_card1';
my $cardnumber2 = 'test_card2';
my $cardnumber3 = 'test_card3';
- my $categorycode = Koha::Database->new()->schema()->resultset('Category')->first()->categorycode();
- my $branchcode = Koha::Database->new()->schema()->resultset('Branch')->first()->branchcode();
+ my $categorycode = $builder->build({ source => 'Category' })->{categorycode};
+ my $branchcode = $builder->build({ source => 'Branch' })->{branchcode};
my $query = '
INSERT INTO borrowers
$query = '
INSERT INTO biblio
- (title, author)
- VALUES (?,?)';
+ (title, author, datecreated)
+ VALUES (?,?, NOW())';
$insert_sth = $dbh->prepare($query);
$insert_sth->execute( $title1, $author1 );
my $biblionumber1 = $dbh->last_insert_id( undef, undef, 'biblio', undef );
# ---------- Add 2 auth_header
$query = '
INSERT INTO auth_header
- (authtypecode)
- VALUES (?)';
+ (authtypecode, marcxml)
+ VALUES (?, "")';
$insert_sth = $dbh->prepare($query);
- $insert_sth->execute('authtypecode1');
+ $insert_sth->execute('atc1');
my $authid1 = $dbh->last_insert_id( undef, undef, 'auth_header', undef );
- $insert_sth->execute('authtypecode2');
+ $insert_sth->execute('atc2');
my $authid2 = $dbh->last_insert_id( undef, undef, 'auth_header', undef );
# ---------- Add 1 old_issues
$query = '
INSERT INTO old_issues
- (borrowernumber, branchcode, itemnumber)
- VALUES (?,?,?)';
+ (issue_id, borrowernumber, branchcode, itemnumber)
+ VALUES ((select coalesce(max(issue_id), 0)+1 from issues),?,?,?)';
$insert_sth = $dbh->prepare($query);
$insert_sth->execute( $borrowernumber1, $branchcode, $item_number1 );
my $issue_id1 = $dbh->last_insert_id( undef, undef, 'old_issues', undef );
AddReserve( $branchcode, $borrowernumber1, $biblionumber1, '', 1, undef, undef, '', 'Title', undef, undef );
my $biblio = Koha::Biblios->find( $biblionumber1 );
my $holds = $biblio->holds;
- CancelReserve( { reserve_id => $holds->next->reserve_id } );
+ $holds->next->cancel if $holds->count;
# ---------- Add 1 aqbudgets
$query = '
z3950NormalizeAuthor
SpineLabelAutoPrint
SpineLabelShowPrintOnBibDetails
+ BlockReturnOfLostItems
BlockReturnOfWithdrawnItems
CalculateFinesOnReturn
AgeRestrictionOverride
OpacMaintenance
OpacPublic
OpacSeparateHoldings
- OPACShowBarcode
OPACShowCheckoutName
OpacShowFiltersPulldownMobile
OPACShowHoldQueueDetails
- OpacShowLibrariesPulldownMobile
OpacShowRecentComments
OPACShowUnusedAuthorities
OpacStarRatings
EnhancedMessagingPreferences
ExtendedPatronAttributes
intranetreadinghistory
- memberofinstitution
patronimages
TalkingTechItivaPhoneNotification
uppercasesurnames
}
}
-$dbh->rollback;
+$schema->storage->txn_rollback;