Code Duplication    Length = 5-8 lines in 28 locations

src/Eccube/Repository/OrderRepository.php 14 locations

@@ 102-106 (lines=5) @@
99
        }
100
101
        // status
102
        if (!empty($searchData['status']) && $searchData['status']) {
103
            $qb
104
                ->andWhere('o.OrderStatus = :status')
105
                ->setParameter('status', $searchData['status']);
106
        }
107
108
        // name
109
        if (isset($searchData['name']) && Str::isNotBlank($searchData['name'])) {
@@ 202-207 (lines=6) @@
199
        }
200
201
        // oreder_date
202
        if (!empty($searchData['order_date_start']) && $searchData['order_date_start']) {
203
            $date = $searchData['order_date_start'];
204
            $qb
205
                ->andWhere('o.create_date >= :order_date_start')
206
                ->setParameter('order_date_start', $date);
207
        }
208
        if (!empty($searchData['order_date_end']) && $searchData['order_date_end']) {
209
            $date = clone $searchData['order_date_end'];
210
            $date = $date
@@ 208-215 (lines=8) @@
205
                ->andWhere('o.create_date >= :order_date_start')
206
                ->setParameter('order_date_start', $date);
207
        }
208
        if (!empty($searchData['order_date_end']) && $searchData['order_date_end']) {
209
            $date = clone $searchData['order_date_end'];
210
            $date = $date
211
                ->modify('+1 days');
212
            $qb
213
                ->andWhere('o.create_date < :order_date_end')
214
                ->setParameter('order_date_end', $date);
215
        }
216
217
        // create_date
218
        if (!empty($searchData['update_date_start']) && $searchData['update_date_start']) {
@@ 218-223 (lines=6) @@
215
        }
216
217
        // create_date
218
        if (!empty($searchData['update_date_start']) && $searchData['update_date_start']) {
219
            $date = $searchData['update_date_start'];
220
            $qb
221
                ->andWhere('o.update_date >= :update_date_start')
222
                ->setParameter('update_date_start', $date);
223
        }
224
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
225
            $date = clone $searchData['update_date_end'];
226
            $date = $date
@@ 224-231 (lines=8) @@
221
                ->andWhere('o.update_date >= :update_date_start')
222
                ->setParameter('update_date_start', $date);
223
        }
224
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
225
            $date = clone $searchData['update_date_end'];
226
            $date = $date
227
                ->modify('+1 days');
228
            $qb
229
                ->andWhere('o.update_date < :update_date_end')
230
                ->setParameter('update_date_end', $date);
231
        }
232
233
        // payment_total
234
        if (isset($searchData['payment_total_start']) && Str::isNotBlank($searchData['payment_total_start'])) {
@@ 294-299 (lines=6) @@
291
292
        // status
293
        $filterStatus = false;
294
        if (!empty($searchData['status']) && $searchData['status']) {
295
            $qb
296
                ->andWhere('o.OrderStatus = :status')
297
                ->setParameter('status', $searchData['status']);
298
            $filterStatus = true;
299
        }
300
        if (!empty($searchData['multi_status']) && count($searchData['multi_status'])) {
301
            $qb
302
                ->andWhere($qb->expr()->in('o.OrderStatus', ':multi_status'))
@@ 363-368 (lines=6) @@
360
        }
361
362
        // oreder_date
363
        if (!empty($searchData['order_date_start']) && $searchData['order_date_start']) {
364
            $date = $searchData['order_date_start'];
365
            $qb
366
                ->andWhere('o.order_date >= :order_date_start')
367
                ->setParameter('order_date_start', $date);
368
        }
369
        if (!empty($searchData['order_date_end']) && $searchData['order_date_end']) {
370
            $date = clone $searchData['order_date_end'];
371
            $date = $date
@@ 369-376 (lines=8) @@
366
                ->andWhere('o.order_date >= :order_date_start')
367
                ->setParameter('order_date_start', $date);
368
        }
369
        if (!empty($searchData['order_date_end']) && $searchData['order_date_end']) {
370
            $date = clone $searchData['order_date_end'];
371
            $date = $date
372
                ->modify('+1 days');
373
            $qb
374
                ->andWhere('o.order_date < :order_date_end')
375
                ->setParameter('order_date_end', $date);
376
        }
377
378
        // payment_date
379
        if (!empty($searchData['payment_date_start']) && $searchData['payment_date_start']) {
@@ 379-384 (lines=6) @@
376
        }
377
378
        // payment_date
379
        if (!empty($searchData['payment_date_start']) && $searchData['payment_date_start']) {
380
            $date = $searchData['payment_date_start'];
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-392 (lines=8) @@
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
            $qb
390
                ->andWhere('o.payment_date < :payment_date_end')
391
                ->setParameter('payment_date_end', $date);
392
        }
393
394
        // commit_date
395
        if (!empty($searchData['commit_date_start']) && $searchData['commit_date_start']) {
@@ 395-400 (lines=6) @@
392
        }
393
394
        // commit_date
395
        if (!empty($searchData['commit_date_start']) && $searchData['commit_date_start']) {
396
            $date = $searchData['commit_date_start'];
397
            $qb
398
                ->andWhere('o.commit_date >= :commit_date_start')
399
                ->setParameter('commit_date_start', $date);
400
        }
401
        if (!empty($searchData['commit_date_end']) && $searchData['commit_date_end']) {
402
            $date = clone $searchData['commit_date_end'];
403
            $date = $date
@@ 401-408 (lines=8) @@
398
                ->andWhere('o.commit_date >= :commit_date_start')
399
                ->setParameter('commit_date_start', $date);
400
        }
401
        if (!empty($searchData['commit_date_end']) && $searchData['commit_date_end']) {
402
            $date = clone $searchData['commit_date_end'];
403
            $date = $date
404
                ->modify('+1 days');
405
            $qb
406
                ->andWhere('o.commit_date < :commit_date_end')
407
                ->setParameter('commit_date_end', $date);
408
        }
409
410
411
        // update_date
@@ 412-417 (lines=6) @@
409
410
411
        // update_date
412
        if (!empty($searchData['update_date_start']) && $searchData['update_date_start']) {
413
            $date = $searchData['update_date_start'];
414
            $qb
415
                ->andWhere('o.update_date >= :update_date_start')
416
                ->setParameter('update_date_start', $date);
417
        }
418
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
419
            $date = clone $searchData['update_date_end'];
420
            $date = $date
@@ 418-425 (lines=8) @@
415
                ->andWhere('o.update_date >= :update_date_start')
416
                ->setParameter('update_date_start', $date);
417
        }
418
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
419
            $date = clone $searchData['update_date_end'];
420
            $date = $date
421
                ->modify('+1 days');
422
            $qb
423
                ->andWhere('o.update_date < :update_date_end')
424
                ->setParameter('update_date_end', $date);
425
        }
426
427
        // payment_total
428
        if (isset($searchData['payment_total_start']) && Str::isNotBlank($searchData['payment_total_start'])) {

src/Eccube/Repository/ProductRepository.php 2 locations

@@ 262-267 (lines=6) @@
259
        }
260
261
        // update_date
262
        if (!empty($searchData['update_date_start']) && $searchData['update_date_start']) {
263
            $date = $searchData['update_date_start'];
264
            $qb
265
                ->andWhere('p.update_date >= :update_date_start')
266
                ->setParameter('update_date_start', $date);
267
        }
268
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
269
            $date = clone $searchData['update_date_end'];
270
            $date = $date
@@ 268-275 (lines=8) @@
265
                ->andWhere('p.update_date >= :update_date_start')
266
                ->setParameter('update_date_start', $date);
267
        }
268
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
269
            $date = clone $searchData['update_date_end'];
270
            $date = $date
271
                ->modify('+1 days');
272
            $qb
273
                ->andWhere('p.update_date < :update_date_end')
274
                ->setParameter('update_date_end', $date);
275
        }
276
277
278
        // Order By

src/Eccube/Repository/CustomerRepository.php 4 locations

@@ 212-218 (lines=7) @@
209
                ->andWhere('c.birth >= :birth_start')
210
                ->setParameter('birth_start', $searchData['birth_start']);
211
        }
212
        if (!empty($searchData['birth_end']) && $searchData['birth_end']) {
213
            $date = clone $searchData['birth_end'];
214
            $date->modify('+1 days');
215
            $qb
216
                ->andWhere('c.birth < :birth_end')
217
                ->setParameter('birth_end', $date);
218
        }
219
220
        // tel
221
        if (isset($searchData['tel']) && Str::isNotBlank($searchData['tel'])) {
@@ 257-263 (lines=7) @@
254
                ->andWhere('c.create_date >= :create_date_start')
255
                ->setParameter('create_date_start', $searchData['create_date_start']);
256
        }
257
        if (!empty($searchData['create_date_end']) && $searchData['create_date_end']) {
258
            $date = clone $searchData['create_date_end'];
259
            $date->modify('+1 days');
260
            $qb
261
                ->andWhere('c.create_date < :create_date_end')
262
                ->setParameter('create_date_end', $date);
263
        }
264
265
        // update_date
266
        if (!empty($searchData['update_date_start']) && $searchData['update_date_start']) {
@@ 271-277 (lines=7) @@
268
                ->andWhere('c.update_date >= :update_date_start')
269
                ->setParameter('update_date_start', $searchData['update_date_start']);
270
        }
271
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
272
            $date = clone $searchData['update_date_end'];
273
            $date->modify('+1 days');
274
            $qb
275
                ->andWhere('c.update_date < :update_date_end')
276
                ->setParameter('update_date_end', $date);
277
        }
278
279
        // last_buy
280
        if (!empty($searchData['last_buy_start']) && $searchData['last_buy_start']) {
@@ 285-291 (lines=7) @@
282
                ->andWhere('c.last_buy_date >= :last_buy_start')
283
                ->setParameter('last_buy_start', $searchData['last_buy_start']);
284
        }
285
        if (!empty($searchData['last_buy_end']) && $searchData['last_buy_end']) {
286
            $date = clone $searchData['last_buy_end'];
287
            $date->modify('+1 days');
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/ShippingRepository.php 8 locations

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