folio-migration-tools 1.9.0a7__py3-none-any.whl → 1.9.0rc1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,6 @@ import logging
3
3
  import sys
4
4
  from os import environ
5
5
  from pathlib import Path
6
- from sqlite3 import connect
7
6
 
8
7
  import httpx
9
8
  import humps
@@ -165,7 +165,7 @@ class ItemMapper(MappingFileMapperBase):
165
165
  legacy_item,
166
166
  folio_prop_name,
167
167
  index_or_id,
168
- False,
168
+ self.task_configuration.prevent_permanent_location_map_default,
169
169
  )
170
170
  elif folio_prop_name == "temporaryLocationId":
171
171
  if not self.temp_location_mapping:
@@ -25,6 +25,8 @@ from folio_migration_tools.mapping_file_transformation.ref_data_mapping import (
25
25
 
26
26
 
27
27
  class CompositeOrderMapper(MappingFileMapperBase):
28
+ VALID_PO_NUMBER_CHARACTERS = r"[A-Za-z0-9]"
29
+
28
30
  def __init__(
29
31
  self,
30
32
  folio_client: FolioClient,
@@ -364,6 +366,8 @@ class CompositeOrderMapper(MappingFileMapperBase):
364
366
  return {}
365
367
 
366
368
  def perform_additional_mapping(self, index_or_id, composite_order):
369
+ self.validate_po_number(index_or_id, composite_order.get("poNumber"))
370
+
367
371
  # Get organization UUID from FOLIO
368
372
  composite_order["vendor"] = self.get_folio_organization_uuid(
369
373
  index_or_id, composite_order.get("vendor")
@@ -376,6 +380,22 @@ class CompositeOrderMapper(MappingFileMapperBase):
376
380
 
377
381
  return composite_order
378
382
 
383
+ def validate_po_number(
384
+ self,
385
+ index_or_id: str,
386
+ po_number: str,
387
+ ):
388
+ if re.sub(self.VALID_PO_NUMBER_CHARACTERS, "", po_number):
389
+ self.migration_report.add(
390
+ "PurchaseOrderVendorLinking",
391
+ i18n.t("RECORD FAILED: PO number has invalid character(s)"),
392
+ )
393
+ raise TransformationRecordFailedError(
394
+ index_or_id,
395
+ "Purchase Order number has invalid character(s)",
396
+ po_number,
397
+ )
398
+
379
399
  def get_matching_record_from_folio(
380
400
  self,
381
401
  index_or_id,
@@ -846,7 +846,7 @@ class Conditions:
846
846
  self.mapper.migration_report.add(
847
847
  "StaffOnlyViaIndicator",
848
848
  f"{marc_field.tag} indicator1: {ind1} ("
849
- + i18n.t("1 is public, all other values are Staff only")
849
+ + i18n.t("0 is staff-only, all other values are public")
850
850
  + ")",
851
851
  )
852
852
  if ind1 == "0":
@@ -864,4 +864,30 @@ class Conditions:
864
864
  raise TransformationProcessError(
865
865
  legacy_id,
866
866
  f"Subject type not found for {parameter['name']} {marc_field}",
867
- )
867
+ )
868
+
869
+ def condition_set_subject_source_id(self, legacy_id, value, parameter, marc_field: field.Field):
870
+ try:
871
+ t = self.get_ref_data_tuple_by_name(
872
+ self.folio.folio_get_all("/subject-sources", "subjectSources"), "subject_sources", parameter["name"]
873
+ )
874
+ self.mapper.migration_report.add("MappedSubjectSources", t[1])
875
+ return t[0]
876
+ except Exception:
877
+ raise TransformationProcessError(
878
+ legacy_id,
879
+ f"Subject source not found for {parameter['name']} {marc_field}",
880
+ )
881
+
882
+ def condition_set_subject_source_id_by_code(self, legacy_id, value, parameter, marc_field: field.Field):
883
+ try:
884
+ t = self.get_ref_data_tuple_by_code(
885
+ self.folio.folio_get_all("/subject-sources", "subjectSources"), "subject_sources", value
886
+ )
887
+ self.mapper.migration_report.add("MappedSubjectSources", t[1])
888
+ return t[0]
889
+ except Exception:
890
+ raise TransformationProcessError(
891
+ legacy_id,
892
+ f"Subject source not found for {value} {marc_field}",
893
+ )
@@ -5,7 +5,6 @@ import sys
5
5
  import time
6
6
  import traceback
7
7
  from datetime import datetime
8
- from math import log
9
8
  from typing import Annotated, List
10
9
  from uuid import uuid4
11
10
 
@@ -68,6 +68,15 @@ class ItemsTransformer(MigrationTaskBase):
68
68
  ),
69
69
  ),
70
70
  ] = ""
