|
Lines 54-80
sub show_type_disclaimer {
Link Here
|
| 54 |
|
54 |
|
| 55 |
my $disc_sys_pref = $self->_get_type_disclaimer_sys_pref; |
55 |
my $disc_sys_pref = $self->_get_type_disclaimer_sys_pref; |
| 56 |
|
56 |
|
| 57 |
my $disc_info = |
57 |
my $disc_info = $self->_get_type_disclaimer_info( |
| 58 |
$self->_get_type_disclaimer_info( $self->_get_type_disclaimer_sys_pref, |
58 |
$self->_get_type_disclaimer_sys_pref, |
| 59 |
$self->{metadata}->{type} ); |
59 |
$self->{metadata}->{type} |
|
|
60 |
); |
| 60 |
|
61 |
|
| 61 |
return |
62 |
return |
| 62 |
|
63 |
|
| 63 |
# ILLModuleDisclaimerByType contains correct YAML |
64 |
# ILLModuleDisclaimerByType contains correct YAML |
| 64 |
%{$disc_sys_pref} |
65 |
%{$disc_sys_pref} |
| 65 |
|
66 |
|
| 66 |
# Check that we have info to display for this type |
67 |
# Check that we have info to display for this type |
| 67 |
&& $disc_info |
68 |
&& $disc_info |
| 68 |
|
69 |
|
| 69 |
# ILLModuleDisclaimerByType contains at least 'all' |
70 |
# ILLModuleDisclaimerByType contains at least 'all' |
| 70 |
&& $disc_sys_pref->{all} |
71 |
&& $disc_sys_pref->{all} |
| 71 |
|
72 |
|
| 72 |
# Type disclaimer has not yet been submitted |
73 |
# Type disclaimer has not yet been submitted |
| 73 |
&& !$self->{metadata}->{type_disclaimer_submitted} |
74 |
&& !$self->{metadata}->{type_disclaimer_submitted} |
| 74 |
|
75 |
|
| 75 |
# The form has been submitted and the backend is able to create the request |
76 |
# The form has been submitted and the backend is able to create the request |
| 76 |
&& $request->_backend_capability( 'can_create_request', |
77 |
&& $request->_backend_capability( |
| 77 |
$self->{metadata} ); |
78 |
'can_create_request', |
|
|
79 |
$self->{metadata} |
| 80 |
); |
| 78 |
} |
81 |
} |
| 79 |
|
82 |
|
| 80 |
=head3 type_disclaimer_template_params |
83 |
=head3 type_disclaimer_template_params |
|
Lines 90-101
Given $params, return true if type disclaimer should be rendered
Link Here
|
| 90 |
sub type_disclaimer_template_params { |
93 |
sub type_disclaimer_template_params { |
| 91 |
my ( $self, $params ) = @_; |
94 |
my ( $self, $params ) = @_; |
| 92 |
|
95 |
|
| 93 |
my $disc_info = |
96 |
my $disc_info = $self->_get_type_disclaimer_info( |
| 94 |
$self->_get_type_disclaimer_info( $self->_get_type_disclaimer_sys_pref, |
97 |
$self->_get_type_disclaimer_sys_pref, |
| 95 |
$params->{type} ); |
98 |
$params->{type} |
|
|
99 |
); |
| 96 |
|
100 |
|
| 97 |
$params->{method} = 'typedisclaimer' if $self->{ui_context} eq 'staff'; |
101 |
$params->{method} = 'typedisclaimer' if $self->{ui_context} eq 'staff'; |
| 98 |
delete $params->{stage} if $self->{ui_context} eq 'staff'; |
102 |
delete $params->{stage} if $self->{ui_context} eq 'staff'; |
| 99 |
|
103 |
|
| 100 |
return ( |
104 |
return ( |
| 101 |
whole => $params, |
105 |
whole => $params, |
|
Lines 154-160
sub _get_type_disclaimer_info {
Link Here
|
| 154 |
my ( $self, $disc_sys_pref, $type ) = @_; |
158 |
my ( $self, $disc_sys_pref, $type ) = @_; |
| 155 |
|
159 |
|
| 156 |
my @matching_request_type = |
160 |
my @matching_request_type = |
| 157 |
map ( $_ eq $type ? $_ : (), keys %$disc_sys_pref ); |
161 |
map ( $_ eq $type ? $_ : (), keys %$disc_sys_pref ); |
| 158 |
|
162 |
|
| 159 |
my $disc_info = undef; |
163 |
my $disc_info = undef; |
| 160 |
if ( scalar @matching_request_type ) { |
164 |
if ( scalar @matching_request_type ) { |
|
Lines 162-169
sub _get_type_disclaimer_info {
Link Here
|
| 162 |
|
166 |
|
| 163 |
$disc_info->{text} = $disc_sys_pref->{$type}->{text}; |
167 |
$disc_info->{text} = $disc_sys_pref->{$type}->{text}; |
| 164 |
$disc_info->{av_cat} = $disc_sys_pref->{$type}->{av_category_code}; |
168 |
$disc_info->{av_cat} = $disc_sys_pref->{$type}->{av_category_code}; |
| 165 |
} |
169 |
} elsif ( $disc_sys_pref->{all} ) { |
| 166 |
elsif ( $disc_sys_pref->{all} ) { |
|
|
| 167 |
$disc_info->{text} = $disc_sys_pref->{all}->{text}; |
170 |
$disc_info->{text} = $disc_sys_pref->{all}->{text}; |
| 168 |
$disc_info->{av_cat} = $disc_sys_pref->{all}->{av_category_code}; |
171 |
$disc_info->{av_cat} = $disc_sys_pref->{all}->{av_category_code}; |
| 169 |
} |
172 |
} |