Skip to content

Commit

Permalink
[BF] logic fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
barryo committed Oct 27, 2017
1 parent 7d0bd03 commit be4548a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions application/controllers/PeeringManagerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function indexAction()
{
// days since last peering request email sent
if( !$p['email_last_sent'] )
$peers[ $i ]['email_days'] = 0;
$peers[ $i ]['email_days'] = -1;
else
$peers[ $i ]['email_days'] = floor( ( time() - $p['email_last_sent']->getTimestamp() ) / 86400 );
}
Expand Down Expand Up @@ -310,16 +310,16 @@ public function peeringRequestAction()
// get this customer/peer peering manager table entry
$pm = $this->_loadPeeringManagerEntry( $this->getCustomer(), $peer );

if( isset( $this->_options['peeringmanager']['testmode'] ) && $this->_options['peeringmanager']['testmode']
&& isset( $this->_options['peeringmanager']['testdate'] ) && $this->_options['peeringmanager']['testdate'] )
if( !( isset( $this->_options['peeringmanager']['testmode'] ) && $this->_options['peeringmanager']['testmode'] )
|| isset( $this->_options['peeringmanager']['testdate'] ) && $this->_options['peeringmanager']['testdate'] )
{
$pm->setEmailLastSent( new DateTime() );
$pm->setEmailsSent( $pm->getEmailsSent() + 1 );
$pm->setUpdated( new DateTime() );
}

if( isset( $this->_options['peeringmanager']['testmode'] ) && $this->_options['peeringmanager']['testmode']
&& isset( $this->_options['peeringmanager']['testnote'] ) && $this->_options['peeringmanager']['testnote'] )
if( !( isset( $this->_options['peeringmanager']['testmode'] ) && $this->_options['peeringmanager']['testmode'] )
|| isset( $this->_options['peeringmanager']['testnote'] ) && $this->_options['peeringmanager']['testnote'] )
{
$pm->setNotes(
date( 'Y-m-d' ) . " [{$this->getUser()->getUsername()}]: peering request " . ( $marksent ? 'marked ' : '' ) . "sent\n\n" . $pm->getNotes()
Expand Down
2 changes: 1 addition & 1 deletion application/views/peering-manager/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ $(document).ready( function() {

var days = $( '#' + event.currentTarget.id ).attr( 'data-days' );
if( days >= 0 && days < 30 ) {
bootbox.confirm( "Are you sure you want to send a peering request to this member? You already sent one only " + days + " days ago.",
bootbox.confirm( "Are you sure you want to send a peering request to this member? You already sent one " + ( days == 0 ? "today" : ( days == 1 ? "yesterday" : days + " days ago" ) ) + ".",
function( result ) {
if( result ) {
return ixpOpenPeeringRequestDialog( custid );
Expand Down

0 comments on commit be4548a

Please sign in to comment.