|
|
@@ -15,16 +15,22 @@ $values = $test->getValues(true);
|
|
|
|
|
|
$location_address = $location->name . ", " . $location->getDisplayAddress(["address_1", "address_2", "city", "postal_code"]);
|
|
|
|
|
|
+// Base cost
|
|
|
$fee = floatval($test->test_fee) > 0 ? $test->test_fee : $project->default_tester_fee;
|
|
|
$fee = (float) $fee;
|
|
|
|
|
|
-$play_spent = (float) ($values["play_spent"] ?? 0);
|
|
|
$travel_cost = (float) http::value("travel_cost", "float");
|
|
|
+$test->test_travel_cost = $travel_cost;
|
|
|
|
|
|
-$invoice_total = $fee + $play_spent + $travel_cost;
|
|
|
+$invoice_total = $fee + $travel_cost;
|
|
|
|
|
|
-$test->test_travel_cost = $travel_cost;
|
|
|
+// Additional tester invoice fields
|
|
|
+$tester_invoice_fields = $template->getTesterInvoiceFields();
|
|
|
+foreach($tester_invoice_fields as $field) {
|
|
|
+ $invoice_total += (float) $values[$field->name] ?? 0;
|
|
|
+}
|
|
|
|
|
|
+// Get invoice address
|
|
|
$address = $tester->getInvoiceAddress();
|
|
|
if(!$address) throw new Exception(_("Invoice address not found. Please set an address as the invoice address then try again."));
|
|
|
if(!$tester->hasValidPaymentMethod()) throw new Exception(_("No valid payment method found. Please go to the Settings page and make sure all respective fields are filled in and then try again."));
|
|
|
@@ -175,18 +181,22 @@ ob_start();
|
|
|
<td align="right" valign="top">£<?=number_format($fee, 2)?></td>
|
|
|
</tr>
|
|
|
<?php
|
|
|
- if($play_spent) {
|
|
|
+
|
|
|
+ foreach($tester_invoice_fields as $field) {
|
|
|
+ $value = $values[$field->name] ?? 0;
|
|
|
+ if(!$value) continue;
|
|
|
?>
|
|
|
<tr>
|
|
|
<td>
|
|
|
- <strong>Play Costs</strong>
|
|
|
+ <strong><?=htmlspecialchars($field->label)?></strong>
|
|
|
</td>
|
|
|
<td align="right" valign="top">1</td>
|
|
|
- <td align="right" valign="top">£<?=number_format($play_spent, 2)?></td>
|
|
|
- <td align="right" valign="top">£<?=number_format($play_spent, 2)?></td>
|
|
|
+ <td align="right" valign="top">£<?=number_format($value, 2)?></td>
|
|
|
+ <td align="right" valign="top">£<?=number_format($value, 2)?></td>
|
|
|
</tr>
|
|
|
<?php
|
|
|
}
|
|
|
+
|
|
|
if($travel_cost) {
|
|
|
?>
|
|
|
<tr>
|