| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved. |
|---|
| 4 | * |
|---|
| 5 | * http://www.lockon.co.jp/ |
|---|
| 6 | */ |
|---|
| 7 | $INC_PATH = realpath( dirname( __FILE__) ); |
|---|
| 8 | require( $INC_PATH ."/../conf/conf.php" ); |
|---|
| 9 | /* [̾¾Î] SC_CustomerList |
|---|
| 10 | * [³µÍ×] ²ñ°÷¸¡º÷ÍÑ¥¯¥é¥¹ |
|---|
| 11 | */ |
|---|
| 12 | class SC_CustomerList extends SC_SelectSql { |
|---|
| 13 | |
|---|
| 14 | var $arrColumnCSV; |
|---|
| 15 | |
|---|
| 16 | function SC_CustomerList($array, $mode = '') { |
|---|
| 17 | parent::SC_SelectSql($array); |
|---|
| 18 | |
|---|
| 19 | if($mode == "") { |
|---|
| 20 | // ²ñ°÷ËÜÅÐÏ¿²ñ°÷¤Çºï½ü¤·¤Æ¤¤¤Ê¤¤²ñ°÷ |
|---|
| 21 | $this->setWhere("status = 2 AND del_flg = 0 "); |
|---|
| 22 | // ÅÐÏ¿Æü¤ò¼¨¤¹¥«¥é¥à |
|---|
| 23 | $regdate_col = 'dtb_customer.update_date'; |
|---|
| 24 | } |
|---|
| 25 | |
|---|
| 26 | if($mode == "customer") { |
|---|
| 27 | // ´ÉÍý¼Ô¥Ú¡¼¥¸¸ÜµÒ¸¡º÷¤Î¾ì¹ç²¾ÅÐÏ¿²ñ°÷¤â¸¡º÷ |
|---|
| 28 | $this->setWhere( "(status = 1 OR status = 2) AND del_flg = 0 "); |
|---|
| 29 | // ÅÐÏ¿Æü¤ò¼¨¤¹¥«¥é¥à |
|---|
| 30 | $regdate_col = 'dtb_customer.update_date'; |
|---|
| 31 | } |
|---|
| 32 | |
|---|
| 33 | // ¥á¡¼¥ë¥Þ¥¬¥¸¥ó¤Î¾ì¹ç |
|---|
| 34 | if($mode == "magazine") { |
|---|
| 35 | $this->setWhere("(del_flg = 0 OR del_flg IS NULL)"); |
|---|
| 36 | $this->setWhere("status = 2"); |
|---|
| 37 | |
|---|
| 38 | /*¡¡²ñ°÷¤Î¤ßÂоݤȤ¹¤ë¤¿¤áºï½ü |
|---|
| 39 | if(is_array($this->arrSql['customer'])) { |
|---|
| 40 | $tmp_where = ""; |
|---|
| 41 | foreach($this->arrSql['customer'] as $val) { |
|---|
| 42 | if($tmp_where != "") { |
|---|
| 43 | $tmp_where.= " OR "; |
|---|
| 44 | } |
|---|
| 45 | switch($val) { |
|---|
| 46 | // ²ñ°÷ |
|---|
| 47 | case '1': |
|---|
| 48 | $tmp_where.= "status = 2"; |
|---|
| 49 | break; |
|---|
| 50 | // ¥á¥ë¥Þ¥¬ÅÐÏ¿ |
|---|
| 51 | case '2': |
|---|
| 52 | $tmp_where.= "customer_id IS NULL"; |
|---|
| 53 | break; |
|---|
| 54 | // CSVÅÐÏ¿ |
|---|
| 55 | case '3': |
|---|
| 56 | $tmp_where.= "customer_id IS NULL"; |
|---|
| 57 | break; |
|---|
| 58 | default: |
|---|
| 59 | $tmp_where = ""; |
|---|
| 60 | break; |
|---|
| 61 | } |
|---|
| 62 | } |
|---|
| 63 | if($tmp_where != "") { |
|---|
| 64 | $tmp_where = "(" . $tmp_where . ")"; |
|---|
| 65 | } |
|---|
| 66 | $this->setWhere($tmp_where); |
|---|
| 67 | } |
|---|
| 68 | */ |
|---|
| 69 | // ÅÐÏ¿Æü¤ò¼¨¤¹¥«¥é¥à |
|---|
| 70 | $regdate_col = 'dtb_customer.create_date'; |
|---|
| 71 | } |
|---|
| 72 | |
|---|
| 73 | // ¸ÜµÒID |
|---|
| 74 | if ( strlen($this->arrSql['customer_id']) > 0 ) { |
|---|
| 75 | $this->setWhere( "customer_id = ?" ); |
|---|
| 76 | $this->arrVal[] = $this->arrSql['customer_id']; |
|---|
| 77 | } |
|---|
| 78 | |
|---|
| 79 | // ̾Á° |
|---|
| 80 | if ( strlen($this->arrSql['name']) > 0 ) { |
|---|
| 81 | if(DB_TYPE == "pgsql"){ |
|---|
| 82 | $this->setWhere("(name01 || name02 LIKE ?)" ); |
|---|
| 83 | }elseif(DB_TYPE == "mysql"){ |
|---|
| 84 | $this->setWhere("concat(name01,name02) LIKE ?" ); |
|---|
| 85 | } |
|---|
| 86 | |
|---|
| 87 | $searchName = $this->addSearchStr($this->arrSql['name']); |
|---|
| 88 | $this->arrVal[] = mb_ereg_replace("[ ¡¡]+","",$searchName); |
|---|
| 89 | } |
|---|
| 90 | |
|---|
| 91 | //¡¡Ì¾Á°¡Ê¥«¥Ê¡Ë |
|---|
| 92 | if ( strlen($this->arrSql['kana']) > 0 ) { |
|---|
| 93 | if(DB_TYPE == "pgsql"){ |
|---|
| 94 | $this->setWhere("(kana01 || kana02 LIKE ?)"); |
|---|
| 95 | }elseif(DB_TYPE == "mysql"){ |
|---|
| 96 | $this->setWhere("concat(kana01,kana02) LIKE ?" ); |
|---|
| 97 | } |
|---|
| 98 | $searchKana = $this->addSearchStr($this->arrSql['kana']); |
|---|
| 99 | $this->arrVal[] = mb_ereg_replace("[ ¡¡]+","",$searchKana); |
|---|
| 100 | } |
|---|
| 101 | |
|---|
| 102 | //¡¡ÅÔÆ»Éܸ© |
|---|
| 103 | if ( strlen($this->arrSql['pref']) > 0 ) { |
|---|
| 104 | $this->setWhere( "pref = ?" ); |
|---|
| 105 | $this->arrVal[] = $this->arrSql['pref']; |
|---|
| 106 | } |
|---|
| 107 | |
|---|
| 108 | //¡¡ÅÅÏÃÈÖ¹æ |
|---|
| 109 | if ( is_numeric( $this->arrSql['tel'] ) ) { |
|---|
| 110 | if(DB_TYPE == "pgsql"){ |
|---|
| 111 | $this->setWhere( "(tel01 || tel02 || tel03 LIKE ?)" ); |
|---|
| 112 | }elseif(DB_TYPE == "mysql"){ |
|---|
| 113 | $this->setWhere("concat(tel01,tel02,tel03) LIKE ?" ); |
|---|
| 114 | } |
|---|
| 115 | $searchTel = $this->addSearchStr($this->arrSql['tel']); |
|---|
| 116 | $this->arrVal[] = ereg_replace("-", "", $searchTel); |
|---|
| 117 | } |
|---|
| 118 | |
|---|
| 119 | //¡¡ÀÊÌ |
|---|
| 120 | if ( is_array( $this->arrSql['sex'] ) ){ |
|---|
| 121 | $arrSexVal = $this->setItemTerm( $this->arrSql['sex'] ,"sex" ); |
|---|
| 122 | foreach ($arrSexVal as $data) { |
|---|
| 123 | $this->arrVal[] = $data; |
|---|
| 124 | } |
|---|
| 125 | } |
|---|
| 126 | |
|---|
| 127 | //¡¡¿¦¶È |
|---|
| 128 | if ( is_array( $this->arrSql['job'] ) ){ |
|---|
| 129 | if ( in_array("ÉÔÌÀ", $this->arrSql['job'] ) ) { |
|---|
| 130 | $arrJobVal = $this->setItemTermWithNull( $this->arrSql['job'] ,"job" ); |
|---|
| 131 | } else { |
|---|
| 132 | $arrJobVal = $this->setItemTerm( $this->arrSql['job'] ,"job" ); |
|---|
| 133 | } |
|---|
| 134 | if (is_array($arrJobVal)) { |
|---|
| 135 | foreach ($arrJobVal as $data) { |
|---|
| 136 | $this->arrVal[] = $data; |
|---|
| 137 | } |
|---|
| 138 | } |
|---|
| 139 | } |
|---|
| 140 | |
|---|
| 141 | //¡¡E-MAIL |
|---|
| 142 | if (strlen($this->arrSql['email']) > 0) { |
|---|
| 143 | //¥«¥ó¥Þ¶èÀÚ¤ê¤ÇÊ£¿ô¤Î¾ò·ï»ØÄê²Äǽ¤Ë |
|---|
| 144 | $this->arrSql['email'] = explode(",", $this->arrSql['email']); |
|---|
| 145 | $sql_where = ""; |
|---|
| 146 | foreach($this->arrSql['email'] as $val) { |
|---|
| 147 | $val = trim($val); |
|---|
| 148 | //¸¡º÷¾ò·ï¤ò´Þ¤Þ¤Ê¤¤ |
|---|
| 149 | if($this->arrSql['not_emailinc'] == '1') { |
|---|
| 150 | if($sql_where == "") { |
|---|
| 151 | $sql_where .= "dtb_customer.email NOT ILIKE ? "; |
|---|
| 152 | } else { |
|---|
| 153 | $sql_where .= "AND dtb_customer.email NOT ILIKE ? "; |
|---|
| 154 | } |
|---|
| 155 | } else { |
|---|
| 156 | if($sql_where == "") { |
|---|
| 157 | $sql_where .= "dtb_customer.email ILIKE ? "; |
|---|
| 158 | } else { |
|---|
| 159 | $sql_where .= "OR dtb_customer.email ILIKE ? "; |
|---|
| 160 | } |
|---|
| 161 | } |
|---|
| 162 | $searchEmail = $this->addSearchStr($val); |
|---|
| 163 | $this->arrVal[] = $searchEmail; |
|---|
| 164 | } |
|---|
| 165 | $this->setWhere($sql_where); |
|---|
| 166 | } |
|---|
| 167 | |
|---|
| 168 | //¡¡E-MAIL(mobile) |
|---|
| 169 | if (strlen($this->arrSql['email_mobile']) > 0) { |
|---|
| 170 | //¥«¥ó¥Þ¶èÀÚ¤ê¤ÇÊ£¿ô¤Î¾ò·ï»ØÄê²Äǽ¤Ë |
|---|
| 171 | $this->arrSql['email_mobile'] = explode(",", $this->arrSql['email_mobile']); |
|---|
| 172 | $sql_where = ""; |
|---|
| 173 | foreach($this->arrSql['email_mobile'] as $val) { |
|---|
| 174 | $val = trim($val); |
|---|
| 175 | //¸¡º÷¾ò·ï¤ò´Þ¤Þ¤Ê¤¤ |
|---|
| 176 | if($this->arrSql['not_email_mobileinc'] == '1') { |
|---|
| 177 | if($sql_where == "") { |
|---|
| 178 | $sql_where .= "dtb_customer.email_mobile NOT ILIKE ? "; |
|---|
| 179 | } else { |
|---|
| 180 | $sql_where .= "AND dtb_customer.email_mobile NOT ILIKE ? "; |
|---|
| 181 | } |
|---|
| 182 | } else { |
|---|
| 183 | if($sql_where == "") { |
|---|
| 184 | $sql_where .= "dtb_customer.email_mobile ILIKE ? "; |
|---|
| 185 | } else { |
|---|
| 186 | $sql_where .= "OR dtb_customer.email_mobile ILIKE ? "; |
|---|
| 187 | } |
|---|
| 188 | } |
|---|
| 189 | $searchemail_mobile = $this->addSearchStr($val); |
|---|
| 190 | $this->arrVal[] = $searchemail_mobile; |
|---|
| 191 | } |
|---|
| 192 | $this->setWhere($sql_where); |
|---|
| 193 | } |
|---|
| 194 | |
|---|
| 195 | //¡¡ÇÛ¿®¥á¡¼¥ë¥¢¥É¥ì¥¹¼ïÊÌ |
|---|
| 196 | if ( $mode == 'magazine' ){ |
|---|
| 197 | if ( strlen($this->arrSql['mail_type']) > 0 && $this->arrSql['mail_type'] == 2) { |
|---|
| 198 | $this->setWhere( " dtb_customer.email_mobile <> '' "); |
|---|
| 199 | } |
|---|
| 200 | } |
|---|
| 201 |
|
|---|
| 202 | //¥É¥á¥¤¥ó»ØÄê
|
|---|
| 203 | if ( $mode == 'magazine' ){
|
|---|
| 204 | global $arrDomainType; |
|---|
| 205 | $sql_where = ""; |
|---|
| 206 | $domain = ($this->arrSql['domain']); |
|---|
| 207 | //¥É¥á¥¤¥ó»ØÄê»þ |
|---|
| 208 | if($domain == 2 || $domain == 3) { |
|---|
| 209 | //PC¥É¥á¥¤¥ó |
|---|
| 210 | if($domain == 2) { |
|---|
| 211 | foreach($arrDomainType as $val) { |
|---|
| 212 | switch($this->arrSql['mail_type']){ |
|---|
| 213 | case '1': |
|---|
| 214 | if($sql_where == "") { |
|---|
| 215 | $sql_where .= "dtb_customer.email NOT ILIKE ? "; |
|---|
| 216 | } else { |
|---|
| 217 | $sql_where .= "AND dtb_customer.email NOT LIKE ? " ; |
|---|
| 218 | } |
|---|
| 219 | break; |
|---|
| 220 | case '2': |
|---|
| 221 | if($sql_where == "") { |
|---|
| 222 | $sql_where .= "dtb_customer.email_mobile NOT ILIKE ? "; |
|---|
| 223 | } else { |
|---|
| 224 | $sql_where .= "AND dtb_customer.email_mobile NOT LIKE ? " ; |
|---|
| 225 | } |
|---|
| 226 | break; |
|---|
| 227 | } |
|---|
| 228 | $searchDomain = $this->addSearchStr($val); |
|---|
| 229 | $this->arrVal[] = $searchDomain; |
|---|
| 230 | } |
|---|
| 231 | $this->setWhere($sql_where); |
|---|
| 232 | } |
|---|
| 233 | //¥â¥Ð¥¤¥ë¥É¥á¥¤¥ó |
|---|
| 234 | if($domain == 3) { |
|---|
| 235 | foreach($arrDomainType as $val) { |
|---|
| 236 | switch($this->arrSql['mail_type']){ |
|---|
| 237 | case '1': |
|---|
| 238 | if($sql_where == "") { |
|---|
| 239 | $sql_where .= "dtb_customer.email ILIKE ? "; |
|---|
| 240 | } else { |
|---|
| 241 | $sql_where .= "OR dtb_customer.email LIKE ? " ; |
|---|
| 242 | } |
|---|
| 243 | break; |
|---|
| 244 | case '2': |
|---|
| 245 | if($sql_where == "") { |
|---|
| 246 | $sql_where .= "dtb_customer.email_mobile ILIKE ? "; |
|---|
| 247 | } else { |
|---|
| 248 | $sql_where .= "OR dtb_customer.email_mobile LIKE ? " ; |
|---|
| 249 | } |
|---|
| 250 | } |
|---|
| 251 | $searchDomain = $this->addSearchStr($val); |
|---|
| 252 | $this->arrVal[] = $searchDomain; |
|---|
| 253 | } |
|---|
| 254 | $this->setWhere($sql_where); |
|---|
| 255 | } |
|---|
| 256 | } |
|---|
| 257 | }
|
|---|
| 258 | |
|---|
| 259 | //¡¡HTML-mail¡ÊÇÛ¿®Êý¼°) |
|---|
| 260 | if ( $mode == 'magazine' ){ |
|---|
| 261 | if ( strlen($this->arrSql['htmlmail']) > 0 ) { |
|---|
| 262 | $this->setWhere( " mailmaga_flg = ? "); |
|---|
| 263 | $this->arrVal[] = $this->arrSql['htmlmail']; |
|---|
| 264 | } else { |
|---|
| 265 | $this->setWhere( " (mailmaga_flg = 1 or mailmaga_flg = 2) "); |
|---|
| 266 | } |
|---|
| 267 | } |
|---|
| 268 | |
|---|
| 269 | // ¹ØÆþ¶â³Û»ØÄê |
|---|
| 270 | if( is_numeric( $this->arrSql["buy_total_from"] ) || is_numeric( $this->arrSql["buy_total_to"] ) ) { |
|---|
| 271 | $arrBuyTotal = $this->selectRange($this->arrSql["buy_total_from"], $this->arrSql["buy_total_to"], "buy_total"); |
|---|
| 272 | foreach ($arrBuyTotal as $data1) { |
|---|
| 273 | $this->arrVal[] = $data1; |
|---|
| 274 | } |
|---|
| 275 | } |
|---|
| 276 | |
|---|
| 277 | // ¹ØÆþ²ó¿ô»ØÄê |
|---|
| 278 | if( is_numeric( $this->arrSql["buy_times_from"] ) || is_numeric( $this->arrSql["buy_times_to"] ) ) { |
|---|
| 279 | $arrBuyTimes = $this->selectRange($this->arrSql["buy_times_from"], $this->arrSql["buy_times_to"], "buy_times"); |
|---|
| 280 | foreach ($arrBuyTimes as $data2) { |
|---|
| 281 | $this->arrVal[] = $data2; |
|---|
| 282 | } |
|---|
| 283 | } |
|---|
| 284 | |
|---|
| 285 | // ÃÂÀ¸Æü´ü´Ö»ØÄê |
|---|
| 286 | if ( (strlen($this->arrSql['b_start_year']) > 0 && strlen($this->arrSql['b_start_month']) > 0 && strlen($this->arrSql['b_start_day']) > 0) || |
|---|
| 287 | strlen($this->arrSql['b_end_year']) > 0 && strlen($this->arrSql['b_end_month']) > 0 && strlen($this->arrSql['b_end_day']) > 0) { |
|---|
| 288 | |
|---|
| 289 | $arrBirth = $this->selectTermRange($this->arrSql['b_start_year'], $this->arrSql['b_start_month'], $this->arrSql['b_start_day'] |
|---|
| 290 | , $this->arrSql['b_end_year'], $this->arrSql['b_end_month'], $this->arrSql['b_end_day'], "birth"); |
|---|
| 291 | if (is_array($arrBirth)) { |
|---|
| 292 | foreach ($arrBirth as $data3) { |
|---|
| 293 | $this->arrVal[] = $data3; |
|---|
| 294 | } |
|---|
| 295 | } |
|---|
| 296 | } |
|---|
| 297 | |
|---|
| 298 | // ÃÂÀ¸·î¤Î¸¡º÷ |
|---|
| 299 | if (is_numeric($this->arrSql["birth_month"])) { |
|---|
| 300 | $this->setWhere(" EXTRACT(month from birth) = ?"); |
|---|
| 301 | $this->arrVal[] = $this->arrSql["birth_month"]; |
|---|
| 302 | } |
|---|
| 303 | |
|---|
| 304 | // ÅÐÏ¿´ü´Ö»ØÄê |
|---|
| 305 | if ( (strlen($this->arrSql['start_year']) > 0 && strlen($this->arrSql['start_month']) > 0 && strlen($this->arrSql['start_day']) > 0 ) || |
|---|
| 306 | (strlen($this->arrSql['end_year']) > 0 && strlen($this->arrSql['end_month']) >0 && strlen($this->arrSql['end_day']) > 0) ) { |
|---|
| 307 | |
|---|
| 308 | $arrRegistTime = $this->selectTermRange($this->arrSql['start_year'], $this->arrSql['start_month'], $this->arrSql['start_day'] |
|---|
| 309 | , $this->arrSql['end_year'], $this->arrSql['end_month'], $this->arrSql['end_day'], $regdate_col); |
|---|
| 310 | if (is_array($arrRegistTime)) { |
|---|
| 311 | foreach ($arrRegistTime as $data4) { |
|---|
| 312 | $this->arrVal[] = $data4; |
|---|
| 313 | } |
|---|
| 314 | } |
|---|
| 315 | } |
|---|
| 316 | |
|---|
| 317 | // ºÇ½ª¹ØÆþÆü»ØÄê |
|---|
| 318 | if ( (strlen($this->arrSql['buy_start_year']) > 0 && strlen($this->arrSql['buy_start_month']) > 0 && strlen($this->arrSql['buy_start_day']) > 0 ) || |
|---|
| 319 | (strlen($this->arrSql['buy_end_year']) > 0 && strlen($this->arrSql['buy_end_month']) >0 && strlen($this->arrSql['buy_end_day']) > 0) ) { |
|---|
| 320 | $arrRegistTime = $this->selectTermRange($this->arrSql['buy_start_year'], $this->arrSql['buy_start_month'], $this->arrSql['buy_start_day'] |
|---|
| 321 | , $this->arrSql['buy_end_year'], $this->arrSql['buy_end_month'], $this->arrSql['buy_end_day'], "last_buy_date"); |
|---|
| 322 | if (is_array($arrRegistTime)) { |
|---|
| 323 | foreach ($arrRegistTime as $data4) { |
|---|
| 324 | $this->arrVal[] = $data4; |
|---|
| 325 | } |
|---|
| 326 | } |
|---|
| 327 | } |
|---|
| 328 | |
|---|
| 329 | //¹ØÆþ¾¦ÉÊ¥³¡¼¥É |
|---|
| 330 | if ( strlen($this->arrSql['buy_product_code']) > 0 ) { |
|---|
| 331 | $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 ? ))"); |
|---|
| 332 | $search_buyproduct_code = $this->addSearchStr($this->arrSql['buy_product_code']); |
|---|
| 333 | $this->arrVal[] = $search_buyproduct_code; |
|---|
| 334 | } |
|---|
| 335 | |
|---|
| 336 | //¹ØÆþ¾¦ÉÊ̾¾Î |
|---|
| 337 | if ( strlen($this->arrSql['buy_product_name']) > 0 ) { |
|---|
| 338 | $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 ? ))"); |
|---|
| 339 | $search_buyproduct_name = $this->addSearchStr($this->arrSql['buy_product_name']); |
|---|
| 340 | $this->arrVal[] = $search_buyproduct_name; |
|---|
| 341 | } |
|---|
| 342 | |
|---|
| 343 | //¥«¥Æ¥´¥ê¡¼¤òÁªÂò¤·¤Æ¤¤¤ë¾ì¹ç¤Î¤ß¹Ê¹þ¸¡º÷¤ò¹Ô¤¦ |
|---|
| 344 | if ( strlen($this->arrSql['category_id']) != ""){ |
|---|
| 345 | //¥«¥Æ¥´¥ê¡¼¤Ç¹Ê¹þ¸¡º÷¤ò¹Ô¤¦SQLʸÀ¸À® |
|---|
| 346 | list($tmp_where, $tmp_arrval) = sfGetCatWhere(sfManualEscape($this->arrSql['category_id'])); |
|---|
| 347 | |
|---|
| 348 | //¥«¥Æ¥´¥ê¡¼¤Ç¹Ê¹þ¤ß¤¬²Äǽ¤Î¾ì¹ç |
|---|
| 349 | if($tmp_where != "") { |
|---|
| 350 | $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_products WHERE ".$tmp_where." ))) "); |
|---|
| 351 | $this->arrVal = array_merge((array)$this->arrVal, (array)$tmp_arrval); |
|---|
| 352 | } |
|---|
| 353 | } |
|---|
| 354 | //¡¡·ÈÂÓÅÅÏÃÈÖ¹æ |
|---|
| 355 | if ( is_numeric( $this->arrSql['cell'] ) ) { |
|---|
| 356 | $this->setWhere( "(cell01 || cell02 || cell03 LIKE ?)" ); |
|---|
| 357 | $searchTel = $this->addSearchStr($this->arrSql['cell']); |
|---|
| 358 | $this->arrVal[] = ereg_replace("-", "", $searchTel); |
|---|
| 359 | } |
|---|
| 360 | |
|---|
| 361 | //¡¡¥¥ã¥ó¥Ú¡¼¥ó |
|---|
| 362 | if ( is_numeric( $this->arrSql['campaign_id'] ) ) { |
|---|
| 363 | $this->setWhere( " customer_id IN (SELECT distinct customer_id FROM dtb_campaign_order WHERE campaign_id = ?)" ); |
|---|
| 364 | $this->arrVal[] = $this->arrSql['campaign_id']; |
|---|
| 365 | } |
|---|
| 366 | |
|---|
| 367 | $this->setOrder( "customer_id DESC" ); |
|---|
| 368 | } |
|---|
| 369 | |
|---|
| 370 | // ¸¡º÷ÍÑSQL |
|---|
| 371 | function getList() { |
|---|
| 372 | $this->select = "SELECT customer_id,name01,name02,kana01,kana02,sex,email,tel01,tel02,tel03,pref,status FROM dtb_customer "; |
|---|
| 373 | return $this->getSql(0); |
|---|
| 374 | } |
|---|
| 375 | |
|---|
| 376 | function getListMailMagazine($is_mobile = false) { |
|---|
| 377 | |
|---|
| 378 | $colomn = $this->getMailMagazineColumn($is_mobile); |
|---|
| 379 | $this->select = " |
|---|
| 380 | SELECT |
|---|
| 381 | $colomn |
|---|
| 382 | FROM |
|---|
| 383 | dtb_customer"; |
|---|
| 384 | return $this->getSql(0); |
|---|
| 385 | } |
|---|
| 386 | |
|---|
| 387 | function getMailMagazineColumn($is_mobile= false) { |
|---|
| 388 | if($is_mobile == true) { |
|---|
| 389 | $email_column = "dtb_customer.email_mobile as email"; |
|---|
| 390 | } else { |
|---|
| 391 | $email_column = "dtb_customer.email"; |
|---|
| 392 | } |
|---|
| 393 | |
|---|
| 394 | $column ="dtb_customer.customer_id, |
|---|
| 395 | dtb_customer.name01, |
|---|
| 396 | dtb_customer.name02, |
|---|
| 397 | dtb_customer.kana01, |
|---|
| 398 | dtb_customer.kana02, |
|---|
| 399 | dtb_customer.sex, |
|---|
| 400 | $email_column, |
|---|
| 401 | dtb_customer.tel01, |
|---|
| 402 | dtb_customer.tel02, |
|---|
| 403 | dtb_customer.tel03, |
|---|
| 404 | dtb_customer.pref, |
|---|
| 405 | dtb_customer.mailmaga_flg"; |
|---|
| 406 | |
|---|
| 407 | return $column; |
|---|
| 408 | } |
|---|
| 409 | |
|---|
| 410 | //¡¡¸¡º÷Áí¿ô¥«¥¦¥ó¥ÈÍÑSQL |
|---|
| 411 | function getListCount() { |
|---|
| 412 | $this->select = "SELECT COUNT(customer_id) FROM dtb_customer "; |
|---|
| 413 | return $this->getSql(1); |
|---|
| 414 | } |
|---|
| 415 | |
|---|
| 416 | //¡¡CSV¥À¥¦¥ó¥í¡¼¥ÉÍÑSQL |
|---|
| 417 | function getListCSV($arrColumnCSV) { |
|---|
| 418 | $this->arrColumnCSV = $arrColumnCSV; |
|---|
| 419 | $i = 0; |
|---|
| 420 | foreach ($this->arrColumnCSV as $val) { |
|---|
| 421 | if ($i != 0) $state .= ", "; |
|---|
| 422 | $state .= $val["sql"]; |
|---|
| 423 | $i ++; |
|---|
| 424 | } |
|---|
| 425 | |
|---|
| 426 | $this->select = "SELECT " .$state. " FROM dtb_customer "; |
|---|
| 427 | return $this->getSql(2); |
|---|
| 428 | } |
|---|
| 429 | |
|---|
| 430 | function getWhere() { |
|---|
| 431 | return array($this->where, $this->arrVal); |
|---|
| 432 | } |
|---|
| 433 | } |
|---|
| 434 | ?> |
|---|