humhub / calendar

Create one-time or recurring events, invite and manage attendees, and keep track of all your events with the Calendar module.
28 stars 46 forks source link

Undefined variable: isSpaceGlobal #143

Closed staxDB closed 4 years ago

staxDB commented 6 years ago

Issue with the latest Calendar Module v0.6.18 and HH v1.3.1 or HH v1.3.2dev: When clicking on a calendar view, then on the options of this calendar an at least on other calendars I get this error message (extracted from the log):

2018-08-25 12:00:13 [::1][4][ndou5pgscu84p2e82e6f64vo3f][error][yii\base\ErrorException:8] yii\base\ErrorException: Undefined variable: isSpaceGlobal in /Applications/MAMP/htdocs/rochus/protected/modules/calendar/views/common/_calendarTypeItem.php:28
Stack trace:
#0 /Applications/MAMP/htdocs/rochus/protected/modules/calendar/views/common/_calendarTypeItem.php(28): yii\base\ErrorHandler->handleError(8, 'Undefined varia...', '/Applications/M...', 28, Array)
#1 /Applications/MAMP/htdocs/rochus/protected/vendor/yiisoft/yii2/base/View.php(336): require('/Applications/M...')
#2 /Applications/MAMP/htdocs/rochus/protected/vendor/yiisoft/yii2/base/View.php(254): yii\base\View->renderPhpFile('/Applications/M...', Array)
#3 /Applications/MAMP/htdocs/rochus/protected/vendor/yiisoft/yii2/base/View.php(156): yii\base\View->renderFile('/Applications/M...', Array, NULL)
#4 /Applications/MAMP/htdocs/rochus/protected/modules/calendar/views/common/calendarsConfig.php(50): yii\base\View->render('_calendarTypeIt...', Array)
#5 /Applications/MAMP/htdocs/rochus/protected/vendor/yiisoft/yii2/base/View.php(336): require('/Applications/M...')
#6 /Applications/MAMP/htdocs/rochus/protected/vendor/yiisoft/yii2/base/View.php(254): yii\base\View->renderPhpFile('/Applications/M...', Array)
#7 /Applications/MAMP/htdocs/rochus/protected/vendor/yiisoft/yii2/base/View.php(156): yii\base\View->renderFile('/Applications/M...', Array, Object(humhub\modules\calendar\controllers\ContainerConfigController))
#8 /Applications/MAMP/htdocs/rochus/protected/vendor/yiisoft/yii2/base/Controller.php(384): yii\base\View->render('@calendar/views...', Array, Object(humhub\modules\calendar\controllers\ContainerConfigController))
#9 /Applications/MAMP/htdocs/rochus/protected/modules/calendar/controllers/ContainerConfigController.php(135): yii\base\Controller->render('@calendar/views...', Array)
#10 [internal function]: humhub\modules\calendar\controllers\ContainerConfigController->actionCalendars()
#11 /Applications/MAMP/htdocs/rochus/protected/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#12 /Applications/MAMP/htdocs/rochus/protected/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#13 /Applications/MAMP/htdocs/rochus/protected/vendor/yiisoft/yii2/base/Module.php(528): yii\base\Controller->runAction('calendars', Array)
#14 /Applications/MAMP/htdocs/rochus/protected/vendor/yiisoft/yii2/web/Application.php(103): yii\base\Module->runAction('calendar/contai...', Array)
#15 /Applications/MAMP/htdocs/rochus/protected/vendor/yiisoft/yii2/base/Application.php(386): yii\web\Application->handleRequest(Object(humhub\components\Request))
#16 /Applications/MAMP/htdocs/rochus/index.php(25): yii\base\Application->run()
#17 {main}
2018-08-25 12:00:13 [::1][4][ndou5pgscu84p2e82e6f64vo3f][info][application] $_GET = [
    '_pjax' => '#layout-content'
    '_' => '1535191200585'
    'cguid' => '21500568-72fb-483d-ba91-297e4f539253'
]

