Our changes
authorLisa Marie Maginnis <lisam@fsf.org>
Thu, 1 May 2014 21:04:18 +0000 (17:04 -0400)
committerMichael McMahon <michael@fsf.org>
Wed, 4 May 2022 20:32:58 +0000 (16:32 -0400)
CRM/ACL/BAO/Cache.php
CRM/Contact/Task.php
CRM/Contribute/Task.php
CRM/Import/Parser.php
CRM/Utils/PDF/Utils.php
CRM/Utils/Token.php
api/v3/Contact.php
api/v3/Contribution.php

index eac03d8b101fccb86b03b316d788eb2d26828210..2bcce46abd6623a6a8168f2f308784e14a52c7bc 100644 (file)
@@ -64,9 +64,13 @@ SELECT acl_id
 ";
     $params = [1 => [$id, 'Integer']];
 
-    if ($id == 0) {
-      $query .= " OR contact_id IS NULL";
-    }
+## this is related to RT#765026
+# Something is occasionally inserting records in civicrm_acl_cache with id null. That causes i
+# for our anonymous visitors who want to sign petitions.
+# Removed. Ward, 2012-07-20
+#    if ($id == 0) {
+#      $query .= " OR contact_id IS NULL";
+#    }
 
     $dao = CRM_Core_DAO::executeQuery($query, $params);
 
index 5db37ba3e0d9644ee4c30278872d929b9e6276e2..b7b51cb1b6c92a2d50bb8901e5f97069ecc794f1 100644 (file)
@@ -34,7 +34,8 @@ class CRM_Contact_Task extends CRM_Core_Task {
     RESTORE = 108,
     COMMUNICATION_PREFS = 109,
     INDIVIDUAL_CONTACTS = 110,
-    ADD_TO_CASE = 111;
+    ADD_TO_CASE = 111,
+    LATEX_LETTER = 112;
 
   /**
    * @var string
@@ -148,6 +149,11 @@ class CRM_Contact_Task extends CRM_Core_Task {
           'url' => 'civicrm/task/alter-contact-preference',
           'icon' => 'fa-check-square-o',
         ],
+        self::LATEX_LETTER => [
+          'title' => ts('Print Latex PDF Letter for Contacts'),
+          'class' => 'CRM_Contact_Form_Task_LatexPDF',
+          'result' => TRUE,
+        ],
         self::RESTORE => [
           'title' => ts('Restore contacts from trash'),
           'class' => 'CRM_Contact_Form_Task_Delete',
index 2bc1fcf177c13c74e181f5a0327acfaaa566ef5d..3ad1ccab9dc35a87cbd459b68f25bf432a2a18c0 100644 (file)
@@ -29,7 +29,8 @@ class CRM_Contribute_Task extends CRM_Core_Task {
     UPDATE_STATUS = 401,
     PDF_RECEIPT = 402,
     PDF_THANKYOU = 403,
-    PDF_INVOICE = 404;
+    PDF_INVOICE = 404,
+    LATEX_TEST = 405;
 
   /**
    * @var string
@@ -112,6 +113,11 @@ class CRM_Contribute_Task extends CRM_Core_Task {
           'class' => 'CRM_Contribute_Form_Task_Invoice',
           'result' => FALSE,
         ],
+        self::LATEX_TEST => [
+          'title' => ts('Latex Letters for Contributions'),
+          'class' => 'CRM_Contribute_Form_Task_PDFLatex',
+          'result' => FALSE,
+        ],
       ];
 
       //CRM-4418, check for delete
index eb05e31038232aa0d9db4793cda1bf9e98d7e3f1..6f12d74ef36cd14ee466663a3d50269b6791a324 100644 (file)
@@ -18,7 +18,7 @@ abstract class CRM_Import_Parser {
   /**
    * Settings
    */
-  const MAX_WARNINGS = 25, DEFAULT_TIMEOUT = 30;
+  const MAX_ERRORS = 10000, MAX_WARNINGS = 25, DEFAULT_TIMEOUT = 30;
 
   /**
    * Return codes
index a751baa1e38b9b72825d80d38a2c2e270598eaa3..4a6bc942f14531c700fdaff9e0f8c42e63e7b0bd 100644 (file)
@@ -18,8 +18,96 @@ use Dompdf\Options;
  * @package CRM
  * @copyright CiviCRM LLC https://civicrm.org/licensing
  */
+
 class CRM_Utils_PDF_Utils {
 
+  public static function latex2pdf(&$text, $fileName = 'civicrm.pdf', $output = FALSE, $pdfFormat = NULL) {
+         /* FIXME: get $paper_size, $orientation, $margins */
+
+    if (is_array($text)) {
+      $pages = &$text;
+    }
+    else {
+      $pages = array($text);
+    }
+
+
+    $head='\documentclass[11pt]{letter}
+\usepackage{url}
+\usepackage{ucs}
+\usepackage{graphicx}
+\usepackage[T1]{fontenc}
+\usepackage{fullpage}
+
+\newcommand{\fsfclosing}[1]{\par\nobreak\vspace{\parskip}
+  \stopbreaks
+  \noindent
+  \ifx\@empty\fromaddress\else
+  \hspace*{\longindentation}\fi
+  \parbox{\indentedwidth}{\raggedright
+       \ignorespaces #1\\\\[1\medskipamount]
+       \hspace*{-0.25in}\includegraphics[scale=1.0]{sigjohns.pdf}
+       \\\\
+
+       \ifx\@empty\fromsig
+           \fromname
+       \else \fromsig \fi\strut}
+   \par}
+\medskipamount=\parskip
+
+%% This line might be necessary, but it was not able to find utf8.def on my
+%% machine.
+\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}
+\begin{document}
+';
+                $footer='
+\end{document}';
+
+    $latex = $head;
+    foreach ($pages as $page) {
+                       $latex.=$page;
+               }
+    $latex.=$footer;
+
+               $descriptorspec = array(
+        0 => array("pipe", "r"),
+        1 => array("pipe", "w")
+               );
+
+
+
+               $process = proc_open("/usr/local/bin/pdflatex_wrapper.sh", $descriptorspec, $pipes);
+
+
+         if (is_resource($process)) {
+                       fwrite($pipes[0], $latex);
+                       fclose($pipes[0]);
+
+      $pdf = stream_get_contents($pipes[1]);
+                       fclose($pipes[1]);
+         } else {
+                       CRM_Core_Error::debug_log_message("ERROR creating PDF. Check /tmp/pdflatex_*");
+               }
+
+    if ($output) {
+      return $pdf;
+    }
+    else {
+      header('Content-Type: application/pdf');
+      header('Content-Disposition: attachment; filename="' . $fileName . '"');
+      echo $pdf;
+    }
+       }
+
   /**
    * @param array $text
    *   List of HTML snippets.
index aa882def57d587d5134f2bd1b15bded10190fff7..0243c1d29fe80592a258dfb8a44b96eb35515f5e 100644 (file)
@@ -643,7 +643,7 @@ class CRM_Utils_Token {
       $str
     );
 
-    $str = preg_replace('/\\\\|\{(\s*)?\}/', ' ', $str);
+    //$str = preg_replace('/\\\\|\{(\s*)?\}/', ' ', $str); //WHY you do this?
     return $str;
   }
 
@@ -858,7 +858,7 @@ class CRM_Utils_Token {
    * @param string $str ref to the string that will be scanned and modified
    */
   public static function unescapeTokens(&$str) {
-    $str = preg_replace('/\\\\|\{(\{\w+\.\w+\})\}/', '\\1', $str);
+    //$str = preg_replace('/\\\\|\{(\{\w+\.\w+\})\}/', '\\1', $str);
   }
 
   /**
index 237d170cfac78e54757e87f9513c32256af94e98..1b276a022883ee6ccaf409a74acb010b16d46152 100644 (file)
@@ -145,6 +145,15 @@ function _civicrm_api3_contact_create_spec(&$params) {
   $params['gender_id']['api.aliases'] = ['gender'];
 }
 
+/**
+ * Added by Ward; basic filter-able contribution list
+ * use filter.receive_date_high etc
+ * 2013-07-02
+ */
+function civicrm_api3_contact_list($params) {
+  return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
+}
+
 /**
  * Retrieve one or more contacts, given a set of search params.
  *
index b4205cd3c14e4b4f0f1e229acfc5b5bd9fa4890e..f9d48de62695c75207a7ce61ba8c68e641a9d3d0 100644 (file)
@@ -234,6 +234,15 @@ function _civicrm_api3_contribution_delete_spec(&$params) {
   $params['id']['api.aliases'] = ['contribution_id'];
 }
 
+/**
+ * Added by Ward; basic filter-able contribution list
+ * use filter.receive_date_high etc
+ * 2013-07-02
+ */
+function civicrm_api3_contribution_list($params) {
+  return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
+}
+
 /**
  * Retrieve a set of contributions.
  *