/** * 端末マスタのデータを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); }
/** * 端末マスタの保存が成功したかJSON形式で返す * @access public * @see Admin_ActionClass::perform() */ function perform() { // get request params $terminal_id_arr = $this->af->get('terminal_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 $staffDao = DaoFactory::TerminalMst(); try { // begin $staffDao->BeginTransaction(); foreach ($terminal_id_arr as $terminal_id) { // set params $params = array('status_flg' => $status_flg, 'UID' => $s_user_id, 'PGM' => get_class()); // dao update $staffDao->Update($params, ' company_id = ? AND terminal_id = ? ', array($company_id, $terminal_id)); } // commit $staffDao->CommitTransaction(); } catch (Exception $e) { // rollback $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 $terminal_id_arr = $this->af->get('terminal_id_arr'); // get session params $company_id = $this->session->get('company_id'); // dao $terminalDao = DaoFactory::TerminalMst(); $terminalUdidMDao = DaoFactory::TerminalUdidMst(); try { // begin $terminalDao->BeginTransaction(); $params = array('company_id' => $company_id); if ($_REQUEST['del'] == 'all') { $terminalDao->Delete(' company_id = ? ', $params); } else { foreach ($terminal_id_arr as $terminal_id) { $params['terminal_id'] = $terminal_id; $terminalDao->Delete(' company_id = ? AND terminal_id = ? ', $params); $terminalUdidMDao->Delete(' company_id = ? AND terminal_id = ? ', $params); } } $terminalDao->CommitTransaction(); } catch (Exception $e) { $terminalDao->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 $terminal_id_arr = $this->af->get('terminal_id_arr'); // get session params $company_id = $this->session->get('company_id'); $s_user_id = $this->session->get('user_id'); // dao $staffDao = DaoFactory::TerminalMst(); try { // begin $staffDao->BeginTransaction(); if (empty($terminal_id_arr)) { $params = array('UUID' => '', 'UID' => $s_user_id, 'PGM' => get_class()); $staffDao->Update($params, ' company_id = ? ', array($company_id)); } else { foreach ($terminal_id_arr as $terminal_id) { // set params $params = array('UUID' => '', 'UID' => $s_user_id, 'PGM' => get_class()); // dao clear $staffDao->Update($params, ' company_id = ? AND terminal_id = ? ', array($company_id, $terminal_id)); } } // commit $staffDao->CommitTransaction(); $output['result'] = 0; return array('json', $output); } catch (Exception $e) { // rollback $staffDao->AbortTransaction(); $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array(500, $e->getMessage()); } exit; }
/** * リクエストのsettingIDがDBに登録されているかチェックする * @param string $name フォーム名 */ public function check_terminal_id_exists($name) { if ($this->form_vars['terminal_id'] == '') { return; } // パラメータを取得 $params = array('company_id' => $this->backend->getSession()->get('company_id'), 'terminal_id' => $this->form_vars['terminal_id']); $ret = DaoFactory::TerminalMst()->Retrieve(' company_id = ? AND terminal_id = ? ', $params); // 存在しない場合 if (empty($ret)) { $this->ae->add($name, "入力された{form}は登録されていません", E_FORM_INVALIDCHAR); } }
/** * 端末マスタのデータをJSON形式で返す * @access public * @return array 担当マスタ * @see Admin_ActionClass::perform() */ public function perform() { // 初期化 $keyword = $this->af->get('terminal_keyword'); $company_id = $this->session->get('company_id'); try { $params = array('keyword' => $keyword, 'company_id' => $company_id); // 一覧を取得 $list = DaoFactory::TerminalMst()->TerminalMst_GetTerminalList($params, true)->fetchAll(); // ページ情報を設定 $pager = array('result_page' => '', 'result_start_num' => '', 'result_end_num' => '', 'result_all_count' => count($list) ? $list[0]['FOUND_ROWS'] : 0, 'result_get_count' => count($list), 'result_limit' => ''); // output にセット $output['totalData'] = array(); $output['listData'] = $list; $output['pagerData'] = $pager; } catch (Exception $e) { // 致命的なエラーが発生 $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); 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 ) $terminal_id = $this->af->get('terminal_id'); $terminal_name = $this->af->get('terminal_name'); $s_yukou_flg = $this->af->get('yukou_flg'); $keyword = $this->af->get('keyword'); $warehouse_id = $this->af->get('warehouse_id'); if ($s_yukou_flg == 9) { $s_yukou_flg = ''; } // 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('terminal_id' => $terminal_id, 'terminal_name' => $terminal_name, 'yukou_flg' => $s_yukou_flg, 'keyword' => $keyword, 'warehouse_id' => $warehouse_id, 'order' => $order, 'column' => $column, 'company_id' => $company_id, 'start_page' => $start_page, 'end_page' => $end_page); // 一覧を取得 $stmt = DaoFactory::TerminalMst()->TerminalMst_GetTerminalList($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); }
/** * 担当マスタのデータをJSON形式で返す * @access public * @return array 担当マスタのデータを返す * @see Admin_ActionClass::perform() */ public function perform() { // 初期化 $company_id = $this->session->get('company_id'); $not_terminal_id = $this->af->get('not_terminal_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 shop_cd $keyword = $this->af->get('keyword'); // pager setting $start_page = ($page - 1) * $limit + 1; $end_page = ($page - 1) * $limit + $limit; $terminalGroup = DaoFactory::TerminalMst(); if ($not_terminal_id != "") { $not_terminal_id = explode(',', urldecode($not_terminal_id)); } try { // DAO パラメータ定義 $params = array('company_id' => $company_id, 'not_terminal_id' => $not_terminal_id, 'limit' => $limit, 'page' => $page, 'order' => $order, 'column' => $column, 'keyword' => $keyword, 'start_page' => $start_page, 'end_page' => $end_page); // 一覧を取得 $list = $terminalGroup->TerminalMst_GetAll($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 * @see Admin_ActionClass::perform() */ function perform() { // get request params $terminal_id = $this->af->get('terminal_id'); $terminal_name = $this->af->get('terminal_name'); $password = $this->af->get('password'); $warehouse_id = $this->af->get('warehouse_id'); // get session params $company_id = $this->session->get('company_id'); $s_user_id = $this->session->get('user_id'); $licenses = $this->af->get('license_id'); //add $oya_terminal_id = null; if (!is_null($oya_terminal_flg) && $mode_kbn == 1) { $oya_terminal_id = $terminal_id; } // dao $terminalDao = DaoFactory::TerminalMst(); try { // begin $terminalDao->BeginTransaction(); // // $wheresql = 'company_id=? ORDER BY UPD_DATE desc'; // $params = array( // 'company_id' => $company_id, // ); // $license = DaoFactory::LicenseD()->Retrieve($wheresql, $params); // if (DaoFactory::TerminalMst()->Column('COUNT(*)', 'company_id=?', $params) >= $license['MAX_TERMINAL']) { // return array('400', array('terminal_id' => '端末数が申込まれた端末数に達しています。新たに端末を追加するには削除するか端末数を増やす申請を行ってください')); // } // set params $params = array('terminal_id' => $terminal_id, 'terminal_name' => $terminal_name, 'status_flg' => '1', 'password' => md5($password), 'company_id' => $company_id, 'UID' => $s_user_id, 'PGM' => get_class()); //terminal insert $terminalDao->Insert($params); $TanmatsuLicenseDao = Daofactory::TanmatsuLicense(); //add $licenseDao = DaoFactory::LicenseMst(); //add //license //-- delete $params = array('company_id' => $company_id, 'terminal_id' => $terminal_id); $TanmatsuLicenseDao->Delete(' company_id = ? AND terminal_id = ? ', $params); if ($licenses != '') { $licenses = explode(',', $licenses); //terminal_license insert foreach ($licenses as $license_id) { //exists ( license_id ) $exist = $licenseDao->Retrieve(' company_id = ? AND license_id = ? ', array($company_id, $license_id)); if (empty($exist)) { $def1 = $this->af->getDef('license_id'); $err_msg = array('license_id_err' => "入力された" . $def1['name'] . "は登録されていません"); return array(400, $err_msg); } $params = array('company_id' => $company_id, 'terminal_id' => $terminal_id, 'license_id' => $license_id, 'UID' => $user_id, 'PGM' => get_class()); $TanmatsuLicenseDao->Insert($params); //if start_time is null $params = array('license_id' => $license_id, 'company_id' => $company_id); $result = $licenseDao->Column('START_YMD_HMS', ' LICENSE_ID = ? AND COMPANY_ID = ? ', $params); if (empty($result)) { $params = array('company_id' => $company_id, 'license_id' => $license_id, 'uid' => $s_user_id, 'pgm' => get_class()); //update start_date end_date of license_mst $licenseDao->UpdateLicense($params); } } } //endif license != '' // commit $terminalDao->CommitTransaction(); } catch (Exception $e) { $terminalDao->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 $terminal_id = $this->af->get('terminal_id'); $terminal_name = $this->af->get('terminal_name'); $password = $this->af->get('password'); $warehouse_id = $this->af->get('warehouse_id'); // get session params $company_id = $this->session->get('company_id'); $s_user_id = $this->session->get('user_id'); $licenses = $this->af->get('license_id'); //add // dao $terminalDao = DaoFactory::TerminalMst(); $TanmatsuLicenseDao = Daofactory::TanmatsuLicense(); //add $licenseDao = DaoFactory::LicenseMst(); //add try { // begin $terminalDao->BeginTransaction(); // set params $params = array('terminal_name' => $terminal_name, 'status_flg' => '1', 'UID' => $s_user_id, 'PGM' => get_class()); // password がリクエストにあれば update に含める if ($password != '') { $params['password'] = md5($password); } // dao update $terminalDao->Update($params, ' company_id = ? AND terminal_id = ? ', array($company_id, $terminal_id)); //license //-- delete $params = array('company_id' => $company_id, 'terminal_id' => $terminal_id); $TanmatsuLicenseDao->Delete(' company_id = ? AND terminal_id = ? ', $params); if ($licenses != '') { $licenses = explode(',', $licenses); // insert foreach ($licenses as $license_id) { //exists ( license_id ) $exist = $licenseDao->Retrieve(' company_id = ? AND license_id = ? ', array($company_id, $license_id)); if (empty($exist)) { $def1 = $this->af->getDef('license_id'); $err_msg = array('license_id_err' => "入力された" . $def1['name'] . "は登録されていません"); return array(400, $err_msg); } $params = array('company_id' => $company_id, 'terminal_id' => $terminal_id, 'license_id' => $license_id, 'UID' => $s_user_id, 'PGM' => get_class()); $TanmatsuLicenseDao->Insert($params); //if start_time is null $params = array('license_id' => $license_id, 'company_id' => $company_id); $result = $licenseDao->Column('START_YMD_HMS', ' LICENSE_ID = ? AND COMPANY_ID = ? ', $params); if (empty($result)) { $params = array('company_id' => $company_id, 'license_id' => $license_id, 'uid' => $s_user_id, 'pgm' => get_class()); //update start_date end_date of license_mst $licenseDao->UpdateLicense($params); } } } //endif license != '' // commit $terminalDao->CommitTransaction(); } catch (Exception $e) { // rollback $terminalDao->AbortTransaction(); $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array(500, $e->getMessage()); } exit; }
function perform() { //パラメータ取得 $company_name = $this->af->get('company_name'); $address = $this->af->get('address'); $contact = $this->af->get('contact'); $tel = $this->af->get('tel'); $mail = $this->af->get('mail'); $psw = $this->af->get('psw'); $psw2 = $this->af->get('psw2'); $uuid = $this->af->get('uuid'); $locale = $this->af->get('locale'); if ($locale == "zh-Hans") { $default_locale = "zh-Hans-CN"; } elseif ($locale == "ja") { $default_locale = "ja_JP"; } else { $default_locale = "en_US"; } $params = array('company_name' => $company_name, 'address' => $address, 'contact' => $contact, 'company_tel' => $tel, 'mail' => $mail, 'UID' => 'terminal', 'PGM' => get_class()); try { //fixme $dao = DaoFactory::CompanyMst(); $wdao = DaoFactory::WarehouseMst(); $tdao = DaoFactory::TerminalMst(); $sdao = DaoFactory::StaffMst(); $tudao = DaoFactory::TerminalUdidMst(); $dao->BeginTransaction(); $company_id = $dao->getNewCompanyId(); $argu = array('company_id' => $company_id, 'example_id' => $this->config->get('template_company_id'), 'uuid' => $uuid, 'upd_uid' => 'terminal', 'upd_pgm' => get_class()); $dao->addNewCompanyForApi($argu); $where = ' COMPANY_ID = ? '; $bind = array($company_id); $dao->Update($params, $where, $bind); $wdao->Update(array('address' => $address, 'warehouse_tel' => $tel, 'contact' => $contact, 'UID' => 'terminal', 'PGM' => get_class()), $where, $bind); $sdao->Update(array('staff_tel' => $tel, 'UID' => 'terminal', 'PGM' => get_class()), $where, $bind); $tdao->Update(array('password' => $psw, 'UID' => 'terminal', 'PGM' => get_class()), $where, $bind); $tudao->Update(array('terminal_id' => $terminal_id, 'udid' => $udid, 'UID' => 'terminal', 'PGM' => get_class()), $where, $bind); DaoFactory::UserMst()->Update(array('user_pwd' => $psw, 'UID' => 'terminal', 'PGM' => get_class(), 'E_MAIL' => $mail, 'DEFAULT_LOCALE' => $default_locale), $where, $bind); $warehouse_id = $wdao->getMaxWarehouseIdByCompany(array('company_id' => $company_id)); $terminal_id = $tdao->getMaxTerminalIdByCompany(array('company_id' => $company_id)); $staff_id = $sdao->getMaxStaffIdByCompany(array('company_id' => $company_id)); //commit $dao->CommitTransaction(); } catch (Exception $e) { // 致命的なエラーが発生 $dao->AbortTransaction(); $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array('500', $e->getMessage()); } mb_language('uni'); if ($locale == 'ja') { $subject = "{$this->config->get('system_name')}利用開始のご案内"; $message = "\r\n{$company_name} \r\n{$contact} 様\r\n\r\nこの度は「{$this->config->get('system_name')}」サービスにご登録いただきまして、誠にありがとうございます。\r\n本メールは iPhone/iPod touch の {$this->config->get('app_name')}アプリからアカウント申請を行っていただいた方に自動送信されています。\r\n本メールの心当たりがない場合は、本メールの破棄と弊社までご連絡頂ますようお願い申し上げます。\r\n\r\nアカウント申請後は {$this->config->get('app_name')}アプリのログイン画面にて申請時に入力したパスワードでログインが可能です。\r\n新規でご登録していただいたアカウントには端末1台2ヶ月まで無料ご利用いただけます。\r\n別の端末でログインするには、管理画面から端末追加登録とライセンス購入する必要がございます。\r\nライセンスのご購入はライセンスマスタ管理画面の購入リンクを押すか、直接AsShopにて、オンラインにてご購入いただけます。\r\n\r\nアカウント申請に伴い {$this->config->get('system_name')}に下記の情報が登録されています。\r\n-----------------アカウント情報------------------\r\n\t 会社ID:{$company_id}\r\n 初期管理者ユーザID:admin\r\n 管理者パスワード:申請時ご入力いただいたパスワード (端末のログインパスワードも同じです)※セキュリティのためパスワード本メールに含んでいません\r\n WEB管理画面URL: {$this->config->get('url')}?company_id={$company_id}\r\n \r\n------------------デモ情報-------------------------\r\n**登録後すぐに端末からログインし、ご利用いただけるように、上記のアカウント情報以外に\r\n下記必要なデモデータも自動的に作成されています。\r\n 倉庫/場所/発注先 コード:{$warehouse_id}\r\n 端末ID:{$terminal_id}\r\n 担当者ID:{$staff_id}\r\n---------------------------------------------------\r\n\r\n本サービスはiPhone/iPod touch用バーコードリーダー「AsReader」を併用すると更に便利にご利用になれます。\r\n詳しくはホームページまで。\r\nhttp://asreader.com/\r\n\r\n本サービスご利用にあたり、質問などお困りの時がございましたら、下記のサイトまでご参照ください。\r\nサービスホーム http://www.asx4.net\r\nAsWiki https://wiki.asx4.net\r\nAsHelp https://support.asx4.net\r\nAsShop https://ec.asx4.net\r\n\r\n "; } elseif ($locale == 'zh-Hans') { $subject = "{$this->config->get('app_name')}服务使用向导"; $message = "\r\n{$company_name} \r\n{$contact} 您好!\r\n \t\r\n非常感谢您登录{$this->config->get('app_name')}。\r\n这封邮件是在您通过iPhone/iPod touch的{$this->config->get('app_name')}应用程序,申请账号时自动发送给您的。\r\n如果您对该邮件不知情,请销毁本邮件并与我们联系。\r\n \t\r\n账户申请后,您就可以使用申请账号时所设置的密码在 {$this->config->get('app_name')}应用程序的登录画面中登录使用了。\r\n新注册的账号里已自动生成1台终端,可免费使用两个月。\r\n如需新增使用其他终端,需要在管理画面中的“终端管理”进行终端添加并购买证书后方可使用。\r\n \t\r\n以下是您所申请的{$this->config->get('app_name')}账户的相关信息。\r\n-----------------账户信息------------------\r\n\t 公司ID:{$company_id}\r\n \t 管理员ID:admin\r\n\t 管理员密码:申请账户时填写的密码 (与终端登录密码相同)\r\n\t WEB管理页面URL: {$this->config->get('url')}?company_id={$company_id}\r\n \t \r\n------------------模板信息-------------------------\r\n**为了在注册后您可以马上使用终端登录来体验我们的服务,除以上账户信息外,\r\n我们也为你创建了以下必要的基本信息。\r\n\t 仓库/场所/供货方 代码:{$warehouse_id}\r\n\t 终端ID:{$terminal_id}\r\n\t 操作员ID:{$staff_id}\r\n---------------------------------------------------\r\n \t\r\n如在使用本服务中遇到任何问题,请查看以下相关网站。\r\n服务总站 http://www.asx4.net\r\nAsWiki https://wiki.asx4.net\r\nAsHelp https://support.asx4.net\r\nAsShop https://ec.asx4.net \r\n \t\r\n"; } else { $subject = "Thank you for signing up {$this->config->get('app_name')} service"; $message = "\r\n{$company_name} \r\nHi {$contact} \r\n \t \r\nThank you for signing up our service {$this->config->get('app_name')}. \r\nThis mail is sent to every user who has registered an new account from our iOS app {$this->config->get('app_name')}.\r\nPlease feel free to contact us if you were not aware that you were going to receive it.\r\n \t \r\nYou can login to the app {$this->config->get('app_name')} with the password you have input in the register form upon receipt of this email.\r\n \t \r\nAccount Information:\r\n-----------------Account info------------------\r\n\t Company ID:{$company_id}\r\n\t Admin User ID:admin\r\n\t Password:The password you set in registration form\r\n\t Admin page URL: {$this->config->get('url')}?company_id={$company_id}\r\nEvery new account is assoiated with one preset terminal with a 2month free license.\r\nIf you want more terminals or longer licenses, please create terminal in the back-end admin system and buy license from our online shop.\r\n\r\n------------------demo data-------------------------\r\nBesides the account information above, we have also created some demo datas in order to help you test or learn our system easier.\r\n\t Warehouse/Place/Seller ID:{$warehouse_id}\r\n\t Terminal ID:{$terminal_id}\r\n\t Staff ID:{$staff_id}\r\n---------------------------------------------------\r\n \t \r\nOur app support AsReader 100% internally. AsReader is a series of hardware for iOS devices, they have ability to scan barcode or RFID tags and send the data to iOS devices.\r\nSo, it can easily turn your iPhones/iPods into a powerful handheld termials.\r\nfor more information, please refer to their official site:\r\nhttp://asreader.com/\r\n\r\nIf you have any question during using our service, please consult our following site for more information.\r\nService Home http://www.asx4.net\r\nAsWiki https://wiki.asx4.net\r\nAsHelp https://support.asx4.net\r\nAsShop https://ec.asx4.net\r\n\r\nBest regards,\r\n\r\nAsApps Team\r\n \t \r\n"; } $headers = "From: {$this->config->get('admin_email_address')}"; mb_send_mail($mail, $subject, $message, $headers); $output['company_id'] = $company_id; $output['warehouse_id'] = $warehouse_id; $output['terminal_id'] = $terminal_id; $output['staff_id'] = $staff_id; $output['server_url'] = $this->config->get('url'); return array('json', $output); }