public function getAppliedVersions()
 {
     $where = "{$this->systemColumn} = ?";
     $whereValues = array($this->system);
     $rows = $this->query->select($this->versionColumn, $this->versionTable, $where, $whereValues);
     $versions = array();
     foreach ($rows as $row) {
         $versions[] = $row[$this->versionColumn];
     }
     return $versions;
 }
Ejemplo n.º 2
0
 /**
  * セッションのデータをDBから読み込む.
  *
  * @param string $id セッションID
  * @return string セッションデータの値
  */
 function sfSessRead($id)
 {
     $objQuery = new SC_Query_Ex();
     $arrRet = $objQuery->select("sess_data", "dtb_session", "sess_id = ?", array($id));
     if (empty($arrRet)) {
         return '';
     } else {
         return $arrRet[0]['sess_data'];
     }
 }
Ejemplo n.º 3
0
 function sfCheckCustomerMailMaga($email)
 {
     $col = "email, mailmaga_flg, customer_id";
     $from = "dtb_customer";
     $where = "(email = ? OR email_mobile = ?) AND status = 2 AND del_flg = 0";
     $objQuery = new SC_Query_Ex();
     $arrRet = $objQuery->select($col, $from, $where, array($email));
     // 会員のメールアドレスが登録されている
     if (!empty($arrRet[0]['customer_id'])) {
         return true;
     }
     return false;
 }
 /**
  * メインカテゴリーの取得.
  *
  * @param boolean $count_check 登録商品数をチェックする場合はtrue
  * @return array $arrMainCat メインカテゴリーの配列を返す
  */
 function lfGetMainCat($count_check = false)
 {
     $objQuery = new SC_Query_Ex();
     $col = '*';
     $from = 'dtb_category left join dtb_category_total_count ON dtb_category.category_id = dtb_category_total_count.category_id';
     // メインカテゴリーとその直下のカテゴリーを取得する。
     $where = 'level <= 2 AND del_flg = 0';
     // 登録商品数のチェック
     if ($count_check) {
         $where .= ' AND product_count > 0';
     }
     $objQuery->setOption('ORDER BY rank DESC');
     $arrRet = $objQuery->select($col, $from, $where);
     // メインカテゴリーを抽出する。
     $arrMainCat = array();
     foreach ($arrRet as $cat) {
         if ($cat['level'] != 1) {
             continue;
         }
         // 子カテゴリーを持つかどうかを調べる。
         $arrChildrenID = SC_Utils_Ex::sfGetUnderChildrenArray($arrRet, 'parent_category_id', 'category_id', $cat['category_id']);
         $cat['has_children'] = count($arrChildrenID) > 0;
         $arrMainCat[] = $cat;
     }
     return $arrMainCat;
 }
Ejemplo n.º 5
0
 /**
  * 受注番号、最終ポイント、加算ポイント、利用ポイントから「オーダー前ポイント」を取得する
  *
  * @param integer $order_id 受注番号
  * @param integer $use_point 利用ポイント
  * @param integer $add_point 加算ポイント
  * @param integer $order_status 対応状況
  * @return array オーダー前ポイントの配列
  */
 function sfGetRollbackPoint($order_id, $use_point, $add_point, $order_status)
 {
     $objQuery = new SC_Query_Ex();
     $arrRet = $objQuery->select("customer_id", "dtb_order", "order_id = ?", array($order_id));
     $customer_id = $arrRet[0]['customer_id'];
     if ($customer_id != "" && $customer_id >= 1) {
         $arrRet = $objQuery->select('point', "dtb_customer", "customer_id = ?", array($customer_id));
         $point = $arrRet[0]['point'];
         $rollback_point = $arrRet[0]['point'];
         // 対応状況がポイント利用対象の場合、使用ポイント分を戻す
         if (SC_Helper_Purchase_Ex::isUsePoint($order_status)) {
             $rollback_point += $use_point;
         }
         // 対応状況がポイント加算対象の場合、加算ポイント分を戻す
         if (SC_Helper_Purchase_Ex::isAddPoint($order_status)) {
             $rollback_point -= $add_point;
         }
     } else {
         $rollback_point = "";
         $point = "";
     }
     return array($point, $rollback_point);
 }
