oxCounter implementation

After a deep analysis of the bugs #3253 and #2693 we created an oxCounter class which now is responsible for correct record number calculation.

What’s new and what has been changed:

  • oxOrder::_insert() now does not call oxOrder::_setRecordNumber() (which is deprecated since version 4.6.x), instead calls oxOrder::_setNumber() if order number is not set; in case the order has a defined number, the counter is updated by calling oxCounter::update();
  • oxOrder::_setNumber() calls oxCounter::getNext() which returns next possible number for item;

oxCounter class overview:

  • oxCounter::getNext( $sIdent ) – returns the next possible number for the given ident;
  • oxCounter::update( $sIdent, $iCount ) – updates the current counter;
  • the parameter $sIdent – is the name of the counters.  For example when saving an order depending on shop configuration order numbers should be unique per shop (1) or unique globally (2), thus in case (1) $sIdent  looks “oxOrder_” + shopId or, in case (2), “oxOrder”;  the counter name might depend on the table which has special counter rules name (oxOrder, oxUser and etc).

 

0.00 avg. rating (0% score) - 0 votes