DbHelper
class DbHelper
DB関連のヘルパークラス.
Properties
$g_root_on | ルートカテゴリ取得フラグ | ||
$g_root_id | ルートカテゴリID | ||
$g_category_on | 選択中カテゴリ取得フラグ | ||
$g_category_id | 選択中カテゴリID |
Methods
カラムの存在チェックと作成を行う.
No description
データの存在チェックを行う.
店舗基本情報を取得する.
基本情報のキャッシュデータを取得する
基本情報のキャッシュデータファイルを生成する データはgetBasisDataより取得。
基本情報の登録有無を取得する
No description
受注番号、最終ポイント、加算ポイント、利用ポイントから「オーダー前ポイント」を取得する
カテゴリツリーの取得を行う.
カテゴリツリーを走査し, パンくずリスト用の配列を生成する.
親カテゴリを連結した文字列を取得する.
指定したカテゴリIDの大カテゴリを取得する.
カテゴリツリーの取得を行う.
カテゴリツリーの取得を行う.
選択中の商品のカテゴリを取得する.
商品をカテゴリの先頭に追加する.
商品をカテゴリの末尾に追加する.
商品をカテゴリから削除する.
商品カテゴリを更新する.
子IDの配列を返す.
階層構造のテーブルから子ID配列を取得する.
親ID直下の子IDを全て取得する.
所属する全ての階層の親IDを配列で返す.
階層構造のテーブルから親ID配列を取得する.
No description
カテゴリから商品を検索する場合のWHERE文と値を返す.
SELECTボックス用リストを作成する.
ランキングを上げる.
ランキングを下げる.
指定順位へ移動する.
指定された位置の値をDB用のRANK値に変換する 指定位置が1番目に移動なら、newRankは最大値 指定位置が1番下へ移動なら、newRankは1
指定した順位の商品から移動させる商品までのrankを1つずらす
ランクを含むレコードを削除する.
親IDの配列を元に特定のカラムを取得する.
カテゴリ変更時の移動処理を行う.
レコードの存在チェックを行う.
選択中の商品のメーカーを取得する.
メーカーの取得を行う.
店舗基本情報に基づいて税金額を返す
店舗基本情報に基づいて税金付与した金額を返す Utils::sfCalcIncTax とどちらか統一したほうが良い
店舗基本情報に基づいて加算ポイントを返す
指定ファイルが存在する場合 SQL として実行
商品規格を設定しているか
店舗基本情報を登録する
レコード件数を計算.
Details
at line 59
bool
columnExists($tableName, $colName, $colType = '', $dsn = '', $add = false)
カラムの存在チェックと作成を行う.
チェック対象のテーブルに, 該当のカラムが存在するかチェックする. 引数 $add が true の場合, 該当のカラムが存在しない場合は, カラムの生成を行う. カラムの生成も行う場合は, $col_type も必須となる.
at line 93
columnAdd($tableName, $colName, $colType)
at line 110
bool
dataExists(string $tableName, string $where, array $arrWhereVal)
データの存在チェックを行う.
at line 128
array
getBasisData(boolean $force = false)
店舗基本情報を取得する.
引数 $force が false の場合は, 初回のみ DB 接続し, 2回目以降はキャッシュされた結果を使用する.
at line 148
array
getBasisDataCache(boolean $generate = false)
基本情報のキャッシュデータを取得する
at line 181
bool
createBasisDataCache()
基本情報のキャッシュデータファイルを生成する データはgetBasisDataより取得。
このメソッドが直接呼ばれるのは、 「基本情報管理>SHOPマスター」の更新完了後。 getBasisDataCacheでは、 キャッシュデータファイルが無い場合に呼ばれます。
at line 215
int
getBasisCount()
deprecated
deprecated
基本情報の登録数を取得する
at line 228
boolean
getBasisExists()
基本情報の登録有無を取得する
at line 237
getRootId()
at line 274
array
getRollbackPoint(integer $order_id, integer $use_point, integer $add_point, integer $order_status)
受注番号、最終ポイント、加算ポイント、利用ポイントから「オーダー前ポイント」を取得する
at line 309
array
getCatTree(integer $parent_category_id, bool $count_check = false)
カテゴリツリーの取得を行う.
at line 357
findTree(array $arrTree, integer $parent, array $result)
カテゴリツリーを走査し, パンくずリスト用の配列を生成する.
at line 381
string
getCatCombName(integer $category_id)
親カテゴリを連結した文字列を取得する.
at line 408
array
getFirstCat(integer $category_id)
指定したカテゴリIDの大カテゴリを取得する.
at line 435
array
getCategoryList(string $addwhere = '', bool $products_check = false, string $head = CATEGORY_HEAD)
カテゴリツリーの取得を行う.
$products_check:true商品登録済みのものだけ取得する
at line 477
array
getLevelCatList(bool $parent_zero = true)
カテゴリツリーの取得を行う.
親カテゴリの Value=0 を対象とする
at line 529
array
getCategoryId(int $product_id, int $category_id, bool $closed = false)
選択中の商品のカテゴリを取得する.
at line 553
void
addProductBeforCategories(integer $category_id, integer $product_id)
商品をカテゴリの先頭に追加する.
at line 576
void
addProductAfterCategories(integer $category_id, integer $product_id)
商品をカテゴリの末尾に追加する.
at line 610
void
removeProductByCategories(integer $category_id, integer $product_id)
商品をカテゴリから削除する.
at line 625
void
updateProductCategories(array $arrCategory_id, integer $product_id)
商品カテゴリを更新する.
at line 659
void
countCategory(Query $objQuery = null, boolean $is_force_all_count = false)
カテゴリ数の登録を行う.
at line 840
getChildsID($table, $pid_name, $id_name, $id)
子IDの配列を返す.
at line 856
array
getChildrenArray(string $table, string $pid_name, string $id_name, integer $id)
階層構造のテーブルから子ID配列を取得する.
at line 878
array
getChildrenArraySub($table, $pid_name, $id_name, $arrPID)
親ID直下の子IDを全て取得する.
at line 899
array
getParents(string $table, string $pid_name, string $id_name, integer $id)
所属する全ての階層の親IDを配列で返す.
at line 915
array
getParentsArray(string $table, string $pid_name, string $id_name, integer $id)
階層構造のテーブルから親ID配列を取得する.
at line 945
getParentsArraySub($table, $pid_name, $id_name, $child)
at line 966
array
getCatWhere(integer $category_id)
カテゴリから商品を検索する場合のWHERE文と値を返す.
at line 986
array
getIDValueList(string $table, string $keyname, string $valname, string $where = '', array $arrVal = array())
SELECTボックス用リストを作成する.
at line 1014
void
rankUp(string $table, string $colname, integer $id, string $andwhere = '')
ランキングを上げる.
at line 1067
void
rankDown(string $table, string $colname, integer $id, string $andwhere = '')
ランキングを下げる.
at line 1120
void
moveRank(string $tableName, string $keyIdColumn, integer $keyId, integer $pos, string $where = '')
指定順位へ移動する.
at line 1168
int
getNewRank(int $position, int $maxRank)
指定された位置の値をDB用のRANK値に変換する 指定位置が1番目に移動なら、newRankは最大値 指定位置が1番下へ移動なら、newRankは1
at line 1191
boolean
moveOtherItemRank(int $newRank, int $oldRank, Query $objQuery, string $tableName, string $addWhere)
指定した順位の商品から移動させる商品までのrankを1つずらす
at line 1228
void
deleteRankRecord(string $table, string $colname, integer $id, string $andwhere = '', bool $delete = false)
ランクを含むレコードを削除する.
レコードごと削除する場合は、$deleteをtrueにする
at line 1278
array
getParentsCol(Query $objQuery, string $table, string $id_name, string $col_name, array $arrId)
親IDの配列を元に特定のカラムを取得する.
at line 1312
void
moveCatRank(Query $objQuery, string $table, string $id_name, string $cat_name, integer $old_catid, integer $new_catid, integer $id)
カテゴリ変更時の移動処理を行う.
※この関数って、どこからも呼ばれていないのでは??
at line 1352
bool
isRecord(string $table, string $col, array $arrVal, string $addwhere = '')
レコードの存在チェックを行う.
TODO Query に移行するべきか?
at line 1388
void
countMaker(Query $objQuery)
メーカー商品数数の登録を行う.
at line 1411
array
getMakerId($product_id, $maker_id, $closed = false)
選択中の商品のメーカーを取得する.
at line 1447
array
getMakerList(string $addwhere = '', bool $products_check = false)
メーカーの取得を行う.
$products_check:true商品登録済みのものだけ取得する
at line 1487
double
tax(integer $price)
店舗基本情報に基づいて税金額を返す
at line 1504
double
calcIncTax(int $price, int $tax = null, int $tax_rule = null)
店舗基本情報に基づいて税金付与した金額を返す Utils::sfCalcIncTax とどちらか統一したほうが良い
at line 1521
integer
getAddPoint(integer $totalpoint, integer $use_point)
店舗基本情報に基づいて加算ポイントを返す
at line 1537
void
execSqlByFile(string $sqlFilePath)
指定ファイルが存在する場合 SQL として実行
XXX プラグイン用に追加。将来消すかも。
at line 1560
bool
hasProductClass(integer $product_id)
商品規格を設定しているか
at line 1578
void
registerBasisData(array $arrData)
店舗基本情報を登録する
at line 1612
integer
countRecords(string $table, string $where = '', array $arrval = array())
レコード件数を計算.