Ignore:
Timestamp:
07/12/10 10:39:22 (14 years ago)
Author:
niltonneto
Message:

Ticket #1135 - Ajuste da atualização do header.inc.php, setup dos módulos e API.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/contactcenter/setup/tables_update.inc.php

    r1728 r3031  
    99        * option) any later version.                                               * 
    1010        \**************************************************************************/     
    11         $test[] = '0.4.1'; 
    12         function contactcenter_upgrade0_4_1() { 
    13                  
    14                 $oProc = $GLOBALS['phpgw_setup']->oProc; 
    15                 $oProc->DropTable('phpgw_cc_city'); 
    16                 $oProc->DropTable('phpgw_cc_state'); 
    17                 $oProc->CreateTable( 
    18                         'phpgw_cc_state',array( 
    19                                 'fd' => array( 
    20                                         'id_state' => array( 'type' => 'int', 'precision' => 8, 'nullable' => false), 
    21                                         'id_country' => array( 'type' => 'char', 'nullable' => false, 'precision' => 2), 
    22                                         'state_name' => array( 'type' => 'varchar', 'precision' => 30), 
    23                                         'state_symbol' => array( 'type' => 'varchar', 'precision' => 10) 
    24                                 ), 
    25                                 'pk' => array('id_state'), 
    26                                 'fk' => array('id_country' => array('phpgw_common_country_list' => 'id_country')), 
    27                                 'ix' => array(), 
    28                                 'uc' => array() 
    29                         ) 
    30                 ); 
    31                 $oProc->CreateTable( 
    32                         'phpgw_cc_city', array( 
    33                                 'fd' => array( 
    34                                         'id_city' => array( 'type' => 'int', 'precision' => 8, 'nullable' => false ), 
    35                                         'id_state' => array( 'type' => 'int', 'precision' => 8 ), 
    36                                         'id_country' => array( 'type' => 'char', 'nullable' => false, 'precision' => 2), 
    37                                         'city_timezone' => array( 'type' => 'int', 'precision' => 2 ), 
    38                                         'city_geo_location' => array(  'type'  => 'varchar', 'precision' => 40 ), 
    39                                         'city_name' => array( 'type'  => 'varchar', 'precision' => 60, 'nullable' => 'false' ),                          
    40                                 ), 
    41                                 'pk' => array('id_city'), 
    42                                 'fk' => array('id_state'   => array('phpgw_cc_state' => 'id_state')     ), 
    43                                 'ix' => array(), 
    44                                 'uc' => array() 
    45                         )                
    46                 );               
    47                  
    48                 include("states_pt-br.inc.php");  
    49                 include("cities_pt-br.inc.php"); 
    50                 $GLOBALS['setup_info']['contactcenter']['currentver'] = '1.0.0'; 
    51                 return $GLOBALS['setup_info']['contactcenter']['currentver']; 
    52         } 
    53         $test[] = '1.0.0'; 
    54         function contactcenter_upgrade1_0_0() { 
    55                 $GLOBALS['setup_info']['contactcenter']['currentver'] = '1.0.005'; 
    56                 return $GLOBALS['setup_info']['contactcenter']['currentver']; 
    57         } 
    58         $test[] = '1.0.005'; 
    59         function contactcenter_upgrade1_0_005() { 
    60                 $GLOBALS['setup_info']['contactcenter']['currentver'] = '1.14'; 
    61                 return $GLOBALS['setup_info']['contactcenter']['currentver']; 
    62         } 
    63         $test[] = '1.14'; 
    64         function contactcenter_upgrade1_14() {                           
    65                 $GLOBALS['phpgw_setup']->db->query("ALTER TABLE phpgw_cc_connections ALTER COLUMN connection_value TYPE varchar(100)"); 
    66                 $GLOBALS['setup_info']['contactcenter']['currentver'] = '1.15'; 
    67                 return $GLOBALS['setup_info']['contactcenter']['currentver']; 
    68         } 
    69         $test[] = '1.15'; 
    70         function contactcenter_upgrade1_15() {           
    71                 $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_cc_contact','last_status', array('type' => 'char', 'precision' => 1, 'default' => 'N')); 
    72                 $GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_cc_contact','category', array('type' => 'varchar', 'precision' => 20));                                 
    73                 // Verify if last_update column exists..... 
    74                 $GLOBALS['phpgw_setup']->oProc->m_oTranslator->_GetColumns($GLOBALS['phpgw_setup']->oProc,'phpgw_cc_contact', &$sColumns); 
    75                 if(array_search("last_update",explode(",",$sColumns)) === FALSE) { 
    76                         $GLOBALS['phpgw_setup']->db->query("ALTER TABLE phpgw_cc_contact ADD COLUMN last_update int8 DEFAULT (date_part('epoch'::text, ('now'::text)::timestamp(3) with time zone) * (1000)::double precision)"); 
    77                 } 
    78                 $GLOBALS['setup_info']['contactcenter']['currentver'] = '1.20'; 
    79                 return $GLOBALS['setup_info']['contactcenter']['currentver']; 
    80         } 
    81         $test[] = '1.20'; 
    82         function contactcenter_upgrade1_20() { 
    83                 $GLOBALS['setup_info']['contactcenter']['currentver'] = '1.20.001'; 
    84                 return $GLOBALS['setup_info']['contactcenter']['currentver']; 
    85         } 
    86         $test[] = '1.20.001'; 
    87         function contactcenter_upgrade1_20_001() { 
    88                 $GLOBALS['setup_info']['contactcenter']['currentver'] = '1.21'; 
    89                 // Verify if plpgsql language is installed. 
    90                 $res = $GLOBALS['phpgw_setup']->db->query("select lanname from pg_language where lanname = 'plpgsql'"); 
    91                 if(!strstr($res,'plpgsql')){ 
    92                         $GLOBALS['phpgw_setup']->db->query("create language 'plpgsql'"); 
    93                 }                
    94                 // Verify if trigger Insert() for Shared Contacts exists, else create it..... 
    95                 $res = $GLOBALS['phpgw_setup']->db->query("select tgname from pg_trigger where tgname = 'trig_share_catalog_insert'"); 
    96                 if(!strstr($res,'trig_share_catalog_insert')){ 
    97                         $GLOBALS['phpgw_setup']->db->query("create function share_catalog_insert() returns trigger as ' begin if ". 
    98                                 "new.acl_appname = ''contactcenter'' and  new.acl_location <> ''run'' then ". 
    99                                 "insert into phpgw_cc_contact_rels (id_contact,id_related,id_typeof_contact_relation) ". 
    100                                 "values (new.acl_location::integer,new.acl_account,1); end if; return new; end;' language 'plpgsql';");          
    101  
    102                         $GLOBALS['phpgw_setup']->db->query("create trigger trig_share_catalog_insert after insert on phpgw_acl for " . 
    103                                 "each row execute procedure share_catalog_insert()");  
    104                 } 
    105                 // Verify if trigger Delete() for Shared Contacts exists, else create it..... 
    106                 $res = $GLOBALS['phpgw_setup']->db->query("select tgname from pg_trigger where tgname = 'trig_share_catalog_delete'");           
    107                 if(!strstr($res,'trig_share_catalog_delete')){ 
    108                         $GLOBALS['phpgw_setup']->db->query("create function share_catalog_delete() returns trigger as ' begin if " . 
    109                                                                 "old.acl_appname = ''contactcenter'' then delete from phpgw_cc_contact_rels where " . 
    110                                                                 "id_contact=old.acl_location and id_related=old.acl_account and " . 
    111                                                                 "id_typeof_contact_relation=1; end if; return new; end;' language 'plpgsql'"); 
    112          
    113                         $GLOBALS['phpgw_setup']->db->query("create trigger trig_share_catalog_delete after delete on phpgw_acl for " . 
    114                                 "each row execute procedure share_catalog_delete()"); 
    115                 } 
    116                 return $GLOBALS['setup_info']['contactcenter']['currentver']; 
    117         } 
     11        // Since Expresso 1.2 using ContactCenter 1.21 
    11812        $test[] = '1.21'; 
    11913        function contactcenter_upgrade1_21() { 
     
    12923        function contactcenter_upgrade2_0_000() { 
    13024                $GLOBALS['setup_info']['contactcenter']['currentver'] = '2.0.001'; 
     25                return $GLOBALS['setup_info']['contactcenter']['currentver']; 
     26        } 
     27        $test[] = '2.0.001'; 
     28        function contactcenter_upgrade2_0_001() { 
     29                $GLOBALS['setup_info']['contactcenter']['currentver'] = '2.0.002'; 
     30                return $GLOBALS['setup_info']['contactcenter']['currentver']; 
     31        }                
     32        $test[] = '2.0.002'; 
     33        function contactcenter_upgrade2_0_002() { 
     34                $GLOBALS['setup_info']['contactcenter']['currentver'] = '2.1.000'; 
     35                return $GLOBALS['setup_info']['contactcenter']['currentver']; 
     36        }        
     37        $test[] = '2.1.000'; 
     38        function contactcenter_upgrade2_1_000() {                
    13139                $GLOBALS['phpgw_setup']->db->query("ALTER TABLE phpgw_cc_contact ADD COLUMN web_page character varying(100)"); 
    13240                $GLOBALS['phpgw_setup']->db->query("ALTER TABLE phpgw_cc_contact ADD COLUMN corporate_name character varying(100)"); 
    13341                $GLOBALS['phpgw_setup']->db->query("ALTER TABLE phpgw_cc_contact ADD COLUMN job_title character varying(40)"); 
    13442                $GLOBALS['phpgw_setup']->db->query("ALTER TABLE phpgw_cc_contact ADD COLUMN department character varying(30)"); 
     43                $GLOBALS['setup_info']['contactcenter']['currentver'] = '2.2.000'; 
    13544                return $GLOBALS['setup_info']['contactcenter']['currentver']; 
    136         } 
    137         $test[] = '2.0.001'; 
    138         function contactcenter_upgrade2_0_001() { 
    139                 $GLOBALS['setup_info']['contactcenter']['currentver'] = '2.1.000'; 
    140                 return $GLOBALS['setup_info']['contactcenter']['currentver']; 
    141         } 
     45        }        
    14246?> 
Note: See TracChangeset for help on using the changeset viewer.