Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Extensions
Documents
Commits
6b280f8b
Commit
6b280f8b
authored
Jul 16, 2019
by
jaapjansma
Browse files
Added subject field with tokens
parent
8dda21b9
Changes
5
Hide whitespace changes
Inline
Side-by-side
drupal/views_civicrm_documents/views_civicrm_documents.info
View file @
6b280f8b
name
=
CiviCRM
Documents
views
integeration
description
=
Integrates
CiviCRM
Documents
with
views
version
=
7.
x
-
1.
9
version
=
7.
x
-
1.
10
core
=
7.
x
package
=
CiviCRM
dependencies
[]
=
civicrm
(>=
4.4
)
...
...
drupal/webform_civicrm_documents/WebformCiviCRMDocuments.inc
View file @
6b280f8b
...
...
@@ -28,7 +28,14 @@ class WebformCiviCRMDocuments {
foreach
(
$this
->
node
->
webform
[
'components'
]
as
$cid
=>
$field
)
{
if
(
$this
->
checkComponentForDocument
(
$cid
,
$field
))
{
$this
->
saveFiles
(
$field
[
'name'
],
$this
->
submission
->
data
[
$cid
],
$field
);
$subject
=
_webform_civicrm_documents_get_subject
(
$field
);
if
(
$subject
)
{
$subject
=
webform_replace_tokens
(
$subject
,
$this
->
node
,
$this
->
submission
);
}
if
(
!
$subject
)
{
$subject
=
$field
[
'name'
];
}
$this
->
saveFiles
(
$subject
,
$this
->
submission
->
data
[
$cid
],
$field
);
}
}
}
...
...
drupal/webform_civicrm_documents/webform_civicrm_documents.info
View file @
6b280f8b
name
=
CiviCRM
Webform
upload
to
CiviCRM
Document
description
=
Create
documents
from
CiviCRM
Webform
uploaded
files
.
version
=
7.
x
-
1.
9
version
=
7.
x
-
1.
10
core
=
7.
x
package
=
CiviCRM
dependencies
[]
=
civicrm
(>=
4.4
)
...
...
drupal/webform_civicrm_documents/webform_civicrm_documents.module
View file @
6b280f8b
...
...
@@ -21,7 +21,7 @@ function webform_civicrm_documents_form_webform_component_edit_form_alter(&$form
if
(
!
isset
(
$form
[
'#node'
]
->
webform_civicrm
))
{
return
;
}
$form
[
'webform_civicrm_documents'
]
=
array
(
'#type'
=>
'fieldset'
,
'#title'
=>
t
(
'CiviCRM Documents'
),
...
...
@@ -30,9 +30,20 @@ function webform_civicrm_documents_form_webform_component_edit_form_alter(&$form
$form
[
'webform_civicrm_documents'
][
'enabled'
]
=
array
(
'#type'
=>
'checkbox'
,
'#title'
=>
t
(
'Save this file as a document in civicrm'
),
'#description'
=>
t
(
"The file is saved as document in civicrm
by its name
"
),
'#description'
=>
t
(
"The file is saved as document in civicrm
.
"
),
'#default_value'
=>
_webform_civicrm_documents_get_enabled
(
$component
),
);
$form
[
'webform_civicrm_documents'
][
'subject'
]
=
array
(
'#type'
=>
'textfield'
,
'#title'
=>
t
(
'Subject.'
),
'#description'
=>
t
(
"Default to the title of the field."
)
.
' '
.
theme
(
'webform_token_help'
,
array
(
'groups'
=>
array
(
'node'
,
'submission'
))),
'#default_value'
=>
_webform_civicrm_documents_get_subject
(
$component
),
'#states'
=>
array
(
'invisible'
=>
array
(
':input[name="webform_civicrm_documents[enabled]"]'
=>
array
(
'checked'
=>
false
),
),
),
);
$form
[
'webform_civicrm_documents'
][
'existing'
]
=
array
(
'#type'
=>
'select'
,
'#title'
=>
t
(
'What to do when document already exist'
),
...
...
@@ -67,6 +78,7 @@ function webform_civicrm_documents_webform_component_presave(&$component) {
return
;
}
$component
[
'extra'
][
'webform_civicrm_documents_enabled'
]
=
$component
[
'webform_civicrm_documents'
][
'enabled'
]
?
true
:
false
;
$component
[
'extra'
][
'webform_civicrm_documents_subject'
]
=
$component
[
'webform_civicrm_documents'
][
'subject'
];
$component
[
'extra'
][
'webform_civicrm_documents_existing'
]
=
$component
[
'webform_civicrm_documents'
][
'existing'
];
$component
[
'extra'
][
'webform_civicrm_documents_contacts'
]
=
serialize
(
$component
[
'webform_civicrm_documents'
][
'contact'
]);
}
...
...
@@ -79,6 +91,14 @@ function _webform_civicrm_documents_get_enabled(array $component) {
return
$enabled
;
}
function
_webform_civicrm_documents_get_subject
(
array
$component
)
{
$subject
=
''
;
if
(
isset
(
$component
[
'extra'
][
'webform_civicrm_documents_subject'
]))
{
$subject
=
$component
[
'extra'
][
'webform_civicrm_documents_subject'
];
}
return
$subject
;
}
function
_webform_civicrm_documents_get_contact
(
array
$component
)
{
$contacts
=
array
();
if
(
!
empty
(
$component
[
'extra'
][
'webform_civicrm_documents_contacts'
]))
{
...
...
info.xml
View file @
6b280f8b
...
...
@@ -14,8 +14,8 @@
<url
desc=
"Support"
>
http://civicoop.org
</url>
<url
desc=
"Licensing"
>
http://www.gnu.org/licenses/agpl-3.0.html
</url>
</urls>
<releaseDate>
201
8-09-05
</releaseDate>
<version>
1.
9
</version>
<releaseDate>
201
9-07-16
</releaseDate>
<version>
1.
10
</version>
<develStage>
stable
</develStage>
<compatibility>
<ver>
4.7
</ver>
...
...
Write
Preview
Supports
Markdown
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