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'])) {
@@ 291-296 (lines=6) @@
288
289
        // status
290
        $filterStatus = false;
291
        if (!empty($searchData['status']) && $searchData['status']) {
292
            $qb
293
                ->andWhere('o.OrderStatus = :status')
294
                ->setParameter('status', $searchData['status']);
295
            $filterStatus = true;
296
        }
297
        if (!empty($searchData['multi_status']) && count($searchData['multi_status'])) {
298
            $qb
299
                ->andWhere($qb->expr()->in('o.OrderStatus', ':multi_status'))
@@ 360-366 (lines=7) @@
357
        }
358
359
        // oreder_date
360
        if (!empty($searchData['order_date_start']) && $searchData['order_date_start']) {
361
            $date = $searchData['order_date_start']
362
                ->format('Y-m-d H:i:s');
363
            $qb
364
                ->andWhere('o.order_date >= :order_date_start')
365
                ->setParameter('order_date_start', $date);
366
        }
367
        if (!empty($searchData['order_date_end']) && $searchData['order_date_end']) {
368
            $date = clone $searchData['order_date_end'];
369
            $date = $date
@@ 367-375 (lines=9) @@
364
                ->andWhere('o.order_date >= :order_date_start')
365
                ->setParameter('order_date_start', $date);
366
        }
367
        if (!empty($searchData['order_date_end']) && $searchData['order_date_end']) {
368
            $date = clone $searchData['order_date_end'];
369
            $date = $date
370
                ->modify('+1 days')
371
                ->format('Y-m-d H:i:s');
372
            $qb
373
                ->andWhere('o.order_date < :order_date_end')
374
                ->setParameter('order_date_end', $date);
375
        }
376
377
        // payment_date
378
        if (!empty($searchData['payment_date_start']) && $searchData['payment_date_start']) {
@@ 378-384 (lines=7) @@
375
        }
376
377
        // payment_date
378
        if (!empty($searchData['payment_date_start']) && $searchData['payment_date_start']) {
379
            $date = $searchData['payment_date_start']
380
                ->format('Y-m-d H:i:s');
381
            $qb
382
                ->andWhere('o.payment_date >= :payment_date_start')
383
                ->setParameter('payment_date_start', $date);
384
        }
385
        if (!empty($searchData['payment_date_end']) && $searchData['payment_date_end']) {
386
            $date = clone $searchData['payment_date_end'];
387
            $date = $date
@@ 385-393 (lines=9) @@
382
                ->andWhere('o.payment_date >= :payment_date_start')
383
                ->setParameter('payment_date_start', $date);
384
        }
385
        if (!empty($searchData['payment_date_end']) && $searchData['payment_date_end']) {
386
            $date = clone $searchData['payment_date_end'];
387
            $date = $date
388
                ->modify('+1 days')
389
                ->format('Y-m-d H:i:s');
390
            $qb
391
                ->andWhere('o.payment_date < :payment_date_end')
392
                ->setParameter('payment_date_end', $date);
393
        }
394
395
        // commit_date
396
        if (!empty($searchData['commit_date_start']) && $searchData['commit_date_start']) {
@@ 396-402 (lines=7) @@
393
        }
394
395
        // commit_date
396
        if (!empty($searchData['commit_date_start']) && $searchData['commit_date_start']) {
397
            $date = $searchData['commit_date_start']
398
                ->format('Y-m-d H:i:s');
399
            $qb
400
                ->andWhere('o.commit_date >= :commit_date_start')
401
                ->setParameter('commit_date_start', $date);
402
        }
403
        if (!empty($searchData['commit_date_end']) && $searchData['commit_date_end']) {
404
            $date = clone $searchData['commit_date_end'];
405
            $date = $date
@@ 403-411 (lines=9) @@
400
                ->andWhere('o.commit_date >= :commit_date_start')
401
                ->setParameter('commit_date_start', $date);
402
        }
403
        if (!empty($searchData['commit_date_end']) && $searchData['commit_date_end']) {
404
            $date = clone $searchData['commit_date_end'];
405
            $date = $date
406
                ->modify('+1 days')
407
                ->format('Y-m-d H:i:s');
408
            $qb
409
                ->andWhere('o.commit_date < :commit_date_end')
410
                ->setParameter('commit_date_end', $date);
411
        }
412
413
414
        // update_date
@@ 415-421 (lines=7) @@
412
413
414
        // update_date
415
        if (!empty($searchData['update_date_start']) && $searchData['update_date_start']) {
416
            $date = $searchData['update_date_start']
417
                ->format('Y-m-d H:i:s');
418
            $qb
419
                ->andWhere('o.update_date >= :update_date_start')
420
                ->setParameter('update_date_start', $date);
421
        }
422
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
423
            $date = clone $searchData['update_date_end'];
424
            $date = $date
@@ 422-430 (lines=9) @@
419
                ->andWhere('o.update_date >= :update_date_start')
420
                ->setParameter('update_date_start', $date);
421
        }
422
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
423
            $date = clone $searchData['update_date_end'];
424
            $date = $date
425
                ->modify('+1 days')
426
                ->format('Y-m-d H:i:s');
427
            $qb
428
                ->andWhere('o.update_date < :update_date_end')
429
                ->setParameter('update_date_end', $date);
430
        }
431
432
        // payment_total
433
        if (isset($searchData['payment_total_start']) && Str::isNotBlank($searchData['payment_total_start'])) {

src/Eccube/Repository/ProductRepository.php 4 locations

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

src/Eccube/Repository/CustomerRepository.php 8 locations

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