예제 #1
0
 function changeProductStatus(LC_Page $objPage)
 {
     $objQuery = SC_Query_Ex::getSingletonInstance();
     $objQuery->begin();
     $n = array();
     $n2 = array("auto_display_status" => 0);
     $objSql = new SC_SelectSql_Ex();
     $objSql->setWhere("auto_display_status = 1");
     $objSql->setWhere("del_flg             = 0");
     $s = "auto_display_end_date";
     $e = "auto_display_start_date";
     // 公開日による状態変更
     // {$s} > NOW() 公開開始前
     // {$e} < NOW() 公開終了後
     // その他       公開中
     $objQuery->update("dtb_products", $n, $objSql->getWhere(), $n, array("status" => "CASE WHEN {$s} > NOW() THEN 2 WHEN {$e} < NOW() THEN 2 ELSE 1 END", "auto_display_status" => "CASE WHEN {$e} < NOW() THEN 0 ELSE 1 END"));
     $objSql->setWhere("{$e} < NOW() ");
     $objQuery->update("dtb_products", $n, $objSql->getWhere(), $n2);
     $objQuery->commit();
     if (GC_Utils_Ex::isFrontFunction()) {
         // 商品数量を再計算
         $objDb = new SC_Helper_DB_Ex();
         $objDb->sfCountCategory($objQuery);
         $objDb->sfCountMaker($objQuery);
     }
 }
