Helix Installation   Getting Started   Reference Documentation   Global Functions   Quick Start
ModulesClassesFunctions
 

Class Reference

class address extends address_ext

Hide Inherited MembersHelix Core
Description
No description.
 
Constants
constantTABLENAME ["cor_address"][ address ]
 
Properties
protected_cdate[ address_db ]
protected_cdate_dirty[ address_db ]
protected_city[ address_db ]
protected_city_dirty[ address_db ]
protected_country_id[ address_db ]
protected_country_id_dirty[ address_db ]
protected_deleted[ address_db ]
protected_deleted_dirty[ address_db ]
protected_dirty[ obj ]
protected_id[ address_db ]
protected_id_dirty[ address_db ]
protected_mdate[ address_db ]
protected_mdate_dirty[ address_db ]
protected_name[ address_db ]
protected_name_dirty[ address_db ]
protected_postal_code[ address_db ]
protected_postal_code_dirty[ address_db ]
publicproperty_objects_array[ obj ]
protected_province[ address_db ]
protected_province_dirty[ address_db ]
protected_state_id[ address_db ]
protected_state_id_dirty[ address_db ]
 
Methods
publiccommit ( )[ address_db ]
Parameters
No parameters for this method
Code
116  public function commit()
117  {
118      if ($this->_id > 0)
119      {
120          $this->update();
121      }
122      else
123      {
124          $this->insert();
125      }
126 
127      foreach ($this->property_objects_array as $property=>$object)
128      {
129          $this->{$property} = $object;
130      }
131 
132      return true;
133  }
public__construct ( id )[ address_db ]
Parameters
optionalid
Code
050  public function __construct($__id=null)
051  {
052      $this->_id = 0;
053      $this->_name = "";
054      $this->_city = "";
055      $this->_province = "";
056      $this->_state_id = 0;
057      $this->_postal_code = "";
058      $this->_country_id = 0;
059      $this->_mdate = null;
060      $this->_cdate = null;
061      $this->_deleted = false;
062 
063      $this->_id_dirty = false;
064      $this->_name_dirty = false;
065      $this->_city_dirty = false;
066      $this->_province_dirty = false;
067      $this->_state_id_dirty = false;
068      $this->_postal_code_dirty = false;
069      $this->_country_id_dirty = false;
070      $this->_mdate_dirty = false;
071      $this->_cdate_dirty = false;
072      $this->_deleted_dirty = false;
073 
074      if (is_null($__id))
075      {
076          return;
077      }
078 
079      $db = address::db();
080      $q  = " SELECT cor_address.id,cor_address.name,cor_address.city,cor_address.province,cor_address.state_id,cor_address.postal_code,cor_address.country_id,cor_address.mdate,cor_address.cdate,cor_address.deleted ";
081      $q .= " FROM cor_address ";       
082      if (!is_null($__id))
083      {
084          $q .= " WHERE id = '$__id' ";
085      }
086 
087      $db->query($q);
088      if ($db->next_record() && $db->num_rows() == 1)
089      {
090          $this->_id = $db->f("id");
091          $this->_name = $db->f("name");
092          $this->_city = $db->f("city");
093          $this->_province = $db->f("province");
094          $this->_state_id = $db->f("state_id");
095          $this->_postal_code = $db->f("postal_code");
096          $this->_country_id = $db->f("country_id");
097          $this->_mdate = $db->f("mdate");
098          $this->_cdate = $db->f("cdate");
099          $this->_deleted = $db->f("deleted");
100      }
101  }
protected staticdb ( )[ address_db ]
Parameters
No parameters for this method
Code
773  protected static function db()
774  {
775      return new db();
776  }
publicdelete ( )[ address_db ]
Parameters
No parameters for this method
Code
181  public function delete()
182  {
183      $db = address::db();
184      $q  = " UPDATE cor_address SET ";
185      $q .= " deleted = 1 ";
186      $q .= " WHERE id = " . $this->_id;
187      $db->query($q);
188      $this->deleted = true;
189      return true;
190  }
public staticdelete_all ( )[ address_db ]
Parameters
No parameters for this method
Code
289  public static function delete_all()
290  {
291      $db = address::db();
292      $q  = " UPDATE cor_address SET ";
293      $q .= " deleted = 1 ";
294     
295      $db->query($q);
296      return true;
297  }
public__get ( p )[ obj ]
Parameters
requiredp
Code
007  public function __get($p)
008  {
009      $methods = get_class_methods($this);
010      $properties = get_object_vars($this);
011      if (in_array("get_$p",$methods))
012      {
013          return $this->{"get_$p"}();
014      }
015      else if (array_key_exists("_$p",$properties))
016      {
017          return $this->{"_$p"};
018      }
019      else if (in_array("get_" . substr($p,strpos($p,"_")+1), $methods))
020      {
021          return $this->{"get_" . substr($p,strpos($p,"_")+1)}(substr($p,0,strpos($p,"_")));
022      }
023      else
024      {
025          trigger_error("This object [" . get_class($this) . ":$this->id] has no private property '_$p' for the requested public property '$p'",E_USER_WARNING);
026          return null;
027      }
028  }
publicget_addressline ( type ["default"] )[ address_db ]
Parameters
optionaltype ["default"]
Code
574  public function get_addressline($__type="default")
575  {
576      $object = is_null(keyval($this->property_objects_array,"{$__type}_addressline")) ? new addressline($this->get_addressline_id($__type)) : $this->property_objects_array["{$__type}_addressline"];
577      $this->property_objects_array["{$__type}_addressline"] = $object;
578      return $object;
579  }
publicget_addressline_id ( type ["default"] )[ address_db ]
Parameters
optionaltype ["default"]
Code
580  public function get_addressline_id($__type="default")
581  {
582      $ids = $this->get_addressline_ids($__type, true);
583      return (count($ids)==1 ? $ids[0] : null);
584  }
publicget_addressline_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ address_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
585  public function get_addressline_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
586  {
587      $addressline_ids = array();
588      $db = address::db();
589      $q  = " SELECT cor_addressline.id FROM cor_address_addressline INNER JOIN cor_addressline ON cor_address_addressline.addressline_id=cor_addressline.id AND cor_address_addressline.deleted=0 AND cor_addressline.deleted=0 AND cor_address_addressline.address_id='$this->id' " . (is_null($__type) ? "" : " AND cor_address_addressline.address_addressline_type_id='" . address_addressline::type_id($__type) . "'") . ($__get_primary ? " AND cor_address_addressline.primary=1 " : "");
590      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
591      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
592      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
593      $db->query($q);
594      while ($db->next_record())
595      {
596          $addressline_ids[] = $db->f("id");
597      }
598      return $addressline_ids;
599  }
publicget_addressline_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ address_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
600  public function get_addressline_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
601  {
602      $ids = $this->get_addressline_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
603      $objects = array();
604      foreach ($ids as $index=>$id)
605      {
606          $objects[$index] = new addressline($id);
607      }
608      return $objects;
609  }
publicget_array ( )[ obj ]
Parameters
No parameters for this method
Code
096  public function get_array()
097  {
098      return get_object_vars($this);
099  }
publicget_classname ( )[ obj ]
Parameters
No parameters for this method
Code
086  public function get_classname()
087  {
088      return get_class($this);
089  }
public staticget_columns ( columns , order , lookups , where_clause , limit , offset [0] )[ address_db ]
Parameters
requiredcolumns
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
212  public static function get_columns($__columns, $__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
213  {
214      $lookups = is_array($__lookups) ? $__lookups : array($__lookups);
215      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
216      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
217 
218      $db = address::db();
219      $data = array();
220      $q  = " SELECT $colstring ";
221      $q .= " FROM cor_address ";
222      $q .= " WHERE cor_address.deleted = 0 ";
223      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
224      $q .= array_key_exists("state_id",$lookups) ? " AND cor_address.state_id='" . $lookups["state_id"] . "' " : "";
225      $q .= array_key_exists("country_id",$lookups) ? " AND cor_address.country_id='" . $lookups["country_id"] . "' " : "";
226 
227      if (is_string($__order))
228      {
229          $q .= "ORDER BY " . $__order;
230      }
231      else if (is_array($__order) and count($__order)>0)
232      {
233          $orderings = array();
234          foreach ($__order as $col=>$dir)
235          {
236              $orderings[] = " $col $dir ";
237          }
238          $q .= "ORDER BY " . implode(", ", $orderings);
239      }
240      else if (is_object($__order))
241      {
242          $q .= "";
243      }
244      else
245      {
246          // THERE IS NO `order` COLUMN ON THIS OBJECT
247      }
248 
249      if (!is_null($__limit))
250      {
251          $q .= " LIMIT $__offset , $__limit ";
252      }
253 
254      $db->query($q);
255 
256      if (count($colarray)>1 || $colstring=="*")
257      {
258          while ($db->next_record())
259          {
260              $data[] = $db->record;
261          }
262      }
263      else
264      {
265          while ($db->next_record())
266          {
267              $data[] = $db->f(0);
268          }
269      }
270 
271      return $data;
272  }
publicget_country ( )[ address_db ]
Parameters
No parameters for this method
Code
364  public function get_country()
365  {
366      return new country($this->country_id);
367  }
publicget_creditcardaccount ( type ["default"] )[ address_db ]
Parameters
optionaltype ["default"]
Code
475  public function get_creditcardaccount($__type="default")
476  {
477      $object = is_null(keyval($this->property_objects_array,"{$__type}_creditcardaccount")) ? new creditcardaccount($this->get_creditcardaccount_id($__type)) : $this->property_objects_array["{$__type}_creditcardaccount"];
478      $this->property_objects_array["{$__type}_creditcardaccount"] = $object;
479      return $object;
480  }
publicget_creditcardaccount_id ( type ["default"] )[ address_db ]
Parameters
optionaltype ["default"]
Code
481  public function get_creditcardaccount_id($__type="default")
482  {
483      $ids = $this->get_creditcardaccount_ids($__type, true);
484      return (count($ids)==1 ? $ids[0] : null);
485  }
publicget_creditcardaccount_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ address_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
486  public function get_creditcardaccount_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
487  {
488      $creditcardaccount_ids = array();
489      $db = address::db();
490      $q  = " SELECT com_creditcardaccount.paymentaccount_id FROM com_address_creditcardaccount INNER JOIN com_creditcardaccount ON com_address_creditcardaccount.creditcardaccount_paymentaccount_id=com_creditcardaccount.paymentaccount_id AND com_address_creditcardaccount.deleted=0 AND com_creditcardaccount.deleted=0 AND com_address_creditcardaccount.address_id='$this->id' " . (is_null($__type) ? "" : " AND com_address_creditcardaccount.address_creditcardaccount_type_id='" . address_creditcardaccount::type_id($__type) . "'") . ($__get_primary ? " AND com_address_creditcardaccount.primary=1 " : "");
491      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
492      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
493      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
494      $db->query($q);
495      while ($db->next_record())
496      {
497          $creditcardaccount_ids[] = $db->f("paymentaccount_id");
498      }
499      return $creditcardaccount_ids;
500  }
publicget_creditcardaccount_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ address_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
501  public function get_creditcardaccount_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
502  {
503      $ids = $this->get_creditcardaccount_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
504      $objects = array();
505      foreach ($ids as $index=>$id)
506      {
507          $objects[$index] = new creditcardaccount($id);
508      }
509      return $objects;
510  }
publicget_dirty ( )[ obj ]
Parameters
No parameters for this method
Code
063  public function get_dirty()
064  {
065      if ($this->id === 0)
066      {
067          $this->_dirty = true;
068      }
069      else
070      {
071          foreach (get_object_vars($this) as $k=>$v)
072          {
073              if ($this->_dirty)
074              {
075                  break;
076              }
077              if (preg_match('/_dirty$/',$k))
078              {
079                  $this->_dirty = $this->_dirty || $v;
080              }
081          }
082      }
083      return $this->_dirty;
084  }
publicget_entity ( type ["default"] )[ address_db ]
Parameters
optionaltype ["default"]
Code
674  public function get_entity($__type="default")
675  {
676      $object = is_null(keyval($this->property_objects_array,"{$__type}_entity")) ? new entity($this->get_entity_id($__type)) : $this->property_objects_array["{$__type}_entity"];
677      $this->property_objects_array["{$__type}_entity"] = $object;
678      return $object;
679  }
publicget_entity_id ( type ["default"] )[ address_db ]
Parameters
optionaltype ["default"]
Code
680  public function get_entity_id($__type="default")
681  {
682      $ids = $this->get_entity_ids($__type, true);
683      return (count($ids)==1 ? $ids[0] : null);
684  }
publicget_entity_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ address_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
685  public function get_entity_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
686  {
687      $entity_ids = array();
688      $db = address::db();
689      $q  = " SELECT cor_entity.id FROM cor_address_entity INNER JOIN cor_entity ON cor_address_entity.entity_id=cor_entity.id AND cor_address_entity.deleted=0 AND cor_entity.deleted=0 AND cor_address_entity.address_id='$this->id' " . (is_null($__type) ? "" : " AND cor_address_entity.address_entity_type_id='" . address_entity::type_id($__type) . "'") . ($__get_primary ? " AND cor_address_entity.primary=1 " : "");
690      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
691      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
692      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
693      $db->query($q);
694      while ($db->next_record())
695      {
696          $entity_ids[] = $db->f("id");
697      }
698      return $entity_ids;
699  }
publicget_entity_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ address_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
700  public function get_entity_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
701  {
702      $ids = $this->get_entity_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
703      $objects = array();
704      foreach ($ids as $index=>$id)
705      {
706          $objects[$index] = new entity($id);
707      }
708      return $objects;
709  }
publicget_event ( type ["default"] )[ address_db ]
Parameters
optionaltype ["default"]
Code
376  public function get_event($__type="default")
377  {
378      $object = is_null(keyval($this->property_objects_array,"{$__type}_event")) ? new event($this->get_event_id($__type)) : $this->property_objects_array["{$__type}_event"];
379      $this->property_objects_array["{$__type}_event"] = $object;
380      return $object;
381  }
publicget_event_id ( type ["default"] )[ address_db ]
Parameters
optionaltype ["default"]
Code
382  public function get_event_id($__type="default")
383  {
384      $ids = $this->get_event_ids($__type, true);
385      return (count($ids)==1 ? $ids[0] : null);
386  }
publicget_event_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ address_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
387  public function get_event_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
388  {
389      $event_ids = array();
390      $db = address::db();
391      $q  = " SELECT cal_event.id FROM cal_address_event INNER JOIN cal_event ON cal_address_event.event_id=cal_event.id AND cal_address_event.deleted=0 AND cal_event.deleted=0 AND cal_address_event.address_id='$this->id' " . (is_null($__type) ? "" : " AND cal_address_event.address_event_type_id='" . address_event::type_id($__type) . "'") . ($__get_primary ? " AND cal_address_event.primary=1 " : "");
392      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
393      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
394      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
395      $db->query($q);
396      while ($db->next_record())
397      {
398          $event_ids[] = $db->f("id");
399      }
400      return $event_ids;
401  }
publicget_event_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ address_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
402  public function get_event_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
403  {
404      $ids = $this->get_event_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
405      $objects = array();
406      foreach ($ids as $index=>$id)
407      {
408          $objects[$index] = new event($id);
409      }
410      return $objects;
411  }
public staticget_ids ( order , lookups , where_clause , limit , offset [0] )[ address_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
274  public static function get_ids($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
275  {
276      return address::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset);
277  }
publicget_json ( )[ obj ]
Parameters
No parameters for this method
Code
101  public function get_json()
102  {
103      $class = new ReflectionClass($this->classname);
104      $methods = $class->getMethods();
105      usort($methods,"sort_reflection_objects");
106      $accessors = array();
107      foreach ($methods as $index=>$method)
108      {
109          $declarer = $method->getDeclaringClass()->name;
110          if (preg_match('/^(get|set|)_(.+)$/',$method->name,$matches))
111          {
112              $accessor = $matches[2];
113              $getset = $matches[1];
114              eval("\$accessors[\$accessor] = \$this->".$accessor.";");
115          }
116      }
117      //return json_encode($this->get_array());
118      return json_encode($accessors);
119  }
publicget_line1 ( )[ address_ext ]
Parameters
No parameters for this method
Code
007  public function get_line1()
008  {
009      return $this->line1_addressline->value;
010  }
publicget_line2 ( )[ address_ext ]
Parameters
No parameters for this method
Code
016  public function get_line2()
017  {
018      return $this->line2_addressline->value;
019  }
publicget_line3 ( )[ address_ext ]
Parameters
No parameters for this method
Code
025  public function get_line3()
026  {
027      return $this->line3_addressline->value;
028  }
public staticget_objects ( order , lookups , where_clause , limit , offset [0] )[ address_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
279  public static function get_objects($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
280  {
281      $objects = array();
282      foreach (address::get_columns("id", $__order, $__lookups, $__where_clause, $__limit, $__offset) as $id)
283      {
284          $objects[] = new address($id);
285      }
286      return $objects;
287  }
publicget_properties ( )[ obj ]
Parameters
No parameters for this method
Code
121  public function get_properties()
122  {
123      return array_keys($this->array);
124  }
publicget_single_line ( )[ address_ext ]
Parameters
No parameters for this method
Code
034  public function get_single_line()
035  {
036      $state = new state($this->state_id);
037      $country = new country($this->country_id);
038      $singleline="";
039      if(!is_null($this->line1))
040      {
041          $singleline = "\"". $this->line1."\"";
042      }
043      if(!is_null($this->line2))
044      {
045          $singleline .= ", \"" . $this->line2."\"";
046      }
047      if(!is_null($this->line3))
048      {
049          $singleline .= ", \"" . $this->line3."\"";
050      }
051      if($this->city<>"" && !is_null($this->city))
052      {
053          $singleline .= ", \"" . $this->city."\"";
054      }
055      if($state->id>0)
056      {
057          $singleline .= " \"" . $state."\"";
058      }
059      else if($this->province<>"" || !is_null($this->province))
060      {
061          $singleline .= " \"" . $this->province."\"";
062      }
063      if($country->id>0)
064      {
065          $singleline .= " \"" . $country."\"";
066      }
067      if($this->postal_code<>"" && !is_null($this->postal_code))
068      {
069          $singleline .= " \"" . $this->postal_code."\"";
070      }
071     
072      return $singleline;
073  }
publicget_state ( )[ address_db ]
Parameters
No parameters for this method
Code
352  public function get_state()
353  {
354      return new state($this->state_id);
355  }
protectedget_string ( )[ obj ]
Parameters
No parameters for this method
Code
091  protected function get_string()
092  {
093      return method_exists($this,"__toString") ? $this->__toString() : null;
094  }
protectedinsert ( )[ address_db ]
Parameters
No parameters for this method
Code
135  protected function insert()
136  {
137      $db = address::db();
138      $q  = " INSERT INTO cor_address ( ";
139      $q .= $db->param_string("name") . ", ";
140      $q .= $db->param_string("city") . ", ";
141      $q .= $db->param_string("province") . ", ";
142      $q .= $db->param_string("state_id") . ", ";
143      $q .= $db->param_string("postal_code") . ", ";
144      $q .= $db->param_string("country_id") . ", ";
145      $q .= $db->param_string("mdate") . ", ";
146      $q .= $db->param_string("cdate") . ", ";
147      $q .= $db->param_string("deleted");
148      $q .= " ) VALUES ( ";
149      $q .= $db->value_string($this->_name) . ", ";
150      $q .= $db->value_string($this->_city) . ", ";
151      $q .= $db->value_string($this->_province) . ", ";
152      $q .= $db->value_string($this->_state_id) . ", ";
153      $q .= $db->value_string($this->_postal_code) . ", ";
154      $q .= $db->value_string($this->_country_id) . ", ";
155      $q .= $db->value_string(timestamp()) . ", ";
156      $q .= $db->value_string(timestamp()) . ", ";
157      $q .= $this->deleted ? "'1'" : "'0'";
158      $q .= " ) ";
159      $db->query($q);
160      $this->_id = $db->insert_id;
161      return true;
162  }
publicmap ( )[ address_db ]
Parameters
No parameters for this method
Code
103  public function map()
104  {
105      $this->_name = array_key_exists("address:name",$_REQUEST) ? reqval("address:name") : $this->_name;
106      $this->_city = array_key_exists("address:city",$_REQUEST) ? reqval("address:city") : $this->_city;
107      $this->_province = array_key_exists("address:province",$_REQUEST) ? reqval("address:province") : $this->_province;
108      $this->_state_id = array_key_exists("address:state_id",$_REQUEST) ? reqval("address:state_id") : $this->_state_id;
109      $this->_postal_code = array_key_exists("address:postal_code",$_REQUEST) ? reqval("address:postal_code") : $this->_postal_code;
110      $this->_country_id = array_key_exists("address:country_id",$_REQUEST) ? reqval("address:country_id") : $this->_country_id;
111      $this->_mdate = array_key_exists("address:mdate",$_REQUEST) ? reqval("address:mdate") : $this->_mdate;
112      $this->_cdate = array_key_exists("address:cdate",$_REQUEST) ? reqval("address:cdate") : $this->_cdate;
113      $this->_deleted = array_key_exists("address:deleted",$_REQUEST) ? reqval("address:deleted") : $this->_deleted;
114  }
publicparselocation ( v )[ address_ext ]
Parameters
requiredv
Code
124  public function parselocation($__v)
125  {
126      //matches this string:"city" "state" "country" "zip" only
127      $pattern = '/\"[a-z0-9 ]+\"/i';
128      $parts=array();
129      preg_match_all($pattern, $__v, $parts);
130             
131      switch (count($parts[0])) {
132          case 0:
133              //setting to nothing, wipe this address
134              return false;
135          case 1:
136              //assume city
137              $this->city=str_replace("\"","",$parts[0][0]);
138              $this->commit();
139              break;
140          case 2:
141              //assume city
142              $this->city=str_replace("\"","",$parts[0][0]);
143              $state = new state(null,str_replace("\"","",$parts[0][1]));
144              if($state->id>0)
145              {
146                  $this->state_id = $state->id;
147              }
148              else
149              {
150                  $this->province = str_replace("\"","",$parts[0][1]);
151              }
152              $this->commit();
153              break;
154          case 3:
155              //assume city state zip
156              $this->city=str_replace("\"","",$parts[0][0]);
157              $state = new state(null,str_replace("\"","",$parts[0][1]));
158              if($state->id>0)
159              {
160                  $this->state_id = $state->id;
161              }
162              else
163              {
164                  $this->province = str_replace("\"","",$parts[0][1]);
165              }
166              $this->postal_code str_replace("\"","",$parts[0][2]);
167             
168              $this->commit();
169              return true;
170              break;
171          case 4:
172              //assume city state zip country
173              $this->city=str_replace("\"","",$parts[0][0]);
174              $state = new state(null,str_replace("\"","",$parts[0][1]));
175              if($state->id>0)
176              {
177                  $this->state_id = $state->id;
178              }
179              else
180              {
181                  $this->province = str_replace("\"","",$parts[0][1]);
182              }
183              $this->postal_code str_replace("\"","",$parts[0][2]);
184             
185              $tmp_country = str_replace("\"","",$parts[0][3]);
186              if(strlen($tmp_country)==2)
187              {
188                  $country = new country(null,$tmp_country);                   
189              }
190              else if(strlen($tmp_country)==3)
191              {
192                  $country = new country(null,null,$tmp_country);                   
193              }
194              else
195              {
196                  $country = new country(null,null,null,$tmp_country);                   
197              }
198              if($country->id>0)
199              {
200                  $this->country_id = $country->id;
201              }
202              else
203              {
204                  $this->country_id=0;
205              }
206              $this->commit();
207             
208              return true;
209              break;
210          default:
211              return false;
212      }
213      return true;
214  }
publicpurge ( )[ address_db ]
Parameters
No parameters for this method
Code
203  public function purge()
204  {
205      $db = address::db();
206      $q  = " DELETE FROM cor_address ";
207      $q .= " WHERE id = " . $this->_id;
208      $db->query($q);
209      return true;
210  }
public staticsearch ( keyword )[ address_db ]
public__set ( p , v )[ obj ]
Parameters
requiredp
requiredv
Code
030  public function __set($p,$v)
031  {
032      $methods = get_class_methods($this);
033      $properties = get_object_vars($this);
034      if (in_array("set_$p",$methods))
035      {
036          $this->{"set_$p"}($v);
037      }
038      else if (array_key_exists("_$p",$properties))
039      {
040          if (!preg_match('/_dirty$/',$p) && property_exists($this,"_{$p}_dirty"))
041          {
042              if (is_object($this->{"_$p"}))
043              {
044                  $this->{"_$p"}->dirty = true;
045              }
046              else
047              {
048                  $this->{"_{$p}_dirty"} = $this->{$p}==$v ? false : true;
049              }
050          }
051          $this->{"_$p"} = $v;
052      }
053      else if (in_array("set_" . substr($p,strpos($p,"_")+1), $methods))
054      {
055          $this->{"set_" . substr($p,strpos($p,"_")+1)}($v,substr($p,0,strpos($p,"_")));
056      }
057      else
058      {
059          trigger_error("This object [" . get_class($this) . ":$this->id] has no private property '_$p' for the requested public property '$p'",E_USER_WARNING);
060      }
061  }
publicset_addressline ( v , type ["default"] )[ address_db ]
Parameters
requiredv
optionaltype ["default"]
Code
611  public function set_addressline($__v, $__type="default")
612  {
613      $object = is_null(keyval($this->property_objects_array,"{$__type}_addressline")) ? new addressline($this->get_addressline_id($__type)) : $this->property_objects_array["{$__type}_addressline"];
614      if (is_null($__v))
615      {
616          $rel = new address_addressline(null,$this->id,$object->id,address_addressline::type_id($__type));
617          $rel->delete();
618          $object->delete();
619          if (!is_null(keyval($this->property_objects_array,"{$__type}_addressline")))
620          {
621              $this->property_objects_array["{$__type}_addressline"] = null;
622          }
623      }
624      else
625      {
626          $object->value = is_object($__v) ? $__v->value : $__v;
627          $object->commit();
628          $this->set_addressline_ids(array($object->id),$__type);
629      }
630  }
publicset_addressline_id ( v , type ["default"] )[ address_db ]
Parameters
requiredv
optionaltype ["default"]
Code
631  public function set_addressline_id($__v, $__type="default")
632  {
633      $this->set_addressline_ids(array($__v),$__type);
634  }
publicset_addressline_ids ( v , type ["default"] )[ address_db ]
Parameters
requiredv
optionaltype ["default"]
Code
635  public function set_addressline_ids($__v, $__type="default")
636  {
637      if ($this->id == 0)
638      {
639          $this->commit();
640      }
641      $type_id = address_addressline::type_id($__type);
642      address_addressline::delete_all($this->id,null,$type_id);
643      $order = 0;
644      if (is_array($__v))
645      {
646          foreach ($__v as $index=>$id)
647          {
648              $object = new address_addressline(null,$this->id,$id,$type_id);
649              $object->deleted = false;
650              $object->order = (++$order);
651              $object->address_addressline_type_id = $type_id;
652              $object->commit();
653              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_addressline")))
654              {
655                  $this->property_objects_array["{$__type}_addressline"] = new addressline($object->addressline_id);
656              }
657          }
658          $this->_dirty = true;
659      }
660  }
publicset_addressline_list ( v , type ["default"] )[ address_db ]
Parameters
requiredv
optionaltype ["default"]
Code
661  public function set_addressline_list($__v, $__type="default")
662  {
663      if (is_array($__v))
664      {
665          $ids = array();
666          foreach ($__v as $index=>$object)
667          {
668              $ids[] = $object->id;
669          }
670          $this->set_addressline_ids($ids,$__type);
671      }
672  }
publicset_country ( v )[ address_db ]
Parameters
requiredv
Code
368  public function set_country($v)
369  {
370      if ($v->id > 0)
371      {
372          $this->country_id = $v->id;
373      }
374  }
publicset_creditcardaccount ( v , type ["default"] )[ address_db ]
Parameters
requiredv
optionaltype ["default"]
Code
512  public function set_creditcardaccount($__v, $__type="default")
513  {
514      $object = is_null(keyval($this->property_objects_array,"{$__type}_creditcardaccount")) ? new creditcardaccount($this->get_creditcardaccount_id($__type)) : $this->property_objects_array["{$__type}_creditcardaccount"];
515      if (is_null($__v))
516      {
517          $rel = new address_creditcardaccount(null,$this->id,$object->id,address_creditcardaccount::type_id($__type));
518          $rel->delete();
519          if (!is_null(keyval($this->property_objects_array,"{$__type}_creditcardaccount")))
520          {
521              $this->property_objects_array["{$__type}_creditcardaccount"] = null;
522          }
523      }
524      else
525      {
526          $id = $object->id;
527          $object = $__v;
528          $object->id = $__v->id>0 ? $__v->id : $id;
529          $object->commit();
530          $this->set_creditcardaccount_ids(array($object->id),$__type);
531      }
532  }
publicset_creditcardaccount_id ( v , type ["default"] )[ address_db ]
Parameters
requiredv
optionaltype ["default"]
Code
533  public function set_creditcardaccount_id($__v, $__type="default")
534  {
535      $this->set_creditcardaccount_ids(array($__v),$__type);
536  }
publicset_creditcardaccount_ids ( v , type ["default"] )[ address_db ]
Parameters
requiredv
optionaltype ["default"]
Code
537  public function set_creditcardaccount_ids($__v, $__type="default")
538  {
539      if ($this->id == 0)
540      {
541          $this->commit();
542      }
543      $type_id = address_creditcardaccount::type_id($__type);
544      address_creditcardaccount::delete_all($this->id,null,$type_id);
545      if (is_array($__v))
546      {
547          foreach ($__v as $index=>$id)
548          {
549              $object = new address_creditcardaccount(null,$this->id,$id,$type_id);
550              $object->deleted = false;
551              $object->address_creditcardaccount_type_id = $type_id;
552              $object->commit();
553              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_creditcardaccount")))
554              {
555                  $this->property_objects_array["{$__type}_creditcardaccount"] = new creditcardaccount($object->creditcardaccount_id);
556              }
557          }
558          $this->_dirty = true;
559      }
560  }
publicset_creditcardaccount_list ( v , type ["default"] )[ address_db ]
Parameters
requiredv
optionaltype ["default"]
Code
561  public function set_creditcardaccount_list($__v, $__type="default")
562  {
563      if (is_array($__v))
564      {
565          $ids = array();
566          foreach ($__v as $index=>$object)
567          {
568              $ids[] = $object->id;
569          }
570          $this->set_creditcardaccount_ids($ids,$__type);
571      }
572  }
publicset_entity ( v , type ["default"] )[ address_db ]
Parameters
requiredv
optionaltype ["default"]
Code
711  public function set_entity($__v, $__type="default")
712  {
713      $object = is_null(keyval($this->property_objects_array,"{$__type}_entity")) ? new entity($this->get_entity_id($__type)) : $this->property_objects_array["{$__type}_entity"];
714      if (is_null($__v))
715      {
716          $rel = new address_entity(null,$this->id,$object->id,address_entity::type_id($__type));
717          $rel->delete();
718          if (!is_null(keyval($this->property_objects_array,"{$__type}_entity")))
719          {
720              $this->property_objects_array["{$__type}_entity"] = null;
721          }
722      }
723      else
724      {
725          $id = $object->id;
726          $object = $__v;
727          $object->id = $__v->id>0 ? $__v->id : $id;
728          $object->commit();
729          $this->set_entity_ids(array($object->id),$__type);
730      }
731  }
publicset_entity_id ( v , type ["default"] )[ address_db ]
Parameters
requiredv
optionaltype ["default"]
Code
732  public function set_entity_id($__v, $__type="default")
733  {
734      $this->set_entity_ids(array($__v),$__type);
735  }
publicset_entity_ids ( v , type ["default"] )[ address_db ]
Parameters
requiredv
optionaltype ["default"]
Code
736  public function set_entity_ids($__v, $__type="default")
737  {
738      if ($this->id == 0)
739      {
740          $this->commit();
741      }
742      $type_id = address_entity::type_id($__type);
743      address_entity::delete_all($this->id,null,$type_id);
744      if (is_array($__v))
745      {
746          foreach ($__v as $index=>$id)
747          {
748              $object = new address_entity(null,$this->id,$id,$type_id);
749              $object->deleted = false;
750              $object->address_entity_type_id = $type_id;
751              $object->commit();
752              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_entity")))
753              {
754                  $this->property_objects_array["{$__type}_entity"] = new entity($object->entity_id);
755              }
756          }
757          $this->_dirty = true;
758      }
759  }
publicset_entity_list ( v , type ["default"] )[ address_db ]
Parameters
requiredv
optionaltype ["default"]
Code
760  public function set_entity_list($__v, $__type="default")
761  {
762      if (is_array($__v))
763      {
764          $ids = array();
765          foreach ($__v as $index=>$object)
766          {
767              $ids[] = $object->id;
768          }
769          $this->set_entity_ids($ids,$__type);
770      }
771  }
publicset_event ( v , type ["default"] )[ address_db ]
Parameters
requiredv
optionaltype ["default"]
Code
413  public function set_event($__v, $__type="default")
414  {
415      $object = is_null(keyval($this->property_objects_array,"{$__type}_event")) ? new event($this->get_event_id($__type)) : $this->property_objects_array["{$__type}_event"];
416      if (is_null($__v))
417      {
418          $rel = new address_event(null,$this->id,$object->id,address_event::type_id($__type));
419          $rel->delete();
420          if (!is_null(keyval($this->property_objects_array,"{$__type}_event")))
421          {
422              $this->property_objects_array["{$__type}_event"] = null;
423          }
424      }
425      else
426      {
427          $id = $object->id;
428          $object = $__v;
429          $object->id = $__v->id>0 ? $__v->id : $id;
430          $object->commit();
431          $this->set_event_ids(array($object->id),$__type);
432      }
433  }
publicset_event_id ( v , type ["default"] )[ address_db ]
Parameters
requiredv
optionaltype ["default"]
Code
434  public function set_event_id($__v, $__type="default")
435  {
436      $this->set_event_ids(array($__v),$__type);
437  }
publicset_event_ids ( v , type ["default"] )[ address_db ]
Parameters
requiredv
optionaltype ["default"]
Code
438  public function set_event_ids($__v, $__type="default")
439  {
440      if ($this->id == 0)
441      {
442          $this->commit();
443      }
444      $type_id = address_event::type_id($__type);
445      address_event::delete_all($this->id,null,$type_id);
446      if (is_array($__v))
447      {
448          foreach ($__v as $index=>$id)
449          {
450              $object = new address_event(null,$this->id,$id,$type_id);
451              $object->deleted = false;
452              $object->address_event_type_id = $type_id;
453              $object->commit();
454              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_event")))
455              {
456                  $this->property_objects_array["{$__type}_event"] = new event($object->event_id);
457              }
458          }
459          $this->_dirty = true;
460      }
461  }
publicset_event_list ( v , type ["default"] )[ address_db ]
Parameters
requiredv
optionaltype ["default"]
Code
462  public function set_event_list($__v, $__type="default")
463  {
464      if (is_array($__v))
465      {
466          $ids = array();
467          foreach ($__v as $index=>$object)
468          {
469              $ids[] = $object->id;
470          }
471          $this->set_event_ids($ids,$__type);
472      }
473  }
publicset_line1 ( v )[ address_ext ]
Parameters
requiredv
Code
011  public function set_line1($v)
012  {
013      $this->line1_addressline = $v;
014  }
publicset_line2 ( v )[ address_ext ]
Parameters
requiredv
Code
020  public function set_line2($v)
021  {
022      $this->line2_addressline = $v;
023  }
publicset_line3 ( v )[ address_ext ]
Parameters
requiredv
Code
029  public function set_line3($v)
030  {
031      $this->line3_addressline = $v;
032  }
publicset_single_line ( v )[ address_ext ]
Parameters
requiredv
Code
075  public function set_single_line($__v)
076  {
077      //sets the address from a single line
078      //expects the following as valid value
079      // [line1] [,line2] [,line3][,"city"] ["state/province"] ["country"] ["zip"]
080      $parts = explode(",",$__v);
081     
082      //get rid of the extra spaces
083      switch (count($parts)) {
084          case 0:
085              //setting to nothing, wipe this address
086              $this->delete();
087              break;
088          case 1:
089              //assume line 1 only
090              $this->state_id=0;
091              $this->country_id=0;
092              $this->city=null;
093              $this->postal_code=null;
094              $this->line1=trim($parts[0]);
095              $this->commit();
096              break;
097          case 2:
098              //assume line1, "city" "state" "country" "zip" only
099              $this->line1=trim(str_replace("\"","",$parts[0]));
100              $this->parselocation($parts[1]);
101              $this->commit();
102              break;
103          case 3:
104              //assume line1,line2, "city" "state" "country" "zip" only
105              $this->line1=trim(str_replace("\"","",$parts[0]));
106              $this->line2=trim(str_replace("\"","",$parts[1]));
107              $this->parselocation($parts[2]);
108              $this->commit();
109              break;
110          case 4:
111              //assume line1,line2,line3, "city" "state" "country" "zip" only
112              $this->line1=trim(str_replace("\"","",$parts[0]));
113              $this->line2=trim(str_replace("\"","",$parts[1]));
114              $this->line3=trim(str_replace("\"","",$parts[2]));
115              $this->parselocation($parts[3]);
116              $this->commit();
117              break;
118          default:
119              return false;
120      }
121      return true;
122  }
publicset_state ( v )[ address_db ]
Parameters
requiredv
Code
356  public function set_state($v)
357  {
358      if ($v->id > 0)
359      {
360          $this->state_id = $v->id;
361      }
362  }
public__toString ( )[ address_db ]
Parameters
No parameters for this method
Code
347  public function __toString()
348  {
349      return (is_null($this->name) ? "" : $this->name);
350  }
publicundelete ( )[ address_db ]
Parameters
No parameters for this method
Code
192  public function undelete()
193  {
194      $db = address::db();
195      $q  = " UPDATE cor_address SET ";
196      $q .= " deleted = 0 ";
197      $q .= " WHERE id = " . $this->_id;
198      $db->query($q);
199      $this->deleted = false;
200      return true;
201  }
protectedupdate ( )[ address_db ]
Parameters
No parameters for this method
Code
164  protected function update()
165  {
166      $db = address::db();
167      $q  = " UPDATE cor_address SET ";
168      $q .= $db->param_string("name") . " = " . $db->value_string($this->_name) . ", ";
169      $q .= $db->param_string("city") . " = " . $db->value_string($this->_city) . ", ";
170      $q .= $db->param_string("province") . " = " . $db->value_string($this->_province) . ", ";
171      $q .= $db->param_string("state_id") . " = " . $db->value_string($this->_state_id) . ", ";
172      $q .= $db->param_string("postal_code") . " = " . $db->value_string($this->_postal_code) . ", ";
173      $q .= $db->param_string("country_id") . " = " . $db->value_string($this->_country_id) . ", ";
174      $q .= $db->param_string("mdate") . " = " . $db->value_string(timestamp()) . ", ";
175      $q .= $db->param_string("deleted") . " = " . ($this->deleted ? "'1'" : "'0'");
176      $q .= " WHERE id = " . $this->_id;
177      $db->query($q);
178      return true;
179  }
 
Accessors
publicaddressline[ address_db ]
Code
574  public function get_addressline($__type="default")
575  {
576      $object = is_null(keyval($this->property_objects_array,"{$__type}_addressline")) ? new addressline($this->get_addressline_id($__type)) : $this->property_objects_array["{$__type}_addressline"];
577      $this->property_objects_array["{$__type}_addressline"] = $object;
578      return $object;
579  }
Code
611  public function set_addressline($__v, $__type="default")
612  {
613      $object = is_null(keyval($this->property_objects_array,"{$__type}_addressline")) ? new addressline($this->get_addressline_id($__type)) : $this->property_objects_array["{$__type}_addressline"];
614      if (is_null($__v))
615      {
616          $rel = new address_addressline(null,$this->id,$object->id,address_addressline::type_id($__type));
617          $rel->delete();
618          $object->delete();
619          if (!is_null(keyval($this->property_objects_array,"{$__type}_addressline")))
620          {
621              $this->property_objects_array["{$__type}_addressline"] = null;
622          }
623      }
624      else
625      {
626          $object->value = is_object($__v) ? $__v->value : $__v;
627          $object->commit();
628          $this->set_addressline_ids(array($object->id),$__type);
629      }
630  }
publicaddressline_id[ address_db ]
Code
580  public function get_addressline_id($__type="default")
581  {
582      $ids = $this->get_addressline_ids($__type, true);
583      return (count($ids)==1 ? $ids[0] : null);
584  }
Code
631  public function set_addressline_id($__v, $__type="default")
632  {
633      $this->set_addressline_ids(array($__v),$__type);
634  }
publicaddressline_ids[ address_db ]
Code
585  public function get_addressline_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
586  {
587      $addressline_ids = array();
588      $db = address::db();
589      $q  = " SELECT cor_addressline.id FROM cor_address_addressline INNER JOIN cor_addressline ON cor_address_addressline.addressline_id=cor_addressline.id AND cor_address_addressline.deleted=0 AND cor_addressline.deleted=0 AND cor_address_addressline.address_id='$this->id' " . (is_null($__type) ? "" : " AND cor_address_addressline.address_addressline_type_id='" . address_addressline::type_id($__type) . "'") . ($__get_primary ? " AND cor_address_addressline.primary=1 " : "");
590      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
591      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
592      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
593      $db->query($q);
594      while ($db->next_record())
595      {
596          $addressline_ids[] = $db->f("id");
597      }
598      return $addressline_ids;
599  }
Code
635  public function set_addressline_ids($__v, $__type="default")
636  {
637      if ($this->id == 0)
638      {
639          $this->commit();
640      }
641      $type_id = address_addressline::type_id($__type);
642      address_addressline::delete_all($this->id,null,$type_id);
643      $order = 0;
644      if (is_array($__v))
645      {
646          foreach ($__v as $index=>$id)
647          {
648              $object = new address_addressline(null,$this->id,$id,$type_id);
649              $object->deleted = false;
650              $object->order = (++$order);
651              $object->address_addressline_type_id = $type_id;
652              $object->commit();
653              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_addressline")))
654              {
655                  $this->property_objects_array["{$__type}_addressline"] = new addressline($object->addressline_id);
656              }
657          }
658          $this->_dirty = true;
659      }
660  }
publicaddressline_list[ address_db ]
Code
600  public function get_addressline_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
601  {
602      $ids = $this->get_addressline_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
603      $objects = array();
604      foreach ($ids as $index=>$id)
605      {
606          $objects[$index] = new addressline($id);
607      }
608      return $objects;
609  }
Code
661  public function set_addressline_list($__v, $__type="default")
662  {
663      if (is_array($__v))
664      {
665          $ids = array();
666          foreach ($__v as $index=>$object)
667          {
668              $ids[] = $object->id;
669          }
670          $this->set_addressline_ids($ids,$__type);
671      }
672  }
publicarray[ obj ]
Code
096  public function get_array()
097  {
098      return get_object_vars($this);
099  }
publicclassname[ obj ]
Code
086  public function get_classname()
087  {
088      return get_class($this);
089  }
publiccolumns[ address_db ]
Code
212  public static function get_columns($__columns, $__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
213  {
214      $lookups = is_array($__lookups) ? $__lookups : array($__lookups);
215      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
216      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
217 
218      $db = address::db();
219      $data = array();
220      $q  = " SELECT $colstring ";
221      $q .= " FROM cor_address ";
222      $q .= " WHERE cor_address.deleted = 0 ";
223      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
224      $q .= array_key_exists("state_id",$lookups) ? " AND cor_address.state_id='" . $lookups["state_id"] . "' " : "";
225      $q .= array_key_exists("country_id",$lookups) ? " AND cor_address.country_id='" . $lookups["country_id"] . "' " : "";
226 
227      if (is_string($__order))
228      {
229          $q .= "ORDER BY " . $__order;
230      }
231      else if (is_array($__order) and count($__order)>0)
232      {
233          $orderings = array();
234          foreach ($__order as $col=>$dir)
235          {
236              $orderings[] = " $col $dir ";
237          }
238          $q .= "ORDER BY " . implode(", ", $orderings);
239      }
240      else if (is_object($__order))
241      {
242          $q .= "";
243      }
244      else
245      {
246          // THERE IS NO `order` COLUMN ON THIS OBJECT
247      }
248 
249      if (!is_null($__limit))
250      {
251          $q .= " LIMIT $__offset , $__limit ";
252      }
253 
254      $db->query($q);
255 
256      if (count($colarray)>1 || $colstring=="*")
257      {
258          while ($db->next_record())
259          {
260              $data[] = $db->record;
261          }
262      }
263      else
264      {
265          while ($db->next_record())
266          {
267              $data[] = $db->f(0);
268          }
269      }
270 
271      return $data;
272  }
publiccountry[ address_db ]
Code
364  public function get_country()
365  {
366      return new country($this->country_id);
367  }
Code
368  public function set_country($v)
369  {
370      if ($v->id > 0)
371      {
372          $this->country_id = $v->id;
373      }
374  }
publiccreditcardaccount[ address_db ]
Code
475  public function get_creditcardaccount($__type="default")
476  {
477      $object = is_null(keyval($this->property_objects_array,"{$__type}_creditcardaccount")) ? new creditcardaccount($this->get_creditcardaccount_id($__type)) : $this->property_objects_array["{$__type}_creditcardaccount"];
478      $this->property_objects_array["{$__type}_creditcardaccount"] = $object;
479      return $object;
480  }
Code
512  public function set_creditcardaccount($__v, $__type="default")
513  {
514      $object = is_null(keyval($this->property_objects_array,"{$__type}_creditcardaccount")) ? new creditcardaccount($this->get_creditcardaccount_id($__type)) : $this->property_objects_array["{$__type}_creditcardaccount"];
515      if (is_null($__v))
516      {
517          $rel = new address_creditcardaccount(null,$this->id,$object->id,address_creditcardaccount::type_id($__type));
518          $rel->delete();
519          if (!is_null(keyval($this->property_objects_array,"{$__type}_creditcardaccount")))
520          {
521              $this->property_objects_array["{$__type}_creditcardaccount"] = null;
522          }
523      }
524      else
525      {
526          $id = $object->id;
527          $object = $__v;
528          $object->id = $__v->id>0 ? $__v->id : $id;
529          $object->commit();
530          $this->set_creditcardaccount_ids(array($object->id),$__type);
531      }
532  }
publiccreditcardaccount_id[ address_db ]
Code
481  public function get_creditcardaccount_id($__type="default")
482  {
483      $ids = $this->get_creditcardaccount_ids($__type, true);
484      return (count($ids)==1 ? $ids[0] : null);
485  }
Code
533  public function set_creditcardaccount_id($__v, $__type="default")
534  {
535      $this->set_creditcardaccount_ids(array($__v),$__type);
536  }
publiccreditcardaccount_ids[ address_db ]
Code
486  public function get_creditcardaccount_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
487  {
488      $creditcardaccount_ids = array();
489      $db = address::db();
490      $q  = " SELECT com_creditcardaccount.paymentaccount_id FROM com_address_creditcardaccount INNER JOIN com_creditcardaccount ON com_address_creditcardaccount.creditcardaccount_paymentaccount_id=com_creditcardaccount.paymentaccount_id AND com_address_creditcardaccount.deleted=0 AND com_creditcardaccount.deleted=0 AND com_address_creditcardaccount.address_id='$this->id' " . (is_null($__type) ? "" : " AND com_address_creditcardaccount.address_creditcardaccount_type_id='" . address_creditcardaccount::type_id($__type) . "'") . ($__get_primary ? " AND com_address_creditcardaccount.primary=1 " : "");
491      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
492      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
493      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
494      $db->query($q);
495      while ($db->next_record())
496      {
497          $creditcardaccount_ids[] = $db->f("paymentaccount_id");
498      }
499      return $creditcardaccount_ids;
500  }
Code
537  public function set_creditcardaccount_ids($__v, $__type="default")
538  {
539      if ($this->id == 0)
540      {
541          $this->commit();
542      }
543      $type_id = address_creditcardaccount::type_id($__type);
544      address_creditcardaccount::delete_all($this->id,null,$type_id);
545      if (is_array($__v))
546      {
547          foreach ($__v as $index=>$id)
548          {
549              $object = new address_creditcardaccount(null,$this->id,$id,$type_id);
550              $object->deleted = false;
551              $object->address_creditcardaccount_type_id = $type_id;
552              $object->commit();
553              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_creditcardaccount")))
554              {
555                  $this->property_objects_array["{$__type}_creditcardaccount"] = new creditcardaccount($object->creditcardaccount_id);
556              }
557          }
558          $this->_dirty = true;
559      }
560  }
publiccreditcardaccount_list[ address_db ]
Code
501  public function get_creditcardaccount_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
502  {
503      $ids = $this->get_creditcardaccount_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
504      $objects = array();
505      foreach ($ids as $index=>$id)
506      {
507          $objects[$index] = new creditcardaccount($id);
508      }
509      return $objects;
510  }
Code
561  public function set_creditcardaccount_list($__v, $__type="default")
562  {
563      if (is_array($__v))
564      {
565          $ids = array();
566          foreach ($__v as $index=>$object)
567          {
568              $ids[] = $object->id;
569          }
570          $this->set_creditcardaccount_ids($ids,$__type);
571      }
572  }
publicdirty[ obj ]
Code
063  public function get_dirty()
064  {
065      if ($this->id === 0)
066      {
067          $this->_dirty = true;
068      }
069      else
070      {
071          foreach (get_object_vars($this) as $k=>$v)
072          {
073              if ($this->_dirty)
074              {
075                  break;
076              }
077              if (preg_match('/_dirty$/',$k))
078              {
079                  $this->_dirty = $this->_dirty || $v;
080              }
081          }
082      }
083      return $this->_dirty;
084  }
publicentity[ address_db ]
Code
674  public function get_entity($__type="default")
675  {
676      $object = is_null(keyval($this->property_objects_array,"{$__type}_entity")) ? new entity($this->get_entity_id($__type)) : $this->property_objects_array["{$__type}_entity"];
677      $this->property_objects_array["{$__type}_entity"] = $object;
678      return $object;
679  }
Code
711  public function set_entity($__v, $__type="default")
712  {
713      $object = is_null(keyval($this->property_objects_array,"{$__type}_entity")) ? new entity($this->get_entity_id($__type)) : $this->property_objects_array["{$__type}_entity"];
714      if (is_null($__v))
715      {
716          $rel = new address_entity(null,$this->id,$object->id,address_entity::type_id($__type));
717          $rel->delete();
718          if (!is_null(keyval($this->property_objects_array,"{$__type}_entity")))
719          {
720              $this->property_objects_array["{$__type}_entity"] = null;
721          }
722      }
723      else
724      {
725          $id = $object->id;
726          $object = $__v;
727          $object->id = $__v->id>0 ? $__v->id : $id;
728          $object->commit();
729          $this->set_entity_ids(array($object->id),$__type);
730      }
731  }
publicentity_id[ address_db ]
Code
680  public function get_entity_id($__type="default")
681  {
682      $ids = $this->get_entity_ids($__type, true);
683      return (count($ids)==1 ? $ids[0] : null);
684  }
Code
732  public function set_entity_id($__v, $__type="default")
733  {
734      $this->set_entity_ids(array($__v),$__type);
735  }
publicentity_ids[ address_db ]
Code
685  public function get_entity_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
686  {
687      $entity_ids = array();
688      $db = address::db();
689      $q  = " SELECT cor_entity.id FROM cor_address_entity INNER JOIN cor_entity ON cor_address_entity.entity_id=cor_entity.id AND cor_address_entity.deleted=0 AND cor_entity.deleted=0 AND cor_address_entity.address_id='$this->id' " . (is_null($__type) ? "" : " AND cor_address_entity.address_entity_type_id='" . address_entity::type_id($__type) . "'") . ($__get_primary ? " AND cor_address_entity.primary=1 " : "");
690      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
691      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
692      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
693      $db->query($q);
694      while ($db->next_record())
695      {
696          $entity_ids[] = $db->f("id");
697      }
698      return $entity_ids;
699  }
Code
736  public function set_entity_ids($__v, $__type="default")
737  {
738      if ($this->id == 0)
739      {
740          $this->commit();
741      }
742      $type_id = address_entity::type_id($__type);
743      address_entity::delete_all($this->id,null,$type_id);
744      if (is_array($__v))
745      {
746          foreach ($__v as $index=>$id)
747          {
748              $object = new address_entity(null,$this->id,$id,$type_id);
749              $object->deleted = false;
750              $object->address_entity_type_id = $type_id;
751              $object->commit();
752              if (count($__v)==1 && !is_null(keyval($this->