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

(-)a/C4/Serials.pm (-6 / +9 lines)
Lines 799-805 sub GetPreviousSerialid { Link Here
799
    my (
799
    my (
800
        $nextseq,       $newlastvalue1, $newlastvalue2, $newlastvalue3,
800
        $nextseq,       $newlastvalue1, $newlastvalue2, $newlastvalue3,
801
        $newinnerloop1, $newinnerloop2, $newinnerloop3
801
        $newinnerloop1, $newinnerloop2, $newinnerloop3
802
    ) = GetNextSeq( $subscription, $pattern, $frequency, $planneddate );
802
    ) = GetNextSeq( $subscription, $pattern, $frequency, $planneddate, $count_forward );
803
803
804
$subscription is a hashref containing all the attributes of the table
804
$subscription is a hashref containing all the attributes of the table
805
'subscription'.
805
'subscription'.
Lines 807-824 $pattern is a hashref containing all the attributes of the table Link Here
807
'subscription_numberpatterns'.
807
'subscription_numberpatterns'.
808
$frequency is a hashref containing all the attributes of the table 'subscription_frequencies'
808
$frequency is a hashref containing all the attributes of the table 'subscription_frequencies'
809
$planneddate is a date string in iso format.
809
$planneddate is a date string in iso format.
810
$count_forward is the number of issues to count forward, defaults to 1 if omitted
810
This function get the next issue for the subscription given on input arg
811
This function get the next issue for the subscription given on input arg
811
812
812
=cut
813
=cut
813
814
814
sub GetNextSeq {
815
sub GetNextSeq {
815
    my ($subscription, $pattern, $frequency, $planneddate) = @_;
816
    my ($subscription, $pattern, $frequency, $planneddate, $count_forward) = @_;
816
817
817
    return unless ($subscription and $pattern);
818
    return unless ($subscription and $pattern);
818
819
819
    my ( $newlastvalue1, $newlastvalue2, $newlastvalue3,
820
    my ( $newlastvalue1, $newlastvalue2, $newlastvalue3,
820
    $newinnerloop1, $newinnerloop2, $newinnerloop3 );
821
    $newinnerloop1, $newinnerloop2, $newinnerloop3 );
821
    my $count = 1;
822
    my $count = $count_forward ? $count_forward : 1;
822
823
823
    if ($subscription->{'skip_serialseq'}) {
824
    if ($subscription->{'skip_serialseq'}) {
824
        my @irreg = split /;/, $subscription->{'irregularity'};
825
        my @irreg = split /;/, $subscription->{'irregularity'};
Lines 1042-1048 sub ModSubscriptionHistory { Link Here
1042
=head2 ModSerialStatus
1043
=head2 ModSerialStatus
1043
1044
1044
    ModSerialStatus($serialid, $serialseq, $planneddate, $publisheddate,
1045
    ModSerialStatus($serialid, $serialseq, $planneddate, $publisheddate,
1045
        $publisheddatetext, $status, $notes);
1046
        $publisheddatetext, $status, $notes, $count_forward);
1046
1047
1047
This function modify the serial status. Serial status is a number.(eg 2 is "arrived")
1048
This function modify the serial status. Serial status is a number.(eg 2 is "arrived")
1048
Note : if we change from "waited" to something else,then we will have to create a new "waited" entry
1049
Note : if we change from "waited" to something else,then we will have to create a new "waited" entry
Lines 1051-1060 Note : if we change from "waited" to something else,then we will have to create Link Here
1051
1052
1052
sub ModSerialStatus {
1053
sub ModSerialStatus {
1053
    my ($serialid, $serialseq, $planneddate, $publisheddate, $publisheddatetext,
1054
    my ($serialid, $serialseq, $planneddate, $publisheddate, $publisheddatetext,
1054
        $status, $notes) = @_;
1055
        $status, $notes, $count_forward) = @_;
1055
1056
1056
    return unless ($serialid);
1057
    return unless ($serialid);
1057
1058
1059
    my $count = $count_forward ? $count_forward : 1;
1060
1058
    #It is a usual serial
1061
    #It is a usual serial
1059
    # 1st, get previous status :
1062
    # 1st, get previous status :
1060
    my $dbh   = C4::Context->dbh;
1063
    my $dbh   = C4::Context->dbh;
Lines 1123-1129 sub ModSerialStatus { Link Here
1123
            $newserialseq,  $newlastvalue1, $newlastvalue2, $newlastvalue3,
1126
            $newserialseq,  $newlastvalue1, $newlastvalue2, $newlastvalue3,
1124
            $newinnerloop1, $newinnerloop2, $newinnerloop3
1127
            $newinnerloop1, $newinnerloop2, $newinnerloop3
1125
          )
1128
          )
1126
          = GetNextSeq( $subscription, $pattern, $frequency, $publisheddate );
1129
          = GetNextSeq( $subscription, $pattern, $frequency, $publisheddate, $count );
1127
1130
1128
        # next date (calculated from actual date & frequency parameters)
1131
        # next date (calculated from actual date & frequency parameters)
1129
        my $nextpublisheddate = GetNextDate($subscription, $publisheddate, $frequency, 1);
1132
        my $nextpublisheddate = GetNextDate($subscription, $publisheddate, $frequency, 1);
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/modals/serials_skip_issues.inc (+28 lines)
Line 0 Link Here
1
<div id="skip_issues" class="modal" tabindex="-1" role="dialog" aria-labelledby="skip_issues_label" aria-hidden="true">
2
    <div class="modal-dialog">
3
        <div class="modal-content">
4
            <form action="/cgi-bin/koha/serials/serials-collection.pl" method="post">
5
                <div class="modal-body">
6
                    <fieldset class="rows">
7
                        <legend>Skip issues and generate next</legend>
8
                        <ol>
9
                            <li>
10
                            <label for="nbissues" class="required">How many issues do you want to skip?</label>
11
                            <input type="text" pattern="^\d+$" size="10" id="skip_issues" name="skip_issues" required="required" />
12
                            </li>
13
                        </ol>
14
                        <input type="hidden" name="op" value="gennext" />
15
16
                        [%# subscriptionidlist is used from serials-collection, subscriptionid is used from serils-edit %]
17
                        <input type="hidden" name="subscriptionid" value="[% subscriptionidlist || subscriptionid | html %]" />
18
                    </fieldset>
19
                </div>
20
21
                <div class="modal-footer">
22
                    <a href="#" class="cancel" data-dismiss="modal" aria-hidden="true">Cancel</a>
23
                    <input type="submit" class="btn btn-default approve" value="OK" />
24
                </div>
25
            </form>
26
        </div>
27
    </div>
28
</div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt (+5 lines)
Lines 39-44 Link Here
39
39
40
                [% INCLUDE 'modals/serials_multi_receiving.inc' %]
40
                [% INCLUDE 'modals/serials_multi_receiving.inc' %]
41
41
42
                [% INCLUDE 'modals/serials_skip_issues.inc' %]
43
42
                [% UNLESS ( popup ) %]
44
                [% UNLESS ( popup ) %]
43
                    [% INCLUDE 'serials-toolbar.inc' %]
45
                    [% INCLUDE 'serials-toolbar.inc' %]
44
46
Lines 182-187 Link Here
182
                                                    <div class="btn-group">
184
                                                    <div class="btn-group">
183
                                                        <input type="button" value="Generate next" data-subscriptionid="[% subscriptionidlist | html %]" class="btn btn-default btn-sm generatenext" />
185
                                                        <input type="button" value="Generate next" data-subscriptionid="[% subscriptionidlist | html %]" class="btn btn-default btn-sm generatenext" />
184
                                                    </div>
186
                                                    </div>
187
                                                    <div class="btn-group">
188
                                                        <input type="button" value="Skip issues and generate next" data-subscriptionid="[% subscriptionidlist | html %]"  href="#skip_issues" class="btn btn-default btn-sm" data-toggle="modal" />
189
                                                    </div>
185
                                                    [% IF ( subscriptions.size == 1 and !serialsadditems ) %]&nbsp;
190
                                                    [% IF ( subscriptions.size == 1 and !serialsadditems ) %]&nbsp;
186
                                                        <div class="btn-group"><input type="button" value="Multi receiving" href="#multi_receiving" class="btn btn-default btn-sm" data-toggle="modal"></div>
191
                                                        <div class="btn-group"><input type="button" value="Multi receiving" href="#multi_receiving" class="btn btn-default btn-sm" data-toggle="modal"></div>
187
                                                    [% END %]
192
                                                    [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt (+31 lines)
Lines 12-17 Link Here
12
        $('#multi_receiving').on('show', function () {
12
        $('#multi_receiving').on('show', function () {
13
           $(this).find(".modal-body").html($(".serials_multi_receiving")[0].outerHTML);
13
           $(this).find(".modal-body").html($(".serials_multi_receiving")[0].outerHTML);
14
        });
14
        });
15
16
        $("form").on("submit", function(){
17
                let issues = $('input[name="skip_issues"]').val() ? $('input[name="skip_issues"]').val() : '';
18
                let too_many = _("Choose a value between 0-10 in issues to skip!");
19
                let no_number = _("Not a number in skip issues!");
20
21
                if ( issues == '' || ( issues.match(/^\d+$/) && issues <= 10 )  ) {
22
                    return true;
23
                }
24
                else if ( issues.match(/^\d+$/) && issues > 10  ) {
25
                    alert(too_many);
26
                    return false;
27
                }  else if ( !issues.match(/^\d+$/) ) {
28
                    alert(no_number);
29
                    return false;
30
                }
31
                else {
32
                    return false;
33
                }
34
            });
15
    });
35
    });
16
36
17
function popup(subscriptionid) {
37
function popup(subscriptionid) {
Lines 62-67 $(document).ready(function() { Link Here
62
        }
82
        }
63
        return true;
83
        return true;
64
    });
84
    });
85
86
    $("#toggle_skip_issues").on("change", function() {
87
        if (this.checked) {
88
            $("#skip_issues").removeClass("collapse").prop("disabled", false);
89
        } else {
90
            $("#skip_issues").addClass("collapse").prop("disabled", true);
91
        }
92
    });
65
});
93
});
66
//]]>
94
//]]>
67
</script>
95
</script>
Lines 297-302 $(document).ready(function() { Link Here
297
  [% END %]
325
  [% END %]
298
  [% END %]
326
  [% END %]
299
[% END %]
327
[% END %]
328
    <tr>
329
        <td colspan="6">Skip issues:<input type="checkbox" id="toggle_skip_issues"> <input id="skip_issues" type="text" pattern="^\d+$" name="skip_issues" class="collapse" value="1" disabled required="required"/></td>
330
    </tr>
300
[% FOREACH newserialloo IN newserialloop %]
331
[% FOREACH newserialloo IN newserialloop %]
301
    [% UNLESS ( newserialloo.subscriptionexpired ) %]
332
    [% UNLESS ( newserialloo.subscriptionexpired ) %]
302
    <tr>
333
    <tr>
(-)a/serials/serials-collection.pl (-2 / +4 lines)
Lines 46-51 my ($template, $loggedinuser, $cookie) Link Here
46
                            });