71
+ prevent_permanent_location_map_default: Annotated[
72
+ bool,
73
+ Field(
74
+ title="Prevent permanent location map default",
75
+ description=(
76
+ "Prevent the default mapping of permanent location to the default location."
77
+ ),
78
+ ),
79
+ ] = False
71
80
 
72
81
  @staticmethod
73
82
  def get_object_type() -> FOLIONamespaces:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: folio_migration_tools
3
- Version: 1.9.0a7
3
+ Version: 1.9.0rc1
4
4
  Summary: A tool allowing you to migrate data from legacy ILS:s (Library systems) into FOLIO LSP
5
5
  License: MIT
6
6
  Keywords: FOLIO,ILS,LSP,Library Systems,MARC21,Library data
@@ -26,7 +26,8 @@ Requires-Dist: pyhumps (>=3.7.3,<4.0.0)
26
26
  Requires-Dist: pymarc (>=5.2.3,<6.0.0)
27
27
  Requires-Dist: python-dateutil (>=2.8.2,<3.0.0)
28
28
  Requires-Dist: python-i18n (>=0.3.9,<0.4.0)
29
- Project-URL: Homepage, https://github.com/FOLIO-FSE/folio_migration_tools
29
+ Project-URL: Documentation, https://folio-migration-tools.readthedocs.io/en/latest/
30
+ Project-URL: Homepage, https://github.com/folio-fse/folio_migration_tools
30
31
  Project-URL: Repository, https://github.com/FOLIO-FSE/folio_migration_tools
31
32
  Description-Content-Type: text/markdown
32
33
 
@@ -1,5 +1,5 @@
1
1
  folio_migration_tools/__init__.py,sha256=yTPImroNb0CPuYmG4nm6aAcu5gpFJ7o1uM2dJS-47ec,93
2
- folio_migration_tools/__main__.py,sha256=etBycP4P9KkbpLcI4sWqwHaVyP8_OQeg-uJOESt5adY,7310
2
+ folio_migration_tools/__main__.py,sha256=0rbCmTq4HTxj8M3UjvX3rOEkq6-YqvaSGEMmuCORbho,7282
3
3
  folio_migration_tools/circulation_helper.py,sha256=2kAkLM6caPiep0ZtBkMICbRDh53KdfdH21oEX1eMRDI,14193
4
4
  folio_migration_tools/colors.py,sha256=GP0wdI_GZ2WD5SjrbPN-S3u8vvN_u6rGQIBBcWv_0ZM,227
5
5
  folio_migration_tools/config_file_load.py,sha256=zHHa6NDkN6EJiQE4DgjrFQPVKsd70POsfbGkB8308jg,2822
@@ -15,16 +15,16 @@ folio_migration_tools/mapper_base.py,sha256=4rtZxmWp1qaAIG2awiJ3RElPM9IVA-n8-Qzz
15
15
  folio_migration_tools/mapping_file_transformation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  folio_migration_tools/mapping_file_transformation/courses_mapper.py,sha256=mJQxxeTn1bCYb2zwFYyXJ6EGZpJ0DsmwOY3nED7D_gQ,8091
17
17
  folio_migration_tools/mapping_file_transformation/holdings_mapper.py,sha256=GI9xnN74EsUMAshXKNJ6p9bGPdLtK0PCXqbB3nIxrC8,7207
