fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15756] property: invoice handling


From: sigurdne
Subject: [Fmsystem-commits] [15756] property: invoice handling
Date: Thu, 29 Sep 2016 12:40:29 +0000 (UTC)

Revision: 15756
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15756
Author:   sigurdne
Date:     2016-09-29 12:40:28 +0000 (Thu, 29 Sep 2016)
Log Message:
-----------
property: invoice handling

Modified Paths:
--------------
    trunk/property/inc/class.uitts.inc.php
    trunk/property/inc/class.uiworkorder.inc.php
    trunk/property/inc/custom/default/BkBygg_exporter_varemottak_til_Agresso.php
    trunk/property/templates/base/workorder.xsl

Modified: trunk/property/inc/class.uitts.inc.php
===================================================================
--- trunk/property/inc/class.uitts.inc.php      2016-09-29 12:40:10 UTC (rev 
15755)
+++ trunk/property/inc/class.uitts.inc.php      2016-09-29 12:40:28 UTC (rev 
15756)
@@ -56,7 +56,8 @@
                        'get_external_project'=> true,
                        'get_unspsc_code'=> true,
                        'receive_order' => true,
-                       'check_purchase_right'=> true
+                       'check_purchase_right'=> true,
+                       'show_attachment'       => true
                );
 
                /**
@@ -229,6 +230,35 @@
                        echo $html;
                }
 
+               function show_attachment(  )
+               {
+                       if (!$this->acl->check('.ticket.order', PHPGW_ACL_ADD, 
'property'))
+                       {
+                               phpgw::no_access();
+                       }
+                       $GLOBALS['phpgw_info']['flags']['noheader'] = true;
+                       $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
+                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
+
+                       $file_name = urldecode(phpgw::get_var('file_name'));
+                       $key = phpgw::get_var('key');
+                       $invoice_config = CreateObject('admin.soconfig', 
$GLOBALS['phpgw']->locations->get_id('property', '.invoice'));
+                       $directory_attachment = 
rtrim($invoice_config->config_data['import']['local_path'], '/') . 
'/attachment/' . $key;
+
+                       $file = "$directory_attachment/$file_name";
+
+                       if (file_exists($file))
+                       {
+                               $size = filesize($file);
+                               $content = file_get_contents($file);
+
+                               $browser = CreateObject('phpgwapi.browser');
+                               $browser->content_header($document['name'], '', 
$size);
+                               echo $content;
+                       }
+       
+               }
+
                function download2()
                {
                        if (!$this->acl->check('.ticket.external', 
PHPGW_ACL_READ, 'property'))
@@ -2607,11 +2637,14 @@
                                $approved_amount += $entry['approved_amount'];
                        }
 
-                       foreach ($invoices as $entry)
+
+                       if($invoices)
                        {
-
                                $invoice_config = 
CreateObject('admin.soconfig', $GLOBALS['phpgw']->locations->get_id('property', 
'.invoice'));
+                       }
 
+                       foreach ($invoices as $entry)
+                       {
                                $directory_attachment = 
rtrim($invoice_config->config_data['import']['local_path'], '/') . 
'/attachment/' .$entry['external_voucher_id'];
                                $attachmen_list = array();
                                try
@@ -2626,9 +2659,15 @@
                                                                continue;
                                                        }
 
+                                                       $url = self::link(array(
+                                                               'menuaction'=> 
'property.uitts.show_attachment',
+                                                               'file_name' => 
urlencode((string)$file),
+                                                               'key'=> 
$entry['external_voucher_id']
+                                                               ));
+
                                                        $attachmen_list[] = 
array(
                                                                'voucher_id'    
=> $entry['external_voucher_id'],
-                                                               'file_name'     
        => (string)$file
+                                                               'file_name'     
        => "<a href='{$url}' target='_blank'>" . (string)$file . "</a>"
                                                        );
                                                }
                                        }

Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php        2016-09-29 12:40:10 UTC 
(rev 15755)
+++ trunk/property/inc/class.uiworkorder.inc.php        2016-09-29 12:40:28 UTC 
(rev 15756)
@@ -1781,6 +1781,59 @@
                                $approved_amount += $entry['approved_amount'];
                        }
 
+                       if($invoices)
+                       {
+                               $invoice_config = 
CreateObject('admin.soconfig', $GLOBALS['phpgw']->locations->get_id('property', 
'.invoice'));
+                       }
+
+                       foreach ($invoices as $entry)
+                       {
+                               $directory_attachment = 
rtrim($invoice_config->config_data['import']['local_path'], '/') . 
'/attachment/' .$entry['external_voucher_id'];
+                               $attachmen_list = array();
+                               try
+                               {
+                                       $dir = new 
DirectoryIterator("$directory_attachment/");
+                                       if (is_object($dir))
+                                       {
+                                               foreach ($dir as $file)
+                                               {
+                                                       if ($file->isDot() || 
!$file->isFile() || !$file->isReadable())
+                                                       {
+                                                               continue;
+                                                       }
+
+                                                       $url = self::link(array(
+                                                               'menuaction'=> 
'property.uitts.show_attachment',
+                                                               'file_name' => 
urlencode((string)$file),
+                                                               'key'=> 
$entry['external_voucher_id']
+                                                               ));
+
+                                                       $attachmen_list[] = 
array(
+                                                               'voucher_id'    
=> $entry['external_voucher_id'],
+                                                               'file_name'     
        => "<a href='{$url}' target='_blank'>" . (string)$file . "</a>"
+                                                       );
+                                               }
+                                       }
+                               }
+                               catch (Exception $e)
+                               {
+
+                               }
+                       }
+                       $attachmen_def = array(
+                               array(
+                                       'key' => 'voucher_id',
+                                       'label' => 'key',
+                                       'hidden' => false
+                                       ),
+                               array(
+                                       'key' => 'file_name',
+                                       'label' => lang('attachments'),
+                                       'hidden' => false,
+                                       'sortable' => true,
+                                       )
+                               );
+
                        $invoice_def = array
                                (
                                array(
@@ -1876,6 +1929,19 @@
                                )
                        );
 
+                       $datatable_def[] = array(
+                               'container' => 'datatable-container_6',
+                               'requestUrl' => "''",
+                               'data' => json_encode($attachmen_list),
+                               'ColumnDefs' => $attachmen_def,
+                               'config' => array(
+                                       array(
+                                               'disableFilter' => true),
+                                       array(
+                                               'disablePagination' => true)
+                               )
+                       );
+
                        $datatable_def[] = array
                                (
                                'container' => 'datatable-container_3',

Modified: 
trunk/property/inc/custom/default/BkBygg_exporter_varemottak_til_Agresso.php
===================================================================
--- 
trunk/property/inc/custom/default/BkBygg_exporter_varemottak_til_Agresso.php    
    2016-09-29 12:40:10 UTC (rev 15755)
+++ 
trunk/property/inc/custom/default/BkBygg_exporter_varemottak_til_Agresso.php    
    2016-09-29 12:40:28 UTC (rev 15756)
@@ -72,8 +72,8 @@
                                'order_id' => $values['order_id'],
                                'lines' => array(
                                        array(
-                                               'UnitCode' => 'STK',
-                                               'Quantity' => 
($received_amount),
+                                               'UnitCode' => 'SUM',
+                                               'Amount' => ($received_amount),
                                        )
                                )
                        );

Modified: trunk/property/templates/base/workorder.xsl
===================================================================
--- trunk/property/templates/base/workorder.xsl 2016-09-29 12:40:10 UTC (rev 
15755)
+++ trunk/property/templates/base/workorder.xsl 2016-09-29 12:40:28 UTC (rev 
15756)
@@ -975,7 +975,7 @@
                                                </input>
                                        </div>
                                        <xsl:choose>
-                                               <xsl:when test="mode='edit'">
+                                               <xsl:when 
test="value_workorder_id!='' and mode='edit'">
                                                        <div 
class="pure-control-group">
                                                                <label 
for="name">
                                                                        
<xsl:value-of select="php:function('lang', 'order received')"/>
@@ -1012,34 +1012,57 @@
                                                        </div>
                                                </xsl:when>
                                        </xsl:choose>
-                                       <div class="pure-control-group">
-                                               <label for="name">
-                                                       <xsl:choose>
-                                                               <xsl:when 
test="value_workorder_id!='' and mode='edit'">
-                                                                       
<xsl:variable name="lang_add_invoice_statustext">
-                                                                               
<xsl:value-of select="php:function('lang', 'add invoice')"/>
-                                                                       
</xsl:variable>
-                                                                       <a 
href="javascript:showlightbox_manual_invoice({value_workorder_id})" 
title="{$lang_add_invoice_statustext}">
-                                                                               
<xsl:value-of select="php:function('lang', 'add invoice')"/>
-                                                                       </a>
-                                                               </xsl:when>
-                                                       </xsl:choose>
-                                               </label>
-                                               <div class="pure-custom">
-                                                       <xsl:for-each 
select="datatable_def">
-                                                               <xsl:if 
test="container = 'datatable-container_2'">
-                                                                       
<xsl:call-template name="table_setup">
-                                                                               
<xsl:with-param name="container" select ='container'/>
-                                                                               
<xsl:with-param name="requestUrl" select ='requestUrl' />
-                                                                               
<xsl:with-param name="ColumnDefs" select ='ColumnDefs' />
-                                                                               
<xsl:with-param name="tabletools" select ='tabletools' />
-                                                                               
<xsl:with-param name="data" select ='data' />
-                                                                               
<xsl:with-param name="config" select ='config' />
-                                                                       
</xsl:call-template>
-                                                               </xsl:if>
-                                                       </xsl:for-each>
-                                               </div>
-                                       </div>
+                                       <xsl:choose>
+                                               <xsl:when 
test="value_workorder_id!=''">
+                                                       <div 
class="pure-control-group">
+                                                               <label 
for="name">
+                                                                       
<xsl:choose>
+                                                                               
<xsl:when test="mode='edit'">
+                                                                               
        <xsl:variable name="lang_add_invoice_statustext">
+                                                                               
                <xsl:value-of select="php:function('lang', 'add invoice')"/>
+                                                                               
        </xsl:variable>
+                                                                               
        <a href="javascript:showlightbox_manual_invoice({value_workorder_id})" 
title="{$lang_add_invoice_statustext}">
+                                                                               
                <xsl:value-of select="php:function('lang', 'add invoice')"/>
+                                                                               
        </a>
+                                                                               
</xsl:when>
+                                                                       
</xsl:choose>
+                                                               </label>
+                                                               <div 
class="pure-custom">
+                                                                       
<xsl:for-each select="datatable_def">
+                                                                               
<xsl:if test="container = 'datatable-container_2'">
+                                                                               
        <xsl:call-template name="table_setup">
+                                                                               
                <xsl:with-param name="container" select ='container'/>
+                                                                               
                <xsl:with-param name="requestUrl" select ='requestUrl' />
+                                                                               
                <xsl:with-param name="ColumnDefs" select ='ColumnDefs' />
+                                                                               
                <xsl:with-param name="tabletools" select ='tabletools' />
+                                                                               
                <xsl:with-param name="data" select ='data' />
+                                                                               
                <xsl:with-param name="config" select ='config' />
+                                                                               
        </xsl:call-template>
+                                                                               
</xsl:if>
+                                                                       
</xsl:for-each>
+                                                               </div>
+                                                       </div>
+                                                       <div 
class="pure-control-group">
+                                                               <label 
for="name">
+                                                                       
<xsl:value-of select="php:function('lang', 'attachments')"/>
+                                                               </label>
+                                                               <div 
class="pure-custom">
+                                                                       
<xsl:for-each select="datatable_def">
+                                                                               
<xsl:if test="container = 'datatable-container_6'">
+                                                                               
        <xsl:call-template name="table_setup">
+                                                                               
                <xsl:with-param name="container" select ='container'/>
+                                                                               
                <xsl:with-param name="requestUrl" select ='requestUrl' />
+                                                                               
                <xsl:with-param name="ColumnDefs" select ='ColumnDefs' />
+                                                                               
                <xsl:with-param name="tabletools" select ='tabletools' />
+                                                                               
                <xsl:with-param name="data" select ='data' />
+                                                                               
                <xsl:with-param name="config" select ='config' />
+                                                                               
        </xsl:call-template>
+                                                                               
</xsl:if>
+                                                                       
</xsl:for-each>
+                                                               </div>
+                                                       </div>
+                                               </xsl:when>
+                                       </xsl:choose>
                                </fieldset>
                        </div>
                        <div id="coordination">




reply via email to

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