| 83 | | // Get the original approval status |
|---|
| 84 | | $metadata =& midcom_helper_metadata::retrieve($guid); |
|---|
| | 84 | // Get the original approval status and update metadata reference |
|---|
| | 85 | $metadata =& midcom_helper_metadata::retrieve($object); |
|---|
| | 86 | if (!is_object($metadata)) |
|---|
| | 87 | { |
|---|
| | 88 | $_MIDCOM->generate_error(MIDCOM_ERRCRIT, "Couild not fetch metadata for object {$guid}"); |
|---|
| | 89 | // This will exit |
|---|
| | 90 | } |
|---|
| | 91 | // Make sure this is reference to correct direction (from our point of view) |
|---|
| | 92 | $metadata->object =& $object; |
|---|
| | 93 | |
|---|
| | 94 | // Get the approval status if metadata object is available |
|---|
| 104 | | { |
|---|
| 105 | | // Some heuristics for the update logging |
|---|
| 106 | | if ( isset($object->title) |
|---|
| 107 | | && $object->title) |
|---|
| 108 | | { |
|---|
| 109 | | $title = $object->title; |
|---|
| 110 | | } |
|---|
| 111 | | elseif (isset($object->extra) |
|---|
| 112 | | && $object->extra) |
|---|
| 113 | | { |
|---|
| 114 | | $title = $object->extra; |
|---|
| 115 | | } |
|---|
| 116 | | elseif (isset($object->name) |
|---|
| 117 | | && $object->name) |
|---|
| 118 | | { |
|---|
| 119 | | $title = $object->name; |
|---|
| 120 | | } |
|---|
| 121 | | else |
|---|
| 122 | | { |
|---|
| 123 | | $title = sprintf("{$object->guid} %s", get_class($object)); |
|---|
| 124 | | } |
|---|
| 125 | | |
|---|
| | 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); |
|---|