<?php
/**
* @version	$Id: addresses_item.php 14258 2011-03-16 21:43:52Z alex $
* @package	In-Commerce
* @copyright	Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license	Commercial License
* This software is protected by copyright law and international treaties.
* Unauthorized reproduction or unlicensed usage of the code of this program,
* or any portion of it may result in severe civil and criminal penalties,
* and will be prosecuted to the maximum extent possible under the law
* See http://www.in-portal.org/commercial-license for copyright notices and details.
*/
	defined('FULL_PATH') or die('restricted access!');

	class AddressesItem extends kDBItem
	{
		function MarkAddress($address_type, $update_record = true)
		{
			$user_id = $this->Application->RecallVar('user_id');
			$sql = 'UPDATE '.$this->TableName.'
					SET LastUsedAs'.$address_type.' = 0
					WHERE PortalUserId = '.$user_id;
			$this->Conn->Query($sql);
			$this->SetDBField('LastUsedAs'.$address_type, 1);

			return $update_record ? $this->Update() : true;
		}

	}