mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-05-25 00:44:03 -04:00
Fix for adding/deleting stock locations (#242)
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
class Stock_location extends CI_Model
|
||||
{
|
||||
function exists($location_id='')
|
||||
function exists($location_name='')
|
||||
{
|
||||
$this->db->from('stock_locations');
|
||||
$this->db->where('location_id',$location_id);
|
||||
$this->db->where('location_name',$location_name);
|
||||
$query = $this->db->get();
|
||||
|
||||
return ($query->num_rows()>=1);
|
||||
@@ -84,9 +84,9 @@ class Stock_location extends CI_Model
|
||||
|
||||
function save(&$location_data,$location_id)
|
||||
{
|
||||
if (!$this->exists($location_id))
|
||||
$location_name = $location_data['location_name'];
|
||||
if (!$this->exists($location_name))
|
||||
{
|
||||
$location_name = $location_data['location_name'];
|
||||
$this->db->trans_start();
|
||||
$location_data = array('location_name'=>$location_name,'deleted'=>0);
|
||||
$this->db->insert('stock_locations',$location_data);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<?php $location_id = $location_data['location_id']; ?>
|
||||
<?php $location_name = $location_data['location_name']; ?>
|
||||
<div class="field_row clearfix" style="<?php echo $location_data['deleted'] ? 'display:none;' : 'display:block;' ?>">
|
||||
<?php echo form_label($this->lang->line('config_stock_location').' ' .++$i. ':', 'stock_location_'.$i ,array('class'=>'required wide')); ?>
|
||||
<?php echo form_label($this->lang->line('config_stock_location').' ' .++$i. ':', 'stock_location_'.$i ,array('class'=>'required wide')); ?>
|
||||
<div class='form_field'>
|
||||
<?php $form_data = array(
|
||||
'name'=>'stock_location_'.$location_id,
|
||||
|
||||
Reference in New Issue
Block a user