fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15164] Syncromind: merge from trunk


From: sigurdne
Subject: [Fmsystem-commits] [15164] Syncromind: merge from trunk
Date: Fri, 13 May 2016 14:25:49 +0000 (UTC)

Revision: 15164
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15164
Author:   sigurdne
Date:     2016-05-13 14:25:48 +0000 (Fri, 13 May 2016)
Log Message:
-----------
Syncromind: merge from trunk

Modified Paths:
--------------
    branches/dev-syncromind-2/property/inc/class.uitts.inc.php
    branches/dev-syncromind-2/property/js/portico/workorder.edit.js
    branches/dev-syncromind-2/property/setup/tables_update.inc.php

Modified: branches/dev-syncromind-2/property/inc/class.uitts.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.uitts.inc.php  2016-05-13 
14:24:03 UTC (rev 15163)
+++ branches/dev-syncromind-2/property/inc/class.uitts.inc.php  2016-05-13 
14:25:48 UTC (rev 15164)
@@ -54,7 +54,8 @@
                        'get_ecodimb'   => true,
                        'get_b_account' => true,
                        'get_external_project'=> true,
-                       'get_unspsc_code'=> true
+                       'get_unspsc_code'=> true,
+                       'receive_order' => true
                );
 
                /**
@@ -125,6 +126,7 @@
                        $order = phpgw::get_var('order');
                        $draw = phpgw::get_var('draw', 'int');
                        $columns = phpgw::get_var('columns');
+                       $export = phpgw::get_var('export', 'bool');
 
                        $params = array(
                                'start' => phpgw::get_var('start', 'int', 
'REQUEST', 0),
@@ -134,7 +136,7 @@
                                'sort' => $order[0]['dir'],
                                'dir' => $order[0]['dir'],
                                'cat_id' => phpgw::get_var('cat_id', 'int', 
'REQUEST', 0),
-                               'allrows' => phpgw::get_var('length', 'int') == 
-1 ? true : false,
+                               'allrows' => phpgw::get_var('length', 'int') == 
-1 || $export,
                                'status_id' => $this->bo->status_id,
                                'user_id' => $this->bo->user_id,
                                'reported_by' => $this->bo->reported_by,
@@ -176,7 +178,7 @@
                                }
                        }
 
-                       if (phpgw::get_var('export', 'bool'))
+                       if ($export)
                        {
                                return $values;
                        }
@@ -199,28 +201,6 @@
                        return $this->jquery_results($result_data);
                }
 
-               function save_sessiondata()
-               {
-                       $data = array
-                               (
-                               'start' => $this->start,
-                               'query' => $this->query,
-                               'sort' => $this->sort,
-                               'order' => $this->order,
-                               'status_id' => $this->status_id,
-                               'user_id' => $this->user_id,
-                               'reported_by' => $this->reported_by,
-                               'cat_id' => $this->cat_id,
-                               'vendor_id' => $this->vendor_id,
-                               'district_id' => $this->district_id,
-                               'part_of_town_id' => $this->part_of_town_id,
-                               'allrows' => $this->allrows,
-                               'start_date' => $this->start_date,
-                               'end_date' => $this->end_date
-                       );
-                       $this->bo->save_sessiondata($data);
-               }
-
                function _print()
                {
                        if (!$this->acl_read)
@@ -525,7 +505,6 @@
 
                private function _get_fields()
                {
-                       $this->bo->read(array('dry_run' => true));
                        $this->bo->get_origin_entity_type();
                        $uicols_related = $this->bo->uicols_related;
 
@@ -539,19 +518,19 @@
                        $uicols['descr'][] = lang('subject');
 
                        $location_types = 
execMethod('property.soadmin_location.select_location_type');
-                       $level_assigned = 
isset($this->bo->config->config_data['list_location_level']) && 
$this->bo->config->config_data['list_location_level'] ? 
$this->bo->config->config_data['list_location_level'] : array();
+//                     $level_assigned = 
isset($this->bo->config->config_data['list_location_level']) && 
$this->bo->config->config_data['list_location_level'] ? 
$this->bo->config->config_data['list_location_level'] : array();
 
-                       static $location_cache = array();
-
                        foreach ($location_types as $dummy => $level)
                        {
-                               if (in_array($level['id'], $level_assigned))
+               //              if (in_array($level['id'], $level_assigned))
                                {
                                        $uicols['name'][] = 
"loc{$level['id']}_name";
                                        $uicols['descr'][] = $level['name'];
                                }
+                               break;//first one only...
                        }
 
+
                        $uicols['name'][] = 'entry_date';
                        $uicols['descr'][] = lang('entry date');
 
@@ -910,8 +889,8 @@
                                ),
                                'datatable' => array(
                                        'source' => 
self::link(array('menuaction' => 'property.uitts.index',
-                                               'start_date' => $start_date,
-                                               'end_date' => $end_date,
+                                       //      'start_date' => $start_date,
+                                       //      'end_date' => $end_date,
                                                'phpgw_return_as' => 'json')),
                                        'download' => 
self::link(array('menuaction' => 'property.uitts.download',
                                                'export' => true, 'allrows' => 
true)),
@@ -2499,6 +2478,186 @@
                                )
                        );
 
+
+                       // start invoice
+                       $invoices = array();
+                       $active_invoices = 
execMethod('property.soinvoice.read_invoice_sub_sum', array(
+                               'order_id' => $id));
+                       $historical_invoices = 
execMethod('property.soinvoice.read_invoice_sub_sum', array(
+                               'order_id' => $id,
+                               'paid' => true));
+                       $invoices = array_merge($active_invoices, 
$historical_invoices);
+
+
+                       $link_data_invoice1 = array
+                               (
+                               'menuaction' => 'property.uiinvoice.index',
+                               'user_lid' => 'all'
+                       );
+                       $link_data_invoice2 = array
+                               (
+                               'menuaction' => 'property.uiinvoice2.index'
+                       );
+
+                       $content_invoice = array();
+                       $amount = 0;
+                       $approved_amount = 0;
+                       foreach ($invoices as $entry)
+                       {
+                               $entry['voucher_id'] = $entry['transfer_time'] 
? -1 * $entry['voucher_id'] : $entry['voucher_id'];
+                               if ($entry['voucher_out_id'])
+                               {
+                                       $voucher_out_id = 
$entry['voucher_out_id'];
+                               }
+                               else
+                               {
+                                       $voucher_out_id = 
abs($entry['voucher_id']);
+                               }
+
+                               if 
($this->bo->config->config_data['invoicehandler'] == 2)
+                               {
+                                       if ($entry['voucher_id'] > 0)
+                                       {
+                                               
$link_data_invoice2['voucher_id'] = $entry['voucher_id'];
+                                               $url = 
$GLOBALS['phpgw']->link('/index.php', $link_data_invoice2);
+                                       }
+                                       else
+                                       {
+                                               
$link_data_invoice1['voucher_id'] = abs($entry['voucher_id']);
+                                               $link_data_invoice1['paid'] = 
'true';
+                                               $url = 
$GLOBALS['phpgw']->link('/index.php', $link_data_invoice1);
+                                       }
+                               }
+                               else
+                               {
+                                       if ($entry['voucher_id'] > 0)
+                                       {
+                                               
$link_data_invoice1['voucher_id'] = $entry['voucher_id'];
+                                               $link_data_invoice1['query'] = 
$entry['voucher_id'];
+                                               $url = 
$GLOBALS['phpgw']->link('/index.php', $link_data_invoice1);
+                                       }
+                                       else
+                                       {
+                                               
$link_data_invoice1['voucher_id'] = abs($entry['voucher_id']);
+                                               $link_data_invoice1['paid'] = 
'true';
+                                               $url = 
$GLOBALS['phpgw']->link('/index.php', $link_data_invoice1);
+                                       }
+                               }
+                               $link_voucher_id = "<a href='" . $url . "'>" . 
$voucher_out_id . "</a>";
+
+                               $content_invoice[] = array
+                                       (
+                                       'voucher_id' => ($_lean) ? 
$entry['voucher_id'] : $link_voucher_id,
+                                       'voucher_out_id' => 
$entry['voucher_out_id'],
+                                       'status' => $entry['status'],
+                                       'period' => $entry['period'],
+                                       'periodization' => 
$entry['periodization'],
+                                       'periodization_start' => 
$entry['periodization_start'],
+                                       'invoice_id' => $entry['invoice_id'],
+                                       'budget_account' => 
$entry['budget_account'],
+                                       'dima' => $entry['dima'],
+                                       'dimb' => $entry['dimb'],
+                                       'dimd' => $entry['dimd'],
+                                       'type' => $entry['type'],
+                                       'amount' => $entry['amount'],
+                                       'approved_amount' => 
$entry['approved_amount'],
+                                       'vendor' => $entry['vendor'],
+                                       'external_project_id' => 
$entry['project_id'],
+                                       'currency' => $entry['currency'],
+                                       'budget_responsible' => 
$entry['budget_responsible'],
+                                       'budsjettsigndato' => 
$entry['budsjettsigndato'] ? 
$GLOBALS['phpgw']->common->show_date(strtotime($entry['budsjettsigndato']), 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']) : '',
+                                       'transfer_time' => 
$entry['transfer_time'] ? 
$GLOBALS['phpgw']->common->show_date(strtotime($entry['transfer_time']), 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']) : '',
+                               );
+
+                               $amount += $entry['amount'];
+                               $approved_amount += $entry['approved_amount'];
+                       }
+
+                       $invoice_def = array
+                               (
+                               array(
+                                       'key' => 'voucher_id',
+                                       'label' => lang('bilagsnr'),
+                                       'sortable' => false,
+                                       'value_footer' => lang('Sum')),
+                               array(
+                                       'key' => 'voucher_out_id',
+                                       'hidden' => true),
+                               array(
+                                       'key' => 'invoice_id',
+                                       'label' => lang('invoice number'),
+                                       'sortable' => false),
+                               array(
+                                       'key' => 'vendor',
+                                       'label' => lang('vendor'),
+                                       'sortable' => false),
+                               array(
+                                       'key' => 'amount',
+                                       'label' => lang('amount'),
+                                       'sortable' => false,
+                                       'className' => 'right',
+                                       'value_footer' => 
number_format($amount, 2, $this->decimal_separator, '.')),
+                               array(
+                                       'key' => 'approved_amount',
+                                       'label' => lang('approved amount'),
+                                       'sortable' => false,
+                                       'className' => 'right',
+                                       'value_footer' => 
number_format($approved_amount, 2, $this->decimal_separator, '.')),
+                               array(
+                                       'key' => 'period',
+                                       'label' => lang('period'),
+                                       'sortable' => false),
+                               array(
+                                       'key' => 'periodization',
+                                       'label' => lang('periodization'),
+                                       'sortable' => false),
+                               array(
+                                       'key' => 'periodization_start',
+                                       'label' => lang('periodization start'),
+                                       'sortable' => false),
+                               array(
+                                       'key' => 'currency',
+                                       'label' => lang('currency'),
+                                       'sortable' => false),
+                               array(
+                                       'key' => 'type',
+                                       'label' => lang('type'),
+                                       'sortable' => false),
+                               array(
+                                       'key' => 'budget_responsible',
+                                       'label' => lang('budget responsible'),
+                                       'sortable' => false),
+                               array(
+                                       'key' => 'budsjettsigndato',
+                                       'label' => lang('budsjettsigndato'),
+                                       'sortable' => false),
+                               array(
+                                       'key' => 'transfer_time',
+                                       'label' => lang('transfer time'),
+                                       'sortable' => false)
+                       );
+
+                       $datatable_def[] = array
+                               (
+                               'container' => 'datatable-container_7',
+                               'requestUrl' => "''",
+                               'data' => json_encode($content_invoice),
+                               'ColumnDefs' => $invoice_def,
+                               'config' => array(
+                                       array(
+                                               'disableFilter' => true),
+                                       array(
+                                               'disablePagination' => true)
+                               )
+                       );
+
+
+
+                       // end invoice table
+
+                       
//----------------------------------------------datatable settings--------
+
+
                        $_filter_buildingpart = array();
                        $filter_buildingpart = 
isset($this->bo->config->config_data['filter_buildingpart']) ? 
$this->bo->config->config_data['filter_buildingpart'] : array();
 
@@ -2507,7 +2666,6 @@
                                $_filter_buildingpart = 
array("filter_{$filter_key}" => 1);
                        }
 
-                       
//----------------------------------------------datatable settings--------
 //_debug_array($supervisor_email);die();
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
                        $cat_select = 
$this->cats->formatted_xslt_list(array('select_name' => 'values[cat_id]',
@@ -2577,6 +2735,7 @@
                        $tabs['history'] = array('label' => lang('History'), 
'link' => '#history');
                        $active_tab = 'general';
 
+                       $unspsc_code = $ticket['unspsc_code'] ? 
$ticket['unspsc_code'] : 
$GLOBALS['phpgw_info']['user']['preferences']['property']['unspsc_code'];
                        $data = array
                                (
                                'datatable_def' => $datatable_def,
@@ -2596,8 +2755,8 @@
                                'value_service_name' => 
$this->_get_eco_service_name($ticket['service_id']),
                                'value_external_project_id' => 
$ticket['external_project_id'],
                                'value_external_project_name' => 
$this->_get_external_project_name($ticket['external_project_id']),
-                               'value_unspsc_code' => $ticket['unspsc_code'],
-                               'value_unspsc_code_name' => 
$this->_get_unspsc_code_name($ticket['unspsc_code']),
+                               'value_unspsc_code' => $unspsc_code,
+                               'value_unspsc_code_name' => 
$this->_get_unspsc_code_name($unspsc_code),
                                'value_budget' => $ticket['budget'],
                                'value_actual_cost' => $ticket['actual_cost'],
                                'year_list' => array('options' => 
$this->bocommon->select_list($ticket['actual_cost_year'] ? 
$ticket['actual_cost_year'] : date('Y'), $year_list)),
@@ -2687,7 +2846,10 @@
                                        'options' => 
execMethod('property.boproject.select_branch_list', $values['branch_id'])) : '',
                                'preview_html' => 
"javascript:preview_html($id)",
                                'preview_pdf' => "javascript:preview_pdf($id)",
-                               'tabs' => 
phpgwapi_jquery::tabview_generate($tabs, $active_tab)
+                               'tabs' => 
phpgwapi_jquery::tabview_generate($tabs, $active_tab),
+                               'value_order_sent'      => 
$ticket['order_sent'],
+                               'value_order_received'  => 
$ticket['order_received'] ? 
$GLOBALS['phpgw']->common->show_date($ticket['order_received']) : '[ DD/MM/YYYY 
- H:i ]',
+                               'value_order_received_percent' => (int) 
$ticket['order_received_percent']
                        );
 
                        phpgwapi_jquery::load_widget('numberformat');
@@ -2776,7 +2938,18 @@
                        return $this->bocommon->get_b_account();
                }
 
+               public function receive_order( )
+               {
+                       if (!$GLOBALS['phpgw']->acl->check('.project', 
PHPGW_ACL_ADD, 'property'))
+                       {
+                               return;
+                       }
 
+                       $id = phpgw::get_var('id', 'int');
+                       $received_percent = phpgw::get_var('received_percent', 
'int');
+                       return $this->bo->receive_order($id, $received_percent);
+               }
+
                private function _get_eco_service_name( $id )
                {
                        return $this->bocommon->get_eco_service_name($id);
@@ -3063,7 +3236,42 @@
                                                , lang('descr') => 
array('width' => 120))
                                ));
                        }
+//start SMS::QRCODE
+                       $sms_location_id = 
$GLOBALS['phpgw']->locations->get_id('sms', 'run');
+                       $config_sms = CreateObject('admin.soconfig', 
$sms_location_id);
+                       $gateway_number = 
$config_sms->config_data['common']['gateway_number'];
+                       $gateway_codeword = 
$config_sms->config_data['common']['gateway_codeword'];
+                       phpgw::import_class('phpgwapi.phpqrcode');
+                       $code_text = "SMSTO:{$gateway_number}: 
{$gateway_codeword} STATUS {$ticket['order_id']} ";
 
+                       $filename = 
$GLOBALS['phpgw_info']['server']['temp_dir'] . '/' . md5($code_text) . '.png';
+                       QRcode::png($code_text, $filename);
+                       $pdf->ezSetDy(-20);
+
+                       $lang_status_code = lang('status code');
+                       $lang_to = lang('to');
+                       $code_help = "Send: {$gateway_codeword} STATUS 
{$ticket['order_id']} <{$lang_status_code}> {$lang_to} {$gateway_number}\n\n"
+                               . $lang_status_code
+                               . ":\n\n 1 => " . lang('performed')
+                               . "\n 2 => " . lang('No access')
+                               . "\n 3 => I arbeid";
+                       $data = array(
+                               array('col1' => "<C:showimage:{$filename} 90>", 
'col2' => $code_help)
+                       );
+
+                       $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('width' => 150, 
'justification' => 'left'),
+                                       'col2' => array('width' => 350, 
'justification' => 'left'),
+                               )
+                       ));
+
+//end SMS::QRCODE
+
                        if 
(isset($this->bo->config->config_data['order_footer_header']) && 
$this->bo->config->config_data['order_footer_header'])
                        {
                                if (!$content)

Modified: branches/dev-syncromind-2/property/js/portico/workorder.edit.js
===================================================================
--- branches/dev-syncromind-2/property/js/portico/workorder.edit.js     
2016-05-13 14:24:03 UTC (rev 15163)
+++ branches/dev-syncromind-2/property/js/portico/workorder.edit.js     
2016-05-13 14:25:48 UTC (rev 15164)
@@ -34,6 +34,44 @@
 
 });
 
+function receive_order(workorder_id)
+{
+       var oArgs = {
+               menuaction: 'property.uiworkorder.receive_order',
+               id: workorder_id,
+               received_percent: $("#slider-range-min").slider("value")
+       };
+       var strURL = phpGWLink('index.php', oArgs, true);
+       $.ajax({
+               type: 'POST',
+               dataType: 'json',
+               url: strURL,
+               success: function (data)
+               {
+                       if (data != null)
+                       {
+                               var msg;
+                               if (data['result'] == true)
+                               {
+                                       msg = 'OK';
+                                       
$("#order_received_time").html(data['time']);
+                               }
+                               else
+                               {
+                                       msg = 'Error';
+
+                               }
+                               window.alert(msg);
+                       }
+               },
+               failure: function (o)
+               {
+                       window.alert('failure - try again - once');
+               },
+               timeout: 5000
+       });
+}
+
 function check_and_submit_valid_session()
 {
        var oArgs = {menuaction: 'property.bocommon.confirm_session'};
@@ -110,7 +148,7 @@
        $("#order_tab").val(tab);
 }
 
-this.showlightbox_manual_invoide = function (workorder_id)
+this.showlightbox_manual_invoice = function (workorder_id)
 {
        var oArgs = {menuaction: 'property.uiworkorder.add_invoice', order_id: 
workorder_id};
        var sUrl = phpGWLink('index.php', oArgs);
@@ -146,7 +184,7 @@
 
        if ($("#vendor_id").val() != vendor_id)
        {
-               var oArgs = {menuaction: 
'property.uiworkorder.get_vendor_contract',vendor_id:$("#vendor_id").val()};
+               var oArgs = {menuaction: 
'property.uiworkorder.get_vendor_contract', vendor_id: $("#vendor_id").val()};
                var requestUrl = phpGWLink('index.php', oArgs, true);
                var htmlString = "";
 
@@ -228,3 +266,142 @@
 var strURL = phpGWLink('index.php', oArgs, true);
 JqueryPortico.autocompleteHelper(strURL, 'unspsc_code_name', 'unspsc_code', 
'unspsc_code_container');
 
+
+// from ajax_workorder_edit.js
+
+
+$(document).ready(function ()
+{
+
+       $("#global_category_id").change(function ()
+       {
+               var oArgs = {menuaction: 'property.boworkorder.get_category', 
cat_id: $(this).val()};
+               var requestUrl = phpGWLink('index.php', oArgs, true);
+
+               var htmlString = "";
+
+               $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl,
+                       success: function (data)
+                       {
+                               if (data != null)
+                               {
+                                       if (data.active != 1)
+                                       {
+                                               alert('Denne kan ikke velges');
+                                       }
+                               }
+                       }
+               });
+       });
+
+
+       $("#workorder_edit").on("submit", function (e)
+       {
+
+               if ($("#lean").val() == 0)
+               {
+                       return;
+               }
+
+               e.preventDefault();
+               var thisForm = $(this);
+               var submitBnt = $(thisForm).find("input[type='submit']");
+               var requestUrl = $(thisForm).attr("action");
+               $.ajax({
+                       type: 'POST',
+                       url: requestUrl + "&phpgw_return_as=json&" + 
$(thisForm).serialize(),
+                       success: function (data)
+                       {
+                               if (data)
+                               {
+                                       if (data.sessionExpired)
+                                       {
+                                               alert('Sesjonen er utløpt - du 
må logge inn på nytt');
+                                               return;
+                                       }
+
+                                       var obj = data;
+
+                                       var submitBnt = 
$(thisForm).find("input[type='submit']");
+                                       if (obj.status == "updated")
+                                       {
+                                               $(submitBnt).val("Lagret");
+                                       }
+                                       else
+                                       {
+                                               $(submitBnt).val("Feil ved 
lagring");
+                                       }
+
+                                       // Changes text on save button back to 
original
+                                       window.setTimeout(function ()
+                                       {
+                                               $(submitBnt).val('Lagre');
+                                               
$(submitBnt).addClass("not_active");
+                                       }, 1000);
+
+                                       var ok = true;
+                                       var htmlString = "";
+                                       if (data['receipt'] != null)
+                                       {
+                                               if (data['receipt']['error'] != 
null)
+                                               {
+                                                       ok = false;
+                                                       for (var i = 0; i < 
data['receipt']['error'].length; ++i)
+                                                       {
+                                                               htmlString += 
"<div class=\"error\">";
+                                                               htmlString += 
data['receipt']['error'][i]['msg'];
+                                                               htmlString += 
'</div>';
+                                                       }
+
+                                               }
+                                               if (typeof 
(data['receipt']['message']) != 'undefined')
+                                               {
+                                                       for (var i = 0; i < 
data['receipt']['message'].length; ++i)
+                                                       {
+                                                               htmlString += 
"<div class=\"msg_good\">";
+                                                               htmlString += 
data['receipt']['message'][i]['msg'];
+                                                               htmlString += 
'</div>';
+                                                       }
+
+                                               }
+                                               $("#receipt").html(htmlString);
+                                       }
+
+                                       if (ok)
+                                       {
+                                               parent.closeJS_remote();
+                                               //      parent.hide_popupBox();
+                                       }
+                               }
+                       }
+               });
+       });
+
+       $("#workorder_cancel").on("submit", function (e)
+       {
+               if ($("#lean").val() == 0)
+               {
+                       return;
+               }
+               e.preventDefault();
+               parent.closeJS_remote();
+//             parent.hide_popupBox();
+       });
+
+       $("#slider-range-min").slider({
+               range: "min",
+               value: $("#value_order_received_percent").val() || 0,
+               min: 0,
+               max: 100,
+               step: 10,
+               slide: function (event, ui)
+               {
+                       $("#order_received_percent").val(ui.value + " %");
+               }
+       });
+       $("#order_received_percent").val($("#slider-range-min").slider("value") 
+ " %");
+
+});

Modified: branches/dev-syncromind-2/property/setup/tables_update.inc.php
===================================================================
--- branches/dev-syncromind-2/property/setup/tables_update.inc.php      
2016-05-13 14:24:03 UTC (rev 15163)
+++ branches/dev-syncromind-2/property/setup/tables_update.inc.php      
2016-05-13 14:25:48 UTC (rev 15164)
@@ -8870,7 +8870,7 @@
                                'fd' => array(
                                        'id' => array('type' => 'int', 
'precision' => '4', 'nullable' => False),
                                        'name' => array('type' => 'varchar', 
'precision' => '50', 'nullable' => False),
-                                       'active' => array('type' => 'int', 
'precision' => '2', 'nullable' => True, 'default' => '0'),
+                                       'active' => array('type' => 'int', 
'precision' => '2', 'nullable' => True, 'default' => 1),
                                ),
                                'pk' => array('id'),
                                'ix' => array(),
@@ -9018,3 +9018,188 @@
                        return $GLOBALS['setup_info']['property']['currentver'];
                }
        }
+
+       /**
+       * Update property version from 0.9.17.697 to 0.9.17.698
+       * Add parametres for integration with e-commerse platforms
+       */
+       $test[] = '0.9.17.697';
+
+       function property_upgrade0_9_17_697()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw']->locations->add('.project.workorder.transfer', 'Transfer 
Workorder', 'property', $allow_grant = null, $custom_tbl = null, $c_function = 
true);
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.698';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
+       * Update property version from 0.9.17.698 to 0.9.17.699
+       * Add parametres for integration with e-commerse platforms
+       */
+       $test[] = '0.9.17.698';
+
+       function property_upgrade0_9_17_698()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+               $GLOBALS['phpgw_setup']->oProc->query("DELETE FROM fm_cache");
+
+               $GLOBALS['phpgw_setup']->oProc->AddColumn("fm_workorder", 
'building_part', array(
+                       'type' => 'varchar',
+                       'precision' => 4,
+                       'nullable' => True
+                       )
+               );
+
+               $GLOBALS['phpgw_setup']->oProc->AddColumn("fm_workorder", 
'order_dim1', array(
+                       'type' => 'int',
+                       'precision' => 4,
+                       'nullable' => True
+                       )
+               );
+
+               $GLOBALS['phpgw_setup']->oProc->AddColumn("fm_workorder", 
'order_sent', array(
+                       'type' => 'int',
+                       'precision' => 8,
+                       'nullable' => True
+                       )
+               );
+               $GLOBALS['phpgw_setup']->oProc->AddColumn("fm_workorder", 
'order_received', array(
+                       'type' => 'int',
+                       'precision' => 8,
+                       'nullable' => True
+                       )
+               );
+               $GLOBALS['phpgw_setup']->oProc->AddColumn("fm_tts_tickets", 
'order_sent', array(
+                       'type' => 'int',
+                       'precision' => 8,
+                       'nullable' => True
+                       )
+               );
+               $GLOBALS['phpgw_setup']->oProc->AddColumn("fm_tts_tickets", 
'order_received', array(
+                       'type' => 'int',
+                       'precision' => 8,
+                       'nullable' => True
+                       )
+               );
+
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.699';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
+       * Update property version from 0.9.17.699 to 0.9.17.700
+       * Add parametres for integration with e-commerse platforms
+       */
+       $test[] = '0.9.17.699';
+
+       function property_upgrade0_9_17_699()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->AddColumn("fm_workorder", 
'order_received_percent', array(
+                       'type' => 'int',
+                       'precision' => 2,
+                       'nullable' => True
+                       )
+               );
+
+               $GLOBALS['phpgw_setup']->oProc->AddColumn("fm_tts_tickets", 
'order_received_percent', array(
+                       'type' => 'int',
+                       'precision' => 2,
+                       'nullable' => True
+                       )
+               );
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.700';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
+       * Update property version from 0.9.17.700 to 0.9.17.701
+       *
+       */
+       $test[] = '0.9.17.700';
+
+       function property_upgrade0_9_17_700()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn("fm_external_project", 'active', 
array(
+                       'type' => 'int',
+                       'precision' => 2,
+                       'nullable' => True,
+                       'default' => 1
+                       )
+               );
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.701';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
+
+       /**
+       * Update property version from 0.9.17.701 to 0.9.17.702
+       *
+       */
+       $test[] = '0.9.17.701';
+
+       function property_upgrade0_9_17_701()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->query("DELETE FROM fm_cache");
+
+               $GLOBALS['phpgw_setup']->oProc->query("SELECT count(*) as cnt 
FROM fm_location_type");
+               $GLOBALS['phpgw_setup']->oProc->next_record();
+               $locations = $GLOBALS['phpgw_setup']->oProc->f('cnt');
+
+               for($location_type = 1; $location_type < ($locations + 1); 
$location_type++)
+               {
+
+                       
$GLOBALS['phpgw_setup']->oProc->AddColumn("fm_location{$location_type}", 'id', 
array(
+                               'type' => 'int',
+                               'precision' => 4,
+                               'nullable' => true,
+                               )
+                       );
+
+                       
$GLOBALS['phpgw_setup']->oProc->AddColumn("fm_location{$location_type}_history",
 'id', array(
+                               'type' => 'int',
+                               'precision' => 4,
+                               'nullable' => true,
+                               )
+                       );
+
+                       $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', ".location.{$location_type}");
+
+                       $GLOBALS['phpgw_setup']->oProc->query("SELECT max(id) 
as id FROM phpgw_cust_attribute WHERE location_id = {$location_id}");
+                       $GLOBALS['phpgw_setup']->oProc->next_record();
+                       $attrib_id = $GLOBALS['phpgw_setup']->oProc->f('id') +1;
+
+                       $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO 
phpgw_cust_attribute (location_id, 
id,column_name,datatype,precision_,input_text,statustext,nullable,custom)"
+                       . " VALUES ( {$location_id}, {$attrib_id}, 'id', 'I', 
4, 'id', 'id', 'true', NULL)");
+
+               }
+
+               execMethod('property.solocation.update_location');
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.702';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }




reply via email to

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