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

(-)a/C4/Serials.pm (-4 / +6 lines)
Lines 1346-1353 sub ModSubscription { Link Here
1346
        $lastvalue2,    $innerloop2,       $lastvalue3,        $innerloop3,    $status,
1346
        $lastvalue2,    $innerloop2,       $lastvalue3,        $innerloop3,    $status,
1347
        $biblionumber,  $callnumber,       $notes,             $letter,        $manualhistory,
1347
        $biblionumber,  $callnumber,       $notes,             $letter,        $manualhistory,
1348
        $internalnotes, $serialsadditems,  $staffdisplaycount, $opacdisplaycount,
1348
        $internalnotes, $serialsadditems,  $staffdisplaycount, $opacdisplaycount,
1349
        $graceperiod,   $location,         $enddate,           $subscriptionid, $skip_serialseq,
1349
        $graceperiod,   $warn_when_late,   $location,          $enddate, $subscriptionid, $skip_serialseq,
1350
        $itemtype,      $previousitemtype, $mana_id,           $ccode,          $published_on_template
1350
        $itemtype,      $previousitemtype, $mana_id,           $ccode,   $published_on_template
1351
    ) = @_;
1351
    ) = @_;
1352
1352
1353
    my $subscription = Koha::Subscriptions->find($subscriptionid);
1353
    my $subscription = Koha::Subscriptions->find($subscriptionid);
Lines 1384-1389 sub ModSubscription { Link Here
1384
            staffdisplaycount     => $staffdisplaycount,
1384
            staffdisplaycount     => $staffdisplaycount,
1385
            opacdisplaycount      => $opacdisplaycount,
1385
            opacdisplaycount      => $opacdisplaycount,
1386
            graceperiod           => $graceperiod,
1386
            graceperiod           => $graceperiod,
1387
            warn_when_late        => $warn_when_late // 0,
1387
            location              => $location,
1388
            location              => $location,
1388
            enddate               => $enddate,
1389
            enddate               => $enddate,
1389
            skip_serialseq        => $skip_serialseq,
1390
            skip_serialseq        => $skip_serialseq,
Lines 1429-1436 sub NewSubscription { Link Here
1429
        $lastvalue1,      $innerloop1,        $lastvalue2,       $innerloop2,    $lastvalue3,
1430
        $lastvalue1,      $innerloop1,        $lastvalue2,       $innerloop2,    $lastvalue3,
1430
        $innerloop3,      $status,            $notes,            $letter,        $firstacquidate, $irregularity,
1431
        $innerloop3,      $status,            $notes,            $letter,        $firstacquidate, $irregularity,
1431
        $numberpattern,   $locale,            $callnumber,       $manualhistory, $internalnotes,
1432
        $numberpattern,   $locale,            $callnumber,       $manualhistory, $internalnotes,
1432
        $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,
1433
        $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,   $warn_when_late,
1433
        $location,        $enddate,           $skip_serialseq,   $itemtype, $previousitemtype, $mana_id, $ccode,
1434
        $location,        $enddate,           $skip_serialseq,   $itemtype,      $previousitemtype, $mana_id, $ccode,
1434
        $published_on_template,
1435
        $published_on_template,
1435
    ) = @_;
1436
    ) = @_;
1436
    my $dbh = C4::Context->dbh;
1437
    my $dbh = C4::Context->dbh;
