| @@ 248-273 (lines=26) @@ | ||
| 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 | } |
|
| @@ 1235-1260 (lines=26) @@ | ||
| 1232 | $success = 1; |
|
| 1233 | $TKT = EEM_Ticket::instance(); |
|
| 1234 | // checkboxes? |
|
| 1235 | if (! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
| 1236 | // if array has more than one element then success message should be plural |
|
| 1237 | $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
| 1238 | // cycle thru the boxes |
|
| 1239 | while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
| 1240 | if ($trash) { |
|
| 1241 | if (! $TKT->delete_by_ID($TKT_ID)) { |
|
| 1242 | $success = 0; |
|
| 1243 | } |
|
| 1244 | } else { |
|
| 1245 | if (! $TKT->restore_by_ID($TKT_ID)) { |
|
| 1246 | $success = 0; |
|
| 1247 | } |
|
| 1248 | } |
|
| 1249 | } |
|
| 1250 | } else { |
|
| 1251 | // grab single id and trash |
|
| 1252 | $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
| 1253 | if ($trash) { |
|
| 1254 | if (! $TKT->delete_by_ID($TKT_ID)) { |
|
| 1255 | $success = 0; |
|
| 1256 | } |
|
| 1257 | } else { |
|
| 1258 | if (! $TKT->restore_by_ID($TKT_ID)) { |
|
| 1259 | $success = 0; |
|
| 1260 | } |
|
| 1261 | } |
|
| 1262 | } |
|
| 1263 | $action_desc = $trash ? 'moved to the trash' : 'restored'; |
|