senaite /
senaite.health
| 1 | # -*- coding: utf-8 -*- |
||
| 2 | # |
||
| 3 | # This file is part of SENAITE.HEALTH. |
||
| 4 | # |
||
| 5 | # SENAITE.HEALTH is free software: you can redistribute it and/or modify it |
||
| 6 | # under the terms of the GNU General Public License as published by the Free |
||
| 7 | # Software Foundation, version 2. |
||
| 8 | # |
||
| 9 | # This program is distributed in the hope that it will be useful, but WITHOUT |
||
| 10 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
||
| 11 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
||
| 12 | # details. |
||
| 13 | # |
||
| 14 | # You should have received a copy of the GNU General Public License along with |
||
| 15 | # this program; if not, write to the Free Software Foundation, Inc., 51 |
||
| 16 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
||
| 17 | # |
||
| 18 | # Copyright 2018-2019 by it's authors. |
||
| 19 | # Some rights reserved, see README and LICENSE. |
||
| 20 | |||
| 21 | """ http://pypi.python.org/pypi/archetypes.schemaextender |
||
| 22 | """ |
||
| 23 | from archetypes.schemaextender.interfaces import IOrderableSchemaExtender |
||
| 24 | from bika.health import bikaMessageFactory as _ |
||
| 25 | from bika.lims.fields import * |
||
| 26 | from bika.lims.interfaces import IClient |
||
| 27 | from zope.component import adapts |
||
| 28 | from zope.interface import implements |
||
| 29 | |||
| 30 | |||
| 31 | class ClientSchemaExtender(object): |
||
| 32 | adapts(IClient) |
||
| 33 | implements(IOrderableSchemaExtender) |
||
| 34 | |||
| 35 | fields = [ |
||
| 36 | ExtBooleanField('DefaultResultsDistributionToPatients', |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Loading history...
|
|||
| 37 | schemata="Results Reports", |
||
| 38 | default=True, |
||
| 39 | widget=BooleanWidget( |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
| 40 | label=_("Inherit default settings for Patient results distribution"), |
||
| 41 | description=_("If checked, the settings for results reports " |
||
| 42 | "distribution to patients will be inherited " |
||
| 43 | "from Bika Setup, so further changes in Bika " |
||
| 44 | "Setup for this setting will be populated too.")) |
||
| 45 | ), |
||
| 46 | ExtBooleanField('AllowResultsDistributionToPatients', |
||
| 47 | schemata="Results Reports", |
||
| 48 | default=False, |
||
| 49 | widget=BooleanWidget( |
||
| 50 | label=_("Allow results distribution to Patients"), |
||
| 51 | description=_("If checked, results reports will also be sent " |
||
| 52 | "to the Patient automatically. This setting can " |
||
| 53 | "be overriden either on Patient's 'Publication " |
||
| 54 | "preferences' tab.")) |
||
| 55 | ), |
||
| 56 | ExtLinesField('PatientPublicationPreferences', |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
| 57 | vocabulary_factory='bika.health.obsolete.CustomPubPrefVocabularyFactory', |
||
| 58 | schemata='Results Reports', |
||
| 59 | widget=MultiSelectionWidget( |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
| 60 | label=_("Default publication preference for Patients"), |
||
| 61 | description=_("Select the preferred channels to be used for " |
||
| 62 | "sending the results reports to Patients. " |
||
| 63 | "This setting can be overriden on Patient's " |
||
| 64 | "'Publication preferences' tab.") |
||
| 65 | ) |
||
| 66 | ), |
||
| 67 | ExtBooleanField('PatientPublicationAttachmentsPermitted', |
||
| 68 | default=False, |
||
| 69 | schemata='Results Reports', |
||
| 70 | widget=BooleanWidget( |
||
| 71 | label=_("Results attachments permitted"), |
||
| 72 | description=_("File attachments to results, e.g. microscope " |
||
| 73 | "photos, will be included in emails to patients " |
||
| 74 | "if this option is enabled. This setting can be " |
||
| 75 | "overriden on Patient's 'Publication " |
||
| 76 | "preferences' tab.") |
||
| 77 | ) |
||
| 78 | ), |
||
| 79 | ] |
||
| 80 | |||
| 81 | def __init__(self, context): |
||
| 82 | self.context = context |
||
| 83 | |||
| 84 | def getFields(self): |
||
| 85 | return self.fields |
||
| 86 | |||
| 87 | def getOrder(self, schematas): |
||
| 88 | sch = schematas['Results Reports'] |
||
| 89 | sch.remove('AllowResultsDistributionToPatients') |
||
| 90 | sch.insert(sch.index('PatientPublicationPreferences'), 'AllowResultsDistributionToPatients') |
||
| 91 | schematas['Results Reports'] = sch |
||
| 92 | return schematas |
||
| 93 |