diff --git a/Lib/Exception/WebException.php b/Lib/Exception/WebException.php index 7476e72..d02503a 100644 --- a/Lib/Exception/WebException.php +++ b/Lib/Exception/WebException.php @@ -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; } } diff --git a/Lib/Formatter/Formatter.php b/Lib/Formatter/Formatter.php index f4496ca..b650f4c 100644 --- a/Lib/Formatter/Formatter.php +++ b/Lib/Formatter/Formatter.php @@ -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); } \ No newline at end of file diff --git a/Lib/Formatter/Html.php b/Lib/Formatter/Html.php index f9e61eb..166d201 100644 --- a/Lib/Formatter/Html.php +++ b/Lib/Formatter/Html.php @@ -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']; diff --git a/Lib/Search/BookSearch.php b/Lib/Search/BookSearch.php index 73c5364..254604f 100644 --- a/Lib/Search/BookSearch.php +++ b/Lib/Search/BookSearch.php @@ -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 diff --git a/Lib/db/AudioBook.php b/Lib/db/AudioBook.php index 2b8fec4..98b604b 100644 --- a/Lib/db/AudioBook.php +++ b/Lib/db/AudioBook.php @@ -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'] diff --git a/Lib/db/DbMapping.php b/Lib/db/DbMapping.php index d7fb8e9..8373120 100644 --- a/Lib/db/DbMapping.php +++ b/Lib/db/DbMapping.php @@ -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 diff --git a/Lib/db/User.php b/Lib/db/User.php index 2ba6a38..7111eb8 100644 --- a/Lib/db/User.php +++ b/Lib/db/User.php @@ -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; diff --git a/NetBiblio.php b/NetBiblio.php index 77f2d9c..fd23516 100644 --- a/NetBiblio.php +++ b/NetBiblio.php @@ -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',