default batch done in controller
This commit is contained in:
parent
0b3ac942dc
commit
a8262fd2c8
@ -19,6 +19,8 @@ class Batch_Controller extends REST_Controller {
|
||||
$this->methods['addBatchDetails_delete']['limit'] = 50; // 50 requests per hour per user/key
|
||||
$this->methods['getBatchDetails_post']['limit'] = 500; // 50 requests per hour per user/key
|
||||
$this->methods['updateBatchDetails_post']['limit'] = 500;// 500 requests per hour per user/key
|
||||
$this->methods['updateBatchDefault_post']['limit'] = 500;// 500 requests per hour per user/key
|
||||
|
||||
// load the model
|
||||
$this->load->model('Batch_model', 'batch_model');
|
||||
|
||||
@ -120,6 +122,39 @@ class Batch_Controller extends REST_Controller {
|
||||
|
||||
|
||||
}
|
||||
/*
|
||||
* update the default batch details
|
||||
* created by kms
|
||||
* */
|
||||
public function updateBatchDefault_post()
|
||||
{
|
||||
$now = new DateTime();
|
||||
$now->setTimezone(new DateTimezone('Asia/Kolkata'));
|
||||
$details['BatchCode'] = $this->post('batchCode');
|
||||
$details['UniversityID'] = $this->post('universityID');
|
||||
$details['IsDefault'] = $this->post('IsDefault');
|
||||
$details['UpdatedBy'] = $this->post('updatedBy');
|
||||
$details['UpdatedOn'] = $now->format("Y-m-d H:i:s");
|
||||
|
||||
$updateDetails = $this->batch_model->updateDefaultBatch($details);// Check if the users data store contains users (in case the database result returns NULL)
|
||||
|
||||
if ($updateDetails)
|
||||
{
|
||||
$updateDetails['status'] = REST_Controller::HTTP_OK;
|
||||
// Set the response and exit
|
||||
$this->response($updateDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set the response and exit
|
||||
$this->response([
|
||||
'message' => 'Something went wrong.please try again!',
|
||||
'status' => REST_Controller::HTTP_NOT_FOUND
|
||||
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user