Code Duplication    Length = 23-24 lines in 2 locations

code/model/Attendee.php 1 location

@@ 481-503 (lines=23) @@
478
     *
479
     * @return mixed
480
     */
481
    public function sendTicket()
482
    {
483
        // Get the mail sender or fallback to the admin email
484
        if (empty($from = Reservation::config()->get('mail_sender'))) {
485
            $from = Config::inst()->get('Email', 'admin_email');
486
        }
487
488
        $email = new Email();
489
        $email->setSubject(_t(
490
            'AttendeeMail.TITLE',
491
            'Your ticket for {event}',
492
            null,
493
            array(
494
                'event' => $this->Event()->Title
495
            )
496
        ));
497
        $email->setFrom($from);
498
        $email->setTo($this->getEmail());
499
        $email->setTemplate('AttendeeMail');
500
        $email->populateTemplate($this);
501
        $this->extend('updateTicketMail', $email);
502
        return $email->send();
503
    }
504
505
    /**
506
     * Get the checkin link

code/model/Reservation.php 1 location

@@ 376-399 (lines=24) @@
373
     *
374
     * @return mixed
375
     */
376
    public function sendReservation()
377
    {
378
        // Get the mail sender or fallback to the admin email
379
        if (($from = self::config()->get('mail_sender')) && empty($from)) {
380
            $from = Config::inst()->get('Email', 'admin_email');
381
        }
382
383
        // Create the email with given template and reservation data
384
        $email = new Email();
385
        $email->setSubject(_t(
386
            'ReservationMail.TITLE',
387
            'Your order at {sitename}',
388
            null,
389
            array(
390
                'sitename' => SiteConfig::current_site_config()->Title
391
            )
392
        ));
393
        $email->setFrom($from);
394
        $email->setTo($this->MainContact()->Email);
395
        $email->setTemplate('ReservationMail');
396
        $email->populateTemplate($this);
397
        $this->extend('updateReservationMail', $email);
398
        return $email->send();
399
    }
400
401
    /**
402
     * Send the reserved tickets