Fix to item pic ID 0 issue (#921)

Some code clean up too.
This commit is contained in:
FrancescoUK
2016-10-19 18:47:57 +01:00
parent 0723bd2922
commit b1c36b790f
2 changed files with 9 additions and 9 deletions

View File

@@ -72,8 +72,8 @@ class Items extends Secure_Controller
{
$this->load->helper('file');
$this->load->library('image_lib');
$base_path = "uploads/item_pics/" . $pic_id ;
$images = glob ($base_path. "*");
$base_path = './uploads/item_pics/' . $pic_id;
$images = glob($base_path . '.*');
if(sizeof($images) > 0)
{
$image_path = $images[0];
@@ -190,7 +190,7 @@ class Items extends Secure_Controller
$data['selected_supplier'] = $item_info->supplier_id;
$data['logo_exists'] = $item_info->pic_id != '';
$images = glob("uploads/item_pics/" . $item_info->pic_id . ".*");
$images = glob('./uploads/item_pics/' . $item_info->pic_id . '.*');
$data['image_path'] = sizeof($images) > 0 ? base_url($images[0]) : '';
$stock_locations = $this->Stock_location->get_undeleted_all()->result_array();

View File

@@ -248,20 +248,20 @@ function get_items_manage_table_headers()
function get_item_data_row($item, $controller)
{
$CI =& get_instance();
$item_tax_info=$CI->Item_taxes->get_info($item->item_id);
$item_tax_info = $CI->Item_taxes->get_info($item->item_id);
$tax_percents = '';
foreach($item_tax_info as $tax_info)
{
$tax_percents.=to_tax_decimals($tax_info['percent']) . '%, ';
$tax_percents .= to_tax_decimals($tax_info['percent']) . '%, ';
}
// remove ', ' from last item
$tax_percents=substr($tax_percents, 0, -2);
$controller_name=strtolower(get_class($CI));
$tax_percents = substr($tax_percents, 0, -2);
$controller_name = strtolower(get_class($CI));
$image = '';
if (!empty($item->pic_id))
if ($item->pic_id != '')
{
$images = glob("uploads/item_pics/" . $item->pic_id . ".*");
$images = glob('./uploads/item_pics/' . $item->pic_id . '.*');
if (sizeof($images) > 0)
{
$image .= '<a class="rollover" href="'. base_url($images[0]) .'"><img src="'.site_url('items/pic_thumb/'.$item->pic_id).'"></a>';