Skip to content

Commit

Permalink
Merge pull request #27 from DreamSpawn/show-refund
Browse files Browse the repository at this point in the history
Added list of people entitled to a refund
  • Loading branch information
DreamSpawn authored Mar 1, 2020
2 parents e747c8c + 97f5ec2 commit 58e26dd
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/controllers/participant_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -1885,4 +1885,8 @@ public function checkForDoubleBookings()
{
$this->page->double_booked_participants = $this->model->findDoubleBookedParticipants();
}

public function showRefund(){
$this->page->rfundees = $this->model->findPeopleNeedingRefund();
}
}
1 change: 1 addition & 0 deletions include/framework/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ protected function generateMenu() {
<li><a href='{$this->url('checkin_interface')}'>Checkin registrering</a></li>
<li><a href='{$this->url('edit_participant_types')}'>Rediger deltagertyper</a></li>
<li><a href='{$this->url('show_double_bookings')}'>Tjek for dobbelt-bookinger</a></li>
<li><a href='{$this->url('show_refund')}'>Deltagere der skal have penge tilbage</a></li>
HTML;

if ($this->user->hasRole('Infonaut') || $this->user->hasRole('Admin')) {
Expand Down
1 change: 1 addition & 0 deletions include/framework/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
13 changes: 13 additions & 0 deletions include/models/participant_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

}
11 changes: 11 additions & 0 deletions include/templates/participant/showrefund.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<h1>Deltagere der skal have penge tilbage</h1>
<?php if (empty($this->rfundees)) : ?>
<h2>Ingen fundet</h2>
<?php else : ?>
<h2>Deltagere:</h2>
<ul>
<?php foreach ($this->rfundees as $participant) : ?>
<li><a href="<?= $this->url('visdeltager', ['id' => $participant->id]);?>"><?= e($participant->getName()).", DKK ".(-$participant->difference)?></a></li>
<?php endforeach;?>
</ul>
<?php endif; ?>

0 comments on commit 58e26dd

Please sign in to comment.