fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [17100] property: pdf-order from ticket


From: sigurdne
Subject: [Fmsystem-commits] [17100] property: pdf-order from ticket
Date: Wed, 20 Sep 2017 04:47:11 -0400 (EDT)

Revision: 17100
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17100
Author:   sigurdne
Date:     2017-09-20 04:47:10 -0400 (Wed, 20 Sep 2017)
Log Message:
-----------
property: pdf-order from ticket

Modified Paths:
--------------
    trunk/property/inc/class.uitts.inc.php

Modified: trunk/property/inc/class.uitts.inc.php
===================================================================
--- trunk/property/inc/class.uitts.inc.php      2017-09-19 12:53:25 UTC (rev 
17099)
+++ trunk/property/inc/class.uitts.inc.php      2017-09-20 08:47:10 UTC (rev 
17100)
@@ -3318,22 +3318,69 @@
 
                        $pdf->ezStartPageNumbers(500, 28, 6, 'right', 
'{PAGENUM} ' . lang('of') . ' {TOTALPAGENUM}', 1);
 
-                       $data = array
-                               (
+                       $organisation = '';
+                       $contact_name = '';
+                       $contact_email = '';
+                       $contact_phone = '';
+                       $contact_name2  = '';
+                       $contact_email2 = '';
+                       $contact_phone3 = '';
+
+                       if (isset($this->bo->config->config_data['org_name']))
+                       {
+                               $organisation = 
$this->bo->config->config_data['org_name'];
+                       }
+                       if (isset($this->bo->config->config_data['department']))
+                       {
+                               $department = 
$this->bo->config->config_data['department'];
+                       }
+
+                       $data = array(
                                array(
-                                       'col1' => 
"{$this->bo->config->config_data['org_name']}\n\nOrg.nr: 
{$this->bo->config->config_data['org_unit_id']}",
-                                       'col2' => lang('Order'),
-                                       'col3' => lang('order id') . 
"\n\n{$ticket['order_id']}")
+                                       'col1' => lang('order id') . " 
<b>{$ticket['order_id']}</b>",
+                                       'col2' => lang('date') . ": {$date}"
+                       ));
+
+                       $pdf->ezTable($data, array('col1' => '', 'col2' => ''), 
'', array('showHeadings' => 0,
+                               'shaded' => 0, 'xPos' => 0,
+                               'xOrientation' => 'right', 'width' => 500, 
'gridlines' => EZ_GRIDLINE_ALL,
+                               'cols' => array
+                                       (
+                                       'col1' => array('justification' => 
'right', 'width' => 250, 'justification' => 'left'),
+                                       'col2' => array('justification' => 
'right', 'width' => 250, 'justification' => 'left'),
+                               )
+                       ));
+
+                       
$GLOBALS['phpgw']->preferences->set_account_id($common_data['workorder']['user_id'],
 true);
+
+
+                       $on_behalf_of_assigned = 
phpgw::get_var('on_behalf_of_assigned', 'bool');
+                       if ($on_behalf_of_assigned && 
isset($ticket['assignedto_name']))
+                       {
+                               $from_name = $ticket['assignedto_name'];
+                               
$GLOBALS['phpgw']->preferences->set_account_id($ticket['assignedto'], true);
+                               $GLOBALS['phpgw_info']['user']['preferences'] = 
$GLOBALS['phpgw']->preferences->data;
+                       }
+                       else
+                       {
+                               $from_name = 
$GLOBALS['phpgw_info']['user']['fullname'];
+                       }
+
+                       $ressursnr = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['ressursnr'];
+                       $data = array(
+                               array(
+                                       'col1' => 
"{$organisation}\n{$department}\nOrg.nr: 
{$this->bo->config->config_data['org_unit_id']}",
+                                       'col2' => "Saksbehandler: 
{$from_name}\nRessursnr.: {$ressursnr}"
+                               ),
                        );
 
