spelling, small cleanups

This commit is contained in:
Gilles Crettenand
2015-06-02 23:14:54 +02:00
parent b587047d17
commit 4f865d1186
8 changed files with 36 additions and 38 deletions

View File

@@ -39,8 +39,6 @@ namespace BSR\Lib\db;
* @property string sql_genre
* @property string genreCode
* @property string sql_genreCode
* @property string coverdisplay
* @property string sql_coverdisplay
* @property string link
* @property string sql_link
* @property string linkTitle
@@ -50,7 +48,7 @@ namespace BSR\Lib\db;
*/
class AudioBook extends DbMapping
{
protected $attributeNames = 'id title author code summary editor media collection isbn reader cover category availabilityDate producerCode producer genre genreCode coverdisplay link linkTitle mediaType';
protected $attributeNames = 'id title author code summary editor media collection isbn reader cover category availabilityDate producerCode producer genre genreCode link linkTitle mediaType';
public static function find($id) {
return self::findBy('NoticeID', $id);
@@ -97,7 +95,7 @@ class AudioBook extends DbMapping
LTRIM(RTRIM(GenreCode.TextFre)) As genre,
LTRIM(RTRIM(GenreCode.Code)) AS genreCode,
CASE
WHEN Notices.coverdisplay = 2 THEN 'http://fichiers.bibliothequesonore.ch:8089/netbiblio/images/covers/Cover' + CAST(Notices.NoticeID AS VARCHAR) + '_Original.jpg'
WHEN Notices.CoverDisplay = 2 THEN 'http://fichiers.bibliothequesonore.ch:8089/netbiblio/images/covers/Cover' + CAST(Notices.NoticeID AS VARCHAR) + '_Original.jpg'
ELSE 'http://ecx.images-amazon.com/images/I/' + Fields.[899a] + '._SL320_.jpg'
END AS cover,
Fields.[856u] AS link,
@@ -105,7 +103,7 @@ class AudioBook extends DbMapping
LTRIM(RTRIM(Notices.[MediaType1Code])) AS mediaType
FROM Notices
INNER JOIN Codes As GenreCode ON Notices.MediaType2Code = GenreCode.Code AND GenreCode.Type = 2
INNER JOIN Codes AS ProducerCode ON Notices.userdefined3code = ProducerCode.Code AND ProducerCode.Type=6
INNER JOIN Codes AS ProducerCode ON Notices.UserDefined3code = ProducerCode.Code AND ProducerCode.Type=6
LEFT OUTER JOIN (
SELECT *
FROM (
@@ -142,7 +140,7 @@ class AudioBook extends DbMapping
OUTER APPLY (
SELECT TOP 1 *
FROM Items
WHERE Notices.NoticeID = NoticeId
WHERE Notices.NoticeID = NoticeID
) AS item1
LEFT JOIN Authorities AS isbn ON isbn.AuthorityID = Fields.[020]
WHERE
@@ -216,24 +214,24 @@ class AudioBook extends DbMapping
}
/**
* Retrieve the list of all books currently lended to readers.
* Retrieve the list of all books currently lent to readers.
*/
public static function inReading()
{
$sql = "SELECT
noticenr, title, author, displayName
FROM notices, items, circulations, useraccounts
NoticeNr, title, author, displayName
FROM notices, items, circulations, UserAccounts
WHERE
mediatype1code='N' and NoticeNr not like '%~%'
AND items.noticeid = notices.noticeid
AND items.ItemID=circulations.ItemID
AND useraccounts.useraccountid=circulations.useraccountid
MediaType1code='N' and NoticeNr not like '%~%'
AND items.NoticeID = notices.NoticeID
AND items.ItemID = circulations.ItemID
AND UserAccounts.UserAccountID = circulations.UserAccountID
ORDER BY author, title;";
$results = Connection::execute($sql);
return array_map(function($row) {
return array(
"noticenr" => $row['noticenr'],
"NoticeNr" => $row['NoticeNr'],
"auteur" => $row['author'],
"titre" => $row['title'],
"lecteur" => $row['displayName']

View File

@@ -48,7 +48,7 @@ abstract class DbMapping
/**
* Ensure that name attribute is authorized
* If public_only is false, check agains PRIVATE_ATTRIBUTES_NAME too.
* If public_only is false, check against PRIVATE_ATTRIBUTES_NAME too.
* Those one cannot be accessed via setAttributes and other batch methods.
* @param string $name
* @param bool $public_only
@@ -62,7 +62,7 @@ abstract class DbMapping
}
/**
* Get a user attribute or the linked whishes
* Get a user attribute or the linked wishes
* @param string $name
* @return mixed

View File

@@ -5,7 +5,7 @@ use BSR\Lib\Configuration;
use BSR\Lib\Search\BookSearch;
/**
* User is mapped on the Useraccounts table. Contains user information : id, login, firstName, lastName, displayName.
* User is mapped on the UserAccounts table. Contains user information : id, login, firstName, lastName, displayName.
*
* @property int id
* @property string $login
@@ -72,11 +72,11 @@ class User extends DbMapping
[TelephoneMobile] AS mobilePhone,
[TelephonePrivate] AS privatePhone,
[Telephone] AS officePhone,
[UserAccountId] AS id,
REPLACE(UseraccountNr, ' ', '') AS login
[UserAccountID] AS id,
REPLACE(UserAccountNr, ' ', '') AS login
FROM [UserAccounts] AS u
LEFT JOIN [Addresses] AS a ON a.[AddressID] = u.[ActualAddressID]
WHERE REPLACE(UseraccountNr, ' ', '') = '%s' AND disabled = 1 %s;",
WHERE REPLACE(UserAccountNr, ' ', '') = '%s' AND disabled = 1 %s;",
$login, $cond);
$results = Connection::execute($sql, $raiseError);
@@ -91,7 +91,7 @@ class User extends DbMapping
FROM %s AS c
INNER JOIN Items AS i ON i.ItemId = c.ItemId
WHERE
c.UseraccountId = %s
c.UserAccountID = %s
ORDER BY %s", $table, $this->id, $sort);
$result = Connection::execute($sql);
@@ -161,7 +161,7 @@ class User extends DbMapping
INNER JOIN Notices AS n ON n.NoticeID = w.NoticeID
WHERE
LTRIM(RTRIM(n.NoticeNr)) = '%s'
AND w.UseraccountId = %s;", $noticeNr, $this->id);
AND w.UserAccountID = %s;", $noticeNr, $this->id);
$result = Connection::execute($sql);
return $result->current() !== false;