diff --git a/app/Services/Pdf/PdfBuilder.php b/app/Services/Pdf/PdfBuilder.php index d6df412c4213..c83e0fed78c4 100644 --- a/app/Services/Pdf/PdfBuilder.php +++ b/app/Services/Pdf/PdfBuilder.php @@ -1036,16 +1036,19 @@ class PdfBuilder */ public function getTableTotals() :array { + //need to see where we don't pass all these particular variables. try and refactor thisout - $_variables = array_key_exists('variables', $this->service->options) - ? $this->service->options['variables'] - : ['values' => ['$entity.public_notes' => $this->service->config->entity->public_notes, '$entity.terms' => $this->service->config->entity->terms, '$entity_footer' => $this->service->config->entity->footer], 'labels' => []]; + // $_variables = array_key_exists('variables', $this->service->options) + // ? $this->service->options['variables'] + // : ['values' => ['$entity.public_notes' => $this->service->config->entity->public_notes, '$entity.terms' => $this->service->config->entity->terms, '$entity_footer' => $this->service->config->entity->footer], 'labels' => []]; + + $_variables = $this->service->html_variables; $variables = $this->service->config->pdf_variables['total_columns']; $elements = [ ['element' => 'div', 'properties' => ['style' => 'display: flex; flex-direction: column;'], 'elements' => [ - ['element' => 'p', 'content' => strtr(str_replace(["labels","values"], ["",""], $_variables['values']['$entity.public_notes']), $_variables), 'properties' => ['data-ref' => 'total_table-public_notes', 'style' => 'text-align: left;']], + ['element' => 'p', 'content' => strtr(str_replace(["labels", "values"], ["",""], $_variables['values']['$entity.public_notes']), $_variables), 'properties' => ['data-ref' => 'total_table-public_notes', 'style' => 'text-align: left;']], ['element' => 'p', 'content' => '', 'properties' => ['style' => 'text-align: left; display: flex; flex-direction: column; page-break-inside: auto;'], 'elements' => [ ['element' => 'span', 'content' => '$entity.terms_label: ', 'properties' => ['hidden' => $this->entityVariableCheck('$entity.terms'), 'data-ref' => 'total_table-terms-label', 'style' => 'font-weight: bold; text-align: left; margin-top: 1rem;']], ['element' => 'span', 'content' => strtr(str_replace("labels", "", $_variables['values']['$entity.terms']), $_variables['labels']), 'properties' => ['data-ref' => 'total_table-terms', 'style' => 'text-align: left;']], diff --git a/app/Utils/Helpers.php b/app/Utils/Helpers.php index 0bbbca13d219..c7224eb0f19f 100644 --- a/app/Utils/Helpers.php +++ b/app/Utils/Helpers.php @@ -266,12 +266,12 @@ class Helpers $_right = ''; // If right side doesn't have any calculations, replace with raw ranges keyword. - if (! Str::contains($right, ['-', '+', '/', '*'])) { + if (! Str::contains(str_replace("year, $currentDateTime->month)->translatedFormat('F Y'); } // If right side contains one of math operations, calculate. - if (Str::contains($right, ['+'])) { + if (Str::contains(str_replace("keys()->first()), $replacements['literal'][$matches->keys()->first()], @@ -315,7 +315,7 @@ class Helpers ); } - if (Str::contains($match, ['-', '+', '/', '*'])) { + if (Str::contains(str_replace("