Système de feedback par gilles

envoi du mail après un certain nombre de tl.
Amélioration de la rcherche.
2-3 autres trucs.
This commit is contained in:
SIMON_\Simon
2017-07-24 17:05:05 +02:00
parent c140c28bd4
commit ddaf517579
5 changed files with 121 additions and 26 deletions

View File

@@ -42,14 +42,13 @@ class Configuration {
// 0 : no log at all
// 1 : log summary
// 2 : log response
'verbosity' => 0,
'verbosity' => 2,
),
'session' => array(
'save_path' => ''
),
'checkfile_url' => 'http://fichiers.bibliothequesonore.ch/checkfile.php?',
'checkfile_url' => 'http://85.218.123.89/checkfile.php?',
'checkfile_url_old' => 'http://fichiers.bibliothequesonore.ch/checkfile.php?',
'netbiblio_worker_id' => 45,
'www_employee_id' => 45,
'www_library_id' => 2,

View File

@@ -81,10 +81,13 @@ class BookSearch
$queryText = \SolrUtils::escapeQueryChars($queryText);
}
if (strlen($queryField) > 0) {
if($queryField == 'mediaType' and $queryText=='noCDS'){
$queryText='-mediaType:CDS';
} else if (strlen($queryField) > 0) {
$queryText = sprintf('%s:"%s"', $queryField, $queryText);
}
$this->queryParts[] = $queryText;
}
@@ -161,7 +164,7 @@ class BookSearch
$this->query->setParam('hl', $highlight ? 'true' : 'false');
$this->query->setParam('spellcheck', $spellcheck ? 'true' : 'false');
try {
$results = $this->client->query($this->query)->getArrayResponse();
} catch(\SolrException $e) {
@@ -300,7 +303,7 @@ class BookSearch
$s = new BookSearch();
$s->addFilterQuery(1, 'visible');
$s->addFacetField($field);
$s->setFacetLimits(2000, 10);
$s->setFacetLimits(2000, 2);
$results = $s->getResults(0, 0, true);
return $results['facets']['facets'][$field];

View File

@@ -21,7 +21,10 @@ class DbHelper
AND Notices.NoticeNr NOT LIKE '%~%'
AND Notices.NoticeNr NOT LIKE '%V%'
AND Notices.NoticeNr NOT LIKE '%T%'
AND Notices.MediaType1Code = 'CDD';";
AND Codes.TextFre !=''
AND Notices.MediaType1Code = 'CDD'
ORDER BY text;";
$results = Connection::execute($sql)->to_array();

View File

@@ -182,6 +182,24 @@ class User extends DbMapping
return $this->_getLoans('OldCirculations', $count, 'CheckOutDate DESC');
}
/**
* Books eligible for feedback by the user. Lent or downloaded more than 2 weeks ago and less than 5 monthes.
* @return array
*/
public function GetBooksForFeedback()
{
$sql = sprintf("SELECT n.NoticeNr
FROM OldCirculations AS c
INNER JOIN Items AS i ON i.ItemId = c.ItemId
INNER JOIN Notices AS n ON n.NoticeID = i.NoticeID
WHERE
c.UserAccountID = %s
AND DATEDIFF(week, CheckOutDate, GETDATE()) > 1
AND DATEDIFF(month, CheckOutDate, GETDATE()) < 5
", $this->id);
return Connection::execute($sql)->to_array(); }
/**
* Add a book to the wish list if it is not already inside.
@@ -237,20 +255,38 @@ class User extends DbMapping
* @param int $limit
* @return array
*/
public function getWishes($count = false, $limit = 50)
public function getWishes($count = false, $limit = 200)
{
$sql = sprintf("SELECT TOP $limit
NoticeID
NoticeID, CreationDate
FROM Wishes
WHERE UserAccountID = %s
ORDER BY CreationDate DESC", $this->id);
$result = Connection::execute($sql);
$ids = array_map(function($r) { return $r['NoticeID']; }, $result->to_array());
$wishList = $result->to_array();
$ids = array_map(function($r) { return $r['NoticeID']; }, $wishList);
if($count) {
return count($ids);
}
return BookSearch::GetBooks($ids, 'id');
$books = BookSearch::GetBooks($ids, 'id');
foreach($wishList as $w) {
$id = $w['NoticeID'];
if(isset($books[$id])) {
$books[$id]['creationDate'] = $w['CreationDate'];
}
}
$creationDates = array();
foreach ($books as $key => $book)
{
$creationDates[$key] = $book['creationDate'];
}
array_multisort($creationDates, SORT_DESC, $books);
return $books;
}
/**
@@ -269,4 +305,4 @@ class User extends DbMapping
$status = Connection::execute($sql, true);
return $status && ! $status->is_error() && $status->get_num_rows() > 0;
}
}
}