A lot debug messages removed, mailer with stubs added, resend link basicly finished...
[shipsimu.git] / application / ship-simu / main / companies / class_ShippingCompany.php
index 895a19a9ec7a11d8fc1601699ad3bcd5160ff88f..322a61a2a1e0065d72b40bf0d8ad42afb7a8b8d8 100644 (file)
@@ -86,7 +86,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                // Get new instance
                $companyInstance = new ShippingCompany();
 
-               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $companyInstance->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> wird gegr&uuml;ndet.<br />\n",
+               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $companyInstance->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> wird gegr&uuml;ndet.",
                        __CLASS__,
                        __LINE__,
                        $companyName
@@ -123,7 +123,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
 
        // Angestellten-Liste erstellen
        private function createEmployeeList () {
-               if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> erh&auml;lt eine Angestelltenliste.<br />\n",
+               if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> erh&auml;lt eine Angestelltenliste.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName()
@@ -133,7 +133,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
 
        // Werftenliste erstellen
        public function createShipyardList () {
-               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> erh&auml;lt eine Werftsliste.<br />\n",
+               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> erh&auml;lt eine Werftsliste.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName()
@@ -143,7 +143,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
 
        // Auftragsliste erstellen
        public function createContractList () {
-               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> erh&auml;lt eine Auftragsliste.<br />\n",
+               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> erh&auml;lt eine Auftragsliste.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName()
@@ -177,7 +177,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
 
        // Reedereien Werften bauen lassen
        public function createShipyardInHarbor($shipyardName, Harbor $harborInstance) {
-               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> baut im <strong>%s</strong> eine Werft <strong>%s</strong>.<br />\n",
+               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> baut im <strong>%s</strong> eine Werft <strong>%s</strong>.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName(),
@@ -198,13 +198,6 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
 
        // Setter fuer Reederei-Gruender
        public final function setCompanyFounder(CompanyEmployee $founderInstance) {
-               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> ist von <strong>%s %s</strong> gegr&uuml;ndet worden.<br />\n",
-                       __CLASS__,
-                       __LINE__,
-                       $this->getCompanyName(),
-                       $founderInstance->getSurname(),
-                       $founderInstance->getFamily()
-               ));
                $this->founderInstance = $founderInstance;
        }
 
@@ -215,26 +208,11 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
 
        // Neue(n) Angestellte(n) in Angestellten-Liste aufnehmen
        public function addNewEmployee (SimulatorPersonell $employeeInstance) {
-               if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] <strong>%s %s</strong> tritt der Reederei <strong>%s</strong> als <strong>%s</strong> bei und erh&auml;lt ein Gehalt von <strong>%s</strong>.<br />\n",
-                       __CLASS__,
-                       __LINE__,
-                       $employeeInstance->getSurname(),
-                       $employeeInstance->getFamily(),
-                       $this->getCompanyName(),
-                       $employeeInstance->getObjectDescription(),
-                       $this->formatCurrency($employeeInstance->getSalary())
-               ));
                $this->employeeList->append($employeeInstance);
        }
 
        // Neue Werft in Liste aufnehmen
        public function addNewShipyard (Shipyard $shipyardInstance) {
-               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> erh&auml;lt die Werft <strong>%s</strong> hinzugef&uuml;gt.<br />\n",
-                       __CLASS__,
-                       __LINE__,
-                       $this->getCompanyName(),
-                       $shipyardInstance->getShipyardName()
-               ));
                $this->shipyardList->append($shipyardInstance);
        }
 
@@ -244,7 +222,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                $amount = (int) $amount;
 
                // Debug-Meldung ausgeben
-               if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> stellt per Zufall <strong>%d</strong> neue Mitarbeiter ein.<br />\n",
+               if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> stellt per Zufall <strong>%d</strong> neue Mitarbeiter ein.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName(),
@@ -258,7 +236,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                if ($totalUnemployed < $amount) {
                        // Reichte nicht aus!
                        throw new ToMuchEmployeesException(array($amount, $personellInstance->getAllUnemployed()), self::EXCEPTION_NOT_ENOUGTH_UNEMPLOYEES);
-               }
+               } // END - if
 
                // Get list for all unemployed people
                $list = $personellInstance->getSpecialPersonellList(false); // Should be cached
@@ -298,7 +276,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                        $employee->increaseSalary((mt_rand(7, 14) * 100)); // Are 700 to 1400 EUR for the begin okay?
 
                        // Debug message
-                       if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> stellt den/die Angestellte(n) <strong>%s %s</strong> ein.<br />\n",
+                       if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> stellt den/die Angestellte(n) <strong>%s %s</strong> ein.",
                                __CLASS__,
                                __LINE__,
                                $this->getCompanyName(),
@@ -314,7 +292,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                $personellInstance->resetCache();
 
                // Debug-Meldung ausgeben
