Lines 17-22
use C4::Items;
Link Here
|
17 |
use Koha::DateUtils; |
17 |
use Koha::DateUtils; |
18 |
use Koha::Acquisition::Booksellers; |
18 |
use Koha::Acquisition::Booksellers; |
19 |
use t::lib::Mocks; |
19 |
use t::lib::Mocks; |
|
|
20 |
use t::lib::TestBuilder; |
20 |
use Test::More tests => 49; |
21 |
use Test::More tests => 49; |
21 |
|
22 |
|
22 |
BEGIN { |
23 |
BEGIN { |
Lines 29-34
my $dbh = C4::Context->dbh;
Link Here
|
29 |
$dbh->{AutoCommit} = 0; |
30 |
$dbh->{AutoCommit} = 0; |
30 |
$dbh->{RaiseError} = 1; |
31 |
$dbh->{RaiseError} = 1; |
31 |
|
32 |
|
|
|
33 |
my $builder = t::lib::TestBuilder->new(); |
34 |
|
32 |
# This could/should be used for all untested methods |
35 |
# This could/should be used for all untested methods |
33 |
my @methods = ('updateClaim'); |
36 |
my @methods = ('updateClaim'); |
34 |
can_ok('C4::Serials', @methods); |
37 |
can_ok('C4::Serials', @methods); |
Lines 140-156
ok(C4::Serials::GetSerialStatusFromSerialId($serial->{serialid}), 'test getting
Link Here
|
140 |
isa_ok(C4::Serials::GetSerialInformation($serial->{serialid}), 'HASH', 'test getting Serial Information'); |
143 |
isa_ok(C4::Serials::GetSerialInformation($serial->{serialid}), 'HASH', 'test getting Serial Information'); |
141 |
|
144 |
|
142 |
subtest 'Values should not be erased on editing' => sub { |
145 |
subtest 'Values should not be erased on editing' => sub { |
|
|
146 |
|
143 |
plan tests => 1; |
147 |
plan tests => 1; |
|
|
148 |
|
144 |
( $biblionumber, $biblioitemnumber ) = get_biblio(); |
149 |
( $biblionumber, $biblioitemnumber ) = get_biblio(); |
145 |
my ( $icn_tag, $icn_sf ) = GetMarcFromKohaField( 'items.itemcallnumber', '' ); |
150 |
my ( $icn_tag, $icn_sf ) = GetMarcFromKohaField( 'items.itemcallnumber', '' ); |
146 |
my $item_record = new MARC::Record; |
151 |
my ( $it_tag, $it_sf ) = GetMarcFromKohaField( 'items.itype', '' ); |
|
|
152 |
|
153 |
my $itemtype = $builder->build( { source => 'Itemtype' } )->{itemtype}; |
147 |
my $itemcallnumber = 'XXXmy itemcallnumberXXX'; |
154 |
my $itemcallnumber = 'XXXmy itemcallnumberXXX'; |
148 |
$item_record->append_fields( MARC::Field->new( '080', '', '', "a" => "default" ), MARC::Field->new( $icn_tag, '', '', $icn_sf => $itemcallnumber ), ); |
155 |
|
|
|
156 |
my $item_record = new MARC::Record; |
157 |
|
158 |
$item_record->append_fields( |
159 |
MARC::Field->new( '080', '', '', "a" => "default" ), |
160 |
MARC::Field->new( |
161 |
$icn_tag, '', '', |
162 |
$icn_sf => $itemcallnumber, |
163 |
$it_sf => $itemtype |
164 |
) |
165 |
); |
149 |
my ( undef, undef, $itemnumber ) = C4::Items::AddItemFromMarc( $item_record, $biblionumber ); |
166 |
my ( undef, undef, $itemnumber ) = C4::Items::AddItemFromMarc( $item_record, $biblionumber ); |
150 |
my $serialid = C4::Serials::NewIssue( "serialseq", $subscriptionid, $biblionumber, 1, undef, undef, "publisheddatetext", "notes" ); |
167 |
my $serialid = C4::Serials::NewIssue( "serialseq", $subscriptionid, $biblionumber, |
|
|
168 |
1, undef, undef, "publisheddatetext", "notes" ); |
151 |
C4::Serials::AddItem2Serial( $serialid, $itemnumber ); |
169 |
C4::Serials::AddItem2Serial( $serialid, $itemnumber ); |
152 |
my $serial_info = C4::Serials::GetSerialInformation($serialid); |
170 |
my $serial_info = C4::Serials::GetSerialInformation($serialid); |
153 |
my ($itemcallnumber_info) = grep { $_->{kohafield} eq 'items.itemcallnumber' } @{ $serial_info->{items}[0]->{iteminformation} }; |
171 |
my ($itemcallnumber_info) = grep { $_->{kohafield} eq 'items.itemcallnumber' } |
|
|
172 |
@{ $serial_info->{items}[0]->{iteminformation} }; |
154 |
like( $itemcallnumber_info->{marc_value}, qr|value="$itemcallnumber"| ); |
173 |
like( $itemcallnumber_info->{marc_value}, qr|value="$itemcallnumber"| ); |
155 |
}; |
174 |
}; |
156 |
|
175 |
|
157 |
- |
|
|