From 97f5ec23ae10942a5e4ca4c33514841b911c2d3d Mon Sep 17 00:00:00 2001 From: Mikkel Westh Date: Sun, 1 Mar 2020 21:25:10 +0100 Subject: [PATCH] Added list of people entitled to a refund --- include/controllers/participant_controller.php | 4 ++++ include/framework/layout.php | 1 + include/framework/routes.php | 1 + include/models/participant_model.php | 13 +++++++++++++ include/templates/participant/showrefund.phtml | 11 +++++++++++ 5 files changed, 30 insertions(+) create mode 100644 include/templates/participant/showrefund.phtml diff --git a/include/controllers/participant_controller.php b/include/controllers/participant_controller.php index ffcb8756..28a4b7ef 100755 --- a/include/controllers/participant_controller.php +++ b/include/controllers/participant_controller.php @@ -1885,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/framework/layout.php b/include/framework/layout.php index 04de9932..9eba50db 100755 --- a/include/framework/layout.php +++ b/include/framework/layout.php @@ -433,6 +433,7 @@ 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')) { diff --git a/include/framework/routes.php b/include/framework/routes.php index 64511853..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'); diff --git a/include/models/participant_model.php b/include/models/participant_model.php index 6acf4aaf..6ebd66ca 100755 --- a/include/models/participant_model.php +++ b/include/models/participant_model.php @@ -3060,4 +3060,17 @@ public function getParticipantFromPhotoidentifier($identifier) 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/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:

    + +