Blabla.
This commit is contained in:
@@ -6,11 +6,12 @@ use BSR\Lib\Configuration;
|
||||
use BSR\Lib\db\DBHelper;
|
||||
use BSR\Lib\db\Connection;
|
||||
use BSR\Lib\db\User;
|
||||
use BSR\Lib\Logger;
|
||||
use BSR\Lib\Exception\AuthenticationException;
|
||||
use BSR\Lib\Exception\WebException;
|
||||
use BSR\Lib\Search\BookSearch;
|
||||
use BSR\Lib\WebService;
|
||||
use BSR\Lib\Logger;
|
||||
|
||||
class NetBiblio extends WebService
|
||||
{
|
||||
/** @var string $version version number */
|
||||
@@ -84,7 +85,7 @@ class NetBiblio extends WebService
|
||||
Configuration::get('checkfile_url'),
|
||||
http_build_query(array("book" => implode(',', $codes)))
|
||||
);
|
||||
|
||||
// Logger::log($uri);
|
||||
$ch = curl_init($uri);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
@@ -141,9 +142,7 @@ class NetBiblio extends WebService
|
||||
* @return array either one or a list of books
|
||||
*/
|
||||
private function AddBookData(array $books)
|
||||
{
|
||||
Logger::log(print_r($books, true), 0);
|
||||
|
||||
{
|
||||
if(isset($books['code'])) {
|
||||
$result = $this->AddBookData(array($books));
|
||||
return reset($result);
|
||||
@@ -485,6 +484,7 @@ class NetBiblio extends WebService
|
||||
return array_values($this->AddBookData($circulations));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method returns the list of books that the currently authenticated user
|
||||
* has downloaded or that were lent to him.
|
||||
@@ -495,7 +495,20 @@ class NetBiblio extends WebService
|
||||
public function GetOldLoans()
|
||||
{
|
||||
$circulations = $this->getUser()->GetOldLoans();
|
||||
return array_values($this->AddBookData($circulations));
|
||||
return $circulations; //array_values($this->AddBookData($circulations));
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the list of noticenr that
|
||||
* were lent to the currently authenticated user.
|
||||
*
|
||||
* @return array
|
||||
* @throws AuthenticationException
|
||||
*/
|
||||
public function GetOldLoansNrs()
|
||||
{
|
||||
$circulations = $this->getUser()->GetOldLoansNrs();
|
||||
return $circulations;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -712,14 +725,14 @@ class NetBiblio extends WebService
|
||||
$bs = new BookSearch();
|
||||
|
||||
// when search on a particular field, put results in descending date order
|
||||
if(!isset($queryArray['queryText'])) {
|
||||
if(!isset($queryArray['queryText']) && !isset($queryArray['author_fr']) && !isset($queryArray['title_fr']) ) {
|
||||
$bs->addSortField('availabilityDate');
|
||||
}
|
||||
|
||||
if (isset($queryArray['queryText']) && strlen($queryArray['queryText']) > 0) {
|
||||
$type = isset($queryArray['queryType']) ? $queryArray['queryType'] : null;
|
||||
|
||||
if($this->client != 'website' && in_array($type, array('title', 'author', 'reader'))) {
|
||||
if(in_array($type, array('title', 'author', 'reader'))) {
|
||||
// we don't want an exact search on mobile apps
|
||||
$type = $type.'_fr';
|
||||
} else if($type == 'text') {
|
||||
@@ -782,8 +795,6 @@ class NetBiblio extends WebService
|
||||
|
||||
$results = $bs->getResults($start, $count, $facets, $spellcheck, $highlight);
|
||||
|
||||
|
||||
|
||||
$data = array(
|
||||
'count' => $results['count'],
|
||||
'facets' => $results['facets'],
|
||||
@@ -812,6 +823,21 @@ class NetBiblio extends WebService
|
||||
return $this->AddBookData($results['books']);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method return books similar to the one given.
|
||||
*
|
||||
* @param int|array $ids One or multiple book ids
|
||||
* @param int number of books
|
||||
* @return array
|
||||
*/
|
||||
public function MoreLikeThisByCode($codes, $number = 8)
|
||||
{
|
||||
$bs = new BookSearch(false);
|
||||
$bs->addOrQuery(is_array($code) ? $codes : array($codes), 'code');
|
||||
$bs->setHandler('more');
|
||||
$results = $bs->getResults(0, $number);
|
||||
return array_values($this->AddBookData($results['books']));
|
||||
}
|
||||
/**
|
||||
* This method returns books similar to the books already
|
||||
* loaned by the current user.
|
||||
|
||||
Reference in New Issue
Block a user