| @@ 239-264 (lines=26) @@ | ||
| 236 | $TKT = EEM_Ticket::instance(); |
|
| 237 | ||
| 238 | //checkboxes? |
|
| 239 | if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) { |
|
| 240 | //if array has more than one element then success message should be plural |
|
| 241 | $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
| 242 | ||
| 243 | //cycle thru the boxes |
|
| 244 | while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
|
| 245 | if ( $trash ) { |
|
| 246 | if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
| 247 | $success = 0; |
|
| 248 | } else { |
|
| 249 | if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
| 250 | $success = 0; |
|
| 251 | } |
|
| 252 | } |
|
| 253 | } else { |
|
| 254 | //grab single id and trash |
|
| 255 | $TKT_ID = absint( $this->_req_data['TKT_ID'] ); |
|
| 256 | ||
| 257 | if ( $trash ) { |
|
| 258 | if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
| 259 | $success = 0; |
|
| 260 | } else { |
|
| 261 | if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
| 262 | $success = 0; |
|
| 263 | } |
|
| 264 | } |
|
| 265 | ||
| 266 | $action_desc = $trash ? 'moved to the trash' : 'restored'; |
|
| 267 | $this->_redirect_after_action( $success, 'Tickets', $action_desc, array() ); |
|
| @@ 1099-1124 (lines=26) @@ | ||
| 1096 | $TKT = EEM_Ticket::instance(); |
|
| 1097 | ||
| 1098 | //checkboxes? |
|
| 1099 | if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) { |
|
| 1100 | //if array has more than one element then success message should be plural |
|
| 1101 | $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
| 1102 | ||
| 1103 | //cycle thru the boxes |
|
| 1104 | while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
|
| 1105 | if ( $trash ) { |
|
| 1106 | if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
| 1107 | $success = 0; |
|
| 1108 | } else { |
|
| 1109 | if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
| 1110 | $success = 0; |
|
| 1111 | } |
|
| 1112 | } |
|
| 1113 | } else { |
|
| 1114 | //grab single id and trash |
|
| 1115 | $TKT_ID = absint( $this->_req_data['TKT_ID'] ); |
|
| 1116 | ||
| 1117 | if ( $trash ) { |
|
| 1118 | if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
| 1119 | $success = 0; |
|
| 1120 | } else { |
|
| 1121 | if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
| 1122 | $success = 0; |
|
| 1123 | } |
|
| 1124 | } |
|
| 1125 | ||
| 1126 | $action_desc = $trash ? 'moved to the trash' : 'restored'; |
|
| 1127 | $query_args = array( |
|