Code Duplication    Length = 5-8 lines in 29 locations

src/Eccube/Repository/CustomerRepository.php 4 locations

@@ 190-196 (lines=7) @@
187
                ->andWhere('c.birth >= :birth_start')
188
                ->setParameter('birth_start', $searchData['birth_start']);
189
        }
190
        if (!empty($searchData['birth_end']) && $searchData['birth_end']) {
191
            $date = clone $searchData['birth_end'];
192
            $date->modify('+1 days');
193
            $qb
194
                ->andWhere('c.birth < :birth_end')
195
                ->setParameter('birth_end', $date);
196
        }
197
198
        // tel
199
        if (isset($searchData['tel']) && Str::isNotBlank($searchData['tel'])) {
@@ 235-241 (lines=7) @@
232
                ->andWhere('c.create_date >= :create_date_start')
233
                ->setParameter('create_date_start', $searchData['create_date_start']);
234
        }
235
        if (!empty($searchData['create_date_end']) && $searchData['create_date_end']) {
236
            $date = clone $searchData['create_date_end'];
237
            $date->modify('+1 days');
238
            $qb
239
                ->andWhere('c.create_date < :create_date_end')
240
                ->setParameter('create_date_end', $date);
241
        }
242
243
        // update_date
244
        if (!empty($searchData['update_date_start']) && $searchData['update_date_start']) {
@@ 249-255 (lines=7) @@
246
                ->andWhere('c.update_date >= :update_date_start')
247
                ->setParameter('update_date_start', $searchData['update_date_start']);
248
        }
249
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
250
            $date = clone $searchData['update_date_end'];
251
            $date->modify('+1 days');
252
            $qb
253
                ->andWhere('c.update_date < :update_date_end')
254
                ->setParameter('update_date_end', $date);
255
        }
256
257
        // last_buy
258
        if (!empty($searchData['last_buy_start']) && $searchData['last_buy_start']) {
@@ 263-269 (lines=7) @@
260
                ->andWhere('c.last_buy_date >= :last_buy_start')
261
                ->setParameter('last_buy_start', $searchData['last_buy_start']);
262
        }
263
        if (!empty($searchData['last_buy_end']) && $searchData['last_buy_end']) {
264
            $date = clone $searchData['last_buy_end'];
265
            $date->modify('+1 days');
266
            $qb
267
                ->andWhere('c.last_buy_date < :last_buy_end')
268
                ->setParameter('last_buy_end', $date);
269
        }
270
271
        // status
272
        if (!empty($searchData['customer_status']) && count($searchData['customer_status']) > 0) {

src/Eccube/Repository/OrderRepository.php 14 locations

@@ 85-89 (lines=5) @@
82
        }
83
84
        // status
85
        if (!empty($searchData['status']) && $searchData['status']) {
86
            $qb
87
                ->andWhere('o.OrderStatus = :status')
88
                ->setParameter('status', $searchData['status']);
89
        }
90
91
        // name
92
        if (isset($searchData['name']) && Str::isNotBlank($searchData['name'])) {
@@ 185-190 (lines=6) @@
182
        }
183
184
        // oreder_date
185
        if (!empty($searchData['order_date_start']) && $searchData['order_date_start']) {
186
            $date = $searchData['order_date_start'];
187
            $qb
188
                ->andWhere('o.create_date >= :order_date_start')
189
                ->setParameter('order_date_start', $date);
190
        }
