|
Lines 46-87
use C4::Output;
Link Here
|
| 46 |
use C4::Dates; |
46 |
use C4::Dates; |
| 47 |
use C4::Form::MessagingPreferences; |
47 |
use C4::Form::MessagingPreferences; |
| 48 |
|
48 |
|
| 49 |
sub StringSearch { |
49 |
sub StringSearch { |
| 50 |
my ($searchstring,$type)=@_; |
50 |
my ( $searchstring, $type ) = @_; |
| 51 |
my $dbh = C4::Context->dbh; |
51 |
my $dbh = C4::Context->dbh; |
| 52 |
$searchstring=~ s/\'/\\\'/g; |
52 |
$searchstring =~ s/\'/\\\'/g; |
| 53 |
my @data=split(' ',$searchstring); |
53 |
my @data = split( ' ', $searchstring ); |
| 54 |
my $count=@data; |
54 |
my $count = @data; |
| 55 |
my $sth=$dbh->prepare("Select * from categories where (description like ?) order by category_type,description,categorycode"); |
55 |
my $sth = $dbh->prepare("SELECT * FROM categories WHERE (description LIKE ?) ORDER BY category_type, description, categorycode"); |
| 56 |
$sth->execute("$data[0]%"); |
56 |
$sth->execute("$data[0]%"); |
| 57 |
my @results; |
57 |
my @results; |
| 58 |
while (my $data=$sth->fetchrow_hashref){ |
58 |
|
| 59 |
push(@results,$data); |
59 |
while ( my $data = $sth->fetchrow_hashref ) { |
| 60 |
} |
60 |
push( @results, $data ); |
| 61 |
# $sth->execute; |
61 |
} |
| 62 |
$sth->finish; |
|
|
| 63 |
return (scalar(@results),\@results); |
| 64 |
} |
| 65 |
|
62 |
|
| 66 |
my $input = new CGI; |
63 |
# $sth->execute; |
| 67 |
my $searchfield=$input->param('description'); |
64 |
$sth->finish; |
| 68 |
my $script_name="/cgi-bin/koha/admin/categorie.pl"; |
65 |
return ( scalar(@results), \@results ); |
| 69 |
my $categorycode=$input->param('categorycode'); |
66 |
} |
| 70 |
my $op = $input->param('op'); |
|
|
| 71 |
|
67 |
|
| 72 |
my ($template, $loggedinuser, $cookie) |
68 |
my $input = new CGI; |
| 73 |
= get_template_and_user({template_name => "admin/categorie.tmpl", |
69 |
my $searchfield = $input->param('description'); |
| 74 |
query => $input, |
70 |
my $script_name = "/cgi-bin/koha/admin/categorie.pl"; |
| 75 |
type => "intranet", |
71 |
my $categorycode = $input->param('categorycode'); |
| 76 |
authnotrequired => 0, |
72 |
my $op = $input->param('op'); |
| 77 |
flagsrequired => {parameters => 'parameters_remaining_permissions'}, |
73 |
my $block_expired = $input->param("block_expired"); |
| 78 |
debug => 1, |
|
|
| 79 |
}); |
| 80 |
|
74 |
|
|
|
75 |
my ( $template, $loggedinuser, $cookie ) = get_template_and_user( |
| 76 |
{ template_name => "admin/categorie.tmpl", |
| 77 |
query => $input, |
| 78 |
type => "intranet", |
| 79 |
authnotrequired => 0, |
| 80 |
flagsrequired => { parameters => 'parameters_remaining_permissions' }, |
| 81 |
debug => 1, |
| 82 |
} |
| 83 |
); |
| 81 |
|
84 |
|
| 82 |
$template->param(script_name => $script_name, |
85 |
$template->param( |
| 83 |
categorycode => $categorycode, |
86 |
script_name => $script_name, |
| 84 |
searchfield => $searchfield); |
87 |
categorycode => $categorycode, |
|
|
88 |
searchfield => $searchfield |
| 89 |
); |
| 85 |
|
90 |
|
| 86 |
|
91 |
|
| 87 |
################## ADD_FORM ################################## |
92 |
################## ADD_FORM ################################## |
|
Lines 94-103
if ($op eq 'add_form') {
Link Here
|
| 94 |
my @selected_branches; |
99 |
my @selected_branches; |
| 95 |
if ($categorycode) { |
100 |
if ($categorycode) { |
| 96 |
my $dbh = C4::Context->dbh; |
101 |
my $dbh = C4::Context->dbh; |
| 97 |
my $sth=$dbh->prepare("select categorycode,description,enrolmentperiod,enrolmentperioddate,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,hidelostitems,overduenoticerequired,category_type from categories where categorycode=?"); |
102 |
my $sth=$dbh->prepare(" |
|
|
103 |
SELECT * |
| 104 |
FROM categories |
| 105 |
WHERE categorycode = ? |
| 106 |
"); |
| 98 |
$sth->execute($categorycode); |
107 |
$sth->execute($categorycode); |
| 99 |
$data=$sth->fetchrow_hashref; |
108 |
$data = $sth->fetchrow_hashref; |
| 100 |
|
|
|
| 101 |
$sth = $dbh->prepare("SELECT b.branchcode, b.branchname FROM categories_branches AS cb, branches AS b WHERE cb.branchcode = b.branchcode AND cb.categorycode = ?"); |
109 |
$sth = $dbh->prepare("SELECT b.branchcode, b.branchname FROM categories_branches AS cb, branches AS b WHERE cb.branchcode = b.branchcode AND cb.categorycode = ?"); |
| 102 |
$sth->execute( $categorycode ); |
110 |
$sth->execute( $categorycode ); |
| 103 |
while ( my $branch = $sth->fetchrow_hashref ) { |
111 |
while ( my $branch = $sth->fetchrow_hashref ) { |
|
Lines 119-140
if ($op eq 'add_form') {
Link Here
|
| 119 |
}; |
127 |
}; |
| 120 |
} |
128 |
} |
| 121 |
|
129 |
|
| 122 |
$template->param(description => $data->{'description'}, |
130 |
$template->param( |
| 123 |
enrolmentperiod => $data->{'enrolmentperiod'}, |
131 |
description => $data->{'description'}, |
| 124 |
enrolmentperioddate => C4::Dates::format_date($data->{'enrolmentperioddate'}), |
132 |
enrolmentperiod => $data->{'enrolmentperiod'}, |
| 125 |
upperagelimit => $data->{'upperagelimit'}, |
133 |
enrolmentperioddate => C4::Dates::format_date( $data->{'enrolmentperioddate'} ), |
| 126 |
dateofbirthrequired => $data->{'dateofbirthrequired'}, |
134 |
upperagelimit => $data->{'upperagelimit'}, |
| 127 |
enrolmentfee => sprintf("%.2f",$data->{'enrolmentfee'}), |
135 |
dateofbirthrequired => $data->{'dateofbirthrequired'}, |
| 128 |
overduenoticerequired => $data->{'overduenoticerequired'}, |
136 |
enrolmentfee => sprintf( "%.2f", $data->{'enrolmentfee'} ), |
| 129 |
issuelimit => $data->{'issuelimit'}, |
137 |
overduenoticerequired => $data->{'overduenoticerequired'}, |
| 130 |
reservefee => sprintf("%.2f",$data->{'reservefee'}), |
138 |
issuelimit => $data->{'issuelimit'}, |
| 131 |
hidelostitems => $data->{'hidelostitems'}, |
139 |
reservefee => sprintf( "%.2f", $data->{'reservefee'} ), |
| 132 |
category_type => $data->{'category_type'}, |
140 |
hidelostitems => $data->{'hidelostitems'}, |
| 133 |
SMSSendDriver => C4::Context->preference("SMSSendDriver"), |
141 |
category_type => $data->{'category_type'}, |
| 134 |
TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification"), |
142 |
SMSSendDriver => C4::Context->preference("SMSSendDriver"), |
| 135 |
"type_".$data->{'category_type'} => 1, |
143 |
TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification"), |
| 136 |
branches_loop => \@branches_loop, |
144 |
branches_loop => \@branches_loop, |
| 137 |
); |
145 |
SMSSendDriver => C4::Context->preference("SMSSendDriver"), |
|
|
146 |
BlockExpiredPatronOpacActions => $data->{'BlockExpiredPatronOpacActions'}, |
| 147 |
"type_" . $data->{'category_type'} => 1, |
| 148 |
); |
| 149 |
|
| 138 |
if (C4::Context->preference('EnhancedMessagingPreferences')) { |
150 |
if (C4::Context->preference('EnhancedMessagingPreferences')) { |
| 139 |
C4::Form::MessagingPreferences::set_form_values({ categorycode => $categorycode } , $template); |
151 |
C4::Form::MessagingPreferences::set_form_values({ categorycode => $categorycode } , $template); |
| 140 |
} |
152 |
} |
|
Lines 148-166
if ($op eq 'add_form') {
Link Here
|
| 148 |
if($input->param('enrolmentperioddate')){ |
160 |
if($input->param('enrolmentperioddate')){ |
| 149 |
$input->param('enrolmentperioddate' => C4::Dates::format_date_in_iso($input->param('enrolmentperioddate')) ); |
161 |
$input->param('enrolmentperioddate' => C4::Dates::format_date_in_iso($input->param('enrolmentperioddate')) ); |
| 150 |
} |
162 |
} |
| 151 |
|
163 |
|
| 152 |
if ($is_a_modif) { |
164 |
if ($is_a_modif) { |
| 153 |
my $sth=$dbh->prepare("UPDATE categories SET description=?,enrolmentperiod=?, enrolmentperioddate=?,upperagelimit=?,dateofbirthrequired=?,enrolmentfee=?,reservefee=?,hidelostitems=?,overduenoticerequired=?,category_type=? WHERE categorycode=?"); |
165 |
my $sth=$dbh->prepare(" |
| 154 |
$sth->execute(map { $input->param($_) } ('description','enrolmentperiod','enrolmentperioddate','upperagelimit','dateofbirthrequired','enrolmentfee','reservefee','hidelostitems','overduenoticerequired','category_type','categorycode')); |
166 |
UPDATE categories |
|
|
167 |
SET description=?, |
| 168 |
enrolmentperiod=?, |
| 169 |
enrolmentperioddate=?, |
| 170 |
upperagelimit=?, |
| 171 |
dateofbirthrequired=?, |
| 172 |
enrolmentfee=?, |
| 173 |
reservefee=?, |
| 174 |
hidelostitems=?, |
| 175 |
overduenoticerequired=?, |
| 176 |
category_type=?, |
| 177 |
BlockExpiredPatronOpacActions=? |
| 178 |
WHERE categorycode=?" |
| 179 |
); |
| 180 |
$sth->execute( |
| 181 |
map { $input->param($_) } ( |
| 182 |
'description', |
| 183 |
'enrolmentperiod', |
| 184 |
'enrolmentperioddate', |
| 185 |
'upperagelimit', |
| 186 |
'dateofbirthrequired', |
| 187 |
'enrolmentfee', |
| 188 |
'reservefee', |
| 189 |
'hidelostitems', |
| 190 |
'overduenoticerequired', |
| 191 |
'category_type', |
| 192 |
'block_expired', |
| 193 |
'categorycode' |
| 194 |
) |
| 195 |
); |
| 155 |
my @branches = $input->param("branches"); |
196 |
my @branches = $input->param("branches"); |
| 156 |
if ( @branches ) { |
197 |
if ( @branches ) { |
| 157 |
$sth = $dbh->prepare("DELETE FROM categories_branches WHERE categorycode = ?"); |
198 |
$sth = $dbh->prepare("DELETE FROM categories_branches WHERE categorycode = ?"); |
| 158 |
$sth->execute( $input->param( "categorycode" ) ); |
199 |
$sth->execute( $input->param( "categorycode" ) ); |
| 159 |
$sth = $dbh->prepare( |
200 |
$sth = $dbh->prepare(" |
| 160 |
"INSERT INTO categories_branches |
201 |
INSERT INTO categories_branches ( categorycode, branchcode ) |
| 161 |
( categorycode, branchcode ) |
202 |
VALUES ( ?, ? ) |
| 162 |
VALUES ( ?, ? )" |
203 |
"); |
| 163 |
); |
|
|
| 164 |
for my $branchcode ( @branches ) { |
204 |
for my $branchcode ( @branches ) { |
| 165 |
next if not $branchcode; |
205 |
next if not $branchcode; |
| 166 |
$sth->bind_param( 1, $input->param( "categorycode" ) ); |
206 |
$sth->bind_param( 1, $input->param( "categorycode" ) ); |
|
Lines 169-200
if ($op eq 'add_form') {
Link Here
|
| 169 |
} |
209 |
} |
| 170 |
} |
210 |
} |
| 171 |
$sth->finish; |
211 |
$sth->finish; |
| 172 |
} else { |
212 |
} else { |
| 173 |
my $sth=$dbh->prepare("INSERT INTO categories (categorycode,description,enrolmentperiod,enrolmentperioddate,upperagelimit,dateofbirthrequired,enrolmentfee,reservefee,hidelostitems,overduenoticerequired,category_type) values (?,?,?,?,?,?,?,?,?,?,?)"); |
213 |
my $sth=$dbh->prepare(" |
| 174 |
$sth->execute(map { $input->param($_) } ('categorycode','description','enrolmentperiod','enrolmentperioddate','upperagelimit','dateofbirthrequired','enrolmentfee','reservefee','hidelostitems','overduenoticerequired','category_type')); |
214 |
INSERT INTO categories ( |
| 175 |
$sth->finish; |
215 |
categorycode, |
| 176 |
} |
216 |
description, |
| 177 |
if (C4::Context->preference('EnhancedMessagingPreferences')) { |
217 |
enrolmentperiod, |
| 178 |
C4::Form::MessagingPreferences::handle_form_action($input, |
218 |
enrolmentperioddate, |
| 179 |
{ categorycode => $input->param('categorycode') }, $template); |
219 |
upperagelimit, |
|
|
220 |
dateofbirthrequired, |
| 221 |
enrolmentfee, |
| 222 |
reservefee, |
| 223 |
hidelostitems, |
| 224 |
overduenoticerequired, |
| 225 |
category_type, |
| 226 |
BlockExpiredPatronOpacActions |
| 227 |
) |
| 228 |
VALUES (?,?,?,?,?,?,?,?,?,?,?,?)"); |
| 229 |
$sth->execute( |
| 230 |
map { $input->param($_) } ( |
| 231 |
'categorycode', |
| 232 |
'description', |
| 233 |
'enrolmentperiod', |
| 234 |
'enrolmentperioddate', |
| 235 |
'upperagelimit', |
| 236 |
'dateofbirthrequired', |
| 237 |
'enrolmentfee', |
| 238 |
'reservefee', |
| 239 |
'hidelostitems', |
| 240 |
'overduenoticerequired', |
| 241 |
'category_type', |
| 242 |
'block_expired' |
| 243 |
) |
| 244 |
); |
| 245 |
$sth->finish; |
| 246 |
} |
| 247 |
if ( C4::Context->preference('EnhancedMessagingPreferences') ) { |
| 248 |
C4::Form::MessagingPreferences::handle_form_action( $input, { categorycode => $input->param('categorycode') }, $template ); |
| 180 |
} |
249 |
} |
| 181 |
print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=categorie.pl\"></html>"; |
250 |
print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=categorie.pl\"></html>"; |
| 182 |
exit; |
251 |
exit; |
| 183 |
|
252 |
|
| 184 |
# END $OP eq ADD_VALIDATE |
253 |
# END $OP eq ADD_VALIDATE |
| 185 |
################## DELETE_CONFIRM ################################## |
254 |
################## DELETE_CONFIRM ################################## |
| 186 |
# called by default form, used to confirm deletion of data in DB |
255 |
# called by default form, used to confirm deletion of data in DB |
| 187 |
} elsif ($op eq 'delete_confirm') { |
256 |
} elsif ($op eq 'delete_confirm') { |
| 188 |
$template->param(delete_confirm => 1); |
257 |
$template->param(delete_confirm => 1); |
| 189 |
|
258 |
|
| 190 |
my $dbh = C4::Context->dbh; |
259 |
my $dbh = C4::Context->dbh; |
| 191 |
my $sth=$dbh->prepare("select count(*) as total from borrowers where categorycode=?"); |
260 |
my $sth=$dbh->prepare("SELECT count(*) AS total FROM borrowers WHERE categorycode = ?"); |
| 192 |
$sth->execute($categorycode); |
261 |
$sth->execute($categorycode); |
| 193 |
my $total = $sth->fetchrow_hashref; |
262 |
my $total = $sth->fetchrow_hashref; |
| 194 |
$sth->finish; |
263 |
$sth->finish; |
| 195 |
$template->param(total => $total->{'total'}); |
264 |
$template->param(total => $total->{'total'}); |
| 196 |
|
265 |
|
| 197 |
my $sth2=$dbh->prepare("select categorycode,description,enrolmentperiod,enrolmentperioddate,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,hidelostitems,overduenoticerequired,category_type from categories where categorycode=?"); |
266 |
my $sth2 = $dbh->prepare(" |
|
|
267 |
SELECT * |
| 268 |
FROM categories |
| 269 |
WHERE categorycode = ? |
| 270 |
"); |
| 198 |
$sth2->execute($categorycode); |
271 |
$sth2->execute($categorycode); |
| 199 |
my $data=$sth2->fetchrow_hashref; |
272 |
my $data=$sth2->fetchrow_hashref; |
| 200 |
$sth2->finish; |
273 |
$sth2->finish; |
|
Lines 202-219
if ($op eq 'add_form') {
Link Here
|
| 202 |
$template->param(totalgtzero => 1); |
275 |
$template->param(totalgtzero => 1); |
| 203 |
} |
276 |
} |
| 204 |
|
277 |
|
| 205 |
$template->param( description => $data->{'description'}, |
278 |
$template->param( |
| 206 |
enrolmentperiod => $data->{'enrolmentperiod'}, |
279 |
description => $data->{'description'}, |
| 207 |
enrolmentperioddate => C4::Dates::format_date($data->{'enrolmentperioddate'}), |
280 |
enrolmentperiod => $data->{'enrolmentperiod'}, |
| 208 |
upperagelimit => $data->{'upperagelimit'}, |
281 |
enrolmentperioddate => C4::Dates::format_date( $data->{'enrolmentperioddate'} ), |
| 209 |
dateofbirthrequired => $data->{'dateofbirthrequired'}, |
282 |
upperagelimit => $data->{'upperagelimit'}, |
| 210 |
enrolmentfee => sprintf("%.2f",$data->{'enrolmentfee'}), |
283 |
dateofbirthrequired => $data->{'dateofbirthrequired'}, |
| 211 |
overduenoticerequired => $data->{'overduenoticerequired'}, |
284 |
enrolmentfee => sprintf( "%.2f", $data->{'enrolmentfee'} ), |
| 212 |
issuelimit => $data->{'issuelimit'}, |
285 |
overduenoticerequired => $data->{'overduenoticerequired'}, |
| 213 |
reservefee => sprintf("%.2f",$data->{'reservefee'}), |
286 |
issuelimit => $data->{'issuelimit'}, |
| 214 |
hidelostitems => $data->{'hidelostitems'}, |
287 |
reservefee => sprintf( "%.2f", $data->{'reservefee'} ), |
| 215 |
category_type => $data->{'category_type'}, |
288 |
hidelostitems => $data->{'hidelostitems'}, |
| 216 |
); |
289 |
category_type => $data->{'category_type'}, |
|
|
290 |
BlockExpiredPatronOpacActions => $data->{'BlockExpiredPatronOpacActions'}, |
| 291 |
); |
| 217 |
# END $OP eq DELETE_CONFIRM |
292 |
# END $OP eq DELETE_CONFIRM |
| 218 |
################## DELETE_CONFIRMED ################################## |
293 |
################## DELETE_CONFIRMED ################################## |
| 219 |
# called by delete_confirm, used to effectively confirm deletion of data in DB |
294 |
# called by delete_confirm, used to effectively confirm deletion of data in DB |
|
Lines 229-279
if ($op eq 'add_form') {
Link Here
|
| 229 |
|
304 |
|
| 230 |
# END $OP eq DELETE_CONFIRMED |
305 |
# END $OP eq DELETE_CONFIRMED |
| 231 |
} else { # DEFAULT |
306 |
} else { # DEFAULT |
| 232 |
$template->param(else => 1); |
307 |
$template->param(else => 1); |
| 233 |
my @loop; |
308 |
my @loop; |
| 234 |
my ($count,$results)=StringSearch($searchfield,'web'); |
309 |
my ($count,$results) = StringSearch($searchfield,'web'); |
|
|
310 |
|
| 235 |
my $dbh = C4::Context->dbh; |
311 |
my $dbh = C4::Context->dbh; |
| 236 |
my $sth = $dbh->prepare("SELECT b.branchcode, b.branchname FROM categories_branches AS cb, branches AS b WHERE cb.branchcode = b.branchcode AND cb.categorycode = ?"); |
312 |
my $sth = $dbh->prepare(" |
| 237 |
for (my $i=0; $i < $count; $i++){ |
313 |
SELECT b.branchcode, |
|
|
314 |
b.branchname |
| 315 |
FROM categories_branches AS cb, |
| 316 |
branches AS b |
| 317 |
WHERE cb.branchcode = b.branchcode |
| 318 |
AND cb.categorycode = ? |
| 319 |
"); |
| 320 |
|
| 321 |
for (my $i=0; $i < $count; $i++){ |
| 238 |
$sth->execute( $results->[$i]{'categorycode'} ); |
322 |
$sth->execute( $results->[$i]{'categorycode'} ); |
|
|
323 |
|
| 239 |
my @selected_branches; |
324 |
my @selected_branches; |
| 240 |
while ( my $branch = $sth->fetchrow_hashref ) { |
325 |
while ( my $branch = $sth->fetchrow_hashref ) { |
| 241 |
push @selected_branches, $branch; |
326 |
push @selected_branches, $branch; |
| 242 |
} |
327 |
} |
| 243 |
my %row = ( |
328 |
|
| 244 |
categorycode => $results->[$i]{'categorycode'}, |
329 |
my %row = ( |
| 245 |
description => $results->[$i]{'description'}, |
330 |
categorycode => $results->[$i]{'categorycode'}, |
| 246 |
enrolmentperiod => $results->[$i]{'enrolmentperiod'}, |
331 |
description => $results->[$i]{'description'}, |
| 247 |
enrolmentperioddate => C4::Dates::format_date($results->[$i]{'enrolmentperioddate'}), |
332 |
enrolmentperiod => $results->[$i]{'enrolmentperiod'}, |
| 248 |
upperagelimit => $results->[$i]{'upperagelimit'}, |
333 |
enrolmentperioddate => C4::Dates::format_date($results->[$i]{'enrolmentperioddate'}), |
| 249 |
dateofbirthrequired => $results->[$i]{'dateofbirthrequired'}, |
334 |
upperagelimit => $results->[$i]{'upperagelimit'}, |
| 250 |
enrolmentfee => sprintf("%.2f",$results->[$i]{'enrolmentfee'}), |
335 |
dateofbirthrequired => $results->[$i]{'dateofbirthrequired'}, |
| 251 |
overduenoticerequired => $results->[$i]{'overduenoticerequired'}, |
336 |
enrolmentfee => sprintf("%.2f",$results->[$i]{'enrolmentfee'}), |
| 252 |
issuelimit => $results->[$i]{'issuelimit'}, |
337 |
overduenoticerequired => $results->[$i]{'overduenoticerequired'}, |
| 253 |
reservefee => sprintf("%.2f",$results->[$i]{'reservefee'}), |
338 |
issuelimit => $results->[$i]{'issuelimit'}, |
| 254 |
hidelostitems => $results->[$i]{'hidelostitems'}, |
339 |
reservefee => sprintf("%.2f",$results->[$i]{'reservefee'}), |
| 255 |
category_type => $results->[$i]{'category_type'}, |
340 |
hidelostitems => $results->[$i]{'hidelostitems'}, |
| 256 |
"type_".$results->[$i]{'category_type'} => 1, |
341 |
category_type => $results->[$i]{'category_type'}, |
| 257 |
branches => \@selected_branches, |
342 |
block_syspref => 1, |
|
|
343 |
branches => \@selected_branches, |
| 344 |
"type_".$results->[$i]{'category_type'} => 1, |
| 258 |
); |
345 |
); |
|
|
346 |
|
| 259 |
if (C4::Context->preference('EnhancedMessagingPreferences')) { |
347 |
if (C4::Context->preference('EnhancedMessagingPreferences')) { |
| 260 |
my $brief_prefs = _get_brief_messaging_prefs($results->[$i]{'categorycode'}); |
348 |
my $brief_prefs = _get_brief_messaging_prefs($results->[$i]{'categorycode'}); |
| 261 |
$row{messaging_prefs} = $brief_prefs if @$brief_prefs; |
349 |
$row{messaging_prefs} = $brief_prefs if @$brief_prefs; |
| 262 |
} |
350 |
} |
| 263 |
push @loop, \%row; |
|
|
| 264 |
} |
| 265 |
$template->param(loop => \@loop); |
| 266 |
# check that I (institution) and C (child) exists. otherwise => warning to the user |
| 267 |
$sth=$dbh->prepare("select category_type from categories where category_type='C'"); |
| 268 |
$sth->execute; |
| 269 |
my ($categoryChild) = $sth->fetchrow; |
| 270 |
$template->param(categoryChild => $categoryChild); |
| 271 |
$sth=$dbh->prepare("select category_type from categories where category_type='I'"); |
| 272 |
$sth->execute; |
| 273 |
my ($categoryInstitution) = $sth->fetchrow; |
| 274 |
$template->param(categoryInstitution => $categoryInstitution); |
| 275 |
$sth->finish; |
| 276 |
|
351 |
|
|
|
352 |
push @loop, \%row; |
| 353 |
} |
| 354 |
|
| 355 |
$template->param(loop => \@loop); |
| 356 |
# check that I (institution) and C (child) exists. otherwise => warning to the user |
| 357 |
|
| 358 |
$sth = $dbh->prepare("select category_type from categories where category_type='C'"); |
| 359 |
$sth->execute; |
| 360 |
my ($categoryChild) = $sth->fetchrow; |
| 361 |
$template->param(categoryChild => $categoryChild); |
| 362 |
|
| 363 |
$sth = $dbh->prepare("select category_type from categories where category_type='I'"); |
| 364 |
$sth->execute; |
| 365 |
my ($categoryInstitution) = $sth->fetchrow; |
| 366 |
$template->param(categoryInstitution => $categoryInstitution); |
| 367 |
$sth->finish; |
| 277 |
|
368 |
|
| 278 |
} #---- END $OP eq DEFAULT |
369 |
} #---- END $OP eq DEFAULT |
| 279 |
output_html_with_http_headers $input, $cookie, $template->output; |
370 |
output_html_with_http_headers $input, $cookie, $template->output; |