X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=application%2Fship-simu%2Fmain%2Fclass_WorksContract.php;h=ff4e019907f59eacd5fe66fe99fc260dc8a7e2a3;hb=d381d9892a92c37a3b6653a9c76a49c510b0d0f3;hp=9527b232a39fbf86fb057436a144be357325c6c7;hpb=d527a312ec4b2983fc0ecda2179ce335c1a5a1f9;p=shipsimu.git diff --git a/application/ship-simu/main/class_WorksContract.php b/application/ship-simu/main/class_WorksContract.php index 9527b23..ff4e019 100644 --- a/application/ship-simu/main/class_WorksContract.php +++ b/application/ship-simu/main/class_WorksContract.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Ship-Simu Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -44,15 +44,6 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract { protected function __construct () { // Call parent constructor parent::__construct(__CLASS__); - - // Set description - $this->setObjectDescription("Bauvertrag"); - - // Unique-ID generieren - $this->generateUniqueId(); - - // Clean up a little - $this->removeSystemArray(); } // Neuen Bauvertrag generieren @@ -64,15 +55,6 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract { // 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 %s mit der %s %s erstellt.", - __CLASS__, - __LINE__, - $shipName, - $partnerInstance->getObjectDescription(), - $partnerInstance->getCompanyName() - )); - // Schiffsnamen setzen $contractInstance->setShipName($shipName); @@ -123,7 +105,7 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract { $parentPart = (string) $parentPart; // Debug message - if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Das Schiffsteil %s wird zusammen mit dem Konstruktionsteil %s in den Bauvertrag aufgenommen.", + if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) $this->debugOutput(sprintf("[%s:%d] Das Schiffsteil %s wird zusammen mit dem Konstruktionsteil %s in den Bauvertrag aufgenommen.", __CLASS__, __LINE__, $shipPart, @@ -137,13 +119,13 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract { try { $partInstance = ObjectFactory::createObjectByName($shipPart, $dataArray); } catch (DimNotFoundInArrayException $e) { - $this->getDebugInstance()->output(sprintf("[main:] Die %s konnte nicht vervollständigt werden. Grund: %s
", + $this->debugOutput(sprintf("[main:] Die %s konnte nicht vervollständigt werden. Grund: %s
", $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__ )); @@ -152,7 +134,7 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract { if (!$partInstance instanceof ConstructableShipPart) { // Ship part not constructable! throw new ShipPartNotConstructableException(array($shipPart), self::EXCEPTION_NOT_CONSTRUCTABLE); - } elseif (!$this->getShipInstance()->createShipPart($partInstance, $parentPart)) { + } elseif ($this->getShipInstance()->createShipPart($partInstance, $parentPart) === false) { // Schiff konnte nicht gebaut werden! throw new ShipNotConstructedException(sprintf("Das Schiff %s konnte wegen eines Fehlers nicht gebaut werden. Siehe obere Meldungen.", $this->getShipInstance()->getShipName() @@ -166,23 +148,8 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract { // 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] %s kostet %s.", - __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] %s wurde in den Bauvertrag aufgenommen.", - __CLASS__, - __LINE__, - $partInstance->getObjectDescription() - )); } // Setter for contract partner @@ -239,7 +206,7 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract { if ((defined('DEBUG_CONTRACT')) || (defined('DEBUG_ALL'))) { if ($partnerInstance->equals($partyInstance)) { // With itself - $this->getDebugInstance()->output(sprintf("[%s:%d] Die %s %s stimmt einem Bauvertrag über das %s %s zu.", + $this->debugOutput(sprintf("[%s:%d] Die %s %s stimmt einem Bauvertrag über das %s %s zu.", __CLASS__, __LINE__, $partnerInstance->getObjectDescription(), @@ -249,7 +216,7 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract { )); } else { // Other contract party - $this->getDebugInstance()->output(sprintf("[%s:%d] Die %s %s geht mit der %s %s einen Bauvertrag über das %s %s ein.", + $this->debugOutput(sprintf("[%s:%d] Die %s %s geht mit der %s %s einen Bauvertrag über das %s %s ein.", __CLASS__, __LINE__, $partnerInstance->getObjectDescription(), @@ -284,7 +251,7 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract { throw new NullPointerException($shipInstance, self::EXCEPTION_IS_NULL_POINTER); } elseif (!is_object($shipInstance)) { // Not an object! ;-( - throw new NoObjectException($shipInstance, self::EXCEPTION_IS_NO_OBJECT); + throw new InvalidObjectException($shipInstance, self::EXCEPTION_IS_NO_OBJECT); } elseif (!$shipInstance instanceof ConstructableShip) { // Does not have the required feature (method) throw new ShipIsInvalidException(array($shipInstance), self::EXCEPTION_INVALID_SHIP_INSTANCE); @@ -313,7 +280,7 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract { throw new NullPointerException($item, self::EXCEPTION_IS_NULL_POINTER); } elseif (!is_object($item)) { // Not an object! ;-( - throw new NoObjectException($item, self::EXCEPTION_IS_NO_OBJECT); + throw new InvalidObjectException($item, self::EXCEPTION_IS_NO_OBJECT); } elseif (!$item instanceof BaseSimulator) { // Does not have the required feature (method) throw new MissingMethodException(array($item, 'getPartInstance'), self::EXCEPTION_MISSING_METHOD); @@ -328,7 +295,7 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract { throw new NullPointerException($part, self::EXCEPTION_IS_NULL_POINTER); } elseif (!is_object($part)) { // Not an object! ;-( - throw new NoObjectException($part, self::EXCEPTION_IS_NO_OBJECT); + throw new InvalidObjectException($part, self::EXCEPTION_IS_NO_OBJECT); } elseif (!method_exists($part, 'getPrice')) { // Does not have the required feature (method) throw new MissingMethodException(array($part, 'getPrice'), self::EXCEPTION_MISSING_METHOD);