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

(-)a/installer/data/mysql/atomicupdate/bug_25655.pl (+26 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "25655",
5
    description => "Store actual cost in foreign currency and currency from the invoices",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
        unless ( column_exists('aqorders', 'invoice_unitprice') ) {
10
            $dbh->do(q{
11
                ALTER TABLE aqorders
12
                ADD COLUMN invoice_unitprice decimal(28,6) DEFAULT NULL COMMENT 'the unit price in foreign currency' AFTER estimated_delivery_date
13
            });
14
        }
15
        say $out "Added column 'aqorders.invoice_unitprice'";
16
17
        unless ( column_exists('aqorders', 'invoice_currency') ) {
18
            $dbh->do(q{
19
                ALTER TABLE aqorders
20
                ADD COLUMN invoice_currency varchar(10) DEFAULT NULL COMMENT 'the currency of the invoice_unitprice' AFTER invoice_unitprice,
21
                ADD CONSTRAINT `aqorders_invoice_currency` FOREIGN KEY (`invoice_currency`) REFERENCES `currency` (`currency`) ON DELETE SET NULL ON UPDATE SET NULL
22
            });
23
        }
24
        say $out "Added column 'aqorders.invoice_currency'";
25
    },
26
};
(-)a/installer/data/mysql/kohastructure.sql (-1 / +3 lines)
Lines 690-695 CREATE TABLE `aqorders` ( Link Here
690
  `suppliers_reference_qualifier` varchar(3) DEFAULT NULL COMMENT 'Type of number above usually ''QLI''',
690
  `suppliers_reference_qualifier` varchar(3) DEFAULT NULL COMMENT 'Type of number above usually ''QLI''',
691
  `suppliers_report` mediumtext DEFAULT NULL COMMENT 'reports received from suppliers',
691
  `suppliers_report` mediumtext DEFAULT NULL COMMENT 'reports received from suppliers',
692
  `estimated_delivery_date` date DEFAULT NULL COMMENT 'Estimated delivery date',
692
  `estimated_delivery_date` date DEFAULT NULL COMMENT 'Estimated delivery date',
693
  `invoice_unitprice` decimal(28,6) DEFAULT NULL COMMENT 'the unit price in foreign currency',
694
  `invoice_currency` varchar(10) DEFAULT NULL COMMENT 'the currency of the invoice_unitprice',
693
  PRIMARY KEY (`ordernumber`),
695
  PRIMARY KEY (`ordernumber`),
694
  KEY `basketno` (`basketno`),
696
  KEY `basketno` (`basketno`),
695
  KEY `biblionumber` (`biblionumber`),
697
  KEY `biblionumber` (`biblionumber`),
Lines 703-708 CREATE TABLE `aqorders` ( Link Here
703
  CONSTRAINT `aqorders_budget_id_fk` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE CASCADE ON UPDATE CASCADE,
705
  CONSTRAINT `aqorders_budget_id_fk` FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE CASCADE ON UPDATE CASCADE,
704
  CONSTRAINT `aqorders_created_by` FOREIGN KEY (`created_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
706
  CONSTRAINT `aqorders_created_by` FOREIGN KEY (`created_by`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE,
705
  CONSTRAINT `aqorders_currency` FOREIGN KEY (`currency`) REFERENCES `currency` (`currency`) ON DELETE SET NULL ON UPDATE SET NULL,
707
  CONSTRAINT `aqorders_currency` FOREIGN KEY (`currency`) REFERENCES `currency` (`currency`) ON DELETE SET NULL ON UPDATE SET NULL,
708
  CONSTRAINT `aqorders_invoice_currency` FOREIGN KEY (`invoice_currency`) REFERENCES `currency` (`currency`) ON DELETE SET NULL ON UPDATE SET NULL,
706
  CONSTRAINT `aqorders_ibfk_1` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
709
  CONSTRAINT `aqorders_ibfk_1` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE,
707
  CONSTRAINT `aqorders_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
710
  CONSTRAINT `aqorders_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE,
708
  CONSTRAINT `aqorders_ibfk_3` FOREIGN KEY (`invoiceid`) REFERENCES `aqinvoices` (`invoiceid`) ON DELETE SET NULL ON UPDATE CASCADE,
711
  CONSTRAINT `aqorders_ibfk_3` FOREIGN KEY (`invoiceid`) REFERENCES `aqinvoices` (`invoiceid`) ON DELETE SET NULL ON UPDATE CASCADE,
709
- 

Return to bug 25655