diff --git a/composer.json b/composer.json index 80e29763..f55509fc 100644 --- a/composer.json +++ b/composer.json @@ -12,6 +12,8 @@ } ], "require": { - "guzzlehttp/guzzle": "^6.2" + "guzzlehttp/guzzle": "^6.2", + "shuchkin/simplexlsx" : "0.8.10", + "shuchkin/simplexls" : "0.9.4" } } diff --git a/composer.lock b/composer.lock index 65e49851..b66349fa 100644 --- a/composer.lock +++ b/composer.lock @@ -1,48 +1,52 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c3cd76e7057a1b566e5fc949f660604e", + "content-hash": "ae04e84d115e6972febb1ac3d55930ea", "packages": [ { "name": "guzzlehttp/guzzle", - "version": "6.2.2", + "version": "6.4.1", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60" + "reference": "0895c932405407fd3a7368b6910c09a24d26db11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/ebf29dee597f02f09f4d5bbecc68230ea9b08f60", - "reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/0895c932405407fd3a7368b6910c09a24d26db11", + "reference": "0895c932405407fd3a7368b6910c09a24d26db11", "shasum": "" }, "require": { + "ext-json": "*", "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.3.1", + "guzzlehttp/psr7": "^1.6.1", "php": ">=5.5" }, "require-dev": { "ext-curl": "*", - "phpunit/phpunit": "^4.0", - "psr/log": "^1.0" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", + "psr/log": "^1.1" + }, + "suggest": { + "psr/log": "Required for using the Log middleware" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.2-dev" + "dev-master": "6.3-dev" } }, "autoload": { - "files": [ - "src/functions_include.php" - ], "psr-4": { "GuzzleHttp\\": "src/" - } + }, + "files": [ + "src/functions_include.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -66,7 +70,7 @@ "rest", "web service" ], - "time": "2016-10-08T15:01:37+00:00" + "time": "2019-10-23T15:58:00+00:00" }, { "name": "guzzlehttp/promises", @@ -121,32 +125,37 @@ }, { "name": "guzzlehttp/psr7", - "version": "1.3.1", + "version": "1.6.1", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b" + "reference": "239400de7a173fe9901b9ac7c06497751f00727a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", - "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a", + "reference": "239400de7a173fe9901b9ac7c06497751f00727a", "shasum": "" }, "require": { "php": ">=5.4.0", - "psr/http-message": "~1.0" + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" }, "provide": { "psr/http-message-implementation": "1.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "ext-zlib": "*", + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" + }, + "suggest": { + "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "1.6-dev" } }, "autoload": { @@ -166,16 +175,24 @@ "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" } ], - "description": "PSR-7 message implementation", + "description": "PSR-7 message implementation that also provides common utility methods", "keywords": [ "http", "message", + "psr-7", + "request", + "response", "stream", - "uri" + "uri", + "url" ], - "time": "2016-06-24T23:00:38+00:00" + "time": "2019-07-01T23:21:34+00:00" }, { "name": "psr/http-message", @@ -226,6 +243,138 @@ "response" ], "time": "2016-08-06T14:39:51+00:00" + }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "time": "2019-03-08T08:55:37+00:00" + }, + { + "name": "shuchkin/simplexls", + "version": "0.9.4", + "source": { + "type": "git", + "url": "https://github.com/shuchkin/simplexls.git", + "reference": "3b5a08c8ecc67ba6f35a1bb14d88634b152f5a3a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/shuchkin/simplexls/zipball/3b5a08c8ecc67ba6f35a1bb14d88634b152f5a3a", + "reference": "3b5a08c8ecc67ba6f35a1bb14d88634b152f5a3a", + "shasum": "" + }, + "require": { + "ext-mbstring": "*" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/SimpleXLS.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Sergey Shuchkin (SMSPILOT)", + "email": "sergey.shuchkin@gmail.com", + "homepage": "http://www.shuchkin.ru/" + } + ], + "description": "Parse and retrieve data from old format Excel XLS files. MS Excel 97 workbooks PHP reader.", + "homepage": "https://github.com/shuchkin/simplexls", + "keywords": [ + "backend", + "excel", + "parser", + "php", + "xls" + ], + "time": "2019-02-19T02:25:40+00:00" + }, + { + "name": "shuchkin/simplexlsx", + "version": "0.8.10", + "source": { + "type": "git", + "url": "https://github.com/shuchkin/simplexlsx.git", + "reference": "55cdcb34969951c8df0c3193c3e75553d5a38b37" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/shuchkin/simplexlsx/zipball/55cdcb34969951c8df0c3193c3e75553d5a38b37", + "reference": "55cdcb34969951c8df0c3193c3e75553d5a38b37", + "shasum": "" + }, + "require": { + "ext-libxml": "*", + "ext-simplexml": "*", + "ext-zlib": "*" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/SimpleXLSX.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Sergey Shuchkin (SMSPILOT)", + "email": "sergey.shuchkin@gmail.com", + "homepage": "http://www.shuchkin.ru/" + } + ], + "description": "Parse and retrieve data from Excel XLSx files. MS Excel 2007 workbooks PHP reader.", + "homepage": "https://github.com/shuchkin/simplexlsx", + "keywords": [ + "backend", + "excel", + "parser", + "php", + "xlsx" + ], + "time": "2019-11-06T23:47:40+00:00" } ], "packages-dev": [ @@ -283,39 +432,136 @@ ], "time": "2015-06-14T21:17:01+00:00" }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2017-09-11T18:02:19+00:00" + }, { "name": "phpdocumentor/reflection-docblock", - "version": "2.0.4", + "version": "3.3.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" + "reference": "bf329f6c1aadea3299f08ee804682b7c45b326a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/bf329f6c1aadea3299f08ee804682b7c45b326a2", + "reference": "bf329f6c1aadea3299f08ee804682b7c45b326a2", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.6 || ^7.0", + "phpdocumentor/reflection-common": "^1.0.0", + "phpdocumentor/type-resolver": "^0.4.0", + "webmozart/assert": "^1.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^4.4" }, - "suggest": { - "dflydev/markdown": "~1.0", - "erusev/parsedown": "~1.0" + "type": "library", + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2017-11-10T14:09:06+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.4.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { - "psr-0": { - "phpDocumentor": [ + "psr-4": { + "phpDocumentor\\Reflection\\": [ "src/" ] } @@ -327,42 +573,45 @@ "authors": [ { "name": "Mike van Riel", - "email": "mike.vanriel@naenius.com" + "email": "me@mikevanriel.com" } ], - "time": "2015-02-03T12:10:50+00:00" + "time": "2017-07-14T14:27:02+00:00" }, { "name": "phpspec/prophecy", - "version": "v1.5.0", + "version": "1.9.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7" + "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4745ded9307786b730d7a60df5cb5a6c43cf95f7", - "reference": "4745ded9307786b730d7a60df5cb5a6c43cf95f7", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/f6811d96d97bdf400077a0cc100ae56aa32b9203", + "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", - "phpdocumentor/reflection-docblock": "~2.0", - "sebastian/comparator": "~1.1" + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", + "sebastian/comparator": "^1.1|^2.0|^3.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, "require-dev": { - "phpspec/phpspec": "~2.0" + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "1.8.x-dev" } }, "autoload": { - "psr-0": { - "Prophecy\\": "src/" + "psr-4": { + "Prophecy\\": "src/Prophecy" } }, "notification-url": "https://packagist.org/downloads/", @@ -390,7 +639,7 @@ "spy", "stub" ], - "time": "2015-08-13T10:07:40+00:00" + "time": "2019-10-03T11:07:50+00:00" }, { "name": "phpunit/php-code-coverage", @@ -456,16 +705,16 @@ }, { "name": "phpunit/php-file-iterator", - "version": "1.4.1", + "version": "1.4.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", - "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", "shasum": "" }, "require": { @@ -499,7 +748,7 @@ "filesystem", "iterator" ], - "time": "2015-06-21T13:08:43+00:00" + "time": "2017-11-27T13:52:08+00:00" }, { "name": "phpunit/php-text-template", @@ -544,22 +793,30 @@ }, { "name": "phpunit/php-timer", - "version": "1.0.7", + "version": "1.0.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -581,20 +838,20 @@ "keywords": [ "timer" ], - "time": "2015-06-21T08:01:12+00:00" + "time": "2017-02-26T11:10:40+00:00" }, { "name": "phpunit/php-token-stream", - "version": "1.4.8", + "version": "1.4.12", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" + "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1ce90ba27c42e4e44e6d8458241466380b51fa16", + "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16", "shasum": "" }, "require": { @@ -630,20 +887,20 @@ "keywords": [ "tokenizer" ], - "time": "2015-09-15T10:49:45+00:00" + "time": "2017-12-04T08:55:13+00:00" }, { "name": "phpunit/phpunit", - "version": "4.8.19", + "version": "4.8.36", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "b2caaf8947aba5e002d42126723e9d69795f32b4" + "reference": "46023de9a91eec7dfb06cc56cb4e260017298517" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b2caaf8947aba5e002d42126723e9d69795f32b4", - "reference": "b2caaf8947aba5e002d42126723e9d69795f32b4", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/46023de9a91eec7dfb06cc56cb4e260017298517", + "reference": "46023de9a91eec7dfb06cc56cb4e260017298517", "shasum": "" }, "require": { @@ -657,9 +914,9 @@ "phpunit/php-code-coverage": "~2.1", "phpunit/php-file-iterator": "~1.4", "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": ">=1.0.6", + "phpunit/php-timer": "^1.0.6", "phpunit/phpunit-mock-objects": "~2.3", - "sebastian/comparator": "~1.1", + "sebastian/comparator": "~1.2.2", "sebastian/diff": "~1.2", "sebastian/environment": "~1.3", "sebastian/exporter": "~1.2", @@ -702,7 +959,7 @@ "testing", "xunit" ], - "time": "2015-11-30T08:18:59+00:00" + "time": "2017-06-21T08:07:12+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -762,22 +1019,22 @@ }, { "name": "sebastian/comparator", - "version": "1.2.0", + "version": "1.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", "shasum": "" }, "require": { "php": ">=5.3.3", "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2" + "sebastian/exporter": "~1.2 || ~2.0" }, "require-dev": { "phpunit/phpunit": "~4.4" @@ -822,32 +1079,32 @@ "compare", "equality" ], - "time": "2015-07-26T15:48:44+00:00" + "time": "2017-01-29T09:50:25+00:00" }, { "name": "sebastian/diff", - "version": "1.3.0", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3" + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3", - "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -870,31 +1127,31 @@ } ], "description": "Diff implementation", - "homepage": "http://www.github.com/sebastianbergmann/diff", + "homepage": "https://github.com/sebastianbergmann/diff", "keywords": [ "diff" ], - "time": "2015-02-22T15:13:53+00:00" + "time": "2017-05-22T07:24:03+00:00" }, { "name": "sebastian/environment", - "version": "1.3.2", + "version": "1.3.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44" + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6324c907ce7a52478eeeaede764f48733ef5ae44", - "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^4.8 || ^5.0" }, "type": "library", "extra": { @@ -924,20 +1181,20 @@ "environment", "hhvm" ], - "time": "2015-08-03T06:14:51+00:00" + "time": "2016-08-18T05:49:44+00:00" }, { "name": "sebastian/exporter", - "version": "1.2.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "7ae5513327cb536431847bcc0c10edba2701064e" + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", - "reference": "7ae5513327cb536431847bcc0c10edba2701064e", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", "shasum": "" }, "require": { @@ -945,12 +1202,13 @@ "sebastian/recursion-context": "~1.0" }, "require-dev": { + "ext-mbstring": "*", "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { @@ -990,7 +1248,7 @@ "export", "exporter" ], - "time": "2015-06-21T07:55:53+00:00" + "time": "2016-06-17T09:04:28+00:00" }, { "name": "sebastian/global-state", @@ -1045,16 +1303,16 @@ }, { "name": "sebastian/recursion-context", - "version": "1.0.1", + "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "994d4a811bafe801fb06dccbee797863ba2792ba" + "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/994d4a811bafe801fb06dccbee797863ba2792ba", - "reference": "994d4a811bafe801fb06dccbee797863ba2792ba", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7", + "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7", "shasum": "" }, "require": { @@ -1094,7 +1352,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-06-21T08:04:50+00:00" + "time": "2016-10-03T07:41:43+00:00" }, { "name": "sebastian/version", @@ -1131,27 +1389,95 @@ "homepage": "https://github.com/sebastianbergmann/version", "time": "2015-06-21T13:59:46+00:00" }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.12.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "550ebaac289296ce228a706d0867afc34687e3f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/550ebaac289296ce228a706d0867afc34687e3f4", + "reference": "550ebaac289296ce228a706d0867afc34687e3f4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.12-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2019-08-06T08:03:45+00:00" + }, { "name": "symfony/yaml", - "version": "v2.8.0", + "version": "v3.4.33", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "f79824187de95064a2f5038904c4d7f0227fedb5" + "reference": "dab657db15207879217fc81df4f875947bf68804" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/f79824187de95064a2f5038904c4d7f0227fedb5", - "reference": "f79824187de95064a2f5038904c4d7f0227fedb5", + "url": "https://api.github.com/repos/symfony/yaml/zipball/dab657db15207879217fc81df4f875947bf68804", + "reference": "dab657db15207879217fc81df4f875947bf68804", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": "^5.5.9|>=7.0.8", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/console": "<3.4" + }, + "require-dev": { + "symfony/console": "~3.4|~4.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.4-dev" } }, "autoload": { @@ -1178,7 +1504,57 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2015-11-30T12:35:10+00:00" + "time": "2019-10-24T15:33:53+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.5.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "88e6d84706d09a236046d686bbea96f07b3a34f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/88e6d84706d09a236046d686bbea96f07b3a34f4", + "reference": "88e6d84706d09a236046d686bbea96f07b3a34f4", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0", + "symfony/polyfill-ctype": "^1.8" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.36 || ^7.5.13" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2019-08-24T08:43:50+00:00" } ], "aliases": [], diff --git a/include/controllers/activity_controller.php b/include/controllers/activity_controller.php index a93e4a45..54ff4f39 100755 --- a/include/controllers/activity_controller.php +++ b/include/controllers/activity_controller.php @@ -215,46 +215,138 @@ public function opretAktivitet() $this->page->model = $this->model; } - - public function importActivities() + + /** + * Handle import and export of activity data + * + * @access public + * @return void + */ + public function importExportActivities(){ + $session = $this->dic->get('Session'); + + // if it's not a post request, don't do anything + if (!$this->page->request->isPost()){ + return; + } + $post = $this->page->request->post; + + if (isset($post->importactivities)) { + $this->uploadActivities(); + $session->activity_data = $this->model->activity_data; + } + + if ((isset($post->import_add) || isset($post->import_replace)) && isset($session->activity_data)) { + $this->saveActivities($session->activity_data, isset($post->import_replace)); + $session->delete('activity_data'); + } + + if (isset($post->exportactivities)){ + $this->exportActivities(); + } + + if (isset($session->activity_data)) { + $this->page->activity_data = $session->activity_data; + $this->page->activity_header = $this->model->getActivityHeader(); + } + + } + + /** + * Imports activities from a submitted spreadsheet + * + * @access private + * @return void + */ + private function uploadActivities() { - $user = $this->model->getLoggedInUser(); - - if ($this->page->request->isPost()) { - $post = $this->page->request->post; - - /* - Nothing in $post... - foreach ($post as $key => $value) { - echo "Field ".htmlspecialchars($key)." is ".htmlspecialchars($value)."
"; - } - exit; - */ - - if (empty($post->importactivities)) { // skal jeg bruge file eller importactivities ? - $this->errorMessage('Ingen Excel fil valgt.'); - $this->hardRedirect($this->url('aktiviteterhome')); + // Did the user submit a file + $file = isset($_FILES['activities']) ? $_FILES['activities'] : null; + if($file == null || $file['error'] == 4) { + $this->errorMessage('Ingen Excel fil valgt.'); + return; + } + + // Parse the file depending on file type or give an error if type isn't known + list($name, $type) = explode(".", $file['name']); + switch ($type) { + case "xlsx": + if ( !$data = SimpleXLSX::parse($file['tmp_name'])->rows() ) { + $this->errorMessage(SimpleXLSX::parseError()); + } + break; + case "xls": + if ( !$data = SimpleXLS::parse($file['tmp_name'])->rows() ) { + $this->errorMessage(SimpleXLS::parseError()); + } + break; + case "csv": + $data = self::parseCSV($file['tmp_name']); + break; + default: + $this->errorMessage('Fil er ikke korrekt type'); + return false; + } + + unset($data[0]); // remove column names from data + $this->model->activity_data = $this->model->parseActivityData($data); + $this->successMessage('Aktiviteter blev uploadet, men er IKKE gemt'); + } + + private static function parseCSV($file){ + $csv = file_get_contents($file); + // $lb = "\n"; + // $delim = ";"; + $lines = explode(";\n", $csv); + foreach ($lines as $line) { + preg_match_all("/\"([^\"]*)\"/",$line,$matches); + if (count($matches[1]) > 0) { + $data[] = $matches[1]; } - else { - try { - if ($this->model->importActivities()) { - $this->successMessage('Aktiviteter blev importeret.'); - $this->log("Aktiviter blev importeret af {$this->model->getLoggedInUser()->user}", 'Aktivitet', $this->model->getLoggedInUser()); - $this->hardRedirect($this->url('aktiviteterhome')); - } else - { - $this->errorMessage('Kunne ikke importere aktiviteter.'); - $this->hardRedirect($this->url('aktiviteterhome')); - } - } catch (Exception $e) { + } + return $data; + } + + /** + * Save uploaded data in the database + * + * @access private + * @return void + */ + private function saveActivities($data, $replace = false) { + try { + $this->model->saveActivities($data, $replace); + $this->successMessage('Aktiviteter blev importeret.'); + $this->log("Aktiviter blev importeret", 'Aktivitet', $this->model->getLoggedInUser()); + } catch (FrameworkException $e) { + if ($e->getCode() == 1) { + $this->errorMessage('Kan ikke udskifte aktiviteter efter der er oprettet afviklinger'); + } else { $this->errorMessage('Kunne ikke importere aktiviteter.'); - $this->hardRedirect($this->url('aktiviteterhome')); } + $this->errorMessage('Framework Exception'); + $e->logException(); + } catch (Exception $e) { + $this->errorMessage('Kunne ikke importere aktiviteter.'); + error_log($e->getMessage()); + } + } + + private function exportActivities(){ + $activities = $this->model->loadActivities(); + header('Content-Type: text/csv;charset=utf-8'); + header('Content-Disposition: attachment;filename="aktiviteter.csv"'); + header('Cache-Control: max-age=0'); + + echo chr(0xEF).chr(0xBB).chr(0xBF); // UTF8 BOM + foreach($activities as $activity) { + foreach($activity as $cell) { + echo "\"$cell\";"; } + echo "\n"; } - - $this->page->model = $this->model; - } + exit; + } /** * creates a scheduling for an activity diff --git a/include/controllers/participant_controller.php b/include/controllers/participant_controller.php index 50f1135f..28a4b7ef 100755 --- a/include/controllers/participant_controller.php +++ b/include/controllers/participant_controller.php @@ -384,6 +384,7 @@ protected function genSearchVars() 'supergds' => '', 'flere_gdsvagter' => '', 'sovesal' => '', + 'sober_sleeping', 'udeblevet' => '', 'rabat' => '', 'knutepunkt_bil' => '', @@ -471,24 +472,31 @@ public function visTextedit() $this->page->setTemplate('noResults'); } else { $this->page->textfield = $this->vars['textfield']; - $var = $this->page->textfield; - $this->page->textcontent = $deltager->$var; $this->page->deltager = $deltager; - switch ($var) { - case 'admin_note': - $this->page->field = 'noter om deltageren'; - break; - case 'deltager_note': - $this->page->field = 'beskeder fra deltageren'; - break; - case 'beskeder': - $this->page->field = 'beskeder til deltageren'; - break; - case 'paid_note': - $this->page->field = 'økonomi-noter'; - break; - default: - $this->page->field = e($var); + + if (preg_match("/deltager_note_(\w+)/",$this->page->textfield,$matches)) { + $var = $matches[1]; + $this->page->textcontent = $deltager->note->$var->content; + $this->page->field = $deltager->note->$var->name; + } else { + $var = $this->page->textfield; + $this->page->textcontent = $deltager->$var; + switch ($var) { + case 'admin_note': + $this->page->field = 'noter om deltageren'; + break; + case 'deltager_note': + $this->page->field = 'beskeder fra deltageren'; + break; + case 'beskeder': + $this->page->field = 'beskeder til deltageren'; + break; + case 'paid_note': + $this->page->field = 'økonomi-noter'; + break; + default: + $this->page->field = e($var); + } } $this->page->setTitle('Rediger ' . strip_tags($this->page->field)); } @@ -1877,4 +1885,8 @@ public function checkForDoubleBookings() { $this->page->double_booked_participants = $this->model->findDoubleBookedParticipants(); } + + public function showRefund(){ + $this->page->rfundees = $this->model->findPeopleNeedingRefund(); + } } diff --git a/include/controllers/photo_controller.php b/include/controllers/photo_controller.php index 8b7efb1b..23bbe3e9 100755 --- a/include/controllers/photo_controller.php +++ b/include/controllers/photo_controller.php @@ -199,4 +199,59 @@ public function seeMissingPhotos() $this->hardRedirect($this->url('show_search_result')); } + + /** + * Download all uploaded photos with ID and name of organizer, + * in a zip archive + * + * @access public + * @return void + */ + public function downloadPhotos(){ + // Path and file names + $path = PUBLIC_PATH . 'uploads/'; + $archive = $path.'photos.zip'; + + // Get all croped photos + $photos = glob($path.'photo-cropped-*'); + + if (!is_array($photos)) { + echo "Ingen fotos er blevet uploaded"; + exit; + } + + $participant_model = $this->model->factory('Participant'); + + // create new zip archive + $zip = new ZipArchive(); + $zip->open($archive, ZIPARCHIVE::CREATE ); + + foreach ($photos as $photo){ + // Get identifier and file type from photo + preg_match("/photo-cropped-(.+)\.(.+)/", $photo, $matches); + $identifier = $matches[1]; + $filetype = $matches[2]; + + // Find the participant(organizer) the photo belongs to + if ($participant = $participant_model->getParticipantFromPhotoidentifier($identifier)){ + // Add photo to zip file, with a more useful name + $name = preg_replace("/\s+/","_", $participant->getName() ); + $filename = "{$participant->id}_$name.$filetype"; + $zip->addFile($photo,$filename); + } + + } + // Close the archive + $zip->close(); + // Set headers for downloading the zip file + header("Content-type: application/zip"); + header("Content-Disposition: attachment; filename=Arrangør_billeder_".date("Ymd").".zip"); + header("Pragma: no-cache"); + header("Expires: 0"); + // Add zip file to the response + readfile($archive); + // Delete the zip file afterwards + unlink($archive); + exit; + } } diff --git a/include/controllers/wear_controller.php b/include/controllers/wear_controller.php index f04f5728..bc9a3aa3 100755 --- a/include/controllers/wear_controller.php +++ b/include/controllers/wear_controller.php @@ -75,6 +75,7 @@ public function showWear() { if (empty($this->vars['id']) || !($wear = $this->model->findEntity('Wear', $this->vars['id']))) { $this->page->setTemplate('noResults'); } else { + $this->page->model = $this->model; $this->page->wear = $wear; } } @@ -182,7 +183,7 @@ public function editWear() { public function wearBreakdown() { $this->page->wear_data = $this->model->getWearBreakdown(); - $this->page->wear_pricetypes = $this->model->getAllWearprices(); + $this->page->wear_types = $this->model->getAllWearTypes(); $this->page->model = $this->model; $this->page->sizes = $this->model->getWearSizes(); $this->page->size_count = count($this->page->sizes); @@ -250,8 +251,8 @@ public function detailedMiniList() $size = ((!empty($this->vars['size'])) ? strtoupper($this->vars['size']) : null); $this->page->orders = $this->model->getWearOrders($type, $size); $this->page->size = $size; - $this->page->type = (($type) ? $this->model->findEntity('WearPriser', $type) : null); - $this->page->headname = $type ? $this->page->type->getWear()->navn . '(' . $this->page->type->getCategory()->navn . ')' : ''; + $this->page->type = (($type) ? $this->model->findEntity('Wear', $type) : null); + $this->page->headname = $type ? $this->page->type->navn : ''; $this->page->headsize = $size ? 'str. ' . $size : ''; } diff --git a/include/entities/deltagere.php b/include/entities/deltagere.php index 3b945941..7cc9b895 100755 --- a/include/entities/deltagere.php +++ b/include/entities/deltagere.php @@ -93,6 +93,25 @@ class Deltagere extends DBObject implements AgeFulfilment 'ungdomsskole' => 'Ungdomsskole/klub', ); + /** + * Contains display names for different notes + * + * @var array + */ + static protected $note_names = [ + 'da' => [ + 'comment' => 'Andre kommentarer', + 'gds' => 'Kommentarer til GDS', + 'junior_ward' => 'Værge kontakt' + ], + 'en' => [ + 'comment' => 'Other comments', + 'gds' => 'Comments regarding GDS', + 'junior_ward' => 'Ward contact' + ] + ]; + + /** * Name of database table * @@ -125,6 +144,12 @@ public function __get($var) return $this->calculated_age = $diff->format('%y'); + } elseif($var == 'note') { + if (!isset($this->note_obj)) { + $this->note_obj = self::parseNote($this->deltager_note); + } + return $this->note_obj; + } elseif (array_key_exists($var, $this->storage)) { return parent::__get($var); @@ -201,6 +226,8 @@ public function wildcardSearch($input) { case 'arbejdsomraade': case 'ungdomsklub': case 'scenarie': + case 'skills': + case 'deltager_note': $select->setWhereOr($field, 'like', "%{$bit}%"); break; default: @@ -1615,4 +1642,25 @@ public function isSingleDayParticipant() return $x->isEntrance() && !$x->isDayTicket(); })) === 0; } + + public function setNote($name, $content) { + $note = json_decode($this->deltager_note); + $note->$name = $content; + parent::__set('deltager_note', json_encode($note)); + } + + public static function parseNote($note){ + if ($jsnon_note = json_decode($note)) { + $note_obj = new stdClass(); + foreach($jsnon_note as $key => $value) { + $note_obj->$key = new stdClass(); + $note_obj->$key->content = $value; + $note_obj->$key->name = isset(self::$note_names['da'][$key]) ? self::$note_names['da'][$key] : $key; + $note_obj->$key->name_en = isset(self::$note_names['en'][$key]) ? self::$note_names['en'][$key] : $key; + } + return $note_obj; + } + + return null; + } } diff --git a/include/entities/wear.php b/include/entities/wear.php index 1b1d2474..615a201f 100755 --- a/include/entities/wear.php +++ b/include/entities/wear.php @@ -109,6 +109,56 @@ public function getWearpriser($kategori = null) return $this->createEntity('WearPriser')->findBySelectMany($select); } + /** + * returns array of wear prices for the wear object, with only one price for organizers + * + * @param object $kategori - BrugerKategorier entity + * @access public + * @return array + */ + public function getWearpriserSquashed() + { + if (!$this->isLoaded()) { + return array(); + } + + $select = $this->createEntity('BrugerKategorier')->getSelect(); + $select->setWhere('arrangoer','=','ja'); + $organizer_cats = $this->createEntity('BrugerKategorier')->findBySelectMany($select); + + $select = $this->createEntity('WearPriser')->getSelect(); + $select->setLeftJoin('brugerkategorier','brugerkategori_id', 'brugerkategorier.id'); + $select->setWhere('wear_id', '=', $this->id); + $select->setWhere('arrangoer','=','nej'); + $select->setField('wearpriser.id'); + $select->setField('wearpriser.wear_id'); + $select->setField('wearpriser.brugerkategori_id'); + $select->setField('wearpriser.pris'); + $participant_prices = $this->createEntity('WearPriser')->findBySelectMany($select); + + $select = $this->createEntity('WearPriser')->getSelect(); + $select->setLeftJoin('brugerkategorier','brugerkategori_id', 'brugerkategorier.id'); + $select->setWhere('wear_id', '=', $this->id); + $select->setWhere('arrangoer','=','ja'); + $select->setField('wearpriser.id'); + $select->setField('wearpriser.wear_id'); + $select->setField('wearpriser.brugerkategori_id'); + $select->setField('wearpriser.pris'); + $organizer_prices = $this->createEntity('WearPriser')->findBySelectMany($select); + + if (count($organizer_cats) == count($organizer_prices)){ + $organizer_price = (object) [ + 'id' => 0, + 'brugerkategori_id' => 0, + 'wear_id' => $this->id, + 'pris' => $organizer_prices[0]->pris + ]; + $participant_prices[] = $organizer_price; + return $participant_prices; + } + return array_merge($participant_prices,$organizer_prices); + } + /** * returns array of user category id's that already have prices * set for them, for this wear item @@ -119,7 +169,7 @@ public function getWearpriser($kategori = null) public function getUsedUserCategories() { $return = array(); - $prices = $this->getWearPriser(); + $prices = $this->getWearpriserSquashed(); foreach ($prices as $price) { $return[] = $price->brugerkategori_id; diff --git a/include/framework/dbobject.php b/include/framework/dbobject.php index d7aad5e2..2a3367e5 100755 --- a/include/framework/dbobject.php +++ b/include/framework/dbobject.php @@ -568,6 +568,21 @@ public function delete() return true; } + /** + * deletes ALL elements of the curret object type from the database + * + * @access public + * @return bool + */ + public function deleteALL(){ + $query = "DELETE FROM {$this->quoteTable($this->tablename)}"; + $this->getDB()->exec($query); + $this->invalidate(); + $query = "ALTER TABLE {$this->quoteTable($this->tablename)} AUTO_INCREMENT = 1"; + $this->getDB()->exec($query); + return true; + } + //{{{ methods dealing with loading objects and invalidating them /** * creates a number of new objects and calls loadObject to fill them with data diff --git a/include/framework/layout.php b/include/framework/layout.php index 256e7b98..9eba50db 100755 --- a/include/framework/layout.php +++ b/include/framework/layout.php @@ -433,12 +433,14 @@ protected function generateMenu() {
  • Checkin registrering
  • Rediger deltagertyper
  • Tjek for dobbelt-bookinger
  • +
  • Deltagere der skal have penge tilbage
  • HTML; if ($this->user->hasRole('Infonaut') || $this->user->hasRole('Admin')) { $return .= <<ID skabeloner
  • Arrangører med manglende ID-billede
  • +
  • Hent billeder til ID
  • HTML; } @@ -453,7 +455,7 @@ protected function generateMenu() {
  • Alle aktiviteter
  • Grafisk oversigt
  • Opret aktivitet
  • -
  • Importer aktiviter
  • +
  • Importer/eksporter aktiviter
  • Afstemnings-statistik
  • Tilmeldings-statistik

  • diff --git a/include/framework/routes.php b/include/framework/routes.php index dd604bb4..6d833987 100755 --- a/include/framework/routes.php +++ b/include/framework/routes.php @@ -147,6 +147,7 @@ public function __construct(Config $config) $this->routes['participant_signup_email'] = array('url' => 'participant/send-signup-email/:id:', 'controller' => 'Participant', 'method' => 'sendSignupEmail'); $this->routes['participant_check_for_voucher'] = array('url' => 'participant/has-vouchers/:participant_id:', 'controller' => 'Participant', 'method' => 'checkForVouchers'); $this->routes['show_double_bookings'] = array('url' => 'participant/check-double-bookings', 'controller' => 'Participant', 'method' => 'checkForDoubleBookings'); + $this->routes['show_refund'] = array('url' => 'participant/show-refund', 'controller' => 'Participant', 'method' => 'showRefund'); $this->routes['participant_reset_password'] = array('url' => 'participant/reset-password/:hash:', 'controller' => 'Participant', 'method' => 'resetParticipantPassword'); @@ -157,6 +158,7 @@ public function __construct(Config $config) $this->routes['send_photo_upload_reminders'] = ['url' => 'photo/send-reminders', 'controller' => 'Photo', 'method' => 'sendUploadReminders']; $this->routes['show_missing_photo'] = ['url' => 'photo/see-missing-photo', 'controller' => 'Photo', 'method' => 'seeMissingPhotos']; + $this->routes['photo_download'] = ['url' => 'photo/download', 'controller' => 'Photo', 'method' => 'downloadPhotos']; // id template stuff $this->routes['template_editing'] = ['url' => 'id-templates', 'controller' => 'IdTemplate', 'method' => 'showEdit']; @@ -200,7 +202,7 @@ public function __construct(Config $config) $this->routes['edit_aktivitet'] = array('url' => 'aktivitet/edit/:id:', 'controller' => 'Activity', 'method' => 'editAktivitet'); $this->routes['edit_afvikling'] = array('url' => 'aktivitet/editafvikling/:id:', 'controller' => 'Activity', 'method' => 'editAfvikling'); $this->routes['opret_aktivitet'] = array('url' => 'aktivitet/opret/', 'controller' => 'Activity', 'method' => 'opretAktivitet'); - $this->routes['import_activities'] = array('url' => 'aktivitet/importer/', 'controller' => 'Activity', 'method' => 'importActivities'); + $this->routes['import_activities'] = array('url' => 'aktivitet/importer_eksporter/', 'controller' => 'Activity', 'method' => 'importExportActivities'); $this->routes['opret_afvikling'] = array('url' => 'aktivitet/opretafvikling/:aktivitet_id:', 'controller' => 'Activity', 'method' => 'opretAfvikling'); $this->routes['slet_aktivitet'] = array('url' => 'aktivitet/slet/:id:', 'controller' => 'Activity', 'method' => 'sletAktivitet'); $this->routes['slet_afvikling'] = array('url' => 'aktivitet/sletafvikling/:id:', 'controller' => 'Activity', 'method' => 'sletAfvikling'); diff --git a/include/helpers/view_helper.php b/include/helpers/view_helper.php index cf22a49c..2915f8f3 100755 --- a/include/helpers/view_helper.php +++ b/include/helpers/view_helper.php @@ -127,13 +127,15 @@ public function deltagerSearchbox(array $search_vars, Model $model) { - Sprog: + + Sprog: HTML; - foreach ($model->getAvailableSprog() as $sprog) { $output .= " - - + "; } @@ -170,11 +172,15 @@ public function deltagerSearchbox(array $search_vars, Model $model) { Annulleret: {$this->view->genSelect('deltager_search[annulled]', array('', 'nej','ja'))} Ønsket antal GDS: - Ungdomsskole: - Arrangørområde: - Scenarie: - Skills: - + + Ungdomsskole: + Arrangørområde: + Scenarie: + + + Skills: + Noter: +
    diff --git a/include/migrations/1027-deltager-note-json.sql b/include/migrations/1027-deltager-note-json.sql new file mode 100644 index 00000000..deaf813f --- /dev/null +++ b/include/migrations/1027-deltager-note-json.sql @@ -0,0 +1,2 @@ +UPDATE deltagere SET deltager_note = CONCAT('{"note" :"', deltager_note, '"}' ); +ALTER TABLE deltagere MODIFY deltager_note JSON; \ No newline at end of file diff --git a/include/migrations/1028-sober-sleeping.sql b/include/migrations/1028-sober-sleeping.sql new file mode 100644 index 00000000..6c5da115 --- /dev/null +++ b/include/migrations/1028-sober-sleeping.sql @@ -0,0 +1,2 @@ +ALTER TABLE deltagere CHANGE dancing_with_the_clans sober_sleeping enum('ja','nej'); +ALTER TABLE deltagere DROP COLUMN game_reallocation_participant; \ No newline at end of file diff --git a/include/models/activity_model.php b/include/models/activity_model.php index 09f74451..05a901db 100755 --- a/include/models/activity_model.php +++ b/include/models/activity_model.php @@ -171,50 +171,232 @@ public function opretAktivitet(RequestVars $post) return $activity; } + + public function getActivityHeader(){ + $activity = $this->createEntity('Aktiviteter'); + $fields = $activity->getColumns(); + $fields[] = 'age_min'; + $fields[] = 'age_max'; + return $fields; + } + + public static function parseActivityData($data){ + $result = []; + foreach ($data as $row) { + $result[] = self::parseActivityRow($row); + } + return $result; + } + + public static function parseActivityRow($row){ + for($i = 0; $i <= 26; $i++){ + $row[$i] = isset($row[$i]) ? $row[$i] : ""; + } + + $result_row = []; + $result_row['id'] = is_numeric($row[26]) ? intval($row[26]) : null; + $result_row['navn'] = $row[1]; + $result_row['kan_tilmeldes'] = preg_match("/nej/", strtolower($row[24])) == 1 ? 'nej' : 'ja';; + $result_row['note'] = $row[22]; + $result_row['foromtale'] = $row[17]; + preg_match("/\d+/", $row[12], $matches); + $result_row['varighed_per_afvikling'] = isset($matches[0]) ? $matches[0] : 0; + preg_match("/\d+/", $row[6], $matches); + $result_row['min_deltagere_per_hold'] = isset($matches[0]) ? $matches[0] : 0; + preg_match("/\d+/", $row[7], $matches); + $result_row['max_deltagere_per_hold'] = isset($matches[0]) ? $matches[0] : 0; + preg_match("/\d+/", $row[8], $matches); + $result_row['spilledere_per_hold'] = isset($matches[0]) ? $matches[0] : 0; + preg_match("/\d+/", $row[9], $matches); + $result_row['pris'] = isset($matches[0]) ? $matches[0] : 0; + $result_row['lokale_eksklusiv'] = preg_match("/nej/", strtolower($row[19])) == 1 ? 'nej' : 'ja'; + $result_row['wp_link'] = is_numeric($row[26]) ? intval($row[26]) : 0; + $result_row['teaser_dk'] = $row[13]; + $result_row['teaser_en'] = $row[14]; + $result_row['title_en'] = $row[2];; + $result_row['description_en'] = $row[18]; + $result_row['author'] = $row[3];; + // parsing type from input + $type = strtolower($row[4]); + if (preg_match("/junior/", $type)) { + $type = 'junior'; + } elseif (preg_match("/live/", $type)) { + $type = 'live'; + } elseif (preg_match("/brætspil|braet/", $type)) { + $type = 'braet'; + } elseif(preg_match("/rolle(spil)?/", $type)) { + $type = 'rolle'; + } elseif (preg_match("/figur/", $type)) { + $type = 'figur'; + } elseif(preg_match("/magic/", $type)) { + $type = 'magic'; + } elseif(preg_match("/workshop/", $type)) { + $type = 'workshop'; + } elseif(preg_match("/system/", $type) || preg_match("/spillederbriefing/", strtolower($result_row['navn']))) { + $type = 'system'; + } else { + $type = 'ottoviteter'; + } + $result_row['type'] = $type; + + $result_row['tids_eksklusiv'] = preg_match("/nej/", strtolower($row[20])) == 1 ? 'nej' : 'ja'; + + $sprog = preg_match("/d/", strtolower($row[5])) == 1 ? 'dansk' : ''; + $engelsk = $sprog == '' ? 'engelsk' : '+engelsk'; + $sprog .= preg_match("/e/", strtolower($row[5])) == 1 ? $engelsk : ''; + $result_row['sprog'] = $sprog; + + $result_row['replayable'] = preg_match("/ja/", strtolower($row[15])) == 1 ? 'nej' : 'ja'; // If not one-time event + $result_row['updated'] = self::parseDateTime($row[0]); + $result_row['hidden'] = preg_match("/ja/", strtolower($row[21])) == 1 ? 'ja' : 'nej'; + preg_match("/\d/", $row[23], $matches); + $result_row['karmatype'] = isset($matches[0]) ? $matches[0] : 0; + preg_match("/\d+/", $row[16], $matches); + $result_row['max_signups'] = isset($matches[0]) ? $matches[0] : 0; + $result_row['age_min'] = $row[10]; + $result_row['age_max'] = $row[11]; + + return $result_row; + } + + /** + * Simple method for parsing timestamp or just give current time + * + * @return parsed timestamp or if parsing failed + */ + private static function parseDateTime($dateTime){ + // parse time + if (preg_match("/\b(\d{2})[:\.](\d{2})[:\.](\d{2})\b/",$dateTime, $matches)){ + $time = "$matches[1]:$matches[2]:$matches[3]"; + } else { + $time = date("H:i:s"); + } + + // parse date + if (preg_match("/(\d{4})[-\/](\d{2})[-\/](\d{2})/",$dateTime, $matches)){ + $date = "$matches[1]-$matches[2]-$matches[3]"; + } elseif (preg_match("/(\d{2})[-\/](\d{2})[-\/](\d{4})/",$dateTime, $matches)){ + $date = "$matches[3]-$matches[2]-$matches[1]"; + } else { + $date = date("Y-m-d"); + } + + return "$date $time"; + } - public function importActivities() - { - $activity = $this->createEntity('Aktiviteter'); - // Required values - $activity->updated = date('Y-m-d H:i:s'); - $activity->navn = "Test"; - $activity->title_en = "Test"; - $activity->author = "Text"; - $activity->type = 'rolle'; - $activity->sprog = 'dansk'; - $activity->min_deltagere_per_hold = 1; - $activity->max_deltagere_per_hold = 1; - $activity->spilledere_per_hold = 1; - $activity->pris = 0; - $activity->varighed_per_afvikling = 1; - $activity->teaser_dk = "TeaserDK"; - $activity->teaser_en = "TeaserEN"; - $activity->replayable = 'nej'; - $activity->max_signups = 0; - $activity->foromtale = "foromtale"; // Can be null - $activity->description_en = "DescriptionEN"; - - // Default values: - $activity->kan_tilmeldes = 'ja'; - $activity->note = NULL; - $activity->lokale_eksklusiv = 'ja'; - $activity->wp_link = 0; - $activity->tids_eksklusiv = 'ja'; - - // Default values (which are not visible under "Opret Aktivitet") - $activity->hidden = 'nej'; - $activity->karmatype = 0; - - if (!$activity->insert()) { - return false; + public function saveActivities($data, $replace = false) { + if($replace === true) { + // Check if we have any afviklinger before trying to replace activities + if ($this->createEntity('Afviklinger')->findAll() + || $this->createEntity('AfviklingerMultiblok')->findAll()) + { + throw new FrameworkException("Cannot replace activities after afviklinger has been created", 1); + } + + $activity = $this->createEntity('Aktiviteter'); + $activity->deleteAll(); } - - // Optional values: - //$activity->setMinAge(7); - //$activity->setMaxAge(50); - - return true; - } + + $errors = 0; + foreach($data as $row) { + $activity = $this->createEntity('Aktiviteter'); + if (!$replace) { + $exists = $activity->findById($row['id']); + } else { + $exists = false; + } + + foreach ($row as $key => $value){ + if ($key === 'age_min' || $key === 'age_max'){ + continue; + } + + $activity->$key = $value; + } + + if ($exists) { + $activity->update(); + } else { + $activity->insert(); + } + + // Values that have to be set after the activity is inserted + // since they are in a different table with foreign key constraint + if ($row['age_min'] !== '') { + $activity->setMinAge($row['age_min']); + } + if ($row['age_max'] !== '') { + $activity->setMaxAge($row['age_max']); + } + } + } + + /** + * Load all activities from database + * for use with export function + */ + public function loadActivities() + { + $activity = $this->createEntity('Aktiviteter'); + //$columns = $activity->getColumns(); + $activities = $activity->findAll(); + $columns = [ + 'updated', //0 + 'navn', //1 + 'title_en', //2 + 'author', //3 + 'type', //4 + 'sprog', //5 + 'min_deltagere_per_hold', //6 + 'max_deltagere_per_hold', //7 + 'spilledere_per_hold', //8 + 'pris', //9 + 'age_min', //10 + 'age_max', //11 + 'varighed_per_afvikling', //12 + 'teaser_dk', //13 + 'teaser_en', //14 + 'onetime', //15 inverse of replayable + 'max_signups', //16 + 'foromtale', //17 + 'description_en', //18 + 'lokale_eksklusiv', //19 + 'tids_eksklusiv', //20 + 'hidden', //21 + 'note', //22 + 'karmatype', //23 + 'kan_tilmældes', //24 + 'wp_link', //25 + 'id', //26 + ]; + + $list[] = $columns; + foreach ($activities as $activity) { + $fields = []; + foreach ($columns as $column){ + switch($column) { + case 'age_min': + $age = $activity->getMinAge(); + $fields[] = $age == false ? '' : $age; + break; + case 'age_max': + $age = $activity->getMaxAge(); + $fields[] = $age == false ? '' : $age; + break; + case 'onetime': + $fields[] = $activity->replayable == 'nej' ? 'ja' : 'nej'; + break; + default: + $fields[] = str_replace("\"","''",$activity->$column); + } + } + $list[] = $fields; + } + + //usort($activities[$type], function($a, $b) {return strcmp($a->navn, $b->navn);}); + return $list; + } + /** * creates a scheduling for an activity with data from POST diff --git a/include/models/api_model.php b/include/models/api_model.php index 358e79ff..a3269adb 100755 --- a/include/models/api_model.php +++ b/include/models/api_model.php @@ -914,7 +914,7 @@ public function addActivity(array $json, $deltager = null) { foreach ($json['activity'] as $activity) { $schedule = $this->createEntity('Afviklinger')->findById($activity['schedule_id']); - if (intval($activity['priority']) === 4) { + if (intval($activity['priority']) === 5) { $deltager->setAktivitetTilmelding($schedule, 1, 'spiller'); $deltager->setAktivitetTilmelding($schedule, 0, 'spilleder'); @@ -980,21 +980,18 @@ public function parseSignupData(array $data, DBObject $participant) $e->logException(); return ['Could not update database with participant data']; - } $errors = array(); if (!empty($data['wear']) && is_array($data['wear'])) { $errors[] = $this->addWear($data, $participant); - } else { $errors[] = $this->addWear(['wear' => []], $participant); } if (!empty($data['activity']) && is_array($data['activity'])) { $errors[] = $this->addActivity($data, $participant); - } else { $errors[] = $this->addActivity(['activity' => []], $participant); } @@ -1005,14 +1002,12 @@ public function parseSignupData(array $data, DBObject $participant) if (!empty($data['gds']) && is_array($data['gds'])) { $errors[] = $this->addGDS($data, $participant); - } else { $errors[] = $this->addGDS(['gds' => []], $participant); } if (!empty($data['food']) && is_array($data['food'])) { $errors[] = $this->addFood($data, $participant); - } else { $errors[] = $this->addFood(['food' => []], $participant); } @@ -1167,9 +1162,8 @@ protected function setParticipantData(DBObject $participant, array $data) 'may_contact', 'desired_activities', 'desired_diy_shifts', - 'game_reallocation_participant', - 'dancing_with_the_clans', 'sovesal', + 'sober_sleeping', 'ungdomsskole', 'original_price', 'scenarie', @@ -1195,6 +1189,8 @@ protected function setParticipantData(DBObject $participant, array $data) $participant->brugerkategori_id = $bk->id; } + $participant->note = $this->createEntity('Deltagere')->parseNote($participant->deltager_note); + return $this; } @@ -1524,8 +1520,8 @@ public function getParticipantBaseData(DBObject $participant) 'may_contact' => $participant->may_contact, 'desired_activities' => $participant->desired_activities, 'desired_diy_shifts' => $participant->desired_diy_shifts, - 'game_reallocation_participant' => $participant->game_reallocation_participant, 'sovesal' => $participant->sovesal, + 'sober_sleeping' => $participant->sovesal, 'ungdomsskole' => $participant->ungdomsskole, 'original_price' => $participant->original_price, 'scenarie' => $participant->scenarie, diff --git a/include/models/food_model.php b/include/models/food_model.php index 64b0177a..53bab0b9 100755 --- a/include/models/food_model.php +++ b/include/models/food_model.php @@ -486,10 +486,10 @@ public function updateFoodHandoutTimes() foreach ($this->createEntity('Mad')->findAll() as $food) { foreach ($food->getMadtider() as $madtid) { if ($madtid->isDinner()) { - $usage[$madtid->dato] = array(1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0); + $usage[$madtid->dato] = array(1 => 0, 2 => 0, 3 => 0, 4 => 0); } elseif ($madtid->isLunch()) { - $usage[$madtid->dato] = array(1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0); + $usage[$madtid->dato] = array(1 => 0, 2 => 0, 3 => 0, 4 => 0); } } diff --git a/include/models/participant_model.php b/include/models/participant_model.php index b29ac32d..6ebd66ca 100755 --- a/include/models/participant_model.php +++ b/include/models/participant_model.php @@ -201,6 +201,8 @@ public function miniWildCardSearch($terms, $exclude_phone = false) { $select->setWhereOr('ungdomsskole', 'like', "%{$term}%"); $select->setWhereOr('scenarie', 'like', "%{$term}%"); $select->setWhereOr('arbejdsomraade', 'like', "%{$term}%"); + $select->setWhereOr('skills', 'like', "%{$term}%"); + $select->setWhereOr('deltager_note', 'like', "%{$term}%"); } } @@ -658,6 +660,7 @@ public function createDeltager(RequestVars $post) 'supergds', 'flere_gdsvagter', 'sovesal', + 'sober_sleeping', 'udeblevet', 'rabat', 'forfatter', @@ -667,7 +670,6 @@ public function createDeltager(RequestVars $post) 'ready_mandag', 'ready_tirsdag', 'may_contact', - 'game_reallocation_participant', 'interpreter', 'annulled', ); @@ -1085,11 +1087,15 @@ protected function indgangMadDeletes($array_name, $entity_name, $field_name, Req */ public function updateDeltagerNote($deltager, $field, RequestVars $post) { - if (!in_array($field, array('deltager_note', 'admin_note', 'beskeder', 'paid_note', 'medical_note'))) { - return false; - } + if (preg_match("/deltager_note_(\w+)/", $field, $matches)) { + $deltager->setNote($matches[1], $post->$field); + } else{ + if (!in_array($field, array('deltager_note', 'admin_note', 'beskeder', 'paid_note', 'medical_note'))) { + return false; + } - $deltager->$field = $post->$field; + $deltager->$field = $post->$field; + } return $deltager->update(); } @@ -1849,36 +1855,40 @@ public function makeJeditableUpdate(Deltagere $participant, RequestVars $post) $this->factory('IdTemplate')->cleanIdTemplateParticipantCache($participant); - switch ($post->id) { - case 'birthdate': - $parsed = strtotime($post->value); - $participant->birthdate = $parsed ? date('Y-m-d', $parsed) : '0000-00-00'; - break; - case 'address': - $participant->adresse1 = $post->value; - break; - case 'name': - $parts = explode(' ', $post->value); - if (count($parts) > 1) { - $participant->efternavn = array_pop($parts); - $participant->fornavn = implode(' ', $parts); - } else { - $participant->fornavn = $parts[0]; - $participant->efternavn = ''; - } - break; - case 'brugerkategori_id': - $category = $this->createEntity('BrugerKategorier')->findById($post->value); - $return_value = $category->navn; - $participant->brugerkategori_id = $category->id; - break; + if (preg_match("/deltager_note_(\w+)/",$post->id, $matches)) { + $participant->setNote($matches[1], $post->value); + } else { + switch ($post->id) { + case 'birthdate': + $parsed = strtotime($post->value); + $participant->birthdate = $parsed ? date('Y-m-d', $parsed) : '0000-00-00'; + break; + case 'address': + $participant->adresse1 = $post->value; + break; + case 'name': + $parts = explode(' ', $post->value); + if (count($parts) > 1) { + $participant->efternavn = array_pop($parts); + $participant->fornavn = implode(' ', $parts); + } else { + $participant->fornavn = $parts[0]; + $participant->efternavn = ''; + } + break; + case 'brugerkategori_id': + $category = $this->createEntity('BrugerKategorier')->findById($post->value); + $return_value = $category->navn; + $participant->brugerkategori_id = $category->id; + break; - case 'participant-template': - $this->updateParticipantIdTemplate($participant, intval($post->value)); - break; + case 'participant-template': + $this->updateParticipantIdTemplate($participant, intval($post->value)); + break; - default: - $participant->{$post->id} = $post->value; + default: + $participant->{$post->id} = $post->value; + } } $this->log("Deltager #{$participant->id} fik opdateret " . $post->id . " af {$this->getLoggedInUser()->user}", 'Deltager', $this->getLoggedInUser()); @@ -2428,11 +2438,12 @@ public function setupSignupEmail(DBObject $participant, Page $page) $page->participant_photo_upload_link = $this->getPhotoUploadLink($participant); } - if ($participant->speaksDanish() && $lang !== 'en') { - $page->end_signup_changes_date = date('d/m-Y', $paytime + 7 * 86400); - } else { - $page->end_signup_changes_date = date('M d, Y', $paytime + 7 * 86400); - } + $page->end_signup_changes_date = $page->payment_day; + // if ($participant->speaksDanish() && $lang !== 'en') { + // $page->end_signup_changes_date = date('d/m-Y', $paytime + 7 * 86400); + // } else { + // $page->end_signup_changes_date = date('M d, Y', $paytime + 7 * 86400); + // } return $participant; } @@ -3027,4 +3038,39 @@ public function findDoubleBookedParticipants() return $participants; } + + /** + * fetches a participant from a photo identifier + * + * @param string $identifier identifier to search by + * + * @access public + * @return null|Deltagere + */ + public function getParticipantFromPhotoidentifier($identifier) + { + $query = "SELECT participant_id FROM participantphotoidentifiers WHERE LOWER(identifier) = LOWER(?)"; + + $participant = null; + + if ($results = $this->db->query($query, array($identifier))) { + $participant = $this->createEntity('Deltagere')->findById($results[0]['participant_id']); + } + + return $participant; + } + + public function findPeopleNeedingRefund(){ + $participants = $this->createEntity('Deltagere')->findAll(); + + foreach($participants as $participant) { + $participant->difference = $participant->calcRealTotal() - $participant->betalt_beloeb; + if ($participant->difference < 0) { + $refundees[] = $participant; + } + } + + return $refundees; + } + } diff --git a/include/models/wear_model.php b/include/models/wear_model.php index 1f7a2556..2bceaa7e 100755 --- a/include/models/wear_model.php +++ b/include/models/wear_model.php @@ -35,6 +35,8 @@ class WearModel extends Model { + public $allOrganizerCategory = "Alle arrangører"; + /** * returns array of info on ordered wear * @@ -52,21 +54,19 @@ public function getWearBreakdown() $select = $this->createEntity('DeltagereWear')->getSelect(); $select->setFrom('wearpriser')-> setTableWhere('wearpriser.id','deltagere_wear.wearpris_id')-> - setGroupBy('wearpris_id')-> setGroupBy('size')-> setGroupBy('wear_id')-> - setField('wearpris_id')-> setField('size')-> setField('wear_id')-> setField('SUM(antal) AS antal',false)-> - setOrder('wearpris_id','asc')-> + setOrder('wear_id','asc')-> setOrder('size','asc'); $DB = $this->db; if ($result = $DB->query($select)) { foreach ($result as $row) { - $results[$row['wearpris_id']][] = $row; + $results[$row['wear_id']][] = $row; } } return $results; @@ -96,17 +96,16 @@ public function getAllWear() } /** - * returns all WearPriser entities + * returns all Wear entities * * @access public * @return array */ - public function getAllWearprices() + public function getAllWearTypes() { - $select = $this->createEntity('WearPriser')->getSelect(); - $select->setOrder('wear_id','asc'); - $select->setOrder('brugerkategori_id','asc'); - return $this->createEntity('WearPriser')->findBySelectMany($select); + $select = $this->createEntity('Wear')->getSelect(); + $select->setOrder('id','asc'); + return $this->createEntity('Wear')->findBySelectMany($select); } /** @@ -152,7 +151,8 @@ public function getWearOrders($type = null, $size = null) $select = $dw->getSelect(); if ($type) { - $select->setWhere('wearpris_id','=',$type); + $select->setLeftJoin('wearpriser', 'wearpris_id', 'id'); + $select->setWhere('wear_id','=',$type); } if ($size) { @@ -240,35 +240,56 @@ protected function updatePrices(Wear $wear, RequestVars $post) { $priser = $wear->getWearpriser(); $pris_index = array_flip($this->extractIds($priser)); + $categories = array_flip($this->extractIds($priser, 'brugerkategori_id')); $success = true; if (!empty($post->wearpriceid) && !empty($post->wearprice_category) && !empty($post->wearprice_price)) { + // Is the special all organizer category set? + if (false !== $key = array_search(0, $post->wearprice_category)){ + $organizer_price = $post->wearprice_price[$key]; + $organizers = $this->getAllOrganizerCategories(); + $org_ids = []; + foreach ($organizers as $org) { + $org_ids[$org->id] = true; + } + } + foreach ($post->wearpriceid as $index => $id) { - if (isset($pris_index[$id])) { - $wearprice = $priser[$pris_index[$id]]; - $wearprice->pris = $post->wearprice_price[$index]; + $category = $post->wearprice_category[$index]; + + // Don't add seperate price for the "all organizers" category + if ($category === '0') continue; + + // Do we use organizer price + if (isset($org_ids[$category])) { + $price = $organizer_price; + unset($org_ids[$category]); + } else { + $price = $post->wearprice_price[$index]; + } + + if (isset($categories[$category])) { + $wearprice = $priser[$categories[$category]]; + $wearprice->pris = $price; $wearprice->update(); - unset($priser[$pris_index[$id]]); + unset($priser[$categories[$category]]); continue; } elseif ($id > 0) { continue; - } $new_wearprice = $this->createEntity('WearPriser'); $new_wearprice->wear_id = $wear->id; - $new_wearprice->brugerkategori_id = $post->wearprice_category[$index]; - $new_wearprice->pris = $post->wearprice_price[$index]; + $new_wearprice->brugerkategori_id = $category; + $new_wearprice->pris = $price; if (!$new_wearprice->insert()) { $success = false; } - } - } if (!$success) { @@ -276,11 +297,29 @@ protected function updatePrices(Wear $wear, RequestVars $post) } foreach ($priser as $pris) { - $pris->delete(); + if (isset($org_ids[$pris->brugerkategori_id])) { + $pris->pris = $organizer_price; + $pris->update(); + unset($org_ids[$pris->brugerkategori_id]); + } else { + $pris->delete(); + } + } + + if (is_array($org_ids)) { + foreach ($org_ids as $id => $value) { + $new_wearprice = $this->createEntity('WearPriser'); + $new_wearprice->wear_id = $wear->id; + $new_wearprice->brugerkategori_id = $id; + $new_wearprice->pris = $organizer_price; + if (!$new_wearprice->insert()) { + $success = false; + } + } } - return true; + return $success; } /** @@ -291,7 +330,26 @@ protected function updatePrices(Wear $wear, RequestVars $post) */ public function getAllParticipantCategories() { - return (($return = $this->createEntity('BrugerKategorier')->findAll()) ? $return : array()); + $category = $this->createEntity('BrugerKategorier'); + $categories = $category->findAll(); + $categories = $categories ? $categories : array(); + $category->navn = $this->allOrganizerCategory; + $category->id = 0; + $categories[] = $category; + + return $categories; + } + + public function getAllOrganizerCategories(){ + $category = $this->createEntity('BrugerKategorier'); + $categories = $category->findAll(); + $categories = $categories ? $categories : array(); + foreach($categories as $key => $category){ + if (!$category->isArrangoer()){ + unset($categories[$key]); + } + } + return $categories; } /** diff --git a/include/templates/activity/importactivities.phtml b/include/templates/activity/importactivities.phtml deleted file mode 100644 index 3c606d1b..00000000 --- a/include/templates/activity/importactivities.phtml +++ /dev/null @@ -1,14 +0,0 @@ -
    -
    - Importer Aktiviteter -
    -
    -
    - - - -
    - -
    -
    -
    \ No newline at end of file diff --git a/include/templates/activity/importexportactivities.phtml b/include/templates/activity/importexportactivities.phtml new file mode 100644 index 00000000..998f7b9f --- /dev/null +++ b/include/templates/activity/importexportactivities.phtml @@ -0,0 +1,66 @@ +getMessagesHtml()?> +
    +
    + Eksporter Aktiviteter +
    +
    +
    + + + +
    + +
    +
    +
    +
    +
    + Importer Aktiviteter +
    +

    Bemærk det er vigtigt at kolonner står i den rigtige rækkefølge. +
    En csv-fil skal være af samme format som det der bliver eksporteret

    +

    Man vil kunne se resultatet af importen inden man vælger at lægge det i databasen

    +
    +
    + + + +
    + +
    +
    + activity_data)) { ?> +
    +

    Herunder kan du se de data infosys har læst fra arket

    +

    Vil du fjene de aktiviteter der allerede ligger i databasen og ersatte med dem du har uploadet +
    eller vil du opdatere aktiviteter med samme ID og tilføje dem der ikke allerede findes i forvejen?

    +
    + + + +
    + + activity_header as $header) { ?> + + + + activity_data as $row){ ?> + + $cell) { + if($key == "updated") { + $cell = preg_replace("/ /"," ",$cell); + $cell = preg_replace("/-/","‑",$cell); + } + $class = strlen($cell) > 100 ? 'class="long-text"' : ''; + ?> + + + + +
    >
    + + + \ No newline at end of file diff --git a/include/templates/api/confirmationdata.phtml b/include/templates/api/confirmationdata.phtml index a5aacbf7..2f980429 100644 --- a/include/templates/api/confirmationdata.phtml +++ b/include/templates/api/confirmationdata.phtml @@ -55,35 +55,35 @@ case 'a': entrance['sleeping-partout'])) : ?> Overnatning (alle dage) -entrance['entrance-23'])) : ?> -Indgang onsdag 28/3 +entrance['entrance-08'])) : ?> +Indgang onsdag 8/4 -entrance['sleeping-23'])) : ?> -Overnatning onsdag 28/3 +entrance['sleeping-08'])) : ?> +Overnatning onsdag 8/4 -entrance['entrance-24'])) : ?> -Indgang torsdag 29/3 +entrance['entrance-09'])) : ?> +Indgang torsdag 9/4 -entrance['sleeping-24'])) : ?> -Overnatning torsdag 29/3 +entrance['sleeping-09'])) : ?> +Overnatning torsdag 9/4 -entrance['entrance-25'])) : ?> -Indgang fredag 30/3 +entrance['entrance-10'])) : ?> +Indgang fredag 10/4 -entrance['sleeping-25'])) : ?> -Overnatning fredag 30/3 +entrance['sleeping-10'])) : ?> +Overnatning fredag 10/4 -entrance['entrance-26'])) : ?> -Indgang lørdag 31/3 +entrance['entrance-11'])) : ?> +Indgang lørdag 11/4 -entrance['sleeping-26'])) : ?> -Overnatning lørdag 31/3 +entrance['sleeping-11'])) : ?> +Overnatning lørdag 11/4 -entrance['entrance-27'])) : ?> -Indgang søndag 1/4 +entrance['entrance-12'])) : ?> +Indgang søndag 12/4 -entrance['sleeping-27'])) : ?> -Overnatning søndag 1/4 +entrance['sleeping-12'])) : ?> +Overnatning søndag 12/4 food)) : ?> @@ -91,27 +91,27 @@ case 'a': food as $fooditem) : ?> getMad(); switch (date('d', strtotime($fooditem->dato))) { - case '23': + case '8': $day_da = 'Onsdag'; $day_en = 'Wednesday'; break; - case '24': + case '9': $day_da = 'Torsdag'; $day_en = 'Thursday'; break; - case '25': + case '10': $day_da = 'Fredag'; $day_en = 'Friday'; break; - case '26': + case '11': $day_da = 'Lørdag'; $day_en = 'Saturday'; break; - case '27': + case '12': $day_da = 'Sønddag'; $day_en = 'Sunday'; break; @@ -184,18 +184,27 @@ case 'a': Jeg vil spille på dansk: participant->sprog, 'dansk') !== false ? 'Ja' : 'Nej';?> Jeg vil spille på engelsk: participant->sprog, 'engelsk') !== false ? 'Ja' : 'Nej';?> Jeg vil spille på skandinavisk: participant->sprog, 'skandinavisk') !== false ? 'Ja' : 'Nej';?> -Vil gerne med-arrangere Fastaval 2020: participant->arrangoer_naeste_aar === 'ja' ? 'Ja' : 'Nej';?> +Vil gerne med-arrangere Fastaval 2021: participant->arrangoer_naeste_aar === 'ja' ? 'Ja' : 'Nej';?> Klargøre skolen fra mandag: participant->ready_mandag === 'ja' ? 'Ja' : 'Nej';?> Klargøre skolen fra tirsdag: participant->ready_tirsdag === 'ja' ? 'Ja' : 'Nej';?> Jeg vil være simultantolk: participant->interpreter === 'ja' ? 'Ja' : 'Nej';?> participant->sovesal === 'ja') : ?> Jeg vil gerne have en plads i arrangørsovesalen: Ja -participant->skills) : ?> -Evner/skills du kan og vil hjælpe med: participant->skills);?> +participant->sober_sleeping === 'ja') : ?> +Jeg vil gerne sove i sovesal for ædru personer: Ja -participant->deltager_note) : ?> -Andre kommentarer: participant->deltager_note);?> +participant->skills) : ?> +Evner/skills du kan og vil hjælpe med: participant->skills)?> + +participant->deltager_note) : + if($this->participant->note) : + foreach($this->participant->note as $note) : ?> + name?>: content))?> + +Andre kommentarer: participant->deltager_note)?> + participant->rig_onkel === 'ja') : ?> Rig tante/onkel (støtter Fastaval med 300kr.) Ja diff --git a/include/templates/api/confirmationdataen.phtml b/include/templates/api/confirmationdataen.phtml index 84385df2..466128c0 100644 --- a/include/templates/api/confirmationdataen.phtml +++ b/include/templates/api/confirmationdataen.phtml @@ -55,35 +55,35 @@ case 'a': entrance['sleeping-partout'])) : ?> Sleeping area (all-days) -entrance['entrance-23'])) : ?> -Entrance Wednesday 28/3 +entrance['entrance-08'])) : ?> +Entrance Wednesday 8/4 -entrance['sleeping-23'])) : ?> -Sleeping area Wednesday 28/3 +entrance['sleeping-08'])) : ?> +Sleeping area Wednesday 8/4 -entrance['entrance-24'])) : ?> -Entrance Thursday 29/3 +entrance['entrance-09'])) : ?> +Entrance Thursday 9/4 -entrance['sleeping-24'])) : ?> -Sleeping area Thursday 29/3 +entrance['sleeping-09'])) : ?> +Sleeping area Thursday 9/4 -entrance['entrance-25'])) : ?> -Entrance Friday 30/3 +entrance['entrance-10'])) : ?> +Entrance Friday 10/4 -entrance['sleeping-25'])) : ?> -Sleeping area Friday 30/3 +entrance['sleeping-10'])) : ?> +Sleeping area Friday 10/4 -entrance['entrance-26'])) : ?> -Entrance Saturday 31/3 +entrance['entrance-11'])) : ?> +Entrance Saturday 11/4 -entrance['sleeping-26'])) : ?> -Sleeping area Saturday 31/3 +entrance['sleeping-11'])) : ?> +Sleeping area Saturday 11/4 -entrance['entrance-27'])) : ?> -Entrance Sunday 1/4 +entrance['entrance-12'])) : ?> +Entrance Sunday 12/4 -entrance['sleeping-27'])) : ?> -Sleeping area Sunday 1/4 +entrance['sleeping-12'])) : ?> +Sleeping area Sunday 12/4 food)) : ?> @@ -91,27 +91,27 @@ case 'a': food as $fooditem) : ?> getMad(); switch (date('d', strtotime($fooditem->dato))) { - case '23': + case '8': $day_da = 'Onsdag'; $day_en = 'Wednesday'; break; - case '24': + case '9': $day_da = 'Torsdag'; $day_en = 'Thursday'; break; - case '25': + case '10': $day_da = 'Fredag'; $day_en = 'Friday'; break; - case '26': + case '11': $day_da = 'Lørdag'; $day_en = 'Saturday'; break; - case '27': + case '12': $day_da = 'Sønddag'; $day_en = 'Sunday'; break; @@ -184,18 +184,27 @@ case 'a': I want to play in Danish: participant->sprog, 'dansk') !== false ? 'Yes' : 'No';?> I want to play in English: participant->sprog, 'engelsk') !== false ? 'Yes' : 'No';?> I want to play in Scandinavian: participant->sprog, 'skandinavisk') !== false ? 'Yes' : 'No';?> -I want to be part of organizing Fastaval 2020: participant->arrangoer_naeste_aar === 'ja' ? 'Yes' : 'No';?> +I want to be part of organizing Fastaval 2021: participant->arrangoer_naeste_aar === 'ja' ? 'Yes' : 'No';?> I will help setup the place Monday: participant->ready_mandag === 'ja' ? 'Yes' : 'No';?> I will help setup the place Tuesday: participant->ready_tirsdag === 'ja' ? 'Yes' : 'No';?> I can help translate on-site: participant->interpreter === 'ja' ? 'Yes' : 'No';?> participant->sovesal === 'ja') : ?> -I would like a spot in the organisers sleeping area: Yes +I would like a spot in the organisers sleeping area: Yes + +participant->sober_sleeping === 'ja') : ?> +I would like to sleep in the area for sober people: Yes participant->skills) : ?> Any skills you can and would like to help Fastaval with: participant->skills);?> -participant->deltager_note) : ?> -Other comments: participant->deltager_note);?> +participant->deltager_note) : + if($this->participant->note) : + foreach($this->participant->note as $note) : ?> + name_en?>: content))?> + +Other comments: participant->deltager_note);?> + participant->rig_onkel === 'ja') : ?> I am a rich aunty/uncle (supporting Fastaval with 300kr.) Yes diff --git a/include/templates/index/main.phtml b/include/templates/index/main.phtml index 608ed950..0801a412 100755 --- a/include/templates/index/main.phtml +++ b/include/templates/index/main.phtml @@ -80,9 +80,15 @@ $this->registerLateLoadJS('index.js');

    Mad udleveret:

    diff --git a/include/templates/participant/sendsignupemail.phtml b/include/templates/participant/sendsignupemail.phtml index 7e97c5da..19b4da21 100644 --- a/include/templates/participant/sendsignupemail.phtml +++ b/include/templates/participant/sendsignupemail.phtml @@ -211,11 +211,20 @@ case 'a': participant->sovesal === 'ja') : ?> Jeg vil gerne have en plads i arrangørsovesalen: Ja +participant->sober_sleeping === 'ja') : ?> +Jeg vil gerne sove i sovesal for ædru personer: Ja + participant->skills) : ?> Evner/skills du kan og vil hjælpe med: participant->skills);?> -participant->deltager_note) : ?> -Andre kommentarer: participant->deltager_note);?> +participant->deltager_note) : + if($this->participant->note) : + foreach($this->participant->note as $note) : ?> + name?>: content))?> + +Andre kommentarer: participant->deltager_note)?> + participant->rig_onkel === 'ja') : ?> Rig onkel (støtter Fastaval med 300kr.) Ja diff --git a/include/templates/participant/sendsignupemailen.phtml b/include/templates/participant/sendsignupemailen.phtml index 525ea98f..158f7471 100644 --- a/include/templates/participant/sendsignupemailen.phtml +++ b/include/templates/participant/sendsignupemailen.phtml @@ -206,11 +206,20 @@ case 'a': participant->sovesal === 'ja') : ?> I need a space in the volunteers sleeping area: Yes +participant->sober_sleeping === 'ja') : ?> +I would like to sleep in the area for sober people: Yes + participant->skills) : ?> Skills you would like to help with at Fastaval: participant->skills);?> -participant->deltager_note) : ?> -Other comments: participant->deltager_note);?> +participant->deltager_note) : + if($this->participant->note) : + foreach($this->participant->note as $note) : ?> + name_en?>: content))?> + +Other comments: participant->deltager_note);?> + participant->rig_onkel === 'ja') : ?> Rich uncle (supporting Fastaval with 300kr.) Yes diff --git a/include/templates/participant/showrefund.phtml b/include/templates/participant/showrefund.phtml new file mode 100644 index 00000000..f3230645 --- /dev/null +++ b/include/templates/participant/showrefund.phtml @@ -0,0 +1,11 @@ +

    Deltagere der skal have penge tilbage

    +rfundees)) : ?> +

    Ingen fundet

    + +

    Deltagere:

    + + diff --git a/include/templates/participant/visdeltager.phtml b/include/templates/participant/visdeltager.phtml index 08175dc7..c43f1ca5 100755 --- a/include/templates/participant/visdeltager.phtml +++ b/include/templates/participant/visdeltager.phtml @@ -93,11 +93,14 @@ $this->registerLateLoadJS('participant.js'); Arr. næste år: deltager->arrangoer_naeste_aar;?> Arr. sovesal: deltager->sovesal;?> - Forfatter: deltager->forfatter;?> + Ædru sovesal: deltager->sober_sleeping;?> + Forfatter: deltager->forfatter;?> Ønsket antal aktiviteter: deltager->desired_activities);?> Ønsket antal GDS: deltager->desired_diy_shifts);?> + + Simultantolk: deltager->interpreter);?> @@ -106,14 +109,12 @@ $this->registerLateLoadJS('participant.js'); Udeblevet: deltager->udeblevet;?> - Karma: participant_karma;?> Annulleret: deltager->annulled === 'ja') :?>style='color: #ffffff;background-color: #ff0000;'>deltager->annulled);?> - + Aktivitets-låst: deltager->activity_lock);?> Tilmeldt: late_signup) :?>deltager->signed_up));?> Checked in: deltager->checkin_time) ? date('Y-m-d H:i', strtotime($this->deltager->checkin_time)) : 'Ikke tjekket ind';?> - Aktivitets-låst: deltager->activity_lock);?>
    @@ -312,12 +313,6 @@ $this->registerLateLoadJS('participant.js');

    deltager->admin_note, ENT_QUOTES));?>

    -
    -
    - Deltagerens noter (til Fastaval) - Ret/slet -

    deltager->deltager_note, ENT_QUOTES));?>

    -
    -
    Beskeder til deltageren (fra Fastaval) - Ret/slet @@ -343,6 +338,16 @@ $this->registerLateLoadJS('participant.js');
    + deltager->note) : ?> + deltager->note as $key => $note) : ?> +
    +
    + name?> - Ret/slet +

    content, ENT_QUOTES));?>

    +
    +
    + + payment_edit || ($this->is_read_only && !$this->is_read_only_activity))) :?> diff --git a/include/templates/participant/visedit.phtml b/include/templates/participant/visedit.phtml index 80f3fe70..89ba77b7 100755 --- a/include/templates/participant/visedit.phtml +++ b/include/templates/participant/visedit.phtml @@ -62,6 +62,7 @@ Må kontaktes: genSelect('deltager[may_contact]', array('nej', 'ja'), $this->deltager->may_contact);?> + Ædru sovesal: genSelect('deltager[sober_sleeping]',array('nej','ja'), $this->deltager->sober_sleeping);?> Forfatter: genSelect('deltager[forfatter]',array('nej', 'ja'), $this->deltager->forfatter);?> @@ -72,7 +73,7 @@ Ønsket antal aktiviteter: Ønsket antal GDS: - Simultantolk: genSelect('deltager[interpreter]', array('nej', 'ja'), $this->deltager->dancing_with_the_clans);?> + Simultantolk: genSelect('deltager[interpreter]', array('nej', 'ja'), $this->deltager->interpreter);?> Udeblevet: genSelect('deltager[udeblevet]',array('nej','ja'), $this->deltager->udeblevet);?> diff --git a/include/templates/participant/visopret.phtml b/include/templates/participant/visopret.phtml index b215f283..74418845 100755 --- a/include/templates/participant/visopret.phtml +++ b/include/templates/participant/visopret.phtml @@ -80,6 +80,7 @@ Simultantolk: genSelect('deltager[interpreter]', array('nej', 'ja'));?> + Ædru sovesal: genSelect('deltager[sober_sleeping]',array('nej','ja'));?> Udeblevet: genSelect('deltager[udeblevet]',array('nej','ja'));?> SuperGM: genSelect('deltager[supergm]', array('nej','ja'));?> diff --git a/include/templates/participant/vistextedit.phtml b/include/templates/participant/vistextedit.phtml index fd8df94c..50ea1600 100755 --- a/include/templates/participant/vistextedit.phtml +++ b/include/templates/participant/vistextedit.phtml @@ -2,7 +2,7 @@
    Rediger field;?>
    - +
    diff --git a/include/templates/wear/editwear.phtml b/include/templates/wear/editwear.phtml index 30a0729e..21793670 100755 --- a/include/templates/wear/editwear.phtml +++ b/include/templates/wear/editwear.phtml @@ -19,10 +19,23 @@ wear->getWearpriser()) : - foreach ($result as $price) : ?> + if ($result = $this->wear->getWearpriserSquashed()) : + foreach ($result as $price) : + if ($price->brugerkategori_id == 0) { + $navn = $this->model->allOrganizerCategory; + } else { + $navn = $price->getCategory()->navn; + } + + ?> - getCategory()->navn;?> + + + + + + + diff --git a/include/templates/wear/showwear.phtml b/include/templates/wear/showwear.phtml index 53e2e557..5f3dfecb 100755 --- a/include/templates/wear/showwear.phtml +++ b/include/templates/wear/showwear.phtml @@ -19,12 +19,17 @@ wear->getWearpriser()) : + if ($prices = $this->wear->getWearpriserSquashed()) : foreach ($prices as $price) : + if ($price->brugerkategori_id == 0) { + $navn = $this->model->allOrganizerCategory; + } else { + $navn = $price->getCategory()->navn; + } ?> id;?> - getCategory()->navn;?> + pris;?> - wear_pricetypes as $key => $price) : + wear_types as $key => $wear) : $ialt = 0; ?> - getWear()->navn;?>, getCategory()->navn;?> - wear_data[$price->id])) : + navn;?> + wear_data[$wear->id])) : foreach ($this->sizes as $size) :?> 0 sizes as $size) : $col_done = false; - foreach ($this->wear_data[$price->id] as $data) : - if ($data['size'] == $size && $data['wearpris_id'] == $price->id) : ?> + foreach ($this->wear_data[$wear->id] as $data) : + if ($data['size'] == $size && $data['wear_id'] == $wear->id) : ?> - +