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

(-)a/C4/Serials.pm (-65 / +37 lines)
Lines 1301-1337 sub ModNextExpected { Link Here
1301
1301
1302
}
1302
}
1303
1303
1304
=head2 GetSubscriptionIrregularities
1305
1306
=over 4
1307
1308
=item @irreg = &GetSubscriptionIrregularities($subscriptionid);
1309
get the list of irregularities for a subscription
1310
1311
=back
1312
1313
=cut
1314
1315
sub GetSubscriptionIrregularities {
1316
    my $subscriptionid = shift;
1317
1318
    return unless $subscriptionid;
1319
1320
    my $dbh = C4::Context->dbh;
1321
    my $query = qq{
1322
        SELECT irregularity
1323
        FROM subscription
1324
        WHERE subscriptionid = ?
1325
    };
1326
    my $sth = $dbh->prepare($query);
1327
    $sth->execute($subscriptionid);
1328
1329
    my ($result) = $sth->fetchrow_array;
1330
    my @irreg = split /;/, $result;
1331
1332
    return @irreg;
1333
}
1334
1335
=head2 ModSubscription
1304
=head2 ModSubscription
1336
1305
1337
this function modifies a subscription. Put all new values on input args.
1306
this function modifies a subscription. Put all new values on input args.
Lines 1342-1364 returns the number of rows affected Link Here
1342
sub ModSubscription {
1311
sub ModSubscription {
1343
    my (
1312
    my (
1344
    $auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $startdate,
1313
    $auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $startdate,
1345
    $periodicity, $firstacquidate, $irregularity, $numberpattern, $locale,
1314
    $periodicity, $firstacquidate, $irregularity, $permanent_irregularity,
1346
    $numberlength, $weeklength, $monthlength, $lastvalue1, $innerloop1,
1315
    $numberpattern, $locale, $numberlength, $weeklength, $monthlength,
1347
    $lastvalue2, $innerloop2, $lastvalue3, $innerloop3, $status,
1316
    $lastvalue1, $innerloop1, $lastvalue2, $innerloop2, $lastvalue3,
1348
    $biblionumber, $callnumber, $notes, $letter, $manualhistory,
1317
    $innerloop3, $status, $biblionumber, $callnumber, $notes, $letter,
1349
    $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1318
    $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount,
1350
    $graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq,
1319
    $opacdisplaycount, $graceperiod, $location, $enddate, $subscriptionid,
1351
    $itemtype, $previousitemtype
1320
    $skip_serialseq, $itemtype, $previousitemtype
1352
    ) = @_;
1321
    ) = @_;
1353
1322
1354
    my $dbh   = C4::Context->dbh;
1323
    my $dbh   = C4::Context->dbh;
1355
    my $query = "UPDATE subscription
1324
    my $query = "UPDATE subscription
1356
        SET librarian=?, branchcode=?, aqbooksellerid=?, cost=?, aqbudgetid=?,
1325
        SET librarian=?, branchcode=?, aqbooksellerid=?, cost=?, aqbudgetid=?,
1357
            startdate=?, periodicity=?, firstacquidate=?, irregularity=?,
1326
            startdate=?, periodicity=?, firstacquidate=?, irregularity=?,
1358
            numberpattern=?, locale=?, numberlength=?, weeklength=?, monthlength=?,
1327
            permanent_irregularity=?, numberpattern=?, locale=?, numberlength=?,
1359
            lastvalue1=?, innerloop1=?, lastvalue2=?, innerloop2=?,
1328
            weeklength=?, monthlength=?, lastvalue1=?, innerloop1=?,
1360
            lastvalue3=?, innerloop3=?, status=?, biblionumber=?,
1329
            lastvalue2=?, innerloop2=?, lastvalue3=?, innerloop3=?, status=?,
1361
            callnumber=?, notes=?, letter=?, manualhistory=?,
1330
            biblionumber=?, callnumber=?, notes=?, letter=?, manualhistory=?,
1362
            internalnotes=?, serialsadditems=?, staffdisplaycount=?,
1331
            internalnotes=?, serialsadditems=?, staffdisplaycount=?,
1363
            opacdisplaycount=?, graceperiod=?, location = ?, enddate=?,
1332
            opacdisplaycount=?, graceperiod=?, location = ?, enddate=?,
1364
            skip_serialseq=?, itemtype=?, previousitemtype=?
1333
            skip_serialseq=?, itemtype=?, previousitemtype=?
Lines 1366-1382 sub ModSubscription { Link Here
1366
1335
1367
    my $sth = $dbh->prepare($query);
1336
    my $sth = $dbh->prepare($query);
1368
    $sth->execute(
1337
    $sth->execute(
1369
        $auser,           $branchcode,     $aqbooksellerid, $cost,
1338
        $auser,                     $branchcode,        $aqbooksellerid,
1370
        $aqbudgetid,      $startdate,      $periodicity,    $firstacquidate,
1339
        $cost,                      $aqbudgetid,        $startdate,
1371
        $irregularity,    $numberpattern,  $locale,         $numberlength,
1340
        $periodicity,               $firstacquidate,    $irregularity,
1372
        $weeklength,      $monthlength,    $lastvalue1,     $innerloop1,
1341
        $permanent_irregularity,    $numberpattern,     $locale,
1373
        $lastvalue2,      $innerloop2,     $lastvalue3,     $innerloop3,
1342
        $numberlength,              $weeklength,        $monthlength,
1374
        $status,          $biblionumber,   $callnumber,     $notes,
1343
        $lastvalue1,                $innerloop1,        $lastvalue2,
1375
        $letter,          ($manualhistory ? $manualhistory : 0),
1344
        $innerloop2,                $lastvalue3,        $innerloop3,
1376
        $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1345
        $status,                    $biblionumber,      $callnumber,
1377
        $graceperiod,     $location,       $enddate,        $skip_serialseq,
1346
        $notes,                     $letter,            ($manualhistory ? $manualhistory : 0),
1378
        $itemtype,        $previousitemtype,
1347
        $internalnotes,             $serialsadditems,   $staffdisplaycount,
1379
        $subscriptionid
1348
        $opacdisplaycount,          $graceperiod,       $location,
1349
        $enddate,                   $skip_serialseq,    $itemtype,
1350
        $previousitemtype,          $subscriptionid
1380
    );
1351
    );
1381
    my $rows = $sth->rows;
1352
    my $rows = $sth->rows;
1382
1353
Lines 1407-1415 sub NewSubscription { Link Here
1407
    $startdate, $periodicity, $numberlength, $weeklength, $monthlength,
1378
    $startdate, $periodicity, $numberlength, $weeklength, $monthlength,
1408
    $lastvalue1, $innerloop1, $lastvalue2, $innerloop2, $lastvalue3,
1379
    $lastvalue1, $innerloop1, $lastvalue2, $innerloop2, $lastvalue3,
1409
    $innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity,
1380
    $innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity,
1410
    $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes,
1381
    $permanent_irregularity, $numberpattern, $locale, $callnumber,
1411
    $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,
1382
    $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount,
1412
    $location, $enddate, $skip_serialseq, $itemtype, $previousitemtype
1383
    $opacdisplaycount, $graceperiod, $location, $enddate, $skip_serialseq,
1384
    $itemtype, $previousitemtype
1413
    ) = @_;
1385
    ) = @_;
1414
    my $dbh = C4::Context->dbh;
1386
    my $dbh = C4::Context->dbh;
1415
1387
Lines 1420-1430 sub NewSubscription { Link Here
1420
            biblionumber, startdate, periodicity, numberlength, weeklength,
1392
            biblionumber, startdate, periodicity, numberlength, weeklength,
1421
            monthlength, lastvalue1, innerloop1, lastvalue2, innerloop2,
1393
            monthlength, lastvalue1, innerloop1, lastvalue2, innerloop2,
1422
            lastvalue3, innerloop3, status, notes, letter, firstacquidate,
1394
            lastvalue3, innerloop3, status, notes, letter, firstacquidate,
1423
            irregularity, numberpattern, locale, callnumber,
1395
            irregularity, permanent_irregularity, numberpattern, locale,
1424
            manualhistory, internalnotes, serialsadditems, staffdisplaycount,
1396
            callnumber, manualhistory, internalnotes, serialsadditems,
1425
            opacdisplaycount, graceperiod, location, enddate, skip_serialseq,
1397
            staffdisplaycount, opacdisplaycount, graceperiod, location,
1426
            itemtype, previousitemtype)
1398
            enddate, skip_serialseq, itemtype, previousitemtype)
1427
        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
1399
        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
1428
        |;
1400
        |;
1429
    my $sth = $dbh->prepare($query);
1401
    my $sth = $dbh->prepare($query);
1430
    $sth->execute(
1402
    $sth->execute(
Lines 1432-1441 sub NewSubscription { Link Here
1432
        $startdate, $periodicity, $numberlength, $weeklength,
1404
        $startdate, $periodicity, $numberlength, $weeklength,
1433
        $monthlength, $lastvalue1, $innerloop1, $lastvalue2, $innerloop2,
1405
        $monthlength, $lastvalue1, $innerloop1, $lastvalue2, $innerloop2,
1434
        $lastvalue3, $innerloop3, $status, $notes, $letter,
1406
        $lastvalue3, $innerloop3, $status, $notes, $letter,
1435
        $firstacquidate, $irregularity, $numberpattern, $locale, $callnumber,
1407
        $firstacquidate, $irregularity, $permanent_irregularity,
1436
        $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount,
1408
        $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes,
1437
        $opacdisplaycount, $graceperiod, $location, $enddate, $skip_serialseq,
1409
        $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,
1438
        $itemtype, $previousitemtype
1410
        $location, $enddate, $skip_serialseq, $itemtype, $previousitemtype
1439
    );
1411
    );
1440
1412
1441
    my $subscriptionid = $dbh->{'mysql_insertid'};
1413
    my $subscriptionid = $dbh->{'mysql_insertid'};
(-)a/Koha/DateUtils.pm (-1 / +30 lines)
Lines 18-30 package Koha::DateUtils; Link Here
18
18
19
use Modern::Perl;
19
use Modern::Perl;
20
use DateTime;
20
use DateTime;
21
use Date::Calc qw( Day_of_Week );
21
use C4::Context;
22
use C4::Context;
22
use Koha::Exceptions;
23
use Koha::Exceptions;
23
24
24
use base 'Exporter';
25
use base 'Exporter';
25
26
26
our @EXPORT = (
27
our @EXPORT = (
27
    qw( dt_from_string output_pref format_sqldatetime )
28
    qw( dt_from_string output_pref format_sqldatetime issue_number )
28
);
29
);
29
30
30
=head1 DateUtils
31
=head1 DateUtils
Lines 297-300 sub format_sqldatetime { Link Here
297
    return q{};
298
    return q{};
298
}
299
}
299
300
301
=head2 issue_number
302
303
my $week_number = issue_number('2017-01-01', 'week');
304
305
=cut
306
307
sub issue_number {
308
    my ($date, $issue_type) = @_;
309
310
    unless ( ref($date) eq 'DateTime' ) {
311
        Koha::Exceptions::WrongParameter->throw("Date passed to issue_number is not a valid DateTime object" );
312
    }
313
314
    if ($issue_type eq 'day') {
315
        return Day_of_Week(split /-/, $date->ymd);
316
    }
317
318
    if ($issue_type eq 'week') {
319
        return $date->week_number;
320
    }
321
322
    if ($issue_type eq 'month') {
323
        return $date->month;
324
    }
325
326
    return 0;
327
}
328
300
1;
329
1;
(-)a/Koha/Subscription.pm (+24 lines)
Lines 48-53 sub biblio { Link Here
48
    return scalar Koha::Biblios->find($self->biblionumber);
48
    return scalar Koha::Biblios->find($self->biblionumber);
49
}
49
}
50
50
51
=head2 irregularities
52
53
Returns an array containing irregularities
54
55
=cut
56
57
sub irregularities {
58
    my ($self) = @_;
59
60
    return split(';', $self->irregularity);
61
}
62
63
=head2 permanent_irregularities
64
65
Returns an array containing permanent irregularities
66
67
=cut
68
69
sub permanent_irregularities {
70
    my ($self) = @_;
71
72
    return split(';', $self->permanent_irregularity);
73
}
74
51
=head3 type
75
=head3 type
52
76
53
=cut
77
=cut
(-)a/installer/data/mysql/atomicupdate/Bug_17656-add-permanent-irregularities.sql (+1 lines)
Line 0 Link Here
1
ALTER TABLE `subscription` ADD permanent_irregularity text AFTER irregularity;
(-)a/koha-tmpl/intranet-tmpl/prog/css/staff-global.css (+6 lines)
Lines 3028-3030 fieldset.rows + fieldset.action { Link Here
3028
#patron_search #filters {
3028
#patron_search #filters {
3029
    display: none;
3029
    display: none;
3030
}
3030
}
3031
3032
.week-columns{
3033
    -moz-column-count: 2; /* Firefox */
3034
    -webkit-column-count: 2; /* Safari and Chrome */
3035
    column-count: 3;
3036
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/serials/subscription_daily_choice.inc (+29 lines)
Line 0 Link Here
1
<p><em>
2
    If there is a day (or more) in the week where issues are never
3
    published, you can check corresponding boxes below.
4
</em></p>
5
[% daily_choice = [
6
    {name => 'monday', desc => 'Monday', value => 1},
7
    {name => 'tuesday', desc => 'Tuesday', value => 2},
8
    {name => 'wednesday', desc => 'Wednesday', value => 3},
9
    {name => 'thursday', desc => 'Thursday', value => 4},
10
    {name => 'friday', desc => 'Friday', value => 5},
11
    {name => 'saturday', desc => 'Saturday', value => 6},
12
    {name => 'sunday', desc => 'Sunday', value => 7}
13
] %]
14
15
[% FOREACH day IN daily_choice %]
16
    [% IF permanent_irreg.grep( day.value ).0 == day.value %]
17
        <input type="checkbox" name="permanent_irregularity"
18
               id="[% day.name %]" data-dow="[% day.value %]"
19
               value="[% day.value %]" class="skip"
20
               checked="checked"
21
        />
22
    [% ELSE %]
23
        <input type="checkbox" name="permanent_irregularity"
24
               id="[% day.name %]" data-dow="[% day.value %]"
25
               value="[% day.value %]" class="skip"
26
        />
27
    [% END %]
28
    <label for="[% day.name %]">[% day.desc %]</label>
29
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/serials/subscription_monthly_choice.inc (+34 lines)
Line 0 Link Here
1
<p><em>
2
    If there is a month (or more) in the year where issues are never
3
    published, you can check corresponding boxes below.
4
</em></p>
5
[% monthly_choice = [
6
    {name => 'january', desc => 'January', value => 1},
7
    {name => 'february', desc => 'February', value => 2},
8
    {name => 'march', desc => 'March', value => 3},
9
    {name => 'april', desc => 'April', value => 4},
10
    {name => 'may', desc => 'May', value => 5},
11
    {name => 'june', desc => 'June', value => 6},
12
    {name => 'july', desc => 'July', value => 7}
13
    {name => 'august', desc => 'August', value => 8}
14
    {name => 'september', desc => 'September', value => 9}
15
    {name => 'october', desc => 'October', value => 10}
16
    {name => 'november', desc => 'November', value => 11}
17
    {name => 'december', desc => 'December', value =>12}
18
] %]
19
20
[% FOREACH month IN monthly_choice %]
21
    [% IF permanent_irreg.grep( month.value ).0 == month.value %]
22
        <input type="checkbox" name="permanent_irregularity"
23
               id="[% month.name %]" data-dow="[% month.value %]"
24
               value="[% month.value %]" class="skip"
25
               checked="checked"
26
        />
27
    [% ELSE %]
28
        <input type="checkbox" name="permanent_irregularity"
29
               id="[% month.name %]" data-dow="[% month.value %]"
30
               value="[% month.value %]" class="skip"
31
        />
32
    [% END %]
33
    <label for="[% month.name %]">[% month.desc %]</label>
34
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/serials/subscription_weekly_choice.inc (+28 lines)
Line 0 Link Here
1
<div class="row select-weeks">
2
    <div class="col-lg-12">
3
        <div class="button-group">
4
            <button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
5
                Week(s) not published
6
                <span class="caret"></span>
7
            </button>
8
            <ul class="dropdown-menu week-columns">
9
                [% FOREACH p IN predictions_loop %]
10
                    <li>
11
                        <a href="#" class="small">
12
                            [% IF permanent_irreg.grep( p.dow ).0 == p.dow %]
13
                                <input type="checkbox" name="permanent_irregularity" value="[% p.dow %]" data-dow="[% p.dow %]" class="skip" checked="checked"/>
14
                            [% ELSE %]
15
                                <input type="checkbox" name="permanent_irregularity" value="[% p.dow %]" data-dow="[% p.dow %]" class="skip"/>
16
                            [% END %]
17
                            &nbsp;Week <b>#[% p.dow %]</b> ([% p.publicationdate | $KohaDates %])
18
                        </a>
19
                    </li>
20
                [% END %]
21
            </ul>
22
        </div>
23
    </div>
24
</div>
25
<p>
26
    <em>Choice the week(s) in the year where issues are never
27
    published.</em>
28
</p>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/showpredictionpattern.tt (-20 / +26 lines)
Lines 6-12 Link Here
6
[% END %]
6
[% END %]
7
[% IF (ask_for_irregularities) %]
7
[% IF (ask_for_irregularities) %]
8
    <p><em>Please check issues that are NOT published (irregularities)</em></p>
8
    <p><em>Please check issues that are NOT published (irregularities)</em></p>
9
    [% IF (daily_options) %]
9
    [% IF (show_irregularity_options) %]
10
        <script type="text/javascript">
10
        <script type="text/javascript">
11
        //<![CDATA[
11
        //<![CDATA[
12
        function Check_boxes(dow) {
12
        function Check_boxes(dow) {
Lines 21-50 Link Here
21
            }
21
            }
22
        }
