Changeset 23459
- Timestamp:
- 2014/05/29 14:40:57 (8 years ago)
- Location:
- branches/version-2_13-dev/data/class
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_13-dev/data/class/SC_Product.php
r23458 r23459 696 696 */ 697 697 public function getCategoryIds($product_id, $include_hidden = false) { 698 if ($include_hidden) { 699 $where = ''; 700 } else { 701 $where = 'status = 1'; 702 } 703 704 if (SC_Utils_Ex::sfIsInt($product_id) && $product_id != 0 && SC_Helper_DB_Ex::sfIsRecord('dtb_products','product_id', array($product_id), $where)) { 698 if ($this->isValidProductId($product_id, $include_hidden)) { 705 699 $objQuery =& SC_Query_Ex::getSingletonInstance(); 706 700 $category_id = $objQuery->getCol('category_id', 'dtb_product_categories', 'product_id = ?', array($product_id)); … … 712 706 return $category_id; 713 707 } 708 709 /** 710 * 有効な商品IDかチェックする. 711 * 712 * @param int $product_id 713 * @param bool $include_hidden 714 * @param bool $include_deleted 715 * @return bool 716 */ 717 public function isValidProductId($product_id, $include_hidden = false, $include_deleted = false) { 718 $where = ''; 719 if (!$include_hidden) { 720 $where .= ' status = 1'; 721 } 722 if (!$include_deleted) { 723 $where .= ' del_flg = 0'; 724 } 725 if ( 726 SC_Utils_Ex::sfIsInt($product_id) 727 && !SC_Utils_Ex::sfIsZeroFilling($product_id) 728 && SC_Helper_DB_Ex::sfIsRecord('dtb_products','product_id', array($product_id), $where) 729 ) { 730 return true; 731 } 732 return false; 733 } 714 734 } -
branches/version-2_13-dev/data/class/helper/SC_Helper_Category.php
r23439 r23459 397 397 return $objQuery->update($table, array(), $where, array(), $arrRawVal); 398 398 } 399 400 /** 401 * 有効なカテゴリーIDかチェックする. 402 * 403 * @param int $category_id 404 * @param bool $include_deleted 405 * @return bool 406 */ 407 public function isValidCategoryId($category_id, $include_deleted = false) { 408 if ($include_deleted) { 409 $where = ''; 410 } else { 411 $where = 'del_flg = 0'; 412 } 413 if ( 414 SC_Utils_Ex::sfIsInt($category_id) 415 && !SC_Utils_Ex::sfIsZeroFilling($category_id) 416 && SC_Helper_DB_Ex::sfIsRecord('dtb_category','category_id', array($category_id), $where) 417 ) { 418 return true; 419 } 420 return false; 421 } 399 422 } -
branches/version-2_13-dev/data/class/helper/SC_Helper_DB.php
r23458 r23459 524 524 $category_id = (int) $category_id; 525 525 $product_id = (int) $product_id; 526 if (SC_Utils_Ex::sfIsInt($category_id) && $category_id != 0 && SC_Helper_DB_Ex::sfIsRecord('dtb_category','category_id', array($category_id))) { 526 $objCategory = new SC_Helper_Category_Ex(); 527 if ($objCategory->isValidCategoryId($category_id, $closed)) { 527 528 $category_id = array($category_id); 528 529 } else { -
branches/version-2_13-dev/data/class/pages/admin/products/LC_Page_Admin_Products.php
r23129 r23459 164 164 if (count($this->arrProducts) > 0) { 165 165 foreach ($this->arrProducts as $key => $val) { 166 $this->arrProducts[$key]['categories'] = $obj Db->sfGetCategoryId($val['product_id'], 0, true);166 $this->arrProducts[$key]['categories'] = $objProduct->getCategoryIds($val['product_id'], true); 167 167 $objDb->g_category_on = false; 168 168 } -
branches/version-2_13-dev/data/class/pages/products/LC_Page_Products_List.php
r23407 r23459 185 185 * カテゴリIDの取得 186 186 * 187 * @return integer カテゴリID 187 * @param int $category_id 188 * @return integer|void カテゴリID 188 189 */ 189 190 public function lfGetCategoryId($category_id) … … 193 194 194 195 // 正当性チェック 195 if (!SC_Utils_Ex::sfIsInt($category_id)196 || SC_Utils_Ex::sfIsZeroFilling($category_id)197 || !SC_Helper_DB_Ex::sfIsRecord('dtb_category', 'category_id', (array) $category_id, 'del_flg = 0')198 ){196 $objCategory = new SC_Helper_Category_Ex(); 197 if ($objCategory->isValidCategoryId($category_id)) { 198 return $category_id; 199 } else { 199 200 SC_Utils_Ex::sfDispSiteError(CATEGORY_NOT_FOUND); 200 201 } 201 202 // 指定されたカテゴリIDを元に正しいカテゴリIDを取得する。203 $arrCategory_id = SC_Helper_DB_Ex::sfGetCategoryId('', $category_id);204 205 if (empty($arrCategory_id)) {206 SC_Utils_Ex::sfDispSiteError(CATEGORY_NOT_FOUND);207 }208 209 return $arrCategory_id[0];210 202 } 211 203
Note: See TracChangeset
for help on using the changeset viewer.