====== pears.NetActionDialogGetDetails ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
create procedure "pears"."NetActionDialogGetDetails"( in "pWebUserID" char(20),in "pTheID" char(20),in "pActionDialogType" char(50) )
result(
"name" char(255),
"notes" long varchar,
"othernotes" long varchar,
"addr1" char(255),
"addr2" char(255),
"addr3" char(255),
"town" char(255),
"county" char(255),
"postcode" char(255),
"statusName" char(255),
"alert" char(255),
"warning" char(255),
"headline" char(255),
"adtype" char(255) )
// IQXWeb
begin
case "pActionDialogType"
when 'person' then
select "name",
"notes",
"othernotes",
"addr1",
"addr2",
"addr3",
"town",
"county",
"postcode",
(select "status"."name" from "status" where "status"."type" = 'p' and "status"."status" = "person"."status") as "statusName",
"alert",
"PersonWarning" as "warning",
(select "PersonHeadline"("pTheID")) as "headline",
'Candidate' as "adtype"
from "Person"
where "Person"."personid" = "pTheID"
when 'company' then
select "name",
"notes",
"extranotes",
"addr1",
"addr2",
"addr3",
"town",
"county",
"postcode",
(select "cs"."name" from "companystatus" as "cs" where "cs"."companystatusid" = "company"."status") as "statusName",
"alert",
"CompanyWarning" as "warning",
(select "CompanyHeadline"("pTheID")) as "headline",
'Company' as "adtype"
from "Company"
where "company"."companyID" = "pTheID"
when 'contact' then
select "p"."name",
"e"."note",
"c"."notes",
"c"."addr1",
"c"."addr2",
"c"."addr3",
"c"."town",
"c"."county",
"c"."postcode",
(select "status"."name" from "status" where "status"."type" = 'p' and "status"."status" = "p"."status") as "statusName",
"p"."alert",
"p"."PersonWarning" as "warning",
(select "PersonHeadline"("pTheID")) as "headline",
'Contact' as "adtype"
from "employment" as "e"
key join "company" as "c"
,"employment" as "e"
key join "person" as "p"
where "e"."employmentid" = "pTheID"
else
select '','','','','','','','','','','','' from "dummy"
end case
end /* DOC
2018-04-30 IW-460 PC Client and Contact Details need to show CLIENT state
2018-04-30 IW-474 PC Address needs to be Client address, Notes client or employment
*/
go
COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."NetActionDialogGetDetails" IS
{create PROCEDURE pears."NetActionDialogGetDetails"(pWebUserID char(20),in pTheID char(20), in pActionDialogType char(50))
RESULT(
name char(255),
notes long varchar,
othernotes long varchar,
addr1 char(255),
addr2 char(255),
addr3 char(255),
town char(255),
county char(255),
postcode char(255),
statusName char(255),
alert char(255),
warning char(255),
headline char(255),
adtype char(255)
)
// IQXWeb
BEGIN
CASE pActionDialogType
WHEN 'person' THEN
SELECT
name,
notes,
othernotes,
addr1,
addr2,
addr3,
town,
county,
postcode,
(SELECT status.name FROM status where status.type = 'p' and status.status = person.status) as statusName,
alert,
PersonWarning as warning,
(SELECT PersonHeadline(pTheID)) as headline,
'Candidate' as adtype
FROM
Person
WHERE
Person.personid=pTheID;
WHEN 'company' THEN
SELECT
name,
notes,
extranotes,
addr1,
addr2,
addr3,
town,
county,
postcode,
(SELECT cs.name FROM companystatus cs where cs.companystatusid = company.status) as statusName,
alert,
CompanyWarning as warning,
(SELECT CompanyHeadline(pTheID)) as headline,
'Company' as adtype
FROM
Company
WHERE
company.companyID=pTheID;
WHEN 'contact' THEN
SELECT
p.name,
e.note,
c.notes,
c.addr1,
c.addr2,
c.addr3,
c.town,
c.county,
c.postcode,
(SELECT status.name FROM status where status.type = 'p' and status.status = p.status) as statusName,
p.alert,
p.PersonWarning as warning,
(SELECT PersonHeadline(pTheID)) as headline,
'Contact' as adtype
FROM
employment e
key join company c,
employment e
key join person p
WHERE
e.employmentid=pTheID;
ELSE
select '','','','','','','','','','','','' from dummy;
END CASE;
END
/* DOC
2018-04-30 IW-460 PC Client and Contact Details need to show CLIENT state
2018-04-30 IW-474 PC Address needs to be Client address, Notes client or employment
*/
}