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

(-)a/C4/Serials.pm (-2 / +4 lines)
Lines 1285-1291 sub ModSubscription { Link Here
1285
    $lastvalue2, $innerloop2, $lastvalue3, $innerloop3, $status,
1285
    $lastvalue2, $innerloop2, $lastvalue3, $innerloop3, $status,
1286
    $biblionumber, $callnumber, $notes, $letter, $manualhistory,
1286
    $biblionumber, $callnumber, $notes, $letter, $manualhistory,
1287
    $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1287
    $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1288
    $graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq,
1288
    $graceperiod, $warn_when_late, $location, $enddate, $subscriptionid, $skip_serialseq,
1289
    $itemtype, $previousitemtype, $mana_id, $ccode
1289
    $itemtype, $previousitemtype, $mana_id, $ccode
1290
    ) = @_;
1290
    ) = @_;
1291
1291
Lines 1323-1328 sub ModSubscription { Link Here
1323
            staffdisplaycount => $staffdisplaycount,
1323
            staffdisplaycount => $staffdisplaycount,
1324
            opacdisplaycount  => $opacdisplaycount,
1324
            opacdisplaycount  => $opacdisplaycount,
1325
            graceperiod       => $graceperiod,
1325
            graceperiod       => $graceperiod,
1326
            warn_when_late    => $warn_when_late,
1326
            location          => $location,
1327
            location          => $location,
1327
            enddate           => $enddate,
1328
            enddate           => $enddate,
1328
            skip_serialseq    => $skip_serialseq,
1329
            skip_serialseq    => $skip_serialseq,
Lines 1366-1372 sub NewSubscription { Link Here
1366
    $lastvalue1, $innerloop1, $lastvalue2, $innerloop2, $lastvalue3,
1367
    $lastvalue1, $innerloop1, $lastvalue2, $innerloop2, $lastvalue3,
1367
    $innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity,
1368
    $innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity,
1368
    $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes,
1369
    $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes,
1369
    $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,
1370
    $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, $warn_when_late,
1370
    $location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode
1371
    $location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode
1371
    ) = @_;
1372
    ) = @_;
1372
    my $dbh = C4::Context->dbh;
1373
    my $dbh = C4::Context->dbh;
