====== pears.AutoMatchRemoveShiftFromQueue ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
create procedure "pears"."AutoMatchRemoveShiftFromQueue"(
in @TempShiftPlanID char(20),@State char(1),@Refill smallint )
begin
if @State in( 'P','B' ) then
update "AutoMatchShiftQueue" set "NotRequired" = 1 where "TempshiftPlanID" = @TempShiftPlanID and "completed" is null;
update "AutoMatchNotificationQueue" set "NotRequired" = 1 where "TempshiftPlanID" = @TempShiftPlanID and "emailcompleted" is null and "SMScompleted" is null and "Pushcompleted" is null
end if;
if(@State = 'C') and("isnull"(@Refill,0) = 0) then
update "AutoMatchShiftQueue" set "NotRequired" = 1 where "TempshiftPlanID" = @TempShiftPlanID and "completed" is null;
update "AutoMatchNotificationQueue" set "NotRequired" = 1 where "TempshiftPlanID" = @TempShiftPlanID and "emailcompleted" is null and "SMScompleted" is null and "Pushcompleted" is null
end if
end
go
COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."AutoMatchRemoveShiftFromQueue" IS
{create procedure AutoMatchRemoveShiftFromQueue
( IN @TempShiftPlanID char(20), @State char(1), @Refill smallint )
begin
if @State in ('P','B') then
update AutoMatchShiftQueue set NotRequired = 1 where TempshiftPlanID = @TempShiftPlanID and completed is null;
update AutoMatchNotificationQueue set NotRequired = 1 where TempshiftPlanID = @TempShiftPlanID and emailcompleted is null and SMScompleted is null and Pushcompleted is null;
end if;
if (@State = 'C') and (isnull(@Refill,0) = 0) then
update AutoMatchShiftQueue set NotRequired = 1 where TempshiftPlanID = @TempShiftPlanID and completed is null;
update AutoMatchNotificationQueue set NotRequired = 1 where TempshiftPlanID = @TempShiftPlanID and emailcompleted is null and SMScompleted is null and Pushcompleted is null;
end if;
end
}