예제 #2
0
 function __construct($array, $mode = '')
 {
     parent::__construct($array);
     $objDb = new SC_Helper_DB_Ex();
     $dbFactory = SC_DB_DBFactory_Ex::getInstance();
     if ($mode == '') {
         // 会員本登録会員で削除していない会員
         $this->setWhere('status = 2 AND del_flg = 0 ');
         // 登録日を示すカラム
         $regdate_col = 'dtb_customer.update_date';
     }
     if ($mode == 'customer') {
         $this->setWhere(' del_flg = 0 ');
         // 登録日を示すカラム
         $regdate_col = 'dtb_customer.update_date';
     }
     // 会員ID
     if (!isset($this->arrSql['search_customer_id'])) {
         $this->arrSql['search_customer_id'] = '';
     }
     if (strlen($this->arrSql['search_customer_id']) > 0) {
         $this->setWhere('customer_id =  ?');
         $this->arrVal[] = $this->arrSql['search_customer_id'];
     }
     // 名前
     if (!isset($this->arrSql['search_name'])) {
         $this->arrSql['search_name'] = '';
     }
     if (strlen($this->arrSql['search_name']) > 0) {
         $this->setWhere('(' . $dbFactory->concatColumn(array('name01', 'name02')) . ' LIKE ?)');
         $searchName = $this->addSearchStr($this->arrSql['search_name']);
         $this->arrVal[] = mb_ereg_replace('[  ]+', '', $searchName);
     }
     // 名前(フリガナ)
     if (!isset($this->arrSql['search_kana'])) {
         $this->arrSql['search_kana'] = '';
     }
     if (strlen($this->arrSql['search_kana']) > 0) {
         $this->setWhere('(' . $dbFactory->concatColumn(array('kana01', 'kana02')) . ' LIKE ?)');
         $searchKana = $this->addSearchStr($this->arrSql['search_kana']);
         $this->arrVal[] = mb_ereg_replace('[  ]+', '', $searchKana);
     }
     // 都道府県
     if (!isset($this->arrSql['search_pref'])) {
         $this->arrSql['search_pref'] = '';
     }
     if (strlen($this->arrSql['search_pref']) > 0) {
         $this->setWhere('pref = ?');
         $this->arrVal[] = $this->arrSql['search_pref'];
     }
     // 電話番号
     if (!isset($this->arrSql['search_tel'])) {
         $this->arrSql['search_tel'] = '';
     }
     if (is_numeric($this->arrSql['search_tel'])) {
         $this->setWhere('(' . $dbFactory->concatColumn(array('tel01', 'tel02', 'tel03')) . ' LIKE ?)');
         $searchTel = $this->addSearchStr($this->arrSql['search_tel']);
         $this->arrVal[] = str_replace('-', '', $searchTel);
     }
     // 性別
     if (!isset($this->arrSql['search_sex'])) {
         $this->arrSql['search_sex'] = '';
     }
     if (is_array($this->arrSql['search_sex'])) {
         $arrSexVal = $this->setItemTerm($this->arrSql['search_sex'], 'sex');
         foreach ($arrSexVal as $data) {
             $this->arrVal[] = $data;
         }
     }
     // 職業
     if (!isset($this->arrSql['search_job'])) {
         $this->arrSql['search_job'] = '';
     }
     if (is_array($this->arrSql['search_job'])) {
         if (in_array(t('c_Unknown_01'), $this->arrSql['search_job'])) {
             $arrJobVal = $this->setItemTermWithNull($this->arrSql['search_job'], 'job');
         } else {
             $arrJobVal = $this->setItemTerm($this->arrSql['search_job'], 'job');
         }
         if (is_array($arrJobVal)) {
             foreach ($arrJobVal as $data) {
                 $this->arrVal[] = $data;
             }
         }
     }
     // E-MAIL
     if (!isset($this->arrSql['search_email'])) {
         $this->arrSql['search_email'] = '';
     }
     if (strlen($this->arrSql['search_email']) > 0) {
         //カンマ区切りで複数の条件指定可能に
         $this->arrSql['search_email'] = explode(',', $this->arrSql['search_email']);
         $sql_where = '';
         foreach ($this->arrSql['search_email'] as $val) {
             $val = trim($val);
             //検索条件を含まない
             if ($this->arrSql['not_emailinc'] == '1') {
                 if ($sql_where == '') {
                     $sql_where .= 'dtb_customer.email NOT ILIKE ? ';
                 } else {
                     $sql_where .= 'AND dtb_customer.email NOT ILIKE ? ';
                 }
             } else {
                 if ($sql_where == '') {
                     $sql_where .= 'dtb_customer.email ILIKE ? ';
                 } else {
                     $sql_where .= 'OR dtb_customer.email ILIKE ? ';
                 }
             }
             $searchEmail = $this->addSearchStr($val);
             $this->arrVal[] = $searchEmail;
         }
         $this->setWhere($sql_where);
     }
     // E-MAIL(mobile)
     if (!isset($this->arrSql['search_email_mobile'])) {
         $this->arrSql['search_email_mobile'] = '';
     }
     if (strlen($this->arrSql['search_email_mobile']) > 0) {
         //カンマ区切りで複数の条件指定可能に
         $this->arrSql['search_email_mobile'] = explode(',', $this->arrSql['search_email_mobile']);
         $sql_where = '';
         foreach ($this->arrSql['search_email_mobile'] as $val) {
             $val = trim($val);
             //検索条件を含まない
             if ($this->arrSql['not_email_mobileinc'] == '1') {
                 if ($sql_where == '') {
                     $sql_where .= 'dtb_customer.email_mobile NOT ILIKE ? ';
                 } else {
                     $sql_where .= 'AND dtb_customer.email_mobile NOT ILIKE ? ';
                 }
             } else {
                 if ($sql_where == '') {
                     $sql_where .= 'dtb_customer.email_mobile ILIKE ? ';
                 } else {
                     $sql_where .= 'OR dtb_customer.email_mobile ILIKE ? ';
                 }
             }
             $searchemail_mobile = $this->addSearchStr($val);
             $this->arrVal[] = $searchemail_mobile;
         }
         $this->setWhere($sql_where);
     }
     // メールマガジンの場合
     if ($mode == 'customer') {
         // メルマガ受け取りの選択項目がフォームに存在する場合
         if (isset($this->arrSql['search_htmlmail'])) {
             $this->setWhere('status = 2');
             if (SC_Utils_Ex::sfIsInt($this->arrSql['search_htmlmail'])) {
                 $this->setWhere('mailmaga_flg = ?');
                 $this->arrVal[] = $this->arrSql['search_htmlmail'];
             } else {
                 // メルマガ購読拒否は省く
                 $this->setWhere('mailmaga_flg <> 3');
             }
         }
     }
     // 配信メールアドレス種別
     if ($mode == 'customer') {
         if (isset($this->arrSql['search_mail_type'])) {
             $sqlEmailMobileIsEmpty = "(dtb_customer.email_mobile IS NULL OR dtb_customer.email_mobile = '')";
             switch ($this->arrSql['search_mail_type']) {
                 // PCメールアドレス
                 case 1:
                     $this->setWhere("(dtb_customer.email <> dtb_customer.email_mobile OR {$sqlEmailMobileIsEmpty})");
                     break;
                     // 携帯メールアドレス
                 // 携帯メールアドレス
                 case 2:
                     $this->setWhere("NOT {$sqlEmailMobileIsEmpty}");
                     break;
                     // PCメールアドレス (携帯メールアドレスを登録している会員は除外)
                 // PCメールアドレス (携帯メールアドレスを登録している会員は除外)
                 case 3:
                     $this->setWhere($sqlEmailMobileIsEmpty);
                     break;
                     // 携帯メールアドレス (PCメールアドレスを登録している会員は除外)
                 // 携帯メールアドレス (PCメールアドレスを登録している会員は除外)
                 case 4:
                     $this->setWhere('dtb_customer.email = dtb_customer.email_mobile');
                     break;
             }
         }
     }
     // 購入金額指定
     if (!isset($this->arrSql['search_buy_total_from'])) {
         $this->arrSql['search_buy_total_from'] = '';
     }
     if (!isset($this->arrSql['search_buy_total_to'])) {
         $this->arrSql['search_buy_total_to'] = '';
     }
     if (is_numeric($this->arrSql['search_buy_total_from']) || is_numeric($this->arrSql['search_buy_total_to'])) {
         $arrBuyTotal = $this->selectRange($this->arrSql['search_buy_total_from'], $this->arrSql['search_buy_total_to'], 'buy_total');
         foreach ($arrBuyTotal as $data) {
             $this->arrVal[] = $data;
         }
     }
     // 購入回数指定
     if (!isset($this->arrSql['search_buy_times_from'])) {
         $this->arrSql['search_buy_times_from'] = '';
     }
     if (!isset($this->arrSql['search_buy_times_to'])) {
         $this->arrSql['search_buy_times_to'] = '';
     }
     if (is_numeric($this->arrSql['search_buy_times_from']) || is_numeric($this->arrSql['search_buy_times_to'])) {
         $arrBuyTimes = $this->selectRange($this->arrSql['search_buy_times_from'], $this->arrSql['search_buy_times_to'], 'buy_times');
         foreach ($arrBuyTimes as $data) {
             $this->arrVal[] = $data;
         }
     }
     // 誕生日期間指定
     if (!isset($this->arrSql['search_b_start_year'])) {
         $this->arrSql['search_b_start_year'] = '';
     }
     if (!isset($this->arrSql['search_b_start_month'])) {
         $this->arrSql['search_b_start_month'] = '';
     }
     if (!isset($this->arrSql['search_b_start_day'])) {
         $this->arrSql['search_b_start_day'] = '';
     }
     if (!isset($this->arrSql['search_b_end_year'])) {
         $this->arrSql['search_b_end_year'] = '';
     }
     if (!isset($this->arrSql['search_b_end_month'])) {
         $this->arrSql['search_b_end_month'] = '';
     }
     if (!isset($this->arrSql['search_b_end_day'])) {
         $this->arrSql['search_b_end_day'] = '';
     }
     if (strlen($this->arrSql['search_b_start_year']) > 0 && strlen($this->arrSql['search_b_start_month']) > 0 && strlen($this->arrSql['search_b_start_day']) > 0 || strlen($this->arrSql['search_b_end_year']) > 0 && strlen($this->arrSql['search_b_end_month']) > 0 && strlen($this->arrSql['search_b_end_day']) > 0) {
         $arrBirth = $this->selectTermRange($this->arrSql['search_b_start_year'], $this->arrSql['search_b_start_month'], $this->arrSql['search_b_start_day'], $this->arrSql['search_b_end_year'], $this->arrSql['search_b_end_month'], $this->arrSql['search_b_end_day'], 'birth');
         foreach ($arrBirth as $data) {
             $this->arrVal[] = $data;
         }
     }
     // 誕生月の検索
     if (!isset($this->arrSql['search_birth_month'])) {
         $this->arrSql['search_birth_month'] = '';
     }
     if (is_numeric($this->arrSql['search_birth_month'])) {
         $this->setWhere(' EXTRACT(month from birth) = ?');
         $this->arrVal[] = $this->arrSql['search_birth_month'];
     }
     // 登録期間指定
     if (!isset($this->arrSql['search_start_year'])) {
         $this->arrSql['search_start_year'] = '';
     }
     if (!isset($this->arrSql['search_start_month'])) {
         $this->arrSql['search_start_month'] = '';
     }
     if (!isset($this->arrSql['search_start_day'])) {
         $this->arrSql['search_start_day'] = '';
     }
     if (!isset($this->arrSql['search_end_year'])) {
         $this->arrSql['search_end_year'] = '';
     }
     if (!isset($this->arrSql['search_end_month'])) {
         $this->arrSql['search_end_month'] = '';
     }
     if (!isset($this->arrSql['search_end_day'])) {
         $this->arrSql['search_end_day'] = '';
     }
     if (strlen($this->arrSql['search_start_year']) > 0 && strlen($this->arrSql['search_start_month']) > 0 && strlen($this->arrSql['search_start_day']) > 0 || strlen($this->arrSql['search_end_year']) > 0 && strlen($this->arrSql['search_end_month']) > 0 && strlen($this->arrSql['search_end_day']) > 0) {
         $arrRegistTime = $this->selectTermRange($this->arrSql['search_start_year'], $this->arrSql['search_start_month'], $this->arrSql['search_start_day'], $this->arrSql['search_end_year'], $this->arrSql['search_end_month'], $this->arrSql['search_end_day'], $regdate_col);
         foreach ($arrRegistTime as $data) {
             $this->arrVal[] = $data;
         }
     }
     // 最終購入日指定
     if (!isset($this->arrSql['search_buy_start_year'])) {
         $this->arrSql['search_buy_start_year'] = '';
     }
     if (!isset($this->arrSql['search_buy_start_month'])) {
         $this->arrSql['search_buy_start_month'] = '';
     }
     if (!isset($this->arrSql['search_buy_start_day'])) {
         $this->arrSql['search_buy_start_day'] = '';
     }
     if (!isset($this->arrSql['search_buy_end_year'])) {
         $this->arrSql['search_buy_end_year'] = '';
     }
     if (!isset($this->arrSql['search_buy_end_month'])) {
         $this->arrSql['search_buy_end_month'] = '';
     }
     if (!isset($this->arrSql['search_buy_end_day'])) {
         $this->arrSql['search_buy_end_day'] = '';
     }
     if (strlen($this->arrSql['search_buy_start_year']) > 0 && strlen($this->arrSql['search_buy_start_month']) > 0 && strlen($this->arrSql['search_buy_start_day']) > 0 || strlen($this->arrSql['search_buy_end_year']) > 0 && strlen($this->arrSql['search_buy_end_month']) > 0 && strlen($this->arrSql['search_buy_end_day']) > 0) {
         $arrRegistTime = $this->selectTermRange($this->arrSql['search_buy_start_year'], $this->arrSql['search_buy_start_month'], $this->arrSql['search_buy_start_day'], $this->arrSql['search_buy_end_year'], $this->arrSql['search_buy_end_month'], $this->arrSql['search_buy_end_day'], 'last_buy_date');
         foreach ($arrRegistTime as $data) {
             $this->arrVal[] = $data;
         }
     }
     // 購入商品コード
     if (!isset($this->arrSql['search_buy_product_code'])) {
         $this->arrSql['search_buy_product_code'] = '';
     }
     if (strlen($this->arrSql['search_buy_product_code']) > 0) {
         $this->setWhere('customer_id IN (SELECT customer_id FROM dtb_order WHERE order_id IN (SELECT order_id FROM dtb_order_detail WHERE product_code LIKE ?) AND del_flg = 0)');
         $search_buyproduct_code = $this->addSearchStr($this->arrSql['search_buy_product_code']);
         $this->arrVal[] = $search_buyproduct_code;
     }
     // 購入商品名称
     if (!isset($this->arrSql['search_buy_product_name'])) {
         $this->arrSql['search_buy_product_name'] = '';
     }
     if (strlen($this->arrSql['search_buy_product_name']) > 0) {
         $this->setWhere('customer_id IN (SELECT customer_id FROM dtb_order WHERE order_id IN (SELECT order_id FROM dtb_order_detail WHERE product_name LIKE ?) AND del_flg = 0)');
         $search_buyproduct_name = $this->addSearchStr($this->arrSql['search_buy_product_name']);
         $this->arrVal[] = $search_buyproduct_name;
     }
     // カテゴリを選択している場合のみ絞込検索を行う
     if (!isset($this->arrSql['search_category_id'])) {
         $this->arrSql['search_category_id'] = '';
     }
     if (strlen($this->arrSql['search_category_id']) > 0) {
         // カテゴリで絞込検索を行うSQL文生成
         list($tmp_where, $tmp_arrval) = $objDb->sfGetCatWhere($this->arrSql['search_category_id']);
         // カテゴリで絞込みが可能の場合
         if ($tmp_where != '') {
             $this->setWhere(' customer_id IN (SELECT distinct customer_id FROM dtb_order WHERE order_id IN (SELECT distinct order_id FROM dtb_order_detail WHERE product_id IN (SELECT product_id FROM dtb_product_categories WHERE ' . $tmp_where . ') AND del_flg = 0)) ');
             $this->arrVal = array_merge((array) $this->arrVal, (array) $tmp_arrval);
         }
     }
     // 会員状態
     if (!isset($this->arrSql['search_status'])) {
         $this->arrSql['search_status'] = '';
     }
     if (is_array($this->arrSql['search_status'])) {
         $arrStatusVal = $this->setItemTerm($this->arrSql['search_status'], 'status');
         foreach ($arrStatusVal as $data) {
             $this->arrVal[] = $data;
         }
     }
     $this->setOrder('customer_id DESC');
 }
 /**
  * 検索条件のwhere文とかを取得
  *
  * @return array
  */
 public function lfGetSearchCondition(&$arrSearchData)
 {
     $searchCondition = parent::lfGetSearchCondition($arrSearchData);
     GC_Utils_Ex::gfPrintLog(print_r($this->arrForm, true), DEBUG_LOG_REALFILE);
     $objSql = new SC_SelectSql_Ex();
     $objSql->setWhere($searchCondition['where']);
     $character_id = $this->arrForm['character_id'];
     if (SC_Utils_Ex::sfIsInt($character_id)) {
         $this->arrSearchData["character_id"] = $character_id;
         $objSql->setWhere("product_id IN (\n                        SELECT product_id\n                        FROM cp_dtb_product_characters\n                        INNER JOIN cp_dtb_character USING(character_id)\n                        WHERE character_id = ?\n                        AND   cp_dtb_character.status  = 1\n                        AND   cp_dtb_character.del_flg = 0\n                    )");
         $searchCondition['arrval'][] = intval($character_id);
     }
     $searchCondition['where'] = $objSql->getWhere(false);
     $searchCondition['where_for_count'] = $objSql->getWhere(false);
     return $searchCondition;
 }
 public function getWhere()
 {
     return array(parent::getWhere(), $this->arrVal);
 }
 /**
  * クエリを構築する.
  *
  * 検索条件のキーに応じた WHERE 句と, クエリパラメーターを構築する.
  * クエリパラメーターは, SC_FormParam の入力値から取得する.
  *
  * 構築内容は, 引数の $where 及び $arrValues にそれぞれ追加される.
  *
  * @param  string       $key          検索条件のキー
  * @param  string       $where        構築する WHERE 句
  * @param  array        $arrValues    構築するクエリパラメーター
  * @param  SC_FormParam $objFormParam SC_FormParam インスタンス
  * @param  SC_FormParam $objDb        SC_Helper_DB_Ex インスタンス
  * @return void
  */
 public function buildQuery($key, &$where, &$arrValues, SC_FormParam &$objFormParam, SC_Helper_DB &$objDb)
 {
     $objSql = new SC_SelectSql_Ex();
     $objSql->setWhere($where);
     $objQuery = new SC_Query_Ex("", false, true);
     $data = array();
     $id = "product_id";
     $extends = true;
     $value = $objFormParam->getValue($key);
     switch ($key) {
         case "search_orderby":
             $column = "update_date";
             switch ($value) {
                 default:
                 case "date":
                     $column = "auto_display_start_date";
             }
             if ($objDb->sfColumnExists("dtb_products", $column)) {
                 $this->order = $column;
             }
             break;
         case "search_character_id":
             $sub_query = $objQuery->getSql($id, "cp_dtb_product_characters", "character_id=?");
             $objSql->setWhere("{$id} IN ({$sub_query})");
             $arrValues[] = $value;
             break;
         case "search_auto_display_status":
             if (is_array($value)) {
                 $data = $objSql->setItemTerm($value, "auto_display_status");
             } elseif (is_string($value)) {
                 $data = $objSql->setItemTerm((array) $value, "auto_display_status");
             }
             break;
         case "search_auto_display_start_date_start_year":
         case "search_auto_display_start_date_end_year":
         case "search_auto_display_end_date_start_year":
         case "search_auto_display_end_date_end_year":
         case "search_spass_provide_start_date_start_year":
         case "search_spass_provide_start_date_end_year":
         case "search_spass_provide_end_date_start_year":
         case "search_spass_provide_end_date_end_year":
             $y = $objFormParam->getValue($key);
             $m = $objFormParam->getValue(str_replace("_year", "_month", $key));
             $d = $objFormParam->getValue(str_replace("_year", "_day", $key));
             switch ($key) {
                 case "search_auto_display_start_date_start_year":
                     $data = $objSql->selectTermRange($y, $m, $d, "", "", "", "auto_display_start_date");
                     break;
                 case "search_auto_display_start_date_end_year":
                     $data = $objSql->selectTermRange("", "", "", $y, $m, $d, "auto_display_start_date");
                     break;
                 case "search_auto_display_end_date_start_year":
                     $data = $objSql->selectTermRange($y, $m, $d, "", "", "", "auto_display_end_date");
                     break;
                 case "search_auto_display_end_date_end_year":
                     $data = $objSql->selectTermRange("", "", "", $y, $m, $d, "auto_display_end_date");
                     break;
                 case "search_spass_provide_start_date_start_year":
                     $data = $objSql->selectTermRange($y, $m, $d, "", "", "", "spass_provide_start_date");
                     break;
                 case "search_search_spass_provide_start_date_end_year":
                     $data = $objSql->selectTermRange("", "", "", $y, $m, $d, "spass_provide_start_date");
                     break;
                 case "search_search_spass_provide_end_date_start_year":
                     $data = $objSql->selectTermRange($y, $m, $d, "", "", "", "spass_provide_end_date");
                     break;
                 case "search_search_spass_provide_end_date_end_year":
                     $data = $objSql->selectTermRange("", "", "", $y, $m, $d, "spass_provide_end_date");
                     break;
             }
             break;
         default:
             $extends = false;
             parent::buildQuery($key, $where, $arrValues, $objFormParam, $objDb);
     }
     if ($extends) {
         foreach ($data as $d) {
             $arrValues[] = $d;
         }
         $where = $objSql->getWhere();
     }
 }
 /**
  * クエリを構築する.
  *
  * 検索条件のキーに応じた WHERE 句と, クエリパラメーターを構築する.
  * クエリパラメーターは, SC_FormParam の入力値から取得する.
  *
  * 構築内容は, 引数の $where 及び $arrValues にそれぞれ追加される.
  *
  * @param  string       $key          検索条件のキー
  * @param  string       $where        構築する WHERE 句
  * @param  array        $arrValues    構築するクエリパラメーター
  * @param  SC_FormParam $objFormParam SC_FormParam インスタンス
  * @return void
  */
 public function buildQuery($key, &$where, &$arrValues, &$objFormParam)
 {
     $dbFactory = SC_DB_DBFactory_Ex::getInstance();
     switch ($key) {
         case 'search_product_name':
             $where .= ' AND EXISTS (SELECT 1 FROM dtb_order_detail od WHERE od.order_id = dtb_order.order_id AND od.product_name LIKE ?)';
             $arrValues[] = sprintf('%%%s%%', $objFormParam->getValue($key));
             break;
         case 'search_order_name':
             $where .= ' AND ' . $dbFactory->concatColumn(array('order_name01', 'order_name02')) . ' LIKE ?';
             $arrValues[] = sprintf('%%%s%%', preg_replace('/[  ]/u', '', $objFormParam->getValue($key)));
             break;
         case 'search_order_kana':
             $where .= ' AND ' . $dbFactory->concatColumn(array('order_kana01', 'order_kana02')) . ' LIKE ?';
             $arrValues[] = sprintf('%%%s%%', preg_replace('/[  ]/u', '', $objFormParam->getValue($key)));
             break;
         case 'search_order_id1':
             $where .= ' AND order_id >= ?';
             $arrValues[] = sprintf('%d', $objFormParam->getValue($key));
             break;
         case 'search_order_id2':
             $where .= ' AND order_id <= ?';
             $arrValues[] = sprintf('%d', $objFormParam->getValue($key));
             break;
         case 'search_order_sex':
             $tmp_where = '';
             foreach ($objFormParam->getValue($key) as $element) {
                 if ($element != '') {
                     if (SC_Utils_Ex::isBlank($tmp_where)) {
                         $tmp_where .= ' AND (order_sex = ?';
                     } else {
                         $tmp_where .= ' OR order_sex = ?';
                     }
                     $arrValues[] = $element;
                 }
             }
             if (!SC_Utils_Ex::isBlank($tmp_where)) {
                 $tmp_where .= ')';
                 $where .= " {$tmp_where} ";
             }
             break;
         case 'search_order_tel':
             $where .= ' AND (' . $dbFactory->concatColumn(array('order_tel01', 'order_tel02', 'order_tel03')) . ' LIKE ?)';
             $arrValues[] = SC_SelectSql_Ex::addSearchStr(preg_replace('/[()-]+/', '', $objFormParam->getValue($key)));
             break;
         case 'search_order_email':
             $where .= ' AND order_email LIKE ?';
             $arrValues[] = sprintf('%%%s%%', $objFormParam->getValue($key));
             break;
         case 'search_payment_id':
             $tmp_where = '';
             foreach ($objFormParam->getValue($key) as $element) {
                 if ($element != '') {
                     if ($tmp_where == '') {
                         $tmp_where .= ' AND (payment_id = ?';
                     } else {
                         $tmp_where .= ' OR payment_id = ?';
                     }
                     $arrValues[] = $element;
                 }
             }
             if (!SC_Utils_Ex::isBlank($tmp_where)) {
                 $tmp_where .= ')';
                 $where .= " {$tmp_where} ";
             }
             break;
         case 'search_total1':
             $where .= ' AND total >= ?';
             $arrValues[] = sprintf('%d', $objFormParam->getValue($key));
             break;
         case 'search_total2':
             $where .= ' AND total <= ?';
             $arrValues[] = sprintf('%d', $objFormParam->getValue($key));
             break;
         case 'search_sorderyear':
             $date = SC_Utils_Ex::sfGetTimestamp($objFormParam->getValue('search_sorderyear'), $objFormParam->getValue('search_sordermonth'), $objFormParam->getValue('search_sorderday'));
             $where .= ' AND create_date >= ?';
             $arrValues[] = $date;
             break;
         case 'search_eorderyear':
             $date = SC_Utils_Ex::sfGetTimestamp($objFormParam->getValue('search_eorderyear'), $objFormParam->getValue('search_eordermonth'), $objFormParam->getValue('search_eorderday'), true);
             $where .= ' AND create_date <= ?';
             $arrValues[] = $date;
             break;
         case 'search_supdateyear':
             $date = SC_Utils_Ex::sfGetTimestamp($objFormParam->getValue('search_supdateyear'), $objFormParam->getValue('search_supdatemonth'), $objFormParam->getValue('search_supdateday'));
             $where .= ' AND update_date >= ?';
             $arrValues[] = $date;
             break;
         case 'search_eupdateyear':
             $date = SC_Utils_Ex::sfGetTimestamp($objFormParam->getValue('search_eupdateyear'), $objFormParam->getValue('search_eupdatemonth'), $objFormParam->getValue('search_eupdateday'), true);
             $where .= ' AND update_date <= ?';
             $arrValues[] = $date;
             break;
         case 'search_sbirthyear':
             $date = SC_Utils_Ex::sfGetTimestamp($objFormParam->getValue('search_sbirthyear'), $objFormParam->getValue('search_sbirthmonth'), $objFormParam->getValue('search_sbirthday'));
             $where .= ' AND order_birth >= ?';
             $arrValues[] = $date;
             break;
         case 'search_ebirthyear':
             $date = SC_Utils_Ex::sfGetTimestamp($objFormParam->getValue('search_ebirthyear'), $objFormParam->getValue('search_ebirthmonth'), $objFormParam->getValue('search_ebirthday'), true);
             $where .= ' AND order_birth <= ?';
             $arrValues[] = $date;
             break;
         case 'search_order_status':
             $where .= ' AND status = ?';
             $arrValues[] = $objFormParam->getValue($key);
             break;
         default:
             break;
     }
 }
예제 #7
0
 /**
  * 開始行番号, 行数を指定して管理者データを取得する.
  *
  * @access private
  * @param integer $startno 開始行番号
  * @return array 管理者データの連想配列
  */
 function getMemberData($startno)
 {
     $objSql = new SC_SelectSql_Ex();
     $objSql->setSelect("SELECT member_id,name,department,login_id,authority,rank,work FROM dtb_member");
     $objSql->setOrder("rank DESC");
     $objSql->setWhere("del_flg <> 1 AND member_id <> " . ADMIN_ID);
     $objSql->setLimitOffset(MEMBER_PMAX, $startno);
     $objQuery =& SC_Query_Ex::getSingletonInstance();
     $arrMemberData = $objQuery->getAll($objSql->getSql());
     return $arrMemberData;
 }
 function setItemTerm($arr, $ItemStr)
 {
     if (is_array($arr)) {
         $arr = array_filter($arr, "strlen");
         $this->arrWhereVal = array_merge($this->arrWhereVal, parent::setItemTerm($arr, $ItemStr));
     }
 }