*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
// Call parent constructor
parent::__construct(__CLASS__);
- // Set description
- $this->setObjectDescription("Bauvertrag");
-
- // Unique-ID generieren
- $this->generateUniqueId();
-
// Clean up a little
$this->removeSystemArray();
+ $this->removeNumberFormaters();
}
// Neuen Bauvertrag generieren
// Get new instance
$contractInstance = new WorksContract();
- // Debug-Meldung ausgeben
- if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $contractInstance->getDebugInstance()->output(sprintf("[%s:%d] Neuer Bauvertrag wird für das Schiff <strong>%s</strong> mit der <strong>%s</strong> <strong>%s</strong> erstellt.",
- __CLASS__,
- __LINE__,
- $shipName,
- $partnerInstance->getObjectDescription(),
- $partnerInstance->getCompanyName()
- ));
-
// Schiffsnamen setzen
$contractInstance->setShipName($shipName);
$parentPart = (string) $parentPart;
// Debug message
- if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiffsteil <strong>%s</strong> wird zusammen mit dem Konstruktionsteil <strong>%s</strong> in den Bauvertrag aufgenommen.",
+ if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiffsteil <strong>%s</strong> wird zusammen mit dem Konstruktionsteil <strong>%s</strong> in den Bauvertrag aufgenommen.",
__CLASS__,
__LINE__,
$shipPart,
try {
$partInstance = ObjectFactory::createObjectByName($shipPart, $dataArray);
} catch (DimNotFoundInArrayException $e) {
- $this->getDebugInstance()->output(sprintf("[main:] Die <strong>%s</strong> konnte nicht vervollständigt werden. Grund: <strong>%s</strong><br />",
+ $this->debugOutput(sprintf("[main:] Die <strong>%s</strong> konnte nicht vervollständigt werden. Grund: <strong>%s</strong><br />",
$this->getShipInstance()->getShipName(),
$e->getMessage()
));
// Debug message
- if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Versuche ein Schiffsteil in den Bauvertrag aufzunehmen.",
+ if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Versuche ein Schiffsteil in den Bauvertrag aufzunehmen.",
__CLASS__,
__LINE__
));
// Get price for this item
$price = $this->getMerchantInstance()->getPriceFromList($partInstance);
- // Final debug message
- if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] <strong>%s</strong> kostet <strong>%s</strong>.",
- __CLASS__,
- __LINE__,
- $partInstance->getObjectDescription(),
- $this->getMerchantInstance()->formatCurrency($price)
- ));
-
// Add price
$partInstance->setPrice($price);
-
- // Final debug message
- if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] <strong>%s</strong> wurde in den Bauvertrag aufgenommen.",
- __CLASS__,
- __LINE__,
- $partInstance->getObjectDescription()
- ));
}
// Setter for contract partner
if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) {
if ($partnerInstance->equals($partyInstance)) {
// With itself
- $this->getDebugInstance()->output(sprintf("[%s:%d] Die <strong>%s</strong> <em><strong>%s</strong></em> stimmt einem Bauvertrag über das <strong>%s</strong> <em><strong>%s</strong></em> zu.",
+ $this->debugOutput(sprintf("[%s:%d] Die <strong>%s</strong> <em><strong>%s</strong></em> stimmt einem Bauvertrag über das <strong>%s</strong> <em><strong>%s</strong></em> zu.",
__CLASS__,
__LINE__,
$partnerInstance->getObjectDescription(),
));
} else {
// Other contract party
- $this->getDebugInstance()->output(sprintf("[%s:%d] Die <strong>%s</strong> <em><strong>%s</strong></em> geht mit der <strong>%s</strong> <em><strong>%s</strong></em> einen Bauvertrag über das <strong>%s</strong> <em><strong>%s</strong></em> ein.",
+ $this->debugOutput(sprintf("[%s:%d] Die <strong>%s</strong> <em><strong>%s</strong></em> geht mit der <strong>%s</strong> <em><strong>%s</strong></em> einen Bauvertrag über das <strong>%s</strong> <em><strong>%s</strong></em> ein.",
__CLASS__,
__LINE__,
$partnerInstance->getObjectDescription(),
} elseif (!is_object($item)) {
// Not an object! ;-(
throw new NoObjectException($item, self::EXCEPTION_IS_NO_OBJECT);
- } elseif (!method_exists($item, 'getPartInstance')) {
+ } elseif (!$item instanceof BaseSimulator) {
// Does not have the required feature (method)
throw new MissingMethodException(array($item, 'getPartInstance'), self::EXCEPTION_MISSING_METHOD);
}