View | Details | Raw Unified | Return to bug 23352
Collapse All | Expand All

(-)a/C4/Items.pm (-4 / +4 lines)
Lines 1366-1372 sub _SearchItems_build_where_fragment { Link Here
1366
1366
1367
    my ($items, $total) = SearchItems($filter, $params);
1367
    my ($items, $total) = SearchItems($filter, $params);
1368
1368
1369
Perform ubscriptionCurrentlyOnOrder search among items
1369
Perform a search among items
1370
1370
1371
$filter is a reference to a hash which can be a filter, or a combination of filters.
1371
$filter is a reference to a hash which can be a filter, or a combination of filters.
1372
1372
Lines 1553-1562 sub PrepareItemrecordDisplay { Link Here
1553
1553
1554
    #If the subscription is on order (i.e. aqorders.datereceived is NULL then call GetLastOrderNotReceviedFromSubscription() which
1554
    #If the subscription is on order (i.e. aqorders.datereceived is NULL then call GetLastOrderNotReceviedFromSubscription() which
1555
    #retrieves the last order for the subscriptionid with a datereceived also equalling NULL
1555
    #retrieves the last order for the subscriptionid with a datereceived also equalling NULL
1556
    if ( subscriptionCurrentlyOnOrder($subscriptionid) ) {
1556
    if ( C4::Serials::subscriptionCurrentlyOnOrder($subscriptionid)) {
1557
        $lastOrder = GetLastOrderNotReceivedFromSubscriptionid( $subscriptionid );
1557
        $lastOrder = C4::Acquisition::GetLastOrderNotReceivedFromSubscriptionid( $subscriptionid );
1558
    } else { #Otherwise the subscription has already arrived so retrieve the last order for the subscriptionid where datereceived is not null
1558
    } else { #Otherwise the subscription has already arrived so retrieve the last order for the subscriptionid where datereceived is not null
1559
        $lastOrder = GetLastOrderReceivedFromSubscriptionid( $subscriptionid );
1559
        $lastOrder = C4::Acquisition::GetLastOrderReceivedFromSubscriptionid( $subscriptionid );
1560
    }
1560
    }
1561
1561
1562
    my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
1562
    my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
(-)a/t/db_dependent/Serials.t (-7 / +16 lines)
Lines 18-24 use Koha::DateUtils; Link Here
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 t::lib::TestBuilder;
21
use Test::More tests => 49;
21
use Test::More tests => 51;
22
22
23
BEGIN {
23
BEGIN {
24
    use_ok('C4::Serials');
24
    use_ok('C4::Serials');
Lines 83-97 my $subscriptionid = NewSubscription( Link Here
83
    undef,      undef,  undef, undef, undef, undef,
83
    undef,      undef,  undef, undef, undef, undef,
84
    1,          $notes, ,undef, '2013-01-01', undef, $pattern_id,
84
    1,          $notes, ,undef, '2013-01-01', undef, $pattern_id,
85
    undef,       undef,  0,    $internalnotes,  0,
85
    undef,       undef,  0,    $internalnotes,  0,
86
    undef, undef, 0,          undef,         '2013-12-31', 0
86
    undef, undef, 0,          undef,         '2013-12-31', 0,
87
    undef, undef, undef, 'ccodevalue'
87
);
88
);
88
89
89
my $subscriptioninformation = GetSubscription( $subscriptionid );
90
my $subscriptioninformation = GetSubscription( $subscriptionid );
90
91
91
is( $subscriptioninformation->{notes}, $notes, 'NewSubscription should set notes' );
92
is( $subscriptioninformation->{notes}, $notes, 'NewSubscription should set notes' );
92
is( $subscriptioninformation->{internalnotes}, $internalnotes, 'NewSubscription should set internalnotes' );
93
is( $subscriptioninformation->{internalnotes}, $internalnotes, 'NewSubscription should set internalnotes' );
94
is( $subscriptioninformation->{ccode}, 'ccodevalue', 'NewSubscription ccode should be "ccodevalue"' );
93
95
94
my $subscription_history = C4::Serials::GetSubscriptionHistoryFromSubscriptionId($subscriptionid);
96
my $subscription_history = C4::Serials::GetSubscriptionHistoryFromSubscriptionId($subscriptionid);
97
95
is( $subscription_history->{opacnote}, undef, 'NewSubscription should not set subscriptionhistory opacnotes' );
98
is( $subscription_history->{opacnote}, undef, 'NewSubscription should not set subscriptionhistory opacnotes' );
96
is( $subscription_history->{librariannote}, undef, 'NewSubscription should not set subscriptionhistory librariannotes' );
99
is( $subscription_history->{librariannote}, undef, 'NewSubscription should not set subscriptionhistory librariannotes' );
97
100
Lines 117-122 if (not $frequency->{unit}) { Link Here
117
    $frequency->{description} = "Frequency created by t/db_dependant/Serials.t";
120
    $frequency->{description} = "Frequency created by t/db_dependant/Serials.t";
118
    $subscriptioninformation->{periodicity} = AddSubscriptionFrequency($frequency);
121
    $subscriptioninformation->{periodicity} = AddSubscriptionFrequency($frequency);
119
    $subscriptioninformation->{serialsadditems} = 1;
122
    $subscriptioninformation->{serialsadditems} = 1;
123
    $subscriptioninformation->{ccode} = 'ccodevalue2';
120
124
121
    ModSubscription( @$subscriptioninformation{qw(
125
    ModSubscription( @$subscriptioninformation{qw(
122
        librarian branchcode aqbooksellerid cost aqbudgetid startdate
126
        librarian branchcode aqbooksellerid cost aqbudgetid startdate
Lines 125-136 if (not $frequency->{unit}) { Link Here
125
        innerloop2 lastvalue3 innerloop3 status biblionumber callnumber notes
129
        innerloop2 lastvalue3 innerloop3 status biblionumber callnumber notes
126
        letter manualhistory internalnotes serialsadditems staffdisplaycount
130
        letter manualhistory internalnotes serialsadditems staffdisplaycount
127
        opacdisplaycount graceperiod location enddate subscriptionid
131
        opacdisplaycount graceperiod location enddate subscriptionid
128
        skip_serialseq
132
        skip_serialseq itemtype previousitemtype mana_id ccode
129
    )} );
133
    )} );
130
}
134
}
131
my $expirationdate = GetExpirationDate($subscriptionid) ;
135
my $expirationdate = GetExpirationDate($subscriptionid) ;
132
ok( $expirationdate, "expiration date is not NULL" );
136
ok( $expirationdate, "expiration date is not NULL" );
133
137
138
#Check if ccode has changed
139
my $subscriptioninformation2 = GetSubscription( $subscriptionid );
140
is( $subscriptioninformation2->{ccode}, 'ccodevalue2', 'ModifiedSubscription ccode should be "ccodevalue2"' );
141
134
ok(C4::Serials::GetSubscriptionHistoryFromSubscriptionId($subscriptionid), 'test getting history from sub-scription');
142
ok(C4::Serials::GetSubscriptionHistoryFromSubscriptionId($subscriptionid), 'test getting history from sub-scription');
135
143
136
my ($serials_count, @serials) = GetSerials($subscriptionid);
144
my ($serials_count, @serials) = GetSerials($subscriptionid);
Lines 183-189 if ($old_frequency) { Link Here
183
        innerloop2 lastvalue3 innerloop3 status biblionumber callnumber notes
191
        innerloop2 lastvalue3 innerloop3 status biblionumber callnumber notes
184
        letter manualhistory internalnotes serialsadditems staffdisplaycount
192
        letter manualhistory internalnotes serialsadditems staffdisplaycount
185
        opacdisplaycount graceperiod location enddate subscriptionid
193
        opacdisplaycount graceperiod location enddate subscriptionid
186
        skip_serialseq
194
        skip_serialseq itemtype previousitemtype mana_id ccode
187
    )} );
195
    )} );
