Code Duplication    Length = 6-9 lines in 25 locations

src/Eccube/Repository/OrderRepository.php 13 locations

@@ 195-201 (lines=7) @@
192
        }
193
194
        // oreder_date
195
        if (!empty($searchData['order_date_start']) && $searchData['order_date_start']) {
196
            $date = $searchData['order_date_start']
197
                ->format('Y-m-d H:i:s');
198
            $qb
199
                ->andWhere('o.create_date >= :order_date_start')
200
                ->setParameter('order_date_start', $date);
201
        }
202
        if (!empty($searchData['order_date_end']) && $searchData['order_date_end']) {
203
            $date = clone $searchData['order_date_end'];
204
            $date = $date
@@ 202-210 (lines=9) @@
199
                ->andWhere('o.create_date >= :order_date_start')
200
                ->setParameter('order_date_start', $date);
201
        }
202
        if (!empty($searchData['order_date_end']) && $searchData['order_date_end']) {
203
            $date = clone $searchData['order_date_end'];
204
            $date = $date
205
                ->modify('+1 days')
206
                ->format('Y-m-d H:i:s');
207
            $qb
208
                ->andWhere('o.create_date < :order_date_end')
209
                ->setParameter('order_date_end', $date);
210
        }
211
212
        // create_date
213
        if (!empty($searchData['update_date_start']) && $searchData['update_date_start']) {
@@ 213-219 (lines=7) @@
210
        }
211
212
        // create_date
213
        if (!empty($searchData['update_date_start']) && $searchData['update_date_start']) {
214
            $date = $searchData['update_date_start']
215
                ->format('Y-m-d H:i:s');
216
            $qb
217
                ->andWhere('o.update_date >= :update_date_start')
218
                ->setParameter('update_date_start', $date);
219
        }
220
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
221
            $date = clone $searchData['update_date_end'];
222
            $date = $date
@@ 220-228 (lines=9) @@
217
                ->andWhere('o.update_date >= :update_date_start')
218
                ->setParameter('update_date_start', $date);
219
        }
220
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
221
            $date = clone $searchData['update_date_end'];
222
            $date = $date
223
                ->modify('+1 days')
224
                ->format('Y-m-d H:i:s');
225
            $qb
226
                ->andWhere('o.update_date < :update_date_end')
227
                ->setParameter('update_date_end', $date);
228
        }
229
230
        // payment_total
231
        if (isset($searchData['payment_total_start']) && Str::isNotBlank($searchData['payment_total_start'])) {
@@ 296-301 (lines=6) @@
293
294
        // status
295
        $filterStatus = false;
296
        if (!empty($searchData['status']) && $searchData['status']) {
297
            $qb
298
                ->andWhere('o.OrderStatus = :status')
299
                ->setParameter('status', $searchData['status']);
300
            $filterStatus = true;
301
        }
302
        if (!empty($searchData['multi_status']) && count($searchData['multi_status'])) {
303
            $qb
304
                ->andWhere($qb->expr()->in('o.OrderStatus', ':multi_status'))
@@ 365-371 (lines=7) @@
362
        }
363
364
        // oreder_date
365
        if (!empty($searchData['order_date_start']) && $searchData['order_date_start']) {
366
            $date = $searchData['order_date_start']
367
                ->format('Y-m-d H:i:s');
368
            $qb
369
                ->andWhere('o.order_date >= :order_date_start')
370
                ->setParameter('order_date_start', $date);
371
        }
372
        if (!empty($searchData['order_date_end']) && $searchData['order_date_end']) {
373
            $date = clone $searchData['order_date_end'];
374
            $date = $date
@@ 372-380 (lines=9) @@
369
                ->andWhere('o.order_date >= :order_date_start')
370
                ->setParameter('order_date_start', $date);
371
        }
372
        if (!empty($searchData['order_date_end']) && $searchData['order_date_end']) {
373
            $date = clone $searchData['order_date_end'];
374
            $date = $date
375
                ->modify('+1 days')
376
                ->format('Y-m-d H:i:s');
377
            $qb
378
                ->andWhere('o.order_date < :order_date_end')
379
                ->setParameter('order_date_end', $date);
380
        }
381
382
        // payment_date
383
        if (!empty($searchData['payment_date_start']) && $searchData['payment_date_start']) {
@@ 383-389 (lines=7) @@
380
        }
381
382
        // payment_date
383
        if (!empty($searchData['payment_date_start']) && $searchData['payment_date_start']) {
384
            $date = $searchData['payment_date_start']
385
                ->format('Y-m-d H:i:s');
386
            $qb
387
                ->andWhere('o.payment_date >= :payment_date_start')
388
                ->setParameter('payment_date_start', $date);
389
        }
390
        if (!empty($searchData['payment_date_end']) && $searchData['payment_date_end']) {
391
            $date = clone $searchData['payment_date_end'];
392
            $date = $date
@@ 390-398 (lines=9) @@
387
                ->andWhere('o.payment_date >= :payment_date_start')
388
                ->setParameter('payment_date_start', $date);
389
        }
390
        if (!empty($searchData['payment_date_end']) && $searchData['payment_date_end']) {
391
            $date = clone $searchData['payment_date_end'];
392
            $date = $date
393
                ->modify('+1 days')
394
                ->format('Y-m-d H:i:s');
395
            $qb
396
                ->andWhere('o.payment_date < :payment_date_end')
397
                ->setParameter('payment_date_end', $date);
398
        }
399
400
        // commit_date
401
        if (!empty($searchData['commit_date_start']) && $searchData['commit_date_start']) {
@@ 401-407 (lines=7) @@
398
        }
399
400
        // commit_date
401
        if (!empty($searchData['commit_date_start']) && $searchData['commit_date_start']) {
402
            $date = $searchData['commit_date_start']
403
                ->format('Y-m-d H:i:s');
404
            $qb
405
                ->andWhere('o.commit_date >= :commit_date_start')
406
                ->setParameter('commit_date_start', $date);
407
        }
408
        if (!empty($searchData['commit_date_end']) && $searchData['commit_date_end']) {
409
            $date = clone $searchData['commit_date_end'];
410
            $date = $date
@@ 408-416 (lines=9) @@
405
                ->andWhere('o.commit_date >= :commit_date_start')
406
                ->setParameter('commit_date_start', $date);
407
        }
408
        if (!empty($searchData['commit_date_end']) && $searchData['commit_date_end']) {
409
            $date = clone $searchData['commit_date_end'];
410
            $date = $date
411
                ->modify('+1 days')
412
                ->format('Y-m-d H:i:s');
413
            $qb
414
                ->andWhere('o.commit_date < :commit_date_end')
415
                ->setParameter('commit_date_end', $date);
416
        }
417
418
419
        // update_date
@@ 420-426 (lines=7) @@
417
418
419
        // update_date
420
        if (!empty($searchData['update_date_start']) && $searchData['update_date_start']) {
421
            $date = $searchData['update_date_start']
422
                ->format('Y-m-d H:i:s');
423
            $qb
424
                ->andWhere('o.update_date >= :update_date_start')
425
                ->setParameter('update_date_start', $date);
426
        }
427
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
428
            $date = clone $searchData['update_date_end'];
429
            $date = $date
@@ 427-435 (lines=9) @@
424
                ->andWhere('o.update_date >= :update_date_start')
425
                ->setParameter('update_date_start', $date);
426
        }
