Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CiviCRM Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
CiviCRM Core
Commits
17dae666
Commit
17dae666
authored
1 year ago
by
Eileen McNaughton
Browse files
Options
Downloads
Patches
Plain Diff
Copy locationBuildForm function back to only class that calls it
parent
a823c163
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CRM/Contact/Form/Contact.php
+62
-1
62 additions, 1 deletion
CRM/Contact/Form/Contact.php
CRM/Contact/Form/Location.php
+3
-0
3 additions, 0 deletions
CRM/Contact/Form/Location.php
with
65 additions
and
1 deletion
CRM/Contact/Form/Contact.php
+
62
−
1
View file @
17dae666
...
...
@@ -819,7 +819,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
// build location blocks.
CRM_Contact_Form_Edit_Lock
::
buildQuickForm
(
$this
);
CRM_Contact_Form_Location
::
buildQuickForm
(
$this
);
$this
->
buildLocationForm
(
);
// add attachment
$this
->
addField
(
'image_URL'
,
[
'maxlength'
=>
'255'
,
'label'
=>
ts
(
'Browse/Upload Image'
),
'accept'
=>
'image/png, image/jpeg, image/gif'
]);
...
...
@@ -883,6 +883,67 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
$this
->
addButtons
(
$buttons
);
}
private
function
buildLocationForm
():
void
{
// required for subsequent AJAX requests.
$ajaxRequestBlocks
=
[];
$generateAjaxRequest
=
0
;
//build 1 instance of all blocks, without using ajax ...
foreach
(
$this
->
_blocks
as
$blockName
=>
$label
)
{
$name
=
strtolower
(
$blockName
);
$instances
=
[
1
];
if
(
!
empty
(
$_POST
[
$name
])
&&
is_array
(
$_POST
[
$name
]))
{
$instances
=
array_keys
(
$_POST
[
$name
]);
}
elseif
(
!
empty
(
$this
->
_values
[
$name
])
&&
is_array
(
$this
->
_values
[
$name
]))
{
$instances
=
array_keys
(
$this
->
_values
[
$name
]);
}
foreach
(
$instances
as
$instance
)
{
if
(
$instance
==
1
)
{
$this
->
assign
(
'addBlock'
,
FALSE
);
$this
->
assign
(
'blockId'
,
$instance
);
}
else
{
//we are going to build other block instances w/ AJAX
$generateAjaxRequest
++
;
$ajaxRequestBlocks
[
$blockName
][
$instance
]
=
TRUE
;
}
switch
(
$blockName
)
{
case
'Email'
:
// setDefaults uses this to tell which instance
$this
->
set
(
'Email_Block_Count'
,
$instance
);
CRM_Contact_Form_Edit_Email
::
buildQuickForm
(
$this
,
$instance
);
// Only display the signature fields if this contact has a CMS account
// because they can only send email if they have access to the CRM
$ufID
=
$this
->
_contactId
&&
CRM_Core_BAO_UFMatch
::
getUFId
(
$this
->
_contactId
);
$this
->
assign
(
'isAddSignatureFields'
,
(
bool
)
$ufID
);
if
(
$ufID
)
{
$this
->
add
(
'textarea'
,
"email[
$instance
][signature_text]"
,
ts
(
'Signature (Text)'
),
[
'rows'
=>
2
,
'cols'
=>
40
]
);
$this
->
add
(
'wysiwyg'
,
"email[
$instance
][signature_html]"
,
ts
(
'Signature (HTML)'
),
[
'rows'
=>
2
,
'cols'
=>
40
]
);
}
break
;
default
:
// @todo This pattern actually adds complexity compared to filling out a switch statement
// for the limited number of blocks - as we also have to receive the block count
$this
->
set
(
$blockName
.
'_Block_Count'
,
$instance
);
$formName
=
'CRM_Contact_Form_Edit_'
.
$blockName
;
$formName
::
buildQuickForm
(
$this
);
}
}
}
//assign to generate AJAX request for building extra blocks.
$this
->
assign
(
'generateAjaxRequest'
,
$generateAjaxRequest
);
$this
->
assign
(
'ajaxRequestBlocks'
,
$ajaxRequestBlocks
);
}
/**
* Form submission of new/edit contact is processed.
*/
...
...
This diff is collapsed.
Click to expand it.
CRM/Contact/Form/Location.php
+
3
−
0
View file @
17dae666
...
...
@@ -13,12 +13,15 @@
*
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
*
* @deprecated in CiviCRM 5.66, will be removed around CiviCRM 5.76.
*/
class
CRM_Contact_Form_Location
{
/**
* Build the form object.
*
* @deprecated in CiviCRM 5.66, will be removed around CiviCRM 5.76.
* @param CRM_Core_Form $form
*/
public
static
function
buildQuickForm
(
&
$form
)
{
...
...
This diff is collapsed.
Click to expand it.
colemanw
@colemanw
mentioned in commit
903c186d
·
3 months ago
mentioned in commit
903c186d
mentioned in commit 903c186dd296f3a765166d093183209d7ecf6fab
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment