If I duplicate a meeting and I edit it, changing the date and the assigned user = the calendar shows me the duplicate metting 2 times #5017

Open
opened 2026-02-20 16:28:02 -05:00 by deekerman · 5 comments
Owner

Originally created by @Rascott33 on GitHub (May 19, 2023).

Duplicating meetings is a wonderful feature when meetings are repeated over time, but I found a bug.

Duplicate and edited visits by changing the assigned user are repeated in the calendar.

Expected Behavior

If I create new visits using the duplicate visit function and change the date and assignee, the new duplicate visit must be a unique record for that assignee.

Actual Behavior

Duplicate visits that are edited and the assigned user is changed keep a memory of the assigned user to which it previously belonged and in the visits calendar if we see the shared month and see the visits of all users, that duplicate visit is shown repeatedly as many times as assigned users to which it belonged at some point.

Steps to Reproduce

  1. Create a meeting and assigned to you
  2. Duplicate the meeting, change the date and change the assignee
  3. Go to the calendar, shared month and in the settings choose to see the meetings of all users.
  4. The duplicate meeting you created is displayed 2 times.

If you were to duplicate the same meeting again and assign it to another user, it would show up on the calendar 3 times.

And so to infinity and beyond.

Context

Repeatedly displaying a single meeting record on the calendar can cause confusion.

Duplicate meetings with user switch should only be seen once for only the current assignee.

Your Environment

  • SuiteCRM 7.13:
  • Firefox 113.0.1 (64-bit)
  • PHP 7.4.29
  • Debian 10
Originally created by @Rascott33 on GitHub (May 19, 2023). Duplicating meetings is a wonderful feature when meetings are repeated over time, but I found a bug. Duplicate and edited visits by changing the assigned user are repeated in the calendar. Expected Behavior If I create new visits using the duplicate visit function and change the date and assignee, the new duplicate visit must be a unique record for that assignee. Actual Behavior Duplicate visits that are edited and the assigned user is changed keep a memory of the assigned user to which it previously belonged and in the visits calendar if we see the shared month and see the visits of all users, that duplicate visit is shown repeatedly as many times as assigned users to which it belonged at some point. #### Steps to Reproduce 1. Create a meeting and assigned to you 2. Duplicate the meeting, change the date and change the assignee 3. Go to the calendar, shared month and in the settings choose to see the meetings of all users. 4. The duplicate meeting you created is displayed 2 times. If you were to duplicate the same meeting again and assign it to another user, it would show up on the calendar 3 times. And so to infinity and beyond. #### Context Repeatedly displaying a single meeting record on the calendar can cause confusion. Duplicate meetings with user switch should only be seen once for only the current assignee. #### Your Environment * SuiteCRM 7.13: * Firefox 113.0.1 (64-bit) * PHP 7.4.29 * Debian 10
Author
Owner

@SuiteBot commented on GitHub (May 19, 2023):

This issue has been mentioned on SuiteCRM. There might be relevant details there:

https://community.suitecrm.com/t/bug-v-7-13-duplicate-meeting-i-change-the-assigned-user-and-the-calendar-shows-me-double/89060/2

@SuiteBot commented on GitHub (May 19, 2023): This issue has been mentioned on **SuiteCRM**. There might be relevant details there: https://community.suitecrm.com/t/bug-v-7-13-duplicate-meeting-i-change-the-assigned-user-and-the-calendar-shows-me-double/89060/2
Author
Owner

@pgorod commented on GitHub (May 20, 2023):

Exactly which PHP 7 are you using?

@pgorod commented on GitHub (May 20, 2023): Exactly which PHP 7 are you using?
Author
Owner

@Rascott33 commented on GitHub (May 20, 2023):

7.4.29

@Rascott33 commented on GitHub (May 20, 2023): 7.4.29
Author
Owner

@Rascott33 commented on GitHub (May 22, 2023):

Investigating and discovered that in the "meetings_users" table when you duplicate a meeting and change the assigned user, two records are created in this table, one with the id of the initial user and another identical record but with the id of the new assigned user.

This is what generates duplication in the registration in the calendar. The record in the "meetings_users" table should only be 1 with the actual user assigned.

@Rascott33 commented on GitHub (May 22, 2023): Investigating and discovered that in the "meetings_users" table when you duplicate a meeting and change the assigned user, two records are created in this table, one with the id of the initial user and another identical record but with the id of the new assigned user. This is what generates duplication in the registration in the calendar. The record in the "meetings_users" table should only be 1 with the actual user assigned.
Author
Owner

@Rascott33 commented on GitHub (May 22, 2023):

I’ve managed to modify the snippet so that duplicating meetings and changing the assigned user doesn’t create double calendar entries:

Go to modules/Meetings/MeetingFormBase.php and modules/Calls/CallFormBase.php and all this code:

