App-Office-Contacts
view release on metacpan or search on metacpan
lib/App/Office/Contacts/View/Note.pm view on Meta::CPAN
</tr>
<tr class="$class">
<td>$text</td>
<td>$update</td>
</tr>
EOS
}
$html .= <<EOS;
</tbody>
</table>
EOS
return $html;
} # End of format_person_notes.
# -----------------------------------------------
sub add
{
my($self, $user_id, $result) = @_;
$self -> db -> logger -> log(debug => "View::Note.add($user_id, ...)");
# Force the user_id into the person's record, so it is available elsewhere.
# Note: This is the user_id of the person logged on.
my($note) = {};
$$note{creator_id} = $user_id;
$$note{entity_id} = $result -> get_value('entity_id');
$$note{entity_type} = $result -> get_value('entity_type');
$$note{body} = $result -> get_value('body');
$self -> db -> logger -> log(debug => '-' x 50);
$self -> db -> logger -> log(debug => 'Adding note ...'); # Skip note because of potential length.
$self -> db -> logger -> log(debug => "$_ => $$note{$_}") for sort grep{! /^body$/} keys %$note;
my($text) = $$note{body};
$text = length($text) > 20 ? (substr($text, 0, 20) . '...') : $text;
$self -> db -> logger -> log(debug => "note => $text");
$self -> db -> logger -> log(debug => '-' x 50);
$self -> db -> note -> add($note);
} # End of add.
# -----------------------------------------------
sub delete
{
my($self, $user_id, $result) = @_;
$self -> db -> logger -> log(debug => "View::Note.delete($user_id, ...)");
$self -> db -> note -> delete($result -> get_value('note_id') );
} # End of delete.
# -----------------------------------------------
sub update
{
my($self, $user_id, $result) = @_;
$self -> db -> logger -> log(debug => "View::Note.update($user_id, ...)");
# Force the user_id into the person's record, so it is available elsewhere.
# Note: This is the user_id of the person logged on.
my($note) = {};
$$note{creator_id} = $user_id;
$$note{entity_id} = $result -> get_value('entity_id');
$$note{entity_type} = $result -> get_value('entity_type');
$$note{body} = $result -> get_value('body') || ''; # Content may have been deleted.
$$note{id} = $result -> get_value('note_id');
$self -> db -> note -> update($note);
} # End of update.
# -----------------------------------------------
1;
=head1 NAME
App::Office::Contacts::View::Note - A web-based contacts manager
=head1 Synopsis
See L<App::Office::Contacts/Synopsis>.
=head1 Description
L<App::Office::Contacts> implements a utf8-aware, web-based, private and group contacts manager.
=head1 Distributions
See L<App::Office::Contacts/Distributions>.
=head1 Installation
See L<App::Office::Contacts/Installation>.
Each instance of this class is a L<Moo>-based object with these attributes:
=head1 Object attributes
Each instance of this class extends L<App::Office::Contacts::View::Base>, with these attributes:
=over 4
=item o (None)
=back
=head1 Methods
=head2 add($user_id, $result)
Adds a Note.
( run in 0.487 second using v1.01-cache-2.11-cpan-99c4e6809bf )