Fixed issue 22902: Added 'Print' link button to be used in QueryList widgets
authorDavid Baz Fayos <david.baz@openbravo.com>
Sat, 26 Jan 2013 21:51:40 +0100
changeset 19456 603290cb6a8a
parent 19455 ef2e15e1a780
child 19457 16eca807e2a3
child 19516 76fd8a0d8eee
Fixed issue 22902: Added 'Print' link button to be used in QueryList widgets
modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/classic/ob-classic-compatibility.js
modules/org.openbravo.client.querylist/src/org/openbravo/client/querylist/QueryListUtils.java
modules/org.openbravo.client.querylist/web/org.openbravo.client.querylist/js/ob-querylist-canvas-item.js
src/org/openbravo/erpCommon/businessUtility/PrinterReports.html
src/org/openbravo/erpCommon/businessUtility/PrinterReports.java
src/org/openbravo/erpCommon/businessUtility/PrinterReports.xml
src/org/openbravo/erpCommon/utility/reporting/printing/PrintController.java
src/org/openbravo/erpCommon/utility/reporting/printing/PrintOptions.html
src/org/openbravo/erpCommon/utility/reporting/printing/PrintOptions.xml
--- a/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml	Sat Jan 26 17:16:16 2013 +0100
+++ b/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml	Sat Jan 26 21:51:40 2013 +0100
@@ -66,6 +66,17 @@
 <!--04A912EBB5154048961E21EF15380D4A-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
 <!--04A912EBB5154048961E21EF15380D4A--></AD_MESSAGE>
 
+<!--04E5DFD5293748308CF3ED2848CE8AE4--><AD_MESSAGE>
+<!--04E5DFD5293748308CF3ED2848CE8AE4-->  <AD_MESSAGE_ID><![CDATA[04E5DFD5293748308CF3ED2848CE8AE4]]></AD_MESSAGE_ID>
+<!--04E5DFD5293748308CF3ED2848CE8AE4-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--04E5DFD5293748308CF3ED2848CE8AE4-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--04E5DFD5293748308CF3ED2848CE8AE4-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--04E5DFD5293748308CF3ED2848CE8AE4-->  <VALUE><![CDATA[OBUIAPP_Print]]></VALUE>
+<!--04E5DFD5293748308CF3ED2848CE8AE4-->  <MSGTEXT><![CDATA[Print]]></MSGTEXT>
+<!--04E5DFD5293748308CF3ED2848CE8AE4-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--04E5DFD5293748308CF3ED2848CE8AE4-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--04E5DFD5293748308CF3ED2848CE8AE4--></AD_MESSAGE>
+
 <!--07272FCDEEA64054AF2F983D9814EE00--><AD_MESSAGE>
 <!--07272FCDEEA64054AF2F983D9814EE00-->  <AD_MESSAGE_ID><![CDATA[07272FCDEEA64054AF2F983D9814EE00]]></AD_MESSAGE_ID>
 <!--07272FCDEEA64054AF2F983D9814EE00-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java	Sat Jan 26 17:16:16 2013 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java	Sat Jan 26 21:51:40 2013 +0100
@@ -838,12 +838,10 @@
     }
   }
 
