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

(-)a/C4/Serials.pm (-2 / +4 lines)
Lines 1318-1324 sub ModSubscription { Link Here
1318
    $lastvalue2, $innerloop2, $lastvalue3, $innerloop3, $status,
1318
    $lastvalue2, $innerloop2, $lastvalue3, $innerloop3, $status,
1319
    $biblionumber, $callnumber, $notes, $letter, $manualhistory,
1319
    $biblionumber, $callnumber, $notes, $letter, $manualhistory,
1320
    $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1320
    $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1321
    $graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq,
1321
    $graceperiod, $warn_when_late, $location, $enddate, $subscriptionid, $skip_serialseq,
1322
    $itemtype, $previousitemtype, $mana_id
1322
    $itemtype, $previousitemtype, $mana_id
1323
    ) = @_;
1323
    ) = @_;
1324
1324
Lines 1356-1361 sub ModSubscription { Link Here
1356
            staffdisplaycount => $staffdisplaycount,
1356
            staffdisplaycount => $staffdisplaycount,
1357
            opacdisplaycount  => $opacdisplaycount,
1357
            opacdisplaycount  => $opacdisplaycount,
1358
            graceperiod       => $graceperiod,
1358
            graceperiod       => $graceperiod,
1359
            warn_when_late    => $warn_when_late,
1359
            location          => $location,
1360
            location          => $location,
1360
            enddate           => $enddate,
1361
            enddate           => $enddate,
1361
            skip_serialseq    => $skip_serialseq,
1362
            skip_serialseq    => $skip_serialseq,
Lines 1398-1404 sub NewSubscription { Link Here
1398
    $lastvalue1, $innerloop1, $lastvalue2, $innerloop2, $lastvalue3,
1399
    $lastvalue1, $innerloop1, $lastvalue2, $innerloop2, $lastvalue3,
1399
    $innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity,
1400
    $innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity,
1400
    $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes,
1401
    $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes,
1401
    $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,
1402
    $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, $warn_when_late,
1402
    $location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id
1403
    $location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id
1403
    ) = @_;
1404
    ) = @_;
1404
    my $dbh = C4::Context->dbh;
1405
    my $dbh = C4::Context->dbh;