22
        }
23
        $(document).ready(function(){
23
        $(document).ready(function(){
24
            $(".skipday").on("change",function(){
24
            $(".skip").on("change",function(){
25
                Check_boxes( $(this).data("dow"));
25
                Check_boxes( $(this).data("dow"));
26
            });
26
            });
27
28
            nothing_checked = 1;
29
            $("input[name='irregularity']").each(function() {
30
                if ($(this).is(':checked')) {
31
                    nothing_checked = 0;
32
                }
33
            });
34
35
            // No day/month/week are checked, could be after a renewal.
36
            // So check them according to permanent irregularity
37
            if (nothing_checked) {
38
                $(".skipday").each(function() {
39
                    if ($(this).is(':checked')) {
40
                        Check_boxes( $(this).data("dow"));
41
                    }
42
                });
43
            }
27
        });
44
        });
28
        //]]>
45
        //]]>
29
        </script>
46
        </script>
30
        <p><em>
47
        [% IF (show_irregularity_options == 'day') %]
31
            If there is a day (or more) in the week where issues are never
48
            [% INCLUDE 'serials/subscription_daily_choice.inc' %]
32
            published, you can check corresponding boxes below.
49
        [% ELSIF (show_irregularity_options == 'month') %]
33
        </em></p>
50
            [% INCLUDE 'serials/subscription_monthly_choice.inc' %]
