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

How best to debug a missing case number in case notification email. #8113

Closed
iba-jsykes opened this issue Oct 22, 2019 · 10 comments
Closed

How best to debug a missing case number in case notification email. #8113

iba-jsykes opened this issue Oct 22, 2019 · 10 comments
Labels
Area: Emails:Campaigns Issues & PRs related to email campaigns Area: Emails Issues & PRs related to all things regarding emails & email module Status:Requires Updates Issues & PRs which requires input or update from the author Status: Stale For issues & PRs that have had no activity Type: Bug Bugs within the core SuiteCRM codebase

Comments

@iba-jsykes
Copy link

iba-jsykes commented Oct 22, 2019

Issue

I have a new install of 7.11.7 and my case number is missing from my notification email.

In Case.php, i have the following writing to the log :

public function set_notification_body($xtpl, $case)
 {
     global $app_list_strings;
     $GLOBALS['log']->debug("debugging case");
     $GLOBALS['log']->debug(print_r($case->case_number, true));
     $xtpl->assign('CASE_NUMBER', $case->case_number);
     $xtpl->assign('CASE_SUBJECT', $case->name);
     $xtpl->assign(
         'CASE_PRIORITY',
         (isset($case->priority) ? $app_list_strings['case_priority_dom'][$case->priority] : '')
     );
     $xtpl->assign('CASE_STATUS', (isset($case->status) ? $app_list_strings['case_status_dom'][$case->status] : ''));
     $xtpl->assign('CASE_DESCRIPTION', $case->description);

     return $xtpl;
 }

which outputs :

Tue Oct 22 11:44:41 2019 [1528][1][DEBUG] debugging case
Tue Oct 22 11:44:41 2019 [1528][1][DEBUG]

$case->name works just fine.

I've added CASE_NUMBER to my email template, which obviously is blank.

The database entry for this email HAS the case number.
The log file and the actual email do not.

Expected Behavior

This was working in a previous version.

Steps to Reproduce

1.Set up custom email template
2.Try to add CASE_NUMBER
3.Create a case using the UI and assign it.
4.User gets email, case number is blank.

Your Environment

  • SuiteCRM Version used: 7.11.7
  • Browser name and version (e.g. Chrome Version 51.0.2704.63 (64-bit)): Chrome latest
  • Environment name and version (e.g. MySQL, PHP 7):mysql 5.7, PHP 7.1
  • Operating System and version (e.g Ubuntu 16.04): Windows Server 2019
@pgorod
Copy link
Contributor

pgorod commented Oct 23, 2019

How do you generate the notification? Please update your "steps to reproduce" to include that, not just the template creation. After having the template ready, you do something to trigger the notification, what is it, exactly?

@Dillon-Brown Dillon-Brown added the Status:Requires Updates Issues & PRs which requires input or update from the author label Oct 23, 2019
@iba-jsykes
Copy link
Author

Updated. Just using the UI to create a case.

@pgorod
Copy link
Contributor

pgorod commented Oct 23, 2019

And where did you set up the email template? Do you mean you edited en_us.notify_template.html? If so, please paste the relevant section here, I want to try this exactly the same way you're trying. Thanks.

@iba-jsykes
Copy link
Author

iba-jsykes commented Oct 23, 2019

Yes, I put my modified template in /custom/include/language/en_us.notify_template.html

line 68 starts the case :

<!-- BEGIN: Case_Subject -->
<p>SuiteCRM Case - {CASE_SUBJECT} {CASE_NUMBER}</p>
<!-- END: Case_Subject -->
<!-- BEGIN: Case -->
<p><b>{ASSIGNER}</b> has assigned a Case to <b>{ASSIGNED_USER}</b>.</p>
<p>
Subject: {CASE_SUBJECT}<br/>
Priority: {CASE_PRIORITY}<br/>
Status: {CASE_STATUS}<br/>
Description: {CASE_DESCRIPTION}
Case : {CASE_NUMBER}
</p>
<p>You may <a href={URL}>review this Case</a>.</p>
<!-- END: Case -->

Also, thanks for taking a look at this.

@iba-jsykes
Copy link
Author

Was this not reproducible?

@pgorod
Copy link
Contributor

pgorod commented Nov 15, 2019

I'm sorry, I just didn't have time to look at this again.

I'm thinking that a possible problem is if the number doesn't yet exist, because the case is being created.

If you send the email at a later event (for example, changing the assignment of a Case that has already been created and saved earlier), does the CASE_NUMBER appear?

@iba-jsykes
Copy link
Author

No problem at all.

Yes, secondary assignment works, and the template has access to the number, this is only an issue on case creation. I was eventually able to hit a breakpoint on the object being passed to Smarty and it's definitely not there. Version 6.x of this functionality worked without issue, but I believe custom notification template handling changed a lot since then.

@pgorod
Copy link
Contributor

pgorod commented Nov 16, 2019

Ok, that's interesting. So when you hit that breakpoint, if you look at the call stack and see where it's being called from, in one of the levels above you should find the place were eventually (further ahead) the case number gets assigned. Maybe it's possible to move that to a point earlier in the code, so you have it available in the notification?

(or, saying it the other way around, maybe the notification can be moved to a later point)

@samus-aran samus-aran added Type: Bug Bugs within the core SuiteCRM codebase Area: Emails Issues & PRs related to all things regarding emails & email module Area: Emails:Campaigns Issues & PRs related to email campaigns labels Sep 7, 2021
@serhiisamko091184 serhiisamko091184 added the Status: Stale For issues & PRs that have had no activity label Mar 14, 2024
@serhiisamko091184
Copy link
Contributor

Hello, @iba-jsykes

The issue has been marked as stale because there has been no recent activity. It will be closed if no further activity occurs.
Thanks for your contributions.

Regards,
Serhii

@serhiisamko091184
Copy link
Contributor

Hey @iba-jsykes

Closing this issue due to inactivity.
Thank you.

Regards,
Serhii

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Emails:Campaigns Issues & PRs related to email campaigns Area: Emails Issues & PRs related to all things regarding emails & email module Status:Requires Updates Issues & PRs which requires input or update from the author Status: Stale For issues & PRs that have had no activity Type: Bug Bugs within the core SuiteCRM codebase
Projects
None yet
Development

No branches or pull requests

5 participants