I have two custom buttons, HOLD and HIRE. HOLD is working fine. HIRE is reverting to HOLD. Is there anything obviously wrong with my code? If so, what is the fix? This is in LIST PAGE -> BEFORE RECORD DELETED in the event editor.
//delete records
if(@$_POST["a"]=="delete")
return true;
//
//update records
global $strTableName;
//
if(@$_POST["a"]=="Hold")
{
// set isHeld to '0' meaning, is not on hold
$sql = "UPDATE CCEmployerView
SET isHeld='"."1"."', holdby='".$_SESSION["ID"]."',
holddate=now() where CandidateCCID=" . $deleted_values["CandidateCCID"];
CustomQuery($sql);
}
// move all data to CCEmployerView table and delete from CCEmployerHold table
{
$sql = "INSERT into CCEmployerHold
(CandidateCCID,
RecruiterID,
Upload Photo
,
FirstName,
MiddleName,
SurName,
Gender,
DOB,
AvailBeginDate,
AvailEndDate,
EmailAddr,
PrimTele,
PrimPhoneType,
SecTele,
SecPhoneType,
MailAddr,
POBoxSte,
City,
Postal,
Province,
Country,
CityBirth,
CountryBirth,
CountryCitizenship,
CountryPermRes,
CSS,
USBStart,
USBEnd,
FOS,
CurOcc,
CCyn,
HowMany,
EngRating,
IntNotes,
RPS,
JPS1,
JPS2,
JPS3,
JPS4,
JPS1Notes,
JPS2Notes,
JPS3Notes,
JPS4Notes,
OtherSkills,
Employment,
VolHist,
Education,
Hobbies,
DrivLic,
Smoker,
USFunds,
UTube,
UpVid,
UpPBP,
UpPSS,
UpWritRef1,
UpWritRef2,
UpWritRef3,
UpFormRes,
UpCerts,
UpCBCR,
UpHealthScreen,
UpTnC,
IsApproved,
BeenPlaced,
ImgThumb,
VideoPath,
PassBioPath,
ProofSSPath,
Ref1Path,
Ref2Path,
Ref3Path,
FormResPath,
CertsPath,
CrimBakPath,
HealthScreenPath,
TACPath,
CandidateChoice,
assignedTo,
holdby,
holddate,
empAssignedTo,
IntNotesPath,
isHeld)
SELECT
CandidateCCID,
RecruiterID,
Upload Photo
,
FirstName,
MiddleName,
SurName,
Gender,
DOB,
AvailBeginDate,
AvailEndDate,
EmailAddr,
PrimTele,
PrimPhoneType,
SecTele,
SecPhoneType,
MailAddr,
POBoxSte,
City,
Postal,
Province,
Country,
CityBirth,
CountryBirth,
CountryCitizenship,
CountryPermRes,
CSS,
USBStart,
USBEnd,
FOS,
CurOcc,
CCyn,
HowMany,
EngRating,
IntNotes,
RPS,
JPS1,
JPS2,
JPS3,
JPS4,
JPS1Notes,
JPS2Notes,
JPS3Notes,
JPS4Notes,
OtherSkills,
Employment,
VolHist,
Education,
Hobbies,
DrivLic,
Smoker,
USFunds,
UTube,
UpVid,
UpPBP,
UpPSS,
UpWritRef1,
UpWritRef2,
UpWritRef3,
UpFormRes,
UpCerts,
UpCBCR,
UpHealthScreen,
UpTnC,
IsApproved,
BeenPlaced,
ImgThumb,
VideoPath,
PassBioPath,
ProofSSPath,
Ref1Path,
Ref2Path,
Ref3Path,
FormResPath,
CertsPath,
CrimBakPath,
HealthScreenPath,
TACPath,
CandidateChoice,
assignedTo,
holdby,
holddate,
empAssignedTo,
IntNotesPath,
isHeld
FROM CCEmployerView
WHERE CandidateCCID=" . $deleted_values["CandidateCCID"];
CustomQuery($sql);
$strDelete = "DELETE FROM CCEmployerView WHERE CandidateCCID=" . $deleted_values["CandidateCCID"];
CustomQuery($strDelete);
}
return true;
//Hire a Camp Counselor Candidate
if(@$_POST["a"]=="Hire")
{
// set isHeld to '0' meaning, is not on hold
$sql = "UPDATE CCEmployerView
SET isHeld='"."0"."', holdby='".$_SESSION["ID"]."',
holddate=now() where CandidateCCID=" . $deleted_values["CandidateCCID"];
CustomQuery($sql);
}
{
$sql = "INSERT into CandidateCCPlaced
(CandidateCCID,
RecruiterID,
Upload Photo
,
FirstName,
MiddleName,
SurName,
Gender,
DOB,
AvailBeginDate,
AvailEndDate,
EmailAddr,
PrimTele,
PrimPhoneType,
SecTele,
SecPhoneType,
MailAddr,
POBoxSte,
City,
Postal,
Province,
Country,
CityBirth,
CountryBirth,
CountryCitizenship,
CountryPermRes,
CSS,
USBStart,
USBEnd,
FOS,
CurOcc,
CCyn,
HowMany,
EngRating,
IntNotes,
RPS,
JPS1,
JPS2,
JPS3,
JPS4,
JPS1Notes,
JPS2Notes,
JPS3Notes,
JPS4Notes,
OtherSkills,
Employment,
VolHist,
Education,
Hobbies,
DrivLic,
Smoker,
USFunds,
UTube,
UpVid,
UpPBP,
UpPSS,
UpWritRef1,
UpWritRef2,
UpWritRef3,
UpFormRes,
UpCerts,
UpCBCR,
UpHealthScreen,
UpTnC,
IsApproved,
BeenPlaced,
ImgThumb,
VideoPath,
PassBioPath,
ProofSSPath,
Ref1Path,
Ref2Path,
Ref3Path,
FormResPath,
CertsPath,
CrimBakPath,
HealthScreenPath,
TACPath,
CandidateChoice,
assignedTo,
holdby,
holddate,
empAssignedTo,
IntNotesPath,
isHeld)
SELECT
CandidateCCID,
RecruiterID,
Upload Photo
,
FirstName,
MiddleName,
SurName,
Gender,
DOB,
AvailBeginDate,
AvailEndDate,
EmailAddr,
PrimTele,
PrimPhoneType,
SecTele,
SecPhoneType,
MailAddr,
POBoxSte,
City,
Postal,
Province,
Country,
CityBirth,
CountryBirth,
CountryCitizenship,
CountryPermRes,
CSS,
USBStart,
USBEnd,
FOS,
CurOcc,
CCyn,
HowMany,
EngRating,
IntNotes,
RPS,
JPS1,
JPS2,
JPS3,
JPS4,
JPS1Notes,
JPS2Notes,
JPS3Notes,
JPS4Notes,
OtherSkills,
Employment,
VolHist,
Education,
Hobbies,
DrivLic,
Smoker,
USFunds,
UTube,
UpVid,
UpPBP,
UpPSS,
UpWritRef1,
UpWritRef2,
UpWritRef3,
UpFormRes,
UpCerts,
UpCBCR,
UpHealthScreen,
UpTnC,
IsApproved,
BeenPlaced,
ImgThumb,
VideoPath,
PassBioPath,
ProofSSPath,
Ref1Path,
Ref2Path,
Ref3Path,
FormResPath,
CertsPath,
CrimBakPath,
HealthScreenPath,
TACPath,
CandidateChoice,
assignedTo,
holdby,
holddate,
empAssignedTo,
IntNotesPath,
isHeld
FROM CCEmployerView
WHERE CandidateCCID=" . $deleted_values["CandidateCCID"];
CustomQuery($sql);
$strDelete = "DELETE FROM CCEmployerView WHERE CandidateCCID=" . $deleted_values["CandidateCCID"];
CustomQuery($strDelete);
}
//
return true;