Version 4.6.0

This commit is contained in:
Neo committed 2025-12-19 05:55:31 -08:00
1 parent f79dcf067a
commit 517a5e1f70
2036 files changed
+110041 -26162

No files matched your search

@@ -296,6 +296,18 @@ abstract class _Purchase extends \IPS\nexus\Invoice\Item
return TRUE;
}
/**
* Purchase can be reactivated in the ACP?
*
* @param \IPS\nexus\Purchase $purchase The purchase
* @param NULL $error Error to show, passed by reference
* @return bool
*/
public static function canAcpReactivate( \IPS\nexus\Purchase $purchase, &$error=NULL )
{
return TRUE;
}
/**
* Can Renew Until
*
@@ -475,4 +487,54 @@ abstract class _Purchase extends \IPS\nexus\Invoice\Item
{
return TRUE;
}
/**
* Is this item the same as another item in the cart?
* Used to decide when an item is added to the cart if we should just increase the quantity of this item instead of creating a new item.
*
* @param \IPS\nexus\Invoice\Item $item The other item
* @return bool
*/
public function isSameAsOtherItem( $item )
{
// You can't compare DateInterval objects, it just throws an exception, so we have to
// manually figure out if the renewal terms have any differences
if ( $item instanceof \IPS\nexus\Invoice\Item\Purchase )
{
if ( $item->renewalTerm xor $this->renewalTerm )
{
return FALSE;
}
elseif ( !$item->renewalTerm and !$this->renewalTerm )
{
return parent::isSameAsOtherItem( $item );
}
else
{
if ( $item->renewalTerm and $this->renewalTerm )
{
if ( $item->renewalTerm->getTerm() != $this->renewalTerm->getTerm() )
{
return FALSE;
}
if ( $item->renewalTerm->cost != $item->renewalTerm->cost )
{
return FALSE;
}
}
$clonedThis = clone $this;
$clonedThis->renewalTerm = NULL;
$clonedOther = clone $item;
$clonedOther->renewalTerm = NULL;
return $clonedThis->isSameAsOtherItem( $clonedOther );
}
}
else
{
return FALSE;
}
}
}