예제 #1
0
 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;
 }
예제 #2
0
 /**
  * リクエストのライセンスがDBに登録されているかチェックする
  * @param string $name フォーム名
  */
 public function check_license_id_exists($name)
 {
     // ライセンスを取得
     $params = array('company_id' => $this->backend->getSession()->get('company_id'), 'license_id' => $this->form_vars['license_id']);
     $license = DaoFactory::LicenseMst()->Retrieve(' company_id = ? AND license_id = ? ', $params);
     // ライセンスが存在しない場合
     if (empty($license)) {
         $this->ae->add($name, "入力された{form}は登録されていません", E_FORM_INVALIDCHAR);
     }
 }
예제 #3
0
 /**
  * 
  * @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());
     }
 }
예제 #4
0
 public function checkLicense()
 {
     $company_id = $this->session->get('company_id');
     $days = $this->config->get('license_warning_days');
     //$days排序 降序
     rsort($days, SORT_NUMERIC);
     try {
         $dao = DaoFactory::LicenseMst();
         $params = array('company_id' => $company_id, 'day' => $days[0]);
         $res = $dao->LicenseMST_GetLicenseValidDaysWarning($params)->fetchAll(PDO::FETCH_ASSOC);
         $this->af->setApp('daysn_terminal_num', count($res));
         $this->af->setApp('day_num', $res[0]['DAYS']);
     } catch (Exception $e) {
         $this->logger->log(LOG_DEBUG, $e->getTraceAsString());
     }
 }
예제 #5
0
 /**
  * ライセンスマスタのデータをJSON形式で返す
  * @access public
  * @return array ライセンスマスタ
  * @see Admin_ActionClass::perform()
  */
 public function perform()
 {
     // 初期化
     $not_license_id = $this->af->get('not_license_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');
     $license_id = $this->af->get('license_id');
     $search_terminal_id = $this->af->get('search_terminal_id');
     $terminal_name = $this->af->get('terminal_name');
     $joutai = $this->af->get('joutai');
     $company_id = $this->session->get('company_id');
     $start_page = ($page - 1) * $limit + 1;
     $end_page = ($page - 1) * $limit + $limit;
     $not_license_id = explode(',', urldecode($not_license_id));
     $terminal_id = $this->af->get('terminal_id');
     $from_flg = $this->af->get('from_flg');
     try {
         // 一覧を取得
         if ($from_flg == 'terminal') {
             $params = array('terminal_id' => $terminal_id, 'not_license_id' => $not_license_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::LicenseMst()->LicenseMST_GetMasterLicenseListForTerminal($params)->fetchAll();
         } else {
             $params = array('limit' => $limit, 'page' => $page, 'order' => $order, 'column' => $column, 'keyword' => $keyword, 'company_id' => $company_id, 'start_page' => $start_page, 'end_page' => $end_page, 'license_id' => $license_id, 'search_terminal_id' => $search_terminal_id, 'terminal_name' => $terminal_name, 'joutai' => $joutai);
             $list = DaoFactory::LicenseMst()->LicenseMST_GetMasterLicenseList($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) {
         // 致命的なエラーが発生
         $this->logger->log(LOG_DEBUG, $e->getTraceAsString());
         return array('500', $e->getMessage());
     }
     return array('json', $output);
 }
예제 #6
0
 /**
  * 端末マスタの保存が成功したか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;
 }
예제 #7
0
 /**
  * 端末マスタの保存が成功したか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;
 }