Save additional price list
768990
protected function savePriceListValue()
    {
        if (empty($this->arSavedPriceList)) {
            return;
        }

        foreach ($this->arSavedPriceList as $iPriceTypeID => $arPriceData) {
            if (empty($iPriceTypeID)) {
                continue;
            }

            $this->savePriceValue($iPriceTypeID, array_get($arPriceData, 'price'), array_get($arPriceData, 'old_price'));
        }
    }
1137170
def save(self, dolist=0):
        
        quoted = not dolist
        fields = 7*[""]
        fields[0] = self.name
        fields[1] = self.type
        fields[2] = self.mode
        fields[3] = self.toString(self.value,quoted=quoted)
        if self.choice is not None:
            schoice = list(map(self.toString, self.choice))
            schoice.insert(0,'')
            schoice.append('')
            fields[4] = repr('|'.join(schoice))
        elif self.min not in [None,INDEF]:
            fields[4] = self.toString(self.min,quoted=quoted)
        if self.max not in [None,INDEF]:
            fields[5] = self.toString(self.max,quoted=quoted)
        if self.prompt:
            if quoted:
                sprompt = repr(self.prompt)
            else:
                sprompt = self.prompt
            # prompt can have embedded newlines (which are printed)
            sprompt = sprompt.replace(r'\012', '\n')
            sprompt = sprompt.replace(r'\n', '\n')
            fields[6] = sprompt
        # delete trailing null parameters
        for i in [6,5,4]:
            if fields[i] != "": break
            del fields[i]
        if dolist:
            return fields
        else:
            return ','.join(fields)
30145
protected function UpdateWishlist()
    {
        $aInput = $this->global->GetUserData(TdbPkgShopWishlist::URL_PARAMETER_FILTER_DATA);
        $sWishListDescription = '';
        if (array_key_exists('description', $aInput)) {
            $sWishListDescription = $aInput['description'];
        }
        $oMsgManager = TCMSMessageManager::GetInstance();

        $oUser = TdbDataExtranetUser::GetInstance();
        if ($oUser->IsLoggedIn()) {
            $oWishlist = &$oUser->GetWishlist(true);
            $aTmp = $oWishlist->sqlData;
            $aTmp['description'] = $sWishListDescription;
            if (array_key_exists('is_public', $aInput)) {
                $aTmp['is_public'] = $aInput['is_public'];
            }

            $oWishlist->LoadFromRow($aTmp);
            $oWishlist->Save();

            $aItems = array();
            if (array_key_exists('aItem', $aInput) && is_array($aInput['aItem'])) {
                $aItems = $aInput['aItem'];
                foreach ($aItems as $sWishlistItemId => $aItemData) {
                    $oWishlistItem = TdbPkgShopWishlistArticle::GetNewInstance();
                    /** @var $oWishlistItem TdbPkgShopWishlistArticle */
                    if ($oWishlistItem->LoadFromFields(array('pkg_shop_wishlist_id' => $oWishlist->id, 'id' => $sWishlistItemId))) {
                        $atmpData = $oWishlistItem->sqlData;
                        if (array_key_exists('comment', $aItemData)) {
                            $atmpData['comment'] = $aItemData['comment'];
                        }
                        if (array_key_exists('amount', $aItemData)) {
                            $atmpData['amount'] = $aItemData['amount'];
                        }
                        $oWishlistItem->LoadFromRow($atmpData);
                        $oWishlistItem->AllowEditByAll(true);
                        $oWishlistItem->Save();
                    }
                }
            }

            $oMsgManager->AddMessage($oWishlist->GetMsgConsumerName(), 'WISHLIST-UPDATED-INFOS');
        }
    }
196911
def buildDPList(self):
        """"""
        updated = False
        dps = []
        itemlist = self.getItemDPList()
        # first remove all items marked for removal, in case their names clash with new or renamed items
        for item, dp in itemlist:
            item._policy = item._combobox_current_value[self.ColAction]
            if dp and item._policy == "remove":
                dp.remove_file()
                dp.remove_subproducts()
        # now, make list
        for item, dp in itemlist:
            if item._policy == "remove":
                continue
            # update renderer and comment
            render = item._combobox_current_value[self.ColRender]
            comment = str(item.text(self.ColComment))
            if render != dp.render:
                dp.render = render
                updated = True
            if comment != dp.comment:
                dp.comment = comment
                updated = True
            # archived DPs may need to be renamed, for new ones simply set the name
            if dp.archived:
                updated = updated or dp.rename(str(item.text(self.ColRename)))
            else:
                dp.set_policy(item._policy)
                dp.filename = str(item.text(self.ColRename))
            dps.append(dp)
        return dps, updated
685330
def append(self, val):
        """"""
        val.scraper = self.scraper
        val._collection_path = copy(self.collection._collection_path)
        val._collection_path.append(val)
        super(ItemList, self).append(val)
696084
def QA_SU_save_deal(dealist, client=DATABASE):
    

    if isinstance(dealist, pd.DataFrame):

        collection = client.deal

        collection.create_index(
            [('account_cookie',
              ASCENDING),
             ('trade_id',
              ASCENDING)],
            unique=True
        )
        try:
            dealist = QA_util_to_json_from_pandas(dealist.reset_index())
            collection.insert_many(dealist, ordered=False)
        except Exception as e:

            pass
1272776
protected function UpdateListData()
    {
        $this->dNumberOfItems = 0;
        $this->dProductPrice = 0;

        $this->dTotalWeight = 0;
        $this->dTotalVolume = 0;
        $tmpPointer = $this->getItemPointer();
        $this->GoToStart();
        while ($oItem = &$this->Next()) {
            if ($oItem->dAmount <= 0) {
                $this->RemoveArticle($oItem);
            } else {
                $this->dNumberOfItems += $oItem->dAmount;
                $this->dProductPrice += $oItem->dPriceTotal;

                $this->dTotalWeight += $oItem->dTotalWeight;
                $this->dTotalVolume += $oItem->dTotalVolume;
            }
        }
        $this->setItemPointer($tmpPointer);
    }
340261
function _savePps(&$raList) 
    {
        // Save each PPS WK
        for ($i = 0; $i < count($raList); $i++) {
            fwrite($this->_FILEH_, $raList[$i]->_getPpsWk());
        }
        // Adjust for Block
        $iCnt = count($raList);
        $iBCnt = $this->_BIG_BLOCK_SIZE / OLE_PPS_SIZE;
        if ($iCnt % $iBCnt) {
            for ($i = 0; $i < (($iBCnt - ($iCnt % $iBCnt)) * OLE_PPS_SIZE); $i++) {
                fwrite($this->_FILEH_, "\x00");
            }
        }
    }
464396
def append(self, acces, **kwargs):
        
        if acces.Id in set(ac.Id for ac in self):
            raise ValueError("Acces id already in list !")
        list.append(self, acces)
        if kwargs:
            self.infos[acces.Id] = kwargs
56374
public function update(PriceListRequest $request, PriceList $price_list)
    {
        try {
            $attributes = $request->all();

            $price_list->update($attributes);
            return $this->response->message(trans('messages.success.updated', ['Module' => trans('pricelist::price_list.name')]))
                ->code(204)
                ->status('success')
                ->url(guard_url('pricelist/price_list/' . $price_list->getRouteKey()))
                ->redirect();
        } catch (Exception $e) {
            return $this->response->message($e->getMessage())
                ->code(400)
                ->status('error')
                ->url(guard_url('pricelist/price_list/' . $price_list->getRouteKey()))
                ->redirect();
        }

    }
556443
def add_list_data(data)
      raise symbol.to_s if data.nil?
      self.exchange_rate = data['price_usd'].to_f
      self.perchant_change_week = data['percent_change_7d'].to_f
      self.perchant_change_day = data['percent_change_24h'].to_f
    end
