appointments.php
3 days ago
employees.php
3 days ago
index.html
3 days ago
packages.php
3 days ago
subscriptions.php
3 days ago
employees.php
105 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package VikAppointments |
| 4 | * @subpackage core |
| 5 | * @author E4J s.r.l. |
| 6 | * @copyright Copyright (C) 2021 E4J s.r.l. All Rights Reserved. |
| 7 | * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL |
| 8 | * @link https://vikwp.com |
| 9 | */ |
| 10 | |
| 11 | // No direct access |
| 12 | defined('ABSPATH') or die('No script kiddies please!'); |
| 13 | |
| 14 | VAPLoader::import('libraries.invoice.classes.appointments'); |
| 15 | |
| 16 | /** |
| 17 | * Class used to generate the invoices of the employees subscriptions. |
| 18 | * Since the invoices of the subscriptions are almost equals to the invoices |
| 19 | * of the appointments, this class will extend the methods declared by |
| 20 | * VAPInvoiceAppointments. |
| 21 | * |
| 22 | * @since 1.6 |
| 23 | */ |
| 24 | class VAPInvoiceEmployees extends VAPInvoiceAppointments |
| 25 | { |
| 26 | /** |
| 27 | * Class constructor. |
| 28 | * |
| 29 | * @param object The order details. |
| 30 | */ |
| 31 | public function __construct($order) |
| 32 | { |
| 33 | $this->order = $order; |
| 34 | |
| 35 | if (!empty($this->order->billing)) |
| 36 | { |
| 37 | // replicate billing details by using the customer notation |
| 38 | $this->order->billing->billing_address = $this->order->billing->address; |
| 39 | $this->order->billing->billing_state = $this->order->billing->state; |
| 40 | $this->order->billing->billing_city = $this->order->billing->city; |
| 41 | $this->order->billing->billing_zip = $this->order->billing->zip; |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * @override |
| 47 | * Returns the destination absolute path of the invoices folder. |
| 48 | * |
| 49 | * @return string The invoice folder path. |
| 50 | * |
| 51 | * @since 1.7 |
| 52 | */ |
| 53 | public function getInvoiceFolderPath() |
| 54 | { |
| 55 | return parent::getInvoiceFolderPath() . DIRECTORY_SEPARATOR . 'employees'; |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * @override |
| 60 | * Returns the destination URI of the invoices folder. |
| 61 | * |
| 62 | * @return string The invoice folder URI. |
| 63 | * |
| 64 | * @since 1.7 |
| 65 | */ |
| 66 | public function getInvoiceFolderURI() |
| 67 | { |
| 68 | return parent::getInvoiceFolderURI() . 'employees/'; |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * @override |
| 73 | * Returns the page template that will be used to |
| 74 | * generate the invoice. |
| 75 | * |
| 76 | * @return string The base HTML. |
| 77 | */ |
| 78 | protected function getPageTemplate() |
| 79 | { |
| 80 | $data = array( |
| 81 | 'order' => $this->order, |
| 82 | ); |
| 83 | |
| 84 | // create layout file (always read from the site section of VikAppointments) |
| 85 | $layout = new JLayoutFile('templates.invoice.employee', null, [ |
| 86 | 'component' => 'com_vikappointments', |
| 87 | 'client' => 'site', |
| 88 | ]); |
| 89 | |
| 90 | return $layout->render($data); |
| 91 | } |
| 92 | |
| 93 | /** |
| 94 | * @override |
| 95 | * Returns the e-mail address of the employee that should |
| 96 | * receive the invoice via mail. |
| 97 | * |
| 98 | * @return string The employee e-mail. |
| 99 | */ |
| 100 | public function getRecipient() |
| 101 | { |
| 102 | return $this->order->employee->email; |
| 103 | } |
| 104 | } |
| 105 |