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

(-)a/C4/Serials.pm (-8 / +10 lines)
Lines 1312-1322 returns the number of rows affected Link Here
1312
1312
1313
sub ModSubscription {
1313
sub ModSubscription {
1314
    my (
1314
    my (
1315
    $auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $startdate,
1315
    $manager_id, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $startdate,
1316
    $periodicity, $firstacquidate, $irregularity, $numberpattern, $locale,
1316
    $periodicity, $firstacquidate, $irregularity, $numberpattern, $locale,
1317
    $numberlength, $weeklength, $monthlength, $lastvalue1, $innerloop1,
1317
    $numberlength, $weeklength, $monthlength, $lastvalue1, $innerloop1,
1318
    $lastvalue2, $innerloop2, $lastvalue3, $innerloop3, $status,
1318
    $lastvalue2, $innerloop2, $lastvalue3, $innerloop3, $status,
1319
    $biblionumber, $callnumber, $notes, $letter, $manualhistory,
1319
    $biblionumber, $callnumber, $notes, $letter, $late_issue_letter_code, $manualhistory,
1320
    $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1320
    $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount,
1321
    $graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq,
1321
    $graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq,
1322
    $itemtype, $previousitemtype, $mana_id
1322
    $itemtype, $previousitemtype, $mana_id
Lines 1325-1331 sub ModSubscription { Link Here
1325
    my $subscription = Koha::Subscriptions->find($subscriptionid);
1325
    my $subscription = Koha::Subscriptions->find($subscriptionid);
1326
    $subscription->set(
1326
    $subscription->set(
1327
        {
1327
        {
1328
            librarian         => $auser,
1328
            manager_id        => $manager_id,
1329
            branchcode        => $branchcode,
1329
            branchcode        => $branchcode,
1330
            aqbooksellerid    => $aqbooksellerid,
1330
            aqbooksellerid    => $aqbooksellerid,
1331
            cost              => $cost,
1331
            cost              => $cost,
Lines 1345-1350 sub ModSubscription { Link Here
1345
            status            => $status,
1345
            status            => $status,
1346
            notes             => $notes,
1346
            notes             => $notes,
1347
            letter            => $letter,
1347
            letter            => $letter,
1348
            late_issue_letter_code => $late_issue_letter_code,
1348
            firstacquidate    => $firstacquidate,
1349
            firstacquidate    => $firstacquidate,
1349
            irregularity      => $irregularity,
1350
            irregularity      => $irregularity,
1350
            numberpattern     => $numberpattern,
1351
            numberpattern     => $numberpattern,
Lines 1376-1385 sub ModSubscription { Link Here
1376
1377
1377
=head2 NewSubscription
1378
=head2 NewSubscription
1378
1379
1379
$subscriptionid = &NewSubscription($auser,branchcode,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
1380
$subscriptionid = &NewSubscription($manager_id,branchcode,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
1380
    $startdate,$periodicity,$numberlength,$weeklength,$monthlength,
1381
    $startdate,$periodicity,$numberlength,$weeklength,$monthlength,
1381
    $lastvalue1,$innerloop1,$lastvalue2,$innerloop2,$lastvalue3,$innerloop3,
1382
    $lastvalue1,$innerloop1,$lastvalue2,$innerloop2,$lastvalue3,$innerloop3,
1382
    $status, $notes, $letter, $firstacquidate, $irregularity, $numberpattern,
1383
    $status, $notes, $letter, $late_issue_letter_code, $firstacquidate, $irregularity, $numberpattern,
1383
    $locale, $callnumber, $manualhistory, $internalnotes, $serialsadditems,
1384
    $locale, $callnumber, $manualhistory, $internalnotes, $serialsadditems,
1384
    $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
1385
    $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
1385
    $skip_serialseq, $itemtype, $previousitemtype);
1386
    $skip_serialseq, $itemtype, $previousitemtype);
Lines 1393-1402 the id of this new subscription Link Here
1393
1394
1394
sub NewSubscription {
1395
sub NewSubscription {
1395
    my (
1396
    my (
1396
    $auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $biblionumber,
1397
    $manager_id, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $biblionumber,
1397
    $startdate, $periodicity, $numberlength, $weeklength, $monthlength,
1398
    $startdate, $periodicity, $numberlength, $weeklength, $monthlength,
1398
    $lastvalue1, $innerloop1, $lastvalue2, $innerloop2, $lastvalue3,
1399
    $lastvalue1, $innerloop1, $lastvalue2, $innerloop2, $lastvalue3,
1399
    $innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity,
1400
    $innerloop3, $status, $notes, $letter, $late_issue_letter_code, $firstacquidate, $irregularity,
1400
    $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes,
1401
    $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes,
1401
    $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,
1402
    $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod,
1402
    $location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id
1403
    $location, $enddate, $skip_serialseq, $itemtype, $previousitemtype, $mana_id
Lines 1405-1411 sub NewSubscription { Link Here
1405
1406
1406
    my $subscription = Koha::Subscription->new(
1407
    my $subscription = Koha::Subscription->new(
1407
        {
1408
        {
1408
            librarian         => $auser,
1409
            manager_id        => $manager_id,
1409
            branchcode        => $branchcode,
1410
            branchcode        => $branchcode,
1410
            aqbooksellerid    => $aqbooksellerid,
1411
            aqbooksellerid    => $aqbooksellerid,
1411
            cost              => $cost,
1412
            cost              => $cost,
Lines 1425-1430 sub NewSubscription { Link Here
1425
            status            => $status,
1426
            status            => $status,
1426
            notes             => $notes,
1427
            notes             => $notes,
1427
            letter            => $letter,
1428
            letter            => $letter,
1429
            late_issue_letter_code => $late_issue_letter_code,
1428
            firstacquidate    => $firstacquidate,
1430
            firstacquidate    => $firstacquidate,
1429
            irregularity      => $irregularity,
1431
            irregularity      => $irregularity,
1430
            numberpattern     => $numberpattern,
1432
            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 undef 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 4786-4792 DROP TABLE IF EXISTS `subscription`; Link Here
4786
CREATE TABLE `subscription` (
4786
CREATE TABLE `subscription` (
4787
  `biblionumber` int(11) NOT NULL COMMENT 'foreign key for biblio.biblionumber that this subscription is attached to',
4787
  `biblionumber` int(11) NOT NULL COMMENT 'foreign key for biblio.biblionumber that this subscription is attached to',
4788
  `subscriptionid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for this subscription',
4788
  `subscriptionid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique key for this subscription',
4789
  `librarian` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT 'the librarian''s username from borrowers.userid',
4789
  `manager_id` INT NULL DEFAULT NULL COMMENT 'the borrowernumber of the patron that last modified the subscription',
4790
  `startdate` date DEFAULT NULL COMMENT 'start date for this subscription',
4790
  `startdate` date DEFAULT NULL COMMENT 'start date for this subscription',
4791
  `aqbooksellerid` int(11) DEFAULT 0 COMMENT 'foreign key for aqbooksellers.id to link to the vendor',
4791
  `aqbooksellerid` int(11) DEFAULT 0 COMMENT 'foreign key for aqbooksellers.id to link to the vendor',
4792
  `cost` int(11) DEFAULT 0,
4792
  `cost` int(11) DEFAULT 0,
Lines 4809-4814 CREATE TABLE `subscription` ( Link Here
4809
  `irregularity` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'any irregularities in the subscription',
4809
  `irregularity` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'any irregularities in the subscription',
4810
  `skip_serialseq` tinyint(1) NOT NULL DEFAULT 0,
4810
  `skip_serialseq` tinyint(1) NOT NULL DEFAULT 0,
4811
  `letter` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4811
  `letter` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4812
  `late_issue_letter_code` VARCHAR(20) NULL DEFAULT NULL COMMENT 'letter code used for late issue alerts',
4812
  `numberpattern` int(11) DEFAULT NULL COMMENT 'the numbering pattern used links to subscription_numberpatterns.id',
4813
  `numberpattern` int(11) DEFAULT NULL COMMENT 'the numbering pattern used links to subscription_numberpatterns.id',
4813
  `locale` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'for foreign language subscriptions to display months, seasons, etc correctly',
4814
  `locale` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'for foreign language subscriptions to display months, seasons, etc correctly',
4814
  `distributedto` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
4815
  `distributedto` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
Lines 4833-4839 CREATE TABLE `subscription` ( Link Here
4833
  KEY `subscription_ibfk_3` (`biblionumber`),
4834
  KEY `subscription_ibfk_3` (`biblionumber`),
4834
  CONSTRAINT `subscription_ibfk_1` FOREIGN KEY (`periodicity`) REFERENCES `subscription_frequencies` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
4835
  CONSTRAINT `subscription_ibfk_1` FOREIGN KEY (`periodicity`) REFERENCES `subscription_frequencies` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
4835
  CONSTRAINT `subscription_ibfk_2` FOREIGN KEY (`numberpattern`) REFERENCES `subscription_numberpatterns` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
4836
  CONSTRAINT `subscription_ibfk_2` FOREIGN KEY (`numberpattern`) REFERENCES `subscription_numberpatterns` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
4836
  CONSTRAINT `subscription_ibfk_3` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE
4837
  CONSTRAINT `subscription_ibfk_3` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4838
  CONSTRAINT `subscription_manager_id_fk` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE
4837
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4839
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4838
/*!40101 SET character_set_client = @saved_cs_client */;
4840
/*!40101 SET character_set_client = @saved_cs_client */;
4839
4841
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt (-1 / +19 lines)
Lines 75-81 fieldset.rows table { clear: none; margin: 0; } Link Here
75
                        [% ELSE %]
75
                        [% ELSE %]
76
                                <input type="hidden" name="op" value="addsubscription" />
76
                                <input type="hidden" name="op" value="addsubscription" />
77
                        [% END %]
77
                        [% END %]
78
                        <input type="hidden" name="user" value="[% logged_in_user.userid | html %]" />
79
                        <input type="hidden" name="irreg_check" value="0" />
78
                        <input type="hidden" name="irreg_check" value="0" />
80
                        <fieldset id="subscription_add_information" class="rows">
79
                        <fieldset id="subscription_add_information" class="rows">
81
                            <legend>Subscription details</legend>
80
                            <legend>Subscription details</legend>
Lines 186-191 fieldset.rows table { clear: none; margin: 0; } Link Here
186
                                        <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>
185
                                        <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>
187
                                    [% END %]
186
                                    [% END %]
188
                                </li>
187
                                </li>
188
                                <li>
189
                                    [% IF ( letterloop ) %]
190
                                        <label for="late_issue_letter_code">Late issue notification: </label>
191
                                        <select name="late_issue_letter_code" id="late_issue_letter_code">
192
                                            <option value="">None</option>
193
                                            [% FOREACH letter IN letterloop %]
194
                                                [% IF ( letter.value == late_issue_letter_code ) %]
195
                                                    <option value="[% letter.value | html %]" selected="selected">[% letter.lettername | html %]</option>
196
                                                [% ELSE %]
197
                                                    <option value="[% letter.value | html %]">[% letter.lettername | html %]</option>
198
                                                [% END %]
199
                                            [% END %]
200
                                        </select>
201
                                        <div class="hint">Selecting a notice will allow you to receive a notification when a serial issue is late.</div>
202
                                    [% ELSE %]
203
                                        <span class="label">Late issue notification: </span>
204
                                        <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>
205
                                    [% END %]
206
                                </li>
189
                                <li>
207
                                <li>
190
                                    <label for="location">Location:</label>
208
                                    <label for="location">Location:</label>
191
                                    <select name="location" id="location">
209
                                    <select name="location" id="location">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt (-1 / +6 lines)
Lines 109-115 Link Here
109
                                <div class="rows">
109
                                <div class="rows">
110
                                    <ol>
110
                                    <ol>
111
                                        <li><span class="label">Subscription ID: </span>[% subscriptionid | html %]</li>
111
                                        <li><span class="label">Subscription ID: </span>[% subscriptionid | html %]</li>
112
                                        <li><span class="label">Librarian identity:</span> [% librarian | html %]</li>
112
                                        <li>
113
                                            <span class="label">Manager:</span>
114
                                            [% IF subscription.manager %]
115
                                                [% INCLUDE 'patron-title.inc' patron = subscription.manager | html %]
116
                                            [% END %]
117
                                        </li>
113
                                        <li><span class="label">Vendor:</span> <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% aqbooksellerid | uri %]">[% aqbooksellername | html %]</a></li>
118
                                        <li><span class="label">Vendor:</span> <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% aqbooksellerid | uri %]">[% aqbooksellername | html %]</a></li>
114
                                        <li><span class="label">Biblio:</span>  <a href="/cgi-bin/koha/catalogue/[% default_bib_view | uri %].pl?biblionumber=[% bibnum | uri %]">[% bibliotitle | html %]</a> <em>([% bibnum | html %])</em></li>
119
                                        <li><span class="label">Biblio:</span>  <a href="/cgi-bin/koha/catalogue/[% default_bib_view | uri %].pl?biblionumber=[% bibnum | uri %]">[% bibliotitle | html %]</a> <em>([% bibnum | html %])</em></li>
115
                                        [% IF ( OPACBaseURL ) %]
120
                                        [% IF ( OPACBaseURL ) %]
(-)a/misc/cronjobs/serialsUpdate.pl (-4 / +29 lines)
Lines 26-31 use C4::Serials qw( GetSubscription GetNextDate ModSerialStatus ); Link Here
26
use C4::Serials::Frequency;
26
use C4::Serials::Frequency;
27
use C4::Log qw( cronlogaction );
27
use C4::Log qw( cronlogaction );
28
use Koha::DateUtils qw( dt_from_string output_pref );
28
use Koha::DateUtils qw( dt_from_string output_pref );
29
use C4::Letters;
30
use C4::Message;
29
31
30
use Date::Calc qw( check_date Date_to_Days );
32
use Date::Calc qw( check_date Date_to_Days );
31
use Getopt::Long qw( GetOptions );
33
use Getopt::Long qw( GetOptions );
Lines 123-132 while ( my $issue = $sth->fetchrow_hashref ) { Link Here
123
                && Date_to_Days( $year, $month, $day ) <
125
                && Date_to_Days( $year, $month, $day ) <
124
                Date_to_Days( $tyear, $tmonth, $tday ) )
126
                Date_to_Days( $tyear, $tmonth, $tday ) )
125
            {
127
            {
126
                $confirm
128
                if ($confirm) {
127
                  and ModSerialStatus( $issue->{serialid}, $issue->{serialseq},
129
                    ModSerialStatus(
128
                    $issue->{planneddate}, $issue->{publisheddate}, $issue->{publisheddatetext},
130
                        $issue->{serialid},          $issue->{serialseq},
129
                    3, $note );
131
                        $issue->{planneddate},       $issue->{publisheddate},
132
                        $issue->{publisheddatetext}, 3,
133
                        $note
134
                    );
135
136
                    if ($subscription->{late_issue_letter_code} && $subscription->{manager_id}) {
137
                        my $letter = C4::Letters::GetPreparedLetter (
138
                            module => 'serial',
139
                            letter_code => 'SERIAL_IS_LATE',
140
                            branchcode => $subscription->{branchcode},
141
                            tables => {
142
                                branches => $subscription->{branchcode},
143
                                biblio => $subscription->{biblionumber},
144
                                biblioitems => $subscription->{biblionumber},
145
                                borrowers => $subscription->{manager_id},
146
                                subscription => $subscription->{subscriptionid},
147
                                serial => $issue->{serialid},
148
                            },
149
                        );
150
                        my $manager = Koha::Patrons->find($subscription->{manager_id});
151
                        C4::Message->enqueue($letter, $manager->unblessed, 'email');
152
                    }
153
                }
154
130
                $verbose
155
                $verbose
131
                  and print "Serial issue with id=" . $issue->{serialid} . " updated\n";
156
                  and print "Serial issue with id=" . $issue->{serialid} . " updated\n";
132
            }
157
            }
(-)a/serials/subscription-add.pl (-7 / +6 lines)
Lines 294-300 sub redirect_add_subscription { Link Here
294
    }
294
    }
295
    my $numberpattern = Koha::Subscription::Numberpatterns->new_or_existing({ $query->Vars });
295
    my $numberpattern = Koha::Subscription::Numberpatterns->new_or_existing({ $query->Vars });
296
296
297
    my $auser          = $query->param('user');
298
    my $branchcode     = $query->param('branchcode');
297
    my $branchcode     = $query->param('branchcode');
299
    my $aqbooksellerid = $query->param('aqbooksellerid');
298
    my $aqbooksellerid = $query->param('aqbooksellerid');
300
    my $cost           = $query->param('cost');
299
    my $cost           = $query->param('cost');
Lines 320-325 sub redirect_add_subscription { Link Here
320
    my $notes             = $query->param('notes');
319
    my $notes             = $query->param('notes');
321
    my $internalnotes     = $query->param('internalnotes');
320
    my $internalnotes     = $query->param('internalnotes');
322
    my $letter            = $query->param('letter');
321
    my $letter            = $query->param('letter');
322
    my $late_issue_letter_code = $query->param('late_issue_letter_code');
323
    my $manualhistory     = $query->param('manualhist') ? 1 : 0;
323
    my $manualhistory     = $query->param('manualhist') ? 1 : 0;
324
    my $serialsadditems   = $query->param('serialsadditems');
324
    my $serialsadditems   = $query->param('serialsadditems');
325
    my $staffdisplaycount = $query->param('staffdisplaycount');
325
    my $staffdisplaycount = $query->param('staffdisplaycount');
Lines 347-356 sub redirect_add_subscription { Link Here
347
        }
347
        }
348
    }
348
    }
349
    my $subscriptionid = NewSubscription(
349
    my $subscriptionid = NewSubscription(
350
        $auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $biblionumber,
350
        $loggedinuser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $biblionumber,
351
        $startdate, $periodicity, $numberlength, $weeklength,
351
        $startdate, $periodicity, $numberlength, $weeklength,
352
        $monthlength, $lastvalue1, $innerloop1, $lastvalue2, $innerloop2,
352
        $monthlength, $lastvalue1, $innerloop1, $lastvalue2, $innerloop2,
353
        $lastvalue3, $innerloop3, $status, $notes, $letter, $firstacquidate,
353
        $lastvalue3, $innerloop3, $status, $notes, $letter, $late_issue_letter_code, $firstacquidate,
354
        join(";",@irregularity), $numberpattern, $locale, $callnumber,
354
        join(";",@irregularity), $numberpattern, $locale, $callnumber,
355
        $manualhistory, $internalnotes, $serialsadditems,
355
        $manualhistory, $internalnotes, $serialsadditems,
356
        $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
356
        $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate,
Lines 386-393 sub redirect_add_subscription { Link Here
386
sub redirect_mod_subscription {
386
sub redirect_mod_subscription {
387
    my $subscriptionid = $query->param('subscriptionid');
387
    my $subscriptionid = $query->param('subscriptionid');
388
    my @irregularity = $query->multi_param('irregularity');
388
    my @irregularity = $query->multi_param('irregularity');
389
    my $auser = $query->param('user');
390
    my $librarian => scalar $query->param('librarian'),
391
    my $branchcode = $query->param('branchcode');
389
    my $branchcode = $query->param('branchcode');
392
    my $cost = $query->param('cost');
390
    my $cost = $query->param('cost');
393
    my $aqbooksellerid = $query->param('aqbooksellerid');
391
    my $aqbooksellerid = $query->param('aqbooksellerid');
Lines 432-437 sub redirect_mod_subscription { Link Here
432
    my $notes = $query->param('notes');
430
    my $notes = $query->param('notes');
433
    my $internalnotes = $query->param('internalnotes');
431
    my $internalnotes = $query->param('internalnotes');
434
    my $letter = $query->param('letter');
432
    my $letter = $query->param('letter');
433
    my $late_issue_letter_code = $query->param('late_issue_letter_code');
435
    my $manualhistory = $query->param('manualhist') ? 1 : 0;
434
    my $manualhistory = $query->param('manualhist') ? 1 : 0;
436
    my $serialsadditems = $query->param('serialsadditems');
435
    my $serialsadditems = $query->param('serialsadditems');
437
	my $staffdisplaycount = $query->param('staffdisplaycount');
436
	my $staffdisplaycount = $query->param('staffdisplaycount');
Lines 469-479 sub redirect_mod_subscription { Link Here
469
    }
468
    }
470
469
471
    ModSubscription(
470
    ModSubscription(
472
        $auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $startdate,
471
        $loggedinuser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $startdate,
473
        $periodicity, $firstacquidate, join(";",@irregularity),
472
        $periodicity, $firstacquidate, join(";",@irregularity),
474
        $numberpattern, $locale, $numberlength, $weeklength, $monthlength, $lastvalue1,
473
        $numberpattern, $locale, $numberlength, $weeklength, $monthlength, $lastvalue1,
475
        $innerloop1, $lastvalue2, $innerloop2, $lastvalue3, $innerloop3,
474
        $innerloop1, $lastvalue2, $innerloop2, $lastvalue3, $innerloop3,
476
        $status, $biblionumber, $callnumber, $notes, $letter,
475
        $status, $biblionumber, $callnumber, $notes, $letter, $late_issue_letter_code,
477
        $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount,
476
        $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount,
478
        $opacdisplaycount, $graceperiod, $location, $enddate, $subscriptionid,
477
        $opacdisplaycount, $graceperiod, $location, $enddate, $subscriptionid,
479
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id
478
        $skip_serialseq, $itemtype, $previousitemtype, $mana_id
(-)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 120-126 subtest '->subscriptions() tests' => sub { Link Here
120
        $id_budget,   $biblionumber, '2013-01-01',         undef,
120
        $id_budget,   $biblionumber, '2013-01-01',         undef,
121
        undef,        undef,         undef,                undef,
121
        undef,        undef,         undef,                undef,
122
        undef,        undef,         undef,                undef,
122
        undef,        undef,         undef,                undef,
123
        undef,        1,             "subscription notes", undef,
123
        undef,        1,             "subscription notes", undef, undef,
124
        '2013-01-01', undef,         undef,                undef,
124
        '2013-01-01', undef,         undef,                undef,
125
        'CALL DEF',   0,             "intnotes",           0,
125
        'CALL DEF',   0,             "intnotes",           0,
126
        undef,        undef,         0,                    undef,
126
        undef,        undef,         0,                    undef,
(-)a/t/db_dependent/Letters.t (-2 / +2 lines)
Lines 484-490 my $subscriptionid = NewSubscription( Link Here
484
     undef,      "",     undef, undef, undef, $biblionumber,
484
     undef,      "",     undef, undef, undef, $biblionumber,
485
    '2013-01-01', 1, undef, undef,  undef,
485
    '2013-01-01', 1, undef, undef,  undef,
486
    undef,      undef,  undef, undef, undef, undef,
486
    undef,      undef,  undef, undef, undef, undef,
487
    1,          $notes,undef, '2013-01-01', undef, 1,
487
    1,          $notes,undef, undef, '2013-01-01', undef, 1,
488
    undef,       undef,  0,    $internalnotes,  0,
488
    undef,       undef,  0,    $internalnotes,  0,
489
    undef, undef, 0,          undef,         '2013-12-31', 0
489
    undef, undef, 0,          undef,         '2013-12-31', 0
490
);
490
);
Lines 578-584 subtest 'SendAlerts - claimissue' => sub { Link Here
578
         undef, "", $booksellerid, undef, undef, $biblionumber,
578
         undef, "", $booksellerid, undef, undef, $biblionumber,
579
        '2013-01-01', 1, undef, undef,  undef,
579
        '2013-01-01', 1, undef, undef,  undef,
580
        undef,  undef,  undef, undef, undef, undef,
580
        undef,  undef,  undef, undef, undef, undef,
581
        1, 'public',undef, '2013-01-01', undef, 1,
581
        1, 'public',undef, undef, '2013-01-01', undef, 1,
582
        undef, undef,  0, 'internal',  0,
582
        undef, undef,  0, 'internal',  0,
583
        undef, undef, 0,  undef, '2013-12-31', 0
583
        undef, undef, 0,  undef, '2013-12-31', 0
584
    );
584
    );
(-)a/t/db_dependent/Serials.t (-10 / +10 lines)
Lines 78-84 my $subscriptionid = NewSubscription( Link Here
78
    undef,      "",     undef, undef, $budget_id, $biblionumber,
78
    undef,      "",     undef, undef, $budget_id, $biblionumber,
79
    '2013-01-01', $frequency_id, undef, undef,  undef,
79
    '2013-01-01', $frequency_id, undef, undef,  undef,
80
    undef,      undef,  undef, undef, undef, undef,
80
    undef,      undef,  undef, undef, undef, undef,
81
    1,          $notes, ,undef, '2013-01-01', undef, $pattern_id,
81
    1,          $notes, undef, undef, '2013-01-01', undef, $pattern_id,
82
    undef,       undef,  0,    $internalnotes,  0,
82
    undef,       undef,  0,    $internalnotes,  0,
83
    undef, undef, 0,          undef,         '2013-12-31', 0
83
    undef, undef, 0,          undef,         '2013-12-31', 0
84
);
84
);
Lines 116-126 if (not $frequency->{unit}) { Link Here
116
    $subscriptioninformation->{serialsadditems} = 1;
116
    $subscriptioninformation->{serialsadditems} = 1;
117
117
118
    ModSubscription( @$subscriptioninformation{qw(
118
    ModSubscription( @$subscriptioninformation{qw(
119
        librarian branchcode aqbooksellerid cost aqbudgetid startdate
119
        manager_id branchcode aqbooksellerid cost aqbudgetid startdate
120
        periodicity firstacquidate irregularity numberpattern locale
120
        periodicity firstacquidate irregularity numberpattern locale
121
        numberlength weeklength monthlength lastvalue1 innerloop1 lastvalue2
121
        numberlength weeklength monthlength lastvalue1 innerloop1 lastvalue2
122
        innerloop2 lastvalue3 innerloop3 status biblionumber callnumber notes
122
        innerloop2 lastvalue3 innerloop3 status biblionumber callnumber notes
123
        letter manualhistory internalnotes serialsadditems staffdisplaycount
123
        letter late_issue_letter_code manualhistory internalnotes serialsadditems staffdisplaycount
124
        opacdisplaycount graceperiod location enddate subscriptionid
124
        opacdisplaycount graceperiod location enddate subscriptionid
125
        skip_serialseq
125
        skip_serialseq
126
    )} );
126
    )} );
Lines 174-184 if ($old_frequency) { Link Here
174
    $subscriptioninformation->{periodicity} = $old_frequency;
174
    $subscriptioninformation->{periodicity} = $old_frequency;
175
175
176
    ModSubscription( @$subscriptioninformation{qw(
176
    ModSubscription( @$subscriptioninformation{qw(
177
        librarian branchcode aqbooksellerid cost aqbudgetid startdate
177
        manager_id branchcode aqbooksellerid cost aqbudgetid startdate
178
        periodicity firstacquidate irregularity numberpattern locale
178
        periodicity firstacquidate irregularity numberpattern locale
179
        numberlength weeklength monthlength lastvalue1 innerloop1 lastvalue2
179
        numberlength weeklength monthlength lastvalue1 innerloop1 lastvalue2
180
        innerloop2 lastvalue3 innerloop3 status biblionumber callnumber notes
180
        innerloop2 lastvalue3 innerloop3 status biblionumber callnumber notes
181
        letter manualhistory internalnotes serialsadditems staffdisplaycount
181
        letter late_issue_letter_code manualhistory internalnotes serialsadditems staffdisplaycount
182
        opacdisplaycount graceperiod location enddate subscriptionid
182
        opacdisplaycount graceperiod location enddate subscriptionid
183
        skip_serialseq
183
        skip_serialseq
184
    )} );
184
    )} );
Lines 324-330 $subscriptionid = NewSubscription( Link Here
324
    undef,      "",     undef, undef, $budget_id, $biblionumber,
324
    undef,      "",     undef, undef, $budget_id, $biblionumber,
325
    '2013-01-01', $frequency_id, undef, undef,  undef,
325
    '2013-01-01', $frequency_id, undef, undef,  undef,
326
    undef,      undef,  undef, undef, undef, undef,
326
    undef,      undef,  undef, undef, undef, undef,
327
    1,          $notes,undef, '2013-01-01', undef, $pattern_id,
327
    1,          $notes,undef, undef, '2013-01-01', undef, $pattern_id,
328
    undef,       undef,  0,    $internalnotes,  0,
328
    undef,       undef,  0,    $internalnotes,  0,
329
    undef, undef, 0,          undef,         '2013-12-31', 0
329
    undef, undef, 0,          undef,         '2013-12-31', 0
330
);
330
);
Lines 421-430 subtest "PreserveSerialNotes preference" => sub { Link Here
421
subtest "NewSubscription|ModSubscription" => sub {
421
subtest "NewSubscription|ModSubscription" => sub {
422
    plan tests => 4;
422
    plan tests => 4;
423
    my $subscriptionid = NewSubscription(
423
    my $subscriptionid = NewSubscription(
424
        "",      "",     "", "", $budget_id, $biblionumber,
424
        undef,      "",     "", "", $budget_id, $biblionumber,
425
        '2013-01-01', $frequency_id, "", "",  "",
425
        '2013-01-01', $frequency_id, "", "",  "",
426
        "",      "",  "", "", "", "",
426
        "",      "",  "", "", "", "",
427
        1,          $notes,"", '2013-01-01', "", $pattern_id,
427
        1,          $notes,"", undef, '2013-01-01', "", $pattern_id,
428
        "",       "",  0,    $internalnotes,  0,
428
        "",       "",  0,    $internalnotes,  0,
429
        "", "", 0,          "",         '2013-12-31', 0
429
        "", "", 0,          "",         '2013-12-31', 0
430
    );
430
    );
Lines 438-448 subtest "NewSubscription|ModSubscription" => sub { Link Here
438
    my $subscription_info = $subscription->unblessed;
438
    my $subscription_info = $subscription->unblessed;
439
    $subscription_info->{biblionumber} = $biblio_2->biblionumber;
439
    $subscription_info->{biblionumber} = $biblio_2->biblionumber;
440
    ModSubscription( @$subscription_info{qw(
440
    ModSubscription( @$subscription_info{qw(
441
        librarian branchcode aqbooksellerid cost aqbudgetid startdate
441
        manager_id branchcode aqbooksellerid cost aqbudgetid startdate
442
        periodicity firstacquidate irregularity numberpattern locale
442
        periodicity firstacquidate irregularity numberpattern locale
443
        numberlength weeklength monthlength lastvalue1 innerloop1 lastvalue2
443
        numberlength weeklength monthlength lastvalue1 innerloop1 lastvalue2
444
        innerloop2 lastvalue3 innerloop3 status biblionumber callnumber notes
444
        innerloop2 lastvalue3 innerloop3 status biblionumber callnumber notes
445
        letter manualhistory internalnotes serialsadditems staffdisplaycount
445
        letter late_issue_letter_code manualhistory internalnotes serialsadditems staffdisplaycount
446
        opacdisplaycount graceperiod location enddate subscriptionid
446
        opacdisplaycount graceperiod location enddate subscriptionid
447
        skip_serialseq
447
        skip_serialseq
448
    )} );
448
    )} );
(-)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