|
Lines 16-22
my $builder = t::lib::TestBuilder->new;
Link Here
|
| 16 |
my $schema = Koha::Database->schema; |
16 |
my $schema = Koha::Database->schema; |
| 17 |
|
17 |
|
| 18 |
subtest 'set_additional_fields with marcfield_mode = "get"' => sub { |
18 |
subtest 'set_additional_fields with marcfield_mode = "get"' => sub { |
| 19 |
plan tests => 1; |
19 |
plan tests => 2; |
| 20 |
|
20 |
|
| 21 |
$schema->txn_begin; |
21 |
$schema->txn_begin; |
| 22 |
|
22 |
|
|
Lines 53-58
subtest 'set_additional_fields with marcfield_mode = "get"' => sub {
Link Here
|
| 53 |
|
53 |
|
| 54 |
is($values->[0]->value, 'some value', 'value was copied from the biblio record to the field'); |
54 |
is($values->[0]->value, 'some value', 'value was copied from the biblio record to the field'); |
| 55 |
|
55 |
|
|
|
56 |
$field->delete; |
| 57 |
my $get_marcfield_field = Koha::AdditionalField->new( |
| 58 |
{ |
| 59 |
tablename => 'subscription', |
| 60 |
name => random_string( 'c' x 100 ), |
| 61 |
marcfield => '998$Z', |
| 62 |
marcfield_mode => 'get', |
| 63 |
} |
| 64 |
); |
| 65 |
$get_marcfield_field->store()->discard_changes(); |
| 66 |
my $q = CGI->new; |
| 67 |
$q->param( |
| 68 |
-name => 'additional_field_' . $get_marcfield_field->id, |
| 69 |
-value => '', |
| 70 |
); |
| 71 |
|
| 72 |
my @additional_fields = |
| 73 |
Koha::Object::Mixin::AdditionalFields->prepare_cgi_additional_field_values( $q, 'subscription' ); |
| 74 |
$subscription->set_additional_fields( \@additional_fields ); |
| 75 |
|
| 76 |
$values = $subscription->additional_field_values()->as_list(); |
| 77 |
|
| 78 |
is( $values->[0]->value, 'some value', 'value was copied from the biblio record to the field' ); |
| 79 |
|
| 56 |
$schema->txn_rollback; |
80 |
$schema->txn_rollback; |
| 57 |
}; |
81 |
}; |
| 58 |
|
82 |
|
| 59 |
- |
|
|