Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #10566 - Incorrect date and time in the relationship with a person in the target lists #10567

Open
wants to merge 1 commit into
base: hotfix
Choose a base branch
from

Conversation

SinergiaCRM
Copy link
Contributor

Description

Fixing #10566

When deleting a Target List that has related records, the value of the date_modified field of the prospect_lists_prospects table is modified, however the DB stores the local date, and not the UTC date and time as it should.

Solution:
The NOW() function that collected the local DB date and time from the date_modified field has been changed to UTC_TIMESTAMP() that records it in UTC.

Motivation and Context

Motivation: This happens because the field update is being done directly with SQL using the NOW() function.

How To Test This

  1. Create a Target List.
  2. Add a person to the Target List.
  3. Check the date_modified field of the prospect_lists_prospects table in DB and observe that the date and time is UTC.
  4. Delete the Target List and verify that the date_modified field has taken the UTC date and time.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Final checklist

  • My code follows the code style of this project found here.
  • My change requires a change to the documentation.
  • I have read the How to Contribute guidelines.

@@ -427,7 +427,7 @@ public function save($check_notify = false)

public function mark_deleted($id)
{
$query = "UPDATE prospect_lists_prospects SET deleted = 1, date_modified = NOW() WHERE prospect_list_id = '{$id}' AND deleted = 0";
$query = "UPDATE prospect_lists_prospects SET deleted = 1, date_modified = UTC_TIMESTAMP() WHERE prospect_list_id = '{$id}' AND deleted = 0";
Copy link
Member

Choose a reason for hiding this comment

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

I don't believe this will work with MS SQL, so you will likely need to use the DB convert function here to support both engines and equally update that to use UTC_TIMESTAMP in MySQL , so this fix is applied globally when used

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.

2 participants