/** * * @see Ethna_ActionClass::perform() */ function perform() { $days = $this->config->get('license_warning_days'); try { $licenseDao = DaoFactory::LicenseMst(); $userDao = DaoFactory::UserMst(); $companyDao = DaoFactory::CompanyMst(); sort($days, SORT_NUMERIC); $result = array(); foreach ($days as $day) { $params = array('day' => $day); $res = $licenseDao->LicenseMST_GetLicenseValidDays($params)->fetchAll(PDO::FETCH_ASSOC); $result = array_merge($result, $res); } foreach ($result as $value) { $send_email[$value['COMPANY_ID']][] = array('TERMINAL_ID' => $value['TERMINAL_ID'], 'END_YMD' => $value['END_YMD']); } //send e-mail $headers = "From: {$this->config->get('admin_email_address')}"; foreach ($send_email as $company => $arr) { $invalid_terminal_list = ''; foreach ($arr as $key => $value) { $invalid_terminal_list .= "\n{$value['TERMINAL_ID']}\t\t\t{$value['END_YMD']}"; } //get admin user's e-mail address and language $companyInfo = $companyDao->Retrieve('COMPANY_ID = ?', array($company)); //$companyInfo['CONTACT'] $userInfo = $userDao->Retrieve("LOGIN_ID = 'admin' AND COMPANY_ID = ? ", array($company)); //$userInfo['E_MAIL'] //$userInfo['DEFAULT_LOCALE'] zh-Hans-CN en_US ja_JP if ($userInfo['DEFAULT_LOCALE'] == 'zh-Hans-CN') { $this->backend->getController()->setLocale('zh-Hans-CN'); $subject = _et($this->config->get('system_name')) . "终端证书即将到期"; $send_message = "\n{$companyInfo['COMPANY_NAME']} \n{$companyInfo['CONTACT']} 您好!\n \t\n非常感谢您使用我们的{$this->config->get('app_name')}服务。\n您的以下终端的证书即将过期,为了不影响业务请尽快到证书管理页面购买新的证书。\n\n终端\t\t\t到期日\n" . $invalid_terminal_list . "\n\n新的证书可以从后台管理系统的证书管理页面购买,也可以直接到AsShop购买。\n如有任何问题请随即和我们取得联系。\n\n服务总站 http://www.asx4.net\nAsWiki\t\thttps://wiki.asx4.net\nAsHelp \thttps://support.asx4.net\nAsShop\thttps://ec.asx4.net\n \t\n"; } elseif ($userInfo['DEFAULT_LOCALE'] == 'ja_JP') { $this->backend->getController()->setLocale('ja_JP'); $subject = _et($this->config->get('system_name')) . "端末のライセンスの期限が近づいています"; $send_message = "\n{$companyInfo['COMPANY_NAME']} \n{$companyInfo['CONTACT']} 様\n \t\n{$this->config->get('app_name')}をご利用いただきまして誠にありがとうございます。\n下記の端末のライセンスの期限が近づいています。業務に影響を与えないように早めに新しいライセンスをご購入ください。\n\n端末ID\t\t\t期限\n" . $invalid_terminal_list . "\n\nライセンスは管理画面のライセンスマスタ画面か、AsShopからご購入いただけます。\nご不明な点がございましたら、お問い合わせください。\n\nサービスホーム http://www.asx4.net\nAsWiki \t\t\t\thttps://wiki.asx4.net\nAsHelp \t\t\t\thttps://support.asx4.net\nAsShop \t\t\t\thttps://ec.asx4.net \n \t\n"; } else { $this->backend->getController()->setLocale('en_US'); $subject = _et($this->config->get('system_name')) . " Terminal will be out of license soon"; $send_message = "\n{$companyInfo['COMPANY_NAME']} \nHi {$companyInfo['CONTACT']}\n \t\nThanks for using our {$this->config->get('app_name')} service. \nThe following terminal will be out of license soon. Please buy new license as soon as possible.\n\nTerminal ID\t\t\tValid Until\n" . $invalid_terminal_list . "\n\nYou can buy new licenses from the LICENSE MANAGEMENT page in our admin system or buy form the AsShop directly.\nIf you have any question, please don't hesitate to contact us.\n\nService Home\t\thttp://www.asx4.net\nAsWiki \t\t\thttps://wiki.asx4.net\nAsHelp \t\t\thttps://support.asx4.net\nAsShop \t\t\thttps://ec.asx4.net\n"; } mb_send_mail($userInfo['E_MAIL'], $subject, $send_message, $headers); } } catch (Exception $e) { $this->logger->log(LOG_ERR, $e->getMessage()); die($e->getMessage()); } }
/** * 会社マスタのデータをJSON形式で返す * @access public * @return array 会社マスタ * @see Admin_ActionClass::perform() */ public function perform() { // get session params $company_id = $this->session->get('company_id'); try { // set dao params $params = array('company_id' => $company_id); // get detail $detail = DaoFactory::CompanyMst()->Retrieve(' company_id = ? ', array('company_id' => $company_id)); $output = array(); $output['COMPANY_ID'] = $company_id; $output['COMPANY_NAME'] = $detail['COMPANY_NAME']; $output['ADDRESS'] = $detail['ADDRESS']; $output['CONTACT'] = $detail['CONTACT']; $output['COMPANY_TEL'] = $detail['COMPANY_TEL']; $output['MAIL'] = $detail['MAIL']; $output['SHIMEBI'] = $detail['SHIMEBI']; $output['IS_TANA_BANGO_MUST'] = $detail['IS_TANA_BANGO_MUST']; $output['IS_TANTOSYA_MUST'] = $detail['IS_TANTOSYA_MUST']; if ('' != $detail['STOCK_MOVE_RCV_WAYS']) { $arr = explode(',', $detail['STOCK_MOVE_RCV_WAYS']); } else { $arr = array(); } foreach ($arr as $value) { $output['STOCK_MOVE_RCV_WAYS[' . $value . ']'] = 1; } // set output $output['totalData'] = array(); $output['listData'] = $output; $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 $stock_move_rcv_ways = $this->af->get('stock_move_rcv_ways'); $company_name = $this->af->get('company_name'); $address = $this->af->get('address'); $contact = $this->af->get('contact'); $company_tel = $this->af->get('company_tel'); $mail = $this->af->get('mail'); $is_tana_bango_must = $this->af->get('is_tana_bango_must'); $is_tantosya_must = $this->af->get('is_tantosya_must'); // get session params $company_id = $this->session->get('company_id'); $stock_move_rcv_ways = implode(',', array_keys($stock_move_rcv_ways)); // dao $CompanyMstDao = DaoFactory::CompanyMst(); try { // mod params $open_jikoku = "{$open_jikoku_h}:{$open_jikoku_m}"; $close_jikoku = "{$close_jikoku_h}:{$close_jikoku_m}"; // start transaction $CompanyMstDao->BeginTransaction(); // set dao params $params = array('company_name' => $company_name, 'address' => $address, 'contact' => $contact, 'company_tel' => $company_tel, 'mail' => $mail, 'stock_move_rcv_ways' => $stock_move_rcv_ways, 'is_tana_bango_must' => $is_tana_bango_must, 'is_tantosya_must' => $is_tantosya_must, 'UID' => $user_id, 'PGM' => get_class()); // update $CompanyMstDao->Update($params, ' company_id = ? ', array($company_id)); // commit transaction $CompanyMstDao->CommitTransaction(); } catch (Exception $e) { // rollback $CompanyMstDao->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); }
public function Login($params) { if ($this->isLogin()) { $this->Logout(); } // dao $UserMst = DaoFactory::UserMst(); // スーパーユーザフラグ初期化 $super_user_flg = false; // 指定したlogin_idのスーパーユーザを取得 $super_user = $UserMst->Retrieve(' company_id = ? and login_id = ? and kengen_flg = ? ', array('company_id' => '-', 'login_id' => $params['login_id'], 'kengen_flg' => Konst::KENGEN_FLG_SUPER)); // 指定した login_id と password を取得したレコードで存在チェック if ($super_user['LOGIN_ID'] === $params['login_id'] && $super_user['USER_PWD'] === $params['password']) { // 指定の会社IDが存在することを確認 $ret_kaisha = DaoFactory::CompanyMst()->Retrieve(' company_id = ? ', array('company_id' => $params['company_id'])); // 存在しない場合はログインエラー if (!$ret_kaisha) { return LoginController::LOGIN_FAILED; } // スーパーユーザである $super_user_flg = true; // 後のログイン処理に乗せるために代入 $userData = $super_user; // スーパーユーザの会社CDは意味の無いものなので、ログイン時に入力した値を用いる $su_company_id = $userData['COMPANY_ID']; $userData['COMPANY_ID'] = $params['company_id']; } // ユーパーユーザでなければ通常ログイン処理 if ($super_user_flg === false) { // ユーザデータ取得 $userData = $UserMst->UserMst_GetByLoginId($params); // レコードのチェック if (empty($userData)) { return LoginController::LOGIN_FAILED; } // ユーザーの存在チェック if ($userData['LOGIN_ID'] !== $params['login_id']) { return LoginController::LOGIN_FAILED; } // パスワードロック中でないかチェック if ($userData['PWD_LOCKING'] == 1) { return LoginController::LOGIN_LOCKING; } // パスワードが合っているかチェック if ($userData['USER_PWD'] !== $params['password']) { // パスワード誤入力時の処理 $opt_params = array('company_id' => $userData['COMPANY_ID'], 'user_id' => $userData['USER_ID'], 'upd_uid' => $userData['USER_ID'], 'upd_pgm' => get_class()); $UserMst->UserMst_PasswordMismatch($opt_params); if ($userData['PWD_MISMATCH'] == PWD_MISMATCH_NUM_TO_LOCK - 2) { return LoginController::LOGIN_LOCK_WARNING; } else { if ($userData['PWD_MISMATCH'] == PWD_MISMATCH_NUM_TO_LOCK - 1) { return LoginController::LOGIN_JUSTNOW_LOCKED; } } return LoginController::LOGIN_FAILED; } // ライセンスが有効期間内かチェック /*$wheresql = 'company_id = ? AND current_date BETWEEN start_date AND end_date'; $params = array( 'company_id' => $params['company_id'], ); if (DaoFactory::LicenseD()->Retrieve($wheresql, $params) === false) { // 有効期間外の場合 return LoginController::LOGIN_EXPIRE_LICENSE; }*/ } // ログイン成功時の処理 $opt_params = array('company_id' => $userData['COMPANY_ID'], 'user_id' => $userData['USER_ID'], 'upd_uid' => $userData['USER_ID'], 'upd_pgm' => get_class()); $UserMst->UserMst_loginSuccess($opt_params); $this->session->start(); $loginData = array('user' => $userData, 'session_time' => time()); $this->session->set('loginData', serialize($loginData)); $this->session->set('company_id', $userData['COMPANY_ID']); $this->session->set('user_id', $userData['USER_ID']); $this->session->set('kengen_flg', $userData['KENGEN_FLG']); $this->session->set('pwd_kigengire', $userData['PWD_KIGENGIRE']); $this->session->set('pwd_kigen_zan', $userData['PWD_KIGEN_ZAN']); $this->session->set('role_id', $userData['ROLE_ID']); if ($super_user_flg === true) { $this->session->set('su_company_id', $su_company_id); } return LoginController::LOGIN_SUCCESS; }