]> git.mxchange.org Git - shipsimu.git/blobdiff - application/ship-simu/main/class_WorksContract.php
- XHTML errors/warnings fixed in some pages
[shipsimu.git] / application / ship-simu / main / class_WorksContract.php
index 9527b232a39fbf86fb057436a144be357325c6c7..f56c2fae74ca79eefb906d9756af3569c076e07e 100644 (file)
@@ -45,14 +45,9 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract {
                // 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
@@ -64,15 +59,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&uuml;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);
 
@@ -123,7 +109,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 <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,
@@ -137,13 +123,13 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract {
                try {
                        $partInstance = ObjectFactory::createObjectByName($shipPart, $dataArray);
                } catch (DimNotFoundInArrayException $e) {
-                       $this->getDebugInstance()->output(sprintf("[main:] Die <strong>%s</strong> konnte nicht vervollst&auml;ndigt werden. Grund: <strong>%s</strong><br />",
+                       $this->debugOutput(sprintf("[main:] Die <strong>%s</strong> konnte nicht vervollst&auml;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__
                        ));
@@ -152,7 +138,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 <strong>%s</strong> konnte wegen eines Fehlers nicht gebaut werden. Siehe obere Meldungen.",
                                        $this->getShipInstance()->getShipName()
@@ -166,23 +152,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] <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
@@ -239,7 +210,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 <strong>%s</strong> <em><strong>%s</strong></em> stimmt einem Bauvertrag &uuml;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 &uuml;ber das <strong>%s</strong> <em><strong>%s</strong></em> zu.",
                                        __CLASS__,
                                        __LINE__,
                                        $partnerInstance->getObjectDescription(),
@@ -249,7 +220,7 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract {
                                ));
                        } 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 &uuml;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 &uuml;ber das <strong>%s</strong> <em><strong>%s</strong></em> ein.",
                                        __CLASS__,
                                        __LINE__,
                                        $partnerInstance->getObjectDescription(),