- Timestamp:
- 2012/02/06 11:05:15 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/SC_CustomerList.php
r21420 r21441 37 37 $dbFactory = SC_DB_DBFactory_Ex::getInstance(); 38 38 39 if ($mode == "") {39 if ($mode == "") { 40 40 // 会員本登録会員で削除していない会員 41 41 $this->setWhere("status = 2 AND del_flg = 0 "); … … 44 44 } 45 45 46 if ($mode == 'customer') {46 if ($mode == 'customer') { 47 47 $this->setWhere( " del_flg = 0 "); 48 48 // 登録日を示すカラム … … 52 52 // 会員ID 53 53 if (!isset($this->arrSql['search_customer_id'])) $this->arrSql['search_customer_id'] = ""; 54 if ( 54 if (strlen($this->arrSql['search_customer_id']) > 0 ) { 55 55 $this->setWhere( "customer_id = ?" ); 56 56 $this->arrVal[] = $this->arrSql['search_customer_id']; … … 59 59 // 名前 60 60 if (!isset($this->arrSql['search_name'])) $this->arrSql['search_name'] = ""; 61 if ( 61 if (strlen($this->arrSql['search_name']) > 0 ) { 62 62 $this->setWhere("(" . $dbFactory->concatColumn(array("name01", "name02")) . " LIKE ?)" ); 63 63 $searchName = $this->addSearchStr($this->arrSql['search_name']); … … 67 67 // 名前(フリガナ) 68 68 if (!isset($this->arrSql['search_kana'])) $this->arrSql['search_kana'] = ""; 69 if ( 69 if (strlen($this->arrSql['search_kana']) > 0 ) { 70 70 $this->setWhere("(" . $dbFactory->concatColumn(array("kana01", "kana02")) . " LIKE ?)" ); 71 71 $searchKana = $this->addSearchStr($this->arrSql['search_kana']); … … 75 75 // 都道府県 76 76 if (!isset($this->arrSql['search_pref'])) $this->arrSql['search_pref'] = ""; 77 if ( 77 if (strlen($this->arrSql['search_pref']) > 0 ) { 78 78 $this->setWhere( "pref = ?" ); 79 79 $this->arrVal[] = $this->arrSql['search_pref']; … … 82 82 // 電話番号 83 83 if (!isset($this->arrSql['search_tel'])) $this->arrSql['search_tel'] = ""; 84 if ( 84 if (is_numeric( $this->arrSql['search_tel'] ) ) { 85 85 $this->setWhere("(" . $dbFactory->concatColumn(array("tel01", "tel02", "tel03")) . " LIKE ?)" ); 86 86 $searchTel = $this->addSearchStr($this->arrSql['search_tel']); … … 90 90 // 性別 91 91 if (!isset($this->arrSql['search_sex'])) $this->arrSql['search_sex'] = ""; 92 if ( is_array( $this->arrSql['search_sex'] ) ){92 if (is_array( $this->arrSql['search_sex'] ) ) { 93 93 $arrSexVal = $this->setItemTerm( $this->arrSql['search_sex'] ,'sex' ); 94 94 foreach ($arrSexVal as $data) { … … 99 99 // 職業 100 100 if (!isset($this->arrSql['search_job'])) $this->arrSql['search_job'] = ""; 101 if ( is_array( $this->arrSql['search_job'] ) ){102 if ( 101 if (is_array( $this->arrSql['search_job'] ) ) { 102 if (in_array("不明", $this->arrSql['search_job'] ) ) { 103 103 $arrJobVal = $this->setItemTermWithNull( $this->arrSql['search_job'] ,'job' ); 104 104 } else { … … 118 118 $this->arrSql['search_email'] = explode(",", $this->arrSql['search_email']); 119 119 $sql_where = ""; 120 foreach ($this->arrSql['search_email'] as $val) {120 foreach ($this->arrSql['search_email'] as $val) { 121 121 $val = trim($val); 122 122 //検索条件を含まない 123 if ($this->arrSql['not_emailinc'] == '1') {124 if ($sql_where == "") {123 if ($this->arrSql['not_emailinc'] == '1') { 124 if ($sql_where == "") { 125 125 $sql_where .= "dtb_customer.email NOT ILIKE ? "; 126 126 } else { … … 128 128 } 129 129 } else { 130 if ($sql_where == "") {130 if ($sql_where == "") { 131 131 $sql_where .= "dtb_customer.email ILIKE ? "; 132 132 } else { … … 147 147 $this->arrSql['search_email_mobile'] = explode(",", $this->arrSql['search_email_mobile']); 148 148 $sql_where = ""; 149 foreach ($this->arrSql['search_email_mobile'] as $val) {149 foreach ($this->arrSql['search_email_mobile'] as $val) { 150 150 $val = trim($val); 151 151 //検索条件を含まない 152 if ($this->arrSql['not_email_mobileinc'] == '1') {153 if ($sql_where == "") {152 if ($this->arrSql['not_email_mobileinc'] == '1') { 153 if ($sql_where == "") { 154 154 $sql_where .= "dtb_customer.email_mobile NOT ILIKE ? "; 155 155 } else { … … 157 157 } 158 158 } else { 159 if ($sql_where == "") {159 if ($sql_where == "") { 160 160 $sql_where .= "dtb_customer.email_mobile ILIKE ? "; 161 161 } else { … … 170 170 171 171 // メールマガジンの場合 172 if ($mode == 'customer') {172 if ($mode == 'customer') { 173 173 // メルマガ受け取りの選択項目がフォームに存在する場合 174 if ( isset($this->arrSql['search_htmlmail'])){175 if (SC_Utils_Ex::sfIsInt($this->arrSql['search_htmlmail'])) {174 if (isset($this->arrSql['search_htmlmail'])) { 175 if (SC_Utils_Ex::sfIsInt($this->arrSql['search_htmlmail'])) { 176 176 $this->setWhere("mailmaga_flg = ?"); 177 177 $this->arrVal[] = $this->arrSql['search_htmlmail']; … … 184 184 185 185 // 配信メールアドレス種別 186 if ( $mode == 'customer' ){187 if (isset($this->arrSql['search_mail_type'])) {186 if ($mode == 'customer' ) { 187 if (isset($this->arrSql['search_mail_type'])) { 188 188 $sqlEmailMobileIsEmpty = "(dtb_customer.email_mobile IS NULL OR dtb_customer.email_mobile = '')"; 189 189 switch ($this->arrSql['search_mail_type']) { … … 211 211 if (!isset($this->arrSql['search_buy_total_from'])) $this->arrSql['search_buy_total_from'] = ""; 212 212 if (!isset($this->arrSql['search_buy_total_to'])) $this->arrSql['search_buy_total_to'] = ""; 213 if (is_numeric( $this->arrSql["search_buy_total_from"] ) || is_numeric( $this->arrSql["search_buy_total_to"] ) ) {213 if (is_numeric( $this->arrSql["search_buy_total_from"] ) || is_numeric( $this->arrSql["search_buy_total_to"] ) ) { 214 214 $arrBuyTotal = $this->selectRange($this->arrSql["search_buy_total_from"], $this->arrSql["search_buy_total_to"], "buy_total"); 215 215 foreach ($arrBuyTotal as $data) { … … 221 221 if (!isset($this->arrSql['search_buy_times_from'])) $this->arrSql['search_buy_times_from'] = ""; 222 222 if (!isset($this->arrSql['search_buy_times_to'])) $this->arrSql['search_buy_times_to'] = ""; 223 if (is_numeric( $this->arrSql["search_buy_times_from"] ) || is_numeric( $this->arrSql["search_buy_times_to"] ) ) {223 if (is_numeric( $this->arrSql["search_buy_times_from"] ) || is_numeric( $this->arrSql["search_buy_times_to"] ) ) { 224 224 $arrBuyTimes = $this->selectRange($this->arrSql["search_buy_times_from"], $this->arrSql["search_buy_times_to"], "buy_times"); 225 225 foreach ($arrBuyTimes as $data) { … … 288 288 // 購入商品コード 289 289 if (!isset($this->arrSql['search_buy_product_code'])) $this->arrSql['search_buy_product_code'] = ""; 290 if ( 290 if (strlen($this->arrSql['search_buy_product_code']) > 0 ) { 291 291 $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)"); 292 292 $search_buyproduct_code = $this->addSearchStr($this->arrSql['search_buy_product_code']); … … 296 296 // 購入商品名称 297 297 if (!isset($this->arrSql['search_buy_product_name'])) $this->arrSql['search_buy_product_name'] = ""; 298 if ( 298 if (strlen($this->arrSql['search_buy_product_name']) > 0 ) { 299 299 $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)"); 300 300 $search_buyproduct_name = $this->addSearchStr($this->arrSql['search_buy_product_name']); … … 304 304 // カテゴリを選択している場合のみ絞込検索を行う 305 305 if (!isset($this->arrSql['search_category_id'])) $this->arrSql['search_category_id'] = ""; 306 if ( strlen($this->arrSql['search_category_id']) > 0){306 if (strlen($this->arrSql['search_category_id']) > 0) { 307 307 // カテゴリで絞込検索を行うSQL文生成 308 308 list($tmp_where, $tmp_arrval) = $objDb->sfGetCatWhere($this->arrSql['search_category_id']); 309 309 310 310 // カテゴリで絞込みが可能の場合 311 if ($tmp_where != "") {311 if ($tmp_where != "") { 312 312 $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)) "); 313 313 $this->arrVal = array_merge((array)$this->arrVal, (array)$tmp_arrval); … … 317 317 // 会員状態 318 318 if (!isset($this->arrSql['search_status'])) $this->arrSql['search_status'] = ""; 319 if ( is_array( $this->arrSql['search_status'] ) ){319 if (is_array( $this->arrSql['search_status'] ) ) { 320 320 $arrStatusVal = $this->setItemTerm( $this->arrSql['search_status'] ,'status' ); 321 321 foreach ($arrStatusVal as $data) {
Note: See TracChangeset
for help on using the changeset viewer.