| 84 | | // Get the original approval status |
|---|
| 85 | | $metadata =& midcom_helper_metadata::retrieve($identificator); |
|---|
| | 85 | // Get the original approval status and update metadata reference |
|---|
| | 86 | $metadata =& midcom_helper_metadata::retrieve($object); |
|---|
| | 87 | if (!is_object($metadata)) |
|---|
| | 88 | { |
|---|
| | 89 | $_MIDCOM->generate_error(MIDCOM_ERRCRIT, "Couild not fetch metadata for object {$guid}"); |
|---|
| | 90 | // This will exit |
|---|
| | 91 | } |
|---|
| | 92 | // Make sure this is reference to correct direction (from our point of view) |
|---|
| | 93 | $metadata->object =& $object; |
|---|
| | 94 | |
|---|
| | 95 | // Get the approval status if metadata object is available |
|---|
| 105 | | { |
|---|
| 106 | | // Some heuristics for the update logging |
|---|
| 107 | | if ( isset($object->title) |
|---|
| 108 | | && $object->title) |
|---|
| 109 | | { |
|---|
| 110 | | $title = $object->title; |
|---|
| 111 | | } |
|---|
| 112 | | elseif (isset($object->extra) |
|---|
| 113 | | && $object->extra) |
|---|
| 114 | | { |
|---|
| 115 | | $title = $object->extra; |
|---|
| 116 | | } |
|---|
| 117 | | elseif (isset($object->name) |
|---|
| 118 | | && $object->name) |
|---|
| 119 | | { |
|---|
| 120 | | $title = $object->name; |
|---|
| 121 | | } |
|---|
| 122 | | else |
|---|
| 123 | | { |
|---|
| 124 | | $title = sprintf("{$object->guid} %s", get_class($object)); |
|---|
| 125 | | } |
|---|
| 126 | | |
|---|
| | 114 | $metadata->set() calls update *AND* updates the metadata cache correctly, thus we use that in stead of raw update |
|---|
| | 115 | */ |
|---|
| | 116 | if (!$metadata->set('score', $object->metadata->score)) |
|---|
| | 117 | { |
|---|
| | 118 | // Show an error message on an update failure |
|---|
| | 119 | $_MIDCOM->load_library('midcom.helper.reflector'); |
|---|
| | 120 | $reflector =& midcom_helper_reflector::get($object); |
|---|
| | 121 | $title = $reflector->get_class_label() . ' ' . $reflector->get_object_label($object); |
|---|