Skip to content

feat: add phone validation option to Job Applicant contact number field#6025

Open
pjamsheer wants to merge 1 commit into
version-15from
employee_creation_issue
Open

feat: add phone validation option to Job Applicant contact number field#6025
pjamsheer wants to merge 1 commit into
version-15from
employee_creation_issue

Conversation

@pjamsheer

@pjamsheer pjamsheer commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

This pull request adds a validation option to the "Contact Number" field for job applicants, ensuring that phone numbers are properly validated. The main changes include updating the field definition, adding a database patch to apply this change, and registering the patch for execution.

Job Applicant "Contact Number" field improvements:

  • Added the "options": "Phone" property to the one_fm_contact_number field in get_job_applicant_custom_fields() to enable phone number validation.

Database migration:

  • Introduced a new patch script add_phone_option_to_job_applicant_contact_number.py that updates the one_fm_contact_number field to include the "Phone" option, ensuring the change is applied to existing fields.
  • Registered the new patch in patches.txt so it will run during the next migration.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves phone number handling for Job Applicants and Employees by enforcing phone validation on the Job Applicant contact number field and sanitizing stored phone numbers to remove problematic Unicode characters.

Changes:

  • Adds options: "Phone" to the Job Applicant one_fm_contact_number custom field (fixture + patch).
  • Introduces a data patch to sanitize existing Job Applicant contact numbers by stripping Unicode bidirectional markers.
  • Sanitizes Employee phone fields during onboarding before saving the new Employee record.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
one_fm/patches/v15_0/sanitize_job_applicant_contact_numbers.py New patch to sanitize stored Job Applicant phone numbers.
one_fm/patches/v15_0/add_phone_option_to_job_applicant_contact_number.py New patch to apply Phone validation option to the Job Applicant contact number field.
one_fm/patches.txt Registers the two new v15 patches for migration execution.
one_fm/hiring/doctype/onboard_employee/onboard_employee.py Sanitizes employee phone fields during Employee creation.
one_fm/custom/custom_field/job_applicant.py Updates Job Applicant contact number field to use options: "Phone".

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread one_fm/patches/v15_0/sanitize_job_applicant_contact_numbers.py Outdated
Comment thread one_fm/patches/v15_0/sanitize_job_applicant_contact_numbers.py Outdated
Comment thread one_fm/patches/v15_0/sanitize_job_applicant_contact_numbers.py Outdated
Comment thread one_fm/patches/v15_0/add_phone_option_to_job_applicant_contact_number.py Outdated
Comment thread one_fm/hiring/doctype/onboard_employee/onboard_employee.py Outdated
Comment thread one_fm/hiring/doctype/onboard_employee/onboard_employee.py Outdated
Comment thread one_fm/hiring/doctype/onboard_employee/onboard_employee.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves phone-number handling for Job Applicants and newly created Employees by enforcing Frappe’s “Phone” field validation and sanitizing stored phone strings to remove problematic Unicode formatting characters.

Changes:

  • Add "options": "Phone" to the Job Applicant contact number custom field (via customization + patch).
  • Introduce a migration patch to sanitize existing Job Applicant phone fields by removing bidi markers and trimming whitespace.
  • Sanitize Employee phone fields during onboarding employee creation.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
one_fm/patches/v15_0/sanitize_job_applicant_contact_numbers.py New patch to sanitize existing Job Applicant contact numbers in DB.
one_fm/patches/v15_0/add_phone_option_to_job_applicant_contact_number.py New patch to enforce “Phone” validation on an existing custom field.
one_fm/patches.txt Registers the two new v15 patches for migration execution.
one_fm/hiring/utils.py Adds shared sanitization utilities (translation table + sanitization helper).
one_fm/hiring/doctype/onboard_employee/onboard_employee.py Sanitizes Employee phone fields before saving newly created Employee records.
one_fm/custom/custom_field/job_applicant.py Updates Job Applicant custom field definition to use “Phone” validation option.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread one_fm/hiring/utils.py Outdated
Comment thread one_fm/patches/v15_0/sanitize_job_applicant_contact_numbers.py Outdated
Comment thread one_fm/patches/v15_0/sanitize_job_applicant_contact_numbers.py Outdated
Comment thread one_fm/patches/v15_0/sanitize_job_applicant_contact_numbers.py Outdated
Comment thread one_fm/patches/v15_0/add_phone_option_to_job_applicant_contact_number.py Outdated
Comment thread one_fm/hiring/utils.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves phone number handling for hiring/onboarding by enforcing phone validation for Job Applicant contact numbers, sanitizing problematic Unicode characters in existing data, and sanitizing phone fields during employee creation.

Changes:

  • Add "options": "Phone" to the Job Applicant one_fm_contact_number custom field (and include a patch to apply it).
  • Introduce a migration patch to sanitize Job Applicant contact numbers using a shared sanitize_phone_number utility.
  • Sanitize Employee phone fields during onboarding to prevent invalid/unexpected Unicode markers in newly created Employee records.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
