mark the voucher as Completely used.
962381
public function MarkVoucherAsCompletelyUsed()
    {
        $aData = $this->sqlData;
        $aData['date_used_up'] = date('Y-m-d H:i:s');
        $aData['is_used_up'] = '1';
        $this->LoadFromRow($aData);
        $bEditState = $this->bAllowEditByAll;
        $this->AllowEditByAll(true);
        $this->Save();
        $this->AllowEditByAll($bEditState);
    }
429120
public function onBeforeDelete()
    {
        // If an attendee is deleted from the guest list remove it's qr code
        // after deleting the code it's not validatable anymore, simply here for cleanup
        if ($this->TicketQRCode()->exists()) {
            $this->TicketQRCode()->delete();
        }

        // cleanup the ticket file
        if ($this->TicketFile()->exists()) {
            $this->TicketFile()->delete();
        }

        if ($this->Fields()->exists()) {
            $this->Fields()->removeAll();
        }

        parent::onBeforeDelete();
    }
941915
protected function _markVouchers($oBasket, $oUser)
    {
        $this->_aVoucherList = $oBasket->getVouchers();

        if (is_array($this->_aVoucherList)) {
            foreach ($this->_aVoucherList as $sVoucherId => $oSimpleVoucher) {
                $oVoucher = oxNew(\OxidEsales\Eshop\Application\Model\Voucher::class);
                $oVoucher->load($sVoucherId);
                $oVoucher->markAsUsed($this->oxorder__oxid->value, $oUser->oxuser__oxid->value, $oSimpleVoucher->dVoucherdiscount);

                $this->_aVoucherList[$sVoucherId] = $oVoucher;
            }
        }
    }
420248
def mark_as_required(self):
    """"""
    if self not in tf.get_collection(bookkeeper.GraphKeys.MARKED_LOSSES):
      tf.add_to_collection(bookkeeper.GraphKeys.MARKED_LOSSES, self)
1019912
protected function clearPriceCache()
    {
        $obItem = $this->obElement->item;
        if (empty($obItem)) {
            return;
        }

        if ($obItem instanceof Offer) {

            $sSorting = !empty($this->obElement->price_type) ? '|'.$this->obElement->price_type : '';

            OfferListStore::instance()->sorting->clear(OfferListStore::SORT_PRICE_ASC.$sSorting);
            OfferListStore::instance()->sorting->clear(OfferListStore::SORT_PRICE_DESC.$sSorting);

            if ($obItem->active) {
                ProductListStore::instance()->sorting->clear(ProductListStore::SORT_PRICE_ASC.$sSorting);
                ProductListStore::instance()->sorting->clear(ProductListStore::SORT_PRICE_DESC.$sSorting);
            }
        }
    }
372160
def clean(self, value):
        """"""
        if value:
            value = value.replace('-', '').replace(' ', '')
            self.card_type = verify_credit_card(value)
            if self.card_type is None:
                raise forms.ValidationError("Invalid credit card number.")
        return value
92439
def mark_seen(self):
        
        data = self.get_selected_item()
        if data['is_new']:
            with self.term.loader('Marking as read'):
                data['object'].mark_as_read()
            if not self.term.loader.exception:
                data['is_new'] = False
        else:
            with self.term.loader('Marking as unread'):
                data['object'].mark_as_unread()
            if not self.term.loader.exception:
                data['is_new'] = True
1168753
def clean(self):
        
        self._table.clear()
        for item in self._usage_recency:
            self._usage_recency.remove(item)
24765
def cleanup(self):
        ''' '''
        allList = []
        allList.extend(self.cur.execute("SELECT keywordid FROM keyword;"))
        usedList = []
        usedList.extend(self.cur.execute("SELECT keywordid FROM notekeyword;"))
        unusedList = [val for val in allList if val not in usedList]
        for key in unusedList:
            if self.debug:
                print("About to delete keyword with ID %s" % key)
            try:
                self.cur.execute("DELETE FROM keyword WHERE keywordId = ?;", key)
            except:
                self.error("There was a problem deleting keyword %s" % key)
        self.con.commit()
90712
def reset_all(self):
        """"""

        self._LOG.debug("Marking all CMs as Good.")

        for key in self.list:
            self.mark_good(key)
1227188
def creditusage(cls):
        """"""
        rating = cls.call('hosting.rating.list')
        if not rating:
            return 0

        rating = rating.pop()
        usage = [sum(resource.values())
                 for resource in rating.values()
                 if isinstance(resource, dict)]
        return sum(usage)
117047
def used(self, fieldname):
        """"""
        if fieldname in self.unused:
            self.unused.remove(fieldname)
788697
public function checkMarkVoucherAsCompletelyUsed()
    {
        $bMarkVoucherAsCompletelyUsed = false;
        $oVoucherSeries = &$this->GetFieldShopVoucherSeries();
        if ('absolut' == $oVoucherSeries->fieldValueType && !is_null($oVoucherSeries->GetFieldShopVoucherSeriesSponsor())) {
            $dValueUsed = $this->GetValuePreviouslyUsed();
            if ($dValueUsed >= $this->GetVoucherSeriesOriginalValue()) {
                $bMarkVoucherAsCompletelyUsed = true;
            }
        } elseif ('absolut' == $oVoucherSeries->fieldValueType && is_null($oVoucherSeries->GetFieldShopVoucherSeriesSponsor())) {
            $bMarkVoucherAsCompletelyUsed = true;
        } else {
            $bMarkVoucherAsCompletelyUsed = true;
        }

        return $bMarkVoucherAsCompletelyUsed;
    }
835664
private void maybeMarkCurrentKeyAsUsed(DeterministicKey key) {
        // It's OK for currentKeys to be empty here: it means we're a married wallet and the key may be a part of a
        // rotating chain.
        for (Map.Entry<KeyChain.KeyPurpose, DeterministicKey> entry : currentKeys.entrySet()) {
            if (entry.getValue() != null && entry.getValue().equals(key)) {
                log.info("Marking key as used: {}", key);
                currentKeys.put(entry.getKey(), freshKey(entry.getKey()));
                return;
            }
        }
    }
396138
public function CommitVoucherUseForCurrentUser($iShopOrderId)
    {
        $oShopVoucherUse = TdbShopVoucherUse::GetNewInstance();
        /** @var $oShopvoucherUse TdbShopVoucherUse */
        $aData = array('shop_voucher_id' => $this->id, 'date_used' => date('Y-m-d H:i:s'), 'value_used' => $this->GetValue(), 'shop_order_id' => $iShopOrderId);
        // hook to post-convert value (as may be required when dealing with currency)
        $this->CommitVoucherUseForCurrentUserPreSaveHook($aData);
        $oShopVoucherUse->LoadFromRow($aData);
        $oShopVoucherUse->AllowEditByAll(true);
        $oShopVoucherUse->Save();

        if ($this->checkMarkVoucherAsCompletelyUsed()) {
            $this->MarkVoucherAsCompletelyUsed();
        }
    }
708612
public function revoke_voucher($voucher_id)
    {
        if (!$this->is_loggedin) {
            return false;
        }

        $payload  = ['_id' => $voucher_id, 'cmd' => 'delete-voucher'];
        $response = $this->exec_curl('/api/s/' . $this->site . '/cmd/hotspot', $payload);

        return $this->process_response_boolean($response);
    }
774353
public function mark_as_used() {
	$mysql = bootstrap::get_library('mysql');
	
	$sql   = "UPDATE `login_tokens` SET `used` = 1, `last_used_at` = %d WHERE `id` = %d;";
	$binds = [time(), $this->data['id']];
	$mysql::query($sql, $binds);
}