sugarcrm / SugarRepairsModule

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid "Action" or "failure" message when running 'emailAddresses' repair with "test" flag set

crazytonyi opened this issue · comments

Currently, it you run this action in test mode, you will get something like:

[Sugar Repairs][51280fc5-36bd-8c59-d91e-570214a4d9dd][EmailAddress][Change] -> Will update email address relationship as primary :: id->20a74fee-a851-153f-a3b6-56f8d09fc1f3
[Sugar Repairs][51280fc5-36bd-8c59-d91e-570214a4d9dd][EmailAddress][Action] -> Failed to update primary email address for Prospects->1172c83d-8add-1f05-c30e-56f8d06d5f83. This will have to be fixed manually.

For every record found. This is a false positive that is caused by the repair script having:

            $results = $this->setPrimaryAddress($id);
            if (!$results==true) {
                $this->logAction("-> Failed to update primary email address for {$bean_module}->{$bean_id}. This will have to be fixed manaully.");
            }

Where setPrimaryAddress is checking if instance is in test mode and, if it is, returns false instead of attempting the update. I suggest we change this to...

            $results = $this->setPrimaryAddress($id);
            if (!$results==true && !$this->isTesting) {
                $this->logAction("-> Failed to update primary email address for {$bean_module}->{$bean_id}. This will have to be fixed manually.");
            }

Otherwise, it gives them impression that the update was attempted and failed and that an action is required. This could be especially problematic if we intend to pass along the test log output to clients.