191
        if (!empty($searchData['order_date_end']) && $searchData['order_date_end']) {
192
            $date = clone $searchData['order_date_end'];
193
            $date = $date
@@ 277-282 (lines=6) @@
274
275
        // status
276
        $filterStatus = false;
277
        if (!empty($searchData['status']) && $searchData['status']) {
278
            $qb
279
                ->andWhere('o.OrderStatus = :status')
280
                ->setParameter('status', $searchData['status']);
281
            $filterStatus = true;
282
        }
283
        if (!empty($searchData['multi_status']) && count($searchData['multi_status'])) {
284
            $qb
285
                ->andWhere($qb->expr()->in('o.OrderStatus', ':multi_status'))
@@ 191-198 (lines=8) @@
188
                ->andWhere('o.create_date >= :order_date_start')
189
                ->setParameter('order_date_start', $date);
190
        }
191
        if (!empty($searchData['order_date_end']) && $searchData['order_date_end']) {
192
            $date = clone $searchData['order_date_end'];
193
            $date = $date
194
                ->modify('+1 days');
195
            $qb
196
                ->andWhere('o.create_date < :order_date_end')
197
                ->setParameter('order_date_end', $date);
198
        }
199
200
        // create_date
201
        if (!empty($searchData['update_date_start']) && $searchData['update_date_start']) {
@@ 201-206 (lines=6) @@
198
        }
199
200
        // create_date
201
        if (!empty($searchData['update_date_start']) && $searchData['update_date_start']) {
202
            $date = $searchData['update_date_start'];
203
            $qb
204
                ->andWhere('o.update_date >= :update_date_start')
205
                ->setParameter('update_date_start', $date);
206
        }
207
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
208
            $date = clone $searchData['update_date_end'];
209
            $date = $date
@@ 207-214 (lines=8) @@
204
                ->andWhere('o.update_date >= :update_date_start')
205
                ->setParameter('update_date_start', $date);
206
        }
207
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
208
            $date = clone $searchData['update_date_end'];
209
            $date = $date
210
                ->modify('+1 days');
211
            $qb
212
                ->andWhere('o.update_date < :update_date_end')
213
                ->setParameter('update_date_end', $date);
214
        }
215
216
        // payment_total
217
        if (isset($searchData['payment_total_start']) && Str::isNotBlank($searchData['payment_total_start'])) {
@@ 346-351 (lines=6) @@
343
        }
344
345
        // oreder_date
346
        if (!empty($searchData['order_date_start']) && $searchData['order_date_start']) {
347
            $date = $searchData['order_date_start'];
348
            $qb
349
                ->andWhere('o.order_date >= :order_date_start')
350
                ->setParameter('order_date_start', $date);
351
        }
352
        if (!empty($searchData['order_date_end']) && $searchData['order_date_end']) {
353
            $date = clone $searchData['order_date_end'];
354
            $date = $date
@@ 352-359 (lines=8) @@
349
                ->andWhere('o.order_date >= :order_date_start')
350
                ->setParameter('order_date_start', $date);
351
        }
352
        if (!empty($searchData['order_date_end']) && $searchData['order_date_end']) {
353
            $date = clone $searchData['order_date_end'];
354
            $date = $date
355
                ->modify('+1 days');
356
            $qb
357
                ->andWhere('o.order_date < :order_date_end')
358
                ->setParameter('order_date_end', $date);
359
        }
360
361
        // payment_date
362
        if (!empty($searchData['payment_date_start']) && $searchData['payment_date_start']) {
@@ 362-367 (lines=6) @@
359
        }
360
361
        // payment_date
362
        if (!empty($searchData['payment_date_start']) && $searchData['payment_date_start']) {
363
            $date = $searchData['payment_date_start'];
364
            $qb
365
                ->andWhere('o.payment_date >= :payment_date_start')
366
                ->setParameter('payment_date_start', $date);
367
        }
368
        if (!empty($searchData['payment_date_end']) && $searchData['payment_date_end']) {
369
            $date = clone $searchData['payment_date_end'];
370
            $date = $date
@@ 368-375 (lines=8) @@
365
                ->andWhere('o.payment_date >= :payment_date_start')
366
                ->setParameter('payment_date_start', $date);
367
        }
368
        if (!empty($searchData['payment_date_end']) && $searchData['payment_date_end']) {
369
            $date = clone $searchData['payment_date_end'];
370
            $date = $date
371
                ->modify('+1 days');
372
            $qb
373
                ->andWhere('o.payment_date < :payment_date_end')
374
                ->setParameter('payment_date_end', $date);
375
        }
376
377
        // commit_date
378
        if (!empty($searchData['commit_date_start']) && $searchData['commit_date_start']) {
@@ 378-383 (lines=6) @@
375
        }
376
377
        // commit_date
