Issue #1258536 by logaritmisk: set node-type fields to default when not set.
authorJoao Ventura
Fri, 26 Aug 2011 17:56:50 +0000 (19:56 +0200)
committerJoao Ventura
Fri, 26 Aug 2011 17:56:50 +0000 (19:56 +0200)
print.module
print_mail/print_mail.module
print_pdf/print_pdf.module

index f9e8d79..79d812a 100644 (file)
@@ -446,9 +446,15 @@ function print_nodeapi(&$node, $op = 'view', $teaser, $page) {
     case 'insert':
     case 'update':
       if (user_access('administer print') || user_access('node-specific print configuration')) {
-        if ($node->print_display === NULL) $node->print_display = variable_get('print_display_'. $node->type, PRINT_TYPE_SHOW_LINK_DEFAULT);
-        if ($node->print_display_comment === NULL) $node->print_display_comment = variable_get('print_display_comment_'. $node->type, PRINT_TYPE_COMMENT_LINK_DEFAULT);
-        if ($node->print_display_urllist === NULL) $node->print_display_urllist = variable_get('print_display_urllist_'. $node->type, PRINT_TYPE_URLLIST_DEFAULT);
+        if (!isset($node->print_display) || ($node->print_display === NULL)) {
+          $node->print_display = variable_get('print_display_'. $node->type, PRINT_TYPE_SHOW_LINK_DEFAULT);
+        }
+        if (!isset($node->print_display_comment) || ($node->print_display_comment === NULL)) {
+          $node->print_display_comment = variable_get('print_display_comment_'. $node->type, PRINT_TYPE_COMMENT_LINK_DEFAULT);
+        }
+        if (!isset($node->print_display_urllist) || ($node->print_display_urllist === NULL)) {
+          $node->print_display_urllist = variable_get('print_display_urllist_'. $node->type, PRINT_TYPE_URLLIST_DEFAULT);
+        }
 
         _print_node_conf_modify($node->nid, $node->print_display, $node->print_display_comment, $node->print_display_urllist);
       }
index 7f21a54..ea8d87a 100644 (file)
@@ -217,9 +217,15 @@ function print_mail_nodeapi(&$node, $op = 'view', $teaser, $page) {
     case 'insert':
     case 'update':
       if (user_access('administer print') || user_access('node-specific print configuration')) {
-        if ($node->print_mail_display === NULL) $node->print_mail_display = variable_get('print_mail_display_'. $node->type, PRINT_TYPE_SHOW_LINK_DEFAULT);
-        if ($node->print_mail_display_comment === NULL) $node->print_mail_display_comment = variable_get('print_mail_display_comment_'. $node->type, PRINT_TYPE_COMMENT_LINK_DEFAULT);
-        if ($node->print_mail_display_urllist === NULL) $node->print_mail_display_urllist = variable_get('print_mail_display_urllist_'. $node->type, PRINT_TYPE_URLLIST_DEFAULT);
+        if (!isset($node->print_mail_display) || ($node->print_mail_display === NULL)) {
+          $node->print_mail_display = variable_get('print_mail_display_'. $node->type, PRINT_TYPE_SHOW_LINK_DEFAULT);
+        }
+        if (!isset($node->print_mail_display_comment) || ($node->print_mail_display_comment === NULL)) {
+          $node->print_mail_display_comment = variable_get('print_mail_display_comment_'. $node->type, PRINT_TYPE_COMMENT_LINK_DEFAULT);
+        }
+        if (!isset($node->print_mail_display_urllist) || ($node->print_mail_display_urllist === NULL)) {
+          $node->print_mail_display_urllist = variable_get('print_mail_display_urllist_'. $node->type, PRINT_TYPE_URLLIST_DEFAULT);
+        }
 
         _print_mail_node_conf_modify($node->nid, $node->print_mail_display, $node->print_mail_display_comment, $node->print_mail_display_urllist);
       }
index f5e00fb..d2ce3a4 100644 (file)
@@ -333,9 +333,15 @@ function print_pdf_nodeapi(&$node, $op = 'view', $teaser, $page) {
     case 'insert':
     case 'update':
       if (user_access('administer print') || user_access('node-specific print configuration')) {
-        if ($node->print_pdf_display === NULL) $node->print_pdf_display = variable_get('print_pdf_display_'. $node->type, PRINT_TYPE_SHOW_LINK_DEFAULT);
-        if ($node->print_pdf_display_comment === NULL) $node->print_pdf_display_comment = variable_get('print_pdf_display_comment_'. $node->type, PRINT_TYPE_COMMENT_LINK_DEFAULT);
-        if ($node->print_pdf_display_urllist === NULL) $node->print_pdf_display_urllist = variable_get('print_pdf_display_urllist_'. $node->type, PRINT_TYPE_URLLIST_DEFAULT);
+        if (!isset($node->print_pdf_display) || ($node->print_pdf_display === NULL)) {
+          $node->print_pdf_display = variable_get('print_pdf_display_'. $node->type, PRINT_TYPE_SHOW_LINK_DEFAULT);
+        }
+        if (!isset($node->print_pdf_display_comment) || ($node->print_pdf_display_comment === NULL)) {
+          $node->print_pdf_display_comment = variable_get('print_pdf_display_comment_'. $node->type, PRINT_TYPE_COMMENT_LINK_DEFAULT);
+        }
+        if (!isset($node->print_pdf_display_urllist) || ($node->print_pdf_display_urllist === NULL)) {
+          $node->print_pdf_display_urllist = variable_get('print_pdf_display_urllist_'. $node->type, PRINT_TYPE_URLLIST_DEFAULT);
+        }
 
         _print_pdf_node_conf_modify($node->nid, $node->print_pdf_display, $node->print_pdf_display_comment, $node->print_pdf_display_urllist);
       }