Page 1 of 1

Candidate Tags won't update with 0 tags selected. Workaround included.

Posted: 06 Jan 2020, 17:55
by rob
I wanted to share this workaround for anyone else having problems with Tags (and removing all from a single candidate), as I couldn't find any solutions out there.

Background: My team started using the tag feature, which is great for advanced sorting and filtering. Which is definitely a feature I encourage others to explore if they are not already doing so. However, in our current version 0.9.4, we were unable to remove all tags from a candidate. A proposed work around internally was to have a tag labeled 'None', but I thought this was a lame solution. After playing around with the code a bit, a quick workaround is to just add a hidden input with a fictitious static tagID in the form adding the tags(See Below). While this doesn't fix the ACTUAL issue going on here, this works just fine. In addition, and not required, a second step would be to add an extra query to remove that extra tag right after updating.

Workaround: File: ./opencats/modules/candidates/AssignCandidateTagModal.tpl add the following line inside the <form>:
Code: Select all
                <input type="hidden" id="candidateTAGG" name="candidate_tags[]" value="99999" />

Optional Second Part: File: ./opencats/lib/Tags.php add the line below after the $queryResult in the function AddTagsToCandidate near the very end of the file, Line 268 if it's the orig file.
Code: Select all
                $queryResult = $this->_db->query("delete from candidate_tag where tag_id = 99999");

Wasn't sure if I posted this in the right part of this forum, my bad if this was the wrong spot.

Re: Candidate Tags won't update with 0 tags selected. Workaround included.

Posted: 16 Jan 2020, 11:14
by RussH
Hi Rob,

thank you for this. Sorry for the radio silence, have been building the release for php 7.x compatible version. I'll add this as a minor update to the release, unless you want to create a PR on github?