From 9b2705b60a931d943d1b6c3ad85e09a852fbba60 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Mon, 27 Apr 2015 11:53:47 -0500 Subject: [PATCH] pdf: Fix incorrect custom data in ticket print --- include/client/templates/ticket-print.tmpl.php | 12 ++++-------- include/staff/templates/ticket-print.tmpl.php | 11 ++++------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/include/client/templates/ticket-print.tmpl.php b/include/client/templates/ticket-print.tmpl.php index a1173b217..d8a4f1643 100644 --- a/include/client/templates/ticket-print.tmpl.php +++ b/include/client/templates/ticket-print.tmpl.php @@ -160,14 +160,10 @@ div.hr { <?php foreach (DynamicFormEntry::forTicket($ticket->getId()) as $form) { // Skip core fields shown earlier in the ticket view - // TODO: Rewrite getAnswers() so that one could write - // ->getAnswers()->filter(not(array('field__name__in'=> - // array('email', ...)))); - $answers = array_filter($form->getAnswers(), function ($a) { - return !in_array($a->getField()->get('name'), - array('email','subject','name','priority')) - && !$a->getField()->get('private'); - }); + $answers = $form->getAnswers()->exclude(Q::any(array( + 'field__flags__hasbit' => DynamicFormField::FLAG_EXT_STORED | DynamicFormField::FLAG_CLIENT_VIEW, + 'field__name__in' => array('subject', 'priority'), + ))); if (count($answers) == 0) continue; ?> diff --git a/include/staff/templates/ticket-print.tmpl.php b/include/staff/templates/ticket-print.tmpl.php index 11323c4a1..97074ed26 100644 --- a/include/staff/templates/ticket-print.tmpl.php +++ b/include/staff/templates/ticket-print.tmpl.php @@ -183,13 +183,10 @@ div.hr { <?php foreach (DynamicFormEntry::forTicket($ticket->getId()) as $form) { // Skip core fields shown earlier in the ticket view - // TODO: Rewrite getAnswers() so that one could write - // ->getAnswers()->filter(not(array('field__name__in'=> - // array('email', ...)))); - $answers = array_filter($form->getAnswers(), function ($a) { - return !in_array($a->getField()->get('name'), - array('email','subject','name','priority')); - }); + $answers = $form->getAnswers()->exclude(Q::any(array( + 'field__flags__hasbit' => DynamicFormField::FLAG_EXT_STORED, + 'field__name__in' => array('subject', 'priority') + ))); if (count($answers) == 0) continue; ?> -- GitLab