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

(-)a/C4/Serials.pm (-8 / +10 lines)
Lines 1317-1327 returns the number of rows affected Link Here
1317
1317
1318
sub ModSubscription {
1318
sub ModSubscription {
1319
    my (
1319
    my (
1320
    $auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $startdate,
1320
    $manager_id, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $startdate,
1321
    $periodicity, $firstacquidate, $irregularity, $numberpattern, $locale,
1321
    $periodicity, $firstacquidate, $irregularity, $numberpattern, $locale,
1322
    $numberlength, $weeklength, $monthlength, $lastvalue1, $innerloop1,
1322
    $numberlength, $weeklength, $monthlength, $lastvalue1, $innerloop1,
1323
    $lastvalue2, $innerloop2, $lastvalue3, $innerloop3, $status,
1323
    $lastvalue2, $innerloop2, $lastvalue3, $innerloop3, $status,
1324
    $biblionumber, $callnumber, $notes, $letter, $manualhistory,
1324
    $biblionumber, $callnumber, $notes, $letter, $late_issue_letter_code, $manualhistory,
1325
    $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1325
    $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1326
    $graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq,
1326
    $graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq,
1327
    $itemtype, $previousitemtype, $mana_id, $ccode, $published_on_template
1327
    $itemtype, $previousitemtype, $mana_id, $ccode, $published_on_template
Lines 1330-1336 sub ModSubscription { Link Here
1330
    my $subscription = Koha::Subscriptions->find($subscriptionid);
1330
    my $subscription = Koha::Subscriptions->find($subscriptionid);
1331
    $subscription->set(
1331
    $subscription->set(
1332
        {
1332
        {
1333
            librarian         => $auser,
1333
            manager_id        => $manager_id,
1334
            branchcode        => $branchcode,
1334
            branchcode        => $branchcode,
1335
            aqbooksellerid    => $aqbooksellerid,
1335
            aqbooksellerid    => $aqbooksellerid,
1336
            cost              => $cost,
1336
            cost              => $cost,
Lines 1350-1355 sub ModSubscription { Link Here
1350
            status            => $status,
1350
            status            => $status,
1351
            notes             => $notes,
1351
            notes             => $notes,
1352
            letter            => $letter,
1352
            letter            => $letter,
1353
            late_issue_letter_code => $late_issue_letter_code,
1353
            firstacquidate    => $firstacquidate,
1354
            firstacquidate    => $firstacquidate,
1354
            irregularity      => $irregularity,
1355
            irregularity      => $irregularity,
1355
            numberpattern     => $numberpattern,
1356
            numberpattern     => $numberpattern,
Lines 1383-1392 sub ModSubscription { Link Here
1383
1384
1384
=head2 NewSubscription
1385
=head2 NewSubscription
1385
1386
1386
$subscriptionid = &NewSubscription($auser,branchcode,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
1387
$subscriptionid = &NewSubscription($manager_id,branchcode,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
1387
    $startdate,$periodicity,$numberlength,$weeklength,$monthlength,
1388
    $startdate,$periodicity,$numberlength,$weeklength,$monthlength,
1388
    $lastvalue1,$innerloop1,$lastvalue2,$innerloop2,$lastvalue3,$innerloop3,
1389
    $lastvalue1,$innerloop1,$lastvalue2,$innerloop2,$lastvalue3,$innerloop3,
1389
    $status, $notes, $letter, $firstacquidate, $irregularity, $numberpattern,
1390
    $status, $notes, $letter, $late_issue_letter_code, $firstacquidate, $irregularity, $numberpattern,
1390
    $locale, $callnumber, $manualhistory, $internalnotes, $serialsadditems,
1391
    $locale, $callnumber, $manualhistory, $internalnotes, $serialsadditems,
1391
    $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
1392
    $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
1392
    $skip_serialseq, $itemtype, $previousitemtype);
1393
    $skip_serialseq, $itemtype, $previousitemtype);
Lines 1400-1409 the id of this new subscription Link Here
1400
1401
1401
sub NewSubscription {
1402
sub NewSubscription {
1402
    my (
1403
    my (
1403
    $auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $biblionumber,
1404
    $manager_id, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $biblionumber,
1404
    $startdate, $periodicity, $numberlength, $weeklength, $monthlength,
1405
    $startdate, $periodicity, $numberlength, $weeklength, $monthlength,
1405
    $lastvalue1, $innerloop1, $lastvalue2, $innerloop2, $lastvalue3,
1406
    $lastvalue1, $innerloop1, $lastvalue2, $innerloop2, $lastvalue3,
1406
    $innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity,
1407
    $innerloop3, $status, $notes, $letter, $late_issue_letter_code, $firstacquidate, $irregularity,
1407
    $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes,
1408
    $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes,
1408
    $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,
1409
    $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,
1409
    $location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode,
1410
    $location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode,
Lines 1413-1419 sub NewSubscription { Link Here
1413
1414
1414
    my $subscription = Koha::Subscription->new(
1415
    my $subscription = Koha::Subscription->new(
1415
        {
1416
        {
1416
            librarian         => $auser,
1417
            manager_id        => $manager_id,
1417
            branchcode        => $branchcode,
1418
            branchcode        => $branchcode,
1418
            aqbooksellerid    => $aqbooksellerid,
1419
            aqbooksellerid    => $aqbooksellerid,
1419
            cost              => $cost,
1420
            cost              => $cost,
Lines 1433-1438 sub NewSubscription { Link Here
1433
            status            => $status,
1434
            status            => $status,
1434
            notes             => $notes,
1435
            notes             => $notes,
1435
            letter            => $letter,
1436
            letter            => $letter,
1437
            late_issue_letter_code => $late_issue_letter_code,
1436
            firstacquidate    => $firstacquidate,
1438
            firstacquidate    => $firstacquidate,
1437
            irregularity      => $irregularity,
1439
            irregularity      => $irregularity,
1438
            numberpattern     => $numberpattern,
1440
            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 6101-6107 DROP TABLE IF EXISTS `subscription`; Link Here
6101
CREATE TABLE `subscription` (
6101
CREATE TABLE `subscription` (
6102
  `biblionumber` int(11) NOT NULL COMMENT 'foreign key for biblio.biblionumber that this subscription is attached to',
6102
  `biblionumber` int(11) NOT NULL COMMENT 'foreign key for biblio.biblionumber that this subscription is attached to',
6103
  `subscriptionid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for this subscription',
6103
  `subscriptionid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for this subscription',
6104
  `librarian` varchar(100) DEFAULT '' COMMENT 'the librarian''s username from borrowers.userid',
6104
  `manager_id` INT NULL DEFAULT NULL COMMENT 'the borrowernumber of the patron that last modified the subscription',
6105
  `startdate` date DEFAULT NULL COMMENT 'start date for this subscription',
6105
  `startdate` date DEFAULT NULL COMMENT 'start date for this subscription',
6106
  `aqbooksellerid` int(11) DEFAULT NULL COMMENT 'foreign key for aqbooksellers.id to link to the vendor',
6106
  `aqbooksellerid` int(11) DEFAULT NULL COMMENT 'foreign key for aqbooksellers.id to link to the vendor',
6107
  `cost` int(11) DEFAULT 0,
6107
  `cost` int(11) DEFAULT 0,
Lines 6124-6129 CREATE TABLE `subscription` ( Link Here
6124
  `irregularity` mediumtext DEFAULT NULL COMMENT 'any irregularities in the subscription',
6124
  `irregularity` mediumtext DEFAULT NULL COMMENT 'any irregularities in the subscription',
6125
  `skip_serialseq` tinyint(1) NOT NULL DEFAULT 0,
6125
  `skip_serialseq` tinyint(1) NOT NULL DEFAULT 0,
6126
  `letter` varchar(20) DEFAULT NULL,
6126
  `letter` varchar(20) DEFAULT NULL,
6127
  `late_issue_letter_code` varchar(20) NULL DEFAULT NULL COMMENT 'letter code used for late issue alerts',
6127
  `numberpattern` int(11) DEFAULT NULL COMMENT 'the numbering pattern used links to subscription_numberpatterns.id',
6128
  `numberpattern` int(11) DEFAULT NULL COMMENT 'the numbering pattern used links to subscription_numberpatterns.id',
6128
  `locale` varchar(80) DEFAULT NULL COMMENT 'for foreign language subscriptions to display months, seasons, etc correctly',
6129
  `locale` varchar(80) DEFAULT NULL COMMENT 'for foreign language subscriptions to display months, seasons, etc correctly',
6129
  `distributedto` mediumtext DEFAULT NULL,
6130
  `distributedto` mediumtext DEFAULT NULL,
Lines 6152-6158 CREATE TABLE `subscription` ( Link Here
6152
  CONSTRAINT `subscription_ibfk_1` FOREIGN KEY (`periodicity`) REFERENCES `subscription_frequencies` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
6153
  CONSTRAINT `subscription_ibfk_1` FOREIGN KEY (`periodicity`) REFERENCES `subscription_frequencies` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
6153
  CONSTRAINT `subscription_ibfk_2` FOREIGN KEY (`numberpattern`) REFERENCES `subscription_numberpatterns` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
6154
  CONSTRAINT `subscription_ibfk_2` FOREIGN KEY (`numberpattern`) REFERENCES `subscription_numberpatterns` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
6154
  CONSTRAINT `subscription_ibfk_3` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
6155
  CONSTRAINT `subscription_ibfk_3` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
6155
  CONSTRAINT `subscription_ibfk_4` FOREIGN KEY (`aqbooksellerid`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
6156
  CONSTRAINT `subscription_ibfk_4` FOREIGN KEY (`aqbooksellerid`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
6157
  CONSTRAINT `subscription_manager_id_fk` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
6156
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6158
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
6157
/*!40101 SET character_set_client = @saved_cs_client */;
6159
/*!40101 SET character_set_client = @saved_cs_client */;
6158
6160
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt (-1 / +19 lines)
Lines 73-79 fieldset.rows table { clear: none; margin: 0; } Link Here
73
                        [% ELSE %]
73
                        [% ELSE %]
74
                                <input type="hidden" name="op" value="cud-addsubscription" />
74
                                <input type="hidden" name="op" value="cud-addsubscription" />
75
                        [% END %]
75
                        [% END %]
76
                        <input type="hidden" name="user" value="[% logged_in_user.userid | html %]" />
77
                        <input type="hidden" name="irreg_check" value="0" />
76
                        <input type="hidden" name="irreg_check" value="0" />
78
                        <fieldset id="subscription_add_information" class="rows">
77
                        <fieldset id="subscription_add_information" class="rows">
79
                            <legend>Subscription details</legend>
78
                            <legend>Subscription details</legend>
Lines 181-186 fieldset.rows table { clear: none; margin: 0; } Link Here
181
                                        <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>
180
                                        <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>
182
                                    [% END %]
181
                                    [% END %]
183
                                </li>
182
                                </li>
183
                                <li>
184
                                    [% IF ( letterloop ) %]
185
                                        <label for="late_issue_letter_code">Late issue notification: </label>
186
                                        <select name="late_issue_letter_code" id="late_issue_letter_code">
187
                                            <option value="">None</option>
188
                                            [% FOREACH letter IN letterloop %]
189
                                                [% IF ( letter.value == late_issue_letter_code ) %]
190
                                                    <option value="[% letter.value | html %]" selected="selected">[% letter.lettername | html %]</option>
191
                                                [% ELSE %]
192
                                                    <option value="[% letter.value | html %]">[% letter.lettername | html %]</option>
193
                                                [% END %]
194
                                            [% END %]
195
                                        </select>
196
                                        <div class="hint">Selecting a notice will allow you to receive a notification when a serial issue is late.</div>
197
                                    [% ELSE %]
198
                                        <span class="label">Late issue notification: </span>
199
                                        <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>
200
                                    [% END %]
201
                                </li>
184
                                <li>
202
                                <li>
185
                                    <label for="location">Location:</label>
203
                                    <label for="location">Location:</label>
186
                                    <select name="location" id="location">
204
                                    <select name="location" id="location">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt (-1 / +6 lines)
Lines 110-116 Link Here
110
                                    <div class="rows">
110
                                    <div class="rows">
111
                                        <ol>
111
                                        <ol>
112
                                            <li><span class="label">Subscription ID: </span>[% subscriptionid | html %]</li>
112
                                            <li><span class="label">Subscription ID: </span>[% subscriptionid | html %]</li>
113
                                            <li><span class="label">Librarian identity:</span> [% librarian | html %]</li>
113
                                            <li>
114
                                                <span class="label">Manager:</span>
115
                                                [% IF subscription.manager %]
116
                                                    [% INCLUDE 'patron-title.inc' patron = subscription.manager | html %]
117
                                                [% END %]
118
                                            </li>
114
                                            <li><span class="label">Vendor:</span> <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% aqbooksellerid | uri %]">[% aqbooksellername | html %]</a></li>
119
                                            <li><span class="label">Vendor:</span> <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% aqbooksellerid | uri %]">[% aqbooksellername | html %]</a></li>
115
                                            <li>
120
                                            <li>
116
                                                <span class="label">Bibliographic record:</span>
121
                                                <span class="label">Bibliographic record:</span>
(-)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 290-296 sub redirect_add_subscription { Link Here
290
    }
290
    }
291
    my $numberpattern = Koha::Subscription::Numberpatterns->new_or_existing({ $query->Vars });
291
    my $numberpattern = Koha::Subscription::Numberpatterns->new_or_existing({ $query->Vars });
292
292
293
    my $auser          = $query->param('user');
294
    my $branchcode     = $query->param('branchcode');
293
    my $branchcode     = $query->param('branchcode');
295
    my $aqbooksellerid = $query->param('aqbooksellerid');
294
    my $aqbooksellerid = $query->param('aqbooksellerid');
296
    my $cost           = $query->param('cost');
295
    my $cost           = $query->param('cost');
Lines 316-321 sub redirect_add_subscription { Link Here
316
    my $notes             = $query->param('notes');
315
    my $notes             = $query->param('notes');
317
    my $internalnotes     = $query->param('internalnotes');
316
    my $internalnotes     = $query->param('internalnotes');
318
    my $letter            = $query->param('letter');
317
    my $letter            = $query->param('letter');
318
    my $late_issue_letter_code = $query->param('late_issue_letter_code');
319
    my $manualhistory     = $query->param('manualhist') ? 1 : 0;
319
    my $manualhistory     = $query->param('manualhist') ? 1 : 0;
320
    my $serialsadditems   = $query->param('serialsadditems');
320
    my $serialsadditems   = $query->param('serialsadditems');
321
    my $staffdisplaycount = $query->param('staffdisplaycount');
321
    my $staffdisplaycount = $query->param('staffdisplaycount');
Lines 345-354 sub redirect_add_subscription { Link Here
345
        }
345
        }
346
    }
346
    }
347
    my $subscriptionid = NewSubscription(
347
    my $subscriptionid = NewSubscription(
348
        $auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $biblionumber,
348
        $loggedinuser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $biblionumber,
349
        $startdate, $periodicity, $numberlength, $weeklength,
349
        $startdate, $periodicity, $numberlength, $weeklength,
350
        $monthlength, $lastvalue1, $innerloop1, $lastvalue2, $innerloop2,
350
        $monthlength, $lastvalue1, $innerloop1, $lastvalue2, $innerloop2,
351
        $lastvalue3, $innerloop3, $status, $notes, $letter, $firstacquidate,
351
        $lastvalue3, $innerloop3, $status, $notes, $letter, $late_issue_letter_code, $firstacquidate,
352
        join(";",@irregularity), $numberpattern, $locale, $callnumber,
352
        join(";",@irregularity), $numberpattern, $locale, $callnumber,
353
        $manualhistory, $internalnotes, $serialsadditems,
353
        $manualhistory, $internalnotes, $serialsadditems,
354
        $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
354
        $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
Lines 370-377 sub redirect_add_subscription { Link Here
370
sub redirect_mod_subscription {
370
sub redirect_mod_subscription {
371
    my $subscriptionid = $query->param('subscriptionid');
371
    my $subscriptionid = $query->param('subscriptionid');
372
    my @irregularity = $query->multi_param('irregularity');
372
    my @irregularity = $query->multi_param('irregularity');
373
    my $auser = $query->param('user');
374
    my $librarian => scalar $query->param('librarian'),
375
    my $branchcode = $query->param('branchcode');
373
    my $branchcode = $query->param('branchcode');
376
    my $cost = $query->param('cost');
374
    my $cost = $query->param('cost');
377
    my $aqbooksellerid = $query->param('aqbooksellerid');
375
    my $aqbooksellerid = $query->param('aqbooksellerid');
Lines 416-421 sub redirect_mod_subscription { Link Here
416
    my $notes = $query->param('notes');
414
    my $notes = $query->param('notes');
417
    my $internalnotes = $query->param('internalnotes');
415
    my $internalnotes = $query->param('internalnotes');
418
    my $letter = $query->param('letter');
416
    my $letter = $query->param('letter');
417
    my $late_issue_letter_code = $query->param('late_issue_letter_code');
419
    my $manualhistory = $query->param('manualhist') ? 1 : 0;
418
    my $manualhistory = $query->param('manualhist') ? 1 : 0;
420
    my $serialsadditems = $query->param('serialsadditems');
419
    my $serialsadditems = $query->param('serialsadditems');
421
	my $staffdisplaycount = $query->param('staffdisplaycount');
420
	my $staffdisplaycount = $query->param('staffdisplaycount');
Lines 455-465 sub redirect_mod_subscription { Link Here
455
    }
454
    }
456
455
457
    ModSubscription(
456
    ModSubscription(
458
        $auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $startdate,
457
        $loggedinuser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $startdate,
459
        $periodicity, $firstacquidate, join(";",@irregularity),
458
        $periodicity, $firstacquidate, join(";",@irregularity),
460
        $numberpattern, $locale, $numberlength, $weeklength, $monthlength, $lastvalue1,
459
        $numberpattern, $locale, $numberlength, $weeklength, $monthlength, $lastvalue1,
461
        $innerloop1, $lastvalue2, $innerloop2, $lastvalue3, $innerloop3,
460
        $innerloop1, $lastvalue2, $innerloop2, $lastvalue3, $innerloop3,
462
        $status, $biblionumber, $callnumber, $notes, $letter,
461
        $status, $biblionumber, $callnumber, $notes, $letter, $late_issue_letter_code,
463
        $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount,
462
        $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount,
464
        $opacdisplaycount, $graceperiod, $location, $enddate, $subscriptionid,
463
        $opacdisplaycount, $graceperiod, $location, $enddate, $subscriptionid,
465
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode, $published_on_template
464
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id, $ccode, $published_on_template
(-)a/serials/subscription-detail.pl (+1 lines)
Lines 148-153 while ( my $o = $orders->next ) { Link Here
148
$template->param(
148
$template->param(
149
    subscription => $subscription,
149
    subscription => $subscription,
150
    subscriptionid => $subscriptionid,
150
    subscriptionid => $subscriptionid,
151
    subscription => Koha::Subscriptions->find($subscriptionid),
151
    serialslist => \@serialslist,
152
    serialslist => \@serialslist,
152
    hasRouting  => $hasRouting,
153
    hasRouting  => $hasRouting,
153
    routing => C4::Context->preference("RoutingSerials"),
154
    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 649-655 my $subscriptionid = NewSubscription( Link Here
649
     undef,      "",     undef, undef, undef, $biblionumber,
649
     undef,      "",     undef, undef, undef, $biblionumber,
650
    '2013-01-01', 1, undef, undef,  undef,
650
    '2013-01-01', 1, undef, undef,  undef,
651
    undef,      undef,  undef, undef, undef, undef,
651
    undef,      undef,  undef, undef, undef, undef,
652
    1,          $notes,undef, '2013-01-01', undef, $number_pattern->id,
652
    1,          $notes,undef, undef, '2013-01-01', undef, $number_pattern->id,
653
    undef,       undef,  0,    $internalnotes,  0,
653
    undef,       undef,  0,    $internalnotes,  0,
654
    undef, undef, 0,          undef,         '2013-12-31', 0
654
    undef, undef, 0,          undef,         '2013-12-31', 0
655
);
655
);
Lines 763-769 subtest 'SendAlerts - claimissue' => sub { Link Here
763
         undef, "", $booksellerid, undef, undef, $biblionumber,
763
         undef, "", $booksellerid, undef, undef, $biblionumber,
764
        '2013-01-01', 1, undef, undef,  undef,
764
        '2013-01-01', 1, undef, undef,  undef,
765
        undef,  undef,  undef, undef, undef, undef,
765
        undef,  undef,  undef, undef, undef, undef,
766
        1, 'public',undef, '2013-01-01', undef, $number_pattern->id,
766
        1, 'public',undef, undef, '2013-01-01', undef, $number_pattern->id,
767
        undef, undef,  0, 'internal',  0,
767
        undef, undef,  0, 'internal',  0,
768
        undef, undef, 0,  undef, '2013-12-31', 0
768
        undef, undef, 0,  undef, '2013-12-31', 0
769
    );
769
    );
(-)a/t/db_dependent/Serials.t (-9 / +11 lines)
Lines 103-108 my $subscriptionid = NewSubscription( Link Here
103
    1,
103
    1,
104
    $notes,
104
    $notes,
105
    undef,
105
    undef,
106
    undef,
106
    '2013-01-01',
107
    '2013-01-01',
107
    undef,
108
    undef,
108
    $pattern_id,
109
    $pattern_id,
Lines 143-148 NewSubscription( Link Here
143
    1,
144
    1,
144
    $notes,
145
    $notes,
145
    undef,
146
    undef,
147
    undef,
146
    '2013-01-02',
148
    '2013-01-02',
147
    undef,
149
    undef,
148
    $pattern_id,
150
    $pattern_id,
Lines 267-277 if (not $frequency->{unit}) { Link Here
267
    $subscriptioninformation->{ccode} = 'NFIC';
269
    $subscriptioninformation->{ccode} = 'NFIC';
268
270
269
    ModSubscription( @$subscriptioninformation{qw(
271
    ModSubscription( @$subscriptioninformation{qw(
270
        librarian branchcode aqbooksellerid cost aqbudgetid startdate
272
        manager_id branchcode aqbooksellerid cost aqbudgetid startdate
271
        periodicity firstacquidate irregularity numberpattern locale
273
        periodicity firstacquidate irregularity numberpattern locale
272
        numberlength weeklength monthlength lastvalue1 innerloop1 lastvalue2
274
        numberlength weeklength monthlength lastvalue1 innerloop1 lastvalue2
273
        innerloop2 lastvalue3 innerloop3 status biblionumber callnumber notes
275
        innerloop2 lastvalue3 innerloop3 status biblionumber callnumber notes
274
        letter manualhistory internalnotes serialsadditems staffdisplaycount
276
        letter late_issue_letter_code manualhistory internalnotes serialsadditems staffdisplaycount
275
        opacdisplaycount graceperiod location enddate subscriptionid
277
        opacdisplaycount graceperiod location enddate subscriptionid
276
        skip_serialseq itemtype previousitemtype mana_id ccode
278
        skip_serialseq itemtype previousitemtype mana_id ccode
277
    )} );
279
    )} );
Lines 329-339 if ($old_frequency) { Link Here
329
    $subscriptioninformation->{periodicity} = $old_frequency;
331
    $subscriptioninformation->{periodicity} = $old_frequency;
330
332
331
    ModSubscription( @$subscriptioninformation{qw(
333
    ModSubscription( @$subscriptioninformation{qw(
332
        librarian branchcode aqbooksellerid cost aqbudgetid startdate
334
        manager_id branchcode aqbooksellerid cost aqbudgetid startdate
333
        periodicity firstacquidate irregularity numberpattern locale
335
        periodicity firstacquidate irregularity numberpattern locale
334
        numberlength weeklength monthlength lastvalue1 innerloop1 lastvalue2
336
        numberlength weeklength monthlength lastvalue1 innerloop1 lastvalue2
335
        innerloop2 lastvalue3 innerloop3 status biblionumber callnumber notes
337
        innerloop2 lastvalue3 innerloop3 status biblionumber callnumber notes
336
        letter manualhistory internalnotes serialsadditems staffdisplaycount
338
        letter late_issue_letter_code manualhistory internalnotes serialsadditems staffdisplaycount
337
        opacdisplaycount graceperiod location enddate subscriptionid
339
        opacdisplaycount graceperiod location enddate subscriptionid
338
        skip_serialseq
340
        skip_serialseq
339
    )} );
341
    )} );
Lines 479-485 $subscriptionid = NewSubscription( Link Here
479
    undef,      "",     undef, undef, $budget_id, $biblionumber,
481
    undef,      "",     undef, undef, $budget_id, $biblionumber,
480
    '2013-01-01', $frequency_id, undef, undef,  undef,
482
    '2013-01-01', $frequency_id, undef, undef,  undef,
481
    undef,      undef,  undef, undef, undef, undef,
483
    undef,      undef,  undef, undef, undef, undef,
482
    1,          $notes,undef, '2013-01-01', undef, $pattern_id,
484
    1,          $notes,undef, undef, '2013-01-01', undef, $pattern_id,
483
    undef,       undef,  0,    $internalnotes,  0,
485
    undef,       undef,  0,    $internalnotes,  0,
484
    undef, undef, 0,          undef,         '2013-12-31', 0
486
    undef, undef, 0,          undef,         '2013-12-31', 0
485
);
487
);
Lines 576-585 subtest "PreserveSerialNotes preference" => sub { Link Here
576
subtest "NewSubscription|ModSubscription" => sub {
578
subtest "NewSubscription|ModSubscription" => sub {
577
    plan tests => 4;
579
    plan tests => 4;
578
    my $subscriptionid = NewSubscription(
580
    my $subscriptionid = NewSubscription(
579
        "",      "",     "", "", $budget_id, $biblionumber,
581
        undef,      "",     "", "", $budget_id, $biblionumber,
580
        '2013-01-01', $frequency_id, "", "",  "",
582
        '2013-01-01', $frequency_id, "", "",  "",
581
        "",      "",  "", "", "", "",
583
        "",      "",  "", "", "", "",
582
        1,          $notes,"", '2013-01-01', "", $pattern_id,
584
        1,          $notes,"", undef, '2013-01-01', "", $pattern_id,
583
        "",       "",  0,    $internalnotes,  0,
585
        "",       "",  0,    $internalnotes,  0,
584
        "", "", 0,          "",         '2013-12-31', 0
586
        "", "", 0,          "",         '2013-12-31', 0
585
    );
587
    );
Lines 593-603 subtest "NewSubscription|ModSubscription" => sub { Link Here
593
    my $subscription_info = $subscription->unblessed;
595
    my $subscription_info = $subscription->unblessed;
594
    $subscription_info->{biblionumber} = $biblio_2->biblionumber;
596
    $subscription_info->{biblionumber} = $biblio_2->biblionumber;
595
    ModSubscription( @$subscription_info{qw(
597
    ModSubscription( @$subscription_info{qw(
596
        librarian branchcode aqbooksellerid cost aqbudgetid startdate
598
        manager_id branchcode aqbooksellerid cost aqbudgetid startdate
597
        periodicity firstacquidate irregularity numberpattern locale
599
        periodicity firstacquidate irregularity numberpattern locale
598
        numberlength weeklength monthlength lastvalue1 innerloop1 lastvalue2
600
        numberlength weeklength monthlength lastvalue1 innerloop1 lastvalue2
599
        innerloop2 lastvalue3 innerloop3 status biblionumber callnumber notes
601
        innerloop2 lastvalue3 innerloop3 status biblionumber callnumber notes
600
        letter manualhistory internalnotes serialsadditems staffdisplaycount
602
        letter late_issue_letter_code manualhistory internalnotes serialsadditems staffdisplaycount
601
        opacdisplaycount graceperiod location enddate subscriptionid
603
        opacdisplaycount graceperiod location enddate subscriptionid
602
        skip_serialseq
604
        skip_serialseq
603
    )} );
605
    )} );
(-)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