|
Lines 51-56
sub Init {
Link Here
|
| 51 |
# suggesteddate, when coming from the DB, needs to be formated |
51 |
# suggesteddate, when coming from the DB, needs to be formated |
| 52 |
$suggestion->{'suggesteddate'} = format_date( $suggestion->{'suggesteddate'} ); |
52 |
$suggestion->{'suggesteddate'} = format_date( $suggestion->{'suggesteddate'} ); |
| 53 |
} |
53 |
} |
|
|
54 |
|
| 54 |
foreach my $date (qw(rejecteddate accepteddate)) { |
55 |
foreach my $date (qw(rejecteddate accepteddate)) { |
| 55 |
$suggestion->{$date} = ( |
56 |
$suggestion->{$date} = ( |
| 56 |
( $suggestion->{$date} eq "0000-00-00" || $suggestion->{$date} eq "" ) |
57 |
( $suggestion->{$date} eq "0000-00-00" || $suggestion->{$date} eq "" ) |
|
Lines 58-70
sub Init {
Link Here
|
| 58 |
: format_date( $suggestion->{$date} ) |
59 |
: format_date( $suggestion->{$date} ) |
| 59 |
); |
60 |
); |
| 60 |
} |
61 |
} |
|
|
62 |
|
| 61 |
$suggestion->{'branchcode'} = C4::Context->userenv->{"branch"} unless ( $suggestion->{'branchcode'} ); |
63 |
$suggestion->{'branchcode'} = C4::Context->userenv->{"branch"} unless ( $suggestion->{'branchcode'} ); |
| 62 |
} |
64 |
} |
| 63 |
|
65 |
|
| 64 |
sub GetCriteriumDesc { |
66 |
sub GetCriteriumDesc { |
| 65 |
my ( $criteriumvalue, $displayby ) = @_; |
67 |
my ( $criteriumvalue, $displayby ) = @_; |
| 66 |
return ( $criteriumvalue eq 'ASKED' ? "Pending" : ucfirst( lc($criteriumvalue) ) ) if ( $displayby =~ /status/i ); |
|
|
| 67 |
return ( GetBranchName($criteriumvalue) ) if ( $displayby =~ /branchcode/ ); |
| 68 |
return ( GetSupportName($criteriumvalue) ) if ( $displayby =~ /itemtype/ ); |
68 |
return ( GetSupportName($criteriumvalue) ) if ( $displayby =~ /itemtype/ ); |
| 69 |
if ( $displayby =~ /suggestedby/ || $displayby =~ /managedby/ || $displayby =~ /acceptedby/ ) { |
69 |
if ( $displayby =~ /suggestedby/ || $displayby =~ /managedby/ || $displayby =~ /acceptedby/ ) { |
| 70 |
my $borr = C4::Members::GetMember( borrowernumber => $criteriumvalue ); |
70 |
my $borr = C4::Members::GetMember( borrowernumber => $criteriumvalue ); |
|
Lines 91-101
my $branchfilter = ( $displayby ne "branchcode" ) ? $input->param('branchco
Link Here
|
| 91 |
my $tabcode = $input->param('tabcode'); |
91 |
my $tabcode = $input->param('tabcode'); |
| 92 |
|
92 |
|
| 93 |
# filter informations which are not suggestion related. |
93 |
# filter informations which are not suggestion related. |
| 94 |
my $suggestion_ref = $input->Vars; |
94 |
my $input_vars = $input->Vars; |
| 95 |
|
95 |
|
| 96 |
delete $$suggestion_ref{$_} foreach qw( suggestedbyme op displayby tabcode edit_field ); |
96 |
delete $$input_vars{$_} foreach qw( suggestedbyme op displayby tabcode edit_field ); |
| 97 |
foreach ( keys %$suggestion_ref ) { |
97 |
foreach ( keys %$input_vars ) { |
| 98 |
delete $$suggestion_ref{$_} if ( !$$suggestion_ref{$_} && ( $op eq 'else' || $op eq 'change' ) ); |
98 |
delete $$input_vars{$_} if ( !$$input_vars{$_} && ( $op eq 'else' || $op eq 'change' ) ); |
| 99 |
} |
99 |
} |
| 100 |
my ( $template, $borrowernumber, $cookie, $userflags ) = get_template_and_user( |
100 |
my ( $template, $borrowernumber, $cookie, $userflags ) = get_template_and_user( |
| 101 |
{ template_name => "suggestion/suggestion.tmpl", |
101 |
{ template_name => "suggestion/suggestion.tmpl", |
|
Lines 109-179
my ( $template, $borrowernumber, $cookie, $userflags ) = get_template_and_user(
Link Here
|
| 109 |
## Operations |
109 |
## Operations |
| 110 |
## |
110 |
## |
| 111 |
if ( $op =~ /save/i ) { |
111 |
if ( $op =~ /save/i ) { |
| 112 |
if ( $$suggestion_ref{"STATUS"} ) { |
112 |
if ( $$input_vars{"STATUS"} ) { |
| 113 |
if ( my $tmpstatus = lc( $$suggestion_ref{"STATUS"} ) =~ /ACCEPTED|REJECTED/i ) { |
113 |
if ( my $tmpstatus = lc( $$input_vars{"STATUS"} ) =~ /ACCEPTED|REJECTED/i ) { |
| 114 |
$$suggestion_ref{ lc( $$suggestion_ref{"STATUS"} ) . "date" } = C4::Dates->today; |
114 |
$$input_vars{ lc( $$input_vars{"STATUS"} ) . "date" } = C4::Dates->today; |
| 115 |
$$suggestion_ref{ lc( $$suggestion_ref{"STATUS"} ) . "by" } = C4::Context->userenv->{number}; |
115 |
$$input_vars{ lc( $$input_vars{"STATUS"} ) . "by" } = C4::Context->userenv->{number}; |
| 116 |
} |
116 |
} |
| 117 |
$$suggestion_ref{"manageddate"} = C4::Dates->today; |
117 |
$$input_vars{"manageddate"} = C4::Dates->today; |
| 118 |
$$suggestion_ref{"managedby"} = C4::Context->userenv->{number}; |
118 |
$$input_vars{"managedby"} = C4::Context->userenv->{number}; |
| 119 |
} |
119 |
} |
| 120 |
if ( $$suggestion_ref{'suggestionid'} > 0 ) { |
120 |
if ( $$input_vars{'suggestionid'} > 0 ) { |
| 121 |
&ModSuggestion($suggestion_ref); |
121 |
&ModSuggestion($input_vars); |
| 122 |
} else { |
122 |
} else { |
| 123 |
###FIXME:Search here if suggestion already exists. |
123 |
###FIXME:Search here if suggestion already exists. |
| 124 |
my $suggestions_loop = SearchSuggestion($suggestion_ref); |
124 |
my $suggestions_loop = SearchSuggestion($input_vars); |
| 125 |
if ( @$suggestions_loop >= 1 ) { |
125 |
if ( @$suggestions_loop >= 1 ) { |
| 126 |
|
126 |
|
| 127 |
#some suggestion are answering the request Donot Add |
127 |
#some suggestion are answering the request Donot Add |
| 128 |
} else { |
128 |
} else { |
| 129 |
## Adding some informations related to suggestion |
129 |
## Adding some informations related to suggestion |
| 130 |
&NewSuggestion($suggestion_ref); |
130 |
&NewSuggestion($input_vars); |
| 131 |
} |
131 |
} |
| 132 |
|
132 |
|
| 133 |
# empty fields, to avoid filter in "SearchSuggestion" |
133 |
# empty fields, to avoid filter in "SearchSuggestion" |
| 134 |
} |
134 |
} |
| 135 |
map { delete $$suggestion_ref{$_} } keys %$suggestion_ref; |
135 |
map { delete $$input_vars{$_} } keys %$input_vars; |
| 136 |
$op = 'else'; |
136 |
$op = 'else'; |
| 137 |
} elsif ( $op =~ /add/ ) { |
137 |
} elsif ( $op =~ /add/ ) { |
| 138 |
|
138 |
|
| 139 |
#Adds suggestion |
139 |
#Adds suggestion |
| 140 |
Init($suggestion_ref); |
140 |
Init($input_vars); |
| 141 |
$op = 'save'; |
141 |
$op = 'save'; |
| 142 |
} elsif ( $op =~ /edit/ ) { |
142 |
} elsif ( $op =~ /edit/ ) { |
| 143 |
|
143 |
|
| 144 |
#Edit suggestion |
144 |
#Edit suggestion |
| 145 |
$suggestion_ref = &GetSuggestion( $$suggestion_ref{'suggestionid'} ); |
145 |
$input_vars = &GetSuggestion( $$input_vars{'suggestionid'} ); |
| 146 |
Init($suggestion_ref); |
146 |
Init($input_vars); |
| 147 |
$op = 'save'; |
147 |
$op = 'save'; |
| 148 |
} elsif ( $op eq "change" ) { |
148 |
} elsif ( $op eq "change" ) { |
| 149 |
|
149 |
|
| 150 |
# set accepted/rejected/managed informations if applicable |
150 |
# set accepted/rejected/managed informations if applicable |
| 151 |
# ie= if the librarian has choosen some action on the suggestions |
151 |
# ie= if the librarian has choosen some action on the suggestions |
| 152 |
if ( $$suggestion_ref{"STATUS"} eq "ACCEPTED" ) { |
152 |
if ( $$input_vars{"STATUS"} eq "ACCEPTED" ) { |
| 153 |
$$suggestion_ref{"accepteddate"} = C4::Dates->today; |
153 |
$$input_vars{"accepteddate"} = C4::Dates->today; |
| 154 |
$$suggestion_ref{"acceptedby"} = C4::Context->userenv->{number}; |
154 |
$$input_vars{"acceptedby"} = C4::Context->userenv->{number}; |
| 155 |
} elsif ( $$suggestion_ref{"STATUS"} eq "REJECTED" ) { |
155 |
} elsif ( $$input_vars{"STATUS"} eq "REJECTED" ) { |
| 156 |
$$suggestion_ref{"rejecteddate"} = C4::Dates->today; |
156 |
$$input_vars{"rejecteddate"} = C4::Dates->today; |
| 157 |
$$suggestion_ref{"rejectedby"} = C4::Context->userenv->{number}; |
157 |
$$input_vars{"rejectedby"} = C4::Context->userenv->{number}; |
| 158 |
} |
158 |
} |
| 159 |
if ( $$suggestion_ref{"STATUS"} ) { |
159 |
if ( $$input_vars{"STATUS"} ) { |
| 160 |
$$suggestion_ref{"manageddate"} = C4::Dates->today; |
160 |
$$input_vars{"manageddate"} = C4::Dates->today; |
| 161 |
$$suggestion_ref{"managedby"} = C4::Context->userenv->{number}; |
161 |
$$input_vars{"managedby"} = C4::Context->userenv->{number}; |
| 162 |
} |
162 |
} |
| 163 |
if ( my $reason = $$suggestion_ref{"reason$tabcode"} ) { |
163 |
if ( my $reason = $$input_vars{"reason$tabcode"} ) { |
| 164 |
if ( $reason eq "other" ) { |
164 |
if ( $reason eq "other" ) { |
| 165 |
$reason = $$suggestion_ref{"other_reason$tabcode"}; |
165 |
$reason = $$input_vars{"other_reason$tabcode"}; |
| 166 |
} |
166 |
} |
| 167 |
$$suggestion_ref{'reason'} = $reason; |
167 |
$$input_vars{'reason'} = $reason; |
| 168 |
} |
168 |
} |
| 169 |
delete $$suggestion_ref{$_} foreach ( "reason$tabcode", "other_reason$tabcode" ); |
169 |
delete $$input_vars{$_} foreach ( "reason$tabcode", "other_reason$tabcode" ); |
| 170 |
foreach ( keys %$suggestion_ref ) { |
170 |
foreach ( keys %$input_vars ) { |
| 171 |
delete $$suggestion_ref{$_} unless ( $$suggestion_ref{$_} ); |
171 |
delete $$input_vars{$_} unless ( $$input_vars{$_} ); |
| 172 |
} |
172 |
} |
| 173 |
foreach my $suggestionid (@editsuggestions) { |
173 |
foreach my $suggestionid (@editsuggestions) { |
| 174 |
next unless $suggestionid; |
174 |
next unless $suggestionid; |
| 175 |
$$suggestion_ref{'suggestionid'} = $suggestionid; |
175 |
$$input_vars{'suggestionid'} = $suggestionid; |
| 176 |
&ModSuggestion($suggestion_ref); |
176 |
&ModSuggestion($input_vars); |
| 177 |
} |
177 |
} |
| 178 |
$op = 'else'; |
178 |
$op = 'else'; |
| 179 |
} elsif ( $op eq "delete" ) { |
179 |
} elsif ( $op eq "delete" ) { |
|
Lines 182-198
if ( $op =~ /save/i ) {
Link Here
|
| 182 |
} |
182 |
} |
| 183 |
$op = 'else'; |
183 |
$op = 'else'; |
| 184 |
} elsif ( $op eq 'show' ) { |
184 |
} elsif ( $op eq 'show' ) { |
| 185 |
$suggestion_ref = &GetSuggestion( $$suggestion_ref{'suggestionid'} ); |
185 |
$input_vars = &GetSuggestion( $$input_vars{'suggestionid'} ); |
| 186 |
$$suggestion_ref{branchname} = GetBranchName $$suggestion_ref{branchcode}; |
186 |
$$input_vars{branchname} = GetBranchName $$input_vars{branchcode}; |
| 187 |
my $budget = GetBudget $$suggestion_ref{budgetid}; |
187 |
my $budget = GetBudget $$input_vars{budgetid}; |
| 188 |
$$suggestion_ref{budgetname} = $$budget{budget_name}; |
188 |
$$input_vars{budgetname} = $$budget{budget_name}; |
| 189 |
Init($suggestion_ref); |
189 |
Init($input_vars); |
| 190 |
} |
190 |
} |
| 191 |
if ( $op =~ /else/ ) { |
191 |
if ( $op =~ /else/ ) { |
| 192 |
$op = 'else'; |
192 |
$op = 'else'; |
| 193 |
|
193 |
|
| 194 |
$displayby ||= "STATUS"; |
194 |
$displayby ||= "STATUS"; |
| 195 |
delete $$suggestion_ref{'branchcode'} if ( $displayby eq "branchcode" ); |
195 |
delete $$input_vars{'branchcode'} if ( $displayby eq "branchcode" ); |
| 196 |
my $criteria_list = GetDistinctValues( "suggestions." . $displayby ); |
196 |
my $criteria_list = GetDistinctValues( "suggestions." . $displayby ); |
| 197 |
my @allsuggestions; |
197 |
my @allsuggestions; |
| 198 |
my $reasonsloop = GetAuthorisedValues("SUGGEST"); |
198 |
my $reasonsloop = GetAuthorisedValues("SUGGEST"); |
|
Lines 200-213
if ( $op =~ /else/ ) {
Link Here
|
| 200 |
|
200 |
|
| 201 |
# By default, display suggestions from current working branch |
201 |
# By default, display suggestions from current working branch |
| 202 |
if ( not defined $branchfilter ) { |
202 |
if ( not defined $branchfilter ) { |
| 203 |
$$suggestion_ref{'branchcode'} = C4::Context->userenv->{'branch'}; |
203 |
$$input_vars{'branchcode'} = C4::Context->userenv->{'branch'}; |
| 204 |
} |
204 |
} |
| 205 |
my $definedvalue = defined $$suggestion_ref{$displayby} && $$suggestion_ref{$displayby} ne ""; |
205 |
my $definedvalue = defined $$input_vars{$displayby} && $$input_vars{$displayby} ne ""; |
| 206 |
|
206 |
|
| 207 |
next if ( $definedvalue && $$suggestion_ref{$displayby} ne $criteriumvalue ); |
207 |
next if ( $definedvalue && $$input_vars{$displayby} ne $criteriumvalue ); |
| 208 |
$$suggestion_ref{$displayby} = $criteriumvalue; |
208 |
$$input_vars{$displayby} = $criteriumvalue; |
| 209 |
|
209 |
|
| 210 |
my $suggestions = &SearchSuggestion($suggestion_ref); |
210 |
my $suggestions = &SearchSuggestion($input_vars); |
| 211 |
foreach my $suggestion (@$suggestions) { |
211 |
foreach my $suggestion (@$suggestions) { |
| 212 |
if ( $suggestion->{budgetid} ) { |
212 |
if ( $suggestion->{budgetid} ) { |
| 213 |
my $bud = GetBudget( $suggestion->{budgetid} ); |
213 |
my $bud = GetBudget( $suggestion->{budgetid} ); |
|
Lines 223-235
if ( $op =~ /else/ ) {
Link Here
|
| 223 |
} |
223 |
} |
| 224 |
push @allsuggestions, |
224 |
push @allsuggestions, |
| 225 |
{ "suggestiontype" => $criteriumvalue || "suggest", |
225 |
{ "suggestiontype" => $criteriumvalue || "suggest", |
| 226 |
"suggestiontypelabel" => GetCriteriumDesc( $criteriumvalue, $displayby ) || "", |
226 |
'suggestions_loop' => $suggestions, |
| 227 |
"suggestionscount" => scalar(@$suggestions), |
227 |
'reasonsloop' => $reasonsloop, |
| 228 |
'suggestions_loop' => $suggestions, |
|
|
| 229 |
'reasonsloop' => $reasonsloop, |
| 230 |
}; |
228 |
}; |
| 231 |
|
229 |
|
| 232 |
delete $$suggestion_ref{$displayby} unless $definedvalue; |
230 |
delete $$input_vars{$displayby} unless $definedvalue; |
| 233 |
} |
231 |
} |
| 234 |
|
232 |
|
| 235 |
$template->param( |
233 |
$template->param( |
|
Lines 241-249
if ( $op =~ /else/ ) {
Link Here
|
| 241 |
|
239 |
|
| 242 |
foreach my $element (qw(managedby suggestedby acceptedby)) { |
240 |
foreach my $element (qw(managedby suggestedby acceptedby)) { |
| 243 |
|
241 |
|
| 244 |
# $debug || warn $$suggestion_ref{$element}; |
242 |
# $debug || warn $$input_vars{$element}; |
| 245 |
if ( $$suggestion_ref{$element} ) { |
243 |
if ( $$input_vars{$element} ) { |
| 246 |
my $member = GetMember( borrowernumber => $$suggestion_ref{$element} ); |
244 |
my $member = GetMember( borrowernumber => $$input_vars{$element} ); |
| 247 |
$template->param( |
245 |
$template->param( |
| 248 |
$element . "_borrowernumber" => $$member{borrowernumber}, |
246 |
$element . "_borrowernumber" => $$member{borrowernumber}, |
| 249 |
$element . "_firstname" => $$member{firstname}, |
247 |
$element . "_firstname" => $$member{firstname}, |
|
Lines 255-261
foreach my $element (qw(managedby suggestedby acceptedby)) {
Link Here
|
| 255 |
} |
253 |
} |
| 256 |
} |
254 |
} |
| 257 |
$template->param( |
255 |
$template->param( |
| 258 |
%$suggestion_ref, |
256 |
%$input_vars, |
| 259 |
"op_$op" => 1, |
257 |
"op_$op" => 1, |
| 260 |
dateformat => C4::Context->preference("dateformat"), |
258 |
dateformat => C4::Context->preference("dateformat"), |
| 261 |
"op" => $op, |
259 |
"op" => $op, |
|
Lines 282-288
foreach my $thisbranch ( sort { $branches->{$a}->{'branchname'} cmp $branches->{
Link Here
|
| 282 |
value => $thisbranch, |
280 |
value => $thisbranch, |
| 283 |
branchname => $branches->{$thisbranch}->{'branchname'}, |
281 |
branchname => $branches->{$thisbranch}->{'branchname'}, |
| 284 |
selected => ( $branchfilter and $branches->{$thisbranch}->{'branchcode'} eq $branchfilter ) |
282 |
selected => ( $branchfilter and $branches->{$thisbranch}->{'branchcode'} eq $branchfilter ) |
| 285 |
|| ( $$suggestion_ref{'branchcode'} and $branches->{$thisbranch}->{'branchcode'} eq $$suggestion_ref{'branchcode'} ) |
283 |
|| ( $$input_vars{'branchcode'} and $branches->{$thisbranch}->{'branchcode'} eq $$input_vars{'branchcode'} ) |
| 286 |
); |
284 |
); |
| 287 |
push @branchloop, \%row; |
285 |
push @branchloop, \%row; |
| 288 |
} |
286 |
} |
|
Lines 298-305
my $supportlist = GetSupportList();
Link Here
|
| 298 |
|
296 |
|
| 299 |
foreach my $support (@$supportlist) { |
297 |
foreach my $support (@$supportlist) { |
| 300 |
$$support{'selected'} = |
298 |
$$support{'selected'} = |
| 301 |
( defined $$suggestion_ref{'itemtype'} ) |
299 |
( defined $$input_vars{'itemtype'} ) |
| 302 |
? $$support{'itemtype'} eq $$suggestion_ref{'itemtype'} |
300 |
? $$support{'itemtype'} eq $$input_vars{'itemtype'} |
| 303 |
: 0; |
301 |
: 0; |
| 304 |
if ( $$support{'imageurl'} ) { |
302 |
if ( $$support{'imageurl'} ) { |
| 305 |
$$support{'imageurl'} = getitemtypeimagelocation( 'intranet', $$support{'imageurl'} ); |
303 |
$$support{'imageurl'} = getitemtypeimagelocation( 'intranet', $$support{'imageurl'} ); |
|
Lines 310-316
foreach my $support (@$supportlist) {
Link Here
|
| 310 |
$template->param( itemtypeloop => $supportlist ); |
308 |
$template->param( itemtypeloop => $supportlist ); |
| 311 |
$template->param( returnsuggestedby => $returnsuggestedby ); |
309 |
$template->param( returnsuggestedby => $returnsuggestedby ); |
| 312 |
|
310 |
|
| 313 |
my $patron_reason_loop = GetAuthorisedValues( "OPAC_SUG", $$suggestion_ref{'patronreason'} ); |
311 |
my $patron_reason_loop = GetAuthorisedValues( "OPAC_SUG", $$input_vars{'patronreason'} ); |
| 314 |
$template->param( patron_reason_loop => $patron_reason_loop ); |
312 |
$template->param( patron_reason_loop => $patron_reason_loop ); |
| 315 |
|
313 |
|
| 316 |
#Budgets management |
314 |
#Budgets management |
|
Lines 328-349
foreach my $budget ( @{$budgets} ) {
Link Here
|
| 328 |
|
326 |
|
| 329 |
## Please see file perltidy.ERR |
327 |
## Please see file perltidy.ERR |
| 330 |
$budget->{'selected'} = 1 |
328 |
$budget->{'selected'} = 1 |
| 331 |
if ( $$suggestion_ref{'budgetid'} |
329 |
if ( $$input_vars{'budgetid'} |
| 332 |
&& $budget->{'budget_id'} eq $$suggestion_ref{'budgetid'} ); |
330 |
&& $budget->{'budget_id'} eq $$input_vars{'budgetid'} ); |
| 333 |
|
331 |
|
| 334 |
push @budgets_loop, $budget; |
332 |
push @budgets_loop, $budget; |
| 335 |
} |
333 |
} |
| 336 |
|
334 |
|
| 337 |
$template->param( budgetsloop => \@budgets_loop ); |
335 |
$template->param( budgetsloop => \@budgets_loop ); |
| 338 |
$template->param( "statusselected_$$suggestion_ref{'STATUS'}" => 1 ) if ( $$suggestion_ref{'STATUS'} ); |
336 |
$template->param( "selected_status" => $$input_vars{'STATUS'} ) if ( $$input_vars{'STATUS'} ); |
| 339 |
|
337 |
|
| 340 |
# get currencies and rates |
338 |
# get currencies and rates |
| 341 |
my @rates = GetCurrencies(); |
339 |
my @rates = GetCurrencies(); |
| 342 |
my $count = scalar @rates; |
340 |
my $count = scalar @rates; |
| 343 |
my $active_currency = GetCurrency(); |
341 |
my $active_currency = GetCurrency(); |
| 344 |
my $selected_currency; |
342 |
my $selected_currency; |
| 345 |
if ( $$suggestion_ref{'currency'} ) { |
343 |
if ( $$input_vars{'currency'} ) { |
| 346 |
$selected_currency = $$suggestion_ref{'currency'}; |
344 |
$selected_currency = $$input_vars{'currency'}; |
| 347 |
} else { |
345 |
} else { |
| 348 |
$selected_currency = $active_currency->{currency}; |
346 |
$selected_currency = $active_currency->{currency}; |
| 349 |
} |
347 |
} |
|
Lines 360-381
for ( my $i = 0 ; $i < $count ; $i++ ) {
Link Here
|
| 360 |
$template->param( loop_currency => \@loop_currency ); |
358 |
$template->param( loop_currency => \@loop_currency ); |
| 361 |
|
359 |
|
| 362 |
$template->param( |
360 |
$template->param( |
| 363 |
price => sprintf( "%.2f", $$suggestion_ref{'price'} || 0 ), |
361 |
price => sprintf( "%.2f", $$input_vars{'price'} || 0 ), |
| 364 |
total => sprintf( "%.2f", $$suggestion_ref{'total'} || 0 ), |
362 |
total => sprintf( "%.2f", $$input_vars{'total'} || 0 ), |
| 365 |
); |
363 |
); |
| 366 |
|
364 |
|
| 367 |
my %hashlists; |
365 |
my %hashlists; |
| 368 |
foreach my $field (qw(managedby acceptedby suggestedby budgetid)) { |
366 |
foreach my $field (qw(managedby acceptedby suggestedby budgetid)) { |
| 369 |
my $values_list; |
367 |
my $values_list; |
| 370 |
$values_list = GetDistinctValues( "suggestions." . $field ); |
368 |
$values_list = GetDistinctValues( "suggestions." . $field ); |
| 371 |
my @codes_list = map { |
369 |
my @codes_list = |
| 372 |
{ 'code' => $$_{'value'}, |
370 |
map { { 'code' => $$_{'value'}, 'desc' => GetCriteriumDesc( $$_{'value'}, $field ), 'selected' => ( $$input_vars{$field} ) ? $$_{'value'} eq $$input_vars{$field} : 0, } } |
| 373 |
'desc' => GetCriteriumDesc( $$_{'value'}, $field ), |
371 |
@$values_list; |
| 374 |
'selected' => ( $$suggestion_ref{$field} ) ? $$_{'value'} eq $$suggestion_ref{$field} : 0, |
|
|
| 375 |
} |
| 376 |
} @$values_list; |
| 377 |
$hashlists{ lc($field) . "_loop" } = \@codes_list; |
372 |
$hashlists{ lc($field) . "_loop" } = \@codes_list; |
| 378 |
} |
373 |
} |
| 379 |
$template->param(%hashlists); |
374 |
$template->param(%hashlists); |
| 380 |
$template->param( DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), ); |
375 |
|
|
|
376 |
$template->param( |
| 377 |
DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), |
| 378 |
SuggestionStatuses => GetAuthorisedValues('SUGGEST_STATUS'), |
| 379 |
); |
| 380 |
|
| 381 |
output_html_with_http_headers $input, $cookie, $template->output; |
381 |
output_html_with_http_headers $input, $cookie, $template->output; |
| 382 |
- |
|
|