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

Add justice contacts #190

Open
wants to merge 2 commits into
base: urban2.6.x
Choose a base branch
from
Open
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 news/URB-2525.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Add justice contacts
[ndemonte]
8 changes: 8 additions & 0 deletions src/Products/urban/browser/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,14 @@
permission="zope2.View"
/>

<browser:page
for="Products.ATContentTypes.interfaces.IATFolder"
name="justice_contact_folderview"
class=".urban_configfolderview.JusticeContactFolderView"
template="templates/urban_configfolderview.pt"
permission="zope2.View"
/>

<browser:page
for="Products.ATContentTypes.interfaces.IATFolder"
name="notaries_folderview"
Expand Down
2 changes: 1 addition & 1 deletion src/Products/urban/browser/contactview.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
class ContactView(BrowserView):
"""
This manage the view of every Contacts :
Applicant, Architect, Geometrician, Notary
Applicant, Architect, Geometrician, Notary, JusticeContact
"""
def __init__(self, context, request):
self.context = context
Expand Down
19 changes: 19 additions & 0 deletions src/Products/urban/browser/licence/templates/licencemacros.pt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,25 @@
</fieldset>


<fieldset metal:define-macro="urbanJusticeContactMacro" i18n:domain="urban" tal:define="justiceContacts here/getJusticeContacts">
<legend i18n:translate="urban_label_justiceContact">Justice contacts</legend>
<tal:loop repeat="justiceContact justiceContacts">
<div class="#" tal:attributes="class python: 'clear'">
<a href="#" tal:attributes="href python: justiceContact.absolute_url() + '?came_from_licence_uid=' + context.UID()">
<span tal:replace="python: justiceContact.getPersonTitle(short=True)" />
<span tal:replace="justiceContact/getName1|nothing" />
<span tal:replace="justiceContact/getName2|nothing" />
<span tal:condition="justiceContact/getSociety" tal:replace="justiceContact/getSociety|nothing" />
</a>
<br />
<span tal:content="python: justiceContact.getStreet()+' '+justiceContact.getNumber()" /><br />
<span tal:content="python: justiceContact.getZipcode()+' '+justiceContact.getCity()" /><br />
<span tal:content="python: justiceContact.getPhone()" /><br />
</div>
</tal:loop>
</fieldset>


<fieldset metal:define-macro="urbanProprietariesMacro" i18n:domain="urban">
<legend i18n:translate="proprietaries">Proprietary(ies)</legend>
<div class="#" tal:define="proprietaries context/getProprietaries"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<legend i18n:translate="legend_details">Details</legend>
<table metal:define-slot="detail_slot" class="no-style-table" cellspacing=0 cellpadding=0 width=100%
tal:define="default_custom python: ['foldermanagers'];
default_exclude python: ['title', 'workLocations', 'architects', 'geometricians', 'notaryContact', 'representativeContacts'];
default_exclude python: ['title', 'workLocations', 'architects', 'geometricians', 'justicecontacts', 'notaryContact', 'representativeContacts'];
custom custom | python: []; custom python: custom + default_custom;
exclude exclude | default_exclude">

Expand Down Expand Up @@ -171,7 +171,7 @@
<table class="no-style-table" cellspacing=0 cellpadding=0 width=100%
tal:define="default_custom python: ['isInPCA', 'isInSubdivision'];
default_exclude python: [
'title', 'workLocations', 'architects', 'geometricians', 'notaryContact',
'title', 'workLocations', 'architects', 'geometricians', 'justicecontacts', 'notaryContact',
'pca', 'pcaDetails', 'parcellings', 'subdivisionDetails'
];
custom custom | python: []; custom python: custom + default_custom;
Expand Down
6 changes: 6 additions & 0 deletions src/Products/urban/browser/table/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,12 @@ def update(self):
self.label = 'label_colname_geometrician_data'


class JusticeContactTitleColumnHeader(TitleColumnHeader):

def update(self):
self.label = 'label_colname_justice_contact_data'


class ClaimantTitleColumnHeader(TitleColumnHeader):

def update(self):
Expand Down
9 changes: 9 additions & 0 deletions src/Products/urban/browser/table/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@
provides="z3c.table.interfaces.IColumnHeader"
/>

<adapter
for="zope.interface.Interface
zope.publisher.interfaces.browser.IBrowserRequest
Products.urban.browser.table.interfaces.IJusticeContactTable
Products.urban.browser.table.interfaces.ITitleColumn"
factory=".column.JusticeContactTitleColumnHeader"
provides="z3c.table.interfaces.IColumnHeader"
/>

