/** * PL/SQLのbatch_zaiko_allを実行する * @see Ethna_ActionClass::perform() */ function perform() { try { $this->alterDao = DaoFactory::AlterSql(); $this->alterDao->BeginTransaction(); $app_name = $this->config->get('app_name'); // 更新所有项目 $this->AlterDB_21275(); $this->ModifyData_21275(); if ($app_name == 'AsOrder') { //AsOrderのみ } elseif ($app_name == 'AsCount') { //AsCountのみ } elseif ($app_name == 'AsZai') { //AsZaiのみ } $params = array('CURRENT_VERSION' => $this->config->get('code_version'), 'UID' => 'script', 'PGM' => 'batch'); DaoFactory::SystemInfo()->Update($params); $this->alterDao->CommitTransaction(); } catch (Exception $e) { $this->alterDao->AbortTransaction(); $this->logger->log(LOG_ERR, $e->getMessage()); die($e->getMessage()); } }
function validateParams($params) { $error_message_list = array(); // 現在のパスワード $UserMst = DaoFactory::UserMst(); $userData = $UserMst->UserMst_GetByUserId($params); if ($params['current_pwd'] == '') { $error_message_list['current_pwd'] = '現在のパスワードが入力されていません。'; } else { if ($userData['USER_PWD'] != $params['current_pwd_hash']) { $error_message_list['current_pwd'] = '現在のパスワードが正しくありません。'; } } // 新しいパスワード if ($params['new_pwd1'] == '') { $error_message_list['new_pwd1'] = '新しいパスワードが入力されていません。'; } // 新しいパスワード(確認用) if ($params['new_pwd2'] == '') { $error_message_list['new_pwd2'] = '新しいパスワード(確認用)が入力されていません。'; } if ($params['new_pwd1'] != $params['new_pwd2']) { $error_message_list['new_pwd1'] = '二つの新しいパスワードの入力内容が異なっています。'; } return $error_message_list; }
/** * Get a factory instance. * @return DaoFactory */ public static function getFactory() { if (!self::$_instance) { self::$_instance = new self(); } return self::$_instance; }
/** * 出庫一覧の保存が成功したかJSON形式で返す * @access public * @see Admin_ActionClass::perform() */ function perform() { set_time_limit(DEFAULT_CSV_PROCESS_TIME_LIMIT); // 初期化 $nyushutsu_date_from = $this->af->get('nyushutsu_date_from'); $nyushutsu_date_to = $this->af->get('nyushutsu_date_to'); $warehouse_id = $this->af->get('warehouse_id'); $product_id = $this->af->get('product_id'); $product_name = $this->af->get('product_name'); $denpyo_no = $this->af->get('denpyo_no'); $record_arr = $this->af->get('record_arr'); $keyword = $this->af->get('keyword'); $company_id = $this->session->get('company_id'); if (!empty($record_arr)) { $params = array('company_id' => $company_id, 'record_arr' => $record_arr); } else { $params = array('company_id' => $company_id, 'nyushutsu_date_from' => $nyushutsu_date_from, 'nyushutsu_date_to' => $nyushutsu_date_to, 'product_id' => $product_id, 'product_name' => $product_name, 'warehouse_id' => $warehouse_id, 'denpyo_no' => $denpyo_no, 'keyword' => $keyword); } try { // 一覧を取得 $sth = DaoFactory::NyushutsuD()->getStoragerecordCsvData($params); // 書き込みクラスを生成 require_once 'csv/NyushutsuDCsvWriter.class.php'; $writer = new NyushutsuDCsvWriter(); } catch (Exception $e) { // 致命的なエラーが発生 $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array('500', $e->getMessage()); } return array('csv', $writer, $sth, 'NyushutsuD' . date('YmdHis') . '.csv'); }
/** * AIカスタムマスタの保存が成功したかJSON形式で返す * @access public * @see Admin_ActionClass::perform() */ function perform() { // 初期化 $ai = $this->af->get('ai'); $ai_name = $this->af->get('ai_name'); $company_id = $this->session->get('company_id'); $data_length = $this->af->get('data_length'); $gtin14 = $this->af->get('gtin14'); $user_id = $this->session->get('user_id'); try { // 保存 $dao = DaoFactory::AicustomMst(); $dao->BeginTransaction(); // WAREHOUSE_MSTに保存 $params = array('ai_name' => $ai_name, 'data_length' => $data_length, 'UID' => $user_id, 'PGM' => get_class()); // AIカスタムコード存在チェック // $exist = $dao->Retrieve(' ai = ? AND company_id = ? ', array($ai, $company_id)); // if(!is_array($exist)){ // $def1 = $this->af->getDef('ai'); // $err_msg = array( // 'ai' => $def1['name'] ."が登録されていません", // ); // return array(400, $err_msg); // } $dao->Update($params, 'ai = ? and gtin14 = ? and company_id = ? ', array($ai, $gtin14, $company_id)); $dao->CommitTransaction(); } catch (Exception $e) { $dao->AbortTransaction(); $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array(500, $e->getMessage()); } return array('json', array('status' => '200')); }
/** * 区分マスタのデータをJSON形式で返す * @access public * @return array 区分マスタ * @see Admin_ActionClass::perform() */ public function perform() { // get request params ( search ) $buyer_cd = $this->af->get('buyer_cd'); // get session params $company_id = $this->session->get('company_id'); $user_id = $this->session->get('user_id'); try { // DAO パラメータ定義 $params = array('company_id' => $company_id, 'buyer_cd' => $buyer_cd); // 詳細を取得 $detail = DaoFactory::BuyerMst()->getBuyerByKeys($params); $detail['TERMINAL_ID'] = DaoFactory::BuyerMst()->GetAllTerminalsByBuyerCD($params); $detail['USER_ID'] = DaoFactory::BuyerMst()->GetAllUsersByBuyerCD($params); // output にセット $output['totalData'] = array(); $output['listData'] = $detail; $output['pagerData'] = array(); } catch (Exception $e) { // 致命的なエラーが発生 $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array('500', $e->getMessage()); } return array('json', $output); }
/** * バーコードパターンマスタの保存が成功したかJSON形式で返す * @access public * @see Admin_ActionClass::perform() */ function perform() { // get request params $arr_data = $this->af->get('arr_data'); // get session params $company_id = $this->session->get('company_id'); // dao $BarcodePatternMstDao = DaoFactory::BarcodePatternMst(); file_put_contents('/tmp/aszai_arr_datasss', var_export($arr_data, true)); try { // mod params // start transaction $BarcodePatternMstDao->BeginTransaction(); foreach ($arr_data as $key => $value) { // set dao params $params = array('regex' => $value, 'UID' => $user_id, 'PGM' => get_class()); // update $BarcodePatternMstDao->Update($params, ' company_id = ? and data_type = ? ', array($company_id, $key)); } // commit transaction $BarcodePatternMstDao->CommitTransaction(); } catch (Exception $e) { // rollback $BarcodePatternMstDao->AbortTransaction(); $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array(500, $e->getMessage()); } exit; }
/** * 担当マスタの削除処理 * @access public * @see Admin_ActionClass::perform() */ function perform() { // get request params $staff_id_arr = $this->af->get('staff_id_arr'); // get session params $company_id = $this->session->get('company_id'); // dao $staffDao = DaoFactory::StaffMst(); try { // begin $staffDao->BeginTransaction(); $params = array('company_id' => $company_id); if ($_REQUEST['del'] == 'all') { $staffDao->Delete(' company_id = ? ', $params); } else { foreach ($staff_id_arr as $staff_id) { $params['staff_id'] = $staff_id; $staffDao->Delete(' company_id = ? AND staff_id = ? ', $params); } } $staffDao->CommitTransaction(); } catch (Exception $e) { $staffDao->AbortTransaction(); $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array(500, $e->getMessage()); } exit; }
/** * ロールマスタの保存が成功したかJSON形式で返す * @access public * @see Admin_ActionClass::perform() */ function perform() { // get request params $role_id_arr = $this->af->get('role_id_arr'); // get session params $s_user_id = $this->session->get('user_id'); $company_id = $this->session->get('company_id'); // dao $roleDao = DaoFactory::RoleMst(); $menuRoleDDao = DaoFactory::MenuRoleD(); try { // begin $roleDao->BeginTransaction(); $params = array('company_id' => $company_id); if ($_REQUEST['del'] == 'all') { $roleDao->Delete(' company_id = ? ', $params); $menuRoleDDao->Delete(' company_id = ? ', $params); } else { foreach ($role_id_arr as $role_id) { $where = ' company_id = ? AND role_id = ? '; $params['role_id'] = $role_id; $roleDao->Delete($where, $params); $menuRoleDDao->Delete($where, $params); } } // commit $roleDao->CommitTransaction(); } catch (Exception $e) { // rollback $roleDao->AbortTransaction(); $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array(500, $e->getMessage()); } exit; }
/** * 担当マスタのデータをJSON形式で返す * @access public * @return array 担当マスタ * @see Admin_ActionClass::perform() */ public function perform() { // 初期化 $not_staff_id = $this->af->get('not_staff_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'); // pager setting $start_page = ($page - 1) * $limit + 1; $end_page = ($page - 1) * $limit + $limit; $loginData = unserialize($this->session->get('loginData')); try { // DAO パラメータ定義 $params = array('not_staff_id' => $not_staff_id, 'limit' => $limit, 'page' => $page, 'order' => $order, 'column' => $column, 'keyword' => $keyword, 'company_id' => $company_id, 'start_page' => $start_page, 'end_page' => $end_page); // 一覧を取得 $list = DaoFactory::StaffMst()->StaffMst_GetStaffListCdAndName($params)->fetchAll(); // ページ情報を設定 $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); }
/** * 店舗マスタのデータをJSON形式で返す * @access public * @return array 店舗マスタ * @see Admin_ActionClass::perform() */ public function perform() { // get request params ( search ) $warehouse_id = $this->af->get('warehouse_id'); // get session params $company_id = $this->session->get('company_id'); try { // DAO パラメータ定義 $params = array('company_id' => $company_id, 'warehouse_id' => $warehouse_id); // 詳細を取得 $detail = DaoFactory::WarehouseMst()->Retrieve(' company_id = ? AND warehouse_id = ? ', $params); unset($detail['COMPANY_ID']); // パスワードは出力させない if ('' != $detail['STOCK_MOVE_RCV_WAYS']) { $arr = explode(',', $detail['STOCK_MOVE_RCV_WAYS']); } else { $arr = array(); } foreach ($arr as $value) { $detail['STOCK_MOVE_RCV_WAYS[' . $value . ']'] = 1; } // output にセット $output['totalData'] = array(); $output['listData'] = $detail; $output['pagerData'] = array(); } catch (Exception $e) { // 致命的なエラーが発生 return array('500', $e->getMessage()); } return array('json', $output); }
/** * ユーザマスタの保存が成功したかJSON形式で返す * @access public * @see Admin_ActionClass::perform() */ function perform() { // get request params $user_id_arr = $this->af->get('user_id_arr'); // get session params $s_user_id = $this->session->get('user_id'); $company_id = $this->session->get('company_id'); // dao $userDao = DaoFactory::UserMst(); try { // begin $userDao->BeginTransaction(); if ($_REQUEST['del'] == 'all') { $userDao->Delete(' company_id = ? AND user_id <> ? ', array($company_id, $s_user_id)); } else { foreach ($user_id_arr as $user_id) { $userDao->Delete('company_id = ? AND user_id = ? ', array($company_id, $user_id)); } } // commit $userDao->CommitTransaction(); } catch (Exception $e) { // rollback $userDao->AbortTransaction(); $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array(500, $e->getMessage()); } exit; }
function perform() { //パラメータ取得 $company_id = $this->af->get('company_id'); $warehouse_id = $this->af->get('warehouse_id'); $product_id = $this->af->get('product_id'); $keyword = $this->af->get('keyword'); $bc_1 = $this->af->get('bc_1'); $ai = $this->af->get('ai'); $ai_arr = array(); if (!empty($ai)) { foreach ($ai as $key => $value) { $ai_arr[] = '%(' . str_replace('y', '_', $key) . ')' . $value . '%'; } } try { $dao = DaoFactory::ZaikoD(); $params = array('company_id' => $company_id, 'warehouse_id' => $warehouse_id, 'product_id' => $product_id, 'barcode' => $bc_1, 'keyword' => $keyword, 'ai_arr' => $ai_arr); $output = $dao->searchZaikoListForApi($params); } catch (Exception $e) { // 致命的なエラーが発生 $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array('500', $e->getMessage()); } return array('json', $output); }
/** * 担当編集のビュー名を返す * @access public * @return string ビュー名 * @see Admin_ActionClass::perform() */ function perform() { $staff_id = $this->af->get('staff_id'); $staff = DaoFactory::StaffMst()->Retrieve('staff_id = ?', array($staff_id)); $this->af->set('staff_name', $staff['STAFF_NAME']); return 'master_staff_detail_edit'; }
function perform() { //パラメータ取得 $order_id = $this->af->get('order_id'); $service_list = json_decode($this->af->get('service_list'), true); $user_id = $this->session->get('user_id'); $params = array('order_id' => $order_id, 'service_list' => $service_list, 'pgm' => get_class(), 'uid' => $user_id); try { $dao = DaoFactory::LicenseMst(); $exist = $dao->Retrieve(' ORDER_ID = ? ', array($order_id)); if (!empty($exist)) { echo 0; exit; } $dao->BeginTransaction(); $dao->insertNewLicense($params); //commit $dao->CommitTransaction(); } catch (Exception $e) { // 致命的なエラーが発生 $dao->AbortTransaction(); $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array('500', $e->getMessage()); } echo 0; exit; }
/** * 店舗マスタの保存が成功したかJSON形式で返す * @access public * @see Admin_ActionClass::perform() */ function perform() { // 初期化 $company_id = $this->session->get('company_id'); $user_id = $this->session->get('user_id'); $warehouse_id = $this->af->get('warehouse_id'); $warehouse_name = $this->af->get('warehouse_name'); $stock_move_rcv_ways = $this->af->get('stock_move_rcv_ways'); // 保存 $warehouse = DaoFactory::WarehouseMst(); try { $warehouse->BeginTransaction(); // WAREHOUSE_MSTに保存 $params = array('warehouse_name' => $warehouse_name, 'stock_move_rcv_ways' => implode(',', array_keys($stock_move_rcv_ways)), 'UID' => $user_id, 'PGM' => get_class()); // 店舗コード存在チェック $exist = $warehouse->Retrieve(' company_id = ? AND warehouse_id = ? ', array($company_id, $warehouse_id)); if (!is_array($exist)) { $def1 = $this->af->getDef('warehouse_id'); $err_msg = array('warehouse_id' => $def1['name'] . "が登録されていません"); return array(400, $err_msg); } $warehouse->Update($params, 'company_id=? AND warehouse_id=?', array($company_id, $warehouse_id)); $warehouse->CommitTransaction(); } catch (Exception $e) { $warehouse->AbortTransaction(); $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array(500, $e->getMessage()); } exit; }
/** * 端末マスタのデータをJSON形式で返す * @access public * @return array 端末マスタ * @see Admin_ActionClass::perform() */ public function perform() { // get request params ( search ) $s_terminal_id = $this->af->get('terminal_id'); // get session params $company_id = $this->session->get('company_id'); try { // DAO パラメータ定義 $params = array('company_id' => $company_id, 'terminal_id' => $s_terminal_id); // 詳細を取得 $detail = DaoFactory::TerminalMst()->Retrieve(' company_id = ? AND terminal_id = ? ', $params); $licenses = DaoFactory::TanmatsuLicense()->GetLicenseInfo($params)->fetchAll(); unset($detail['PASSWORD']); unset($detail['PASSWORD_KIGEN']); $detail['LICENSE_ID'] = array(); foreach ($licenses as $record) { $detail['LICENSE_ID'][] = array('LICENSE_ID' => $record['LICENSE_ID'], 'START_YMD' => $record['START_YMD'], 'END_YMD' => $record['END_YMD']); } // output にセット $output['totalData'] = array(); $output['listData'] = $detail; $output['pagerData'] = array(); } catch (Exception $e) { // 致命的なエラーが発生 return array('500', $e->getMessage()); } return array('json', $output); }
function authenticate() { $this->af->setApp('app_name', $this->config->get('app_name')); // ログインチェック $login = new LoginController(); if (!$login->isLogin()) { return 'login'; } // パスワード期限チェック $company_id = $this->session->get('company_id'); $user_id = $this->session->get('user_id'); $params = array('company_id' => $company_id, 'user_id' => $user_id); if (DaoFactory::UserMst()->isExpiredPassword($params)) { return 'password_list'; } // get params $kengen_flg = intval($this->session->get('kengen_flg')); // 権限取得 // 権限フラグチェック if ($kengen_flg != Konst::KENGEN_FLG_KANRI && $kengen_flg != Konst::KENGEN_FLG_SUPER) { // 管理者ユーザ(8)、スーパーユーザ(9)以外であれば弾く $login->Logout(); return 'login'; } $locale = $this->session->get('current_locale'); if ($locale) { $this->backend->getController()->setLocale($locale); } $this->setGuideModal(); $this->checkLicense(); return null; }
/** * 店舗マスタの保存が成功したか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; }
/** * 店舗マスタの保存が成功したかJSON形式で返す * @access public * @see Admin_ActionClass::perform() */ function perform() { // get request params $staff_id = $this->af->get('staff_id'); $staff_name = $this->af->get('staff_name'); // get session params $company_id = $this->session->get('company_id'); $user_id = $this->session->get('user_id'); try { $dao = DaoFactory::StaffMst(); $dao->BeginTransaction(); $staff = $dao->Retrieve('company_id = ? AND staff_id = ?', array($company_id, $staff_id)); if (empty($staff)) { $params = array('company_id' => $company_id, 'staff_id' => $staff_id, 'staff_name' => $staff_name, 'UID' => $user_id, 'PGM' => get_class()); $dao->Insert($params); } else { $params = array('staff_name' => $staff_name, 'UID' => $user_id, 'PGM' => get_class()); $dao->Update($params, 'company_id = ? AND staff_id = ?', array($company_id, $staff_id)); } // commit $dao->CommitTransaction(); } catch (Exception $e) { // rollback $dao->AbortTransaction(); $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array(500, $e->getMessage()); } exit; }
/** * GtinマスタCSVを出力 * @access public * @see Admin_ActionClass::perform() */ function perform() { set_time_limit(DEFAULT_CSV_PROCESS_TIME_LIMIT); // get request params $gtin = $this->af->get('gtin'); $bc_1 = $this->af->get('bc_1'); $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 { // 一覧を取得 $params = array('company_id' => $company_id, 'gtin' => $gtin, 'bc_1' => $bc_1, 'keyword' => $keyword, 'record_arr' => $record_arr, 'order' => $order, 'column' => $column); $sth = DaoFactory::GtinMst()->GtinMst_GetGtinList($params); // 書き込みクラスを生成 require_once 'csv/GtinMstCsvWriter.class.php'; $writer = new GtinMstCsvWriter(); } catch (Exception $e) { // 致命的なエラーが発生 return array('500', $e->getMessage()); } return array('csv', $writer, $sth, 'GtinMst.csv'); }
/** * カテゴリマスタのデータをJSON形式で返す * @access public * @return array カテゴリマスタ * @see Admin_ActionClass::perform() */ public function perform() { // get request params ( search ) $category_id = $this->af->get('category_id'); $kbn_category_name = $this->af->get('kbn_category_name'); $must_flg = $this->af->get('must_flg'); $keyword = $this->af->get('keyword'); // get request params ( pager ) $limit = $this->af->get('limit'); $page = $this->af->get('page'); $order = $this->af->get('order'); $column = $this->af->get('column'); // get session params $company_id = $this->session->get('company_id'); // pager setting $start_page = ($page - 1) * $limit + 1; $end_page = ($page - 1) * $limit + $limit; try { // DAO パラメータ定義 $params = array('category_id' => $category_id, 'kbn_category_name' => $kbn_category_name, 'must_flg' => $must_flg, 'keyword' => $keyword, 'order' => $order, 'column' => $column, 'company_id' => $company_id, 'start_page' => $start_page, 'end_page' => $end_page); // 一覧を取得 $stmt = DaoFactory::KbnCategoryMst()->KbnCategoryMst_GetList($params); $list = $stmt->fetchAll(); // ページ情報を設定 $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); }
/** * AIカスタムマスタの保存が成功したかJSON形式で返す * @access public * @see Admin_ActionClass::perform() */ function perform() { // 初期化 $record_arr = $this->af->get('record_arr'); $del = $this->af->get('del'); $company_id = $this->session->get('company_id'); $user_id = $this->session->get('user_id'); // 削除 $dao = DaoFactory::AicustomMst(); try { $dao->BeginTransaction(); $params = array(); if ($del == 'all') { $dao->Delete(' company_id = ? ', array($company_id)); } else { foreach ($record_arr as $row) { $params['ai'] = $row['ai']; $params['gtin14'] = $row['gtin14']; $params['company_id'] = $company_id; $dao->Delete(' ai = ? and gtin14= ? and company_id = ? ', $params); } } $dao->CommitTransaction(); } catch (Exception $e) { $dao->AbortTransaction(); $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array(500, $e->getMessage()); } exit; }
/** * AIカスタムマスタのデータをJSON形式で返す * @access public * @return array AIカスタムマスタ * @see Admin_ActionClass::perform() */ public function perform() { // 初期化 $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; try { $params = array('company_id' => $company_id, 'limit' => $limit, 'page' => $page, 'order' => $order, 'column' => $column, 'keyword' => $keyword, 'start_page' => $start_page, 'end_page' => $end_page); // 一覧を取得 $list = DaoFactory::AicustomMst()->getAicustomList($params); // ページ情報を設定 $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); }
/** * ロケーションマスタ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'); }
/** * ロケーションマスタの保存が成功したか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; }
/** * 端末マスタの保存が成功したかJSON形式で返す * @access public * @see Admin_ActionClass::perform() */ function perform() { // get request params $category_id_arr = $this->af->get('category_id_arr'); $status_flg = $this->af->get('status_flg'); // get session params $company_id = $this->session->get('company_id'); $s_user_id = $this->session->get('user_id'); // dao $Dao = DaoFactory::KbnCategoryMst(); try { // begin $Dao->BeginTransaction(); foreach ($category_id_arr as $category_id) { // set params $params = array('IS_MUST' => $status_flg, 'UID' => $s_user_id, 'PGM' => get_class()); // dao update $Dao->Update($params, ' COMPANY_ID = ? AND CATEGORY_ID = ? ', array($company_id, $category_id)); } // commit $Dao->CommitTransaction(); } catch (Exception $e) { // rollback $Dao->AbortTransaction(); $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array(500, $e->getMessage()); } exit; }
/** * Execute */ function execute(&$observer) { // MOD RJH // Modification Date: 11-18-2004 // Add Tracking for all actions into a single consolidated Admin Log Table // using Sushi to store data // TRACKING // ID (pk), USER ID(ind), IP(ind), datetime, request page, POST/GET if( preg_match("/^10./",$_SERVER['REMOTE_ADDR']) ) return TRUE; $GAIALOG = serialize(array($_GET,$_POST)); $dao_logging =& DaoFactory::create('admincpanellog.insert'); $dao_logging->setUserId(SC::get('userdata.user_id')); $dao_logging->setUsername(SC::get('userdata.username')); $dao_logging->setUserIp($_SERVER['REMOTE_ADDR']); $dao_logging->setDatetime(SC::get('board_config.time_now')); $dao_logging->setRequestFilename($_SERVER['SCRIPT_NAME']); $dao_logging->setRequestData($GAIALOG); $rs =& $dao_logging->execute(); if(!$rs->isSuccess()) { $observer->set('error.message', "Unable to connect to the database, please try again later."); $observer->set('error.title', 'Database Error'); $observer->set('error.code', GENERAL_ERROR); $observer->set('error.line', __LINE__); $observer->set('error.file', __FILE__); return FALSE; } return TRUE; }
public function checkPrivileges($o) { $username=SC::get('userdata.username'); if(in_array($username,array('dev1','dev2'))){ return true; } $uid=SC::get('userdata.user_id'); $dao=DaoFactory::create('user/admin'); $dao->select('count(user_id) as count'); $dao->byUserId($uid); $rs=$dao->execute(); if(!$rs->isSuccess()) { throw new CircuitDatabaseException('query admin users failed', $rs); } $count=$rs->fetchrow(DB_ASSOC); if($count['count']==0) { $message = "This page is not available under the current configuration, or "; $message .= "you are not authorized to view this page."; $o->set('error.message', $message); $o->set('error.code', GENERAL_MESSAGE); $o->set('error.title', 'Not Authorized'); $o->set('error.line', __LINE__); $o->set('error.file', __FILE__); return false; } return true; }
/** * 担当マスタの保存が成功したかJSON形式で返す * @access public * @see Admin_ActionClass::perform() */ function perform() { // get request params $staff_id = $this->af->get('staff_id'); $staff_name = $this->af->get('staff_name'); // get session params $company_id = $this->session->get('company_id'); $user_id = $this->session->get('user_id'); // dao $staffDao = DaoFactory::StaffMst(); try { // begin $staffDao->BeginTransaction(); // pk 重複チェック $exist = $staffDao->Retrieve(' company_id = ? AND staff_id = ? ', array($company_id, $staff_id)); if (!empty($exist)) { $def1 = $this->af->getDef('staff_id'); $err_msg = array('staff_id' => "入力された" . $def1['name'] . "は既に登録されています"); return array(400, $err_msg); } // set params $params = array('staff_id' => $staff_id, 'staff_name' => $staff_name, 'company_id' => $company_id, 'UID' => $user_id, 'PGM' => get_class()); // dao insert $staffDao->Insert($params); // commit $staffDao->CommitTransaction(); } catch (Exception $e) { $staffDao->AbortTransaction(); $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array(500, $e->getMessage()); } exit; }