- Timestamp:
- 2012/02/15 19:56:17 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/SC_CustomerList.php
r21481 r21514 37 37 $dbFactory = SC_DB_DBFactory_Ex::getInstance(); 38 38 39 if ($mode == "") {39 if ($mode == '') { 40 40 // 会員本登録会員で削除していない会員 41 $this->setWhere( "status = 2 AND del_flg = 0 ");41 $this->setWhere('status = 2 AND del_flg = 0 '); 42 42 // 登録日を示すカラム 43 43 $regdate_col = 'dtb_customer.update_date'; … … 45 45 46 46 if ($mode == 'customer') { 47 $this->setWhere( " del_flg = 0 ");47 $this->setWhere(' del_flg = 0 '); 48 48 // 登録日を示すカラム 49 49 $regdate_col = 'dtb_customer.update_date'; … … 53 53 if (!isset($this->arrSql['search_customer_id'])) $this->arrSql['search_customer_id'] = ""; 54 54 if (strlen($this->arrSql['search_customer_id']) > 0) { 55 $this->setWhere( "customer_id = ?");55 $this->setWhere('customer_id = ?'); 56 56 $this->arrVal[] = $this->arrSql['search_customer_id']; 57 57 } … … 60 60 if (!isset($this->arrSql['search_name'])) $this->arrSql['search_name'] = ""; 61 61 if (strlen($this->arrSql['search_name']) > 0) { 62 $this->setWhere( "(". $dbFactory->concatColumn(array('name01', 'name02')) . " LIKE ?)");62 $this->setWhere('(' . $dbFactory->concatColumn(array('name01', 'name02')) . " LIKE ?)"); 63 63 $searchName = $this->addSearchStr($this->arrSql['search_name']); 64 $this->arrVal[] = mb_ereg_replace( "[ ]+","",$searchName);64 $this->arrVal[] = mb_ereg_replace('[ ]+','',$searchName); 65 65 } 66 66 … … 68 68 if (!isset($this->arrSql['search_kana'])) $this->arrSql['search_kana'] = ""; 69 69 if (strlen($this->arrSql['search_kana']) > 0) { 70 $this->setWhere( "(". $dbFactory->concatColumn(array('kana01', 'kana02')) . " LIKE ?)");70 $this->setWhere('(' . $dbFactory->concatColumn(array('kana01', 'kana02')) . " LIKE ?)"); 71 71 $searchKana = $this->addSearchStr($this->arrSql['search_kana']); 72 $this->arrVal[] = mb_ereg_replace( "[ ]+","",$searchKana);72 $this->arrVal[] = mb_ereg_replace('[ ]+','',$searchKana); 73 73 } 74 74 … … 76 76 if (!isset($this->arrSql['search_pref'])) $this->arrSql['search_pref'] = ""; 77 77 if (strlen($this->arrSql['search_pref']) > 0) { 78 $this->setWhere( "pref = ?");78 $this->setWhere('pref = ?'); 79 79 $this->arrVal[] = $this->arrSql['search_pref']; 80 80 } … … 83 83 if (!isset($this->arrSql['search_tel'])) $this->arrSql['search_tel'] = ""; 84 84 if (is_numeric($this->arrSql['search_tel'])) { 85 $this->setWhere( "(". $dbFactory->concatColumn(array('tel01', 'tel02', 'tel03')) . " LIKE ?)");85 $this->setWhere('(' . $dbFactory->concatColumn(array('tel01', 'tel02', 'tel03')) . " LIKE ?)"); 86 86 $searchTel = $this->addSearchStr($this->arrSql['search_tel']); 87 $this->arrVal[] = ereg_replace( "-", "", $searchTel);87 $this->arrVal[] = ereg_replace('-', '', $searchTel); 88 88 } 89 89 … … 100 100 if (!isset($this->arrSql['search_job'])) $this->arrSql['search_job'] = ""; 101 101 if (is_array($this->arrSql['search_job'])) { 102 if (in_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 { … … 116 116 if (strlen($this->arrSql['search_email']) > 0) { 117 117 //カンマ区切りで複数の条件指定可能に 118 $this->arrSql['search_email'] = explode( ",", $this->arrSql['search_email']);119 $sql_where = "";118 $this->arrSql['search_email'] = explode(',', $this->arrSql['search_email']); 119 $sql_where = ''; 120 120 foreach ($this->arrSql['search_email'] as $val) { 121 121 $val = trim($val); 122 122 //検索条件を含まない 123 123 if ($this->arrSql['not_emailinc'] == '1') { 124 if ($sql_where == "") {125 $sql_where .= "dtb_customer.email NOT ILIKE ? ";124 if ($sql_where == '') { 125 $sql_where .= 'dtb_customer.email NOT ILIKE ? '; 126 126 } else { 127 $sql_where .= "AND dtb_customer.email NOT ILIKE ? ";127 $sql_where .= 'AND dtb_customer.email NOT ILIKE ? '; 128 128 } 129 129 } else { 130 if ($sql_where == "") {131 $sql_where .= "dtb_customer.email ILIKE ? ";130 if ($sql_where == '') { 131 $sql_where .= 'dtb_customer.email ILIKE ? '; 132 132 } else { 133 $sql_where .= "OR dtb_customer.email ILIKE ? ";133 $sql_where .= 'OR dtb_customer.email ILIKE ? '; 134 134 } 135 135 } … … 145 145 if (strlen($this->arrSql['search_email_mobile']) > 0) { 146 146 //カンマ区切りで複数の条件指定可能に 147 $this->arrSql['search_email_mobile'] = explode( ",", $this->arrSql['search_email_mobile']);148 $sql_where = "";147 $this->arrSql['search_email_mobile'] = explode(',', $this->arrSql['search_email_mobile']); 148 $sql_where = ''; 149 149 foreach ($this->arrSql['search_email_mobile'] as $val) { 150 150 $val = trim($val); 151 151 //検索条件を含まない 152 152 if ($this->arrSql['not_email_mobileinc'] == '1') { 153 if ($sql_where == "") {154 $sql_where .= "dtb_customer.email_mobile NOT ILIKE ? ";153 if ($sql_where == '') { 154 $sql_where .= 'dtb_customer.email_mobile NOT ILIKE ? '; 155 155 } else { 156 $sql_where .= "AND dtb_customer.email_mobile NOT ILIKE ? ";156 $sql_where .= 'AND dtb_customer.email_mobile NOT ILIKE ? '; 157 157 } 158 158 } else { 159 if ($sql_where == "") {160 $sql_where .= "dtb_customer.email_mobile ILIKE ? ";159 if ($sql_where == '') { 160 $sql_where .= 'dtb_customer.email_mobile ILIKE ? '; 161 161 } else { 162 $sql_where .= "OR dtb_customer.email_mobile ILIKE ? ";162 $sql_where .= 'OR dtb_customer.email_mobile ILIKE ? '; 163 163 } 164 164 } … … 174 174 if (isset($this->arrSql['search_htmlmail'])) { 175 175 if (SC_Utils_Ex::sfIsInt($this->arrSql['search_htmlmail'])) { 176 $this->setWhere( "mailmaga_flg = ?");176 $this->setWhere('mailmaga_flg = ?'); 177 177 $this->arrVal[] = $this->arrSql['search_htmlmail']; 178 178 } else { 179 179 // メルマガ購読拒否は省く 180 $this->setWhere( "mailmaga_flg <> 3");180 $this->setWhere('mailmaga_flg <> 3'); 181 181 } 182 182 } … … 248 248 if (!isset($this->arrSql['search_birth_month'])) $this->arrSql['search_birth_month'] = ""; 249 249 if (is_numeric($this->arrSql['search_birth_month'])) { 250 $this->setWhere( " EXTRACT(month from birth) = ?");250 $this->setWhere(' EXTRACT(month from birth) = ?'); 251 251 $this->arrVal[] = $this->arrSql['search_birth_month']; 252 252 } … … 289 289 if (!isset($this->arrSql['search_buy_product_code'])) $this->arrSql['search_buy_product_code'] = ""; 290 290 if (strlen($this->arrSql['search_buy_product_code']) > 0) { 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)");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']); 293 293 $this->arrVal[] = $search_buyproduct_code; … … 297 297 if (!isset($this->arrSql['search_buy_product_name'])) $this->arrSql['search_buy_product_name'] = ""; 298 298 if (strlen($this->arrSql['search_buy_product_name']) > 0) { 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)");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']); 301 301 $this->arrVal[] = $search_buyproduct_name; … … 309 309 310 310 // カテゴリで絞込みが可能の場合 311 if ($tmp_where != "") {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)) ");311 if ($tmp_where != '') { 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); 314 314 } … … 324 324 } 325 325 326 $this->setOrder( "customer_id DESC");326 $this->setOrder('customer_id DESC'); 327 327 } 328 328 329 329 // 検索用SQL 330 330 function getList() { 331 $this->select = "SELECT customer_id,name01,name02,kana01,kana02,sex,email,email_mobile,tel01,tel02,tel03,pref,status,update_date,mailmaga_flg FROM dtb_customer ";331 $this->select = 'SELECT customer_id,name01,name02,kana01,kana02,sex,email,email_mobile,tel01,tel02,tel03,pref,status,update_date,mailmaga_flg FROM dtb_customer '; 332 332 return $this->getSql(0); 333 333 } … … 346 346 // 検索総数カウント用SQL 347 347 function getListCount() { 348 $this->select = "SELECT COUNT(customer_id) FROM dtb_customer ";348 $this->select = 'SELECT COUNT(customer_id) FROM dtb_customer '; 349 349 return $this->getSql(1); 350 350 } … … 355 355 $i = 0; 356 356 foreach ($this->arrColumnCSV as $val) { 357 if ($i != 0) $state .= ", ";357 if ($i != 0) $state .= ', '; 358 358 $state .= $val['sql']; 359 359 $i ++; 360 360 } 361 361 362 $this->select = "SELECT " .$state. " FROM dtb_customer ";362 $this->select = 'SELECT ' .$state. ' FROM dtb_customer '; 363 363 return $this->getSql(2); 364 364 }
Note: See TracChangeset
for help on using the changeset viewer.
