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

(-)a/C4/Serials.pm (+4 lines)
Lines 1318-1323 sub ModSubscription { Link Here
1318
    $itemtype, $previousitemtype
1318
    $itemtype, $previousitemtype
1319
    ) = @_;
1319
    ) = @_;
1320
1320
1321
    $aqbooksellerid ||= undef;
1322
1321
    my $dbh   = C4::Context->dbh;
1323
    my $dbh   = C4::Context->dbh;
1322
    my $query = "UPDATE subscription
1324
    my $query = "UPDATE subscription
1323
        SET librarian=?, branchcode=?, aqbooksellerid=?, cost=?, aqbudgetid=?,
1325
        SET librarian=?, branchcode=?, aqbooksellerid=?, cost=?, aqbudgetid=?,
Lines 1380-1385 sub NewSubscription { Link Here
1380
    ) = @_;
1382
    ) = @_;
1381
    my $dbh = C4::Context->dbh;
1383
    my $dbh = C4::Context->dbh;
1382
1384
1385
    $aqbooksellerid ||= undef;
1386
1383
    #save subscription (insert into database)
1387
    #save subscription (insert into database)
1384
    my $query = qq|
1388
    my $query = qq|
1385
        INSERT INTO subscription
1389
        INSERT INTO subscription
(-)a/installer/data/mysql/atomicupdate/bug_18745.perl (+11 lines)
Lines 1-5 Link Here
1
$DBversion = 'XXX';
1
$DBversion = 'XXX';
2
if( CheckVersion( $DBversion ) ) {
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do(q{
4
       UPDATE subscription
5
       SET aqbooksellerid = NULL
6
       WHERE aqbooksellerid = 0
7
    });
8
    $dbh->do(q{
9
        ALTER TABLE subscription
10
        MODIFY COLUMN aqbooksellerid int(11) NULL DEFAULT NULL,
11
        ADD CONSTRAINT subscription_ibfk_aqbooksellerid FOREIGN KEY (aqbooksellerid) REFERENCES aqbooksellers (id) ON DELETE RESTRICT ON UPDATE CASCADE
12
    });
13
3
    if (!column_exists('serial', 'aqbooksellerid')) {
14
    if (!column_exists('serial', 'aqbooksellerid')) {
4
        $dbh->do(q{
15
        $dbh->do(q{
5
            ALTER TABLE `serial`
16
            ALTER TABLE `serial`
(-)a/installer/data/mysql/kohastructure.sql (-2 / +3 lines)
Lines 2132-2138 CREATE TABLE `subscription` ( -- information related to the subscription Link Here
2132
  `subscriptionid` int(11) NOT NULL auto_increment, -- unique key for this subscription
2132
  `subscriptionid` int(11) NOT NULL auto_increment, -- unique key for this subscription
2133
  `librarian` varchar(100) default '', -- the librarian's username from borrowers.userid
2133
  `librarian` varchar(100) default '', -- the librarian's username from borrowers.userid
2134
  `startdate` date default NULL, -- start date for this subscription
2134
  `startdate` date default NULL, -- start date for this subscription
2135
  `aqbooksellerid` int(11) default 0, -- foreign key for aqbooksellers.id to link to the vendor
2135
  `aqbooksellerid` int(11) NULL DEFAULT NULL, -- foreign key for aqbooksellers.id to link to the vendor
2136
  `cost` int(11) default 0,
2136
  `cost` int(11) default 0,
2137
  `aqbudgetid` int(11) default 0,
2137
  `aqbudgetid` int(11) default 0,
2138
  `weeklength` int(11) default 0, -- subscription length in weeks (will not be filled in if monthlength or numberlength is set)
2138
  `weeklength` int(11) default 0, -- subscription length in weeks (will not be filled in if monthlength or numberlength is set)
Lines 2174-2180 CREATE TABLE `subscription` ( -- information related to the subscription Link Here
2174
  PRIMARY KEY  (`subscriptionid`),
2174
  PRIMARY KEY  (`subscriptionid`),
2175
  KEY `by_biblionumber` (`biblionumber`),
2175
  KEY `by_biblionumber` (`biblionumber`),
2176
  CONSTRAINT subscription_ibfk_1 FOREIGN KEY (periodicity) REFERENCES subscription_frequencies (id) ON DELETE SET NULL ON UPDATE CASCADE,
2176
  CONSTRAINT subscription_ibfk_1 FOREIGN KEY (periodicity) REFERENCES subscription_frequencies (id) ON DELETE SET NULL ON UPDATE CASCADE,
2177
  CONSTRAINT subscription_ibfk_2 FOREIGN KEY (numberpattern) REFERENCES subscription_numberpatterns (id) ON DELETE SET NULL ON UPDATE CASCADE
2177
  CONSTRAINT subscription_ibfk_2 FOREIGN KEY (numberpattern) REFERENCES subscription_numberpatterns (id) ON DELETE SET NULL ON UPDATE CASCADE,
2178
  CONSTRAINT subscription_ibfk_aqbooksellerid FOREIGN KEY (aqbooksellerid) REFERENCES aqbooksellers (id) ON DELETE RESTRICT ON UPDATE CASCADE
2178
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2179
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2179
2180
2180
--
2181
--
(-)a/serials/subscription-add.pl (-3 / +2 lines)
Lines 312-318 sub redirect_add_subscription { Link Here
312
312
313
    my $auser          = $query->param('user');
313
    my $auser          = $query->param('user');
314
    my $branchcode     = $query->param('branchcode');
314
    my $branchcode     = $query->param('branchcode');
315
    my $aqbooksellerid = $query->param('aqbooksellerid');
315
    my $aqbooksellerid = $query->param('aqbooksellerid') || undef;
316
    my $cost           = $query->param('cost');
316
    my $cost           = $query->param('cost');
317
    my $aqbudgetid     = $query->param('aqbudgetid');
317
    my $aqbudgetid     = $query->param('aqbudgetid');
318
    my @irregularity   = $query->multi_param('irregularity');
318
    my @irregularity   = $query->multi_param('irregularity');
Lines 390-396 sub redirect_mod_subscription { Link Here
390
    my $librarian => scalar $query->param('librarian'),
390
    my $librarian => scalar $query->param('librarian'),
391
    my $branchcode = $query->param('branchcode');
391
    my $branchcode = $query->param('branchcode');
392
    my $cost = $query->param('cost');
392
    my $cost = $query->param('cost');
393
    my $aqbooksellerid = $query->param('aqbooksellerid');
393
    my $aqbooksellerid = $query->param('aqbooksellerid') || undef;
394
    my $biblionumber = $query->param('biblionumber');
394
    my $biblionumber = $query->param('biblionumber');
395
    my $aqbudgetid = $query->param('aqbudgetid');
395
    my $aqbudgetid = $query->param('aqbudgetid');
396
396
397
- 

Return to bug 18745