first commit
This commit is contained in:
70
plugins/stTaxPlugin/lib/model/TaxPeer.php
Normal file
70
plugins/stTaxPlugin/lib/model/TaxPeer.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Subclass for performing query and update operations on the 'st_tax' table.
|
||||
*
|
||||
*
|
||||
*
|
||||
* @package plugins.stTaxPlugin.lib.model
|
||||
*/
|
||||
class TaxPeer extends BaseTaxPeer
|
||||
{
|
||||
/**
|
||||
* Zwraca domyślną stawkę VAT
|
||||
*
|
||||
* @param Criteria $c
|
||||
* @param Connection $con
|
||||
* @return Tax
|
||||
*/
|
||||
public static function doSelectDefaultOne(Criteria $c, $con = null)
|
||||
{
|
||||
$c = clone $c;
|
||||
|
||||
$c->add(self::IS_DEFAULT, true);
|
||||
|
||||
$tax = self::doSelectOne($c);
|
||||
|
||||
return $tax ? $tax : self::doSelectOne(new Criteria());
|
||||
}
|
||||
|
||||
/**
|
||||
* Zwraca stawkę VAT po jej wartości
|
||||
*
|
||||
* @param string $value Wartość stawki VAT
|
||||
* @return Tax
|
||||
*/
|
||||
public static function retrieveByTax($value)
|
||||
{
|
||||
return stTax::getByValue($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Zwraca listę aktywnych stawek VAT
|
||||
*
|
||||
* @return Tax[]
|
||||
*/
|
||||
public static function doSelectActive()
|
||||
{
|
||||
$c = new Criteria();
|
||||
$c->add(self::IS_ACTIVE, true);
|
||||
|
||||
$rs = self::doSelectRS($c);
|
||||
|
||||
$results = array();
|
||||
|
||||
while ($rs->next())
|
||||
{
|
||||
$tax = new Tax();
|
||||
$tax->hydrate($rs);
|
||||
$results[$tax->getId()] = $tax;
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
public static function clearCache()
|
||||
{
|
||||
$cache = new stFunctionCache('stTax');
|
||||
$cache->removeAll();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user