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/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'])) {

src/Eccube/Repository/CustomerRepository.php 4 locations

@@ 203-209 (lines=7) @@
200
                ->andWhere('c.birth >= :birth_start')
201
                ->setParameter('birth_start', $searchData['birth_start']);
202
        }
203
        if (!empty($searchData['birth_end']) && $searchData['birth_end']) {
204
            $date = clone $searchData['birth_end'];
205
            $date->modify('+1 days');
206
            $qb
207
                ->andWhere('c.birth < :birth_end')
208
                ->setParameter('birth_end', $date);
209
        }
210
211
        // tel
212
        if (isset($searchData['tel']) && Str::isNotBlank($searchData['tel'])) {
@@ 248-254 (lines=7) @@
245
                ->andWhere('c.create_date >= :create_date_start')
246
                ->setParameter('create_date_start', $searchData['create_date_start']);
247
        }
248
        if (!empty($searchData['create_date_end']) && $searchData['create_date_end']) {
249
            $date = clone $searchData['create_date_end'];
250
            $date->modify('+1 days');
251
            $qb
252
                ->andWhere('c.create_date < :create_date_end')
253
                ->setParameter('create_date_end', $date);
254
        }
255
256
        // update_date
257
        if (!empty($searchData['update_date_start']) && $searchData['update_date_start']) {
@@ 262-268 (lines=7) @@
259
                ->andWhere('c.update_date >= :update_date_start')
260
                ->setParameter('update_date_start', $searchData['update_date_start']);
261
        }
262
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
263
            $date = clone $searchData['update_date_end'];
264
            $date->modify('+1 days');
265
            $qb
266
                ->andWhere('c.update_date < :update_date_end')
267
                ->setParameter('update_date_end', $date);
268
        }
269
270
        // last_buy
271
        if (!empty($searchData['last_buy_start']) && $searchData['last_buy_start']) {
@@ 276-282 (lines=7) @@
273
                ->andWhere('c.last_buy_date >= :last_buy_start')
274
                ->setParameter('last_buy_start', $searchData['last_buy_start']);
275
        }
276
        if (!empty($searchData['last_buy_end']) && $searchData['last_buy_end']) {
277
            $date = clone $searchData['last_buy_end'];
278
            $date->modify('+1 days');
279
            $qb
280
                ->andWhere('c.last_buy_date < :last_buy_end')
281
                ->setParameter('last_buy_end', $date);
282
        }
283
284
        // status
285
        if (!empty($searchData['customer_status']) && count($searchData['customer_status']) > 0) {

src/Eccube/Repository/ProductRepository.php 2 locations

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