Code Duplication    Length = 7-9 lines in 24 locations

src/Eccube/Repository/CustomerRepository.php 8 locations

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

src/Eccube/Repository/OrderRepository.php 12 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'])) {
@@ 348-354 (lines=7) @@
345
        }
346
347
        // oreder_date
348
        if (!empty($searchData['order_date_start']) && $searchData['order_date_start']) {
349
            $date = $searchData['order_date_start']
350
                ->format('Y-m-d H:i:s');
351
            $qb
352
                ->andWhere('o.order_date >= :order_date_start')
353
                ->setParameter('order_date_start', $date);
354
        }
355
        if (!empty($searchData['order_date_end']) && $searchData['order_date_end']) {
356
            $date = clone $searchData['order_date_end'];
357
            $date = $date
@@ 355-363 (lines=9) @@
352
                ->andWhere('o.order_date >= :order_date_start')
353
                ->setParameter('order_date_start', $date);
354
        }
355
        if (!empty($searchData['order_date_end']) && $searchData['order_date_end']) {
356
            $date = clone $searchData['order_date_end'];
357
            $date = $date
358
                ->modify('+1 days')
359
                ->format('Y-m-d H:i:s');
360
            $qb
361
                ->andWhere('o.order_date < :order_date_end')
362
                ->setParameter('order_date_end', $date);
363
        }
364
365
        // payment_date
366
        if (!empty($searchData['payment_date_start']) && $searchData['payment_date_start']) {
@@ 366-372 (lines=7) @@
363
        }
364
365
        // payment_date
366
        if (!empty($searchData['payment_date_start']) && $searchData['payment_date_start']) {
367
            $date = $searchData['payment_date_start']
368
                ->format('Y-m-d H:i:s');
369
            $qb
370
                ->andWhere('o.payment_date >= :payment_date_start')
371
                ->setParameter('payment_date_start', $date);
372
        }
373
        if (!empty($searchData['payment_date_end']) && $searchData['payment_date_end']) {
374
            $date = clone $searchData['payment_date_end'];
375
            $date = $date
@@ 373-381 (lines=9) @@
370
                ->andWhere('o.payment_date >= :payment_date_start')
371
                ->setParameter('payment_date_start', $date);
372
        }
373
        if (!empty($searchData['payment_date_end']) && $searchData['payment_date_end']) {
374
            $date = clone $searchData['payment_date_end'];
375
            $date = $date
376
                ->modify('+1 days')
377
                ->format('Y-m-d H:i:s');
378
            $qb
379
                ->andWhere('o.payment_date < :payment_date_end')
380
                ->setParameter('payment_date_end', $date);
381
        }
382
383
        // commit_date
384
        if (!empty($searchData['commit_date_start']) && $searchData['commit_date_start']) {
@@ 384-390 (lines=7) @@
381
        }
382
383
        // commit_date
384
        if (!empty($searchData['commit_date_start']) && $searchData['commit_date_start']) {
385
            $date = $searchData['commit_date_start']
386
                ->format('Y-m-d H:i:s');
387
            $qb
388
                ->andWhere('o.commit_date >= :commit_date_start')
389
                ->setParameter('commit_date_start', $date);
390
        }
391
        if (!empty($searchData['commit_date_end']) && $searchData['commit_date_end']) {
392
            $date = clone $searchData['commit_date_end'];
393
            $date = $date
@@ 391-399 (lines=9) @@
388
                ->andWhere('o.commit_date >= :commit_date_start')
389
                ->setParameter('commit_date_start', $date);
390
        }
391
        if (!empty($searchData['commit_date_end']) && $searchData['commit_date_end']) {
392
            $date = clone $searchData['commit_date_end'];
393
            $date = $date
394
                ->modify('+1 days')
395
                ->format('Y-m-d H:i:s');
396
            $qb
397
                ->andWhere('o.commit_date < :commit_date_end')
398
                ->setParameter('commit_date_end', $date);
399
        }
400
401
402
        // update_date
@@ 403-409 (lines=7) @@
400
401
402
        // update_date
403
        if (!empty($searchData['update_date_start']) && $searchData['update_date_start']) {
404
            $date = $searchData['update_date_start']
405
                ->format('Y-m-d H:i:s');
406
            $qb
407
                ->andWhere('o.update_date >= :update_date_start')
408
                ->setParameter('update_date_start', $date);
409
        }
410
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
411
            $date = clone $searchData['update_date_end'];
412
            $date = $date
@@ 410-418 (lines=9) @@
407
                ->andWhere('o.update_date >= :update_date_start')
408
                ->setParameter('update_date_start', $date);
409
        }
410
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
411
            $date = clone $searchData['update_date_end'];
412
            $date = $date
413
                ->modify('+1 days')
414
                ->format('Y-m-d H:i:s');
415
            $qb
416
                ->andWhere('o.update_date < :update_date_end')
417
                ->setParameter('update_date_end', $date);
418
        }
419
420
        // payment_total
421
        if (isset($searchData['payment_total_start']) && Str::isNotBlank($searchData['payment_total_start'])) {

src/Eccube/Repository/ProductRepository.php 4 locations

@@ 204-210 (lines=7) @@
201
        }
202
203
        // crate_date
204
        if (!empty($searchData['create_date_start']) && $searchData['create_date_start']) {
205
            $date = $searchData['create_date_start']
206
                ->format('Y-m-d H:i:s');
207
            $qb
208
                ->andWhere('p.create_date >= :create_date_start')
209
                ->setParameter('create_date_start', $date);
210
        }
211
212
        if (!empty($searchData['create_date_end']) && $searchData['create_date_end']) {
213
            $date = clone $searchData['create_date_end'];
@@ 212-220 (lines=9) @@
209
                ->setParameter('create_date_start', $date);
210
        }
211
212
        if (!empty($searchData['create_date_end']) && $searchData['create_date_end']) {
213
            $date = clone $searchData['create_date_end'];
214
            $date = $date
215
                ->modify('+1 days')
216
                ->format('Y-m-d H:i:s');
217
            $qb
218
                ->andWhere('p.create_date < :create_date_end')
219
                ->setParameter('create_date_end', $date);
220
        }
221
222
        // update_date
223
        if (!empty($searchData['update_date_start']) && $searchData['update_date_start']) {
@@ 223-229 (lines=7) @@
220
        }
221
222
        // update_date
223
        if (!empty($searchData['update_date_start']) && $searchData['update_date_start']) {
224
            $date = $searchData['update_date_start']
225
                ->format('Y-m-d H:i:s');
226
            $qb
227
                ->andWhere('p.update_date >= :update_date_start')
228
                ->setParameter('update_date_start', $date);
229
        }
230
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
231
            $date = clone $searchData['update_date_end'];
232
            $date = $date
@@ 230-238 (lines=9) @@
227
                ->andWhere('p.update_date >= :update_date_start')
228
                ->setParameter('update_date_start', $date);
229
        }
230
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
231
            $date = clone $searchData['update_date_end'];
232
            $date = $date
233
                ->modify('+1 days')
234
                ->format('Y-m-d H:i:s');
235
            $qb
236
                ->andWhere('p.update_date < :update_date_end')
237
                ->setParameter('update_date_end', $date);
238
        }
239
240
241
        // Order By