18
- folio_migration_tools/mapping_file_transformation/item_mapper.py,sha256=oT64nczTM7XNAA_8PaFMIxaMiu3wzTg8z8SUA-OLRA0,10379
18
+ folio_migration_tools/mapping_file_transformation/item_mapper.py,sha256=RR8eqbHaGrwtYl2HIouIfiS5B52mErD7eeOMhj_L2NU,10436
19
19
  folio_migration_tools/mapping_file_transformation/manual_fee_fines_mapper.py,sha256=nCkqbxaDHKxMuqQHh_afxQp48YrVD-SeCZ0L1iGvnkk,13402
20
20
  folio_migration_tools/mapping_file_transformation/mapping_file_mapper_base.py,sha256=RacwSOP6r6i28EOywaepq5K5FimD8Ld5MlBo89FYO7c,37963
21
21
  folio_migration_tools/mapping_file_transformation/notes_mapper.py,sha256=auLQZqa4rSJo_MIV4Lc5-LG8RcBpp2bnKH243qNYq_0,3470
22
- folio_migration_tools/mapping_file_transformation/order_mapper.py,sha256=Bn9OnVmOA5k8XyB1Lpllc0pL-RO71A_VSBjoZVV1eJ0,16786
22
+ folio_migration_tools/mapping_file_transformation/order_mapper.py,sha256=z7FGQ9BDSgIM3AWzw_lw90Ee7zH_zzW2mNqD5iMhr_I,17464
23
23
  folio_migration_tools/mapping_file_transformation/organization_mapper.py,sha256=0zjw0-C-qTYH9GC6FDBElucWCZWdoOiTHOY7q9_4NQg,14571
24
24
  folio_migration_tools/mapping_file_transformation/ref_data_mapping.py,sha256=qFsn_LwKZeKFdOudfEQnNA3DEHOdNQVKzTPdZAlDPX0,8864
25
25
  folio_migration_tools/mapping_file_transformation/user_mapper.py,sha256=oWuIPRQL0anF_qTVFibHtc1oOaqyKCBH4O1hX5rQAZQ,7806
26
26
  folio_migration_tools/marc_rules_transformation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
- folio_migration_tools/marc_rules_transformation/conditions.py,sha256=MnbMThiOZ6IenXirjMSNkqJ86RtFzbF4cp1T4YcfpyA,36349
27
+ folio_migration_tools/marc_rules_transformation/conditions.py,sha256=17AkmOFU2Ha3Ezg2WTE0NeZafKKW6_MDJkia1TvWdKA,37512
28
28
  folio_migration_tools/marc_rules_transformation/holdings_statementsparser.py,sha256=lTb5QWEAgwyFHy5vdSK6oDl1Q5v2GnzuV04xWV3p4rc,12401
29
29
  folio_migration_tools/marc_rules_transformation/hrid_handler.py,sha256=Ihdv0_1q7gL_pZ3HWU3GcfV_jjpIfOLithWk9z_uH3Y,9997
30
30
  folio_migration_tools/marc_rules_transformation/loc_language_codes.xml,sha256=ztn2_yKws6qySL4oSsZh7sOjxq5bCC1PhAnXJdtgmJ0,382912
@@ -37,12 +37,12 @@ folio_migration_tools/marc_rules_transformation/rules_mapper_holdings.py,sha256=
37
37
  folio_migration_tools/migration_report.py,sha256=BkRspM1hwTBnWeqsHamf7yVEofzLj560Q-9G--O00hw,4258
38
38
  folio_migration_tools/migration_tasks/__init__.py,sha256=ZkbY_yGyB84Ke8OMlYUzyyBj4cxxNrhMTwQlu_GbdDs,211
39
39
  folio_migration_tools/migration_tasks/authority_transformer.py,sha256=AoXg9s-GLO3yEEDCrQV7hc4YVXxwxsdxDdpj1zhHydE,4251
