mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-03-05 23:58:02 -05:00
This corrects an error in a previous migration (2.3_to_2.3.1.sql) that assigned a null value to receivings_stock and sales_stock for the location_id when it should have been the location_id of that particular stock_location.
31 lines
734 B
PHP
31 lines
734 B
PHP
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
class Migration_fix_empty_reports extends CI_Migration
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
public function up()
|
|
{
|
|
$this->db->select('location_name');
|
|
$this->db->from('stock_locations');
|
|
$this->db->where('location_id', 1);
|
|
$this->db->limit(1);
|
|
$location_name = $this->db->get()->result_array()[0]['location_name'];
|
|
|
|
$location_name = str_replace(' ', '_', $location_name);
|
|
$this->db->set('location_id',1);
|
|
$this->db->where('permission_id','receivings_' . $location_name);
|
|
$this->db->or_where('permission_id', 'sales_' . $location_name);
|
|
$this->db->update('permissions');
|
|
}
|
|
|
|
public function down()
|
|
{
|
|
|
|
}
|
|
}
|
|
?>
|