Lines 14-21
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 Test::More tests => 45; |
19 |
use Test::More tests => 46; |
19 |
|
20 |
|
20 |
BEGIN { |
21 |
BEGIN { |
21 |
use_ok('C4::Serials'); |
22 |
use_ok('C4::Serials'); |
Lines 27-32
my $dbh = C4::Context->dbh;
Link Here
|
27 |
$dbh->{AutoCommit} = 0; |
28 |
$dbh->{AutoCommit} = 0; |
28 |
$dbh->{RaiseError} = 1; |
29 |
$dbh->{RaiseError} = 1; |
29 |
|
30 |
|
|
|
31 |
$dbh->do(q|UPDATE marc_subfield_structure SET value_builder="callnumber.pl" where kohafield="items.itemcallnumber" and frameworkcode=''|); |
32 |
|
30 |
my $booksellerid = C4::Bookseller::AddBookseller( |
33 |
my $booksellerid = C4::Bookseller::AddBookseller( |
31 |
{ |
34 |
{ |
32 |
name => "my vendor", |
35 |
name => "my vendor", |
Lines 106-111
if (not $frequency->{unit}) {
Link Here
|
106 |
$frequency->{issuesperunit} = 1; |
109 |
$frequency->{issuesperunit} = 1; |
107 |
$frequency->{description} = "Frequency created by t/db_dependant/Serials.t"; |
110 |
$frequency->{description} = "Frequency created by t/db_dependant/Serials.t"; |
108 |
$subscriptioninformation->{periodicity} = AddSubscriptionFrequency($frequency); |
111 |
$subscriptioninformation->{periodicity} = AddSubscriptionFrequency($frequency); |
|
|
112 |
$subscriptioninformation->{serialsadditems} = 1; |
109 |
|
113 |
|
110 |
ModSubscription( @$subscriptioninformation{qw( |
114 |
ModSubscription( @$subscriptioninformation{qw( |
111 |
librarian branchcode aqbooksellerid cost aqbudgetid startdate |
115 |
librarian branchcode aqbooksellerid cost aqbudgetid startdate |
Lines 130-135
ok(C4::Serials::GetSerialStatusFromSerialId($serial->{serialid}), 'test getting
Link Here
|
130 |
|
134 |
|
131 |
isa_ok(C4::Serials::GetSerialInformation($serial->{serialid}), 'HASH', 'test getting Serial Information'); |
135 |
isa_ok(C4::Serials::GetSerialInformation($serial->{serialid}), 'HASH', 'test getting Serial Information'); |
132 |
|
136 |
|
|
|
137 |
subtest 'Values should not be erased on editing' => sub { |
138 |
plan tests => 1; |
139 |
( $biblionumber, $biblioitemnumber ) = get_biblio(); |
140 |
my ( $icn_tag, $icn_sf ) = GetMarcFromKohaField( 'items.itemcallnumber', '' ); |
141 |
my $item_record = new MARC::Record; |
142 |
my $itemcallnumber = 'XXXmy itemcallnumberXXX'; |
143 |
$item_record->append_fields( MARC::Field->new( '080', '', '', "a" => "default" ), MARC::Field->new( $icn_tag, '', '', $icn_sf => $itemcallnumber ), ); |
144 |
my ( undef, undef, $itemnumber ) = C4::Items::AddItemFromMarc( $item_record, $biblionumber ); |
145 |
my $serialid = C4::Serials::NewIssue( "serialseq", $subscriptionid, $biblionumber, 1, undef, undef, "publisheddatetext", "notes" ); |
146 |
C4::Serials::AddItem2Serial( $serialid, $itemnumber ); |
147 |
my $serial_info = C4::Serials::GetSerialInformation($serialid); |
148 |
my ($itemcallnumber_info) = grep { $_->{kohafield} eq 'items.itemcallnumber' } @{ $serial_info->{items}[0]->{iteminformation} }; |
149 |
like( $itemcallnumber_info->{marc_value}, qr|value="$itemcallnumber"| ); |
150 |
}; |
151 |
|
133 |
# Delete created frequency |
152 |
# Delete created frequency |
134 |
if ($old_frequency) { |
153 |
if ($old_frequency) { |
135 |
my $freq_to_delete = $subscriptioninformation->{periodicity}; |
154 |
my $freq_to_delete = $subscriptioninformation->{periodicity}; |
Lines 148-154
if ($old_frequency) {
Link Here
|
148 |
DelSubscriptionFrequency($freq_to_delete); |
167 |
DelSubscriptionFrequency($freq_to_delete); |
149 |
} |
168 |
} |
150 |
|
169 |
|
151 |
|
|
|
152 |
# Test calling subs without parameters |
170 |
# Test calling subs without parameters |
153 |
is(C4::Serials::AddItem2Serial(), undef, 'test adding item to serial'); |
171 |
is(C4::Serials::AddItem2Serial(), undef, 'test adding item to serial'); |
154 |
is(C4::Serials::UpdateClaimdateIssues(), undef, 'test updating claim date'); |
172 |
is(C4::Serials::UpdateClaimdateIssues(), undef, 'test updating claim date'); |
Lines 245-247
for my $am ( @arrived_missing ) {
Link Here
|
245 |
is( $subscription->{missinglist}, join('; ', @serialseqs), "subscription missinglist is updated after ModSerialStatus" ); |
263 |
is( $subscription->{missinglist}, join('; ', @serialseqs), "subscription missinglist is updated after ModSerialStatus" ); |
246 |
|
264 |
|
247 |
$dbh->rollback; |
265 |
$dbh->rollback; |
248 |
- |
266 |
|
|
|
267 |
sub get_biblio { |
268 |
my $bib = MARC::Record->new(); |
269 |
$bib->append_fields( |
270 |
MARC::Field->new('100', ' ', ' ', a => 'Moffat, Steven'), |
271 |
MARC::Field->new('245', ' ', ' ', a => 'Silence in the library'), |
272 |
); |
273 |
my ($bibnum, $bibitemnum) = AddBiblio($bib, ''); |
274 |
return ($bibnum, $bibitemnum); |
275 |
} |