=head2 C4::Creators::Lib::get_all_templates()
- This function returns a reference to a hash containing all templates upon success and 1 upon failure. Errors are logged to the Apache log.
+ This function returns a reference to a hash containing all templates upon success and undefined upon failure. Errors are logged to the Apache log.
examples:
$sth->execute();
if ($sth->err) {
warn sprintf('Database returned the following error: %s', $sth->errstr);
- return -1;
+ return;
}
ADD_TEMPLATES:
while (my $template = $sth->fetchrow_hashref) {
=head2 C4::Creators::Lib::get_all_layouts()
- This function returns a reference to a hash containing all layouts upon success and 1 upon failure. Errors are logged to the Apache log.
+ This function returns a reference to a hash containing all layouts upon success and undefined upon failure. Errors are logged to the Apache log.
examples:
$sth->execute();
if ($sth->err) {
warn sprintf('Database returned the following error: %s', $sth->errstr);
- return -1;
+ return;
}
ADD_LAYOUTS:
while (my $layout = $sth->fetchrow_hashref) {
=head2 C4::Creators::Lib::get_all_profiles()
- This function returns an arrayref whose elements are hashes containing all profiles upon success and 1 upon failure. Errors are logged
+ This function returns an arrayref whose elements are hashes containing all profiles upon success and undefined upon failure. Errors are logged
to the Apache log. Two parameters are accepted. The first limits the field(s) returned. This parameter should be string of comma separted
fields. ie. "field_1, field_2, ...field_n" The second limits the records returned based on a string containing a valud SQL 'WHERE' filter.
$sth->execute();
if ($sth->err) {
warn sprintf('Database returned the following error: %s', $sth->errstr);
- return -1;
+ return;
}
ADD_PROFILES:
while (my $profile = $sth->fetchrow_hashref) {
$sth->execute();
if ($sth->err) {
warn sprintf('Database returned the following error: %s', $sth->errstr);
- return -1;
+ return;
}
grep {push @$image_names, {type => $$_[0], name => $$_[0], selected => 0}} @{$sth->fetchall_arrayref([0])};
return $image_names;
$sth->execute($params{'creator'});
if ($sth->err) {
warn sprintf('Database returned the following error on attempted SELECT: %s', $sth->errstr);
- return -1;
+ return;
}
ADD_BATCHES:
while (my $batch = $sth->fetchrow_hashref) {
$sth1->execute($batch->{'batch_id'}, $params{'creator'});
if ($sth1->err) {
warn sprintf('Database returned the following error on attempted SELECT count: %s', $sth1->errstr);
- return -1;
+ return;
}
my $count = $sth1->fetchrow_arrayref;
$batch->{'_item_count'} = @$count[0];
$sth->execute($item->{'item_number'}, $params{'batch_id'});
if ($sth->err) {
warn sprintf('Database returned the following error on attempted SELECT: %s', $sth->errstr);
- return -1;
+ return;
}
my $record = $sth->fetchrow_hashref;
my $label_summary;
$sth->execute($item->{'borrower_number'});
if ($sth->err) {
warn sprintf('Database returned the following error on attempted SELECT: %s', $sth->errstr);
- return -1;
+ return;
}
my $record = $sth->fetchrow_hashref;
my $card_summary->{'_card_number'} = $card_number;
sub html_table {
my $headers = shift;
my $data = shift;
- return undef if scalar(@$data) == 0; # no need to generate a table if there is not data to display
+ # no need to generate a table if there is not data to display
+ unless ( @{$data} ) {
+ return;
+ }
my $table = [];
my $fields = [];
my @table_columns = ();