Db0065
This commit is contained in:
@@ -12,7 +12,7 @@ namespace Swarmops.Database
|
||||
/// <summary>
|
||||
/// This is the IN-CODE revision of the database. The version we expect to be running against.
|
||||
/// </summary>
|
||||
public static int DbVersionExpected => 64;
|
||||
public static int DbVersionExpected => 65;
|
||||
|
||||
|
||||
// This class is in horrible need of serious refactoring. For its simplicity in task, it's a horrible bowl of spaghetti.
|
||||
|
||||
@@ -62,3 +62,4 @@
|
||||
0062 - Added OrganizationSequenceId to OutboundInvoices (like 0041 but outbound) [RF]
|
||||
0063 - Added DeriveUnique to HotBitcoinAddresses for ability to create unique HBAs [RF]
|
||||
0064 - Quick fix for OutboundInvoices (how did this error happen?) [RF]
|
||||
0065 - Dumb fix for 0062 (or rather, the error was dumb) [RF]
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
DROP PROCEDURE IF EXISTS `CreateOutboundInvoice`
|
||||
|
||||
#
|
||||
|
||||
CREATE PROCEDURE `CreateOutboundInvoice`(
|
||||
organizationId INTEGER,
|
||||
createdDateTime DATETIME,
|
||||
createdByPersonId INTEGER,
|
||||
dueDate DATETIME,
|
||||
budgetId INTEGER,
|
||||
customerName VARCHAR(128),
|
||||
invoiceAddressPaper VARCHAR(256),
|
||||
invoiceAddressMail VARCHAR(128),
|
||||
currencyId INTEGER,
|
||||
reference VARCHAR(64),
|
||||
domestic TINYINT(1),
|
||||
securityCode VARCHAR(16),
|
||||
theirReference VARCHAR(64)
|
||||
)
|
||||
BEGIN
|
||||
|
||||
DECLARE newIdentity INTEGER;
|
||||
DECLARE sequenceNumber INTEGER;
|
||||
|
||||
INSERT INTO OutboundInvoices
|
||||
(CustomerName,InvoiceAddressPaper,InvoiceAddressMail,CurrencyId,
|
||||
BudgetId,OrganizationId,CreatedDateTime,CreatedByPersonId,
|
||||
DueDate,ReminderCount,Reference,Open,Domestic,Sent,SecurityCode,TheirReference)
|
||||
VALUES
|
||||
(customerName,invoiceAddressPaper,invoiceAddressMail,currencyId,
|
||||
budgetId,organizationId,createdDateTime,createdByPersonId,
|
||||
dueDate,0,reference,1,domestic,0,securityCode,theirReference);
|
||||
|
||||
SELECT LAST_INSERT_ID() INTO newIdentity;
|
||||
|
||||
SELECT COUNT(*) FROM OutboundInvoices WHERE
|
||||
OutboundInvoices.OrganizationId = organizationId AND
|
||||
OutboundInvoices.OutboundInvoiceId <= newIdentity INTO sequenceNumber;
|
||||
|
||||
UPDATE OutboundInvoices
|
||||
SET OutboundInvoices.OrganizationSequenceId = sequenceNumber
|
||||
WHERE OutboundInvoices.OutboundInvoiceId = newIdentity;
|
||||
|
||||
SELECT newIdentity AS Identity;
|
||||
|
||||
END
|
||||
|
||||
Reference in New Issue
Block a user