[Koha-patches] [PATCH] Bug 7937: Fix warns on opac-userupdate.pl

Katrin Fischer Katrin.Fischer.83 at web.de
Tue Apr 10 01:25:11 CEST 2012


1) opac-userupdate.pl: Use of uninitialized value $updateemailaddress in
pattern match (m//) at /home/katrin/kohaclone/opac/opac-userupdate.pl line 61.

Warn was created when branch has no email address.
The script falls back to KohaAdminEmailAddress first and shows an
error message in OPAC when there is no email address to be used.

2) opac-userupdate.pl: Use of uninitialized value in concatenation (.) or
string at /home/katrin/kohaclone/koha-tmpl/opac-tmpl/prog/en/modules/opac-userupdate.tt
line 75.

Warn was created when patron has no date of birth.
---
 .../opac-tmpl/prog/en/modules/opac-userupdate.tt   |    9 ++++++++-
 opac/opac-userupdate.pl                            |    2 +-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-userupdate.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-userupdate.tt
index b903e4d..90a39ad 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-userupdate.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-userupdate.tt
@@ -70,7 +70,14 @@
 </fieldset>
 <fieldset class="brief">
 <ol>
-<li><label for="dob">Date of birth: </label> <input id="dob" type="text" size="10" value="[% BORROWER_INF.dateofbirth | $KohaDates %]" name="dateofbirth" /></li>
+<li>
+    <label for="dob">Date of birth: </label> 
+    [% IF ( BORROWER_INF.dateofbirth ) %]
+        <input id="dob" type="text" size="10" value="[% BORROWER_INF.dateofbirth | $KohaDates %]" name="dateofbirth" />
+    [% ELSE %]
+        <input id="dob" type="text" size="10" value="" name="dateofbirth" />
+    [% END %]
+</li>
 <li><label for="sex">Gender: </label> <select name="sex" id="sex"><option></option>
 [% IF ( BORROWER_INF.sex == 'F' ) %]<option value="F" selected="selected">Female</option>[% ELSE %]<option value="F">Female</option>[% END %]
 [% IF ( BORROWER_INF.sex == 'M' ) %]<option value="M" selected="selected">Male</option>[% ELSE %]<option value="M">Male</option>[% END %]
diff --git a/opac/opac-userupdate.pl b/opac/opac-userupdate.pl
index b37d88c..1dfc87f 100755
--- a/opac/opac-userupdate.pl
+++ b/opac/opac-userupdate.pl
@@ -57,7 +57,7 @@ my @fields = (
     'surname','firstname','othernames','streetnumber','address','address2','city','state','zipcode','country','phone','mobile','fax','phonepro', 'emailaddress','emailpro','B_streetnumber','B_address','B_address2','B_city','B_state','B_zipcode','B_country','B_phone','B_email','dateofbirth','sex'
 );
 my $update;
-my $updateemailaddress = $lib->{'branchemail'};
+my $updateemailaddress = $lib->{'branchemail'} || '';
 $updateemailaddress = C4::Context->preference('KohaAdminEmailAddress') unless( $updateemailaddress =~ /\w+@\w+/);
 if ( !$updateemailaddress || $updateemailaddress eq '' ) {
     warn
-- 
1.7.5.4



More information about the Koha-patches mailing list