//add assigned user and current user if this is the first time bean is saved
if (empty($focus->id) && !empty($_REQUEST['return_module']) && $_REQUEST['return_module'] =='Meetings' && !empty($_REQUEST['return_action']) && $_REQUEST['return_action'] =='DetailView') {
//if return action is set to detail view and return module to meeting, then this is from the long form, do not add the assigned user (only the current user)
//The current user is already added to UI and we want to give the current user the option of opting out of meeting.
//add current user if the assigned to user is different than current user.
if ($current_user->id != $_POST['assigned_user_id']) {
$_POST['user_invitees'] .= ','.$_POST['assigned_user_id'].', ';
$_POST['user_invitees'] = str_replace(',,', ',', $_POST['user_invitees']);
}
} elseif (empty($focus->id)) {
//this is not from long form so add assigned and current user automatically as there is no invitee list UI.
//This call could be through an ajax call from subpanels or shortcut bar
if (!isset($_POST['user_invitees'])) {
$_POST['user_invitees'] = '';
}

        $_POST['user_invitees'] .= ','.$_POST['assigned_user_id'].', ';

        //add current user if the assigned to user is different than current user.
        if ($current_user->id != $_POST['assigned_user_id'] && $_REQUEST['module'] != "Calendar") {
            $_POST['user_invitees'] .= ','.$current_user->id.', ';
        }

        //remove any double comma's introduced during appending
        $_POST['user_invitees'] = str_replace(',,', ',', $_POST['user_invitees']);
    }

Change it for this:

//add assigned user and current user if this is the first time bean is saved
if (empty($focus->id) && !empty($_REQUEST['return_module']) && $_REQUEST['return_module'] =='Meetings' && !empty($_REQUEST['return_action']) && $_REQUEST['return_action'] =='DetailView') {
//if return action is set to detail view and return module to meeting, then this is from the long form, do not add the assigned user (only the current user)
//The current user is already added to UI and we want to give the current user the option of opting out of meeting.
//add current user if the assigned to user is different than current user.
if ($current_user->id != $_POST['assigned_user_id']) {
$_POST['user_invitees'] = str_replace(',,', ',', $_POST['assigned_user_id']);
}
} {

        //remove any double comma's introduced during appending
        $_POST['user_invitees'] = str_replace(',,', ',', $_POST['assigned_user_id']);
    }

It destroys the invitations function, but for me it is a solution since I don't use it and seeing double entries in the calendar is very annoying

@Rascott33 commented on GitHub (May 22, 2023): I’ve managed to modify the snippet so that duplicating meetings and changing the assigned user doesn’t create double calendar entries: Go to modules/Meetings/MeetingFormBase.php and modules/Calls/CallFormBase.php and all this code: //add assigned user and current user if this is the first time bean is saved if (empty($focus->id) && !empty($_REQUEST['return_module']) && $_REQUEST['return_module'] =='Meetings' && !empty($_REQUEST['return_action']) && $_REQUEST['return_action'] =='DetailView') { //if return action is set to detail view and return module to meeting, then this is from the long form, do not add the assigned user (only the current user) //The current user is already added to UI and we want to give the current user the option of opting out of meeting. //add current user if the assigned to user is different than current user. if ($current_user->id != $_POST['assigned_user_id']) { $_POST['user_invitees'] .= ','.$_POST['assigned_user_id'].', '; $_POST['user_invitees'] = str_replace(',,', ',', $_POST['user_invitees']); } } elseif (empty($focus->id)) { //this is not from long form so add assigned and current user automatically as there is no invitee list UI. //This call could be through an ajax call from subpanels or shortcut bar if (!isset($_POST['user_invitees'])) { $_POST['user_invitees'] = ''; } $_POST['user_invitees'] .= ','.$_POST['assigned_user_id'].', '; //add current user if the assigned to user is different than current user. if ($current_user->id != $_POST['assigned_user_id'] && $_REQUEST['module'] != "Calendar") { $_POST['user_invitees'] .= ','.$current_user->id.', '; } //remove any double comma's introduced during appending $_POST['user_invitees'] = str_replace(',,', ',', $_POST['user_invitees']); } Change it for this: //add assigned user and current user if this is the first time bean is saved if (empty($focus->id) && !empty($_REQUEST['return_module']) && $_REQUEST['return_module'] =='Meetings' && !empty($_REQUEST['return_action']) && $_REQUEST['return_action'] =='DetailView') { //if return action is set to detail view and return module to meeting, then this is from the long form, do not add the assigned user (only the current user) //The current user is already added to UI and we want to give the current user the option of opting out of meeting. //add current user if the assigned to user is different than current user. if ($current_user->id != $_POST['assigned_user_id']) { $_POST['user_invitees'] = str_replace(',,', ',', $_POST['assigned_user_id']); } } { //remove any double comma's introduced during appending $_POST['user_invitees'] = str_replace(',,', ',', $_POST['assigned_user_id']); } It destroys the invitations function, but for me it is a solution since I don't use it and seeing double entries in the calendar is very annoying
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/SuiteCRM-SuiteCRM#5017
No description provided.