|
Lines 29-34
use C4::Output;
Link Here
|
| 29 |
use C4::Dates qw/format_date/; |
29 |
use C4::Dates qw/format_date/; |
| 30 |
use C4::Debug; |
30 |
use C4::Debug; |
| 31 |
use C4::Branch; # XXX subfield_is_koha_internal_p |
31 |
use C4::Branch; # XXX subfield_is_koha_internal_p |
|
|
32 |
use C4::Koha qw/GetAuthorisedValueCategories/; |
| 32 |
|
33 |
|
| 33 |
=head1 NAME |
34 |
=head1 NAME |
| 34 |
|
35 |
|
|
Lines 549-562
elsif ($phase eq 'Run this report'){
Link Here
|
| 549 |
# split on ??. Each odd (2,4,6,...) entry should be a parameter to fill |
550 |
# split on ??. Each odd (2,4,6,...) entry should be a parameter to fill |
| 550 |
my @split = split /<<|>>/,$sql; |
551 |
my @split = split /<<|>>/,$sql; |
| 551 |
my @tmpl_parameters; |
552 |
my @tmpl_parameters; |
|
|
553 |
my @authval_errors; |
| 552 |
for(my $i=0;$i<($#split/2);$i++) { |
554 |
for(my $i=0;$i<($#split/2);$i++) { |
| 553 |
my ($text,$authorised_value) = split /\|/,$split[$i*2+1]; |
555 |
my ($text,$authorised_value) = split /\|/,$split[$i*2+1]; |
| 554 |
my $input; |
556 |
my $input; |
| 555 |
my $labelid; |
557 |
my $labelid; |
| 556 |
if ($authorised_value eq "date") { |
558 |
if ( not defined $authorised_value ) { |
| 557 |
$input = 'date'; |
559 |
# no authorised value input, provide a text box |
| 558 |
} |
560 |
$input = "text"; |
| 559 |
elsif ($authorised_value) { |
561 |
} elsif ( $authorised_value eq "date" ) { |
|
|
562 |
# require a date, provide a date picker |
| 563 |
$input = 'date'; |
| 564 |
} else { |
| 565 |
# defined $authorised_value, and not 'date' |
| 560 |
my $dbh=C4::Context->dbh; |
566 |
my $dbh=C4::Context->dbh; |
| 561 |
my @authorised_values; |
567 |
my @authorised_values; |
| 562 |
my %authorised_lib; |
568 |
my %authorised_lib; |
|
Lines 596-611
elsif ($phase eq 'Run this report'){
Link Here
|
| 596 |
|
602 |
|
| 597 |
#---- "true" authorised value |
603 |
#---- "true" authorised value |
| 598 |
} |
604 |
} |
| 599 |
else { |
605 |
else { |
| 600 |
my $authorised_values_sth = $dbh->prepare("SELECT authorised_value,lib FROM authorised_values WHERE category=? ORDER BY lib"); |
606 |
# Build a hash of authorised value categories |
| 601 |
|
607 |
my %authorised_value_categories = map { $_ => 1 } (GetAuthorisedValueCategories()); |
| 602 |
$authorised_values_sth->execute( $authorised_value); |
608 |
if ( exists $authorised_value_categories{$authorised_value}) { |
| 603 |
|
609 |
my $query = ' |
| 604 |
while ( my ( $value, $lib ) = $authorised_values_sth->fetchrow_array ) { |
610 |
SELECT authorised_value,lib |
| 605 |
push @authorised_values, $value; |
611 |
FROM authorised_values |
| 606 |
$authorised_lib{$value} = $lib; |
612 |
WHERE category=? |
| 607 |
# For item location, we show the code and the libelle |
613 |
ORDER BY lib |
| 608 |
$authorised_lib{$value} = $lib; |
614 |
'; |
|
|
615 |
my $authorised_values_sth = $dbh->prepare($query); |
| 616 |
$authorised_values_sth->execute( $authorised_value); |
| 617 |
|
| 618 |
while ( my ( $value, $lib ) = $authorised_values_sth->fetchrow_array ) { |
| 619 |
push @authorised_values, $value; |
| 620 |
$authorised_lib{$value} = $lib; |
| 621 |
# For item location, we show the code and the libelle |
| 622 |
$authorised_lib{$value} = $lib; |
| 623 |
} |
| 624 |
} else { |
| 625 |
# not exists $authorised_value_categories{$authorised_value}) |
| 626 |
push @authval_errors, {'entry' => $text, |
| 627 |
'auth_val' => $authorised_value }; |
| 628 |
# tell the template there's an error |
| 629 |
$template->param( auth_val_error => 1 ); |
| 630 |
# skip scrolling list creation and params push |
| 631 |
next; |
| 609 |
} |
632 |
} |
| 610 |
} |
633 |
} |
| 611 |
$labelid = $text; |
634 |
$labelid = $text; |
|
Lines 621-634
elsif ($phase eq 'Run this report'){
Link Here
|
| 621 |
-multiple => 0, |
644 |
-multiple => 0, |
| 622 |
-tabindex => 1, |
645 |
-tabindex => 1, |
| 623 |
); |
646 |
); |
| 624 |
} else { |
|
|
| 625 |
$input = "text"; |
| 626 |
} |
647 |
} |
|
|
648 |
|
| 627 |
push @tmpl_parameters, {'entry' => $text, 'input' => $input, 'labelid' => $labelid }; |
649 |
push @tmpl_parameters, {'entry' => $text, 'input' => $input, 'labelid' => $labelid }; |
| 628 |
} |
650 |
} |
| 629 |
$template->param('sql' => $sql, |
651 |
$template->param('sql' => $sql, |
| 630 |
'name' => $name, |
652 |
'name' => $name, |
| 631 |
'sql_params' => \@tmpl_parameters, |
653 |
'sql_params' => \@tmpl_parameters, |
|
|
654 |
'auth_val_errors' => \@authval_errors, |
| 632 |
'enter_params' => 1, |
655 |
'enter_params' => 1, |
| 633 |
'reports' => $report_id, |
656 |
'reports' => $report_id, |
| 634 |
); |
657 |
); |
| 635 |
- |
|
|