bug 3222: moved messaging preference editing
The display and editing of messaging preferences for a patron have been moved as follows: * the prefs for a patron are now displayed on the patron details tab, not the messaging tab. * the prefs are now modified by editing the patron record, not on the messaging tab. The messaging tab now contains only the list of messages that have been or will be sent to the patron. When creating a new patron record, changing the patron category via the category dropdown now also changes the default messaging preferences for that patron. If you start editing a new patron, change one of the messaging preferences, then change the patron category, the form will ask you if you want to keep the preferences or get the defaults belonging to the new patron category. Note that when you edit an existing patron record, changing the patron category will *not* cause the messaging preferences to be automatically changed. Programmer's note: this commit introduces a new web service, members/default_messagingprefs.pl, that uses Jesse Weaver's C4::Service module. Signed-off-by: Daniel Sweeney <daniel.sweeney@liblime.com> Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This commit is contained in:
parent
8e5eea5c4e
commit
b6e62489d8
|
|
@ -126,6 +126,7 @@ sub set_form_values {
|
|||
# make a hashref of the days, selecting one.
|
||||
if ( $option->{'takes_days'} ) {
|
||||
my $days_in_advance = $pref->{'days_in_advance'} ? $pref->{'days_in_advance'} : 0;
|
||||
$option->{days_in_advance} = $days_in_advance;
|
||||
@{$option->{'select_days'}} = map {; {
|
||||
day => $_,
|
||||
selected => $_ == $days_in_advance ? 'selected="selected"' :'' }
|
||||
|
|
|
|||
|
|
@ -18,12 +18,23 @@
|
|||
<input type="hidden" name="modify" value="yes" />
|
||||
<input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" />
|
||||
<table>
|
||||
<tr><th></th><th>Days in advance</th><!-- TMPL_IF NAME="SMSSendDriver" --><th>SMS</th><!-- /TMPL_IF --><th>Email</th><th>Digests only?</th><!-- <th>RSS</th> --><th>Do not notify</th></tr>
|
||||
<tr><th></th>
|
||||
<th>Days in advance</th>
|
||||
<!-- TMPL_IF NAME="SMSSendDriver" --><th>SMS</th><!-- /TMPL_IF -->
|
||||
<th>Email</th><th>Digests only?</th>
|
||||
<!-- <th>RSS</th> -->
|
||||
<!-- TMPL_UNLESS NAME="messaging_form_inactive" --><th>Do not notify</th><!-- /TMPL_UNLESS -->
|
||||
</tr>
|
||||
<!-- TMPL_LOOP name="messaging_preferences" -->
|
||||
<tr>
|
||||
<td><!-- TMPL_VAR NAME="message_name" --></td>
|
||||
<!-- TMPL_IF NAME="takes_days" -->
|
||||
<td><select name="<!-- TMPL_VAR NAME="message_attribute_id" -->-DAYS">
|
||||
<td>
|
||||
<!-- TMPL_IF NAME="messaging_form_inactive" -->
|
||||
<select name="<!-- TMPL_VAR NAME="message_attribute_id" -->-DAYS" disabled="disabled">
|
||||
<!-- TMPL_ELSE -->
|
||||
<select name="<!-- TMPL_VAR NAME="message_attribute_id" -->-DAYS">
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- TMPL_LOOP name="select_days" -->
|
||||
<!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR NAME="day" -->" selected="selected"><!-- TMPL_VAR NAME="day" --></option><!-- TMPL_ELSE -->
|
||||
<option value="<!-- TMPL_VAR NAME="day" -->"><!-- TMPL_VAR NAME="day" --></option>
|
||||
|
|
@ -35,46 +46,80 @@
|
|||
<td>-</td>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- TMPL_IF NAME="transport-sms" -->
|
||||
<!-- TMPL_IF NAME="SMSSendDriver" --><td><input type="checkbox"
|
||||
<!-- TMPL_IF NAME="SMSSendDriver" --><td>
|
||||
<!-- TMPL_IF NAME="messaging_form_inactive" -->
|
||||
<input type="checkbox"
|
||||
id="sms<!-- TMPL_VAR NAME="message_attribute_id" -->"
|
||||
name="<!-- TMPL_VAR NAME="message_attribute_id" -->"
|
||||
value="sms" <!-- TMPL_VAR NAME="transport-sms" --> disabled="disabled" />
|
||||
<!-- TMPL_ELSE -->
|
||||
<input type="checkbox"
|
||||
id="sms<!-- TMPL_VAR NAME="message_attribute_id" -->"
|
||||
name="<!-- TMPL_VAR NAME="message_attribute_id" -->"
|
||||
value="sms" <!-- TMPL_VAR NAME="transport-sms" --> onclick = "$('#none'+'<!-- TMPL_VAR NAME="message_attribute_id" -->').attr('checked','');" />
|
||||
<!-- /TMPL_IF -->
|
||||
</td><!-- /TMPL_IF -->
|
||||
<!-- TMPL_ELSE -->
|
||||
<td>-</td>
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
<!-- TMPL_IF NAME="transport-email" -->
|
||||
<td><input type="checkbox"
|
||||
<td>
|
||||
<!-- TMPL_IF NAME="messaging_form_inactive" -->
|
||||
<input type="checkbox"
|
||||
id="email<!-- TMPL_VAR NAME="message_attribute_id" -->"
|
||||
name="<!-- TMPL_VAR NAME="message_attribute_id" -->"
|
||||
value="email" <!-- TMPL_VAR NAME="transport-email" --> disabled="disabled" />
|
||||
<!-- TMPL_ELSE -->
|
||||
<input type="checkbox"
|
||||
id="email<!-- TMPL_VAR NAME="message_attribute_id" -->"
|
||||
name="<!-- TMPL_VAR NAME="message_attribute_id" -->"
|
||||
value="email" <!-- TMPL_VAR NAME="transport-email" --> onclick = "$('#none'+'<!-- TMPL_VAR NAME="message_attribute_id" -->').attr('checked','');" />
|
||||
<!-- /TMPL_IF -->
|
||||
</td>
|
||||
<!-- TMPL_ELSE -->
|
||||
<td>-</td>
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
<!-- TMPL_IF NAME="has_digest" -->
|
||||
<td><input type="checkbox"
|
||||
<td>
|
||||
<!-- TMPL_IF NAME="messaging_form_inactive" -->
|
||||
<input type="checkbox"
|
||||
id="digest<!-- TMPL_VAR NAME="message_attribute_id" -->"
|
||||
value="<!-- TMPL_VAR NAME="message_attribute_id" -->"
|
||||
name="digest" <!-- TMPL_VAR NAME="digest" --> disabled="disabled" />
|
||||
<!-- TMPL_ELSE -->
|
||||
<input type="checkbox"
|
||||
id="digest<!-- TMPL_VAR NAME="message_attribute_id" -->"
|
||||
value="<!-- TMPL_VAR NAME="message_attribute_id" -->"
|
||||
name="digest" <!-- TMPL_VAR NAME="digest" --> onclick = "$('#none'+'<!-- TMPL_VAR NAME="message_attribute_id" -->').attr('checked','');" />
|
||||
<!-- /TMPL_IF -->
|
||||
</td>
|
||||
<!-- TMPL_ELSE -->
|
||||
<td>-</td>
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
<!-- <!-- TMPL_IF NAME="transport-rss" -->
|
||||
<td><input type="checkbox"
|
||||
<td>
|
||||
<!-- TMPL_IF NAME="messaging_form_inactive" -->
|
||||
<input type="checkbox"
|
||||
id="rss<!-- TMPL_VAR NAME="message_attribute_id" -->"
|
||||
name="<!-- TMPL_VAR NAME="message_attribute_id" -->"
|
||||
value="rss" <!-- TMPL_VAR NAME="transport-rss" --> disabled="disabled" />
|
||||
<!-- TMPL_ELSE -->
|
||||
<input type="checkbox"
|
||||
id="rss<!-- TMPL_VAR NAME="message_attribute_id" -->"
|
||||
name="<!-- TMPL_VAR NAME="message_attribute_id" -->"
|
||||
value="rss" <!-- TMPL_VAR NAME="transport-rss" --> onclick = "$('#none'+'<!-- TMPL_VAR NAME="message_attribute_id" -->').attr('checked','');" />
|
||||
<!-- /TMPL_IF -->
|
||||
</td>
|
||||
<!-- TMPL_ELSE -->
|
||||
<td>-</td>
|
||||
<!-- /TMPL_IF --> -->
|
||||
|
||||
<!-- TMPL_UNLESS NAME="messaging_form_inactive" -->
|
||||
<td><input type="checkbox" class="none" id="none<!-- TMPL_VAR NAME="message_attribute_id" -->" /></td>
|
||||
<!-- /TMPL_UNLESS -->
|
||||
</tr>
|
||||
<!-- /TMPL_LOOP -->
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -929,6 +929,65 @@
|
|||
</fieldset>
|
||||
<!-- /TMPL_IF--><!-- /TMPL_IF --><!-- /TMPL_UNLESS -->
|
||||
|
||||
<!-- TMPL_IF NAME="step_5" --><!-- TMPL_IF NAME="EnhancedMessagingPreferences" -->
|
||||
<fieldset class="rows" id="memberentry_messaging_prefs">
|
||||
<!-- TMPL_IF NAME="opadd" -->
|
||||
<!-- handle changing prefs if creating new patron and changing
|
||||
the patron category
|
||||
-->
|
||||
<script language="javascript" type="text/javascript">//<![CDATA[
|
||||
$(document).ready(function(){
|
||||
var message_prefs_dirty = false;
|
||||
$('#memberentry_messaging_prefs > *').change(function() {
|
||||
message_prefs_dirty = true;
|
||||
});
|
||||
$('#categorycode').change(function() {
|
||||
var categorycode = $(this).val();
|
||||
if (message_prefs_dirty) {
|
||||
if (!confirm('Change messaging preferences to default for this category?')) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
$.getJSON('/cgi-bin/koha/members/default_messageprefs.pl?categorycode=' + categorycode,
|
||||
function(data) {
|
||||
$.each(data.messaging_preferences, function(i, item) {
|
||||
var attrid = item.message_attribute_id;
|
||||
var transports = ['email', 'rss', 'sms'];
|
||||
$.each(transports, function(j, transport) {
|
||||
if (item['transport-' + transport] != ' ') {
|
||||
$('#' + transport + attrid).attr('checked', item['transport-' + transport]);
|
||||
} else {
|
||||
$('#' + transport + attrid).removeAttr('checked');
|
||||
}
|
||||
});
|
||||
if (item.digest && item.digest != ' ') {
|
||||
$('#digest' + attrid).attr('checked', item.digest);
|
||||
} else {
|
||||
$('#digest' + attrid).removeAttr('checked');
|
||||
}
|
||||
if (item.takes_days == '1') {
|
||||
$('[name=' + attrid + '-DAYS]').val('' + item.days_in_advance);
|
||||
}
|
||||
});
|
||||
message_prefs_dirty = false;
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
<!-- /TMPL_IF -->
|
||||
<input type="hidden" name="setting_messaging_prefs" value="1" />
|
||||
<legend>Patron messaging preferences</legend>
|
||||
<!-- TMPL_INCLUDE NAME="messaging-preference-form.inc" -->
|
||||
<!-- TMPL_IF NAME="SMSSendDriver" -->
|
||||
<p><label for="SMSnumber">SMS number:</label>
|
||||
<input type="text" id="SMSnumber" name="SMSnumber" value="<!-- TMPL_VAR NAME="SMSnumber" -->" />
|
||||
</p>
|
||||
<!-- /TMPL_IF -->
|
||||
</fieldset>
|
||||
<!-- /TMPL_IF --> <!-- /TMPL_IF -->
|
||||
|
||||
<fieldset class="action">
|
||||
<input type="submit" name="save" onclick="return check_form_borrowers();" value="Save" />
|
||||
<!-- TMPL_IF NAME="opadd" -->
|
||||
|
|
|
|||
|
|
@ -42,23 +42,6 @@
|
|||
</div>
|
||||
<!-- TMPL_ELSE -->
|
||||
|
||||
<form method="get" name="messaging" action="/cgi-bin/koha/members/messaging.pl">
|
||||
<!-- TMPL_IF NAME= "settings_updated" -->
|
||||
<div class="dialog message"><h4>Settings Updated</h4>
|
||||
The patron settings have been updated</div>
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
<h3>Manage patron messaging settings</h3>
|
||||
|
||||
<!-- TMPL_INCLUDE NAME="messaging-preference-form.inc" -->
|
||||
|
||||
<!-- TMPL_IF NAME="transport-sms" --><p><label for="SMSnumber">SMS number:</label> <input type="text" id="SMSnumber" name="SMSnumber" value="<!-- TMPL_VAR NAME="SMSnumber" -->" /></p><!-- /TMPL_IF -->
|
||||
<fieldset class="action">
|
||||
<input type="submit" value="Submit Changes" /> <a class="cancel" href="/cgi-bin/koha/opac-user.pl">Cancel</a>
|
||||
</fieldset>
|
||||
|
||||
</form>
|
||||
|
||||
<!-- TMPL_IF NAME="message_queue" -->
|
||||
<table>
|
||||
<caption>Message Queue</caption>
|
||||
|
|
|
|||
|
|
@ -279,6 +279,19 @@ if (nodename =="barcodes[]"){
|
|||
<div class="action"><a href="memberentry.pl?op=modify&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&step=4">Edit</a></div>
|
||||
<!-- /TMPL_UNLESS -->
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
<!-- TMPL_IF NAME="EnhancedMessagingPreferences" -->
|
||||
<div id="patron-messaging-prefs" style="padding-top: 1em;">
|
||||
<h3>Patron messaging preferences</h3>
|
||||
<!-- TMPL_INCLUDE NAME="messaging-preference-form.inc" -->
|
||||
<!-- TMPL_IF NAME="SMSSendDriver" -->
|
||||
<div class="rows"> <ol><li><span class="label">SMS number:</span><!-- TMPL_VAR NAME="SMSnumber" -->
|
||||
</li></ol></div>
|
||||
<!-- /TMPL_IF -->
|
||||
</div>
|
||||
<div class="action"><a href="memberentry.pl?op=modify&borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&step=5">Edit</a></div>
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
</div>
|
||||
<div class="yui-u">
|
||||
<div id="patron-library-details">
|
||||
|
|
@ -443,7 +456,7 @@ if (nodename =="barcodes[]"){
|
|||
</td>
|
||||
<!-- /TMPL_IF -->
|
||||
</tr>
|
||||
<!-- /tmpl_loop --></tbody>
|
||||
<!-- /tmpl_loop -->
|
||||
<tr>
|
||||
<td colspan="4" style="text-align: right; font-weight:bold;">Totals:</td>
|
||||
<td><!-- TMPL_VAR NAME="totaldue" --></td>
|
||||
|
|
@ -467,6 +480,7 @@ if (nodename =="barcodes[]"){
|
|||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<fieldset class="action">
|
||||
<!-- TMPL_IF NAME="CAN_user_circulate_override_renewals" -->
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# Copyright 2009 LibLime
|
||||
#
|
||||
# This file is part of Koha.
|
||||
#
|
||||
# Koha is free software; you can redistribute it and/or modify it under the
|
||||
# terms of the GNU General Public License as published by the Free Software
|
||||
# Foundation; either version 2 of the License, or (at your option) any later
|
||||
# version.
|
||||
#
|
||||
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with
|
||||
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
|
||||
# Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use C4::Service;
|
||||
use C4::Form::MessagingPreferences;
|
||||
|
||||
# Simple JSON service to get the default messaging preferences
|
||||
# for a patron category - used by the patron editing form to
|
||||
# update the prefs if operator is creating a new patron and has
|
||||
# changed the patron category from its original value.
|
||||
|
||||
my ($query, $response) = C4::Service->init(borrowers => 1);
|
||||
my ($categorycode) = C4::Service->require_params('categorycode');
|
||||
C4::Form::MessagingPreferences::set_form_values({ categorycode => $categorycode }, $response);
|
||||
C4::Service->return_success( $response );
|
||||
|
||||
|
|
@ -38,6 +38,7 @@ use C4::Input;
|
|||
use C4::Log;
|
||||
use C4::Letters;
|
||||
use C4::Branch; # GetBranches
|
||||
use C4::Form::MessagingPreferences;
|
||||
|
||||
use vars qw($debug);
|
||||
|
||||
|
|
@ -148,19 +149,30 @@ if ($op eq 'insert' || $op eq 'modify' || $op eq 'save') {
|
|||
|
||||
# remove keys from %newdata that ModMember() doesn't like
|
||||
{
|
||||
my @keys_to_delete = qw(
|
||||
BorrowerMandatoryField
|
||||
category_type
|
||||
check_member
|
||||
destination
|
||||
nodouble
|
||||
op
|
||||
save
|
||||
select_roadtype
|
||||
updtype
|
||||
my @keys_to_delete = (
|
||||
qr/^BorrowerMandatoryField$/,
|
||||
qr/^category_type$/,
|
||||
qr/^check_member$/,
|
||||
qr/^destination$/,
|
||||
qr/^nodouble$/,
|
||||
qr/^op$/,
|
||||
qr/^save$/,
|
||||
qr/^select_roadtype$/,
|
||||
qr/^updtype$/,
|
||||
qr/^SMSnumber$/,
|
||||
qr/^setting_extended_patron_attributes$/,
|
||||
qr/^setting_messaging_prefs$/,
|
||||
qr/^digest$/,
|
||||
qr/^modify$/,
|
||||
qr/^step$/,
|
||||
qr/^\d+$/,
|
||||
qr/^\d+-DAYS/,
|
||||
qr/^patron_attr_/,
|
||||
);
|
||||
for (@keys_to_delete) {
|
||||
delete($newdata{$_});
|
||||
for my $regexp (@keys_to_delete) {
|
||||
for (keys %newdata) {
|
||||
delete($newdata{$_}) if /$regexp/;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -267,6 +279,10 @@ if ($op eq 'modify' || $op eq 'insert' || $op eq 'save' ){
|
|||
}
|
||||
}
|
||||
|
||||
if ( ( defined $input->param('SMSnumber') ) && ( $input->param('SMSnumber') ne $newdata{'mobile'} ) ) {
|
||||
$newdata{smsalertnumber} = $input->param('SMSnumber');
|
||||
}
|
||||
|
||||
### Error checks should happen before this line.
|
||||
$nok = $nok || scalar(@errors);
|
||||
if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){
|
||||
|
|
@ -310,6 +326,9 @@ if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){
|
|||
if (C4::Context->preference('ExtendedPatronAttributes') and $input->param('setting_extended_patron_attributes')) {
|
||||
C4::Members::Attributes::SetBorrowerAttributes($borrowernumber, $extended_patron_attributes);
|
||||
}
|
||||
if (C4::Context->preference('EnhancedMessagingPreferences') and $input->param('setting_messaging_prefs')) {
|
||||
C4::Form::MessagingPreferences::handle_form_action($input, { borrowernumber => $borrowernumber }, $template);
|
||||
}
|
||||
} elsif ($op eq 'save'){
|
||||
if ($NoUpdateLogin) {
|
||||
delete $newdata{'password'};
|
||||
|
|
@ -319,6 +338,9 @@ if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){
|
|||
if (C4::Context->preference('ExtendedPatronAttributes') and $input->param('setting_extended_patron_attributes')) {
|
||||
C4::Members::Attributes::SetBorrowerAttributes($borrowernumber, $extended_patron_attributes);
|
||||
}
|
||||
if (C4::Context->preference('EnhancedMessagingPreferences') and $input->param('setting_messaging_prefs')) {
|
||||
C4::Form::MessagingPreferences::handle_form_action($input, { borrowernumber => $borrowernumber }, $template);
|
||||
}
|
||||
}
|
||||
print scalar ($destination eq "circ") ?
|
||||
$input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber") :
|
||||
|
|
@ -337,7 +359,7 @@ if ($nok or !$nodouble){
|
|||
%data=%newdata;
|
||||
$template->param( updtype => ($op eq 'add' ?'I':'M')); # used to check for $op eq "insert"... but we just changed $op!
|
||||
unless ($step){
|
||||
$template->param( step_1 => 1,step_2 => 1,step_3 => 1, step_4 => 1);
|
||||
$template->param( step_1 => 1,step_2 => 1,step_3 => 1, step_4 => 1, step_5 => 1);
|
||||
}
|
||||
}
|
||||
if (C4::Context->preference("IndependantBranches")) {
|
||||
|
|
@ -352,11 +374,11 @@ if (C4::Context->preference("IndependantBranches")) {
|
|||
if ($op eq 'add'){
|
||||
my $arg2 = $newdata{'dateenrolled'} || C4::Dates->today('iso');
|
||||
$data{'dateexpiry'} = GetExpiryDate($newdata{'categorycode'},$arg2);
|
||||
$template->param( updtype => 'I', step_1=>1, step_2=>1, step_3=>1, step_4=>1);
|
||||
$template->param( updtype => 'I', step_1=>1, step_2=>1, step_3=>1, step_4=>1, step_5 => 1);
|
||||
}
|
||||
if ($op eq "modify") {
|
||||
$template->param( updtype => 'M',modify => 1 );
|
||||
$template->param( step_1=>1, step_2=>1, step_3=>1, step_4=>1) unless $step;
|
||||
$template->param( step_1=>1, step_2=>1, step_3=>1, step_4=>1, step_5 => 1) unless $step;
|
||||
}
|
||||
# my $cardnumber=$data{'cardnumber'};
|
||||
$data{'cardnumber'}=fixup_cardnumber($data{'cardnumber'}) if $op eq 'add';
|
||||
|
|
@ -573,6 +595,16 @@ if (C4::Context->preference('ExtendedPatronAttributes')) {
|
|||
patron_attributes_form($template, $borrowernumber);
|
||||
}
|
||||
|
||||
if (C4::Context->preference('EnhancedMessagingPreferences')) {
|
||||
if ($op eq 'add') {
|
||||
C4::Form::MessagingPreferences::set_form_values({ categorycode => $categorycode }, $template);
|
||||
} else {
|
||||
C4::Form::MessagingPreferences::set_form_values({ borrowernumber => $borrowernumber }, $template);
|
||||
}
|
||||
$template->param(SMSSendDriver => C4::Context->preference("SMSSendDriver"));
|
||||
$template->param(SMSnumber => defined $data{'smsalertnumber'} ? $data{'smsalertnumber'} : $data{'mobile'});
|
||||
}
|
||||
|
||||
$template->param( "showguarantor" => ($category_type=~/A|I|S|X/) ? 0 : 1); # associate with step to know where you are
|
||||
$debug and warn "memberentry step: $step";
|
||||
$template->param(%data);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ use C4::Letters;
|
|||
use C4::Biblio;
|
||||
use C4::Reserves;
|
||||
use C4::Branch; # GetBranchName
|
||||
use C4::Form::MessagingPreferences;
|
||||
|
||||
use Data::Dumper;
|
||||
|
||||
|
|
@ -65,18 +64,6 @@ $template->param( $borrower );
|
|||
|
||||
my $borrower = GetMemberDetails( $borrowernumber );
|
||||
|
||||
if ( defined $query->param('modify') && $query->param('modify') eq 'yes' ) {
|
||||
|
||||
# If they've modified the SMS number, record it.
|
||||
if ( ( defined $query->param('SMSnumber') ) && ( $query->param('SMSnumber') ne $borrower->{'mobile'} ) ) {
|
||||
ModMember( borrowernumber => $borrowernumber,
|
||||
smsalertnumber => $query->param('SMSnumber') );
|
||||
$borrower = GetMemberDetails( $borrowernumber );
|
||||
}
|
||||
C4::Form::MessagingPreferences::handle_form_action($query, { borrowernumber => $borrowernumber }, $template);
|
||||
}
|
||||
|
||||
C4::Form::MessagingPreferences::set_form_values({ borrowernumber => $borrowernumber }, $template);
|
||||
|
||||
if ( $borrower->{'category_type'} eq 'C') {
|
||||
my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' );
|
||||
|
|
@ -100,7 +87,6 @@ $template->param( messagingview => 1,
|
|||
dateformat => C4::Context->preference("dateformat"),
|
||||
categoryname => $borrower->{'description'},
|
||||
$borrower->{'categorycode'} => 1,
|
||||
SMSSendDriver => C4::Context->preference("SMSSendDriver")
|
||||
);
|
||||
|
||||
#$messaging_preferences->{'SMSnumber'}{'value'} = defined $borrower->{'smsalertnumber'}
|
||||
|
|
@ -109,6 +95,6 @@ $template->param( messagingview => 1,
|
|||
$template->param( BORROWER_INFO => [ $borrower ],
|
||||
messagingview => 1,
|
||||
is_child => ($borrower->{'category_type'} eq 'C'),
|
||||
SMSnumber => defined $borrower->{'smsalertnumber'} ? $borrower->{'smsalertnumber'} : $borrower->{'mobile'} );
|
||||
);
|
||||
|
||||
output_html_with_http_headers $query, $cookie, $template->output;
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ use C4::Letters;
|
|||
use C4::Biblio;
|
||||
use C4::Reserves;
|
||||
use C4::Branch; # GetBranchName
|
||||
use C4::Form::MessagingPreferences;
|
||||
|
||||
#use Smart::Comments;
|
||||
#use Data::Dumper;
|
||||
|
|
@ -350,6 +351,13 @@ if (C4::Context->preference('ExtendedPatronAttributes')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (C4::Context->preference('EnhancedMessagingPreferences')) {
|
||||
C4::Form::MessagingPreferences::set_form_values({ borrowernumber => $borrowernumber }, $template);
|
||||
$template->param(messaging_form_inactive => 1);
|
||||
$template->param(SMSSendDriver => C4::Context->preference("SMSSendDriver"));
|
||||
$template->param(SMSnumber => defined $data->{'smsalertnumber'} ? $data->{'smsalertnumber'} : $data->{'mobile'});
|
||||
}
|
||||
|
||||
$template->param(
|
||||
detailview => 1,
|
||||
AllowRenewalLimitOverride => C4::Context->preference("AllowRenewalLimitOverride"),
|
||||
|
|
|
|||
Loading…
Reference in New Issue