What do you have in modules/cases/logic_hooks.php ?

I am working on a bug and I would need some help.

I need to check my Case module hooks, but I don’t have the “standard” file available in Github, because it’s only created by the installer during installation.

Can somebody please tell me where the hook file is created by the installer (probably modules/Cases/logic_hooks.php) and paste here (inside “code” tags) the correct contents of that file?

A couple of things:

  1. Please state your version. I believe anything 7.7.* will be good for me to check my hooks.

  2. Please do a quick check that your Case Updates threaded are working before sending me the file. Just add a threaded update to any case and see it gets saved correctly. I want to compare a working installation to my own system that has this bug.

Thanks in advance!

Hi pgr,

in fresh install 7.7.4, i have

  • no logic_hook in modules/cases
  • in custom/modules/cases … just a logic_hook with this :

 $hook_version = 1; 
$hook_array = Array(); 
// position, file, function 
$hook_array['before_save'] = Array(); 
$hook_array['before_save'][] = Array(1, 'Cases push feed', 'modules/Cases/SugarFeeds/CaseFeed.php','CaseFeed', 'pushFeed'); 

Regards

1 Like

First of all, thank you, your help is much appreciated!

That is weird, I can’t seem to find the right place and way of firing this hook:

$hook_array['before_save'][] = Array(10, 'Save case updates', 'modules/AOP_Case_Updates/CaseUpdatesHook.php','CaseUpdateUpdatesHook', 'saveUpdate');

I had that hook in my old system (in custom/modules/Cases/logic_hooks.php, before the AOP modules where moved from there), and I believe I messed things up when I migrated and was copying things manually from my custom directory.

But there should be something equivalent in the new systems… or else the Case updates wouldn’t work for anybody. Can you find that hook definition anywhere in your working system?

Thanks

Instead of:

Have you tried:

$hook_array['before_save'][] = Array(10, 'Save case updates', 'modules/AOP_Case_Updates/CaseUpdatesHook.php','CaseUpdatesHook', 'saveUpdate');

(I have changed: CaseUpdateUpdatesHook to CaseUpdatesHook (removed the first “Update”): I searched it and haven’t found it in the files. Maybe that is the problem.)

Alternatively, is the file still in the custom folder?

I hope this helps.

1 Like

@amariussi I apologize, that was just an error copy-pasting from the Linux terminal which broke my line in two. I have the correct value as ‘CaseUpdatesHook’ in my system.

No, the file with the code is not in the custom folder, and I think it’s not supposed to be there (https://github.com/salesagility/SuiteCRM/tree/master/custom).

I do have the file in ‘modules/AOP_Case_Updates/CaseUpdatesHook.php’, I just can’t get the hook registered correctly for some reason or conflict that I don’t understand. That’s why I’m trying to find exactly how that hook is registered in working systems.

Thanks for your help!

To answer my own question, the file should be in custom/modules/Cases/logic_hooks.php and define a SaveUpdate hook properly.

This solves the bug. Everything is explained here:
https://github.com/salesagility/SuiteCRM/issues/2237