phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: property/inc class.bolookup.inc.php,NONE,1.1 cla


From: Sigurd Nes <address@hidden>
Subject: [Phpgroupware-cvs] CVS: property/inc class.bolookup.inc.php,NONE,1.1 class.solookup.inc.php,NONE,1.1 class.uilookup.inc.php,NONE,1.1 class.boXport.inc.php,1.4,1.5 class.uiXport.inc.php,1.6,1.7
Date: Fri, 27 Dec 2002 14:03:30 -0500

Update of /cvsroot/phpgroupware/property/inc
In directory subversions:/tmp/cvs-serv29649/inc

Modified Files:
        class.boXport.inc.php class.uiXport.inc.php 
Added Files:
        class.bolookup.inc.php class.solookup.inc.php 
        class.uilookup.inc.php 
Log Message:
no message

--- NEW FILE ---
<?php
        
/***************************************************************************\
        * This program is free software; you can redistribute it and/or modify 
it   *
        * under the terms of the GNU General Public License as published by the 
    *
        * Free Software Foundation; either version 2 of the License, or (at 
your    *
        * option) any later version.                                            
    *
        
\***************************************************************************/

        class bolookup
        {
                var $start;
                var $query;
                var $filter;
                var $sort;
                var $order;
                var $cat_id;

                var $public_functions = array
                (
                        'read'                          => True,
                        'read_single'           => True,
                        'save'                          => True,
                        'delete'                        => True,
                        'check_perms'           => True
                );

                var $soap_functions = array(
                        'list' => array(
                                'in'  => 
array('int','int','struct','string','int'),
                                'out' => array('array')
                        ),
                        'read' => array(
                                'in'  => array('int','struct'),
                                'out' => array('array')
                        ),
                        'save' => array(
                                'in'  => array('int','struct'),
                                'out' => array()
                        ),
                        'delete' => array(
                                'in'  => array('int','struct'),
                                'out' => array()
                        )
                );

                function bolookup($session=False)
                {
                        $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->so               = 
CreateObject($this->currentapp.'.solookup');
                        $this->socommon = 
CreateObject($this->currentapp.'.socommon');

                        $start  = get_var('start',array('POST','GET'));
                        $query  = get_var('query',array('POST','GET'));
                        $sort   = get_var('sort',array('POST','GET'));
                        $order  = get_var('order',array('POST','GET'));
                        $filter = get_var('filter',array('POST','GET'));
                        $cat_id = get_var('cat_id',array('POST','GET'));

                        if ($start)
                        {
                                $this->start=$start;
                        }
                        else
                        {
                                $this->start=0;
                        }

                        if(isset($query))
                        {
                                $this->query = $query;
                        }
                        if(!empty($filter))
                        {
                                $this->filter = $filter;
                        }
                        if(isset($sort))
                        {
                                $this->sort = $sort;
                        }
                        if(isset($order))
                        {
                                $this->order = $order;
                        }
                        if(isset($cat_id))
                        {
                                $this->cat_id = $cat_id;
                        }
                }


                function read_addressbook()
                {
                        $vendor = $this->so->read_addressbook(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
                                                                                
        'filter' => $this->filter,'cat_id' => $this->cat_id));
                        $this->total_records = $this->so->total_records;

                        return $vendor;
                }

                function read_property()
                {
                        $property = $this->so->read_property(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
                                                                                
        'filter' => $this->filter,'cat_id' => $this->cat_id));
                        $this->total_records = $this->so->total_records;

                        return $property;
                }


                function select_part_of_town($part_of_town_id)
                {
                        return 
$this->socommon->select_part_of_town($part_of_town_id);
                }

        }
?>

--- NEW FILE ---
<?php
        
/***************************************************************************\
        * This program is free software; you can redistribute it and/or modify 
it   *
        * under the terms of the GNU General Public License as published by the 
    *
        * Free Software Foundation; either version 2 of the License, or (at 
your    *
        * option) any later version.                                            
    *
        
\***************************************************************************/

        class solookup
        {
                var $grants;

                function solookup()
                {
                        $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->db               = $GLOBALS['phpgw']->db;
                        $this->db2              = $this->db;
                        $this->grants   = 
$GLOBALS['phpgw']->acl->get_grants($this->currentapp);
                        $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];

                        if 
($GLOBALS['phpgw_info']['server']['db_type']=='pgsql')
                        {
                                $this->join = " JOIN ";
                        }
                        else
                        {
                                $this->join = " LEFT JOIN ";
                        }


                }

                function read_addressbook($data)
                {
                        if(is_array($data))
                        {
                                if ($data['start'])
                                {
                                        $start=$data['start'];
                                }
                                else
                                {
                                        $start=0;
                                }
                                $filter = 
(isset($data['filter'])?$data['filter']:'none');
                                $query = 
(isset($data['query'])?$data['query']:'');
                                $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
                                $order = 
(isset($data['order'])?$data['order']:'');
                                $cat_id = 
(isset($data['cat_id'])?$data['cat_id']:0);
                        }


                        if ($order)
                        {
                                $ordermethod = " order by $order $sort";
                        }
                        else
                        {
                                $ordermethod = ' order by org_name DESC';
                        }

                        if ($filter == 'none')
                        {
                                $filtermethod = ' ( owner=' . $this->account;
                                if (is_array($this->grants))
                                {
                                        $grants = $this->grants;
                                        while (list($user) = each($grants))
                                        {
                                                $public_user_list[] = $user;
                                        }
                                        reset($public_user_list);
                                        $filtermethod .= " OR (access='public' 
OR owner IN(" . implode(',',$public_user_list) . ")))";
                                }
                                else
                                {
                                        $filtermethod .= ' )';
                                }
                        }
                        elseif ($filter == 'yours')
                        {
                                $filtermethod = " owner='" . $this->account . 
"'";
                        }
                        else
                        {
                                $filtermethod = " owner='" . $this->account . 
"' AND access='private'";
                        }

                        if ($cat_id > 0)
                        {
                                $filtermethod .= " AND cat_id='$cat_id' ";
                        }

                        if($query)
                        {
                                $query = ereg_replace("'",'',$query);
                                $query = ereg_replace('"','',$query);

                                $querymethod = " AND id LIKE '%$query%' or 
org_name LIKE '%$query%'";
                        }

                        $sql = "SELECT id,org_name FROM phpgw_addressbook WHERE 