188
196
189
    DelSubscriptionFrequency($freq_to_delete);
197
    DelSubscriptionFrequency($freq_to_delete);
Lines 296-302 $subscriptionid = NewSubscription( Link Here
296
    undef,      undef,  undef, undef, undef, undef,
304
    undef,      undef,  undef, undef, undef, undef,
297
    1,          $notes,undef, '2013-01-01', undef, $pattern_id,
305
    1,          $notes,undef, '2013-01-01', undef, $pattern_id,
298
    undef,       undef,  0,    $internalnotes,  0,
306
    undef,       undef,  0,    $internalnotes,  0,
299
    undef, undef, 0,          undef,         '2013-12-31', 0
307
    undef, undef, 0,          undef,         '2013-12-31', 0,
308
    undef, undef, undef, 'ccode'
300
);
309
);
301
my $total_issues;
310
my $total_issues;
302
( $total_issues, @serials ) = C4::Serials::GetSerials( $subscriptionid );
311
( $total_issues, @serials ) = C4::Serials::GetSerials( $subscriptionid );
Lines 396-402 subtest "NewSubscription" => sub { Link Here
396
        "",      "",  "", "", "", "",
405
        "",      "",  "", "", "", "",
397
        1,          $notes,"", '2013-01-01', "", $pattern_id,
406
        1,          $notes,"", '2013-01-01', "", $pattern_id,
398
        "",       "",  0,    $internalnotes,  0,
407
        "",       "",  0,    $internalnotes,  0,
399
        "", "", 0,          "",         '2013-12-31', 0
408
        "", "", 0,          "",         '2013-12-31', 0, "",
409
        "", "", "ccode"
400
    );
410
    );
401
    ok($subscriptionid, "Sending empty string instead of undef to reflect use of the interface");
411
    ok($subscriptionid, "Sending empty string instead of undef to reflect use of the interface");
402
};
412
};
403
- 

Return to bug 23352