one_fm/patches/v15_0/sanitize_job_applicant_contact_numbers.py Adds a batched data migration to sanitize Job Applicant phone fields.
one_fm/patches/v15_0/add_phone_option_to_job_applicant_contact_number.py Adds/updates custom field metadata to enforce Phone validation on contact number.
one_fm/patches.txt Registers the new patches for execution during migrations.
one_fm/hiring/utils.py Adds reusable phone sanitization helper(s) and a cached translation table.
one_fm/hiring/doctype/onboard_employee/onboard_employee.py Sanitizes phone fields before saving newly created Employee records.
one_fm/custom/custom_field/job_applicant.py Updates the Job Applicant custom field definition to include options = "Phone".

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread one_fm/patches.txt Outdated
Comment thread one_fm/patches/v15_0/sanitize_job_applicant_contact_numbers.py Outdated
Comment thread one_fm/patches/v15_0/sanitize_job_applicant_contact_numbers.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves phone number handling across the hiring/onboarding flow by enforcing phone validation on the Job Applicant contact number field and sanitizing phone strings to remove invisible Unicode formatting characters that can break validation.

Changes:

  • Added "options": "Phone" to the Job Applicant one_fm_contact_number custom field and introduced a patch to apply this to existing sites.
  • Added a sanitization utility (sanitize_phone_number) and applied it during employee creation in onboarding.
  • Added a database patch to sanitize existing Job Applicant contact numbers, and registered the new patches in patches.txt.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
one_fm/patches/v15_0/sanitize_job_applicant_contact_numbers.py New patch to batch-sanitize Job Applicant phone fields in the DB.
one_fm/patches/v15_0/add_phone_option_to_job_applicant_contact_number.py New patch to enforce Phone validation option on the Job Applicant contact number field.
one_fm/patches.txt Registers the two new patches (including post-model-sync execution for sanitization).
one_fm/hiring/utils.py Adds cached translation table + sanitize_phone_number() helper.
one_fm/hiring/doctype/onboard_employee/onboard_employee.py Sanitizes employee phone fields during onboarding employee creation.
one_fm/custom/custom_field/job_applicant.py Adds "options": "Phone" to the Job Applicant contact number field definition.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread one_fm/patches/v15_0/sanitize_job_applicant_contact_numbers.py Outdated
Comment thread one_fm/patches/v15_0/sanitize_job_applicant_contact_numbers.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves phone-number handling for hiring/onboarding by enforcing phone validation on Job Applicant contact numbers and normalizing stored phone values to remove problematic Unicode formatting markers.

Changes:

  • Adds "options": "Phone" to the Job Applicant one_fm_contact_number custom field (and introduces a migration patch to apply it).
  • Introduces a post-migration patch to sanitize existing Job Applicant phone numbers in batches.
  • Adds shared phone sanitization utilities and applies them during employee creation in onboarding.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
one_fm/patches/v15_0/sanitize_job_applicant_contact_numbers.py New post-model-sync patch to sanitize existing Job Applicant phone fields in batches.
one_fm/patches/v15_0/add_phone_option_to_job_applicant_contact_number.py New patch to enforce Phone validation option on Job Applicant contact number field.
one_fm/patches.txt Registers the new patches (including post-model-sync sanitization).
one_fm/hiring/utils.py Adds reusable sanitization helpers (cached translate table + sanitizer).
one_fm/hiring/doctype/onboard_employee/onboard_employee.py Sanitizes employee phone fields before saving the created Employee document.
one_fm/custom/custom_field/job_applicant.py Updates the Job Applicant custom field definition to include Phone validation option.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread one_fm/hiring/utils.py Outdated
Comment thread one_fm/patches/v15_0/sanitize_job_applicant_contact_numbers.py Outdated
@pjamsheer pjamsheer force-pushed the employee_creation_issue branch from 2987ce9 to 3e07096 Compare April 29, 2026 12:30
@pjamsheer pjamsheer changed the title feat: add phone validation option and sanitize contact numbers for Jo… feat: add phone validation option to Job Applicant contact number field Apr 29, 2026
@pjamsheer pjamsheer requested a review from Copilot April 29, 2026 12:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds phone-number validation configuration to the Job Applicant “Contact Number” custom field and ensures existing sites receive the update via a migration patch.

Changes:

  • Set options = "Phone" on the one_fm_contact_number custom field definition for Job Applicant.
  • Added a v15 patch to apply the phone validation option to existing databases.
  • Registered the new patch in one_fm/patches.txt.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
one_fm/patches/v15_0/add_phone_option_to_job_applicant_contact_number.py Adds a migration patch that updates the Job Applicant contact number custom field to use options="Phone".
one_fm/patches.txt Registers the new patch for execution during migrations.
one_fm/custom/custom_field/job_applicant.py Updates the Job Applicant custom field spec to include options="Phone" for the contact number field.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread one_fm/patches.txt
@pjamsheer pjamsheer force-pushed the employee_creation_issue branch from 3e07096 to 48156d1 Compare April 29, 2026 12:37
@pjamsheer pjamsheer requested a review from NoBoneZ April 29, 2026 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants