use C4::Context;
use C4::Auth;
use C4::Output;
+use C4::Form::MessagingPreferences;
sub StringSearch {
my ($searchstring,$type)=@_;
category_type => $data->{'category_type'},
"type_".$data->{'category_type'} => 1,
);
+ if (C4::Context->preference('EnhancedMessagingPreferences')) {
+ C4::Form::MessagingPreferences::set_form_values({ categorycode => $categorycode } , $template);
+ }
# END $OP eq ADD_FORM
################## ADD_VALIDATE ##################################
# called by add_form, used to insert/modify data in DB
$sth->execute(map { $input->param($_) } ('categorycode','description','enrolmentperiod','upperagelimit','dateofbirthrequired','enrolmentfee','reservefee','overduenoticerequired','category_type'));
$sth->finish;
}
+ if (C4::Context->preference('EnhancedMessagingPreferences')) {
+ C4::Form::MessagingPreferences::handle_form_action($input,
+ { categorycode => $input->param('categorycode') }, $template);
+ }
print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=categorie.pl\"></html>";
exit;
category_type => $results->[$i]{'category_type'},
"type_".$results->[$i]{'category_type'} => 1,
toggle => $toggle );
+ if (C4::Context->preference('EnhancedMessagingPreferences')) {
+ my $brief_prefs = _get_brief_messaging_prefs($results->[$i]{'categorycode'});
+ $row{messaging_prefs} = $brief_prefs if @$brief_prefs;
+ }
push @loop, \%row;
if ( $toggle eq 0 )
{
} #---- END $OP eq DEFAULT
output_html_with_http_headers $input, $cookie, $template->output;
+exit 0;
+
+sub _get_brief_messaging_prefs {
+ my $categorycode = shift;
+ my $messaging_options = C4::Members::Messaging::GetMessagingOptions();
+ my $results = [];
+ PREF: foreach my $option ( @$messaging_options ) {
+ my $pref = C4::Members::Messaging::GetMessagingPreferences( { categorycode => $categorycode,
+ message_name => $option->{'message_name'} } );
+ next unless @{$pref->{'transports'}};
+ my $brief_pref = { message_attribute_id => $option->{'message_attribute_id'},
+ message_name => $option->{'message_name'},
+ };
+ foreach my $transport ( @{$pref->{'transports'}} ) {
+ push @{ $brief_pref->{'transports'} }, { transport => $transport };
+ }
+ push @$results, $brief_pref;
+ }
+ return $results;
+}
</li></ol>
</fieldset>
+ <!-- TMPL_IF NAME="EnhancedMessagingPreferences" -->
+ <fieldset>
+ <h4>Default messaging preferences for this patron category</h4>
+ <!-- TMPL_INCLUDE NAME="messaging-preference-form.inc" -->
+ </fieldset>
+ <!-- /TMPL_IF -->
<fieldset class="action"><input type="button" value="Save" onclick="Check(this.form);" /> </fieldset>
</form>
<th scope="col">Enrollment fee</th>
<th scope="col">Overdue</th>
<th scope="col">Hold fee</th>
+ <!-- TMPL_IF NAME="EnhancedMessagingPreferences" -->
+ <th scope="col">Messaging</th>
+ <!-- /TMPL_IF -->
<th scope="col" colspan="2"> </th>
</tr>
<!-- TMPL_LOOP NAME="loop" -->
<td><!-- TMPL_VAR NAME="enrolmentfee" --></td>
<td><!-- TMPL_IF NAME="overduenoticerequired" -->Yes<!-- TMPL_ELSE -->No<!-- /TMPL_IF --></td>
<td><!-- TMPL_VAR NAME="reservefee" --></td>
+ <!-- TMPL_IF NAME="EnhancedMessagingPreferences" -->
+ <td>
+ <!-- TMPL_IF NAME="messaging_prefs" -->
+ <!-- TMPL_LOOP NAME="messaging_prefs" -->
+ <!-- TMPL_VAR NAME="message_name" --> :
+ <!-- TMPL_LOOP NAME="transports" -->
+ <!-- TMPL_VAR NAME="transport" -->
+ <!-- /TMPL_LOOP -->
+ <!-- /TMPL_LOOP -->
+ <br />
+ <!-- TMPL_ELSE -->
+ none
+ <!-- /TMPL_IF -->
+ </td>
+ <!-- /TMPL_IF -->
<td><a href="<!-- TMPL_VAR NAME="script_name" -->?op=add_form&categorycode=<!-- TMPL_VAR NAME="categorycode" escape="url" -->">Edit</a></td>
<td><a href="<!-- TMPL_VAR NAME="script_name" -->?op=delete_confirm&categorycode=<!-- TMPL_VAR NAME="categorycode" escape="url" -->">Delete</a></td>
</tr>