Lines 135-141
my $output_formats = [
Link Here
|
135 |
|
135 |
|
136 |
=head2 C4::Creators::Lib::get_all_templates() |
136 |
=head2 C4::Creators::Lib::get_all_templates() |
137 |
|
137 |
|
138 |
This function returns a reference to a hash containing all templates upon success and 1 upon failure. Errors are logged to the Apache log. |
138 |
This function returns a reference to a hash containing all templates upon success and undefined upon failure. Errors are logged to the Apache log. |
139 |
|
139 |
|
140 |
examples: |
140 |
examples: |
141 |
|
141 |
|
Lines 152-158
sub get_all_templates {
Link Here
|
152 |
$sth->execute(); |
152 |
$sth->execute(); |
153 |
if ($sth->err) { |
153 |
if ($sth->err) { |
154 |
warn sprintf('Database returned the following error: %s', $sth->errstr); |
154 |
warn sprintf('Database returned the following error: %s', $sth->errstr); |
155 |
return -1; |
155 |
return; |
156 |
} |
156 |
} |
157 |
ADD_TEMPLATES: |
157 |
ADD_TEMPLATES: |
158 |
while (my $template = $sth->fetchrow_hashref) { |
158 |
while (my $template = $sth->fetchrow_hashref) { |
Lines 163-169
sub get_all_templates {
Link Here
|
163 |
|
163 |
|
164 |
=head2 C4::Creators::Lib::get_all_layouts() |
164 |
=head2 C4::Creators::Lib::get_all_layouts() |
165 |
|
165 |
|
166 |
This function returns a reference to a hash containing all layouts upon success and 1 upon failure. Errors are logged to the Apache log. |
166 |
This function returns a reference to a hash containing all layouts upon success and undefined upon failure. Errors are logged to the Apache log. |
167 |
|
167 |
|
168 |
examples: |
168 |
examples: |
169 |
|
169 |
|
Lines 180-186
sub get_all_layouts {
Link Here
|
180 |
$sth->execute(); |
180 |
$sth->execute(); |
181 |
if ($sth->err) { |
181 |
if ($sth->err) { |
182 |
warn sprintf('Database returned the following error: %s', $sth->errstr); |
182 |
warn sprintf('Database returned the following error: %s', $sth->errstr); |
183 |
return -1; |
183 |
return; |
184 |
} |
184 |
} |
185 |
ADD_LAYOUTS: |
185 |
ADD_LAYOUTS: |
186 |
while (my $layout = $sth->fetchrow_hashref) { |
186 |
while (my $layout = $sth->fetchrow_hashref) { |
Lines 191-197
sub get_all_layouts {
Link Here
|
191 |
|
191 |
|
192 |
=head2 C4::Creators::Lib::get_all_profiles() |
192 |
=head2 C4::Creators::Lib::get_all_profiles() |
193 |
|
193 |
|
194 |
This function returns an arrayref whose elements are hashes containing all profiles upon success and 1 upon failure. Errors are logged |
194 |
This function returns an arrayref whose elements are hashes containing all profiles upon success and undefined upon failure. Errors are logged |
195 |
to the Apache log. Two parameters are accepted. The first limits the field(s) returned. This parameter should be string of comma separted |
195 |
to the Apache log. Two parameters are accepted. The first limits the field(s) returned. This parameter should be string of comma separted |
196 |
fields. ie. "field_1, field_2, ...field_n" The second limits the records returned based on a string containing a valud SQL 'WHERE' filter. |
196 |
fields. ie. "field_1, field_2, ...field_n" The second limits the records returned based on a string containing a valud SQL 'WHERE' filter. |
197 |
|
197 |
|
Lines 214-220
sub get_all_profiles {
Link Here
|
214 |
$sth->execute(); |
214 |
$sth->execute(); |
215 |
if ($sth->err) { |
215 |
if ($sth->err) { |
216 |
warn sprintf('Database returned the following error: %s', $sth->errstr); |
216 |
warn sprintf('Database returned the following error: %s', $sth->errstr); |
217 |
return -1; |
217 |
return; |
218 |
} |
218 |
} |
219 |
ADD_PROFILES: |
219 |
ADD_PROFILES: |
220 |
while (my $profile = $sth->fetchrow_hashref) { |
220 |
while (my $profile = $sth->fetchrow_hashref) { |
Lines 235-241
sub get_all_image_names {
Link Here
|
235 |
$sth->execute(); |
235 |
$sth->execute(); |
236 |
if ($sth->err) { |
236 |
if ($sth->err) { |
237 |
warn sprintf('Database returned the following error: %s', $sth->errstr); |
237 |
warn sprintf('Database returned the following error: %s', $sth->errstr); |
238 |
return -1; |
238 |
return; |
239 |
} |
239 |
} |
240 |
grep {push @$image_names, {type => $$_[0], name => $$_[0], selected => 0}} @{$sth->fetchall_arrayref([0])}; |
240 |
grep {push @$image_names, {type => $$_[0], name => $$_[0], selected => 0}} @{$sth->fetchall_arrayref([0])}; |
241 |
return $image_names; |
241 |
return $image_names; |
Lines 266-272
sub get_batch_summary {
Link Here
|
266 |
$sth->execute($params{'creator'}); |
266 |
$sth->execute($params{'creator'}); |
267 |
if ($sth->err) { |
267 |
if ($sth->err) { |
268 |
warn sprintf('Database returned the following error on attempted SELECT: %s', $sth->errstr); |
268 |
warn sprintf('Database returned the following error on attempted SELECT: %s', $sth->errstr); |
269 |
return -1; |
269 |
return; |
270 |
} |
270 |
} |
271 |
ADD_BATCHES: |
271 |
ADD_BATCHES: |
272 |
while (my $batch = $sth->fetchrow_hashref) { |
272 |
while (my $batch = $sth->fetchrow_hashref) { |
Lines 275-281
sub get_batch_summary {
Link Here
|
275 |
$sth1->execute($batch->{'batch_id'}, $params{'creator'}); |
275 |
$sth1->execute($batch->{'batch_id'}, $params{'creator'}); |
276 |
if ($sth1->err) { |
276 |
if ($sth1->err) { |
277 |
warn sprintf('Database returned the following error on attempted SELECT count: %s', $sth1->errstr); |
277 |
warn sprintf('Database returned the following error on attempted SELECT count: %s', $sth1->errstr); |
278 |
return -1; |
278 |
return; |
279 |
} |
279 |
} |
280 |
my $count = $sth1->fetchrow_arrayref; |
280 |
my $count = $sth1->fetchrow_arrayref; |
281 |
$batch->{'_item_count'} = @$count[0]; |
281 |
$batch->{'_item_count'} = @$count[0]; |
Lines 315-321
sub get_label_summary {
Link Here
|
315 |
$sth->execute($item->{'item_number'}, $params{'batch_id'}); |
315 |
$sth->execute($item->{'item_number'}, $params{'batch_id'}); |
316 |
if ($sth->err) { |
316 |
if ($sth->err) { |
317 |
warn sprintf('Database returned the following error on attempted SELECT: %s', $sth->errstr); |
317 |
warn sprintf('Database returned the following error on attempted SELECT: %s', $sth->errstr); |
318 |
return -1; |
318 |
return; |
319 |
} |
319 |
} |
320 |
my $record = $sth->fetchrow_hashref; |
320 |
my $record = $sth->fetchrow_hashref; |
321 |
my $label_summary; |
321 |
my $label_summary; |
Lines 361-367
sub get_card_summary {
Link Here
|
361 |
$sth->execute($item->{'borrower_number'}); |
361 |
$sth->execute($item->{'borrower_number'}); |
362 |
if ($sth->err) { |
362 |
if ($sth->err) { |
363 |
warn sprintf('Database returned the following error on attempted SELECT: %s', $sth->errstr); |
363 |
warn sprintf('Database returned the following error on attempted SELECT: %s', $sth->errstr); |
364 |
return -1; |
364 |
return; |
365 |
} |
365 |
} |
366 |
my $record = $sth->fetchrow_hashref; |
366 |
my $record = $sth->fetchrow_hashref; |
367 |
my $card_summary->{'_card_number'} = $card_number; |
367 |
my $card_summary->{'_card_number'} = $card_number; |
Lines 535-541
sub get_table_names {
Link Here
|
535 |
sub html_table { |
535 |
sub html_table { |
536 |
my $headers = shift; |
536 |
my $headers = shift; |
537 |
my $data = shift; |
537 |
my $data = shift; |
538 |
return undef if scalar(@$data) == 0; # no need to generate a table if there is not data to display |
538 |
# no need to generate a table if there is not data to display |
|
|
539 |
unless ( @{$data} ) { |
540 |
return; |
541 |
} |
539 |
my $table = []; |
542 |
my $table = []; |
540 |
my $fields = []; |
543 |
my $fields = []; |
541 |
my @table_columns = (); |
544 |
my @table_columns = (); |