40
- folio_migration_tools/migration_tasks/batch_poster.py,sha256=yQa72SA2sCDCcPgWrdP0jPixG2J6z5_Bhe9NzEDhzBA,30750
40
+ folio_migration_tools/migration_tasks/batch_poster.py,sha256=6-PMMvhdoFbydIGeN1duHcoHMEFe4ePGzMX6tP5gxSs,30729
41
41
  folio_migration_tools/migration_tasks/bibs_transformer.py,sha256=XzlPo-0uuugJA4SM80xOlOj5nDK6OMDXFnAYg80hOBc,7791
42
42
  folio_migration_tools/migration_tasks/courses_migrator.py,sha256=dQerp97P3r7wmxK3Ovg6AriO6K_nTr6vA8RKj_XBEt4,5728
43
43
  folio_migration_tools/migration_tasks/holdings_csv_transformer.py,sha256=Hwr4YjgNIQpi2N-x8eq-mmRpXAyxYylQjpYubm03-ec,19668
44
44
  folio_migration_tools/migration_tasks/holdings_marc_transformer.py,sha256=yN0a8YVNx2P6NswxSylTca0MmNk1shze3PyKXv9JJIw,9547
45
- folio_migration_tools/migration_tasks/items_transformer.py,sha256=MOpnw1yvNKc6x4ZNjlB1nA2XiXMFdAso-8v2bET5tbE,15011
45
+ folio_migration_tools/migration_tasks/items_transformer.py,sha256=S3RZDKL8lQbO6V8RWzzV_aB_L8fjoNF78DTi9hnKpH4,15350
46
46
  folio_migration_tools/migration_tasks/loans_migrator.py,sha256=PCjr_bC2ixhPPk_D54m7B871_bQObn5oP_Sow3ocg54,33238
47
47
  folio_migration_tools/migration_tasks/manual_fee_fines_transformer.py,sha256=CnmlTge7nChUJ10EiUkriQtJlVxWqglgfhjgneh2_yM,7247
48
48
  folio_migration_tools/migration_tasks/migration_task_base.py,sha256=5vVkBqUvCGuGPUyWlnKsLCFtgOQzq4jjBK_TBUHs7BE,13742
@@ -60,7 +60,8 @@ folio_migration_tools/transaction_migration/legacy_request.py,sha256=1ulyFzPQw_I
60
60
  folio_migration_tools/transaction_migration/legacy_reserve.py,sha256=rZVtiMBYnt6aI0WxAwPN8fML_MKEUSUYsadCKPTeB4E,1839
61
61
  folio_migration_tools/transaction_migration/transaction_result.py,sha256=cTdCN0BnlI9_ZJB2Z3Fdkl9gpymIi-9mGZsRFlQcmDk,656
62
62
  folio_migration_tools/translations/en.json,sha256=HOVpkb_T-SN_x0NpDp8gyvV1hMLCui3SsG7ByyIv0OU,38669
63
- folio_migration_tools-1.9.0a7.dist-info/LICENSE,sha256=PhIEkitVi3ejgq56tt6sWoJIG_zmv82cjjd_aYPPGdI,1072
64
- folio_migration_tools-1.9.0a7.dist-info/METADATA,sha256=vvVvLOBAoK-NY7na8o2wF7llFGWy74ExfyZBgbKpwYA,7330
65
- folio_migration_tools-1.9.0a7.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
66
- folio_migration_tools-1.9.0a7.dist-info/RECORD,,
63
+ folio_migration_tools-1.9.0rc1.dist-info/LICENSE,sha256=PhIEkitVi3ejgq56tt6sWoJIG_zmv82cjjd_aYPPGdI,1072
64
+ folio_migration_tools-1.9.0rc1.dist-info/METADATA,sha256=QxHgnFjxkklcsK5gVrIK7tEFKyk5qodSNa6V_cQbP7E,7415
65
+ folio_migration_tools-1.9.0rc1.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
66
+ folio_migration_tools-1.9.0rc1.dist-info/entry_points.txt,sha256=Hbe-HjqMcU8FwVshVIkeWyZd9XwgT1CCMNf06EpHQu8,77
67
+ folio_migration_tools-1.9.0rc1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 2.0.1
2
+ Generator: poetry-core 2.1.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ folio-migration-tools=folio_migration_tools.__main__:main
3
+