Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vtigercrm
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
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
Admin message
Welcome to Vtiger Community. To gain access for account, please contact [ community @ vtiger.com ]
Show more breadcrumbs
Tim Mohrbach
vtigercrm
Commits
66e2083d
Commit
66e2083d
authored
9 years ago
by
Preexo
Browse files
Options
Downloads
Patches
Plain Diff
fixes
vtiger/vtigercrm#35
parent
30d5d09a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pkg/vtiger/modules/Google/modules/Google/helpers/Map.php
+47
-9
47 additions, 9 deletions
pkg/vtiger/modules/Google/modules/Google/helpers/Map.php
with
47 additions
and
9 deletions
pkg/vtiger/modules/Google/modules/Google/helpers/Map.php
+
47
−
9
View file @
66e2083d
...
...
@@ -10,6 +10,32 @@
* *********************************************************************************** */
class
Google_Map_Helper
{
public
function
__construct
()
{
self
::
initializeSchema
();
}
/**
* Creates table if not exists
*/
private
static
function
initializeSchema
()
{
if
(
!
Vtiger_Utils
::
CheckTable
(
'vtiger_google_map'
))
{
// create table
Vtiger_Utils
::
CreateTable
(
'vtiger_google_map'
,
'(module varchar(255), parameter_name varchar(255), parameter_field varchar(255))'
,
true
);
// fill with defaults
$db
=
PearDatabase
::
getInstance
();
$db
->
pquery
(
"INSERT INTO `vtiger_google_map` (`module`, `parameter_name`, `parameter_field`) VALUES
('Contacts', 'street', 'mailingstreet'),
('Contacts', 'city', 'mailingcity'),
('Contacts', 'country', 'mailingcountry'),
('Leads', 'street', 'lane'),
('Leads', 'city', 'city'),
('Leads', 'country', 'country'),
('Accounts', 'street', 'bill_street'),
('Accounts', 'city', 'bill_city'),
('Accounts', 'country', 'bill_country');"
);
}
}
/**
* get the location for the record based on the module type
...
...
@@ -37,18 +63,30 @@ class Google_Map_Helper {
* @return type
*/
static
function
getLocationFields
(
$module
)
{
switch
(
$module
)
{
case
'Contacts'
:
return
array
(
'street'
=>
'mailingstreet'
,
'city'
=>
'mailingcity'
,
'country'
=>
'mailingcountry'
);
self
::
initializeSchema
();
$db
=
PearDatabase
::
getInstance
();
$result
=
$db
->
pquery
(
"SELECT * FROM vtiger_google_map WHERE module='
$module
'"
);
$number
=
$db
->
num_rows
(
$result
);
$retArray
=
array
();
if
(
$number
>=
1
){
// fill return array with db values
for
(
$i
=
0
;
$i
<
$number
;
$i
++
)
{
$row
=
$db
->
fetch_row
(
$result
);
$retArray
[
$row
[
'parameter_name'
]]
=
$row
[
'parameter_field'
];
}
}
else
{
// in case nothing came from db
switch
(
$module
)
{
case
'Contacts'
:
$retArray
=
array
(
'street'
=>
'mailingstreet'
,
'city'
=>
'mailingcity'
,
'country'
=>
'mailingcountry'
);
break
;
case
'Leads'
:
$retArray
=
array
(
'street'
=>
'lane'
,
'city'
=>
'city'
,
'country'
=>
'country'
);
break
;
case
'
Lead
s'
:
ret
urn
array
(
'street'
=>
'
lane
'
,
'city'
=>
'city'
,
'country'
=>
'country'
);
case
'
Account
s'
:
$
ret
Array
=
array
(
'street'
=>
'
bill_street
'
,
'city'
=>
'
bill_
city'
,
'country'
=>
'
bill_
country'
);
break
;
case
'Accounts'
:
return
array
(
'street'
=>
'bill_street'
,
'city'
=>
'bill_city'
,
'country'
=>
'bill_country'
);
break
;
default
:
return
array
();
default
:
$retArray
=
array
();
break
;
}
}
return
$retArray
;
}
}
?>
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