mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Added error message when saving or editing a paper type with duplicate name
This commit is contained in:
@@ -118,8 +118,12 @@ class Labels extends CI_Controller {
|
||||
else
|
||||
{
|
||||
$this->load->model('labels_model');
|
||||
$this->labels_model->addPaper();
|
||||
|
||||
try {
|
||||
$this->labels_model->addPaper();
|
||||
} catch (\Throwable $th) {
|
||||
$this->session->set_flashdata('error', 'Your paper could not be saved. Remember that it can\'t have the same name as existing paper types.');
|
||||
redirect('labels/createpaper');
|
||||
}
|
||||
redirect('labels');
|
||||
}
|
||||
|
||||
@@ -379,7 +383,13 @@ class Labels extends CI_Controller {
|
||||
|
||||
public function updatePaper($id) {
|
||||
$this->load->model('labels_model');
|
||||
$this->labels_model->updatePaper($id);
|
||||
try {
|
||||
$this->labels_model->updatePaper($id);
|
||||
} catch (\Throwable $th) {
|
||||
$this->session->set_flashdata('error', 'Your paper could not be saved. Remember that it can\'t have the same name as existing paper types.');
|
||||
$cleanid = $this->security->xss_clean($id);
|
||||
redirect('labels/editpaper/'.$cleanid);
|
||||
}
|
||||
$this->session->set_flashdata('message', 'Paper was saved.');
|
||||
redirect('labels');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user