<adapter
for="zope.interface.Interface
zope.publisher.interfaces.browser.IBrowserRequest
Expand Down
6 changes: 6 additions & 0 deletions src/Products/urban/browser/table/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ class IArchitectsTable(IUrbanTable):
"""


class IJusticeContactTable(IUrbanTable):
"""
Marker interface for a table displaying people in charge of justice
"""


class IClaimantsTable(IUrbanTable):
"""
Marker interface for a table displaying claimants
Expand Down
12 changes: 12 additions & 0 deletions src/Products/urban/browser/table/urbantable.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,18 @@ class ArchitectsTable(FolderContentTable, ContactTable):
batchSize = 20


class JusticeContactTable(FolderContentTable, ContactTable):
"""
Same as a ContactTable.
We define our own class so we can implement a marker interface used to find
the correct translation for column headers
"""
implements(interfaces.IJusticeContactTable)

batchSize = 20



class ClaimantsTable(ContactTable):
"""
Same as a ContactTable.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<li><img src="../folder_icon.png" /> <a href="architects" i18n:translate="manage_architects">Manage architects</a></li>
<li><img src="../folder_icon.png" /> <a href="notaries" i18n:translate="manage_notaries">Manage notaries</a></li>
<li><img src="../folder_icon.png" /> <a href="geometricians" i18n:translate="manage_geometricians">Manage geometricians</a></li>
<li><img src="../folder_icon.png" /> <a href="justicecontacts" i18n:translate="manage_justice_contact">Manage people in charge of justice</a></li>
<li><img src="../folder_icon.png" /> <a href="parcellings" i18n:translate="manage_parcellings">Manage parcellings</a></li>
<li tal:condition="view/is_urban_manager">
<br />
Expand Down
14 changes: 13 additions & 1 deletion src/Products/urban/browser/urban_configfolderview.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from Products.urban.browser.table.urbantable import GeometriciansTable
from Products.urban.browser.table.urbantable import NotariesTable
from Products.urban.browser.table.urbantable import ArchitectsTable
from Products.urban.browser.table.urbantable import JusticeContactTable
from Products.urban.browser.table.urbantable import ParcellingsTable
from Products.urban.browser.table.urbantable import UrbanTable
from Products.urban import UrbanMessage as _
Expand Down Expand Up @@ -37,7 +38,7 @@ class SearchForm(form.Form):
def updateWidgets(self):
super(SearchForm, self).updateWidgets()

@button.buttonAndHandler(u'Search')
@button.buttonAndHandler(_(u'Search'))
def handleSearch(self, action):
data, errors = self.extractData()
if errors:
Expand Down Expand Up @@ -134,6 +135,17 @@ def getCSSClass(self):
return '{} contenttype-geometrician'.format(base_css)


class JusticeContactFolderView(ContactsFolderView):
"""
This manage the people in charge of justice folder config view
"""
table = JusticeContactTable

def getCSSClass(self):
base_css = super(JusticeContactFolderView, self).getCSSClass()
return '{} contenttype-justicecontact'.format(base_css)


class NotariesFolderView(ContactsFolderView):
"""
This manage the notaries folder config view
Expand Down
22 changes: 22 additions & 0 deletions src/Products/urban/content/licence/Inspection.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,27 @@
default_method='getDefaultText',
default_output_type='text/x-html-safe',
),
ReferenceField(
name='representativeContacts',
widget=ReferenceBrowserWidget(
force_close_on_insert=1,
allow_search=1,
only_for_review_states='enabled',
allow_browse=0,
show_indexes=1,
available_indexes={'Title': 'Nom'},
startup_directory='urban',
wild_card_search=True,
show_results_without_query=True,
restrict_browsing_to_startup_directory=False,
label=_('urban_label_representative_contacts', default='RepresentativeContact(s)'),
popup_name='contact_reference_popup',
),
schemata='urban_description',
multiValued=1,
relationship='basebuildlicenceRepresentativeContacts',
allowed_types=('Geometrician', 'Architect',),
),
),
)
Inspection_schema = BaseFolderSchema.copy() + \
Expand Down Expand Up @@ -386,6 +407,7 @@ def finalize_schema(schema, folderish=False, moveDiscussion=True):
schema.moveField('description', after='inspection_context')
schema.moveField('bound_licences', before='workLocations')
schema.moveField('use_bound_licence_infos', after='bound_licences')
schema.moveField('representativeContacts', before='foldermanagers')
schema['parcellings'].widget.label = _('urban_label_parceloutlicences')
schema['isInSubdivision'].widget.label = _('urban_label_is_in_parceloutlicences')
schema['subdivisionDetails'].widget.label = _('urban_label_parceloutlicences_details')
Expand Down
46 changes: 45 additions & 1 deletion src/Products/urban/content/licence/Ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,48 @@
default_method='getDefaultText',
default_output_type='text/x-html-safe',
),
ReferenceField(
name='representativeContacts',
widget=ReferenceBrowserWidget(
force_close_on_insert=1,
allow_search=1,
only_for_review_states='enabled',
allow_browse=0,
show_indexes=1,
available_indexes={'Title': 'Nom'},
startup_directory='urban',
wild_card_search=True,
show_results_without_query=True,
restrict_browsing_to_startup_directory=False,
label=_('urban_label_representative_contacts', default='RepresentativeContact(s)'),
popup_name='contact_reference_popup',
),
schemata='urban_description',
multiValued=1,
relationship='basebuildlicenceRepresentativeContacts',
allowed_types=('Geometrician', 'Architect',),
),
ReferenceField(
name='justiceContacts',
widget=ReferenceBrowserWidget(
force_close_on_insert=1,
allow_search=1,
only_for_review_states='enabled',
allow_browse=0,
show_indexes=1,
available_indexes={'Title': 'Nom'},
startup_directory='urban',
wild_card_search=True,
show_results_without_query=True,
restrict_browsing_to_startup_directory=False,
label=_('urban_label_justice_contacts', default='Justice contact(s)'),
popup_name='contact_reference_popup',
),
schemata='urban_description',
multiValued=1,
relationship='ticketJusticeContacts',
allowed_types=('JusticeContact',),
),
),
)

