Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Mukul
erp5
Commits
9a07f26c
Commit
9a07f26c
authored
Jan 10, 2018
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_corporate_identity: fixes for creating letter from event
parent
f2bd41c1
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
134 additions
and
54 deletions
+134
-54
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_getDestinationDict.py
..._skins/erp5_corporate_identity/Base_getDestinationDict.py
+2
-2
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_getSourceDict.py
...ortal_skins/erp5_corporate_identity/Base_getSourceDict.py
+8
-5
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_getThemeDict.py
...portal_skins/erp5_corporate_identity/Base_getThemeDict.py
+7
-7
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_viewAsReport.py
...portal_skins/erp5_corporate_identity/Base_viewAsReport.py
+1
-1
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Letter_send.py
...eItem/portal_skins/erp5_corporate_identity/Letter_send.py
+6
-6
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Letter_viewAsLetter.py
...rtal_skins/erp5_corporate_identity/Letter_viewAsLetter.py
+20
-16
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_getCustomProxyParameter.py
...rp5_corporate_identity/WebPage_getCustomProxyParameter.py
+17
-4
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsBook.py
...ortal_skins/erp5_corporate_identity/WebPage_viewAsBook.py
+1
-1
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/template_themes/themes.css.css
...ns/erp5_corporate_identity/template_themes/themes.css.css
+2
-2
bt5/erp5_corporate_identity/TestTemplateItem/portal_components/test.erp5.testCorporateIdentityTemplates.py
...al_components/test.erp5.testCorporateIdentityTemplates.py
+70
-10
No files found.
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_getDestinationDict.py
View file @
9a07f26c
...
@@ -7,7 +7,7 @@ Create a destination dict for filling templates
...
@@ -7,7 +7,7 @@ Create a destination dict for filling templates
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# destination: Can be set if called from Event
# destination: Can be set if called from Event
# override_destination_person_title: Title of person to use
# override_destination_person_title: Title of person to use
# override_destination_organisation_title: Title of organisation to use
# override_destination_organisation_title: Title of organisation to use
blank
=
''
blank
=
''
...
@@ -41,7 +41,7 @@ if destination is None:
...
@@ -41,7 +41,7 @@ if destination is None:
destination
=
{}
destination
=
{}
destination
.
update
(
destination_person
or
{})
destination
.
update
(
destination_person
or
{})
destination
.
update
(
destination_organisation
or
{})
destination
.
update
(
destination_organisation
or
{})
# destination => event
# destination => event
else
:
else
:
destination_uid
=
context
.
restrictedTraverse
(
destination
).
getUid
()
destination_uid
=
context
.
restrictedTraverse
(
destination
).
getUid
()
...
...
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_getSourceDict.py
View file @
9a07f26c
...
@@ -16,9 +16,10 @@ from Products.PythonScripts.standard import html_quote
...
@@ -16,9 +16,10 @@ from Products.PythonScripts.standard import html_quote
# ------------------------------- Set Source ----------------------------------
# ------------------------------- Set Source ----------------------------------
source_logo_url
=
None
source_logo_url
=
None
default_bank_account_uid
=
context
.
WebPage_getCustomParameter
(
"default_bank_account_uid"
)
if
source
is
None
:
if
source
is
None
:
default_company_title
=
context
.
Base_getCustomTemplateParameter
(
"default_company_title"
)
default_company_title
=
context
.
WebPage_getCustomParameter
(
"default_company_title"
)
default_bank_account_uid
=
context
.
Base_getCustomTemplateParameter
(
"default_bank_account_uid"
)
contributor_title_string
=
blank
contributor_title_string
=
blank
source_person
=
None
source_person
=
None
source_person_list
=
[]
source_person_list
=
[]
...
@@ -37,10 +38,13 @@ if source is None:
...
@@ -37,10 +38,13 @@ if source is None:
contributor_title_string
=
', '
.
join
(
x
.
get
(
"name"
,
blank
)
for
x
in
source_person_list
)
contributor_title_string
=
', '
.
join
(
x
.
get
(
"name"
,
blank
)
for
x
in
source_person_list
)
# source organisation
# source organisation
# order: override => follow-up => default_organisation_uid => default_company_title => source_person career subordinate
if
override_source_organisation_title
is
not
None
or
override_source_organisation_title
is
blank
:
if
override_source_organisation_title
is
not
None
or
override_source_organisation_title
is
blank
:
source_organisation_list
=
context
.
Base_getCustomTemplateProxyParameter
(
"override_organisation"
,
override_source_organisation_title
)
source_organisation_list
=
context
.
Base_getCustomTemplateProxyParameter
(
"override_organisation"
,
override_source_organisation_title
)
if
len
(
source_organisation_list
)
==
0
:
if
len
(
source_organisation_list
)
==
0
:
source_organisation_uid
=
context
.
Base_getCustomTemplateParameter
(
"default_source_organisation_uid"
)
source_organisation_list
=
context
.
Base_getCustomTemplateProxyParameter
(
"organisation"
)
if
len
(
source_organisation_list
)
==
0
:
source_organisation_uid
=
context
.
WebPage_getCustomParameter
(
"default_source_organisation_uid"
)
if
source_organisation_uid
:
if
source_organisation_uid
:
source_organisation_list
=
context
.
Base_getCustomTemplateProxyParameter
(
"sender"
,
source_organisation_uid
)
or
[]
source_organisation_list
=
context
.
Base_getCustomTemplateProxyParameter
(
"sender"
,
source_organisation_uid
)
or
[]
if
len
(
source_organisation_list
)
==
0
and
default_company_title
:
if
len
(
source_organisation_list
)
==
0
and
default_company_title
:
...
@@ -51,7 +55,6 @@ if source is None:
...
@@ -51,7 +55,6 @@ if source is None:
if
len
(
organisation_candidate_list
)
>
0
:
if
len
(
organisation_candidate_list
)
>
0
:
source_organisation_list
=
organisation_candidate_list
source_organisation_list
=
organisation_candidate_list
break
break
#source_organisation_list = context.Base_getCustomTemplateProxyParameter("source", source_person.get("uid")) or []
if
len
(
source_organisation_list
)
>
0
:
if
len
(
source_organisation_list
)
>
0
:
source_organisation
=
source_organisation_list
[
0
]
source_organisation
=
source_organisation_list
[
0
]
...
@@ -62,7 +65,7 @@ if source is None:
...
@@ -62,7 +65,7 @@ if source is None:
# source => event
# source => event
else
:
else
:
source_uid
=
context
.
restrictedTraverse
(
source
).
getUid
()
source_uid
=
context
.
restrictedTraverse
(
source
).
getUid
()
source
=
context
.
Base_getCustomTemplateProxyParameter
(
"source"
,
source_uid
)[
0
]
source
=
context
.
Base_getCustomTemplateProxyParameter
(
"source"
,
source_uid
)[
0
]
# override specific bank account (no default to pick correct one if multiple exist)
# override specific bank account (no default to pick correct one if multiple exist)
...
...
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_getThemeDict.py
View file @
9a07f26c
...
@@ -23,12 +23,12 @@ theme_logo_dict = {}
...
@@ -23,12 +23,12 @@ theme_logo_dict = {}
theme_reference
=
None
theme_reference
=
None
theme
=
(
theme
=
(
context
.
Base_getCustomTemplateProxyParameter
(
"theme"
)
or
context
.
Base_getCustomTemplateProxyParameter
(
"theme"
)
or
context
.
Base_getCustomTemplate
Parameter
(
"theme"
)
or
context
.
WebPage_getCustom
Parameter
(
"theme"
)
or
context
.
Base_getCustomTemplate
Parameter
(
"default_company_title"
)
context
.
WebPage_getCustom
Parameter
(
"default_company_title"
)
)
)
if
theme
is
not
None
:
if
theme
is
not
None
:
theme
=
theme
.
lower
()
theme
=
theme
.
lower
()
theme_logo_prefix
=
context
.
Base_getCustomTemplate
Parameter
(
"default_logo_prefix"
)
theme_logo_prefix
=
context
.
WebPage_getCustom
Parameter
(
"default_logo_prefix"
)
if
theme_logo_prefix
:
if
theme_logo_prefix
:
theme_reference
=
theme_logo_prefix
+
theme
.
capitalize
()
theme_reference
=
theme_logo_prefix
+
theme
.
capitalize
()
theme_logo_list
=
context
.
Base_getCustomTemplateProxyParameter
(
"logo"
,
theme_reference
)
theme_logo_list
=
context
.
Base_getCustomTemplateProxyParameter
(
"logo"
,
theme_reference
)
...
@@ -40,11 +40,11 @@ if theme is None:
...
@@ -40,11 +40,11 @@ if theme is None:
theme_dict
=
{}
theme_dict
=
{}
theme_dict
[
"theme"
]
=
theme
theme_dict
[
"theme"
]
=
theme
theme_dict
[
"theme_logo_description"
]
=
theme_logo_dict
.
get
(
"description"
,
blank
)
theme_dict
[
"theme_logo_description"
]
=
theme_logo_dict
.
get
(
"description"
,
blank
)
theme_dict
[
"theme_logo_url"
]
=
context
.
Base_getCustomTemplate
Parameter
(
"fallback_image"
)
theme_dict
[
"theme_logo_url"
]
=
context
.
WebPage_getCustom
Parameter
(
"fallback_image"
)
if
theme_logo_dict
.
get
(
"relative_url"
,
None
)
is
not
None
:
if
theme_logo_dict
.
get
(
"relative_url"
,
None
)
is
not
None
:
theme_dict
[
"theme_logo_url"
]
=
theme_logo_dict
.
get
(
"relative_url"
)
+
param
theme_dict
[
"theme_logo_url"
]
=
theme_logo_dict
.
get
(
"relative_url"
)
+
param
theme_dict
[
"template_css_url"
]
=
css_path
+
pdf
+
".css"
theme_dict
[
"template_css_url"
]
=
css_path
+
pdf
+
".css"
theme_dict
[
"fallback_img_url"
]
=
context
.
Base_getCustomTemplate
Parameter
(
"fallback_image"
)
or
blank
theme_dict
[
"fallback_img_url"
]
=
context
.
WebPage_getCustom
Parameter
(
"fallback_image"
)
or
blank
theme_dict
[
"theme_css_font_list"
]
=
context
.
Base_getCustomTemplate
Parameter
(
font
)
or
[]
theme_dict
[
"theme_css_font_list"
]
=
context
.
WebPage_getCustom
Parameter
(
font
)
or
[]
theme_dict
[
"theme_css_url"
]
=
context
.
Base_getCustomTemplateParameter
(
css
)
or
context
.
Base_getCustomTemplate
Parameter
(
css
)
or
blank
theme_dict
[
"theme_css_url"
]
=
context
.
WebPage_getCustomParameter
(
css
)
or
context
.
WebPage_getCustom
Parameter
(
css
)
or
blank
return
theme_dict
return
theme_dict
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Base_viewAsReport.py
View file @
9a07f26c
...
@@ -59,7 +59,7 @@ doc_requirement_relative_url = kw.get('requirement_relative_url', None)
...
@@ -59,7 +59,7 @@ doc_requirement_relative_url = kw.get('requirement_relative_url', None)
# -------------------------- Document Parameters ------------------------------
# -------------------------- Document Parameters ------------------------------
doc_localiser
=
doc
.
getPortalObject
().
Localizer
doc_localiser
=
doc
.
getPortalObject
().
Localizer
doc_relative_url
=
doc
.
getRelativeUrl
()
doc_relative_url
=
doc
.
getRelativeUrl
()
doc_rendering_fix
=
doc
.
Base_getCustomTemplate
Parameter
(
'wkhtmltopdf_rendering_fix'
)
or
blank
doc_rendering_fix
=
doc
.
WebPage_getCustom
Parameter
(
'wkhtmltopdf_rendering_fix'
)
or
blank
doc_report
=
getattr
(
doc
,
doc_report_name
)
doc_report
=
getattr
(
doc
,
doc_report_name
)
doc_aggregate_list
=
[]
doc_aggregate_list
=
[]
doc_revision
=
"1"
doc_revision
=
"1"
...
...
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Letter_send.py
View file @
9a07f26c
...
@@ -8,7 +8,7 @@ Print letter in any of the supported formats
...
@@ -8,7 +8,7 @@ Print letter in any of the supported formats
# parameters (*default)
# parameters (*default)
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# REQUEST: request object
#
#
REQUEST: request object
# format: output format
# format: output format
# portal_skin: skin to use for output
# portal_skin: skin to use for output
# batch_mode: used for tests
# batch_mode: used for tests
...
@@ -26,11 +26,11 @@ Print letter in any of the supported formats
...
@@ -26,11 +26,11 @@ Print letter in any of the supported formats
# override_destination_person_title: overide event recipient
# override_destination_person_title: overide event recipient
# override_date to use instead of current date
# override_date to use instead of current date
new_skin_name
=
"Letter"
#
new_skin_name = "Letter"
context
.
getPortalObject
().
portal_skins
.
changeSkin
(
new_skin_name
)
#
context.getPortalObject().portal_skins.changeSkin(new_skin_name)
if
REQUEST
is
None
:
#
if REQUEST is None:
REQUEST
=
context
.
REQUEST
#
REQUEST = context.REQUEST
REQUEST
.
set
(
'portal_skin'
,
new_skin_name
)
#
REQUEST.set('portal_skin', new_skin_name)
return
context
.
Letter_viewAsLetter
(
return
context
.
Letter_viewAsLetter
(
format
=
format
,
format
=
format
,
...
...
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/Letter_viewAsLetter.py
View file @
9a07f26c
...
@@ -48,7 +48,6 @@ override_date = letter.Base_setToNone(param=kw.get("override_date", None))
...
@@ -48,7 +48,6 @@ override_date = letter.Base_setToNone(param=kw.get("override_date", None))
override_batch_mode
=
letter
.
Base_setToNone
(
param
=
kw
.
get
(
'batch_mode'
,
None
))
override_batch_mode
=
letter
.
Base_setToNone
(
param
=
kw
.
get
(
'batch_mode'
,
None
))
# -------------------------- Document Parameters ------------------------------
# -------------------------- Document Parameters ------------------------------
letter_form
=
letter
.
REQUEST
letter_portal_type
=
letter
.
getPortalType
()
letter_portal_type
=
letter
.
getPortalType
()
letter_relative_url
=
letter
.
getRelativeUrl
()
letter_relative_url
=
letter
.
getRelativeUrl
()
letter_prefix
=
"Letter."
letter_prefix
=
"Letter."
...
@@ -67,26 +66,26 @@ if letter_portal_type == "Web Page":
...
@@ -67,26 +66,26 @@ if letter_portal_type == "Web Page":
else
:
else
:
letter_format
=
'pdf'
letter_format
=
'pdf'
letter_save
=
letter_save
or
True
letter_save
=
letter_save
or
True
letter_modification_date
=
letter
_form
[
'start_date'
]
or
None
or
letter
.
getCreationDate
()
letter_modification_date
=
letter
.
getStartDate
()
or
letter
.
getCreationDate
()
letter_title
=
letter
_form
.
get
(
'title'
)
letter_title
=
letter
.
getTitle
(
)
letter_content
=
letter
_form
.
get
(
'text_content'
)
letter_content
=
letter
.
getTextContent
(
)
letter_aggregate_list
=
letter
.
getAggregateList
()
letter_aggregate_list
=
letter
.
getAggregateList
()
letter_language
=
letter
.
Base_setToNone
(
param
=
letter_form
.
get
(
'select_language'
))
letter_language
=
letter
.
Base_setToNone
(
param
=
kw
.
get
(
'select_language'
))
letter_source
=
letter
_form
.
get
(
'source'
)
or
None
letter_source
=
letter
.
getSource
()
letter_destination
=
letter
_form
.
get
(
'destination'
)
or
None
letter_destination
=
letter
.
getDestination
()
# cut corner to retrieve path to css files
# cut corner to retrieve path to css files
letter_version
=
"001"
letter_version
=
"001"
letter_reference
=
letter
_form
.
get
(
"reference"
)
letter_reference
=
letter
.
getReference
(
)
# overrides for tests
# overrides for tests
if
override_batch_mode
is
not
None
:
if
override_batch_mode
!=
None
:
letter_modification_date
=
DateTime
(
"1976-11-04"
)
letter_modification_date
=
DateTime
(
"1976-11-04"
)
if
letter_language
is
not
None
:
#and letter_format == "pdf":
if
letter_language
!=
None
:
#and letter_format == "pdf":
letter
.
REQUEST
[
'AcceptLanguage'
].
set
(
letter_language
,
10
)
letter
.
REQUEST
[
'AcceptLanguage'
].
set
(
letter_language
,
10
)
if
letter_language
is
None
:
if
letter_language
==
None
:
letter_language
=
blank
letter_language
=
blank
if
letter_reference
is
None
:
if
letter_reference
==
None
:
letter_reference
=
letter_prefix
+
letter_title
.
replace
(
" "
,
"."
)
letter_reference
=
letter_prefix
+
letter_title
.
replace
(
" "
,
"."
)
letter_full_reference
=
'-'
.
join
([
letter_reference
,
letter_version
,
letter_language
])
letter_full_reference
=
'-'
.
join
([
letter_reference
,
letter_version
,
letter_language
])
...
@@ -141,8 +140,8 @@ if letter_format == "html":
...
@@ -141,8 +140,8 @@ if letter_format == "html":
letter_source_company
=
letter_source
.
get
(
"corporate_name"
,
letter_source
.
get
(
"organisation_title"
,
blank
)),
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_corporate_name
=
letter_source
.
get
(
"corporate_name"
,
blank
),
letter_source_company_capital
=
letter_source
.
get
(
"social_capital"
,
blank
),
letter_source_company_capital
=
letter_source
.
get
(
"social_capital"
,
blank
),
letter_source_company_capital_currency
=
letter_source
.
get
(
"social_capital_currency"
,
letter
.
Base_getCustomTemplate
Parameter
(
"default_source_company_capital_currency"
)),
letter_source_company_capital_currency
=
letter_source
.
get
(
"social_capital_currency"
,
letter
.
WebPage_getCustom
Parameter
(
"default_source_company_capital_currency"
)),
letter_source_registered_court
=
letter_source
.
get
(
"registered_court"
,
letter
.
Base_getCustomTemplate
Parameter
(
"default_source_registered_court"
)),
letter_source_registered_court
=
letter_source
.
get
(
"registered_court"
,
letter
.
WebPage_getCustom
Parameter
(
"default_source_registered_court"
)),
letter_source_ape_code
=
letter_source
.
get
(
"activity_code"
,
blank
),
letter_source_ape_code
=
letter_source
.
get
(
"activity_code"
,
blank
),
letter_source_address
=
letter_source
.
get
(
"address"
,
blank
),
letter_source_address
=
letter_source
.
get
(
"address"
,
blank
),
letter_source_postal_code
=
letter_source
.
get
(
"postal_code"
,
blank
),
letter_source_postal_code
=
letter_source
.
get
(
"postal_code"
,
blank
),
...
@@ -226,8 +225,8 @@ if letter_format == "pdf":
...
@@ -226,8 +225,8 @@ if letter_format == "pdf":
letter_source_company
=
letter_source
.
get
(
"organisation_title"
,
blank
),
letter_source_company
=
letter_source
.
get
(
"organisation_title"
,
blank
),
letter_source_company_corporate_name
=
letter_source
.
get
(
"corporate_name"
,
blank
),
letter_source_company_corporate_name
=
letter_source
.
get
(
"corporate_name"
,
blank
),
letter_source_company_capital
=
letter_source
.
get
(
"social_capital"
,
blank
),
letter_source_company_capital
=
letter_source
.
get
(
"social_capital"
,
blank
),
letter_source_company_capital_currency
=
letter_source
.
get
(
"social_capital_currency"
,
letter
.
Base_getCustomTemplate
Parameter
(
"default_source_company_capital_currency"
)),
letter_source_company_capital_currency
=
letter_source
.
get
(
"social_capital_currency"
,
letter
.
WebPage_getCustom
Parameter
(
"default_source_company_capital_currency"
)),
letter_source_registered_court
=
letter_source
.
get
(
"registered_court"
,
letter
.
Base_getCustomTemplate
Parameter
(
"default_source_registered_court"
)),
letter_source_registered_court
=
letter_source
.
get
(
"registered_court"
,
letter
.
WebPage_getCustom
Parameter
(
"default_source_registered_court"
)),
letter_source_ape_code
=
letter_source
.
get
(
"activity_code"
,
blank
),
letter_source_ape_code
=
letter_source
.
get
(
"activity_code"
,
blank
),
letter_source_address
=
letter_source
.
get
(
"address"
,
blank
),
letter_source_address
=
letter_source
.
get
(
"address"
,
blank
),
letter_source_postal_code
=
letter_source
.
get
(
"postal_code"
,
blank
),
letter_source_postal_code
=
letter_source
.
get
(
"postal_code"
,
blank
),
...
@@ -260,6 +259,11 @@ if letter_format == "pdf":
...
@@ -260,6 +259,11 @@ if letter_format == "pdf":
)
)
)
)
# return file for comparison in portal-component tests
if
override_batch_mode
!=
None
:
if
letter_portal_type
!=
"Web Page"
:
return
pdf_file
return
letter
.
WebPage_finishPdfCreation
(
return
letter
.
WebPage_finishPdfCreation
(
doc_download
=
letter_download
,
doc_download
=
letter_download
,
doc_save
=
letter_save
,
doc_save
=
letter_save
,
...
...
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_getCustomProxyParameter.py
View file @
9a07f26c
...
@@ -224,10 +224,23 @@ if pass_parameter is not None and pass_source_data is not None:
...
@@ -224,10 +224,23 @@ if pass_parameter is not None and pass_source_data is not None:
# -------------- Source/Destination (Person => Organisation) -----------------
# -------------- Source/Destination (Person => Organisation) -----------------
# returns [{organisation_dict}]
# returns [{organisation_dict}]
if
pass_parameter
==
"source"
or
pass_parameter
==
"destination"
:
if
pass_parameter
==
"source"
or
pass_parameter
==
"destination"
:
for
c
in
portal_object
.
person_module
.
searchFolder
(
uid
=
pass_source_data
):
person_candidate_list
=
portal_object
.
person_module
.
searchFolder
(
uid
=
pass_source_data
)
organisation
=
c
.
getCareerSubordinationValue
()
organisation_candidate_list
=
portal_object
.
organisation_module
.
searchFolder
(
uid
=
pass_source_data
)
if
organisation
is
not
None
:
return
populateOrganisationDict
([
organisation
])
if
len
(
person_candidate_list
)
>
0
:
for
c
in
person_candidate_list
:
organisation
=
c
.
getCareerSubordinationValue
()
if
organisation
is
not
None
:
return
populateOrganisationDict
([
organisation
])
else
:
return
populatePersonDict
([
c
])
# events might pass organisation as sender/recipient
if
len
(
organisation_candidate_list
)
>
0
:
organisation_candidate_list
=
portal_object
.
organisation_module
.
searchFolder
(
uid
=
pass_source_data
)
for
o
in
organisation_candidate_list
:
return
populateOrganisationDict
([
o
])
return
[]
return
[]
# -------------------- Organisation (Follow-Up) ------------------------------
# -------------------- Organisation (Follow-Up) ------------------------------
...
...
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/WebPage_viewAsBook.py
View file @
9a07f26c
...
@@ -75,7 +75,7 @@ override_batch_mode = book.Base_setToNone(param=kw.get('batch_mode', None))
...
@@ -75,7 +75,7 @@ override_batch_mode = book.Base_setToNone(param=kw.get('batch_mode', None))
book_localiser
=
book
.
getPortalObject
().
Localizer
book_localiser
=
book
.
getPortalObject
().
Localizer
book_relative_url
=
book
.
getRelativeUrl
()
book_relative_url
=
book
.
getRelativeUrl
()
book_prefix
=
"Book."
book_prefix
=
"Book."
book_rendering_fix
=
book
.
Base_getCustomTemplate
Parameter
(
'wkhtmltopdf_rendering_fix'
)
or
blank
book_rendering_fix
=
book
.
WebPage_getCustom
Parameter
(
'wkhtmltopdf_rendering_fix'
)
or
blank
book_content
=
book
.
getTextContent
()
book_content
=
book
.
getTextContent
()
book_aggregate_list
=
[]
book_aggregate_list
=
[]
book_revision
=
book
.
getRevision
()
book_revision
=
book
.
getRevision
()
...
...
bt5/erp5_corporate_identity/SkinTemplateItem/portal_skins/erp5_corporate_identity/template_themes/themes.css.css
View file @
9a07f26c
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
/* ------------------------ Slideshow -------------------------------------- */
/* ------------------------ Slideshow -------------------------------------- */
.ci-default
.ci-slideshow
.ci-slideshow-header
h2
,
.ci-default
.ci-slideshow
.ci-slideshow-header
h2
,
.ci-default
.ci-slideshow
.ci-slideshow-footer
,
.ci-default
.ci-slideshow
.ci-slideshow-footer
,
.ci-default
.ci-slideshow
.ci-slideshow-intro.present
>
h2
,
.ci-default
.ci-slideshow
.ci-slideshow-intro.present
>
h2
,
.ci-default
.ci-slideshow
.ci-slideshow-intro.present
:before
,
.ci-default
.ci-slideshow
.ci-slideshow-intro.present
:before
,
.ci-default
.ci-slideshow
h1
,
.ci-default
.ci-slideshow
h1
,
...
@@ -81,7 +81,7 @@
...
@@ -81,7 +81,7 @@
color
:
#ffffff
;
color
:
#ffffff
;
}
}
.ci-default
.ci-letter
.ci-letter-footer
{
.ci-default
.ci-letter
.ci-letter-footer
{
border-color
:
#C3C7C6
;
border-color
:
#C3C7C6
;
}
}
.ci-default
.ci-letter
.ci-letter-bar-logo
img
{
.ci-default
.ci-letter
.ci-letter-bar-logo
img
{
background
:
#ffffff
;
background
:
#ffffff
;
...
...
bt5/erp5_corporate_identity/TestTemplateItem/portal_components/test.erp5.testCorporateIdentityTemplates.py
View file @
9a07f26c
...
@@ -92,6 +92,16 @@ class TestCorporateIdentityTemplates(ERP5TypeTestCase):
...
@@ -92,6 +92,16 @@ class TestCorporateIdentityTemplates(ERP5TypeTestCase):
self
.
portal
.
portal_preferences
.
default_nexedi_system_preference
.
enable
()
self
.
portal
.
portal_preferences
.
default_nexedi_system_preference
.
enable
()
self
.
tic
()
self
.
tic
()
def
createTestEvent
(
self
,
target_language
):
test_event
=
self
.
portal
.
event_module
.
newContent
(
portal_type
=
"Letter"
,
language
=
target_language
,
content_type
=
"text/html"
,
text_content
=
"Hello"
,
title
=
"Test"
)
return
test_event
def
computeImageRenderingRootMeanSquare
(
self
,
image_data_1
,
image_data_2
):
def
computeImageRenderingRootMeanSquare
(
self
,
image_data_1
,
image_data_2
):
"""
"""
Compute and return the RMS (Root Mean Square) of image_data_1 and 2.
Compute and return the RMS (Root Mean Square) of image_data_1 and 2.
...
@@ -112,10 +122,7 @@ class TestCorporateIdentityTemplates(ERP5TypeTestCase):
...
@@ -112,10 +122,7 @@ class TestCorporateIdentityTemplates(ERP5TypeTestCase):
# image can be converted into greyscale without transparency
# image can be converted into greyscale without transparency
h1
=
image1
.
histogram
()
h1
=
image1
.
histogram
()
h2
=
image2
.
histogram
()
h2
=
image2
.
histogram
()
rms
=
math
.
sqrt
(
rms
=
math
.
sqrt
(
sum
((
a
-
b
)
**
2
for
a
,
b
in
zip
(
h1
,
h2
))
/
len
(
h1
))
#reduce(operator.add, map(lambda a, b: (a - b) ** 2, h1, h2)) / len(h1)
sum
((
a
-
b
)
**
2
for
a
,
b
in
zip
(
h1
,
h2
))
/
len
(
h1
)
)
# Note:
# Note:
# - rms is ~5300.0 same page, bmp without alpha and bmp transparent back
# - rms is ~5300.0 same page, bmp without alpha and bmp transparent back
...
@@ -183,7 +190,6 @@ class TestCorporateIdentityTemplates(ERP5TypeTestCase):
...
@@ -183,7 +190,6 @@ class TestCorporateIdentityTemplates(ERP5TypeTestCase):
if
has_original_accept_language
:
if
has_original_accept_language
:
self
.
app
.
REQUEST
[
"AcceptLanguage"
]
=
original_accept_language
self
.
app
.
REQUEST
[
"AcceptLanguage"
]
=
original_accept_language
else
:
else
:
# `del self.app.REQUEST["AcceptLanguage"]` raises `AttributeError: __delitem__`
self
.
app
.
REQUEST
[
"AcceptLanguage"
]
=
AcceptLanguage
()
self
.
app
.
REQUEST
[
"AcceptLanguage"
]
=
AcceptLanguage
()
def
callWithNewRequestForm
(
self
,
*
args
,
**
kw
):
def
callWithNewRequestForm
(
self
,
*
args
,
**
kw
):
...
@@ -230,16 +236,21 @@ class TestCorporateIdentityTemplates(ERP5TypeTestCase):
...
@@ -230,16 +236,21 @@ class TestCorporateIdentityTemplates(ERP5TypeTestCase):
"""
"""
Compare a rendered PDF page with a a pregenerated image
Compare a rendered PDF page with a a pregenerated image
"""
"""
t
est_page
=
getattr
(
self
.
portal
.
web_page_module
,
id1
)
t
arget_language
=
kw
.
get
(
"lang"
,
None
)
or
"en"
expected_image
=
getattr
(
self
.
portal
.
image_module
,
id2
)
expected_image
=
getattr
(
self
.
portal
.
image_module
,
id2
)
image_source_pdf_doc
=
getattr
(
self
.
portal
.
document_module
,
id3
)
image_source_pdf_doc
=
getattr
(
self
.
portal
.
document_module
,
id3
)
dump
=
getattr
(
self
.
portal
,
'dump_data'
,
None
)
dump
=
getattr
(
self
.
portal
,
'dump_data'
,
None
)
kw
[
"batch_mode"
]
=
1
kw
[
"batch_mode"
]
=
1
if
id1
==
None
:
test_page
=
self
.
createTestEvent
(
target_language
)
self
.
tic
()
else
:
test_page
=
getattr
(
self
.
portal
.
web_page_module
,
id1
)
pdf_kw
=
dict
(
pdf_kw
=
dict
(
reference
=
test_page
.
getReference
(),
reference
=
test_page
.
getReference
(),
target_language
=
kw
.
get
(
"lang"
,
None
)
or
"en"
,
target_language
=
target_language
version
=
test_page
.
getVersion
(),
)
)
pdf_data
=
self
.
call
(
pdf_data
=
self
.
call
(
...
@@ -251,7 +262,6 @@ class TestCorporateIdentityTemplates(ERP5TypeTestCase):
...
@@ -251,7 +262,6 @@ class TestCorporateIdentityTemplates(ERP5TypeTestCase):
**
kw
**
kw
)
)
# XXX don't overwrite file to create image, use temporary-pdf?
image_source_pdf_doc
.
setData
(
pdf_data
)
image_source_pdf_doc
.
setData
(
pdf_data
)
_
,
bmp
=
image_source_pdf_doc
.
convert
(
"bmp"
,
frame
=
kw
.
get
(
"page_number"
))
_
,
bmp
=
image_source_pdf_doc
.
convert
(
"bmp"
,
frame
=
kw
.
get
(
"page_number"
))
...
@@ -680,7 +690,7 @@ class TestCorporateIdentityTemplates(ERP5TypeTestCase):
...
@@ -680,7 +690,7 @@ class TestCorporateIdentityTemplates(ERP5TypeTestCase):
use_skin
=
"Letter"
,
use_skin
=
"Letter"
,
override_source_organisation_title
=
"Test Association"
,
override_source_organisation_title
=
"Test Association"
,
override_source_person_title
=
"Test Association Member"
,
override_source_person_title
=
"Test Association Member"
,
override_destination_organisation_title
=
"Test Associati
no
"
,
override_destination_organisation_title
=
"Test Associati
on
"
,
override_destination_person_title
=
"Test Association Member"
,
override_destination_person_title
=
"Test Association Member"
,
subfield_field_override_date_year
=
"1999"
,
subfield_field_override_date_year
=
"1999"
,
subfield_field_override_date_month
=
"12"
,
subfield_field_override_date_month
=
"12"
,
...
@@ -688,6 +698,56 @@ class TestCorporateIdentityTemplates(ERP5TypeTestCase):
...
@@ -688,6 +698,56 @@ class TestCorporateIdentityTemplates(ERP5TypeTestCase):
)
)
)
)
@
changeSkin
(
'Letter'
)
def
test_pdfLetterEventOverrideSenderRecipientOrganisation
(
self
):
"""
Test:
- Event as Letter
- override recipient, sender and use organisations
- export as pdf
"""
self
.
runPdfTestPattern
(
None
,
"template_test_letter_input_page_0_005_en_bmp"
,
"template_test_letter_input_005_en_pdf"
,
**
dict
(
page_number
=
0
,
test_method
=
"Letter_send"
,
format
=
"pdf"
,
use_skin
=
"Letter"
,
override_source_organisation_title
=
"Test Organisation"
,
override_destination_organisation_title
=
"Test Organisation"
,
subfield_field_override_date_year
=
"1999"
,
subfield_field_override_date_month
=
"12"
,
subfield_field_override_date_day
=
"31"
)
)
@
changeSkin
(
'Letter'
)
def
test_pdfLetterEventOverrideSenderRecipientPerson
(
self
):
"""
Test:
- Event as Letter
- override recipient, sender and a person without any organisation
- export as pdf
"""
self
.
runPdfTestPattern
(
None
,
"template_test_letter_input_page_0_006_en_bmp"
,
"template_test_letter_input_006_en_pdf"
,
**
dict
(
page_number
=
0
,
test_method
=
"Letter_send"
,
format
=
"pdf"
,
use_skin
=
"Letter"
,
override_source_person_title
=
"Test Unassociated Member"
,
override_destination_person_title
=
"Test Unassociated Member"
,
subfield_field_override_date_year
=
"1999"
,
subfield_field_override_date_month
=
"12"
,
subfield_field_override_date_day
=
"31"
)
)
@
changeSkin
(
'Letter'
)
@
changeSkin
(
'Letter'
)
def
test_pdfLetterLocaliserHeadDisplay
(
self
):
def
test_pdfLetterLocaliserHeadDisplay
(
self
):
"""
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment