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

(-)a/C4/Serials.pm (-8 / +10 lines)
Lines 1279-1289 returns the number of rows affected Link Here
1279
1279
1280
sub ModSubscription {
1280
sub ModSubscription {
1281
    my (
1281
    my (
1282
    $auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $startdate,
1282
    $manager_id, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $startdate,
1283
    $periodicity, $firstacquidate, $irregularity, $numberpattern, $locale,
1283
    $periodicity, $firstacquidate, $irregularity, $numberpattern, $locale,
1284
    $numberlength, $weeklength, $monthlength, $lastvalue1, $innerloop1,
1284
    $numberlength, $weeklength, $monthlength, $lastvalue1, $innerloop1,
1285
    $lastvalue2, $innerloop2, $lastvalue3, $innerloop3, $status,
1285
    $lastvalue2, $innerloop2, $lastvalue3, $innerloop3, $status,
1286
    $biblionumber, $callnumber, $notes, $letter, $manualhistory,
1286
    $biblionumber, $callnumber, $notes, $letter, $late_issue_letter_code, $manualhistory,
1287
    $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1287
    $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1288
    $graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq,
1288
    $graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq,
1289
    $itemtype, $previousitemtype, $mana_id, $ccode
1289
    $itemtype, $previousitemtype, $mana_id, $ccode
Lines 1292-1298 sub ModSubscription { Link Here
1292
    my $subscription = Koha::Subscriptions->find($subscriptionid);
1292
    my $subscription = Koha::Subscriptions->find($subscriptionid);
1293
    $subscription->set(
1293
    $subscription->set(
1294
        {
1294
        {
1295
            librarian         => $auser,
1295
            manager_id        => $manager_id,
1296
            branchcode        => $branchcode,
1296
            branchcode        => $branchcode,
1297
            aqbooksellerid    => $aqbooksellerid,
1297
            aqbooksellerid    => $aqbooksellerid,
1298
            cost              => $cost,
1298
            cost              => $cost,
Lines 1312-1317 sub ModSubscription { Link Here
1312
            status            => $status,
1312
            status            => $status,
1313
            notes             => $notes,
1313
            notes             => $notes,
1314
            letter            => $letter,
1314
            letter            => $letter,
1315
            late_issue_letter_code => $late_issue_letter_code,
1315
            firstacquidate    => $firstacquidate,
1316
            firstacquidate    => $firstacquidate,
1316
            irregularity      => $irregularity,
1317
            irregularity      => $irregularity,
1317
            numberpattern     => $numberpattern,
1318
            numberpattern     => $numberpattern,
Lines 1344-1353 sub ModSubscription { Link Here
1344
1345
1345
=head2 NewSubscription
1346
=head2 NewSubscription
1346
1347
1347
$subscriptionid = &NewSubscription($auser,branchcode,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
1348
$subscriptionid = &NewSubscription($manager_id,branchcode,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
1348
    $startdate,$periodicity,$numberlength,$weeklength,$monthlength,
1349
    $startdate,$periodicity,$numberlength,$weeklength,$monthlength,
1349
    $lastvalue1,$innerloop1,$lastvalue2,$innerloop2,$lastvalue3,$innerloop3,
1350
    $lastvalue1,$innerloop1,$lastvalue2,$innerloop2,$lastvalue3,$innerloop3,
1350
    $status, $notes, $letter, $firstacquidate, $irregularity, $numberpattern,
1351
    $status, $notes, $letter, $late_issue_letter_code, $firstacquidate, $irregularity, $numberpattern,
1351
    $locale, $callnumber, $manualhistory, $internalnotes, $serialsadditems,
1352
    $locale, $callnumber, $manualhistory, $internalnotes, $serialsadditems,
1352
    $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
1353
    $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
1353
    $skip_serialseq, $itemtype, $previousitemtype);
1354
    $skip_serialseq, $itemtype, $previousitemtype);
Lines 1361-1370 the id of this new subscription Link Here
1361
1362
1362
sub NewSubscription {
1363
sub NewSubscription {
1363
    my (
1364
    my (
1364
    $auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $biblionumber,
1365
    $manager_id, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $biblionumber,
1365
    $startdate, $periodicity, $numberlength, $weeklength, $monthlength,
1366
    $startdate, $periodicity, $numberlength, $weeklength, $monthlength,
1366
    $lastvalue1, $innerloop1, $lastvalue2, $innerloop2, $lastvalue3,
1367
    $lastvalue1, $innerloop1, $lastvalue2, $innerloop2, $lastvalue3,
1367
    $innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity,
1368
    $innerloop3, $status, $notes, $letter, $late_issue_letter_code, $firstacquidate, $irregularity,
1368
    $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes,
1369
    $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes,
1369
    $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,
1370
    $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,
1370
    $location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode
1371
    $location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode
Lines 1373-1379 sub NewSubscription { Link Here
1373
1374
1374
    my $subscription = Koha::Subscription->new(
1375
    my $subscription = Koha::Subscription->new(
1375
        {
1376
        {
1376
            librarian         => $auser,
1377
            manager_id        => $manager_id,
1377
            branchcode        => $branchcode,
1378
            branchcode        => $branchcode,
1378
            aqbooksellerid    => $aqbooksellerid,
1379
            aqbooksellerid    => $aqbooksellerid,
1379
            cost              => $cost,
1380
            cost              => $cost,
Lines 1393-1398 sub NewSubscription { Link Here
1393
            status            => $status,
1394
            status            => $status,
1394
            notes             => $notes,
1395
            notes             => $notes,
1395
            letter            => $letter,
1396
            letter            => $letter,
1397
            late_issue_letter_code => $late_issue_letter_code,
1396
            firstacquidate    => $firstacquidate,
1398
            firstacquidate    => $firstacquidate,
1397
            irregularity      => $irregularity,
1399
            irregularity      => $irregularity,
1398
            numberpattern     => $numberpattern,
1400
            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 5307-5313 DROP TABLE IF EXISTS `subscription`; Link Here
5307
CREATE TABLE `subscription` (
5307
CREATE TABLE `subscription` (
5308
  `biblionumber` int(11) NOT NULL COMMENT 'foreign key for biblio.biblionumber that this subscription is attached to',
5308
  `biblionumber` int(11) NOT NULL COMMENT 'foreign key for biblio.biblionumber that this subscription is attached to',
5309
  `subscriptionid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for this subscription',
5309
  `subscriptionid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for this subscription',
5310
  `librarian` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT 'the librarian''s username from borrowers.userid',
5310
  `manager_id` INT NULL DEFAULT NULL COMMENT 'the borrowernumber of the patron that last modified the subscription',
5311
  `startdate` date DEFAULT NULL COMMENT 'start date for this subscription',
5311
  `startdate` date DEFAULT NULL COMMENT 'start date for this subscription',
5312
  `aqbooksellerid` int(11) DEFAULT 0 COMMENT 'foreign key for aqbooksellers.id to link to the vendor',
5312
  `aqbooksellerid` int(11) DEFAULT 0 COMMENT 'foreign key for aqbooksellers.id to link to the vendor',
5313
  `cost` int(11) DEFAULT 0,
5313
  `cost` int(11) DEFAULT 0,
Lines 5330-5335 CREATE TABLE `subscription` ( Link Here
5330
  `irregularity` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'any irregularities in the subscription',
5330
  `irregularity` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'any irregularities in the subscription',
5331
  `skip_serialseq` tinyint(1) NOT NULL DEFAULT 0,
5331
  `skip_serialseq` tinyint(1) NOT NULL DEFAULT 0,
5332
  `letter` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5332
  `letter` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5333
  `late_issue_letter_code` VARCHAR(20) NULL DEFAULT NULL COMMENT 'letter code used for late issue alerts',
5333
  `numberpattern` int(11) DEFAULT NULL COMMENT 'the numbering pattern used links to subscription_numberpatterns.id',
5334
  `numberpattern` int(11) DEFAULT NULL COMMENT 'the numbering pattern used links to subscription_numberpatterns.id',
5334
  `locale` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'for foreign language subscriptions to display months, seasons, etc correctly',
5335
  `locale` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'for foreign language subscriptions to display months, seasons, etc correctly',
5335
  `distributedto` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
5336
  `distributedto` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
Lines 5355-5361 CREATE TABLE `subscription` ( Link Here
5355
  KEY `subscription_ibfk_3` (`biblionumber`),
5356
  KEY `subscription_ibfk_3` (`biblionumber`),
5356
  CONSTRAINT `subscription_ibfk_1` FOREIGN KEY (`periodicity`) REFERENCES `subscription_frequencies` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
5357
  CONSTRAINT `subscription_ibfk_1` FOREIGN KEY (`periodicity`) REFERENCES `subscription_frequencies` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
5357
  CONSTRAINT `subscription_ibfk_2` FOREIGN KEY (`numberpattern`) REFERENCES `subscription_numberpatterns` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
5358
  CONSTRAINT `subscription_ibfk_2` FOREIGN KEY (`numberpattern`) REFERENCES `subscription_numberpatterns` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
5358
  CONSTRAINT `subscription_ibfk_3` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
5359
  CONSTRAINT `subscription_ibfk_3` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
5360
  CONSTRAINT `subscription_manager_id_fk` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
5359
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5361
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
5360
/*!40101 SET character_set_client = @saved_cs_client */;
5362
/*!40101 SET character_set_client = @saved_cs_client */;
5361
5363
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt (-1 / +19 lines)
Lines 78-84 fieldset.rows table { clear: none; margin: 0; } Link Here
78
                        [% ELSE %]
78
                        [% ELSE %]
79
                                <input type="hidden" name="op" value="addsubscription" />
79
                                <input type="hidden" name="op" value="addsubscription" />
80
                        [% END %]
80
                        [% END %]
81
                        <input type="hidden" name="user" value="[% logged_in_user.userid | html %]" />
82
                        <input type="hidden" name="irreg_check" value="0" />
81
                        <input type="hidden" name="irreg_check" value="0" />
83
                        <fieldset id="subscription_add_information" class="rows">
82
                        <fieldset id="subscription_add_information" class="rows">
84
                            <legend>Subscription details</legend>
83
                            <legend>Subscription details</legend>
Lines 189-194 fieldset.rows table { clear: none; margin: 0; } Link Here
189
                                        <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>
188
                                        <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>
190
                                    [% END %]
189
                                    [% END %]
191
                                </li>
190
                                </li>
191
                                <li>
192
                                    [% IF ( letterloop ) %]
193
                                        <label for="late_issue_letter_code">Late issue notification: </label>
194
                                        <select name="late_issue_letter_code" id="late_issue_letter_code">
195
                                            <option value="">None</option>
196
                                            [% FOREACH letter IN letterloop %]
197
                                                [% IF ( letter.value == late_issue_letter_code ) %]
198
                                                    <option value="[% letter.value | html %]" selected="selected">[% letter.lettername | html %]</option>
199
                                                [% ELSE %]
200
                                                    <option value="[% letter.value | html %]">[% letter.lettername | html %]</option>
201
                                                [% END %]
202
                                            [% END %]
203
                                        </select>
204
                                        <div class="hint">Selecting a notice will allow you to receive a notification when a serial issue is late.</div>
205
                                    [% ELSE %]
206
                                        <span class="label">Late issue notification: </span>
207
                                        <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>
208
                                    [% END %]
209
                                </li>
192
                                <li>
210
                                <li>
193
                                    <label for="location">Location:</label>
211
                                    <label for="location">Location:</label>
194
                                    <select name="location" id="location">
212
                                    <select name="location" id="location">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt (-1 / +6 lines)
Lines 120-126 Link Here
120
                                    <div class="rows">
120
                                    <div class="rows">
121
                                        <ol>
121
                                        <ol>
122
                                            <li><span class="label">Subscription ID: </span>[% subscriptionid | html %]</li>
122
                                            <li><span class="label">Subscription ID: </span>[% subscriptionid | html %]</li>
123
                                            <li><span class="label">Librarian identity:</span> [% librarian | html %]</li>
123
                                            <li>
124
                                                <span class="label">Manager:</span>
125
                                                [% IF subscription.manager %]
126
                                                    [% INCLUDE 'patron-title.inc' patron = subscription.manager | html %]
127
                                                [% END %]
128
                                            </li>
124
                                            <li><span class="label">Vendor:</span> <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% aqbooksellerid | uri %]">[% aqbooksellername | html %]</a></li>
129
                                            <li><span class="label">Vendor:</span> <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% aqbooksellerid | uri %]">[% aqbooksellername | html %]</a></li>
125
                                            <li><span class="label">Biblio:</span>  <a href="[% PROCESS biblio_a_href biblionumber => bibnum %]">[% bibliotitle | html %] [% bibliosubtitle | html %]</a> <em>([% bibnum | html %])</em></li>
130
                                            <li><span class="label">Biblio:</span>  <a href="[% PROCESS biblio_a_href biblionumber => bibnum %]">[% bibliotitle | html %] [% bibliosubtitle | html %]</a> <em>([% bibnum | html %])</em></li>
126
                                            [% IF ( OPACBaseURL ) %]
131
                                            [% 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 321-326 sub redirect_add_subscription { Link Here
321
    my $notes             = $query->param('notes');
320
    my $notes             = $query->param('notes');
322
    my $internalnotes     = $query->param('internalnotes');
321
    my $internalnotes     = $query->param('internalnotes');
323
    my $letter            = $query->param('letter');
322
    my $letter            = $query->param('letter');
323
    my $late_issue_letter_code = $query->param('late_issue_letter_code');
324
    my $manualhistory     = $query->param('manualhist') ? 1 : 0;
324
    my $manualhistory     = $query->param('manualhist') ? 1 : 0;
325
    my $serialsadditems   = $query->param('serialsadditems');
325
    my $serialsadditems   = $query->param('serialsadditems');
326
    my $staffdisplaycount = $query->param('staffdisplaycount');
326
    my $staffdisplaycount = $query->param('staffdisplaycount');
Lines 349-358 sub redirect_add_subscription { Link Here
349
        }
349
        }
350
    }
350
    }
351
    my $subscriptionid = NewSubscription(
351
    my $subscriptionid = NewSubscription(
352
        $auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $biblionumber,
352
        $loggedinuser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $biblionumber,
353
        $startdate, $periodicity, $numberlength, $weeklength,
353
        $startdate, $periodicity, $numberlength, $weeklength,
354
        $monthlength, $lastvalue1, $innerloop1, $lastvalue2, $innerloop2,
354
        $monthlength, $lastvalue1, $innerloop1, $lastvalue2, $innerloop2,
355
        $lastvalue3, $innerloop3, $status, $notes, $letter, $firstacquidate,
355
        $lastvalue3, $innerloop3, $status, $notes, $letter, $late_issue_letter_code, $firstacquidate,
356
        join(";",@irregularity), $numberpattern, $locale, $callnumber,
356
        join(";",@irregularity), $numberpattern, $locale, $callnumber,
357
        $manualhistory, $internalnotes, $serialsadditems,
357
        $manualhistory, $internalnotes, $serialsadditems,
358
        $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
358
        $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
Lines 389-396 sub redirect_add_subscription { Link Here
389
sub redirect_mod_subscription {
389
sub redirect_mod_subscription {
390
    my $subscriptionid = $query->param('subscriptionid');
390
    my $subscriptionid = $query->param('subscriptionid');
391
    my @irregularity = $query->multi_param('irregularity');
391
    my @irregularity = $query->multi_param('irregularity');
392
    my $auser = $query->param('user');
393
    my $librarian => scalar $query->param('librarian'),
394
    my $branchcode = $query->param('branchcode');
392
    my $branchcode = $query->param('branchcode');
395
    my $cost = $query->param('cost');
393
    my $cost = $query->param('cost');
396
    my $aqbooksellerid = $query->param('aqbooksellerid');
394
    my $aqbooksellerid = $query->param('aqbooksellerid');
Lines 435-440 sub redirect_mod_subscription { Link Here
435
    my $notes = $query->param('notes');
433
    my $notes = $query->param('notes');
436
    my $internalnotes = $query->param('internalnotes');
434
    my $internalnotes = $query->param('internalnotes');
437
    my $letter = $query->param('letter');
435
    my $letter = $query->param('letter');
436
    my $late_issue_letter_code = $query->param('late_issue_letter_code');
438
    my $manualhistory = $query->param('manualhist') ? 1 : 0;
437
    my $manualhistory = $query->param('manualhist') ? 1 : 0;
439
    my $serialsadditems = $query->param('serialsadditems');
438
    my $serialsadditems = $query->param('serialsadditems');
440
	my $staffdisplaycount = $query->param('staffdisplaycount');
439
	my $staffdisplaycount = $query->param('staffdisplaycount');
Lines 473-483 sub redirect_mod_subscription { Link Here
473
    }
472
    }
474
473
475
    ModSubscription(
474
    ModSubscription(
476
        $auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $startdate,
475
        $loggedinuser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $startdate,
477
        $periodicity, $firstacquidate, join(";",@irregularity),
476
        $periodicity, $firstacquidate, join(";",@irregularity),
478
        $numberpattern, $locale, $numberlength, $weeklength, $monthlength, $lastvalue1,
477
        $numberpattern, $locale, $numberlength, $weeklength, $monthlength, $lastvalue1,
479
        $innerloop1, $lastvalue2, $innerloop2, $lastvalue3, $innerloop3,
478
        $innerloop1, $lastvalue2, $innerloop2, $lastvalue3, $innerloop3,
480
        $status, $biblionumber, $callnumber, $notes, $letter,
479
        $status, $biblionumber, $callnumber, $notes, $letter, $late_issue_letter_code,
481
        $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount,
480
        $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount,
482
        $opacdisplaycount, $graceperiod, $location, $enddate, $subscriptionid,
481
        $opacdisplaycount, $graceperiod, $location, $enddate, $subscriptionid,
483
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode
482
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode
(-)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 498-504 my $subscriptionid = NewSubscription( Link Here
498
     undef,      "",     undef, undef, undef, $biblionumber,
498
     undef,      "",     undef, undef, undef, $biblionumber,
499
    '2013-01-01', 1, undef, undef,  undef,
499
    '2013-01-01', 1, undef, undef,  undef,
500
    undef,      undef,  undef, undef, undef, undef,
500
    undef,      undef,  undef, undef, undef, undef,
501
    1,          $notes,undef, '2013-01-01', undef, 1,
501
    1,          $notes,undef, undef, '2013-01-01', undef, 1,
502
    undef,       undef,  0,    $internalnotes,  0,
502
    undef,       undef,  0,    $internalnotes,  0,
503
    undef, undef, 0,          undef,         '2013-12-31', 0
503
    undef, undef, 0,          undef,         '2013-12-31', 0
504
);
504
);
Lines 592-598 subtest 'SendAlerts - claimissue' => sub { Link Here
592
         undef, "", $booksellerid, undef, undef, $biblionumber,
592
         undef, "", $booksellerid, undef, undef, $biblionumber,
593
        '2013-01-01', 1, undef, undef,  undef,
593
        '2013-01-01', 1, undef, undef,  undef,
594
        undef,  undef,  undef, undef, undef, undef,
594
        undef,  undef,  undef, undef, undef, undef,
595
        1, 'public',undef, '2013-01-01', undef, 1,
595
        1, 'public',undef, undef, '2013-01-01', undef, 1,
596
        undef, undef,  0, 'internal',  0,
596
        undef, undef,  0, 'internal',  0,
597
        undef, undef, 0,  undef, '2013-12-31', 0
597
        undef, undef, 0,  undef, '2013-12-31', 0
598
    );
598
    );
(-)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