Show pageOld revisionsBacklinksExport to PDFFold/unfold allBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== pears.TempShiftCancelReason ====== <WRAP center round info> Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. </WRAP> ===== Description ===== User defined shift cancellation reason with settings for action required. ===== Columns ===== ^ Column ^ Type ^ Null ^ Default ^ Comment ^ | **TempShiftCancelReasonID** | char(1) | NOT NULL | | | | Name | char(50) | NOT NULL | | | | SortOrder | smallint | NULL | | | | AppliesToUnfilled | tinyint | NULL | | | | ClientAware | tinyint | NULL | | | | TempAware | tinyint | NULL | | | | Bill | tinyint | NULL | | | | Pay | tinyint | NULL | | | | Refill | tinyint | NULL | | | | PublishToWeb | smallint | NULL | 0 | | | ShortCode | char(4) | NULL | | | | TempShiftUnavailable | tinyint | NULL | | | ===== Primary Key ===== * TempShiftCancelReasonID ===== Foreign Keys ===== * No outgoing foreign keys found. ===== Referenced By ===== ^ Table ^ Constraint ^ Columns ^ Referenced columns ^ | [[database:tables:pears_placementdayvariation|pears.PlacementDayVariation]] | TempShiftCancelReason | TempShiftCancelReasonID | TempShiftCancelReasonID | | [[database:tables:pears_tempshift|pears.TempShift]] | TempShiftCancelReason | CancelReason | TempShiftCancelReasonID | | [[database:tables:pears_tempshiftcancelreasondept|pears.TempShiftCancelReasonDept]] | TempShiftCancelReason | TempShiftCancelReasonid | TempShiftCancelReasonID | ===== Indexes ===== * No indexes found. ===== Triggers ===== ^ Name ^ Timing ^ Event ^ | WPK_tempshiftcancelreason_SHIFTCANCELREASON | after | insert,delete,update order 1 | | TempShiftCancelReasonAudit | before | delete order 1 | ===== Original SQL ===== <code sql> -- IQX database structure split by table -- Source: IQXDatabaseStructure - with comments.sql -- Table: "pears"."TempShiftCancelReason" -- Table comment: User defined shift cancellation reason with settings for action required. -- Statement count: 6 CREATE TABLE "pears"."TempShiftCancelReason" ( "TempShiftCancelReasonID" char(1) NOT NULL ,"Name" char(50) NOT NULL ,"SortOrder" smallint NULL ,"AppliesToUnfilled" tinyint NULL ,"ClientAware" tinyint NULL ,"TempAware" tinyint NULL ,"Bill" tinyint NULL ,"Pay" tinyint NULL ,"Refill" tinyint NULL ,"PublishToWeb" smallint NULL DEFAULT 0 ,"ShortCode" char(4) NULL ,"TempShiftUnavailable" tinyint NULL ,PRIMARY KEY ("TempShiftCancelReasonID" ASC) ) go COMMENT ON TABLE "pears"."TempShiftCancelReason" IS 'User defined shift cancellation reason with settings for action required.' go create trigger "WPK_tempshiftcancelreason_SHIFTCANCELREASON" after insert,delete,update order 1 on "pears"."tempshiftcancelreason" for each statement begin call "WPKTrackChange"('P','SHIFTCANCELREASON') end go COMMENT TO PRESERVE FORMAT ON TRIGGER "pears"."TempShiftCancelReason"."WPK_tempshiftcancelreason_SHIFTCANCELREASON" IS {create trigger WPK_tempshiftcancelreason_SHIFTCANCELREASON after insert,delete,update order 1 on tempshiftcancelreason for each statement begin call WPKTrackChange('P','SHIFTCANCELREASON') end } go create trigger "TempShiftCancelReasonAudit" before delete order 1 on "pears"."TempShiftCancelReason" referencing old as "old_shiftcancelreason" for each row begin declare "mergedid" char(1); declare "nameold" char(50); declare "mergedname" char(50); set "mergedid" = (select "RIGHT"("old_shiftcancelreason"."name",1)); set "nameold" = (select "LEFT"("old_shiftcancelreason"."name","LEN"("old_shiftcancelreason"."name")-1)); set "mergedname" = (select "name" from "tempshiftcancelreason" where "tempshiftcancelreasonid" = "mergedid"); if exists(select * from "audititems" where "isnull"("auditflag",0) = 1 and "itemname" = 'Cancel Reason') then call "auditlog"('Shift',"old_shiftcancelreason"."tempshiftcancelreasonid", 'Shift Cancel Reason deleted',"nameold",'Removed - Merged into '+"mergedid"+' - '+"mergedname") end if end go COMMENT TO PRESERVE FORMAT ON TRIGGER "pears"."TempShiftCancelReason"."TempShiftCancelReasonAudit" IS {create trigger TempShiftCancelReasonAudit before delete order 1 on pears.TempShiftCancelReason referencing old as old_shiftcancelreason for each row begin declare mergedid char(1); declare nameold char(50); declare mergedname char(50); set mergedid = (select RIGHT(old_shiftcancelreason.name, 1)); set nameold = (select LEFT(old_shiftcancelreason.name, LEN(old_shiftcancelreason.name) - 1)); set mergedname = (select name from tempshiftcancelreason where tempshiftcancelreasonid = mergedid) ; if exists(select * from audititems where isnull(auditflag, 0) = 1 and itemname= 'Cancel Reason') then call auditlog('Shift',old_shiftcancelreason.tempshiftcancelreasonid , 'Shift Cancel Reason deleted',nameold,'Removed - Merged into '+mergedid+' - '+mergedname) end if; end } go </code> database/tables/pears_tempshiftcancelreason.txt Last modified: 2026/08/07 19:24by 127.0.0.1