Skip to content

Commit

Permalink
webui: Update create bill link to list bill or list bills depending o…
Browse files Browse the repository at this point in the history
…n if port exists in bills #5616 (#5653)
  • Loading branch information
laf authored and f0o committed Jan 29, 2017
1 parent 5be1ea9 commit f611c7e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion html/pages/device/port.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,14 @@
}//end if

if ($_SESSION['userlevel'] >= '10' && $config['enable_billing'] == 1) {
echo "<span style='float: right;'><a href='" . generate_url(array('page'=>'bills', 'view'=>'add', 'port'=>$port['port_id'])) . "'><i class='fa fa-money fa-lg icon-theme' aria-hidden='true'></i> Create Bill</a></span>";
$bills = dbFetchRows("SELECT `bill_id` FROM `bill_ports` WHERE `port_id`=?", array($port['port_id']));
if (count($bills) === 1) {
echo "<span style='float: right;'><a href='" . generate_url(array('page' => 'bill','bill_id' => $bills[0]['bill_id'])) . "'><i class='fa fa-money fa-lg icon-theme' aria-hidden='true'></i> View Bill</a></span>";
} elseif (count($bills) > 1) {
echo "<span style='float: right;'><a href='" . generate_url(array('page' => 'bills')) . "'><i class='fa fa-money fa-lg icon-theme' aria-hidden='true'></i> View Bills</a></span>";
} else {
echo "<span style='float: right;'><a href='" . generate_url(array('page' => 'bills','view' => 'add','port' => $port['port_id'])) . "'><i class='fa fa-money fa-lg icon-theme' aria-hidden='true'></i> Create Bill</a></span>";
}
}

print_optionbar_end();
Expand Down

0 comments on commit f611c7e

Please sign in to comment.