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

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

@ -10,8 +10,8 @@ class Html extends Formatter {
)); ));
} }
private function result($data) { protected function result($data) {
// the format is array('result' => array('funcname' => DATA)) // the format is array('result' => array('function name' => DATA))
// so take the first element of the 'result' array // so take the first element of the 'result' array
$func = key($data['result']); $func = key($data['result']);
$data = reset($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']; $code = $data['error']['code'];
$name = $data['error']['name']; $name = $data['error']['name'];
$msg = $data['error']['reason']; $msg = $data['error']['reason'];
@ -72,7 +72,7 @@ class Html extends Formatter {
); );
} }
private function failure($data) { protected function failure($data) {
$code = $data['failure']['code']; $code = $data['failure']['code'];
$name = $data['failure']['reason']; $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 array $codes
* @param string $field the field to use for the search * @param string $field the field to use for the search

@ -39,8 +39,6 @@ namespace BSR\Lib\db;
* @property string sql_genre * @property string sql_genre
* @property string genreCode * @property string genreCode
* @property string sql_genreCode * @property string sql_genreCode
* @property string coverdisplay
* @property string sql_coverdisplay
* @property string link * @property string link
* @property string sql_link * @property string sql_link
* @property string linkTitle * @property string linkTitle
@ -50,7 +48,7 @@ namespace BSR\Lib\db;
*/ */
class AudioBook extends DbMapping 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) { public static function find($id) {
return self::findBy('NoticeID', $id); return self::findBy('NoticeID', $id);
@ -97,7 +95,7 @@ class AudioBook extends DbMapping
LTRIM(RTRIM(GenreCode.TextFre)) As genre, LTRIM(RTRIM(GenreCode.TextFre)) As genre,
LTRIM(RTRIM(GenreCode.Code)) AS genreCode, LTRIM(RTRIM(GenreCode.Code)) AS genreCode,
CASE 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' ELSE 'http://ecx.images-amazon.com/images/I/' + Fields.[899a] + '._SL320_.jpg'
END AS cover, END AS cover,
Fields.[856u] AS link, Fields.[856u] AS link,
@ -105,7 +103,7 @@ class AudioBook extends DbMapping
LTRIM(RTRIM(Notices.[MediaType1Code])) AS mediaType LTRIM(RTRIM(Notices.[MediaType1Code])) AS mediaType
FROM Notices FROM Notices
INNER JOIN Codes As GenreCode ON Notices.MediaType2Code = GenreCode.Code AND GenreCode.Type = 2 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 ( LEFT OUTER JOIN (
SELECT * SELECT *
FROM ( FROM (
@ -142,7 +140,7 @@ class AudioBook extends DbMapping
OUTER APPLY ( OUTER APPLY (
SELECT TOP 1 * SELECT TOP 1 *
FROM Items FROM Items
WHERE Notices.NoticeID = NoticeId WHERE Notices.NoticeID = NoticeID
) AS item1 ) AS item1
LEFT JOIN Authorities AS isbn ON isbn.AuthorityID = Fields.[020] LEFT JOIN Authorities AS isbn ON isbn.AuthorityID = Fields.[020]
WHERE 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() public static function inReading()
{ {
$sql = "SELECT $sql = "SELECT
noticenr, title, author, displayName NoticeNr, title, author, displayName
FROM notices, items, circulations, useraccounts FROM notices, items, circulations, UserAccounts
WHERE WHERE
mediatype1code='N' and NoticeNr not like '%~%' MediaType1code='N' and NoticeNr not like '%~%'
AND items.noticeid = notices.noticeid AND items.NoticeID = notices.NoticeID
AND items.ItemID=circulations.ItemID AND items.ItemID = circulations.ItemID
AND useraccounts.useraccountid=circulations.useraccountid AND UserAccounts.UserAccountID = circulations.UserAccountID
ORDER BY author, title;"; ORDER BY author, title;";
$results = Connection::execute($sql); $results = Connection::execute($sql);
return array_map(function($row) { return array_map(function($row) {
return array( return array(
"noticenr" => $row['noticenr'], "NoticeNr" => $row['NoticeNr'],
"auteur" => $row['author'], "auteur" => $row['author'],
"titre" => $row['title'], "titre" => $row['title'],
"lecteur" => $row['displayName'] "lecteur" => $row['displayName']

@ -48,7 +48,7 @@ abstract class DbMapping
/** /**
* Ensure that name attribute is authorized * 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. * Those one cannot be accessed via setAttributes and other batch methods.
* @param string $name * @param string $name
* @param bool $public_only * @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 * @param string $name
* @return mixed * @return mixed

@ -5,7 +5,7 @@ use BSR\Lib\Configuration;
use BSR\Lib\Search\BookSearch; 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 int id
* @property string $login * @property string $login
@ -72,11 +72,11 @@ class User extends DbMapping
[TelephoneMobile] AS mobilePhone, [TelephoneMobile] AS mobilePhone,
[TelephonePrivate] AS privatePhone, [TelephonePrivate] AS privatePhone,
[Telephone] AS officePhone, [Telephone] AS officePhone,
[UserAccountId] AS id, [UserAccountID] AS id,
REPLACE(UseraccountNr, ' ', '') AS login REPLACE(UserAccountNr, ' ', '') AS login
FROM [UserAccounts] AS u FROM [UserAccounts] AS u
LEFT JOIN [Addresses] AS a ON a.[AddressID] = u.[ActualAddressID] 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); $login, $cond);
$results = Connection::execute($sql, $raiseError); $results = Connection::execute($sql, $raiseError);
@ -91,7 +91,7 @@ class User extends DbMapping
FROM %s AS c FROM %s AS c
INNER JOIN Items AS i ON i.ItemId = c.ItemId INNER JOIN Items AS i ON i.ItemId = c.ItemId
WHERE WHERE
c.UseraccountId = %s c.UserAccountID = %s
ORDER BY %s", $table, $this->id, $sort); ORDER BY %s", $table, $this->id, $sort);
$result = Connection::execute($sql); $result = Connection::execute($sql);
@ -161,7 +161,7 @@ class User extends DbMapping
INNER JOIN Notices AS n ON n.NoticeID = w.NoticeID INNER JOIN Notices AS n ON n.NoticeID = w.NoticeID
WHERE WHERE
LTRIM(RTRIM(n.NoticeNr)) = '%s' LTRIM(RTRIM(n.NoticeNr)) = '%s'
AND w.UseraccountId = %s;", $noticeNr, $this->id); AND w.UserAccountID = %s;", $noticeNr, $this->id);
$result = Connection::execute($sql); $result = Connection::execute($sql);
return $result->current() !== false; 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 * If a username is given, first validate that it is the same
* currently in the session. * currently in the session.
* *
@ -254,7 +254,7 @@ class NetBiblio extends WebService
$sql = "SELECT circulationId $sql = "SELECT circulationId
FROM OldCirculations FROM OldCirculations
WHERE WHERE
useraccountID= $userId AND UserAccountID= $userId AND
itemID = $itemId AND itemID = $itemId AND
LTRIM(RTRIM(remark)) = '$client';"; LTRIM(RTRIM(remark)) = '$client';";
$result = Connection::execute($sql, false); $result = Connection::execute($sql, false);
@ -278,11 +278,11 @@ class NetBiblio extends WebService
$nextId = 1; $nextId = 1;
} }
$sql = "UPDATE Useraccounts $sql = "UPDATE UserAccounts
SET SET
Circulations = Circulations + 1, Circulations = Circulations + 1,
TotalCirculations = TotalCirculations + 1 TotalCirculations = TotalCirculations + 1
WHERE UseraccountID = $userId;"; WHERE UserAccountID = $userId;";
Connection::execute($sql); Connection::execute($sql);
$sql = "UPDATE Items $sql = "UPDATE Items
@ -294,11 +294,11 @@ class NetBiblio extends WebService
$worker_id = Configuration::get('netbiblio_worker_id'); $worker_id = Configuration::get('netbiblio_worker_id');
$sql = "INSERT INTO OldCirculations ( $sql = "INSERT INTO OldCirculations (
CirculationID, ItemID, UseraccountID, CirculationID, ItemID, UserAccountID,
Remark, Remark,
DueDate, CheckOutDate, CheckInDate, DueDate, CheckOutDate, CheckInDate,
CheckOutBranchofficeID, CheckOutEmployeeID, CheckInBranchofficeID, CheckInEmployeeID, CheckOutBranchOfficeID, CheckOutEmployeeID, CheckInBranchOfficeID, CheckInEmployeeID,
Reminders, Renewals, Prereminder, InfoCode, CheckOutSIP2Info, CheckInSIP2Info Reminders, Renewals, PreReminder, InfoCode, CheckOutSIP2Info, CheckInSIP2Info
) VALUES ( ) VALUES (
$nextId, $itemId, $userId, $nextId, $itemId, $userId,
'$client', '$client',

Loading…
Cancel
Save