380434
public function saveRecommList()
    {
        if (!\OxidEsales\Eshop\Core\Registry::getSession()->checkSessionChallenge()) {
            return;
        }

        if (!$this->getViewConfig()->getShowListmania()) {
            return;
        }

        if (($oUser = $this->getUser())) {
            if (!($oRecommList = $this->getActiveRecommList())) {
                $oRecommList = oxNew(\OxidEsales\Eshop\Application\Model\RecommendationList::class);
                $oRecommList->oxrecommlists__oxuserid = new \OxidEsales\Eshop\Core\Field($oUser->getId());
                $oRecommList->oxrecommlists__oxshopid = new \OxidEsales\Eshop\Core\Field(\OxidEsales\Eshop\Core\Registry::getConfig()->getShopId());
            } else {
                $this->_sThisTemplate = 'page/account/recommendationedit.tpl';
            }

            $sTitle = trim(( string ) \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('recomm_title', true));
            $sAuthor = trim(( string ) \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('recomm_author', true));
            $sText = trim(( string ) \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('recomm_desc', true));

            $oRecommList->oxrecommlists__oxtitle = new \OxidEsales\Eshop\Core\Field($sTitle);
            $oRecommList->oxrecommlists__oxauthor = new \OxidEsales\Eshop\Core\Field($sAuthor);
            $oRecommList->oxrecommlists__oxdesc = new \OxidEsales\Eshop\Core\Field($sText);

            try {
                // marking entry as saved
                $this->_blSavedEntry = (bool) $oRecommList->save();
                $this->setActiveRecommList($this->_blSavedEntry ? $oRecommList : false);
            } catch (\OxidEsales\Eshop\Core\Exception\ObjectException $oEx) {
                //add to display at specific position
                \OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($oEx, false, true, 'user');
            }
        }
    }
199528
protected function buildAmountPriceList()
    {
        if ($this->getAmountPriceList() === null) {
            /** @var \OxidEsales\Eshop\Application\Model\AmountPriceList $oAmPriceList */
            $oAmPriceList = oxNew(\OxidEsales\Eshop\Application\Model\AmountPriceList::class);
            $this->setAmountPriceList($oAmPriceList);

            if (!$this->skipDiscounts()) {
                //collecting assigned to article amount-price list
                $oAmPriceList->load($this);

                // prepare abs prices if currently having percentages
                $oBasePrice = $this->_getGroupPrice();
                foreach ($oAmPriceList as $oAmPrice) {
                    if ($oAmPrice->oxprice2article__oxaddperc->value) {
                        $oAmPrice->oxprice2article__oxaddabs = new \OxidEsales\Eshop\Core\Field(
                            \OxidEsales\Eshop\Core\Price::percent($oBasePrice, 100 - $oAmPrice->oxprice2article__oxaddperc->value),
                            \OxidEsales\Eshop\Core\Field::T_RAW
                        );
                    }
                }
            }

            $this->setAmountPriceList($oAmPriceList);
        }

        return $this->_oAmountPriceList;
    }
419143
function addValueToList(list, value) {
    for (var i = list.length - 1; i >= 0; i--) {
        if (list[i] == value) {
            return false;
        }
    }
    list.push(value);
    return true;
}
15068
def list(self):
        
        mylist = []
        for prod in self.product_list:
            if self.purchasable(prod) and not self.entitled(prod):
                mylist.append(prod)
        return mylist
1347103
protected function setPriceListAttribute($arPriceList)
    {
        if (empty($arPriceList) || !is_array($arPriceList)) {
            return;
        }

        if (isset($arPriceList[0])) {
            $this->fSavedPrice = array_get($arPriceList[0], 'price');
            $this->fSavedOldPrice = array_get($arPriceList[0], 'old_price');
            unset($arPriceList[0]);
        }

        $this->arSavedPriceList = $arPriceList;
    }
926520
protected function UpdateItemInfo()
    {
        $this->dPriceTotal = $this->dAmount * $this->dPrice;
        $this->dTotalWeight = $this->dAmount * $this->fieldSizeWeight;
        $this->dTotalVolume = $this->dAmount * $this->dVolume;
        $this->dPriceAfterDiscount = $this->dPrice;
        $this->dPriceTotalAfterDiscount = $this->dPriceTotal;
        $this->dPriceTotalAfterDiscountWithoutVouchers = $this->dPriceTotalAfterDiscount;
    }