$_SERVER = [
    'REDIRECT_BASE' => '/rochus'
    'REDIRECT_STATUS' => '200'
    'BASE' => '/rochus'
    'HTTP_HOST' => 'localhost:8888'
    'HTTP_CONNECTION' => 'keep-alive'
    'HTTP_DNT' => '1'
    'HTTP_X_CSRF_TOKEN' => 'Qa_QmIkV1_mdzWuPpBfYPy8C-uU8RLDQsv0WkKp3SsV3_prvzXy8vO_gAuGQQooNYlqpn118-b3Dn1nG2jEdkw=='
    'HTTP_USER_AGENT' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'
    'CONTENT_TYPE' => 'application/x-www-form-urlencoded; charset=UTF-8'
    'HTTP_ACCEPT' => 'text/html, */*; q=0.01'
    'HTTP_X_REQUESTED_WITH' => 'XMLHttpRequest'
    'HTTP_X_PJAX' => 'true'
    'HTTP_X_PJAX_CONTAINER' => '#layout-content'
    'HTTP_REFERER' => 'http://localhost:8888/rochus/s/test/calendar/container-config/types'
    'HTTP_ACCEPT_ENCODING' => 'gzip, deflate, br'
    'HTTP_ACCEPT_LANGUAGE' => 'de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7'
    'HTTP_COOKIE' => 'pm_space-members-panel=expanded; cookieconsent_status=dismiss; _csrf=af8080c6b25e73b4f2beadf8a796942e01d31bb83c78ec3f62c196a01851051ba%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%226QJwDikEr-in4UR2MXSza8ImqbOVpFWV%22%3B%7D; language=d489efb27d626d5ef3d4975fd4d0f4d5658c6ecd1d42162b017705586f9f5bfda%3A2%3A%7Bi%3A0%3Bs%3A8%3A%22language%22%3Bi%3A1%3Bs%3A2%3A%22de%22%3B%7D; _identity=edcfb39690bad5a856f32d72cdb548df21011eb923ad712b785fb0b47f643c29a%3A2%3A%7Bi%3A0%3Bs%3A9%3A%22_identity%22%3Bi%3A1%3Bs%3A50%3A%22%5B4%2C%22816e2f30-6f01-492d-adfc-98edc49f9113%22%2C2592000%5D%22%3B%7D; PHPSESSID=ndou5pgscu84p2e82e6f64vo3f'
    'PATH' => '/usr/bin:/bin:/usr/sbin:/sbin'
    'SERVER_SIGNATURE' => ''
    'SERVER_SOFTWARE' => 'Apache/2.2.34 (Unix) mod_wsgi/3.5 Python/2.7.13 PHP/7.2.1 mod_ssl/2.2.34 OpenSSL/1.0.2j DAV/2 mod_fastcgi/2.4.6 mod_perl/2.0.9 Perl/v5.24.0'
    'SERVER_NAME' => 'localhost'
    'SERVER_ADDR' => '::1'
    'SERVER_PORT' => '8888'
    'REMOTE_ADDR' => '::1'
    'DOCUMENT_ROOT' => '/Applications/MAMP/htdocs'
    'SERVER_ADMIN' => 'you@example.com'
    'SCRIPT_FILENAME' => '/Applications/MAMP/htdocs/rochus/index.php'
    'REMOTE_PORT' => '49320'
    'REDIRECT_QUERY_STRING' => '_pjax=%23layout-content&_=1535191200585'
    'REDIRECT_URL' => '/rochus/s/test/calendar/container-config/calendars'
    'GATEWAY_INTERFACE' => 'CGI/1.1'
    'SERVER_PROTOCOL' => 'HTTP/1.1'
    'REQUEST_METHOD' => 'GET'
    'QUERY_STRING' => '_pjax=%23layout-content&_=1535191200585'
    'REQUEST_URI' => '/rochus/s/test/calendar/container-config/calendars?_pjax=%23layout-content&_=1535191200585'
    'SCRIPT_NAME' => '/rochus/index.php'
    'PHP_SELF' => '/rochus/index.php'
    'REQUEST_TIME_FLOAT' => 1535191213.386
    'REQUEST_TIME' => 1535191213
    'argv' => [
        0 => '_pjax=%23layout-content&_=1535191200585'
    ]
    'argc' => 1
]
2018-08-25 12:00:14 [::1][4][ndou5pgscu84p2e82e6f64vo3f][error][yii\base\ErrorException:8] yii\base\ErrorException: Undefined variable: isSpaceGlobal in /Applications/MAMP/htdocs/rochus/protected/modules/calendar/views/common/_calendarTypeItem.php:28
Stack trace:
#0 /Applications/MAMP/htdocs/rochus/protected/modules/calendar/views/common/_calendarTypeItem.php(28): yii\base\ErrorHandler->handleError(8, 'Undefined varia...', '/Applications/M...', 28, Array)
#1 /Applications/MAMP/htdocs/rochus/protected/vendor/yiisoft/yii2/base/View.php(336): require('/Applications/M...')
#2 /Applications/MAMP/htdocs/rochus/protected/vendor/yiisoft/yii2/base/View.php(254): yii\base\View->renderPhpFile('/Applications/M...', Array)
#3 /Applications/MAMP/htdocs/rochus/protected/vendor/yiisoft/yii2/base/View.php(156): yii\base\View->renderFile('/Applications/M...', Array, NULL)
#4 /Applications/MAMP/htdocs/rochus/protected/modules/calendar/views/common/calendarsConfig.php(50): yii\base\View->render('_calendarTypeIt...', Array)
#5 /Applications/MAMP/htdocs/rochus/protected/vendor/yiisoft/yii2/base/View.php(336): require('/Applications/M...')
#6 /Applications/MAMP/htdocs/rochus/protected/vendor/yiisoft/yii2/base/View.php(254): yii\base\View->renderPhpFile('/Applications/M...', Array)
#7 /Applications/MAMP/htdocs/rochus/protected/vendor/yiisoft/yii2/base/View.php(156): yii\base\View->renderFile('/Applications/M...', Array, Object(humhub\modules\calendar\controllers\ContainerConfigController))
#8 /Applications/MAMP/htdocs/rochus/protected/vendor/yiisoft/yii2/base/Controller.php(384): yii\base\View->render('@calendar/views...', Array, Object(humhub\modules\calendar\controllers\ContainerConfigController))
#9 /Applications/MAMP/htdocs/rochus/protected/modules/calendar/controllers/ContainerConfigController.php(135): yii\base\Controller->render('@calendar/views...', Array)
#10 [internal function]: humhub\modules\calendar\controllers\ContainerConfigController->actionCalendars()
#11 /Applications/MAMP/htdocs/rochus/protected/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#12 /Applications/MAMP/htdocs/rochus/protected/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#13 /Applications/MAMP/htdocs/rochus/protected/vendor/yiisoft/yii2/base/Module.php(528): yii\base\Controller->runAction('calendars', Array)
#14 /Applications/MAMP/htdocs/rochus/protected/vendor/yiisoft/yii2/web/Application.php(103): yii\base\Module->runAction('calendar/contai...', Array)
#15 /Applications/MAMP/htdocs/rochus/protected/vendor/yiisoft/yii2/base/Application.php(386): yii\web\Application->handleRequest(Object(humhub\components\Request))
#16 /Applications/MAMP/htdocs/rochus/index.php(25): yii\base\Application->run()
#17 {main}
2018-08-25 12:00:13 [::1][4][ndou5pgscu84p2e82e6f64vo3f][info][application] $_GET = [
    'cguid' => '21500568-72fb-483d-ba91-297e4f539253'
]

