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']) && StringUtil::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']) && StringUtil::isNotBlank($searchData['payment_total_start'])) {
@@ 295-300 (lines=6) @@
292
293
        // status
294
        $filterStatus = false;
295
        if (!empty($searchData['status']) && $searchData['status']) {
296
            $qb
297
                ->andWhere('o.OrderStatus = :status')
298
                ->setParameter('status', $searchData['status']);
299
            $filterStatus = true;
300
        }
301
        if (!empty($searchData['multi_status']) && count($searchData['multi_status'])) {
302
            $qb
303
                ->andWhere($qb->expr()->in('o.OrderStatus', ':multi_status'))
@@ 365-370 (lines=6) @@
362
        }
363
364
        // oreder_date
365
        if (!empty($searchData['order_date_start']) && $searchData['order_date_start']) {
366
            $date = $searchData['order_date_start'];
367
            $qb
368
                ->andWhere('o.order_date >= :order_date_start')
369
                ->setParameter('order_date_start', $date);
370
        }
371
        if (!empty($searchData['order_date_end']) && $searchData['order_date_end']) {
372
            $date = clone $searchData['order_date_end'];
373
            $date = $date
@@ 371-378 (lines=8) @@
368
                ->andWhere('o.order_date >= :order_date_start')
369
                ->setParameter('order_date_start', $date);
370
        }
371
        if (!empty($searchData['order_date_end']) && $searchData['order_date_end']) {
372
            $date = clone $searchData['order_date_end'];
373
            $date = $date
374
                ->modify('+1 days');
375
            $qb
376
                ->andWhere('o.order_date < :order_date_end')
377
                ->setParameter('order_date_end', $date);
378
        }
379
380
        // payment_date
381
        if (!empty($searchData['payment_date_start']) && $searchData['payment_date_start']) {
@@ 381-386 (lines=6) @@
378
        }
379
380
        // payment_date
381
        if (!empty($searchData['payment_date_start']) && $searchData['payment_date_start']) {
382
            $date = $searchData['payment_date_start'];
383
            $qb
384
                ->andWhere('o.payment_date >= :payment_date_start')
385
                ->setParameter('payment_date_start', $date);
386
        }
387
        if (!empty($searchData['payment_date_end']) && $searchData['payment_date_end']) {
388
            $date = clone $searchData['payment_date_end'];
389
            $date = $date
@@ 387-394 (lines=8) @@
384
                ->andWhere('o.payment_date >= :payment_date_start')
385
                ->setParameter('payment_date_start', $date);
386
        }
387
        if (!empty($searchData['payment_date_end']) && $searchData['payment_date_end']) {
388
            $date = clone $searchData['payment_date_end'];
389
            $date = $date
390
                ->modify('+1 days');
391
            $qb
392
                ->andWhere('o.payment_date < :payment_date_end')
393
                ->setParameter('payment_date_end', $date);
394
        }
395
396
        // shipping_date
397
        if (!empty($searchData['shipping_date_start']) && $searchData['shipping_date_start']) {
@@ 397-402 (lines=6) @@
394
        }
395
396
        // shipping_date
397
        if (!empty($searchData['shipping_date_start']) && $searchData['shipping_date_start']) {
398
            $date = $searchData['shipping_date_start'];
399
            $qb
400
                ->andWhere('o.shipping_date >= :shipping_date_start')
401
                ->setParameter('shipping_date_start', $date);
402
        }
403
        if (!empty($searchData['shipping_date_end']) && $searchData['shipping_date_end']) {
404
            $date = clone $searchData['shipping_date_end'];
405
            $date = $date
@@ 403-410 (lines=8) @@
400
                ->andWhere('o.shipping_date >= :shipping_date_start')
401
                ->setParameter('shipping_date_start', $date);
402
        }
403
        if (!empty($searchData['shipping_date_end']) && $searchData['shipping_date_end']) {
404
            $date = clone $searchData['shipping_date_end'];
405
            $date = $date
406
                ->modify('+1 days');
407
            $qb
408
                ->andWhere('o.shipping_date < :shipping_date_end')
409
                ->setParameter('shipping_date_end', $date);
410
        }
411
412
413
        // update_date
@@ 414-419 (lines=6) @@
411
412
413
        // update_date
414
        if (!empty($searchData['update_date_start']) && $searchData['update_date_start']) {
415
            $date = $searchData['update_date_start'];
416
            $qb
417
                ->andWhere('o.update_date >= :update_date_start')
418
                ->setParameter('update_date_start', $date);
419
        }
420
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
421
            $date = clone $searchData['update_date_end'];
422
            $date = $date
@@ 420-427 (lines=8) @@
417
                ->andWhere('o.update_date >= :update_date_start')
418
                ->setParameter('update_date_start', $date);
419
        }
420
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
421
            $date = clone $searchData['update_date_end'];
422
            $date = $date
423
                ->modify('+1 days');
424
            $qb
425
                ->andWhere('o.update_date < :update_date_end')
426
                ->setParameter('update_date_end', $date);
427
        }
428
429
        // payment_total
430
        if (isset($searchData['payment_total_start']) && StringUtil::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']) && StringUtil::isNotBlank($searchData['tel'])) {
@@ 249-255 (lines=7) @@
246
                ->andWhere('c.create_date >= :create_date_start')
247
                ->setParameter('create_date_start', $searchData['create_date_start']);
248
        }
249
        if (!empty($searchData['create_date_end']) && $searchData['create_date_end']) {
250
            $date = clone $searchData['create_date_end'];
251
            $date->modify('+1 days');
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']) {
@@ 263-269 (lines=7) @@
260
                ->andWhere('c.update_date >= :update_date_start')
261
                ->setParameter('update_date_start', $searchData['update_date_start']);
262
        }
263
        if (!empty($searchData['update_date_end']) && $searchData['update_date_end']) {
264
            $date = clone $searchData['update_date_end'];
265
            $date->modify('+1 days');
266
            $qb
267
                ->andWhere('c.update_date < :update_date_end')
268
                ->setParameter('update_date_end', $date);
269
        }
270
271
        // last_buy
272
        if (!empty($searchData['last_buy_start']) && $searchData['last_buy_start']) {
@@ 277-283 (lines=7) @@
274
                ->andWhere('c.last_buy_date >= :last_buy_start')
275
                ->setParameter('last_buy_start', $searchData['last_buy_start']);
276
        }
277
        if (!empty($searchData['last_buy_end']) && $searchData['last_buy_end']) {
278
            $date = clone $searchData['last_buy_end'];
279
            $date->modify('+1 days');
280
            $qb
281
                ->andWhere('c.last_buy_date < :last_buy_end')
282
                ->setParameter('last_buy_end', $date);
283
        }
284
285
        // status
286
        if (!empty($searchData['customer_status']) && count($searchData['customer_status']) > 0) {

src/Eccube/Repository/ProductRepository.php 2 locations

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

src/Eccube/Repository/ShippingRepository.php 8 locations

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