4
0
Fork 0

update 2023-07-21 11:55:41

This commit is contained in:
Robot 2023-07-21 11:55:41 +02:00
parent 17d09272e1
commit 23a28426de
Signed by: Robot
GPG Key ID: 14DECD44E7E1BB95
3 changed files with 14 additions and 14 deletions

View File

@ -18,7 +18,7 @@ class Note << (F,LightGreen) >> #Green {
+ __construct(Load $load, Insert $insert, ...)
+ set(int $book, int $chapter, ...) : ?array
+ delete(string $note) : bool
- get(string $linker, int $book, ...) : ?array
- get(string $linker, int $book, ...) : ?object
- create(string $linker, int $book, ...) : bool
}
@ -58,7 +58,7 @@ note right of Note::get
Get a note
since: 2.0.1
return: ?array
return: ?object
arguments:
string $linker

View File

@ -108,7 +108,7 @@ final class Note
];
}
// get note if it exist
// get note if it exists
if (($_note = $this->get($linker, $book, $chapter, $verse)) !== null)
{
// publish if not published
@ -120,7 +120,7 @@ final class Note
}
// update the note if needed
if ($_note->note !== $note && !$this->update->value($note, 'note', $_note->id, 'id', 'note'))
if ((!isset($_note->note) || $_note->note !== $note) && !$this->update->value($note, 'note', $_note->id, 'id', 'note'))
{
return [
'error' => Text::_('COM_GETBIBLE_NOTE_ALREADY_EXIST_BUT_COULD_NOT_UPDATE_THE_NOTE_TEXT')
@ -176,7 +176,7 @@ final class Note
* @param int $chapter The chapter in which the note is made
* @param int $verse The verse where the note is made
*
* @return array|null Array of the note values on success
* @return object|null Array of the note values on success
* @since 2.0.1
**/
private function get(
@ -184,12 +184,12 @@ final class Note
int $book,
int $chapter,
int $verse
): ?array
): ?object
{
// get note if it exist
if (($note = $this->load->item([
'linker' => $linker,
'book' => $book,
'book_nr' => $book,
'chapter' => $chapter,
'verse' => $verse
], 'note')) !== null)
@ -231,7 +231,7 @@ final class Note
'note' => $note ?? '',
'access' => 0,
'linker' => $linker,
'book' => $book,
'book_nr' => $book,
'chapter' => $chapter,
'verse' => $verse,
'guid' => $guid

View File

@ -79,7 +79,7 @@
];
}
// get note if it exist
// get note if it exists
if (($_note = $this->get($linker, $book, $chapter, $verse)) !== null)
{
// publish if not published
@ -91,7 +91,7 @@
}
// update the note if needed
if ($_note->note !== $note && !$this->update->value($note, 'note', $_note->id, 'id', 'note'))
if ((!isset($_note->note) || $_note->note !== $note) && !$this->update->value($note, 'note', $_note->id, 'id', 'note'))
{
return [
'error' => Text::_('Note already exist, but could not update the note text.')
@ -147,7 +147,7 @@
* @param int $chapter The chapter in which the note is made
* @param int $verse The verse where the note is made
*
* @return array|null Array of the note values on success
* @return object|null Array of the note values on success
* @since 2.0.1
**/
private function get(
@ -155,12 +155,12 @@
int $book,
int $chapter,
int $verse
): ?array
): ?object
{
// get note if it exist
if (($note = $this->load->item([
'linker' => $linker,
'book' => $book,
'book_nr' => $book,
'chapter' => $chapter,
'verse' => $verse
], 'note')) !== null)
@ -202,7 +202,7 @@
'note' => $note ?? '',
'access' => 0,
'linker' => $linker,
'book' => $book,
'book_nr' => $book,
'chapter' => $chapter,
'verse' => $verse,
'guid' => $guid