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

(-)a/C4/Serials.pm (+4 lines)
Lines 1311-1316 sub ModSubscription { Link Here
1311
    $itemtype, $previousitemtype, $mana_id
1311
    $itemtype, $previousitemtype, $mana_id
1312
    ) = @_;
1312
    ) = @_;
1313
1313
1314
    $aqbooksellerid ||= undef;
1315
1314
    my $dbh   = C4::Context->dbh;
1316
    my $dbh   = C4::Context->dbh;
1315
    my $query = "UPDATE subscription
1317
    my $query = "UPDATE subscription
1316
        SET librarian=?, branchcode=?, aqbooksellerid=?, cost=?, aqbudgetid=?,
1318
        SET librarian=?, branchcode=?, aqbooksellerid=?, cost=?, aqbudgetid=?,
Lines 1373-1378 sub NewSubscription { Link Here
1373
    ) = @_;
1375
    ) = @_;
1374
    my $dbh = C4::Context->dbh;
1376
    my $dbh = C4::Context->dbh;
1375
1377
1378
    $aqbooksellerid ||= undef;
1379
1376
    #save subscription (insert into database)
1380
    #save subscription (insert into database)
1377
    my $query = qq|
1381
    my $query = qq|
1378
        INSERT INTO subscription
1382
        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 2095-2101 CREATE TABLE `subscription` ( -- information related to the subscription Link Here
2095
  `subscriptionid` int(11) NOT NULL auto_increment, -- unique key for this subscription
2095
  `subscriptionid` int(11) NOT NULL auto_increment, -- unique key for this subscription
2096
  `librarian` varchar(100) default '', -- the librarian's username from borrowers.userid
2096
  `librarian` varchar(100) default '', -- the librarian's username from borrowers.userid
2097
  `startdate` date default NULL, -- start date for this subscription
2097
  `startdate` date default NULL, -- start date for this subscription
2098
  `aqbooksellerid` int(11) default 0, -- foreign key for aqbooksellers.id to link to the vendor
2098
  `aqbooksellerid` int(11) NULL DEFAULT NULL, -- foreign key for aqbooksellers.id to link to the vendor
2099
  `cost` int(11) default 0,
2099
  `cost` int(11) default 0,
2100
  `aqbudgetid` int(11) default 0,
2100
  `aqbudgetid` int(11) default 0,
2101
  `weeklength` int(11) default 0, -- subscription length in weeks (will not be filled in if monthlength or numberlength is set)
2101
  `weeklength` int(11) default 0, -- subscription length in weeks (will not be filled in if monthlength or numberlength is set)
Lines 2137-2143 CREATE TABLE `subscription` ( -- information related to the subscription Link Here
2137
  PRIMARY KEY  (`subscriptionid`),
2137
  PRIMARY KEY  (`subscriptionid`),
2138
  KEY `by_biblionumber` (`biblionumber`),
2138
  KEY `by_biblionumber` (`biblionumber`),
2139
  CONSTRAINT subscription_ibfk_1 FOREIGN KEY (periodicity) REFERENCES subscription_frequencies (id) ON DELETE SET NULL ON UPDATE CASCADE,
2139
  CONSTRAINT subscription_ibfk_1 FOREIGN KEY (periodicity) REFERENCES subscription_frequencies (id) ON DELETE SET NULL ON UPDATE CASCADE,
2140
  CONSTRAINT subscription_ibfk_2 FOREIGN KEY (numberpattern) REFERENCES subscription_numberpatterns (id) ON DELETE SET NULL ON UPDATE CASCADE
2140
  CONSTRAINT subscription_ibfk_2 FOREIGN KEY (numberpattern) REFERENCES subscription_numberpatterns (id) ON DELETE SET NULL ON UPDATE CASCADE,
2141
  CONSTRAINT subscription_ibfk_aqbooksellerid FOREIGN KEY (aqbooksellerid) REFERENCES aqbooksellers (id) ON DELETE RESTRICT ON UPDATE CASCADE
2141
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2142
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2142
2143
2143
--
2144
--
(-)a/serials/subscription-add.pl (-3 / +2 lines)
Lines 317-323 sub redirect_add_subscription { Link Here
317
317
318
    my $auser          = $query->param('user');
318
    my $auser          = $query->param('user');
319
    my $branchcode     = $query->param('branchcode');
319
    my $branchcode     = $query->param('branchcode');
320
    my $aqbooksellerid = $query->param('aqbooksellerid');
320
    my $aqbooksellerid = $query->param('aqbooksellerid') || undef;
321
    my $cost           = $query->param('cost');
321
    my $cost           = $query->param('cost');
322
    my $aqbudgetid     = $query->param('aqbudgetid');
322
    my $aqbudgetid     = $query->param('aqbudgetid');
323
    my @irregularity   = $query->multi_param('irregularity');
323
    my @irregularity   = $query->multi_param('irregularity');
Lines 411-417 sub redirect_mod_subscription { Link Here
411
    my $librarian => scalar $query->param('librarian'),
411
    my $librarian => scalar $query->param('librarian'),
412
    my $branchcode = $query->param('branchcode');
412
    my $branchcode = $query->param('branchcode');
413
    my $cost = $query->param('cost');
413
    my $cost = $query->param('cost');
414
    my $aqbooksellerid = $query->param('aqbooksellerid');
414
    my $aqbooksellerid = $query->param('aqbooksellerid') || undef;
415
    my $biblionumber = $query->param('biblionumber');
415
    my $biblionumber = $query->param('biblionumber');
416
    my $aqbudgetid = $query->param('aqbudgetid');
416
    my $aqbudgetid = $query->param('aqbudgetid');
417
417
418
- 

Return to bug 18745