Ejemplo n.º 6
0
    /**
     * 商品規格ID1、2に紐づいた,product_class_idを取得する.
     *
     * @param int $productId 商品ID
     * @param int $classcategory_id1 商品規格ID1
     * @param int $classcategory_id2 商品規格ID2
     * @return string product_class_id
     */
    function getClasscategoryIdsByProductClassId($productId, $classcategory_id1, $classcategory_id2)
    {
        $objQuery = new SC_Query_Ex();
        $col = "T1.product_id AS product_id,T1.product_class_id AS product_class_id,T1.classcategory_id1 AS classcategory_id1,T1.classcategory_id2 AS classcategory_id2";
        $table = <<<__EOS__
            (SELECT
                pc.product_code AS product_code,
                pc.product_id AS product_id,
                pc.product_class_id AS product_class_id,
                pc.class_combination_id AS class_combination_id,
                COALESCE(cc2.classcategory_id,0) AS classcategory_id1,
                COALESCE(cc1.classcategory_id,0) AS classcategory_id2
            FROM
                dtb_products_class pc LEFT JOIN dtb_class_combination cc1 ON pc.class_combination_id = cc1.class_combination_id
                LEFT JOIN dtb_class_combination cc2 ON cc1.parent_class_combination_id = cc2.class_combination_id) T1
__EOS__;
        $where = "T1.product_id = ? AND T1.classcategory_id1 = ? AND T1.classcategory_id2 = ?";
        $arrRet = $objQuery->select($col, $table, $where, array($productId, $classcategory_id1, $classcategory_id2));
        return $arrRet[0]['product_class_id'];
    }
Ejemplo n.º 7
0
    /**
     * 商品情報の読み込みを行う.
     *
     * @param integer $customer_id 会員ID
     * @param integer $order_id 受注ID
     * @param integer $product_id 商品ID
     * @param integer $product_class_id 商品規格ID
     * @return array 商品情報の配列
     */
    function lfGetRealFileName($customer_id, $order_id, $product_id, $product_class_id)
    {
        $objQuery = new SC_Query_Ex();
        $col = <<<__EOS__
            pc.product_id AS product_id,
            pc.product_class_id AS product_class_id,
            pc.down_realfilename AS down_realfilename,
            pc.down_filename AS down_filename,
            o.order_id AS order_id,
            o.customer_id AS customer_id,
            o.payment_date AS payment_date,
            o.status AS status
__EOS__;
        $table = <<<__EOS__
            dtb_products_class pc,
            dtb_order_detail od,
            dtb_order o
__EOS__;
        $dbFactory = SC_DB_DBFactory_Ex::getInstance();
        $where = "o.customer_id = ? AND o.order_id = ? AND pc.product_id = ? AND pc.product_class_id = ?";
        $where .= " AND " . $dbFactory->getDownloadableDaysWhereSql('o');
        $where .= " = 1";
        $arrRet = $objQuery->select($col, $table, $where, array($customer_id, $order_id, $product_id, $product_class_id));
        return $arrRet[0];
    }
Ejemplo n.º 8
0
 function lfGetOrderDetail($order_id)
 {
     $objQuery = new SC_Query_Ex();
     $col = "product_id, product_class_id, product_code, product_name, classcategory_name1, classcategory_name2, price, quantity, point_rate";
     $where = "order_id = ?";
     $objQuery->setOrder("order_detail_id");
     $arrRet = $objQuery->select($col, "dtb_order_detail", $where, array($order_id));
     return $arrRet;
 }
Ejemplo n.º 9
0
 /**
  * インストールされているプラグインを取得する。
  */
 function getAllPlugin()
 {
     $objQuery = new SC_Query_Ex();
     $col = '*';
     $table = 'dtb_plugin';
     $where = 'del_flg = 0';
     // XXX 2.11.0 互換のため
     $arrCols = $objQuery->listTableFields($table);
     if (in_array('rank', $arrCols)) {
         $objQuery->setOrder('rank DESC');
     }
     $arrRet = $objQuery->select($col, $table, $where);
     return $arrRet;
 }
 /**
  * DBから登録内容を取得する.
  *
  * @param void
  * @return array
  */
 function getOwnersStoreSettings()
 {
     $table = 'dtb_ownersstore_settings';
     $colmuns = '*';
     $objQuery = new SC_Query_Ex();
     $arrRet = $objQuery->select($colmuns, $table);
     if (isset($arrRet[0])) {
         return $arrRet[0];
     }
     return array();
 }