$_SERVER = [
    'REDIRECT_BASE' => '/rochus'
    'REDIRECT_STATUS' => '200'
    'BASE' => '/rochus'
    'HTTP_HOST' => 'localhost:8888'
    'HTTP_CONNECTION' => 'keep-alive'
    'HTTP_UPGRADE_INSECURE_REQUESTS' => '1'
    'HTTP_DNT' => '1'
    'HTTP_USER_AGENT' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'
    'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8'
    'HTTP_REFERER' => 'http://localhost:8888/rochus/s/test/calendar/container-config/types'
    'HTTP_ACCEPT_ENCODING' => 'gzip, deflate, br'
    'HTTP_ACCEPT_LANGUAGE' => 'de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7'
    'HTTP_COOKIE' => 'pm_space-members-panel=expanded; cookieconsent_status=dismiss; _csrf=af8080c6b25e73b4f2beadf8a796942e01d31bb83c78ec3f62c196a01851051ba%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%226QJwDikEr-in4UR2MXSza8ImqbOVpFWV%22%3B%7D; language=d489efb27d626d5ef3d4975fd4d0f4d5658c6ecd1d42162b017705586f9f5bfda%3A2%3A%7Bi%3A0%3Bs%3A8%3A%22language%22%3Bi%3A1%3Bs%3A2%3A%22de%22%3B%7D; _identity=edcfb39690bad5a856f32d72cdb548df21011eb923ad712b785fb0b47f643c29a%3A2%3A%7Bi%3A0%3Bs%3A9%3A%22_identity%22%3Bi%3A1%3Bs%3A50%3A%22%5B4%2C%22816e2f30-6f01-492d-adfc-98edc49f9113%22%2C2592000%5D%22%3B%7D; PHPSESSID=ndou5pgscu84p2e82e6f64vo3f'
    'PATH' => '/usr/bin:/bin:/usr/sbin:/sbin'
    'SERVER_SIGNATURE' => ''
    'SERVER_SOFTWARE' => 'Apache/2.2.34 (Unix) mod_wsgi/3.5 Python/2.7.13 PHP/7.2.1 mod_ssl/2.2.34 OpenSSL/1.0.2j DAV/2 mod_fastcgi/2.4.6 mod_perl/2.0.9 Perl/v5.24.0'
    'SERVER_NAME' => 'localhost'
    'SERVER_ADDR' => '::1'
    'SERVER_PORT' => '8888'
    'REMOTE_ADDR' => '::1'
    'DOCUMENT_ROOT' => '/Applications/MAMP/htdocs'
    'SERVER_ADMIN' => 'you@example.com'
    'SCRIPT_FILENAME' => '/Applications/MAMP/htdocs/rochus/index.php'
    'REMOTE_PORT' => '49323'
    'REDIRECT_URL' => '/rochus/s/test/calendar/container-config/calendars'
    'GATEWAY_INTERFACE' => 'CGI/1.1'
    'SERVER_PROTOCOL' => 'HTTP/1.1'
    'REQUEST_METHOD' => 'GET'
    'QUERY_STRING' => ''
    'REQUEST_URI' => '/rochus/s/test/calendar/container-config/calendars'
    'SCRIPT_NAME' => '/rochus/index.php'
    'PHP_SELF' => '/rochus/index.php'
    'REQUEST_TIME_FLOAT' => 1535191213.733
    'REQUEST_TIME' => 1535191213
    'argv' => []
    'argc' => 0
]
staxDB commented 6 years ago

