Bugzilla – Attachment 13766 Details for
Bug 7067
allow patron self registration via the opac
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7067 - OPAC Borrower Self Registration - Followup
Bug-7067---OPAC-Borrower-Self-Registration---Follo.patch (text/plain), 41.53 KB, created by
Jared Camins-Esakov
on 2012-11-29 14:38:32 UTC
(
hide
)
Description:
Bug 7067 - OPAC Borrower Self Registration - Followup
Filename:
MIME Type:
Creator:
Jared Camins-Esakov
Created:
2012-11-29 14:38:32 UTC
Size:
41.53 KB
patch
obsolete
>From 71f88f26f21e0e9f8d18e87ae22f1df2cd710dae Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 10 Sep 2012 08:06:09 -0400 >Subject: [PATCH] Bug 7067 - OPAC Borrower Self Registration - Followup > >* Rename PatronSelfRegistrationUseTemporaryStatus to PatronSelfRegistrationDefaultCategory >* Hide register link unless PatronSelfRegistrationDefaultCategory is set. >* Add invalid token page >* Add documentation and switches to cron scripts >* Add required fields check for editing exiting patrons >* Don't force require email address for existing patrons when > PatronSelfRegistrationVerifyByEmail is enabled. > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >Passed-QA-by: Jonathan Druart <jonathan.druart@biblibre.com> >--- > C4/Auth.pm | 2 + > C4/Members.pm | 11 +- > Koha/Borrower/Modifications.pm | 32 ++++-- > installer/data/mysql/sysprefs.sql | 6 +- > installer/data/mysql/updatedatabase.pl | 4 +- > .../prog/en/modules/admin/preferences/opac.pref | 2 +- > .../intranet-tmpl/prog/en/modules/intranet-main.tt | 3 +- > .../prog/en/modules/members/members-update.tt | 113 ++++++++++---------- > koha-tmpl/opac-tmpl/prog/en/modules/opac-auth.tt | 2 +- > koha-tmpl/opac-tmpl/prog/en/modules/opac-main.tt | 2 +- > .../opac-tmpl/prog/en/modules/opac-memberentry.tt | 45 ++++++-- > .../prog/en/modules/opac-registration-invalid.tt | 30 ++++++ > mainpage.pl | 10 +- > members/members-update-do.pl | 2 +- > members/members-update.pl | 10 +- > misc/cronjobs/delete_expired_opac_registrations.pl | 28 ++++- > .../delete_unverified_opac_registrations.pl | 33 +++++- > opac/opac-memberentry.pl | 104 +++++++++++------- > opac/opac-registration-verify.pl | 34 +++--- > 19 files changed, 326 insertions(+), 147 deletions(-) > create mode 100644 koha-tmpl/opac-tmpl/prog/en/modules/opac-registration-invalid.tt > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index 290eb7d..e0b09fa 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -463,6 +463,7 @@ sub get_template_and_user { > SyndeticsCoverImageSize => C4::Context->preference("SyndeticsCoverImageSize"), > OPACLocalCoverImages => C4::Context->preference("OPACLocalCoverImages"), > PatronSelfRegistration => C4::Context->preference("PatronSelfRegistration"), >+ PatronSelfRegistrationDefaultCategory => C4::Context->preference("PatronSelfRegistrationDefaultCategory"), > ); > > $template->param(OpacPublic => '1') if ($user || C4::Context->preference("OpacPublic")); >@@ -980,6 +981,7 @@ sub checkauth { > AutoLocation => C4::Context->preference("AutoLocation"), > wrongip => $info{'wrongip'}, > PatronSelfRegistration => C4::Context->preference("PatronSelfRegistration"), >+ PatronSelfRegistrationDefaultCategory => C4::Context->preference("PatronSelfRegistrationDefaultCategory"), > ); > > $template->param( OpacPublic => C4::Context->preference("OpacPublic")); >diff --git a/C4/Members.pm b/C4/Members.pm >index aed849a..3430729 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -757,10 +757,6 @@ sub AddMember { > # generate a proper login if none provided > $data{'userid'} = Generate_Userid($data{'borrowernumber'}, $data{'firstname'}, $data{'surname'}) if $data{'userid'} eq ''; > >- # create a disabled account if no password provided >- $data{'password'} = ($data{'password'})? md5_base64($data{'password'}) : '!'; >- $data{'borrowernumber'}=InsertInTable("borrowers",\%data); >- > # add expiration date if it isn't already there > unless ( $data{'dateexpiry'} ) { > $data{'dateexpiry'} = GetExpiryDate( $data{'categorycode'}, C4::Dates->new()->output("iso") ); >@@ -771,6 +767,11 @@ sub AddMember { > $data{'dateenrolled'} = C4::Dates->new()->output("iso"); > } > >+ # create a disabled account if no password provided >+ $data{'password'} = ($data{'password'})? md5_base64($data{'password'}) : '!'; >+ $data{'borrowernumber'}=InsertInTable("borrowers",\%data); >+ >+ > # mysql_insertid is probably bad. not necessarily accurate and mysql-specific at best. > logaction("MEMBERS", "CREATE", $data{'borrowernumber'}, "") if C4::Context->preference("BorrowersLog"); > >@@ -2376,7 +2377,7 @@ sub GetBorrowersWithEmail { > sub AddMember_Opac { > my ( %borrower ) = @_; > >- $borrower{'categorycode'} = C4::Context->preference('PatronSelfRegistrationUseTemporaryStatus'); >+ $borrower{'categorycode'} = C4::Context->preference('PatronSelfRegistrationDefaultCategory'); > > my $sr = new String::Random; > $sr->{'A'} = [ 'A'..'Z', 'a'..'z' ]; >diff --git a/Koha/Borrower/Modifications.pm b/Koha/Borrower/Modifications.pm >index a986599..f83b61d 100644 >--- a/Koha/Borrower/Modifications.pm >+++ b/Koha/Borrower/Modifications.pm >@@ -144,17 +144,24 @@ Returns the number of pending modifications for existing borrowers. > =cut > > sub GetPendingModificationsCount { >- my ($self) = @_; >+ my ( $self, $branchcode ) = @_; > > my $dbh = C4::Context->dbh; > my $query = " > SELECT COUNT(*) AS count >- FROM borrower_modifications >- WHERE borrowernumber > 0 >+ FROM borrower_modifications, borrowers >+ WHERE borrower_modifications.borrowernumber > 0 >+ AND borrower_modifications.borrowernumber = borrowers.borrowernumber > "; > >+ my @params; >+ if ($branchcode) { >+ $query .= " AND borrowers.branchcode = ? "; >+ push( @params, $branchcode ); >+ } >+ > my $sth = $dbh->prepare($query); >- $sth->execute(); >+ $sth->execute(@params); > my $result = $sth->fetchrow_hashref(); > > return $result->{'count'}; >@@ -169,17 +176,24 @@ Returns an arrayref of hashrefs for all pending modifications for existing borro > =cut > > sub GetPendingModifications { >- my ($self) = @_; >+ my ( $self, $branchcode ) = @_; > > my $dbh = C4::Context->dbh; > my $query = " >- SELECT * >- FROM borrower_modifications >- WHERE borrowernumber > 0 >+ SELECT borrower_modifications.* >+ FROM borrower_modifications, borrowers >+ WHERE borrower_modifications.borrowernumber > 0 >+ AND borrower_modifications.borrowernumber = borrowers.borrowernumber > "; > >+ my @params; >+ if ($branchcode) { >+ $query .= " AND borrowers.branchcode = ? "; >+ push( @params, $branchcode ); >+ } >+ > my $sth = $dbh->prepare($query); >- $sth->execute(); >+ $sth->execute(@params); > > my @m; > while ( my $row = $sth->fetchrow_hashref() ) { >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 2cb60ba..52d54eb 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -390,7 +390,7 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' > INSERT INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES > ('PatronSelfRegistration', '0', NULL, 'If enabled, patrons will be able to register themselves via the OPAC.', 'YesNo'), > ('PatronSelfRegistrationVerifyByEmail', '0', NULL, 'If enabled, any patron attempting to register themselves via the OPAC will be required to verify themselves via email to activate his or her account.', 'YesNo'), >-('PatronSelfRegistrationUseTemporaryStatus', '', '', 'A patron registered via the OPAC will receive a borrower category code set in this system preference.', 'free'), >-('PatronSelfRegistrationExpireTemporaryAccountsDelay', '0', NULL, 'If PatronSelfRegistrationUseTemporaryStatus is enabled, this system preference controls how long a patron can have a temporary status before the account is deleted automatically. It is an integer value representing a number of days to wait before deleting a temporary patron account. Setting it to 0 disables the deleting of temporary accounts.', 'Integer'), >+('PatronSelfRegistrationDefaultCategory', '', '', 'A patron registered via the OPAC will receive a borrower category code set in this system preference.', 'free'), >+('PatronSelfRegistrationExpireTemporaryAccountsDelay', '0', NULL, 'If PatronSelfRegistrationDefaultCategory is enabled, this system preference controls how long a patron can have a temporary status before the account is deleted automatically. It is an integer value representing a number of days to wait before deleting a temporary patron account. Setting it to 0 disables the deleting of temporary accounts.', 'Integer'), > ('PatronSelfRegistrationBorrowerMandatoryField', 'surname|firstname', NULL , 'Choose the mandatory fields for a patron''s account, when registering via the OPAC.', 'free'), >-('PatronSelfRegistrationBorrowerUnwantedField', '', NULL , 'Name the fields you don''t want to display when registering a new patron via the OPAC.', 'free'); >\ No newline at end of file >+('PatronSelfRegistrationBorrowerUnwantedField', '', NULL , 'Name the fields you don''t want to display when registering a new patron via the OPAC.', 'free'); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index f719aa0..9c7b128 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -5799,8 +5799,8 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { > INSERT INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES > ('PatronSelfRegistration', '0', NULL, 'If enabled, patrons will be able to register themselves via the OPAC.', 'YesNo'), > ('PatronSelfRegistrationVerifyByEmail', '0', NULL, 'If enabled, any patron attempting to register themselves via the OPAC will be required to verify themselves via email to activate his or her account.', 'YesNo'), >- ('PatronSelfRegistrationUseTemporaryStatus', '', '', 'A patron registered via the OPAC will receive a borrower category code set in this system preference.', 'free'), >- ('PatronSelfRegistrationExpireTemporaryAccountsDelay', '0', NULL, 'If PatronSelfRegistrationUseTemporaryStatus is enabled, this system preference controls how long a patron can have a temporary status before the account is deleted automatically. It is an integer value representing a number of days to wait before deleting a temporary patron account. Setting it to 0 disables the deleting of temporary accounts.', 'Integer'), >+ ('PatronSelfRegistrationDefaultCategory', '', '', 'A patron registered via the OPAC will receive a borrower category code set in this system preference.', 'free'), >+ ('PatronSelfRegistrationExpireTemporaryAccountsDelay', '0', NULL, 'If PatronSelfRegistrationDefaultCategory is enabled, this system preference controls how long a patron can have a temporary status before the account is deleted automatically. It is an integer value representing a number of days to wait before deleting a temporary patron account. Setting it to 0 disables the deleting of temporary accounts.', 'Integer'), > ('PatronSelfRegistrationBorrowerMandatoryField', 'surname|firstname', NULL , 'Choose the mandatory fields for a patron''s account, when registering via the OPAC.', 'free'), > ('PatronSelfRegistrationBorrowerUnwantedField', '', NULL , 'Name the fields you don''t want to display when registering a new patron via the OPAC.', 'free'); > "); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >index 8d0c161..bcf7124 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >@@ -543,7 +543,7 @@ OPAC: > - "that a self-registering patron verify his or herself via email." > - > - "Use the patron category code" >- - pref: PatronSelfRegistrationUseTemporaryStatus >+ - pref: PatronSelfRegistrationDefaultCategory > class: short > - "as the default patron category for patrons registered via the OPAC." > - >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt >index 8ccf85a..e7363b0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt >@@ -107,6 +107,7 @@ > <div class="yui-g"> > [% IF ( ( CAN_user_tools_moderate_comments && pendingcomments ) > || ( CAN_user_tools_moderate_tags && pendingtags ) >+ || ( CAN_user_borrowers && pending_borrower_modifications ) > || ( CAN_user_acquisition && pendingsuggestions ) ) %] > <div id="area-pending"> > [% IF ( CAN_user_acquisition && pendingsuggestions ) %] >@@ -132,7 +133,7 @@ > [% END %] > > >- [% IF ( CAN_user_borrowers && pending_borrower_modifications )%] >+ [% IF ( CAN_user_borrowers && pending_borrower_modifications ) %] > <div class="pending-info"> > <a href="/cgi-bin/koha/members/members-update.pl">Patrons requesting modifications</a>: > <span class="pending-number-link">[% pending_borrower_modifications %]</span> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt >index 8878b7f..228ccf2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt >@@ -64,72 +64,75 @@ > <div id="yui-main"> > <div class="yui-b"> > <div class="yui-g"> >+ [% IF PendingModifications %] >+ <form method="post" action="members-update-do.pl"> > >- <form method="post" action="members-update-do.pl"> >- >- <table> >- <thead> >- <tr> >- <th colspan="3">Action</th> >- <th rowspan="2">Patron</th> >- <th rowspan="2">Changes</th> >- </tr> >- >- <tr> >- <th>Approve</th> >- <th>Deny</th> >- <th>Ignore</th> >- </tr> >- </thead> >+ <table> >+ <thead> >+ <tr> >+ <th colspan="3">Action</th> >+ <th rowspan="2">Patron</th> >+ <th rowspan="2">Changes</th> >+ </tr> > >- <tbody> >- [% FOREACH pm IN PendingModifications %] >- [% SET borrowernumber = pm.borrowernumber %] > <tr> >- <td> >- <input type="radio" name="modify_[% pm.borrowernumber %]" value="approve" /> >- </td> >- <td> >- <input type="radio" name="modify_[% pm.borrowernumber %]" value="deny" /> >- </td> >- <td> >- <input type="radio" name="modify_[% pm.borrowernumber %]" value="ignore" checked="checked"/> >- </td> >+ <th>Approve</th> >+ <th>Deny</th> >+ <th>Ignore</th> >+ </tr> >+ </thead> >+ >+ <tbody> >+ [% FOREACH pm IN PendingModifications %] >+ [% SET borrowernumber = pm.borrowernumber %] >+ <tr> >+ <td> >+ <input type="radio" name="modify_[% pm.borrowernumber %]" value="approve" /> >+ </td> >+ <td> >+ <input type="radio" name="modify_[% pm.borrowernumber %]" value="deny" /> >+ </td> >+ <td> >+ <input type="radio" name="modify_[% pm.borrowernumber %]" value="ignore" checked="checked"/> >+ </td> > >- <td> >- [% borrowers.$borrowernumber.firstname %] [% borrowers.$borrowernumber.surname %] >- </td> >+ <td> >+ [% borrowers.$borrowernumber.firstname %] [% borrowers.$borrowernumber.surname %] >+ </td> > >- <td> >- <table> >- <tr> >- <th>Field</th> >- <th>From</th> >- <th>To</th> >- </tr> >+ <td> >+ <table> >+ <tr> >+ <th>Field</th> >+ <th>From</th> >+ <th>To</th> >+ </tr> > > >- [% FOREACH key IN pm.keys %] >- [% IF field_display_names.$key %] >- [% IF ( ( pm.$key OR borrowers.$borrowernumber.$key ) && ( pm.$key != borrowers.$borrowernumber.$key ) ) %] >- <tr> >- <td>[% field_display_names.$key %]</td> >- <td>[% borrowers.$borrowernumber.$key %]</td> >- <td>[% pm.$key %]</td> >- </td> >+ [% FOREACH key IN pm.keys %] >+ [% IF field_display_names.$key %] >+ [% IF ( ( pm.$key OR borrowers.$borrowernumber.$key ) && ( pm.$key != borrowers.$borrowernumber.$key ) ) %] >+ <tr> >+ <td>[% field_display_names.$key %]</td> >+ <td>[% borrowers.$borrowernumber.$key %]</td> >+ <td>[% pm.$key %]</td> >+ </tr> >+ [% END %] > [% END %] > [% END %] >- [% END %] >- </table> >- </td> >- </tr> >- [% END %] >- </tbody> >- </table> >+ </table> >+ </td> >+ </tr> >+ [% END %] >+ </tbody> >+ </table> > >- <p><input type="submit" /></p> >+ <p><input type="submit" /></p> > >- </form> >+ </form> >+ [% ELSE %] >+ <p>There are no pending patron modifications.</p> >+ [% END %] > </div> > </div> > </div> >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth.tt >index b890529..6a6e1ee 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth.tt >@@ -86,7 +86,7 @@ please choose against which one you would like to authenticate: </p> > <input type="submit" value="Log In" class="submit" /> > <div id="nologininstructions"> > <h5>Don't have a password yet?</h5><p> If you don't have a password yet, stop by the circulation desk the next time you're in the library. We'll happily set one up for you.</p> >- <h5>Don't have a library card?</h5><p> If you don't have a library card, stop by your local library to sign up[% IF PatronSelfRegistration %] or <a href="/cgi-bin/koha/opac-memberentry.pl">register here</a>[% END %]. </p> >+ <h5>Don't have a library card?</h5><p> If you don't have a library card, stop by your local library to sign up[% IF PatronSelfRegistration && PatronSelfRegistrationDefaultCategory %] or <a href="/cgi-bin/koha/opac-memberentry.pl">register here</a>[% END %].</p> > </div> > </form> > >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-main.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-main.tt >index 47f5557..1ae7bf5 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-main.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-main.tt >@@ -56,7 +56,7 @@ > <li><label for="password">Password:</label><input type="password" id="password" size="10" name="password" /></li> > </ol> <fieldset class="action"> > <input type="submit" value="Log In" class="submit" /> >- [% IF PatronSelfRegistration %]<div>Don't have an account? <a href="/cgi-bin/koha/opac-memberentry.pl">Register here.</a></div>[% END %] >+ [% IF PatronSelfRegistration && PatronSelfRegistrationDefaultCategory %]<div>Don't have an account? <a href="/cgi-bin/koha/opac-memberentry.pl">Register here.</a></div>[% END %] > > </fieldset></fieldset> > </form> >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-memberentry.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-memberentry.tt >index 38c0bc7..ac2cb02 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-memberentry.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-memberentry.tt >@@ -7,7 +7,16 @@ > > <script type="text/javascript"> > $(document).ready(function() { >- $( "#borrower_dateofbirth" ).datepicker({ yearRange: "c-120:c" }); >+ [% IF action == 'edit' && !OPACPatronDetails %] >+ $("#memberentry-form :input").attr('readonly', true); >+ $("#borrower_branchcode").attr('disabled',true); >+ $("#borrower_title").attr('disabled',true); >+ $('#memberentry-form :radio').attr('disabled',true); >+ $('span.required').remove(); >+ $('label.required').removeClass('required'); >+ [% ELSE %] >+ $( "#borrower_dateofbirth" ).datepicker({ yearRange: "c-120:c" }); >+ [% END %] > }); > </script> > </head> >@@ -21,6 +30,9 @@ > <div class="yui-b"> > <div class="yui-g"> > <div id="useraccount" class="container"> >+ [% UNLESS OPACPatronDetails %] >+ <div>To make changes to your record please contact the library.</div> >+ [% END %] > > [% IF empty_mandatory_fields %] > <div class="dialog alert">You have not filled out all required fields. Please fill in all missing fields and resubmit.</div> >@@ -30,7 +42,7 @@ > <div class="dialog alert">You typed in the wrong characters in the box before submitting. Please try again.</div> > [% END %] > >- <form method="post"> >+ <form method="post" id="memberentry-form"> > > [% UNLESS > hidden.defined('branchcode') >@@ -132,9 +144,11 @@ > [% END %] > Date of birth:</label> > >- <input type="text" id="borrower_dateofbirth" name="borrower_dateofbirth" value="[% borrower.dateofbirth | $KohaDates %]" readonly="readonly" size="10" /> >+ <input type="text" id="borrower_dateofbirth" name="borrower_dateofbirth" value="[% borrower.dateofbirth | $KohaDates %]" size="10" /> > >- <a href="#" style="font-size:85%;text-decoration:none;" onclick="document.getElementById('borrower_dateofbirth').value='';return false;">Clear date</a><p></p> >+ [% UNLESS action == 'edit' && !OPACPatronDetails %] >+ <a href="#" style="font-size:85%;text-decoration:none;" onclick="document.getElementById('borrower_dateofbirth').value='';return false;">Clear date</a><p></p> >+ [% END %] > > [% IF mandatory.defined('dateofbirth') %]<span class="required">Required</span>[% END %] > </li> >@@ -682,16 +696,25 @@ > [% END %] > > [% UNLESS action == 'edit' %] >- <p>Please type this following characters into the box below : [% captcha %]</p> >- <p> >- <input type="text" name="captcha" id="captcha" /> >- <input type="hidden" name="captcha_digest" value="[% captcha_digest %]" /> >- </p> >+ <fieldset class="rows" id="memberentry_captcha"> >+ <ol> >+ <li> >+ <label for="borrower_altcontactphone" class="required">Verification</label> >+ >+ <input type="text" name="captcha" id="captcha" /> >+ <input type="hidden" name="captcha_digest" value="[% captcha_digest %]" /> >+ >+ <span class="required">Please type this following characters into the preceding box: <strong>[% captcha %]</strong></span> >+ </li> >+ </ol> >+ </fieldset> > [% END %] > > [% IF action == 'edit' %] >- <input type="hidden" name="action" value="update" /> >- <input type="submit" value="Submit Update Request" /> >+ [% IF OPACPatronDetails %] >+ <input type="hidden" name="action" value="update" /> >+ <input type="submit" value="Submit Update Request" /> >+ [% END %] > [% ELSE %] > <input type="hidden" name="action" value="create" /> > <input type="submit" value="Submit" /> >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-registration-invalid.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-registration-invalid.tt >new file mode 100644 >index 0000000..12dac1d >--- /dev/null >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-registration-invalid.tt >@@ -0,0 +1,30 @@ >+[% INCLUDE 'doc-head-open.inc' %] >+[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog >+[% INCLUDE 'doc-head-close.inc' %] >+</head> >+<body id="opac-main"> >+[% IF ( OpacNav ) %]<div id="doc3" class="yui-t1">[% ELSE %]<div id="doc3" class="yui-t7">[% END %] >+ <div id="bd"> >+[% INCLUDE 'masthead.inc' %] >+ >+<div id="yui-main"> >+ <div class="yui-b"> >+ <div id="loggedin" class="yui-ge"> >+ <div class="yui-u first"> >+ <h1>Registration invalid!</h1> >+ >+ <p>There were problems processing your registration. Please contact your library for help.</p> >+ >+ </div> >+ </div> >+ </div> >+</div> >+ >+[% IF ( OpacNav ) %]<div class="yui-b"> >+ <div id="opacnav" class="container"> >+ [% INCLUDE 'navigation.inc' %] >+ </div> >+[% END %] >+ >+</div> >+[% INCLUDE 'opac-bottom.inc' %] >diff --git a/mainpage.pl b/mainpage.pl >index 06fee5c..9085630 100755 >--- a/mainpage.pl >+++ b/mainpage.pl >@@ -32,7 +32,7 @@ use Koha::Borrower::Modifications; > > my $query = new CGI; > >-my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >+my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( > { > template_name => "intranet-main.tmpl", > query => $query, >@@ -50,11 +50,17 @@ $template->param( > koha_news_count => $koha_news_count > ); > >+my $branch = >+ C4::Context->preference("IndependantBranches") >+ && !$flags->{'superlibrarian'} >+ ? C4::Context->userenv()->{'branch'} >+ : undef; >+ > my $pendingcomments = numberofreviews(0); > my $pendingtags = get_count_by_tag_status(0); > my $pendingsuggestions = CountSuggestion("ASKED"); > my $pending_borrower_modifications = >- Koha::Borrower::Modifications->GetPendingModificationsCount(); >+ Koha::Borrower::Modifications->GetPendingModificationsCount( $branch ); > > $template->param( > pendingcomments => $pendingcomments, >diff --git a/members/members-update-do.pl b/members/members-update-do.pl >index 147975a..e7b7b28 100755 >--- a/members/members-update-do.pl >+++ b/members/members-update-do.pl >@@ -61,4 +61,4 @@ foreach my $param (@params) { > } > } > >-print $query->redirect("/cgi-bin/koha/mainpage.pl"); >+print $query->redirect("/cgi-bin/koha/members/members-update.pl"); >diff --git a/members/members-update.pl b/members/members-update.pl >index 9ffcf42..334d83b 100755 >--- a/members/members-update.pl >+++ b/members/members-update.pl >@@ -30,7 +30,7 @@ use Koha::Borrower::Modifications; > > my $query = new CGI; > >-my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >+my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( > { > template_name => "members/members-update.tmpl", > query => $query, >@@ -41,8 +41,14 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > } > ); > >+my $branch = >+ C4::Context->preference("IndependantBranches") >+ && !$flags->{'superlibrarian'} >+ ? C4::Context->userenv()->{'branch'} >+ : undef; >+ > my $pending_modifications = >- Koha::Borrower::Modifications->GetPendingModifications(); >+ Koha::Borrower::Modifications->GetPendingModifications($branch); > > my $borrowers; > foreach my $pm (@$pending_modifications) { >diff --git a/misc/cronjobs/delete_expired_opac_registrations.pl b/misc/cronjobs/delete_expired_opac_registrations.pl >index c588b03..86f47c5 100755 >--- a/misc/cronjobs/delete_expired_opac_registrations.pl >+++ b/misc/cronjobs/delete_expired_opac_registrations.pl >@@ -18,6 +18,7 @@ > # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > > use Modern::Perl; >+use Getopt::Long; > > BEGIN { > >@@ -30,11 +31,36 @@ BEGIN { > use C4::Context; > use C4::Members qw/ DelMember /; > >+my $help; >+my $confirm; >+ >+GetOptions( >+ 'h|help' => \$help, >+ 'c|confirm' => \$confirm, >+); >+my $usage = << 'ENDUSAGE'; >+ >+This script remove confirmed OPAC based patron registrations >+that have not been changed from the patron category specified >+in the system preference PatronSelfRegistrationDefaultCategory >+within the required time period. >+ >+This script has the following parameters : >+ -h --help: This message >+ >+ -c --confirm: Without this flag set, this script will do nothing. >+ENDUSAGE >+ >+if ( $help || !$confirm ) { >+ print $usage; >+ exit; >+} >+ > ## Delete accounts that haven't been upgraded from the 'temporary' category code' > my $delay = > C4::Context->preference('PatronSelfRegistrationExpireTemporaryAccountsDelay'); > my $category_code = >- C4::Context->preference('PatronSelfRegistrationUseTemporaryStatus'); >+ C4::Context->preference('PatronSelfRegistrationDefaultCategory'); > > my $query = " > SELECT borrowernumber >diff --git a/misc/cronjobs/delete_unverified_opac_registrations.pl b/misc/cronjobs/delete_unverified_opac_registrations.pl >index 78c2137..62816d5 100755 >--- a/misc/cronjobs/delete_unverified_opac_registrations.pl >+++ b/misc/cronjobs/delete_unverified_opac_registrations.pl >@@ -18,6 +18,7 @@ > # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > > use Modern::Perl; >+use Getopt::Long; > > BEGIN { > >@@ -30,6 +31,34 @@ BEGIN { > use C4::Context; > use C4::Members qw/ DelMember /; > >+my $help; >+my $confirm; >+my $hours = 24; >+ >+GetOptions( >+ 'h|help' => \$help, >+ 'c|confirm' => \$confirm, >+ 't|time=i' => \$hours, >+); >+my $usage = << 'ENDUSAGE'; >+ >+This script removes unconfirmed OPAC based patron registrations >+that have not been confirmed within the required time period. >+ >+This script has the following parameters : >+ -h --help: This message >+ >+ -t --time: The length in hours to wait before removing an unconfirmed registration. >+ Defaults to 24 hours if not set. >+ >+ -c --confirm: Without this flag set, this script will do nothing. >+ENDUSAGE >+ >+if ( $help || !$confirm ) { >+ print $usage; >+ exit; >+} >+ > my $dbh = C4::Context->dbh; > > $dbh->do( " >@@ -37,5 +66,5 @@ $dbh->do( " > WHERE > borrowernumber = 0 > AND >- TIME_TO_SEC( TIMEDIFF( NOW(), timestamp )) / 3600 > 24 >-" ); >+ TIME_TO_SEC( TIMEDIFF( NOW(), timestamp )) / 3600 > ? >+", undef, $hours ); >diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl >index cf24176..20ec9db 100755 >--- a/opac/opac-memberentry.pl >+++ b/opac/opac-memberentry.pl >@@ -30,11 +30,6 @@ use C4::Branch qw(GetBranchesLoop); > my $cgi = new CGI; > my $dbh = C4::Context->dbh; > >-unless ( C4::Context->preference('PatronSelfRegistration') ) { >- print $cgi->redirect("/cgi-bin/koha/opac-main.pl"); >- exit; >-} >- > my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > { > template_name => "opac-memberentry.tmpl", >@@ -44,21 +39,38 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > } > ); > >+unless ( C4::Context->preference('PatronSelfRegistration') || $borrowernumber ) >+{ >+ print $cgi->redirect("/cgi-bin/koha/opac-main.pl"); >+ exit; >+} >+ >+my $action = $cgi->param('action') || q{}; >+if ( $action eq q{} ) { >+ if ($borrowernumber) { >+ $action = 'edit'; >+ } >+ else { >+ $action = 'new'; >+ } >+} >+ > $template->param( >- hidden => GetHiddenFields(), >- mandatory => GetMandatoryFields(), >- member_titles => GetTitles(), >- branches => GetBranchesLoop() >+ action => $action, >+ hidden => GetHiddenFields(), >+ mandatory => GetMandatoryFields($action), >+ member_titles => GetTitles(), >+ branches => GetBranchesLoop(), >+ OPACPatronDetails => C4::Context->preference('OPACPatronDetails'), > ); > >-my $action = $cgi->param('action') || q{}; > if ( $action eq 'create' ) { > > my %borrower = ParseCgiForBorrower($cgi); > > %borrower = DelEmptyFields(%borrower); > >- my @empty_mandatory_fields = CheckMandatoryFields( \%borrower ); >+ my @empty_mandatory_fields = CheckMandatoryFields( \%borrower, $action ); > > if (@empty_mandatory_fields) { > $template->param( >@@ -144,30 +156,44 @@ if ( $action eq 'create' ) { > } > } > elsif ( $action eq 'update' ) { >- ( $template, $borrowernumber, $cookie ) = get_template_and_user( >- { >- template_name => "opac-memberentry-update-submitted.tmpl", >- type => "opac", >- query => $cgi, >- authnotrequired => 1, >- } >- ); > > my %borrower = ParseCgiForBorrower($cgi); > >- %borrower = DelUnchangedFields( $borrowernumber, %borrower ); >+ my %borrower_changes = DelEmptyFields(%borrower); >+ my @empty_mandatory_fields = >+ CheckMandatoryFields( \%borrower_changes, $action ); > >- my $m = >- Koha::Borrower::Modifications->new( borrowernumber => $borrowernumber ); >+ if (@empty_mandatory_fields) { >+ $template->param( >+ empty_mandatory_fields => \@empty_mandatory_fields, >+ borrower => \%borrower >+ ); > >- $m->DelModifications; >- $m->AddModifications(%borrower); >-} >-elsif ($borrowernumber) { #Display logged in borrower's data >- $action = 'edit'; >+ $template->param( action => 'edit' ); >+ } >+ else { >+ ( $template, $borrowernumber, $cookie ) = get_template_and_user( >+ { >+ template_name => "opac-memberentry-update-submitted.tmpl", >+ type => "opac", >+ query => $cgi, >+ authnotrequired => 1, >+ } >+ ); > >+ my %borrower_changes = DelUnchangedFields( $borrowernumber, %borrower ); >+ >+ my $m = >+ Koha::Borrower::Modifications->new( >+ borrowernumber => $borrowernumber ); >+ >+ $m->DelModifications; >+ $m->AddModifications(%borrower_changes); >+ } >+} >+elsif ( $action eq 'edit' ) { #Display logged in borrower's data > $template->param( >- borrower => GetMember( borrowernumber => $borrowernumber ) ); >+ borrower => GetMember( borrowernumber => $borrowernumber ), ); > } > > my $captcha = random_string("CCCCC"); >@@ -177,8 +203,6 @@ $template->param( > captcha_digest => md5_base64($captcha) > ); > >-$template->param( action => $action ); >- > output_html_with_http_headers $cgi, $cookie, $template->output; > > sub GetHiddenFields { >@@ -197,6 +221,8 @@ sub GetHiddenFields { > } > > sub GetMandatoryFields { >+ my ($action) = @_; >+ > my %mandatory_fields; > > my $BorrowerMandatoryField = >@@ -208,18 +234,21 @@ sub GetMandatoryFields { > $mandatory_fields{$_} = 1; > } > >- $mandatory_fields{'email'} = 1 >- if C4::Context->boolean_preference('PatronSelfRegistrationVerifyByEmail'); >+ if ( $action eq 'create' || $action eq 'new' ) { >+ $mandatory_fields{'email'} = 1 >+ if C4::Context->boolean_preference( >+ 'PatronSelfRegistrationVerifyByEmail'); >+ } > > return \%mandatory_fields; > } > > sub CheckMandatoryFields { >- my ($borrower) = @_; >+ my ( $borrower, $action ) = @_; > > my @empty_mandatory_fields; > >- my $mandatory_fields = GetMandatoryFields(); >+ my $mandatory_fields = GetMandatoryFields($action); > delete $mandatory_fields->{'cardnumber'}; > > foreach my $key ( keys %$mandatory_fields ) { >@@ -236,9 +265,10 @@ sub ParseCgiForBorrower { > my %borrower; > > foreach ( $cgi->param ) { >- my ($key) = substr( $_, 9 ); >- $borrower{$key} = $cgi->param($_) >- if ( $_ =~ '^borrower_' ); >+ if ( $_ =~ '^borrower_' ) { >+ my ($key) = substr( $_, 9 ); >+ $borrower{$key} = $cgi->param($_); >+ } > } > > $borrower{'dateofbirth'} = >diff --git a/opac/opac-registration-verify.pl b/opac/opac-registration-verify.pl >index bf0eae4..682dacb 100755 >--- a/opac/opac-registration-verify.pl >+++ b/opac/opac-registration-verify.pl >@@ -32,22 +32,23 @@ unless ( C4::Context->preference('PatronSelfRegistration') ) { > exit; > } > >-my ( $template, $borrowernumber, $cookie ) = get_template_and_user( >- { >- template_name => "opac-registration-confirmation.tmpl", >- type => "opac", >- query => $cgi, >- authnotrequired => 1, >- } >-); >- >-$template->param( >- OpacPasswordChange => C4::Context->preference('OpacPasswordChange') ); >- > my $token = $cgi->param('token'); > my $m = Koha::Borrower::Modifications->new( verification_token => $token ); > >+my ( $template, $borrowernumber, $cookie ); > if ( $m->Verify() ) { >+ ( $template, $borrowernumber, $cookie ) = get_template_and_user( >+ { >+ template_name => "opac-registration-confirmation.tmpl", >+ type => "opac", >+ query => $cgi, >+ authnotrequired => 1, >+ } >+ ); >+ >+ $template->param( >+ OpacPasswordChange => C4::Context->preference('OpacPasswordChange') ); >+ > my $borrower = $m->GetModifications(); > > my $password; >@@ -68,7 +69,14 @@ if ( $m->Verify() ) { > > } > else { >- >+ ( $template, $borrowernumber, $cookie ) = get_template_and_user( >+ { >+ template_name => "opac-registration-invalid.tmpl", >+ type => "opac", >+ query => $cgi, >+ authnotrequired => 1, >+ } >+ ); > } > > output_html_with_http_headers $cgi, $cookie, $template->output; >-- >1.7.9.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 7067
:
11960
|
11961
|
11962
|
11965
|
11966
|
11967
|
11968
|
11970
|
11973
|
11978
|
12006
|
12007
|
12013
|
12104
|
12109
|
12114
|
12116
|
12129
|
12135
|
12136
|
12138
|
12153
|
12154
|
12171
|
12190
|
12191
|
12196
|
12197
|
12242
|
12243
|
12244
|
12245
|
12277
|
12278
|
13038
|
13039
|
13040
|
13048
|
13053
|
13259
|
13260
|
13744
|
13745
|
13746
|
13747
|
13748
|
13765
|
13766
|
13767
|
13768
|
13769
|
13984
|
14001
|
14085
|
14086
|
14087
|
14088
|
14089
|
14090
|
14092
|
14093
|
14119
|
14190
|
14191
|
14193
|
14194
|
14282
|
14283