Commit 368ed35d authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_corporate_identity: add parameter to define letter recipient position

parent f5c8c036
......@@ -48,6 +48,7 @@ override_destination_organisation_title = kw.get("override_destination_organisat
override_date = kw.get("override_date")
override_batch_mode = kw.get('batch_mode', None)
destination_position_in_letter = kw.get('destination_position_in_letter', 'right')
# -------------------------- Document Parameters ------------------------------
letter_portal_type = letter.getPortalType()
letter_relative_url = letter.getRelativeUrl()
......@@ -138,6 +139,7 @@ if letter_format == "html":
letter_destination_postal_code=letter_destination.get("postal_code", blank),
letter_destination_city=letter_destination.get("city", blank),
letter_destination_country=letter_destination.get("country", blank),
letter_destination_position = destination_position_in_letter,
letter_source_company=letter_source.get("corporate_name", letter_source.get("organisation_title", blank)),
letter_source_company_corporate_name=letter_source.get("corporate_name", blank),
letter_source_company_capital=letter_source.get("social_capital", blank),
......@@ -207,6 +209,7 @@ if letter_format == "pdf":
letter_destination_postal_code=letter_destination.get("postal_code", blank),
letter_destination_city=letter_destination.get("city", blank),
letter_destination_country=letter_destination.get("country", blank),
letter_destination_position = destination_position_in_letter,
letter_source_company=letter_source.get("corporate_name", letter_source.get("organisation_title", blank)),
letter_source_address=letter_source.get("address", blank),
letter_source_postal_code=letter_source.get("postal_code", blank),
......
......@@ -34,6 +34,7 @@ Generates the complete letter
letter_destination_postal_code python: options.get('letter_destination_postal_code');
letter_destination_city python: options.get('letter_destination_city');
letter_destination_country python: options.get('letter_destination_country');
letter_destination_position python: options.get('letter_destination_position');
letter_content python: options.get('letter_content');
letter_display_source_address python: options.get('letter_display_source_address');
......
......@@ -28,6 +28,7 @@ Generates the letter Content
letter_destination_city python: options.get('letter_destination_city');
letter_destination_country python: options.get('letter_destination_country');
letter_display_source_address python: options.get('letter_display_source_address');
letter_destination_position python: options.get('letter_destination_position');
letter_content python: options.get('letter_content');">
<!DOCTYPE html>
<html tal:attributes="class python: ''.join(['ci-', letter_theme, ' ci-', letter_language])">
......@@ -47,6 +48,20 @@ Generates the letter Content
</html>
</tal:block>
<tal:block tal:condition="python: False">
<tal:block metal:define-macro="letter_destination">
<td class="ci-letter-destination">
<span tal:content="python: letter_destination_company or ' '"></span>
<span tal:content="python: letter_destination_person or ' '"></span>
<tal:block tal:repeat="address python: letter_destination_address.split('\n')">
<span tal:content="python: address"></span>
</tal:block>
<span tal:content="python: ''.join([letter_destination_postal_code, ' ', letter_destination_city])"></span>
<span tal:content="python: letter_destination_country or ' '"></span>
</td>
</tal:block>
</tal:block>
<tal:block tal:condition="python: False">
<tal:block metal:define-macro="letter_content">
<div class="ci-letter-head ci-letter-head-right">
......@@ -73,17 +88,16 @@ Generates the letter Content
<td></td>
</tr>
<tr>
<td></td>
<td class="ci-letter-destination">
<span tal:content="python: letter_destination_company or ' '"></span>
<span tal:content="python: letter_destination_person or ' '"></span>
<tal:block tal:repeat="address python: letter_destination_address.split('\n')">
<span tal:content="python: address"></span>
</tal:block>
<span tal:content="python: ''.join([letter_destination_postal_code, ' ', letter_destination_city])"></span>
<span tal:content="python: letter_destination_country or ' '"></span>
</td>
<td></td>
<tal:block tal:condition="python: letter_destination_position== 'right'">
<td></td>
<tal:block metal:use-macro="context/Letter_createLetterContent/macros/letter_destination" />
<td></td>
</tal:block>
<tal:block tal:condition="python: letter_destination_position=='left'">
<tal:block metal:use-macro="context/Letter_createLetterContent/macros/letter_destination" />
<td></td>
<td></td>
</tal:block>
</tr>
</tal:block>
</tbody>
......
......@@ -37,5 +37,6 @@ return context.Base_viewAsLetter(
document_save=document_save,
document_download=document_download,
batch_mode=batch_mode,
destination_position_in_letter = destination_position_in_letter,
**kw
)
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>format=None, display_source_address=None, display_head=None, display_svg=None, batch_mode=False, document_download=None, document_save=None, override_source_organisation_title=None,override_source_person_title=None,override_destination_organisation_title=None,override_destination_person_title=None,override_date=None,**kw</string> </value>
<value> <string>format=None, display_source_address=None, display_head=None, display_svg=None, batch_mode=False, document_download=None, document_save=None, override_source_organisation_title=None,override_source_person_title=None,override_destination_organisation_title=None,override_destination_person_title=None,override_date=None,destination_position_in_letter=\'right\', **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -38,5 +38,6 @@ return context.WebPage_viewAsLetter(
document_save=document_save,
document_download=document_download,
batch_mode=batch_mode,
destination_position_in_letter = destination_position_in_letter,
**kw
)
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>format="html", display_source_address=None, display_head=1, display_svg=None, batch_mode=False, document_download=None, document_save=None, override_source_organisation_title=None,override_source_person_title=None,override_destination_organisation_title=None,override_destination_person_title=None,override_date=None,**kw</string> </value>
<value> <string>format="html", display_source_address=None, display_head=1, display_svg=None, batch_mode=False, document_download=None, document_save=None, override_source_organisation_title=None,override_source_person_title=None,override_destination_organisation_title=None,override_destination_person_title=None,override_date=None, destination_position_in_letter = \'right\', **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -46,6 +46,7 @@ if dialog_id is not None:
display_source_address=display_source_address,
document_download=document_download,
document_save=document_save,
destination_position_in_letter = destination_position_in_letter,
**kw
)
)
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>override_source_organisation_title=None, display_source_address=None, display_svg=None,document_download=None, document_save=None, dialog_id=None, cancel_url=None, portal_skin=None,display_head=None, format=None, override_date=None, override_destination_person_title=None, override_source_person_title=None,override_destination_organisation_title=None, *args,**kw</string> </value>
<value> <string>override_source_organisation_title=None, display_source_address=None, display_svg=None,document_download=None, document_save=None, dialog_id=None, cancel_url=None, portal_skin=None,display_head=None, format=None, override_date=None, override_destination_person_title=None, override_source_person_title=None,override_destination_organisation_title=None, destination_position_in_letter = \'right\', *args,**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -37,5 +37,6 @@ return context.Base_viewAsLetter(
document_save=document_save,
document_download=document_download,
batch_mode=batch_mode,
destination_position_in_letter = destination_position_in_letter,
**kw
)
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>format=None, display_source_address=None, display_head=None, display_svg=None, batch_mode=False, document_download=None, document_save=None, override_source_organisation_title=None,override_source_person_title=None,override_destination_organisation_title=None,override_destination_person_title=None,override_date=None,**kw</string> </value>
<value> <string>format=None, display_source_address=None, display_head=None, display_svg=None, batch_mode=False, document_download=None, document_save=None, override_source_organisation_title=None,override_source_person_title=None,override_destination_organisation_title=None,override_destination_person_title=None,override_date=None,destination_position_in_letter = \'right\',**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -91,6 +91,7 @@
<string>override_source_person_title</string>
<string>override_destination_organisation_title</string>
<string>override_destination_person_title</string>
<string>destination_position_in_letter</string>
<string>override_date</string>
</list>
</value>
......
......@@ -301,7 +301,7 @@
<key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[
python: \'<iframe width="100%%" height="500" style="background-color:#FFFFFF;box-sizing:border-box;-wekbit-box-sizing:border-box;" src="%s/WebPage_viewAsWeb?portal_skin=Letter&amp;override_source_person_title=%s&amp;override_source_organisation_title=%s&amp;override_destination_person_title=%s&amp;override_destination_organisation_title=%s&amp;display_head=%s&amp;override_date=%s&amp;display_source_address=%s&amp;display_svg=%s" name="default_version"></iframe>\' % (context.absolute_url(), context.REQUEST.get("override_source_person_title", ""), context.REQUEST.get("override_source_organisation_title", ""), context.REQUEST.get("override_destination_person_title", ""), context.REQUEST.get("override_destination_organisation_title", ""), context.REQUEST.get("display_head", 1), context.REQUEST.get("override_date", ""), context.REQUEST.get("display_source_address", 0), context.REQUEST.get("display_svg", "png"))
python: \'<iframe width="100%%" height="500" style="background-color:#FFFFFF;box-sizing:border-box;-wekbit-box-sizing:border-box;" src="%s/WebPage_viewAsWeb?portal_skin=Letter&amp;override_source_person_title=%s&amp;override_source_organisation_title=%s&amp;override_destination_person_title=%s&amp;override_destination_organisation_title=%s&amp;display_head=%s&amp;override_date=%s&amp;display_source_address=%s&amp;display_svg=%s&amp;destination_position_in_letter=%s" name="default_version"></iframe>\' % (context.absolute_url(), context.REQUEST.get("override_source_person_title", ""), context.REQUEST.get("override_source_organisation_title", ""), context.REQUEST.get("override_destination_person_title", ""), context.REQUEST.get("override_destination_organisation_title", ""), context.REQUEST.get("display_head", 1), context.REQUEST.get("override_date", ""), context.REQUEST.get("display_source_address", 0), context.REQUEST.get("display_svg", "png"), context.REQUEST.get("destination_position_in_letter", "right"))
]]></string> </value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>first_item</string>
<string>items</string>
<string>size</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>destination_position_in_letter</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_list_field</string> </value>
</item>
<item>
<key> <string>first_item</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list>
<tuple>
<string>Right</string>
<string>right</string>
</tuple>
<tuple>
<string>Left</string>
<string>left</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>size</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Recipient Position In Letter</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -129,6 +129,7 @@ html{
width: 50%;
}
.ci-letter .ci-letter-head-right table tr td:nth-child(2) {
padding-left:100px;
width: 48%;
}
.ci-letter .ci-letter-head-right table tr td:nth-child(3) {
......
......@@ -137,6 +137,7 @@ html {
width: 43%;
}
.ci-letter .ci-letter-head-right table tr td:nth-child(2) {
padding-left:100px;
width: 55%;
}
.ci-letter .ci-letter-head-right table tr td:nth-child(3) {
......
......@@ -39,5 +39,6 @@ return context.Letter_viewAsLetter(
document_save=document_save,
document_download=document_download,
batch_mode=batch_mode,
destination_position_in_letter = destination_position_in_letter,
**kw
)
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>format="html", display_source_address=None, display_svg=None,document_download=None, batch_mode=False, display_head=None,document_save=None, override_source_organisation_title=None,override_source_person_title=None,override_destination_organisation_title=None,override_destination_person_title=None,override_date=None,**kw</string> </value>
<value> <string>format="html", display_source_address=None, display_svg=None,document_download=None, batch_mode=False, display_head=None,document_save=None, override_source_organisation_title=None,override_source_person_title=None,override_destination_organisation_title=None,override_destination_person_title=None,override_date=None,destination_position_in_letter=\'right\',**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment