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

@@ -361,6 +361,33 @@ abstract class _Item
return NULL;
}
/**
* 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 )
{
/* If one is set to be associated with something in the cart and the other is set to be associated
with an existing purchase, trying to compare those will throw an error */
if ( $item->parent or $this->parent )
{
if ( \gettype( $this->parent ) != \gettype( $item->parent ) )
{
return FALSE;
}
}
/* Assume the quantities are the same */
$cloned = clone $item;
$cloned->quantity = $this->quantity;
/* Compare */
return ( $cloned == $this );
}
/**
* Get output for API
*