Added the current uncommited changes to production code, and rebased to 4.6.8
authorRuben Rodriguez <ruben@fsf.org>
Thu, 10 Sep 2015 22:24:23 +0000 (18:24 -0400)
committerAndrew Engelbrecht <andrew@fsf.org>
Mon, 17 Jul 2017 22:06:14 +0000 (18:06 -0400)
13 files changed:
CRM/Activity/BAO/Activity.php
CRM/Contact/BAO/Contact.php
CRM/Contact/BAO/Contact/Utils.php
CRM/Contact/BAO/GroupContact.php
CRM/Contact/BAO/GroupContactCache.php
CRM/Contact/Form/Task/PDFLatexCommon.php
CRM/Contribute/BAO/Contribution.php
CRM/Event/BAO/Participant.php
CRM/Member/BAO/Membership.php
CRM/Member/Import/Form/DataSource.php
CRM/Price/BAO/PriceSet.php
CRM/Utils/PDF/Utils.php
templates/CRM/Contribute/Form/Contribution/PremiumBlock.tpl

index 84a46cfef613825c91cdd9092ce597cca9ebb47d..f9afc1d82f00a3c71cebe8cffa42f7a88dc33b43 100644 (file)
@@ -583,7 +583,8 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity {
       }
     }
 
-    CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
+    // reset the group contact cache since smart groups might be affected due to this
+    // CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
 
     if (!empty($params['id'])) {
       CRM_Utils_Hook::post('edit', 'Activity', $activity->id, $activity);
index 3e95bcd97b21032f22f4c0aa72f1635a3240466e..a90501235ba62ce9451536fa2ef7f0e912c44c4d 100644 (file)
@@ -1933,7 +1933,9 @@ ORDER BY civicrm_email.is_primary DESC";
       CRM_Contact_BAO_GroupContact::addContactsToGroup($contactIds, $addToGroupID);
     }
 
-    CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
+    // reset the group contact cache for this group
+    // HACK: Dave disabled this on 12/09/2014 due to a crazy amount of lock wait timeouts on cache tables, causing donations to fail.
+    //CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
 
     if ($editHook) {
       CRM_Utils_Hook::post('edit', 'Profile', $contactID, $params);
index 9cbb44d53b0ce3ed022ea3c8560b64cd37d9e662..c12f47baa9871ecf7fb9abfac8cdeb18ed96c858 100644 (file)
@@ -979,7 +979,7 @@ INNER JOIN civicrm_contact contact_target ON ( contact_target.id = act.contact_i
           FROM civicrm_contact
           WHERE contact_type = %1
           AND ({$idFldName} IS NULL
-          OR ( {$idFldName} IS NOT NULL AND ({$displayFldName} IS NULL OR {$displayFldName} = '')) )";
+          OR ( {$idFldName} IS NOT NULL AND ({$displayFldName} IS NULL OR {$displayFldName} = '')) ) LIMIT 800";
       }
 
       if ($limit) {
index 8833d1958d48ac7b0aabbf273c58a22425895fa8..69b427f6495c67654e85ced1d743e0d873bf2427 100644 (file)
@@ -146,12 +146,14 @@ class CRM_Contact_BAO_GroupContact extends CRM_Contact_DAO_GroupContact {
     // also reset the acl cache
     $config = CRM_Core_Config::singleton();
     if (!$config->doNotResetCache) {
-      CRM_ACL_BAO_Cache::resetCache();
+      // HACK: Dave commented this out on 12/09/2014 due to lock wait timeouts on the acl cache that caused donations to fail.
+      //CRM_ACL_BAO_Cache::resetCache();
     }
 
     // reset the group contact cache for all group(s)
     // if this group is being used as a smart group
-    CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
+    // HACK: Dave had to disable this, too!
+    //CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
 
     CRM_Utils_Hook::post('create', 'GroupContact', $groupId, $contactIds);
 
index e0d041aa277341344d5ba82118709e6a4704d1ef..d47e69614988b99a2bdb4b0b77dc6f0c4ecdafe4 100644 (file)
@@ -340,10 +340,13 @@ WHERE  id IN ( $groupIDs )
       2 => array(self::getRefreshDateTime(), 'String'),
     );
 
+    // HACK: Hardcoded delete limit.
+    $deleteLimit = 1000;
+
     if (!isset($groupID)) {
       if ($smartGroupCacheTimeout == 0) {
         $query = "
-DELETE FROM civicrm_group_contact_cache
+DELETE FROM civicrm_group_contact_cache LIMIT $deleteLimit
 ";
         $update = "
 UPDATE civicrm_group g
@@ -358,6 +361,7 @@ DELETE     gc
 FROM       civicrm_group_contact_cache gc
 INNER JOIN civicrm_group g ON g.id = gc.group_id
 WHERE      g.cache_date <= %1
+LIMIT      $deleteLimit
 ";
         $update = "
 UPDATE civicrm_group g
@@ -376,9 +380,10 @@ AND    refresh_date IS NULL
     elseif (is_array($groupID)) {
       $groupIDs = implode(', ', $groupID);
       $query = "
-DELETE     g
-FROM       civicrm_group_contact_cache g
-WHERE      g.group_id IN ( $groupIDs )
+DELETE
+FROM       civicrm_group_contact_cache
+WHERE      group_id IN ( $groupIDs )
+LIMIT      $deleteLimit
 ";
       $update = "
 UPDATE civicrm_group g
@@ -389,9 +394,10 @@ WHERE  id IN ( $groupIDs )
     }
     else {
       $query = "
-DELETE     g
-FROM       civicrm_group_contact_cache g
-WHERE      g.group_id = %1
+DELETE
+FROM       civicrm_group_contact_cache
+WHERE      group_id = %1
+LIMIT      $deleteLimit
 ";
       $update = "
 UPDATE civicrm_group g
@@ -402,7 +408,10 @@ WHERE  id = %1
       $params = array(1 => array($groupID, 'Integer'));
     }
 
-    CRM_Core_DAO::executeQuery($query, $params);
+    // Nibble at the rows, don't try to delete everything at once!
+    do {
+      $dao = CRM_Core_DAO::executeQuery($query, $params);
+    } while($dao->affectedRows() != 0);
 
     if ($refresh) {
       CRM_Core_DAO::executeQuery($refresh, $params);
index a0ca45339c14114d26b6b21c68dcedc5c46a2759..4dbdb1806b492a46902d35538e2bfdcd223dbc81 100644 (file)
@@ -48,7 +48,7 @@ class CRM_Contact_Form_Task_PDFLatexCommon {
   static function preProcess(&$form) {
     $messageText    = array();
     $messageSubject = array();
-    $dao            = new CRM_Core_BAO_MessageTemplates();
+    $dao            = new CRM_Core_BAO_MessageTemplate();
     $dao->is_active = 1;
     $dao->find();
     while ($dao->fetch()) {
@@ -254,14 +254,14 @@ class CRM_Contact_Form_Task_PDFLatexCommon {
       }
       if (CRM_Utils_Array::value('saveTemplate', $formValues) && $formValues['saveTemplate']) {
         $messageTemplate['msg_title'] = $formValues['saveTemplateName'];
-        CRM_Core_BAO_MessageTemplates::add($messageTemplate);
+        CRM_Core_BAO_MessageTemplate::add($messageTemplate);
       }
 
       if (CRM_Utils_Array::value('updateTemplate', $formValues) && $formValues['template'] && $formValues['updateTemplate']) {
         $messageTemplate['id'] = $formValues['template'];
 
         unset($messageTemplate['msg_title']);
-        CRM_Core_BAO_MessageTemplates::add($messageTemplate);
+        CRM_Core_BAO_MessageTemplate::add($messageTemplate);
       }
     }
     elseif (CRM_Utils_Array::value('template', $formValues) > 0) {
@@ -384,10 +384,11 @@ class CRM_Contact_Form_Task_PDFLatexCommon {
 
     foreach ($form->_contactIds as $contactId) {
       $activityTargetParams = array(
+        'contact_id' => $contactId,
         'activity_id' => empty($activity->id) ? $activityIds[$contactId] : $activity->id,
         'target_contact_id' => $contactId,
       );
-      CRM_Activity_BAO_Activity::createActivityTarget($activityTargetParams);
+      CRM_Activity_BAO_ActivityTarget::create($activityTargetParams);
     }
   }
 
index d4d1eef84b0f68bdc933587fb36a688a6f42c00b..4d0f5b6b3b433a51f4d6ee7d0f490ae718567809 100644 (file)
@@ -241,7 +241,9 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
       );
     }
 
-    CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
+    // reset the group contact cache for this group
+    // HACK: dave hack - these caches are murder!!!
+    // CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
 
     if ($contributionID) {
       CRM_Utils_Hook::post('edit', 'Contribution', $contribution->id, $contribution);
index 492ece8ccb0ebcc4c0fbd39439208c0499c664a6..8b0907f7474117e1b51bcf4a19c60fc6e052ac93 100644 (file)
@@ -138,7 +138,9 @@ class CRM_Event_BAO_Participant extends CRM_Event_DAO_Participant {
 
     $session = CRM_Core_Session::singleton();
 
-    CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
+    // reset the group contact cache for this group
+    // HACK: by davet
+    // CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
 
     if (!empty($params['id'])) {
       CRM_Utils_Hook::post('edit', 'Participant', $participantBAO->id, $participantBAO);
index 6d206aa137b10365629e19600d18df5dc846214a..81bc66d2aacd25161570559909a5321220cb3470 100644 (file)
@@ -137,7 +137,8 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership {
     CRM_Member_BAO_MembershipLog::add($membershipLog, CRM_Core_DAO::$_nullArray);
 
     // reset the group contact cache since smart groups might be affected due to this
-    CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
+    // HACK: a new fragrance by davet
+    // CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();
 
     $allStatus = CRM_Member_BAO_Membership::buildOptions('status_id', 'get');
     $activityParams = array(
@@ -738,6 +739,212 @@ INNER JOIN  civicrm_membership_type type ON ( type.id = membership.membership_ty
     return NULL;
   }
 
+  /**
+   * Build Membership  Block in Contribution Pages.
+   *
+   * @param CRM_Core_Form $form
+   *   Form object.
+   * @param int $pageID
+   *   Unused?.
+   * @param int $cid
+   *   Contact checked for having a current membership for a particular membership.
+   * @param bool $formItems
+   * @param int $selectedMembershipTypeID
+   *   Selected membership id.
+   * @param bool $thankPage
+   *   Thank you page.
+   * @param null $isTest
+   *
+   * @return bool
+   *   Is this a separate membership payment
+   *
+   */
+  public static function buildMembershipBlock(
+    &$form,
+    $pageID,
+    $cid,
+    $formItems = FALSE,
+    $selectedMembershipTypeID = NULL,
+    $thankPage = FALSE,
+    $isTest = NULL
+  ) {
+
+    $separateMembershipPayment = FALSE;
+    if ($form->_membershipBlock) {
+      $form->_currentMemberships = array();
+
+      $membershipBlock = $form->_membershipBlock;
+      $membershipTypeIds = $membershipTypes = $radio = array();
+      $membershipPriceset = (!empty($form->_priceSetId) && $form->_useForMember) ? TRUE : FALSE;
+
+      $allowAutoRenewMembership = $autoRenewOption = FALSE;
+      $autoRenewMembershipTypeOptions = array();
+
+      $paymentProcessor = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE, 'is_recur = 1');
+
+      $separateMembershipPayment = CRM_Utils_Array::value('is_separate_payment', $membershipBlock);
+
+      if ($membershipPriceset) {
+        foreach ($form->_priceSet['fields'] as $pField) {
+          if (empty($pField['options'])) {
+            continue;
+          }
+          foreach ($pField['options'] as $opId => $opValues) {
+            if (empty($opValues['membership_type_id'])) {
+              continue;
+            }
+            $membershipTypeIds[$opValues['membership_type_id']] = $opValues['membership_type_id'];
+          }
+        }
+      }
+      elseif (!empty($membershipBlock['membership_types'])) {
+        $membershipTypeIds = explode(',', $membershipBlock['membership_types']);
+      }
+
+      if (!empty($membershipTypeIds)) {
+        //set status message if wrong membershipType is included in membershipBlock
+        if (isset($form->_mid) && !$membershipPriceset) {
+          $membershipTypeID = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership',
+            $form->_mid,
+            'membership_type_id'
+          );
+          if (!in_array($membershipTypeID, $membershipTypeIds)) {
+            CRM_Core_Session::setStatus(ts("Oops. The membership you're trying to renew appears to be invalid. Contact your site administrator if you need assistance. If you continue, you will be issued a new membership."), ts('Invalid Membership'), 'error');
+          }
+        }
+
+        $membershipTypeValues = self::buildMembershipTypeValues($form, $membershipTypeIds);
+        $form->_membershipTypeValues = $membershipTypeValues;
+        $endDate = NULL;
+        foreach ($membershipTypeIds as $value) {
+          $memType = $membershipTypeValues[$value];
+          if ($selectedMembershipTypeID != NULL) {
+            if ($memType['id'] == $selectedMembershipTypeID) {
+              $form->assign('minimum_fee',
+                CRM_Utils_Array::value('minimum_fee', $memType)
+              );
+              $form->assign('membership_name', $memType['name']);
+              if (!$thankPage && $cid) {
+                $membership = new CRM_Member_DAO_Membership();
+                $membership->contact_id = $cid;
+                $membership->membership_type_id = $memType['id'];
+                if ($membership->find(TRUE)) {
+                  $form->assign('renewal_mode', TRUE);
+                  $memType['current_membership'] = $membership->end_date;
+                  $form->_currentMemberships[$membership->membership_type_id] = $membership->membership_type_id;
+                }
+              }
+              $membershipTypes[] = $memType;
+            }
+          }
+          elseif ($memType['is_active']) {
+            $javascriptMethod = NULL;
+            $allowAutoRenewOpt = (int) $memType['auto_renew'];
+            if (is_array($form->_paymentProcessors)) {
+              foreach ($form->_paymentProcessors as $id => $val) {
+                if (!$val['is_recur']) {
+                  $allowAutoRenewOpt = 0;
+                  continue;
+                }
+              }
+            }
+
+            $javascriptMethod = array('onclick' => "return showHideAutoRenew( this.value );");
+            $autoRenewMembershipTypeOptions["autoRenewMembershipType_{$value}"] = (int) $allowAutoRenewOpt * CRM_Utils_Array::value($value, CRM_Utils_Array::value('auto_renew', $form->_membershipBlock));;
+
+            if ($allowAutoRenewOpt) {
+              $allowAutoRenewMembership = TRUE;
+            }
+
+            //add membership type.
+            $radio[$memType['id']] = $form->createElement('radio', NULL, NULL, NULL,
+              $memType['id'], $javascriptMethod
+            );
+            if ($cid) {
+              $membership = new CRM_Member_DAO_Membership();
+              $membership->contact_id = $cid;
+              $membership->membership_type_id = $memType['id'];
+
+              //show current membership, skip pending and cancelled membership records,
+              //because we take first membership record id for renewal
+              $membership->whereAdd('status_id != 5 AND status_id !=6');
+
+              if (!is_null($isTest)) {
+                $membership->is_test = $isTest;
+              }
+
+              //CRM-4297
+              $membership->orderBy('end_date DESC');
+
+              if ($membership->find(TRUE)) {
+                if (!$membership->end_date) {
+                  unset($radio[$memType['id']]);
+                  $form->assign('islifetime', TRUE);
+                  continue;
+                }
+                $form->assign('renewal_mode', TRUE);
+                $form->_currentMemberships[$membership->membership_type_id] = $membership->membership_type_id;
+                $memType['current_membership'] = $membership->end_date;
+                if (!$endDate) {
+                  $endDate = $memType['current_membership'];
+                  $form->_defaultMemTypeId = $memType['id'];
+                }
+                if ($memType['current_membership'] < $endDate) {
+                  $endDate = $memType['current_membership'];
+                  $form->_defaultMemTypeId = $memType['id'];
+                }
+              }
+            }
+            $membershipTypes[] = $memType;
+          }
+        }
+      }
+
+      $form->assign('showRadio', $formItems);
+      if ($formItems) {
+        if (!$membershipPriceset) {
+          if (!$membershipBlock['is_required']) {
+            $form->assign('showRadioNoThanks', TRUE);
+            $radio[''] = $form->createElement('radio', NULL, NULL, NULL, 'no_thanks', NULL);
+            $form->addGroup($radio, 'selectMembership', NULL);
+          }
+          elseif ($membershipBlock['is_required'] && count($radio) == 1) {
+            $temp = array_keys($radio);
+            $form->add('hidden', 'selectMembership', $temp[0], array('id' => 'selectMembership'));
+            $form->assign('singleMembership', TRUE);
+            $form->assign('showRadio', FALSE);
+          }
+          else {
+            $form->addGroup($radio, 'selectMembership', NULL);
+          }
+
+          $form->addRule('selectMembership', ts('Please select one of the memberships.'), 'required');
+        }
+        else {
+         $autoRenewOption = CRM_Price_BAO_PriceSet::checkAutoRenewForPriceSet($form->_priceSetId);
+          $form->assign('autoRenewOption', $autoRenewOption);
+        }
+
+        if (!$form->_values['is_pay_later'] && is_array($form->_paymentProcessors) && ($allowAutoRenewMembership || $autoRenewOption)) {
+          $form->addElement('checkbox', 'auto_renew', ts('Please renew my membership automatically.'));
+         $temphax =& $form->getElement('auto_renew');
+         $temphax->setValue(1);
+        }
+      }
+
+      $form->assign('membershipBlock', $membershipBlock);
+      $form->assign('membershipTypes', $membershipTypes);
+      $form->assign('allowAutoRenewMembership', $allowAutoRenewMembership);
+      $form->assign('autoRenewMembershipTypeOptions', json_encode($autoRenewMembershipTypeOptions));
+
+      //give preference to user submitted auto_renew value.
+      $takeUserSubmittedAutoRenew = (!empty($_POST) || $form->isSubmitted()) ? TRUE : FALSE;
+      $form->assign('takeUserSubmittedAutoRenew', $takeUserSubmittedAutoRenew);
+    }
+
+    return $separateMembershipPayment;
+  }
+
   /**
    * Return Membership Block info in Contribution Pages.
    *
index 11eb187608b3a67369b31a4978ce847067b08304..055c671d91487a8771026e165fae3843f017ec77 100644 (file)
@@ -50,6 +50,25 @@ class CRM_Member_Import_Form_DataSource extends CRM_Import_Form_DataSource {
   public function buildQuickForm() {
     parent::buildQuickForm();
 
+    //Setting Upload File Size
+    $config = CRM_Core_Config::singleton();
+
+    $uploadFileSize = CRM_Core_Config_Defaults::formatUnitSize($config->maxFileSize . 'm', TRUE);
+    $uploadSize = round(($uploadFileSize / (1024 * 1024)), 2);
+
+    $this->assign('uploadSize', $uploadSize);
+
+    $this->add('File', 'uploadFile', ts('Import Data File'), 'size=30 maxlength=255', TRUE);
+    $this->setMaxFileSize($uploadFileSize);
+    $this->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', array(
+          1 => $uploadSize,
+          2 => $uploadFileSize,
+        )), 'maxfilesize', $uploadFileSize);
+    $this->addRule('uploadFile', ts('A valid file must be uploaded.'), 'uploadedfile');
+    $this->addRule('uploadFile', ts('Input file must be in CSV format'), 'utf8File');
+
+    $this->addElement('checkbox', 'skipColumnHeader', ts('First row contains column headers'));
+
     $duplicateOptions = array();
     $duplicateOptions[] = $this->createElement('radio',
       NULL, NULL, ts('Insert new Membership'), CRM_Import_Parser::DUPLICATE_SKIP
index 3b1dfb35d8bbfc921e540708ad33b4c626f04c7d..49ef2e292bdc749fe5dde8964ffdd6d09a7c2abc 100644 (file)
@@ -1372,6 +1372,11 @@ GROUP BY     mt.member_of_contact_id";
    *   $autoRenewOption ( 0:hide, 1:optional 2:required )
    */
   public static function checkAutoRenewForPriceSet($priceSetId) {
+    // auto-renew option should be visible if membership types associated with all the fields has
+    // been set for auto-renew option
+    // Auto renew checkbox should be frozen if for all the membership type auto renew is required
+
+    // get the membership type auto renew option and check if required or optional
     $query = 'SELECT DISTINCT mt.auto_renew, mt.duration_interval, mt.duration_unit,
              pf.html_type, pf.id as price_field_id
             FROM civicrm_price_field_value pfv
@@ -1429,12 +1434,18 @@ GROUP BY     mt.member_of_contact_id";
    * @return array
    *   associate array of frequency interval and unit
    */
-  public static function getRecurDetails($priceSetId) {
+  public static function getRecurDetails($priceSetId, $priceFieldValueIds) {
+    // Escape the array of ids.
+    foreach ($priceFieldValueIds as $index => $id) {
+      $priceFieldValueIds[$index] = CRM_Utils_Type::escape($id, 'Integer');
+    }
+
     $query = 'SELECT mt.duration_interval, mt.duration_unit
             FROM civicrm_price_field_value pfv
             INNER JOIN civicrm_membership_type mt ON pfv.membership_type_id = mt.id
             INNER JOIN civicrm_price_field pf ON pfv.price_field_id = pf.id
-            WHERE pf.price_set_id = %1 LIMIT 1';
+            WHERE pf.price_set_id = %1 AND pfv.id IN ('
+      . implode(',', $priceFieldValueIds) . ') LIMIT 1';
 
     $params = array(1 => array($priceSetId, 'Integer'));
     $dao = CRM_Core_DAO::executeQuery($query, $params);
index e093d10012b2e18951f28da7c37ccb820d99d156..11f11e420264b0d17544193138739831383e0057 100644 (file)
@@ -36,6 +36,15 @@ use Dompdf\Options;
 
 class CRM_Utils_PDF_Utils {
 
+  public static function enqueuePDF($pdf) {
+
+    $fname = time().'_lp.pdf';
+    file_put_contents('/tmp/'.$fname, $pdf);
+    header('Location: /civicrm/lp-setup?file='.$fname);
+    exit;
+  }
+
   public static function latex2pdf(&$text, $fileName = 'civicrm.pdf', $output = FALSE, $pdfFormat = NULL) {
          /* FIXME: get $paper_size, $orientation, $margins */
 
@@ -46,13 +55,22 @@ class CRM_Utils_PDF_Utils {
       $pages = array($text);
     }
 
-
-    $head='\documentclass[11pt]{letter}
+    $head='\documentclass[12pt]{letter}
 \usepackage{url}
 \usepackage{ucs}
 \usepackage{graphicx}
 \usepackage[T1]{fontenc}
 \usepackage{fullpage}
+\usepackage{fontspec,xunicode}
+%% VERY IMPORTANT.  Configures supported languages and fonts to use for each one.
+\usepackage[Latin, Hebrew, Arabics, CJK, Diacritics]{ucharclasses}
+\setDefaultTransitions{\fontspec{CMU Serif}}{}
+\setTransitionsForLatin{\fontspec{CMU Serif}}{}
+\setTransitionsForArabics{\fontspec{Droid Sans Arabic}}{}
+\setTransitionsForCJK{\fontspec{WenQuanYi Zen Hei}}{}
+\setTransitionsForDiacritics{\fontspec{Droid Sans Arabic}}{}
+\setTransitionTo{Hebrew}{\fontspec{David CLM}}
+\setmainfont{CMU Serif}
 
 \newcommand{\fsfclosing}[1]{\par\nobreak\vspace{\parskip}
   \stopbreaks
@@ -61,7 +79,7 @@ class CRM_Utils_PDF_Utils {
   \hspace*{\longindentation}\fi
   \parbox{\indentedwidth}{\raggedright
        \ignorespaces #1\\\\[1\medskipamount]
-       \hspace*{-0.25in}\includegraphics[scale=1.0]{sigjohns.pdf}
+       \hspace*{-0.25in}\includegraphics[scale=1.0]{/var/www/drupal-7.27/sites/all/modules/civicrm/sigjohns.pdf}
        \\\\
 
        \ifx\@empty\fromsig
@@ -72,16 +90,16 @@ class CRM_Utils_PDF_Utils {
 
 %% This line might be necessary, but it was not able to find utf8.def on my
 %% machine.
-\usepackage[utf8x]{inputenc}
+%% \usepackage[utf8x]{inputenc}
 \pagestyle{empty}
 \tolerance=8000
 \address{\vspace{0.05in}}
 \signature{John Sullivan \\\\ Executive Director}
 \usepackage[
-top    = 0.4in,
-bottom = 0.9in,
-left   = 0.8in,
-right  = 0.8in]{geometry}
+top    = 1.5in,
+bottom = 1.25in,
+left   = 1.0in,
+right  = 1.0in]{geometry}
 \begin{document}
 ';
                 $footer='
@@ -120,8 +138,10 @@ right  = 0.8in]{geometry}
       header('Content-Type: application/pdf');
       header('Content-Disposition: attachment; filename="' . $fileName . '"');
       echo $pdf;
+//      CRM_Utils_PDF_Utils::enqueuePDF($pdf);
+
     }
-       }
+  }
 
   /**
    * @param array $text
@@ -328,6 +348,7 @@ right  = 0.8in]{geometry}
     $snappy->setOption("margin-right", $margins[2] . $margins[0]);
     $snappy->setOption("margin-bottom", $margins[3] . $margins[0]);
     $snappy->setOption("margin-left", $margins[4] . $margins[0]);
+    $html = preg_replace('/{ }/', ' ', $html);
     $pdf = $snappy->getOutputFromHtml($html);
     if ($output) {
       return $pdf;
@@ -336,6 +357,8 @@ right  = 0.8in]{geometry}
       CRM_Utils_System::setHttpHeader('Content-Type', 'application/pdf');
       CRM_Utils_System::setHttpHeader('Content-Disposition', 'attachment; filename="' . $fileName . '"');
       echo $pdf;
+      //CRM_Utils_PDF_Utils::enqueuePDF($pdf);
+
     }
   }
 
index 89982f7181642689aa4b153bf923560aa4cbd817..6ba59e9664ed08d80855d82742b391cd0ba13351 100644 (file)
             amount = 0;
           }
 
+          // next, check for contribution amount price sets
+          check_price_set('.contribution_amount-content input[type="radio"]');
+
+          // next, check for membership level price set
+          check_price_set('.membership_amount-content input[type="radio"]');
+
+          check_price_set(cj('.price-set-option-content input[type="radio"]'));
+
           // make sure amount is a number at this point
           if(!amount) amount = 0;
 
         // update premiums
         function update_premiums() {
           var amount = get_amount();
+         console.log('amount:', amount);
 
           $('.premium').each(function(){
             var min_contribution = $(this).attr('min_contribution');