use Modern::Perl;
-use Test::More tests => 63;
+use Test::More tests => 64;
use C4::Context;
use Koha::DateUtils;
use DateTime::Duration;
#Test subscriptioncount
my $dt_today = dt_from_string;
-my $today = output_pref( $dt_today, 'iso', '24hr', 1 );
+my $today = output_pref({ dt => $dt_today, dateformat => 'iso', timeformat => '24hr', dateonly => 1 });
my $dt_today1 = dt_from_string;
my $dur5 = DateTime::Duration->new( days => -5 );
$dt_today1->add_duration($dur5);
-my $daysago5 = output_pref( $dt_today1, 'iso', '24hr', 1 );
+my $daysago5 = output_pref({ dt => $dt_today1, dateformat => 'iso', timeformat => '24hr', dateonly => 1 });
my $budgetperiod = C4::Budgets::AddBudgetPeriod({
budget_period_startdate => $daysago5,
budget_active => 1,
budget_period_id => $budgetperiod
});
-my ($biblionumber, $biblioitemnumber) = AddBiblio(MARC::Record->new, '');
+my $bib = MARC::Record->new();
+$bib->append_fields(
+ MARC::Field->new('245', ' ', ' ', a => 'Journal of ethnology'),
+ MARC::Field->new('500', ' ', ' ', a => 'bib notes'),
+);
+my ($biblionumber, $biblioitemnumber) = AddBiblio($bib, '');
$bookseller1fromid = C4::Bookseller::GetBookSellerFromId($id_supplier1);
is( $bookseller1fromid->{subscriptioncount},
0, 'Supplier1 has 0 subscription' );
-my $id_subscription1 = C4::Serials::NewSubscription(
- undef, "", $id_supplier1, undef,
- $id_budget, $biblionumber, '01-01-2013', undef,
- undef, undef, undef, undef,
- undef, undef, undef, undef,
- undef, undef, undef, undef,
- undef, undef, undef, undef,
- undef, undef, undef, undef,
- undef, undef, undef, 1,
- "notes", undef, undef, undef,
- undef, undef, undef, 0,
- "intnotes", 0, undef, undef,
- 0, undef, '31-12-2013',
+
+my $id_subscription1 = NewSubscription(
+ undef, "", $id_supplier1, undef, $id_budget, $biblionumber,
+ '01-01-2013',undef, undef, undef, undef,
+ undef, undef, undef, undef, undef, undef,
+ 1, "subscription notes",undef, '01-01-2013', undef, undef,
+ undef, undef, 0, "intnotes", 0,
+ undef, undef, 0, undef, '31-12-2013', 0
);
-my $id_subscription2 = C4::Serials::NewSubscription(
- undef, "", $id_supplier1, undef,
- $id_budget, $biblionumber, '01-01-2013', undef,
- undef, undef, undef, undef,
- undef, undef, undef, undef,
- undef, undef, undef, undef,
- undef, undef, undef, undef,
- undef, undef, undef, undef,
- undef, undef, undef, 1,
- "notes", undef, undef, undef,
- undef, undef, undef, 0,
- "intnotes", 0, undef, undef,
- 0, undef, '31-12-2013',
+
+my @subscriptions = SearchSubscriptions({biblionumber => $biblionumber});
+is($subscriptions[0]->{publicnotes}, 'subscription notes', 'subscription search results include public notes (bug 10689)');
+
+my $id_subscription2 = NewSubscription(
+ undef, "", $id_supplier1, undef, $id_budget, $biblionumber,
+ '01-01-2013',undef, undef, undef, undef,
+ undef, undef, undef, undef, undef, undef,
+ 1, "subscription notes",undef, '01-01-2013', undef, undef,
+ undef, undef, 0, "intnotes", 0,
+ undef, undef, 0, undef, '31-12-2013', 0
);
+
$bookseller1fromid = C4::Bookseller::GetBookSellerFromId($id_supplier1);
is( $bookseller1fromid->{subscriptioncount},
2, 'Supplier1 has 2 subscriptions' );
my $dt_today2 = dt_from_string;
my $dur10 = DateTime::Duration->new( days => -10 );
$dt_today2->add_duration($dur10);
-my $daysago10 = output_pref( $dt_today2, 'iso', '24hr', 1 );
+my $daysago10 = output_pref({ dt => $dt_today2, dateformat => 'iso', timeformat => '24hr', dateonly => 1 });
my $basket3info = {
basketno => $sample_basket3,
closedate => $daysago10,
ModBasket($basket4info);
#Add 1 subscription
-my $id_subscription3 = C4::Serials::NewSubscription(
- undef, "", $id_supplier3, undef,
- $id_budget, $biblionumber, '01-01-2013', undef,
- undef, undef, undef, undef,
- undef, undef, undef, undef,
- undef, undef, undef, undef,
- undef, undef, undef, undef,
- undef, undef, undef, undef,
- undef, undef, undef, 1,
- "notes", undef, undef, undef,
- undef, undef, undef, 0,
- "intnotes", 0, undef, undef,
- 0, undef, '31-12-2013',
+my $id_subscription3 = NewSubscription(
+ undef, "", $id_supplier1, undef, $id_budget, $biblionumber,
+ '01-01-2013',undef, undef, undef, undef,
+ undef, undef, undef, undef, undef, undef,
+ 1, "subscription notes",undef, '01-01-2013', undef, undef,
+ undef, undef, 0, "intnotes", 0,
+ undef, undef, 0, undef, '31-12-2013', 0
);
#Add 4 orders
my $dt_today3 = dt_from_string;
my $dur4 = DateTime::Duration->new( days => -4 );
$dt_today3->add_duration($dur4);
-my $daysago4 = output_pref( $dt_today3, 'iso', '24hr', 1 );
+my $daysago4 = output_pref({ dt => $dt_today3, dateformat => 'iso', timeformat => '24hr', dateonly => 1 });
%suppliers =
C4::Bookseller::GetBooksellersWithLateOrders( undef, $daysago4, undef );