[2] | 1 | <?php |
---|
| 2 | /***************************************************************************\ |
---|
| 3 | * eGroupWare - Contacts Center * |
---|
| 4 | * http://www.egroupware.org * |
---|
| 5 | * * |
---|
| 6 | * Storage Object Classes * |
---|
| 7 | * Written by: * |
---|
| 8 | * - Raphael Derosso Pereira <raphaelpereira@users.sourceforge.net> * |
---|
| 9 | * sponsored by Thyamad - http://www.thyamad.com * |
---|
| 10 | * ------------------------------------------------------------------------- * |
---|
| 11 | * This program is free software; you can redistribute it and/or modify it * |
---|
| 12 | * under the terms of the GNU General Public License as published by the * |
---|
| 13 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
| 14 | * option) any later version. * |
---|
| 15 | \***************************************************************************/ |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | |
---|
| 19 | include_once("class.so_main.inc.php"); |
---|
| 20 | |
---|
| 21 | class so_company_legal extends so_main |
---|
| 22 | { |
---|
| 23 | |
---|
| 24 | function so_company_legal ( $id = false ) |
---|
| 25 | { |
---|
| 26 | $this->init(); |
---|
| 27 | |
---|
| 28 | $this->main_fields = array( |
---|
| 29 | 'id_company_legal' => array( |
---|
| 30 | 'name' => 'id_company_legal', |
---|
| 31 | 'type' => 'primary', |
---|
| 32 | 'state' => 'empty', |
---|
| 33 | 'value' => &$this->id |
---|
| 34 | ), |
---|
| 35 | 'id_typeof_company_legal' => array( |
---|
| 36 | 'name' => 'id_typeof_company_legal', |
---|
| 37 | 'type' => 'foreign', |
---|
| 38 | 'association' => array( |
---|
| 39 | 'table' => 'phpgw_cc_typeof_co_legals', |
---|
| 40 | 'field' => 'id_typeof_company_legal' |
---|
| 41 | ), |
---|
| 42 | 'state' => 'empty', |
---|
| 43 | 'value' => false |
---|
| 44 | ), |
---|
| 45 | 'id_company' => array( |
---|
| 46 | 'name' => 'id_company', |
---|
| 47 | 'type' => 'foreign', |
---|
| 48 | 'association' => array( |
---|
| 49 | 'table' => 'phpgw_cc_company', |
---|
| 50 | 'field' => 'id_company' |
---|
| 51 | ), |
---|
| 52 | 'state' => 'empty', |
---|
| 53 | 'value' => false |
---|
| 54 | ), |
---|
| 55 | 'legal_info_name' => array( |
---|
| 56 | 'name' => 'legal_info_name', |
---|
| 57 | 'type' => false, |
---|
| 58 | 'state' => 'empty', |
---|
| 59 | 'value' => false |
---|
| 60 | ), |
---|
| 61 | 'legal_info_value' => array( |
---|
| 62 | 'name' => 'legal_info_value', |
---|
| 63 | 'type' => false, |
---|
| 64 | 'state' => 'empty', |
---|
| 65 | 'value' => false |
---|
| 66 | ) |
---|
| 67 | ); |
---|
| 68 | |
---|
| 69 | $this->db_tables = array( |
---|
| 70 | 'phpgw_cc_company_legals' => array( |
---|
| 71 | 'type' => 'main', |
---|
| 72 | 'keys' => array( |
---|
| 73 | 'primary' => array(&$this->main_fields['id_company_legal']), |
---|
| 74 | 'foreign' => array( |
---|
| 75 | &$this->main_fields['id_typeof_company_legal'], |
---|
| 76 | &$this->main_fields['id_company'] |
---|
| 77 | ) |
---|
| 78 | ), |
---|
| 79 | 'fields' => & $this->main_fields |
---|
| 80 | ) |
---|
| 81 | ); |
---|
| 82 | |
---|
| 83 | if($id) |
---|
| 84 | { |
---|
| 85 | if (!$this->checkout($id)) |
---|
| 86 | { |
---|
| 87 | $this->reset_values(); |
---|
| 88 | $this->state = 'new'; |
---|
| 89 | } |
---|
| 90 | } |
---|
| 91 | else |
---|
| 92 | { |
---|
| 93 | $this->state = 'new'; |
---|
| 94 | } |
---|
| 95 | } |
---|
| 96 | |
---|
| 97 | |
---|
| 98 | /*********************************************************************\ |
---|
| 99 | * Methods to Get Information * |
---|
| 100 | \*********************************************************************/ |
---|
| 101 | |
---|
| 102 | /*! |
---|
| 103 | |
---|
| 104 | @function get_id_type |
---|
| 105 | @abstract Returns the ID of the Type of this Legal |
---|
| 106 | @author Raphael Derosso Pereira |
---|
| 107 | |
---|
| 108 | */ |
---|
| 109 | function get_id_type ( ) |
---|
| 110 | { |
---|
| 111 | return $this->main_fields['id_type']['value']; |
---|
| 112 | } |
---|
| 113 | |
---|
| 114 | /*! |
---|
| 115 | |
---|
| 116 | @function get_name |
---|
| 117 | @abstract Returns the Legal Name |
---|
| 118 | @author Raphael Derosso Pereira |
---|
| 119 | |
---|
| 120 | */ |
---|
| 121 | function get_name ( ) |
---|
| 122 | { |
---|
| 123 | return $this->main_fields['legal_name']['value']; |
---|
| 124 | } |
---|
| 125 | |
---|
| 126 | /*! |
---|
| 127 | |
---|
| 128 | @function get_value |
---|
| 129 | @abstract Returns the Legal Value |
---|
| 130 | @author Raphael Derosso Pereira |
---|
| 131 | |
---|
| 132 | */ |
---|
| 133 | function get_value ( ) |
---|
| 134 | { |
---|
| 135 | return $this->main_fields['legal_value']['value']; |
---|
| 136 | } |
---|
| 137 | |
---|
| 138 | |
---|
| 139 | |
---|
| 140 | /*********************************************************************\ |
---|
| 141 | * Methods to Get Information * |
---|
| 142 | \*********************************************************************/ |
---|
| 143 | |
---|
| 144 | /*! |
---|
| 145 | |
---|
| 146 | @function set_id_type |
---|
| 147 | @abstract Sets the Type ID of this Legal |
---|
| 148 | @author Raphael Derosso Pereira |
---|
| 149 | |
---|
| 150 | @param integer $id_type The Type ID |
---|
| 151 | |
---|
| 152 | */ |
---|
| 153 | function set_id_type ( $id_type ) |
---|
| 154 | { |
---|
| 155 | $this->main_fields['id_type']['value'] = $id_type; |
---|
| 156 | $this->manage_fields($this->main_fields['id_type'], 'changed'); |
---|
| 157 | } |
---|
| 158 | |
---|
| 159 | /*! |
---|
| 160 | |
---|
| 161 | @function set_name |
---|
| 162 | @abstract Sets the Legal Name |
---|
| 163 | @author Raphael Derosso Pereira |
---|
| 164 | |
---|
| 165 | @param string $name The Legal Name |
---|
| 166 | |
---|
| 167 | */ |
---|
| 168 | function set_name ( $name ) |
---|
| 169 | { |
---|
| 170 | $this->main_fields['legal_info_name']['value'] = $name; |
---|
| 171 | $this->manage_fields($this->main_fields['legal_info_name'], 'changed'); |
---|
| 172 | } |
---|
| 173 | |
---|
| 174 | /*! |
---|
| 175 | |
---|
| 176 | @function set_value |
---|
| 177 | @abstract Sets the Legal value |
---|
| 178 | @author Raphael Derosso Pereira |
---|
| 179 | |
---|
| 180 | @param string $value The Legal Value |
---|
| 181 | |
---|
| 182 | */ |
---|
| 183 | function set_value ( $value ) |
---|
| 184 | { |
---|
| 185 | $this->main_fields['legal_info_value']['value'] = $value; |
---|
| 186 | $this->manage_fields($this->main_fields['legal_info_value'], 'changed'); |
---|
| 187 | } |
---|
| 188 | |
---|
| 189 | } |
---|
| 190 | ?> |
---|