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

(-)a/C4/Serials.pm (-2 / +4 lines)
Lines 1323-1329 sub ModSubscription { Link Here
1323
    $lastvalue2, $innerloop2, $lastvalue3, $innerloop3, $status,
1323
    $lastvalue2, $innerloop2, $lastvalue3, $innerloop3, $status,
1324
    $biblionumber, $callnumber, $notes, $letter, $manualhistory,
1324
    $biblionumber, $callnumber, $notes, $letter, $manualhistory,
1325
    $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1325
    $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1326
    $graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq,
1326
    $graceperiod, $warn_when_late, $location, $enddate, $subscriptionid, $skip_serialseq,
1327
    $itemtype, $previousitemtype, $mana_id, $ccode, $published_on_template
1327
    $itemtype, $previousitemtype, $mana_id, $ccode, $published_on_template
1328
    ) = @_;
1328
    ) = @_;
1329
1329
Lines 1361-1366 sub ModSubscription { Link Here
1361
            staffdisplaycount => $staffdisplaycount,
1361
            staffdisplaycount => $staffdisplaycount,
1362
            opacdisplaycount  => $opacdisplaycount,
1362
            opacdisplaycount  => $opacdisplaycount,
1363
            graceperiod       => $graceperiod,
1363
            graceperiod       => $graceperiod,
1364
            warn_when_late    => $warn_when_late // 0,
1364
            location          => $location,
1365
            location          => $location,
1365
            enddate           => $enddate,
1366
            enddate           => $enddate,
1366
            skip_serialseq    => $skip_serialseq,
1367
            skip_serialseq    => $skip_serialseq,
Lines 1405-1411 sub NewSubscription { Link Here
1405
    $lastvalue1, $innerloop1, $lastvalue2, $innerloop2, $lastvalue3,
1406
    $lastvalue1, $innerloop1, $lastvalue2, $innerloop2, $lastvalue3,
1406
    $innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity,
1407
    $innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity,
1407
    $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes,
1408
    $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes,
1408
    $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,
1409
    $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, $warn_when_late,
1409
    $location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode,
1410
    $location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode,
1410
    $published_on_template,
1411
    $published_on_template,
1411
    ) = @_;
1412
    ) = @_;