Lines 1404-1409 sub NewSubscription { Link Here
1404
            staffdisplaycount => $staffdisplaycount,
1405
            staffdisplaycount => $staffdisplaycount,
1405
            opacdisplaycount  => $opacdisplaycount,
1406
            opacdisplaycount  => $opacdisplaycount,
1406
            graceperiod       => $graceperiod,
1407
            graceperiod       => $graceperiod,
1408
            warn_when_late    => $warn_when_late,
1407
            location          => $location,
1409
            location          => $location,
1408
            enddate           => $enddate,
1410
            enddate           => $enddate,
1409
            skip_serialseq    => $skip_serialseq,
1411
            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 5342-5347 CREATE TABLE `subscription` ( Link Here
5342
  `staffdisplaycount` INT(11) NULL DEFAULT NULL COMMENT 'how many issues to show to the staff',
5342
  `staffdisplaycount` INT(11) NULL DEFAULT NULL COMMENT 'how many issues to show to the staff',
5343
  `opacdisplaycount` INT(11) NULL DEFAULT NULL COMMENT 'how many issues to show to the public',
5343
  `opacdisplaycount` INT(11) NULL DEFAULT NULL COMMENT 'how many issues to show to the public',
5344
  `graceperiod` int(11) NOT NULL DEFAULT 0 COMMENT 'grace period in days',
5344
  `graceperiod` int(11) NOT NULL DEFAULT 0 COMMENT 'grace period in days',
5345
  `warn_when_late` INT NOT NULL DEFAULT 0 COMMENT 'if enabled, late issues will be shown on main page',
5345
  `enddate` date DEFAULT NULL COMMENT 'subscription end date',
5346
  `enddate` date DEFAULT NULL COMMENT 'subscription end date',
5346
  `closed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes / no if the subscription is closed',
5347
  `closed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes / no if the subscription is closed',
5347
  `reneweddate` date DEFAULT NULL COMMENT 'date of last renewal for the subscription',
5348
  `reneweddate` date DEFAULT NULL COMMENT 'date of last renewal for the subscription',
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt (-1 / +17 lines)
Lines 177-183 Link Here
177
                <div class="row">
177
                <div class="row">
178
                    <div class="col-sm-12">
178
                    <div class="col-sm-12">
179
                        [%# Following statement must be in one line for translatability %]
179
                        [%# Following statement must be in one line for translatability %]
180
                        [% 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 || new_curbside_pickups.count %]
180
                        [% 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 || new_curbside_pickups.count || late_subscriptions %]
181
                            <div id="area-pending" class="page-section">
181
                            <div id="area-pending" class="page-section">
182
                                [% IF pending_article_requests %]
182
                                [% IF pending_article_requests %]
183
                                <div class="pending-info" id="article_requests_pending">
183
                                <div class="pending-info" id="article_requests_pending">
Lines 259-264 Link Here
259
                                    </div>
259
                                    </div>
260
                                [% END %]
260
                                [% END %]
261
261
262
                                [% IF late_subscriptions %]
263
                                    <div class="pending-info" id="problem_late_subscriptions">
264
                                        <span>The following serials are late:</span>
265
                                        <ul>
266
                                        [% FOREACH s IN late_subscriptions %]
267
                                            <li>
268
                                                <a href="/cgi-bin/koha/serials/serials-collection.pl?subscriptionid=[% s.subscription.subscriptionid | uri %]">[% s.subscription.biblio.title | html %]</a>:
269
                                                [% FOREACH serial IN s.serials %]
270
                                                    [% serial.serialseq | html %]
271
                                                    [% "," UNLESS loop.last %]
272
                                                [% END %]
273
                                            </li>
274
                                        [% END %]
275
                                        </ul>
276
                                    </div>
277
                                [% END %]
262
                            </div>
278
                            </div>
263
279
264
                        [% END %]
280
                        [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt (+9 lines)
Lines 255-260 fieldset.rows table { clear: none; margin: 0; } Link Here
255
                                    <label for="graceperiod">Grace period:</label>
255
                                    <label for="graceperiod">Grace period:</label>
256
                                    <input type="text" name="graceperiod" id="graceperiod" value="[% graceperiod | html %]" size="5"/> day(s)
256
                                    <input type="text" name="graceperiod" id="graceperiod" value="[% graceperiod | html %]" size="5"/> day(s)
257
                                </li>
257
                                </li>
258
                                <li>
259
                                    <label for="warn_when_late">Warn when late</label>
260
                                    [% IF warn_when_late %]
261
                                        <input type="checkbox" name="warn_when_late" id="warn_when_late" value="1" checked />
262
                                    [% ELSE %]
263
                                        <input type="checkbox" name="warn_when_late" id="warn_when_late" value="1" />
264
                                    [% END %]
265
                                    <div class="hint">Show an alert on main page when issues are late</div>
266
                                </li>
258
                                <li>
267
                                <li>
259
                                     <label class="widelabel" for="staffdisplaycount">Number of issues to display to staff: </label>
268
                                     <label class="widelabel" for="staffdisplaycount">Number of issues to display to staff: </label>
260
                                     <input type="text" name="staffdisplaycount" id="staffdisplaycount" value="[% staffdisplaycount | html %]" inputmode="numeric" pattern="[0-9]*"  size="4"/>
269
                                     <input type="text" name="staffdisplaycount" id="staffdisplaycount" value="[% staffdisplaycount | html %]" inputmode="numeric" pattern="[0-9]*"  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
use Koha::CurbsidePickups;
39
use Koha::CurbsidePickups;
Lines 119-131 if ( C4::Context->preference('CurbsidePickup') ) { Link Here
119
    );
121
    );
120
}
122
}
121
123
124
my @late_serials = Koha::Serials->search(
125
    {
126
        'me.status' => C4::Serials::LATE,
127
        'subscriptionid.warn_when_late' => 1,
128
        'subscriptionid.branchcode' => C4::Context->userenv->{branch},
129
    },
130
    {
131
        join => 'subscriptionid',
132
        prefetch => {
133
            subscriptionid => 'biblionumber',
134
        },
135
    }
136
)->as_list;
137
138
my %late_serials_grouped_by_subscription;
139
foreach my $serial (@late_serials) {
140
    my $subscriptionid = $serial->subscriptionid;
141
    $late_serials_grouped_by_subscription{$subscriptionid} //= {
142
        subscription => $serial->subscription,
143
        serials => [],
144
    };
145
    push @{ $late_serials_grouped_by_subscription{$subscriptionid}->{serials} }, $serial;
146
}
147
my @late_subscriptions = sort {
148
    $a->{subscription}->subscriptionid <=> $b->{subscription}->subscriptionid
149
} values %late_serials_grouped_by_subscription;
150
122
$template->param(
151
$template->param(
123
    pendingcomments                => $pendingcomments,
152
    pendingcomments                => $pendingcomments,
124
    pendingtags                    => $pendingtags,
153
    pendingtags                    => $pendingtags,
125
    pending_borrower_modifications => $pending_borrower_modifications,
154
    pending_borrower_modifications => $pending_borrower_modifications,
126
    pending_discharge_requests     => $pending_discharge_requests,
155
    pending_discharge_requests     => $pending_discharge_requests,
127
    pending_article_requests       => $pending_article_requests,
156
    pending_article_requests       => $pending_article_requests,
128
    pending_problem_reports        => $pending_problem_reports
157
    pending_problem_reports        => $pending_problem_reports,
158
    late_subscriptions             => \@late_subscriptions,
129
);
159
);
130
160
131
output_html_with_http_headers $query, $cookie, $template->output;
161
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/serials/subscription-add.pl (-3 / +4 lines)
Lines 303-308 sub redirect_add_subscription { Link Here
303
    my @irregularity   = $query->multi_param('irregularity');
303
    my @irregularity   = $query->multi_param('irregularity');
304
    my $locale         = $query->param('locale');
304
    my $locale         = $query->param('locale');
305
    my $graceperiod    = $query->param('graceperiod') || 0;
305
    my $graceperiod    = $query->param('graceperiod') || 0;
306
    my $warn_when_late = $query->param('warn_when_late');
306
307
307
    my $subtype = $query->param('subtype');
308
    my $subtype = $query->param('subtype');
308
    my $sublength = $query->param('sublength');
309
    my $sublength = $query->param('sublength');
Lines 355-361 sub redirect_add_subscription { Link Here
355
        $lastvalue3, $innerloop3, $status, $notes, $letter, $firstacquidate,
356
        $lastvalue3, $innerloop3, $status, $notes, $letter, $firstacquidate,
356
        join(";",@irregularity), $numberpattern, $locale, $callnumber,
357
        join(";",@irregularity), $numberpattern, $locale, $callnumber,
357
        $manualhistory, $internalnotes, $serialsadditems,
358
        $manualhistory, $internalnotes, $serialsadditems,
358
        $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
359
        $staffdisplaycount, $opacdisplaycount, $graceperiod, $warn_when_late, $location, $enddate,
359
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode
360
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode
360
    );
361
    );
361
    if ( (C4::Context->preference('Mana') == 1) and ( grep { $_ eq "subscription" } split(/,/, C4::Context->preference('AutoShareWithMana'))) ){
362
    if ( (C4::Context->preference('Mana') == 1) and ( grep { $_ eq "subscription" } split(/,/, C4::Context->preference('AutoShareWithMana'))) ){
Lines 440-445 sub redirect_mod_subscription { Link Here
440
	my $staffdisplaycount = $query->param('staffdisplaycount');
441
	my $staffdisplaycount = $query->param('staffdisplaycount');
441
	my $opacdisplaycount = $query->param('opacdisplaycount');
442
	my $opacdisplaycount = $query->param('opacdisplaycount');
442
    my $graceperiod     = $query->param('graceperiod') || 0;
443
    my $graceperiod     = $query->param('graceperiod') || 0;
444
    my $warn_when_late = $query->param('warn_when_late');
443
    my $location = $query->param('location');
445
    my $location = $query->param('location');
444
    my $itemtype          = $query->param('itemtype');
446
    my $itemtype          = $query->param('itemtype');
445
    my $previousitemtype  = $query->param('previousitemtype');
447
    my $previousitemtype  = $query->param('previousitemtype');
Lines 479-485 sub redirect_mod_subscription { Link Here
479
        $innerloop1, $lastvalue2, $innerloop2, $lastvalue3, $innerloop3,
481
        $innerloop1, $lastvalue2, $innerloop2, $lastvalue3, $innerloop3,
480
        $status, $biblionumber, $callnumber, $notes, $letter,
482
        $status, $biblionumber, $callnumber, $notes, $letter,
481
        $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount,
483
        $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount,
482
        $opacdisplaycount, $graceperiod, $location, $enddate, $subscriptionid,
484
        $opacdisplaycount, $graceperiod, $warn_when_late, $location, $enddate, $subscriptionid,
483
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode
485
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode
484
    );
486
    );
485
487
486
- 

Return to bug 29996