remove cr from rfid sid
[koha_ffzg] / ffzg / rfid-sid-cleanup.sql
diff --git a/ffzg/rfid-sid-cleanup.sql b/ffzg/rfid-sid-cleanup.sql
new file mode 100644 (file)
index 0000000..8bfc738
--- /dev/null
@@ -0,0 +1,20 @@
+begin;
+
+select 
+       borrower_attributes.borrowernumber,
+       attribute,
+       replace(attribute,'\r\n','') as sid,
+       length(replace(attribute,'\r\n','')) as len,
+       userid
+from borrower_attributes
+join borrowers on (borrower_attributes.borrowernumber = borrowers.borrowernumber)
+where code = 'RFID_SID'
+and replace(attribute,'\r\n','') != attribute
+;
+
+update borrower_attributes set
+       attribute=replace(attribute,'\r\n','')
+where code = 'RFID_SID'
+and replace(attribute,'\r\n','') != attribute
+;
+