From 5f7fa360be778d4518a7c833b61e685795cb7c8c Mon Sep 17 00:00:00 2001 From: Gregor Wolf Date: Fri, 19 Aug 2016 07:24:11 +0200 Subject: [PATCH] Check for existing event not needed #5 --- .../RegisterAsOrganizerCreate.hdbprocedure | 49 ++++++++----------- 1 file changed, 21 insertions(+), 28 deletions(-) diff --git a/odataparticipant/procedures/RegisterAsOrganizerCreate.hdbprocedure b/odataparticipant/procedures/RegisterAsOrganizerCreate.hdbprocedure index 6190dfc..3f56516 100644 --- a/odataparticipant/procedures/RegisterAsOrganizerCreate.hdbprocedure +++ b/odataparticipant/procedures/RegisterAsOrganizerCreate.hdbprocedure @@ -36,7 +36,7 @@ BEGIN DECLARE lv_CreatedAt string; DECLARE lv_ChangedBy string; DECLARE lv_ChangedAt string; - + DECLARE lv_now string; SELECT * INTO lv_UserName, @@ -66,35 +66,28 @@ BEGIN lv_CreatedBy = lv_UserName; lv_ChangedBy = lv_UserName; - -- Check if provided Event ID belongs to the User - SELECT COUNT(*) INTO lv_Count - FROM "com.sap.sapmentors.sitreg.odataparticipant.procedures::RegisterAsOrganizerRead" - WHERE "History.CreatedBy" = lv_CreatedBy; - - IF lv_Count = 0 THEN - DECLARE lv_now string; - lv_now = CURRENT_TIMESTAMP; - - INSERT INTO "com.sap.sapmentors.sitreg.data::SITreg.Organizer" - VALUES( - UCASE( lv_UserName ), - lv_FirstName, - lv_LastName, - lv_Email, - lv_MobilePhone, - UCASE( lv_Status ), - CURRENT_TIMESTAMP, - CURRENT_TIMESTAMP, - lv_CreatedBy, - CURRENT_TIMESTAMP, - lv_ChangedBy, - lv_now - ); - ELSE + lv_now = CURRENT_TIMESTAMP; + + INSERT INTO "com.sap.sapmentors.sitreg.data::SITreg.Organizer" + VALUES( + UCASE( lv_UserName ), + lv_FirstName, + lv_LastName, + lv_Email, + lv_MobilePhone, + UCASE( lv_Status ), + CURRENT_TIMESTAMP, + CURRENT_TIMESTAMP, + lv_CreatedBy, + CURRENT_TIMESTAMP, + lv_ChangedBy, + lv_now + ); + IF 1 = 2 THEN error = SELECT 400 AS http_status_code, - 'Event does not belong to you' AS error_message, + 'An error occured' AS error_message, '' AS detail FROM dummy; END IF; -END; \ No newline at end of file +END;