Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

PHP Fatal error in ./Timetracker/Model/Timeaccount.php #7194

Closed
mzch opened this issue Jul 16, 2020 · 5 comments
Closed

PHP Fatal error in ./Timetracker/Model/Timeaccount.php #7194

mzch opened this issue Jul 16, 2020 · 5 comments

Comments

@mzch
Copy link

mzch commented Jul 16, 2020

When updating to 2020.03.4, PHP Fatal error occurred:

[Thu Jul 16 07:42:13.226774 2020] [proxy_fcgi:error] [pid 9087:tid 139865274349312] [client 118.243.18.144:65483] AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught Error: Class 'HumanResources_Config' not found in /srv/tine_2020034/Tinebase/Record/Abstract.php:269\nStack trace:\n#0 /srv/tine_2020034/Tinebase/Server/Abstract.php(172): Tinebase_Record_Abstract::getConfiguration()\n#1 /srv/tine_2020034/Tinebase/Server/Json.php(349): Tinebase_Server_Abstract::_getModelConfigMethods('Tinebase_Server...')\n#2 /srv/tine_2020034/Tinebase/Server/Json.php(448): Tinebase_Server_Json::_getServer()\n#3 /srv/tine_2020034/Setup/Server/Json.php(93): Tinebase_Server_Json->_handleException(Object(Zend_Json_Server_Request_Http), Object(Error))\n#4 /srv/tine_2020034/Setup/Core.php(117): Setup_Server_Json->handle()\n#5 /srv/tine_2020034/setup.php(14): Setup_Core::dispatchRequest()\n#6 {main}\n  thrown in /srv/tine_2020034/Tinebase/Record/Abstract.php on line 269', referer: https://mailanyplace.com/setup.php

I found HumanResources_Config only in ./Timetracker/Model/Timeaccount.php`. Because of this issue, I can't update plugins.

OS: Debian 10.4
PHP: 7.3.14

@pschuele pschuele self-assigned this Jul 20, 2020
@pschuele
Copy link
Member

does this solve the problem?

diff --git a/tine20/Timetracker/Model/Timeaccount.php b/tine20/Timetracker/Model/Timeaccount.php
index ba7c040ee7..a1b052a6ba 100644
--- a/tine20/Timetracker/Model/Timeaccount.php
+++ b/tine20/Timetracker/Model/Timeaccount.php
@@ -294,8 +294,8 @@ class Timetracker_Model_Timeaccount extends Sales_Model_Accountable_Abstract
                     self::TYPE                  => self::TYPE_RELATION,
                     self::LABEL                 => 'Stream', // _('Stream')
                     self::CONFIG                => [
-                        self::APP_NAME              => HumanResources_Config::APP_NAME,
-                        self::MODEL_NAME            => HumanResources_Model_Stream::MODEL_NAME_PART,
+                        self::APP_NAME              => 'HumanResources',
+                        self::MODEL_NAME            => 'Stream',
                         self::TYPE                  => Timetracker_Model_Timeaccount::MODEL_NAME_PART
                     ]
                 ]

i think, we can't use the constants here, because HumanResources code might not be loaded as it is in a different package.

@pschuele pschuele added this to To do in Tine 2.0 Development via automation Jul 20, 2020
@pschuele pschuele added this to the 2020.08.1 milestone Jul 20, 2020
@pschuele pschuele moved this from To do to In progress in Tine 2.0 Development Jul 20, 2020
@pschuele pschuele moved this from In progress to To be tested / reviewed in Tine 2.0 Development Jul 20, 2020
@mzch
Copy link
Author

mzch commented Jul 20, 2020

I applied it, but the following error occurred:

[Mon Jul 20 02:26:48.359551 2020] [proxy_fcgi:error] [pid 1589:tid 139865207207680] [client 118.243.18.144:52112] AH01071: Got error 'PHP message: PHP Fatal error:  Uncaught Error: Class 'HumanResources_Config' not found in /srv/tine_2020034/Tinebase/Record/Abstract.php:269\nStack trace:\n#0 /srv/tine_2020034/Tinebase/Server/Abstract.php(172): Tinebase_Record_Abstract::getConfiguration()\n#1 /srv/tine_2020034/Tinebase/Server/Json.php(349): Tinebase_Server_Abstract::_getModelConfigMethods('Tinebase_Server...')\n#2 /srv/tine_2020034/Tinebase/Server/Json.php(448): Tinebase_Server_Json::_getServer()\n#3 /srv/tine_2020034/Setup/Server/Json.php(93): Tinebase_Server_Json->_handleException(Object(Zend_Json_Server_Request_Http), Object(Error))\n#4 /srv/tine_2020034/Setup/Core.php(117): Setup_Server_Json->handle()\n#5 /srv/tine_2020034/setup.php(14): Setup_Core::dispatchRequest()\n#6 {main}\n  thrown in /srv/tine_2020034/Tinebase/Record/Abstract.php on line 269', referer: https://mailanyplace.com/setup.php

@pschuele
Copy link
Member

oops, sorry. found another occurrence in the same file:

@@ -318,10 +318,9 @@ class Timetracker_Model_Timeaccount extends Sales_Model_Accountable_Abstract
         array('relatedApp' => 'Sales', 'relatedModel' => 'Contract', 'config' => array(
             array('type' => 'TIME_ACCOUNT', 'degree' => 'sibling', 'text' => 'Time Account', 'max' => '1:0'), // _('Time Account')
         )
-        ),
-        [
-            'relatedApp' => HumanResources_Config::APP_NAME,
-            'relatedModel' => HumanResources_Model_Stream::MODEL_NAME_PART,
+        ), [
+            'relatedApp' => 'HumanResources',
+            'relatedModel' => 'Stream',
             'config' => [
                 ['type' => self::MODEL_NAME_PART, 'degree' => Tinebase_Model_Relation::DEGREE_SIBLING, 'max' => '1:0'],
             ],

@mzch
Copy link
Author

mzch commented Jul 20, 2020

Great! It works well. Thanks! :)

@mzch mzch closed this as completed Jul 20, 2020
Tine 2.0 Development automation moved this from To be tested / reviewed to Done Jul 20, 2020
@pschuele
Copy link
Member

thanks for your help :)

pschuele added a commit that referenced this issue Jul 24, 2020
... in Timetracker. HR code might not be available

fixes #7194

Change-Id: Ic02f27d9448ca4010e372eb6bb512ac0e2c0bc40
Reviewed-on: http://gerrit.tine20.com/customers/17325
Tested-by: Jenkins CI (http://ci.tine20.com/) <tine20-jenkins@metaways.de>
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Development

No branches or pull requests

2 participants