Ignore:
Timestamp:
2012/06/20 11:57:43 (12 years ago)
Author:
pineray
Message:

#1669 #1859 初期化漏れ、無駄な変数等

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-dev/data/class/helper/SC_Helper_DB.php

    r21898 r21927  
    7575        // 正常に接続されている場合 
    7676        if (!$objQuery->isError()) { 
    77             list($db_type) = explode(':', $dsn); 
    78  
    7977            // カラムリストを取得 
    8078            $columns = $objQuery->listTableFields($table_name); 
     
    111109        $exists = $objQuery->exists($table_name, $where, $arrWhereVal); 
    112110 
    113         // データを追加する 
    114         if (!$exists && $add) { 
    115             $objQuery->exec($sql); 
    116         } 
    117         return $ret; 
     111        // データが存在する場合 TRUE 
     112        if ($exists) { 
     113            return TRUE; 
     114        // $add が TRUE の場合はデータを追加する 
     115        } elseif ($add) { 
     116            return $objQuery->exec($sql); 
     117        // $add が FALSE で、データが存在しない場合 FALSE 
     118        } else { 
     119            return FALSE; 
     120        } 
    118121    } 
    119122 
     
    129132     */ 
    130133    function sfGetBasisData($force = false, $col = '') { 
    131         static $data; 
    132  
    133         if ($force || !isset($data)) { 
     134        static $data = array(); 
     135 
     136        if ($force || empty($data)) { 
    134137            $objQuery =& SC_Query_Ex::getSingletonInstance(); 
    135138 
     
    177180        if (!$this->g_root_on) { 
    178181            $this->g_root_on = true; 
    179             $objQuery =& SC_Query_Ex::getSingletonInstance(); 
    180182 
    181183            if (!isset($_GET['product_id'])) $_GET['product_id'] = ''; 
     
    292294            return; 
    293295        } else { 
    294             foreach ($arrTree as $key => $val) { 
     296            foreach ($arrTree as $val) { 
    295297                if ($val['category_id'] == $parent) { 
    296298                    $result[] = array( 
     
    367369 
    368370        // カテゴリ名称を取得する 
    369         foreach ($arrCatID as $key => $val) { 
     371        foreach ($arrCatID as $val) { 
    370372            $sql = 'SELECT category_name FROM dtb_category WHERE category_id = ?'; 
    371373            $arrVal = array($val); 
     
    448450 
    449451        $max = count($arrRet); 
     452        $arrList = array(); 
    450453        for ($cnt = 0; $cnt < $max; $cnt++) { 
    451454            $id = $arrRet[$cnt]['category_id']; 
     
    486489        $max = count($arrRet); 
    487490 
     491        $arrValue = array(); 
     492        $arrOutput = array(); 
    488493        for ($cnt = 0; $cnt < $max; $cnt++) { 
    489494            if ($parent_zero) { 
     
    523528        } else if (SC_Utils_Ex::sfIsInt($product_id) && $product_id != 0 && SC_Helper_DB_Ex::sfIsRecord('dtb_products','product_id', $product_id, $status)) { 
    524529            $objQuery =& SC_Query_Ex::getSingletonInstance(); 
    525             $where = 'product_id = ?'; 
    526530            $category_id = $objQuery->getCol('category_id', 'dtb_product_categories', 'product_id = ?', array($product_id)); 
    527531        } else { 
     
    943947        $arrList = $objQuery->select($col, $table, $where, $arrVal); 
    944948        $count = count($arrList); 
     949        $arrRet = array(); 
    945950        for ($cnt = 0; $cnt < $count; $cnt++) { 
    946951            $key = $arrList[$cnt][$keyname]; 
     
    12781283            } else if (SC_Utils_Ex::sfIsInt($product_id) && $product_id != 0 && $this->sfIsRecord('dtb_products','product_id', $product_id, $status)) { 
    12791284                $objQuery =& SC_Query_Ex::getSingletonInstance(); 
    1280                 $where = 'product_id = ?'; 
    12811285                $maker_id = $objQuery->getCol('maker_id', 'dtb_products', 'product_id = ?', array($product_id)); 
    12821286                $this->g_maker_id = $maker_id; 
     
    13201324 
    13211325        $max = count($arrRet); 
     1326        $arrList = array(); 
    13221327        for ($cnt = 0; $cnt < $max; $cnt++) { 
    13231328            $id = $arrRet[$cnt]['maker_id']; 
     
    13431348    /** 
    13441349     * 店舗基本情報に基づいて税金付与した金額を返す 
     1350     * SC_Utils_Ex::sfCalcIncTax とどちらか統一したほうが良い 
    13451351     * 
    13461352     * @param integer $price 計算対象の金額 
Note: See TracChangeset for help on using the changeset viewer.