Code:
CREATE TABLE sage_update
(last_update datetime);
Insert into sage_update Values ('0000-00-00 00:00:00');
SET @t7=0;
SELECT (@t7:=configuration_group_id) as t7
FROM configuration_group
WHERE configuration_group_title= 'SAGE';
DELETE FROM configuration WHERE configuration_group_id = @t7;
DELETE FROM configuration_group WHERE configuration_group_id = @t7;
INSERT INTO configuration_group VALUES (NULL, 'Sage Configuration', 'Set Sage Options', '1', '1');
UPDATE configuration_group SET sort_order = last_insert_id() WHERE configuration_group_id = last_insert_id();
SET @t7=0;
SELECT (@t7:=configuration_group_id) as t7
FROM configuration_group
WHERE configuration_group_title= 'Sage Configuration';
INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, use_function, set_function) VALUES
(NULL, 'Output File Name', 'SAGE_OUTPUT_FILENAME', 'sage_stock_transaction.csv', 'Set the name of your sage stock output file', @t7, 1, NOW(), NULL, NULL),
(NULL, 'Output File Name', 'SAGE_OUTPUT_FILENAME2', 'sage_sales_transaction.csv', 'Set the name of your sage sales output file', @t7, 2, NOW(), NULL, NULL),
(NULL, 'Output Directory', 'SAGE_DIRECTORY', 'sage/', 'Set the name of your file output directory', @t7, 3, NOW(), NULL, NULL),
(NULL, 'Start Date', 'SAGE_STARTSDATE','2007-01-01', 'Set the start date of your output file - set to null to use last update, or date format yyyy-mm-dd', @t7, 4, NOW(), NULL, NULL),
(NULL, 'End Date', 'SAGE_ENDSDATE', 'null', 'Set the end date of your output file, or set to null for now - date format yyyy-mm-dd', @t7, 5, NOW(), NULL, NULL),
(NULL, 'Order Status', 'SAGE_STATUS',' 4', 'Set the Complete Status Number of your Order Processing to process all below this level', @t7, 6, NOW(), NULL, NULL),
(NULL, 'Transaction Code', 'SAGE_TX','GO', 'Stock Tranascation Code for Sage', @t7, 7, NOW(), NULL, NULL),
(NULL, 'Sales Code', 'SAGE_TX2','CR', 'Sales Tranascation Code for Sage', @t7, 8, NOW(), NULL, NULL),
(NULL, 'Paypal/Credit Card Nominal Code', 'SAGE_PAYPAL', '1205', 'Set the Sage Nominal code for Paypal/Credit Cards e.t.c', @t7, 9, NOW(), NULL, NULL),
(NULL, 'Bank/Cheque Nominal Code', 'SAGE_CHEQ', '1200', 'Set the Sage Nominal code for Cheques/Bank transfers e.t.c', @t7, 10, NOW(), NULL, NULL);