Is there any way to detect PDF/email in NetSuite Advanced PDFs? - templates

Is there any way to detect if an advanced PDF is being used as a PDF or an email in NetSuite?
I would like to format accordingly.
Something like:
<#if current_format=="email">Show some html stuff.<#else>PDF version</#if>

There is no 'state' information available in to the template generator that I can think of. All it knows is the record context you(or NetSuite) gave it.
The output of the advanced template is XML regardless of its final destination. It's converted to PDF or HTMl output after having been generated. (See: nlapiCreateTemplateRenderer() and nlapiXMLToPDF() documentation in NetSuite for more info.)
If you need to format the content differently, the simplest method is probably to use 2 separate forms.

Related

How to use filepond with Django

As the title suggest.
I have searched Google and stackoverflow, so far I don't find any tutorial that doesn't involve (https://github.com/ImperialCollegeLondon/django-drf-filepond).
While this library seems maintain, at 68 stars, too much risk and I prefer to do without it.
What I tried
When you use filepond input tag with class file-uploader file-uploader-grid, in browser, it will compile and generate a div tag.
The issue is that the id in input will be generated under the div instead of input tag.
Without that id, when the form is submitted, self.request.FILES will be empty dictionary.
So I tried writing a JavaScript to add id to input tag, which don't work unfortunately.
Anyone successfully do it in Django without additional library? Thanks
The input generated is only there to catch files, the actual data is either stored in hidden input fields (if you use server property) or encoded in those fields (if you use file encode plugin).
You can set storeAsFile to true to have FilePond update the fileList property of a file field. But that doesn't work on older versions of iOS, see link in property description:
https://pqina.nl/filepond/docs/api/instance/properties/

Mail Merge vs Document Generation?

I'm looking for a Node or Python Package/Module, that helps me work with document templating, and whenever I lookup this subjects, I get many out of date packages or redirect to HTML template engines...
My problem is, that I have many MS Word Templates and PDF, and I want to be able to query the fields on each template, so I can be passed them in properly, and occasionally generate a series of documents from one record of data.
Any help on how should I look up this? because I can't find it, but I think is that I don't know the Term, Document {Auto}Generation, Mail Merge, Document Templates {Node,Python}, Word Templates {Node,Python}... and I can't get anything useful.

MailChimp: How to use conditional logic with RSS feeds

I have searched MailChimp's documentation as well as other sites but cannot seem to figure out how to use both conditional merge tag blocks with |FEED| merge tags.
Basically I am wanting to combine the two in order to include posts from multiple blogs in my e-mail campaign; in particular, I would like to use conditional logic so that any RSS feeds evaluated as "empty" (meaning no new items) receive alternative content that says something along the lines of "no updates available."
I have tried to come up with a few ways of doing this - none have been successful, but here's the type of thing I had in mind:
*|FEEDBLOCK:http://www.mailchimp.com/blog/feed/|*
*|FEED:TITLE|*
*|IF:FEED:POSTS[$content=full] != |*
*|FEED:POSTS[$count=3,$content=titles]|*
*|ELSE:|*
no updates available for this feed
*|END:IF|*
*|END:FEEDBLOCK|*
any help would be appreciated.
Well, this question is from ages ago, but I had a similar problem and figured out a (really hacky) work-around...
Assumptions:
1. You're using a (very) custom RSS feed
2. You're overriding the default RSS tags with custom content
In my use case, I'm using the <category> RSS tag, which MailChimp reads in via the *FEEDITEM:CATEGORY* merge tag. I'm using this as a subheading for my RSS feed, instead.
If that subheading is filled out in the admin (that is, whatever admin system you're using to spit out the RSS feed), I want to include it in the feed -- but I also need to add in more html for the email template. The solution is including the required html in the RSS feed. (Like I said -- hacky.)
Shockingly, this works. Mailchimp dutifully pulls in all the html/css.
The RSS feed (vastily simplied here) looks something like this:
<channel>
<item>
<category><![CDATA[ <table><td><tr><div class="example">Sub Headline</div></tr></td> ]]></category>
</item>
<channel>
If that field is not set in my custom admin, then no <category> tags at all are outputted, and MailChimp simply ignores that merge tag.
So basically, any email HTML code that you want to display only if the merge tag is valid, should show up in the feed itself.
Definitely not ideal, but it works.
YMMV...
MailChimp is still very limited with it's conditional tags, which are limited to subscriber data. RSS feed conditions would be a welcome addition.
http://blog.mailchimp.com/conditional-dynamic-content-in-mailchimp/

HTML Purifier - Change default allowed HTML tags configuration

I want to allow a limited white list of HTML tags that users can use in my forum. So I have configured the HTML Purifier like so:
$config = HTMLPurifier_Config::createDefault();
$config->set('HTML.Allowed', 'p,a[href|rel|target|title],img[src],span[style],strong,em,ul,ol,li');
$purifier = new HTMLPurifier($config);
What I am wondering is, does the default configuration of the HTML Purifier still apply, with the exception of a reduced number of accepted HTML tags or do I need to re-set every possible configuration parameter manually?
Additionally, should I tweak the default configuration in any way to stay safe? I am new to the whole XSS protection thing, new to HTML Purifier and didn't find that the manual gave a lot of 'basic' tips and hints.
HTML Purifier is safe by default and any restrictions you impose on it by changing %HTML.Allowed are guaranteed only to reduce the permitted tag set. Check out http://htmlpurifier.org/live/smoketests/printDefinition.php to see how tweaking configuration changes the allowed tagset.
Why not just use a DOM parser and check if tag type is in allowed white list of HTML tags?
Converting the input to a DOM node list you should be able to loop through all the DOM nodes and check if the type is allowed that way. php.net has great examples for how to do this written by others like you trying to solve the input sanitization problem.
More information here:
http://php.net/manual/en/class.domdocument.php

How will I filter out only errors in Jenkins-email-ext, BUILD_LOG_REGEX?

Currently I m using BUILD_LOG_REGEX in Jenkins Editable email information to get a log of the errors via email. But I get a lot of junk and I want to filter out the errors and I want the log of errors filtered to perfection. Any help?
Your question is rather non-specific. As Juuso Ohtonen notes in a comment, what you do highly depends on what can be usually found in your log. Here's an example of what we use in one of our jobs, it is rather generic (if not to say minimalistic):
${BUILD_LOG_REGEX, regex="^.*?BUILD FAILED.*?$", linesBefore=0, linesAfter=10, maxMatches=5, showTruncatedLines=false, escapeHtml=true}
I would suggest the following: create a job that logs some text that contains types of errors you encounter (you may just spew some text file that you place in the job's workspace), then play with Java regex patterns - java.util.regex.Pattern - in the Plugin until you get the desired result. Make sure you send the e-mails from the job only to yourself :)
To use custom HTML - here's a quote from the Plugin's Content Token reference:
${JELLY_SCRIPT, template} - Custom message content generated from a Jelly script
template. There are two templates provided: "html" and "text". Custom Jelly templates
should be placed in $JENKINS_HOME/email-templates. When using custom templates, the
template filename without ".jelly" should be used for the "template" argument.
template - the template name. Defaults to "html".
The default template that you can use as your starting point is located in
$JENKINS_HOME/plugins/email-ext/WEB-INF/classes/hudson/plugins/emailext/templates/html.jelly