i guess the calendarsConfig.php file in line 50/51 should look like this:

                'disabled' => !$itemType->enabled,
                'isSpaceGlobal' => ($contentContainer === null),
            ]);?>
kesselb commented 6 years ago

@staxDB would you mind opening a pr for that?

bumrufus commented 6 years ago

i've tried your fix, the error disappaers but i can't change the global calendar, instead of the edit button(pencil) there is a text: (generell)

bumrufus commented 6 years ago

this text is only in the admin section ACP - Module - Calendar - configure - other calendars

under the space section there is still the edit button (pencil) Space - Option (gear) - Module - Calendar - - configure - other calendars

staxDB commented 6 years ago

@bumrufus I think that's what the humhub team wanted. Anyway, I can't see a bug here...

bumrufus commented 6 years ago

acp space

staxDB commented 6 years ago

I know what you mean. But take a look at the file I modified: I only added one line here so that no error message is generated in the view. This file calls the sub-view _calendarTypeItem.php in line 45, in which the following happens: Is it a global calendar, the text general is printed out (which I think should be done in case of a global configuration, i.e. in the admin area). If its a normal space-calendar, the edit-button will be printed..

To sum it up: This has basically nothing to do with my fix. This would require you to create your own issue, if this is an error at all.

bumrufus commented 6 years ago

ok thx, i just want to let u know that there is this error (or not) so maybe the humhub team could look into it. since everything is working for me its ok for me because i dont want to edit the calendar global :-) thx for your fix

staxDB commented 6 years ago

I agree with you! I also think it would be nice to have the ability to edit other calendars in the global calendar view and save these settings for each user individually..... I think I'll open a new issue for that

buddh4 commented 4 years ago

The issue should be fixed already, please create a feature request issue if you have some ideas for enhancements.