Created
July 27, 2012 12:53
-
-
Save mattiaswolff/3187768 to your computer and use it in GitHub Desktop.
Mediusflow: Create partner for invoice import
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Please notice this script does not check if inserted values already exist. This needs to be done manually. | |
--Replace: [[ARCHIVE PATH]] | |
--Replace: [[ROLE]] | |
--Replace: [[PARTNER NAME]] | |
--Replace: [[PARTNER DESCRIPTION]] | |
UPDATE permission | |
SET ACTIVE = -1 | |
WHERE TAG = 'DOWNLOAD_INVOICE_EDI_SOURCE' | |
UPDATE permission | |
SET ACTIVE = -1 WHERE TAG = 'INTEGRATION_SERVICE_REGISTER_INVOICE' | |
-- Add permissions to role | |
DECLARE @intRoleID integer | |
SET @intRoleID = | |
(SELECT top 1 roleid | |
FROM ROLE_LANG | |
WHERE DESCRIPTION = '[[ROLE]]') | |
INSERT INTO ROLE_PERMISSION (ROLEID, PERMISSIONID) | |
SELECT @intRoleID, | |
ID | |
FROM PERMISSION WHERE TAG IN ('INTEGRATION_SERVICE_REGISTER_INVOICE', | |
'DOWNLOAD_INVOICE_EDI_SOURCE') | |
-- Insert partner into partner table | |
INSERT INTO partner(Name, Description) VALUES('[[PARTNER NAME]]', '[[PARTNER DESCRIPTION]]') | |
-- Update partner company with partner information | |
DECLARE @intPartnerId integer | |
SET @intPartnerId = | |
(SELECT [id] FROM partner WHERE [Name] = '[[PARTNER NAME]]') | |
INSERT INTO partner_company(CompanyId, PartnerId) | |
SELECT [id], | |
@intPartnerId | |
FROM company WHERE active = -1 | |
AND isvirtual = 0 | |
-- Insert parameters into partner_config -- | |
-- Invoice image | |
INSERT INTO partner_config (PartnerId, ConfigKey, ConfigValue, DataType) VALUES(@intPartnerId, 'INTEGRATION_SERVICE_REGISTER_INVOICE_BASE64_IMAGE_ACTIVE', '1', 'bool') | |
INSERT INTO partner_config (PartnerId, ConfigKey, ConfigValue, DataType) VALUES(@intPartnerId, 'INTEGRATION_SERVICE_REGISTER_INVOICE_BASE64_IMAGE_DESTINATION_PATH', '[[ARCHIVE PATH]]\TIFFInvoices\', 'string') | |
-- Attachment configuration | |
INSERT INTO partner_config (PartnerId, ConfigKey, ConfigValue, DataType) VALUES(@intPartnerId, 'INTEGRATION_SERVICE_REGISTER_INVOICE_BASE64_ATTACHMENT_ACTIVE', '1', 'bool') | |
INSERT INTO partner_config (PartnerId, ConfigKey, ConfigValue, DataType) VALUES(@intPartnerId, 'INTEGRATION_SERVICE_REGISTER_INVOICE_BASE64_ATTACHMENT_DESTINATION_PATH', '[[ARCHIVE PATH]]\Attachments\', 'string') | |
-- EDI source | |
INSERT INTO partner_config (PartnerId, ConfigKey, ConfigValue, DataType) VALUES(@intPartnerId, 'INTEGRATION_SERVICE_REGISTER_INVOICE_EDI_SOURCE_ACTIVE', '1', 'bool') | |
INSERT INTO partner_config (PartnerId, ConfigKey, ConfigValue, DataType) VALUES(@intPartnerId, 'INTEGRATION_SERVICE_REGISTER_INVOICE_EDI_SOURCE_DESTINATION_PATH', '[[ARCHIVE PATH]]\EDIInvoices\', 'string') */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment