Bugfix to stored proc
This commit is contained in:
@@ -14,7 +14,7 @@ namespace Swarmops.Database
|
||||
/// </summary>
|
||||
public static int DbVersionExpected
|
||||
{
|
||||
get { return 41; }
|
||||
get { return 42; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -39,3 +39,4 @@
|
||||
0039 - VatReport.Guid added [RF]
|
||||
0040 - Document.HiresStatus added [RF]
|
||||
0041 - InboundInvoice housekeeping; added OrgSeqId [RF]
|
||||
0042 - Bugfix to SetInboundInvoiceOrganizationSequenceId [RF]
|
||||
@@ -75,7 +75,7 @@ BEGIN
|
||||
SELECT COUNT(*)
|
||||
FROM InboundInvoices
|
||||
WHERE InboundInvoices.OrganizationId=organizationId
|
||||
AND InboundInvoices.InboundInvoicesId <= inboundInvoiceId
|
||||
AND InboundInvoices.InboundInvoiceId <= inboundInvoiceId
|
||||
INTO sequenceNumber;
|
||||
|
||||
UPDATE InboundInvoices SET OrganizationSequenceId = sequenceNumber
|
||||
@@ -83,4 +83,4 @@ BEGIN
|
||||
|
||||
SELECT sequenceNumber AS OrganizationSequenceId;
|
||||
|
||||
END
|
||||
END
|
||||
@@ -0,0 +1,31 @@
|
||||
DROP PROCEDURE IF EXISTS `SetInboundInvoiceOrganizationSequenceId`
|
||||
|
||||
|
||||
#
|
||||
|
||||
|
||||
CREATE PROCEDURE `SetInboundInvoiceOrganizationSequenceId`(
|
||||
IN inboundInvoiceId INTEGER
|
||||
)
|
||||
BEGIN
|
||||
|
||||
DECLARE organizationId INTEGER;
|
||||
DECLARE sequenceNumber INTEGER;
|
||||
|
||||
SELECT InboundInvoices.OrganizationId
|
||||
FROM InboundInvoices
|
||||
WHERE InboundInvoices.InboundInvoiceId = inboundInvoiceId
|
||||
INTO organizationId;
|
||||
|
||||
SELECT COUNT(*)
|
||||
FROM InboundInvoices
|
||||
WHERE InboundInvoices.OrganizationId=organizationId
|
||||
AND InboundInvoices.InboundInvoiceId <= inboundInvoiceId
|
||||
INTO sequenceNumber;
|
||||
|
||||
UPDATE InboundInvoices SET OrganizationSequenceId = sequenceNumber
|
||||
WHERE InboundInvoices.InboundInvoiceId = inboundInvoiceId;
|
||||
|
||||
SELECT sequenceNumber AS OrganizationSequenceId;
|
||||
|
||||
END
|
||||
Reference in New Issue
Block a user