Expand Down Expand Up @@ -330,7 +372,9 @@ def finalize_schema(schema, folderish=False, moveDiscussion=True):
schema.moveField('use_bound_inspection_infos', after='bound_inspection')
schema.moveField('bound_licences', after='use_bound_inspection_infos')
schema.moveField('managed_by_prosecutor', after='foldermanagers')
schema.moveField('description', after='managed_by_prosecutor')
schema.moveField('representativeContacts', after='managed_by_prosecutor')
schema.moveField('justiceContacts', after='representativeContacts')
schema.moveField('description', after='justiceContacts')
schema['parcellings'].widget.label = _('urban_label_parceloutlicences')
schema['isInSubdivision'].widget.label = _('urban_label_is_in_parceloutlicences')
schema['subdivisionDetails'].widget.label = _('urban_label_parceloutlicences_details')
Expand Down
2 changes: 1 addition & 1 deletion src/Products/urban/events/contactEvents.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def updateLicenceTitle(contact, event):


def sortByAlphabeticalOrder(contact, event):
if not contact.portal_type in ['Notary', 'Architect', 'Geometrician', 'FolderManager']:
if not contact.portal_type in ['Notary', 'Architect', 'Geometrician', 'FolderManager', 'JusticeContact']:
return
container = contact.aq_inner.aq_parent
name = contact.getName1() + contact.getName2()
Expand Down
7 changes: 7 additions & 0 deletions src/Products/urban/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,18 @@ class IGeometrician(Interface):
"""


# not sure if it's used anywhere, may be related to removed code
class IJusticeContact(Interface):
"""Marker interface for JusticeContact
"""


CONTACT_INTERFACES = {
'Architect': IArchitect,
'Geometrician': IGeometrician,
'Notary': INotary, # to be taken into account if notary.py is removed
'Proprietary': IProprietary, # to be taken into account if proprietary.py is removed
'JusticeContact': IJusticeContact,
}


Expand Down
5 changes: 4 additions & 1 deletion src/Products/urban/locales/fr/LC_MESSAGES/plone.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ msgstr ""
"PO-Revision-Date: 2023-07-18 11:52+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
Expand All @@ -14,6 +13,7 @@ msgstr ""
"Language-Name: English\n"
"Preferred-Encodings: utf-8 latin1\n"
"Domain: plone\n"
"Language: fr\n"
"Language-code: fr\n"
"Language-name: French\n"
"Preferred-encodings: utf-8\n"
Expand Down Expand Up @@ -123,6 +123,9 @@ msgstr "Inspection"
msgid "IntegratedLicence"
msgstr "Permis intégré"

msgid "JusticeContact"
msgstr "Personne en charge de la justice"

msgid "Locality"
msgstr "Lieu-dit"

Expand Down
Loading