Our changes
authorLisa Marie Maginnis <lisam@fsf.org>
Thu, 1 May 2014 21:04:18 +0000 (17:04 -0400)
committerroot <root@crm.fsf.org>
Fri, 11 Sep 2015 01:16:47 +0000 (21:16 -0400)
CRM/ACL/BAO/Cache.php
CRM/Contact/Task.php
CRM/Contribute/Task.php
CRM/Core/Resources.php
CRM/Import/Parser.php
CRM/Utils/PDF/Utils.php
CRM/Utils/Token.php
api/v3/Contact.php
api/v3/Contribution.php

index b665d2013d944d2b0898b0bb98ca3cf69b701259..97eb69d2e57c93de0ae2957986551503495af3ff 100644 (file)
@@ -79,9 +79,13 @@ SELECT acl_id
 ";
     $params = array(1 => array($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 764ef97ba852e0a8f7a4612d09d71a1768a17ded..57ff3cb67917abac619ec2d8cee65a14dc497aac 100644 (file)
@@ -64,7 +64,8 @@ class CRM_Contact_Task {
     EMAIL_UNHOLD = 22,
     RESTORE = 23,
     DELETE_PERMANENTLY = 24,
-    COMMUNICATION_PREFS = 25;
+    COMMUNICATION_PREFS = 25,
+    LATEX_LETTER = 26;
 
   /**
    * The task array
@@ -167,6 +168,11 @@ class CRM_Contact_Task {
           'title' => ts('Alter Contact Communication Preferences'),
           'class' => 'CRM_Contact_Form_Task_AlterPreferences',
         ),
+        self::LATEX_LETTER => array(
+          'title' => ts('Print Latex PDF Letter for Contacts'),
+          'class' => 'CRM_Contact_Form_Task_LatexPDF',
+          'result' => TRUE,
+        ),
         self::RESTORE => array(
           'title' => ts('Restore Contacts'),
           'class' => 'CRM_Contact_Form_Task_Delete',
index d4d095a46d8c305738492170eb168306dbbbdf6e..e3361cf086152fc4dea597386d42c9b517cfa204 100644 (file)
@@ -39,7 +39,7 @@
  *
  */
 class CRM_Contribute_Task {
-  const DELETE_CONTRIBUTIONS = 1, PRINT_CONTRIBUTIONS = 2, EXPORT_CONTRIBUTIONS = 3, BATCH_CONTRIBUTIONS = 4, EMAIL_CONTACTS = 5, UPDATE_STATUS = 6, PDF_RECEIPT = 7;
+  CONST DELETE_CONTRIBUTIONS = 1, PRINT_CONTRIBUTIONS = 2, EXPORT_CONTRIBUTIONS = 3, BATCH_CONTRIBUTIONS = 4, EMAIL_CONTACTS = 5, UPDATE_STATUS = 6, PDF_RECEIPT = 7, LATEX_TEST = 10;
 
   /**
    * The task array
@@ -116,6 +116,11 @@ class CRM_Contribute_Task {
           'class' => 'CRM_Contribute_Form_Task_Invoice',
           'result' => FALSE,
         ),
+        10 => array(
+          'title' => ts('Latex Letters for Contributions'),
+          'class' => 'CRM_Contribute_Form_Task_PDFLatex',
+          'result' => FALSE,
+        ),
       );
 
       //CRM-4418, check for delete
index e1663fc7bf0509c3237b7f3f457ec6bd0c3f75ef..c18c8d5679b1e9a8d4a0027916d5d38ad937cf14 100644 (file)
@@ -342,7 +342,7 @@ class CRM_Core_Resources {
    * @return string
    */
   public function renderSetting() {
-    // On a standard page request we construct the CRM object from scratch
+    /*// On a standard page request we construct the CRM object from scratch
     if (!self::isAjaxMode()) {
       $js = 'var CRM = ' . json_encode($this->getSettings()) . ';';
     }
@@ -351,6 +351,10 @@ class CRM_Core_Resources {
       $js = 'CRM.$.extend(true, CRM, ' . json_encode($this->getSettings()) . ');';
     }
     return sprintf("<script type=\"text/javascript\">\n%s\n</script>\n", $js);
+    */
+    $js = 'var CRM = ' . json_encode($this->getSettings()) . ';';
+    //return sprintf("<script type=\"text/javascript\">\n%s\n</script>\n", $js);
+    return sprintf("<script type=\"text/javascript\">\n// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3\n%s\n// @license-end\n</script>\n", $js);
   }
 
   /**
index e55ead633bd14a95469990092f7a12681a19ddb2..a17561478f09cec9b2deb18f1e72bb30ee8bbbd0 100644 (file)
@@ -36,7 +36,7 @@ abstract class CRM_Import_Parser {
   /**
    * Settings
    */
-  const MAX_ERRORS = 250, MAX_WARNINGS = 25, DEFAULT_TIMEOUT = 30;
+  CONST MAX_ERRORS = 10000, MAX_WARNINGS = 25, DEFAULT_TIMEOUT = 30;
 
   /**
    * Return codes
index f2c9bd85588899f41ae18255cca136052f400bbd..3882c7b606b048550340669b0c818f2095b1f034 100644 (file)
@@ -36,8 +36,96 @@ define('DOMPDF_ENABLE_AUTOLOAD', FALSE);
  * $Id$
  *
  */
+
 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 $text
    * @param string $fileName
index b549e4aa9f1f6ae764e6456ca3b73bb8fd975f0f..fb5d96f9b4ca01c258d4ecab51655118fc875bd9 100644 (file)
@@ -685,7 +685,7 @@ class CRM_Utils_Token {
       $str
     );
 
-    $str = preg_replace('/\\\\|\{(\s*)?\}/', ' ', $str);
+    //$str = preg_replace('/\\\\|\{(\s*)?\}/', ' ', $str); //WHY you do this?
     return $str;
   }
 
@@ -874,7 +874,7 @@ class CRM_Utils_Token {
    *   this function works directly on the string that is passed
    */
   public static function unescapeTokens(&$str) {
-    $str = preg_replace('/\\\\|\{(\{\w+\.\w+\})\}/', '\\1', $str);
+    //$str = preg_replace('/\\\\|\{(\{\w+\.\w+\})\}/', '\\1', $str);
   }
 
   /**
index eb6b5d73583d22ef82a026be99664ee3b95890fd..a7a6f9039d102394ad288f027d628ef4cc1a51f3 100644 (file)
@@ -134,6 +134,15 @@ function _civicrm_api3_contact_create_spec(&$params) {
   $params['gender_id']['api.aliases'] = array('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 8d1df05359b2bb13a6b625b74d73d6aaf4ebb5f1..9283eebbdba7d8a02a1139b7fc53c1a3c5bf9348 100644 (file)
@@ -202,6 +202,15 @@ function _civicrm_api3_contribution_delete_spec(&$params) {
   $params['id']['api.aliases'] = array('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.
  *