Bug 11807: (follow-up) remove date conversions
authorJoonas Kylmälä <j.kylmala@gmail.com>
Mon, 31 Aug 2015 09:41:34 +0000 (09:41 +0000)
committerBrendan A Gallagher <brendan@bywatersolutions.com>
Fri, 1 Apr 2016 19:23:42 +0000 (19:23 +0000)
To test

1/ Apply both patches

2/ This patch lets you easily configure mappings for categorycode values.
These mapping will be used when updating the user's account after a successful LDAP login.

Here is an example configuration :

<config>
  <ldapserver id="ldapserver>
    <mapping>
      <categorycode is="usertype">STU</categorycode>
      ...
    </mapping>

    <categorycode_mapping>
      <categorycode value="STU">STUDENT</categorycode>
      <categorycode value="EMP">EMPLOYEE</categorycode>
    </categorycode_mapping>
  </ldapserver>
</config>

3/ With this configuration, LDAP users with the usertype value "EMP" on the LDAP server should have the "EMPLOYEE" categorycode in Koha.

Signed-off-by: Chris <chris@bigballofwax.co.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>

C4/Auth_with_ldap.pm

index 324783a..c50df76 100644 (file)
@@ -27,7 +27,6 @@ use C4::Members qw(AddMember changepassword);
 use C4::Members::Attributes;
 use C4::Members::AttributeTypes;
 use C4::Members::Messaging;
-use C4::Dates;
 use C4::Auth qw(checkpw_internal);
 use Koha::AuthUtils qw(hash_password);
 use List::MoreUtils qw( any );
@@ -266,11 +265,7 @@ sub ldap_entry_2_hash {
                . substr($borrower{ 'surname' },0,1)
                . " ");
 
-    # Date and categorycode conversions
-    $borrower{'dateexpiry'} = C4::Dates->new($borrower{'dateexpiry'},'sql')->output('iso') if $borrower{'dateexpiry'};
-    $borrower{'dateofbirth'} = C4::Dates->new($borrower{'dateofbirth'},'sql')->output('iso') if $borrower{'dateofbirth'};
-    $borrower{'dateenrolled'} = C4::Dates->new($borrower{'dateenrolled'},'sql')->output('iso') if $borrower{'dateenrolled'};
-
+    # categorycode conversions
     if(defined $categorycode_conversions{$borrower{categorycode}}) {
         $borrower{categorycode} = $categorycode_conversions{$borrower{categorycode}};
     }