-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsqlazure_support.patch
More file actions
8370 lines (8348 loc) · 477 KB
/
sqlazure_support.patch
File metadata and controls
8370 lines (8348 loc) · 477 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff -urNb ec-cube-iis/data/class/db/SC_DB_DBFactory.php ec-cube/data/class/db/SC_DB_DBFactory.php
--- ec-cube-iis/data/class/db/SC_DB_DBFactory.php 2014-08-20 17:46:25.000000000 +0900
+++ ec-cube/data/class/db/SC_DB_DBFactory.php 2014-08-20 17:49:19.000000000 +0900
@@ -45,6 +45,9 @@
case 'pgsql':
return new SC_DB_DBFactory_PGSQL();
+ case 'sqlsrv':
+ return new SC_DB_DBFactory_SQLSRV();
+
default:
return new SC_DB_DBFactory();
}
diff -urNb ec-cube-iis/data/class/db/dbfactory/SC_DB_DBFactory_SQLSRV.php ec-cube/data/class/db/dbfactory/SC_DB_DBFactory_SQLSRV.php
--- ec-cube-iis/data/class/db/dbfactory/SC_DB_DBFactory_SQLSRV.php 1970-01-01 09:00:00.000000000 +0900
+++ ec-cube/data/class/db/dbfactory/SC_DB_DBFactory_SQLSRV.php 2014-08-20 17:49:19.000000000 +0900
@@ -0,0 +1,313 @@
+<?php
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2011 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+// {{{ requires
+require_once CLASS_REALDIR . 'db/SC_DB_DBFactory.php';
+
+/**
+ * SQL Server 固有の処理をするクラス.
+ *
+ * このクラスを直接インスタンス化しないこと.
+ * 必ず SC_DB_DBFactory クラスを経由してインスタンス化する.
+ * また, SC_DB_DBFactory クラスの関数を必ずオーバーライドしている必要がある.
+ *
+ * @package DB
+ * @author LOCKON CO.,LTD.
+ * @version $Id:SC_DB_DBFactory_PGSQL.php 15532 2007-08-31 14:39:46Z nanasess $
+ */
+class SC_DB_DBFactory_SQLSRV extends SC_DB_DBFactory
+{
+
+ /**
+ * DBのバージョンを取得する.
+ *
+ * @param string $dsn データソース名
+ * @return string データベースのバージョン
+ */
+ function sfGetDBVersion($dsn = "")
+ {
+ $objQuery =& SC_Query_Ex::getSingletonInstance($dsn);
+ $val = $objQuery->getOne("select @@version");
+ return str_replace("\r\n", " ", $val);
+ }
+
+ /**
+ * MySQL 用の SQL 文に変更する.
+ *
+ * DB_TYPE が SQLSRV の場合は SQL Server 用の SQL 文に置換する.
+ *
+ * @access private
+ * @param string $sql SQL 文
+ * @return string MySQL 用に置換した SQL 文
+ */
+ function sfChangeMySQL($sql)
+ {
+ $sql = $this->sfChangeILIKE($sql);
+ $sql = $this->sfChangeArrayToString($sql);
+ $sql = $this->convertRecommendSql($sql);
+
+ return $sql;
+ }
+
+ /**
+ * ARRAY_TO_STRING(ARRAY(A),B) を GROUP_CONCAT() に変換する.
+ *
+ * @access private
+ * @param string $sql SQL文
+ * @return string 変換後の SQL 文
+ */
+ function sfChangeArrayToString($sql)
+ {
+ if(strpos(strtoupper($sql), 'ARRAY_TO_STRING') !== FALSE) {
+ preg_match_all('/ARRAY_TO_STRING.*?\(.*?ARRAY\(.*?SELECT (.+?) FROM (.+?) WHERE (.+?)\).*?\,.*?\'(.+?)\'.*?\)/is', $sql, $match, PREG_SET_ORDER);
+
+ foreach($match as $item) {
+ $replace = "CAST ({$item[1]} AS varchar) + '" . $item[4] . "' FROM " . $item[2] . " WHERE " . $item[3] . " FOR XML PATH('')";
+ $sql = str_replace($item[0], $replace, $sql);
+ }
+ }
+ return $sql;
+ }
+
+ /**
+ * 関連商品の SQL を変換する。
+ *
+ * @param string SQL 文
+ * @return string 変換後の SQL 文
+ */
+ function convertRecommendSql($sql)
+ {
+ if (strpos(strtoupper($sql), ') AS RECOMMEND_') !== FALSE) {
+ $pattern = '/\(SELECT (comment|recommend_product_id) FROM dtb_recommend_products WHERE (.*?) ORDER BY (.*?) limit 1 offset (\d+)\) AS ((recommend_comment|recommend_product_id)\d+)/';
+ $replacement = '(SELECT \1 FROM dtb_recommend_products WHERE \2 ORDER BY \3 OFFSET \4 ROWS FETCH NEXT 1 ROWS ONLY) AS \5';
+ $sql = preg_replace($pattern, $replacement, $sql);
+ }
+
+ return $sql;
+ }
+
+ /**
+ * 昨日の売上高・売上件数を算出する SQL を返す.
+ *
+ * @param string $method SUM または COUNT
+ * @return string 昨日の売上高・売上件数を算出する SQL
+ */
+ function getOrderYesterdaySql($method)
+ {
+ return "SELECT ".$method."(total) FROM dtb_order "
+ . "WHERE del_flg = 0 "
+ . "AND create_date >= convert(varchar(10),getdate()-1,111) AND create_date < convert(varchar(10),getdate(),111) "
+ . "AND status <> " . ORDER_CANCEL;
+ }
+
+ /**
+ * 当月の売上高・売上件数を算出する SQL を返す.
+ *
+ * @param string $method SUM または COUNT
+ * @return string 当月の売上高・売上件数を算出する SQL
+ */
+ function getOrderMonthSql($method)
+ {
+ return "SELECT ".$method."(total) FROM dtb_order "
+ . "WHERE del_flg = 0 "
+ . "AND create_date >= convert(varchar(10), YEAR(getdate())) + '/' + convert(varchar(10), MONTH(getdate())) + '/01'"
+ . "AND convert(varchar(10), create_date, 111) <> convert(varchar(10),getdate(),111) "
+ . "AND status <> " . ORDER_CANCEL;
+ }
+
+ /**
+ * 昨日のレビュー書き込み件数を算出する SQL を返す.
+ *
+ * @return string 昨日のレビュー書き込み件数を算出する SQL
+ */
+ function getReviewYesterdaySql()
+ {
+ return "SELECT COUNT(*) FROM dtb_review AS A "
+ . "LEFT JOIN dtb_products AS B "
+ . "ON A.product_id = B.product_id "
+ . "WHERE A.del_flg=0 "
+ . "AND B.del_flg = 0 "
+ . "AND A.create_date >= convert(varchar(10),getdate()-1,111) AND A.create_date < convert(varchar(10),getdate(),111) ";
+ }
+
+ /**
+ * メール送信履歴の start_date の検索条件の SQL を返す.
+ *
+ * @deprecated
+ * @return string 検索条件の SQL
+ */
+ function getSendHistoryWhereStartdateSql()
+ {
+ // FIXME
+ return null;
+ }
+
+ /**
+ * ダウンロード販売の検索条件の SQL を返す.
+ *
+ * @param string $dtb_order_alias
+ * @return string 検索条件の SQL
+ */
+ function getDownloadableDaysWhereSql($dtb_order_alias = 'dtb_order')
+ {
+ $baseinfo = SC_Helper_DB_Ex::sfGetBasisData();
+ //downloadable_daysにNULLが入っている場合(無期限ダウンロード可能時)もあるので、NULLの場合は0日に補正
+ $downloadable_days = $baseinfo['downloadable_days'];
+ if($downloadable_days ==null || $downloadable_days == "")$downloadable_days=0;
+ return "(SELECT CASE WHEN (SELECT d1.downloadable_days_unlimited FROM dtb_baseinfo d1) = 1 AND " . $dtb_order_alias . ".payment_date IS NOT NULL THEN 1 WHEN CURRENT_TIMESTAMP <= convert(datetimeoffset, DATEADD(day, ${downloadable_days}, ${dtb_order_alias}.payment_date)) THEN 1 ELSE 0 END)";
+ return 1; // FIXME
+ }
+
+ /**
+ * 売上集計の期間別集計のSQLを返す
+ *
+ * @param mixed $type
+ * @return string 検索条件のSQL
+ */
+ function getOrderTotalDaysWhereSql($format)
+ {
+
+ return $format . " AS str_date,
+ COUNT(order_id) AS total_order,
+ SUM(CASE WHEN order_sex = 1 THEN 1 ELSE 0 END) AS men,
+ SUM(CASE WHEN order_sex = 2 THEN 1 ELSE 0 END) AS women,
+ SUM(CASE WHEN customer_id <> 0 AND order_sex = 1 THEN 1 ELSE 0 END) AS men_member,
+ SUM(CASE WHEN customer_id <> 0 AND order_sex = 2 THEN 1 ELSE 0 END) AS women_member,
+ SUM(CASE WHEN customer_id = 0 AND order_sex = 1 THEN 1 ELSE 0 END) AS men_nonmember,
+ SUM(CASE WHEN customer_id = 0 AND order_sex = 2 THEN 1 ELSE 0 END) AS women_nonmember,
+ SUM(total) AS total,
+ AVG(total) AS total_average";
+ }
+
+ /**
+ * 売上集計の年代別集計の年代抽出部分のSQLを返す
+ *
+ * @return string 年代抽出部分の SQL
+ */
+ function getOrderTotalAgeColSql()
+ {
+ return 'SELECT order_id,total,create_date ,del_flg ,status,customer_id,CASE
+ WHEN RIGHT(CONVERT(CHAR(8) , order_birth, 112), 4) > RIGHT(CONVERT(CHAR(8) , create_date, 112), 4) THEN ROUND(YEAR(create_date) - YEAR(order_birth) - 1,-1,1)
+ ELSE ROUND(YEAR(create_date) - YEAR(order_birth),-1,1)
+ END as age FROM dtb_order';
+ }
+
+ /**
+ * 文字列連結を行う.
+ *
+ * @param array $columns 連結を行うカラム名
+ * @return string 連結後の SQL 文
+ */
+ function concatColumn($columns)
+ {
+ $sql = "";
+ $i = 0;
+ $total = count($columns);
+ foreach ($columns as $column) {
+ $sql .= $column;
+ if ($i < $total -1) {
+ $sql .= " + ";
+ }
+ $i++;
+ }
+ return $sql;
+ }
+
+ /**
+ * テーブルを検索する.
+ *
+ * 引数に部分一致するテーブル名を配列で返す.
+ *
+ * @deprecated SC_Query::listTables() を使用してください
+ * @param string $expression 検索文字列
+ * @return array テーブル名の配列
+ */
+ function findTableNames($expression = "")
+ {
+ $objQuery =& SC_Query_Ex::getSingletonInstance();
+ $sql = 'SELECT name FROM sysobjects WHERE xtype = \'u\' AND name LIKE \'mtb_%\' order by name';
+ $arrColList = $objQuery->getAll($sql);
+ $arrColList = SC_Utils_Ex::sfSwapArray($arrColList, false);
+ $arrList = array();
+ foreach($arrColList[0] as $val){
+ $arrList[$val] = $val ;
+ }
+
+ return $arrList;
+ }
+
+ /**
+ * 文字コード情報を取得する
+ *
+ * @return array 文字コード情報
+ */
+ function getCharSet()
+ {
+ // 未実装
+ return array();
+ }
+
+ /**
+ * 擬似表を表すSQL文(FROM 句)を取得する
+ *
+ * @return string
+ */
+ function getDummyFromClauseSql()
+ {
+ return '';
+ }
+
+ /**
+ * ILIKE句 を LIKE句へ変換する.
+ *
+ * @access private
+ * @param string $sql SQL文
+ * @return string 変換後の SQL 文
+ */
+ function sfChangeILIKE($sql)
+ {
+ $changesql = preg_replace('/(^|[^\w])ILIKE([^\w]|$)/i', '$1LIKE$2', $sql);
+ return $changesql;
+ }
+
+ /**
+ * SQL 文に OFFSET, LIMIT を付加する。
+ *
+ * @param string 元の SQL 文
+ * @param integer LIMIT
+ * @param integer OFFSET
+ * @return string 付加後の SQL 文
+ */
+ function addLimitOffset($sql, $limit = 0, $offset = 0)
+ {
+ if (strlen($offset) === 0) {
+ $offset = 0;
+ }
+ $sql .= " OFFSET $offset ROWS";
+ if ($limit != 0) {
+ $sql .= " FETCH NEXT $limit ROWS ONLY";
+ }
+
+ return $sql;
+ }
+}
diff -urNb ec-cube-iis/data/class/helper/SC_Helper_Mail.php ec-cube/data/class/helper/SC_Helper_Mail.php
--- ec-cube-iis/data/class/helper/SC_Helper_Mail.php 2014-08-20 17:46:25.000000000 +0900
+++ ec-cube/data/class/helper/SC_Helper_Mail.php 2014-08-20 17:49:19.000000000 +0900
@@ -217,8 +217,8 @@
foreach ($arrRet as $key => $value) {
$col = 's_i.*, tax_rate, tax_rule';
$from = 'dtb_shipment_item AS s_i JOIN dtb_order_detail AS o_d
- USING(order_id, product_class_id)';
- $where = 'order_id = ? AND shipping_id = ?';
+ ON s_i.order_id = o_d.order_id AND s_i.product_class_id = o_d.product_class_id';
+ $where = 'o_d.order_id = ? AND shipping_id = ?';
$arrWhereVal = array($order_id, $arrRet[$key]['shipping_id']);
$arrItems = $objQuery->select($col, $from, $where, $arrWhereVal);
$arrRet[$key]['shipment_item'] = $arrItems;
diff -urNb ec-cube-iis/data/class/helper/SC_Helper_Purchase.php ec-cube/data/class/helper/SC_Helper_Purchase.php
--- ec-cube-iis/data/class/helper/SC_Helper_Purchase.php 2014-08-20 17:46:25.000000000 +0900
+++ ec-cube/data/class/helper/SC_Helper_Purchase.php 2014-08-20 17:49:19.000000000 +0900
@@ -1038,8 +1038,8 @@
$objProduct = new SC_Product_Ex();
$arrResults = array();
$objQuery->setOrder('order_detail_id');
- $arrItems = $objQuery->select('dtb_shipment_item.*', 'dtb_shipment_item join dtb_order_detail USING (product_class_id, order_id)',
- 'order_id = ? AND shipping_id = ?',
+ $arrItems = $objQuery->select('dtb_shipment_item.*', 'dtb_shipment_item join dtb_order_detail ON dtb_shipment_item.product_class_id = dtb_order_detail.product_class_id AND dtb_shipment_item.order_id = dtb_order_detail.order_id',
+ 'dtb_order_detail.order_id = ? AND shipping_id = ?',
array($order_id, $shipping_id));
foreach ($arrItems as $key => $arrItem) {
diff -urNb ec-cube-iis/data/class/pages/admin/basis/LC_Page_Admin_Basis_ZipInstall.php ec-cube/data/class/pages/admin/basis/LC_Page_Admin_Basis_ZipInstall.php
--- ec-cube-iis/data/class/pages/admin/basis/LC_Page_Admin_Basis_ZipInstall.php 2014-08-20 17:46:25.000000000 +0900
+++ ec-cube/data/class/pages/admin/basis/LC_Page_Admin_Basis_ZipInstall.php 2014-08-20 17:49:19.000000000 +0900
@@ -161,7 +161,10 @@
$objQuery =& SC_Query_Ex::getSingletonInstance();
// DB更新
+ $objQuery->begin();
+ $this->lfDeleteZip();
$this->insertMtbZip();
+ $objQuery->commit();
}
/**
@@ -229,43 +232,34 @@
$cntInsert = 0;
$img_cnt = 0;
- /* 標準実装が非常に遅いので Azure/WebMatrix 向けにチューニング */
- $begin = microtime(true);
-
- try {
- $dbh = new PDO('mysql:host=' . DB_SERVER . ';dbname=' . DB_NAME . ';port=' . DB_PORT . ';charset=utf8', DB_USER, DB_PASSWORD);
- $dbh->beginTransaction();
- $dbh->exec('DELETE FROM mtb_zip');
-
- $sql = 'INSERT INTO mtb_zip (zip_id, zipcode, state, city, town) VALUES (?, ?, ?, ?, ?)';
- $stmt = $dbh->prepare($sql);
- $line = file(ZIP_CSV_UTF8_REALFILE);
- for($i = 0; $line[$i] != ''; $i ++){
- if (!($array = explode(",", $line[$i]))) {
- continue;
- }
- $stmt->bindParam(1, ++$cntCurrentLine, PDO::PARAM_INT);
- $stmt->bindParam(2, trim($array[2], '"'), PDO::PARAM_STR, strlen($array[2]));
- $stmt->bindParam(3, trim($array[6], '"'), PDO::PARAM_STR, strlen($array[6]));
- $stmt->bindParam(4, trim($array[7], '"'), PDO::PARAM_STR, strlen($array[7]));
- $stmt->bindParam(5, trim($array[8], '"'), PDO::PARAM_STR, strlen($array[8]));
- $stmt->execute();
+ $fp = $this->openZipCsv();
+ while (!feof($fp)) {
+ $arrCSV = fgetcsv($fp, ZIP_CSV_LINE_MAX);
+ if (empty($arrCSV)) continue;
+ $cntCurrentLine++;
+ if ($cntCurrentLine >= $start) {
+ $sqlval = array();
+ $sqlval['zip_id'] = $cntCurrentLine;
+ $sqlval['zipcode'] = $arrCSV[2];
+ $sqlval['state'] = $arrCSV[6];
+ $sqlval['city'] = $arrCSV[7];
+ $sqlval['town'] = $arrCSV[8];
+ $objQuery->insert('mtb_zip', $sqlval);
$cntInsert++;
+ }
// $disp_line件ごとに進捗表示する
- if ($i % $disp_line == 0 && $img_cnt < IMAGE_MAX) {
+ if ($cntCurrentLine % $disp_line == 0 && $img_cnt < IMAGE_MAX) {
echo '<img src="' . $img_path . 'graph_1_w.gif">';
SC_Utils_Ex::sfFlush();
$img_cnt++;
}
SC_Utils_Ex::extendTimeOut();
}
- $end = microtime(true);
+ fclose($fp);
echo '<img src="' . $img_path . 'space_w.gif">';
- } catch (PDOException $e) {
- trigger_error($e->getMessage(), E_USER_ERROR);
- }
+
?>
</div>
<script type='text/javascript' language='javascript'>
@@ -276,7 +270,7 @@
document.open('text/html','replace');
document.clear();
document.write('<p>完了しました。<br />');
- document.write("<?php echo $cntInsert ?> 件を追加しました。<?php echo ($end-$begin); ?> 秒かかりました</p>");
+ document.write("<?php echo $cntInsert ?> 件を追加しました。</p>");
document.write("<p><a href='?' target='_top'>戻る</a></p>");
document.close();
}
@@ -287,7 +281,6 @@
</body>
</html>
<?php
- $dbh->commit();
}
public function openZipCsv()
diff -urNb ec-cube-iis/data/class_extends/SC_CustomerList_Ex.php ec-cube/data/class_extends/SC_CustomerList_Ex.php
--- ec-cube-iis/data/class_extends/SC_CustomerList_Ex.php 2014-08-20 17:46:26.000000000 +0900
+++ ec-cube/data/class_extends/SC_CustomerList_Ex.php 2014-08-20 17:49:20.000000000 +0900
@@ -25,4 +25,301 @@
class SC_CustomerList_Ex extends SC_CustomerList
{
+ public function __construct($array, $mode = '')
+ {
+ if (is_array($array)) {
+ $this->arrSql = $array;
+ }
+
+ $objDb = new SC_Helper_DB_Ex();
+ $dbFactory = SC_DB_DBFactory_Ex::getInstance();
+
+ if ($mode == '') {
+ // 会員本登録会員で削除していない会員
+ $this->setWhere('status = 2 AND del_flg = 0 ');
+ // 登録日を示すカラム
+ $regdate_col = 'dtb_customer.update_date';
+ }
+
+ if ($mode == 'customer') {
+ $this->setWhere(' del_flg = 0 ');
+ // 登録日を示すカラム
+ $regdate_col = 'dtb_customer.update_date';
+ }
+
+ // 会員ID
+ if (!isset($this->arrSql['search_customer_id'])) $this->arrSql['search_customer_id'] = '';
+ if (strlen($this->arrSql['search_customer_id']) > 0) {
+ $this->setWhere('customer_id = ?');
+ $this->arrVal[] = $this->arrSql['search_customer_id'];
+ }
+
+ // 名前
+ if (!isset($this->arrSql['search_name'])) $this->arrSql['search_name'] = '';
+ if (strlen($this->arrSql['search_name']) > 0) {
+ $this->setWhere('(' . $dbFactory->concatColumn(array('name01', 'name02')) . ' LIKE ?)');
+ $searchName = $this->addSearchStr($this->arrSql['search_name']);
+ $this->arrVal[] = preg_replace('/[ ]+/u','',$searchName);
+ }
+
+ // 名前(フリガナ)
+ if (!isset($this->arrSql['search_kana'])) $this->arrSql['search_kana'] = '';
+ if (strlen($this->arrSql['search_kana']) > 0) {
+ $this->setWhere('(' . $dbFactory->concatColumn(array('kana01', 'kana02')) . ' LIKE ?)');
+ $searchKana = $this->addSearchStr($this->arrSql['search_kana']);
+ $this->arrVal[] = preg_replace('/[ ]+/u','',$searchKana);
+ }
+
+ // 都道府県
+ if (!isset($this->arrSql['search_pref'])) $this->arrSql['search_pref'] = '';
+ if (strlen($this->arrSql['search_pref']) > 0) {
+ $this->setWhere('pref = ?');
+ $this->arrVal[] = $this->arrSql['search_pref'];
+ }
+
+ // 電話番号
+ if (!isset($this->arrSql['search_tel'])) $this->arrSql['search_tel'] = '';
+ if (is_numeric($this->arrSql['search_tel'])) {
+ $this->setWhere('(' . $dbFactory->concatColumn(array('tel01', 'tel02', 'tel03')) . ' LIKE ?)');
+ $searchTel = $this->addSearchStr($this->arrSql['search_tel']);
+ $this->arrVal[] = str_replace('-', '', $searchTel);
+ }
+
+ // 性別
+ if (!isset($this->arrSql['search_sex'])) $this->arrSql['search_sex'] = '';
+ if (is_array($this->arrSql['search_sex'])) {
+ $arrSexVal = $this->setItemTerm($this->arrSql['search_sex'] ,'sex');
+ foreach ($arrSexVal as $data) {
+ $this->arrVal[] = $data;
+ }
+ }
+
+ // 職業
+ if (!isset($this->arrSql['search_job'])) $this->arrSql['search_job'] = '';
+ if (is_array($this->arrSql['search_job'])) {
+ if (in_array('不明', $this->arrSql['search_job'])) {
+ $arrJobVal = $this->setItemTermWithNull($this->arrSql['search_job'] ,'job');
+ } else {
+ $arrJobVal = $this->setItemTerm($this->arrSql['search_job'] ,'job');
+ }
+ if (is_array($arrJobVal)) {
+ foreach ($arrJobVal as $data) {
+ $this->arrVal[] = $data;
+ }
+ }
+ }
+
+ // E-MAIL
+ if (!isset($this->arrSql['search_email'])) $this->arrSql['search_email'] = '';
+ if (strlen($this->arrSql['search_email']) > 0) {
+ //カンマ区切りで複数の条件指定可能に
+ $this->arrSql['search_email'] = explode(',', $this->arrSql['search_email']);
+ $sql_where = '';
+ foreach ($this->arrSql['search_email'] as $val) {
+ $val = trim($val);
+ //検索条件を含まない
+ if ($this->arrSql['not_emailinc'] == '1') {
+ if ($sql_where == '') {
+ $sql_where .= 'dtb_customer.email NOT ILIKE ? ';
+ } else {
+ $sql_where .= 'AND dtb_customer.email NOT ILIKE ? ';
+ }
+ } else {
+ if ($sql_where == '') {
+ $sql_where .= 'dtb_customer.email ILIKE ? ';
+ } else {
+ $sql_where .= 'OR dtb_customer.email ILIKE ? ';
+ }
+ }
+ $searchEmail = $this->addSearchStr($val);
+ $this->arrVal[] = $searchEmail;
+ }
+ $this->setWhere($sql_where);
+ }
+
+ // E-MAIL(mobile)
+ if (!isset($this->arrSql['search_email_mobile'])) $this->arrSql['search_email_mobile'] = '';
+
+ if (strlen($this->arrSql['search_email_mobile']) > 0) {
+ //カンマ区切りで複数の条件指定可能に
+ $this->arrSql['search_email_mobile'] = explode(',', $this->arrSql['search_email_mobile']);
+ $sql_where = '';
+ foreach ($this->arrSql['search_email_mobile'] as $val) {
+ $val = trim($val);
+ //検索条件を含まない
+ if ($this->arrSql['not_email_mobileinc'] == '1') {
+ if ($sql_where == '') {
+ $sql_where .= 'dtb_customer.email_mobile NOT ILIKE ? ';
+ } else {
+ $sql_where .= 'AND dtb_customer.email_mobile NOT ILIKE ? ';
+ }
+ } else {
+ if ($sql_where == '') {
+ $sql_where .= 'dtb_customer.email_mobile ILIKE ? ';
+ } else {
+ $sql_where .= 'OR dtb_customer.email_mobile ILIKE ? ';
+ }
+ }
+ $searchemail_mobile = $this->addSearchStr($val);
+ $this->arrVal[] = $searchemail_mobile;
+ }
+ $this->setWhere($sql_where);
+ }
+
+ // メールマガジンの場合
+ if ($mode == 'customer') {
+ // メルマガ受け取りの選択項目がフォームに存在する場合
+ if (isset($this->arrSql['search_htmlmail'])) {
+ $this->setWhere('status = 2');
+ if (SC_Utils_Ex::sfIsInt($this->arrSql['search_htmlmail'])) {
+ $this->setWhere('mailmaga_flg = ?');
+ $this->arrVal[] = $this->arrSql['search_htmlmail'];
+ } else {
+ // メルマガ購読拒否は省く
+ $this->setWhere('mailmaga_flg <> 3');
+ }
+ }
+ }
+
+ // 配信メールアドレス種別
+ if ($mode == 'customer') {
+ if (isset($this->arrSql['search_mail_type'])) {
+ $sqlEmailMobileIsEmpty = "(dtb_customer.email_mobile IS NULL OR dtb_customer.email_mobile = '')";
+ switch ($this->arrSql['search_mail_type']) {
+ // PCメールアドレス
+ case 1:
+ $this->setWhere("(dtb_customer.email <> dtb_customer.email_mobile OR $sqlEmailMobileIsEmpty)");
+ break;
+ // 携帯メールアドレス
+ case 2:
+ $this->setWhere("NOT $sqlEmailMobileIsEmpty");
+ break;
+ // PCメールアドレス (携帯メールアドレスを登録している会員は除外)
+ case 3:
+ $this->setWhere($sqlEmailMobileIsEmpty);
+ break;
+ // 携帯メールアドレス (PCメールアドレスを登録している会員は除外)
+ case 4:
+ $this->setWhere('dtb_customer.email = dtb_customer.email_mobile');
+ break;
+ }
+ }
+ }
+
+ // 購入金額指定
+ if (!isset($this->arrSql['search_buy_total_from'])) $this->arrSql['search_buy_total_from'] = '';
+ if (!isset($this->arrSql['search_buy_total_to'])) $this->arrSql['search_buy_total_to'] = '';
+ if (is_numeric($this->arrSql['search_buy_total_from']) || is_numeric($this->arrSql['search_buy_total_to'])) {
+ $arrBuyTotal = $this->selectRange($this->arrSql['search_buy_total_from'], $this->arrSql['search_buy_total_to'], 'buy_total');
+ foreach ($arrBuyTotal as $data) {
+ $this->arrVal[] = $data;
+ }
+ }
+
+ // 購入回数指定
+ if (!isset($this->arrSql['search_buy_times_from'])) $this->arrSql['search_buy_times_from'] = '';
+ if (!isset($this->arrSql['search_buy_times_to'])) $this->arrSql['search_buy_times_to'] = '';
+ if (is_numeric($this->arrSql['search_buy_times_from']) || is_numeric($this->arrSql['search_buy_times_to'])) {
+ $arrBuyTimes = $this->selectRange($this->arrSql['search_buy_times_from'], $this->arrSql['search_buy_times_to'], 'buy_times');
+ foreach ($arrBuyTimes as $data) {
+ $this->arrVal[] = $data;
+ }
+ }
+
+ // 誕生日期間指定
+ if (!isset($this->arrSql['search_b_start_year'])) $this->arrSql['search_b_start_year'] = '';
+ if (!isset($this->arrSql['search_b_start_month'])) $this->arrSql['search_b_start_month'] = '';
+ if (!isset($this->arrSql['search_b_start_day'])) $this->arrSql['search_b_start_day'] = '';
+ if (!isset($this->arrSql['search_b_end_year'])) $this->arrSql['search_b_end_year'] = '';
+ if (!isset($this->arrSql['search_b_end_month'])) $this->arrSql['search_b_end_month'] = '';
+ if (!isset($this->arrSql['search_b_end_day'])) $this->arrSql['search_b_end_day'] = '';
+ if ((strlen($this->arrSql['search_b_start_year']) > 0 && strlen($this->arrSql['search_b_start_month']) > 0 && strlen($this->arrSql['search_b_start_day']) > 0)
+ || strlen($this->arrSql['search_b_end_year']) > 0 && strlen($this->arrSql['search_b_end_month']) > 0 && strlen($this->arrSql['search_b_end_day']) > 0) {
+ $arrBirth = $this->selectTermRange($this->arrSql['search_b_start_year'], $this->arrSql['search_b_start_month'], $this->arrSql['search_b_start_day'],
+ $this->arrSql['search_b_end_year'], $this->arrSql['search_b_end_month'], $this->arrSql['search_b_end_day'], 'birth');
+ foreach ($arrBirth as $data) {
+ $this->arrVal[] = $data;
+ }
+ }
+
+ // 誕生月の検索
+ if (!isset($this->arrSql['search_birth_month'])) $this->arrSql['search_birth_month'] = '';
+ if (is_numeric($this->arrSql['search_birth_month'])) {
+ $this->setWhere(' datepart(mm, birth) = ?');
+ $this->arrVal[] = $this->arrSql['search_birth_month'];
+ }
+
+ // 登録期間指定
+ if (!isset($this->arrSql['search_start_year'])) $this->arrSql['search_start_year'] = '';
+ if (!isset($this->arrSql['search_start_month'])) $this->arrSql['search_start_month'] = '';
+ if (!isset($this->arrSql['search_start_day'])) $this->arrSql['search_start_day'] = '';
+ if (!isset($this->arrSql['search_end_year'])) $this->arrSql['search_end_year'] = '';
+ if (!isset($this->arrSql['search_end_month'])) $this->arrSql['search_end_month'] = '';
+ if (!isset($this->arrSql['search_end_day'])) $this->arrSql['search_end_day'] = '';
+ if ( (strlen($this->arrSql['search_start_year']) > 0 && strlen($this->arrSql['search_start_month']) > 0 && strlen($this->arrSql['search_start_day']) > 0) ||
+ (strlen($this->arrSql['search_end_year']) > 0 && strlen($this->arrSql['search_end_month']) >0 && strlen($this->arrSql['search_end_day']) > 0)) {
+ $arrRegistTime = $this->selectTermRange($this->arrSql['search_start_year'], $this->arrSql['search_start_month'], $this->arrSql['search_start_day']
+ , $this->arrSql['search_end_year'], $this->arrSql['search_end_month'], $this->arrSql['search_end_day'], $regdate_col);
+ foreach ($arrRegistTime as $data) {
+ $this->arrVal[] = $data;
+ }
+ }
+
+ // 最終購入日指定
+ if (!isset($this->arrSql['search_buy_start_year'])) $this->arrSql['search_buy_start_year'] = '';
+ if (!isset($this->arrSql['search_buy_start_month'])) $this->arrSql['search_buy_start_month'] = '';
+ if (!isset($this->arrSql['search_buy_start_day'])) $this->arrSql['search_buy_start_day'] = '';
+ if (!isset($this->arrSql['search_buy_end_year'])) $this->arrSql['search_buy_end_year'] = '';
+ if (!isset($this->arrSql['search_buy_end_month'])) $this->arrSql['search_buy_end_month'] = '';
+ if (!isset($this->arrSql['search_buy_end_day'])) $this->arrSql['search_buy_end_day'] = '';
+
+ if ( (strlen($this->arrSql['search_buy_start_year']) > 0 && strlen($this->arrSql['search_buy_start_month']) > 0 && strlen($this->arrSql['search_buy_start_day']) > 0) ||
+ (strlen($this->arrSql['search_buy_end_year']) > 0 && strlen($this->arrSql['search_buy_end_month']) >0 && strlen($this->arrSql['search_buy_end_day']) > 0)) {
+ $arrRegistTime = $this->selectTermRange($this->arrSql['search_buy_start_year'], $this->arrSql['search_buy_start_month'], $this->arrSql['search_buy_start_day']
+ , $this->arrSql['search_buy_end_year'], $this->arrSql['search_buy_end_month'], $this->arrSql['search_buy_end_day'], 'last_buy_date');
+ foreach ($arrRegistTime as $data) {
+ $this->arrVal[] = $data;
+ }
+ }
+
+ // 購入商品コード
+ if (!isset($this->arrSql['search_buy_product_code'])) $this->arrSql['search_buy_product_code'] = '';
+ if (strlen($this->arrSql['search_buy_product_code']) > 0) {
+ $this->setWhere('customer_id IN (SELECT customer_id FROM dtb_order WHERE order_id IN (SELECT order_id FROM dtb_order_detail WHERE product_code LIKE ?) AND del_flg = 0)');
+ $search_buyproduct_code = $this->addSearchStr($this->arrSql['search_buy_product_code']);
+ $this->arrVal[] = $search_buyproduct_code;
+ }
+
+ // 購入商品名称
+ if (!isset($this->arrSql['search_buy_product_name'])) $this->arrSql['search_buy_product_name'] = '';
+ if (strlen($this->arrSql['search_buy_product_name']) > 0) {
+ $this->setWhere('customer_id IN (SELECT customer_id FROM dtb_order WHERE order_id IN (SELECT order_id FROM dtb_order_detail WHERE product_name LIKE ?) AND del_flg = 0)');
+ $search_buyproduct_name = $this->addSearchStr($this->arrSql['search_buy_product_name']);
+ $this->arrVal[] = $search_buyproduct_name;
+ }
+
+ // カテゴリを選択している場合のみ絞込検索を行う
+ if (!isset($this->arrSql['search_category_id'])) $this->arrSql['search_category_id'] = '';
+ if (strlen($this->arrSql['search_category_id']) > 0) {
+ // カテゴリで絞込検索を行うSQL文生成
+ list($tmp_where, $tmp_arrval) = $objDb->sfGetCatWhere($this->arrSql['search_category_id']);
+
+ // カテゴリで絞込みが可能の場合
+ if ($tmp_where != '') {
+ $this->setWhere(' customer_id IN (SELECT distinct customer_id FROM dtb_order WHERE order_id IN (SELECT distinct order_id FROM dtb_order_detail WHERE product_id IN (SELECT product_id FROM dtb_product_categories WHERE '.$tmp_where.') AND del_flg = 0)) ');
+ $this->arrVal = array_merge((array) $this->arrVal, (array) $tmp_arrval);
+ }
+ }
+
+ // 会員状態
+ if (!isset($this->arrSql['search_status'])) $this->arrSql['search_status'] = '';
+ if (is_array($this->arrSql['search_status'])) {
+ $arrStatusVal = $this->setItemTerm($this->arrSql['search_status'] ,'status');
+ foreach ($arrStatusVal as $data) {
+ $this->arrVal[] = $data;
+ }
+ }
+
+ $this->setOrder('customer_id DESC');
+ }
}
diff -urNb ec-cube-iis/data/class_extends/SC_Customer_Ex.php ec-cube/data/class_extends/SC_Customer_Ex.php
--- ec-cube-iis/data/class_extends/SC_Customer_Ex.php 2014-08-20 17:46:26.000000000 +0900
+++ ec-cube/data/class_extends/SC_Customer_Ex.php 2014-08-20 17:49:20.000000000 +0900
@@ -25,4 +25,54 @@
class SC_Customer_Ex extends SC_Customer
{
+
+ /**
+ * 会員の登録住所を取得する.
+ *
+ * 配列の1番目に会員登録住所, 追加登録住所が存在する場合は2番目以降に
+ * 設定される.
+ *
+ * @param integer $customer_id 会員ID
+ * @return array 会員登録住所, 追加登録住所の配列
+ */
+ function getCustomerAddress($customer_id)
+ {
+ if (DB_TYPE != 'sqlsrv') {
+ return parent::getCustomerAddress($customer_id);
+ } else {
+ $objQuery =& SC_Query_Ex::getSingletonInstance();
+
+ $from = <<< __EOS__
+ (
+ SELECT NULL AS other_deliv_id,
+ customer_id,
+ name01, name02,
+ kana01, kana02,
+ zip01, zip02,
+ pref,
+ addr01, addr02,
+ email, email_mobile,
+ tel01, tel02, tel03,
+ fax01, fax02, fax03
+ FROM dtb_customer
+ WHERE customer_id = ?
+ UNION ALL
+ SELECT other_deliv_id,
+ customer_id,
+ name01, name02,
+ kana01, kana02,
+ zip01, zip02,
+ pref,
+ addr01, addr02,
+ NULL AS email, NULL AS email_mobile,
+ tel01, tel02, tel03,
+ NULL AS fax01, NULL AS fax02, NULL AS fax03
+ FROM dtb_other_deliv
+ WHERE customer_id = ?
+ ) AS addrs
+__EOS__;
+ $objQuery->setOrder("CASE WHEN other_deliv_id is null THEN -1 ELSE 0 END, other_deliv_id DESC");
+ return $objQuery->select('*', $from, '', array($customer_id, $customer_id));
+ }
+ }
}
diff -urNb ec-cube-iis/data/class_extends/SC_Product_Ex.php ec-cube/data/class_extends/SC_Product_Ex.php
--- ec-cube-iis/data/class_extends/SC_Product_Ex.php 2014-08-20 17:46:26.000000000 +0900
+++ ec-cube/data/class_extends/SC_Product_Ex.php 2014-08-20 17:49:20.000000000 +0900
@@ -25,4 +25,32 @@
class SC_Product_Ex extends SC_Product
{
+ // 2.13.2 向けにコミットの予定
+ /**
+ * SC_Queryインスタンスに設定された検索条件を元に並び替え済みの検索結果商品IDの配列を取得する。
+ *
+ * 検索条件は, SC_Query::setWhere() 関数で設定しておく必要があります.
+ *
+ * @param SC_Query $objQuery SC_Query インスタンス
+ * @param array $arrVal 検索パラメーターの配列
+ * @return array 商品IDの配列
+ */
+ public function findProductIdsOrder(&$objQuery, $arrVal = array())
+ {
+ $table = 'dtb_products AS alldtl';
+
+ if (is_array($this->arrOrderData) and $objQuery->order == '') {
+ $o_col = $this->arrOrderData['col'];
+ $o_table = $this->arrOrderData['table'];
+ $o_order = $this->arrOrderData['order'];
+ $objQuery->setOrder("T2.$o_col $o_order");
+ $objQuery->setLimit(1);
+ $sub_sql = $objQuery->getSqlWithLimit($o_col, "$o_table AS T2", 'T2.product_id = alldtl.product_id');
+
+ $objQuery->setOrder("($sub_sql) $o_order, product_id");
+ }
+ $arrReturn = $objQuery->getCol('alldtl.product_id', $table, '', $arrVal);
+
+ return $arrReturn;
+ }
}
diff -urNb ec-cube-iis/data/class_extends/SC_Query_Ex.php ec-cube/data/class_extends/SC_Query_Ex.php
--- ec-cube-iis/data/class_extends/SC_Query_Ex.php 2014-08-20 17:46:26.000000000 +0900
+++ ec-cube/data/class_extends/SC_Query_Ex.php 2014-08-20 17:49:20.000000000 +0900
@@ -25,4 +25,44 @@
class SC_Query_Ex extends SC_Query
{
+
+ /**
+ * 次のシーケンス値を取得する.
+ *
+ * @param string $seq_name 取得するシーケンス名
+ * @param integer 次のシーケンス値
+ */
+ function nextVal($seq_name)
+ {
+ $dsn = array('phptype' => DB_TYPE,
+ 'username' => DB_USER,
+ 'password' => DB_PASSWORD,
+ 'protocol' => 'tcp',
+ 'hostspec' => DB_SERVER,
+ 'port' => DB_PORT,
+ 'database' => DB_NAME
+ );
+ // SQL Azure では必ず新しいセッションを使用する
+ $_conn = MDB2::connect($dsn, $options);
+ return $_conn->nextID($seq_name, false);
+ }
+
+ // 2.13.2 向けにコミットの予定
+ /**
+ * 構築した SELECT 文を LIMIT OFFSET も含め取得する.
+ *
+ * @param string SELECT 文に含めるカラム名
+ * @param string SELECT 文に含めるテーブル名
+ * @param string SELECT 文に含める WHERE 句
+ * @return string 構築済みの SELECT 文
+ */
+ function getSqlWithLimit($cols, $from = '', $where = '')
+ {
+ $sql = $this->getSql($cols, $from, $where);
+ $offset = $this->conn->offset;
+ $limit = $this->conn->limit;
+ $this->setLimitOffset(0, 0);
+
+ return $this->dbFactory->addLimitOffset($sql, $limit, $offset);
+ }
}
diff -urNb ec-cube-iis/data/class_extends/SC_SelectSql_Ex.php ec-cube/data/class_extends/SC_SelectSql_Ex.php
--- ec-cube-iis/data/class_extends/SC_SelectSql_Ex.php 2014-08-20 17:46:26.000000000 +0900
+++ ec-cube/data/class_extends/SC_SelectSql_Ex.php 2014-08-20 17:49:20.000000000 +0900
@@ -25,4 +25,43 @@
class SC_SelectSql_Ex extends SC_SelectSql
{
+ //-- 期間検索(○年○月○日か~○年○月○日まで)
+ public function selectTermRange($from_year, $from_month, $from_day, $to_year, $to_month, $to_day, $column)
+ {
+ $return = array();
+
+ // 開始期間の構築
+ $date1 = $from_year . '/' . $from_month . '/' . $from_day;
+
+ // 終了期間の構築
+ // @see http://svn.ec-cube.net/open_trac/ticket/328
+ // FIXME とりあえずintvalで対策...
+ $date2 = mktime (0, 0, 0, intval($to_month), intval($to_day), intval($to_year));
+ $date2 = $date2 + 86400;
+ // SQL文のdate関数に与えるフォーマットは、yyyy/mm/ddで指定する。
+ $date2 = date('Y/m/d', $date2);
+
+ // 開始期間だけ指定の場合
+ if (($from_year != '') && ($from_month != '') && ($from_day != '') && ($to_year == '') && ($to_month == '') && ($to_day == '')) {
+ $this->setWhere($column .' >= ?');
+ $return[] = $date1;
+ }
+
+ // 開始~終了
+ if (($from_year != '') && ($from_month != '') && ($from_day != '')
+ && ($to_year != '') && ($to_month != '') && ($to_day != '')
+ ) {
+ $this->setWhere($column . ' >= ? AND ' . $column . ' < ?');
+ $return[] = $date1;
+ $return[] = $date2;
+ }
+
+ // 終了期間だけ指定の場合
+ if (($from_year == '') && ($from_month == '') && ($from_day == '') && ($to_year != '') && ($to_month != '') && ($to_day != '')) {
+ $this->setWhere($column . ' < ?');
+ $return[] = $date2;
+ }
+
+ return $return;
+ }
}
diff -urNb ec-cube-iis/data/class_extends/db_extends/SC_DB_DBFactory_Ex.php ec-cube/data/class_extends/db_extends/SC_DB_DBFactory_Ex.php
--- ec-cube-iis/data/class_extends/db_extends/SC_DB_DBFactory_Ex.php 2014-08-20 17:46:26.000000000 +0900
+++ ec-cube/data/class_extends/db_extends/SC_DB_DBFactory_Ex.php 2014-08-20 17:49:20.000000000 +0900
@@ -49,6 +49,9 @@
case 'pgsql':
return new SC_DB_DBFactory_PGSQL_Ex();
+ case 'sqlsrv':
+ return new SC_DB_DBFactory_SQLSRV_Ex();
+
default:
return new SC_DB_DBFactory_Ex();
}
diff -urNb ec-cube-iis/data/class_extends/db_extends/dbfactory/SC_DB_DBFactory_SQLSRV_Ex.php ec-cube/data/class_extends/db_extends/dbfactory/SC_DB_DBFactory_SQLSRV_Ex.php
--- ec-cube-iis/data/class_extends/db_extends/dbfactory/SC_DB_DBFactory_SQLSRV_Ex.php 1970-01-01 09:00:00.000000000 +0900
+++ ec-cube/data/class_extends/db_extends/dbfactory/SC_DB_DBFactory_SQLSRV_Ex.php 2014-08-20 17:49:20.000000000 +0900
@@ -0,0 +1,38 @@
+<?php
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2011 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+// {{{ requires
+require_once CLASS_REALDIR . 'db/dbfactory/SC_DB_DBFactory_SQLSRV.php';
+
+/**
+ * PostgreSQL 固有の処理をするクラス(拡張).
+ *
+ * SC_DB_DBFactory_PGSQL をカスタマイズする場合は, このクラスを使用する.
+ *
+ * @package DB
+ * @author LOCKON CO.,LTD.
+ * @version $Id$
+ */
+class SC_DB_DBFactory_SQLSRV_Ex extends SC_DB_DBFactory_SQLSRV {
+}
+?>
diff -urNb ec-cube-iis/data/class_extends/helper_extends/SC_Helper_News_Ex.php ec-cube/data/class_extends/helper_extends/SC_Helper_News_Ex.php