Lines 1468-1473 sub NewSubscription { Link Here
1468
            staffdisplaycount     => $staffdisplaycount,
1469
            staffdisplaycount     => $staffdisplaycount,
1469
            opacdisplaycount      => $opacdisplaycount,
1470
            opacdisplaycount      => $opacdisplaycount,
1470
            graceperiod           => $graceperiod,
1471
            graceperiod           => $graceperiod,
1472
            warn_when_late        => $warn_when_late // 0,
1471
            location              => $location,
1473
            location              => $location,
1472
            enddate               => $enddate,
1474
            enddate               => $enddate,
1473
            skip_serialseq        => $skip_serialseq,
1475
            skip_serialseq        => $skip_serialseq,
(-)a/Koha/Serial.pm (+15 lines)
Lines 20-25 package Koha::Serial; Link Here
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Koha::Database;
22
use Koha::Database;
23
use Koha::Subscription;
23
24
24
use base qw(Koha::Object);
25
use base qw(Koha::Object);
25
26
Lines 33-38 Koha::Serial - Koha Serial Object class Link Here
33
34
34
=cut
35
=cut
35
36
37
=head3 subscription
38
39
Returns the subscription this serial belongs to
40
41
    $subscription = $serial->subscription()
42
43
=cut
44
45
sub subscription {
46
    my ($self) = @_;
47
48
    return Koha::Subscription->_new_from_dbic( $self->_result->subscriptionid );
49
}
50
36
=head3 type
51
=head3 type
37
52
38
=cut
53
=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 6179-6184 CREATE TABLE `subscription` ( Link Here
6179
  `staffdisplaycount` int(11) DEFAULT NULL COMMENT 'how many issues to show to the staff',
6179
  `staffdisplaycount` int(11) DEFAULT NULL COMMENT 'how many issues to show to the staff',
6180
  `opacdisplaycount` int(11) DEFAULT NULL COMMENT 'how many issues to show to the public',
6180
  `opacdisplaycount` int(11) DEFAULT NULL COMMENT 'how many issues to show to the public',
6181
  `graceperiod` int(11) NOT NULL DEFAULT 0 COMMENT 'grace period in days',
6181
  `graceperiod` int(11) NOT NULL DEFAULT 0 COMMENT 'grace period in days',
6182
  `warn_when_late` INT NOT NULL DEFAULT 0 COMMENT 'if enabled, late issues will be shown on main page',
6182
  `enddate` date DEFAULT NULL COMMENT 'subscription end date',
6183
  `enddate` date DEFAULT NULL COMMENT 'subscription end date',
6183
  `closed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes / no if the subscription is closed',
6184
  `closed` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'yes / no if the subscription is closed',
6184
  `reneweddate` date DEFAULT NULL COMMENT 'date of last renewal for the subscription',
6185
  `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 182-188 Link Here
182
            <div class="row">
182
            <div class="row">
183
                <div class="col-sm-12">
183
                <div class="col-sm-12">
184
                    [%# Following statement must be in one line for translatability %]
184
                    [%# Following statement must be in one line for translatability %]
185
                    [% 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 ) || self_registered_count %]
185
                    [% 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 ) || self_registered_count || late_subscriptions %]
186
                        <div id="area-pending" class="page-section">
186
                        <div id="area-pending" class="page-section">
187
                            [% IF pending_article_requests %]
187
                            [% IF pending_article_requests %]
188
                                <div class="pending-info" id="article_requests_pending">
188
                                <div class="pending-info" id="article_requests_pending">
Lines 294-299 Link Here
294
                                    [% END %]
294
                                    [% END %]
295
                                </div>
295
                                </div>
296
                            [% END %]
296
                            [% END %]
297
298
                            [% IF late_subscriptions %]
299
                                <div class="pending-info" id="problem_late_subscriptions">
300
                                    <span>The following serials are late:</span>
301
                                    <ul>
302
                                    [% FOREACH s IN late_subscriptions %]
303
                                        <li>
304
                                            <a href="/cgi-bin/koha/serials/serials-collection.pl?subscriptionid=[% s.subscription.subscriptionid | uri %]">[% s.subscription.biblio.title | html %]</a>:
305
                                            [% FOREACH serial IN s.serials %]
306
                                                [% serial.serialseq | html %]
307
                                                [% "," UNLESS loop.last %]
308
                                            [% END %]
309
                                        </li>
310
                                    [% END %]
311
                                    </ul>
312
                                </div>
313
                            [% END %]
297
                        </div>
314
                        </div>
298
                    [% END %]
315
                    [% END %]
299
                </div>
316
                </div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt (+9 lines)
Lines 262-267 Link Here
262
                            <label for="graceperiod">Grace period:</label>
262
                            <label for="graceperiod">Grace period:</label>
263
                            <input type="text" name="graceperiod" id="graceperiod" value="[% graceperiod | html %]" size="5" /> day(s)
263
                            <input type="text" name="graceperiod" id="graceperiod" value="[% graceperiod | html %]" size="5" /> day(s)
264
                        </li>
264
                        </li>
265
                        <li>
266
                            <label for="warn_when_late">Warn when late</label>
267
                            [% IF warn_when_late %]
268
                                <input type="checkbox" name="warn_when_late" id="warn_when_late" value="1" checked />
269
                            [% ELSE %]
270
                                <input type="checkbox" name="warn_when_late" id="warn_when_late" value="1" />
271
                            [% END %]
272
                            <div class="hint">Show an alert on main page when issues are late</div>
273
                        </li>
265
                        <li>
274
                        <li>
266
                            <label class="widelabel" for="staffdisplaycount">Number of issues to display to staff: </label>
275
                            <label class="widelabel" for="staffdisplaycount">Number of issues to display to staff: </label>
267
                            <input type="text" name="staffdisplaycount" id="staffdisplaycount" value="[% staffdisplaycount | html %]" inputmode="numeric" pattern="[0-9]*" size="4" />
276
                            <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 138-143 Link Here
138
                                    [% END %]
138
                                    [% END %]
139
                                </li>
139
                                </li>
140
                                <li><span class="label">Grace period:</span> [% graceperiod | html %]</li>
140
                                <li><span class="label">Grace period:</span> [% graceperiod | html %]</li>
141
                                <li>
142
                                    <span class="label">Warn when late:</span>
143
                                    [% IF warn_when_late %]
144
                                        Yes
145
                                    [% ELSE %]
146
                                        No
147
                                    [% END %]
148
                                </li>
141
                            </ol>
149
                            </ol>
142
                        </div>
150
                        </div>
143
                        <!-- /.rows -->
151
                        <!-- /.rows -->
(-)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 153-158 if ( C4::Context->preference('PatronSelfRegistrationAlert') ) { Link Here
153
    );
155
    );
154
}
156
}
155
157
158
my @late_serials = Koha::Serials->search(
159
    {
160
        'me.status'                     => C4::Serials::LATE,
161
        'subscriptionid.warn_when_late' => 1,
162
        'subscriptionid.branchcode'     => C4::Context->userenv->{branch},
163
    },
164
    {
165
        join     => 'subscriptionid',
166
        prefetch => {
167
            subscriptionid => 'biblionumber',
168
        },
169
    }
170
)->as_list;
171
172
my %late_serials_grouped_by_subscription;
173
foreach my $serial (@late_serials) {
174
    my $subscriptionid = $serial->subscriptionid;
175
    $late_serials_grouped_by_subscription{$subscriptionid} //= {
176
        subscription => $serial->subscription,
177
        serials      => [],
178
    };
