fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [17142] Property: prepare attacment for order #FDV-26


From: sigurdne
Subject: [Fmsystem-commits] [17142] Property: prepare attacment for order #FDV-260
Date: Fri, 6 Oct 2017 10:42:46 -0400 (EDT)

Revision: 17142
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17142
Author:   sigurdne
Date:     2017-10-06 10:42:45 -0400 (Fri, 06 Oct 2017)
Log Message:
-----------
Property: prepare attacment for order #FDV-260

Modified Paths:
--------------
    trunk/property/inc/class.sotts.inc.php
    trunk/property/inc/class.soworkorder.inc.php
    trunk/property/inc/class.uiwo_hour.inc.php
    trunk/property/inc/class.uiworkorder.inc.php
    trunk/property/setup/setup.inc.php
    trunk/property/setup/tables_current.inc.php
    trunk/property/setup/tables_update.inc.php
    trunk/property/templates/base/workorder.xsl

Modified: trunk/property/inc/class.sotts.inc.php
===================================================================
--- trunk/property/inc/class.sotts.inc.php      2017-10-05 18:38:39 UTC (rev 
17141)
+++ trunk/property/inc/class.sotts.inc.php      2017-10-06 14:42:45 UTC (rev 
17142)
@@ -1782,7 +1782,6 @@
                                if(isset($ticket['file_attach']) && 
is_array($ticket['file_attach']))
                                {
                                        $file_attachments = array();
-                                       $validator = 
CreateObject('phpgwapi.EmailAddressValidator');
                                        foreach ($ticket['file_attach'] as 
$_temp)
                                        {
                                                $file_attachments[] = 
(int)$_temp;

Modified: trunk/property/inc/class.soworkorder.inc.php
===================================================================
--- trunk/property/inc/class.soworkorder.inc.php        2017-10-05 18:38:39 UTC 
(rev 17141)
+++ trunk/property/inc/class.soworkorder.inc.php        2017-10-06 14:42:45 UTC 
(rev 17142)
@@ -1013,6 +1013,9 @@
                                        'delivery_address' => 
$this->db->f('delivery_address', true),
                                        );
 
+                               $file_attachments = 
trim($this->db->f('file_attachments'), ',');
+                               $workorder['file_attachments'] = $workorder ? 
explode(',', $file_attachments) : array();
+
                                $sql = "SELECT periodization_id,"
                                        . " sum(fm_workorder_budget.budget) AS 
budget, sum(fm_workorder_budget.combined_cost) AS combined_cost,"
                                        . " 
sum(fm_workorder_budget.contract_sum) AS contract_sum"
@@ -1537,6 +1540,16 @@
                                $value_set['address'] = $address;
                        }
 
+                       if(isset($workorder['file_attach']) && 
is_array($workorder['file_attach']))
+                       {
+                               $file_attachments = array();
+                               foreach ($workorder['file_attach'] as $_temp)
+                               {
+                                       $file_attachments[] = (int)$_temp;
+                               }
+                               $value_set['file_attachments'] = implode(',', 
$file_attachments);
+                       }
+
                        $value_set = $this->db->validate_update($value_set);
 
                        $this->db->transaction_begin();

Modified: trunk/property/inc/class.uiwo_hour.inc.php
===================================================================
--- trunk/property/inc/class.uiwo_hour.inc.php  2017-10-05 18:38:39 UTC (rev 
17141)
+++ trunk/property/inc/class.uiwo_hour.inc.php  2017-10-06 14:42:45 UTC (rev 
17142)
@@ -3468,6 +3468,16 @@
 
                        $dir = 
"{$GLOBALS['phpgw_info']['server']['temp_dir']}/pdf_files";
                        $attachments = array();
+                       if (isset($workorder['file_attachments']) && 
is_array($workorder['file_attachments']))
+                       {
+                               $attachments = 
CreateObject('property.bofiles')->get_attachments($workorder['file_attachments']);
+                               $_attachment_log = array();
+                               foreach ($attachments as $_attachment)
+                               {
+                                       $_attachment_log[] = 
$_attachment['name'];
+                               }
+                               $attachment_log = ' ' . lang('attachments') . ' 
: ' . implode(', ', $_attachment_log);
+                       }
 
                        //save the file
                        if (!file_exists($dir))

Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php        2017-10-05 18:38:39 UTC 
(rev 17141)
+++ trunk/property/inc/class.uiworkorder.inc.php        2017-10-06 14:42:45 UTC 
(rev 17142)
@@ -1819,8 +1819,9 @@
                                        'key' => 'delete_file',
                                        'label' => lang('Delete file'),
                                        'sortable' => false,
-                                       'resizeable' => true)
-                       );
+                                       'resizeable' => true,
+                                       'formatter' => 
'JqueryPortico.FormatterCenter'
+                       ));
 
                        $datatable_def[] = array
                                (
@@ -2493,6 +2494,79 @@
                                )
                        );
 
