<?php

class wpConfig {
    const DEFAULT_ID = 1;

    /**
     * wpConfig::getInstance()
     *
     * @return KataoConfig
     */
    static public function getInstance($force_database_retrieval = false) {
        $wp_config = sfContext::getInstance()->getUser()->getAttribute('wp_config', false);
        if (!$wp_config || $force_database_retrieval) {
            $wp_config = KataoConfigPeer::retrieveByPK(self::DEFAULT_ID);
            if (null == $wp_config) {
                $wp_config = new KataoConfig();
            }
            self::setInstance($wp_config);
        }
        return $wp_config;
    }

    static public function setInstance($config) {
        $config->save();
        sfContext::getInstance()->getUser()->setAttribute('wp_config', $config);
    }

    static public function refresh() {
        self::setInstance($this);
    }

    static public function getKataoMemberId() {
        return self::getInstance()->getKataoMemberId();
    }
    static public function setKataoMemberId($value) {
        $this->setKataoMemberId($value);
    }

    static public function getName() {
        return self::getInstance()->getName();
    }
    static public function setName($value) {
        $this->setName($value);
    }

    static public function getAddress() {
        return self::getInstance()->getAddress();
    }
    static public function setAddress($value) {
        $this->setAddress($value);
    }

    static public function getPhone() {
        return self::getInstance()->getPhone();
    }
    static public function setPhone($value) {
        $this->setPhone($value);
    }

    static public function getEmail() {
        return self::getInstance()->getEmail();
    }
    static public function setEmail($value) {
        $this->setEmail($value);
    }

    static public function getSiretNumber() {
        return self::getInstance()->getSiretNumber();
    }
    static public function setSiretNumber($value) {
        $this->setSiretNumber($value);
    }

    static public function getTVANumber() {
        return self::getInstance()->getTvaNumber();
    }
    static public function setTVANumber($value) {
        $this->setTvaNumber($value);
    }

    static public function getRCSNumber() {
        return self::getInstance()->getRcsNumber();
    }
    static public function setRCSNumber($value) {
        $this->setRcsNumber($value);
    }

    static public function getCapital() {
        return self::getInstance()->getCapital();
    }
    static public function setCapital($value) {
        $this->setCapital($value);
    }

    static public function getInitialTransactionsCount() {
        return self::getInstance()->getInitialTransactionsCount();
    }
    static public function setInitialTransactionsCount($value) {
        $this->setInitialTransactionsCount($value);
    }

    static public function getInitialTransactionsSum() {
        return self::getInstance()->getInitialTransactionsSum();
    }
    static public function setInitialTransactionsSum($value) {
        $this->setInitialTransactionsSum($value);
    }

    static public function getMailingListEmail() {
        return self::getInstance()->getMailingListEmail();
    }
    static public function setMailingListEmail($value) {
        $this->setMailingListEmail($value);
    }

    static public function getCartValidationDaysNumber() {
        return self::getInstance()->getMailingListEmail();
    }
    static public function setCartValidationDaysNumber($value) {
        $this->setCartValidationDaysNumber($value);
    }

    static public function getAccountingCodePrefixPurchase() {
        return self::getInstance()->getAccountingCodePrefixPurchase();
    }
    static public function setAccountingCodePrefixPurchase($value) {
        $this->setAccountingCodePrefixPurchase($value);
    }

    static public function getAccountingCodePrefixSell() {
        return self::getInstance()->getAccountingCodePrefixSell();
    }
    static public function setAccountingCodePrefixSell($value) {
        $this->setAccountingCodePrefixSell($value);
    }

    static public function getAccountingCodeBank() {
        return self::getInstance()->getAccountingCodeBank();
    }
    static public function setAccountingCodeBank($value) {
        $this->setAccountingCodeBank($value);
    }

    static public function getAccountingCodeBankSol() {
        return self::getInstance()->getAccountingCodeBankSol();
    }
    static public function setAccountingCodeBankSol($value) {
        $this->setAccountingCodeBankSol($value);
    }

	static public function getAccountingCodeCredit() {
		return self::getInstance()->getAccountingCodeCredit();
	}
	static public function setAccountingCodeCredit($value) {
		$this->setAccountingCodeCredit($value);
	}

    static public function getAccountingCodeErrorAdjustmentPositive() {
        return self::getInstance()->getAccountingCodeErrorAdjustmentPositive();
    }
    static public function setAccountingCodeErrorAdjustmentPositive($value) {
        $this->setAccountingCodeErrorAdjustmentPositive($value);
    }

    static public function getAccountingCodeErrorAdjustmentNegative() {
        return self::getInstance()->getAccountingCodeErrorAdjustmentNegative();
    }
    static public function setAccountingCodeErrorAdjustmentNegative($value) {
        $this->setAccountingCodeErrorAdjustmentNegative($value);
    }

    static public function getAccountingCodeSolDiscount() {
        return self::getInstance()->getAccountingCodeSolDiscount();
    }
    static public function setAccountingCodeSolDiscount($value) {
        $this->setAccountingCodeSolDiscount($value);
    }

    static public function getAccountingCodeFeesShipping() {
        return self::getInstance()->getAccountingCodeFeesShipping();
    }
    static public function setAccountingCodeFeesShipping($value) {
        $this->setAccountingCodeFeesShipping($value);
    }

    static public function getAccountingCodeFeesBilling() {
        return self::getInstance()->getAccountingCodeFeesBilling();
    }
    static public function setAccountingCodeFeesBilling($value) {
        $this->setAccountingCodeFeesBilling($value);
    }

    static public function getAccountingCodeDiscount() {
        return self::getInstance()->getAccountingCodeDiscount();
    }
    static public function setAccountingCodeDiscount($value) {
        $this->setAccountingCodeDiscount($value);
    }

    static public function getDefaultProductPicture() {
        return self::getInstance()->getDefaultProductPicture();
    }
    static public function setDefaultProductPicture($value) {
        $this->setDefaultProductPicture($value);
    }
    static public function hasDefaultProductPicture() {
        return '' != self::getInstance()->getDefaultProductPicture() && is_file(sfConfig::get('sf_web_dir') . self::getInstance()->getDefaultProductPicture());
    }

    static public function getDefaultProductMargin() {
        return self::getInstance()->getDefaultProductMargin();
    }
    static public function setDefaultProductMargin($value) {
        $this->setDefaultProductMargin($value);
    }

    static public function getDefaultProductSolPercent() {
        return self::getInstance()->getDefaultProductSolPercent();
    }
    static public function setDefaultProductSolPercent($value) {
        $this->setDefaultProductSolPercent($value);
    }

    static public function getMemberFee() {
        return self::getInstance()->getMemberFee();
    }
    static public function setMemberFee($value) {
        $this->setMemberFee($value);
    }
    static public function getMemberFeeStr() {
        return Utils::formatCurrencyEuro(self::getInstance()->getMemberFee());
    }

    static public function getAdditionalCurrencyName() {
        return self::getInstance()->getAdditionalCurrencyName();
    }
    static public function setAdditionalCurrencyName($value) {
        $this->setAdditionalCurrencyName($value);
    }

    static public function getDebugEmail() {
        return self::getInstance()->getDebugEmail();
    }
    static public function setDebugEmail($value) {
        $this->setDebugEmail($value);
    }

    static public function getBankName() {
        return self::getInstance()->getBankName();
    }
    static public function setBankName($value) {
        $this->setBankName($value);
    }

    static public function getBankAccount() {
        return self::getInstance()->getBankAccount();
    }
    static public function setBankAccount($value) {
        $this->setBankAccount($value);
    }
}