spelling, small cleanups

master
Gilles Crettenand 11 years ago
parent b587047d17
commit 4f865d1186

@ -4,7 +4,7 @@ namespace BSR\Lib\Exception;
class WebException extends \Exception
{
private $excname;
private $exceptionName;
/**
* @param string $name
@ -13,12 +13,12 @@ class WebException extends \Exception
*/
function __construct($name, $reason, $code)
{
$this->excname = $name;
$this->exceptionName = $name;
parent::__construct($reason, $code);
}
public function getName()
{
return $this->excname;
return $this->exceptionName;
}
}

@ -70,7 +70,7 @@ abstract class Formatter {
/**
* Output the content for the given data
* @param $array data
* @param array $data
*/
abstract public function render($data);
}

@ -10,8 +10,8 @@ class Html extends Formatter {
));
}
private function result($data) {
// the format is array('result' => array('funcname' => DATA))
protected function result($data) {
// the format is array('result' => array('function name' => DATA))
// so take the first element of the 'result' array
$func = key($data['result']);
$data = reset($data['result']);
@ -60,7 +60,7 @@ class Html extends Formatter {
);
}
private function error($data) {
protected function error($data) {
$code = $data['error']['code'];
$name = $data['error']['name'];
$msg = $data['error']['reason'];
@ -72,7 +72,7 @@ class Html extends Formatter {
);
}
private function failure($data) {
protected function failure($data) {
$code = $data['failure']['code'];
$name = $data['failure']['reason'];

@ -89,7 +89,7 @@ class BookSearch
/**
* Retrive books from Solr based on their code (NoticeNr).
* Retrieve books from Solr based on their code (NoticeNr).
*
* @param array $codes
* @param string $field the field to use for the search

@ -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
MediaType1code='N' and NoticeNr not like '%~%'
AND items.NoticeID = notices.NoticeID
AND items.ItemID = circulations.ItemID
AND useraccounts.useraccountid=circulations.useraccountid
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']

@ -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

@ -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;

@ -31,7 +31,7 @@ class NetBiblio extends WebService
}
/**
* Retrieve information about the curent user from the database.
* Retrieve information about the current user from the database.
* If a username is given, first validate that it is the same
* currently in the session.
*
@ -254,7 +254,7 @@ class NetBiblio extends WebService
$sql = "SELECT circulationId
FROM OldCirculations
WHERE
useraccountID= $userId AND
UserAccountID= $userId AND
itemID = $itemId AND
LTRIM(RTRIM(remark)) = '$client';";
$result = Connection::execute($sql, false);
@ -278,11 +278,11 @@ class NetBiblio extends WebService
$nextId = 1;
}
$sql = "UPDATE Useraccounts
$sql = "UPDATE UserAccounts
SET
Circulations = Circulations + 1,
TotalCirculations = TotalCirculations + 1
WHERE UseraccountID = $userId;";
WHERE UserAccountID = $userId;";
Connection::execute($sql);
$sql = "UPDATE Items
@ -294,11 +294,11 @@ class NetBiblio extends WebService
$worker_id = Configuration::get('netbiblio_worker_id');
$sql = "INSERT INTO OldCirculations (
CirculationID, ItemID, UseraccountID,
CirculationID, ItemID, UserAccountID,
Remark,
DueDate, CheckOutDate, CheckInDate,
CheckOutBranchofficeID, CheckOutEmployeeID, CheckInBranchofficeID, CheckInEmployeeID,
Reminders, Renewals, Prereminder, InfoCode, CheckOutSIP2Info, CheckInSIP2Info
CheckOutBranchOfficeID, CheckOutEmployeeID, CheckInBranchOfficeID, CheckInEmployeeID,
Reminders, Renewals, PreReminder, InfoCode, CheckOutSIP2Info, CheckInSIP2Info
) VALUES (
$nextId, $itemId, $userId,
'$client',

Loading…
Cancel
Save