Skip to content

Commit dbf2830

Browse files
committed
Added 'Allow duplicate vlans' option under settings that allows vlan duplicates and fixed vlan edit bug if vlan number is changed #phpipam#991
1 parent 31bab4e commit dbf2830

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

Diff for: app/admin/settings/index.php

+11
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,17 @@
446446
</td>
447447
</tr>
448448

449+
<!-- vlanDuplicate -->
450+
<tr>
451+
<td class="title"><?php print _("Allow duplicate vlans"); ?></td>
452+
<td>
453+
<input type="checkbox" class="input-switch" value="1" name="vlanDuplicate" <?php if($settings['vlanDuplicate'] == 1) print 'checked'; ?>>
454+
</td>
455+
<td class="info2">
456+
<?php print _('Allow duplicated vlans inside L2 domain'); ?>
457+
</td>
458+
</tr>
459+
449460

450461
<!-- ICPM -->
451462
<tr class="settings-title">

Diff for: app/admin/vlans/edit-result.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@
3434
$custom = $Tools->fetch_custom_fields('vlans');
3535

3636
//if it already exist die
37-
if($User->settings->vlanDuplicate==0 && $_POST['action']=="add") {
37+
if($User->settings->vlanDuplicate==0 && ($_POST['action']=="add" || $_POST['action']=="edit")) {
3838
$check_vlan = $Admin->fetch_multiple_objects ("vlans", "domainId", $_POST['domainId'], "vlanId");
39+
// check
3940
if($check_vlan!==false) {
4041
foreach($check_vlan as $v) {
41-
if($v->number == $_POST['number']) {
42+
if ($v->vlanId==$_POST['vlanId']) {}
43+
elseif($v->number == $_POST['number']) {
4244
{ $Result->show("danger", _("VLAN already exists"), true); }
4345
}
4446
}
@@ -86,6 +88,4 @@
8688
if($_POST['action']=="delete") { $Admin->remove_object_references ("subnets", "vlanId", $_POST['vlanId']); }
8789

8890
# print value for on the fly
89-
if($_POST['action']=="add") { print '<p id="vlanidforonthefly" style="display:none">'.$Admin->lastId.'</p>'; }
90-
91-
?>
91+
if($_POST['action']=="add") { print '<p id="vlanidforonthefly" style="display:none">'.$Admin->lastId.'</p>'; }

Diff for: misc/Roadmap

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ https://github.com/phpipam/phpipam/milestone/2
2222
#109 IP deletion request for non administrative users
2323
#1068 Custom section and other fields
2424
#1023 Location tags, subnet tags, ...
25+
#998 User credentials security constraints are too tight and not configurable
2526

2627
API:
2728
#800 Changelog Doesn't Track Changes Made Via API

0 commit comments

Comments
 (0)