Commit c0581606 authored by Kurund Jalmi's avatar Kurund Jalmi
Browse files

let's delete associated message template only if it exists

parent 2e67fc23
......@@ -39,10 +39,12 @@ function mosaicomsgtpl_civicrm_pre($op, $objectName, $objectId, &$objectRef = NU
'id' => $objectId,
]);
// delete message template
civicrm_api3('MessageTemplate', 'delete', [
'id' => $result['values'][0]['msg_tpl_id'],
]);
// delete associated message template only if it exists
if (!empty($result['values'][0]['msg_tpl_id'])) {
civicrm_api3('MessageTemplate', 'delete', [
'id' => $result['values'][0]['msg_tpl_id'],
]);
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment