|
@@ 351-354 (lines=4) @@
|
| 348 |
|
*/ |
| 349 |
|
public function deleteCampaign(SS_HTTPRequest $request) { |
| 350 |
|
$id = $request->param('ID'); |
| 351 |
|
if (!$id || !is_numeric($id)) { |
| 352 |
|
return (new SS_HTTPResponse(json_encode(['status' => 'error']), 400)) |
| 353 |
|
->addHeader('Content-Type', 'application/json'); |
| 354 |
|
} |
| 355 |
|
|
| 356 |
|
$record = ChangeSet::get()->byID($id); |
| 357 |
|
if(!$record) { |
|
@@ 357-360 (lines=4) @@
|
| 354 |
|
} |
| 355 |
|
|
| 356 |
|
$record = ChangeSet::get()->byID($id); |
| 357 |
|
if(!$record) { |
| 358 |
|
return (new SS_HTTPResponse(json_encode(['status' => 'error']), 404)) |
| 359 |
|
->addHeader('Content-Type', 'application/json'); |
| 360 |
|
} |
| 361 |
|
|
| 362 |
|
if(!$record->canDelete()) { |
| 363 |
|
return (new SS_HTTPResponse(json_encode(['status' => 'error']), 401)) |
|
@@ 362-365 (lines=4) @@
|
| 359 |
|
->addHeader('Content-Type', 'application/json'); |
| 360 |
|
} |
| 361 |
|
|
| 362 |
|
if(!$record->canDelete()) { |
| 363 |
|
return (new SS_HTTPResponse(json_encode(['status' => 'error']), 401)) |
| 364 |
|
->addHeader('Content-Type', 'application/json'); |
| 365 |
|
} |
| 366 |
|
|
| 367 |
|
$record->delete(); |
| 368 |
|
|