+                       $attach_file_def = array
+                               (
+                               array(
+                                       'key' => 'file_name',
+                                       'label' => lang('Filename'),
+                                       'sortable' => false,
+                                       'resizeable' => true
+                                       ),
+                               array(
+                                       'key' => 'attach_file',
+                                       'label' => lang('attach file'),
+                                       'sortable' => false,
+                                       'resizeable' => true,
+                                       'formatter' => 
'JqueryPortico.FormatterCenter')
+                       );
+                       $file_attachments = isset($values['file_attachments']) 
&& is_array($values['file_attachments']) ? $values['file_attachments'] : 
array();
+
+                       $content_attachments = array();
+                       $link_view_file = $GLOBALS['phpgw']->link('/index.php', 
$link_file_data);
+                       $lang_view_file = lang('click to view file');
+                       $lang_select_file = lang('Check to attach file');
+                       $lang_workorder = lang('workorder');
+                       foreach ($values['files'] as $_entry)
+                       {
+                               $_checked = '';
+                               if (in_array($_entry['file_id'], 
$file_attachments))
+                               {
+                                       $_checked = 'checked="checked"';
+                               }
+
+                               $content_attachments[] = array(
+                                       'file_name' => "<a 
href='{$link_view_file}&amp;file_id={$_entry['file_id']}' target='_blank' 
title='{$lang_view_file}'>{$lang_workorder}::${_entry['name']}</a>",
+                                       'attach_file' => "<input 
type='checkbox' $_checked  name='values[file_attach][]' 
value='{$_entry['file_id']}' title='{$lang_select_file}'>"
+                               );
+                       }
+                       unset($_entry);
+
+                       $project_link_file_data = array
+                               (
+                               'menuaction' => 'property.uiproject.view_file',
+                               'id' => $project['project_id']
+                       );
+                       $link_view_file = $GLOBALS['phpgw']->link('/index.php', 
$project_link_file_data);
+
+                       $files = $boproject->get_files($project['project_id']);
+                       $lang_project = lang('project');
+
+                       foreach ($files as $_entry)
+                       {
+
+                               $_checked = '';
+                               if (in_array($_entry['file_id'], 
$file_attachments))
+                               {
+                                       $_checked = 'checked="checked"';
+                               }
+                               $content_attachments[] = array(
+                                       'file_name' => "<a 
href='{$link_view_file}&amp;file_id={$_entry['file_id']}' target='_blank' 
title='{$lang_view_file}'>{$lang_project}::${_entry['name']}</a>",
+                                       'attach_file' => "<input 
type='checkbox' $_checked  name='values[file_attach][]' 
value='{$_entry['file_id']}' title='{$lang_select_file}'>"
+                               );
+                       }
+                       
+                       $datatable_def[] = array
+                               (
+                               'container' => 'datatable-container_8',
+                               'requestUrl' => "''",
+                               'ColumnDefs' => $attach_file_def,
+                               'data' => json_encode($content_attachments),
+                               'config' => array(
+                                       array('disableFilter' => true),
+                                       array('disablePagination' => true)
+                               )
+                       );
+
                        $delivery_address       = $values['delivery_address'] ? 
$values['delivery_address'] : $project['delivery_address'];
 
                        if(!$delivery_address && 
!empty($_location_data['loc1']))

Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php  2017-10-05 18:38:39 UTC (rev 17141)
+++ trunk/property/setup/setup.inc.php  2017-10-06 14:42:45 UTC (rev 17142)
@@ -11,7 +11,7 @@
         * @version $Id$
        */
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.722';
+       $setup_info['property']['version']              = '0.9.17.723';
        $setup_info['property']['app_order']    = 8;
        $setup_info['property']['enable']               = 1;
        $setup_info['property']['app_group']    = 'office';

Modified: trunk/property/setup/tables_current.inc.php
===================================================================
--- trunk/property/setup/tables_current.inc.php 2017-10-05 18:38:39 UTC (rev 
17141)
+++ trunk/property/setup/tables_current.inc.php 2017-10-06 14:42:45 UTC (rev 
17142)
@@ -612,6 +612,7 @@
                                'order_received' => array('type' => 'int', 
'precision' => 8, 'nullable' => True),
                                'order_received_amount' => array('type' => 
'decimal', 'precision' => '20', 'scale' => '2', 'nullable' => True, 'default' 
=> '0.00'),
                                'delivery_address' => array('type' => 'text', 
'nullable' => True),
+                               'file_attachments' => array('type' => 
'varchar', 'precision' => 255, 'nullable' => True),
                        ),
                        'pk' => array('id'),
                        'fk' => array(),

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2017-10-05 18:38:39 UTC (rev 
17141)
+++ trunk/property/setup/tables_update.inc.php  2017-10-06 14:42:45 UTC (rev 
17142)
@@ -9897,4 +9897,28 @@
                }
        }
 
-       
\ No newline at end of file
+       /**
+       * Update property version from 0.9.17.722 to 0.9.17.723
+       *
+       */
+       $test[] = '0.9.17.722';
+
+       function property_upgrade0_9_17_722()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->AddColumn('fm_workorder', 
'file_attachments', array(
+                       'type' => 'varchar',
+                       'precision' => 255,
+                       'nullable' => True
+                       )
+               );
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.723';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+

Modified: trunk/property/templates/base/workorder.xsl
===================================================================
--- trunk/property/templates/base/workorder.xsl 2017-10-05 18:38:39 UTC (rev 
17141)
+++ trunk/property/templates/base/workorder.xsl 2017-10-06 14:42:45 UTC (rev 
17142)
@@ -1273,6 +1273,25 @@
                                                                </div>
                                                        </div>
                                                        <xsl:call-template 
name="file_upload"/>
+                                                       <div 
class="pure-control-group">
+                                                               <label 
for="name">
+                                                                       
<xsl:value-of select="php:function('lang', 'attachments')"/>
+                                                               </label>
+                                                               <div 
class="pure-custom pure-input-1-2">
+                                                                       
<xsl:for-each select="datatable_def">
+                                                                               
<xsl:if test="container = 'datatable-container_8'">
+                                                                               
        <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>
                                                </fieldset>
                                        </div>
                                        <div id="history">




reply via email to

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