179
    push @{ $late_serials_grouped_by_subscription{$subscriptionid}->{serials} }, $serial;
180
}
181
my @late_subscriptions = sort { $a->{subscription}->subscriptionid <=> $b->{subscription}->subscriptionid }
182
    values %late_serials_grouped_by_subscription;
183
156
$template->param(
184
$template->param(
157
    pendingcomments                => $pendingcomments,
185
    pendingcomments                => $pendingcomments,
158
    pendingtags                    => $pendingtags,
186
    pendingtags                    => $pendingtags,
Lines 160-165 $template->param( Link Here
160
    pending_discharge_requests     => $pending_discharge_requests,
188
    pending_discharge_requests     => $pending_discharge_requests,
161
    pending_article_requests       => $pending_article_requests,
189
    pending_article_requests       => $pending_article_requests,
162
    pending_problem_reports        => $pending_problem_reports,
190
    pending_problem_reports        => $pending_problem_reports,
191
    late_subscriptions             => \@late_subscriptions,
163
);
192
);
164
193
165
output_html_with_http_headers $query, $cookie, $template->output;
194
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/serials/subscription-add.pl (-11 / +12 lines)
Lines 322-327 sub redirect_add_subscription { Link Here
322
    my @irregularity   = $query->multi_param('irregularity');
322
    my @irregularity   = $query->multi_param('irregularity');
323
    my $locale         = $query->param('locale');
323
    my $locale         = $query->param('locale');
324
    my $graceperiod    = $query->param('graceperiod') || 0;
324
    my $graceperiod    = $query->param('graceperiod') || 0;
325
    my $warn_when_late = $query->param('warn_when_late');
325
326
326
    my $subtype   = $query->param('subtype');
327
    my $subtype   = $query->param('subtype');
327
    my $sublength = $query->param('sublength');
328
    my $sublength = $query->param('sublength');
Lines 369-382 sub redirect_add_subscription { Link Here
369
        }
370
        }
370
    }