-               if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> hat per Zufall <strong>%d</strong> neue Mitarbeiter eingestellt.<br />\n",
+               if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> hat per Zufall <strong>%d</strong> neue Mitarbeiter eingestellt.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName(),
@@ -324,7 +302,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
 
        // Distribute all personells on all shipyards
        public function distributeAllPersonellOnShipyards () {
-               if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> verteilt alle ihre <strong>%d</strong> Mitarbeiter auf alle <strong>%d</strong> Werft(en).<br />\n",
+               if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> verteilt alle ihre <strong>%d</strong> Mitarbeiter auf alle <strong>%d</strong> Werft(en).",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName(),
@@ -378,7 +356,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                $total = $this->employeeList->count();
 
                // Debug message
-               if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> hat <strong>%d</strong> Mitarbeiter.<br />\n",
+               if ((defined('DEBUG_COMPANY_EMPLOYEE')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> hat <strong>%d</strong> Mitarbeiter.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName(),
@@ -391,7 +369,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
 
        // Getter for total shipyards
        public final function getTotalShipyards () {
-               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] F&uuml;r die Reederei <strong>%s</strong> werden die Anzahl der Werften in allen H&auml;fen ermittelt.<br />\n",
+               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] F&uuml;r die Reederei <strong>%s</strong> werden die Anzahl der Werften in allen H&auml;fen ermittelt.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName()
@@ -407,7 +385,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                $total = $this->shipyardList->count();
 
                // Debug message
-               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> hat <strong>%d</strong> Werft(en).<br />\n",
+               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> hat <strong>%d</strong> Werft(en).",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName(),
@@ -436,7 +414,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                ));
 
                // Debug message
-               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> baut in allen Werften bald Schiffe vom Typ <strong>%s</strong>.<br />\n",
+               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> baut in allen Werften bald Schiffe vom Typ <strong>%s</strong>.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName(),
@@ -467,7 +445,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
 
        // Validate the requested ship type with the company if they can construct it
        public function validateWorksContractShipType (SignableContract $contractInstance) {
-               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> pr&uuml;ft den Bauauftrag der <strong>%s</strong>.<br />\n",
+               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> pr&uuml;ft den Bauauftrag der <strong>%s</strong>.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName(),
@@ -490,7 +468,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                $shipType = $shipInstance->__toString();
 
                // Debug message
-               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> pr&uuml;ft, ob die <strong>%s</strong> (Typ:<strong>%s</strong>) gebaut werden kann.<br />\n",
+               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> pr&uuml;ft, ob die <strong>%s</strong> (Typ:<strong>%s</strong>) gebaut werden kann.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName(),
@@ -508,7 +486,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                $shipType = (string) $shipType;
 
                // Debug message
-               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> fragt alle Werften ab, ob diese Schiffe vom Typ <strong>%s</strong> bauen k&ouml;nnen.<br />\n",
+               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> fragt alle Werften ab, ob diese Schiffe vom Typ <strong>%s</strong> bauen k&ouml;nnen.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName(),
@@ -543,7 +521,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                }
 
                // Debug message
-               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> hat die Suche nach einer Werft beendet, die Schiffe vom Typ <strong>%s</strong> bauen kann.<br />\n",
+               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> hat die Suche nach einer Werft beendet, die Schiffe vom Typ <strong>%s</strong> bauen kann.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName(),
@@ -556,7 +534,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
 
        // As a customer the shipping company can add new contracts
        public function addNewWorksContract (SignableContract $contractInstance) {
-               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> erstellt einen Bauauftrag f&uuml;r ein <strong>%s</strong> mit dem Namen <strong>%s</strong>.<br />\n",
+               if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> erstellt einen Bauauftrag f&uuml;r ein <strong>%s</strong> mit dem Namen <strong>%s</strong>.",
                        __CLASS__,
                        __LINE__,
                        $this->getCompanyName(),
@@ -594,7 +572,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                // Determine if company "signs" own contract (must be done) or with an other party
                if ($this->equals($partnerInstance)) {
                        // With itself
-                       if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> erteilt an sich selbst einen Bauauftrag f&uuml;r das <strong>%s</strong> &quot;<strong>%s</strong>&quot;.<br />\n",
+                       if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> erteilt an sich selbst einen Bauauftrag f&uuml;r das <strong>%s</strong> &quot;<strong>%s</strong>&quot;.",
                                __CLASS__,
                                __LINE__,
                                $this->getCompanyName(),
@@ -603,7 +581,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner
                        ));
                } else {
                        // Other external company
-                       if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> unterzeichnet einen Bauauftrag f&uuml;r das <strong>%s</strong> &quot;<strong>%s</strong>&quot; mit der <strong>%s</strong>.<br />\n",
+                       if ((defined('DEBUG_COMPANY')) || (defined('DEBUG_ALL'))) $this->getDebugInstance()->output(sprintf("[%s:%d] Die Reederei <strong>%s</strong> unterzeichnet einen Bauauftrag f&uuml;r das <strong>%s</strong> &quot;<strong>%s</strong>&quot; mit der <strong>%s</strong>.",
                                __CLASS__,
                                __LINE__,
                                $this->getCompanyName(),