Skip to content

Commit

Permalink
Allow importing geolocation fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Hipska committed Jun 8, 2020
1 parent 08a7646 commit c15ae33
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
## 1.3.0 - 2020-06-08
### Added
- AGPL license file.

### Changed
- Diaeresis in Dutch translation.
- Code cleanup
- Import of objects with Geolocation field is now possible

### Removed
- Support for iTop 2.3 and 2.4 in order to use php 5.6
Expand Down
25 changes: 25 additions & 0 deletions main.sv-geolocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,31 @@ public function GetAsHTMLForHistory($sValue, $oHostObject = null, $bLocalize = t
{
return (string) $sValue;
}

public function GetImportColumns()
{
$aColumns = array();
$aColumns[$this->GetCode()] = 'VARCHAR(25)'.CMDBSource::GetSqlStringColumnDefinition();

return $aColumns;
}

/**
* @param array $aCols
* @param string $sPrefix
* @return ormGeolocation|null
* @throws MissingColumnException
*/
public function FromImportToValue($aCols, $sPrefix = '')
{
if (!isset($aCols[$sPrefix]))
{
$sAvailable = implode(', ', array_keys($aCols));
throw new MissingColumnException("Missing column '$sPrefix' from {$sAvailable}");
}

return $this->MakeRealValue($aCols[$sPrefix], null);
}

/**
* @return int Width of the map
Expand Down
2 changes: 1 addition & 1 deletion module.sv-geolocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

SetupWebPage::AddModule(
__FILE__, // Path to the current file, all other file names are relative to the directory containing this file
'sv-geolocation/1.2.0',
'sv-geolocation/1.3.0',
array(
// Identification
//
Expand Down

0 comments on commit c15ae33

Please sign in to comment.