-                       $pdf->ezTable($data, array('col1' => '', 'col2' => '', 
'col3' => ''), '', array(
+                       $pdf->ezTable($data, array('col1' => '', 'col2' => ''), 
'', array(
                                'showHeadings' => 0, 'shaded' => 0, 'xPos' => 0,
                                'xOrientation' => 'right', 'width' => 500, 
'gridlines' => EZ_GRIDLINE_ALL,
                                'cols' => array
                                        (
-                                       'col1' => array('justification' => 
'right', 'width' => 200, 'justification' => 'left'),
-                                       'col2' => array('justification' => 
'right', 'width' => 100, 'justification' => 'center'),
-                                       'col3' => array('justification' => 
'right', 'width' => 200),
+                                       'col1' => array('justification' => 
'right', 'width' => 250, 'justification' => 'left'),
+                                       'col2' => array('justification' => 
'right', 'width' => 250, 'justification' => 'left'),
                                )
                        ));
 
@@ -3345,6 +3392,7 @@
                        }
                        else
                        {
+                               $delivery_address .= "\n" . 
createObject('property.solocation')->get_location_address($ticket['location_code'])."\n";
                                $location_code = 
$ticket['location_data']['location_code'];
                                $address_element = 
execMethod('property.botts.get_address_element', $location_code);
                                foreach ($address_element as $entry)
@@ -3353,31 +3401,31 @@
                                }
                        }
 
-                       $invoice_address = lang('invoice address') . 
":\n{$this->bo->config->config_data['invoice_address']}";
+                       $data = array
+                               (
+                               array('col1' => $delivery_address)
+                       );
 
-                       
$GLOBALS['phpgw']->preferences->set_account_id($common_data['workorder']['user_id'],
 true);
+                       $pdf->ezTable($data, array('col1' => ''), '', 
array('showHeadings' => 0,
+                               'shaded' => 0, 'xPos' => 0,
+                               'xOrientation' => 'right', 'width' => 500, 
'gridlines' => EZ_GRIDLINE_ALL,
+                               'cols' => array
+                                       (
+                                       'col1' => array('justification' => 
'right', 'width' => 500, 'justification' => 'left'),
+                               )
+                       ));
 
+                       $invoice_address = lang('invoice address') . 
":\n{$this->bo->config->config_data['invoice_address']}";
 
-                       $on_behalf_of_assigned = 
phpgw::get_var('on_behalf_of_assigned', 'bool');
-                       if ($on_behalf_of_assigned && 
isset($ticket['assignedto_name']))
-                       {
-                               $from_name = $ticket['assignedto_name'];
-                               
$GLOBALS['phpgw']->preferences->set_account_id($ticket['assignedto'], true);
-                               $GLOBALS['phpgw_info']['user']['preferences'] = 
$GLOBALS['phpgw']->preferences->data;
-                       }
-                       else
-                       {
-                               $from_name = 
$GLOBALS['phpgw_info']['user']['fullname'];
-                       }
 
