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

(-)a/C4/Serials.pm (-8 / +10 lines)
Lines 1285-1295 returns the number of rows affected Link Here
1285
1285
1286
sub ModSubscription {
1286
sub ModSubscription {
1287
    my (
1287
    my (
1288
    $auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $startdate,
1288
    $manager_id, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $startdate,
1289
    $periodicity, $firstacquidate, $irregularity, $numberpattern, $locale,
1289
    $periodicity, $firstacquidate, $irregularity, $numberpattern, $locale,
1290
    $numberlength, $weeklength, $monthlength, $lastvalue1, $innerloop1,
1290
    $numberlength, $weeklength, $monthlength, $lastvalue1, $innerloop1,
1291
    $lastvalue2, $innerloop2, $lastvalue3, $innerloop3, $status,
1291
    $lastvalue2, $innerloop2, $lastvalue3, $innerloop3, $status,
1292
    $biblionumber, $callnumber, $notes, $letter, $manualhistory,
1292
    $biblionumber, $callnumber, $notes, $letter, $late_issue_letter_code, $manualhistory,
1293
    $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1293
    $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1294
    $graceperiod, $warn_when_late, $location, $enddate, $subscriptionid, $skip_serialseq,
1294
    $graceperiod, $warn_when_late, $location, $enddate, $subscriptionid, $skip_serialseq,
1295
    $itemtype, $previousitemtype, $mana_id, $ccode, $published_on_template
1295
    $itemtype, $previousitemtype, $mana_id, $ccode, $published_on_template
Lines 1298-1304 sub ModSubscription { Link Here
1298
    my $subscription = Koha::Subscriptions->find($subscriptionid);
1298
    my $subscription = Koha::Subscriptions->find($subscriptionid);
1299
    $subscription->set(
1299
    $subscription->set(
1300
        {
1300
        {
1301
            librarian         => $auser,
1301
            manager_id        => $manager_id,
1302
            branchcode        => $branchcode,
1302
            branchcode        => $branchcode,
1303
            aqbooksellerid    => $aqbooksellerid,
1303
            aqbooksellerid    => $aqbooksellerid,
1304
            cost              => $cost,
1304
            cost              => $cost,
Lines 1318-1323 sub ModSubscription { Link Here
1318
            status            => $status,
1318
            status            => $status,
1319
            notes             => $notes,
1319
            notes             => $notes,
1320
            letter            => $letter,
1320
            letter            => $letter,
1321
            late_issue_letter_code => $late_issue_letter_code,
1321
            firstacquidate    => $firstacquidate,
1322
            firstacquidate    => $firstacquidate,
1322
            irregularity      => $irregularity,
1323
            irregularity      => $irregularity,
1323
            numberpattern     => $numberpattern,
1324
            numberpattern     => $numberpattern,
Lines 1352-1361 sub ModSubscription { Link Here
1352
1353
1353
=head2 NewSubscription
1354
=head2 NewSubscription
1354
1355
1355
$subscriptionid = &NewSubscription($auser,branchcode,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
1356
$subscriptionid = &NewSubscription($manager_id,branchcode,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
1356
    $startdate,$periodicity,$numberlength,$weeklength,$monthlength,
1357
    $startdate,$periodicity,$numberlength,$weeklength,$monthlength,
1357
    $lastvalue1,$innerloop1,$lastvalue2,$innerloop2,$lastvalue3,$innerloop3,
1358
    $lastvalue1,$innerloop1,$lastvalue2,$innerloop2,$lastvalue3,$innerloop3,
1358
    $status, $notes, $letter, $firstacquidate, $irregularity, $numberpattern,
1359
    $status, $notes, $letter, $late_issue_letter_code, $firstacquidate, $irregularity, $numberpattern,
1359
    $locale, $callnumber, $manualhistory, $internalnotes, $serialsadditems,
1360
    $locale, $callnumber, $manualhistory, $internalnotes, $serialsadditems,
1360
    $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
1361
    $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
1361
    $skip_serialseq, $itemtype, $previousitemtype);
1362
    $skip_serialseq, $itemtype, $previousitemtype);
Lines 1369-1378 the id of this new subscription Link Here
1369
1370
1370
sub NewSubscription {
1371
sub NewSubscription {
1371
    my (
1372
    my (
1372
    $auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $biblionumber,
1373
    $manager_id, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $biblionumber,
1373
    $startdate, $periodicity, $numberlength, $weeklength, $monthlength,
1374
    $startdate, $periodicity, $numberlength, $weeklength, $monthlength,
1374
    $lastvalue1, $innerloop1, $lastvalue2, $innerloop2, $lastvalue3,
1375
    $lastvalue1, $innerloop1, $lastvalue2, $innerloop2, $lastvalue3,
1375
    $innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity,
1376
    $innerloop3, $status, $notes, $letter, $late_issue_letter_code, $firstacquidate, $irregularity,
1376
    $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes,
1377
    $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes,
1377
    $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, $warn_when_late,
1378
    $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, $warn_when_late,
1378
    $location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode,
1379
    $location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode,
Lines 1382-1388 sub NewSubscription { Link Here
1382
1383
1383
    my $subscription = Koha::Subscription->new(
1384
    my $subscription = Koha::Subscription->new(
1384
        {
1385
        {
1385
            librarian         => $auser,
1386
            manager_id        => $manager_id,
1386
            branchcode        => $branchcode,
1387
            branchcode        => $branchcode,
1387
            aqbooksellerid    => $aqbooksellerid,
1388
            aqbooksellerid    => $aqbooksellerid,
1388
            cost              => $cost,
1389
            cost              => $cost,
Lines 1402-1407 sub NewSubscription { Link Here
1402
            status            => $status,
1403
            status            => $status,
1403
            notes             => $notes,
1404
            notes             => $notes,
1404
            letter            => $letter,
1405
            letter            => $letter,
1406
            late_issue_letter_code => $late_issue_letter_code,
1405
            firstacquidate    => $firstacquidate,
1407
            firstacquidate    => $firstacquidate,
1406
            irregularity      => $irregularity,
1408
            irregularity      => $irregularity,
1407
            numberpattern     => $numberpattern,
1409
            numberpattern     => $numberpattern,
(-)a/Koha/Subscription.pm (+17 lines)
Lines 123-128 sub frequency { Link Here
123
    return Koha::Subscription::Frequency->_new_from_dbic($frequency_rs);
123
    return Koha::Subscription::Frequency->_new_from_dbic($frequency_rs);
124
}
124
}
125
125
126
=head3 manager
127
128
my $patron = $subscription->manager
129
130
Return the subscription manager (a Koha::Patron object)
131
132
=cut
133
134
sub manager {
135
    my ($self) = @_;
136
137
    my $manager = $self->_result->manager;
138
    return unless $manager;
139
140
    return Koha::Patron->_new_from_dbic($manager);
141
}
142
126
=head3 get_search_info
143
=head3 get_search_info
127
144
128
=cut
145
=cut
(-)a/installer/data/mysql/atomicupdate/bug-29997.pl (+46 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "29997",
5
    description => "Replace subscription.librarian by subscription.manager_id, add a foreign key constraint, and add subscription.late_issue_letter_code",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
10
        unless (column_exists('subscription', 'manager_id')) {
11
            $dbh->do(q{
12
                ALTER TABLE subscription
13
                ADD COLUMN manager_id INT NULL DEFAULT NULL AFTER librarian
14
            });
15
        }
16
17
        unless (foreign_key_exists('subscription', 'subscription_manager_id_fk')) {
18
            $dbh->do(q{
19
                ALTER TABLE subscription
20
                ADD CONSTRAINT subscription_manager_id_fk
21
                FOREIGN KEY (manager_id) REFERENCES borrowers (borrowernumber)
22
                ON DELETE SET NULL ON UPDATE CASCADE
23
            });
24
        }
25
26
        if (column_exists('subscription', 'librarian')) {
27
            $dbh->do(q{
28
                UPDATE subscription LEFT JOIN borrowers ON (borrowers.userid = subscription.librarian)
29
                SET subscription.manager_id = borrowers.borrowernumber
30
                WHERE subscription.manager_id IS NULL
31
            });
32
33
            $dbh->do(q{
34
                ALTER TABLE subscription
35
                DROP COLUMN librarian
36
            });
37
        }
38
39
        unless (column_exists('subscription', 'late_issue_letter_code')) {
40
            $dbh->do(q{
41
                ALTER TABLE subscription
42
                ADD COLUMN late_issue_letter_code VARCHAR(20) NULL DEFAULT NULL AFTER letter
43
            });
44
        }
45
    },
46
};
(-)a/installer/data/mysql/kohastructure.sql (-2 / +4 lines)
Lines 5493-5499 DROP TABLE IF EXISTS `subscription`; Link Here
5493
CREATE TABLE `subscription` (
5493
CREATE TABLE `subscription` (
5494
  `biblionumber` int(11) NOT NULL COMMENT 'foreign key for biblio.biblionumber that this subscription is attached to',
5494
  `biblionumber` int(11) NOT NULL COMMENT 'foreign key for biblio.biblionumber that this subscription is attached to',
5495
  `subscriptionid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for this subscription',
5495
  `subscriptionid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for this subscription',
5496
  `librarian` varchar(100) DEFAULT '' COMMENT 'the librarian''s username from borrowers.userid',
5496
  `manager_id` INT NULL DEFAULT NULL COMMENT 'the borrowernumber of the patron that last modified the subscription',
5497
  `startdate` date DEFAULT NULL COMMENT 'start date for this subscription',
5497
  `startdate` date DEFAULT NULL COMMENT 'start date for this subscription',
5498
  `aqbooksellerid` int(11) DEFAULT 0 COMMENT 'foreign key for aqbooksellers.id to link to the vendor',
5498
  `aqbooksellerid` int(11) DEFAULT 0 COMMENT 'foreign key for aqbooksellers.id to link to the vendor',
5499
  `cost` int(11) DEFAULT 0,
5499
  `cost` int(11) DEFAULT 0,
Lines 5516-5521 CREATE TABLE `subscription` ( Link Here
5516
  `irregularity` mediumtext DEFAULT NULL COMMENT 'any irregularities in the subscription',
5516
  `irregularity` mediumtext DEFAULT NULL COMMENT 'any irregularities in the subscription',
5517
  `skip_serialseq` tinyint(1) NOT NULL DEFAULT 0,
5517
  `skip_serialseq` tinyint(1) NOT NULL DEFAULT 0,
5518
  `letter` varchar(20) DEFAULT NULL,
5518
  `letter` varchar(20) DEFAULT NULL,
5519
  `late_issue_letter_code` varchar(20) NULL DEFAULT NULL COMMENT 'letter code used for late issue alerts',
5519
  `numberpattern` int(11) DEFAULT NULL COMMENT 'the numbering pattern used links to subscription_numberpatterns.id',
5520
  `numberpattern` int(11) DEFAULT NULL COMMENT 'the numbering pattern used links to subscription_numberpatterns.id',
5520
  `locale` varchar(80) DEFAULT NULL COMMENT 'for foreign language subscriptions to display months, seasons, etc correctly',
5521
  `locale` varchar(80) DEFAULT NULL COMMENT 'for foreign language subscriptions to display months, seasons, etc correctly',
5521
  `distributedto` mediumtext DEFAULT NULL,
5522
  `distributedto` mediumtext DEFAULT NULL,
Lines 5543-5549 CREATE TABLE `subscription` ( Link Here
5543
  KEY `subscription_ibfk_3` (`biblionumber`),
5544
  KEY `subscription_ibfk_3` (`biblionumber`),
5544
  CONSTRAINT `subscription_ibfk_1` FOREIGN KEY (`periodicity`) REFERENCES `subscription_frequencies` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
5545
  CONSTRAINT `subscription_ibfk_1` FOREIGN KEY (`periodicity`) REFERENCES `subscription_frequencies` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
5545
  CONSTRAINT `subscription_ibfk_2` FOREIGN KEY (`numberpattern`) REFERENCES `subscription_numberpatterns` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
5546
  CONSTRAINT `subscription_ibfk_2` FOREIGN KEY (`numberpattern`) REFERENCES `subscription_numberpatterns` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
5546
  CONSTRAINT `subscription_ibfk_3` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
5547
  CONSTRAINT `subscription_ibfk_3` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5548
  CONSTRAINT `subscription_manager_id_fk` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
5547
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5549
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5548
/*!40101 SET character_set_client = @saved_cs_client */;
5550
/*!40101 SET character_set_client = @saved_cs_client */;
5549
5551
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt (-1 / +19 lines)
Lines 63-69 fieldset.rows table { clear: none; margin: 0; } Link Here
63
                        [% ELSE %]
63
                        [% ELSE %]
64
                                <input type="hidden" name="op" value="addsubscription" />
64
                                <input type="hidden" name="op" value="addsubscription" />
65
                        [% END %]
65
                        [% END %]
66
                        <input type="hidden" name="user" value="[% logged_in_user.userid | html %]" />
67
                        <input type="hidden" name="irreg_check" value="0" />
66
                        <input type="hidden" name="irreg_check" value="0" />
68
                        <fieldset id="subscription_add_information" class="rows">
67
                        <fieldset id="subscription_add_information" class="rows">
69
                            <legend>Subscription details</legend>
68
                            <legend>Subscription details</legend>
Lines 171-176 fieldset.rows table { clear: none; margin: 0; } Link Here
171
                                        <div class="hint">To notify patrons of new serial issues, you must <a href="/cgi-bin/koha/tools/letter.pl">define a notice</a>.</div>
170
                                        <div class="hint">To notify patrons of new serial issues, you must <a href="/cgi-bin/koha/tools/letter.pl">define a notice</a>.</div>
172
                                    [% END %]
171
                                    [% END %]
173
                                </li>
172
                                </li>
173
                                <li>
174
                                    [% IF ( letterloop ) %]
175
                                        <label for="late_issue_letter_code">Late issue notification: </label>
176
                                        <select name="late_issue_letter_code" id="late_issue_letter_code">
177
                                            <option value="">None</option>
178
                                            [% FOREACH letter IN letterloop %]
179
                                                [% IF ( letter.value == late_issue_letter_code ) %]
180
                                                    <option value="[% letter.value | html %]" selected="selected">[% letter.lettername | html %]</option>
181
                                                [% ELSE %]
182
                                                    <option value="[% letter.value | html %]">[% letter.lettername | html %]</option>
183
                                                [% END %]
184
                                            [% END %]
185
                                        </select>
186
                                        <div class="hint">Selecting a notice will allow you to receive a notification when a serial issue is late.</div>
187
                                    [% ELSE %]
188
                                        <span class="label">Late issue notification: </span>
189
                                        <div class="hint">To receive notifications of late serial issues, you must <a href="/cgi-bin/koha/tools/letter.pl">define a notice</a>.</div>
190
                                    [% END %]
191
                                </li>
174
                                <li>
192
                                <li>
175
                                    <label for="location">Location:</label>
193
                                    <label for="location">Location:</label>
176
                                    <select name="location" id="location">
194
                                    <select name="location" id="location">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt (-1 / +6 lines)
Lines 100-106 Link Here
100
                                    <div class="rows">
100
                                    <div class="rows">
101
                                        <ol>
101
                                        <ol>
102
                                            <li><span class="label">Subscription ID: </span>[% subscriptionid | html %]</li>
102
                                            <li><span class="label">Subscription ID: </span>[% subscriptionid | html %]</li>
103
                                            <li><span class="label">Librarian identity:</span> [% librarian | html %]</li>
103
                                            <li>
104
                                                <span class="label">Manager:</span>
105
                                                [% IF subscription.manager %]
106
                                                    [% INCLUDE 'patron-title.inc' patron = subscription.manager | html %]
107
                                                [% END %]
108
                                            </li>
104
                                            <li><span class="label">Vendor:</span> <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% aqbooksellerid | uri %]">[% aqbooksellername | html %]</a></li>
109
                                            <li><span class="label">Vendor:</span> <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% aqbooksellerid | uri %]">[% aqbooksellername | html %]</a></li>
105
                                            <li><span class="label">Biblio:</span>  <a href="[% PROCESS biblio_a_href biblionumber => bibnum %]">[% bibliotitle | html %] [% bibliosubtitle | html %]</a> <em>([% bibnum | html %])</em></li>
110
                                            <li><span class="label">Biblio:</span>  <a href="[% PROCESS biblio_a_href biblionumber => bibnum %]">[% bibliotitle | html %] [% bibliosubtitle | html %]</a> <em>([% bibnum | html %])</em></li>
106
                                            [% IF ( OPACBaseURL ) %]
111
                                            [% IF ( OPACBaseURL ) %]
(-)a/misc/cronjobs/serialsUpdate.pl (+19 lines)
Lines 114-119 while ( my $issue = $sth->fetchrow_hashref ) { Link Here
114
            $issue->{planneddate}, $issue->{publisheddate}, $issue->{publisheddatetext},
114
            $issue->{planneddate}, $issue->{publisheddate}, $issue->{publisheddatetext},
115
            3, $note );
115
            3, $note );
116
        $verbose and print "Serial issue with id=" . $issue->{serialid} . " marked late\n";
116
        $verbose and print "Serial issue with id=" . $issue->{serialid} . " marked late\n";
117
118
        my $subscription = Koha::Subscriptions->find($issue->{subscriptionid});
119
        if ($subscription->late_issue_letter_code && $subscription->manager_id) {
120
            my $letter = C4::Letters::GetPreparedLetter (
121
                module => 'serial',
122
                letter_code => $subscription->late_issue_letter_code,
123
                branchcode => $subscription->branchcode,
124
                tables => {
125
                    branches => $subscription->branchcode,
126
                    biblio => $subscription->biblionumber,
127
                    biblioitems => $subscription->biblionumber,
128
                    borrowers => $subscription->manager_id,
129
                    subscription => $subscription->subscriptionid,
130
                    serial => $issue->{serialid},
131
                },
132
            );
133
            my $manager = $subscription->manager;
134
            C4::Message->enqueue($letter, $manager->unblessed, 'email');
135
        }
117
    } else {
136
    } else {
118
        print "Serial issue with id=" . $issue->{serialid} . " would have been marked late\n";
137
        print "Serial issue with id=" . $issue->{serialid} . " would have been marked late\n";
119
    }
138
    }
(-)a/serials/subscription-add.pl (-7 / +6 lines)
Lines 295-301 sub redirect_add_subscription { Link Here
295
    }
295
    }
296
    my $numberpattern = Koha::Subscription::Numberpatterns->new_or_existing({ $query->Vars });
296
    my $numberpattern = Koha::Subscription::Numberpatterns->new_or_existing({ $query->Vars });
297
297
298
    my $auser          = $query->param('user');
299
    my $branchcode     = $query->param('branchcode');
298
    my $branchcode     = $query->param('branchcode');
300
    my $aqbooksellerid = $query->param('aqbooksellerid');
299
    my $aqbooksellerid = $query->param('aqbooksellerid');
301
    my $cost           = $query->param('cost');
300
    my $cost           = $query->param('cost');
Lines 322-327 sub redirect_add_subscription { Link Here
322
    my $notes             = $query->param('notes');
321
    my $notes             = $query->param('notes');
323
    my $internalnotes     = $query->param('internalnotes');
322
    my $internalnotes     = $query->param('internalnotes');
324
    my $letter            = $query->param('letter');
323
    my $letter            = $query->param('letter');
324
    my $late_issue_letter_code = $query->param('late_issue_letter_code');
325
    my $manualhistory     = $query->param('manualhist') ? 1 : 0;
325
    my $manualhistory     = $query->param('manualhist') ? 1 : 0;
326
    my $serialsadditems   = $query->param('serialsadditems');
326
    my $serialsadditems   = $query->param('serialsadditems');
327
    my $staffdisplaycount = $query->param('staffdisplaycount');
327
    my $staffdisplaycount = $query->param('staffdisplaycount');
Lines 351-360 sub redirect_add_subscription { Link Here
351
        }
351
        }
352
    }
352
    }
353
    my $subscriptionid = NewSubscription(
353
    my $subscriptionid = NewSubscription(
354
        $auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $biblionumber,
354
        $loggedinuser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $biblionumber,
355
        $startdate, $periodicity, $numberlength, $weeklength,
355
        $startdate, $periodicity, $numberlength, $weeklength,
356
        $monthlength, $lastvalue1, $innerloop1, $lastvalue2, $innerloop2,
356
        $monthlength, $lastvalue1, $innerloop1, $lastvalue2, $innerloop2,
357
        $lastvalue3, $innerloop3, $status, $notes, $letter, $firstacquidate,
357
        $lastvalue3, $innerloop3, $status, $notes, $letter, $late_issue_letter_code, $firstacquidate,
358
        join(";",@irregularity), $numberpattern, $locale, $callnumber,
358
        join(";",@irregularity), $numberpattern, $locale, $callnumber,
359
        $manualhistory, $internalnotes, $serialsadditems,
359
        $manualhistory, $internalnotes, $serialsadditems,
360
        $staffdisplaycount, $opacdisplaycount, $graceperiod, $warn_when_late, $location, $enddate,
360
        $staffdisplaycount, $opacdisplaycount, $graceperiod, $warn_when_late, $location, $enddate,
Lines 384-391 sub redirect_add_subscription { Link Here
384
sub redirect_mod_subscription {
384
sub redirect_mod_subscription {
385
    my $subscriptionid = $query->param('subscriptionid');
385
    my $subscriptionid = $query->param('subscriptionid');
386
    my @irregularity = $query->multi_param('irregularity');
386
    my @irregularity = $query->multi_param('irregularity');
387
    my $auser = $query->param('user');
388
    my $librarian => scalar $query->param('librarian'),
389
    my $branchcode = $query->param('branchcode');
387
    my $branchcode = $query->param('branchcode');
390
    my $cost = $query->param('cost');
388
    my $cost = $query->param('cost');
391
    my $aqbooksellerid = $query->param('aqbooksellerid');
389
    my $aqbooksellerid = $query->param('aqbooksellerid');
Lines 430-435 sub redirect_mod_subscription { Link Here
430
    my $notes = $query->param('notes');
428
    my $notes = $query->param('notes');
431
    my $internalnotes = $query->param('internalnotes');
429
    my $internalnotes = $query->param('internalnotes');
432
    my $letter = $query->param('letter');
430
    my $letter = $query->param('letter');
431
    my $late_issue_letter_code = $query->param('late_issue_letter_code');
433
    my $manualhistory = $query->param('manualhist') ? 1 : 0;
432
    my $manualhistory = $query->param('manualhist') ? 1 : 0;
434
    my $serialsadditems = $query->param('serialsadditems');
433
    my $serialsadditems = $query->param('serialsadditems');
435
	my $staffdisplaycount = $query->param('staffdisplaycount');
434
	my $staffdisplaycount = $query->param('staffdisplaycount');
Lines 470-480 sub redirect_mod_subscription { Link Here
470
    }
469
    }
471
470
472
    ModSubscription(
471
    ModSubscription(
473
        $auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $startdate,
472
        $loggedinuser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $startdate,
474
        $periodicity, $firstacquidate, join(";",@irregularity),
473
        $periodicity, $firstacquidate, join(";",@irregularity),
475
        $numberpattern, $locale, $numberlength, $weeklength, $monthlength, $lastvalue1,
474
        $numberpattern, $locale, $numberlength, $weeklength, $monthlength, $lastvalue1,
476
        $innerloop1, $lastvalue2, $innerloop2, $lastvalue3, $innerloop3,
475
        $innerloop1, $lastvalue2, $innerloop2, $lastvalue3, $innerloop3,
477
        $status, $biblionumber, $callnumber, $notes, $letter,
476
        $status, $biblionumber, $callnumber, $notes, $letter, $late_issue_letter_code,
478
        $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount,
477
        $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount,
479
        $opacdisplaycount, $graceperiod, $warn_when_late, $location, $enddate, $subscriptionid,
478
        $opacdisplaycount, $graceperiod, $warn_when_late, $location, $enddate, $subscriptionid,
480
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode, $published_on_template
479
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode, $published_on_template
(-)a/serials/subscription-detail.pl (+1 lines)
Lines 152-157 while ( my $o = $orders->next ) { Link Here
152
152
153
$template->param(
153
$template->param(
154
    subscriptionid => $subscriptionid,
154
    subscriptionid => $subscriptionid,
155
    subscription => Koha::Subscriptions->find($subscriptionid),
155
    serialslist => \@serialslist,
156
    serialslist => \@serialslist,
156
    hasRouting  => $hasRouting,
157
    hasRouting  => $hasRouting,
157
    routing => C4::Context->preference("RoutingSerials"),
158
    routing => C4::Context->preference("RoutingSerials"),
(-)a/t/db_dependent/Acquisition/OrderFromSubscription.t (-1 / +1 lines)
Lines 48-54 my $subscriptionid = NewSubscription( Link Here
48
    undef,      "",     undef, undef, $budget_id, $biblionumber,
48
    undef,      "",     undef, undef, $budget_id, $biblionumber,
49
    '2013-01-01',undef, undef, undef,  undef,
49
    '2013-01-01',undef, undef, undef,  undef,
50
    undef,      undef,  undef, undef, undef, undef,
50
    undef,      undef,  undef, undef, undef, undef,
51
    1,          "notes",undef, '2013-01-01', undef, undef,
51
    1,          "notes",undef, undef, '2013-01-01', undef, undef,
52
    undef,       undef,  0,    "intnotes",  0,
52
    undef,       undef,  0,    "intnotes",  0,
53
    undef, undef, 0,          undef,         '2013-12-31', 0
53
    undef, undef, 0,          undef,         '2013-12-31', 0
54
);
54
);
(-)a/t/db_dependent/Koha/Acquisition/Booksellers.t (-2 / +2 lines)
Lines 102-108 subtest '->subscriptions() tests' => sub { Link Here
102
        $id_budget,   $biblionumber, '2013-01-01',         undef,
102
        $id_budget,   $biblionumber, '2013-01-01',         undef,
103
        undef,        undef,         undef,                undef,
103
        undef,        undef,         undef,                undef,
104
        undef,        undef,         undef,                undef,
104
        undef,        undef,         undef,                undef,
105
        undef,        1,             "subscription notes", undef,
105
        undef,        1,             "subscription notes", undef, undef,
106
        '2013-01-01', undef,         undef,                undef,
106
        '2013-01-01', undef,         undef,                undef,
107
        'CALL ABC',   0,             "intnotes",           0,
107
        'CALL ABC',   0,             "intnotes",           0,
108
        undef,        undef,         0,                    undef,
108
        undef,        undef,         0,                    undef,
Lines 124-130 subtest '->subscriptions() tests' => sub { Link Here
124
        $id_budget,   $biblionumber, '2013-01-01',         undef,
124
        $id_budget,   $biblionumber, '2013-01-01',         undef,
125
        undef,        undef,         undef,                undef,
125
        undef,        undef,         undef,                undef,
126
        undef,        undef,         undef,                undef,
126
        undef,        undef,         undef,                undef,
127
        undef,        1,             "subscription notes", undef,
127
        undef,        1,             "subscription notes", undef, undef,
128
        '2013-01-01', undef,         undef,                undef,
128
        '2013-01-01', undef,         undef,                undef,
129
        'CALL DEF',   0,             "intnotes",           0,
129
        'CALL DEF',   0,             "intnotes",           0,
130
        undef,        undef,         0,                    undef,
130
        undef,        undef,         0,                    undef,
(-)a/t/db_dependent/Letters.t (-2 / +2 lines)
Lines 575-581 my $subscriptionid = NewSubscription( Link Here
575
     undef,      "",     undef, undef, undef, $biblionumber,
575
     undef,      "",     undef, undef, undef, $biblionumber,
576
    '2013-01-01', 1, undef, undef,  undef,
576
    '2013-01-01', 1, undef, undef,  undef,
577
    undef,      undef,  undef, undef, undef, undef,
577
    undef,      undef,  undef, undef, undef, undef,
578
    1,          $notes,undef, '2013-01-01', undef, $number_pattern->id,
578
    1,          $notes,undef, undef, '2013-01-01', undef, $number_pattern->id,
579
    undef,       undef,  0,    $internalnotes,  0,
579
    undef,       undef,  0,    $internalnotes,  0,
580
    undef, undef, 0,          undef,         '2013-12-31', 0
580
    undef, undef, 0,          undef,         '2013-12-31', 0
581
);
581
);
Lines 675-681 subtest 'SendAlerts - claimissue' => sub { Link Here
675
         undef, "", $booksellerid, undef, undef, $biblionumber,
675
         undef, "", $booksellerid, undef, undef, $biblionumber,
676
        '2013-01-01', 1, undef, undef,  undef,
676
        '2013-01-01', 1, undef, undef,  undef,
677
        undef,  undef,  undef, undef, undef, undef,
677
        undef,  undef,  undef, undef, undef, undef,
678
        1, 'public',undef, '2013-01-01', undef, $number_pattern->id,
678
        1, 'public',undef, undef, '2013-01-01', undef, $number_pattern->id,
679
        undef, undef,  0, 'internal',  0,
679
        undef, undef,  0, 'internal',  0,
680
        undef, undef, 0,  undef, '2013-12-31', 0
680
        undef, undef, 0,  undef, '2013-12-31', 0
681
    );
681
    );
(-)a/t/db_dependent/Serials.t (-10 / +10 lines)
Lines 79-85 my $subscriptionid = NewSubscription( Link Here
79
    undef,      "",     undef, undef, $budget_id, $biblionumber,
79
    undef,      "",     undef, undef, $budget_id, $biblionumber,
80
    '2013-01-01', $frequency_id, undef, undef,  undef,
80
    '2013-01-01', $frequency_id, undef, undef,  undef,
81
    undef,      undef,  undef, undef, undef, undef,
81
    undef,      undef,  undef, undef, undef, undef,
82
    1,          $notes, ,undef, '2013-01-01', undef, $pattern_id,
82
    1,          $notes, undef, undef, '2013-01-01', undef, $pattern_id,
83
    undef,       undef,  0,    $internalnotes,  0,
83
    undef,       undef,  0,    $internalnotes,  0,
84
    undef, undef, 0,          undef,         '2013-12-31', 0,
84
    undef, undef, 0,          undef,         '2013-12-31', 0,
85
    undef, undef, undef, $ccode
85
    undef, undef, undef, $ccode
Lines 121-131 if (not $frequency->{unit}) { Link Here
121
    $subscriptioninformation->{ccode} = 'NFIC';
121
    $subscriptioninformation->{ccode} = 'NFIC';
122
122
123
    ModSubscription( @$subscriptioninformation{qw(
123
    ModSubscription( @$subscriptioninformation{qw(
124
        librarian branchcode aqbooksellerid cost aqbudgetid startdate
124
        manager_id branchcode aqbooksellerid cost aqbudgetid startdate
125
        periodicity firstacquidate irregularity numberpattern locale
125
        periodicity firstacquidate irregularity numberpattern locale
126
        numberlength weeklength monthlength lastvalue1 innerloop1 lastvalue2
126
        numberlength weeklength monthlength lastvalue1 innerloop1 lastvalue2
127
        innerloop2 lastvalue3 innerloop3 status biblionumber callnumber notes
127
        innerloop2 lastvalue3 innerloop3 status biblionumber callnumber notes
128
        letter manualhistory internalnotes serialsadditems staffdisplaycount
128
        letter late_issue_letter_code manualhistory internalnotes serialsadditems staffdisplaycount
129
        opacdisplaycount graceperiod location enddate subscriptionid
129
        opacdisplaycount graceperiod location enddate subscriptionid
130
        skip_serialseq itemtype previousitemtype mana_id ccode
130
        skip_serialseq itemtype previousitemtype mana_id ccode
131
    )} );
131
    )} );
Lines 183-193 if ($old_frequency) { Link Here
183
    $subscriptioninformation->{periodicity} = $old_frequency;
183
    $subscriptioninformation->{periodicity} = $old_frequency;
184
184
185
    ModSubscription( @$subscriptioninformation{qw(
185
    ModSubscription( @$subscriptioninformation{qw(
186
        librarian branchcode aqbooksellerid cost aqbudgetid startdate
186
        manager_id branchcode aqbooksellerid cost aqbudgetid startdate
187
        periodicity firstacquidate irregularity numberpattern locale
187
        periodicity firstacquidate irregularity numberpattern locale
188
        numberlength weeklength monthlength lastvalue1 innerloop1 lastvalue2
188
        numberlength weeklength monthlength lastvalue1 innerloop1 lastvalue2
189
        innerloop2 lastvalue3 innerloop3 status biblionumber callnumber notes
189
        innerloop2 lastvalue3 innerloop3 status biblionumber callnumber notes
190
        letter manualhistory internalnotes serialsadditems staffdisplaycount
190
        letter late_issue_letter_code manualhistory internalnotes serialsadditems staffdisplaycount
191
        opacdisplaycount graceperiod location enddate subscriptionid
191
        opacdisplaycount graceperiod location enddate subscriptionid
192
        skip_serialseq
192
        skip_serialseq
193
    )} );
193
    )} );
Lines 333-339 $subscriptionid = NewSubscription( Link Here
333
    undef,      "",     undef, undef, $budget_id, $biblionumber,
333
    undef,      "",     undef, undef, $budget_id, $biblionumber,
334
    '2013-01-01', $frequency_id, undef, undef,  undef,
334
    '2013-01-01', $frequency_id, undef, undef,  undef,
335
    undef,      undef,  undef, undef, undef, undef,
335
    undef,      undef,  undef, undef, undef, undef,
336
    1,          $notes,undef, '2013-01-01', undef, $pattern_id,
336
    1,          $notes,undef, undef, '2013-01-01', undef, $pattern_id,
337
    undef,       undef,  0,    $internalnotes,  0,
337
    undef,       undef,  0,    $internalnotes,  0,
338
    undef, undef, 0,          undef,         '2013-12-31', 0
338
    undef, undef, 0,          undef,         '2013-12-31', 0
339
);
339
);
Lines 430-439 subtest "PreserveSerialNotes preference" => sub { Link Here
430
subtest "NewSubscription|ModSubscription" => sub {
430
subtest "NewSubscription|ModSubscription" => sub {
431
    plan tests => 4;
431
    plan tests => 4;
432
    my $subscriptionid = NewSubscription(
432
    my $subscriptionid = NewSubscription(
433
        "",      "",     "", "", $budget_id, $biblionumber,
433
        undef,      "",     "", "", $budget_id, $biblionumber,
434
        '2013-01-01', $frequency_id, "", "",  "",
434
        '2013-01-01', $frequency_id, "", "",  "",
435
        "",      "",  "", "", "", "",
435
        "",      "",  "", "", "", "",
436
        1,          $notes,"", '2013-01-01', "", $pattern_id,
436
        1,          $notes,"", undef, '2013-01-01', "", $pattern_id,
437
        "",       "",  0,    $internalnotes,  0,
437
        "",       "",  0,    $internalnotes,  0,
438
        "", "", 0,          "",         '2013-12-31', 0
438
        "", "", 0,          "",         '2013-12-31', 0
439
    );
439
    );
Lines 447-457 subtest "NewSubscription|ModSubscription" => sub { Link Here
447
    my $subscription_info = $subscription->unblessed;
447
    my $subscription_info = $subscription->unblessed;
448
    $subscription_info->{biblionumber} = $biblio_2->biblionumber;
448
    $subscription_info->{biblionumber} = $biblio_2->biblionumber;
449
    ModSubscription( @$subscription_info{qw(
449
    ModSubscription( @$subscription_info{qw(
450
        librarian branchcode aqbooksellerid cost aqbudgetid startdate
450
        manager_id branchcode aqbooksellerid cost aqbudgetid startdate
451
        periodicity firstacquidate irregularity numberpattern locale
451
        periodicity firstacquidate irregularity numberpattern locale
452
        numberlength weeklength monthlength lastvalue1 innerloop1 lastvalue2
452
        numberlength weeklength monthlength lastvalue1 innerloop1 lastvalue2
453
        innerloop2 lastvalue3 innerloop3 status biblionumber callnumber notes
453
        innerloop2 lastvalue3 innerloop3 status biblionumber callnumber notes
454
        letter manualhistory internalnotes serialsadditems staffdisplaycount
454
        letter late_issue_letter_code manualhistory internalnotes serialsadditems staffdisplaycount
455
        opacdisplaycount graceperiod location enddate subscriptionid
455
        opacdisplaycount graceperiod location enddate subscriptionid
456
        skip_serialseq
456
        skip_serialseq
457
    )} );
457
    )} );
(-)a/t/db_dependent/Serials/Claims.t (-4 / +4 lines)
Lines 88-94 my $subscriptionid_not_late = NewSubscription( Link Here
88
    undef,      $branchcode,     $supplier_id1, undef, $budget_id, $biblionumber,
88
    undef,      $branchcode,     $supplier_id1, undef, $budget_id, $biblionumber,
89
    '2013-01-01', undef, undef, undef,  undef,
89
    '2013-01-01', undef, undef, undef,  undef,
90
    undef,      undef,  undef, undef, undef, undef,
90
    undef,      undef,  undef, undef, undef, undef,
91
    1,          "notes",undef, '9999-01-01', undef, undef,
91
    1,          "notes",undef, undef, '9999-01-01', undef, undef,
92
    undef,       undef,  0,    "intnotes",  0,
92
    undef,       undef,  0,    "intnotes",  0,
93
    undef, undef, 0,          undef,         '2013-12-31', 0
93
    undef, undef, 0,          undef,         '2013-12-31', 0
94
);
94
);
Lines 99-105 my $subscriptionid_inlate1 = NewSubscription( Link Here
99
    undef,      $branchcode,     $supplier_id1, undef, $budget_id, $biblionumber,
99
    undef,      $branchcode,     $supplier_id1, undef, $budget_id, $biblionumber,
100
    '2013-01-01', undef, undef, undef,  undef,
100
    '2013-01-01', undef, undef, undef,  undef,
101
    undef,      undef,  undef, undef, undef, undef,
101
    undef,      undef,  undef, undef, undef, undef,
102
    1,          "notes",undef, '2013-01-01', undef, undef,
102
    1,          "notes",undef, undef, '2013-01-01', undef, undef,
103
    undef,       undef,  0,    "intnotes",  0,
103
    undef,       undef,  0,    "intnotes",  0,
104
    undef, undef, 0,          undef,         '2013-12-31', 0
104
    undef, undef, 0,          undef,         '2013-12-31', 0
105
);
105
);
Lines 108-114 my $subscriptionid_inlate2 = NewSubscription( Link Here
108
    undef,      $branchcode,     $supplier_id2, undef, $budget_id, $biblionumber,
108
    undef,      $branchcode,     $supplier_id2, undef, $budget_id, $biblionumber,
109
    '2013-01-01', undef, undef, undef,  undef,
109
    '2013-01-01', undef, undef, undef,  undef,
110
    undef,      undef,  undef, undef, undef, undef,
110
    undef,      undef,  undef, undef, undef, undef,
111
    1,          "notes",undef, '2013-01-01', undef, undef,
111
    1,          "notes",undef, undef, '2013-01-01', undef, undef,
112
    undef,       undef,  0,    "intnotes",  0,
112
    undef,       undef,  0,    "intnotes",  0,
113
    undef, undef, 0,          undef,         '2013-12-31', 0
113
    undef, undef, 0,          undef,         '2013-12-31', 0
114
);
114
);
Lines 117-123 my $subscriptionid_inlate3 = NewSubscription( Link Here
117
    undef,      $branchcode,     $supplier_id2, undef, $budget_id, $biblionumber,
117
    undef,      $branchcode,     $supplier_id2, undef, $budget_id, $biblionumber,
118
    '2013-01-02', undef, undef, undef,  undef,
118
    '2013-01-02', undef, undef, undef,  undef,
119
    undef,      undef,  undef, undef, undef, undef,
119
    undef,      undef,  undef, undef, undef, undef,
120
    1,          "notes",undef, '2013-01-02', undef, undef,
120
    1,          "notes",undef, undef, '2013-01-02', undef, undef,
121
    undef,       undef,  0,    "intnotes",  0,
121
    undef,       undef,  0,    "intnotes",  0,
122
    undef, undef, 0,          undef,         '2013-12-31', 0
122
    undef, undef, 0,          undef,         '2013-12-31', 0
123
);
123
);
(-)a/t/db_dependent/Serials_2.t (-3 / +2 lines)
Lines 56-62 my $subscriptionid_from_my_branch = NewSubscription( Link Here
56
    undef,      $my_branch,     undef, undef, $budget_id, $biblionumber,
56
    undef,      $my_branch,     undef, undef, $budget_id, $biblionumber,
57
    '2013-01-01', undef, undef, undef,  undef,
57
    '2013-01-01', undef, undef, undef,  undef,
58
    undef,      undef,  undef, undef, undef, undef,
58
    undef,      undef,  undef, undef, undef, undef,
59
    1,          "notes",undef, '2013-01-01', undef, undef,
59
    1,          "notes",undef, undef, '2013-01-01', undef, undef,
60
    undef,       undef,  0,    "intnotes",  0,
60
    undef,       undef,  0,    "intnotes",  0,
61
    undef, undef, 0,          undef,         '2013-12-31', 0
61
    undef, undef, 0,          undef,         '2013-12-31', 0
62
);
62
);
Lines 66-72 my $subscriptionid_from_another_branch = NewSubscription( Link Here
66
    undef,      $another_branch,     undef, undef, $budget_id, $biblionumber,
66
    undef,      $another_branch,     undef, undef, $budget_id, $biblionumber,
67
    '2013-01-01', undef, undef, undef,  undef,
67
    '2013-01-01', undef, undef, undef,  undef,
68
    undef,      undef,  undef, undef, undef, undef,
68
    undef,      undef,  undef, undef, undef, undef,
69
    1,          "notes",undef, '2013-01-01', undef, undef,
69
    1,          "notes",undef, undef, '2013-01-01', undef, undef,
70
    undef,       undef,  0,    "intnotes",  0,
70
    undef,       undef,  0,    "intnotes",  0,
71
    undef, undef, 0,          undef,         '2013-12-31', 0
71
    undef, undef, 0,          undef,         '2013-12-31', 0
72
);
72
);
73
- 

Return to bug 29997