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

(-)a/C4/Serials.pm (-6 / +9 lines)
Lines 814-820 sub GetPreviousSerialid { Link Here
814
    my (
814
    my (
815
        $nextseq,       $newlastvalue1, $newlastvalue2, $newlastvalue3,
815
        $nextseq,       $newlastvalue1, $newlastvalue2, $newlastvalue3,
816
        $newinnerloop1, $newinnerloop2, $newinnerloop3
816
        $newinnerloop1, $newinnerloop2, $newinnerloop3
817
    ) = GetNextSeq( $subscription, $pattern, $frequency, $planneddate );
817
    ) = GetNextSeq( $subscription, $pattern, $frequency, $planneddate, $count_forward );
818
818
819
$subscription is a hashref containing all the attributes of the table
819
$subscription is a hashref containing all the attributes of the table
820
'subscription'.
820
'subscription'.
Lines 822-839 $pattern is a hashref containing all the attributes of the table Link Here
822
'subscription_numberpatterns'.
822
'subscription_numberpatterns'.
823
$frequency is a hashref containing all the attributes of the table 'subscription_frequencies'
823
$frequency is a hashref containing all the attributes of the table 'subscription_frequencies'
824
$planneddate is a date string in iso format.
824
$planneddate is a date string in iso format.
825
$count_forward is the number of issues to count forward, defaults to 1 if omitted
825
This function get the next issue for the subscription given on input arg
826
This function get the next issue for the subscription given on input arg
826
827
827
=cut
828
=cut
828
829
829
sub GetNextSeq {
830
sub GetNextSeq {
830
    my ($subscription, $pattern, $frequency, $planneddate) = @_;
831
    my ($subscription, $pattern, $frequency, $planneddate, $count_forward) = @_;
831
832
832
    return unless ($subscription and $pattern);
833
    return unless ($subscription and $pattern);
833
834
834
    my ( $newlastvalue1, $newlastvalue2, $newlastvalue3,
835
    my ( $newlastvalue1, $newlastvalue2, $newlastvalue3,
835
    $newinnerloop1, $newinnerloop2, $newinnerloop3 );
836
    $newinnerloop1, $newinnerloop2, $newinnerloop3 );
836
    my $count = 1;
837
    my $count = $count_forward ? $count_forward : 1;
837
838
838
    if ($subscription->{'skip_serialseq'}) {
839
    if ($subscription->{'skip_serialseq'}) {
839
        my @irreg = split /;/, $subscription->{'irregularity'};
840
        my @irreg = split /;/, $subscription->{'irregularity'};
Lines 1058-1064 sub ModSubscriptionHistory { Link Here
1058
=head2 ModSerialStatus
1059
=head2 ModSerialStatus
1059
1060
1060
    ModSerialStatus($serialid, $serialseq, $planneddate, $publisheddate,
1061
    ModSerialStatus($serialid, $serialseq, $planneddate, $publisheddate,
1061
        $publisheddatetext, $status, $notes);
1062
        $publisheddatetext, $status, $notes, $count_forward);
1062
1063
1063
This function modify the serial status. Serial status is a number.(eg 2 is "arrived")
1064
This function modify the serial status. Serial status is a number.(eg 2 is "arrived")
1064
Note : if we change from "waited" to something else,then we will have to create a new "waited" entry
1065
Note : if we change from "waited" to something else,then we will have to create a new "waited" entry
Lines 1067-1076 Note : if we change from "waited" to something else,then we will have to create Link Here
1067
1068
1068
sub ModSerialStatus {
1069
sub ModSerialStatus {
1069
    my ($serialid, $serialseq, $planneddate, $publisheddate, $publisheddatetext,
1070
    my ($serialid, $serialseq, $planneddate, $publisheddate, $publisheddatetext,
1070
        $status, $notes) = @_;
1071
        $status, $notes, $count_forward) = @_;
1071
1072
1072
    return unless ($serialid);
1073
    return unless ($serialid);
1073
1074
1075
    my $count = $count_forward ? $count_forward : 1;
1076
1074
    #It is a usual serial
1077
    #It is a usual serial
1075
    # 1st, get previous status :
1078
    # 1st, get previous status :
1076
    my $dbh   = C4::Context->dbh;
1079
    my $dbh   = C4::Context->dbh;
Lines 1139-1145 sub ModSerialStatus { Link Here
1139
            $newserialseq,  $newlastvalue1, $newlastvalue2, $newlastvalue3,
1142
            $newserialseq,  $newlastvalue1, $newlastvalue2, $newlastvalue3,
1140
            $newinnerloop1, $newinnerloop2, $newinnerloop3
1143
            $newinnerloop1, $newinnerloop2, $newinnerloop3
1141
          )
1144
          )
1142
          = GetNextSeq( $subscription, $pattern, $frequency, $publisheddate );
1145
          = GetNextSeq( $subscription, $pattern, $frequency, $publisheddate, $count );
1143
1146
1144
        # next date (calculated from actual date & frequency parameters)
1147
        # next date (calculated from actual date & frequency parameters)
1145
        my $nextpublisheddate = GetNextDate($subscription, $publisheddate, $frequency, 1);
1148
        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 37-42 Link Here
37
37
38
                [% INCLUDE 'modals/serials_multi_receiving.inc' %]
38
                [% INCLUDE 'modals/serials_multi_receiving.inc' %]
39
39
40
                [% INCLUDE 'modals/serials_skip_issues.inc' %]
41
40
                [% UNLESS ( popup ) %]
42
                [% UNLESS ( popup ) %]
41
                    [% INCLUDE 'serials-toolbar.inc' %]
43
                    [% INCLUDE 'serials-toolbar.inc' %]
42
44
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 327-332 $(document).ready(function() { Link Here
327
  [% END %]
355
  [% END %]
328
  [% END %]
356
  [% END %]
329
[% END %]
357
[% END %]
358
    <tr>
359
        <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>
360
    </tr>
330
[% FOREACH newserialloo IN newserialloop %]
361
[% FOREACH newserialloo IN newserialloop %]
331
    [% UNLESS ( newserialloo.subscriptionexpired ) %]
362
    [% UNLESS ( newserialloo.subscriptionexpired ) %]
332
    <tr>
363
    <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 90-95 my @status = $query->multi_param('status'); Link Here
90
my @notes           = $query->multi_param('notes');
90
my @notes           = $query->multi_param('notes');
91
my @subscriptionids = $query->multi_param('subscriptionid');
91
my @subscriptionids = $query->multi_param('subscriptionid');
92
my $op              = $query->param('op');
92
my $op              = $query->param('op');
93
my $skip_issues     = $query->param('skip_issues') || 0;
94
95
my $count_forward = $skip_issues + 1;
96
93
if ( scalar(@subscriptionids) == 1 && index( $subscriptionids[0], q|,| ) > 0 ) {
97
if ( scalar(@subscriptionids) == 1 && index( $subscriptionids[0], q|,| ) > 0 ) {
94
    @subscriptionids = split( /,/, $subscriptionids[0] );
98
    @subscriptionids = split( /,/, $subscriptionids[0] );
95
}
99
}
Lines 241-247 if ( $op and $op eq 'cud-serialchangestatus' ) { Link Here
241
                $pub_date,
245
                $pub_date,
242
                $publisheddatetexts[$i],
246
                $publisheddatetexts[$i],
243
                $status[$i],
247
                $status[$i],
244
                $notes[$i]
248
                $notes[$i],
249
                $count_forward
245
            );
250
            );
246
        }
251
        }
247
        my $makePreviousSerialAvailable = C4::Context->preference('makePreviousSerialAvailable');
252
        my $makePreviousSerialAvailable = C4::Context->preference('makePreviousSerialAvailable');
248
- 

Return to bug 32392