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 | from archetypes.schemaextender.interfaces import IOrderableSchemaExtender |
||
22 | from zope.component import adapts |
||
23 | from zope.interface import implements |
||
24 | |||
25 | from bika.health import bikaMessageFactory as _ |
||
26 | from bika.lims.fields import * |
||
27 | from bika.lims.interfaces import IBikaSetup |
||
28 | |||
29 | |||
30 | class BikaSetupSchemaExtender(object): |
||
31 | adapts(IBikaSetup) |
||
32 | implements(IOrderableSchemaExtender) |
||
33 | |||
34 | fields = [ |
||
35 | ExtStringField('PatientConditionsHeightUnits', |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
![]() |
|||
36 | schemata="Cases", |
||
37 | default=_("Feet/inches"), |
||
38 | widget=StringWidget( |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
39 | label=_("Patient condition height units"), |
||
40 | description=_("Use '/' symbol to allow multiple-units submission") |
||
41 | ) |
||
42 | ), |
||
43 | ExtStringField('PatientConditionsWeightUnits', |
||
44 | schemata="Cases", |
||
45 | default=_("Lbs"), |
||
46 | widget=StringWidget( |
||
47 | label=_("Patient condition weight units"), |
||
48 | description=_("Use '/' symbol to allow multiple-units submission") |
||
49 | ) |
||
50 | ), |
||
51 | ExtStringField('PatientConditionsWaistUnits', |
||
52 | schemata="Cases", |
||
53 | default=_("Inches"), |
||
54 | widget=StringWidget( |
||
55 | label=_("Patient condition waist units"), |
||
56 | description=_("Use '/' symbol to allow multiple-units submission") |
||
57 | ) |
||
58 | ), |
||
59 | ExtBooleanField('AllowResultsDistributionToPatients', |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
60 | schemata="Results Reports", |
||
61 | default=False, |
||
62 | widget=BooleanWidget( |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
63 | label=_("Allow results distribution to Patients"), |
||
64 | description=_("If checked, results reports will also be sent " |
||
65 | "to the Patient automatically. This setting can " |
||
66 | "be overriden either on 'Patient publication " |
||
67 | "preferences' tab from Client view or on " |
||
68 | "Patient's 'Publication preferences' tab.")) |
||
69 | ), |
||
70 | ExtLinesField('PatientPublicationPreferences', |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
71 | vocabulary_factory='bika.health.obsolete.CustomPubPrefVocabularyFactory', |
||
72 | schemata = 'Results Reports', |
||
73 | widget = MultiSelectionWidget( |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
74 | label = _("Default publication preference for Patients"), |
||
75 | description = _("Select the preferred channels to be used for " |
||
76 | "sending the results reports to Patients. " |
||
77 | "This setting can be overriden either on " |
||
78 | "'Patient publication preferences' tab from " |
||
79 | "Client view or on Patient's 'Publication " |
||
80 | "preferences' tab.") |
||
81 | ) |
||
82 | ), |
||
83 | ExtBooleanField('PatientPublicationAttachmentsPermitted', |
||
84 | default = False, |
||
85 | schemata = 'Results Reports', |
||
86 | widget = BooleanWidget( |
||
87 | label = _("Results attachments permitted"), |
||
88 | description = _("File attachments to results, e.g. microscope " |
||
89 | "photos, will be included in emails to " |
||
90 | "patients if this option is enabled. This " |
||
91 | "setting can be overriden either on 'Patient " |
||
92 | "publication preferences' tab from Client " |
||
93 | "view or on Patient's 'Publication " |
||
94 | "preferences' tab.") |
||
95 | ) |
||
96 | ), |
||
97 | ExtBooleanField('CaseDoctorIsMandatory', |
||
98 | schemata="Cases", |
||
99 | default=True, |
||
100 | widget=BooleanWidget( |
||
101 | label=_("Doctor field is mandatory in cases"), |
||
102 | description=_( |
||
103 | "Should the Doctor field be mandatory while " |
||
104 | "creating a case?") |
||
105 | ) |
||
106 | ), |
||
107 | ExtBooleanField('ClientPatientIDUnique', |
||
108 | schemata="ID Server", |
||
109 | default=False, |
||
110 | widget=BooleanWidget( |
||
111 | label=_("Client Patient ID must be unique"), |
||
112 | description=_("If selected, Client Patient IDs will be forced " |
||
113 | "to be unique") |
||
114 | ) |
||
115 | ), |
||
116 | ] |
||
117 | |||
118 | def __init__(self, context): |
||
119 | self.context = context |
||
120 | |||
121 | def getFields(self): |
||
122 | return self.fields |
||
123 | |||
124 | def getOrder(self, schematas): |
||
125 | sch = schematas['Results Reports'] |
||
126 | sch.remove('AllowResultsDistributionToPatients') |
||
127 | sch.insert(sch.index('PatientPublicationPreferences'), 'AllowResultsDistributionToPatients') |
||
128 | schematas['Results Reports'] = sch |
||
129 | return schematas |
||
130 |