427
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
428
            $date = clone $searchData['update_date_end'];
429
            $date = $date
430
                ->modify('+1 days')
431
                ->format('Y-m-d H:i:s');
432
            $qb
433
                ->andWhere('o.update_date < :update_date_end')
434
                ->setParameter('update_date_end', $date);
435
        }
436
437
        // payment_total
438
        if (isset($searchData['payment_total_start']) && Str::isNotBlank($searchData['payment_total_start'])) {

src/Eccube/Repository/CustomerRepository.php 8 locations

@@ 191-197 (lines=7) @@
188
        }
189
190
        // birth
191
        if (!empty($searchData['birth_start']) && $searchData['birth_start']) {
192
            $date = $searchData['birth_start']
193
                ->format('Y-m-d H:i:s');
194
            $qb
195
                ->andWhere('c.birth >= :birth_start')
196
                ->setParameter('birth_start', $date);
197
        }
198
        if (!empty($searchData['birth_end']) && $searchData['birth_end']) {
199
            $date = clone $searchData['birth_end'];
200
            $date = $date
@@ 198-206 (lines=9) @@
195
                ->andWhere('c.birth >= :birth_start')
196
                ->setParameter('birth_start', $date);
197
        }
198
        if (!empty($searchData['birth_end']) && $searchData['birth_end']) {
199
            $date = clone $searchData['birth_end'];
200
            $date = $date
201
                ->modify('+1 days')
202
                ->format('Y-m-d H:i:s');
203
            $qb
204
                ->andWhere('c.birth < :birth_end')
205
                ->setParameter('birth_end', $date);
206
        }
207
208
        // tel
209
        if (isset($searchData['tel']) && Str::isNotBlank($searchData['tel'])) {
@@ 240-246 (lines=7) @@
237
        }
238
239
        // create_date
240
        if (!empty($searchData['create_date_start']) && $searchData['create_date_start']) {
241
            $date = $searchData['create_date_start']
242
                ->format('Y-m-d H:i:s');
243
            $qb
244
                ->andWhere('c.create_date >= :create_date_start')
245
                ->setParameter('create_date_start', $date);
246
        }
247
        if (!empty($searchData['create_date_end']) && $searchData['create_date_end']) {
248
            $date = clone $searchData['create_date_end'];
249
            $date = $date
@@ 247-255 (lines=9) @@
244
                ->andWhere('c.create_date >= :create_date_start')
245
                ->setParameter('create_date_start', $date);
246
        }
