diff --git a/CHANGES.rst b/CHANGES.rst
index 4d605ac9eb..462bd2746c 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -28,6 +28,8 @@ Changelog
**Removed**
+- #1430 Removed Identifier Types
+
**Fixed**
diff --git a/bika/lims/__init__.py b/bika/lims/__init__.py
index 96c6c6b44a..baff9c2503 100644
--- a/bika/lims/__init__.py
+++ b/bika/lims/__init__.py
@@ -156,7 +156,6 @@ def initialize(context):
from controlpanel.bika_containers import Containers # noqa
from controlpanel.bika_containertypes import ContainerTypes # noqa
from controlpanel.bika_departments import Departments # noqa
- from controlpanel.bika_identifiertypes import IdentifierTypes # noqa
from controlpanel.bika_instrumentlocations import InstrumentLocations # noqa
from controlpanel.bika_instruments import Instruments # noqa
from controlpanel.bika_instrumenttypes import InstrumentTypes # noqa
diff --git a/bika/lims/adapters/configure.zcml b/bika/lims/adapters/configure.zcml
index 2281f81ea1..e39316b406 100644
--- a/bika/lims/adapters/configure.zcml
+++ b/bika/lims/adapters/configure.zcml
@@ -146,19 +146,6 @@
END OF FIELDS/WIDGETS VISIBILITY
-->
-
-
-
-
-
-
-
-1]
-
- for p in brains:
- rows.append({'IdentifierType': p.Title,
- 'Description': p.Description})
-
- rows = sorted(rows, cmp=lambda x, y: cmp(x.lower(
- ), y.lower()), key=itemgetter(sidx and sidx or 'IdentifierType'))
- if sord == 'desc':
- rows.reverse()
- pages = len(rows) / int(nr_rows)
- pages += divmod(len(rows), int(nr_rows))[1] and 1 or 0
- ret = {'page': page,
- 'total': pages,
- 'records': len(rows),
- 'rows': rows[(int(page) - 1) * int(nr_rows): int(page) * int(
- nr_rows)]}
- return json.dumps(ret)
diff --git a/bika/lims/browser/images/bikalabstellit200x.png b/bika/lims/browser/images/bikalabstellit200x.png
deleted file mode 100644
index e244e0d259..0000000000
Binary files a/bika/lims/browser/images/bikalabstellit200x.png and /dev/null differ
diff --git a/bika/lims/browser/images/identifiertype.png b/bika/lims/browser/images/identifiertype.png
deleted file mode 100644
index 2612d46654..0000000000
Binary files a/bika/lims/browser/images/identifiertype.png and /dev/null differ
diff --git a/bika/lims/browser/images/identifiertype_big.png b/bika/lims/browser/images/identifiertype_big.png
deleted file mode 100644
index 0f6791c029..0000000000
Binary files a/bika/lims/browser/images/identifiertype_big.png and /dev/null differ
diff --git a/bika/lims/content/analysisservice.py b/bika/lims/content/analysisservice.py
index 7e95b90696..7d90271db9 100644
--- a/bika/lims/content/analysisservice.py
+++ b/bika/lims/content/analysisservice.py
@@ -32,7 +32,6 @@
from bika.lims.content.abstractbaseanalysis import schema
from bika.lims.interfaces import IAnalysisService
from bika.lims.interfaces import IDeactivable
-from bika.lims.interfaces import IHaveIdentifiers
from bika.lims.utils import to_utf8 as _c
from magnitude import mg
from Products.Archetypes.public import BooleanField
@@ -419,7 +418,7 @@ def Containers(self, instance=None):
class AnalysisService(AbstractBaseAnalysis):
- implements(IAnalysisService, IHaveIdentifiers, IDeactivable)
+ implements(IAnalysisService, IDeactivable)
security = ClassSecurityInfo()
schema = schema
displayContentsTab = False
diff --git a/bika/lims/content/identifiertype.py b/bika/lims/content/identifiertype.py
index 5da3b90849..dfa168ef1f 100644
--- a/bika/lims/content/identifiertype.py
+++ b/bika/lims/content/identifiertype.py
@@ -32,28 +32,6 @@
from Products.CMFCore.utils import getToolByName
from zope.interface import implements
-from ZODB.POSException import ConflictError
-
-# class IdentifierTypeAttributesField(RecordsField):
-# """Keeps a list of possible attributes for an identifier of this type
-# """
-# _properties = RecordsField._properties.copy()
-# _properties.update({
-# 'fixedSize': False,
-# 'minimalSize': 1,
-# 'maximalSize': 9999,
-# 'type': 'identifiertypeattributes',
-# 'subfields': ('title', 'description'),
-# 'required_subfields': ('title',),
-# 'subfield_labels': {'title': _('Attribute Title'),
-# 'description': _('Description')},
-# 'subfield_sizes': {'title': 20,
-# 'description': 35},
-# 'subfield_validators': {'title': 'identifiertypeattributesvalidator'},
-# })
-# security = ClassSecurityInfo()
-
-
PortalTypes = LinesField(
'PortalTypes',
vocabulary='getPortalTypes',
@@ -63,17 +41,6 @@
),
)
-# Attributes = IdentifierTypeAttributesField(
-# 'Attributes',
-# widget=BikaRecordsWidget(
-# label=_("Identifier attributes"),
-# description=_("Each item identified with this IdentifierType can "
-# "contain additional information. The allowed
-# attributes "
-# "can be specified here."),
-# ),
-# )
-
schema = BikaSchema.copy() + Schema((
PortalTypes,
# Attributes,
@@ -92,7 +59,6 @@ class IdentifierType(BaseContent):
def _renameAfterCreation(self, check_auto_id=False):
from bika.lims.idserver import renameAfterCreation
-
renameAfterCreation(self)
def getPortalTypes(self):
diff --git a/bika/lims/controlpanel/bika_identifiertypes.py b/bika/lims/controlpanel/bika_identifiertypes.py
deleted file mode 100644
index 991f6d583e..0000000000
--- a/bika/lims/controlpanel/bika_identifiertypes.py
+++ /dev/null
@@ -1,135 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# This file is part of SENAITE.CORE.
-#
-# SENAITE.CORE is free software: you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free Software
-# Foundation, version 2.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-# details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc., 51
-# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Copyright 2018-2019 by it's authors.
-# Some rights reserved, see README and LICENSE.
-
-import collections
-
-from bika.lims import bikaMessageFactory as _
-from bika.lims.browser.bika_listing import BikaListingView
-from bika.lims.config import PROJECTNAME
-from bika.lims.interfaces import IIdentifierTypes
-from bika.lims.permissions import AddIdentifierType
-from bika.lims.utils import get_link
-from plone.app.folder.folder import ATFolder
-from plone.app.folder.folder import ATFolderSchema
-from Products.Archetypes.public import registerType
-from Products.ATContentTypes.content import schemata
-from zope.interface.declarations import implements
-
-
-class IdentifierTypesView(BikaListingView):
- """Listing for identifier types
- """
-
- def __init__(self, context, request):
- super(IdentifierTypesView, self).__init__(context, request)
-
- self.catalog = "bika_setup_catalog"
-
- self.contentFilter = {
- "portal_type": "IdentifierType",
- "sort_on": "sortable_title",
- "sort_order": "ascending"
- }
-
- self.context_actions = {
- _("Add"): {
- "url": "createObject?type_name=IdentifierType",
- "permission": AddIdentifierType,
- "icon": "++resource++bika.lims.images/add.png"}}
-
- self.title = self.context.translate(_("Identifier Types"))
- self.description = ""
- self.icon = "{}/{}".format(
- self.portal_url,
- "++resource++bika.lims.images/identifiertype_big.png")
-
- self.show_select_column = True
- self.pagesize = 25
-
- self.columns = collections.OrderedDict((
- ("Title", {
- "title": _("Title"),
- "index": "sortable_title"}),
- ("Description", {
- "title": _("Description"),
- "index": "description",
- "toggle": True}),
- ))
-
- self.review_states = [
- {
- "id": "default",
- "title": _("Active"),
- "contentFilter": {"is_active": True},
- "columns": self.columns.keys(),
- }, {
- "id": "inactive",
- "title": _("Inactive"),
- "contentFilter": {"is_active": False},
- "columns": self.columns.keys(),
- }, {
- "id": "all",
- "title": _("All"),
- "contentFilter": {},
- "columns": self.columns.keys(),
- },
- ]
-
- def before_render(self):
- """Before template render hook
- """
- # Don't allow any context actions
- self.request.set("disable_border", 1)
-
- def folderitem(self, obj, item, index):
- """Applies new properties to the item (Client) that is currently being
- rendered as a row in the list
-
- :param obj: client to be rendered as a row in the list
- :param item: dict representation of the client, suitable for the list
- :param index: current position of the item within the list
- :type obj: ATContentType/DexterityContentType
- :type item: dict
- :type index: int
- :return: the dict representation of the item
- :rtype: dict
- """
-
- url = obj.absolute_url()
- title = obj.Title()
-
- item["Description"] = obj.Description()
- item["replace"]["Title"] = get_link(url, value=title)
-
- return item
-
-
-schema = ATFolderSchema.copy()
-
-
-class IdentifierTypes(ATFolder):
- implements(IIdentifierTypes)
- displayContentsTab = False
- schema = schema
-
-
-schemata.finalizeATCTSchema(schema, folderish=True, moveDiscussion=False)
-
-registerType(IdentifierTypes, PROJECTNAME)
diff --git a/bika/lims/controlpanel/configure.zcml b/bika/lims/controlpanel/configure.zcml
index a58f1e6db7..7f716a03aa 100644
--- a/bika/lims/controlpanel/configure.zcml
+++ b/bika/lims/controlpanel/configure.zcml
@@ -132,14 +132,6 @@
layer="bika.lims.interfaces.IBikaLIMS"
/>
-
-
-
diff --git a/bika/lims/profiles/default/controlpanel.xml b/bika/lims/profiles/default/controlpanel.xml
index dfac638c68..6a056bcca3 100644
--- a/bika/lims/profiles/default/controlpanel.xml
+++ b/bika/lims/profiles/default/controlpanel.xml
@@ -57,15 +57,6 @@
senaite.core: Manage Bika
-
- senaite.core: Manage Bika
-
-
-
-
-
-
-
-
diff --git a/bika/lims/profiles/default/structure/bika_setup/.objects b/bika/lims/profiles/default/structure/bika_setup/.objects
index 6807ec1c4f..06bc8e3f7a 100644
--- a/bika/lims/profiles/default/structure/bika_setup/.objects
+++ b/bika/lims/profiles/default/structure/bika_setup/.objects
@@ -7,7 +7,6 @@ bika_analysisspecs,AnalysisSpecs
bika_attachmenttypes,AttachmentTypes
bika_batchlabels,BatchLabels
bika_calculations,Calculations
-bika_identifiertypes,IdentifierTypes
bika_instruments,Instruments
bika_instrumenttypes,InstrumentTypes
bika_instrumentlocations,InstrumentLocations
diff --git a/bika/lims/profiles/default/structure/bika_setup/.preserve b/bika/lims/profiles/default/structure/bika_setup/.preserve
index de3fc0cf47..e2ec2f2431 100644
--- a/bika/lims/profiles/default/structure/bika_setup/.preserve
+++ b/bika/lims/profiles/default/structure/bika_setup/.preserve
@@ -7,7 +7,6 @@ bika_analysisspecs
bika_attachmenttypes
bika_batchlabels
bika_calculations
-bika_identifiertypes
bika_instruments
bika_instrumenttypes
bika_instrumentlocations
diff --git a/bika/lims/profiles/default/structure/bika_setup/bika_identifiertypes/.objects b/bika/lims/profiles/default/structure/bika_setup/bika_identifiertypes/.objects
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/bika/lims/profiles/default/structure/bika_setup/bika_identifiertypes/.properties b/bika/lims/profiles/default/structure/bika_setup/bika_identifiertypes/.properties
deleted file mode 100644
index e642ce5478..0000000000
--- a/bika/lims/profiles/default/structure/bika_setup/bika_identifiertypes/.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-[DEFAULT]
-description =
-title = Identifier Types
-
diff --git a/bika/lims/profiles/default/types.xml b/bika/lims/profiles/default/types.xml
index 46aa1a67af..6f061295a0 100644
--- a/bika/lims/profiles/default/types.xml
+++ b/bika/lims/profiles/default/types.xml
@@ -38,8 +38,6 @@
-
-
diff --git a/bika/lims/profiles/default/types/IdentifierType.xml b/bika/lims/profiles/default/types/IdentifierType.xml
deleted file mode 100644
index 9f2246840d..0000000000
--- a/bika/lims/profiles/default/types/IdentifierType.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
diff --git a/bika/lims/profiles/default/types/IdentifierTypes.xml b/bika/lims/profiles/default/types/IdentifierTypes.xml
deleted file mode 100644
index 127167d2da..0000000000
--- a/bika/lims/profiles/default/types/IdentifierTypes.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
diff --git a/bika/lims/profiles/default/workflows.xml b/bika/lims/profiles/default/workflows.xml
index 0bccdebd78..cf77360929 100644
--- a/bika/lims/profiles/default/workflows.xml
+++ b/bika/lims/profiles/default/workflows.xml
@@ -203,9 +203,6 @@
-
-
-
diff --git a/bika/lims/setuphandlers.py b/bika/lims/setuphandlers.py
index 3f827566f2..3306643c36 100644
--- a/bika/lims/setuphandlers.py
+++ b/bika/lims/setuphandlers.py
@@ -105,7 +105,6 @@
("Container", ["bika_setup_catalog"]),
("ContainerType", ["bika_setup_catalog"]),
("Department", ["bika_setup_catalog", "portal_catalog"]),
- ("IdentifierType", ["bika_setup_catalog"]),
("Instrument", ["bika_setup_catalog", "portal_catalog"]),
("InstrumentLocation", ["bika_setup_catalog", "portal_catalog"]),
("InstrumentType", ["bika_setup_catalog", "portal_catalog"]),
@@ -134,7 +133,6 @@
("bika_catalog", "BatchDate", "", "DateIndex"),
("bika_catalog", "Creator", "", "FieldIndex"),
("bika_catalog", "Description", "", "ZCTextIndex"),
- ("bika_catalog", "Identifiers", "", "KeywordIndex"),
("bika_catalog", "Title", "", "ZCTextIndex"),
("bika_catalog", "Type", "", "FieldIndex"),
("bika_catalog", "UID", "", "FieldIndex"),
@@ -165,7 +163,6 @@
("bika_setup_catalog", "Creator", "", "FieldIndex"),
("bika_setup_catalog", "Description", "", "ZCTextIndex"),
- ("bika_setup_catalog", "Identifiers", "", "KeywordIndex"),
("bika_setup_catalog", "Title", "", "ZCTextIndex"),
("bika_setup_catalog", "Type", "", "FieldIndex"),
("bika_setup_catalog", "UID", "", "FieldIndex"),
diff --git a/bika/lims/upgrade/v01_03_002.py b/bika/lims/upgrade/v01_03_002.py
index 4a493fab51..ff41c7fe94 100644
--- a/bika/lims/upgrade/v01_03_002.py
+++ b/bika/lims/upgrade/v01_03_002.py
@@ -57,6 +57,9 @@ def upgrade(tool):
# Allow to detach a partition from its primary sample (#1420)
update_partitions_role_mappings(portal)
+ # Remove Identifiers
+ remove_identifiers(portal)
+
# Unindex stale catalog brains from the auditlog_catalog
# https://github.com/senaite/senaite.core/issues/1438
unindex_orphaned_brains_in_auditlog_catalog(portal)
@@ -129,3 +132,39 @@ def update_partitions_role_mappings(portal):
partition.reindexObjectSecurity()
logger.info("Updating role mappings of partitions [DONE]")
+
+
+def remove_identifiers(portal):
+ """Remove Identifiers from the portal
+ """
+ # 1. Remove the identifiers and identifier types
+ logger.info("Removing identifiers ...")
+
+ setup = portal.bika_setup
+ try:
+ # we use _delOb because manage_delObjects raises an unauthorized here
+ it = setup["bika_identifiertypes"]
+ for i in it.objectValues():
+ i.unindexObject()
+ it.unindexObject()
+ setup._delOb("bika_identifiertypes")
+ except KeyError:
+ pass
+
+ # 2. Remove controlpanel configlet
+ cp = portal.portal_controlpanel
+ cp.unregisterConfiglet("bika_identifiertypes")
+
+ # 3. Remove catalog indexes
+ for cat in ["portal_catalog", "bika_catalog", "bika_setup_catalog"]:
+ tool = portal[cat]
+ if "Identifiers" in tool.indexes():
+ tool.manage_delIndex("Identifiers")
+
+ # 4. Remove type registration
+ pt = portal.portal_types
+ for t in ["IdentifierType", "IdentifierTypes"]:
+ if t in pt.objectIds():
+ pt.manage_delObjects(t)
+
+ logger.info("Removing identifiers [DONE]")