@@ -, +, @@ --- installer/data/mysql/kohastructure.sql | 21 +++++++++++++++++++++ installer/data/mysql/updatedatabase.pl | 20 ++++++++++++++++++++ 2 files changed, 41 insertions(+) --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -2961,6 +2961,27 @@ CREATE TABLE aqinvoices ( -- +-- Table structure for table 'aqcreditnotes' +-- + +DROP TABLE IF EXISTS aqcreditnotes; +CREATE TABLE aqcreditnotes ( + `creditnote_id` int(11) NOT NULL AUTO_INCREMENT, -- ID of the creditnote, primary key + `booksellerid` int(11) NOT NULL, -- foreign key to aqbooksellers + `invoiceid` int(11) NOT NULL, -- foreign key to aqinvoices + `vendorrefid` varchar(20) NOT NULL, -- Vendorreferenceid + `budget_id` int(11) NOT NULL, -- foreign key to aqbudgets + `amountcredit` decimal(28,6) default NULL, -- amountcredit cost + `creditdate` date default NULL, -- date of amountcredit + `notes` mediumtext, -- notes of amountcredit + `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- date and time this record was last touched + PRIMARY KEY (creditnote_id), + CONSTRAINT aqcreditnotes_fk_aqbooksellerid FOREIGN KEY (booksellerid) REFERENCES aqbooksellers (id) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT aqcreditnotes_fk_invoiceid FOREIGN KEY (invoiceid) REFERENCES aqinvoices (invoiceid) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT aqcreditnotes_fk_budget_id FOREIGN KEY (budget_id) REFERENCES aqbudgets (budget_id) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -- Table structure for table `fieldmapping` -- --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -6990,6 +6990,26 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.13.00.XXX"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("CREATE TABLE aqcreditnotes ( + `creditnote_id` int(11) NOT NULL AUTO_INCREMENT, + `booksellerid` int(11) NOT NULL, + `invoiceid` int(11) NOT NULL, + `vendorrefid` varchar(80) NOT NULL, + `budget_id` int(11) NOT NULL, + `amountcredit` decimal(28,6) default NULL, + `creditdate` date default NULL, + `notes` mediumtext, + `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + PRIMARY KEY (creditnote_id), + CONSTRAINT aqcreditnotes_fk_aqbooksellerid FOREIGN KEY (booksellerid) REFERENCES aqbooksellers (id) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT aqcreditnotes_fk_invoiceid FOREIGN KEY (invoiceid) REFERENCES aqinvoices (invoiceid) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT aqcreditnotes_fk_budget_id FOREIGN KEY (`budget_id`) REFERENCES `aqbudgets` (`budget_id`) ON DELETE CASCADE ON UPDATE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8"); + print "Upgrade to $DBversion done (Added new table aqcreditnotes)\n"; + SetVersion($DBversion); +} =head1 FUNCTIONS --