Merge branch 'labels_paper_types' of github.com:AndreasK79/Cloudlog into labels_paper_types
这个提交包含在:
		
						当前提交
						bc62c97c65
					
				
					共有  5 个文件被更改,包括 50 次插入 和 14 次删除
				
			
		|  | @ -118,8 +118,12 @@ class Labels extends CI_Controller { | ||||||
| 		else | 		else | ||||||
| 		{ | 		{ | ||||||
| 			$this->load->model('labels_model'); | 			$this->load->model('labels_model'); | ||||||
|  | 			try { | ||||||
| 				$this->labels_model->addPaper(); | 				$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'); | 			redirect('labels'); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  | @ -379,7 +383,13 @@ class Labels extends CI_Controller { | ||||||
| 
 | 
 | ||||||
| 	public function updatePaper($id) { | 	public function updatePaper($id) { | ||||||
| 		$this->load->model('labels_model'); | 		$this->load->model('labels_model'); | ||||||
|  | 		try { | ||||||
| 			$this->labels_model->updatePaper($id); | 			$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.'); | 		$this->session->set_flashdata('message', 'Paper was saved.'); | ||||||
| 		redirect('labels'); | 		redirect('labels'); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -58,10 +58,10 @@ class Migration_create_label_paper_types_table extends CI_Migration { | ||||||
| 
 | 
 | ||||||
| 			$this->dbforge->create_table('paper_types'); | 			$this->dbforge->create_table('paper_types'); | ||||||
| 			$this->db->query("CREATE UNIQUE INDEX idx_paper_types_user_id_paper_name ON paper_types (user_id, paper_name) ALGORITHM DEFAULT LOCK DEFAULT;"); | 			$this->db->query("CREATE UNIQUE INDEX idx_paper_types_user_id_paper_name ON paper_types (user_id, paper_name) ALGORITHM DEFAULT LOCK DEFAULT;"); | ||||||
| 			$this->db->query("insert into paper_types (id,user_id,paper_name,metric,width,orientation,height) values ('1','1','A4','mm','210.000','P','297.000');"); | 			$this->db->query("insert into paper_types (id,user_id,paper_name,metric,width,orientation,height) values ('1','-1','A4','mm','210.000','P','297.000');"); | ||||||
| 			$this->db->query("insert into paper_types (id,user_id,paper_name,metric,width,orientation,height) values ('2','1','A5','mm','148.000','P','210.000');"); | 			$this->db->query("insert into paper_types (id,user_id,paper_name,metric,width,orientation,height) values ('2','-1','A5','mm','148.000','P','210.000');"); | ||||||
| 			$this->db->query("insert into paper_types (id,user_id,paper_name,metric,width,orientation,height) values ('3','1','letter','mm','215.900','P','279.400');"); | 			$this->db->query("insert into paper_types (id,user_id,paper_name,metric,width,orientation,height) values ('3','-1','letter','mm','215.900','P','279.400');"); | ||||||
| 			$this->db->query("insert ignore paper_types (user_id,paper_name,metric,width,orientation,height) SELECT u.user_id, pt.paper_name, pt.metric, pt.width, pt.orientation,pt.height FROM paper_types pt inner join users u where pt.id<4;"); | 			$this->db->query("insert ignore paper_types (user_id,paper_name,metric,width,orientation,height) SELECT u.user_id, pt.paper_name, pt.metric, pt.width, pt.orientation,pt.height FROM paper_types pt inner join users u where pt.user_id = -1;"); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -173,7 +173,7 @@ class User_Model extends CI_Model { | ||||||
| 			$this->db->insert($this->config->item('auth_table'), $data); | 			$this->db->insert($this->config->item('auth_table'), $data); | ||||||
| 			$insert_id = $this->db->insert_id(); | 			$insert_id = $this->db->insert_id(); | ||||||
| 			$this->db->query("insert into bandxuser (bandid, userid, active, cq, dok, dxcc, iota, pota, sig, sota, uscounties, was, wwff, vucc) select bands.id, " . $insert_id . ", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 from bands;"); | 			$this->db->query("insert into bandxuser (bandid, userid, active, cq, dok, dxcc, iota, pota, sig, sota, uscounties, was, wwff, vucc) select bands.id, " . $insert_id . ", 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 from bands;"); | ||||||
| 			$this->db->query("insert into paper_types (user_id,paper_name,metric,width,orientation,height) SELECT ".$insert_id.", paper_name, metric, width, orientation,height FROM paper_types where id<4;"); | 			$this->db->query("insert into paper_types (user_id,paper_name,metric,width,orientation,height) SELECT ".$insert_id.", paper_name, metric, width, orientation,height FROM paper_types where user_id = -1;"); | ||||||
| 			return OK; | 			return OK; | ||||||
| 		} else { | 		} else { | ||||||
| 			return EUSERNAMEEXISTS; | 			return EUSERNAMEEXISTS; | ||||||
|  |  | ||||||
|  | @ -3,8 +3,22 @@ | ||||||
| <br> | <br> | ||||||
| 	<?php if($this->session->flashdata('message')) { ?>
 | 	<?php if($this->session->flashdata('message')) { ?>
 | ||||||
| 		<!-- Display Message --> | 		<!-- Display Message --> | ||||||
| 		<div class="alert-message error"> | 		<div class="alert alert-success" role="alert"> | ||||||
| 		  <p><?php echo $this->session->flashdata('message'); ?></p>
 | 			<?php echo $this->session->flashdata('message'); ?>
 | ||||||
|  | 		</div> | ||||||
|  | 	<?php } ?>
 | ||||||
|  | 
 | ||||||
|  | 	<?php if($this->session->flashdata('error')) { ?>
 | ||||||
|  | 		<!-- Display Message --> | ||||||
|  | 		<div class="alert alert-danger" role="alert"> | ||||||
|  | 			<?php echo $this->session->flashdata('error'); ?>
 | ||||||
|  | 		</div> | ||||||
|  | 	<?php } ?>
 | ||||||
|  | 
 | ||||||
|  | 	<?php if($this->session->flashdata('warning')) { ?>
 | ||||||
|  | 		<!-- Display Message --> | ||||||
|  | 		<div class="alert alert-warning" role="alert"> | ||||||
|  | 			<?php echo $this->session->flashdata('warning'); ?>
 | ||||||
| 		</div> | 		</div> | ||||||
| 	<?php } ?>
 | 	<?php } ?>
 | ||||||
| 
 | 
 | ||||||
|  | @ -33,8 +47,6 @@ | ||||||
| 					</div> | 					</div> | ||||||
|   			</div> |   			</div> | ||||||
| 
 | 
 | ||||||
|     			 |  | ||||||
| 
 |  | ||||||
| 			<div class="form-group row"> | 			<div class="form-group row"> | ||||||
|     			<label class="col-sm-2 col-form-label" for="width">Width of paper</label> |     			<label class="col-sm-2 col-form-label" for="width">Width of paper</label> | ||||||
| 			    <div class="col-sm-4"> | 			    <div class="col-sm-4"> | ||||||
|  |  | ||||||
|  | @ -3,8 +3,22 @@ | ||||||
| <br> | <br> | ||||||
| 	<?php if($this->session->flashdata('message')) { ?>
 | 	<?php if($this->session->flashdata('message')) { ?>
 | ||||||
| 		<!-- Display Message --> | 		<!-- Display Message --> | ||||||
| 		<div class="alert-message error"> | 		<div class="alert alert-success" role="alert"> | ||||||
| 		  <p><?php echo $this->session->flashdata('message'); ?></p>
 | 			<?php echo $this->session->flashdata('message'); ?>
 | ||||||
|  | 		</div> | ||||||
|  | 	<?php } ?>
 | ||||||
|  | 
 | ||||||
|  | 	<?php if($this->session->flashdata('error')) { ?>
 | ||||||
|  | 		<!-- Display Message --> | ||||||
|  | 		<div class="alert alert-danger" role="alert"> | ||||||
|  | 			<?php echo $this->session->flashdata('error'); ?>
 | ||||||
|  | 		</div> | ||||||
|  | 	<?php } ?>
 | ||||||
|  | 
 | ||||||
|  | 	<?php if($this->session->flashdata('warning')) { ?>
 | ||||||
|  | 		<!-- Display Message --> | ||||||
|  | 		<div class="alert alert-warning" role="alert"> | ||||||
|  | 			<?php echo $this->session->flashdata('warning'); ?>
 | ||||||
| 		</div> | 		</div> | ||||||
| 	<?php } ?>
 | 	<?php } ?>
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		正在加载…
	
		在新工单中引用