-  public class PrintButton extends IconButton {
-    public boolean hasEmail;
-
-    public PrintButton() {
-      Process process = tab.getProcess();
-      String processUrl = "";
+  public static String getPrintUrl(Tab myTab) {
+    String processUrl = "";
+    if (myTab.getProcess() != null) {
+      Process process = myTab.getProcess();
       for (ModelImplementation mo : process.getADModelImplementationList()) {
         if (mo.isDefault() && ("P".equals(mo.getAction()) || "R".equals(mo.getAction()))) {
           for (ModelImplementationMapping mom : mo.getADModelImplementationMappingList()) {
@@ -861,6 +859,16 @@
       if (processUrl.indexOf("/") == -1) {
         processUrl = "/" + FormatUtilities.replace(processUrl);
       }
+    }
+    return processUrl;
+  }
+
+  public class PrintButton extends IconButton {
+    public boolean hasEmail;
+
+    public PrintButton() {
+      Process process = tab.getProcess();
+      String processUrl = getPrintUrl(tab);
 
       hasEmail = processUrl.contains("orders") || processUrl.contains("invoices")
           || processUrl.contains("payments");
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/classic/ob-classic-compatibility.js	Sat Jan 26 17:16:16 2013 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/classic/ob-classic-compatibility.js	Sat Jan 26 21:51:40 2013 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2010-2012 Openbravo SLU
+ * All portions are Copyright (C) 2010-2013 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -356,9 +356,10 @@
       // * {{{showCloseControl}}} type: Boolean - to specify if the popup should show the close control or not. The default value is "true" if it is not specified
       // * {{{postParams}}} type: Object - parameters to be sent to the url using POST instead of GET
       // * {{{isModal}}} type: Boolean - to specify if the popup should be modal or not. The default value is "true" if it is not specified
+      // * {{{show}}} type: Boolean - to specify if the popup should be shown or not. The default value is "true" if it is not specified
       // 
       // returns the created OBClassicPopupWindow
-      open: function (name, width, height, url, title, theOpener, showMinimizeControl, showMaximizeControl, showCloseControl, postParams, isModal) {
+      open: function (name, width, height, url, title, theOpener, showMinimizeControl, showMaximizeControl, showCloseControl, postParams, isModal, show) {
         var urlCharacter = (url && url.indexOf('?') !== -1) ? '&' : '?';
 
         if (showMinimizeControl !== false) {
@@ -373,6 +374,9 @@
         if (isModal !== false) {
           isModal = true;
         }
+        if (show !== false) {
+          show = true;
+        }
         var _htmlCode, _navUserAgent = navigator.userAgent.toUpperCase();
         if (OB.Utilities.isIE9Strict || _navUserAgent.indexOf("MSIE") === -1) { // IE >= 9 (Strict) or any other browser
           _htmlCode = '<html><head></head><body style="margin: 0; padding: 0; border: none;">' + '<iframe id="MDIPopupContainer" name="MDIPopupContainer" style="margin: 0; padding: 0; border: none; width: 100%; height: 100%;"></iframe>' + '<iframe name="frameMenu" scrolling="no" src="' + OB.Application.contextUrl + 'utility/VerticalMenu.html?Command=HIDE" id="paramFrameMenuLoading" style="margin: 0px; padding: 0px; border: 0px; height: 0px; width: 0px;"></iframe>' + '</body></html>';
@@ -396,6 +400,9 @@
           popupURL: url + urlCharacter + 'IsPopUpCall=1'
         });
         cPopup.show();
+        if (!show) {
+          cPopup.hide();
+        }
         if (cPopup.getIframeHtmlObj) {
           cPopup.getIframeHtmlObj().name = 'OBClassicPopup_iframe'; //To be used in automated tests: https://issues.openbravo.com/view.php?id=16786
         }
--- a/modules/org.openbravo.client.querylist/src/org/openbravo/client/querylist/QueryListUtils.java	Sat Jan 26 17:16:16 2013 +0100
+++ b/modules/org.openbravo.client.querylist/src/org/openbravo/client/querylist/QueryListUtils.java	Sat Jan 26 21:51:40 2013 +0100
@@ -28,6 +28,7 @@
 import org.openbravo.base.exception.OBException;
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.model.ModelProvider;
+import org.openbravo.client.application.window.OBViewTab;
 import org.openbravo.client.kernel.reference.UIDefinition;
 import org.openbravo.client.kernel.reference.UIDefinitionController;
 import org.openbravo.client.myob.WidgetClass;
@@ -85,6 +86,11 @@
 
           if (column.getClientClass() != null) {
             field.put("clientClass", column.getClientClass());
+            if (column.isHasLink()) {
+              final Tab tab = column.getTab();
+              final String printUrl = OBViewTab.getPrintUrl(tab);
+              field.put("OB_printUrl", printUrl);
+            }
           }
 
           field.put("canExport", true);
--- a/modules/org.openbravo.client.querylist/web/org.openbravo.client.querylist/js/ob-querylist-canvas-item.js	Sat Jan 26 17:16:16 2013 +0100
+++ b/modules/org.openbravo.client.querylist/web/org.openbravo.client.querylist/js/ob-querylist-canvas-item.js	Sat Jan 26 21:51:40 2013 +0100
@@ -30,3 +30,34 @@
     }
   }
 });
+
+isc.defineClass('OBQLCanvasItem_Print', isc.OBGridLinkItem);
+
+isc.OBQLCanvasItem_Print.addProperties({
+  title: OB.I18N.getLabel('OBUIAPP_Print'),
+  isDirectPDF: true,
+  isDirectAttach: false,
+  blockAction: false,
+  doAction: function () {
+    var postParams = {
+      inpdirectprint: "N",
+      inppdfpath: this.field.OB_printUrl,
+      inpwindowId: this.field.OB_WindowId,
+      inpkeyColumnId: this.field.OB_keyColumnName,
+      inpTabId: this.field.OB_TabId,
+      inphiddenvalue: this.record[this.field.OB_LinkExpression],
+      inpIsDirectPDF: this.isDirectPDF,
+      inpIsDirectAttach: this.isDirectAttach
+    },
+        showPopup = (postParams.inpIsDirectPDF || postParams.inpIsDirectAttach ? false : true),
+        me = this;
+    if (postParams.inppdfpath && !this.blockAction) {
+      // Block action + setTimeout to avoid user double-click the 'Print' button in 4 seconds.
+      this.blockAction = true;
+      OB.Layout.ClassicOBCompatibility.Popup.open('print', 0, 0, OB.Application.contextUrl + 'businessUtility/PrinterReports.html', '', window, false, false, true, postParams, showPopup, showPopup);
+      setTimeout(function () {
+        me.blockAction = false;
+      }, 4000);
+    }
+  }
+});
\ No newline at end of file
--- a/src/org/openbravo/erpCommon/businessUtility/PrinterReports.html	Sat Jan 26 17:16:16 2013 +0100
+++ b/src/org/openbravo/erpCommon/businessUtility/PrinterReports.html	Sat Jan 26 21:51:40 2013 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2001-2011 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2013 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -25,6 +25,16 @@
 <script language="JavaScript" src="../../../../../web/js/utils.js" type="text/javascript"></script>
 <script language="JavaScript" src="../../../../../web/js/messages.js" type="text/javascript"></script>
 <script language="JavaScript" type="text/javascript" id="paramLanguage">    defaultLang = "en_US";</script>
+<script language="JavaScript" type="text/javascript">
+  var isDirectPDF = false;
+  var isDirectAttach = false;
+</script>
+<script language="JavaScript" type="text/javascript" id="paramIsDirectPDF">
+  isDirectPDF = false;
+</script>
+<script language="JavaScript" type="text/javascript" id="paramIsDirectAttach">
+  isDirectAttach = false;
+</script>
 <script language="JavaScript" type="text/javascript" id="isPrintPreview">
 function printReport(pagina) {
     if (isWindowInMDIContext) {
@@ -32,7 +42,9 @@
       if (pagina.indexOf('../') === 0) {
         pagina = pagina.substring(3, pagina.length);
       }
-      LayoutMDI.OB.Layout.ClassicOBCompatibility.Popup.open('printpdf', 600, 300, LayoutMDI.OB.Application.contextUrl + pagina + "?Commnad=PDF", '', window, false, false, true);
+      var params = "?Commnad=PDF" + (isDirectPDF ? "&isDirectPDF=true" : "") + (isDirectAttach ? "&isDirectAttach=true" : "");
+      var showPopup = (isDirectPDF || isDirectAttach ? false : true)
+      LayoutMDI.OB.Layout.ClassicOBCompatibility.Popup.open('printpdf', 600, 300, LayoutMDI.OB.Application.contextUrl + pagina + params, '', window, false, false, true, null, showPopup, showPopup);
     } else {
       openPDF(pagina, 'PDF');
     }
--- a/src/org/openbravo/erpCommon/businessUtility/PrinterReports.java	Sat Jan 26 17:16:16 2013 +0100
+++ b/src/org/openbravo/erpCommon/businessUtility/PrinterReports.java	Sat Jan 26 21:51:40 2013 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2001-2010 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2013 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -29,6 +29,7 @@
 import org.openbravo.base.filter.IsIDFilter;
 import org.openbravo.base.secureApp.HttpSecureAppServlet;
 import org.openbravo.base.secureApp.VariablesSecureApp;
+import org.openbravo.data.Sqlc;
 import org.openbravo.utils.FormatUtilities;
 import org.openbravo.xmlEngine.XmlDocument;
 
@@ -46,20 +47,34 @@
     if (vars.commandIn("DEFAULT")) {
       String strDirectPrint = vars.getStringParameter("inpdirectprint", "N");
       String strPDFPath = vars.getStringParameter("inppdfpath");
+      String strKeyColumnId = vars.getStringParameter("inpkeyColumnId");
       String strHiddenKey = vars.getStringParameter("inphiddenkey");
+      if (strHiddenKey == null || "".equals(strHiddenKey)) {
+        strHiddenKey = "inp" + Sqlc.TransformaNombreColumna(strKeyColumnId);
+      }
       String strWindowId = vars.getStringParameter("inpwindowId");
-      String strKeyColumnId = vars.getStringParameter("inpkeyColumnId");
       String inptabId = vars.getStringParameter("inpTabId");
       String strHiddenValue = vars.getGlobalVariable("inphiddenvalue", strWindowId + "|"
           + strKeyColumnId);
-      printPage(response, vars, strDirectPrint, strPDFPath, strHiddenKey, strHiddenValue, inptabId);
+      String strIsDirectPDF = vars.getStringParameter("inpIsDirectPDF");
+      if (strIsDirectPDF == null || "".equals(strIsDirectPDF)) {
+        strIsDirectPDF = "false";
+      }
+      String strIsDirectAttach = vars.getStringParameter("inpIsDirectAttach");
+      if (strIsDirectAttach == null || "".equals(strIsDirectAttach)) {
+        strIsDirectAttach = "false";
+      }
+
+      printPage(response, vars, strDirectPrint, strPDFPath, strHiddenKey, strHiddenValue, inptabId,
+          strIsDirectPDF, strIsDirectAttach);
     } else
       pageError(response);
   }
 
   private void printPage(HttpServletResponse response, VariablesSecureApp vars,
       String strDirectPrint, String strPDFPath, String strHiddenKey, String strHiddenValue,
-      String inptabId) throws IOException, ServletException {
+      String inptabId, String strIsDirectPDF, String strIsDirectAttach) throws IOException,
+      ServletException {
     if (log4j.isDebugEnabled())
       log4j.debug("Output: dataSheet");
     String[] discard = { "isPrintPreview" };
@@ -79,6 +94,8 @@
     xmlDocument.setParameter("language", "defaultLang=\"" + vars.getLanguage() + "\";");
     xmlDocument.setParameter("pdfPath", mapping);
     xmlDocument.setParameter("directPrint", strDirectPrint);
+    xmlDocument.setParameter("isDirectPDF", "isDirectPDF = " + strIsDirectPDF + ";\r\n");
+    xmlDocument.setParameter("isDirectAttach", "isDirectAttach = " + strIsDirectAttach + ";\r\n");
     // if (strPDFPath.startsWith("..")) strPDFPath =
     // strPDFPath.substring(2);
 
--- a/src/org/openbravo/erpCommon/businessUtility/PrinterReports.xml	Sat Jan 26 17:16:16 2013 +0100
+++ b/src/org/openbravo/erpCommon/businessUtility/PrinterReports.xml	Sat Jan 26 21:51:40 2013 +0100
@@ -12,7 +12,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2001-2010 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2013 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -21,6 +21,8 @@
 	<template file="PrinterReports.html"/>
 	<PARAMETER id="paramDirectory" name="directory" default=""/>
 	<PARAMETER id="paramLanguage" name="language" default=""/>
+	<PARAMETER id="paramIsDirectPDF" name="isDirectPDF" default=""/>
+	<PARAMETER id="paramIsDirectAttach" name="isDirectAttach" default=""/>
 	<PARAMETER id="fieldPDFPath" name="pdfPath" attribute="onload" replace="xx"/>
 	<PARAMETER id="fieldIsDirectPrint" name="directPrint" attribute="value"/>
 	<PARAMETER id="Pdf1" name="pdfPath" attribute="src" replace="xx"/>
--- a/src/org/openbravo/erpCommon/utility/reporting/printing/PrintController.java	Sat Jan 26 17:16:16 2013 +0100
+++ b/src/org/openbravo/erpCommon/utility/reporting/printing/PrintController.java	Sat Jan 26 21:51:40 2013 +0100
@@ -8,7 +8,7 @@
  * either express or implied. See the License for the specific language
  * governing rights and limitations under the License. The Original Code is
  * Openbravo ERP. The Initial Developer of the Original Code is Openbravo SLU All
- * portions are Copyright (C) 2008-2012 Openbravo SLU All Rights Reserved.
+ * portions are Copyright (C) 2008-2013 Openbravo SLU All Rights Reserved.
  * Contributor(s): ______________________________________.
  */
 package org.openbravo.erpCommon.utility.reporting.printing;
@@ -802,11 +802,21 @@
 
     // Get additional document information
     final String draftDocumentIds = "";
+    String strIsDirectPDF = vars.getStringParameter("isDirectPDF");
+    if (strIsDirectPDF == null || "".equals(strIsDirectPDF)) {
+      strIsDirectPDF = "false";
+    }
+    String strIsDirectAttach = vars.getStringParameter("isDirectAttach");
+    if (strIsDirectAttach == null || "".equals(strIsDirectAttach)) {
+      strIsDirectAttach = "false";
+    }
     xmlDocument.setParameter("directory", "var baseDirectory = \"" + strReplaceWith + "/\";\r\n");
     xmlDocument.setParameter("language", vars.getLanguage());
     xmlDocument.setParameter("theme", vars.getTheme());
     xmlDocument.setParameter("description", "");
     xmlDocument.setParameter("help", "");
+    xmlDocument.setParameter("isDirectPDF", "isDirectPDF = " + strIsDirectPDF + ";\r\n");
+    xmlDocument.setParameter("isDirectAttach", "isDirectAttach = " + strIsDirectAttach + ";\r\n");
     response.setContentType("text/html; charset=UTF-8");
     final PrintWriter out = response.getWriter();
     out.println(xmlDocument.print());
--- a/src/org/openbravo/erpCommon/utility/reporting/printing/PrintOptions.html	Sat Jan 26 17:16:16 2013 +0100
+++ b/src/org/openbravo/erpCommon/utility/reporting/printing/PrintOptions.html	Sat Jan 26 21:51:40 2013 +0100
@@ -13,7 +13,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2008-2011 Openbravo SLU
+ * All portions are Copyright (C) 2008-2013 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -31,6 +31,16 @@
       <script language="JavaScript" type="text/javascript" id="paramLanguage">
         var defaultLang = "en_US";
       </script>
+      <script language="JavaScript" type="text/javascript">
+        var isDirectPDF = false;
+        var isDirectAttach = false;
+      </script>
+      <script language="JavaScript" type="text/javascript" id="paramIsDirectPDF">
+        isDirectPDF = false;
+      </script>
+      <script language="JavaScript" type="text/javascript" id="paramIsDirectAttach">
+        isDirectAttach = false;
+      </script>
       <script language="JavaScript" src="../../../../../web/js/shortcuts.js" type="text/javascript"></script>
       <script language="JavaScript" src="../../../../../web/js/utils.js" type="text/javascript"></script>
       <script language="JavaScript" src="../../../../../web/js/messages.js" type="text/javascript"></script>
@@ -46,16 +56,19 @@
     }
 
     function submitThisPage(strCommand) {
-       if (!isWindowInMDIPopup || getFrame('LayoutMDI').OB.MainView.TabSet.getSelectedTab().pane.getClassName()==='OBClassicWindow') {
+      if (!isWindowInMDIPopup || getFrame('LayoutMDI').OB.MainView.TabSet.getSelectedTab().pane.getClassName()==='OBClassicWindow') {
         // If opening in 2.50 layout, do it in hidden frame
         submitCommandForm(strCommand, false, null, null, "hiddenFrame");
       } else {
           //In OB 3, we submit the form in the OB 3 background_target hidden iframe
         submitCommandForm(strCommand, false, null, null, "background_target");
           //We refresh the main view to ensure that the attachments counter is updated
-        getFrame('LayoutMDI').OB.MainView.TabSet.getSelectedTab().pane.view.refresh();
+        var tabSet = getFrame('LayoutMDI').OB.MainView.TabSet;
+        if (tabSet && tabSet.getSelectedTab() && tabSet.getSelectedTab().pane.view && tabSet.getSelectedTab().pane.view.refresh) {
+          tabSet.getSelectedTab().pane.view.refresh();
+        }
       }
-       closePage();
+      closePage();
       return true;
     }
 
@@ -65,16 +78,20 @@
 	}
 	
 	function onLoadDo(){
-		
+		if (isDirectAttach) {
+			document.getElementById('linkButtonAttach').click();
+		} else if (isDirectPDF) {
+			document.getElementById('linkButtonPrint').click();
+		}
 		this.windowTables = new Array(
-		  new windowTableId('client', 'buttonOK')
+			new windowTableId('client', 'linkButtonPrint')
 		);
 		setWindowTableParentElement();
 		enableShortcuts('popup');
 		setBrowserAutoComplete(false);
 
 		setWindowElementFocus('firstElement');
-        resizeWindow();
+			resizeWindow();
 	}
 
 	function onResizeDo(){
@@ -288,7 +305,7 @@
 		                <td class="Button_RightAlign_ContentCell">
 		                  <div>
                         <button type="button" 
-                          id="linkButtonOk" 
+                          id="linkButtonAttach" 
                           class="ButtonLink" 
                           onclick="submitThisPage('ARCHIVE');return false;" 
                           onfocus="buttonEvent('onfocus', this); window.status='Print and Archive'; return true;" 
@@ -313,6 +330,7 @@
 		                <td class="Button_LeftAlign_ContentCell">
 		                  <div>
                         <button type="button" 
+                          id="linkButtonPrint" 
                           class="ButtonLink" 
                           onclick="submitThisPage('PRINT');return false;" 
                           onfocus="buttonEvent('onfocus', this); window.status='Print'; return true;" 
--- a/src/org/openbravo/erpCommon/utility/reporting/printing/PrintOptions.xml	Sat Jan 26 17:16:16 2013 +0100
+++ b/src/org/openbravo/erpCommon/utility/reporting/printing/PrintOptions.xml	Sat Jan 26 21:51:40 2013 +0100
@@ -12,7 +12,7 @@
 * under the License. 
 * The Original Code is Openbravo ERP. 
 * The Initial Developer of the Original Code is Openbravo SLU 
-* All portions are Copyright (C) 2001-2008 Openbravo SLU 
+* All portions are Copyright (C) 2001-2013 Openbravo SLU 
 * All Rights Reserved. 
 * Contributor(s):  ______________________________________.
 ************************************************************************
@@ -26,6 +26,8 @@
   <PARAMETER id="paramCSS" name="theme" attribute="href" replace="Default"/>
 	<PARAMETER id="processDescription" name="description" replaceCharacters="htmlHelp" default=""/>
 	<PARAMETER id="processHelp" name="help" replaceCharacters="htmlHelp" default=""/>
+  <PARAMETER id="paramIsDirectPDF" name="isDirectPDF" default=""/>
+  <PARAMETER id="paramIsDirectAttach" name="isDirectAttach" default=""/>
 	<PARAMETER id="messageBoxID" name="messageType" attribute="class" replace="yy" default="HIDDEN"/>
 	<PARAMETER id="messageBoxIDTitle" name="messageTitle" default=""/>
 	<PARAMETER id="messageBoxIDMessage" name="messageMessage" default=""/>