Esempio n. 1
0
 /**
  * 店舗マスタの保存が成功したかJSON形式で返す
  * @access public
  * @see Admin_ActionClass::perform()
  */
 function perform()
 {
     // 初期化
     $company_id = $this->session->get('company_id');
     $user_id = $this->session->get('user_id');
     $shiiresaki_cd = $this->af->get('shiiresaki_cd');
     $shiiresaki_mei = $this->af->get('shiiresaki_mei');
     $shiiresaki_mei_kana = $this->af->get('shiiresaki_mei_kana');
     $shiiresaki_kbn = $this->af->get('shiiresaki_kbn');
     // 保存
     $shiiresaki = DaoFactory::ShiiresakiMst();
     try {
         $shiiresaki->BeginTransaction();
         // WAREHOUSE_MSTに保存
         $params = array('company_id' => $company_id, 'shiiresaki_cd' => $shiiresaki_cd, 'shiiresaki_mei' => $shiiresaki_mei, 'shiiresaki_mei_kana' => $shiiresaki_mei_kana, 'shiiresaki_kbn' => $shiiresaki_kbn, 'UID' => $user_id, 'PGM' => get_class());
         // 店舗コード重複チェック
         $exist = $shiiresaki->Retrieve(' company_id = ? and shiiresaki_cd = ?  ', array($company_id, $shiiresaki_cd));
         if (!empty($exist)) {
             $def1 = $this->af->getDef('shiiresaki_cd');
             $err_msg = array('shiiresaki_cd' => "入力された" . $def1['name'] . "は既に登録されています");
             return array(400, $err_msg);
         }
         $shiiresaki->Insert($params);
         $shiiresaki->CommitTransaction();
     } catch (Exception $e) {
         $shiiresaki->AbortTransaction();
         $this->logger->log(LOG_DEBUG, $e->getTraceAsString());
         return array(500, $e->getMessage());
     }
     exit;
 }
Esempio n. 2
0
 /**
  * 仕入先マスタの保存が成功したかJSON形式で返す
  * @access public
  * @see Admin_ActionClass::perform()
  */
 function perform()
 {
     // 初期化
     $company_id = $this->session->get('company_id');
     $user_id = $this->session->get('user_id');
     $shiiresaki_cd_arr = $this->af->get('shiiresaki_cd_arr');
     // 削除
     $shiiresaki = DaoFactory::ShiiresakiMst();
     try {
         $shiiresaki->BeginTransaction();
         $params = array('company_id' => $company_id);
         if ($_REQUEST['del'] == 'all') {
             $shiiresaki->Delete(' company_id = ? ', $params);
         } else {
             foreach ($shiiresaki_cd_arr as $shiiresaki_cd) {
                 $params['shiiresaki_cd'] = $shiiresaki_cd;
                 $shiiresaki->Delete(' company_id = ? and  shiiresaki_cd = ? ', $params);
             }
         }
         $shiiresaki->CommitTransaction();
     } catch (Exception $e) {
         $shiiresaki->AbortTransaction();
         $this->logger->log(LOG_DEBUG, $e->getTraceAsString());
         return array(500, $e->getMessage());
     }
     exit;
 }
Esempio n. 3
0
 /**
  * 仕入先マスタのデータをJSON形式で返す
  * @access public
  * @return array 店舗マスタ
  * @see Admin_ActionClass::perform()
  */
 public function perform()
 {
     // 初期化
     //$not_warehouse_id = $this->af->get('not_warehouse_id');
     $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
     $keyword = $this->af->get('keyword');
     $company_id = $this->session->get('company_id');
     $start_page = ($page - 1) * $limit + 1;
     $end_page = ($page - 1) * $limit + $limit;
     //$not_warehouse_id = explode(',', urldecode($not_warehouse_id));
     try {
         $params = array('limit' => $limit, 'page' => $page, 'order' => $order, 'column' => $column, 'keyword' => $keyword, 'company_id' => $company_id, 'start_page' => $start_page, 'end_page' => $end_page);
         // 一覧を取得
         $list = DaoFactory::ShiiresakiMst()->shiiresakiMst_GetShiiresakiList($params)->fetchAll();
         // ページ情報を設定
         $pager = array('result_page' => $page, 'result_start_num' => ($page - 1) * $limit + 1, 'result_end_num' => ($page - 1) * $limit + $limit, '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);
 }
Esempio n. 4
0
 /**
  * リクエストの仕入先がDBに登録されているかチェックする
  * @param string $name フォーム名
  */
 public function check_shiiresaki_cd_exists($name)
 {
     // 仕入先を取得
     $params = array('shiiresaki_cd' => $this->form_vars['shiiresaki_cd']);
     $shiiresaki = DaoFactory::ShiiresakiMst()->Retrieve(' shiiresaki_cd = ? ', $params);
     // 仕入先が存在しない場合
     if (empty($shiiresaki)) {
         $this->ae->add($name, "入力された{form}は登録されていません", E_FORM_INVALIDCHAR);
     }
 }
Esempio n. 5
0
 /**
  * 仕入先マスタのデータをJSON形式で返す
  * @access public
  * @return array 店舗マスタ
  * @see Admin_ActionClass::perform()
  */
 public function perform()
 {
     // get request params ( search )
     $shiiresaki_cd = $this->af->get('shiiresaki_cd');
     // get session params
     $company_id = $this->session->get('company_id');
     try {
         // DAO パラメータ定義
         $params = array('company_id' => $company_id, 'shiiresaki_cd' => $shiiresaki_cd);
         // 詳細を取得
         $detail = DaoFactory::ShiiresakiMst()->Retrieve(' company_id = ? AND  shiiresaki_cd = ? ', $params);
         unset($detail['COMPANY_ID']);
         // パスワードは出力させない
         // output にセット
         $output['totalData'] = array();
         $output['listData'] = $detail;
         $output['pagerData'] = array();
     } catch (Exception $e) {
         // 致命的なエラーが発生
         return array('500', $e->getMessage());
     }
     return array('json', $output);
 }