/** * 店舗マスタの保存が成功したか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; }
/** * 担当マスタのデータを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); }
/** * 担当マスタの削除処理 * @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; }
/** * 担当編集のビュー名を返す * @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'; }
/** * 担当マスタの保存が成功したか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; }
/** * 担当者の取得 * @param string $name フォーム名 */ public function getArrayOption_staff_id() { $ret[''] = ''; $company_id = $this->backend->getSession()->get('company_id'); $list = DaoFactory::StaffMst()->Select(" company_id = ? order by staff_id ", array($company_id)); foreach ($list as $val) { $ret[$val['STAFF_ID']] = $val['STAFF_ID'] . ':' . $val['STAFF_NAME']; } return $ret; }
/** * リクエストの端末IDがDBに登録されていないことをチェックする * @param string $name フォーム名 */ public function check_staff_not_exists($name) { // パラメータを取得 $params = array('company_id' => $this->backend->getSession()->get('company_id'), 'staff_id' => $this->form_vars['staff_id']); $staff = DaoFactory::StaffMst()->Retrieve(' company_id = ? AND staff_id = ? ', $params); // 存在する場合 if (!empty($terminal)) { $this->ae->add($name, "入力された{form}は既に登録されています", E_FORM_INVALIDCHAR); } }
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); }