Code Duplication    Length = 14-16 lines in 2 locations

class/bookshop_books.php 2 locations

@@ 266-279 (lines=14) @@
263
     *
264
	 * @return integer Le nombre total de livres recommandés
265
     */
266
    public function getRecommendedCount()
267
    {
268
        $criteria = new CriteriaCompo();
269
        $criteria->add(new Criteria('book_online', 1, '='));
270
        $criteria->add(new Criteria('book_recommended', '0000-00-00', '<>'));
271
		if(bookshop_getmoduleoption('show_unpublished') == 0) {	// Ne pas afficher les livres qui ne sont pas publiés
272
            $criteria->add(new Criteria('book_submitted', time(), '<='));
273
        }
274
        if (bookshop_getmoduleoption('nostock_display') == 0) {    // Se limiter aux seuls livres encore en stock
275
            $criteria->add(new Criteria('book_stock', 0, '>'));
276
        }
277
278
        return $this->getCount($criteria);
279
    }
280
281
    /**
282
	 * Renvoie la liste des x derniers livres parus toutes catégories confondues ou dans une catégorie spécifique
@@ 355-370 (lines=16) @@
352
	 * @param intefer $book_cid Catégorie du livre
353
	 * @return integer Le nombre de livres publiés
354
     */
355
    public function getTotalPublishedBooksCount($book_cid = 0)
356
    {
357
        $criteria = new CriteriaCompo();
358
        $criteria->add(new Criteria('book_online', 1, '='));
359
		if(bookshop_getmoduleoption('show_unpublished') == 0) {	// Ne pas afficher les livres qui ne sont pas publiés
360
            $criteria->add(new Criteria('book_submitted', time(), '<='));
361
        }
362
        if (bookshop_getmoduleoption('nostock_display') == 0) {    // Se limiter aux seuls livres encore en stock
363
            $criteria->add(new Criteria('book_stock', 0, '>'));
364
        }
365
        if ($book_cid > 0) {
366
            $criteria->add(new Criteria('book_cid', (int)$book_cid, '='));
367
        }
368
369
        return $this->getCount($criteria);
370
    }
371
372
    /**
373
	 * Récupération de l'ID et du titre d'une série de livres répondants à un critère