Lines 1-7
Link Here
|
1 |
#!/usr/bin/perl |
1 |
#!/usr/bin/perl |
2 |
|
2 |
|
3 |
use Modern::Perl; |
3 |
use Modern::Perl; |
4 |
use Test::More tests => 34; |
4 |
use Test::More tests => 37; |
5 |
|
5 |
|
6 |
use C4::Context; |
6 |
use C4::Context; |
7 |
use Koha::AdditionalField; |
7 |
use Koha::AdditionalField; |
Lines 104-109
use C4::Acquisition;
Link Here
|
104 |
use C4::Biblio; |
104 |
use C4::Biblio; |
105 |
use C4::Budgets; |
105 |
use C4::Budgets; |
106 |
use C4::Serials; |
106 |
use C4::Serials; |
|
|
107 |
use C4::Serials::Frequency; |
108 |
use C4::Serials::Numberpattern; |
107 |
|
109 |
|
108 |
my $booksellerid = C4::Bookseller::AddBookseller( |
110 |
my $booksellerid = C4::Bookseller::AddBookseller( |
109 |
{ |
111 |
{ |
Lines 118-124
my ($biblionumber, $biblioitemnumber) = AddBiblio(MARC::Record->new, '');
Link Here
|
118 |
my $budgetid; |
120 |
my $budgetid; |
119 |
my $bpid = AddBudgetPeriod({ |
121 |
my $bpid = AddBudgetPeriod({ |
120 |
budget_period_startdate => '01-01-2015', |
122 |
budget_period_startdate => '01-01-2015', |
121 |
budget_period_enddate => '12-31-2015', |
123 |
budget_period_enddate => '01-01-2016', |
122 |
budget_description => "budget desc" |
124 |
budget_description => "budget desc" |
123 |
}); |
125 |
}); |
124 |
|
126 |
|
Lines 132-153
my $budget_id = AddBudget({
Link Here
|
132 |
budget_period_id => $bpid |
134 |
budget_period_id => $bpid |
133 |
}); |
135 |
}); |
134 |
|
136 |
|
|
|
137 |
my $frequency_id = AddSubscriptionFrequency({ description => "Test frequency 1" }); |
138 |
my $pattern_id = AddSubscriptionNumberpattern({ |
139 |
label => 'Test numberpattern 1', |
140 |
numberingmethod => '{X}' |
141 |
}); |
142 |
|
135 |
my $subscriptionid1 = NewSubscription( |
143 |
my $subscriptionid1 = NewSubscription( |
136 |
undef, "", undef, undef, $budget_id, $biblionumber, '01-01-2013',undef, |
144 |
undef, "", undef, undef, $budget_id, $biblionumber, |
137 |
undef, undef, undef, undef, undef, undef, undef, undef, |
145 |
'2013-01-01', $frequency_id, undef, undef, undef, |
138 |
undef, undef, undef, undef, undef, undef, undef, undef, |
146 |
undef, undef, undef, undef, undef, undef, |
139 |
undef, undef, undef, undef, undef, undef, undef, 1, |
147 |
1, "notes",undef, '2013-01-01', undef, $pattern_id, |
140 |
"notes", undef, undef, undef, undef, undef, undef, 0, |
148 |
undef, undef, 0, "intnotes", 0, |
141 |
"intnotes", 0, undef, undef, 0, undef, '31-12-2013', |
149 |
undef, undef, 0, undef, '2013-01-01', 0 |
142 |
); |
150 |
); |
143 |
|
151 |
|
144 |
my $subscriptionid2 = NewSubscription( |
152 |
my $subscriptionid2 = NewSubscription( |
145 |
undef, "", undef, undef, $budget_id, $biblionumber, '01-01-2013',undef, |
153 |
undef, "", undef, undef, $budget_id, $biblionumber, |
146 |
undef, undef, undef, undef, undef, undef, undef, undef, |
154 |
'2013-01-01', $frequency_id, undef, undef, undef, |
147 |
undef, undef, undef, undef, undef, undef, undef, undef, |
155 |
undef, undef, undef, undef, undef, undef, |
148 |
undef, undef, undef, undef, undef, undef, undef, 1, |
156 |
1, "notes",undef, '2013-01-01', undef, $pattern_id, |
149 |
"notes", undef, undef, undef, undef, undef, undef, 0, |
157 |
undef, undef, 0, "intnotes", 0, |
150 |
"intnotes", 0, undef, undef, 0, undef, '31-12-2013', |
158 |
undef, undef, 0, undef, '2013-01-01', 0 |
151 |
); |
159 |
); |
152 |
|
160 |
|
153 |
# insert |
161 |
# insert |
Lines 268-271
is ( $exists, 1, "get_matching_record_ids: field common: common_value matches su
Link Here
|
268 |
$exists = grep /not_existent_id/, @$matching_record_ids; |
276 |
$exists = grep /not_existent_id/, @$matching_record_ids; |
269 |
is ( $exists, 0, "get_matching_record_ids: field common: common_value does not inexistent id" ); |
277 |
is ( $exists, 0, "get_matching_record_ids: field common: common_value does not inexistent id" ); |
270 |
|
278 |
|
|
|
279 |
$fields = [ |
280 |
{ |
281 |
name => 'common', |
282 |
value => q|common|, |
283 |
} |
284 |
]; |
285 |
$matching_record_ids = Koha::AdditionalField->get_matching_record_ids({ tablename => 'subscription', fields => $fields, exact_match => 0 }); |
286 |
$exists = grep /$subscriptionid1/, @$matching_record_ids; |
287 |
is ( $exists, 1, "get_matching_record_ids: field common: common% matches subscription1" ); |
288 |
$exists = grep /$subscriptionid2/, @$matching_record_ids; |
289 |
is ( $exists, 1, "get_matching_record_ids: field common: common% matches subscription2 too" ); |
290 |
$exists = grep /not_existent_id/, @$matching_record_ids; |
291 |
is ( $exists, 0, "get_matching_record_ids: field common: common% does not inexistent id" ); |
292 |
|
293 |
|
271 |
$dbh->rollback; |
294 |
$dbh->rollback; |
272 |
- |
|
|