/** * Create new period record and related calculation record. * * @param $calcTypeId * @param $dsBegin * @param $dsEnd * * @return DataObject */ public function addNewPeriodAndCalc($calcTypeId, $dsBegin, $dsEnd) { $result = new DataObject(); /* add new period */ $periodData = [Period::ATTR_CALC_TYPE_ID => $calcTypeId, Period::ATTR_DSTAMP_BEGIN => $dsBegin, Period::ATTR_DSTAMP_END => $dsEnd]; $periodId = $this->_repoBasic->addEntity(Period::ENTITY_NAME, $periodData); $this->_logger->info("New period #{$periodId} for calculation type #{$calcTypeId} is registered ({$dsBegin}-{$dsEnd})."); $periodData[Period::ATTR_ID] = $periodId; $result->setData(self::DATA_PERIOD, $periodData); /* add related calculation */ $dateStarted = $this->_toolDate->getUtcNowForDb(); $calcData = [Calculation::ATTR_PERIOD_ID => $periodId, Calculation::ATTR_DATE_STARTED => $dateStarted, Calculation::ATTR_DATE_ENDED => null, Calculation::ATTR_STATE => Cfg::CALC_STATE_STARTED]; $calcId = $this->_repoBasic->addEntity(Calculation::ENTITY_NAME, $calcData); $this->_logger->info("New calculation #{$calcId} for period #{$periodId} is registered."); $calcData[Calculation::ATTR_ID] = $calcId; $result->setData(self::DATA_CALC, $calcData); return $result; }
/** * Set quantity of the product on the warehouse. * * @param double $data */ public function setQuantity($data) { parent::setQuantity($data); }
/** * @inheritdoc */ public function getUserPassword() { $result = parent::getUserPassword(); return $result; }
public function setOdooId($data) { parent::setData(static::AS_ODOO_ID, $data); }
public function test_replace() { /** === Test Data === */ $DATA = new DataObject(['field' => 'value']); $UPDATED = 'rows updated'; /** === Setup Mocks === */ // $result = $this->_repoGeneric->replaceEntity($this->_entityName, $data); $this->mRepoGeneric->shouldReceive('replaceEntity')->once()->with($this->ENTITY_NAME, $DATA->getData())->andReturn($UPDATED); /** === Call and asserts === */ $res = $this->obj->replace($DATA); $this->assertEquals($UPDATED, $res); }
public function getResultData() { $result = parent::getData(self::PATH_RESULT_DATA); return $result; }
public function setValue($data) { parent::setData(self::AS_VALUE, $data); }
public function setType($data) { parent::setData(self::AS_TYPE, $data); }
public function test_compressPtc_isPeriod() { /** === Test Data === */ $CALC_ID = 21; /** === Mocks === */ $mLogger = $this->_mockLogger(); $mConn = $this->_mockConnection(); $mDba = $this->_mockDbAdapter(null, $mConn); $mToolDate = $this->_mockFor('Praxigento\\Core\\Tool\\IDate'); $mToolPeriod = $this->_mockFor('Praxigento\\Core\\Tool\\IPeriod'); $mToolbox = $this->_mockToolbox(null, $mToolDate, null, $mToolPeriod); $mCallRepo = $this->_mockCallRepo(); $mCallAccount = $this->_mockFor('Praxigento\\Accounting\\Service\\IAccount'); $mCallBonusPersonalPeriod = $this->_mockFor('Praxigento\\Bonus\\Hybrid\\Lib\\Service\\IPeriod'); $mSubDb = $this->_mockFor('Praxigento\\Bonus\\Hybrid\\Lib\\Service\\Calc\\Sub\\Db'); $mSubCalc = $this->_mockFor('Praxigento\\Bonus\\Hybrid\\Lib\\Service\\Calc\\Sub\\Calc'); // $respGetPeriod = $this->_callPeriod->getForDependentCalc($reqGetPeriod); $mRespGetPeriod = new BonusPersonalPeriodGetForDependentCalcResponse(); $mCallBonusPersonalPeriod->expects($this->once())->method('getForDependentCalc')->willReturn($mRespGetPeriod); // if($respGetPeriod->isSucceed()) $mRespGetPeriod->markSucceed(); // $calcData = $respGetPeriod->getCalcData(); $mRespGetPeriod->setCalcData([Calculation::ATTR_ID => $CALC_ID]); // $this->_conn->beginTransaction(); $mConn->expects($this->once())->method('beginTransaction'); // $updates = $this->_subCalc->compressPtc($downlineSnap, $transData, $compressLevel); $mUpdates = new DataObject(); $mUpdates->setData(Sub\Calc::DATA_SNAP, []); $mUpdates->setData(Sub\Calc::DATA_PV, []); $mSubCalc->expects($this->once())->method('compressPtc')->willReturn($mUpdates); // $this->_conn->commit(); $mConn->expects($this->once())->method('commit'); /** * Prepare request and perform call. */ /** @var $call Call */ $call = new Call($mLogger, $mDba, $mToolbox, $mCallRepo, $mCallAccount, $mCallBonusPersonalPeriod, $mSubDb, $mSubCalc); $req = new Request\CompressPtc(); $resp = $call->compressPtc($req); $this->assertTrue($resp->isSucceed()); }
public function setId($data) { parent::setData(self::AS_ID, $data); }
public function setWebsiteId($data) { parent::setData(self::AS_WEBSITE_ID, $data); }
/** * Set array of the warehouses related to products in the bundle. * * @param \Praxigento\Odoo\Data\Odoo\Inventory\Warehouse[] $data */ public function setWarehouses($data = null) { parent::setWarehouses($data); }
public function setPvUnit($data) { parent::setData(static::AS_PV_UNIT, $data); }
/** * Set PV for the product on the concrete warehouse. * * @param double $data */ public function setPvWarehouse($data) { parent::setPvWarehouse($data); }
/** * Set currency for wholesale prices ('EUR'). * * @param string $data */ public function setCurrency($data) { parent::setCurrency($data); }
/** * Set code number used by humans. * * @param string $data */ public function setNumber($data) { parent::setNumber($data); }
/** * Set weight for the product. * * @param float $data */ public function setWeight($data) { parent::setWeight($data); }
/** * Set Odoo ID of the warehouse. * * @param int $data */ public function setIdOdoo($data) { parent::setIdOdoo($data); }