From 96ab341b8b5dd6f15f48b0a367e8eaf4fc6055c4 Mon Sep 17 00:00:00 2001
From: Tomas Cohen Arazi <tomascohen@theke.io>
Date: Wed, 17 Apr 2019 15:06:44 -0300
Subject: [PATCH] Bug 22729: Adapt /patrons controller code to the change

This patch makes the controller code aware of the flgAnonymized =>
anonymized change.

To test:
- Run
  $ kshell
 k$ prove t/db_dependent/api/v1/patrons.t
=> SUCCESS: Tests pass!
- Sign off :-D

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
---
 Koha/REST/V1/Patrons.pm                | 2 --
 api/v1/swagger/definitions/patron.json | 6 +++---
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/Koha/REST/V1/Patrons.pm b/Koha/REST/V1/Patrons.pm
index e4f7ba1125..5e8e398eac 100644
--- a/Koha/REST/V1/Patrons.pm
+++ b/Koha/REST/V1/Patrons.pm
@@ -400,7 +400,6 @@ our $to_api_mapping = {
     debarredcomment     => undef, # calculated, API consumers will use /restrictions instead
     emailpro            => 'secondary_email',
     flags               => undef, # permissions manipulation handled in /permissions
-    flgAnonymized       => 'anonymized',
     gonenoaddress       => 'incorrect_address',
     guarantorid         => 'guarantor_id',
     lastseen            => 'last_seen',
@@ -444,7 +443,6 @@ our $to_api_mapping = {
 
 our $to_model_mapping = {
     altaddress_notes         => 'contactnote',
-    anonymized               => 'flgAnonymized',
     category_id              => 'categorycode',
     check_previous_checkout  => 'checkprevcheckout',
     date_enrolled            => 'dateenrolled',
diff --git a/api/v1/swagger/definitions/patron.json b/api/v1/swagger/definitions/patron.json
index 1e87ffce91..7fca15bf35 100644
--- a/api/v1/swagger/definitions/patron.json
+++ b/api/v1/swagger/definitions/patron.json
@@ -274,9 +274,9 @@
       "description": "persist OverDrive auth token"
     },
     "anonymized": {
-        "type": "boolean",
-        "readOnly": true,
-        "description": "If the patron has been anonymized"
+      "type": "boolean",
+      "readOnly": true,
+      "description": "If the patron has been anonymized"
     }
   },
   "additionalProperties": false,
-- 
2.21.0