247
        if (!empty($searchData['create_date_end']) && $searchData['create_date_end']) {
248
            $date = clone $searchData['create_date_end'];
249
            $date = $date
250
                ->modify('+1 days')
251
                ->format('Y-m-d H:i:s');
252
            $qb
253
                ->andWhere('c.create_date < :create_date_end')
254
                ->setParameter('create_date_end', $date);
255
        }
256
257
        // update_date
258
        if (!empty($searchData['update_date_start']) && $searchData['update_date_start']) {
@@ 258-264 (lines=7) @@
255
        }
256
257
        // update_date
258
        if (!empty($searchData['update_date_start']) && $searchData['update_date_start']) {
259
            $date = $searchData['update_date_start']
260
                ->format('Y-m-d H:i:s');
261
            $qb
262
                ->andWhere('c.update_date >= :update_date_start')
263
                ->setParameter('update_date_start', $date);
264
        }
265
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
266
            $date = clone $searchData['update_date_end'];
267
            $date = $date
@@ 265-273 (lines=9) @@
262
                ->andWhere('c.update_date >= :update_date_start')
263
                ->setParameter('update_date_start', $date);
264
        }
265
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
266
            $date = clone $searchData['update_date_end'];
267
            $date = $date
268
                ->modify('+1 days')
269
                ->format('Y-m-d H:i:s');
270
            $qb
271
                ->andWhere('c.update_date < :update_date_end')
272
                ->setParameter('update_date_end', $date);
273
        }
274
275
        // last_buy
276
        if (!empty($searchData['last_buy_start']) && $searchData['last_buy_start']) {
@@ 276-282 (lines=7) @@
273
        }
274
275
        // last_buy
276
        if (!empty($searchData['last_buy_start']) && $searchData['last_buy_start']) {
277
            $date = $searchData['last_buy_start']
278
                ->format('Y-m-d H:i:s');
279
            $qb
280
                ->andWhere('c.last_buy_date >= :last_buy_start')
281
                ->setParameter('last_buy_start', $date);
282
        }
283
        if (!empty($searchData['last_buy_end']) && $searchData['last_buy_end']) {
284
            $date = clone $searchData['last_buy_end'];
285
            $date = $date
@@ 283-291 (lines=9) @@
280
                ->andWhere('c.last_buy_date >= :last_buy_start')
281
                ->setParameter('last_buy_start', $date);
282
        }
283
        if (!empty($searchData['last_buy_end']) && $searchData['last_buy_end']) {
284
            $date = clone $searchData['last_buy_end'];
285
            $date = $date
286
                ->modify('+1 days')
287
                ->format('Y-m-d H:i:s');
288
            $qb
289
                ->andWhere('c.last_buy_date < :last_buy_end')
290
                ->setParameter('last_buy_end', $date);
291
        }
292
293
        // status
294
        if (!empty($searchData['customer_status']) && count($searchData['customer_status']) > 0) {

src/Eccube/Repository/ProductRepository.php 4 locations

@@ 239-245 (lines=7) @@
236
        }
237
238
        // crate_date
239
        if (!empty($searchData['create_date_start']) && $searchData['create_date_start']) {
240
            $date = $searchData['create_date_start']
241
                ->format('Y-m-d H:i:s');
242
            $qb
243
                ->andWhere('p.create_date >= :create_date_start')
244
                ->setParameter('create_date_start', $date);
245
        }
246
247
        if (!empty($searchData['create_date_end']) && $searchData['create_date_end']) {
248
            $date = clone $searchData['create_date_end'];
@@ 247-255 (lines=9) @@
244
                ->setParameter('create_date_start', $date);
245
        }
246
247
        if (!empty($searchData['create_date_end']) && $searchData['create_date_end']) {
248
            $date = clone $searchData['create_date_end'];
249
            $date = $date
250
                ->modify('+1 days')
251
                ->format('Y-m-d H:i:s');
252
            $qb
253
                ->andWhere('p.create_date < :create_date_end')
254
                ->setParameter('create_date_end', $date);
255
        }
256
257
        // update_date
258
        if (!empty($searchData['update_date_start']) && $searchData['update_date_start']) {
@@ 258-264 (lines=7) @@
255
        }
256
257
        // update_date
258
        if (!empty($searchData['update_date_start']) && $searchData['update_date_start']) {
259
            $date = $searchData['update_date_start']
260
                ->format('Y-m-d H:i:s');
261
            $qb
262
                ->andWhere('p.update_date >= :update_date_start')
263
                ->setParameter('update_date_start', $date);
264
        }
265
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
266
            $date = clone $searchData['update_date_end'];
267
            $date = $date
@@ 265-273 (lines=9) @@
262
                ->andWhere('p.update_date >= :update_date_start')
263
                ->setParameter('update_date_start', $date);
264
        }
265
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
266
            $date = clone $searchData['update_date_end'];
267
            $date = $date
268
                ->modify('+1 days')
269
                ->format('Y-m-d H:i:s');
270
            $qb
271
                ->andWhere('p.update_date < :update_date_end')
272
                ->setParameter('update_date_end', $date);
273
        }
274
275
276
        // Order By