371
    }
371
    my $subscriptionid = NewSubscription(
372
    my $subscriptionid = NewSubscription(
372
        $auser,                     $branchcode,       $aqbooksellerid, $cost, $aqbudgetid, $biblionumber,
373
        $auser,                     $branchcode,    $aqbooksellerid, $cost, $aqbudgetid, $biblionumber,
373
        $startdate,                 $periodicity,      $numberlength,   $weeklength,
374
        $startdate,                 $periodicity,   $numberlength,   $weeklength,
374
        $monthlength,               $lastvalue1,       $innerloop1,     $lastvalue2, $innerloop2,
375
        $monthlength,               $lastvalue1,    $innerloop1,     $lastvalue2, $innerloop2,
375
        $lastvalue3,                $innerloop3,       $status,         $notes, $letter, $firstacquidate,
376
        $lastvalue3,                $innerloop3,    $status,         $notes, $letter, $firstacquidate,
376
        join( ";", @irregularity ), $numberpattern,    $locale,         $callnumber,
377
        join( ";", @irregularity ), $numberpattern, $locale,         $callnumber,
377
        $manualhistory,             $internalnotes,    $serialsadditems,
378
        $manualhistory,             $internalnotes, $serialsadditems,
378
        $staffdisplaycount,         $opacdisplaycount, $graceperiod, $location, $enddate,
379
        $staffdisplaycount, $opacdisplaycount, $graceperiod,      $warn_when_late, $location, $enddate,
379
        $skip_serialseq,            $itemtype,         $previousitemtype, $mana_id, $ccode, $published_on_template
380
        $skip_serialseq,    $itemtype,         $previousitemtype, $mana_id,        $ccode,    $published_on_template
380
    );
381
    );
381
    if (    ( C4::Context->preference('Mana') == 1 )
382
    if (    ( C4::Context->preference('Mana') == 1 )
382
        and ( grep { $_ eq "subscription" } split( /,/, C4::Context->preference('AutoShareWithMana') ) ) )
383
        and ( grep { $_ eq "subscription" } split( /,/, C4::Context->preference('AutoShareWithMana') ) ) )
Lines 452-457 sub redirect_mod_subscription { Link Here
452
    my $staffdisplaycount     = $query->param('staffdisplaycount');
453
    my $staffdisplaycount     = $query->param('staffdisplaycount');
453
    my $opacdisplaycount      = $query->param('opacdisplaycount');
454
    my $opacdisplaycount      = $query->param('opacdisplaycount');
454
    my $graceperiod           = $query->param('graceperiod') || 0;
455
    my $graceperiod           = $query->param('graceperiod') || 0;
456
    my $warn_when_late        = $query->param('warn_when_late');
455
    my $location              = $query->param('location');
457
    my $location              = $query->param('location');
456
    my $itemtype              = $query->param('itemtype');
458
    my $itemtype              = $query->param('itemtype');
457
    my $previousitemtype      = $query->param('previousitemtype');
459
    my $previousitemtype      = $query->param('previousitemtype');
Lines 493-500 sub redirect_mod_subscription { Link Here
493
        $innerloop1,       $lastvalue2,     $innerloop2,       $lastvalue3, $innerloop3,
495
        $innerloop1,       $lastvalue2,     $innerloop2,       $lastvalue3, $innerloop3,
494
        $status,           $biblionumber,   $callnumber,       $notes,      $letter,
496
        $status,           $biblionumber,   $callnumber,       $notes,      $letter,
495
        $manualhistory,    $internalnotes,  $serialsadditems,  $staffdisplaycount,
497
        $manualhistory,    $internalnotes,  $serialsadditems,  $staffdisplaycount,
496
        $opacdisplaycount, $graceperiod,    $location,         $enddate, $subscriptionid,
498
        $opacdisplaycount, $graceperiod,    $warn_when_late,   $location, $enddate, $subscriptionid,
497
        $skip_serialseq,   $itemtype,       $previousitemtype, $mana_id, $ccode, $published_on_template
499
        $skip_serialseq,   $itemtype,       $previousitemtype, $mana_id,  $ccode,   $published_on_template
498
    );
500
    );
499
501
500
    my @additional_fields =
502
    my @additional_fields =
501
- 

Return to bug 29996