34
        <input type="checkbox" id="monday" data-dow="1" class="skipday" />
51
        [% ELSIF (show_irregularity_options == 'week') %]
35
        <label for="monday">Monday</label>
52
            [% INCLUDE 'serials/subscription_weekly_choice.inc' %]
36
        <input type="checkbox" id="tuesday" data-dow="2" class="skipday" />
53
        [% END %]
37
        <label for="tuesday">Tuesday</label>
38
        <input type="checkbox" id="wednesday" data-dow="3" class="skipday" />
39
        <label for="wednesday">Wednesday</label>
40
        <input type="checkbox" id="thursday" data-dow="4" class="skipday" />
41
        <label for="thursday">Thursday</label>
42
        <input type="checkbox" id="friday" data-dow="5" class="skipday" />
43
        <label for="friday">Friday</label>
44
        <input type="checkbox" id="saturday" data-dow="6" class="skipday" />
45
        <label for="saturday">Saturday</label>
46
        <input type="checkbox" id="sunday" data-dow="7" class="skipday" />
47
        <label for="sunday">Sunday</label>
48
    [% END %]
54
    [% END %]
49
[% END %]
55
[% END %]
50
[% IF (predictions_loop) %]
56
[% IF (predictions_loop) %]
(-)a/serials/showpredictionpattern.pl (-5 / +10 lines)
Lines 112-126 if(defined $subscriptionid) { Link Here
112
112
113
my @predictions_loop;
113
my @predictions_loop;
114
my ($calculated) = GetSeq(\%subscription, \%pattern);
114
my ($calculated) = GetSeq(\%subscription, \%pattern);
115
my $dow = issue_number( dt_from_string($date), $frequency->{unit} );
115
push @predictions_loop, {
116
push @predictions_loop, {
116
    number => $calculated,
117
    number => $calculated,
117
    publicationdate => $date,
118
    publicationdate => $date,
118
    issuenumber => $issuenumber,
119
    issuenumber => $issuenumber,
119
    dow => Day_of_Week(split /-/, $date),
120
    dow => $dow,
120
};
121
};
121
my @irreg = ();
122
my @irreg = ();
123
my @permanent_irreg = ();
122
if(defined $subscriptionid) {
124
if(defined $subscriptionid) {
123
    @irreg = C4::Serials::GetSubscriptionIrregularities($subscriptionid);
125
    my $subscription_o = Koha::Subscriptions->find($subscriptionid);
126
    @irreg = $subscription_o->irregularities;
127
    @permanent_irreg = $subscription_o->permanent_irregularities;
124
    while(@irreg && $issuenumber > $irreg[0]) {
128
    while(@irreg && $issuenumber > $irreg[0]) {
125
        shift @irreg;
129
        shift @irreg;
126
    }
130
    }
Lines 139-145 while( $i < 1000 ) { Link Here
139
    }
143
    }
140
    if(defined $date){
144
    if(defined $date){
141
        $line{'publicationdate'} = $date;
145
        $line{'publicationdate'} = $date;
142
        $line{'dow'} = Day_of_Week(split /-/, $date);
146
        $line{dow} = issue_number( dt_from_string($date), $frequency->{unit} );
143
    }
147
    }
144
148
145
    # Check if we don't have exceed end date
149
    # Check if we don't have exceed end date
Lines 175-182 $template->param( Link Here
175
179
176
if ( $frequency->{unit} and not $custompattern ) {
180
if ( $frequency->{unit} and not $custompattern ) {
177
    $template->param( ask_for_irregularities => 1 );
181
    $template->param( ask_for_irregularities => 1 );
178
    if ( $frequency->{unit} eq 'day' and $frequency->{unitsperissue} == 1 ) {
182
    if ( $frequency->{unit} =~ /^(day|month|week)$/ and $frequency->{unitsperissue} == 1 ) {
179
        $template->param( daily_options => 1 );
183
        $template->param( show_irregularity_options => $frequency->{unit} );
184
        $template->param( permanent_irreg => \@permanent_irreg );
180
    }
185
    }
181
}
186
}
182
187
(-)a/serials/subscription-add.pl (-5 / +8 lines)
Lines 294-299 sub redirect_add_subscription { Link Here
294
    my $aqbudgetid     = $query->param('aqbudgetid');
294
    my $aqbudgetid     = $query->param('aqbudgetid');
295
    my $periodicity    = $query->param('frequency');
295
    my $periodicity    = $query->param('frequency');
296
    my @irregularity   = $query->multi_param('irregularity');
296
    my @irregularity   = $query->multi_param('irregularity');
297
    my @permanent_irregularity = $query->multi_param('permanent_irregularity');
297
    my $numberpattern  = $query->param('numbering_pattern');
298
    my $numberpattern  = $query->param('numbering_pattern');
298
    my $locale         = $query->param('locale');
299
    my $locale         = $query->param('locale');
299
    my $graceperiod    = $query->param('graceperiod') || 0;
300
    my $graceperiod    = $query->param('graceperiod') || 0;
Lines 341-350 sub redirect_add_subscription { Link Here
341
        $startdate, $periodicity, $numberlength, $weeklength,
342
        $startdate, $periodicity, $numberlength, $weeklength,
342
        $monthlength, $lastvalue1, $innerloop1, $lastvalue2, $innerloop2,
343
        $monthlength, $lastvalue1, $innerloop1, $lastvalue2, $innerloop2,
343
        $lastvalue3, $innerloop3, $status, $notes, $letter, $firstacquidate,
344
        $lastvalue3, $innerloop3, $status, $notes, $letter, $firstacquidate,
344
        join(";",@irregularity), $numberpattern, $locale, $callnumber,
345
        join(";",@irregularity), join(';', @permanent_irregularity),
345
        $manualhistory, $internalnotes, $serialsadditems,
346
        $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes,
346
        $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
347
        $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,
347
        $skip_serialseq
348
        $location, $enddate, $skip_serialseq
348
    );
349
    );
349
350
350
    my $additional_fields = Koha::AdditionalField->all( { tablename => 'subscription' } );
351
    my $additional_fields = Koha::AdditionalField->all( { tablename => 'subscription' } );
Lines 357-362 sub redirect_add_subscription { Link Here
357
sub redirect_mod_subscription {
358
sub redirect_mod_subscription {
358
    my $subscriptionid = $query->param('subscriptionid');
359
    my $subscriptionid = $query->param('subscriptionid');
359
    my @irregularity = $query->multi_param('irregularity');
360
    my @irregularity = $query->multi_param('irregularity');
361
    my @permanent_irregularity = $query->multi_param('permanent_irregularity');
360
    my $auser = $query->param('user');
362
    my $auser = $query->param('user');
361
    my $librarian => scalar $query->param('librarian'),
363
    my $librarian => scalar $query->param('librarian'),
362
    my $branchcode = $query->param('branchcode');
364
    my $branchcode = $query->param('branchcode');
Lines 423-429 sub redirect_mod_subscription { Link Here
423
    ModSubscription(
425
    ModSubscription(
424
        $auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $startdate,
426
        $auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $startdate,
425
        $periodicity, $firstacquidate, join(";",@irregularity),
427
        $periodicity, $firstacquidate, join(";",@irregularity),
426
        $numberpattern, $locale, $numberlength, $weeklength, $monthlength, $lastvalue1,
428
        join(';', @permanent_irregularity), $numberpattern, $locale,
429
        $numberlength, $weeklength, $monthlength, $lastvalue1,
427
        $innerloop1, $lastvalue2, $innerloop2, $lastvalue3, $innerloop3,
430
        $innerloop1, $lastvalue2, $innerloop2, $lastvalue3, $innerloop3,
428
        $status, $biblionumber, $callnumber, $notes, $letter,
431
        $status, $biblionumber, $callnumber, $notes, $letter,
429
        $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount,
432
        $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount,
(-)a/t/db_dependent/Serials/SubscriptionIrregularity.t (-1 / +35 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
use Modern::Perl;
4
5
use t::lib::TestBuilder;
6
use Test::More tests => 6;
7
8
use Koha::Database;
9
10
use_ok('Koha::Subscription');
11
12
my $schema = Koha::Database->new->schema;
13
$schema->storage->txn_begin;
14
15
my $builder = t::lib::TestBuilder->new();
16
17
my $subscription = $builder->build({
18
    source => 'Subscription',
19
    value  => {
20
        irregularity => '2;4;7',
21
        permanent_irregularity => '1;2'
22
    },
23
});
24
25
my $subscription_o = Koha::Subscriptions->find($subscription->{subscriptionid});
26
my @irreg = $subscription_o->irregularities;
27
is($irreg[0], 2, 'First element of irregularities is 2');
28
is($irreg[1], 4, 'Second element of irregularities is 4');
29
is($irreg[2], 7, 'Third element of irregularities is 7');
30
31
my @permanent_irreg = $subscription_o->permanent_irregularities;
32
is($permanent_irreg[0], 1, 'First element of permanent_irregularities is 1');
33
is($permanent_irreg[1], 2, 'Second element of permanent_irregularities is 2');
34
35
$schema->storage->txn_rollback;

Return to bug 17656