|
Lines 14-22
use C4::Debug;
Link Here
|
| 14 |
use C4::Bookseller; |
14 |
use C4::Bookseller; |
| 15 |
use C4::Biblio; |
15 |
use C4::Biblio; |
| 16 |
use C4::Budgets; |
16 |
use C4::Budgets; |
|
|
17 |
use C4::Items; |
| 17 |
use Koha::DateUtils; |
18 |
use Koha::DateUtils; |
| 18 |
use t::lib::Mocks; |
19 |
use t::lib::Mocks; |
| 19 |
use Test::More tests => 48; |
20 |
use Test::More tests => 49; |
| 20 |
|
21 |
|
| 21 |
BEGIN { |
22 |
BEGIN { |
| 22 |
use_ok('C4::Serials'); |
23 |
use_ok('C4::Serials'); |
|
Lines 32-37
$dbh->{RaiseError} = 1;
Link Here
|
| 32 |
my @methods = ('updateClaim'); |
33 |
my @methods = ('updateClaim'); |
| 33 |
can_ok('C4::Serials', @methods); |
34 |
can_ok('C4::Serials', @methods); |
| 34 |
|
35 |
|
|
|
36 |
$dbh->do(q|UPDATE marc_subfield_structure SET value_builder="callnumber.pl" where kohafield="items.itemcallnumber" and frameworkcode=''|); |
| 37 |
|
| 35 |
my $booksellerid = C4::Bookseller::AddBookseller( |
38 |
my $booksellerid = C4::Bookseller::AddBookseller( |
| 36 |
{ |
39 |
{ |
| 37 |
name => "my vendor", |
40 |
name => "my vendor", |
|
Lines 111-116
if (not $frequency->{unit}) {
Link Here
|
| 111 |
$frequency->{issuesperunit} = 1; |
114 |
$frequency->{issuesperunit} = 1; |
| 112 |
$frequency->{description} = "Frequency created by t/db_dependant/Serials.t"; |
115 |
$frequency->{description} = "Frequency created by t/db_dependant/Serials.t"; |
| 113 |
$subscriptioninformation->{periodicity} = AddSubscriptionFrequency($frequency); |
116 |
$subscriptioninformation->{periodicity} = AddSubscriptionFrequency($frequency); |
|
|
117 |
$subscriptioninformation->{serialsadditems} = 1; |
| 114 |
|
118 |
|
| 115 |
ModSubscription( @$subscriptioninformation{qw( |
119 |
ModSubscription( @$subscriptioninformation{qw( |
| 116 |
librarian branchcode aqbooksellerid cost aqbudgetid startdate |
120 |
librarian branchcode aqbooksellerid cost aqbudgetid startdate |
|
Lines 135-140
ok(C4::Serials::GetSerialStatusFromSerialId($serial->{serialid}), 'test getting
Link Here
|
| 135 |
|
139 |
|
| 136 |
isa_ok(C4::Serials::GetSerialInformation($serial->{serialid}), 'HASH', 'test getting Serial Information'); |
140 |
isa_ok(C4::Serials::GetSerialInformation($serial->{serialid}), 'HASH', 'test getting Serial Information'); |
| 137 |
|
141 |
|
|
|
142 |
subtest 'Values should not be erased on editing' => sub { |
| 143 |
plan tests => 1; |
| 144 |
( $biblionumber, $biblioitemnumber ) = get_biblio(); |
| 145 |
my ( $icn_tag, $icn_sf ) = GetMarcFromKohaField( 'items.itemcallnumber', '' ); |
| 146 |
my $item_record = new MARC::Record; |
| 147 |
my $itemcallnumber = 'XXXmy itemcallnumberXXX'; |
| 148 |
$item_record->append_fields( MARC::Field->new( '080', '', '', "a" => "default" ), MARC::Field->new( $icn_tag, '', '', $icn_sf => $itemcallnumber ), ); |
| 149 |
my ( undef, undef, $itemnumber ) = C4::Items::AddItemFromMarc( $item_record, $biblionumber ); |
| 150 |
my $serialid = C4::Serials::NewIssue( "serialseq", $subscriptionid, $biblionumber, 1, undef, undef, "publisheddatetext", "notes" ); |
| 151 |
C4::Serials::AddItem2Serial( $serialid, $itemnumber ); |
| 152 |
my $serial_info = C4::Serials::GetSerialInformation($serialid); |
| 153 |
my ($itemcallnumber_info) = grep { $_->{kohafield} eq 'items.itemcallnumber' } @{ $serial_info->{items}[0]->{iteminformation} }; |
| 154 |
like( $itemcallnumber_info->{marc_value}, qr|value="$itemcallnumber"| ); |
| 155 |
}; |
| 156 |
|
| 138 |
# Delete created frequency |
157 |
# Delete created frequency |
| 139 |
if ($old_frequency) { |
158 |
if ($old_frequency) { |
| 140 |
my $freq_to_delete = $subscriptioninformation->{periodicity}; |
159 |
my $freq_to_delete = $subscriptioninformation->{periodicity}; |
|
Lines 153-159
if ($old_frequency) {
Link Here
|
| 153 |
DelSubscriptionFrequency($freq_to_delete); |
172 |
DelSubscriptionFrequency($freq_to_delete); |
| 154 |
} |
173 |
} |
| 155 |
|
174 |
|
| 156 |
|
|
|
| 157 |
# Test calling subs without parameters |
175 |
# Test calling subs without parameters |
| 158 |
is(C4::Serials::AddItem2Serial(), undef, 'test adding item to serial'); |
176 |
is(C4::Serials::AddItem2Serial(), undef, 'test adding item to serial'); |
| 159 |
is(C4::Serials::GetFullSubscription(), undef, 'test getting full subscription'); |
177 |
is(C4::Serials::GetFullSubscription(), undef, 'test getting full subscription'); |
|
Lines 317-319
subtest "Do not generate an expected if one already exists" => sub {
Link Here
|
| 317 |
}; |
335 |
}; |
| 318 |
|
336 |
|
| 319 |
$dbh->rollback; |
337 |
$dbh->rollback; |
| 320 |
- |
338 |
|
|
|
339 |
sub get_biblio { |
| 340 |
my $bib = MARC::Record->new(); |
| 341 |
$bib->append_fields( |
| 342 |
MARC::Field->new('100', ' ', ' ', a => 'Moffat, Steven'), |
| 343 |
MARC::Field->new('245', ' ', ' ', a => 'Silence in the library'), |
| 344 |
); |
| 345 |
my ($bibnum, $bibitemnum) = AddBiblio($bib, ''); |
| 346 |
return ($bibnum, $bibitemnum); |
| 347 |
} |