Please describe the issue you're having
If you accept the answer, please mark the topic as [SOLVED] by clicking the tick.

Moderators: RussH, cptr13

Forum rules: Just please remember to play nicely once you walk through the door. You can disagree with us, or any other commenters in this forum, but respect our space and keep your comments directed to the topic at hand.
By CFM
#4565
Varables don't appear to work in opencats/modules/candidates/CandidatesUI.php?


$stringsToFind = array(
'%CANDOWNER%',
'%CANDFIRSTNAME%',
'%CANDFULLNAME%'
);
$replacementStrings = array(
$candidateData['ownerFullName'],
$candidateData['firstName'],
$candidateData['firstName'] . ' ' . $candidateData['lastName'],
$candidateData['firstName'],
$candidateData['firstName']
);
$statusChangeTemplate = str_replace(
$stringsToFind,
$replacementStrings,



- Update: After looking at the code and trying the change ownership option in edit, I see that the variable replacement routine is applied to the change ownership template which is automatically emailed. I’ll try replicating the change variable section elsewhere in cantidatesui.php, unless there is already a suggested modification?
By CFM
#4580
I'm no developer, although I can handle minor HTML and PHP tweaks etc. However, I have now spent about 30 hours trying to setup variables in emails sent from the candidate selection grid. I readily confess that I am way out of my depth and have now given up. After trying simpler iterations, my last 'attempt' is:

Public function defined in mailer.php, just above "public function mail(":

public function candid($recipients)
{
$em = $recipients[$key][1];

$sql = sprintf(
"SELECT
candidate_ID
FROM
candidate
WHERE
email1 = '$em'",
$this->_db->makeQueryString($sql));

return $this->_db->query($sql);

$this->_mailer->Body = '<div style="font: normal normal 12px Arial, Tahoma, sans-serif">'
. str_replace("firstname", $this, $body) . '</div>';
}


Code added to "public function mail(":

$this->_mailer->AddReplyTo($replyTo[0], $replyTo[1]);
}

candid($recipients, $cid);

$this->_mailer->Body = '<div style="font: normal normal 12px Arial, Tahoma, sans-serif">'
. str_replace("firstname", $cid, $body) . '</div>';

if (!$this->_mailer->Send())
{


All I require is a variable for candidate_ID and first_name from the candidate table. I have been using CandidATS and it appears that I will need to keep using it as it allows variables in a custom template. :(
By CFM
#4582
Okay, I have finally created my variables. Even though I could not get EMail Templates Support #231 (https://github.com/opencats/OpenCATS/pull/231) to display the selected template in the message body box, I was still able to paste in a template and send the emails. On the EMail Template Configuration page, I then changed the Candidate Owner button to Candidate ID by finding references to %CANDOWNER% here https://github.com/opencats/OpenCATS/pull/231/files ,and changing them to %CANDID% (my new template variable). At some point I will add Candidate Owner back in by copying and adding where required, however, for now, I have my candidate_ID (name of field in candidate table) variable.

At some point, I hope that someone else addresses the templates not actually appearing in the message body box. I also notice that emails sent are not logged in the candidate's activity. As a workaround for the latter, I have also added a bcc in mailer.php which sends emails to opencats@xxx.com. At least I therefore have a record in my email of everything sent.

Please excuse the roughness of this email , it has been a long 4 days........
User avatar
By RussH
#4599
Sorry - I've replied to a separate thread on this.. How are things working for you now?

OpenCats is verry easy to back-up with a simple […]

Hi there. I'm not a software guy but I think it […]

Please suggest alternatives. Run 3

Mass Import of Resumes

Hi Kline, okay so you're getting into some awkwa[…]