Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clients default CC E-Mails missing in Add Sample #1478

Merged
merged 4 commits into from
Nov 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ Changelog

**Removed**

- #1478 Remove AcquireFieldDefaults (was used for CCEmails field only)

**Fixed**

- #1478 Clients default CC E-Mails missing in Add Sample
- #1479 Fixed too many redirects error: Labclerks viewing verified worksheets
- #1480 Worksheet removal results in 404
- #1475 User with "Analyst" role cannot submit analyses from worksheet
Expand Down
57 changes: 0 additions & 57 deletions bika/lims/adapters/acquirefielddefaults.py

This file was deleted.

7 changes: 0 additions & 7 deletions bika/lims/adapters/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@
xmlns:monkey="http://namespaces.plone.org/monkey"
i18n_domain="senaite.core">

<adapter
factory=".acquirefielddefaults.AcquireFieldDefaults"
provides="bika.lims.interfaces.IAcquireFieldDefaults"
for="bika.lims.interfaces.IAnalysisRequest"
name="DefaultAquireFieldDefaults"
/>

<adapter
for="zope.interface.Interface
zope.publisher.interfaces.browser.IBrowserRequest"
Expand Down
7 changes: 6 additions & 1 deletion bika/lims/browser/analysisrequest/add2.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,9 +820,14 @@ def get_client_info(self, obj):
default_contact = self.get_default_contact(client=obj)
if default_contact:
info["field_values"].update({
"Contact": self.get_contact_info(default_contact)
"Contact": self.get_contact_info(default_contact),
})

# Set default CC Email field
info["field_values"].update({
"CCEmails": {"value": obj.getCCEmails()}
})

# UID of the client
uid = api.get_uid(obj)

Expand Down
2 changes: 0 additions & 2 deletions bika/lims/content/analysisrequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,6 @@
mode="rw",
read_permission=View,
write_permission=FieldEditContact,
acquire=True,
acquire_fieldname="CCEmails",
widget=StringWidget(
label=_("CC Emails"),
description=_("Additional email addresses to be notified"),
Expand Down
29 changes: 0 additions & 29 deletions bika/lims/interfaces/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,35 +821,6 @@ class IDepartment(Interface):
"""


class IAcquireFieldDefaults(Interface):
"""Register this adapter to define if and how the value for a field is
acquired.

An instance's schema fields may delegate the responsibility of providing
default values to their acquisition parents by providing an attribute
"acquire=True".

During object creation this behaviour will walk up the acquisition chain
looking for a matching field, and if one is found it's current value will
be used as the default for this field.

By default the acquisition chain is searched for a field named
identically to the destination field, but this can be configured with an
attribute "acquire_fieldname='FieldName'".

If the source field is found on a parent but contains a False-ish value,
or if the adapter otherwise returns None (this will be the case if the
walker reaches the SiteRoot), the schema's original AT default is used.

No attempt is made to type check the fields - the value of the parent
field is simply injected into getDefaults().
"""

def __call__(context, field):
"""This function must return the surrogate (source) value directly.
"""


class IProxyField(Interface):
"""A field that proxies transparently to the field of another object.
Mainly needed for AnalysisRequest fields that are actually stored on the
Expand Down
85 changes: 0 additions & 85 deletions bika/lims/monkey/Schema.py

This file was deleted.

7 changes: 0 additions & 7 deletions bika/lims/monkey/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,6 @@
replacement=".Widget.isVisible"
/>

<monkey:patch
description="Allow field default value acquisition with IAcquireFieldDefaults"
class="Products.Archetypes.Schema.BasicSchema"
original="setDefaults"
replacement=".Schema.setDefaults"
/>

<!-- Mask analyses with those from descendants (partitioning) -->
<monkey:patch
description=""
Expand Down