Lines 1444-1449 sub NewSubscription { Link Here
1444
            staffdisplaycount => $staffdisplaycount,
1445
            staffdisplaycount => $staffdisplaycount,
1445
            opacdisplaycount  => $opacdisplaycount,
1446
            opacdisplaycount  => $opacdisplaycount,
1446
            graceperiod       => $graceperiod,
1447
            graceperiod       => $graceperiod,
1448
            warn_when_late    => $warn_when_late // 0,
1447
            location          => $location,
1449
            location          => $location,
1448
            enddate           => $enddate,
1450
            enddate           => $enddate,
1449
            skip_serialseq    => $skip_serialseq,
1451
            skip_serialseq    => $skip_serialseq,
(-)a/Koha/Serial.pm (+15 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
=head3 subscription
39
40
Returns the subscription this serial belongs to
41
42
    $subscription = $serial->subscription()
43
44
=cut
45
46
sub subscription {
47
    my ($self) = @_;
48
49
    return Koha::Subscription->_new_from_dbic( $self->_result->subscriptionid );
50
}
51
37
=head3 type
52
=head3 type
38
53
39
=cut
54
=cut
(-)a/installer/data/mysql/atomicupdate/bug-29996.pl (+19 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(
12
                q{
13
                ALTER TABLE subscription
14
                ADD COLUMN warn_when_late INT NOT NULL DEFAULT 0 COMMENT 'if enabled, late issues will be shown on main page' AFTER graceperiod
15
            }
16
            );
17
        }
18
    },
19
};
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 6136-6141 CREATE TABLE `subscription` ( Link Here
6136
  `staffdisplaycount` int(11) DEFAULT NULL COMMENT 'how many issues to show to the staff',
6136
  `staffdisplaycount` int(11) DEFAULT NULL COMMENT 'how many issues to show to the staff',
6137
  `opacdisplaycount` int(11) DEFAULT NULL COMMENT 'how many issues to show to the public',
6137
  `opacdisplaycount` int(11) DEFAULT NULL COMMENT 'how many issues to show to the public',
6138
  `graceperiod` int(11) NOT NULL DEFAULT 0 COMMENT 'grace period in days',
6138
  `graceperiod` int(11) NOT NULL DEFAULT 0 COMMENT 'grace period in days',
6139
  `warn_when_late` INT NOT NULL DEFAULT 0 COMMENT 'if enabled, late issues will be shown on main page',
6139
  `enddate` date DEFAULT NULL COMMENT 'subscription end date',
6140
  `enddate` date DEFAULT NULL COMMENT 'subscription end date',
6140
  `closed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes / no if the subscription is closed',
6141
  `closed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes / no if the subscription is closed',
6141
  `reneweddate` date DEFAULT NULL COMMENT 'date of last renewal for the subscription',
6142
  `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 180-186 Link Here
180
                <div class="row">
180
                <div class="row">
181
                    <div class="col-sm-12">
181
                    <div class="col-sm-12">
182
                        [%# Following statement must be in one line for translatability %]
182
                        [%# Following statement must be in one line for translatability %]
183
                        [% 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('OpacCatalogConcerns') || Koha.Preference('CatalogConcerns') ) && pending_biblio_tickets && CAN_user_editcatalogue_edit_catalogue ) || ( Koha.Preference('OPACReportProblem') && CAN_user_problem_reports && pending_problem_reports.count ) || already_ran_jobs || new_curbside_pickups.count || ( holds_with_cancellation_requests && CAN_user_circulate_circulate_remaining_permissions ) %]
183
                        [% 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('OpacCatalogConcerns') || Koha.Preference('CatalogConcerns') ) && pending_biblio_tickets && CAN_user_editcatalogue_edit_catalogue ) || ( Koha.Preference('OPACReportProblem') && CAN_user_problem_reports && pending_problem_reports.count ) || already_ran_jobs || new_curbside_pickups.count || ( holds_with_cancellation_requests && CAN_user_circulate_circulate_remaining_permissions ) || late_subscriptions %]
184
                            <div id="area-pending" class="page-section">
184
                            <div id="area-pending" class="page-section">
185
                                [% IF pending_article_requests %]
185
                                [% IF pending_article_requests %]
186
                                <div class="pending-info" id="article_requests_pending">
186
                                <div class="pending-info" id="article_requests_pending">
Lines 275-280 Link Here
275
                                        <span class="pending-number-link">[% holds_with_cancellation_requests | html %]</span>
275
                                        <span class="pending-number-link">[% holds_with_cancellation_requests | html %]</span>
276
                                    </div>
276
                                    </div>
277
                                [% END %]
277
                                [% END %]
278
279
                                [% IF late_subscriptions %]
280
                                    <div class="pending-info" id="problem_late_subscriptions">
281
                                        <span>The following serials are late:</span>
282
                                        <ul>
283
                                        [% FOREACH s IN late_subscriptions %]
284
                                            <li>
285
                                                <a href="/cgi-bin/koha/serials/serials-collection.pl?subscriptionid=[% s.subscription.subscriptionid | uri %]">[% s.subscription.biblio.title | html %]</a>:
286
                                                [% FOREACH serial IN s.serials %]
287
                                                    [% serial.serialseq | html %]
288
                                                    [% "," UNLESS loop.last %]
289
                                                [% END %]
290
                                            </li>
291
                                        [% END %]
292
                                        </ul>
293
                                    </div>
294
                                [% END %]
278
                            </div>
295
                            </div>
279
296
280
                        [% END %]
297
                        [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt (+9 lines)
Lines 247-252 fieldset.rows table { clear: none; margin: 0; } Link Here
247
                                    <label for="graceperiod">Grace period:</label>
247
                                    <label for="graceperiod">Grace period:</label>
248
                                    <input type="text" name="graceperiod" id="graceperiod" value="[% graceperiod | html %]" size="5"/> day(s)
248
                                    <input type="text" name="graceperiod" id="graceperiod" value="[% graceperiod | html %]" size="5"/> day(s)
249
                                </li>
249
                                </li>
250
                                <li>
251
                                    <label for="warn_when_late">Warn when late</label>
252
                                    [% IF warn_when_late %]
253
                                        <input type="checkbox" name="warn_when_late" id="warn_when_late" value="1" checked />
254
                                    [% ELSE %]
255
                                        <input type="checkbox" name="warn_when_late" id="warn_when_late" value="1" />
256
                                    [% END %]
257
                                    <div class="hint">Show an alert on main page when issues are late</div>
258
                                </li>
250
                                <li>
259
                                <li>
251
                                     <label class="widelabel" for="staffdisplaycount">Number of issues to display to staff: </label>
260
                                     <label class="widelabel" for="staffdisplaycount">Number of issues to display to staff: </label>
252
                                     <input type="text" name="staffdisplaycount" id="staffdisplaycount" value="[% staffdisplaycount | html %]" inputmode="numeric" pattern="[0-9]*"  size="4"/>
261
                                     <input type="text" name="staffdisplaycount" id="staffdisplaycount" value="[% staffdisplaycount | html %]" inputmode="numeric" pattern="[0-9]*"  size="4"/>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt (+8 lines)
Lines 139-144 Link Here
139
                                                [% END %]
139
                                                [% END %]
140
                                            </li>
140
                                            </li>
141
                                            <li><span class="label">Grace period:</span> [% graceperiod | html %]</li>
141
                                            <li><span class="label">Grace period:</span> [% graceperiod | html %]</li>
142
                                            <li>
143
                                                <span class="label">Warn when late:</span>
144
                                                [% IF warn_when_late %]
145
                                                    Yes
146
                                                [% ELSE %]
147
                                                    No
148
                                                [% END %]
149
                                            </li>
142
                                        </ol>
150
                                        </ol>
143
                                    </div> <!-- /.rows -->
151
                                    </div> <!-- /.rows -->
144
                                </div> <!-- /.col-sm-6 -->
152
                                </div> <!-- /.col-sm-6 -->
(-)a/mainpage.pl (+29 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 33-38 use Koha::ArticleRequests; Link Here
33
use Koha::BiblioFrameworks;
34
use Koha::BiblioFrameworks;
34
use Koha::ProblemReports;
35
use Koha::ProblemReports;
35
use Koha::Quotes;
36
use Koha::Quotes;
37
use Koha::Serials;
36
use Koha::Suggestions;
38
use Koha::Suggestions;
37
use Koha::BackgroundJobs;
39
use Koha::BackgroundJobs;
38
use Koha::CurbsidePickups;
40
use Koha::CurbsidePickups;
Lines 138-143 if ( C4::Context->preference('CurbsidePickup') ) { Link Here
138
    );
140
    );
139
}
141
}
140
142
143
my @late_serials = Koha::Serials->search(
144
    {
145
        'me.status'                     => C4::Serials::LATE,
146
        'subscriptionid.warn_when_late' => 1,
147
        'subscriptionid.branchcode'     => C4::Context->userenv->{branch},
148
    },
149
    {
150
        join     => 'subscriptionid',
151
        prefetch => {
152
            subscriptionid => 'biblionumber',
153
        },
154
    }
155
)->as_list;
156
157
my %late_serials_grouped_by_subscription;
158
foreach my $serial (@late_serials) {
159
    my $subscriptionid = $serial->subscriptionid;
160
    $late_serials_grouped_by_subscription{$subscriptionid} //= {
161
        subscription => $serial->subscription,
162
        serials      => [],
163
    };
164
    push @{ $late_serials_grouped_by_subscription{$subscriptionid}->{serials} }, $serial;
165
}
166
my @late_subscriptions = sort { $a->{subscription}->subscriptionid <=> $b->{subscription}->subscriptionid }
167
    values %late_serials_grouped_by_subscription;
168
141
$template->param(
169
$template->param(
142
    pendingcomments                => $pendingcomments,
170
    pendingcomments                => $pendingcomments,
143
    pendingtags                    => $pendingtags,
171
    pendingtags                    => $pendingtags,
Lines 145-150 $template->param( Link Here
145
    pending_discharge_requests     => $pending_discharge_requests,
173
    pending_discharge_requests     => $pending_discharge_requests,
146
    pending_article_requests       => $pending_article_requests,
174
    pending_article_requests       => $pending_article_requests,
147
    pending_problem_reports        => $pending_problem_reports,
175
    pending_problem_reports        => $pending_problem_reports,
176
    late_subscriptions             => \@late_subscriptions,
148
);
177
);
149
178
150
output_html_with_http_headers $query, $cookie, $template->output;
179
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/serials/subscription-add.pl (-3 / +4 lines)
Lines 298-303 sub redirect_add_subscription { Link Here
298
    my @irregularity   = $query->multi_param('irregularity');
298
    my @irregularity   = $query->multi_param('irregularity');
299
    my $locale         = $query->param('locale');
299
    my $locale         = $query->param('locale');
300
    my $graceperiod    = $query->param('graceperiod') || 0;
300
    my $graceperiod    = $query->param('graceperiod') || 0;
301
    my $warn_when_late = $query->param('warn_when_late');
301
302
302
    my $subtype = $query->param('subtype');
303
    my $subtype = $query->param('subtype');
303
    my $sublength = $query->param('sublength');
304
    my $sublength = $query->param('sublength');
Lines 351-357 sub redirect_add_subscription { Link Here
351
        $lastvalue3, $innerloop3, $status, $notes, $letter, $firstacquidate,
352
        $lastvalue3, $innerloop3, $status, $notes, $letter, $firstacquidate,
352
        join(";",@irregularity), $numberpattern, $locale, $callnumber,
353
        join(";",@irregularity), $numberpattern, $locale, $callnumber,
353
        $manualhistory, $internalnotes, $serialsadditems,
354
        $manualhistory, $internalnotes, $serialsadditems,
354
        $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
355
        $staffdisplaycount, $opacdisplaycount, $graceperiod, $warn_when_late, $location, $enddate,
355
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode, $published_on_template
356
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode, $published_on_template
356
    );
357
    );
357
    if ( (C4::Context->preference('Mana') == 1) and ( grep { $_ eq "subscription" } split(/,/, C4::Context->preference('AutoShareWithMana'))) ){
358
    if ( (C4::Context->preference('Mana') == 1) and ( grep { $_ eq "subscription" } split(/,/, C4::Context->preference('AutoShareWithMana'))) ){
Lines 421-426 sub redirect_mod_subscription { Link Here
421
	my $staffdisplaycount = $query->param('staffdisplaycount');
422
	my $staffdisplaycount = $query->param('staffdisplaycount');
422
	my $opacdisplaycount = $query->param('opacdisplaycount');
423
	my $opacdisplaycount = $query->param('opacdisplaycount');
423
    my $graceperiod     = $query->param('graceperiod') || 0;
424
    my $graceperiod     = $query->param('graceperiod') || 0;
425
    my $warn_when_late = $query->param('warn_when_late');
424
    my $location = $query->param('location');
426
    my $location = $query->param('location');
425
    my $itemtype          = $query->param('itemtype');
427
    my $itemtype          = $query->param('itemtype');
426
    my $previousitemtype  = $query->param('previousitemtype');
428
    my $previousitemtype  = $query->param('previousitemtype');
Lines 461-467 sub redirect_mod_subscription { Link Here
461
        $innerloop1, $lastvalue2, $innerloop2, $lastvalue3, $innerloop3,
463
        $innerloop1, $lastvalue2, $innerloop2, $lastvalue3, $innerloop3,
462
        $status, $biblionumber, $callnumber, $notes, $letter,
464
        $status, $biblionumber, $callnumber, $notes, $letter,
463
        $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount,
465
        $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount,
464
        $opacdisplaycount, $graceperiod, $location, $enddate, $subscriptionid,
466
        $opacdisplaycount, $graceperiod, $warn_when_late, $location, $enddate, $subscriptionid,
465
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode, $published_on_template
467
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode, $published_on_template
466
    );
468
    );
467
469
468
- 

Return to bug 29996