| @@ -72,8 +72,23 @@ | ||
| 72 | 72 | $object = WPSC_Customer::get_anonymous_customer(); |
| 73 | 73 | } |
| 74 | 74 | break; |
| 75 | 75 | |
| 76 | + case 'wpsc_ticket': | |
| 77 | + if ( $value && isset( self::$ref_classes[ $ref_class ] ) ) { | |
| 78 | + $class = self::$ref_classes[ $ref_class ]['class']; | |
| 79 | + $object = new $class( $value ); | |
| 80 | + // A ticket referenced from another record (a todo, a thread, a timer log, ...) | |
| 81 | + // may have since been archived - archived tickets are moved out of the live | |
| 82 | + // tickets table entirely, so the lookup above resolves to an empty object. Fall | |
| 83 | + // back to the archived-ticket table rather than silently returning a blank | |
| 84 | + // ticket (blank id, blank subject, blank link) to every caller. | |
| 85 | + if ( ! $object->id ) { | |
| 86 | + $object = new WPSC_Archive_Ticket( $value ); | |
| 87 | + } | |
| 88 | + } | |
| 89 | + break; | |
| 90 | + | |
| 76 | 91 | default: |
| 77 | 92 | $object = apply_filters( 'wpsc_fun_get_object', $value, $ref_class ); |
| 78 | 93 | if ( ! is_object( $object ) && isset( self::$ref_classes[ $ref_class ] ) ) { |
| 79 | 94 | $class = self::$ref_classes[ $ref_class ]['class']; |