| @@ 248-277 (lines=30) @@ | ||
| 245 | $TKT = EEM_Ticket::instance(); |
|
| 246 | ||
| 247 | // checkboxes? |
|
| 248 | if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
| 249 | // if array has more than one element then success message should be plural |
|
| 250 | $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
| 251 | ||
| 252 | // cycle thru the boxes |
|
| 253 | while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
| 254 | if ($trash) { |
|
| 255 | if (! $TKT->delete_by_ID($TKT_ID)) { |
|
| 256 | $success = 0; |
|
| 257 | } |
|
| 258 | } else { |
|
| 259 | if (! $TKT->restore_by_ID($TKT_ID)) { |
|
| 260 | $success = 0; |
|
| 261 | } |
|
| 262 | } |
|
| 263 | } |
|
| 264 | } else { |
|
| 265 | // grab single id and trash |
|
| 266 | $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
| 267 | ||
| 268 | if ($trash) { |
|
| 269 | if (! $TKT->delete_by_ID($TKT_ID)) { |
|
| 270 | $success = 0; |
|
| 271 | } |
|
| 272 | } else { |
|
| 273 | if (! $TKT->restore_by_ID($TKT_ID)) { |
|
| 274 | $success = 0; |
|
| 275 | } |
|
| 276 | } |
|
| 277 | } |
|
| 278 | ||
| 279 | $action_desc = $trash ? 'moved to the trash' : 'restored'; |
|
| 280 | $this->_redirect_after_action($success, 'Tickets', $action_desc, array()); |
|
| @@ 1205-1232 (lines=28) @@ | ||
| 1202 | $success = 1; |
|
| 1203 | $TKT = EEM_Ticket::instance(); |
|
| 1204 | // checkboxes? |
|
| 1205 | if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
| 1206 | // if array has more than one element then success message should be plural |
|
| 1207 | $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
| 1208 | // cycle thru the boxes |
|
| 1209 | while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
| 1210 | if ($trash) { |
|
| 1211 | if (! $TKT->delete_by_ID($TKT_ID)) { |
|
| 1212 | $success = 0; |
|
| 1213 | } |
|
| 1214 | } else { |
|
| 1215 | if (! $TKT->restore_by_ID($TKT_ID)) { |
|
| 1216 | $success = 0; |
|
| 1217 | } |
|
| 1218 | } |
|
| 1219 | } |
|
| 1220 | } else { |
|
| 1221 | // grab single id and trash |
|
| 1222 | $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
| 1223 | if ($trash) { |
|
| 1224 | if (! $TKT->delete_by_ID($TKT_ID)) { |
|
| 1225 | $success = 0; |
|
| 1226 | } |
|
| 1227 | } else { |
|
| 1228 | if (! $TKT->restore_by_ID($TKT_ID)) { |
|
| 1229 | $success = 0; |
|
| 1230 | } |
|
| 1231 | } |
|
| 1232 | } |
|
| 1233 | $action_desc = $trash ? 'moved to the trash' : 'restored'; |
|
| 1234 | $query_args = array( |
|
| 1235 | 'action' => 'ticket_list_table', |
|