Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
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
justinfreeman (Agileware)
Core
Commits
bf076628
Commit
bf076628
authored
11 years ago
by
pratik.joshi
Browse files
Options
Downloads
Patches
Plain Diff
CRM-14327 : added save and new button
parent
7ab9bfe8
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CRM/Contact/Form/CustomData.php
+19
-1
19 additions, 1 deletion
CRM/Contact/Form/CustomData.php
CRM/Core/BAO/CustomGroup.php
+4
-1
4 additions, 1 deletion
CRM/Core/BAO/CustomGroup.php
with
23 additions
and
2 deletions
CRM/Contact/Form/CustomData.php
+
19
−
1
View file @
bf076628
...
@@ -131,6 +131,12 @@ class CRM_Contact_Form_CustomData extends CRM_Core_Form {
...
@@ -131,6 +131,12 @@ class CRM_Contact_Form_CustomData extends CRM_Core_Form {
if
(
$this
->
_multiRecordDisplay
)
{
if
(
$this
->
_multiRecordDisplay
)
{
$this
->
_groupID
=
CRM_Utils_Request
::
retrieve
(
'groupID'
,
'Positive'
,
$this
);
$this
->
_groupID
=
CRM_Utils_Request
::
retrieve
(
'groupID'
,
'Positive'
,
$this
);
$this
->
_tableID
=
$this
->
_entityId
;
$this
->
_tableID
=
$this
->
_entityId
;
$this
->
_contactType
=
CRM_Contact_BAO_Contact
::
getContactType
(
$this
->
_tableID
);
$mode
=
CRM_Utils_Request
::
retrieve
(
'mode'
,
'String'
,
$this
);
$hasReachedMax
=
CRM_Core_BAO_CustomGroup
::
hasReachedMaxLimit
(
$this
->
_groupID
,
$this
->
_tableID
);
if
(
$hasReachedMax
&&
$mode
==
'add'
)
{
CRM_Core_Error
::
statusBounce
(
ts
(
'The maximum record limit is reached'
));
}
$this
->
_copyValueId
=
CRM_Utils_Request
::
retrieve
(
'copyValueId'
,
'Positive'
,
$this
);
$this
->
_copyValueId
=
CRM_Utils_Request
::
retrieve
(
'copyValueId'
,
'Positive'
,
$this
);
$groupTitle
=
CRM_Core_BAO_CustomGroup
::
getTitle
(
$this
->
_groupID
);
$groupTitle
=
CRM_Core_BAO_CustomGroup
::
getTitle
(
$this
->
_groupID
);
...
@@ -187,6 +193,11 @@ class CRM_Contact_Form_CustomData extends CRM_Core_Form {
...
@@ -187,6 +193,11 @@ class CRM_Contact_Form_CustomData extends CRM_Core_Form {
'name'
=>
ts
(
'%1'
,
array
(
1
=>
$saveButtonName
)),
'name'
=>
ts
(
'%1'
,
array
(
1
=>
$saveButtonName
)),
'isDefault'
=>
TRUE
,
'isDefault'
=>
TRUE
,
),
),
array
(
'type'
=>
'upload'
,
'name'
=>
ts
(
'Save and New'
),
'subName'
=>
'new'
,
),
array
(
array
(
'type'
=>
'cancel'
,
'type'
=>
'cancel'
,
'name'
=>
ts
(
'Cancel'
),
'name'
=>
ts
(
'Cancel'
),
...
@@ -286,13 +297,20 @@ class CRM_Contact_Form_CustomData extends CRM_Core_Form {
...
@@ -286,13 +297,20 @@ class CRM_Contact_Form_CustomData extends CRM_Core_Form {
public
function
postProcess
()
{
public
function
postProcess
()
{
// Get the form values and groupTree
// Get the form values and groupTree
$params
=
$this
->
controller
->
exportValues
(
$this
->
_name
);
$params
=
$this
->
controller
->
exportValues
(
$this
->
_name
);
CRM_Core_BAO_CustomValueTable
::
postProcess
(
$params
,
CRM_Core_BAO_CustomValueTable
::
postProcess
(
$params
,
$this
->
_groupTree
[
$this
->
_groupID
][
'fields'
],
$this
->
_groupTree
[
$this
->
_groupID
][
'fields'
],
'civicrm_contact'
,
'civicrm_contact'
,
$this
->
_tableID
,
$this
->
_tableID
,
$this
->
_entityType
$this
->
_entityType
);
);
$table
=
CRM_Core_DAO
::
getFieldValue
(
'CRM_Core_DAO_CustomGroup'
,
$this
->
_groupID
,
'table_name'
);
$cgcount
=
CRM_Core_BAO_CustomGroup
::
customGroupDataExistsForEntity
(
$this
->
_tableID
,
$table
,
TRUE
);
$cgcount
+=
1
;
$buttonName
=
$this
->
controller
->
getButtonName
();
if
(
$buttonName
==
$this
->
getButtonName
(
'upload'
,
'new'
))
{
CRM_Core_Session
::
singleton
()
->
pushUserContext
(
CRM_Utils_System
::
url
(
'civicrm/contact/view/cd/edit'
,
"reset=1&type=
{
$this
->
_contactType
}
&groupID=
{
$this
->
_groupID
}
&entityID=
{
$this
->
_tableID
}
&cgcount=
{
$cgcount
}
&multiRecordDisplay=single&mode=add"
));
}
// reset the group contact cache for this group
// reset the group contact cache for this group
CRM_Contact_BAO_GroupContactCache
::
remove
();
CRM_Contact_BAO_GroupContactCache
::
remove
();
}
}
...
...
This diff is collapsed.
Click to expand it.
CRM/Core/BAO/CustomGroup.php
+
4
−
1
View file @
bf076628
...
@@ -614,13 +614,16 @@ ORDER BY civicrm_custom_group.weight,
...
@@ -614,13 +614,16 @@ ORDER BY civicrm_custom_group.weight,
*
*
* @return boolean does this entity have data in this custom table
* @return boolean does this entity have data in this custom table
*/
*/
static
public
function
customGroupDataExistsForEntity
(
$entityID
,
$table
){
static
public
function
customGroupDataExistsForEntity
(
$entityID
,
$table
,
$getCount
=
FALSE
){
$query
=
"
$query
=
"
SELECT count(id)
SELECT count(id)
FROM
$table
FROM
$table
WHERE entity_id =
$entityID
WHERE entity_id =
$entityID
"
;
"
;
$recordExists
=
CRM_Core_DAO
::
singleValueQuery
(
$query
);
$recordExists
=
CRM_Core_DAO
::
singleValueQuery
(
$query
);
if
(
$getCount
)
{
return
$recordExists
;
}
return
$recordExists
?
TRUE
:
FALSE
;
return
$recordExists
?
TRUE
:
FALSE
;
}
}
...
...
This diff is collapsed.
Click to expand it.
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