-                       $from = lang('date') . ": {$date}\n";
-                       $from .= lang('dimb') . ": {$ticket['ecodimb']}\n";
-                       $from .= lang('from') . ":\n   {$from_name}";
-                       $from .= "\n   
{$GLOBALS['phpgw']->preferences->data['property']['email']}";
-                       $from .= "\n   
{$GLOBALS['phpgw']->preferences->data['property']['cellphone']}";
+//                     $from = lang('date') . ": {$date}\n";
+//                     $from .= lang('dimb') . ": {$ticket['ecodimb']}\n";
+//                     $from .= lang('from') . ":\n   {$from_name}";
+//                     $from .= "\n   
{$GLOBALS['phpgw']->preferences->data['property']['email']}";
+//                     $from .= "\n   
{$GLOBALS['phpgw']->preferences->data['property']['cellphone']}";
+//
 
 
-
                        if (isset($ticket['vendor_id']) && $ticket['vendor_id'])
                        {
                                $ticket['vendor_name'] = 
$this->_get_vendor_name($ticket['vendor_id']);
@@ -3385,8 +3433,7 @@
 
                        $data = array
                                (
-                               array('col1' => lang('vendor') . 
":\n{$ticket['vendor_name']}", 'col2' => $delivery_address),
-                               array('col1' => $from, 'col2' => 
$invoice_address)
+                               array('col1' => lang('to') . 
":\n{$ticket['vendor_name']}", 'col2' => $invoice_address),
                        );
 
                        if($ticket['order_deadline'])
@@ -3412,7 +3459,6 @@
                        $pdf->selectFont(PHPGW_API_INC . 
'/pdf/fonts/Helvetica-Bold.afm');
                        $pdf->ezText(lang('descr') . ':', 20);
                        $pdf->selectFont(PHPGW_API_INC . 
'/pdf/fonts/Helvetica.afm');
-                       $ressursnr = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['ressursnr'];
 
                        $contact_data = 
$this->bocommon->initiate_ui_contact_lookup(array(
                                'contact_id' => $ticket['contact_id'],
@@ -3436,6 +3482,9 @@
                        $pdf->ezText($ticket['order_descr'], 14);
                        $pdf->ezSetDy(-20);
 
+                       $user_phone = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['cellphone'];
+                       $user_email = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['email'];
+                       $order_email_template = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['order_email_template'];
                        $order_contact_block_template = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['order_contact_block_1'];
 
                        if 
(!empty($this->bo->config->config_data['contact_at_location']))
@@ -3467,36 +3516,60 @@
                                }
                        }
 
-                       $contact_block = str_replace(array
-                               (
-                               '__user_name__',
-                               '__user_phone__',
-                               '__user_email__',
-                               '__contact_name__',
-                               '__contact_email__',
-                               '__contact_phone__',
-                               '__contact_name2__',
-                               '__contact_email2__',
-                               '__contact_phone2__',
-                               '__order_id__',
-                               '[b]',
-                               '[/b]'
-                                       ), array
-                               (
-                               $user_name,
-                               $user_phone,
-                               $user_email,
-                               $contact_name,
-                               $contact_email,
-                               $contact_phone,
-                               $contact_name2,
-                               $contact_email2,
-                               $contact_phone2,
-                               $order_id,
-                               '<b>',
-                               '</b>'
-                                       ), $order_contact_block_template);
+                       $user_phone = str_replace(' ', '', $user_phone);
+                       $contact_phone = str_replace(' ', '', $contact_phone);
+                       $contact_phone2 = str_replace(' ', '', $contact_phone2);
 
+                       if(  preg_match( '/^(\d{2})(\d{2})(\d{2})(\d{2})$/', 
$user_phone,  $matches ) )
+                       {
+                               $user_phone = "{$matches[1]} $matches[2] 
$matches[2] $matches[4]";
+                       }
+                       if(  preg_match( '/^(\d{2})(\d{2})(\d{2})(\d{2})$/', 
$contact_phone,  $matches ) )
+                       {
+                               $contact_phone = "{$matches[1]} $matches[2] 
$matches[2] $matches[4]";
+                       }
+                       if(  preg_match( '/^(\d{2})(\d{2})(\d{2})(\d{2})$/', 
$contact_phone2,  $matches ) )
+                       {
+                               $contact_phone2 = "{$matches[1]} $matches[2] 
$matches[2] $matches[4]";
+                       }
+
+                       if($contact_name)
+                       {
+                               $contact_block = str_replace(array
+                                       (
+                                       '__user_name__',
+                                       '__user_phone__',
+                                       '__user_email__',
+                                       '__contact_name__',
+                                       '__contact_email__',
+                                       '__contact_phone__',
+                                       '__contact_name2__',
+                                       '__contact_email2__',
+                                       '__contact_phone2__',
+                                       '__order_id__',
+                                       '[b]',
+                                       '[/b]'
+                                               ), array
+                                       (
+                                       $user_name,
+                                       $user_phone,
+                                       $user_email,
+                                       $contact_name,
+                                       $contact_email,
+                                       $contact_phone,
+                                       $contact_name2,
+                                       $contact_email2,
+                                       $contact_phone2,
+                                       $order_id,
+                                       '<b>',
+                                       '</b>'
+                                               ), 
$order_contact_block_template);
+                       }
+                       else
+                       {
+                               $contact_block = '';
+                       }
+
 //                     $pdf->selectFont(PHPGW_API_INC . 
'/pdf/fonts/Helvetica-Bold.afm');
 //                     $pdf->ezText('Kontakt på bygget:', 14);
 //                     $pdf->selectFont(PHPGW_API_INC . 
'/pdf/fonts/Helvetica.afm');




reply via email to

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