Changeset 20273


Ignore:
Timestamp:
2011/02/20 22:43:01 (13 years ago)
Author:
fukuda
Message:

#963 [管理画面]メルマガ管理リファクタリング #965[管理画面]顧客管理と被りそうなので一部先行コミット

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_5-dev/data/class/SC_CustomerList.php

    r19892 r20273  
    4848            // 登録日を示すカラム 
    4949            $regdate_col = 'dtb_customer.update_date'; 
    50         } 
    51  
    52         // メールマガジンの場合 
    53         if($mode == "magazine") { 
    54             $this->setWhere("(del_flg = 0 OR del_flg IS NULL)"); 
    55             $this->setWhere("status = 2"); 
    56             // 登録日を示すカラム 
    57             $regdate_col = 'dtb_customer.create_date'; 
    5850        } 
    5951 
     
    177169        } 
    178170 
     171        // メールマガジンの場合 
     172        if($mode == "customer") { 
     173            // メルマガ受け取りの選択項目がフォームに存在する場合 
     174            if ( isset($this->arrSql['htmlmail'])){ 
     175                if (SC_Utils_Ex::sfIsInt($this->arrSql['htmlmail'])){ 
     176                    $this->setWhere("mailmaga_flg = ?"); 
     177                    $this->arrVal[] = $this->arrSql['htmlmail']; 
     178                } else { 
     179                    // メルマガ購読拒否は省く 
     180                    $this->setWhere("mailmaga_flg <> 3"); 
     181                } 
     182            } 
     183        } 
     184 
    179185        // 配信メールアドレス種別 
    180         if ( $mode == 'magazine' ){ 
    181             $sqlEmailMobileIsEmpty = "(dtb_customer.email_mobile IS NULL OR dtb_customer.email_mobile = '')"; 
    182             if (!isset($this->arrSql['mail_type'])) $this->arrSql['mail_type'] = ""; 
    183             switch ($this->arrSql['mail_type']) { 
    184                 // PCメールアドレス 
    185                 case 1: 
    186                     $this->setWhere("(dtb_customer.email <> dtb_customer.email_mobile OR $sqlEmailMobileIsEmpty)"); 
    187                     break; 
    188                 // 携帯メールアドレス 
    189                 case 2: 
    190                     $this->setWhere("NOT $sqlEmailMobileIsEmpty"); 
    191                     break; 
    192                 // PCメールアドレス (携帯メールアドレスを登録している顧客は除外) 
    193                 case 3: 
    194                     $this->setWhere($sqlEmailMobileIsEmpty); 
    195                     break; 
    196                 // 携帯メールアドレス (PCメールアドレスを登録している顧客は除外) 
    197                 case 4: 
    198                     $this->setWhere('dtb_customer.email = dtb_customer.email_mobile'); 
    199                     break; 
    200             } 
    201         } 
    202  
    203         // HTML-mail 
    204         if ( $mode == 'magazine' ){ 
    205             if (!isset($this->arrSql['htmlmail'])) $this->arrSql['htmlmail'] = ""; 
    206             if ( strlen($this->arrSql['htmlmail']) > 0 ) { 
    207                 $this->setWhere( " mailmaga_flg = ? "); 
    208                 $this->arrVal[] = $this->arrSql['htmlmail']; 
    209             } else { 
    210                 $this->setWhere( " (mailmaga_flg = 1 or mailmaga_flg = 2) "); 
     186        if ( $mode == 'customer' ){ 
     187            if (isset($this->arrSql['mail_type'])){ 
     188                $sqlEmailMobileIsEmpty = "(dtb_customer.email_mobile IS NULL OR dtb_customer.email_mobile = '')"; 
     189                switch ($this->arrSql['mail_type']) { 
     190                    // PCメールアドレス 
     191                    case 1: 
     192                        $this->setWhere("(dtb_customer.email <> dtb_customer.email_mobile OR $sqlEmailMobileIsEmpty)"); 
     193                        break; 
     194                    // 携帯メールアドレス 
     195                    case 2: 
     196                        $this->setWhere("NOT $sqlEmailMobileIsEmpty"); 
     197                        break; 
     198                    // PCメールアドレス (携帯メールアドレスを登録している顧客は除外) 
     199                    case 3: 
     200                        $this->setWhere($sqlEmailMobileIsEmpty); 
     201                        break; 
     202                    // 携帯メールアドレス (PCメールアドレスを登録している顧客は除外) 
     203                    case 4: 
     204                        $this->setWhere('dtb_customer.email = dtb_customer.email_mobile'); 
     205                        break; 
     206                } 
    211207            } 
    212208        } 
     
    346342    // 検索用SQL 
    347343    function getList() { 
    348         $this->select = "SELECT customer_id,name01,name02,kana01,kana02,sex,email,tel01,tel02,tel03,pref,status FROM dtb_customer "; 
     344        $this->select = "SELECT customer_id,name01,name02,kana01,kana02,sex,email,tel01,tel02,tel03,pref,status,update_date,mailmaga_flg FROM dtb_customer "; 
    349345        return $this->getSql(0); 
    350346    } 
     
    359355                dtb_customer"; 
    360356        return $this->getSql(0); 
    361     } 
    362  
    363     function getMailMagazineColumn($is_mobile= false) { 
    364         if($is_mobile == true) { 
    365             $email_column = "dtb_customer.email_mobile as email"; 
    366         } else { 
    367             $email_column = "dtb_customer.email"; 
    368         } 
    369  
    370         $column ="dtb_customer.customer_id, 
    371                 dtb_customer.name01, 
    372                 dtb_customer.name02, 
    373                 dtb_customer.kana01, 
    374                 dtb_customer.kana02, 
    375                 dtb_customer.sex, 
    376                 $email_column, 
    377                 dtb_customer.tel01, 
    378                 dtb_customer.tel02, 
    379                 dtb_customer.tel03, 
    380                 dtb_customer.pref, 
    381                 dtb_customer.create_date, 
    382                 dtb_customer.mailmaga_flg"; 
    383  
    384         return $column; 
    385357    } 
    386358 
Note: See TracChangeset for help on using the changeset viewer.