378
        if (!empty($searchData['commit_date_start']) && $searchData['commit_date_start']) {
379
            $date = $searchData['commit_date_start'];
380
            $qb
381
                ->andWhere('o.commit_date >= :commit_date_start')
382
                ->setParameter('commit_date_start', $date);
383
        }
384
        if (!empty($searchData['commit_date_end']) && $searchData['commit_date_end']) {
385
            $date = clone $searchData['commit_date_end'];
386
            $date = $date
@@ 384-391 (lines=8) @@
381
                ->andWhere('o.commit_date >= :commit_date_start')
382
                ->setParameter('commit_date_start', $date);
383
        }
384
        if (!empty($searchData['commit_date_end']) && $searchData['commit_date_end']) {
385
            $date = clone $searchData['commit_date_end'];
386
            $date = $date
387
                ->modify('+1 days');
388
            $qb
389
                ->andWhere('o.commit_date < :commit_date_end')
390
                ->setParameter('commit_date_end', $date);
391
        }
392
393
394
        // update_date
@@ 395-400 (lines=6) @@
392
393
394
        // update_date
395
        if (!empty($searchData['update_date_start']) && $searchData['update_date_start']) {
396
            $date = $searchData['update_date_start'];
397
            $qb
398
                ->andWhere('o.update_date >= :update_date_start')
399
                ->setParameter('update_date_start', $date);
400
        }
401
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
402
            $date = clone $searchData['update_date_end'];
403
            $date = $date
@@ 401-408 (lines=8) @@
398
                ->andWhere('o.update_date >= :update_date_start')
399
                ->setParameter('update_date_start', $date);
400
        }
401
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
402
            $date = clone $searchData['update_date_end'];
403
            $date = $date
404
                ->modify('+1 days');
405
            $qb
406
                ->andWhere('o.update_date < :update_date_end')
407
                ->setParameter('update_date_end', $date);
408
        }
409
410
        // payment_total
411
        if (isset($searchData['payment_total_start']) && Str::isNotBlank($searchData['payment_total_start'])) {

src/Eccube/Repository/ProductRepository.php 2 locations

@@ 238-243 (lines=6) @@
235
        }
236
237
        // update_date
238
        if (!empty($searchData['update_date_start']) && $searchData['update_date_start']) {
239
            $date = $searchData['update_date_start'];
240
            $qb
241
                ->andWhere('p.update_date >= :update_date_start')
242
                ->setParameter('update_date_start', $date);
243
        }
244
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
245
            $date = clone $searchData['update_date_end'];
246
            $date = $date
@@ 244-251 (lines=8) @@
241
                ->andWhere('p.update_date >= :update_date_start')
242
                ->setParameter('update_date_start', $date);
243
        }
244
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
245
            $date = clone $searchData['update_date_end'];
246
            $date = $date
247
                ->modify('+1 days');
248
            $qb
249
                ->andWhere('p.update_date < :update_date_end')
250
                ->setParameter('update_date_end', $date);
251
        }
252
253
254
        // Order By

src/Eccube/Repository/ShippingRepository.php 9 locations

@@ 79-83 (lines=5) @@
76
        }
77
78
        // status
79
        if (!empty($searchData['status']) && $searchData['status']) {
80
            $qb
81
                ->andWhere('o.OrderStatus = :status')
82
                ->setParameter('status', $searchData['status']);
83
        }
84
        if (!empty($searchData['multi_status']) && count($searchData['multi_status'])) {
85
            $qb
86
                ->andWhere($qb->expr()->in('o.OrderStatus', ':multi_status'))
@@ 145-150 (lines=6) @@
142
        }
143
144
        // oreder_date
145
        if (!empty($searchData['order_date_start']) && $searchData['order_date_start']) {
146
            $date = $searchData['order_date_start'];
147
            $qb
148
                ->andWhere('o.order_date >= :order_date_start')
149
                ->setParameter('order_date_start', $date);
150
        }
151
        if (!empty($searchData['order_date_end']) && $searchData['order_date_end']) {
152
            $date = clone $searchData['order_date_end'];
153
            $date = $date
@@ 151-158 (lines=8) @@
148
                ->andWhere('o.order_date >= :order_date_start')
149
                ->setParameter('order_date_start', $date);
150
        }
