예제 #1
0
 /**
  * ロケーションマスタCSVを出力
  * @access public
  * @see Admin_ActionClass::perform()
  */
 function perform()
 {
     set_time_limit(DEFAULT_CSV_PROCESS_TIME_LIMIT);
     // get request params
     $location_id = $this->af->get('location_id');
     $location_name = $this->af->get('location_name');
     $keyword = $this->af->get('keyword');
     $record_arr = $this->af->get('record_arr');
     // get session params
     $company_id = $this->session->get('company_id');
     // pager setting
     $order = $this->af->get('order');
     // default asc
     $column = $this->af->get('column');
     // default warehouse_id
     try {
         // 一覧を取得
         if (!empty($record_arr)) {
             $params = array('company_id' => $company_id, 'record_arr' => $record_arr, 'csv' => true);
         } else {
             $params = array('company_id' => $company_id, 'location_id' => $location_id, 'location_name' => $location_name, 'keyword' => $keyword, 'order' => $order, 'column' => $column, 'csv' => true);
         }
         $dao = DaoFactory::LocationMst();
         $sth = $dao->getLocationList($params);
         // 書き込みクラスを生成
         require_once 'csv/LocationMstCsvWriter.class.php';
         $writer = new LocationMstCsvWriter();
     } catch (Exception $e) {
         // 致命的なエラーが発生
         return array('500', $e->getMessage());
     }
     return array('csv', $writer, $sth, 'LocationMst' . date('YmdHis') . '.csv');
 }
예제 #2
0
 /**
  * ロケーションマスタの保存が成功したかJSON形式で返す
  * @access public
  * @see Admin_ActionClass::perform()
  */
 function perform()
 {
     // get request params
     $location_id = $this->af->get('location_id');
     $location_name = $this->af->get('location_name');
     $warehouse_id = $this->af->get('warehouse_id');
     // get session params
     $company_id = $this->session->get('company_id');
     $user_id = $this->session->get('user_id');
     // dao
     $locationDao = DaoFactory::LocationMst();
     try {
         // begin
         $locationDao->BeginTransaction();
         // cd exists
         $params = array('company_id' => $company_id, 'location_id' => $location_id, 'location_name' => $location_name, 'warehouse_id' => $warehouse_id, 'UID' => $user_id, 'PGM' => get_class());
         $locationDao->Insert($params);
         // commit
         $locationDao->CommitTransaction();
     } catch (Exception $e) {
         $locationDao->AbortTransaction();
         $this->logger->log(LOG_DEBUG, $e->getTraceAsString());
         return array(500, $e->getMessage());
     }
     exit;
 }
예제 #3
0
 /**
  * ロケーションマスタの保存が成功したかJSON形式で返す
  * @access public
  * @see Admin_ActionClass::perform()
  */
 function perform()
 {
     // get request params
     $record_arr = $this->af->get('record_arr');
     // get session params
     $company_id = $this->session->get('company_id');
     // dao
     $locationDao = DaoFactory::LocationMst();
     try {
         // begin
         $params = array('company_id' => $company_id);
         $locationDao->BeginTransaction();
         if ($_REQUEST['del'] == 'all') {
             $locationDao->Delete(' company_id = ? ', $params);
         } else {
             foreach ($record_arr as $key => $pk) {
                 $params['location_id'] = $pk['location_id'];
                 $locationDao->Delete(' company_id = ? AND location_id = ? ', $params);
             }
         }
         $locationDao->CommitTransaction();
     } catch (Exception $e) {
         $locationDao->AbortTransaction();
         $this->logger->log(LOG_DEBUG, $e->getTraceAsString());
         return array(500, $e->getMessage());
     }
     exit;
 }
예제 #4
0
 /**
  * リクエストのロケーションIDがDBに登録されていないことをチェックする
  * @param string $name フォーム名
  */
 public function check_location_not_exists($name)
 {
     // 商品を取得
     $params = array('company_id' => $this->backend->getSession()->get('company_id'), 'location_id' => $this->form_vars['location_id']);
     $location = DaoFactory::LocationMst()->Retrieve(' company_id = ? AND location_id = ? ', $params);
     // 商品が存在する場合
     if (!empty($location)) {
         $this->ae->add($name, "入力された{form}は既に登録されています", E_FORM_INVALIDCHAR);
     }
 }
예제 #5
0
 /**
  * ロケーションマスタのデータをJSON形式で返す
  * @access public
  * @return array 区分マスタ
  * @see Admin_ActionClass::perform()
  */
 public function perform()
 {
     // get request params ( search )
     $location_id = $this->af->get('location_id');
     // get session params
     $company_id = $this->session->get('company_id');
     try {
         // DAO パラメータ定義
         $params = array('company_id' => $company_id, 'location_id' => $location_id);
         // 詳細を取得
         $detail = DaoFactory::LocationMst()->getLocationForEdit($params);
         // output にセット
         $output['totalData'] = array();
         $output['listData'] = $detail;
         $output['pagerData'] = array();
     } catch (Exception $e) {
         // 致命的なエラーが発生
         return array('500', $e->getMessage());
     }
     return array('json', $output);
 }
예제 #6
0
 /**
  * 区分マスタのデータをJSON形式で返す
  * @access public
  * @return array 区分マスタ
  * @see Admin_ActionClass::perform()
  */
 public function perform()
 {
     // get request params
     $location_id = $this->af->get('location_id');
     $location_name = $this->af->get('location_name');
     $warehouse_id_arr = $this->af->get('warehouse_id_arr');
     $keyword = $this->af->get('keyword');
     // get session params
     $company_id = $this->session->get('company_id');
     // pager setting
     $limit = $this->af->get('limit');
     // default 50
     $page = $this->af->get('page');
     // default 1
     $order = $this->af->get('order');
     // default asc
     $column = $this->af->get('column');
     // default warehouse_id
     $start_page = ($page - 1) * $limit + 1;
     $end_page = ($page - 1) * $limit + $limit;
     try {
         // DAO パラメータ定義
         $params = array('location_id' => $location_id, 'location_name' => $location_name, 'warehouse_id' => $warehouse_id_arr, 'keyword' => $keyword, 'limit' => $limit, 'page' => $page, 'order' => $order, 'column' => $column, 'company_id' => $company_id, 'start_page' => $start_page, 'end_page' => $end_page);
         // 一覧を取得
         $list = DaoFactory::LocationMst()->getLocationList($params);
         // ページ情報を設定
         $pager = array('result_page' => $page, 'result_start_num' => $start_page, 'result_end_num' => $end_page, 'result_all_count' => count($list) ? $list[0]['FOUND_ROWS'] : 0, 'result_get_count' => count($list), 'result_limit' => $limit);
         // output にセット
         $output['totalData'] = array();
         $output['listData'] = $list;
         $output['pagerData'] = $pager;
     } catch (Exception $e) {
         // 致命的なエラーが発生
         return array('500', $e->getMessage());
     }
     return array('json', $output);
 }