diff --git a/composer.json b/composer.json index 3ef70213..bde3ad62 100644 --- a/composer.json +++ b/composer.json @@ -47,7 +47,8 @@ "components/font-awesome": "4.3.0", "trentrichardson/jquery-timepicker-addon": "1.6.3", "afarkas/html5shiv": "3.7.3", - "rogeriopradoj/respond": "1.4.2" + "rogeriopradoj/respond": "1.4.2", + "codeception/codeception": "dev-master" }, "require-dev": { diff --git a/module/Admin/Module.php b/module/Admin/Module.php index 67a0c434..aaf4e0fb 100644 --- a/module/Admin/Module.php +++ b/module/Admin/Module.php @@ -21,13 +21,13 @@ class Module implements ViewHelperProviderInterface { - public function onBootstrap(MvcEvent $e) { - $eventManager = $e->getApplication()->getEventManager(); - $eventManager->getSharedManager()->attach('Zend\Mvc\Controller\AbstractActionController', 'dispatch', function($e) { - $controller = $e->getTarget(); + public function onBootstrap(MvcEvent $event) { + $eventManager = $event->getApplication()->getEventManager(); + $eventManager->getSharedManager()->attach('Zend\Mvc\Controller\AbstractActionController', 'dispatch', function($event) { + $controller = $event->getTarget(); $controllerClass = get_class($controller); $moduleNamespace = substr($controllerClass, 0, strpos($controllerClass, '\\')); - $config = $e->getApplication()->getServiceManager()->get('config'); + $config = $event->getApplication()->getServiceManager()->get('config'); if (isset($config['module_layouts'][$moduleNamespace])) { $controller->layout($config['module_layouts'][$moduleNamespace]); } @@ -122,101 +122,10 @@ public function getServiceConfig() { /* * Form Factories */ - 'Admin\Form\PaymentType' => function($serviceManager) { - $form = new Form\PaymentType(); - $form->get('submit')->setValue('Save'); - - $optionService = $serviceManager->get('ErsBase\Service\OptionService'); - #$deadlineOptions = $this->buildDeadlineOptions(); - $deadlineOptions = $optionService->getDeadlineOptions(); - $form->get('active_from_id')->setAttribute('options', $deadlineOptions); - $form->get('active_until_id')->setAttribute('options', $deadlineOptions); - #$form->get('active_from_id')->setValue(0); - #$form->get('active_until_id')->setValue(0); - $currencyOptions = $optionService->getCurrencyOptions(); - $form->get('currency_id')->setAttribute('options', $currencyOptions); - - $typeOptions = [ - [ - 'value' => '', - 'label' => 'Select type ...', - 'disabled' => true, - 'selected' => true, - ], - [ - 'value' => 'sepa', - 'label' => 'Sepa Bank Account', - ], - [ - 'value' => 'ukbt', - 'label' => 'UK Bank Account', - ], - [ - 'value' => 'ipayment', - 'label' => 'iPayment Account', - ], - [ - 'value' => 'paypal', - 'label' => 'Paypal Account', - ], - ]; - $form->get('type')->setAttribute('options', $typeOptions); - - return $form; - }, - 'Admin\Form\Product' => function($serviceManager){ - $form = new Form\Product(); - - $entityManager = $serviceManager->get('doctrine.entitymanager'); - $taxes = $entityManager->getRepository('ErsBase\Entity\Tax')->findAll(); - - $options = array(); - foreach($taxes as $tax) { - $options[$tax->getId()] = $tax->getName().' - '.$tax->getPercentage().'%'; - } - - $form->get('tax_id')->setValueOptions($options); - - $ticketTemplates = array( - 'default' => 'Default', - 'weekticket' => 'Week Ticket', - 'dayticket' => 'Day Ticket', - 'galashow' => 'Gala-Show Ticket', - 'clothes' => 'T-Shirt and Hoodie', - ); - - $form->get('ticket_template')->setValueOptions($ticketTemplates); - - return $form; - }, - 'Admin\Form\Role' => function($serviceManager){ - $form = new Form\Role(); - - $entityManager = $serviceManager->get('doctrine.entitymanager'); - $roles = $entityManager->getRepository('ErsBase\Entity\UserRole')->findBy(array(), array('roleId' => 'ASC')); - - $options = array(); - $options[null] = 'no parent'; - foreach($roles as $role) { - $options[$role->getId()] = $role->getRoleId(); - } - - $form->get('Parent_id')->setValueOptions($options); - - return $form; - }, - 'Admin\Form\ProductVariant' => function($serviceManager){ - $form = new Form\ProductVariant(); - - $options = array(); - $options['text'] = 'Text'; - $options['date'] = 'Date'; - $options['select'] = 'Select'; - - $form->get('type')->setValueOptions($options); - - return $form; - }, + 'Admin\Form\PaymentType' => 'Admin\Form\Factory\PaymentTypeFactory', + 'Admin\Form\Product' => 'Admin\Form\Factory\ProductFactory', + 'Admin\Form\ProductVariant' => 'Admin\Form\Factory\ProductVariantFactory', + 'Admin\Form\Role' => 'Admin\Form\Factory\RoleFactory', 'Admin\Form\User' => function($serviceManager){ $form = new Form\User(); $form->setServiceLocator($serviceManager); diff --git a/module/Admin/src/Admin/Controller/DeadlineController.php b/module/Admin/src/Admin/Controller/DeadlineController.php index 4b93d643..cce8ea79 100644 --- a/module/Admin/src/Admin/Controller/DeadlineController.php +++ b/module/Admin/src/Admin/Controller/DeadlineController.php @@ -46,10 +46,9 @@ public function addAction() $entityManager->flush(); return $this->redirect()->toRoute('admin/deadline'); - } else { - $logger = $this->getServiceLocator()->get('Logger'); - $logger->warn($form->getMessages()); } + $logger = $this->getServiceLocator()->get('Logger'); + $logger->warn($form->getMessages()); } return new ViewModel(array( diff --git a/module/Admin/src/Admin/Controller/OrderController.php b/module/Admin/src/Admin/Controller/OrderController.php index 50a88615..2de266a3 100644 --- a/module/Admin/src/Admin/Controller/OrderController.php +++ b/module/Admin/src/Admin/Controller/OrderController.php @@ -160,23 +160,23 @@ public function searchAction() { public function detailAction() { - $id = (int) $this->params()->fromRoute('id', 0); - if (!$id) { + $orderId = (int) $this->params()->fromRoute('id', 0); + if (!$orderId) { return $this->redirect()->toRoute('admin/order', array()); } $entityManager = $this->getServiceLocator() ->get('Doctrine\ORM\EntityManager'); $order = $entityManager->getRepository('ErsBase\Entity\Order') - ->findOneBy(array('id' => $id)); + ->findOneBy(array('id' => $orderId)); $paymentDetails = $entityManager->getRepository('ErsBase\Entity\PaymentDetail') - ->findBy(array('order_id' => $id), array('created' => 'DESC')); + ->findBy(array('order_id' => $orderId), array('created' => 'DESC')); $forrest = new Service\BreadcrumbService(); - $forrest->set('order', 'admin/order', array('action' => 'detail', 'id' => $id)); - $forrest->set('user', 'admin/order', array('action' => 'detail', 'id' => $id)); - $forrest->set('package', 'admin/order', array('action' => 'detail', 'id' => $id)); - $forrest->set('item', 'admin/order', array('action' => 'detail', 'id' => $id)); - $forrest->set('matching', 'admin/order', array('action' => 'detail', 'id' => $id)); + $forrest->set('order', 'admin/order', array('action' => 'detail', 'id' => $orderId)); + $forrest->set('user', 'admin/order', array('action' => 'detail', 'id' => $orderId)); + $forrest->set('package', 'admin/order', array('action' => 'detail', 'id' => $orderId)); + $forrest->set('item', 'admin/order', array('action' => 'detail', 'id' => $orderId)); + $forrest->set('matching', 'admin/order', array('action' => 'detail', 'id' => $orderId)); return new ViewModel(array( 'order' => $order, @@ -185,14 +185,14 @@ public function detailAction() )); } public function changePaymentTypeAction() { - $id = (int) $this->params()->fromRoute('id', 0); - if (!$id) { + $orderId = (int) $this->params()->fromRoute('id', 0); + if (!$orderId) { return $this->redirect()->toRoute('admin/order', array()); } $entityManager = $this->getServiceLocator() ->get('Doctrine\ORM\EntityManager'); $order = $entityManager->getRepository('ErsBase\Entity\Order') - ->findOneBy(array('id' => $id)); + ->findOneBy(array('id' => $orderId)); $paymenttypes = $entityManager->getRepository('ErsBase\Entity\PaymentType') ->findBy(array(), array('position' => 'ASC')); @@ -235,7 +235,7 @@ public function changePaymentTypeAction() { $request = $this->getRequest(); if ($request->isPost()) { - $inputFilter = new InputFilter\PaymentType(); + #$inputFilter = new InputFilter\PaymentType(); #$form->setInputFilter($inputFilter->getInputFilter()); $form->setData($request->getPost()); @@ -273,14 +273,14 @@ public function changeCurrencyAction() { $logger = $this->getServiceLocator()->get('Logger'); - $id = (int) $this->params()->fromRoute('id', 0); - if (!$id) { + $orderId = (int) $this->params()->fromRoute('id', 0); + if (!$orderId) { return $this->redirect()->toRoute('admin/order', array()); } $entityManager = $this->getServiceLocator() ->get('Doctrine\ORM\EntityManager'); $order = $entityManager->getRepository('ErsBase\Entity\Order') - ->findOneBy(array('id' => $id)); + ->findOneBy(array('id' => $orderId)); # prepare currencies $currencies = $entityManager->getRepository('ErsBase\Entity\Currency') @@ -380,15 +380,15 @@ public function changeCurrencyAction() { public function resendConfirmationAction() { #$logger = $this->getServiceLocator()->get('Logger'); - $id = (int) $this->params()->fromRoute('id', 0); - if (!$id) { + $orderId = (int) $this->params()->fromRoute('id', 0); + if (!$orderId) { return $this->redirect()->toRoute('admin/order', array()); } $entityManager = $this->getServiceLocator() ->get('Doctrine\ORM\EntityManager'); $order = $entityManager->getRepository('ErsBase\Entity\Order') - ->findOneBy(array('id' => $id)); + ->findOneBy(array('id' => $orderId)); $forrest = new Service\BreadcrumbService(); if(!$forrest->exists('order')) { @@ -400,10 +400,10 @@ public function resendConfirmationAction() { $ret = $request->getPost('del', 'No'); if ($ret == 'Yes') { - $id = (int) $request->getPost('id'); + $orderId = (int) $request->getPost('id'); $order = $entityManager->getRepository('ErsBase\Entity\Order') - ->findOneBy(array('id' => $id)); + ->findOneBy(array('id' => $orderId)); $emailService = $this->getServiceLocator() ->get('ErsBase\Service\EmailService'); @@ -424,14 +424,14 @@ public function resendConfirmationAction() { public function sendEticketsAction() { $logger = $this->getServiceLocator()->get('Logger'); - $id = (int) $this->params()->fromRoute('id', 0); - if (!$id) { + $orderId = (int) $this->params()->fromRoute('id', 0); + if (!$orderId) { return $this->redirect()->toRoute('admin/order', array()); } $entityManager = $this->getServiceLocator() ->get('Doctrine\ORM\EntityManager'); $order = $entityManager->getRepository('ErsBase\Entity\Order') - ->findOneBy(array('id' => $id)); + ->findOneBy(array('id' => $orderId)); $forrest = new Service\BreadcrumbService(); if(!$forrest->exists('order')) { @@ -443,10 +443,10 @@ public function sendEticketsAction() { $ret = $request->getPost('del', 'No'); if ($ret == 'Yes') { - $id = (int) $request->getPost('id'); + $orderId = (int) $request->getPost('id'); $order = $entityManager->getRepository('ErsBase\Entity\Order') - ->findOneBy(array('id' => $id)); + ->findOneBy(array('id' => $orderId)); if($order->getPaymentStatus() != 'paid') { return $this->redirect()->toRoute('admin/order', array('action' => 'send-eticket')); @@ -525,14 +525,14 @@ public function sendEticketsAction() { public function sendPaymentReminderAction() { $logger = $this->getServiceLocator()->get('Logger'); - $id = (int) $this->params()->fromRoute('id', 0); - if (!$id) { + $orderId = (int) $this->params()->fromRoute('id', 0); + if (!$orderId) { return $this->redirect()->toRoute('admin/order', array()); } $entityManager = $this->getServiceLocator() ->get('Doctrine\ORM\EntityManager'); $order = $entityManager->getRepository('ErsBase\Entity\Order') - ->findOneBy(array('id' => $id)); + ->findOneBy(array('id' => $orderId)); $forrest = new Service\BreadcrumbService(); if(!$forrest->exists('order')) { @@ -544,10 +544,10 @@ public function sendPaymentReminderAction() { $ret = $request->getPost('del', 'No'); if ($ret == 'Yes') { - $id = (int) $request->getPost('id'); + $orderId = (int) $request->getPost('id'); $order = $entityManager->getRepository('ErsBase\Entity\Order') - ->findOneBy(array('id' => $id)); + ->findOneBy(array('id' => $orderId)); # prepare email (participant, buyer) #$emailService = new Service\EmailService(); @@ -592,14 +592,14 @@ public function sendPaymentReminderAction() { public function changeBuyerAction() { $logger = $this->getServiceLocator()->get('Logger'); - $id = (int) $this->params()->fromRoute('id', 0); - if (!$id) { + $orderId = (int) $this->params()->fromRoute('id', 0); + if (!$orderId) { return $this->redirect()->toRoute('admin/order', array()); } $entityManager = $this->getServiceLocator() ->get('Doctrine\ORM\EntityManager'); $order = $entityManager->getRepository('ErsBase\Entity\Order') - ->findOneBy(array('id' => $id)); + ->findOneBy(array('id' => $orderId)); $form = new Form\SearchUser(); @@ -703,8 +703,8 @@ public function acceptBuyerChangeAction() { $request = $this->getRequest(); if ($request->isPost()) { - $inputFilter = $this->getServiceLocator() - ->get('Admin\InputFilter\AcceptBuyerChange'); + /*$inputFilter = $this->getServiceLocator() + ->get('Admin\InputFilter\AcceptBuyerChange');*/ #$inputFilter = new InputFilter\AcceptBuyerChange(); #$form->setInputFilter($inputFilter->getInputFilter()); $form->setData($request->getPost()); @@ -731,9 +731,8 @@ public function acceptBuyerChangeAction() { 'action' => 'detail', 'id' => $order->getId() )); - } else { - $logger->warn($form->getMessages()); } + $logger->warn($form->getMessages()); } $user = null; @@ -767,12 +766,12 @@ public function acceptBuyerChangeAction() { } public function changePackageAction() { - $id = (int) $this->params()->fromRoute('id', 0); + $orderId = (int) $this->params()->fromRoute('id', 0); $entityManager = $this->getServiceLocator() ->get('Doctrine\ORM\EntityManager'); $package = $entityManager->getRepository('ErsBase\Entity\Package') - ->findOneBy(array('id' => $id)); + ->findOneBy(array('id' => $orderId)); return new ViewModel(array( 'package' => $package, @@ -780,12 +779,12 @@ public function changePackageAction() { } public function changeItemAction() { - $id = (int) $this->params()->fromRoute('id', 0); + $orderId = (int) $this->params()->fromRoute('id', 0); $entityManager = $this->getServiceLocator() ->get('Doctrine\ORM\EntityManager'); $item = $entityManager->getRepository('ErsBase\Entity\Item') - ->findOneBy(array('id' => $id)); + ->findOneBy(array('id' => $orderId)); return new ViewModel(array( 'item' => $item, @@ -793,14 +792,14 @@ public function changeItemAction() { } public function cancelAction() { - $id = (int) $this->params()->fromRoute('id', 0); - if (!$id) { + $orderId = (int) $this->params()->fromRoute('id', 0); + if (!$orderId) { return $this->redirect()->toRoute('admin/order', array()); } $entityManager = $this->getServiceLocator() ->get('Doctrine\ORM\EntityManager'); $order = $entityManager->getRepository('ErsBase\Entity\Order') - ->findOneBy(array('id' => $id)); + ->findOneBy(array('id' => $orderId)); $forrest = new Service\BreadcrumbService(); if(!$forrest->exists('order')) { @@ -812,10 +811,10 @@ public function cancelAction() { $ret = $request->getPost('del', 'No'); if ($ret == 'Yes') { - $id = (int) $request->getPost('id'); + $orderId = (int) $request->getPost('id'); $order = $entityManager->getRepository('ErsBase\Entity\Order') - ->findOneBy(array('id' => $id)); + ->findOneBy(array('id' => $orderId)); /*$status = $entityManager->getRepository('ErsBase\Entity\Status') ->findOneBy(array('value' => 'cancelled'));*/ @@ -846,14 +845,14 @@ public function cancelAction() { } public function paidAction() { - $id = (int) $this->params()->fromRoute('id', 0); - if (!$id) { + $orderId = (int) $this->params()->fromRoute('id', 0); + if (!$orderId) { return $this->redirect()->toRoute('admin/order', array()); } $entityManager = $this->getServiceLocator() ->get('Doctrine\ORM\EntityManager'); $order = $entityManager->getRepository('ErsBase\Entity\Order') - ->findOneBy(array('id' => $id)); + ->findOneBy(array('id' => $orderId)); $forrest = new Service\BreadcrumbService(); if(!$forrest->exists('order')) { @@ -865,10 +864,10 @@ public function paidAction() { $ret = $request->getPost('del', 'No'); if ($ret == 'Yes') { - $id = (int) $request->getPost('id'); + $orderId = (int) $request->getPost('id'); $order = $entityManager->getRepository('ErsBase\Entity\Order') - ->findOneBy(array('id' => $id)); + ->findOneBy(array('id' => $orderId)); $order->setPaymentStatus('paid'); $entityManager->persist($order); @@ -895,14 +894,14 @@ public function paidAction() { } public function refundAction() { - $id = (int) $this->params()->fromRoute('id', 0); - if (!$id) { + $orderId = (int) $this->params()->fromRoute('id', 0); + if (!$orderId) { return $this->redirect()->toRoute('admin/order', array()); } $entityManager = $this->getServiceLocator() ->get('Doctrine\ORM\EntityManager'); $order = $entityManager->getRepository('ErsBase\Entity\Order') - ->findOneBy(array('id' => $id)); + ->findOneBy(array('id' => $orderId)); $forrest = new Service\BreadcrumbService(); if(!$forrest->exists('order')) { @@ -914,10 +913,10 @@ public function refundAction() { $ret = $request->getPost('del', 'No'); if ($ret == 'Yes') { - $id = (int) $request->getPost('id'); + $orderId = (int) $request->getPost('id'); $order = $entityManager->getRepository('ErsBase\Entity\Order') - ->findOneBy(array('id' => $id)); + ->findOneBy(array('id' => $orderId)); $status = $entityManager->getRepository('ErsBase\Entity\Status') ->findOneBy(array('value' => 'refund')); @@ -945,14 +944,14 @@ public function refundAction() { } public function unpaidAction() { - $id = (int) $this->params()->fromRoute('id', 0); - if (!$id) { + $orderId = (int) $this->params()->fromRoute('id', 0); + if (!$orderId) { return $this->redirect()->toRoute('admin/order', array()); } $entityManager = $this->getServiceLocator() ->get('Doctrine\ORM\EntityManager'); $order = $entityManager->getRepository('ErsBase\Entity\Order') - ->findOneBy(array('id' => $id)); + ->findOneBy(array('id' => $orderId)); $forrest = new Service\BreadcrumbService(); if(!$forrest->exists('order')) { @@ -964,10 +963,10 @@ public function unpaidAction() { $ret = $request->getPost('del', 'No'); if ($ret == 'Yes') { - $id = (int) $request->getPost('id'); + $orderId = (int) $request->getPost('id'); $order = $entityManager->getRepository('ErsBase\Entity\Order') - ->findOneBy(array('id' => $id)); + ->findOneBy(array('id' => $orderId)); $status = $entityManager->getRepository('ErsBase\Entity\Status') ->findOneBy(array('value' => 'ordered')); @@ -1053,8 +1052,8 @@ public function overpaidAction() { public function changeOrderDateAction() { $logger = $this->getServiceLocator()->get('Logger'); - $id = (int) $this->params()->fromRoute('id', 0); - if (!$id) { + $orderId = (int) $this->params()->fromRoute('id', 0); + if (!$orderId) { return $this->redirect()->toRoute('admin/order', array()); } @@ -1064,10 +1063,10 @@ public function changeOrderDateAction() { ->get('Doctrine\ORM\EntityManager'); $order = $entityManager->getRepository('ErsBase\Entity\Order') - ->findOneBy(array('id' => $id)); + ->findOneBy(array('id' => $orderId)); if(!$order) { - $this->flashMessenger()->addErrorMessage('Unable to find order with id '.$id); + $this->flashMessenger()->addErrorMessage('Unable to find order with id '.$orderId); return $this->redirect()->toRoute('admin'); } @@ -1084,9 +1083,8 @@ public function changeOrderDateAction() { 'action' => 'detail', 'id' => $order->getId() )); - } else { - $logger->warn($form->getMessages()); } + $logger->warn($form->getMessages()); } $forrest = new Service\BreadcrumbService(); diff --git a/module/Admin/src/Admin/Controller/PaymentTypeController.php b/module/Admin/src/Admin/Controller/PaymentTypeController.php index f3944169..7bd78c03 100644 --- a/module/Admin/src/Admin/Controller/PaymentTypeController.php +++ b/module/Admin/src/Admin/Controller/PaymentTypeController.php @@ -77,10 +77,9 @@ public function addAction() { $entityManager->flush(); return $this->redirect()->toRoute('admin/payment-type'); - } else { - $logger = $this->getServiceLocator()->get('Logger'); - $logger->warn($form->getMessages()); } + $logger = $this->getServiceLocator()->get('Logger'); + $logger->warn($form->getMessages()); } return new ViewModel(array( diff --git a/module/Admin/src/Admin/Controller/RefundController.php b/module/Admin/src/Admin/Controller/RefundController.php index 4a4f94a5..02ecc8fb 100644 --- a/module/Admin/src/Admin/Controller/RefundController.php +++ b/module/Admin/src/Admin/Controller/RefundController.php @@ -41,14 +41,14 @@ public function indexAction() { } public function enterAction() { - $id = (int) $this->params()->fromRoute('id', 0); - if (!$id) { + $orderId = (int) $this->params()->fromRoute('id', 0); + if (!$orderId) { return $this->redirect()->toRoute('admin/refund', array()); } $entityManager = $this->getServiceLocator() ->get('Doctrine\ORM\EntityManager'); $order = $entityManager->getRepository('ErsBase\Entity\Order') - ->findOneBy(array('id' => $id)); + ->findOneBy(array('id' => $orderId)); #$form = $this->getServiceLocator()->get('Admin\Form\Product'); $form = new Form\EnterRefund(); @@ -89,7 +89,7 @@ public function enterAction() { } return new ViewModel(array( - 'id' => $id, + 'id' => $orderId, 'form' => $form, 'order' => $order, )); diff --git a/module/Admin/src/Admin/Controller/TaxController.php b/module/Admin/src/Admin/Controller/TaxController.php index 92a7e426..d30f56f1 100644 --- a/module/Admin/src/Admin/Controller/TaxController.php +++ b/module/Admin/src/Admin/Controller/TaxController.php @@ -66,15 +66,15 @@ public function editAction() $forrest->set('tax', 'admin/tax'); } - $id = (int) $this->params()->fromRoute('id', 0); - if (!$id) { + $taxId = (int) $this->params()->fromRoute('id', 0); + if (!$taxId) { return $this->redirect()->toRoute('admin/tax', array( 'action' => 'add' )); } $entityManager = $this->getServiceLocator() ->get('Doctrine\ORM\EntityManager'); - $tax = $entityManager->getRepository('ErsBase\Entity\Tax')->findOneBy(array('id' => $id)); + $tax = $entityManager->getRepository('ErsBase\Entity\Tax')->findOneBy(array('id' => $taxId)); $form = new Form\Tax(); $form->bind($tax); @@ -96,7 +96,7 @@ public function editAction() } return new ViewModel(array( - 'id' => $id, + 'id' => $taxId, 'form' => $form, 'breadcrumb' => $breadcrumb, )); @@ -110,8 +110,8 @@ public function deleteAction() } $breadcrumb = $forrest->get('tax'); - $id = (int) $this->params()->fromRoute('id', 0); - if (!$id) { + $taxId = (int) $this->params()->fromRoute('id', 0); + if (!$taxId) { return $this->redirect()->toRoute($breadcrumb->route, $breadcrumb->params, $breadcrumb->options); } $entityManager = $this->getServiceLocator() @@ -123,9 +123,9 @@ public function deleteAction() if ($del == 'Yes') { - $id = (int) $request->getPost('id'); + $taxId = (int) $request->getPost('id'); $tax = $entityManager->getRepository('ErsBase\Entity\Tax') - ->findOneBy(array('id' => $id)); + ->findOneBy(array('id' => $taxId)); $entityManager->remove($tax); $entityManager->flush(); } @@ -134,9 +134,9 @@ public function deleteAction() } return new ViewModel(array( - 'id' => $id, + 'id' => $taxId, 'tax' => $tax = $entityManager->getRepository('ErsBase\Entity\Tax') - ->findOneBy(array('id' => $id)), + ->findOneBy(array('id' => $taxId)), 'breadcrumb' => $breadcrumb, )); } diff --git a/module/Admin/src/Admin/Form/AcceptBuyerChange.php b/module/Admin/src/Admin/Form/AcceptBuyerChange.php index 0dced196..76affa76 100644 --- a/module/Admin/src/Admin/Form/AcceptBuyerChange.php +++ b/module/Admin/src/Admin/Form/AcceptBuyerChange.php @@ -13,7 +13,7 @@ class AcceptBuyerChange extends Form { - public function __construct($name = null) + public function __construct() { parent::__construct('AcceptBuyerChange'); $this->setAttribute('method', 'post'); diff --git a/module/Admin/src/Admin/Form/AcceptMatch.php b/module/Admin/src/Admin/Form/AcceptMatch.php index 622aeb3f..8f8698d6 100644 --- a/module/Admin/src/Admin/Form/AcceptMatch.php +++ b/module/Admin/src/Admin/Form/AcceptMatch.php @@ -13,7 +13,7 @@ class AcceptMatch extends Form { - public function __construct($name = null) + public function __construct() { parent::__construct('AcceptMatch'); $this->setAttribute('method', 'post'); diff --git a/module/Admin/src/Admin/Form/AcceptMovePackage.php b/module/Admin/src/Admin/Form/AcceptMovePackage.php index c7bb880c..e84e05c9 100644 --- a/module/Admin/src/Admin/Form/AcceptMovePackage.php +++ b/module/Admin/src/Admin/Form/AcceptMovePackage.php @@ -13,7 +13,7 @@ class AcceptMovePackage extends Form { - public function __construct($name = null) + public function __construct() { parent::__construct('AcceptMovePackage'); $this->setAttribute('method', 'post'); diff --git a/module/Admin/src/Admin/Form/AcceptParticipantChangeItem.php b/module/Admin/src/Admin/Form/AcceptParticipantChangeItem.php index 8307b6c5..9b1689c3 100644 --- a/module/Admin/src/Admin/Form/AcceptParticipantChangeItem.php +++ b/module/Admin/src/Admin/Form/AcceptParticipantChangeItem.php @@ -13,7 +13,7 @@ class AcceptParticipantChangeItem extends Form { - public function __construct($name = null) + public function __construct() { parent::__construct('AcceptParticipantChangeItem'); $this->setAttribute('method', 'post'); diff --git a/module/Admin/src/Admin/Form/AcceptParticipantChangePackage.php b/module/Admin/src/Admin/Form/AcceptParticipantChangePackage.php index 295b219a..a8df3f81 100644 --- a/module/Admin/src/Admin/Form/AcceptParticipantChangePackage.php +++ b/module/Admin/src/Admin/Form/AcceptParticipantChangePackage.php @@ -13,7 +13,7 @@ class AcceptParticipantChangePackage extends Form { - public function __construct($name = null) + public function __construct() { parent::__construct('AcceptParticipantChangePackage'); $this->setAttribute('method', 'post'); diff --git a/module/Admin/src/Admin/Form/AccountIpaymentDetail.php b/module/Admin/src/Admin/Form/AccountIpaymentDetail.php index 632511e7..cb616b74 100644 --- a/module/Admin/src/Admin/Form/AccountIpaymentDetail.php +++ b/module/Admin/src/Admin/Form/AccountIpaymentDetail.php @@ -29,7 +29,31 @@ public function __construct(ObjectManager $objectManager) * action */ + $this->addAccountId(); + $this->addTrxuserId(); + $this->addTrxCurrency(); + $this->addTrxpassword(); + $this->addSecKey(); + $this->addAction(); + + + $this->add(array( + 'type' => 'Zend\Form\Element\Csrf', + 'name' => 'csrf', + )); + + $this->add(array( + 'name' => 'submit', + 'attributes' => array( + 'type' => 'submit', + 'value' => 'Send', + 'class' => 'btn btn-success', + ), + )); + } + + private function addAccountId() { $this->add(array( 'name' => 'account_id', 'attributes' => array( @@ -45,7 +69,8 @@ public function __construct(ObjectManager $objectManager) ), ), )); - + } + private function addTrxuserId() { $this->add(array( 'name' => 'trxuser_id', 'attributes' => array( @@ -61,7 +86,8 @@ public function __construct(ObjectManager $objectManager) ), ), )); - + } + private function addTrxCurrency() { $this->add(array( 'name' => 'trx_currency', 'attributes' => array( @@ -77,7 +103,8 @@ public function __construct(ObjectManager $objectManager) ), ), )); - + } + private function addTrxpassword() { $this->add(array( 'name' => 'trxpassword', 'attributes' => array( @@ -93,7 +120,8 @@ public function __construct(ObjectManager $objectManager) ), ), )); - + } + private function addSecKey() { $this->add(array( 'name' => 'sec_key', 'attributes' => array( @@ -109,7 +137,8 @@ public function __construct(ObjectManager $objectManager) ), ), )); - + } + private function addAction() { $this->add(array( 'name' => 'action', 'attributes' => array( @@ -125,19 +154,5 @@ public function __construct(ObjectManager $objectManager) ), ), )); - - $this->add(array( - 'type' => 'Zend\Form\Element\Csrf', - 'name' => 'csrf', - )); - - $this->add(array( - 'name' => 'submit', - 'attributes' => array( - 'type' => 'submit', - 'value' => 'Send', - 'class' => 'btn btn-success', - ), - )); } } \ No newline at end of file diff --git a/module/Admin/src/Admin/Form/Agegroup.php b/module/Admin/src/Admin/Form/Agegroup.php index 634759ca..a3938a48 100644 --- a/module/Admin/src/Admin/Form/Agegroup.php +++ b/module/Admin/src/Admin/Form/Agegroup.php @@ -13,7 +13,7 @@ class Agegroup extends Form { - public function __construct($name = null) + public function __construct() { parent::__construct('Agegroup'); $this->setAttribute('method', 'post'); diff --git a/module/Admin/src/Admin/Form/BankAccountFormat.php b/module/Admin/src/Admin/Form/BankAccountFormat.php index aa9649b8..44b700a2 100644 --- a/module/Admin/src/Admin/Form/BankAccountFormat.php +++ b/module/Admin/src/Admin/Form/BankAccountFormat.php @@ -13,7 +13,7 @@ class BankAccountFormat extends Form { - public function __construct($name = null) + public function __construct() { parent::__construct('BankAccount'); $this->setAttribute('method', 'post'); diff --git a/module/Admin/src/Admin/Form/ChangeCurrency.php b/module/Admin/src/Admin/Form/ChangeCurrency.php index 449cfbfa..ce2d29b9 100644 --- a/module/Admin/src/Admin/Form/ChangeCurrency.php +++ b/module/Admin/src/Admin/Form/ChangeCurrency.php @@ -17,7 +17,7 @@ class ChangeCurrency extends Form { public $inputFilter; - public function __construct($name = null) + public function __construct() { parent::__construct('ChangeCurrency'); diff --git a/module/Admin/src/Admin/Form/ChangePaymentType.php b/module/Admin/src/Admin/Form/ChangePaymentType.php index f166e028..64e3d812 100644 --- a/module/Admin/src/Admin/Form/ChangePaymentType.php +++ b/module/Admin/src/Admin/Form/ChangePaymentType.php @@ -17,7 +17,7 @@ class ChangePaymentType extends Form { public $inputFilter; - public function __construct($name = null) + public function __construct() { parent::__construct('ChangePaymentType'); diff --git a/module/Admin/src/Admin/Form/Country.php b/module/Admin/src/Admin/Form/Country.php index 511b73de..7adaeb60 100644 --- a/module/Admin/src/Admin/Form/Country.php +++ b/module/Admin/src/Admin/Form/Country.php @@ -13,7 +13,7 @@ class Country extends Form { - public function __construct($name = null) + public function __construct() { parent::__construct('Agegroup'); $this->setAttribute('method', 'post'); diff --git a/module/Admin/src/Admin/Form/Currency.php b/module/Admin/src/Admin/Form/Currency.php index bcfdefcd..c97c53e1 100644 --- a/module/Admin/src/Admin/Form/Currency.php +++ b/module/Admin/src/Admin/Form/Currency.php @@ -13,7 +13,7 @@ class Currency extends Form implements InputFilterProviderInterface { - public function __construct($name = null) + public function __construct() { parent::__construct('Currency'); $this->setAttribute('method', 'post'); diff --git a/module/Admin/src/Admin/Form/Deadline.php b/module/Admin/src/Admin/Form/Deadline.php index ac1d2300..4a97494a 100644 --- a/module/Admin/src/Admin/Form/Deadline.php +++ b/module/Admin/src/Admin/Form/Deadline.php @@ -13,7 +13,7 @@ class Deadline extends Form { - public function __construct($name = null) + public function __construct() { parent::__construct('Deadline'); $this->setAttribute('method', 'post'); diff --git a/module/Admin/src/Admin/Form/DownloadEticket.php b/module/Admin/src/Admin/Form/DownloadEticket.php index 76f3e213..deeeb7b8 100644 --- a/module/Admin/src/Admin/Form/DownloadEticket.php +++ b/module/Admin/src/Admin/Form/DownloadEticket.php @@ -13,7 +13,7 @@ class DownloadEticket extends Form { - public function __construct($name = null) + public function __construct() { parent::__construct('Agegroup'); $this->setAttribute('method', 'post'); diff --git a/module/Admin/src/Admin/Form/Factory/PaymentTypeFactory.php b/module/Admin/src/Admin/Form/Factory/PaymentTypeFactory.php new file mode 100644 index 00000000..7eb3b240 --- /dev/null +++ b/module/Admin/src/Admin/Form/Factory/PaymentTypeFactory.php @@ -0,0 +1,60 @@ +get('submit')->setValue('Save'); + + $optionService = $serviceLocator->get('ErsBase\Service\OptionService'); + #$deadlineOptions = $this->buildDeadlineOptions(); + $deadlineOptions = $optionService->getDeadlineOptions(); + $form->get('active_from_id')->setAttribute('options', $deadlineOptions); + $form->get('active_until_id')->setAttribute('options', $deadlineOptions); + #$form->get('active_from_id')->setValue(0); + #$form->get('active_until_id')->setValue(0); + $currencyOptions = $optionService->getCurrencyOptions(); + $form->get('currency_id')->setAttribute('options', $currencyOptions); + + $typeOptions = [ + [ + 'value' => '', + 'label' => 'Select type ...', + 'disabled' => true, + 'selected' => true, + ], + [ + 'value' => 'sepa', + 'label' => 'Sepa Bank Account', + ], + [ + 'value' => 'ukbt', + 'label' => 'UK Bank Account', + ], + [ + 'value' => 'ipayment', + 'label' => 'iPayment Account', + ], + [ + 'value' => 'paypal', + 'label' => 'Paypal Account', + ], + ]; + $form->get('type')->setAttribute('options', $typeOptions); + + return $form; + } +} \ No newline at end of file diff --git a/module/Admin/src/Admin/Form/Factory/ProductFactory.php b/module/Admin/src/Admin/Form/Factory/ProductFactory.php new file mode 100644 index 00000000..db85a3b0 --- /dev/null +++ b/module/Admin/src/Admin/Form/Factory/ProductFactory.php @@ -0,0 +1,43 @@ +get('doctrine.entitymanager'); + $taxes = $entityManager->getRepository('ErsBase\Entity\Tax')->findAll(); + + $options = array(); + foreach($taxes as $tax) { + $options[$tax->getId()] = $tax->getName().' - '.$tax->getPercentage().'%'; + } + + $form->get('tax_id')->setValueOptions($options); + + $ticketTemplates = array( + 'default' => 'Default', + 'weekticket' => 'Week Ticket', + 'dayticket' => 'Day Ticket', + 'galashow' => 'Gala-Show Ticket', + 'clothes' => 'T-Shirt and Hoodie', + ); + + $form->get('ticket_template')->setValueOptions($ticketTemplates); + + return $form; + } +} \ No newline at end of file diff --git a/module/Admin/src/Admin/Form/Factory/ProductVariantFactory.php b/module/Admin/src/Admin/Form/Factory/ProductVariantFactory.php new file mode 100644 index 00000000..b19e5da5 --- /dev/null +++ b/module/Admin/src/Admin/Form/Factory/ProductVariantFactory.php @@ -0,0 +1,30 @@ +get('type')->setValueOptions($options); + + return $form; + } +} \ No newline at end of file diff --git a/module/Admin/src/Admin/Form/Factory/RoleFactory.php b/module/Admin/src/Admin/Form/Factory/RoleFactory.php new file mode 100644 index 00000000..d01ce891 --- /dev/null +++ b/module/Admin/src/Admin/Form/Factory/RoleFactory.php @@ -0,0 +1,34 @@ +get('doctrine.entitymanager'); + $roles = $entityManager->getRepository('ErsBase\Entity\UserRole')->findBy(array(), array('roleId' => 'ASC')); + + $options = array(); + $options[null] = 'no parent'; + foreach($roles as $role) { + $options[$role->getId()] = $role->getRoleId(); + } + + $form->get('Parent_id')->setValueOptions($options); + + return $form; + } +} \ No newline at end of file diff --git a/module/Admin/src/Admin/Form/ManualMatch.php b/module/Admin/src/Admin/Form/ManualMatch.php index ac2541c3..1f73bf04 100644 --- a/module/Admin/src/Admin/Form/ManualMatch.php +++ b/module/Admin/src/Admin/Form/ManualMatch.php @@ -13,7 +13,7 @@ class ManualMatch extends Form { - public function __construct($name = null) + public function __construct() { parent::__construct('ManualMatch'); $this->setAttribute('method', 'post'); diff --git a/module/Admin/src/Admin/Form/PaymentType.php b/module/Admin/src/Admin/Form/PaymentType.php index 2b9b3bb3..c11250be 100644 --- a/module/Admin/src/Admin/Form/PaymentType.php +++ b/module/Admin/src/Admin/Form/PaymentType.php @@ -15,7 +15,7 @@ class PaymentType extends Form implements InputFilterProviderInterface { - public function __construct($name = null) + public function __construct() { parent::__construct('PaymentType'); $this->setAttribute('method', 'post'); diff --git a/module/Admin/src/Admin/Form/PaymentTypeLogo.php b/module/Admin/src/Admin/Form/PaymentTypeLogo.php index 57c272ef..378e5734 100644 --- a/module/Admin/src/Admin/Form/PaymentTypeLogo.php +++ b/module/Admin/src/Admin/Form/PaymentTypeLogo.php @@ -13,7 +13,7 @@ class PaymentTypeCreditCard extends Form { - public function __construct($name = null) + public function __construct() { parent::__construct('PaymentTypeCreditCard'); $this->setAttribute('method', 'post'); diff --git a/module/Admin/src/Admin/Form/Product.php b/module/Admin/src/Admin/Form/Product.php index 3bd1d037..0ad681e6 100644 --- a/module/Admin/src/Admin/Form/Product.php +++ b/module/Admin/src/Admin/Form/Product.php @@ -13,7 +13,7 @@ class Product extends Form { - public function __construct($name = null) + public function __construct() { parent::__construct('Product'); $this->setAttribute('method', 'post'); diff --git a/module/Admin/src/Admin/Form/ProductPackage.php b/module/Admin/src/Admin/Form/ProductPackage.php index 152505a1..21b4dd2b 100644 --- a/module/Admin/src/Admin/Form/ProductPackage.php +++ b/module/Admin/src/Admin/Form/ProductPackage.php @@ -13,7 +13,7 @@ class ProductPackage extends Form { - public function __construct($name = null) + public function __construct() { parent::__construct('Agegroup'); $this->setAttribute('method', 'post'); diff --git a/module/Admin/src/Admin/Form/ProductPrice.php b/module/Admin/src/Admin/Form/ProductPrice.php index 5ac7cd51..aee04a35 100644 --- a/module/Admin/src/Admin/Form/ProductPrice.php +++ b/module/Admin/src/Admin/Form/ProductPrice.php @@ -13,7 +13,7 @@ class ProductPrice extends Form { - public function __construct($name = null) + public function __construct() { parent::__construct('ProductPrice'); diff --git a/module/Admin/src/Admin/Form/ProductVariant.php b/module/Admin/src/Admin/Form/ProductVariant.php index 2b94fe43..15cfd07c 100644 --- a/module/Admin/src/Admin/Form/ProductVariant.php +++ b/module/Admin/src/Admin/Form/ProductVariant.php @@ -13,7 +13,7 @@ class ProductVariant extends Form { - public function __construct($name = null) + public function __construct() { parent::__construct('ProductVariant'); diff --git a/module/Admin/src/Admin/Form/ProductVariantValue.php b/module/Admin/src/Admin/Form/ProductVariantValue.php index 360311b3..9ece4460 100644 --- a/module/Admin/src/Admin/Form/ProductVariantValue.php +++ b/module/Admin/src/Admin/Form/ProductVariantValue.php @@ -13,7 +13,7 @@ class ProductVariantValue extends Form { - public function __construct($name = null) + public function __construct() { parent::__construct('ProductVariantValue'); diff --git a/module/Admin/src/Admin/Form/Role.php b/module/Admin/src/Admin/Form/Role.php index 7a510b0d..d8ea08b0 100644 --- a/module/Admin/src/Admin/Form/Role.php +++ b/module/Admin/src/Admin/Form/Role.php @@ -13,7 +13,7 @@ class Role extends Form { - public function __construct($name = null) + public function __construct() { parent::__construct('Deadline'); $this->setAttribute('method', 'post'); diff --git a/module/Admin/src/Admin/Form/SearchOrder.php b/module/Admin/src/Admin/Form/SearchOrder.php index 3e0b7951..e854b1a0 100644 --- a/module/Admin/src/Admin/Form/SearchOrder.php +++ b/module/Admin/src/Admin/Form/SearchOrder.php @@ -13,7 +13,7 @@ class SearchOrder extends Form { - public function __construct($name = null) + public function __construct() { parent::__construct('SearchOrder'); $this->setAttribute('method', 'get'); diff --git a/module/Admin/src/Admin/Form/SearchPackage.php b/module/Admin/src/Admin/Form/SearchPackage.php index deedc882..46c78159 100644 --- a/module/Admin/src/Admin/Form/SearchPackage.php +++ b/module/Admin/src/Admin/Form/SearchPackage.php @@ -13,7 +13,7 @@ class SearchPackage extends Form { - public function __construct($name = null) + public function __construct() { parent::__construct('SearchOrder'); $this->setAttribute('method', 'get'); diff --git a/module/Admin/src/Admin/Form/SearchUser.php b/module/Admin/src/Admin/Form/SearchUser.php index 7f0ca371..42e6d022 100644 --- a/module/Admin/src/Admin/Form/SearchUser.php +++ b/module/Admin/src/Admin/Form/SearchUser.php @@ -13,7 +13,7 @@ class SearchUser extends Form { - public function __construct($name = null) + public function __construct() { parent::__construct('SearchOrder'); $this->setAttribute('method', 'get'); diff --git a/module/Admin/src/Admin/Form/Status.php b/module/Admin/src/Admin/Form/Status.php index ff575244..09bb2b06 100644 --- a/module/Admin/src/Admin/Form/Status.php +++ b/module/Admin/src/Admin/Form/Status.php @@ -12,7 +12,7 @@ class Status extends Form { - public function __construct($name = null) + public function __construct() { // we want to ignore the name passed parent::__construct('Status'); diff --git a/module/Admin/src/Admin/Form/Tax.php b/module/Admin/src/Admin/Form/Tax.php index 92c8e361..2cab469d 100644 --- a/module/Admin/src/Admin/Form/Tax.php +++ b/module/Admin/src/Admin/Form/Tax.php @@ -12,7 +12,7 @@ class Tax extends Form { - public function __construct($name = null) + public function __construct() { // we want to ignore the name passed parent::__construct('Tax'); diff --git a/module/Admin/src/Admin/Form/UploadCsv.php b/module/Admin/src/Admin/Form/UploadCsv.php index fdec5ecb..a60740c9 100644 --- a/module/Admin/src/Admin/Form/UploadCsv.php +++ b/module/Admin/src/Admin/Form/UploadCsv.php @@ -13,7 +13,7 @@ class UploadCsv extends Form { - public function __construct($name = null) + public function __construct() { parent::__construct('UploadCsv'); $this->setAttribute('method', 'post'); diff --git a/module/Admin/src/Admin/InputFilter/SearchOrder.php b/module/Admin/src/Admin/InputFilter/SearchOrder.php index da02a202..080b9a26 100644 --- a/module/Admin/src/Admin/InputFilter/SearchOrder.php +++ b/module/Admin/src/Admin/InputFilter/SearchOrder.php @@ -17,7 +17,7 @@ class SearchOrder implements InputFilterAwareInterface { protected $inputFilter; - public function setInputFilter(InputFilterInterface $inputFilter) { + public function setInputFilter(InputFilterInterface $inputFilter) { throw new \Exception("Not used"); } diff --git a/module/Admin/src/Admin/InputFilter/User.php b/module/Admin/src/Admin/InputFilter/User.php index a1c062ac..6721fb60 100644 --- a/module/Admin/src/Admin/InputFilter/User.php +++ b/module/Admin/src/Admin/InputFilter/User.php @@ -185,13 +185,6 @@ public function getInputFilter() \Zend\Validator\Callback::INVALID_VALUE => 'There is already a person with this email address in the system.', ), 'callback' => function($value, $context=array()) { - /*if( - isset($context['session_id']) && - is_numeric($context['session_id']) && - $context['session_id'] != 0 - ) { - return true; - }*/ $entityManager = $this->getServiceLocator() ->get('Doctrine\ORM\EntityManager'); $user = $entityManager->getRepository('ErsBase\Entity\User') diff --git a/module/Application/Module.php b/module/Application/Module.php index 7754b6b9..644d7e6d 100644 --- a/module/Application/Module.php +++ b/module/Application/Module.php @@ -14,25 +14,25 @@ class Module { - public function onBootstrap(MvcEvent $e) + public function onBootstrap(MvcEvent $event) { - $eventManager = $e->getApplication()->getEventManager(); + $eventManager = $event->getApplication()->getEventManager(); $moduleRouteListener = new ModuleRouteListener(); $moduleRouteListener->attach($eventManager); - #$serviceManager = $e->getApplication()->getServiceManager(); + #$serviceManager = $event->getApplication()->getServiceManager(); // Add ACL information to the Navigation view helper #$authorize = $serviceManager->get('BjyAuthorize\Service\Authorize'); #$acl = $authorize->getAcl(); #\Zend\View\Helper\Navigation::setDefaultAcl($acl); #\Zend\View\Helper\Navigation::setDefaultRole('guest'); - $eventManager->attach('render', function($e) { - $serviceManager = $e->getApplication()->getServiceManager(); + $eventManager->attach('render', function($event) { + $serviceManager = $event->getApplication()->getServiceManager(); $config = $serviceManager->get('Config'); - $view = $e->getViewModel(); + $view = $event->getViewModel(); $view->setVariable('ers_config', $config['ERS']); }); } diff --git a/module/ErsBase/config/module.config.php b/module/ErsBase/config/module.config.php index c5628a54..bff81769 100644 --- a/module/ErsBase/config/module.config.php +++ b/module/ErsBase/config/module.config.php @@ -10,7 +10,6 @@ 'service_manager' => [ 'aliases' => [ 'translator' => 'MvcTranslator', - #'Logger' => 'EddieJaoude\Zf2Logger', ], 'shared' => [ 'DOMPDF' => false, diff --git a/module/ErsBase/src/ErsBase/Entity/Code.php b/module/ErsBase/src/ErsBase/Entity/Code.php index b15b77a3..37f425c8 100644 --- a/module/ErsBase/src/ErsBase/Entity/Code.php +++ b/module/ErsBase/src/ErsBase/Entity/Code.php @@ -96,9 +96,9 @@ public function checkCode() { $code = substr($this->getValue(),0,$this->length); if($this->genChecksum($code) == $checksum) { return true; - } else { - return false; } + + return false; } private function normalizeText($text) { diff --git a/module/ErsBase/src/ErsBase/Entity/Order.php b/module/ErsBase/src/ErsBase/Entity/Order.php index b3c825be..4730c203 100644 --- a/module/ErsBase/src/ErsBase/Entity/Order.php +++ b/module/ErsBase/src/ErsBase/Entity/Order.php @@ -75,16 +75,16 @@ public function __toString() { private function genHash() { $alphabet = "0123456789ACDFGHKMNPRUVWXY"; $memory = ''; - $n = ''; + $randNumber = ''; #srand(time()); srand(rand()*time()); for ($i = 0; $i < $this->length; $i++) { - while($n == '' || $memory == $alphabet[$n]) { - $n = rand(0, strlen($alphabet)-1); + while($randNumber == '' || $memory == $alphabet[$randNumber]) { + $randNumber = rand(0, strlen($alphabet)-1); } - $memory = $alphabet[$n]; - $code[$i] = $alphabet[$n]; + $memory = $alphabet[$randNumber]; + $code[$i] = $alphabet[$randNumber]; } $this->setHashkey(implode($code).$this->genChecksum(implode($code))); @@ -228,9 +228,9 @@ public function getPackageByItemId($item_id) { * * @return Entity\Package */ - public function getPackageByParticipantId($id) { + public function getPackageByParticipantId($participantId) { foreach($this->getPackages() as $package) { - if($package->getParticipant()->getId() == $id) { + if($package->getParticipant()->getId() == $participantId) { return $package; } } @@ -422,9 +422,9 @@ public function getParticipantByEmail($email) { * @return Entity\User * @return false */ - public function getParticipantById($id) { + public function getParticipantById($participantId) { foreach($this->getParticipants() as $participant) { - if($participant->getId() == $id) { + if($participant->getId() == $participantId) { return $participant; } } diff --git a/module/ErsBase/src/ErsBase/Entity/Package.php b/module/ErsBase/src/ErsBase/Entity/Package.php index 867ee994..d907a381 100644 --- a/module/ErsBase/src/ErsBase/Entity/Package.php +++ b/module/ErsBase/src/ErsBase/Entity/Package.php @@ -119,10 +119,10 @@ public function addItem(\ErsBase\Entity\Base\Item $item) * * @param type $id */ - public function removeItemById($id) { - $item = $this->getItemById($id); + public function removeItemById($itemId) { + $item = $this->getItemById($itemId); if(!$item) { - throw new \Exception('Unable to remove item with id '.$id); + throw new \Exception('Unable to remove item with id '.$itemId); } return $this->removeItem($item); } @@ -169,9 +169,9 @@ public function getItemCount() { * * @return \Entity\Item */ - public function getItemById($id) { + public function getItemById($itemId) { foreach($this->getItems() as $item) { - if($item->getId() == $id) { + if($item->getId() == $itemId) { return $item; } } diff --git a/module/ErsBase/src/ErsBase/Entity/Product.php b/module/ErsBase/src/ErsBase/Entity/Product.php index a6f5da5c..3dc841cb 100644 --- a/module/ErsBase/src/ErsBase/Entity/Product.php +++ b/module/ErsBase/src/ErsBase/Entity/Product.php @@ -200,7 +200,7 @@ public function getPriceCount() { public function getFormerPrices() { $now = new \DateTime(); - $diff = 0; + #$diff = 0; $ret = new ArrayCollection(); foreach($this->getProductPrices() as $price) { if($now > $price->getDeadline()->getDeadline()) { diff --git a/module/ErsBase/src/ErsBase/Entity/User.php b/module/ErsBase/src/ErsBase/Entity/User.php index b6bd729b..f9325bdb 100644 --- a/module/ErsBase/src/ErsBase/Entity/User.php +++ b/module/ErsBase/src/ErsBase/Entity/User.php @@ -110,8 +110,7 @@ public function setBirthday($birthday) if($birthday instanceof \DateTime) { $this->birthday = $birthday; } elseif(is_string($birthday)) { - $this->birthday = \DateTime::createFromFormat('d.m.Y', $birthday); - #$this->birthday = new \DateTime($birthday); + $this->birthday = \date_create_from_format('d.m.Y', $birthday); } return $this; diff --git a/module/ErsBase/src/ErsBase/Service/StatusService.php b/module/ErsBase/src/ErsBase/Service/StatusService.php index 2670c61d..884c3baf 100644 --- a/module/ErsBase/src/ErsBase/Service/StatusService.php +++ b/module/ErsBase/src/ErsBase/Service/StatusService.php @@ -71,6 +71,7 @@ public function setOrderStatus(Entity\Order $order, $status, $flush=true) { } public function setPackageStatus(Entity\Package $package, $status, $flush=true) { + $logger = $this->getServiceLocator()->get('Logger'); $entityManager = $this->getServiceLocator() ->get('Doctrine\ORM\EntityManager'); if(is_string($status)) { @@ -87,7 +88,7 @@ public function setPackageStatus(Entity\Package $package, $status, $flush=true) foreach($package->getItems() as $item) { if(!in_array($item->getStatus()->getValue(), $ignore)) { if($item->getStatus()->getValue() != $status->getValue()) { - error_log("set item (".$item->getId().") status from ".$item->getStauts()->getValue()." to ".$status->getValue()); + $logger->info("set item (".$item->getId().") status from ".$item->getStatus()->getValue()." to ".$status->getValue()); } $this->setItemStatus($item, $status, false); } diff --git a/module/ErsBase/src/ErsBase/Service/TicketCounterService.php b/module/ErsBase/src/ErsBase/Service/TicketCounterService.php index 62aba7b6..a7b6bbf3 100644 --- a/module/ErsBase/src/ErsBase/Service/TicketCounterService.php +++ b/module/ErsBase/src/ErsBase/Service/TicketCounterService.php @@ -56,7 +56,7 @@ public function checkLimits() { $count = $this->getCurrentItemCount($counter); if ($count >= $counter->getValue()) { - $logger = $this->sl->get('Logger'); + $logger = $this->getServiceLocator()->get('Logger'); $logger->info('Disabling variant values of counter "' . $counter->getName() . '" because ' . $counter->getValue() . ' items were reached.'); // NOTE: Disabling all associated variant values is actually semantically wrong. diff --git a/module/OnsiteReg/src/OnsiteReg/Form/ConfirmItems.php b/module/OnsiteReg/src/OnsiteReg/Form/ConfirmItems.php index e469e9af..d8370643 100644 --- a/module/OnsiteReg/src/OnsiteReg/Form/ConfirmItems.php +++ b/module/OnsiteReg/src/OnsiteReg/Form/ConfirmItems.php @@ -13,7 +13,7 @@ class ConfirmItems extends Form { - public function __construct($name = null) + public function __construct() { parent::__construct('ConfirmItems'); $this->setAttribute('method', 'post'); diff --git a/module/OnsiteReg/src/OnsiteReg/Form/UndoItem.php b/module/OnsiteReg/src/OnsiteReg/Form/UndoItem.php index 7cee160d..eebe4285 100644 --- a/module/OnsiteReg/src/OnsiteReg/Form/UndoItem.php +++ b/module/OnsiteReg/src/OnsiteReg/Form/UndoItem.php @@ -13,7 +13,7 @@ class UndoItem extends Form { - public function __construct($name = null) + public function __construct() { parent::__construct('UndoItems'); $this->setAttribute('method', 'post'); diff --git a/module/PreReg/Module.php b/module/PreReg/Module.php index c99461a7..8c3c3853 100644 --- a/module/PreReg/Module.php +++ b/module/PreReg/Module.php @@ -17,35 +17,37 @@ class Module { - public function onBootstrap($e) + public function onBootstrap($event) { - $eventManager = $e->getApplication()->getEventManager(); + $eventManager = $event->getApplication()->getEventManager(); #$strategy = new RedirectionStrategy(); // eventually set the URI to be used for redirects - #$baseUrl = $e->getRequest()->getUriString(); + #$baseUrl = $event->getRequest()->getUriString(); #$strategy->setRedirectUri('/user/login?redirect='.\rawurlencode($baseUrl)); #$eventManager->attach($strategy); - $eventManager->getSharedManager()->attach('Zend\Mvc\Controller\AbstractActionController', 'dispatch', function($e) { - $controller = $e->getTarget(); + $eventManager->getSharedManager()->attach('Zend\Mvc\Controller\AbstractActionController', 'dispatch', function($event) { + $controller = $event->getTarget(); $controllerClass = get_class($controller); $moduleNamespace = substr($controllerClass, 0, strpos($controllerClass, '\\')); - $config = $e->getApplication()->getServiceManager()->get('config'); + $config = $event->getApplication()->getServiceManager()->get('config'); if (isset($config['module_layouts'][$moduleNamespace])) { $controller->layout($config['module_layouts'][$moduleNamespace]); } }, 100); + + # bootstrap session $moduleRouteListener = new ModuleRouteListener(); $moduleRouteListener->attach($eventManager); - $this->bootstrapSession($e); + $this->bootstrapSession($event); - $translator = $e->getApplication()->getServiceManager()->get('translator'); + $translator = $event->getApplication()->getServiceManager()->get('translator'); $translator->setLocale('en_US'); setlocale(LC_TIME, 'en_US'); - $application = $e->getApplication(); + $application = $event->getApplication(); $serviceManager = $application->getServiceManager(); $auth = $serviceManager->get('BjyAuthorize\Service\Authorize'); @@ -58,10 +60,10 @@ public function onBootstrap($e) $sharedManager = $application->getEventManager()->getSharedManager(); $sharedManager->attach('Zend\Mvc\Application', 'dispatch.error', - function($e) use ($serviceManager) { - if ($e->getParam('exception')){ + function($event) use ($serviceManager) { + if ($event->getParam('exception')){ $emailService = $serviceManager->get('ErsBase\Service\EmailService'); - $emailService->sendExceptionEmail($e->getParam('exception')); + $emailService->sendExceptionEmail($event->getParam('exception')); } } ); @@ -83,56 +85,58 @@ function($e) use ($serviceManager) { }); } - public function bootstrapSession($e) + public function bootstrapSession($event) { if(\Zend\Console\Console::isConsole()) { #echo "not starting session -> console".PHP_EOL; return; } - $sessionManager = $e->getApplication() + $sessionManager = $event->getApplication() ->getServiceManager() ->get('Zend\Session\SessionManager'); $sessionManager->start(); - #error_log(var_export($_SESSION, true)); - $container = new Container('ers'); - #error_log('session: '.$container->init); - if (!isset($container->init)) { - #error_log('initializing session ('.$container->init.')'); - $serviceManager = $e->getApplication()->getServiceManager(); - $request = $serviceManager->get('Request'); + if (isset($container->init)) { + return; + } + + $serviceManager = $event->getApplication()->getServiceManager(); + $request = $serviceManager->get('Request'); - $sessionManager->regenerateId(true); - $container->init = 1; - $container->remoteAddr = $request->getServer()->get('REMOTE_ADDR'); - $container->httpUserAgent = $request->getServer()->get('HTTP_USER_AGENT'); - - $config = $serviceManager->get('Config'); - if (!isset($config['session'])) { - return; - } + $sessionManager->regenerateId(true); + $container->init = 1; + $container->remoteAddr = $request->getServer()->get('REMOTE_ADDR'); + # not needed since we do not check this. + #$container->httpUserAgent = $request->getServer()->get('HTTP_USER_AGENT'); - $sessionConfig = $config['session']; - if (isset($sessionConfig['validators'])) { - $chain = $sessionManager->getValidatorChain(); + $config = $serviceManager->get('Config'); + if (!isset($config['session'])) { + return; + } - foreach ($sessionConfig['validators'] as $validator) { - switch ($validator) { - case 'Zend\Session\Validator\HttpUserAgent': - $validator = new $validator($container->httpUserAgent); - break; - case 'Zend\Session\Validator\RemoteAddr': - $validator = new $validator($container->remoteAddr); - break; - default: - $validator = new $validator(); - } + $sessionConfig = $config['session']; + + if (! isset($sessionConfig['validators'])) { + return; + } - $chain->attach('session.validate', array($validator, 'isValid')); - } + $chain = $sessionManager->getValidatorChain(); + + foreach ($sessionConfig['validators'] as $validator) { + switch ($validator) { + case Validator\HttpUserAgent::class: + $validator = new $validator($container->httpUserAgent); + break; + case Validator\RemoteAddr::class: + $validator = new $validator($container->remoteAddr); + break; + default: + $validator = new $validator(); } + + $chain->attach('session.validate', array($validator, 'isValid')); } $expiration_time = 3600; @@ -147,13 +151,11 @@ public function bootstrapSession($e) $container->getManager()->getStorage()->clear('ers'); $container = new Container('ers'); $container->init = 1; - $container->lifetime = time()+$expiration_time; $container->checkout = array(); $container->getManager()->getStorage()->clear('cart'); - } else { - $container->lifetime = time()+$expiration_time; } + $container->lifetime = time()+$expiration_time; if(!isset($container->currency)) { # TODO: put this into a CurrencyService @@ -165,7 +167,7 @@ public function bootstrapSession($e) $container->currency = 'EUR'; } - $serviceManager = $e->getApplication()->getServiceManager(); + $orderService = $serviceManager->get('ErsBase\Service\OrderService'); $order = $orderService->getOrder(); if($order->getCurrency()->getShort() != $container->currency) { @@ -227,43 +229,49 @@ public function getServiceConfig() { return $logger; }, - 'Zend\Session\SessionManager' => function ($serviceManager) { - $config = $serviceManager->get('config'); - if (isset($config['session'])) { - $session = $config['session']; + SessionManager::class => function ($container) { + $config = $container->get('config'); + if (! isset($config['session'])) { + $sessionManager = new SessionManager(); + Container::setDefaultManager($sessionManager); + return $sessionManager; + } - $sessionConfig = null; - if (isset($session['config'])) { - $class = isset($session['config']['class']) ? $session['config']['class'] : 'Zend\Session\Config\SessionConfig'; - $options = isset($session['config']['options']) ? $session['config']['options'] : array(); - $sessionConfig = new $class(); - $sessionConfig->setOptions($options); - } + $session = $config['session']; - $sessionStorage = null; - if (isset($session['storage'])) { - $class = $session['storage']; - $sessionStorage = new $class(); - } + $sessionConfig = null; + if (isset($session['config'])) { + $class = isset($session['config']['class']) + ? $session['config']['class'] + : SessionConfig::class; - $sessionSaveHandler = null; - if (isset($session['save_handler'])) { - // class should be fetched from service manager since it will require constructor arguments - $sessionSaveHandler = $serviceManager->get($session['save_handler']); - } + $options = isset($session['config']['options']) + ? $session['config']['options'] + : []; - $sessionManager = new SessionManager($sessionConfig, $sessionStorage, $sessionSaveHandler); + $sessionConfig = new $class(); + $sessionConfig->setOptions($options); + } - if (isset($session['validators'])) { - $chain = $sessionManager->getValidatorChain(); - foreach ($session['validators'] as $validator) { - $validator = new $validator(); - $chain->attach('session.validate', array($validator, 'isValid')); - } - } - } else { - $sessionManager = new SessionManager(); + $sessionStorage = null; + if (isset($session['storage'])) { + $class = $session['storage']; + $sessionStorage = new $class(); + } + + $sessionSaveHandler = null; + if (isset($session['save_handler'])) { + // class should be fetched from service manager + // since it will require constructor arguments + $sessionSaveHandler = $container->get($session['save_handler']); } + + $sessionManager = new SessionManager( + $sessionConfig, + $sessionStorage, + $sessionSaveHandler + ); + Container::setDefaultManager($sessionManager); return $sessionManager; }, diff --git a/module/PreReg/config/module.config.php b/module/PreReg/config/module.config.php index 52821fc0..7104e14d 100644 --- a/module/PreReg/config/module.config.php +++ b/module/PreReg/config/module.config.php @@ -416,9 +416,17 @@ }, ), ), - 'session_manager' => array( - 'validators' => array( - 'Zend\Session\Validator\RemoteAddr', - ), - ), + 'session_manager' => [ + /*'config' => [ + 'class' => Session\Config\SessionConfig::class, + 'options' => [ + 'name' => 'myapp', + ], + ],*/ + 'storage' => Session\Storage\SessionArrayStorage::class, + 'validators' => [ + Session\Validator\RemoteAddr::class, + Session\Validator\HttpUserAgent::class, + ], + ], ); diff --git a/module/PreReg/src/PreReg/Controller/ParticipantController.php b/module/PreReg/src/PreReg/Controller/ParticipantController.php index 79ab5a1a..d8b08226 100644 --- a/module/PreReg/src/PreReg/Controller/ParticipantController.php +++ b/module/PreReg/src/PreReg/Controller/ParticipantController.php @@ -76,10 +76,9 @@ public function addAction() { $entityManager = $this->getServiceLocator()->get('Doctrine\ORM\EntityManager'); - if ($user->getCountryId() == 0) { - $user->setCountryId(null); - $user->setCountry(null); - } else { + $user->setCountryId(null); + $user->setCountry(null); + if ($user->getCountryId() != 0) { $country = $entityManager->getRepository('ErsBase\Entity\Country') ->findOneBy(array('id' => $user->getCountryId())); $user->setCountryId($country->getId()); diff --git a/module/PreReg/src/PreReg/Controller/PaymentController.php b/module/PreReg/src/PreReg/Controller/PaymentController.php index 8972b6ed..1a3c4698 100644 --- a/module/PreReg/src/PreReg/Controller/PaymentController.php +++ b/module/PreReg/src/PreReg/Controller/PaymentController.php @@ -157,14 +157,13 @@ public function iPaymentAction() { #$logger = $this->getServiceLocator()->get('Logger'); - if($order != null) { - $a = new \NumberFormatter("de-DE", \NumberFormatter::PATTERN_DECIMAL); - $a->setAttribute(\NumberFormatter::MIN_FRACTION_DIGITS, 0); - $a->setAttribute(\NumberFormatter::MAX_FRACTION_DIGITS, 0); - $trx_amount = $a->format($order->getSum()*100); # amount in cents - } else { + if($order == null) { return $this->redirect()->toRoute('order', array('action' => 'cc-error')); } + $a = new \NumberFormatter("de-DE", \NumberFormatter::PATTERN_DECIMAL); + $a->setAttribute(\NumberFormatter::MIN_FRACTION_DIGITS, 0); + $a->setAttribute(\NumberFormatter::MAX_FRACTION_DIGITS, 0); + $trx_amount = $a->format($order->getSum()*100); # amount in cents $trx_securityhash = \md5($trxuser_id.$trx_amount.$trx_currency.$trxpassword.$sec_key); @@ -225,8 +224,6 @@ public function creditcardAction() { $tmp_action = $config['ERS\iPayment']['action']; $action = preg_replace('/%account_id%/', $account_id, $tmp_action); - $logger = $this->getServiceLocator()->get('Logger'); - if($order != null) { $a = new \NumberFormatter("de-DE", \NumberFormatter::PATTERN_DECIMAL); $a->setAttribute(\NumberFormatter::MIN_FRACTION_DIGITS, 0); @@ -318,10 +315,7 @@ public function ccCheckAction() { $request = new \Zend\Http\PhpEnvironment\Request(); - $ipmatch = false; - if(in_array($request->getServer('REMOTE_ADDR'), $allowed_ips)) { - $ipmatch = true; - } else { + if(!in_array($request->getServer('REMOTE_ADDR'), $allowed_ips)) { $logger->warn('unauthorized hidden trigger from: '.$request->getServer('REMOTE_ADDR')); return $response; } @@ -379,20 +373,9 @@ public function ccCheckAction() { $item->setStatus($status); } } - /*foreach($order->getItems() as $item) { - #$item->setStatus('paid'); - $item->setStatus($status); - $entityManager->persist($item); - }*/ $order->setStatus($status); - - /*$orderStatus = new Entity\OrderStatus; - $orderStatus->setOrder($order); - $orderStatus->setValue('paid'); - $order->addOrderStatus($orderStatus);*/ $entityManager->persist($order); - #$entityManager->persist($orderStatus); $entityManager->flush(); return $response; diff --git a/module/PreReg/src/PreReg/Form/Buyer.php b/module/PreReg/src/PreReg/Form/Buyer.php index ee2e13d5..b1b5485e 100644 --- a/module/PreReg/src/PreReg/Form/Buyer.php +++ b/module/PreReg/src/PreReg/Form/Buyer.php @@ -15,7 +15,7 @@ class Buyer extends Form { - public function __construct($name = null) + public function __construct() { parent::__construct('Buyer'); diff --git a/module/PreReg/src/PreReg/Form/ChangePassword.php b/module/PreReg/src/PreReg/Form/ChangePassword.php index e2ad211f..842a09de 100644 --- a/module/PreReg/src/PreReg/Form/ChangePassword.php +++ b/module/PreReg/src/PreReg/Form/ChangePassword.php @@ -17,7 +17,7 @@ class ChangePassword extends Form { public $inputFilter; - public function __construct($name = null) + public function __construct() { parent::__construct('Participant'); diff --git a/module/PreReg/src/PreReg/Form/Checkout.php b/module/PreReg/src/PreReg/Form/Checkout.php index 6cd97211..e3ff7d47 100644 --- a/module/PreReg/src/PreReg/Form/Checkout.php +++ b/module/PreReg/src/PreReg/Form/Checkout.php @@ -17,7 +17,7 @@ class Checkout extends Form { public $inputFilter; - public function __construct($name = null) + public function __construct() { parent::__construct('Buyer'); diff --git a/module/PreReg/src/PreReg/Form/CreditCard.php b/module/PreReg/src/PreReg/Form/CreditCard.php index b74bebc9..d0e6dd6b 100644 --- a/module/PreReg/src/PreReg/Form/CreditCard.php +++ b/module/PreReg/src/PreReg/Form/CreditCard.php @@ -17,7 +17,7 @@ class CreditCard extends Form { public $inputFilter; - public function __construct($name = null) + public function __construct() { parent::__construct('CreditCard'); diff --git a/module/PreReg/src/PreReg/Form/ETicketSelect.php b/module/PreReg/src/PreReg/Form/ETicketSelect.php index 9723b78d..2944182d 100644 --- a/module/PreReg/src/PreReg/Form/ETicketSelect.php +++ b/module/PreReg/src/PreReg/Form/ETicketSelect.php @@ -17,7 +17,7 @@ class ETicketSelect extends Form { public $inputFilter; - public function __construct($name = null) + public function __construct() { parent::__construct('ETicketSelect'); diff --git a/module/PreReg/src/PreReg/Form/PaymentType.php b/module/PreReg/src/PreReg/Form/PaymentType.php index c6475aa5..d24e6005 100644 --- a/module/PreReg/src/PreReg/Form/PaymentType.php +++ b/module/PreReg/src/PreReg/Form/PaymentType.php @@ -17,7 +17,7 @@ class PaymentType extends Form { public $inputFilter; - public function __construct($name = null) + public function __construct() { parent::__construct('PaymentType'); diff --git a/module/PreReg/src/PreReg/Form/Register.php b/module/PreReg/src/PreReg/Form/Register.php index 0c6ce477..3a217ff4 100644 --- a/module/PreReg/src/PreReg/Form/Register.php +++ b/module/PreReg/src/PreReg/Form/Register.php @@ -17,7 +17,7 @@ class Register extends Form { public $inputFilter; - public function __construct($name = null) + public function __construct() { parent::__construct('Buyer'); diff --git a/module/PreReg/src/PreReg/Form/RequestPassword.php b/module/PreReg/src/PreReg/Form/RequestPassword.php index 2d00cff4..1cc6c250 100644 --- a/module/PreReg/src/PreReg/Form/RequestPassword.php +++ b/module/PreReg/src/PreReg/Form/RequestPassword.php @@ -14,7 +14,7 @@ class RequestPassword extends Form { public $inputFilter; - public function __construct($name = null) + public function __construct() { parent::__construct('RequestPassword'); diff --git a/module/PreReg/src/PreReg/Form/ResetPassword.php b/module/PreReg/src/PreReg/Form/ResetPassword.php index 1cde6db9..d2625b70 100644 --- a/module/PreReg/src/PreReg/Form/ResetPassword.php +++ b/module/PreReg/src/PreReg/Form/ResetPassword.php @@ -14,7 +14,7 @@ class ResetPassword extends Form { public $inputFilter; - public function __construct($name = null) + public function __construct() { parent::__construct('ResetPassword'); diff --git a/module/PreReg/src/PreReg/Form/User.php b/module/PreReg/src/PreReg/Form/User.php index db60d7e7..d680a815 100644 --- a/module/PreReg/src/PreReg/Form/User.php +++ b/module/PreReg/src/PreReg/Form/User.php @@ -17,7 +17,7 @@ class User extends Form { public $inputFilter; - public function __construct($name = null) + public function __construct() { parent::__construct('Participant'); diff --git a/public/js/custom.js b/public/js/custom.js index 11c6d604..5f70b342 100644 --- a/public/js/custom.js +++ b/public/js/custom.js @@ -9,8 +9,8 @@ function makeid() { - var text = ""; - var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + var text = ''; + var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; for( var i=0; i < 6; i++ ) text += possible.charAt(Math.floor(Math.random() * possible.length)); @@ -27,7 +27,7 @@ jQuery(function($) { window.sessionStorage.setItem('tabId', makeid()); } $.ajax({ - url:"/ajax/session-storage/"+window.sessionStorage.getItem('tabId') + url:'/ajax/session-storage/'+window.sessionStorage.getItem('tabId') }).done(function(data) { $('#tabId').html(data); }); @@ -35,8 +35,8 @@ jQuery(function($) { }); $('.datepicker').datepicker({ - /*dateFormat: "yy-mm-dd",*/ - dateFormat: "dd.mm.yy", + /*dateFormat: 'yy-mm-dd',*/ + dateFormat: 'dd.mm.yy', addSliderAccess: true, firstDay: 1, changeMonth: true, @@ -54,8 +54,8 @@ jQuery(function($) { } }); $('.datetimepicker').datetimepicker({ - timeFormat: "HH:mm:ss", - dateFormat: "yy-mm-dd", + timeFormat: 'HH:mm:ss', + dateFormat: 'yy-mm-dd', addSliderAccess: true, sliderAccessArgs: { touchonly: false } }); @@ -66,17 +66,17 @@ jQuery(function($) { cookiePolicyLink: '/info/cookie' }); - $( "#person-detail" ).tabs({ + $( '#person-detail' ).tabs({ create: function( event, ui ) { - $( "#person-detail" ).find('input').prop('disabled', true); - $( "#person-detail" ).find('select').prop('disabled', true); + $( '#person-detail' ).find('input').prop('disabled', true); + $( '#person-detail' ).find('select').prop('disabled', true); ui.panel.find('input').prop('disabled', false); ui.panel.find('select').prop('disabled', false); }, /*activate: function( event, ui ) {},*/ beforeActivate: function( event, ui ) { - $( "#person-detail" ).find('input').prop('disabled', true); - $( "#person-detail" ).find('select').prop('disabled', true); + $( '#person-detail' ).find('input').prop('disabled', true); + $( '#person-detail' ).find('select').prop('disabled', true); ui.newPanel.find('input').prop('disabled', false); ui.newPanel.find('select').prop('disabled', false); } diff --git a/public/js/custom_backend.js b/public/js/custom_backend.js index 0a9b4822..ec9a95f6 100644 --- a/public/js/custom_backend.js +++ b/public/js/custom_backend.js @@ -8,29 +8,29 @@ // /public/js/custom.js function loadChangePaymenttype(currencyId) { - var url = "/admin/ajax/choose-payment-types/" + currencyId; + var url = '/admin/ajax/choose-payment-types/' + currencyId; var count = 1; $.getJSON( url, function( data ) { - var options = ""; + var options = ''; $.each(data, function(id, content) { if(typeof content.name === 'undefined') { return true; } - var disabled = " disabled"; + var disabled = ' disabled'; if(content.active === true) { - disabled = ""; + disabled = ''; } options += ""; count++; }); - $("#change-paymenttype").html(options).fadeIn(); + $('#change-paymenttype').html(options).fadeIn(); }); } jQuery(function($) { $('.datepicker').datepicker({ - /*dateFormat: "yy-mm-dd",*/ - dateFormat: "dd.mm.yy", + /*dateFormat: 'yy-mm-dd',*/ + dateFormat: 'dd.mm.yy', addSliderAccess: true, firstDay: 1, changeMonth: true, @@ -44,8 +44,8 @@ jQuery(function($) { }*/ }); $('.datetimepicker').datetimepicker({ - timeFormat: "HH:mm:ss", - dateFormat: "yy-mm-dd", + timeFormat: 'HH:mm:ss', + dateFormat: 'yy-mm-dd', addSliderAccess: true, sliderAccessArgs: { touchonly: false } }); @@ -55,55 +55,55 @@ jQuery(function($) { $('#matching-accordion .in').collapse('hide'); });*/ $('#order-accordion .accordion-toggle').click(function () { - if($(this).hasClass("panelisopen")){ - $(this).removeClass("panelisopen"); + if($(this).hasClass('panelisopen')){ + $(this).removeClass('panelisopen'); } else { var href = this.hash; - var orderId = href.replace("#order",""); + var orderId = href.replace('#order',''); - $(this).addClass("panelisopen"); + $(this).addClass('panelisopen'); - $.get( "/admin/ajax/matching-order/" + orderId, function( data ) { - $( "#order" + orderId ).html( data ); + $.get( '/admin/ajax/matching-order/' + orderId, function( data ) { + $( '#order' + orderId ).html( data ); }); } }); $('#bankaccount-accordion .accordion-toggle').click(function () { /*$('#statement-accordion .accordion-toggle').click(function () {*/ - if($(this).hasClass("panelisopen")){ - $(this).removeClass("panelisopen"); + if($(this).hasClass('panelisopen')){ + $(this).removeClass('panelisopen'); } else { var href = this.hash; - var bankaccountId = href.replace("#bankaccount",""); + var bankaccountId = href.replace('#bankaccount',''); - $(this).addClass("panelisopen"); + $(this).addClass('panelisopen'); - $( "#bankaccount" + bankaccountId ).html('

'); - $.get( "/admin/ajax/matching-bankstatement/" + bankaccountId, function( data ) { - $( "#bankaccount" + bankaccountId ).html( data ); + $( '#bankaccount' + bankaccountId ).html('

'); + $.get( '/admin/ajax/matching-bankstatement/' + bankaccountId, function( data ) { + $( '#bankaccount' + bankaccountId ).html( data ); $('#statement-accordion .accordion-toggle').click(function () { - if($(this).hasClass("panelisopen")){ - $(this).removeClass("panelisopen"); + if($(this).hasClass('panelisopen')){ + $(this).removeClass('panelisopen'); } else { var href = this.hash; - var bankaccountId = href.replace("#statement",""); + var bankaccountId = href.replace('#statement',''); - $(this).addClass("panelisopen"); + $(this).addClass('panelisopen'); - $.get( "/admin/ajax/matching-statementcols/" + bankaccountId, function( data ) { - $( "#statement" + bankaccountId ).html( data ); + $.get( '/admin/ajax/matching-statementcols/' + bankaccountId, function( data ) { + $( '#statement' + bankaccountId ).html( data ); }); } }); }) .fail(function() { alert('failed to load bank statements'); - $( "#bankaccount" + bankaccountId ).html('

'); + $( '#bankaccount' + bankaccountId ).html('

'); });; } }); - $(".disabled").click(function(event) { + $('.disabled').click(function(event) { event.preventDefault(); return false; }); @@ -117,14 +117,14 @@ jQuery(function($) { }); - $("#change-currency").change(function () { + $('#change-currency').change(function () { var currencyId = $(this).val(); - if(currencyId !== "") { + if(currencyId !== '') { loadChangePaymenttype(currencyId); } }); }); $(document).ready(function() { - $(".dropdown-toggle").dropdown(); + $('.dropdown-toggle').dropdown(); }); \ No newline at end of file diff --git a/public/js/custom_onsite.js b/public/js/custom_onsite.js index 782bb586..633153af 100644 --- a/public/js/custom_onsite.js +++ b/public/js/custom_onsite.js @@ -72,7 +72,7 @@ jQuery(function($) { function updateConfirmButton() { var anythingSelected = $itemCheckboxes.is(':checked'); - var agegroupConfirmed = ($confirmAgegroupCheckbox.length == 0 || $confirmAgegroupCheckbox.prop('checked')); + var agegroupConfirmed = ($confirmAgegroupCheckbox.length === 0 || $confirmAgegroupCheckbox.prop('checked')); if(!anythingSelected || !agegroupConfirmed) { $confirmButton.prop('disabled', true); $confirmButton.prop('class', 'btn btn-lg btn-danger confirm-items-button'); @@ -111,22 +111,26 @@ jQuery(function($) { $itemCheckboxes.change(function() { var $container = $(this).closest('li'); - if($(this).prop('checked')) + if($(this).prop('checked')) { $container.addClass('light-green-bg'); - else + } else { $container.removeClass('light-green-bg'); + } updateConfirmButton(); - if($itemCheckboxes.not(':checked').length === 0) + if($itemCheckboxes.not(':checked').length === 0) { $selectAllButton.text('Select none'); - else + } else { $selectAllButton.text('Select all'); + } }); - if($itemCheckboxes.length === 0) + if($itemCheckboxes.length === 0) { $selectAllButton.prop('disabled', true); + } - if(!$('.package-detail-view').length) + if(!$('.package-detail-view').length) { $('.onsite-search-box').focus(); + } }); \ No newline at end of file diff --git a/public/js/html5shiv.js b/public/js/html5shiv.js deleted file mode 100644 index dcf351c8..00000000 --- a/public/js/html5shiv.js +++ /dev/null @@ -1,8 +0,0 @@ -/* - HTML5 Shiv v3.6.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed -*/ -(function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag(); -a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/\w+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x"; -c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode|| -"undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup main mark meter nav output progress section summary time video",version:"3.6.2",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);if(g)return a.createDocumentFragment(); -for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d #mq-test-1 { width: 42px; }',d.insertBefore(f,e),c=42===g.offsetWidth,d.removeChild(f),{matches:c,media:a}}}(document); - -/*! Respond.js v1.1.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */ -(function(a){"use strict";function x(){u(!0)}var b={};if(a.respond=b,b.update=function(){},b.mediaQueriesSupported=a.matchMedia&&a.matchMedia("only all").matches,!b.mediaQueriesSupported){var q,r,t,c=a.document,d=c.documentElement,e=[],f=[],g=[],h={},i=30,j=c.getElementsByTagName("head")[0]||d,k=c.getElementsByTagName("base")[0],l=j.getElementsByTagName("link"),m=[],n=function(){for(var b=0;l.length>b;b++){var c=l[b],d=c.href,e=c.media,f=c.rel&&"stylesheet"===c.rel.toLowerCase();d&&f&&!h[d]&&(c.styleSheet&&c.styleSheet.rawCssText?(p(c.styleSheet.rawCssText,d,e),h[d]=!0):(!/^([a-zA-Z:]*\/\/)/.test(d)&&!k||d.replace(RegExp.$1,"").split("/")[0]===a.location.host)&&m.push({href:d,media:e}))}o()},o=function(){if(m.length){var b=m.shift();v(b.href,function(c){p(c,b.href,b.media),h[b.href]=!0,a.setTimeout(function(){o()},0)})}},p=function(a,b,c){var d=a.match(/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi),g=d&&d.length||0;b=b.substring(0,b.lastIndexOf("/"));var h=function(a){return a.replace(/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,"$1"+b+"$2$3")},i=!g&&c;b.length&&(b+="/"),i&&(g=1);for(var j=0;g>j;j++){var k,l,m,n;i?(k=c,f.push(h(a))):(k=d[j].match(/@media *([^\{]+)\{([\S\s]+?)$/)&&RegExp.$1,f.push(RegExp.$2&&h(RegExp.$2))),m=k.split(","),n=m.length;for(var o=0;n>o;o++)l=m[o],e.push({media:l.split("(")[0].match(/(only\s+)?([a-zA-Z]+)\s?/)&&RegExp.$2||"all",rules:f.length-1,hasquery:l.indexOf("(")>-1,minw:l.match(/\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:l.match(/\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},s=function(){var a,b=c.createElement("div"),e=c.body,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",e||(e=f=c.createElement("body"),e.style.background="none"),e.appendChild(b),d.insertBefore(e,d.firstChild),a=b.offsetWidth,f?d.removeChild(e):e.removeChild(b),a=t=parseFloat(a)},u=function(b){var h="clientWidth",k=d[h],m="CSS1Compat"===c.compatMode&&k||c.body[h]||k,n={},o=l[l.length-1],p=(new Date).getTime();if(b&&q&&i>p-q)return a.clearTimeout(r),r=a.setTimeout(u,i),void 0;q=p;for(var v in e)if(e.hasOwnProperty(v)){var w=e[v],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?t||s():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?t||s():1)),w.hasquery&&(z&&A||!(z||m>=x)||!(A||y>=m))||(n[w.media]||(n[w.media]=[]),n[w.media].push(f[w.rules]))}for(var C in g)g.hasOwnProperty(C)&&g[C]&&g[C].parentNode===j&&j.removeChild(g[C]);for(var D in n)if(n.hasOwnProperty(D)){var E=c.createElement("style"),F=n[D].join("\n");E.type="text/css",E.media=D,j.insertBefore(E,o.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(c.createTextNode(F)),g.push(E)}},v=function(a,b){var c=w();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))},w=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}();n(),b.update=n,a.addEventListener?a.addEventListener("resize",x,!1):a.attachEvent&&a.attachEvent("onresize",x)}})(this); diff --git a/tests/functional/features/bootstrap/FeatureContext.php b/tests/functional/features/bootstrap/FeatureContext.php index 0ed0a20d..174f46b7 100644 --- a/tests/functional/features/bootstrap/FeatureContext.php +++ b/tests/functional/features/bootstrap/FeatureContext.php @@ -25,7 +25,7 @@ #class FeatureContext extends MinkContext class FeatureContext extends MinkContext implements Context, SnippetAcceptingContext { - protected $em; + protected $entityManager; /** * Initializes context. * @@ -45,9 +45,9 @@ public static function prepare() // prepare system for test suite // before it runs #echo "prepare".PHP_EOL; - #$em = new \DoctrineORMModule\Service\EntityManagerFactory('orm_default'); - #echo 'class: '.get_class($em).PHP_EOL; - #$users = $em->getRepository('ErsBase\Entity\User')->findAll(); + #$entityManager = new \DoctrineORMModule\Service\EntityManagerFactory('orm_default'); + #echo 'class: '.get_class($entityManager).PHP_EOL; + #$users = $entityManager->getRepository('ErsBase\Entity\User')->findAll(); #echo 'found '.count($users).' users'.PHP_EOL; /*$this->getMainContext() ->getSubcontext('zf2_doctrine')