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
36769590
Commit
36769590
authored
5 years ago
by
eileen
Browse files
Options
Downloads
Patches
Plain Diff
[NFC] code cleanup
Swap out some fatals for exceptions, use single quotes, strict comparison
parent
93885422
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CRM/Core/BAO/CustomGroup.php
+12
-10
12 additions, 10 deletions
CRM/Core/BAO/CustomGroup.php
with
12 additions
and
10 deletions
CRM/Core/BAO/CustomGroup.php
+
12
−
10
View file @
36769590
...
...
@@ -160,7 +160,7 @@ class CRM_Core_BAO_CustomGroup extends CRM_Core_DAO_CustomGroup {
if
(
CRM_Core_DAO_AllCoreTables
::
isCoreTable
(
$tableName
))
{
// Bad idea. Prevent group creation because it might lead to a broken configuration.
CRM_Core_Error
::
fatal
(
ts
(
"
Cannot create custom table because %1 is already a core table.
"
,
[
'1'
=>
$tableName
]));
throw
new
CRM_Core_Exception
(
ts
(
'
Cannot create custom table because %1 is already a core table.
'
,
[
'1'
=>
$tableName
]));
}
}
}
...
...
@@ -1639,9 +1639,9 @@ ORDER BY civicrm_custom_group.weight,
$value
=
NULL
;
}
}
elseif
(
$field
[
'html_type'
]
==
'Select'
||
(
$field
[
'html_type'
]
==
'Radio'
&&
$field
[
'data_type'
]
!=
'Boolean'
elseif
(
$field
[
'html_type'
]
==
=
'Select'
||
(
$field
[
'html_type'
]
==
=
'Radio'
&&
$field
[
'data_type'
]
!=
=
'Boolean'
)
)
{
$customOption
=
CRM_Core_BAO_CustomOption
::
getCustomOption
(
$key
,
TRUE
);
...
...
@@ -1654,7 +1654,7 @@ ORDER BY civicrm_custom_group.weight,
}
}
}
elseif
(
$field
[
'data_type'
]
==
'Date'
)
{
elseif
(
$field
[
'data_type'
]
==
=
'Date'
)
{
$valid
=
CRM_Utils_Rule
::
date
(
$value
);
}
...
...
@@ -1679,12 +1679,14 @@ ORDER BY civicrm_custom_group.weight,
*
* @return bool
* false if it matches else true
*
* @throws \CRM_Core_Exception
*/
public
static
function
checkCustomField
(
$customFieldId
,
&
$removeCustomFieldTypes
)
{
$query
=
"
SELECT cg.extends as extends
$query
=
'
SELECT cg.extends as extends
FROM civicrm_custom_group as cg, civicrm_custom_field as cf
WHERE cg.id = cf.custom_group_id
AND cf.id =
"
.
AND cf.id =
'
.
CRM_Utils_Type
::
escape
(
$customFieldId
,
'Integer'
);
$extends
=
CRM_Core_DAO
::
singleValueQuery
(
$query
);
...
...
@@ -1762,7 +1764,7 @@ SELECT IF( EXISTS(SELECT name FROM civicrm_contact_type WHERE name like %1), 1,
if
(
array_key_exists
(
$table
,
$extendObjs
))
{
return
$extendObjs
[
$table
];
}
CRM_Core_Error
::
fatal
(
);
throw
new
CRM_Core_Exception
(
'Unknown error'
);
}
}
}
...
...
@@ -1839,7 +1841,7 @@ SELECT IF( EXISTS(SELECT name FROM civicrm_contact_type WHERE name like %1), 1,
if
(
isset
(
$properties
[
'customValue'
][
$groupCount
]))
{
$properties
[
'element_name'
]
=
"custom_
{
$k
}
_
{
$properties
[
'customValue'
][
$groupCount
][
'id'
]
}
"
;
$formattedGroupTree
[
$key
][
'table_id'
]
=
$properties
[
'customValue'
][
$groupCount
][
'id'
];
if
(
$properties
[
'data_type'
]
==
'File'
)
{
if
(
$properties
[
'data_type'
]
==
=
'File'
)
{
$properties
[
'element_value'
]
=
$properties
[
'customValue'
][
$groupCount
];
$uploadNames
[]
=
$properties
[
'element_name'
];
}
...
...
@@ -2076,7 +2078,7 @@ SELECT civicrm_custom_group.id as groupID, civicrm_custom_group.title as groupT
}
if
(
!
is_array
(
$args
))
{
CRM_Core_Error
::
fatal
(
'Arg is not of type array'
);
throw
new
CRM_Core_Exception
(
'Arg is not of type array'
);
}
list
(
$className
)
=
explode
(
'::'
,
$callback
);
...
...
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