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