Changeset 1892 for temp/trunk/data/class
- Timestamp:
- 2006/08/25 11:01:27 (20 years ago)
- File:
-
- 1 edited
-
temp/trunk/data/class/SC_CustomerList.php (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
temp/trunk/data/class/SC_CustomerList.php
r1870 r1892 17 17 $regdate_col = 'dtb_customer.update_date'; 18 18 } 19 19 20 if($mode == "customer") { 20 21 // ´ÉÍý¼Ô¥Ú¡¼¥¸¸ÜµÒ¸¡º÷¤Î¾ì¹ç²¾ÅÐÏ¿²ñ°÷¤â¸¡º÷ … … 23 24 $regdate_col = 'dtb_customer.update_date'; 24 25 } 25 26 26 27 // ¥á¡¼¥ë¥Þ¥¬¥¸¥ó¤Î¾ì¹ç 27 28 if($mode == "magazine") { … … 41 42 // ¥á¥ë¥Þ¥¬ÅÐÏ¿ 42 43 case '2': 43 // dtb_customer_mail¤Ë¤Î¤ßÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¥ì¥³¡¼¥É¤òÃê½Ð 44 $tmp_where.= "customer_id IS NULL "; 44 $tmp_where.= "customer_id IS NULL"; 45 45 break; 46 46 // CSVÅÐÏ¿ 47 47 case '3': 48 // dtb_customer_mail¤Ë¤Î¤ßÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¥ì¥³¡¼¥É¤òÃê½Ð49 48 $tmp_where.= "customer_id IS NULL"; 50 49 break; … … 64 63 65 64 // ¸ÜµÒID 66 if ( strlen($this->arrSql[' search_customer_id']) > 0 ) {65 if ( strlen($this->arrSql['customer_id']) > 0 ) { 67 66 $this->setWhere( "customer_id = ?" ); 68 $this->arrVal[] = $this->arrSql[' search_customer_id'];67 $this->arrVal[] = $this->arrSql['customer_id']; 69 68 } 70 69 71 70 // ̾Á° 72 if ( strlen($this->arrSql[' search_name']) > 0 ) {71 if ( strlen($this->arrSql['name']) > 0 ) { 73 72 $this->setWhere("(name01 || name02 LIKE ?)" ); 74 $searchName = $this->addSearchStr($this->arrSql[' search_name']);75 $this->arrVal[] = ereg_replace("[ ¡¡]+","",$searchName);73 $searchName = $this->addSearchStr($this->arrSql['name']); 74 $this->arrVal[] = mb_ereg_replace("[ ¡¡]+","",$searchName); 76 75 } 77 76 78 77 //¡¡Ì¾Á°¡Ê¥«¥Ê¡Ë 79 if ( strlen($this->arrSql[' search_kana']) > 0 ) {78 if ( strlen($this->arrSql['kana']) > 0 ) { 80 79 $this->setWhere("(kana01 || kana02 LIKE ?)"); 81 $searchKana = $this->addSearchStr($this->arrSql[' search_kana']);82 $this->arrVal[] = ereg_replace("[ ¡¡]+","",$searchKana);80 $searchKana = $this->addSearchStr($this->arrSql['kana']); 81 $this->arrVal[] = mb_ereg_replace("[ ¡¡]+","",$searchKana); 83 82 } 84 83 85 84 //¡¡ÅÔÆ»Éܸ© 86 if ( strlen($this->arrSql[' search_pref']) > 0 ) {85 if ( strlen($this->arrSql['pref']) > 0 ) { 87 86 $this->setWhere( "pref = ?" ); 88 $this->arrVal[] = $this->arrSql[' search_pref'];87 $this->arrVal[] = $this->arrSql['pref']; 89 88 } 90 89 91 90 //¡¡ÅÅÏÃÈÖ¹æ 92 if ( is_numeric( $this->arrSql[' search_tel'] ) ) {91 if ( is_numeric( $this->arrSql['tel'] ) ) { 93 92 $this->setWhere( "(tel01 || tel02 || tel03 LIKE ?)" ); 94 $searchTel = $this->addSearchStr($this->arrSql[' search_tel']);93 $searchTel = $this->addSearchStr($this->arrSql['tel']); 95 94 $this->arrVal[] = ereg_replace("-", "", $searchTel); 96 95 } 97 96 98 97 //¡¡ÀÊÌ 99 if ( is_array( $this->arrSql['se arch_sex'] ) ){100 $arrSexVal = $this->setItemTerm( $this->arrSql['se arch_sex'] ,"sex" );98 if ( is_array( $this->arrSql['sex'] ) ){ 99 $arrSexVal = $this->setItemTerm( $this->arrSql['sex'] ,"sex" ); 101 100 foreach ($arrSexVal as $data) { 102 101 $this->arrVal[] = $data; … … 105 104 106 105 //¡¡¿¦¶È 107 if ( is_array( $this->arrSql[' search_job'] ) ){108 if ( in_array("ÉÔÌÀ", $this->arrSql[' search_job'] ) ) {109 $arrJobVal = $this->setItemTermWithNull( $this->arrSql[' search_job'] ,"job" );106 if ( is_array( $this->arrSql['job'] ) ){ 107 if ( in_array("ÉÔÌÀ", $this->arrSql['job'] ) ) { 108 $arrJobVal = $this->setItemTermWithNull( $this->arrSql['job'] ,"job" ); 110 109 } else { 111 $arrJobVal = $this->setItemTerm( $this->arrSql[' search_job'] ,"job" );110 $arrJobVal = $this->setItemTerm( $this->arrSql['job'] ,"job" ); 112 111 } 113 112 if (is_array($arrJobVal)) { … … 119 118 120 119 //¡¡E-MAIL 121 if ( strlen($this->arrSql['search_email']) > 0 ) { 122 $this->setWhere( "email ILIKE ? " ); 123 $searchEmail = $this->addSearchStr($this->arrSql['search_email']); 124 $this->arrVal[] = $searchEmail; 125 } 126 120 if (strlen($this->arrSql['email']) > 0) { 121 //¥«¥ó¥Þ¶èÀÚ¤ê¤ÇÊ£¿ô¤Î¾ò·ï»ØÄê²Äǽ¤Ë 122 $this->arrSql['email'] = explode(",", $this->arrSql['email']); 123 $sql_where = ""; 124 foreach($this->arrSql['email'] as $val) { 125 $val = trim($val); 126 //¸¡º÷¾ò·ï¤ò´Þ¤Þ¤Ê¤¤ 127 if($this->arrSql['not_emailinc'] == '1') { 128 if($sql_where == "") { 129 $sql_where .= "email NOT ILIKE ? "; 130 } else { 131 $sql_where .= "AND email NOT ILIKE ? "; 132 } 133 } else { 134 if($sql_where == "") { 135 $sql_where .= "email ILIKE ? "; 136 } else { 137 $sql_where .= "OR email ILIKE ? "; 138 } 139 } 140 $searchEmail = $this->addSearchStr($val); 141 $this->arrVal[] = $searchEmail; 142 } 143 $this->setWhere($sql_where); 144 } 127 145 //¡¡HTML-mail 128 146 if ( $mode == 'magazine' ){ 129 if ( strlen($this->arrSql[' search_htmlmail']) > 0 ) {147 if ( strlen($this->arrSql['htmlmail']) > 0 ) { 130 148 $this->setWhere( " mail_flag = ? "); 131 $this->arrVal[] = $this->arrSql[' search_htmlmail'];149 $this->arrVal[] = $this->arrSql['htmlmail']; 132 150 } else { 133 151 $this->setWhere( " (mail_flag = 1 or mail_flag = 2) "); … … 136 154 137 155 // ¹ØÆþ¶â³Û»ØÄê 138 if( is_numeric( $this->arrSql[" search_buy_total_from"] ) || is_numeric( $this->arrSql["search_buy_total_to"] ) ) {139 $arrBuyTotal = $this->selectRange($this->arrSql[" search_buy_total_from"], $this->arrSql["search_buy_total_to"], "buy_total");156 if( is_numeric( $this->arrSql["buy_total_from"] ) || is_numeric( $this->arrSql["buy_total_to"] ) ) { 157 $arrBuyTotal = $this->selectRange($this->arrSql["buy_total_from"], $this->arrSql["buy_total_to"], "buy_total"); 140 158 foreach ($arrBuyTotal as $data1) { 141 159 $this->arrVal[] = $data1; … … 144 162 145 163 // ¹ØÆþ²ó¿ô»ØÄê 146 if( is_numeric( $this->arrSql[" search_buy_times_from"] ) || is_numeric( $this->arrSql["search_buy_times_to"] ) ) {147 $arrBuyTimes = $this->selectRange($this->arrSql[" search_buy_times_from"], $this->arrSql["search_buy_times_to"], "buy_times");164 if( is_numeric( $this->arrSql["buy_times_from"] ) || is_numeric( $this->arrSql["buy_times_to"] ) ) { 165 $arrBuyTimes = $this->selectRange($this->arrSql["buy_times_from"], $this->arrSql["buy_times_to"], "buy_times"); 148 166 foreach ($arrBuyTimes as $data2) { 149 167 $this->arrVal[] = $data2; … … 152 170 153 171 // ÃÂÀ¸Æü´ü´Ö»ØÄê 154 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) ||155 strlen($this->arrSql[' search_b_end_year']) > 0 && strlen($this->arrSql['search_b_end_month']) > 0 && strlen($this->arrSql['search_b_end_day']) > 0) {156 157 $arrBirth = $this->selectTermRange($this->arrSql[' search_b_start_year'], $this->arrSql['search_b_start_month'], $this->arrSql['search_b_start_day']158 , $this->arrSql[' search_b_end_year'], $this->arrSql['search_b_end_month'], $this->arrSql['search_b_end_day'], "birth");172 if ( (strlen($this->arrSql['b_start_year']) > 0 && strlen($this->arrSql['b_start_month']) > 0 && strlen($this->arrSql['b_start_day']) > 0) || 173 strlen($this->arrSql['b_end_year']) > 0 && strlen($this->arrSql['b_end_month']) > 0 && strlen($this->arrSql['b_end_day']) > 0) { 174 175 $arrBirth = $this->selectTermRange($this->arrSql['b_start_year'], $this->arrSql['b_start_month'], $this->arrSql['b_start_day'] 176 , $this->arrSql['b_end_year'], $this->arrSql['b_end_month'], $this->arrSql['b_end_day'], "birth"); 159 177 if (is_array($arrBirth)) { 160 178 foreach ($arrBirth as $data3) { … … 163 181 } 164 182 } 165 183 166 184 // ÃÂÀ¸·î¤Î¸¡º÷ 167 if (is_numeric($this->arrSql[" search_birth_month"])) {185 if (is_numeric($this->arrSql["birth_month"])) { 168 186 $this->setWhere(" EXTRACT(month from birth) = ?"); 169 $this->arrVal[] = $this->arrSql[" search_birth_month"];170 } 171 187 $this->arrVal[] = $this->arrSql["birth_month"]; 188 } 189 172 190 // ÅÐÏ¿´ü´Ö»ØÄê 173 if ( (strlen($this->arrSql['s earch_start_year']) > 0 && strlen($this->arrSql['search_start_month']) > 0 && strlen($this->arrSql['search_start_day']) > 0 ) ||174 (strlen($this->arrSql[' search_end_year']) > 0 && strlen($this->arrSql['search_end_month']) >0 && strlen($this->arrSql['search_end_day']) > 0) ) {175 176 $arrRegistTime = $this->selectTermRange($this->arrSql['s earch_start_year'], $this->arrSql['search_start_month'], $this->arrSql['search_start_day']177 , $this->arrSql[' search_end_year'], $this->arrSql['search_end_month'], $this->arrSql['search_end_day'], $regdate_col);191 if ( (strlen($this->arrSql['start_year']) > 0 && strlen($this->arrSql['start_month']) > 0 && strlen($this->arrSql['start_day']) > 0 ) || 192 (strlen($this->arrSql['end_year']) > 0 && strlen($this->arrSql['end_month']) >0 && strlen($this->arrSql['end_day']) > 0) ) { 193 194 $arrRegistTime = $this->selectTermRange($this->arrSql['start_year'], $this->arrSql['start_month'], $this->arrSql['start_day'] 195 , $this->arrSql['end_year'], $this->arrSql['end_month'], $this->arrSql['end_day'], $regdate_col); 178 196 if (is_array($arrRegistTime)) { 179 197 foreach ($arrRegistTime as $data4) { … … 182 200 } 183 201 } 184 202 185 203 // ºÇ½ª¹ØÆþÆü»ØÄê 186 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 ) ||187 (strlen($this->arrSql[' search_buy_end_year']) > 0 && strlen($this->arrSql['search_buy_end_month']) >0 && strlen($this->arrSql['search_buy_end_day']) > 0) ) {188 $arrRegistTime = $this->selectTermRange($this->arrSql[' search_buy_start_year'], $this->arrSql['search_buy_start_month'], $this->arrSql['search_buy_start_day']189 , $this->arrSql[' search_buy_end_year'], $this->arrSql['search_buy_end_month'], $this->arrSql['search_buy_end_day'], "last_buy_date");204 if ( (strlen($this->arrSql['buy_start_year']) > 0 && strlen($this->arrSql['buy_start_month']) > 0 && strlen($this->arrSql['buy_start_day']) > 0 ) || 205 (strlen($this->arrSql['buy_end_year']) > 0 && strlen($this->arrSql['buy_end_month']) >0 && strlen($this->arrSql['buy_end_day']) > 0) ) { 206 $arrRegistTime = $this->selectTermRange($this->arrSql['buy_start_year'], $this->arrSql['buy_start_month'], $this->arrSql['buy_start_day'] 207 , $this->arrSql['buy_end_year'], $this->arrSql['buy_end_month'], $this->arrSql['buy_end_day'], "last_buy_date"); 190 208 if (is_array($arrRegistTime)) { 191 209 foreach ($arrRegistTime as $data4) { … … 196 214 197 215 //¹ØÆþ¾¦ÉÊ¥³¡¼¥É 198 if ( strlen($this->arrSql[' search_buy_product_code']) > 0 ) {216 if ( strlen($this->arrSql['buy_product_code']) > 0 ) { 199 217 $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 ? ))"); 200 $search_buyproduct_code = $this->addSearchStr($this->arrSql[' search_buy_product_code']);218 $search_buyproduct_code = $this->addSearchStr($this->arrSql['buy_product_code']); 201 219 $this->arrVal[] = $search_buyproduct_code; 202 220 } 203 221 204 222 //¹ØÆþ¾¦ÉÊ̾¾Î 205 if ( strlen($this->arrSql[' search_buy_product_name']) > 0 ) {223 if ( strlen($this->arrSql['buy_product_name']) > 0 ) { 206 224 $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 ? ))"); 207 $search_buyproduct_name = $this->addSearchStr($this->arrSql[' search_buy_product_name']);225 $search_buyproduct_name = $this->addSearchStr($this->arrSql['buy_product_name']); 208 226 $this->arrVal[] = $search_buyproduct_name; 209 227 } 210 228 211 229 //¥«¥Æ¥´¥ê¡¼¤òÁªÂò¤·¤Æ¤¤¤ë¾ì¹ç¤Î¤ß¹Ê¹þ¸¡º÷¤ò¹Ô¤¦ 212 if ( strlen($this->arrSql[' search_category_id']) != ""){230 if ( strlen($this->arrSql['category_id']) != ""){ 213 231 //¥«¥Æ¥´¥ê¡¼¤Ç¹Ê¹þ¸¡º÷¤ò¹Ô¤¦SQLʸÀ¸À® 214 list($tmp_where, $tmp_arrval) = sfGetCatWhere(sfManualEscape($this->arrSql[' search_category_id']));232 list($tmp_where, $tmp_arrval) = sfGetCatWhere(sfManualEscape($this->arrSql['category_id'])); 215 233 216 234 //¥«¥Æ¥´¥ê¡¼¤Ç¹Ê¹þ¤ß¤¬²Äǽ¤Î¾ì¹ç … … 220 238 } 221 239 } 240 //¡¡·ÈÂÓÅÅÏÃÈÖ¹æ 241 if ( is_numeric( $this->arrSql['cell'] ) ) { 242 $this->setWhere( "(cell01 || cell02 || cell03 LIKE ?)" ); 243 $searchTel = $this->addSearchStr($this->arrSql['cell']); 244 $this->arrVal[] = ereg_replace("-", "", $searchTel); 245 } 222 246 223 247 $this->setOrder( "customer_id DESC" ); … … 231 255 232 256 function getListMailMagazine() { 233 $this->select = "SELECT customer_id,name01,name02,kana01,kana02,sex,email,tel01,tel02,tel03,pref, mail_flag FROM dtb_customer_mail LEFT OUTER JOIN dtb_customer USING(email)";257 $this->select = "SELECT customer_id,name01,name02,kana01,kana02,sex,email,tel01,tel02,tel03,pref, mail_flag, other_data, other_flag FROM dtb_customer_mail LEFT OUTER JOIN dtb_customer USING(email)"; 234 258 return $this->getSql(0); 235 259 } … … 241 265 //¹ØÆþ¾¦ÉÊ¥³¡¼¥É¸¡º÷ÍÑSQL 242 266 function getBuyList(){ 243 $this->select = "SELECT A.customer_id, A.name01, A.name02, A.kana01, A.kana02, A.sex, A.email, A.tel01, A.tel02, A.tel03, A.pref, A.mail_flag, B.order_email, B.order_id, C.product_code267 $this->select = "SELECT A.customer_id, A.name01, A.name02, A.kana01, A.kana02, A.sex, A.email, A.tel01, A.tel02, A.tel03, A.pref, A.mail_flag, A.other_flag, A.other_data, B.order_email, B.order_id, C.product_code 244 268 FROM (dtb_customer LEFT OUTER JOIN dtb_customer_mail USING (email)) AS A LEFT OUTER JOIN dtb_order AS B ON 245 269 A.email=B.order_email LEFT OUTER JOIN dtb_order_detail AS C ON B.order_id = C.order_id"; … … 269 293 return array($this->where, $this->arrVal); 270 294 } 271 272 295 } 273 274 296 ?>
Note: See TracChangeset
for help on using the changeset viewer.
