Bug 21585: Ignore missing firstname in ILL requests table
authorMagnus Enger <magnus@libriotech.no>
Tue, 16 Oct 2018 19:25:43 +0000 (21:25 +0200)
committerFridolin Somers <fridolin.somers@biblibre.com>
Wed, 28 Nov 2018 14:06:31 +0000 (15:06 +0100)
To test:
- Make sure you have a patron with just a surname and no firstname
- Create an ILL request so that the name of this patron shows up in
  the Patron column of the ILL requests table
- Before the patch, the name will display as "null Surname"
- Apply the patch
- Reload the ILL requests page
- The name should now display as just "Surname"
- Sign ye merrily off

Signed-off-by: Andrew Isherwood <andrew.isherwood@ptfs-europe.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 5ea877f6cba299373e0ebb9c59f8797baba98bec)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit da971a81da893ca625d78b172ccab8f4131a8664)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt

index e7e0372..3799419 100644 (file)
 
         // Our 'render' function for borrowerlink
         var createPatronLink = function(data, type, row) {
-            return '<a title="' + _("View borrower details") + '" ' +
+            var patronLink = '<a title="' + _("View borrower details") + '" ' +
                 'href="/cgi-bin/koha/members/moremember.pl?' +
-                'borrowernumber='+row.borrowernumber+'">' +
-                row.patron_firstname + ' ' + row.patron_surname +
-                '</a>';
+                'borrowernumber='+row.borrowernumber+'">';
+                if ( row.patron_firstname ) {
+                    patronLink = patronLink + row.patron_firstname + ' ';
+                }
+                patronLink = patronLink + row.patron_surname + '</a>';
+            return patronLink
         };
 
         // Our 'render' function for the library name