Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add location field to ip address export #4084

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/admin/import-export/export-ipaddr-field-select.php
Expand Up @@ -83,6 +83,7 @@
print " <th>"._('MAC')."</th>";
print " <th>"._('Owner')."</th>";
print " <th>"._('Device')."</th>";
print " <th>"._('Location')."</th>";
print " <th>"._('Note')."</th>";
print " <th>"._('Tag')."</th>";
print " <th>"._('Gateway')."</th>";
Expand All @@ -99,6 +100,7 @@
print " <td><input type='checkbox' name='mac'> </td>";
print " <td><input type='checkbox' name='owner'> </td>";
print " <td><input type='checkbox' name='device'> </td>";
print " <td><input type='checkbox' name='location'> </td>";
print " <td><input type='checkbox' name='note'> </td>";
print " <td><input type='checkbox' name='tag'> </td>";
print " <td><input type='checkbox' name='gateway'> </td>";
Expand Down
19 changes: 19 additions & 0 deletions app/admin/import-export/export-ipaddr.php
Expand Up @@ -124,6 +124,18 @@
}
}
}
if( (isset($_GET['location'])) && ($_GET['location'] == "on") ) {
$worksheet->write($curRow, $curColumn, _('Location') ,$format_header);
$curColumn++;
# get Locations and reorder
$locations = $Tools->fetch_all_objects ("locations", "name");
$locations_indexed = array();
if ($locations!==false) {
foreach($locations as $d) {
$locations_indexed[$d->id] = $d;
}
}
}
if( (isset($_GET['note'])) && ($_GET['note'] == "on") ) {
$worksheet->write($curRow, $curColumn, _('Note') ,$format_header);
$curColumn++;
Expand Down Expand Up @@ -241,6 +253,13 @@
$curColumn++;
}

if( (isset($_GET['location'])) && ($_GET['location'] == "on") ) {
//change location to name
$ip['location'] = is_null($ip['location'])||is_blank($ip['location'])||$ip['location']==0 ? "" : $locations_indexed[$ip['switch']]->name;
$worksheet->write($curRow, $curColumn, $ip['location'], $format_text);
$curColumn++;
}

if( (isset($_GET['note'])) && ($_GET['note'] == "on") ) {
$worksheet->write($curRow, $curColumn, $ip['note'], $format_text);
$curColumn++;
Expand Down