Bug 20847: Add more fields to the Batch Patron Modification tool
authorDavid Roberts <david@koha-ptfs.co.uk>
Fri, 24 Jan 2020 02:15:46 +0000 (02:15 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Wed, 29 Jan 2020 09:07:33 +0000 (09:07 +0000)
This patch adds streetnumber, address, address2, phone and mobile to the
Batch Patron Modify form, also moves Primary email to a more logical
place on the page

To test:

1) Install patch
2) Open Batch Patron Modification tool, and input a borrowernumber to
edit
3) Add some data into the streetnumber, address, address2, phone and
mobile fields and click Save
4) These fields in the user record should now contain your data
5) Test that running the tool again with the option to delete the data
clears the fields correctly
6) Repeat steps 1-5 with a file of user borrowernumbers

Signed-off-by: Daniel J <daniel.jones@cheshiresharedservices.gov.uk>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt
tools/modborrowers.pl

index 63ad371..adcb860 100644 (file)
                                                 <th>First name</th>
                                                 <th>Library</th>
                                                 <th>Patron category</th>
+                                                <th>Street number</th>
+                                                <th>Address</th>
+                                                <th>Address 2</th>
                                                 <th>City</th>
                                                 <th>State</th>
                                                 <th>ZIP/Postal code</th>
                                                 <th>Country</th>
+                                                <th>Primary email</th>
+                                                <th>Phone</th>
+                                                <th>Mobile</th>
                                                 <th class="title-string">Registration date</th>
                                                 <th class="title-string">Expiry date</th>
                                                 <th>Circulation note</th>
                                                 <th>OPAC note</th>
-                                                <th>Primary email</th>
                                                 <th>Restriction expiration</th>
                                                 <th>Restriction comment</th>
                                                 [% FOREACH attrh IN attributes_header %]
                                                     <td>[% borrower.firstname | html %]</td>
                                                     <td>[% Branches.GetName( borrower.branchcode ) | html %]</td>
                                                     <td>[% Categories.GetName(borrower.categorycode) | html %]</td>
+                                                    <td>[% borrower.streetnumber | html %]</td>
+                                                    <td>[% borrower.address | html %]</td>
+                                                    <td>[% borrower.address2 | html %]</td>
                                                     <td>[% borrower.city | html %]</td>
                                                     <td>[% borrower.state | html %]</td>
                                                     <td>[% borrower.zipcode | html %]</td>
                                                     <td>[% borrower.country | html %]</td>
+                                                    <td>[% borrower.email | html %]</td>
+                                                    <td>[% borrower.phone | html %]</td>
+                                                    <td>[% borrower.mobile | html %]</td>
                                                     <td><span title="[% borrower.dateenrolled | html %]">[% borrower.dateenrolled | $KohaDates %]</span></td>
                                                     <td><span title="[% borrower.dateexpiry | html %]">[% borrower.dateexpiry | $KohaDates %]</span></td>
                                                     <td>[% borrower.borrowernotes | html %]</td>
                                                     <td>[% borrower.opacnote | html %]</td>
-                                                    <td>[% borrower.email | html %]</td>
                                                     <td><span title="[% borrower.debarred | html %]">[% borrower.debarred | $KohaDates %]</span></td>
                                                     <td>[% borrower.debarredcomment | html %]</td>
                                                     [% FOREACH pa IN borrower.patron_attributes %]
                                                 Library:
                                                 [% CASE 'categorycode' %]
                                                 Patron category:
+                                                [% CASE 'streetnumber' %]
+                                                Street number:
+                                                [% CASE 'address' %]
+                                                Address:
+                                                [% CASE 'address2' %]
+                                                Address 2:
                                                 [% CASE 'city' %]
                                                 City:
                                                 [% CASE 'state' %]
                                                 ZIP/Postal code:
                                                 [% CASE 'country' %]
                                                 Country:
+                                                [% CASE 'email' %]
+                                                Primary email:
+                                                [% CASE 'phone' %]
+                                                Phone:
+                                                [% CASE 'mobile' %]
+                                                Mobile:
                                                 [% CASE 'sort1' %]
                                                 Sort 1:
                                                 [% CASE 'sort2' %]
                                                 Circulation note:
                                                 [% CASE 'opacnote' %]
                                                 OPAC note:
-                                                [% CASE 'email' %]
-                                                Primary email:
                                                 [% CASE 'debarred' %]
                                                 Restriction expiration:
                                                 [% CASE 'debarredcomment' %]
index 4809362..be9852a 100755 (executable)
@@ -203,6 +203,24 @@ if ( $op eq 'show' ) {
         }
         ,
         {
+            name => "streetnumber",
+            type => "text",
+            mandatory => ( grep /streetnumber/, @mandatoryFields ) ? 1 : 0,
+        }
+        ,
+        {
+            name => "address",
+            type => "text",
+            mandatory => ( grep /address/, @mandatoryFields ) ? 1 : 0,
+        }
+        ,
+        {
+            name => "address2",
+            type => "text",
+            mandatory => ( grep /address2/, @mandatoryFields ) ? 1 : 0,
+        }
+        ,
+        {
             name => "city",
             type => "text",
             mandatory => ( grep /city/, @mandatoryFields ) ? 1 : 0,
@@ -227,6 +245,24 @@ if ( $op eq 'show' ) {
         }
         ,
         {
+            name => "email",
+            type => "text",
+            mandatory => ( grep /email/, @mandatoryFields ) ? 1 : 0,
+        }
+        ,
+        {
+            name => "phone",
+            type => "text",
+            mandatory => ( grep /phone/, @mandatoryFields ) ? 1 : 0,
+        }
+        ,
+        {
+            name => "mobile",
+            type => "text",
+            mandatory => ( grep /mobile/, @mandatoryFields ) ? 1 : 0,
+        }
+        ,
+        {
             name => "sort1",
             type => @sort1_option ? "select" : "text",
             option => \@sort1_option,
@@ -265,12 +301,6 @@ if ( $op eq 'show' ) {
         }
         ,
         {
-            name => "email",
-            type => "text",
-            mandatory => ( grep /email/, @mandatoryFields ) ? 1 : 0,
-        }
-        ,
-        {
             name => "debarred",
             type => "date",
             mandatory => ( grep /debarred/, @mandatoryFields ) ? 1 : 0,
@@ -294,7 +324,7 @@ if ( $op eq 'do' ) {
 
     my @disabled = $input->multi_param('disable_input');
     my $infos;
-        for my $field ( qw/surname firstname branchcode categorycode city state zipcode country sort1 sort2 dateenrolled dateexpiry borrowernotes opacnote email/ ) {
+        for my $field ( qw/surname firstname branchcode categorycode streetnumber address address2 city state zipcode country email phone mobile sort1 sort2 dateenrolled dateexpiry borrowernotes opacnote/ ) {
         my $value = $input->param($field);
         $infos->{$field} = $value if $value;
         $infos->{$field} = "" if grep { /^$field$/ } @disabled;