Source for file PRO_PRODUCT.phpclass
Documentation is available at PRO_PRODUCT.phpclass
* openCSP class file PRO_PRODUCT.phpclass
* @project Open CSP-Management
* @author Peter Krebs <pitlinz@users.sourceforge.net>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id: PRO_PRODUCT.phpclass,v 1.5 2008/08/16 09:21:08 pitlinz Exp $
// ---------------------------------------------------------
// ---------------------------------------------------------
* openCSP class PRO_PRODUCT
* @project Open CSP-Management
* @author Peter Krebs <pitlinz@users.sourceforge.net>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id: PRO_PRODUCT.phpclass,v 1.5 2008/08/16 09:21:08 pitlinz Exp $
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
* @constant string CLASS_SRC_FILE
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
/*** class vars ------------------------------------------------------ */
protected static $loadedProducts =
array();
/*** class methods --------------------------------------------------- */
* returns an instance of a product stored in self::$loadedProducts
if ($debug) echoDebugMethod(__FILE__
,"static","PRO_PRODUCT::getInstance({$aId})");
if (!isset
(self::$loadedProducts[intval($aId)]))
self::$loadedProducts[intval($aId)] =
self::factoryFromId($aId,$debug);
return self::$loadedProducts[intval($aId)];
public static function setInstance(&$aProduct,$debug=
False)
if ($debug) echoDebugMethod(__FILE__
,"static","PRO_PRODUCT::setInstance()");
self::$loadedProducts[$aProduct->getId()] =
$aProduct;
* returns if the product has been instanced
* @param unknown_type $aId
return isset
(self::$loadedProducts[intval($aId)]);
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
/*** compostion --------------------------------------------------- */
/*** attributes -------------------------------------------------- */
* populate timestamp of the parts
* @var double $partsPopulateTS
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
* factories a new product
if ($debug) echoDebugMethod(__FILE__
,"static","PRO_PRODUCT::factoryFromId({$aId})");
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
public function setId($aId)
* returns the sort order number
* sets the sort order number
* returns $this->getDBField(PRO_PRICE) or the lowest price of the parts
foreach($arr_parts as &$obj_part)
if ($obj_part->isOnline())
if (($obj_part->getPrice() <
$flo_price) ||
($flo_price ==
0.0))
$flo_price =
$obj_part->getPrice();
// -------------------------------------------------------
// -------------------------------------------------------
* returns the product group id
* retruns the product group
// -------------------------------------------------------
// db save methods (insert / replace (update) / delete)
// -------------------------------------------------------
public function dbSave($debug=
False)
if ($int_ret =
parent::dbSave($debug))
if ($arr_rootpath =
$this->getProGroup()->getRootPath())
$arr_prodgroupRow =
array(
'PRO_ID' =>
$this->getId(),
'PRO_INGROUPFROM' =>
$this->getDBField('PRO_SHOWFROM'),
'PRO_INGROUPTILL' =>
$this->getDBField('PRO_SHOWTILL'),
foreach($arr_rootpath as $int_pgpId)
$arr_prodgroupRow['PGP_ID'] =
intval($int_pgpId);
* deletes the row from the database
* @param boolean $backupData
* @global array $OCSP_CONF
function dbDelete($backupData=
False,$debug=
False)
return parent::debDelete($backupData,$debug);
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
* returns the template values for a list
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
$sthis->myParts =
array();
foreach($arr_parts as $arr_row)
* returns an array with all parts of a product
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
* returns if a product is online or not
* @param boolean $checkParts (check if we have an online part)
public function isOnline($checkParts=
True,$debug=
False)
if ($debug) echoDebugMethod(__FILE__
,get_class($this),"PRO_PRODUCT::isOnline(" .
($checkParts ?
"CHECKPARTS" :
"") .
")");
$obj_date->setDbString($this->getDBField('PRO_SHOWFROM'));
if ($obj_date->isInFutur())
if ($debug) echoDebugLine(__FILE__
,__LINE__
,"product will come in future");
$obj_date->setDbString($this->getDBField('PRO_SHOWTILL'));
if ($obj_date->isInPast())
if ($debug) echoDebugLine(__FILE__
,__LINE__
,"product is out of date");
foreach($arr_parts as $obj_part)
if ($obj_part->isOnline()) return True;
* returns if the product is in a campain
foreach($arr_parts as &$obj_part)
if ($obj_part->isCampained())
Documentation generated on Thu, 08 Jan 2009 17:48:20 +0100 by phpDocumentor 1.4.0a2