view release on metacpan or search on metacpan
Changelog.ini view on Meta::CPAN
- Add missing pre-reqs to Build.PL and Makefile.PL.
- Make Build.PL and Makefile.PL run scripts/copy.config.pl.
EOT
[V 1.15]
Date=2010-09-22T10:00:00
Comments= <<EOT
- Replace sub script_name() with $self -> query -> url(-absolute => 1).
- Shift some code into a new module, App::Office::CMS::View::Search. This means a view
now hasa search.
- Chop subs generate_cookie(), generate_digest() and validate_post(). See V 1.09 below.
EOT
[V 1.14]
Date=2010-06-25T11:15:00
Comments=- Change all JSON::XS->new->encode(...) to JSON::XS->new->utf8->encode(...).
[V 1.13]
Date=2010-06-24T14:38:00
Comments= <<EOT
- Fix syntax error.
- Change name of default template path from tmpl_path to template_path, as part of adopting
Text::Xslate.
- Add scripts/copy.config.pl to copy .htoffice.contacts.conf to ~/.perl/App-Office-Contacts/.
- Add missing pre-reqs to Build.PL and Makefile.PL.
- Make Build.PL and Makefile.PL run scripts/copy.config.pl.
1.15 Wed Sep 22 10:00:00 2010
- Replace sub script_name() with $self -> query -> url(-absolute => 1).
- Shift some code into a new module, App::Office::CMS::View::Search. This means a view
now hasa search.
- Chop subs generate_cookie(), generate_digest() and validate_post(). See V 1.09 below.
1.14 Fri Jun 25 11:15:00 2010
- Change all JSON::XS->new->encode(...) to JSON::XS->new->utf8->encode(...).
1.13 Thu Jun 24 14:38:00 2010
- Fix syntax error.
- Use 'select count(*) as count' rather than just 'select count(*)' to avoid
differences between Postgres and SQLite.
1.12 Wed Jun 23 13:29:00 2010
lib/App/Office/Contacts.pm view on Meta::CPAN
This is used by all code.
=item Create.pm
This is just used to create tables, populate them, and drop them.
Hence it will not be used by C<CGI> scripts, unless you write such a script yourself.
=item Validator.pm
This is used to validate CGI form data.
=back
=head2 Why did you use Sub::Exporter?
The way I wrote the code, various pairs of classes, e.g.
L<App::Office::Contacts::Controller::Note> and
L<App::Office::Contacts::Donations::Controller::Note>, could share a lot of code,
but they had incompatible parents. Sub::Exporter solved this problem.
lib/App/Office/Contacts/Controller/Exporter/Organization.pm view on Meta::CPAN
try
{
$self -> log(debug => "Controller::Exporter::Org.display($organization_id)");
$result = App::Office::Contacts::Util::Validator -> new
(
app => $self,
config => $self -> param('config'),
db => $self -> param('db'),
query => $self -> query,
) -> validate_organization_id;
if ($result -> success)
{
$self -> param('db') -> session -> param(organization_id => $organization_id);
my($orgs) = $self -> param('db') -> organization -> get_organization_list($self -> param('user_id'), $organization_id);
my($staff) = $self -> param('db') -> organization -> get_organizations_staff($organization_id);
my($notes) = $self -> param('db') -> note -> get_notes('organizations', $organization_id);
$response = $self -> param('view') -> organization -> build_tab_html($$orgs[0], $staff, $notes);
$response = $self -> param('db') -> library -> build_ok_xml($response);
lib/App/Office/Contacts/Controller/Exporter/Organization.pm view on Meta::CPAN
try
{
$self -> log(debug => "Controller::Exporter::Org.get_staff($organization_id, ...)");
$result = App::Office::Contacts::Util::Validator -> new
(
app => $self,
config => $self -> param('config'),
db => $self -> param('db'),
query => $self -> query,
) -> validate_organization_id;
if ($result -> success)
{
my($staff) = $self -> param('db') -> organization -> get_organizations_staff($organization_id);
$response = $self -> param('view') -> occupation -> format_staff($organization_id, $staff);
$response = $self -> param('db') -> library -> build_ok_xml($response);
}
else
{
$response = $self -> param('db') -> library -> build_error_xml
lib/App/Office/Contacts/Controller/Exporter/Person.pm view on Meta::CPAN
try
{
$self -> log(debug => "Controller::Exporter::Person.display($person_id)");
$result = App::Office::Contacts::Util::Validator -> new
(
app => $self,
config => $self -> param('config'),
db => $self -> param('db'),
query => $self -> query,
) -> validate_person_id;
if ($result -> success)
{
$self -> param('db') -> session -> param(person_id => $person_id);
my($persons) = $self -> param('db') -> person -> get_person_list($self -> param('user_id'), $person_id);
my($occupations) = $self -> param('db') -> person -> get_persons_occupations($person_id);
my($notes) = $self -> param('db') -> note -> get_notes('people', $person_id);
$response = $self -> param('view') -> person -> build_tab_html($$persons[0], $occupations, $notes);
$response = $self -> param('db') -> library -> build_ok_xml($response);
lib/App/Office/Contacts/Controller/Exporter/Person.pm view on Meta::CPAN
try
{
$self -> log(debug => "Controller::Exporter::Person.get_occupations($person_id, ...)");
$result = App::Office::Contacts::Util::Validator -> new
(
app => $self,
config => $self -> param('config'),
db => $self -> param('db'),
query => $self -> query,
) -> validate_person_id;
if ($result -> success)
{
my($occupations) = $self -> param('db') -> person -> get_persons_occupations($person_id);
$response = $self -> param('view') -> occupation -> format_occupations($person_id, $occupations);
$response = $self -> param('db') -> library -> build_ok_xml($response);
}
else
{
$response = $self -> param('db') -> library -> build_error_xml
lib/App/Office/Contacts/Database/Library.pm view on Meta::CPAN
$self -> db -> simple -> insert($table_name, $hashref)
|| die $self -> db -> simple -> error;
return $self -> db -> simple -> last_insert_id(undef, undef, $table_name, undef);
} # End of insert_hashref_get_id.
# --------------------------------------------------
sub validate_id
{
my($self, $table_name, $id) = @_;
my($result) = $self -> db -> simple -> query("select id from $table_name where id = ?", $id)
|| die $self -> db -> simple -> error;
# And list() implies there is just 1 matching record.
return ($result -> list)[0] || 0;
} # End of validate_id.
# --------------------------------------------------
sub validate_name
{
my($self, $table_name, $name) = @_;
my($result) = $self -> db -> simple -> query("select id from $table_name where name = ?", $name)
|| die $self -> db -> simple -> error;
# And list() implies there is just 1 matching record.
return ($result -> list)[0] || 0;
} # End of validate_name.
# --------------------------------------------------
1;
=head1 NAME
App::Office::Contacts::Database::Library - A web-based contacts manager
=head1 Synopsis
lib/App/Office/Contacts/Database/Library.pm view on Meta::CPAN
Returns a hashref in the form {$name => $id, ...}.
=head2 get_role_via_id($id)
Returns the name of the role with the given $id.
=head2 insert_hashref_get_id($table_name, $hashref)
Inserts $hashref into $table_name, and returns the id of the new record.
=head2 validate_id($table_name, $id)
Checks if the $table_name contains $id in the primary key column.
=head2 validate_name($table_name, $name)
Checks if the $table_name contains $name in the column called 'name'.
=head1 FAQ
See L<App::Office::Contacts/FAQ>.
=head1 Support
See L<App::Office::Contacts/Support>.
lib/App/Office/Contacts/Util/Validator.pm view on Meta::CPAN
my($verifier) = Data::Verifier -> new
(
filters => [qw(trim)],
profile =>
{
occupation_title =>
{
max_length => 250,
# We can't use a post_check because the occ title might not be on file yet.
# post_check => sub {return $self -> db -> library -> validate_id('occupation_titles', shift -> get_value('occupation_title') )},
required => 1,
type => 'Str',
},
organization_name =>
{
max_length => 250,
post_check => sub {return $self -> db -> library -> validate_name('organizations', shift -> get_value('organization_name') )},
required => 1,
type => 'Str',
},
person_id =>
{
post_check => sub {return $self -> check_person_id(shift -> get_value('person_id') )},
required => 1,
type => 'Int',
},
sid =>
lib/App/Office/Contacts/Util/Validator.pm view on Meta::CPAN
my($verifier) = Data::Verifier -> new
(
filters => [qw(trim)],
profile =>
{
occupation_title =>
{
max_length => 250,
# We can't use a post_check because the occ title might not be on file yet.
# post_check => sub {return $self -> db -> library -> validate_id('occupation_titles', shift -> get_value('occupation_title') )},
required => 1,
type => 'Str',
},
organization_id =>
{
post_check => sub {return $self -> check_organization_id(shift -> get_value('organization_id') )},
required => 1,
type => 'Int',
},
person_name =>
{
max_length => 250,
post_check => sub {return $self -> db -> library -> validate_name('people', shift -> get_value('person_name') )},
required => 1,
type => 'Str',
},
sid =>
{
post_check => sub {return $self -> check_sid(shift -> get_value('sid') )},
required => 1,
type => 'Str',
},
},
lib/App/Office/Contacts/Util/Validator.pm view on Meta::CPAN
sub check_organization_id
{
my($self, $organization_id) = @_; # Note: A max length of 10 is arbitrary.
$organization_id = clean_user_data($organization_id, 10, 1);
my($expected_id) = $self -> db -> session -> param('organization_id') || 0;
my($message) = "Error: Organization id is '$organization_id' but in the session it's '$expected_id'\n";
die $message if (! $expected_id);
my($org_id) = $self -> db -> library -> validate_id('organizations', $organization_id);
die "Error: Organization id is '$organization_id' but this is not on file\n" if ($org_id == 0);
die $message if ($organization_id != $expected_id);
# Return 1 for success as expected by Data::Verifier.
return 1;
} # End of check_organization_id.
# -----------------------------------------------
sub check_organization_name
{
my($self, $name) = @_;
die "That organization is already on file\n" if ($self -> db -> library -> validate_name('organizations', $name) > 0);
# Return 1 for success as expected by Data::Verifier.
return 1;
} # End of check_organization_name.
# -----------------------------------------------
sub check_person_id
{
my($self, $person_id) = @_; # Note: A max length of 10 is arbitrary.
$person_id = clean_user_data($person_id, 10, 1);
my($expected_id) = $self -> db -> session -> param('person_id') || 0;
my($message) = "Error: Person id is '$person_id' but in the session it's '$expected_id'\n";
die $message if (! $expected_id);
my($p_id) = $self -> db -> library -> validate_id('people', $person_id);
die "Error: Person id is '$person_id' but this is not on file\n" if ($p_id == 0);
die $message if ($person_id != $expected_id);
# Return 1 for success as expected by Data::Verifier.
return 1;
} # End of check_person_id.
# -----------------------------------------------
sub check_person_name
{
my($self, $name) = @_;
die "That person is already on file\n" if ($self -> db -> library -> validate_name('people', $name) > 0);
# Return 1 for success as expected by Data::Verifier.
return 1;
} # End of check_person_name.
# -----------------------------------------------
sub check_sid
lib/App/Office/Contacts/Util/Validator.pm view on Meta::CPAN
$self -> app -> log(debug => 'Util::Validator.delete_occupation()');
my($verifier) = Data::Verifier -> new
(
filters => [qw(trim)],
profile =>
{
occupation_id =>
{
post_check => sub {return $self -> db -> library -> validate_id('occupations', shift -> get_value('occupation_id') )},
required => 1,
type => 'Int',
},
# Can't validate organization's id because there may be no org displayed.
# And in that case, there will be no organization's id in the session.
#organization_id =>
#{
# post_check => sub {return $self -> check_organization_id(shift -> get_value('organization_id') )},
# required => 1,
# type => 'Int',
#},
person_id =>
{
post_check => sub {return $self -> check_person_id(shift -> get_value('person_id') )},
lib/App/Office/Contacts/Util/Validator.pm view on Meta::CPAN
$self -> app -> log(debug => 'Util::Validator.delete_staff()');
my($verifier) = Data::Verifier -> new
(
filters => [qw(trim)],
profile =>
{
occupation_id =>
{
post_check => sub {return $self -> db -> library -> validate_id('occupations', shift -> get_value('occupation_id') )},
required => 1,
type => 'Int',
},
organization_id =>
{
post_check => sub {return $self -> check_organization_id(shift -> get_value('organization_id') )},
required => 1,
type => 'Int',
},
# Can't validate person's id because there may be no person displayed.
# And in that case, there will be no person's id in the session.
#person_id =>
#{
# post_check => sub {return $self -> check_person_id(shift -> get_value('person_id') )},
# required => 1,
# type => 'Int',
#},
sid =>
{
post_check => sub {return $self -> check_sid(shift -> get_value('sid') )},
lib/App/Office/Contacts/Util/Validator.pm view on Meta::CPAN
# --------------------------------------------------
sub organization_profile
{
my($self) = @_;
return
{
communication_type_id =>
{
post_check => sub {return $self -> db -> library -> validate_id('communication_types', shift -> get_value('communication_type_id') )},
required => 1,
type => 'Int',
},
email_address_1 =>
{
dependent =>
{
email_address_type_id_1 =>
{
post_check => sub {return $self -> db -> library -> validate_id('email_address_types', shift -> get_value('email_address_type_id_1') )},
required => 1,
type => 'Int',
}
},
required => 0,
type => 'Str',
},
email_address_2 =>
{
dependent =>
{
email_address_type_id_2 =>
{
post_check => sub {return $self -> db -> library -> validate_id('email_address_types', shift -> get_value('email_address_type_id_2') )},
required => 1,
type => 'Int',
}
},
required => 0,
type => 'Str',
},
email_address_3 =>
{
dependent =>
{
email_address_type_id_3 =>
{
post_check => sub {return $self -> db -> library -> validate_id('email_address_types', shift -> get_value('email_address_type_id_3') )},
required => 1,
type => 'Int',
}
},
required => 0,
type => 'Str',
},
email_address_4 =>
{
dependent =>
{
email_address_type_id_4 =>
{
post_check => sub {return $self -> db -> library -> validate_id('email_address_types', shift -> get_value('email_address_type_id_4') )},
required => 1,
type => 'Int',
}
},
required => 0,
type => 'Str',
},
facebook_tag =>
{
max_length => 250,
lib/App/Office/Contacts/Util/Validator.pm view on Meta::CPAN
max_length => 250,
required => 1,
type => 'Str',
},
phone_number_1 =>
{
dependent =>
{
phone_number_type_id_1 =>
{
post_check => sub {return $self -> db -> library -> validate_id('phone_number_types', shift -> get_value('phone_number_type_id_1') )},
required => 1,
type => 'Int',
}
},
required => 0,
type => 'Str',
},
phone_number_2 =>
{
dependent =>
{
phone_number_type_id_2 =>
{
post_check => sub {return $self -> db -> library -> validate_id('phone_number_types', shift -> get_value('phone_number_type_id_2') )},
required => 1,
type => 'Int',
}
},
required => 0,
type => 'Str',
},
phone_number_3 =>
{
dependent =>
{
phone_number_type_id_3 =>
{
post_check => sub {return $self -> db -> library -> validate_id('phone_number_types', shift -> get_value('phone_number_type_id_3') )},
required => 1,
type => 'Int',
}
},
required => 0,
type => 'Str',
},
phone_number_4 =>
{
dependent =>
{
phone_number_type_id_4 =>
{
post_check => sub {return $self -> db -> library -> validate_id('phone_number_types', shift -> get_value('phone_number_type_id_4') )},
required => 1,
type => 'Int',
}
},
required => 0,
type => 'Str',
},
role_id =>
{
post_check => sub {return $self -> db -> library -> validate_id('roles', shift -> get_value('role_id') )},
required => 1,
type => 'Int',
},
sid =>
{
post_check => sub {return $self -> check_sid(shift -> get_value('sid') )},
required => 1,
type => 'Str',
},
twitter_tag =>
{
max_length => 250,
required => 0,
type => 'Str',
},
visibility_id =>
{
post_check => sub {return $self -> db -> library -> validate_id('visibilities', shift -> get_value('visibility_id') )},
required => 1,
type => 'Int',
},
};
} # End of organization_profile.
# --------------------------------------------------
sub person_profile
{
my($self) = @_;
return
{
communication_type_id =>
{
post_check => sub {return $self -> db -> library -> validate_id('communication_types', shift -> get_value('communication_type_id') )},
required => 1,
type => 'Int',
},
email_address_1 =>
{
dependent =>
{
email_address_type_id_1 =>
{
post_check => sub {return $self -> db -> library -> validate_id('email_address_types', shift -> get_value('email_address_type_id_1') )},
required => 1,
type => 'Int',
}
},
required => 0,
type => 'Str',
},
email_address_2 =>
{
dependent =>
{
email_address_type_id_2 =>
{
post_check => sub {return $self -> db -> library -> validate_id('email_address_types', shift -> get_value('email_address_type_id_2') )},
required => 1,
type => 'Int',
}
},
required => 0,
type => 'Str',
},
email_address_3 =>
{
dependent =>
{
email_address_type_id_3 =>
{
post_check => sub {return $self -> db -> library -> validate_id('email_address_types', shift -> get_value('email_address_type_id_3') )},
required => 1,
type => 'Int',
}
},
required => 0,
type => 'Str',
},
email_address_4 =>
{
dependent =>
{
email_address_type_id_4 =>
{
post_check => sub {return $self -> db -> library -> validate_id('email_address_types', shift -> get_value('email_address_type_id_4') )},
required => 1,
type => 'Int',
}
},
required => 0,
type => 'Str',
},
facebook_tag =>
{
max_length => 250,
required => 0,
type => 'Str',
},
gender_id =>
{
post_check => sub {return $self -> db -> library -> validate_id('genders', shift -> get_value('gender_id') )},
required => 1,
type => 'Int',
},
given_names =>
{
max_length => 250,
required => 1,
type => 'Str',
},
homepage =>
{
required => 0,
type => 'Str',
},
phone_number_1 =>
{
dependent =>
{
phone_number_type_id_1 =>
{
post_check => sub {return $self -> db -> library -> validate_id('phone_number_types', shift -> get_value('phone_number_type_id_1') )},
required => 1,
type => 'Int',
}
},
required => 0,
type => 'Str',
},
phone_number_2 =>
{
dependent =>
{
phone_number_type_id_2 =>
{
post_check => sub {return $self -> db -> library -> validate_id('phone_number_types', shift -> get_value('phone_number_type_id_2') )},
required => 1,
type => 'Int',
}
},
required => 0,
type => 'Str',
},
phone_number_3 =>
{
dependent =>
{
phone_number_type_id_3 =>
{
post_check => sub {return $self -> db -> library -> validate_id('phone_number_types', shift -> get_value('phone_number_type_id_3') )},
required => 1,
type => 'Int',
}
},
required => 0,
type => 'Str',
},
phone_number_4 =>
{
dependent =>
{
phone_number_type_id_4 =>
{
post_check => sub {return $self -> db -> library -> validate_id('phone_number_types', shift -> get_value('phone_number_type_id_4') )},
required => 1,
type => 'Int',
}
},
required => 0,
type => 'Str',
},
preferred_name =>
{
max_length => 250,
required => 0,
type => 'Str',
},
role_id =>
{
post_check => sub {return $self -> db -> library -> validate_id('roles', shift -> get_value('role_id') )},
required => 1,
type => 'Int',
},
sid =>
{
post_check => sub {return $self -> check_sid(shift -> get_value('sid') )},
required => 1,
type => 'Str',
},
surname =>
{
max_length => 250,
required => 1,
type => 'Str',
},
title_id =>
{
post_check => sub {return $self -> db -> library -> validate_id('titles', shift -> get_value('title_id') )},
required => 1,
type => 'Int',
},
twitter_tag =>
{
max_length => 250,
required => 0,
type => 'Str',
},
visibility_id =>
{
post_check => sub {return $self -> db -> library -> validate_id('visibilities', shift -> get_value('visibility_id') )},
required => 1,
type => 'Int',
},
};
} # End of person_profile.
# --------------------------------------------------
sub report
lib/App/Office/Contacts/Util/Validator.pm view on Meta::CPAN
$self -> app -> log(debug => 'Util::Validator.report()');
my($verifier) = Data::Verifier -> new
(
filters => [qw(trim)],
profile =>
{
communication_type_id =>
{
post_check => sub {return $self -> db -> library -> validate_id('communication_types', shift -> get_value('communication_type_id') )},
required => 1,
type => 'Int',
},
gender_id =>
{
post_check => sub {return $self -> db -> library -> validate_id('genders', shift -> get_value('gender_id') )},
required => 1,
type => 'Int',
},
ignore_communication_type =>
{
post_check => sub {return shift -> get_value('ignore_communication_type') =~ /^[01]$/ ? 1 : 0},
required => 0,
type => 'Int',
},
ignore_gender =>
lib/App/Office/Contacts/Util/Validator.pm view on Meta::CPAN
type => 'Int',
},
ignore_visibility =>
{
post_check => sub {return shift -> get_value('ignore_visibility') =~ /^[01]$/ ? 1 : 0},
required => 0,
type => 'Int',
},
report_id =>
{
post_check => sub {return $self -> db -> library -> validate_id('reports', shift -> get_value('report_id') )},
required => 1,
type => 'Int',
},
report_entity_id =>
{
post_check => sub {return $self -> db -> library -> validate_id('report_entities', shift -> get_value('report_entity_id') )},
required => 1,
type => 'Int',
},
role_id =>
{
post_check => sub {return $self -> db -> library -> validate_id('roles', shift -> get_value('role_id') )},
required => 1,
type => 'Int',
},
sid =>
{
post_check => sub {return $self -> check_sid(shift -> get_value('sid') )},
required => 1,
type => 'Str',
},
visibility_id =>
{
post_check => sub {return $self -> db -> library -> validate_id('visibilities', shift -> get_value('visibility_id') )},
required => 1,
type => 'Int',
},
},
);
my($result) = $verifier -> verify({$self -> query -> Vars});
$self -> log_result($result);
lib/App/Office/Contacts/Util/Validator.pm view on Meta::CPAN
my($result) = $verifier -> verify({$self -> query -> Vars});
$self -> log_result($result);
return $result;
} # End of update_person.
# --------------------------------------------------
sub validate_upload
{
my($self) = @_;
$self -> app -> log(debug => 'Util::Validator.validate_upload()');
my($verifier) = Data::Verifier -> new
(
filters => [qw(trim)],
profile =>
{ # TODO: This is a fake check, for the moment.
sid =>
{
post_check => sub {return 1},
required => 0,
lib/App/Office/Contacts/Util/Validator.pm view on Meta::CPAN
},
}
);
my($result) = $verifier -> verify({$self -> query -> Vars});
$self -> log_result($result);
return $result;
} # End of validate_upload.
# --------------------------------------------------
sub validate_organization_id
{
my($self) = @_;
$self -> app -> log(debug => 'Util::Validator.validate_organization_id()');
my($verifier) = Data::Verifier -> new
(
filters => [qw(trim)],
profile =>
{
organization_id =>
{
post_check => sub {return $self -> db -> library -> validate_id('organizations', shift -> get_value('organization_id') )},
required => 1,
type => 'Int',
},
sid =>
{
post_check => sub {return $self -> check_sid(shift -> get_value('sid') )},
required => 1,
type => 'Str',
},
}
);
my($result) = $verifier -> verify({$self -> query -> Vars});
$self -> log_result($result);
return $result;
} # End of validate_organization_id.
# --------------------------------------------------
sub validate_person_id
{
my($self) = @_;
$self -> app -> log(debug => 'Util::Validator.validate_person_id()');
my($verifier) = Data::Verifier -> new
(
filters => [qw(trim)],
profile =>
{
person_id =>
{
post_check => sub {return $self -> db -> library -> validate_id('people', shift -> get_value('person_id') )},
required => 1,
type => 'Int',
},
sid =>
{
post_check => sub {return $self -> check_sid(shift -> get_value('sid') )},
required => 1,
type => 'Str',
},
}
);
my($result) = $verifier -> verify({$self -> query -> Vars});
$self -> log_result($result);
return $result;
} # End of validate_person_id.
# --------------------------------------------------
1;
=head1 NAME
App::Office::Contacts::Util::Validator - A web-based contacts manager
=head1 Synopsis
lib/App/Office/Contacts/Util/Validator.pm view on Meta::CPAN
Validates CGI form parameters when updating a Note.
=head2 update_organization()
Validates CGI form parameters when updating an Organization.
=head2 update_person()
Validates CGI form parameters when updating a Person.
=head2 validate_organization_id()
Validates just the organization_id and the sid (Session Id within L<Data::Session> within
L<App::Office::Contacts::Database>).
=head2 validate_person_id()
Validates just the person_id and the sid (See L<App::Office::Contacts::Controller::Exporter::Person>).
=head2 validate_upload()
Validates CGI form parameters when uploading a file (see L<App::Office::Contacts::Import::vCards>).
=head1 FAQ
See L<App::Office::Contacts/FAQ>.
=head1 Support
See L<App::Office::Contacts/Support>.
lib/App/Office/Contacts/View/Occupation.pm view on Meta::CPAN
for my $field_name ($result -> valids)
{
$value = $result -> get_value($field_name);
if ($field_name eq 'occupation_title')
{
# Convert the occupation's title into an id.
$occupation_title = $value; # For the log.
my($occupation_title_id) = $self -> db -> library -> validate_name('occupation_titles', $value);
if ($occupation_title_id == 0)
{
$self -> db -> occupation -> save_occupation_title($value);
$occupation_title_id = $self -> db -> library -> validate_name('occupation_titles', $value);
}
$$occupation{occupation_title_id} = $occupation_title_id;
}
elsif ($field_name eq 'organization_id')
{
$$occupation{organization_id} = $value;
}
elsif ($field_name eq 'organization_name')
{
# Convert the organization's name into an id.
$$occupation{organization_id} = $self -> db -> library -> validate_name('organizations', $value);
}
elsif ($field_name eq 'person_id')
{
$$occupation{person_id} = $value;
}
elsif ($field_name eq 'person_name')
{
# Convert the persons's name into an id.
$$occupation{person_id} = $self -> db -> library -> validate_name('people', $value);
}
else # sid.
{
$$occupation{$field_name} = $value;
}
}
$self -> db -> logger -> log(debug => '-' x 50);
$self -> db -> logger -> log(debug => "Adding occupation '$occupation_title' ...");
$self -> db -> logger -> log(debug => "$_ => $$occupation{$_}") for sort keys %$occupation;