[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 | * This class handles the Contact DB Table |
---|
| 19 | * |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | include_once("class.so_main.inc.php"); |
---|
| 23 | |
---|
| 24 | class so_contact extends so_main { |
---|
| 25 | |
---|
| 26 | function so_contact ( $id_contact = false) |
---|
| 27 | { |
---|
| 28 | $this->init(); |
---|
| 29 | |
---|
| 30 | $this->main_fields = array( |
---|
| 31 | 'id_contact' => array( |
---|
| 32 | 'name' => 'id_contact', |
---|
| 33 | 'type' => 'primary', |
---|
| 34 | 'state' => 'empty', |
---|
| 35 | 'value' => &$this->id), |
---|
| 36 | 'id_owner' => array( |
---|
| 37 | 'name' => 'id_owner', |
---|
| 38 | 'type' => false, |
---|
| 39 | 'state' => 'empty', |
---|
| 40 | 'value' => false), |
---|
| 41 | 'id_status' => array( |
---|
| 42 | 'name' => 'id_status', |
---|
| 43 | 'type' => 'foreign', |
---|
| 44 | 'association' => array( |
---|
| 45 | 'table' => 'phpgw_cc_status', |
---|
| 46 | 'field' => 'id_status'), |
---|
| 47 | 'state' => 'empty', |
---|
| 48 | 'value' => false), |
---|
| 49 | 'photo' => array( |
---|
| 50 | 'name' => 'photo', |
---|
| 51 | 'type' => false, |
---|
| 52 | 'state' => 'empty', |
---|
| 53 | 'value' => false), |
---|
| 54 | 'alias' => array( |
---|
| 55 | 'name' => 'alias', |
---|
| 56 | 'type' => false, |
---|
| 57 | 'state' => 'empty', |
---|
| 58 | 'value' => false), |
---|
| 59 | 'id_prefix' => array( |
---|
| 60 | 'name' => 'id_prefix', |
---|
| 61 | 'type' => 'foreign', |
---|
| 62 | 'association' => array( |
---|
| 63 | 'table' => 'phpgw_cc_prefixes', |
---|
| 64 | 'field' => 'id_prefix'), |
---|
| 65 | 'state' => 'empty', |
---|
| 66 | 'value' => false), |
---|
| 67 | 'given_names' => array( |
---|
| 68 | 'name' => 'given_names', |
---|
| 69 | 'type' => false, |
---|
| 70 | 'state' => 'empty', |
---|
| 71 | 'value' => false), |
---|
| 72 | 'family_names' => array( |
---|
| 73 | 'name' => 'family_names', |
---|
| 74 | 'type' => false, |
---|
| 75 | 'state' => 'empty', |
---|
| 76 | 'value' => false), |
---|
| 77 | 'names_ordered' => array( |
---|
| 78 | 'name' => 'names_ordered', |
---|
| 79 | 'type' => false, |
---|
| 80 | 'state' => 'empty', |
---|
| 81 | 'value' => false), |
---|
| 82 | 'id_suffix' => array( |
---|
| 83 | 'name' => 'id_suffix', |
---|
| 84 | 'type' => 'foreign', |
---|
| 85 | 'association' => array( |
---|
| 86 | 'table' => 'phpgw_cc_suffixes', |
---|
| 87 | 'field' => 'id_suffix'), |
---|
| 88 | 'state' => 'empty', |
---|
| 89 | 'value' => false), |
---|
| 90 | 'birthdate' => array( |
---|
| 91 | 'name' => 'birthdate', |
---|
| 92 | 'type' => false, |
---|
| 93 | 'state' => 'empty', |
---|
| 94 | 'value' => false), |
---|
| 95 | 'sex' => array( |
---|
| 96 | 'name' => 'sex', |
---|
| 97 | 'type' => false, |
---|
| 98 | 'state' => 'empty', |
---|
| 99 | 'value' => false), |
---|
| 100 | 'pgp_key' => array( |
---|
| 101 | 'name' => 'pgp_key', |
---|
| 102 | 'type' => false, |
---|
| 103 | 'state' => 'empty', |
---|
| 104 | 'value' => false), |
---|
| 105 | 'notes' => array( |
---|
| 106 | 'name' => 'notes', |
---|
| 107 | 'type' => false, |
---|
| 108 | 'state' => 'empty', |
---|
| 109 | 'value' => false), |
---|
| 110 | 'is_global' => array( |
---|
| 111 | 'name' => 'is_global', |
---|
| 112 | 'type' => false, |
---|
| 113 | 'state' => 'empty', |
---|
[285] | 114 | 'value' => false), |
---|
| 115 | 'last_status' => array( |
---|
| 116 | 'name' => 'last_status', |
---|
| 117 | 'type' => false, |
---|
| 118 | 'state' => 'empty', |
---|
| 119 | 'value' => false), |
---|
| 120 | 'last_update' => array( |
---|
| 121 | 'name' => 'last_update', |
---|
| 122 | 'type' => false, |
---|
| 123 | 'state' => 'empty', |
---|
[2] | 124 | 'value' => false)); |
---|
| 125 | |
---|
| 126 | $this->companies = array( |
---|
| 127 | 'id_contact' => array( |
---|
| 128 | 'name' => 'id_contact', |
---|
| 129 | 'type' => array('foreign', 'primary'), |
---|
| 130 | 'association' => array( |
---|
| 131 | 'table' => 'phpgw_cc_contact', |
---|
| 132 | 'field' => 'id_contact' |
---|
| 133 | ), |
---|
| 134 | 'states' => array(), |
---|
| 135 | 'values' => array() |
---|
| 136 | ), |
---|
| 137 | 'id_company' => array( |
---|
| 138 | 'name' => 'id_company', |
---|
| 139 | 'type' => array('foreign', 'primary'), |
---|
| 140 | 'association' => array( |
---|
| 141 | 'table' => 'phpgw_cc_company', |
---|
| 142 | 'field' => 'id_company' |
---|
| 143 | ), |
---|
| 144 | 'states' => array(), |
---|
| 145 | 'values' => array() |
---|
| 146 | ), |
---|
| 147 | 'title' => array( |
---|
| 148 | 'name' => 'title', |
---|
| 149 | 'type' => false, |
---|
| 150 | 'states' => array(), |
---|
| 151 | 'values' => array() |
---|
| 152 | ), |
---|
| 153 | 'department' => array( |
---|
| 154 | 'name' => 'department', |
---|
| 155 | 'type' => false, |
---|
| 156 | 'states' => array(), |
---|
| 157 | 'values' => array() |
---|
| 158 | ), |
---|
| 159 | 'default_contact' => array( |
---|
| 160 | 'name' => 'default_contact', |
---|
| 161 | 'type' => false, |
---|
| 162 | 'states' => array(), |
---|
| 163 | 'values' => array() |
---|
| 164 | ), |
---|
| 165 | 'default_company' => array( |
---|
| 166 | 'name' => 'default_company', |
---|
| 167 | 'type' => false, |
---|
| 168 | 'states' => array(), |
---|
| 169 | 'values' => array() |
---|
| 170 | ) |
---|
| 171 | ); |
---|
| 172 | |
---|
| 173 | $this->addresses = array( |
---|
| 174 | 'id_contact' => array( |
---|
| 175 | 'name' => 'id_contact', |
---|
| 176 | 'type' => array('foreign', 'primary'), |
---|
| 177 | 'association' => array( |
---|
| 178 | 'table' => 'phpgw_cc_contact', |
---|
| 179 | 'field' => 'id_contact'), |
---|
| 180 | 'states' => array(), |
---|
| 181 | 'values' => array()), |
---|
| 182 | 'id_address' => array( |
---|
| 183 | 'name' => 'id_address', |
---|
| 184 | 'type' => array('foreign', 'primary'), |
---|
| 185 | 'association' => array( |
---|
| 186 | 'table' => 'phpgw_cc_addresses', |
---|
| 187 | 'field' => 'id_address'), |
---|
| 188 | 'states' => array(), |
---|
| 189 | 'values' => array()), |
---|
| 190 | 'id_typeof_contact_address' => array( |
---|
| 191 | 'name' => 'id_typeof_contact_address', |
---|
| 192 | 'type' => 'foreign', |
---|
| 193 | 'association' => array( |
---|
| 194 | 'table' => 'phpgw_cc_typeof_ct_addrs', |
---|
| 195 | 'field' => 'id_typeof_contact_address'), |
---|
| 196 | 'states' => array(), |
---|
| 197 | 'values' => array())); |
---|
| 198 | |
---|
| 199 | |
---|
| 200 | $this->connections = array( |
---|
| 201 | 'id_contact' => array( |
---|
| 202 | 'name' => 'id_contact', |
---|
| 203 | 'type' => array('foreign', 'primary'), |
---|
| 204 | 'association' => array( |
---|
| 205 | 'table' => 'phpgw_cc_contact', |
---|
| 206 | 'field' => 'id_contact'), |
---|
| 207 | 'states' => array(), |
---|
| 208 | 'values' => array()), |
---|
| 209 | 'id_connection' => array( |
---|
| 210 | 'name' => 'id_connection', |
---|
| 211 | 'type' => array('foreign', 'primary'), |
---|
| 212 | 'association' => array( |
---|
| 213 | 'table' => 'phpgw_cc_connections', |
---|
| 214 | 'field' => 'id_connection'), |
---|
| 215 | 'states' => array(), |
---|
| 216 | 'values' => array()), |
---|
| 217 | 'id_typeof_contact_connection' => array( |
---|
| 218 | 'name' => 'id_typeof_contact_connection', |
---|
| 219 | 'type' => array('foreign', 'primary'), |
---|
| 220 | 'association' => array( |
---|
| 221 | 'table' => 'phpgw_cc_typeof_ct_conns', |
---|
| 222 | 'field' => 'id_typeof_contact_connection'), |
---|
| 223 | 'states' => array(), |
---|
| 224 | 'values' => array())); |
---|
| 225 | |
---|
| 226 | $this->relations = array( |
---|
| 227 | 'id_contact' => array( |
---|
| 228 | 'name' => 'id_contact', |
---|
| 229 | 'type' => array('foreign', 'primary'), |
---|
| 230 | 'association' => array( |
---|
| 231 | 'table' => 'phpgw_cc_contact', |
---|
| 232 | 'field' => 'id_contact' |
---|
| 233 | ), |
---|
| 234 | 'states' => array(), |
---|
| 235 | 'values' => array() |
---|
| 236 | ), |
---|
| 237 | 'id_related' => array( |
---|
| 238 | 'name' => 'id_related', |
---|
| 239 | 'type' => array('foreign', 'primary'), |
---|
| 240 | 'association' => array( |
---|
| 241 | 'table' => 'phpgw_cc_contact', |
---|
| 242 | 'field' => 'id_contact' |
---|
| 243 | ), |
---|
| 244 | 'states' => array(), |
---|
| 245 | 'values' => array() |
---|
| 246 | ), |
---|
| 247 | 'id_typeof_contact_relation' => array( |
---|
| 248 | 'name' => 'id_typeof_contact_relation', |
---|
| 249 | 'type' => array('foreign', 'primary'), |
---|
| 250 | 'association' => array( |
---|
| 251 | 'table' => 'phpgw_cc_typeof_ct_rels', |
---|
| 252 | 'field' => 'id_typeof_contact_relation' |
---|
| 253 | ), |
---|
| 254 | 'states' => array(), |
---|
| 255 | 'values' => array() |
---|
| 256 | ) |
---|
| 257 | ); |
---|
[503] | 258 | $this->relateds = array( |
---|
| 259 | 'id_related' => array( |
---|
| 260 | 'name' => 'id_related', |
---|
| 261 | 'type' => array('foreign', 'primary'), |
---|
| 262 | 'association' => array( |
---|
| 263 | 'table' => 'phpgw_cc_contact', |
---|
| 264 | 'field' => 'id_contact' |
---|
| 265 | ), |
---|
| 266 | 'states' => array(), |
---|
| 267 | 'values' => array() |
---|
| 268 | ), |
---|
| 269 | 'id_contact' => array( |
---|
| 270 | 'name' => 'id_contact', |
---|
| 271 | 'type' => array('foreign', 'primary'), |
---|
| 272 | 'association' => array( |
---|
| 273 | 'table' => 'phpgw_cc_contact', |
---|
| 274 | 'field' => 'id_contact' |
---|
| 275 | ), |
---|
| 276 | 'states' => array(), |
---|
| 277 | 'values' => array() |
---|
| 278 | ), |
---|
| 279 | 'id_typeof_contact_relation' => array( |
---|
| 280 | 'name' => 'id_typeof_contact_relation', |
---|
| 281 | 'type' => array('foreign', 'primary'), |
---|
| 282 | 'association' => array( |
---|
| 283 | 'table' => 'phpgw_cc_typeof_ct_rels', |
---|
| 284 | 'field' => 'id_typeof_contact_relation' |
---|
| 285 | ), |
---|
| 286 | 'states' => array(), |
---|
| 287 | 'values' => array() |
---|
| 288 | ) |
---|
| 289 | ); |
---|
[2] | 290 | |
---|
| 291 | |
---|
| 292 | $this->db_tables = array( |
---|
| 293 | 'phpgw_cc_contact' => array( |
---|
| 294 | 'type' => 'main', |
---|
| 295 | 'keys' => array( |
---|
| 296 | 'primary' => array(&$this->main_fields['id_contact']), |
---|
| 297 | 'foreign' => array( |
---|
| 298 | &$this->main_fields['id_status'], |
---|
| 299 | &$this->main_fields['id_prefix'], |
---|
| 300 | &$this->main_fields['id_suffix'])), |
---|
| 301 | 'fields' => & $this->main_fields), |
---|
| 302 | 'phpgw_cc_contact_company' => array( |
---|
| 303 | 'type' => 'multi', |
---|
| 304 | 'keys' => array( |
---|
| 305 | 'primary' => array( |
---|
| 306 | &$this->companies['id_contact'], |
---|
| 307 | &$this->companies['id_company']), |
---|
| 308 | 'foreign' => array( |
---|
| 309 | &$this->companies['id_contact'], |
---|
| 310 | &$this->companies['id_company'])), |
---|
| 311 | 'fields' => & $this->companies), |
---|
| 312 | 'phpgw_cc_contact_rels' => array( |
---|
| 313 | 'type' => 'multi', |
---|
| 314 | 'keys' => array( |
---|
| 315 | 'primary' => array( |
---|
| 316 | &$this->relations['id_contact'], |
---|
| 317 | &$this->relations['id_related']), |
---|
| 318 | 'foreign' => array( |
---|
| 319 | &$this->relations['id_contact'], |
---|
| 320 | &$this->relations['id_related'])), |
---|
| 321 | 'fields' => & $this->relations), |
---|
| 322 | 'phpgw_cc_contact_addrs' => array( |
---|
| 323 | 'type' => 'multi', |
---|
| 324 | 'keys' => array( |
---|
| 325 | 'primary' => array( |
---|
| 326 | &$this->addresses['id_contact'], |
---|
| 327 | &$this->addresses['id_address']), |
---|
| 328 | 'foreign' => array( |
---|
| 329 | &$this->addresses['id_contact'], |
---|
| 330 | &$this->addresses['id_address'], |
---|
| 331 | &$this->addresses['id_typeof_contact_address'])), |
---|
| 332 | 'fields' => & $this->addresses), |
---|
| 333 | 'phpgw_cc_contact_conns' => array( |
---|
| 334 | 'type' => 'multi', |
---|
| 335 | 'keys' => array( |
---|
| 336 | 'primary' => array( |
---|
| 337 | &$this->connections['id_contact'], |
---|
| 338 | &$this->connections['id_connection']), |
---|
| 339 | 'foreign' => array( |
---|
| 340 | &$this->connections['id_contact'], |
---|
| 341 | &$this->connections['id_connection'], |
---|
| 342 | &$this->connections['id_typeof_contact_connection'])), |
---|
| 343 | 'fields' => & $this->connections)); |
---|
| 344 | |
---|
| 345 | |
---|
| 346 | if ($id_contact) |
---|
| 347 | { |
---|
| 348 | $this->id = $id_contact; |
---|
| 349 | if (!$this->checkout($id_contact)) |
---|
| 350 | { |
---|
| 351 | $this->reset_values(); |
---|
| 352 | $this->state = 'new'; |
---|
| 353 | } |
---|
[503] | 354 | $temp = $this->db_tables; |
---|
| 355 | |
---|
| 356 | $this->db_tables = array(); //Limpo o array para fazer checkout apenas dos contatos relacionados |
---|
| 357 | $this->db_tables['phpgw_cc_contact_rels'] = array( |
---|
| 358 | 'type' => 'multi', |
---|
| 359 | 'keys' => array( |
---|
| 360 | 'primary' => array( |
---|
| 361 | &$this->relateds['id_related']), |
---|
| 362 | &$this->relateds['id_contact'], |
---|
| 363 | 'foreign' => array( |
---|
| 364 | &$this->relateds['id_related'])), |
---|
| 365 | &$this->relateds['id_contact'], |
---|
| 366 | 'fields' => & $this->relateds); |
---|
| 367 | if (!$this->checkout($id_contact)) |
---|
| 368 | { |
---|
| 369 | $this->reset_values(); |
---|
| 370 | $this->state = 'new'; |
---|
| 371 | } |
---|
| 372 | $this->db_tables = $temp; //Coloco o valor do array antigo. |
---|
[2] | 373 | } |
---|
| 374 | else |
---|
| 375 | { |
---|
| 376 | $this->state = 'new'; |
---|
| 377 | } |
---|
| 378 | |
---|
| 379 | } |
---|
| 380 | |
---|
| 381 | /*********************************************************************\ |
---|
| 382 | * Methods to Obtain Data * |
---|
| 383 | \*********************************************************************/ |
---|
| 384 | |
---|
| 385 | /*! |
---|
| 386 | |
---|
| 387 | @function get_photo |
---|
| 388 | @abstract Returns the Contact's photo binary string |
---|
| 389 | @author Raphael Derosso Pereira |
---|
| 390 | |
---|
| 391 | */ |
---|
| 392 | function get_photo ( ) |
---|
| 393 | { |
---|
| 394 | return $this->main_fields['photo']['value']; |
---|
| 395 | } |
---|
| 396 | |
---|
| 397 | /*! |
---|
| 398 | |
---|
| 399 | @function get_alias |
---|
| 400 | @abstract Returns the Contact alias |
---|
| 401 | @author Raphael Derosso Pereira |
---|
| 402 | |
---|
| 403 | */ |
---|
| 404 | function get_alias ( ) |
---|
| 405 | { |
---|
| 406 | return $this->main_fields['alias']['value']; |
---|
| 407 | } |
---|
| 408 | |
---|
| 409 | /*! |
---|
| 410 | |
---|
| 411 | @function get_prefix |
---|
| 412 | @abstract Returns the Contact prefix ID |
---|
| 413 | @author Raphael Derosso Pereira |
---|
| 414 | |
---|
| 415 | */ |
---|
| 416 | function get_prefix ( ) |
---|
| 417 | { |
---|
| 418 | return $this->main_fields['id_prefix']['value']; |
---|
| 419 | } |
---|
| 420 | |
---|
| 421 | /*! |
---|
| 422 | |
---|
| 423 | @function get_given_names |
---|
| 424 | @abstract Returns the Contact's given names |
---|
| 425 | @author Raphael Derosso Pereira |
---|
| 426 | |
---|
| 427 | */ |
---|
| 428 | function get_given_names ( ) |
---|
| 429 | { |
---|
| 430 | return $this->main_fields['given_names']['value']; |
---|
| 431 | } |
---|
| 432 | |
---|
| 433 | /*! |
---|
| 434 | |
---|
| 435 | @function get_family_names |
---|
| 436 | @abstract Returns the Contact's family names |
---|
| 437 | @author Raphael Derosso Pereira |
---|
| 438 | |
---|
| 439 | */ |
---|
| 440 | function get_family_names ( ) |
---|
| 441 | { |
---|
| 442 | return $this->main_fields['family_names']['value']; |
---|
| 443 | } |
---|
| 444 | |
---|
| 445 | /*! |
---|
| 446 | |
---|
| 447 | @function get_names_ordered |
---|
| 448 | @abstract Returns the Contact's names ordered |
---|
| 449 | @author Raphael Derosso Pereira |
---|
| 450 | |
---|
| 451 | */ |
---|
| 452 | function get_names_ordered ( ) |
---|
| 453 | { |
---|
| 454 | return $this->main_fields['names_ordered']['value']; |
---|
| 455 | } |
---|
| 456 | |
---|
| 457 | /*! |
---|
| 458 | |
---|
| 459 | @function get_suffix |
---|
| 460 | @abstract Returns the Contact's suffix |
---|
| 461 | @author Raphael Derosso Pereira |
---|
| 462 | |
---|
| 463 | */ |
---|
| 464 | function get_suffix ( ) |
---|
| 465 | { |
---|
| 466 | return $this->main_fields['id_suffix']['value']; |
---|
| 467 | } |
---|
| 468 | |
---|
| 469 | /*! |
---|
| 470 | |
---|
| 471 | @function get_birthdate |
---|
| 472 | @abstract Returns the Contact's birthdata |
---|
| 473 | @author Raphael Derosso Pereira |
---|
| 474 | |
---|
| 475 | */ |
---|
| 476 | function get_birthdate ( ) |
---|
| 477 | { |
---|
| 478 | return $this->main_fields['birthdate']['value']; |
---|
| 479 | } |
---|
| 480 | |
---|
| 481 | /*! |
---|
| 482 | |
---|
| 483 | @function get_sex |
---|
| 484 | @abstract Returns the Contact's sex |
---|
| 485 | @author Raphael Derosso Pereira |
---|
| 486 | |
---|
| 487 | */ |
---|
| 488 | function get_sex ( ) |
---|
| 489 | { |
---|
| 490 | return $this->main_fields['sex']['value']; |
---|
| 491 | } |
---|
| 492 | |
---|
| 493 | /*! |
---|
| 494 | |
---|
| 495 | @function get_pgp_key |
---|
| 496 | @abstract Returns the Contact's PGP Key |
---|
| 497 | @author Raphael Derosso Pereira |
---|
| 498 | |
---|
| 499 | */ |
---|
| 500 | function get_pgp_key ( ) |
---|
| 501 | { |
---|
| 502 | return $this->main_fields['pgp_key']['value']; |
---|
| 503 | } |
---|
| 504 | |
---|
| 505 | /*! |
---|
| 506 | |
---|
| 507 | @function get_notes |
---|
| 508 | @abstract Returns the Contact's notes |
---|
| 509 | @author Raphael Derosso Pereira |
---|
| 510 | |
---|
| 511 | */ |
---|
| 512 | function get_notes ( ) |
---|
| 513 | { |
---|
| 514 | return $this->main_fields['notes']['value']; |
---|
| 515 | } |
---|
| 516 | |
---|
| 517 | /*! |
---|
| 518 | |
---|
| 519 | @function get_status |
---|
| 520 | @abstract Returns the Contact's status ID |
---|
| 521 | @author Raphael Derosso Pereira |
---|
| 522 | |
---|
| 523 | */ |
---|
| 524 | function get_status ( ) |
---|
| 525 | { |
---|
| 526 | return $this->main_fields['status']['value']; |
---|
| 527 | } |
---|
| 528 | |
---|
| 529 | /*! |
---|
| 530 | |
---|
| 531 | @function get_relations |
---|
| 532 | @abstract Returns the Contact's Relations |
---|
| 533 | @author Raphael Derosso Pereira |
---|
| 534 | |
---|
| 535 | @return array Format: |
---|
| 536 | $return = array( |
---|
| 537 | '<id_related1>' => '<id_relation1_type>', |
---|
| 538 | '<id_related2>' => '<id_relation2_type>', |
---|
| 539 | ...); |
---|
| 540 | */ |
---|
| 541 | function get_relations ( ) |
---|
| 542 | { |
---|
| 543 | $return = array(); |
---|
| 544 | |
---|
| 545 | reset($this->relations['id_related']['values']); |
---|
| 546 | reset($this->relations['id_typeof_contact_relation']['values']); |
---|
| 547 | while(list(,$id_related) = each($this->relations['id_related']['values']) and |
---|
| 548 | list(,$id_relation_type) = each($this->relations['id_typeof_contact_relation']['values'])) |
---|
| 549 | { |
---|
| 550 | $return[$id_related] = $id_relation_type; |
---|
| 551 | } |
---|
| 552 | |
---|
| 553 | return $return; |
---|
| 554 | } |
---|
| 555 | |
---|
[503] | 556 | function get_relateds() { |
---|
| 557 | $return = array(); |
---|
| 558 | |
---|
| 559 | reset($this->relateds['id_contact']['values']); |
---|
| 560 | reset($this->relateds['id_typeof_contact_relation']['values']); |
---|
| 561 | while(list(,$id_relation) = each($this->relateds['id_contact']['values']) and |
---|
| 562 | list(,$id_relation_type) = each($this->relateds['id_typeof_contact_relation']['values'])) |
---|
| 563 | { |
---|
| 564 | $return[$id_relation] = $id_relation_type; |
---|
| 565 | } |
---|
| 566 | return $return; |
---|
| 567 | } |
---|
| 568 | |
---|
[2] | 569 | /*! |
---|
| 570 | |
---|
| 571 | @function get_addresses |
---|
| 572 | @abstract Returns the Contact's Addresses |
---|
| 573 | @author Raphael Derosso Pereira |
---|
| 574 | |
---|
| 575 | @return array Format: |
---|
| 576 | $return = array( |
---|
| 577 | '<id_address1>' => '<id_address1_type>', |
---|
| 578 | '<id_address2>' => '<id_address2_type>', |
---|
| 579 | ...); |
---|
| 580 | */ |
---|
| 581 | function get_addresses ( ) |
---|
| 582 | { |
---|
| 583 | $return = array(); |
---|
| 584 | |
---|
| 585 | reset($this->addresses['id_address']['values']); |
---|
| 586 | reset($this->addresses['id_typeof_contact_address']['values']); |
---|
| 587 | while(list(,$id_address) = each($this->addresses['id_address']['values']) and |
---|
| 588 | list(,$id_address_type) = each($this->addresses['id_typeof_contact_address']['values'])) |
---|
| 589 | { |
---|
| 590 | $return[$id_address] = $id_address_type; |
---|
| 591 | } |
---|
| 592 | |
---|
| 593 | return $return; |
---|
| 594 | } |
---|
| 595 | |
---|
| 596 | /*! |
---|
| 597 | |
---|
| 598 | @function get_connections |
---|
| 599 | @abstract Returns the Contact's Connections |
---|
| 600 | @author Raphael Derosso Pereira |
---|
| 601 | |
---|
| 602 | @return array Format: |
---|
| 603 | $return = array( |
---|
| 604 | '<id_connection1>' => '<id_connection1_type>', |
---|
| 605 | '<id_connection2>' => '<id_connection2_type>', |
---|
| 606 | ...); |
---|
| 607 | */ |
---|
| 608 | function get_connections ( ) |
---|
| 609 | { |
---|
| 610 | $return = array(); |
---|
| 611 | |
---|
| 612 | reset($this->connections['id_connection']['values']); |
---|
| 613 | reset($this->connections['id_typeof_contact_connection']['values']); |
---|
| 614 | while(list(,$id_connection) = each($this->connections['id_connection']['values']) and |
---|
| 615 | list(,$id_connection_type) = each($this->connections['id_typeof_contact_connection']['values'])) |
---|
| 616 | { |
---|
| 617 | $return[$id_connection] = $id_connection_type; |
---|
| 618 | } |
---|
| 619 | |
---|
| 620 | return $return; |
---|
| 621 | } |
---|
| 622 | |
---|
| 623 | /*! |
---|
| 624 | |
---|
| 625 | @function get_companies |
---|
| 626 | @abstract Returns the Contact's Companies IDs and |
---|
| 627 | bussiness info |
---|
| 628 | @author Raphael Derosso Pereira |
---|
| 629 | |
---|
| 630 | @return array Format: |
---|
| 631 | $return = array( |
---|
| 632 | '<id_company1>' => array( |
---|
| 633 | 'title' => '<title>', |
---|
| 634 | 'department' => '<department>' |
---|
| 635 | ), |
---|
| 636 | '<id_company2>' => array( |
---|
| 637 | 'title' => '<title>', |
---|
| 638 | 'department' => '<department>' |
---|
| 639 | ), |
---|
| 640 | ... |
---|
| 641 | ); |
---|
| 642 | |
---|
| 643 | */ |
---|
| 644 | function get_companies ( ) |
---|
| 645 | { |
---|
| 646 | $return = array(); |
---|
| 647 | |
---|
| 648 | reset($this->companies['id_company']['values']); |
---|
| 649 | reset($this->companies['title']['values']); |
---|
| 650 | reset($this->companies['department']['values']); |
---|
| 651 | reset($this->companies['default_company']['values']); |
---|
| 652 | reset($this->companies['default_contact']['values']); |
---|
| 653 | while(list(,$id_company) = each($this->companies['id_company']['values']) and |
---|
| 654 | list(,$title) = each($this->companies['title']['values']) and |
---|
| 655 | list(,$department) = each($this->companies['department']['values']) and |
---|
| 656 | list(,$default_company) = each($this->companies['default_company']['values']) and |
---|
| 657 | list(,$default_contact) = each($this->companies['default_contact']['values'])) |
---|
| 658 | { |
---|
| 659 | $return[$id_company] = array( |
---|
| 660 | 'title' => $title, |
---|
| 661 | 'department' => $department, |
---|
| 662 | 'default_company' => $default_company, |
---|
| 663 | 'default_contact' => $default_contact, |
---|
| 664 | ); |
---|
| 665 | } |
---|
| 666 | |
---|
| 667 | return $return; |
---|
| 668 | } |
---|
| 669 | |
---|
| 670 | /*********************************************************************\ |
---|
| 671 | * Methods to Alter Data * |
---|
| 672 | \*********************************************************************/ |
---|
| 673 | |
---|
| 674 | |
---|
| 675 | /*! |
---|
| 676 | |
---|
| 677 | @function set_photo |
---|
| 678 | @abstract Sets the Contact's Photo binary string |
---|
| 679 | @author Raphael Derosso Pereira |
---|
| 680 | @param string $photo The binary photo string |
---|
| 681 | |
---|
| 682 | */ |
---|
| 683 | function set_photo ( $photo ) |
---|
| 684 | { |
---|
| 685 | $this->main_fields['photo']['value'] = $photo; |
---|
| 686 | $this->manage_fields($this->main_fields['photo'], 'changed'); |
---|
| 687 | } |
---|
| 688 | |
---|
| 689 | /*! |
---|
| 690 | |
---|
| 691 | @function set_alias |
---|
| 692 | @abstract Sets the Contact's Alias |
---|
| 693 | @author Raphael Derosso Pereira |
---|
| 694 | @param string $alias The new Contact alias |
---|
| 695 | |
---|
| 696 | */ |
---|
| 697 | function set_alias ( $alias ) |
---|
| 698 | { |
---|
| 699 | $this->main_fields['alias']['value'] = $alias; |
---|
| 700 | $this->manage_fields($this->main_fields['alias'], 'changed'); |
---|
| 701 | } |
---|
| 702 | |
---|
| 703 | /*! |
---|
| 704 | |
---|
| 705 | @function set_id_prefix |
---|
| 706 | @abstract Sets the Contact's Prefix |
---|
| 707 | @author Raphael Derosso Pereira |
---|
| 708 | @param string $id_prefix The new Contact prefix ID |
---|
| 709 | |
---|
| 710 | */ |
---|
| 711 | function set_id_prefix ( $id_prefix ) |
---|
| 712 | { |
---|
| 713 | $this->main_fields['prefix']['value'] = $id_prefix; |
---|
| 714 | $this->manage_fields($this->main_fields['prefix'], 'changed'); |
---|
| 715 | } |
---|
| 716 | |
---|
| 717 | /*! |
---|
| 718 | |
---|
| 719 | @function set_given_names |
---|
| 720 | @abstract Sets the Contact's Given Names |
---|
| 721 | @author Raphael Derosso Pereira |
---|
| 722 | @param string $names The new Contact's Given Names |
---|
| 723 | |
---|
| 724 | */ |
---|
| 725 | function set_given_names ( $names ) |
---|
| 726 | { |
---|
| 727 | $this->main_fields['given_names']['value'] = $names; |
---|
| 728 | $this->manage_fields($this->main_fields['given_names'], 'changed'); |
---|
| 729 | } |
---|
| 730 | |
---|
| 731 | /*! |
---|
| 732 | |
---|
| 733 | @function set_family_names |
---|
| 734 | @abstract Sets the Contact's Family Names |
---|
| 735 | @author Raphael Derosso Pereira |
---|
| 736 | @param string $names The new Contact's Family Names |
---|
| 737 | |
---|
| 738 | */ |
---|
| 739 | function set_family_names ( $names ) |
---|
| 740 | { |
---|
| 741 | $this->main_fields['family_names']['value'] = $names; |
---|
| 742 | $this->manage_fields($this->main_fields['family_names'], 'changed'); |
---|
| 743 | } |
---|
| 744 | |
---|
| 745 | /*! |
---|
| 746 | |
---|
| 747 | @function set_names_ordered |
---|
| 748 | @abstract Sets the Contact's Names Ordered |
---|
| 749 | @author Raphael Derosso Pereira |
---|
| 750 | @param string $names The new Contact's Names Ordered |
---|
| 751 | |
---|
| 752 | */ |
---|
| 753 | function set_names_ordered ( $names ) |
---|
| 754 | { |
---|
| 755 | $this->main_fields['names_ordered']['value'] = $names; |
---|
| 756 | $this->manage_fields($this->main_fields['names_ordered'], 'changed'); |
---|
| 757 | } |
---|
| 758 | |
---|
| 759 | /*! |
---|
| 760 | |
---|
| 761 | @function set_id_suffix |
---|
| 762 | @abstract Sets the Contact's Sulfix |
---|
| 763 | @author Raphael Derosso Pereira |
---|
| 764 | @param string $id_suffix The new Contact's Sulfix |
---|
| 765 | |
---|
| 766 | */ |
---|
| 767 | function set_id_suffix ( $id_suffix ) |
---|
| 768 | { |
---|
| 769 | $this->main_fields['suffix']['value'] = $names; |
---|
| 770 | $this->manage_fields($this->main_fields['suffix'], 'changed'); |
---|
| 771 | } |
---|
| 772 | |
---|
| 773 | /*! |
---|
| 774 | |
---|
| 775 | @function set_birthdate |
---|
| 776 | @abstract Sets the Contact's Birthdate |
---|
| 777 | @author Raphael Derosso Pereira |
---|
| 778 | @param string $date The new Contact's Birthdate |
---|
| 779 | |
---|
| 780 | */ |
---|
| 781 | function set_birthdate ( $date ) |
---|
| 782 | { |
---|
| 783 | $this->main_fields['birthdate']['value'] = $names; |
---|
| 784 | $this->manage_fields($this->main_fields['birthdate'], 'changed'); |
---|
| 785 | } |
---|
| 786 | |
---|
| 787 | /*! |
---|
| 788 | |
---|
| 789 | @function set_sex |
---|
| 790 | @abstract Sets the Contact's Sex |
---|
| 791 | @author Raphael Derosso Pereira |
---|
| 792 | @param string $sex The new Contact's Sex |
---|
| 793 | |
---|
| 794 | */ |
---|
| 795 | function set_sex ( $sex ) |
---|
| 796 | { |
---|
| 797 | $this->main_fields['birthdate']['value'] = $names; |
---|
| 798 | $this->manage_fields($this->main_fields['birthdate'], 'changed'); |
---|
| 799 | } |
---|
| 800 | |
---|
| 801 | /*! |
---|
| 802 | |
---|
| 803 | @function set_pgp_key |
---|
| 804 | @abstract Sets the Contact's PGP Key |
---|
| 805 | @author Raphael Derosso Pereira |
---|
| 806 | @param string $pgp_key The new Contact's PGP Key |
---|
| 807 | |
---|
| 808 | */ |
---|
| 809 | function set_pgp_key ( $pgp_key ) |
---|
| 810 | { |
---|
| 811 | $this->main_fields['birthdate']['value'] = $names; |
---|
| 812 | $this->manage_fields($this->main_fields['birthdate'], 'changed'); |
---|
| 813 | } |
---|
| 814 | |
---|
| 815 | /*! |
---|
| 816 | |
---|
| 817 | @function set_notes |
---|
| 818 | @abstract Sets the Contact's Notes |
---|
| 819 | @author Raphael Derosso Pereira |
---|
| 820 | @param string $notes The new Contact's Notes |
---|
| 821 | |
---|
| 822 | */ |
---|
| 823 | function set_notes ( $notes ) |
---|
| 824 | { |
---|
| 825 | $this->main_fields['birthdate']['value'] = $names; |
---|
| 826 | $this->manage_fields($this->main_fields['birthdate'], 'changed'); |
---|
| 827 | } |
---|
| 828 | |
---|
| 829 | /*! |
---|
| 830 | |
---|
| 831 | @function set_status |
---|
| 832 | @abstract Change the Contact's set Status |
---|
| 833 | @author Raphael Derosso Pereira |
---|
| 834 | @param integer $id_status The new Contact's set Status |
---|
| 835 | |
---|
| 836 | */ |
---|
| 837 | function set_id_status ( $id_status ) |
---|
| 838 | { |
---|
| 839 | $this->main_fields['id_status']['value'] = $names; |
---|
| 840 | $this->manage_fields($this->main_fields['id_status'], 'changed'); |
---|
| 841 | } |
---|
| 842 | |
---|
| 843 | /*! |
---|
| 844 | |
---|
| 845 | @function set_relation |
---|
| 846 | @abstract Sets the Contact's Relation |
---|
| 847 | @author Raphael Derosso Pereira |
---|
| 848 | @param integer $id_related The new Contact's Relation type ID |
---|
| 849 | @param integer $id_type The new Contact's Relation ID |
---|
| 850 | |
---|
| 851 | */ |
---|
| 852 | function set_relation ( $id_related, $id_type ) |
---|
| 853 | { |
---|
| 854 | if (($pos = array_search($id_related, $this->relations['id_related']['values'])) !== false) |
---|
| 855 | { |
---|
| 856 | $this->relations['id_typeof_contact_relation']['values'][$pos] = $id_type; |
---|
| 857 | $this->manage_fields($this->relations['id_typeof_contact_relation'], 'changed', $pos); |
---|
| 858 | |
---|
| 859 | return; |
---|
| 860 | } |
---|
| 861 | |
---|
| 862 | array_push($this->relations['id_contact']['values'], & $this->id); |
---|
| 863 | array_push($this->relations['id_related']['values'], $id_related); |
---|
| 864 | array_push($this->relations['id_typeof_contact_relation']['values'], $id_type); |
---|
| 865 | |
---|
| 866 | $this->manage_fields($this->relations['id_typeof_contact_relation'], 'new', 'new'); |
---|
| 867 | $this->manage_fields($this->relations['id_related'], 'new', 'new'); |
---|
| 868 | $this->manage_fields($this->relations['id_contact'], 'new', 'new'); |
---|
| 869 | } |
---|
| 870 | |
---|
| 871 | /*! |
---|
[503] | 872 | @function set_related |
---|
| 873 | @abstract Sets the Contact's related |
---|
| 874 | @author Raphael Derosso Pereira |
---|
| 875 | @param integer $id_related The new Contact's Relation type ID |
---|
| 876 | @param integer $id_type The new Contact's Relation ID |
---|
| 877 | |
---|
| 878 | */ |
---|
| 879 | function set_relateds ( $relations , $id_type ) |
---|
| 880 | { |
---|
| 881 | $id = $this->id; |
---|
| 882 | $db = $GLOBALS['phpgw']->db; |
---|
| 883 | |
---|
| 884 | //Remove todos os contatos relacionados |
---|
| 885 | $query = "delete from phpgw_cc_contact_rels where id_related=$id and id_typeof_contact_relation=1"; |
---|
| 886 | |
---|
| 887 | if (!$db->query($query, __LINE__, __FILE__)) { |
---|
| 888 | return false; |
---|
| 889 | } |
---|
| 890 | foreach($relations as $id_relation) { |
---|
| 891 | $query = "insert into phpgw_cc_contact_rels (id_contact,id_related,id_typeof_contact_relation) values ($id_relation,$id,$id_type)"; |
---|
| 892 | |
---|
| 893 | if (!$db->query($query, __LINE__, __FILE__)) { |
---|
| 894 | return false; |
---|
| 895 | } |
---|
| 896 | } |
---|
| 897 | return true; |
---|
| 898 | } |
---|
| 899 | |
---|
| 900 | /*! |
---|
[2] | 901 | |
---|
| 902 | @function set_address |
---|
| 903 | @abstract Sets the Contact's Address |
---|
| 904 | @author Raphael Derosso Pereira |
---|
| 905 | @param integer $id_address The new Contact's Address ID |
---|
| 906 | @param integer $id_type The new Contact's Address type ID |
---|
| 907 | |
---|
| 908 | */ |
---|
| 909 | function set_address ( $id_address, $id_type ) |
---|
| 910 | { |
---|
| 911 | if (($pos = array_search($id_address, $this->addresses['id_address']['values'])) !== false) |
---|
| 912 | { |
---|
| 913 | $this->addresses['id_typeof_contact_address']['values'][$pos] = $id_type; |
---|
| 914 | $this->manage_fields($this->addresses['id_typeof_contact_address'], 'changed', $pos); |
---|
| 915 | |
---|
| 916 | return; |
---|
| 917 | } |
---|
| 918 | |
---|
| 919 | array_push($this->addresses['id_contact']['values'], & $this->id); |
---|
| 920 | array_push($this->addresses['id_address']['values'], $id_address); |
---|
| 921 | array_push($this->addresses['id_typeof_contact_address']['values'], $id_type); |
---|
| 922 | |
---|
| 923 | $this->manage_fields($this->addresses['id_typeof_contact_address'], 'new', 'new'); |
---|
| 924 | $this->manage_fields($this->addresses['id_address'], 'new', 'new'); |
---|
| 925 | $this->manage_fields($this->addresses['id_contact'], 'new', 'new'); |
---|
[503] | 926 | |
---|
[2] | 927 | } |
---|
| 928 | |
---|
| 929 | /*! |
---|
| 930 | |
---|
| 931 | @function set_connection |
---|
| 932 | @abstract Sets the Contact's Connection |
---|
| 933 | @author Raphael Derosso Pereira |
---|
| 934 | @param integer $id_connection The new Contact's Connection ID |
---|
| 935 | @param integer $id_type The new Contact's Connection type ID |
---|
| 936 | |
---|
| 937 | */ |
---|
| 938 | function set_connection ( $id_connection, $id_type ) |
---|
| 939 | { |
---|
| 940 | if (($pos = array_search($id_connection, $this->connections['id_connection']['values'])) !== false) |
---|
| 941 | { |
---|
| 942 | $this->connections['id_typeof_contact_connection']['values'][$pos] = $id_type; |
---|
| 943 | $this->manage_fields($this->connections['id_typeof_contact_connection'], 'changed', $pos); |
---|
| 944 | |
---|
| 945 | return; |
---|
| 946 | } |
---|
| 947 | |
---|
| 948 | array_push($this->connections['id_contact']['values'], & $this->id); |
---|
| 949 | array_push($this->connections['id_connection']['values'], $id_connection); |
---|
| 950 | array_push($this->connections['id_typeof_contact_connection']['values'], $id_type); |
---|
| 951 | |
---|
| 952 | $this->manage_fields($this->connections['id_typeof_contact_connection'], 'new', 'new'); |
---|
| 953 | $this->manage_fields($this->connections['id_connection'], 'new', 'new'); |
---|
| 954 | $this->manage_fields($this->connections['id_contact'], 'new', 'new'); |
---|
| 955 | } |
---|
| 956 | |
---|
| 957 | /*! |
---|
| 958 | |
---|
| 959 | @function set_company |
---|
| 960 | @abstract Sets the Contact's Company and bussiness information |
---|
| 961 | @author Raphael Derosso Pereira |
---|
| 962 | @param array $company_info The new Contact's Company Information |
---|
| 963 | |
---|
| 964 | */ |
---|
| 965 | function set_company ( $company_info ) |
---|
| 966 | { |
---|
| 967 | if (is_array($company_info)) |
---|
| 968 | { |
---|
| 969 | if (($pos = array_search($company_info['id_company'], $this->companies['id_company']['values'])) !== false) |
---|
| 970 | { |
---|
| 971 | $this->companies['title']['values'][$pos] = $company_info['title']; |
---|
| 972 | $this->companies['department']['values'][$pos] = $company_info['department']; |
---|
| 973 | $this->companies['default_company']['values'][$pos] = $company_info['default_company']; |
---|
| 974 | $this->companies['default_contact']['values'][$pos] = $company_info['default_contact']; |
---|
| 975 | |
---|
| 976 | $this->manage_fields($this->companies['title'], 'changed', $pos); |
---|
| 977 | $this->manage_fields($this->companies['department'], 'changed', $pos); |
---|
| 978 | $this->manage_fields($this->companies['default_company'], 'changed', $pos); |
---|
| 979 | $this->manage_fields($this->companies['default_contact'], 'changed', $pos); |
---|
| 980 | |
---|
| 981 | return true; |
---|
| 982 | } |
---|
| 983 | |
---|
| 984 | array_push($this->companies['id_contact']['values'], & $this->id); |
---|
| 985 | array_push($this->companies['id_company']['values'], $company_info['id_company']); |
---|
| 986 | array_push($this->companies['title']['values'], $company_info['title']); |
---|
| 987 | array_push($this->companies['department']['values'], $company_info['department']); |
---|
| 988 | array_push($this->companies['default_company']['values'], $company_info['default_company']); |
---|
| 989 | array_push($this->companies['default_contact']['values'], $company_info['default_contact']); |
---|
| 990 | |
---|
| 991 | $this->manage_fields($this->companies['id_company'], 'new', 'new'); |
---|
| 992 | $this->manage_fields($this->companies['id_contact'], 'new', 'new'); |
---|
| 993 | $this->manage_fields($this->companies['title'], 'new', 'new'); |
---|
| 994 | $this->manage_fields($this->companies['department'], 'new', 'new'); |
---|
| 995 | $this->manage_fields($this->companies['default_company'], 'new', 'new'); |
---|
| 996 | $this->manage_fields($this->companies['default_contact'], 'new', 'new'); |
---|
| 997 | |
---|
| 998 | return true; |
---|
| 999 | } |
---|
| 1000 | |
---|
| 1001 | return false; |
---|
| 1002 | } |
---|
| 1003 | |
---|
| 1004 | |
---|
| 1005 | /*********************************************************************\ |
---|
| 1006 | * Methods to Remove Data * |
---|
| 1007 | \*********************************************************************/ |
---|
| 1008 | |
---|
| 1009 | |
---|
| 1010 | /*! |
---|
| 1011 | |
---|
| 1012 | @function remove_relation |
---|
| 1013 | @abstract Remove one Contact's Relation |
---|
| 1014 | @author Raphael Derosso Pereira |
---|
| 1015 | @param integer $id_related The ID of the relation to be removed |
---|
| 1016 | |
---|
| 1017 | */ |
---|
| 1018 | function remove_relation ( $id_related ) |
---|
| 1019 | { |
---|
| 1020 | if (($pos = array_search($id_related, $this->relations['id_related']['values'])) !== false) |
---|
| 1021 | { |
---|
| 1022 | $this->manage_fields($this->relations['id_contact'], 'deleted', $pos); |
---|
| 1023 | $this->manage_fields($this->relations['id_related'], 'deleted', $pos); |
---|
| 1024 | $this->manage_fields($this->relations['id_typeof_contact_relation'], 'deleted', $pos); |
---|
| 1025 | |
---|
| 1026 | return true; |
---|
| 1027 | } |
---|
| 1028 | |
---|
| 1029 | return false; |
---|
| 1030 | } |
---|
| 1031 | |
---|
| 1032 | /*! |
---|
| 1033 | |
---|
| 1034 | @function remove_address |
---|
| 1035 | @abstract Remove one Contact's Address |
---|
| 1036 | @author Raphael Derosso Pereira |
---|
| 1037 | @param integer $id_address The ID of the address to be removed |
---|
| 1038 | |
---|
| 1039 | */ |
---|
| 1040 | function remove_address ( $id_address ) |
---|
| 1041 | { |
---|
| 1042 | if (($pos = array_search($id_address, $this->addresses['id_address']['values'])) !== false) |
---|
| 1043 | { |
---|
| 1044 | $this->manage_fields($this->addresses['id_contact'], 'deleted', $pos); |
---|
| 1045 | $this->manage_fields($this->addresses['id_address'], 'deleted', $pos); |
---|
| 1046 | $this->manage_fields($this->addresses['id_typeof_contact_address'], 'deleted', $pos); |
---|
| 1047 | |
---|
| 1048 | return true; |
---|
| 1049 | } |
---|
| 1050 | |
---|
| 1051 | return false; |
---|
| 1052 | } |
---|
| 1053 | |
---|
| 1054 | /*! |
---|
| 1055 | |
---|
| 1056 | @function remove_connection |
---|
| 1057 | @abstract Remove one Contact's Connection |
---|
| 1058 | @author Raphael Derosso Pereira |
---|
| 1059 | @param integer $id_connection The ID of the connection to be removed |
---|
| 1060 | |
---|
| 1061 | */ |
---|
| 1062 | function remove_connection ( $id_connection ) |
---|
| 1063 | { |
---|
| 1064 | if (($pos = array_search($id_connection, $this->connections['id_connection']['values'])) !== false) |
---|
| 1065 | { |
---|
| 1066 | $this->manage_fields($this->connections['id_contact'], 'deleted', $pos); |
---|
| 1067 | $this->manage_fields($this->connections['id_connection'], 'deleted', $pos); |
---|
| 1068 | $this->manage_fields($this->connections['id_typeof_contact_connection'], 'deleted', $pos); |
---|
| 1069 | |
---|
| 1070 | return true; |
---|
| 1071 | } |
---|
| 1072 | |
---|
| 1073 | return false; |
---|
| 1074 | } |
---|
| 1075 | |
---|
| 1076 | /*! |
---|
| 1077 | |
---|
| 1078 | @function remove_company |
---|
| 1079 | @abstract Remove one Contact's Company |
---|
| 1080 | @author Raphael Derosso Pereira |
---|
| 1081 | @param integer $id_company The ID of the compay to be removed |
---|
| 1082 | |
---|
| 1083 | */ |
---|
| 1084 | function remove_company ( $id_company ) |
---|
| 1085 | { |
---|
| 1086 | if (($pos = array_search($id_company, $this->companies['id_company']['values'])) !== false) |
---|
| 1087 | { |
---|
| 1088 | $this->manage_fields($this->companies['id_contact'], 'deleted', $pos); |
---|
| 1089 | $this->manage_fields($this->companies['id_company'], 'deleted', $pos); |
---|
| 1090 | $this->manage_fields($this->companies['title'], 'deleted', $pos); |
---|
| 1091 | $this->manage_fields($this->companies['department'], 'deleted', $pos); |
---|
| 1092 | |
---|
| 1093 | return true; |
---|
| 1094 | } |
---|
| 1095 | |
---|
| 1096 | return false; |
---|
| 1097 | } |
---|
| 1098 | |
---|
| 1099 | } |
---|
| 1100 | ?> |
---|