fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [11321] property: preview ticket order as html


From: Sigurd Nes
Subject: [Fmsystem-commits] [11321] property: preview ticket order as html
Date: Wed, 25 Sep 2013 12:05:58 +0000

Revision: 11321
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11321
Author:   sigurdne
Date:     2013-09-25 12:05:55 +0000 (Wed, 25 Sep 2013)
Log Message:
-----------
property: preview ticket order as html

Modified Paths:
--------------
    trunk/property/inc/class.uitts.inc.php
    trunk/property/inc/hook_settings.inc.php
    trunk/property/templates/base/tts.xsl

Modified: trunk/property/inc/class.uitts.inc.php
===================================================================
--- trunk/property/inc/class.uitts.inc.php      2013-09-24 12:57:42 UTC (rev 
11320)
+++ trunk/property/inc/class.uitts.inc.php      2013-09-25 12:05:55 UTC (rev 
11321)
@@ -2727,7 +2727,8 @@
                        }
                        unset($_temp);
 
-                       if($vendor_email)
+                       $preview_html = phpgw::get_var('preview_html', 'bool');
+                       if($vendor_email || $preview_html)
                        {
                                $subject = lang('workorder').": 
{$ticket['order_id']}";
 
@@ -2741,14 +2742,18 @@
                                        $organisation = 
$this->bo->config->config_data['org_name'];
                                }
 