151
        if (!empty($searchData['order_date_end']) && $searchData['order_date_end']) {
152
            $date = clone $searchData['order_date_end'];
153
            $date = $date
154
                ->modify('+1 days');
155
            $qb
156
                ->andWhere('o.order_date < :order_date_end')
157
                ->setParameter('order_date_end', $date);
158
        }
159
160
        // shipping_delivery_date
161
        if (!empty($searchData['shipping_delivery_date_start']) && $searchData['shipping_delivery_date_start']) {
@@ 161-166 (lines=6) @@
158
        }
159
160
        // shipping_delivery_date
161
        if (!empty($searchData['shipping_delivery_date_start']) && $searchData['shipping_delivery_date_start']) {
162
            $date = $searchData['shipping_delivery_date_start'];
163
            $qb
164
                ->andWhere('s.shipping_delivery_date >= :shipping_delivery_date_start')
165
                ->setParameter('shipping_delivery_date_start', $date);
166
        }
167
        if (!empty($searchData['shipping_delivery_date_end']) && $searchData['shipping_delivery_date_end']) {
168
            $date = clone $searchData['shipping_delivery_date_end'];
169
            $date = $date
@@ 167-174 (lines=8) @@
164
                ->andWhere('s.shipping_delivery_date >= :shipping_delivery_date_start')
165
                ->setParameter('shipping_delivery_date_start', $date);
166
        }
167
        if (!empty($searchData['shipping_delivery_date_end']) && $searchData['shipping_delivery_date_end']) {
168
            $date = clone $searchData['shipping_delivery_date_end'];
169
            $date = $date
170
                ->modify('+1 days');
171
            $qb
172
                ->andWhere('s.shipping_delivery_date < :shipping_delivery_date_end')
173
                ->setParameter('shipping_delivery_date_end', $date);
174
        }
175
176
        // commit_date
177
        if (!empty($searchData['commit_date_start']) && $searchData['commit_date_start']) {
@@ 177-182 (lines=6) @@
174
        }
175
176
        // commit_date
177
        if (!empty($searchData['commit_date_start']) && $searchData['commit_date_start']) {
178
            $date = $searchData['commit_date_start'];
179
            $qb
180
                ->andWhere('s.commit_date >= :commit_date_start')
181
                ->setParameter('commit_date_start', $date);
182
        }
183
        if (!empty($searchData['commit_date_end']) && $searchData['commit_date_end']) {
184
            $date = clone $searchData['commit_date_end'];
185
            $date = $date
@@ 183-190 (lines=8) @@
180
                ->andWhere('s.commit_date >= :commit_date_start')
181
                ->setParameter('commit_date_start', $date);
182
        }
183
        if (!empty($searchData['commit_date_end']) && $searchData['commit_date_end']) {
184
            $date = clone $searchData['commit_date_end'];
185
            $date = $date
186
                ->modify('+1 days');
187
            $qb
188
                ->andWhere('s.commit_date < :commit_date_end')
189
                ->setParameter('commit_date_end', $date);
190
        }
191
192
193
        // update_date
@@ 194-199 (lines=6) @@
191
192
193
        // update_date
194
        if (!empty($searchData['update_date_start']) && $searchData['update_date_start']) {
195
            $date = $searchData['update_date_start'];
196
            $qb
197
                ->andWhere('s.update_date >= :update_date_start')
198
                ->setParameter('update_date_start', $date);
199
        }
200
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
201
            $date = clone $searchData['update_date_end'];
202
            $date = $date
@@ 200-207 (lines=8) @@
197
                ->andWhere('s.update_date >= :update_date_start')
198
                ->setParameter('update_date_start', $date);
199
        }
200
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
201
            $date = clone $searchData['update_date_end'];
202
            $date = $date
203
                ->modify('+1 days');
204
            $qb
205
                ->andWhere('s.update_date < :update_date_end')
206
                ->setParameter('update_date_end', $date);
207
        }
208
209
        // payment_total
210
        if (isset($searchData['payment_total_start']) && Str::isNotBlank($searchData['payment_total_start'])) {