From a747722f52c4deb3634c24428023825eff477677 Mon Sep 17 00:00:00 2001
From: lkmorlan <lkmorlan@493050.no-reply.drupal.org>
Date: Mon, 5 Mar 2018 16:14:52 -0500
Subject: [PATCH] Issue #2948793 by Liam Morland: Refactor fillpdf_load()

---
 fillpdf.module | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/fillpdf.module b/fillpdf.module
index 02670d1..9ac978b 100644
--- a/fillpdf.module
+++ b/fillpdf.module
@@ -1668,23 +1668,19 @@ function _fillpdf_transform_field_value($value, $pdf_replacements, $field_replac
  *   FALSE if it could not be found.
  */
 function fillpdf_load($fid, $reset = FALSE) {
+  // Cache query results.
   static $fillpdf = array();
-  if (isset($fillpdf[$fid]) && $reset === FALSE) {
-    // I'm a placeholder if statement!
-  }
-  else {
+  if (!isset($fillpdf[$fid]) || !$reset) {
     $fillpdf[$fid] = db_query("SELECT * FROM {fillpdf_forms} WHERE fid = :fid", array(':fid' => $fid))->fetch();
   }
+
   if ($fillpdf[$fid]) {
     // Turn replacements (textarea content) into an array.
     $fillpdf[$fid]->replacements = _fillpdf_replacements_to_array($fillpdf[$fid]->replacements);
-  }
-  if ($fillpdf[$fid]) {
+
     return $fillpdf[$fid];
   }
-  else {
-    return FALSE;
-  }
+  return FALSE;
 }
 
 /**
-- 
GitLab