Changeset 20281 for branches/version-2_5-dev/data/class/SC_CustomerList.php
- Timestamp:
- 2011/02/21 02:13:44 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/class/SC_CustomerList.php
r20273 r20281 51 51 52 52 // 顧客ID 53 if (!isset($this->arrSql[' customer_id'])) $this->arrSql['customer_id'] = "";54 if ( strlen($this->arrSql[' customer_id']) > 0 ) {53 if (!isset($this->arrSql['search_customer_id'])) $this->arrSql['search_customer_id'] = ""; 54 if ( strlen($this->arrSql['search_customer_id']) > 0 ) { 55 55 $this->setWhere( "customer_id = ?" ); 56 $this->arrVal[] = $this->arrSql[' customer_id'];56 $this->arrVal[] = $this->arrSql['search_customer_id']; 57 57 } 58 58 59 59 // 名前 60 if (!isset($this->arrSql[' name'])) $this->arrSql['name'] = "";61 if ( strlen($this->arrSql[' name']) > 0 ) {60 if (!isset($this->arrSql['search_name'])) $this->arrSql['search_name'] = ""; 61 if ( strlen($this->arrSql['search_name']) > 0 ) { 62 62 $this->setWhere("(" . $dbFactory->concatColumn(array("name01", "name02")) . " LIKE ?)" ); 63 $searchName = $this->addSearchStr($this->arrSql[' name']);63 $searchName = $this->addSearchStr($this->arrSql['search_name']); 64 64 $this->arrVal[] = mb_ereg_replace("[ ]+","",$searchName); 65 65 } 66 66 67 67 // 名前(カナ) 68 if (!isset($this->arrSql[' kana'])) $this->arrSql['kana'] = "";69 if ( strlen($this->arrSql[' kana']) > 0 ) {68 if (!isset($this->arrSql['search_kana'])) $this->arrSql['search_kana'] = ""; 69 if ( strlen($this->arrSql['search_kana']) > 0 ) { 70 70 $this->setWhere("(" . $dbFactory->concatColumn(array("kana01", "kana02")) . " LIKE ?)" ); 71 $searchKana = $this->addSearchStr($this->arrSql[' kana']);71 $searchKana = $this->addSearchStr($this->arrSql['search_kana']); 72 72 $this->arrVal[] = mb_ereg_replace("[ ]+","",$searchKana); 73 73 } 74 74 75 75 // 都道府県 76 if (!isset($this->arrSql[' pref'])) $this->arrSql['pref'] = "";77 if ( strlen($this->arrSql[' pref']) > 0 ) {76 if (!isset($this->arrSql['search_pref'])) $this->arrSql['search_pref'] = ""; 77 if ( strlen($this->arrSql['search_pref']) > 0 ) { 78 78 $this->setWhere( "pref = ?" ); 79 $this->arrVal[] = $this->arrSql[' pref'];79 $this->arrVal[] = $this->arrSql['search_pref']; 80 80 } 81 81 82 82 // 電話番号 83 if (!isset($this->arrSql[' tel'])) $this->arrSql['tel'] = "";84 if ( is_numeric( $this->arrSql[' tel'] ) ) {83 if (!isset($this->arrSql['search_tel'])) $this->arrSql['search_tel'] = ""; 84 if ( is_numeric( $this->arrSql['search_tel'] ) ) { 85 85 $this->setWhere("(" . $dbFactory->concatColumn(array("tel01", "tel02", "tel03")) . " LIKE ?)" ); 86 $searchTel = $this->addSearchStr($this->arrSql[' tel']);86 $searchTel = $this->addSearchStr($this->arrSql['search_tel']); 87 87 $this->arrVal[] = ereg_replace("-", "", $searchTel); 88 88 } 89 89 90 90 // 性別 91 if (!isset($this->arrSql['se x'])) $this->arrSql['sex'] = "";92 if ( is_array( $this->arrSql['se x'] ) ){93 $arrSexVal = $this->setItemTerm( $this->arrSql['se x'] ,"sex" );91 if (!isset($this->arrSql['search_sex'])) $this->arrSql['search_sex'] = ""; 92 if ( is_array( $this->arrSql['search_sex'] ) ){ 93 $arrSexVal = $this->setItemTerm( $this->arrSql['search_sex'] ,"sex" ); 94 94 foreach ($arrSexVal as $data) { 95 95 $this->arrVal[] = $data; … … 98 98 99 99 // 職業 100 if (!isset($this->arrSql[' job'])) $this->arrSql['job'] = "";101 if ( is_array( $this->arrSql[' job'] ) ){102 if ( in_array("不明", $this->arrSql[' job'] ) ) {103 $arrJobVal = $this->setItemTermWithNull( $this->arrSql[' job'] ,"job" );100 if (!isset($this->arrSql['search_job'])) $this->arrSql['search_job'] = ""; 101 if ( is_array( $this->arrSql['search_job'] ) ){ 102 if ( in_array("不明", $this->arrSql['search_job'] ) ) { 103 $arrJobVal = $this->setItemTermWithNull( $this->arrSql['search_job'] ,"job" ); 104 104 } else { 105 $arrJobVal = $this->setItemTerm( $this->arrSql[' job'] ,"job" );105 $arrJobVal = $this->setItemTerm( $this->arrSql['search_job'] ,"job" ); 106 106 } 107 107 if (is_array($arrJobVal)) { … … 113 113 114 114 // E-MAIL 115 if (!isset($this->arrSql[' email'])) $this->arrSql['email'] = "";116 if (strlen($this->arrSql[' email']) > 0) {115 if (!isset($this->arrSql['search_email'])) $this->arrSql['search_email'] = ""; 116 if (strlen($this->arrSql['search_email']) > 0) { 117 117 //カンマ区切りで複数の条件指定可能に 118 $this->arrSql[' email'] = explode(",", $this->arrSql['email']);118 $this->arrSql['search_email'] = explode(",", $this->arrSql['search_email']); 119 119 $sql_where = ""; 120 foreach($this->arrSql[' email'] as $val) {120 foreach($this->arrSql['search_email'] as $val) { 121 121 $val = trim($val); 122 122 //検索条件を含まない … … 141 141 142 142 // E-MAIL(mobile) 143 if (!isset($this->arrSql[' email_mobile'])) $this->arrSql['email_mobile'] = "";143 if (!isset($this->arrSql['search_email_mobile'])) $this->arrSql['search_email_mobile'] = ""; 144 144 145 if (strlen($this->arrSql[' email_mobile']) > 0) {145 if (strlen($this->arrSql['search_email_mobile']) > 0) { 146 146 //カンマ区切りで複数の条件指定可能に 147 $this->arrSql[' email_mobile'] = explode(",", $this->arrSql['email_mobile']);147 $this->arrSql['search_email_mobile'] = explode(",", $this->arrSql['search_email_mobile']); 148 148 $sql_where = ""; 149 foreach($this->arrSql[' email_mobile'] as $val) {149 foreach($this->arrSql['search_email_mobile'] as $val) { 150 150 $val = trim($val); 151 151 //検索条件を含まない … … 172 172 if($mode == "customer") { 173 173 // メルマガ受け取りの選択項目がフォームに存在する場合 174 if ( isset($this->arrSql[' htmlmail'])){175 if (SC_Utils_Ex::sfIsInt($this->arrSql[' 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 $this->arrVal[] = $this->arrSql[' htmlmail'];177 $this->arrVal[] = $this->arrSql['search_htmlmail']; 178 178 } else { 179 179 // メルマガ購読拒否は省く … … 185 185 // 配信メールアドレス種別 186 186 if ( $mode == 'customer' ){ 187 if (isset($this->arrSql[' mail_type'])){187 if (isset($this->arrSql['search_mail_type'])){ 188 188 $sqlEmailMobileIsEmpty = "(dtb_customer.email_mobile IS NULL OR dtb_customer.email_mobile = '')"; 189 switch ($this->arrSql[' mail_type']) {189 switch ($this->arrSql['search_mail_type']) { 190 190 // PCメールアドレス 191 191 case 1: … … 209 209 210 210 // 購入金額指定 211 if (!isset($this->arrSql[' buy_total_from'])) $this->arrSql['buy_total_from'] = "";212 if (!isset($this->arrSql[' buy_total_to'])) $this->arrSql['buy_total_to'] = "";213 if( is_numeric( $this->arrSql[" buy_total_from"] ) || is_numeric( $this->arrSql["buy_total_to"] ) ) {214 $arrBuyTotal = $this->selectRange($this->arrSql[" buy_total_from"], $this->arrSql["buy_total_to"], "buy_total");211 if (!isset($this->arrSql['search_buy_total_from'])) $this->arrSql['search_buy_total_from'] = ""; 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"] ) ) { 214 $arrBuyTotal = $this->selectRange($this->arrSql["search_buy_total_from"], $this->arrSql["search_buy_total_to"], "buy_total"); 215 215 foreach ($arrBuyTotal as $data1) { 216 216 $this->arrVal[] = $data1; … … 219 219 220 220 // 購入回数指定 221 if (!isset($this->arrSql[' buy_times_from'])) $this->arrSql['buy_times_from'] = "";222 if (!isset($this->arrSql[' buy_times_to'])) $this->arrSql['buy_times_to'] = "";223 if( is_numeric( $this->arrSql[" buy_times_from"] ) || is_numeric( $this->arrSql["buy_times_to"] ) ) {224 $arrBuyTimes = $this->selectRange($this->arrSql[" buy_times_from"], $this->arrSql["buy_times_to"], "buy_times");221 if (!isset($this->arrSql['search_buy_times_from'])) $this->arrSql['search_buy_times_from'] = ""; 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"] ) ) { 224 $arrBuyTimes = $this->selectRange($this->arrSql["search_buy_times_from"], $this->arrSql["search_buy_times_to"], "buy_times"); 225 225 foreach ($arrBuyTimes as $data2) { 226 226 $this->arrVal[] = $data2; … … 229 229 230 230 // 誕生日期間指定 231 if (!isset($this->arrSql[' b_start_year'])) $this->arrSql['b_start_year'] = "";232 if (!isset($this->arrSql[' b_start_month'])) $this->arrSql['b_start_month'] = "";233 if (!isset($this->arrSql[' b_start_day'])) $this->arrSql['b_start_day'] = "";234 if (!isset($this->arrSql[' b_end_year'])) $this->arrSql['b_end_year'] = "";235 if (!isset($this->arrSql[' b_end_month'])) $this->arrSql['b_end_month'] = "";236 if (!isset($this->arrSql[' b_end_day'])) $this->arrSql['b_end_day'] = "";237 if ( (strlen($this->arrSql[' b_start_year']) > 0 && strlen($this->arrSql['b_start_month']) > 0 && strlen($this->arrSql['b_start_day']) > 0) ||238 strlen($this->arrSql[' b_end_year']) > 0 && strlen($this->arrSql['b_end_month']) > 0 && strlen($this->arrSql['b_end_day']) > 0) {239 240 $arrBirth = $this->selectTermRange($this->arrSql[' b_start_year'], $this->arrSql['b_start_month'], $this->arrSql['b_start_day']241 , $this->arrSql[' b_end_year'], $this->arrSql['b_end_month'], $this->arrSql['b_end_day'], "birth");231 if (!isset($this->arrSql['search_b_start_year'])) $this->arrSql['search_b_start_year'] = ""; 232 if (!isset($this->arrSql['search_b_start_month'])) $this->arrSql['search_b_start_month'] = ""; 233 if (!isset($this->arrSql['search_b_start_day'])) $this->arrSql['search_b_start_day'] = ""; 234 if (!isset($this->arrSql['search_b_end_year'])) $this->arrSql['search_b_end_year'] = ""; 235 if (!isset($this->arrSql['search_b_end_month'])) $this->arrSql['search_b_end_month'] = ""; 236 if (!isset($this->arrSql['search_b_end_day'])) $this->arrSql['search_b_end_day'] = ""; 237 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) || 238 strlen($this->arrSql['search_b_end_year']) > 0 && strlen($this->arrSql['search_b_end_month']) > 0 && strlen($this->arrSql['search_b_end_day']) > 0) { 239 240 $arrBirth = $this->selectTermRange($this->arrSql['search_b_start_year'], $this->arrSql['search_b_start_month'], $this->arrSql['search_b_start_day'] 241 , $this->arrSql['search_b_end_year'], $this->arrSql['search_b_end_month'], $this->arrSql['search_b_end_day'], "birth"); 242 242 if (is_array($arrBirth)) { 243 243 foreach ($arrBirth as $data3) { … … 248 248 249 249 // 誕生月の検索 250 if (!isset($this->arrSql[' birth_month'])) $this->arrSql['birth_month'] = "";251 if (is_numeric($this->arrSql[" birth_month"])) {250 if (!isset($this->arrSql['search_birth_month'])) $this->arrSql['search_birth_month'] = ""; 251 if (is_numeric($this->arrSql["search_birth_month"])) { 252 252 $this->setWhere(" EXTRACT(month from birth) = ?"); 253 $this->arrVal[] = $this->arrSql[" birth_month"];253 $this->arrVal[] = $this->arrSql["search_birth_month"]; 254 254 } 255 255 256 256 // 登録期間指定 257 if (!isset($this->arrSql['s tart_year'])) $this->arrSql['start_year'] = "";258 if (!isset($this->arrSql['s tart_month'])) $this->arrSql['start_month'] = "";259 if (!isset($this->arrSql['s tart_day'])) $this->arrSql['start_day'] = "";260 if (!isset($this->arrSql[' end_year'])) $this->arrSql['end_year'] = "";261 if (!isset($this->arrSql[' end_month'])) $this->arrSql['end_month'] = "";262 if (!isset($this->arrSql[' end_day'])) $this->arrSql['end_day'] = "";263 if ( (strlen($this->arrSql['s tart_year']) > 0 && strlen($this->arrSql['start_month']) > 0 && strlen($this->arrSql['start_day']) > 0 ) ||264 (strlen($this->arrSql[' end_year']) > 0 && strlen($this->arrSql['end_month']) >0 && strlen($this->arrSql['end_day']) > 0) ) {265 266 $arrRegistTime = $this->selectTermRange($this->arrSql['s tart_year'], $this->arrSql['start_month'], $this->arrSql['start_day']267 , $this->arrSql[' end_year'], $this->arrSql['end_month'], $this->arrSql['end_day'], $regdate_col);257 if (!isset($this->arrSql['search_start_year'])) $this->arrSql['search_start_year'] = ""; 258 if (!isset($this->arrSql['search_start_month'])) $this->arrSql['search_start_month'] = ""; 259 if (!isset($this->arrSql['search_start_day'])) $this->arrSql['search_start_day'] = ""; 260 if (!isset($this->arrSql['search_end_year'])) $this->arrSql['search_end_year'] = ""; 261 if (!isset($this->arrSql['search_end_month'])) $this->arrSql['search_end_month'] = ""; 262 if (!isset($this->arrSql['search_end_day'])) $this->arrSql['search_end_day'] = ""; 263 if ( (strlen($this->arrSql['search_start_year']) > 0 && strlen($this->arrSql['search_start_month']) > 0 && strlen($this->arrSql['search_start_day']) > 0 ) || 264 (strlen($this->arrSql['search_end_year']) > 0 && strlen($this->arrSql['search_end_month']) >0 && strlen($this->arrSql['search_end_day']) > 0) ) { 265 266 $arrRegistTime = $this->selectTermRange($this->arrSql['ssearch_tart_year'], $this->arrSql['search_start_month'], $this->arrSql['search_start_day'] 267 , $this->arrSql['search_end_year'], $this->arrSql['search_end_month'], $this->arrSql['search_end_day'], $regdate_col); 268 268 if (is_array($arrRegistTime)) { 269 269 foreach ($arrRegistTime as $data4) { … … 274 274 275 275 // 最終購入日指定 276 if (!isset($this->arrSql[' buy_start_year'])) $this->arrSql['buy_start_year'] = "";277 if (!isset($this->arrSql[' buy_start_month'])) $this->arrSql['buy_start_month'] = "";278 if (!isset($this->arrSql[' buy_start_day'])) $this->arrSql['buy_start_day'] = "";279 if (!isset($this->arrSql[' buy_end_year'])) $this->arrSql['buy_end_year'] = "";280 if (!isset($this->arrSql[' buy_end_month'])) $this->arrSql['buy_end_month'] = "";281 if (!isset($this->arrSql[' buy_end_day'])) $this->arrSql['buy_end_day'] = "";282 283 if ( (strlen($this->arrSql[' buy_start_year']) > 0 && strlen($this->arrSql['buy_start_month']) > 0 && strlen($this->arrSql['buy_start_day']) > 0 ) ||284 (strlen($this->arrSql[' buy_end_year']) > 0 && strlen($this->arrSql['buy_end_month']) >0 && strlen($this->arrSql['buy_end_day']) > 0) ) {285 $arrRegistTime = $this->selectTermRange($this->arrSql[' buy_start_year'], $this->arrSql['buy_start_month'], $this->arrSql['buy_start_day']286 , $this->arrSql[' buy_end_year'], $this->arrSql['buy_end_month'], $this->arrSql['buy_end_day'], "last_buy_date");276 if (!isset($this->arrSql['search_buy_start_year'])) $this->arrSql['search_buy_start_year'] = ""; 277 if (!isset($this->arrSql['search_buy_start_month'])) $this->arrSql['search_buy_start_month'] = ""; 278 if (!isset($this->arrSql['search_buy_start_day'])) $this->arrSql['search_buy_start_day'] = ""; 279 if (!isset($this->arrSql['search_buy_end_year'])) $this->arrSql['search_buy_end_year'] = ""; 280 if (!isset($this->arrSql['search_buy_end_month'])) $this->arrSql['search_buy_end_month'] = ""; 281 if (!isset($this->arrSql['search_buy_end_day'])) $this->arrSql['search_buy_end_day'] = ""; 282 283 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 ) || 284 (strlen($this->arrSql['search_buy_end_year']) > 0 && strlen($this->arrSql['search_buy_end_month']) >0 && strlen($this->arrSql['search_buy_end_day']) > 0) ) { 285 $arrRegistTime = $this->selectTermRange($this->arrSql['search_buy_start_year'], $this->arrSql['search_buy_start_month'], $this->arrSql['search_buy_start_day'] 286 , $this->arrSql['search_buy_end_year'], $this->arrSql['search_buy_end_month'], $this->arrSql['search_buy_end_day'], "last_buy_date"); 287 287 if (is_array($arrRegistTime)) { 288 288 foreach ($arrRegistTime as $data4) { … … 293 293 294 294 // 購入商品コード 295 if (!isset($this->arrSql[' buy_product_code'])) $this->arrSql['buy_product_code'] = "";296 if ( strlen($this->arrSql[' buy_product_code']) > 0 ) {295 if (!isset($this->arrSql['search_buy_product_code'])) $this->arrSql['search_buy_product_code'] = ""; 296 if ( strlen($this->arrSql['search_buy_product_code']) > 0 ) { 297 297 $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 ? ))"); 298 $search_buyproduct_code = $this->addSearchStr($this->arrSql[' buy_product_code']);298 $search_buyproduct_code = $this->addSearchStr($this->arrSql['search_buy_product_code']); 299 299 $this->arrVal[] = $search_buyproduct_code; 300 300 } 301 301 302 302 // 購入商品名称 303 if (!isset($this->arrSql[' buy_product_name'])) $this->arrSql['buy_product_name'] = "";304 if ( strlen($this->arrSql[' buy_product_name']) > 0 ) {303 if (!isset($this->arrSql['search_buy_product_name'])) $this->arrSql['search_buy_product_name'] = ""; 304 if ( strlen($this->arrSql['search_buy_product_name']) > 0 ) { 305 305 $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 ? ))"); 306 $search_buyproduct_name = $this->addSearchStr($this->arrSql[' buy_product_name']);306 $search_buyproduct_name = $this->addSearchStr($this->arrSql['search_buy_product_name']); 307 307 $this->arrVal[] = $search_buyproduct_name; 308 308 } 309 309 310 310 // カテゴリーを選択している場合のみ絞込検索を行う 311 if (!isset($this->arrSql[' category_id'])) $this->arrSql['category_id'] = "";312 if ( strlen($this->arrSql[' category_id']) > 0){311 if (!isset($this->arrSql['search_category_id'])) $this->arrSql['search_category_id'] = ""; 312 if ( strlen($this->arrSql['search_category_id']) > 0){ 313 313 // カテゴリーで絞込検索を行うSQL文生成 314 list($tmp_where, $tmp_arrval) = $objDb->sfGetCatWhere($this->arrSql[' category_id']);314 list($tmp_where, $tmp_arrval) = $objDb->sfGetCatWhere($this->arrSql['search_category_id']); 315 315 316 316 // カテゴリーで絞込みが可能の場合 … … 321 321 } 322 322 // 携帯電話番号 323 if (!isset($this->arrSql[' cell'])) $this->arrSql['cell'] = "";324 if ( is_numeric( $this->arrSql[' cell'] ) ) {323 if (!isset($this->arrSql['search_cell'])) $this->arrSql['search_cell'] = ""; 324 if ( is_numeric( $this->arrSql['search_cell'] ) ) { 325 325 $this->setWhere( "(cell01 || cell02 || cell03 LIKE ?)" ); 326 $searchTel = $this->addSearchStr($this->arrSql[' cell']);326 $searchTel = $this->addSearchStr($this->arrSql['search_cell']); 327 327 $this->arrVal[] = ereg_replace("-", "", $searchTel); 328 328 } 329 329 330 330 // 会員状態 331 if (!isset($this->arrSql['s tatus'])) $this->arrSql['status'] = "";332 if ( is_array( $this->arrSql['s tatus'] ) ){333 $arrStatusVal = $this->setItemTerm( $this->arrSql['s tatus'] ,"status" );331 if (!isset($this->arrSql['search_status'])) $this->arrSql['search_status'] = ""; 332 if ( is_array( $this->arrSql['search_status'] ) ){ 333 $arrStatusVal = $this->setItemTerm( $this->arrSql['search_status'] ,"status" ); 334 334 foreach ($arrStatusVal as $data) { 335 335 $this->arrVal[] = $data;
Note: See TracChangeset
for help on using the changeset viewer.