46
                            });
47
my $biblionumber = $query->param('biblionumber');
47
my $biblionumber = $query->param('biblionumber');
48
my @subscriptionid = $query->multi_param('subscriptionid');
48
my @subscriptionid = $query->multi_param('subscriptionid');
49
my $skip_issues = $query->param('skip_issues') || 0;
50
my $count_forward = int $skip_issues + 1;
49
51
50
@subscriptionid= uniq @subscriptionid;
52
@subscriptionid= uniq @subscriptionid;
51
@subscriptionid= sort @subscriptionid;
53
@subscriptionid= sort @subscriptionid;
Lines 69-75 if($op eq 'gennext' && @subscriptionid){ Link Here
69
            my $planneddate = $date_received_today ? dt_from_string : $issue->{planneddate};
71
            my $planneddate = $date_received_today ? dt_from_string : $issue->{planneddate};
70
            ModSerialStatus( $issue->{serialid}, $issue->{serialseq},
72
            ModSerialStatus( $issue->{serialid}, $issue->{serialseq},
71
                    $planneddate, $issue->{publisheddate},
73
                    $planneddate, $issue->{publisheddate},
72
                    $issue->{publisheddatetext}, $status, "" );
74
                    $issue->{publisheddatetext}, $status, "", $count_forward );
73
        } else {
75
        } else {
74
            require C4::Serials::Numberpattern;
76
            require C4::Serials::Numberpattern;
75
            my $subscription = GetSubscription($subscriptionid);
77
            my $subscription = GetSubscription($subscriptionid);
Lines 79-85 if($op eq 'gennext' && @subscriptionid){ Link Here
79
            my (
81
            my (
80
                 $newserialseq,  $newlastvalue1, $newlastvalue2, $newlastvalue3,
82
                 $newserialseq,  $newlastvalue1, $newlastvalue2, $newlastvalue3,
81
                 $newinnerloop1, $newinnerloop2, $newinnerloop3
83
                 $newinnerloop1, $newinnerloop2, $newinnerloop3
82
            ) = GetNextSeq($subscription, $pattern, $frequency, $expected->{publisheddate});
84
            ) = GetNextSeq($subscription, $pattern, $frequency, $expected->{publisheddate}, $count_forward);
83
85
84
             ## We generate the next publication date
86
             ## We generate the next publication date
85
             my $nextpublisheddate = GetNextDate($subscription, $expected->{publisheddate}, $frequency, 1);
87
             my $nextpublisheddate = GetNextDate($subscription, $expected->{publisheddate}, $frequency, 1);
(-)a/serials/serials-edit.pl (-2 / +6 lines)
Lines 89-94 my @status = $query->multi_param('status'); Link Here
89
my @notes           = $query->multi_param('notes');
89
my @notes           = $query->multi_param('notes');
90
my @subscriptionids = $query->multi_param('subscriptionid');
90
my @subscriptionids = $query->multi_param('subscriptionid');
91
my $op              = $query->param('op');
91
my $op              = $query->param('op');
92
my $skip_issues     = $query->param('skip_issues') || 0;
93
94
my $count_forward = $skip_issues + 1;
95
92
if ( scalar(@subscriptionids) == 1 && index( $subscriptionids[0], q|,| ) > 0 ) {
96
if ( scalar(@subscriptionids) == 1 && index( $subscriptionids[0], q|,| ) > 0 ) {
93
    @subscriptionids = split( /,/, $subscriptionids[0] );
97
    @subscriptionids = split( /,/, $subscriptionids[0] );
94
}
98
}
Lines 240-246 if ( $op and $op eq 'serialchangestatus' ) { Link Here
240
                $pub_date,
244
                $pub_date,
241
                $publisheddatetexts[$i],
245
                $publisheddatetexts[$i],
242
                $status[$i],
246
                $status[$i],
243
                $notes[$i]
247
                $notes[$i],
248
                $count_forward
244
            );
249
            );
245
        }
250
        }
246
        my $makePreviousSerialAvailable = C4::Context->preference('makePreviousSerialAvailable');
251
        my $makePreviousSerialAvailable = C4::Context->preference('makePreviousSerialAvailable');
247
- 

Return to bug 32392