<commit_before><?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Setup_cclassification_vpricing extends Root_Controller
{
    private  $message;
    public $permissions;
    public $controller_url;
    public function __construct()
    {
        parent::__construct();
        $this->message="";
        $this->permissions=User_helper::get_permission('Setup_cclassification_vpricing');
        $this->controller_url='setup_cclassification_vpricing';
    }

    public function index($action="list",$id=0)
    {
        if($action=="list")
        {
            $this->system_list($id);
        }
        elseif($action=="get_items")
        {
            $this->system_get_items();
        }
        elseif($action=="add")
        {
            $this->system_add();
        }
        elseif($action=="edit")
        {
            $this->system_edit($id);
        }
        elseif($action=="save")
        {
            $this->system_save();
        }
        else
        {
            $this->system_list($id);
        }
    }

    private function system_list()
    {
        if(isset($this->permissions['view'])&&($this->permissions['view']==1))
        {
            $data['title']="Varieties Price";
            $ajax['status']=true;
            $ajax['system_content'][]=array("id"=>"#system_content","html"=>$this->load->view($this->controller_url."/list",$data,true));
            if($this->message)
            {
                $ajax['system_message']=$this->message;
            }
            $ajax['system_page_url']=site_url($this->controller_url);
            $this->jsonReturn($ajax);
        }
        else
        {
            $ajax['status']=false;
            $ajax['system_message']=$this->lang->line("YOU_DONT_HAVE_ACCESS");
            $this->jsonReturn($ajax);
        }

    }
    private function system_get_items()
    {
        $this->db->from($this->config->item('table_setup_classification_variety_price').' vp');
        $this->db->select('vp.id,vp.price,vp.price_net');
        $this->db->select('v.id variety_id,v.name variety_name');
        $this->db->select('crop.name crop_name');
        $this->db->select('type.name crop_type_name,type.id type_id');
        $this->db->select('pack.name pack_size_name,pack.id pack_id');

        $this->db->join($this->config->item('table_setup_classification_varieties').' v','v.id = vp.variety_id','INNER');
        $this->db->join($this->config->item('table_setup_classification_crop_types').' type','type.id = v.crop_type_id','INNER');
        $this->db->join($this->config->item('table_setup_classification_crops').' crop','crop.id = type.crop_id','INNER');
        $this->db->join($this->config->item('table_setup_classification_vpack_size').' pack','pack.id = vp.pack_size_id','INNER');
        $this->db->where('vp.revision',1);
        //$this->db->order_by('vp.id DESC');

        $items=$this->db->get()->result_array();
        foreach($items as &$item)
        {
            //str_pad($item['id'],$this->config->item('system_po_no_length'),'0',STR_PAD_LEFT);
            $item['bar_code']=str_pad($item['type_id'],3,0,STR_PAD_LEFT).str_pad($item['variety_id'],3,0,STR_PAD_LEFT).str_pad($item['pack_id'],2,0,STR_PAD_LEFT);
        }
        $this->jsonReturn($items);

    }

    private function system_add()
    {
        if(isset($this->permissions['add'])&&($this->permissions['add']==1))<commit_msg>barcode changed<commit_after><?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Setup_cclassification_vpricing extends Root_Controller
{
    private  $message;
    public $permissions;
    public $controller_url;
    public function __construct()
    {
        parent::__construct();
        $this->message="";
        $this->permissions=User_helper::get_permission('Setup_cclassification_vpricing');
        $this->controller_url='setup_cclassification_vpricing';
    }

    public function index($action="list",$id=0)
    {
        if($action=="list")
        {
            $this->system_list($id);
        }
        elseif($action=="get_items")
        {
            $this->system_get_items();
        }
        elseif($action=="add")
        {
            $this->system_add();
        }
        elseif($action=="edit")
        {
            $this->system_edit($id);
        }
        elseif($action=="save")
        {
            $this->system_save();
        }
        else
        {
            $this->system_list($id);
        }
    }

    private function system_list()
    {
        if(isset($this->permissions['view'])&&($this->permissions['view']==1))
        {
            $data['title']="Varieties Price";
            $ajax['status']=true;
            $ajax['system_content'][]=array("id"=>"#system_content","html"=>$this->load->view($this->controller_url."/list",$data,true));
            if($this->message)
            {
                $ajax['system_message']=$this->message;
            }
            $ajax['system_page_url']=site_url($this->controller_url);
            $this->jsonReturn($ajax);
        }
        else
        {
            $ajax['status']=false;
            $ajax['system_message']=$this->lang->line("YOU_DONT_HAVE_ACCESS");
            $this->jsonReturn($ajax);
        }

    }
    private function system_get_items()
    {
        $this->db->from($this->config->item('table_setup_classification_variety_price').' vp');
        $this->db->select('vp.id,vp.price,vp.price_net');
        $this->db->select('v.id variety_id,v.name variety_name');
        $this->db->select('crop.name crop_name,crop.id crop_id');
        $this->db->select('type.name crop_type_name,type.id type_id');
        $this->db->select('pack.name pack_size_name,pack.id pack_id');

        $this->db->join($this->config->item('table_setup_classification_varieties').' v','v.id = vp.variety_id','INNER');
        $this->db->join($this->config->item('table_setup_classification_crop_types').' type','type.id = v.crop_type_id','INNER');
        $this->db->join($this->config->item('table_setup_classification_crops').' crop','crop.id = type.crop_id','INNER');
        $this->db->join($this->config->item('table_setup_classification_vpack_size').' pack','pack.id = vp.pack_size_id','INNER');
        $this->db->where('vp.revision',1);
        //$this->db->order_by('vp.id DESC');

        $items=$this->db->get()->result_array();
        foreach($items as &$item)
        {
            //str_pad($item['id'],$this->config->item('system_po_no_length'),'0',STR_PAD_LEFT);
            $item['bar_code']=str_pad($item['crop_id'],2,0,STR_PAD_LEFT).str_pad($item['variety_id'],4,0,STR_PAD_LEFT).str_pad($item['pack_id'],2,0,STR_PAD_LEFT);
        }
        $this->jsonReturn($items);

    }

    private function system_add()
    {
        if(isset($this->permissions['add'])&&($this->permissions['add']==1))
{'fraction_non_alphanumeric': 0.19189268008165647, 'fraction_numerical': 0.0032079323417906094, 'mean_word_length': 2.723669923995657, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 133, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6984750', 'n_tokens_mistral': 2220, 'n_tokens_neox': 2181, 'n_words': 199}