$filtermethod $querymethod";

                        $this->db2->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db2->num_rows();
                        $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);

                        while ($this->db->next_record())
                        {
                                $vendor[] = array
                                (
                                        'id'    => $this->db->f('id'),
                                        'org_name'      => 
$this->db->f('org_name'),
                                        );
                        }
//_debug_array($vendor);

                        return $vendor;
                }

                function read_property($data)
                {
                        if(is_array($data))
                        {
                                if ($data['start'])
                                {
                                        $start=$data['start'];
                                }
                                else
                                {
                                        $start=0;
                                }
                                $filter = 
(isset($data['filter'])?$data['filter']:'none');
                                $query = 
(isset($data['query'])?$data['query']:'');
                                $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
                                $order = 
(isset($data['order'])?$data['order']:'');
                                $cat_id = 
(isset($data['cat_id'])?$data['cat_id']:0);
                        }


                        if ($order)
                        {
                                $ordermethod = " order by $order $sort";
                        }
                        else
                        {
                                $ordermethod = ' order by objekt_id DESC';
                        }

                        if ($filter == 'none')
                        {
                                $filtermethod = ' ( owner=' . $this->account;
                                if (is_array($this->grants))
                                {
                                        $grants = $this->grants;
                                        while (list($user) = each($grants))
                                        {
                                                $public_user_list[] = $user;
                                        }
                                        reset($public_user_list);
                                        $filtermethod .= " OR (access='public' 
OR owner IN(" . implode(',',$public_user_list) . ")))";
                                }
                                else
                                {
                                        $filtermethod .= ' )';
                                }
                        }
                        elseif ($filter == 'yours')
                        {
                                $filtermethod = " owner='" . $this->account . 
"'";
                        }
                        else
                        {
                                $filtermethod = " owner='" . $this->account . 
"' AND access='private'";
                        }

                        if ($cat_id > 0)
                        {
                                $filtermethod .= " AND cat_id='$cat_id' ";
                        }

                        if($query)
                        {
                                $query = ereg_replace("'",'',$query);
                                $query = ereg_replace('"','',$query);

                                $querymethod = " AND gatenavn LIKE '%$query%' 
OR location_code LIKE '%$query%'";
                        }

                        $sql = "SELECT 
objekt_id,bygg_id,seksjons_id,etasje,leie_id,gatenr,gatenavn,tid,owner,access,cat_id,property_type_id,location_code
  FROM boei_leieobjekt $this->join boei_gateadresse  ON 
boei_leieobjekt.gateadresse_id=boei_gateadresse.gateadresse_id WHERE (Not 
(boei_leieobjekt.formaal_id)='99') AND $filtermethod $querymethod  ";

                        $this->db2->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db2->num_rows();
                        $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);

                        while ($this->db->next_record())
                        {
                                $property[] = array
                                (
                                        'property_id'   => 
$this->db->f('objekt_id'),
                                        'building_id'   => 
$this->db->f('bygg_id'),
                                        'entrance_id'   => 
$this->db->f('seksjons_id'),
                                        'floor'                 => 
$this->db->f('etasje'),
                                        'apartment_id'  => 
$this->db->f('leie_id'),
                                        'street_name'   => 
$this->db->f('gatenavn'),
                                        'street_number' => 
$this->db->f('gatenr'),
                                        );
                        }

_debug_array($property);

                        return $property;
                }

        }
?>

--- NEW FILE ---
<?php
        