-                               if(isset($values['on_behalf_of_assigned']) && 
$values['on_behalf_of_assigned'] && isset($ticket['assignedto_name']))
+                               $on_behalf_of_assigned = 
phpgw::get_var('on_behalf_of_assigned', 'bool');
+                               if($on_behalf_of_assigned && 
isset($ticket['assignedto_name']))
                                {
                                        $user_name = $ticket['assignedto_name'];
                                        
$GLOBALS['phpgw']->preferences->set_account_id($ticket['assignedto'], true);
                                        
$GLOBALS['phpgw_info']['user']['preferences'] = 
$GLOBALS['phpgw']->preferences->data;
-                                       $_behalf_alert = lang('this order is 
sent by %1 on behalf of %2',$GLOBALS['phpgw_info']['user']['fullname'], 
$user_name);
-                                       
$historylog->add('C',$id,$_behalf_alert);
-                                       unset($_behalf_alert);
+                                       if(!$preview_html)
+                                       {
+                                               $_behalf_alert = lang('this 
order is sent by %1 on behalf of 
%2',$GLOBALS['phpgw_info']['user']['fullname'], $user_name);
+                                               
$historylog->add('C',$id,$_behalf_alert);
+                                               unset($_behalf_alert);
+                                       }
                                }
                                else
                                {
@@ -2789,6 +2794,7 @@
 
                                $body = nl2br(str_replace(array
                                        (
+                                               '__vendor_name__',
                                                '__organisation__',
                                                '__user_name__',
                                                '__user_phone__',
@@ -2804,6 +2810,7 @@
                                                '[/b]'
                                        ),array
                                        (
+                                               
$vendor_data['value_vendor_name'],
                                                $organisation,
                                                $user_name,
                                                $user_phone,
@@ -2819,6 +2826,20 @@
                                                '</b>'
                                        ),$order_email_template));
 
+                                       $html = 
"<html><head><title>{$subject}</title></head>";
+                                       $html .= "<body>{$body}</body></html>";
+
+
+                               if($preview_html)
+                               {
+                               
+                                       
$GLOBALS['phpgw_info']['flags']['noheader'] = true;
+                                       
$GLOBALS['phpgw_info']['flags']['nofooter'] = true;
+                                       
$GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
+                                       echo $html;
+                                       $GLOBALS['phpgw']->common->phpgw_exit();
+                               }
+
                                if(isset($values['file_attach']) && 
is_array($values['file_attach']))
                                {
                                        $bofiles        = 
CreateObject('property.bofiles');
@@ -3244,6 +3265,8 @@
                                        'building_part_list'                    
=> array('options' => $this->bocommon->select_category_list(array('type'=> 
'building_part','selected' =>$ticket['building_part'], 'order' => 'id', 
'id_in_name' => 'num', 'filter' => $_filter_buildingpart))),
                                        'order_dim1_list'                       
        => array('options' => 
$this->bocommon->select_category_list(array('type'=> 'order_dim1','selected' 
=>$ticket['order_dim1'], 'order' => 'id', 'id_in_name' => 'num' ))),
                                        'branch_list'                           
        => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_branch_list'])
 && 
$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_branch_list']==1 
? array('options' => execMethod('property.boproject.select_branch_list', 
$values['branch_id'])) :'',
+                                       'preview_html'                          
        => "javascript:preview_html($id)",
+
                                );
 
                        //---datatable settings--------------------

Modified: trunk/property/inc/hook_settings.inc.php
===================================================================
--- trunk/property/inc/hook_settings.inc.php    2013-09-24 12:57:42 UTC (rev 
11320)
+++ trunk/property/inc/hook_settings.inc.php    2013-09-25 12:05:55 UTC (rev 
11321)
@@ -309,7 +309,9 @@
        create_select_box('remove navbar','nonavbar',array('no' => 'No','yes' 
=> 'Yes'),'Navigation bar is removed');
        create_select_box('Tabel export format','export_format',array('excel' 
=> 'Excel','csv' => 'CSV', 'ods' => 'ODS'),'Choose which format to export from 
the system for tables');
 
-       $default = 'Fra: __organisation__';
+       $default = 'Til: __vendor_name__';
+       $default .= "\n";
+       $default .= "\n" . 'Fra: __organisation__';
        $default .= "\n" . 'Saksbehandler: __user_name__, ressursnr: 
__ressursnr__';
        $default .= "\n";
        $default .= "\n" . '__location__';

Modified: trunk/property/templates/base/tts.xsl
===================================================================
--- trunk/property/templates/base/tts.xsl       2013-09-24 12:57:42 UTC (rev 
11320)
+++ trunk/property/templates/base/tts.xsl       2013-09-25 12:05:55 UTC (rev 
11321)
@@ -395,6 +395,17 @@
                                var strURL = phpGWLink('index.php', oArgs);
                                
Window1=window.open(strURL,"Search","left=50,top=100,width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
                        }
+                       
+                       function preview_html(id)
+                       {
+
+                               var on_behalf_of_assigned = 
document.getElementById("on_behalf_of_assigned").checked ? 1 : 0;
+
+                               var oArgs = 
{menuaction:'property.uitts.view',id:id, preview_html:true, 
on_behalf_of_assigned: on_behalf_of_assigned};
+                               var strURL = phpGWLink('index.php', oArgs);
+                               
Window1=window.open(strURL,'Search',"left=50,top=100,width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
+
+                       }
                </script>
                <table cellpadding="2" cellspacing="2" width="95%" 
align="center">
                        <xsl:choose>
@@ -808,7 +819,17 @@
                                                                                
                </td>
                                                                                
                <td>
                                                                                
                        <xsl:value-of select="value_order_id"/>
+                                                                               
                        <xsl:text> </xsl:text>
                                                                                
                        <input type="hidden" name="values[order_id]" 
value="{value_order_id}"/>
+                                                                               
                        <xsl:variable name="lang_preview_html">
+                                                                               
                                <xsl:value-of select="php:function('lang', 
'preview html')"/>
+                                                                               
                        </xsl:variable>
+                                                                               
                        <a href="{preview_html}">
+                                                                               
                                <xsl:attribute name="title">
+                                                                               
                                <xsl:value-of select="$lang_preview_html"/>
+                                                                               
                                </xsl:attribute>
+                                                                               
                                <xsl:value-of select="$lang_preview_html"/>
+                                                                               
                        </a>
                                                                                
                </td>
                                                                                
        </tr>
                                                                                
        <tr>
@@ -818,13 +839,14 @@
                                                                                
                        </label>
                                                                                
                </td>
                                                                                
                <td>
-                                                                               
                        <input type="checkbox" 
name="values[on_behalf_of_assigned]" value="True">
+                                                                               
                        <input type="checkbox" id = "on_behalf_of_assigned" 
name="on_behalf_of_assigned" value="True">
                                                                                
                                <xsl:attribute name="title">
                                                                                
                                        <xsl:value-of 
select="php:function('lang', 'on behalf of assigned - vacation mode')"/>
                                                                                
                                </xsl:attribute>
                                                                                
                        </input>
                                                                                
                </td>
                                                                                
        </tr>
+
                                                                                
        <xsl:call-template name="vendor_form"/>
                                                                                
        <xsl:call-template name="ecodimb_form"/>
                                                                                
        <xsl:call-template name="b_account_form"/>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]