Lines 1436-1441 sub NewSubscription { Link Here
1436
            staffdisplaycount => $staffdisplaycount,
1437
            staffdisplaycount => $staffdisplaycount,
1437
            opacdisplaycount  => $opacdisplaycount,
1438
            opacdisplaycount  => $opacdisplaycount,
1438
            graceperiod       => $graceperiod,
1439
            graceperiod       => $graceperiod,
1440
            warn_when_late    => $warn_when_late,
1439
            location          => $location,
1441
            location          => $location,
1440
            enddate           => $enddate,
1442
            enddate           => $enddate,
1441
            skip_serialseq    => $skip_serialseq,
1443
            skip_serialseq    => $skip_serialseq,
(-)a/Koha/Serial.pm (+7 lines)
Lines 21-26 use Modern::Perl; Link Here
21
21
22
22
23
use Koha::Database;
23
use Koha::Database;
24
use Koha::Subscription;
24
25
25
use base qw(Koha::Object);
26
use base qw(Koha::Object);
26
27
Lines 34-39 Koha::Serial - Koha Serial Object class Link Here
34
35
35
=cut
36
=cut
36
37
38
sub subscription {
39
    my ($self) = @_;
40
41
    return Koha::Subscription->_new_from_dbic($self->_result->subscriptionid);
42
}
43
37
=head3 type
44
=head3 type
38
45
39
=cut
46
=cut
(-)a/installer/data/mysql/atomicupdate/bug-29996.pl (+17 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => '29996',
5
    description => 'Add subscription.warn_when_late',
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
10
        unless (column_exists('subscription', 'warn_when_late')) {
11
            $dbh->do(q{
12
                ALTER TABLE subscription
13
                ADD COLUMN warn_when_late INT NOT NULL DEFAULT 0 COMMENT 'if enabled, late issues will be shown on main page' AFTER graceperiod
14
            });
15
        }
16
    },
17
};
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 4821-4826 CREATE TABLE `subscription` ( Link Here
4821
  `staffdisplaycount` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'how many issues to show to the staff',
4821
  `staffdisplaycount` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'how many issues to show to the staff',
4822
  `opacdisplaycount` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'how many issues to show to the public',
4822
  `opacdisplaycount` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'how many issues to show to the public',
4823
  `graceperiod` int(11) NOT NULL DEFAULT 0 COMMENT 'grace period in days',
4823
  `graceperiod` int(11) NOT NULL DEFAULT 0 COMMENT 'grace period in days',
4824
  `warn_when_late` INT NOT NULL DEFAULT 0 COMMENT 'if enabled, late issues will be shown on main page',
4824
  `enddate` date DEFAULT NULL COMMENT 'subscription end date',
4825
  `enddate` date DEFAULT NULL COMMENT 'subscription end date',
4825
  `closed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes / no if the subscription is closed',
4826
  `closed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes / no if the subscription is closed',
4826
  `reneweddate` date DEFAULT NULL COMMENT 'date of last renewal for the subscription',
4827
  `reneweddate` date DEFAULT NULL COMMENT 'date of last renewal for the subscription',
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt (-1 / +18 lines)
Lines 165-171 Link Here
165
                <div class="row">
165
                <div class="row">
166
                    <div class="col-sm-12">
166
                    <div class="col-sm-12">
167
                        [%# Following statement must be in one line for translatability %]
167
                        [%# Following statement must be in one line for translatability %]
168
                        [% IF ( CAN_user_tools_moderate_comments  && pendingcomments ) || ( CAN_user_tools_moderate_tags && pendingtags ) || ( CAN_user_borrowers_edit_borrowers && pending_borrower_modifications ) || ( CAN_user_suggestions_suggestions_manage && ( pendingsuggestions || all_pendingsuggestions )) || ( CAN_user_borrowers_edit_borrowers && pending_discharge_requests ) || pending_article_requests || ( Koha.Preference('AllowCheckoutNotes') && CAN_user_circulate_manage_checkout_notes && pending_checkout_notes.count ) || ( Koha.Preference('OPACReportProblem') && CAN_user_problem_reports && pending_problem_reports.count ) || already_ran_jobs %]
168
                        [% IF ( CAN_user_tools_moderate_comments  && pendingcomments ) || ( CAN_user_tools_moderate_tags && pendingtags ) || ( CAN_user_borrowers_edit_borrowers && pending_borrower_modifications ) || ( CAN_user_suggestions_suggestions_manage && ( pendingsuggestions || all_pendingsuggestions )) || ( CAN_user_borrowers_edit_borrowers && pending_discharge_requests ) || pending_article_requests || ( Koha.Preference('AllowCheckoutNotes') && CAN_user_circulate_manage_checkout_notes && pending_checkout_notes.count ) || ( Koha.Preference('OPACReportProblem') && CAN_user_problem_reports && pending_problem_reports.count ) || already_ran_jobs || late_subscriptions %]
169
                            <div id="area-pending">
169
                            <div id="area-pending">
170
                                [% IF pending_article_requests %]
170
                                [% IF pending_article_requests %]
171
                                <div class="pending-info" id="article_requests_pending">
171
                                <div class="pending-info" id="article_requests_pending">
Lines 240-245 Link Here
240
                                    </div>
240
                                    </div>
241
                                [% END %]
241
                                [% END %]
242
242
243
                                [% IF late_subscriptions %]
244
                                    <div class="pending-info" id="problem_late_subscriptions">
245
                                        <span>The following serials are late:</span>
246
                                        <ul>
247
                                        [% FOREACH s IN late_subscriptions %]
248
                                            <li>
249
                                                <a href="/cgi-bin/koha/serials/serials-collection.pl?subscriptionid=[% s.subscription.subscriptionid | uri %]">[% s.subscription.biblio.title | html %]</a>:
250
                                                [% FOREACH serial IN s.serials %]
251
                                                    [% serial.serialseq | html %]
252
                                                    [% "," UNLESS loop.last %]
253
                                                [% END %]
254
                                            </li>
255
                                        [% END %]
256
                                        </ul>
257
                                    </div>
258
                                [% END %]
259
243
                            </div>
260
                            </div>
244
261
245
                        [% END %]
262
                        [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt (+9 lines)
Lines 231-236 fieldset.rows table { clear: none; margin: 0; } Link Here
231
                                    <label for="graceperiod">Grace period:</label>
231
                                    <label for="graceperiod">Grace period:</label>
232
                                    <input type="text" name="graceperiod" id="graceperiod" value="[% graceperiod | html %]" size="5"/> day(s)
232
                                    <input type="text" name="graceperiod" id="graceperiod" value="[% graceperiod | html %]" size="5"/> day(s)
233
                                </li>
233
                                </li>
234
                                <li>
235
                                    <label for="warn_when_late">Warn when late</label>
236
                                    [% IF warn_when_late %]
237
                                        <input type="checkbox" name="warn_when_late" id="warn_when_late" value="1" checked />
238
                                    [% ELSE %]
239
                                        <input type="checkbox" name="warn_when_late" id="warn_when_late" value="1" />
240
                                    [% END %]
241
                                    <div class="hint">Show an alert on main page when issues are late</div>
242
                                </li>
234
                                <li>
243
                                <li>
235
                                     <label class="widelabel" for="staffdisplaycount">Number of issues to display to staff: </label>
244
                                     <label class="widelabel" for="staffdisplaycount">Number of issues to display to staff: </label>
236
                                     <input type="text" name="staffdisplaycount" id="staffdisplaycount" value="[% staffdisplaycount | html %]" size="4"/>
245
                                     <input type="text" name="staffdisplaycount" id="staffdisplaycount" value="[% staffdisplaycount | html %]" size="4"/>
(-)a/mainpage.pl (-1 / +31 lines)
Lines 25-30 use C4::Output qw( output_html_with_http_headers ); Link Here
25
use C4::Auth qw( get_template_and_user );
25
use C4::Auth qw( get_template_and_user );
26
use C4::Koha;
26
use C4::Koha;
27
use C4::Tags qw( get_count_by_tag_status );
27
use C4::Tags qw( get_count_by_tag_status );
28
use C4::Serials;
28
use Koha::AdditionalContents;
29
use Koha::AdditionalContents;
29
use Koha::Patron::Modifications;
30
use Koha::Patron::Modifications;
30
use Koha::Patron::Discharge;
31
use Koha::Patron::Discharge;
Lines 32-37 use Koha::Reviews; Link Here
32
use Koha::ArticleRequests;
33
use Koha::ArticleRequests;
33
use Koha::ProblemReports;
34
use Koha::ProblemReports;
34
use Koha::Quotes;
35
use Koha::Quotes;
36
use Koha::Serials;
35
use Koha::Suggestions;
37
use Koha::Suggestions;
36
use Koha::BackgroundJobs;
38
use Koha::BackgroundJobs;
37
39
Lines 108-120 unless ( $logged_in_user->has_permission( { parameters => 'manage_background_job Link Here
108
    $template->param( already_ran_jobs => $already_ran_jobs );
110
    $template->param( already_ran_jobs => $already_ran_jobs );
109
}
111
}
110
112
113
my @late_serials = Koha::Serials->search(
114
    {
115
        'me.status' => C4::Serials::LATE,
116
        'subscriptionid.warn_when_late' => 1,
117
        'subscriptionid.branchcode' => C4::Context->userenv->{branch},
118
    },
119
    {
120
        join => 'subscriptionid',
121
        prefetch => {
122
            subscriptionid => 'biblionumber',
123
        },
124
    }
125
);
126
127
my %late_serials_grouped_by_subscription;
128
foreach my $serial (@late_serials) {
129
    my $subscriptionid = $serial->subscriptionid;
130
    $late_serials_grouped_by_subscription{$subscriptionid} //= {
131
        subscription => $serial->subscription,
132
        serials => [],
133
    };
134
    push @{ $late_serials_grouped_by_subscription{$subscriptionid}->{serials} }, $serial;
135
}
136
my @late_subscriptions = sort {
137
    $a->{subscription}->subscriptionid <=> $b->{subscription}->subscriptionid
138
} values %late_serials_grouped_by_subscription;
139
111
$template->param(
140
$template->param(
112
    pendingcomments                => $pendingcomments,
141
    pendingcomments                => $pendingcomments,
113
    pendingtags                    => $pendingtags,
142
    pendingtags                    => $pendingtags,
114
    pending_borrower_modifications => $pending_borrower_modifications,
143
    pending_borrower_modifications => $pending_borrower_modifications,
115
    pending_discharge_requests     => $pending_discharge_requests,
144
    pending_discharge_requests     => $pending_discharge_requests,
116
    pending_article_requests       => $pending_article_requests,
145
    pending_article_requests       => $pending_article_requests,
117
    pending_problem_reports        => $pending_problem_reports
146
    pending_problem_reports        => $pending_problem_reports,
147
    late_subscriptions             => \@late_subscriptions,
118
);
148
);
119
149
120
output_html_with_http_headers $query, $cookie, $template->output;
150
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/serials/subscription-add.pl (-3 / +4 lines)
Lines 302-307 sub redirect_add_subscription { Link Here
302
    my @irregularity   = $query->multi_param('irregularity');
302
    my @irregularity   = $query->multi_param('irregularity');
303
    my $locale         = $query->param('locale');
303
    my $locale         = $query->param('locale');
304
    my $graceperiod    = $query->param('graceperiod') || 0;
304
    my $graceperiod    = $query->param('graceperiod') || 0;
305
    my $warn_when_late = $query->param('warn_when_late');
305
306
306
    my $subtype = $query->param('subtype');
307
    my $subtype = $query->param('subtype');
307
    my $sublength = $query->param('sublength');
308
    my $sublength = $query->param('sublength');
Lines 353-359 sub redirect_add_subscription { Link Here
353
        $lastvalue3, $innerloop3, $status, $notes, $letter, $firstacquidate,
354
        $lastvalue3, $innerloop3, $status, $notes, $letter, $firstacquidate,
354
        join(";",@irregularity), $numberpattern, $locale, $callnumber,
355
        join(";",@irregularity), $numberpattern, $locale, $callnumber,
355
        $manualhistory, $internalnotes, $serialsadditems,
356
        $manualhistory, $internalnotes, $serialsadditems,
356
        $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
357
        $staffdisplaycount, $opacdisplaycount, $graceperiod, $warn_when_late, $location, $enddate,
357
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id
358
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id
358
    );
359
    );
359
    if ( (C4::Context->preference('Mana') == 1) and ( grep { $_ eq "subscription" } split(/,/, C4::Context->preference('AutoShareWithMana'))) ){
360
    if ( (C4::Context->preference('Mana') == 1) and ( grep { $_ eq "subscription" } split(/,/, C4::Context->preference('AutoShareWithMana'))) ){
Lines 437-442 sub redirect_mod_subscription { Link Here
437
	my $staffdisplaycount = $query->param('staffdisplaycount');
438
	my $staffdisplaycount = $query->param('staffdisplaycount');
438
	my $opacdisplaycount = $query->param('opacdisplaycount');
439
	my $opacdisplaycount = $query->param('opacdisplaycount');
439
    my $graceperiod     = $query->param('graceperiod') || 0;
440
    my $graceperiod     = $query->param('graceperiod') || 0;
441
    my $warn_when_late = $query->param('warn_when_late');
440
    my $location = $query->param('location');
442
    my $location = $query->param('location');
441
    my $itemtype          = $query->param('itemtype');
443
    my $itemtype          = $query->param('itemtype');
442
    my $previousitemtype  = $query->param('previousitemtype');
444
    my $previousitemtype  = $query->param('previousitemtype');
Lines 475-481 sub redirect_mod_subscription { Link Here
475
        $innerloop1, $lastvalue2, $innerloop2, $lastvalue3, $innerloop3,
477
        $innerloop1, $lastvalue2, $innerloop2, $lastvalue3, $innerloop3,
476
        $status, $biblionumber, $callnumber, $notes, $letter,
478
        $status, $biblionumber, $callnumber, $notes, $letter,
477
        $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount,
479
        $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount,
478
        $opacdisplaycount, $graceperiod, $location, $enddate, $subscriptionid,
480
        $opacdisplaycount, $graceperiod, $warn_when_late, $location, $enddate, $subscriptionid,
479
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id
481
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id
480
    );
482
    );
481
483
482
- 

Return to bug 29996