/***************************************************************************\
        * -------------------------------------------------                     
    *
        * This program is free software; you can redistribute it and/or modify 
it   *
        * under the terms of the GNU General Public License as published by the 
    *
        * Free Software Foundation; either version 2 of the License, or (at 
your    *
        * option) any later version.                                            
    *
        
\***************************************************************************/
        class uilookup
        {
                var $grants;
                var $cat_id;
                var $start;
                var $query;
                var $sort;
                var $order;
                var $filter;
                var $part_of_town_id;
                var $sub;
                var $currentapp;

                var $public_functions = array
                (
                        'addressbook'  => True,
                        'property'   => True,
                        'edit'   => True,
                        'delete' => True
                );

                function uilookup()
                {
                        $this->currentapp                       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->cats                                     = 
CreateObject('phpgwapi.categories');
                        $this->cats->app_name           = 'building';
                        $this->nextmatchs                       = 
CreateObject('phpgwapi.nextmatchs');
                        $this->account                          = 
$GLOBALS['phpgw_info']['user']['account_id'];

                        $this->grants                           = 
$GLOBALS['phpgw']->acl->get_grants($this->currentapp);
                        $this->grants[$this->account] = PHPGW_ACL_READ + 
PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE;
                        $this->bo                                       = 
CreateObject($this->currentapp.'.bolookup',True);
                        $this->bocommon                                 = 
CreateObject($this->currentapp.'.bocommon',True);

                        $this->start                            = 
$this->bo->start;
                        $this->query                            = 
$this->bo->query;
                        $this->sort                                     = 
$this->bo->sort;
                        $this->order                            = 
$this->bo->order;
                        $this->filter                           = 
$this->bo->filter;
                        $this->cat_id                           = 
$this->bo->cat_id;
                        $this->part_of_town_id          = 
$this->bocommon->part_of_town_id;
                }

                function save_sessiondata()
                {
                        $data = array
                        (
                                'start'         => $this->start,
                                'query'         => $this->query,
                                'sort'          => $this->sort,
                                'order'         => $this->order,
                                'filter'        => $this->filter,
                                'cat_id'        => $this->cat_id
                        );
                        $this->bocommon->save_sessiondata($data);
                }

                function addressbook()
                {

                        $GLOBALS['phpgw']->xslttpl->add_file(array('lookup',
                                                                                
'nextmatchs',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'app_header',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'filter_select',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'search_field'));

                        $sub = get_var('sub',array('POST','GET'));
                        $second_display = 
get_var('second_display',array('POST','GET'));


                        $default_category = 
$GLOBALS['phpgw_info']['user']['preferences']['addressbook']['default_category'];

//echo 'second_display :'.$second_display .'<br>';

                        if ($default_category && !$second_display)
                        {
//echo 'default_category :'.$default_category .'<br>';
                                $this->bo->cat_id       = $default_category;
                                $this->cat_id           = $default_category;
                        }

                        $this->cats->app_name = 'addressbook';

                        $addressbook_list = $this->bo->read_addressbook();

                        while (is_array($addressbook_list) && 
list(,$addressbook_entry) = each($addressbook_list))
                        {
                                $content[] = array
                                (
                                        'id'                            => 
$addressbook_entry['id'],
                                        'vendor_name'           => 
$addressbook_entry['org_name'],
                                        'lang_select'           => 
lang('Select'),
                                        'lang_select_statustext' => 
lang('Select this vendor')
                                );
                        }

                        $table_header[] = array
                        (
                                'lang_name'             => lang('Name'),
                                'lang_id'               => lang('ID'),
                                'lang_select'           => lang('Select')
                        );

                        $table_done[] = array
                        (
                                'lang_done'                             => 
lang('Done'),
                                'lang_done_statustext'  => lang('Close this 
window')
                        );

                        $link_select = array
                        (
                                'menuaction'            => 
$this->currentapp.'.uilookup.addressbook',
                                'second_display'        => true,
                                'cat_id'                        => 
$this->cat_id,
                                'query'                         => $this->query,
                                'filter'                        => $this->filter
                        );


                        $data = array
                        (
                                'hidden_vars'                   => $hidden_vars,
                                'allow_all_rows'                                
=> false,
                                'start_record'                                  
=> $this->start,
                                'record_limit'                                  
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
                                'num_records'                                   
=> count($addressbook_list),
                                'all_records'                                   
=> $this->bo->total_records,
                                'link_url'                                      
        => $GLOBALS['phpgw']->link('/index.php',$link_select),
                                'img_path'                                      
        => $GLOBALS['phpgw']->common->get_image_path('phpgwapi'),
                                'appname'                                       
        => lang($this->currentapp),
                                'function_msg'                                  
=> lang('list vendors'),
                                'lang_no_cat'                                   
=> lang('no category'),
                                'lang_cat_statustext'                   => 
lang('Select the category the building belongs to. To do not use a category 
select NO CATEGORY'),
                                'select_name'                                   
=> 'cat_id',
                                'cat_list'                                      
        => $this->cats->formatted_xslt_list(array('selected' => 
$this->cat_id,'globals' => True)),
                                'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
                                'filter_list'                                   
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' => 
'yes')),
                                'lang_filter_statustext'                => 
lang('Select the filter. To show all entries select SHOW ALL'),
                                'lang_searchfield_statustext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
                                'lang_searchbutton_statustext'  => lang('Submit 
the search string'),
                                'query'                                         
        => $this->query,
                                'lang_submit'                                   
=> lang('submit'),
                                'table_header_addressbook'              => 
$table_header,
                                'values_addressbook'                    => 
$content,
                                'table_done'                                    
=> $table_done
                        );

                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_addressbook' => $data));
                        $this->save_sessiondata();
                }

                function property()
                {

                        $GLOBALS['phpgw']->xslttpl->add_file(array('lookup',
                                                                                
'nextmatchs',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'app_header',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'filter_select',
                                                                                
$GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 
'search_field'));

                        $sub = get_var('sub',array('POST','GET'));

                        $property_list = $this->bo->read_property();

                        while (is_array($property_list) && 
list(,$property_entry) = each($property_list))
                        {
                                $content[] = array
                                (
                                        'property_id'                           
=> $property_entry['property_id'],
                                        'building_id'                           
=> $property_entry['building_id'],
                                        'entrance_id'                           
=> $property_entry['entrance_id'],
                                        'floor'                                 
        => $property_entry['floor'],
                                        'apartment_id'                          
=> $property_entry['apartment_id'],
                                        'street_name'                           
=> $property_entry['street_name'],
                                        'street_number'                         
=> $property_entry['street_number'],
                                        'lang_select'                           
=> lang('Select'),
                                        'lang_select_statustext'        => 
lang('Select this vendor')
                                );
                        }


                        $table_header[] = array
                        (
                                'lang_property'         => lang('Property'),
                                'lang_building'         => lang('Building'),
                                'lang_entrance'         => lang('Entrance'),
                                'lang_floor'            => lang('Floor'),
                                'lang_apartment'                => 
lang('Apartment'),
                                'lang_street_name'              => lang('Street 
Name'),
                                'lang_street_num'               => lang('Num'),
                                'lang_select'           => lang('Select')
                        );

                        $table_done[] = array
                        (
                                'lang_done'                             => 
lang('Done'),
                                'lang_done_statustext'  => lang('Close this 
window')
                        );

                        $link_select = array
                        (
                                'menuaction'            => 
$this->currentapp.'.uilookup.addressbook',
                                'cat_id'                        => 
$this->cat_id,
                                'query'                         => $this->query,
                                'filter'                        => $this->filter
                        );

                        $data = array
                        (
                                'allow_all_rows'                                
=> false,
                                'start_record'                                  
=> $this->start,
                                'record_limit'                                  
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
                                'num_records'                                   
=> count($property_list),
                                'all_records'                                   
=> $this->bo->total_records,
                                'link_url'                                      
        => $GLOBALS['phpgw']->link('/index.php',$link_select),
                                'img_path'                                      
        => $GLOBALS['phpgw']->common->get_image_path('phpgwapi'),
                                'appname'                                       
        => lang($this->currentapp),
                                'function_msg'                                  
=> lang('list vendors'),
                                'lang_no_cat'                                   
=> lang('no category'),
                                'lang_cat_statustext'                   => 
lang('Select the category the building belongs to. To do not use a category 
select NO CATEGORY'),
                                'select_name'                                   
=> 'cat_id',
                                'cat_list'                                      
        => $this->cats->formatted_xslt_list(array('selected' => 
$this->cat_id,'globals' => True)),
                                'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_select),
                                'filter_list'                                   
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter,'yours' => 
'yes')),
                                'lang_filter_statustext'                => 
lang('Select the filter. To show all entries select SHOW ALL'),
                                'lang_searchfield_statustext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
                                'lang_searchbutton_statustext'  => lang('Submit 
the search string'),
                                'query'                                         
        => $this->query,
                                'lang_submit'                                   
=> lang('submit'),
                                'table_header_property'         => 
$table_header,
                                'values_property'                       => 
$content,
                                'table_done'                                    
=> $table_done
                        );

                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list_property' => $data));
                        $this->save_sessiondata();
                }

        }
?>

Index: class.boXport.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.boXport.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** class.boXport.inc.php       21 Dec 2002 12:49:09 -0000      1.4
--- class.boXport.inc.php       27 Dec 2002 19:03:27 -0000      1.5
***************
*** 133,142 ****
  
  
!               function 
import($tsvfile,$conv_type,$private,$fcat_id,$invoice_common,$download)
                {
!                       include (PHPGW_APP_INC . '/import/' . $conv_type);
                        $invoice = new import_conv;
  
!                       $buffer = 
$invoice->import($tsvfile,$conv_type,$private,$fcat_id,$invoice_common,$download);
                        if ($download)
                        {
--- 133,142 ----
  
  
!               function import($invoice_common,$download)
                {
!                       include (PHPGW_APP_INC . '/import/' . 
$invoice_common['conv_type']);
                        $invoice = new import_conv;
  
!                       $buffer = $invoice->import($invoice_common,$download);
                        if ($download)
                        {

Index: class.uiXport.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/class.uiXport.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** class.uiXport.inc.php       24 Dec 2002 23:22:29 -0000      1.6
--- class.uiXport.inc.php       27 Dec 2002 19:03:27 -0000      1.7
***************
*** 41,67 ****
                function import()
                {
-                       global $tsvfile;
  
  //echo $tsvfile;
!                       $values         = get_var('values',array('POST'));
!                       $invoice_date = get_var('invoice_date',array('POST'));
!                       $payment_date = get_var('payment_date',array('POST'));
! 
!                       $values[invoice_date] = $invoice_date;
!                       $values[payment_date] = $payment_date;
  
  
  //_debug_array($values);
!                       if ($values['cancel'] && $tsvfile)
                        {
        //                      unlink ($tsvfile);
                        }
  
!                       if ($values['convert'])
                        {
  
                                $errorcount = 0;
  
!                               if ($values['conv_type']=='none')
                                {
                                        $error[$errorcount++] = 
array('msg'=>lang('Please - select a import format !'));
--- 41,84 ----
                function import()
                {
  
  //echo $tsvfile;
!                       $art                            = 
get_var('art',array('POST','GET'));
!                       $type                           = 
get_var('type',array('POST','GET'));
!                       $dim_b                          = 
get_var('dim_b',array('POST','GET'));
!                       $invoice_num            = 
get_var('invoice_num',array('POST','GET'));
!                       $kid_nr                         = 
get_var('kid_nr',array('POST','GET'));
!                       $abid                           = 
get_var('abid',array('POST','GET'));
!                       $vendor_name            = 
get_var('vendor_name',array('POST','GET'));
!                       $janitor                        = 
get_var('janitor',array('POST','GET'));
!                       $supervisor                     = 
get_var('supervisor',array('POST','GET'));
!                       $budget_responsible     = 
get_var('budget_responsible',array('POST','GET'));
!                       $invoice_date           = 
get_var('invoice_date',array('POST','GET'));
!                       $num_days                       = 
get_var('num_days',array('POST','GET'));
!                       $payment_date           = 
get_var('payment_date',array('POST','GET'));
!                       $cancel                         = 
get_var('cancel',array('POST','GET'));
!                       $convert                        = 
get_var('convert',array('POST','GET'));
!                       $tsvfile                        = 
get_var('tsvfile',array('POST','GET'));
!                       $conv_type                      = 
get_var('conv_type',array('POST','GET'));
!                       $sday                           = 
get_var('sday',array('POST','GET'));
!                       $smonth                         = 
get_var('smonth',array('POST','GET'));
!                       $syear                          = 
get_var('syear',array('POST','GET'));
!                       $eday                           = 
get_var('eday',array('POST','GET'));
!                       $emonth                         = 
get_var('emonth',array('POST','GET'));
!                       $eyear                          = 
get_var('eyear',array('POST','GET'));
!                       $download                       = 
get_var('download',array('POST','GET'));
  
  
  //_debug_array($values);
!                       if ($cancel && $tsvfile)
                        {
        //                      unlink ($tsvfile);
                        }
  
!                       if ($convert)
                        {
  
                                $errorcount = 0;
  
!                               if ($conv_type=='')
                                {
                                        $error[$errorcount++] = 
array('msg'=>lang('Please - select a import format !'));
***************
*** 78,131 ****
                                }
  
!                               if (!$values['art'])
                                {
                                        $error[$errorcount++] = 
array('msg'=>lang('Please - select type invoice!'));
                                }
!                               if (!$values['abid'])
                                {
                                        $error[$errorcount++] = 
array('msg'=>lang('Please - select Vendor!'));
                                }
  
!                               if (!$values['type'])
                                {
                                        $error[$errorcount++] = 
array('msg'=>lang('Please - select type order!'));
                                }
  
!                               if (!$values['budget_responsible'])
                                {
                                        $error[$errorcount++] = 
array('msg'=>lang('Please - select budget responsible!'));
                                }
  
!                               if 
(!$this->invoice->check_vendor($values['abid']))
                                {
!                                       $error[$errorcount++] = 
array('msg'=>lang('That Vendor ID is not valid !'). ' : ' . $values['abid']);
                                }
  
!                               if 
(checkdate($values['smonth'],$values['sday'],$values['syear']))
                                {
!                                       $values['sdate'] = 
mktime(2,0,0,$values['smonth'],$values['sday'],$values['syear']);
!                                       $fakturadato= date("M d 
Y",$values['sdate']);
                                }
                                else
                                {
!                                       if ($values['smonth'] && 
$values['sday'] && $values['syear'])
                                        {
!                                               $error[$errorcount++] = 
array('msg'=>lang('You have entered an invalid start date !') . ' : ' . 
$values['smonth'] .'-'. $values['sday']. '-' . $values['syear']);
                                        }
                                }
  
!                               if 
(checkdate($values['emonth'],$values['eday'],$values['eyear']))
                                {
!                                       $values['edate'] = 
mktime(2,0,0,$values['emonth'],$values['eday'],$values['eyear']);
                                }
                                else
                                {
!                                       if ($values['emonth'] && 
$values['eday'] && $values['eyear'])
                                        {
!                                               $error[$errorcount++] = 
array('msg'=>lang('You have entered an invalid end date !') . ' : ' . 
$values['emonth'] .'-'. $values['eday']. '-' . $values['eyear']);
                                        }
                                }
  
!                               if (!$values['edate'] && !$values['num_days'])
                                {
                                        $error[$errorcount++] = 
array('msg'=>lang('Please - select either payment date or number of days from 
invoice date !'));
--- 95,148 ----
                                }
  
!                               if (!$art)
                                {
                                        $error[$errorcount++] = 
array('msg'=>lang('Please - select type invoice!'));
                                }
!                               if (!$abid)
                                {
                                        $error[$errorcount++] = 
array('msg'=>lang('Please - select Vendor!'));
                                }
  
!                               if (!$type)
                                {
                                        $error[$errorcount++] = 
array('msg'=>lang('Please - select type order!'));
                                }
  
!                               if (!$budget_responsible)
                                {
                                        $error[$errorcount++] = 
array('msg'=>lang('Please - select budget responsible!'));
                                }
  
!                               if (!$this->invoice->check_vendor($abid))
                                {
!                                       $error[$errorcount++] = 
array('msg'=>lang('That Vendor ID is not valid !'). ' : ' . $abid);
                                }
  
!                               if (checkdate($smonth,$sday,$syear))
                                {
!                                       $sdate = 
mktime(2,0,0,$smonth,$sday,$syear);
!                                       $fakturadato= date("M d Y",$sdate);
                                }
                                else
                                {
!                                       if ($smonth && $sday && $syear)
                                        {
!                                               $error[$errorcount++] = 
array('msg'=>lang('You have entered an invalid start date !') . ' : ' . $smonth 
.'-'. $sday. '-' . $syear);
                                        }
                                }
  
!                               if (checkdate($emonth,$eday,$eyear))
                                {
!                                       $edate = 
mktime(2,0,0,$emonth,$eday,$eyear);
                                }
                                else
                                {
!                                       if ($emonth && $eday && $eyear)
                                        {
!                                               $error[$errorcount++] = 
array('msg'=>lang('You have entered an invalid end date !') . ' : ' . $emonth 
.'-'. $eday. '-' . $eyear);
                                        }
                                }
  
!                               if (!$edate && !$num_days)
                                {
                                        $error[$errorcount++] = 
array('msg'=>lang('Please - select either payment date or number of days from 
invoice date !'));
***************
*** 144,191 ****
                                        $m=strpos($dateformat,'m');
  
!                                       $dateparts = explode('/', 
$invoice_date);
!                                       $sday = $dateparts[$d];
!                                       $smonth = $dateparts[$m];
!                                       $syear = $dateparts[$y];
! 
!                                       $dateparts = explode('/', 
$payment_date);
!                                       $eday = $dateparts[$d];
!                                       $emonth = $dateparts[$m];
!                                       $eyear = $dateparts[$y];
! 
!                                       $debug_import_link =  $values;
! 
! //                                    $debug_import_link['invoice_date']      
=       $invoice_date;
! //                                    $debug_import_link['payment_date']      
=       $payment_date;
! //                                    $debug_import_link['download']  =       
'';
  
                                        $invoice_common=array(
                                                                'bilagsnr'      
                        => $this->invoice->next_bilagsnr(),
!                                                               'art'           
                        => $values['art'],
!                                                               'type'          
                        => $values['type'],
!                                                               'dim_b'         
                        => $values['dim_b'],
!                                                               'invoice_num'   
                => $values['invoice_num'],
!                                                               'kid_nr'        
                        => $values['kid_nr'],
!                                                               'abid'          
                        => $values['abid'],
!                                                               'janitor'       
                        => $values['janitor'],
!                                                               'supervisor'    
                => $values['supervisor'],
!                                                               
'budget_responsible'    => $values['budget_responsible'],
!                                                               'num_days'      
                        => $values['num_days'],
!                                                               'invoice_day'   
                => $sday,
!                                                               'invoice_month' 
                => $smonth,
!                                                               'invoice_year'  
                => $syear,
!                                                               'payment_day'   
                => $eday,
!                                                               'payment_month' 
                => $emonth,
!                                                               'payment_year'  
                => $eyear
                                                        );
  
! _debug_array($debug_import_link);
  //                                    $old = $tsvfile;
  //                                    $tsvfile = 
$GLOBALS['phpgw_info']['server']['temp_dir'].'/invoice_import_'.basename($tsvfile);
  //echo $tsvfile;
  //                                    rename($old,$tsvfile);
!                                       $buffer = 
$this->bo->import($tsvfile,$values['conv_type'],$values['private'],$values['fcat_id'],$invoice_common,$values['download']);
  
!                                       if(!$values['download'])
                                        {
  //                                            unlink ($tsvfile);
--- 161,213 ----
                                        $m=strpos($dateformat,'m');
  
!                                       if($invoice_date)
!                                       {
!                                               $dateparts = explode('/', 
$invoice_date);
!                                               $sday = $dateparts[$d];
!                                               $smonth = $dateparts[$m];
!                                               $syear = $dateparts[$y];
! 
!                                               $dateparts = explode('/', 
$payment_date);
!                                               $eday = $dateparts[$d];
!                                               $emonth = $dateparts[$m];
!                                               $eyear = $dateparts[$y];
!                                       }
  
                                        $invoice_common=array(
                                                                'bilagsnr'      
                        => $this->invoice->next_bilagsnr(),
!                                                               'art'           
                        => $art,
!                                                               'type'          
                        => $type,
!                                                               'dim_b'         
                        => $dim_b,
!                                                               'invoice_num'   
                => $invoice_num,
!                                                               'kid_nr'        
                        => $kid_nr,
!                                                               'abid'          
                        => $abid,
!                                                               'vendor_name'   
                => $vendor_name,
!                                                               'janitor'       
                        => $janitor,
!                                                               'supervisor'    
                => $supervisor,
!                                                               
'budget_responsible'    => $budget_responsible,
!                                                               'num_days'      
                        => $num_days,
!                                                               'sday'          
                        => $sday,
!                                                               'smonth'        
                        => $smonth,
!                                                               'syear'         
                        => $syear,
!                                                               'eday'          
                        => $eday,
!                                                               'emonth'        
                        => $emonth,
!                                                               'eyear'         
                        => $eyear,
!                                                               'tsvfile'       
                        => $tsvfile,
!                                                               'conv_type'     
                        => $conv_type,
!                                                               'invoice_date'  
                => $invoice_date,
!                                                               'payment_date'  
                => $payment_date
                                                        );
  
! 
! 
! 
! //_debug_array($invoice_common);
  //                                    $old = $tsvfile;
  //                                    $tsvfile = 
$GLOBALS['phpgw_info']['server']['temp_dir'].'/invoice_import_'.basename($tsvfile);
  //echo $tsvfile;
  //                                    rename($old,$tsvfile);
!                                       $buffer = 
$this->bo->import($invoice_common,$download);
  
!                                       if(!$download)
                                        {
  //                                            unlink ($tsvfile);
***************
*** 194,198 ****
                                        else
                                        {
!                                               
$this->debug_import($buffer,$debug_import_link);
                                                return;
                                        }
--- 216,220 ----
                                        else
                                        {
!                                               
$this->debug_import($buffer,$invoice_common);
                                                return;
                                        }
***************
*** 242,246 ****
                                'lang_debug'                                    
=> lang('Debug output in browser'),
                                'lang_debug_statustext'                 => 
lang('Check this to have the output to screen before import (recommended)'),
!                               'value_debug'                                   
=> $values['download'],
  
                                'lang_import'                                   
=> lang('Import'),
--- 264,268 ----
                                'lang_debug'                                    
=> lang('Debug output in browser'),
                                'lang_debug_statustext'                 => 
lang('Check this to have the output to screen before import (recommended)'),
!                               'value_debug'                                   
=> $download,
  
                                'lang_import'                                   
=> lang('Import'),
***************
*** 261,265 ****
  
                                'lang_vendor'                                   
=> lang('Vendor'),
!                               'addressbook_link'                              
=> $GLOBALS['phpgw']->link('/property/addressbook.php','query='),
  
                                'lang_invoice_date_statustext'  => lang('Enter 
the invoice date'),
--- 283,287 ----
  
                                'lang_vendor'                                   
=> lang('Vendor'),
!                               'addressbook_link'                              
=> 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uilookup.addressbook'),
  
                                'lang_invoice_date_statustext'  => lang('Enter 
the invoice date'),
***************
*** 271,290 ****
  
  
!                               'value_invoice_date'                    => 
$values['invoice_date'],
!                               'value_payment_date'                    => 
$values['payment_date'],
!                               'value_belop'                                   
=> $values['belop'],
!                               'value_abid'                                    
=> $values['abid'],
!                               'value_vendor_name'                             
=> $values['vendor_name'],
!                               'value_kid_nr'                                  
=> $values['kid_nr'],
!                               'value_dim_b'                                   
=> $values['dim_b'],
!                               'value_invoice_num'                             
=> $values['invoice_num'],
!                               'value_merknad'                                 
=> $values['merknad'],
!                               'value_num_days'                                
=> $values['num_days'],
                                'value_tsvfile'                                 
=> $tsvfile,
  
                                'lang_file'                                     
        => lang('File'),
                                'lang_conv'                                     
        => lang('Conversion'),
!                               'conv_list'                                     
        => $this->bo->select_conv($values['conv_type']),
!                               'select_conv'                                   
=> 'values[conv_type]',
                                'lang_select_conversion'                => 
lang('Select the type of conversion:'),
                                'lang_conv_statustext'                  => 
lang('You have to select the Conversion for this import'),
--- 293,312 ----
  
  
!                               'value_invoice_date'                    => 
$invoice_date,
!                               'value_payment_date'                    => 
$payment_date,
!                               'value_belop'                                   
=> $belop,
!                               'value_abid'                                    
=> $abid,
!                               'value_vendor_name'                             
=> $vendor_name,
!                               'value_kid_nr'                                  
=> $kid_nr,
!                               'value_dim_b'                                   
=> $dim_b,
!                               'value_invoice_num'                             
=> $invoice_num,
!                               'value_merknad'                                 
=> $merknad,
!                               'value_num_days'                                
=> $num_days,
                                'value_tsvfile'                                 
=> $tsvfile,
  
                                'lang_file'                                     
        => lang('File'),
                                'lang_conv'                                     
        => lang('Conversion'),
!                               'conv_list'                                     
        => $this->bo->select_conv($conv_type),
!                               'select_conv'                                   
=> 'conv_type',
                                'lang_select_conversion'                => 
lang('Select the type of conversion:'),
                                'lang_conv_statustext'                  => 
lang('You have to select the Conversion for this import'),
***************
*** 292,327 ****
  
                                'lang_art'                                      
        => lang('Art'),
!                               'art_list'                                      
        => $this->invoice->get_list_ecoart($values['art']),
!                               'select_art'                                    
=> 'values[art]',
                                'lang_select_art'                               
=> lang('Select Invoice Type'),
                                'lang_art_statustext'                   => 
lang('You have to select type of invoice'),
  
                                'lang_type'                                     
        => lang('Type invoice II'),
!                               'type_list'                                     
        => $this->invoice->get_type_list($values['type']),
!                               'select_type'                                   
=> 'values[type]',
                                'lang_no_type'                                  
=> lang('No type'),
                                'lang_type_statustext'                  => 
lang('Select the type  invoice. To do not use type -  select NO TYPE'),
  
                                'lang_dimb'                                     
        => lang('Dim B'),
!                               'dimb_list'                                     
        => $this->invoice->select_dimb_list($values['dim_b']),
!                               'select_dimb'                                   
=> 'values[dim_b]',
                                'lang_no_dimb'                                  
=> lang('No Dim B'),
                                'lang_dimb_statustext'                  => 
lang('Select the Dim B for this invoice. To do not use Dim B -  select NO DIM 
B'),
  
                                'lang_janitor'                                  
=> lang('Janitor'),
!                               'janitor_list'                                  
=> $this->invoice->get_list_role('janitor',$values['janitor']),
!                               'select_janitor'                                
=> 'values[janitor]',
                                'lang_no_janitor'                               
=> lang('No janitor'),
                                'lang_janitor_statustext'               => 
lang('Select the janitor responsible for this invoice. To do not use janitor -  
select NO JANITOR'),
  
                                'lang_supervisor'                               
=> lang('Supervisor'),
!                               'supervisor_list'                               
=> $this->invoice->get_list_role('supervisor',$values['supervisor']),
!                               'select_supervisor'                             
=> 'values[supervisor]',
                                'lang_no_supervisor'                    => 
lang('No supervisor'),
                                'lang_supervisor_statustext'            => 
lang('Select the supervisor responsible for this invoice. To do not use 
supervisor -  select NO SUPERVISOR'),
  
                                'lang_budget_responsible'               => 
lang('B - responsible'),
!                               'budget_responsible_list'               => 
$this->invoice->get_list_role('budget_responsible',$values['budget_responsible']),
!                               'select_budget_responsible'             => 
'values[budget_responsible]',
                                'lang_select_budget_responsible'=> lang('Select 
B-Responsible'),
                                'lang_budget_responsible_statustext'            
=> lang('You have to select a budget responsible for this invoice in order to 
make the import')
--- 314,349 ----
  
                                'lang_art'                                      
        => lang('Art'),
!                               'art_list'                                      
        => $this->invoice->get_list_ecoart($art),
!                               'select_art'                                    
=> 'art',
                                'lang_select_art'                               
=> lang('Select Invoice Type'),
                                'lang_art_statustext'                   => 
lang('You have to select type of invoice'),
  
                                'lang_type'                                     
        => lang('Type invoice II'),
!                               'type_list'                                     
        => $this->invoice->get_type_list($type),
!                               'select_type'                                   
=> 'type',
                                'lang_no_type'                                  
=> lang('No type'),
                                'lang_type_statustext'                  => 
lang('Select the type  invoice. To do not use type -  select NO TYPE'),
  
                                'lang_dimb'                                     
        => lang('Dim B'),
!                               'dimb_list'                                     
        => $this->invoice->select_dimb_list($dim_b),
!                               'select_dimb'                                   
=> 'dim_b',
                                'lang_no_dimb'                                  
=> lang('No Dim B'),
                                'lang_dimb_statustext'                  => 
lang('Select the Dim B for this invoice. To do not use Dim B -  select NO DIM 
B'),
  
                                'lang_janitor'                                  
=> lang('Janitor'),
!                               'janitor_list'                                  
=> $this->invoice->get_list_role('janitor',$janitor),
!                               'select_janitor'                                
=> 'janitor',
                                'lang_no_janitor'                               
=> lang('No janitor'),
                                'lang_janitor_statustext'               => 
lang('Select the janitor responsible for this invoice. To do not use janitor -  
select NO JANITOR'),
  
                                'lang_supervisor'                               
=> lang('Supervisor'),
!                               'supervisor_list'                               
=> $this->invoice->get_list_role('supervisor',$supervisor),
!                               'select_supervisor'                             
=> 'supervisor',
                                'lang_no_supervisor'                    => 
lang('No supervisor'),
                                'lang_supervisor_statustext'            => 
lang('Select the supervisor responsible for this invoice. To do not use 
supervisor -  select NO SUPERVISOR'),
  
                                'lang_budget_responsible'               => 
lang('B - responsible'),
!                               'budget_responsible_list'               => 
$this->invoice->get_list_role('budget_responsible',$budget_responsible),
!                               'select_budget_responsible'             => 
'budget_responsible',
                                'lang_select_budget_responsible'=> lang('Select 
B-Responsible'),
                                'lang_budget_responsible_statustext'            
=> lang('You have to select a budget responsible for this invoice in order to 
make the import')
***************
*** 337,341 ****
                }
  
!               function debug_import($buffer='',$debug_import_link='')
                {
  
--- 359,363 ----
                }
  
!               function debug_import($buffer='',$invoice_common='')
                {
  
***************
*** 378,385 ****
                        $link_data_add = array
                        (
                                'menuaction'    => 
$this->currentapp.'.uiXport.import'
                        );
  
!                       $link_data_add  =       $link_data_add  +       
$debug_import_link;
  
  
--- 400,414 ----
                        $link_data_add = array
                        (
+                               'menuaction'    => 
$this->currentapp.'.uiXport.import',
+                                               'convert'       => 'true'
+                       );
+ 
+                       $link_data_cancel = array
+                       (
                                'menuaction'    => 
$this->currentapp.'.uiXport.import'
                        );
  
!                       $link_data_add          =       $link_data_add  +       
$invoice_common;
!                       $link_data_cancel       =       $link_data_cancel       
+       $invoice_common;
  
  
***************
*** 391,395 ****
                                'lang_cancel'                           => 
lang('cancel'),
                                'lang_cancel_statustext'        => lang('Do not 
import this invoice'),
!                               'cancel_action'                 => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiXport.import')
  
                        );
--- 420,424 ----
                                'lang_cancel'                           => 
lang('cancel'),
                                'lang_cancel_statustext'        => lang('Do not 
import this invoice'),
!                               'cancel_action'                 => 
$GLOBALS['phpgw']->link('/index.php',$link_data_cancel)
  
                        );
***************
*** 413,417 ****
                                'lang_sum'                                      
        => lang('Sum'),
                                'sum'                                           
        => $sum,
-                               'felt_1'                                        
                => 'belop',
                                'table_header'                                  
=> $table_header,
                                'table_key'                                     
        => $table_key,
--- 442,445 ----




reply via email to

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