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

AOP. The case creation email is not being sent when relating a case to a contact #9502

Open
txinparta opened this issue Feb 9, 2022 · 2 comments
Labels
Area: Cases Issues & PRs related to all things regarding cases Area: Emails Issues & PRs related to all things regarding emails & email module Priority:Important Issues & PRs that are important; broken functions, errors - there are workarounds Type:Bug Bugs within the core SuiteCRM codebase

Comments

@txinparta
Copy link

Issue

When a contact is associated to a case, the contact receives case creation, update and case closure emails.
If you do it the other way around, to associate a case to a contact, the inital email is not created.

Expected Behavior

In switchboards, for example, the person who attends the customer usually searches if the contact exists in the application. If it exists, it opens the contact and creates the case in the cases submodule.

The customer should receive the message of the new case opened in his/her name.

Actual Behavior

If we associate a case to a contact the initial email is not sent.

Steps to Reproduce

  1. Prerequisites: an outgoing email and AOP (Advanced Open Portal) enabled.
  2. Load the detail view of a contact.
  3. Go to cases submodule.
  4. Create a new case from cases submodule - or associate an existing one - .
  5. The case is associated with the contact but the initial email is not sent.

Context

Your Environment

  • SuiteCRM Version used: 7.12.1
  • Browser name and version: Firefox Developer Edition Versión 98.02b (64-bit), Chromium version 90.0.4430.212 (Developer Build)
  • Environment name and version: Distrib 10.6.0-MariaDB, PHP 7.3.17
  • Operating System and version: Debian 10 (buster)
@johnM2401 johnM2401 added the Area: Cases Issues & PRs related to all things regarding cases label Feb 11, 2022
@johnM2401
Copy link
Contributor

johnM2401 commented Feb 11, 2022

Hey there,

I'm only able to partly replicate your issues, I'm afraid

On relating an Existing Contact to an Existing Case, The email does seem to send out, on my end.

Do you have all the relevant Email Templates selected in Admin->"Case Module Settings" ?
image

Do you get any errors in the SuiteCRM.log or your PHP error log?


However, I am able to replicate the issue of Cases not sending Emails on creation, so I'll mark this as a "Bug"

@johnM2401 johnM2401 added Area: Emails Issues & PRs related to all things regarding emails & email module Priority:Important Issues & PRs that are important; broken functions, errors - there are workarounds Type:Bug Bugs within the core SuiteCRM codebase labels Feb 11, 2022
@txinparta
Copy link
Author

Hey John,

My mistake, It's true :), relating an existing Case to a Contact sends Ok the email.
(I have Email Templates selected in Admin->"Case Module Settings" )

The problems is as you say only on creation. Since the Case is new "$bean->fetched_row" is false in creationNotify function.

modules/AOP_Case_Updates/CaseUpdatesHook.php:

    /**
     * Called by the after_relationship_save logic hook in cases. Checks to ensure this is a
     * contact being added and sends an email to that contact.
     *
     * @param $bean
     * @param $event
     * @param $arguments
     */
    public function creationNotify($bean, $event, $arguments)
    {
        if (isset($_REQUEST['module']) && $_REQUEST['module'] === 'Import') {
            return;
        }
        if ($arguments['module'] !== 'Cases' || $arguments['related_module'] !== 'Contacts') {
            return;
        }
        if (!$bean->fetched_row) {
            return;    //  ------------ on new cases it falls in this if
        }
        if (!empty($arguments['related_bean'])) {
            $contact = $arguments['related_bean'];
        } else {
            $contact = BeanFactory::getBean('Contacts', $arguments['related_id']);
        }
        $this->sendCreationEmail($bean, $contact);
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Cases Issues & PRs related to all things regarding cases Area: Emails Issues & PRs related to all things regarding emails & email module Priority:Important Issues & PRs that are important; broken functions, errors - there are workarounds Type:Bug Bugs within the core SuiteCRM codebase
Projects
None yet
Development

No branches or pull requests

2 participants