Ejemplo n.º 11
0
 function getPublicKey()
 {
     $objQuery = new SC_Query_Ex();
     $arrRet = $objQuery->select('*', 'dtb_ownersstore_settings');
     return isset($arrRet[0]['public_key']) ? $arrRet[0]['public_key'] : null;
 }
 /**
  * Page のアクション.
  *
  * @return void
  */
 function action()
 {
     $objDb = new SC_Helper_DB_Ex();
     $objFormParam = new SC_FormParam_Ex();
     // 入力パラメーター初期化
     $this->initParam($objFormParam);
     $objFormParam->setParam($_POST);
     $objFormParam->convParam();
     switch ($this->getMode()) {
         // カテゴリー登録/編集実行
         case 'edit':
             $category_id = $objFormParam->getValue('category_id');
             if ($category_id == '') {
                 $this->doRegister($objFormParam);
             } else {
                 $this->doEdit($objFormParam);
             }
             break;
             // 入力ボックスへ編集対象のカテゴリ名をセット
         // 入力ボックスへ編集対象のカテゴリ名をセット
         case 'pre_edit':
             $this->doPreEdit($objFormParam);
             break;
             // カテゴリ削除
         // カテゴリ削除
         case 'delete':
             $this->doDelete($objFormParam, $objDb);
             break;
             // 表示順を上へ
         // 表示順を上へ
         case 'up':
             $this->doUp($objFormParam);
             break;
             // 表示順を下へ
         // 表示順を下へ
         case 'down':
             $this->doDown($objFormParam);
             break;
             // XXX 使われていないコード?
         // XXX 使われていないコード?
         case 'moveByDnD':
             // DnDしたカテゴリと移動先のセットを分解する
             $keys = explode("-", $_POST['keySet']);
             if ($keys[0] && $keys[1]) {
                 $objQuery = new SC_Query_Ex();
                 $objQuery->begin();
                 // 移動したデータのrank、level、parent_category_idを取得
                 $rank = $objQuery->get('rank', "dtb_category", "category_id = ?", array($keys[0]));
                 $level = $objQuery->get('level', "dtb_category", "category_id = ?", array($keys[0]));
                 $parent = $objQuery->get("parent_category_id", "dtb_category", "category_id = ?", array($keys[0]));
                 // 同一level内のrank配列を作成
                 $objQuery->setOption("ORDER BY rank DESC");
                 if ($level == 1) {
                     // 第1階層の時
                     $arrRet = $objQuery->select('rank', "dtb_category", "level = ?", array($level));
                 } else {
                     // 第2階層以下の時
                     $arrRet = $objQuery->select('rank', "dtb_category", "level = ? AND parent_category_id = ?", array($level, $parent));
                 }
                 for ($i = 0; $i < sizeof($arrRet); $i++) {
                     $rankAry[$i + 1] = $arrRet[$i]['rank'];
                 }
                 // 移動したデータのグループ内データ数
                 $my_count = $this->lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $keys[0]);
                 if ($rankAry[$keys[1]] > $rank) {
                     // データが今の位置より上がった時
                     $up_count = $rankAry[$keys[1]] - $rank;
                     $decAry = $objQuery->select("category_id", "dtb_category", "level = ? AND rank > ? AND rank <= ?", array($level, $rank, $rankAry[$keys[1]]));
                     foreach ($decAry as $value) {
                         // 上のグループから減算
                         $this->lfDownRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $value["category_id"], $my_count);
                     }
                     // 自分のグループに加算
                     $this->lfUpRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $keys[0], $up_count);
                 } else {
                     if ($rankAry[$keys[1]] < $rank) {
                         // データが今の位置より下がった時
                         $down_count = 0;
                         $incAry = $objQuery->select("category_id", "dtb_category", "level = ? AND rank < ? AND rank >= ?", array($level, $rank, $rankAry[$keys[1]]));
                         foreach ($incAry as $value) {
                             // 下のグループに加算
                             $this->lfUpRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $value["category_id"], $my_count);
                             // 合計減算値
                             $down_count += $this->lfCountChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $value["category_id"]);
                         }
                         // 自分のグループから減算
                         $this->lfDownRankChilds($objQuery, "dtb_category", "parent_category_id", "category_id", $keys[0], $down_count);
                     }
                 }
                 $objQuery->commit();
             }
             break;
             // カテゴリツリークリック時
         // カテゴリツリークリック時
         case 'tree':
             break;
             // CSVダウンロード
         // CSVダウンロード
         case 'csv':
             // CSVを送信する
             $objCSV = new SC_Helper_CSV_Ex();
             $objCSV->sfDownloadCsv("5", "", array(), "", true);
             exit;
             break;
         default:
             break;
     }
     $parent_category_id = $objFormParam->getValue('parent_category_id');
     // 空の場合は親カテゴリを0にする
     if (empty($parent_category_id)) {
         $parent_category_id = 0;
     }
     // 親カテゴリIDの保持
     $this->arrForm['parent_category_id'] = $parent_category_id;
     // カテゴリ一覧を取得
     $this->arrList = $this->findCategoiesByParentCategoryId($parent_category_id);
     // カテゴリツリーを取得
     $this->arrTree = $objDb->sfGetCatTree($parent_category_id);
     // ぱんくずの生成
     $arrBread = array();
     $objDb->findTree($this->arrTree, $parent_category_id, $arrBread);
     $this->tpl_bread_crumbs = SC_Utils_Ex::jsonEncode($arrBread);
 }