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

(-)a/installer/data/mysql/atomicupdate/bug_19166.perl (+20 lines)
Line 0 Link Here
1
$DBversion = 'XXX';  # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do( "
4
        CREATE TABLE IF NOT EXISTS invoice_adjustments (
5
            adjustment_id int(11) NOT NULL AUTO_INCREMENT,
6
            invoiceid int(11) NOT NULL,
7
            adjustment decimal(28,6),
8
            reason varchar(80) default NULL,
9
            note mediumtext default NULL,
10
            budget_id int(11) default NULL,
11
            encumber_open smallint(1) NOT NULL default 1,
12
            timestamp timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
13
            PRIMARY KEY (adjustment_id),
14
            CONSTRAINT invoice_adjustments_fk_invoiceid FOREIGN KEY (invoiceid) REFERENCES aqinvoices (invoiceid) ON DELETE CASCADE ON UPDATE CASCADE,
15
            CONSTRAINT invoice_adjustments_fk_budget_id FOREIGN KEY (budget_id) REFERENCES aqbudgets (budget_id) ON DELETE SET NULL ON UPDATE CASCADE
16
        )
17
        " );
18
    SetVersion( $DBversion );
19
    print "Upgrade to $DBversion done (Bug 19166 - Add the ability to add adjustments to an invoice)\n";
20
}
(-)a/installer/data/mysql/kohastructure.sql (-1 / +19 lines)
Lines 850-855 CREATE TABLE `import_items` ( Link Here
850
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
850
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
851
851
852
--
852
--
853
-- Table structure for table 'invoice_adjustments'
854
--
855
856
DROP TABLE IF EXISTS invoice_adjustments;
857
CREATE TABLE IF NOT EXISTS invoice_adjustments (
858
    adjustment_id int(11) NOT NULL AUTO_INCREMENT, -- primary key for adjustments
859
    invoiceid int(11) NOT NULL, -- foreign key to link an adjustment to an invoice
860
    adjustment decimal(28,6), -- amount of adjustment
861
    reason varchar(80) default NULL, -- reason for adjustment defined by authorised values in ADJ_REASON category
862
    note mediumtext default NULL, -- text to explain adjustment
863
    budget_id int(11) default NULL, -- optional link to budget to apply adjustment to
864
    encumber_open smallint(1) NOT NULL default 1, -- whether or not to encumber the finds when invoice is still open, 1 = yes, 0 = no
865
    timestamp timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- timestamp  of last adjustment to adjustment
866
    PRIMARY KEY (adjustment_id),
867
    CONSTRAINT invoice_adjustments_fk_invoiceid FOREIGN KEY (invoiceid) REFERENCES aqinvoices (invoiceid) ON DELETE CASCADE ON UPDATE CASCADE,
868
    CONSTRAINT invoice_adjustments_fk_budget_id FOREIGN KEY (budget_id) REFERENCES aqbudgets (budget_id) ON DELETE SET NULL ON UPDATE CASCADE
869
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
870
871
--
853
-- Table structure for table `issuingrules`
872
-- Table structure for table `issuingrules`
854
--
873
--
855
874
856
- 

Return to bug 19166