UPDATE
Took a little more tweaking. I made two specific changes:
It was necessary to add a fourth parameter to the UniversalModule->processService method to get the ServiceMeta into the notification POST data for Adds and Edits. I consciously delayed merging that data as long as possible. (see $NotifyVars)
The old service fields data is passed along on an Edit to help the remote service know how to locate the record(s) being changed.
public function addService($package, array $vars=null, $parent_package=null, $parent_service=null, $status="pending") {
$ServiceMeta = array('package_id' => $package->id, 'module_id' => $package->module_id, );
$meta = $this->processService("add", $vars, $package, $ServiceMeta);
public function editService($package, $service, array $vars=array(), $parent_package=null, $parent_service=null) {
$ServiceMeta = array('client_id' => $service->client_id, 'service_id' => $service->id, 'package_id' => $package->id,
'module_id' => $package->module_id, 'old_service_fields' => $service->fields);
$meta = $this->processService("edit", $vars, $package, $ServiceMeta);
private function processService($type, array $vars, $package = null, $ServiceMeta) {
if (isset($vars['use_module']) && $vars['use_module'] == "true") {
$NotifyVars = array_merge($vars, $ServiceMeta);
if (!$this->sendNotification("service_notice_" . $type, $meta, $module_row_id, $NotifyVars, $package->meta)) {
$this->Input->setErrors(array('service_notice_' . $type => array('failed' => Language::_("UniversalModule.!error.service_notice_" . $type . ".failed", true))));
return;
}
}