Helix Installation   Getting Started   Reference Documentation   Global Functions   Quick Start
ModulesClassesFunctions
 

Class Reference

class warranty extends warranty_ext

Hide Inherited MembersAsset Management
Description
No description.
 
Constants
constantTABLENAME ["am_warranty"][ warranty ]
 
Properties
protected_asset_id[ warranty_db ]
protected_asset_id_dirty[ warranty_db ]
protected_asset_type_id[ asset_db ]
protected_asset_type_id_dirty[ asset_db ]
protected_assetstatus_id[ asset_db ]
protected_assetstatus_id_dirty[ asset_db ]
protected_capex[ asset_db ]
protected_capex_dirty[ asset_db ]
protected_cdate[ warranty_db ]
protected_cdate_dirty[ warranty_db ]
protected_deleted[ warranty_db ]
protected_deleted_dirty[ warranty_db ]
protected_department_id[ asset_db ]
protected_department_id_dirty[ asset_db ]
protected_description[ asset_db ]
protected_description_dirty[ asset_db ]
protected_dirty[ obj ]
protected__id[ warranty_db ]
protected_id[ asset_db ]
protected_id_dirty[ asset_db ]
protected__id_dirty[ warranty_db ]
protected_mdate[ warranty_db ]
protected_mdate_dirty[ warranty_db ]
protected_model[ asset_db ]
protected_model_dirty[ asset_db ]
protected_name[ asset_db ]
protected_name_dirty[ asset_db ]
protected_part_number[ asset_db ]
protected_part_number_dirty[ asset_db ]
publicproperty_objects_array[ obj ]
protected_quantity[ asset_db ]
protected_quantity_dirty[ asset_db ]
protected_serial_number[ asset_db ]
protected_serial_number_dirty[ asset_db ]
protected_sku[ asset_db ]
protected_sku_dirty[ asset_db ]
protected_unit_price[ asset_db ]
protected_unit_price_dirty[ asset_db ]
 
Methods
publiccommit ( )[ warranty_db ]
Parameters
No parameters for this method
Code
134  public function commit()
135  {
136      if ($this->_asset_id > 0)
137      {
138          $this->update();
139      }
140      else
141      {
142          $this->insert();
143      }
144 
145      foreach ($this->property_objects_array as $property=>$object)
146      {
147          $this->{$property} = $object;
148      }
149 
150      return true;
151  }
public__construct ( asset_id )[ warranty_db ]
Parameters
optionalasset_id
Code
040  public function __construct($__asset_id=null)
041  {
042      $this->__id = 0;
043      $this->_asset_id = 0;
044      $this->_mdate = null;
045      $this->_cdate = null;
046      $this->_deleted = false;
047      $this->_id = 0;
048      $this->_name = "";
049      $this->_description = "";
050      $this->_asset_type_id = 0;
051      $this->_assetstatus_id = 0;
052      $this->_department_id = 0;
053      $this->_sku = "";
054      $this->_model = "";
055      $this->_part_number = "";
056      $this->_serial_number = "";
057      $this->_unit_price = 0;
058      $this->_quantity = 0;
059      $this->_capex = false;
060 
061      $this->__id_dirty = false;
062      $this->_asset_id_dirty = false;
063      $this->_mdate_dirty = false;
064      $this->_cdate_dirty = false;
065      $this->_deleted_dirty = false;
066      $this->_id_dirty = false;
067      $this->_name_dirty = false;
068      $this->_description_dirty = false;
069      $this->_asset_type_id_dirty = false;
070      $this->_assetstatus_id_dirty = false;
071      $this->_department_id_dirty = false;
072      $this->_sku_dirty = false;
073      $this->_model_dirty = false;
074      $this->_part_number_dirty = false;
075      $this->_serial_number_dirty = false;
076      $this->_unit_price_dirty = false;
077      $this->_quantity_dirty = false;
078      $this->_capex_dirty = false;
079 
080      if (is_null($__asset_id))
081      {
082          return;
083      }
084 
085      $db = warranty::db();
086      $q  = " SELECT am_asset.id,am_asset.name,am_asset.description,am_asset.asset_type_id,am_asset.assetstatus_id,am_asset.department_id,am_asset.sku,am_asset.model,am_asset.part_number,am_asset.serial_number,am_asset.unit_price,am_asset.quantity,am_asset.capex,am_warranty._id,am_warranty.asset_id,am_warranty.mdate,am_warranty.cdate,am_warranty.deleted ";
087      $q .= " FROM am_warranty ";
088      $q .= " INNER JOIN am_asset ON am_warranty.asset_id=am_asset.id ";
089      $q .= is_null($__asset_id) ? "" : " AND am_asset.id='$__asset_id' ";       
090 
091      $db->query($q);
092      if ($db->next_record() && $db->num_rows() == 1)
093      {
094          $this->_id = $db->f("id");
095          $this->_name = $db->f("name");
096          $this->_description = $db->f("description");
097          $this->_asset_type_id = $db->f("asset_type_id");
098          $this->_assetstatus_id = $db->f("assetstatus_id");
099          $this->_department_id = $db->f("department_id");
100          $this->_sku = $db->f("sku");
101          $this->_model = $db->f("model");
102          $this->_part_number = $db->f("part_number");
103          $this->_serial_number = $db->f("serial_number");
104          $this->_unit_price = $db->f("unit_price");
105          $this->_quantity = $db->f("quantity");
106          $this->_capex = $db->f("capex");
107          $this->__id = $db->f("_id");
108          $this->_asset_id = $db->f("asset_id");
109          $this->_mdate = $db->f("mdate");
110          $this->_cdate = $db->f("cdate");
111          $this->_deleted = $db->f("deleted");
112      }
113  }
protected staticdb ( )[ warranty_db ]
Parameters
No parameters for this method
Code
474  protected static function db()
475  {
476      return new db();
477  }
publicdelete ( )[ warranty_db ]
Parameters
No parameters for this method
Code
186  public function delete()
187  {
188      parent::delete();
189      $db = warranty::db();
190      $q  = " UPDATE am_warranty SET ";
191      $q .= " deleted = 1 ";
192      $q .= " WHERE asset_id = " . $this->_asset_id;
193      $db->query($q);
194      $this->deleted = true;
195      return true;
196  }
public staticdelete_all ( )[ warranty_db ]
Parameters
No parameters for this method
Code
299  public static function delete_all()
300  {
301      $db = warranty::db();
302      $q  = " UPDATE am_warranty SET ";
303      $q .= " deleted = 1 ";
304     
305      $db->query($q);
306      return true;
307  }
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_array ( )[ obj ]
Parameters
No parameters for this method
Code
096  public function get_array()
097  {
098      return get_object_vars($this);
099  }
publicget_asset ( )[ warranty_db ]
Parameters
No parameters for this method
Code
363  public function get_asset()
364  {
365      return new asset($this->asset_id);
366  }
publicget_asset_type ( )[ asset_db ]
Parameters
No parameters for this method
Code
424  public function get_asset_type()
425  {
426      return new asset_type($this->asset_type_id);
427  }
publicget_assetdate ( type ["default"] )[ asset_db ]
Parameters
optionaltype ["default"]
Code
460  public function get_assetdate($__type="default")
461  {
462      $object = is_null(keyval($this->property_objects_array,"{$__type}_assetdate")) ? new assetdate($this->get_assetdate_id($__type)) : $this->property_objects_array["{$__type}_assetdate"];
463      $this->property_objects_array["{$__type}_assetdate"] = $object;
464      return $object;
465  }
publicget_assetdate_id ( type ["default"] )[ asset_db ]
Parameters
optionaltype ["default"]
Code
466  public function get_assetdate_id($__type="default")
467  {
468      $ids = $this->get_assetdate_ids($__type, true);
469      return (count($ids)==1 ? $ids[0] : null);
470  }
publicget_assetdate_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ asset_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
471  public function get_assetdate_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
472  {
473      $assetdate_ids = array();
474      $db = asset::db();
475      $q  = " SELECT am_assetdate.id FROM am_asset_assetdate INNER JOIN am_assetdate ON am_asset_assetdate.assetdate_id=am_assetdate.id AND am_asset_assetdate.deleted=0 AND am_assetdate.deleted=0 AND am_asset_assetdate.asset_id='$this->id' " . (is_null($__type) ? "" : " AND am_asset_assetdate.asset_assetdate_type_id='" . asset_assetdate::type_id($__type) . "'") . ($__get_primary ? " AND am_asset_assetdate.primary=1 " : "");
476      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
477      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
478      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
479      $db->query($q);
480      while ($db->next_record())
481      {
482          $assetdate_ids[] = $db->f("id");
483      }
484      return $assetdate_ids;
485  }
publicget_assetdate_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ asset_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
486  public function get_assetdate_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
487  {
488      $ids = $this->get_assetdate_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
489      $objects = array();
490      foreach ($ids as $index=>$id)
491      {
492          $objects[$index] = new assetdate($id);
493      }
494      return $objects;
495  }
publicget_assetstatus ( )[ asset_db ]
Parameters
No parameters for this method
Code
436  public function get_assetstatus()
437  {
438      return new assetstatus($this->assetstatus_id);
439  }
publicget_business ( type ["default"] )[ asset_db ]
Parameters
optionaltype ["default"]
Code
657  public function get_business($__type="default")
658  {
659      $object = is_null(keyval($this->property_objects_array,"{$__type}_business")) ? new business($this->get_business_id($__type)) : $this->property_objects_array["{$__type}_business"];
660      $this->property_objects_array["{$__type}_business"] = $object;
661      return $object;
662  }
publicget_business_id ( type ["default"] )[ asset_db ]
Parameters
optionaltype ["default"]
Code
663  public function get_business_id($__type="default")
664  {
665      $ids = $this->get_business_ids($__type, true);
666      return (count($ids)==1 ? $ids[0] : null);
667  }
publicget_business_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ asset_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
668  public function get_business_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
669  {
670      $business_ids = array();
671      $db = asset::db();
672      $q  = " SELECT bus_business.entity_id FROM am_asset_business INNER JOIN bus_business ON am_asset_business.business_entity_id=bus_business.entity_id AND am_asset_business.deleted=0 AND bus_business.deleted=0 AND am_asset_business.asset_id='$this->id' " . (is_null($__type) ? "" : " AND am_asset_business.asset_business_type_id='" . asset_business::type_id($__type) . "'") . ($__get_primary ? " AND am_asset_business.primary=1 " : "");
673      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
674      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
675      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
676      $db->query($q);
677      while ($db->next_record())
678      {
679          $business_ids[] = $db->f("entity_id");
680      }
681      return $business_ids;
682  }
publicget_business_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ asset_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
683  public function get_business_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
684  {
685      $ids = $this->get_business_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
686      $objects = array();
687      foreach ($ids as $index=>$id)
688      {
689          $objects[$index] = new business($id);
690      }
691      return $objects;
692  }
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] )[ warranty_db ]
Parameters
requiredcolumns
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
220  public static function get_columns($__columns, $__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
221  {
222      $lookups = is_array($__lookups) ? $__lookups : array($__lookups);
223      $colarray = is_array($__columns) ? $__columns : explode(",",$__columns);
224      $colstring = is_array($__columns) ? implode(",",$__columns) : $__columns;
225 
226      $db = warranty::db();
227      $data = array();
228      $q  = " SELECT $colstring ";
229      $q .= " FROM am_warranty ";
230      $q .= " INNER JOIN am_asset ON am_warranty.asset_id=am_asset.id ";
231      $q .= array_key_exists("asset_type_id",$lookups) ? " AND am_asset.asset_type_id='" . $lookups["asset_type_id"] . "' " : "";
232      $q .= array_key_exists("assetstatus_id",$lookups) ? " AND am_asset.assetstatus_id='" . $lookups["assetstatus_id"] . "' " : "";
233      $q .= array_key_exists("department_id",$lookups) ? " AND am_asset.department_id='" . $lookups["department_id"] . "' " : "";
234      $q .= " WHERE am_warranty.deleted = 0 ";
235      $q .= is_null($__where_clause) ? null : " AND ($__where_clause) ";
236 
237      if (is_string($__order))
238      {
239          $q .= "ORDER BY " . $__order;
240      }
241      else if (is_array($__order) and count($__order)>0)
242      {
243          $orderings = array();
244          foreach ($__order as $col=>$dir)
245          {
246              $orderings[] = " $col $dir ";
247          }
248          $q .= "ORDER BY " . implode(", ", $orderings);
249      }
250      else if (is_object($__order))
251      {
252          $q .= "";
253      }
254      else
255      {
256          // THERE IS NO `order` COLUMN ON THIS OBJECT
257      }
258 
259      if (!is_null($__limit))
260      {
261          $q .= " LIMIT $__offset , $__limit ";
262      }
263 
264      $db->query($q);
265 
266      if (count($colarray)>1 || $colstring=="*")
267      {
268          while ($db->next_record())
269          {
270              $data[] = $db->record;
271          }
272      }
273      else
274      {
275          while ($db->next_record())
276          {
277              $data[] = $db->f(0);
278          }
279      }
280 
281      return $data;
282  }
publicget_department ( )[ asset_db ]
Parameters
No parameters for this method
Code
448  public function get_department()
449  {
450      return new department($this->department_id);
451  }
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_hardware ( type ["default"] )[ warranty_db ]
Parameters
optionaltype ["default"]
Code
375  public function get_hardware($__type="default")
376  {
377      $object = is_null(keyval($this->property_objects_array,"{$__type}_hardware")) ? new hardware($this->get_hardware_id($__type)) : $this->property_objects_array["{$__type}_hardware"];
378      $this->property_objects_array["{$__type}_hardware"] = $object;
379      return $object;
380  }
publicget_hardware_id ( type ["default"] )[ warranty_db ]
Parameters
optionaltype ["default"]
Code
381  public function get_hardware_id($__type="default")
382  {
383      $ids = $this->get_hardware_ids($__type, true);
384      return (count($ids)==1 ? $ids[0] : null);
385  }
publicget_hardware_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ warranty_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
386  public function get_hardware_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
387  {
388      $hardware_ids = array();
389      $db = warranty::db();
390      $q  = " SELECT am_hardware.asset_id FROM am_hardware_warranty INNER JOIN am_hardware ON am_hardware_warranty.hardware_asset_id=am_hardware.asset_id AND am_hardware_warranty.deleted=0 AND am_hardware.deleted=0 AND am_hardware_warranty.warranty_asset_id='$this->id' " . (is_null($__type) ? "" : " AND am_hardware_warranty.hardware_warranty_type_id='" . hardware_warranty::type_id($__type) . "'") . ($__get_primary ? " AND am_hardware_warranty.primary=1 " : "");
391      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
392      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
393      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
394      $db->query($q);
395      while ($db->next_record())
396      {
397          $hardware_ids[] = $db->f("asset_id");
398      }
399      return $hardware_ids;
400  }
publicget_hardware_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ warranty_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
401  public function get_hardware_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
402  {
403      $ids = $this->get_hardware_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
404      $objects = array();
405      foreach ($ids as $index=>$id)
406      {
407          $objects[$index] = new hardware($id);
408      }
409      return $objects;
410  }
public staticget_ids ( order , lookups , where_clause , limit , offset [0] )[ warranty_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
284  public static function get_ids($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
285  {
286      return warranty::get_columns("asset_id", $__order, $__lookups, $__where_clause, $__limit, $__offset);
287  }
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  }
public staticget_objects ( order , lookups , where_clause , limit , offset [0] )[ warranty_db ]
Parameters
optionalorder
optionallookups
optionalwhere_clause
optionallimit
optionaloffset [0]
Code
289  public static function get_objects($__order=null, $__lookups=null, $__where_clause=null, $__limit=null, $__offset=0)
290  {
291      $objects = array();
292      foreach (warranty::get_columns("asset_id", $__order, $__lookups, $__where_clause, $__limit, $__offset) as $id)
293      {
294          $objects[] = new warranty($id);
295      }
296      return $objects;
297  }
publicget_office ( type ["default"] )[ asset_db ]
Parameters
optionaltype ["default"]
Code
558  public function get_office($__type="default")
559  {
560      $object = is_null(keyval($this->property_objects_array,"{$__type}_office")) ? new office($this->get_office_id($__type)) : $this->property_objects_array["{$__type}_office"];
561      $this->property_objects_array["{$__type}_office"] = $object;
562      return $object;
563  }
publicget_office_id ( type ["default"] )[ asset_db ]
Parameters
optionaltype ["default"]
Code
564  public function get_office_id($__type="default")
565  {
566      $ids = $this->get_office_ids($__type, true);
567      return (count($ids)==1 ? $ids[0] : null);
568  }
publicget_office_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ asset_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
569  public function get_office_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
570  {
571      $office_ids = array();
572      $db = asset::db();
573      $q  = " SELECT bus_office.entity_id FROM am_asset_office INNER JOIN bus_office ON am_asset_office.office_entity_id=bus_office.entity_id AND am_asset_office.deleted=0 AND bus_office.deleted=0 AND am_asset_office.asset_id='$this->id' " . (is_null($__type) ? "" : " AND am_asset_office.asset_office_type_id='" . asset_office::type_id($__type) . "'") . ($__get_primary ? " AND am_asset_office.primary=1 " : "");
574      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
575      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
576      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
577      $db->query($q);
578      while ($db->next_record())
579      {
580          $office_ids[] = $db->f("entity_id");
581      }
582      return $office_ids;
583  }
publicget_office_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ asset_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
584  public function get_office_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
585  {
586      $ids = $this->get_office_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
587      $objects = array();
588      foreach ($ids as $index=>$id)
589      {
590          $objects[$index] = new office($id);
591      }
592      return $objects;
593  }
publicget_person ( type ["default"] )[ asset_db ]
Parameters
optionaltype ["default"]
Code
756  public function get_person($__type="default")
757  {
758      $object = is_null(keyval($this->property_objects_array,"{$__type}_person")) ? new person($this->get_person_id($__type)) : $this->property_objects_array["{$__type}_person"];
759      $this->property_objects_array["{$__type}_person"] = $object;
760      return $object;
761  }
publicget_person_id ( type ["default"] )[ asset_db ]
Parameters
optionaltype ["default"]
Code
762  public function get_person_id($__type="default")
763  {
764      $ids = $this->get_person_ids($__type, true);
765      return (count($ids)==1 ? $ids[0] : null);
766  }
publicget_person_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ asset_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
767  public function get_person_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
768  {
769      $person_ids = array();
770      $db = asset::db();
771      $q  = " SELECT cor_person.entity_id FROM am_asset_person INNER JOIN cor_person ON am_asset_person.person_entity_id=cor_person.entity_id AND am_asset_person.deleted=0 AND cor_person.deleted=0 AND am_asset_person.asset_id='$this->id' " . (is_null($__type) ? "" : " AND am_asset_person.asset_person_type_id='" . asset_person::type_id($__type) . "'") . ($__get_primary ? " AND am_asset_person.primary=1 " : "");
772      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
773      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
774      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
775      $db->query($q);
776      while ($db->next_record())
777      {
778          $person_ids[] = $db->f("entity_id");
779      }
780      return $person_ids;
781  }
publicget_person_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ asset_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
782  public function get_person_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
783  {
784      $ids = $this->get_person_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
785      $objects = array();
786      foreach ($ids as $index=>$id)
787      {
788          $objects[$index] = new person($id);
789      }
790      return $objects;
791  }
publicget_properties ( )[ obj ]
Parameters
No parameters for this method
Code
121  public function get_properties()
122  {
123      return array_keys($this->array);
124  }
publicget_resource ( type ["default"] )[ asset_db ]
Parameters
optionaltype ["default"]
Code
953  public function get_resource($__type="default")
954  {
955      $object = is_null(keyval($this->property_objects_array,"{$__type}_resource")) ? new resource($this->get_resource_id($__type)) : $this->property_objects_array["{$__type}_resource"];
956      $this->property_objects_array["{$__type}_resource"] = $object;
957      return $object;
958  }
publicget_resource_id ( type ["default"] )[ asset_db ]
Parameters
optionaltype ["default"]
Code
959  public function get_resource_id($__type="default")
960  {
961      $ids = $this->get_resource_ids($__type, true);
962      return (count($ids)==1 ? $ids[0] : null);
963  }
publicget_resource_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ asset_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
964  public function get_resource_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
965  {
966      $resource_ids = array();
967      $db = asset::db();
968      $q  = " SELECT cor_resource.id FROM am_asset_resource INNER JOIN cor_resource ON am_asset_resource.resource_id=cor_resource.id AND am_asset_resource.deleted=0 AND cor_resource.deleted=0 AND am_asset_resource.asset_id='$this->id' " . (is_null($__type) ? "" : " AND am_asset_resource.asset_resource_type_id='" . asset_resource::type_id($__type) . "'") . ($__get_primary ? " AND am_asset_resource.primary=1 " : "");
969      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
970      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
971      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
972      $db->query($q);
973      while ($db->next_record())
974      {
975          $resource_ids[] = $db->f("id");
976      }
977      return $resource_ids;
978  }
publicget_resource_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ asset_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
979  public function get_resource_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
980  {
981      $ids = $this->get_resource_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
982      $objects = array();
983      foreach ($ids as $index=>$id)
984      {
985          $objects[$index] = new resource($id);
986      }
987      return $objects;
988  }
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  }
publicget_type ( )[ asset_db ]
Parameters
No parameters for this method
Code
413  public function get_type()
414  {
415      $type = new asset_type($this->_asset_type_id);
416      return $type->name;
417  }
publicget_url ( type ["default"] )[ asset_db ]
Parameters
optionaltype ["default"]
Code
855  public function get_url($__type="default")
856  {
857      $object = is_null(keyval($this->property_objects_array,"{$__type}_url")) ? new url($this->get_url_id($__type)) : $this->property_objects_array["{$__type}_url"];
858      $this->property_objects_array["{$__type}_url"] = $object;
859      return $object;
860  }
publicget_url_id ( type ["default"] )[ asset_db ]
Parameters
optionaltype ["default"]
Code
861  public function get_url_id($__type="default")
862  {
863      $ids = $this->get_url_ids($__type, true);
864      return (count($ids)==1 ? $ids[0] : null);
865  }
publicget_url_ids ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ asset_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
866  public function get_url_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
867  {
868      $url_ids = array();
869      $db = asset::db();
870      $q  = " SELECT cor_url.id FROM am_asset_url INNER JOIN cor_url ON am_asset_url.url_id=cor_url.id AND am_asset_url.deleted=0 AND cor_url.deleted=0 AND am_asset_url.asset_id='$this->id' " . (is_null($__type) ? "" : " AND am_asset_url.asset_url_type_id='" . asset_url::type_id($__type) . "'") . ($__get_primary ? " AND am_asset_url.primary=1 " : "");
871      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
872      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
873      $q .= is_null($__limit) ? "" : " LIMIT {$__offset}, {$__limit}";
874      $db->query($q);
875      while ($db->next_record())
876      {
877          $url_ids[] = $db->f("id");
878      }
879      return $url_ids;
880  }
publicget_url_list ( type , order , where_clause , limit , offset [0] , get_primary [false] )[ asset_db ]
Parameters
optionaltype
optionalorder
optionalwhere_clause
optionallimit
optionaloffset [0]
optionalget_primary [false]
Code
881  public function get_url_list($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
882  {
883      $ids = $this->get_url_ids($__type, $__order, $__where_clause, $__limit, $__offset, $__get_primary);
884      $objects = array();
885      foreach ($ids as $index=>$id)
886      {
887          $objects[$index] = new url($id);
888      }
889      return $objects;
890  }
protectedinsert ( )[ warranty_db ]
Parameters
No parameters for this method
Code
153  protected function insert()
154  {
155      parent::insert();
156      $this->_asset_id = $this->id;
157      $db = warranty::db();
158      $q  = " INSERT INTO am_warranty ( ";
159      $q .= $db->param_string("asset_id") . ", ";
160      $q .= $db->param_string("mdate") . ", ";
161      $q .= $db->param_string("cdate") . ", ";
162      $q .= $db->param_string("deleted");
163      $q .= " ) VALUES ( ";
164      $q .= $db->value_string($this->_asset_id) . ", ";
165      $q .= $db->value_string(timestamp()) . ", ";
166      $q .= $db->value_string(timestamp()) . ", ";
167      $q .= $this->deleted ? "'1'" : "'0'";
168      $q .= " ) ";
169      $db->query($q);
170      return true;
171  }
publicmap ( )[ warranty_db ]
Parameters
No parameters for this method
Code
115  public function map()
116  {
117      $this->_name = array_key_exists("warranty:name",$_REQUEST) ? reqval("warranty:name") : $this->_name;
118      $this->_description = array_key_exists("warranty:description",$_REQUEST) ? reqval("warranty:description") : $this->_description;
119      $this->_asset_type_id = array_key_exists("warranty:asset_type_id",$_REQUEST) ? reqval("warranty:asset_type_id") : $this->_asset_type_id;
120      $this->_assetstatus_id = array_key_exists("warranty:assetstatus_id",$_REQUEST) ? reqval("warranty:assetstatus_id") : $this->_assetstatus_id;
121      $this->_department_id = array_key_exists("warranty:department_id",$_REQUEST) ? reqval("warranty:department_id") : $this->_department_id;
122      $this->_sku = array_key_exists("warranty:sku",$_REQUEST) ? reqval("warranty:sku") : $this->_sku;
123      $this->_model = array_key_exists("warranty:model",$_REQUEST) ? reqval("warranty:model") : $this->_model;
124      $this->_part_number = array_key_exists("warranty:part_number",$_REQUEST) ? reqval("warranty:part_number") : $this->_part_number;
125      $this->_serial_number = array_key_exists("warranty:serial_number",$_REQUEST) ? reqval("warranty:serial_number") : $this->_serial_number;
126      $this->_unit_price = array_key_exists("warranty:unit_price",$_REQUEST) ? reqval("warranty:unit_price") : $this->_unit_price;
127      $this->_quantity = array_key_exists("warranty:quantity",$_REQUEST) ? reqval("warranty:quantity") : $this->_quantity;
128      $this->_capex = array_key_exists("warranty:capex",$_REQUEST) ? reqval("warranty:capex") : $this->_capex;
129      $this->_mdate = array_key_exists("warranty:mdate",$_REQUEST) ? reqval("warranty:mdate") : $this->_mdate;
130      $this->_cdate = array_key_exists("warranty:cdate",$_REQUEST) ? reqval("warranty:cdate") : $this->_cdate;
131      $this->_deleted = array_key_exists("warranty:deleted",$_REQUEST) ? reqval("warranty:deleted") : $this->_deleted;
132  }
publicpurge ( )[ warranty_db ]
Parameters
No parameters for this method
Code
210  public function purge()
211  {
212      parent::purge();
213      $db = warranty::db();
214      $q  = " DELETE FROM am_warranty ";
215      $q .= " WHERE asset_id = " . $this->_asset_id;
216      $db->query($q);
217      return true;
218  }
public staticsearch ( keyword )[ warranty_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_asset ( v )[ warranty_db ]
Parameters
requiredv
Code
367  public function set_asset($v)
368  {
369      if ($v->id > 0)
370      {
371          $this->asset_id = $v->id;
372      }
373  }
publicset_asset_type ( v )[ asset_db ]
Parameters
requiredv
Code
428  public function set_asset_type($v)
429  {
430      if ($v->id > 0)
431      {
432          $this->asset_type_id = $v->id;
433      }
434  }
publicset_assetdate ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
497  public function set_assetdate($__v, $__type="default")
498  {
499      $object = is_null(keyval($this->property_objects_array,"{$__type}_assetdate")) ? new assetdate($this->get_assetdate_id($__type)) : $this->property_objects_array["{$__type}_assetdate"];
500      if (is_null($__v))
501      {
502          $rel = new asset_assetdate(null,$this->id,$object->id,asset_assetdate::type_id($__type));
503          $rel->delete();
504          $object->delete();
505          if (!is_null(keyval($this->property_objects_array,"{$__type}_assetdate")))
506          {
507              $this->property_objects_array["{$__type}_assetdate"] = null;
508          }
509      }
510      else
511      {
512          $object->value = is_object($__v) ? $__v->value : $__v;
513          $object->commit();
514          $this->set_assetdate_ids(array($object->id),$__type);
515      }
516  }
publicset_assetdate_id ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
517  public function set_assetdate_id($__v, $__type="default")
518  {
519      $this->set_assetdate_ids(array($__v),$__type);
520  }
publicset_assetdate_ids ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
521  public function set_assetdate_ids($__v, $__type="default")
522  {
523      if ($this->id == 0)
524      {
525          $this->commit();
526      }
527      $type_id = asset_assetdate::type_id($__type);
528      asset_assetdate::delete_all($this->id,null,$type_id);
529      if (is_array($__v))
530      {
531          foreach ($__v as $index=>$id)
532          {
533              $object = new asset_assetdate(null,$this->id,$id,$type_id);
534              $object->deleted = false;
535              $object->asset_assetdate_type_id = $type_id;
536              $object->commit();
537              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_assetdate")))
538              {
539                  $this->property_objects_array["{$__type}_assetdate"] = new assetdate($object->assetdate_id);
540              }
541          }
542          $this->_dirty = true;
543      }
544  }
publicset_assetdate_list ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
545  public function set_assetdate_list($__v, $__type="default")
546  {
547      if (is_array($__v))
548      {
549          $ids = array();
550          foreach ($__v as $index=>$object)
551          {
552              $ids[] = $object->id;
553          }
554          $this->set_assetdate_ids($ids,$__type);
555      }
556  }
publicset_assetstatus ( v )[ asset_db ]
Parameters
requiredv
Code
440  public function set_assetstatus($v)
441  {
442      if ($v->id > 0)
443      {
444          $this->assetstatus_id = $v->id;
445      }
446  }
publicset_business ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
694  public function set_business($__v, $__type="default")
695  {
696      $object = is_null(keyval($this->property_objects_array,"{$__type}_business")) ? new business($this->get_business_id($__type)) : $this->property_objects_array["{$__type}_business"];
697      if (is_null($__v))
698      {
699          $rel = new asset_business(null,$this->id,$object->id,asset_business::type_id($__type));
700          $rel->delete();
701          if (!is_null(keyval($this->property_objects_array,"{$__type}_business")))
702          {
703              $this->property_objects_array["{$__type}_business"] = null;
704          }
705      }
706      else
707      {
708          $id = $object->id;
709          $object = $__v;
710          $object->id = $__v->id>0 ? $__v->id : $id;
711          $object->commit();
712          $this->set_business_ids(array($object->id),$__type);
713      }
714  }
publicset_business_id ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
715  public function set_business_id($__v, $__type="default")
716  {
717      $this->set_business_ids(array($__v),$__type);
718  }
publicset_business_ids ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
719  public function set_business_ids($__v, $__type="default")
720  {
721      if ($this->id == 0)
722      {
723          $this->commit();
724      }
725      $type_id = asset_business::type_id($__type);
726      asset_business::delete_all($this->id,null,$type_id);
727      if (is_array($__v))
728      {
729          foreach ($__v as $index=>$id)
730          {
731              $object = new asset_business(null,$this->id,$id,$type_id);
732              $object->deleted = false;
733              $object->asset_business_type_id = $type_id;
734              $object->commit();
735              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_business")))
736              {
737                  $this->property_objects_array["{$__type}_business"] = new business($object->business_id);
738              }
739          }
740          $this->_dirty = true;
741      }
742  }
publicset_business_list ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
743  public function set_business_list($__v, $__type="default")
744  {
745      if (is_array($__v))
746      {
747          $ids = array();
748          foreach ($__v as $index=>$object)
749          {
750              $ids[] = $object->id;
751          }
752          $this->set_business_ids($ids,$__type);
753      }
754  }
publicset_department ( v )[ asset_db ]
Parameters
requiredv
Code
452  public function set_department($v)
453  {
454      if ($v->id > 0)
455      {
456          $this->department_id = $v->id;
457      }
458  }
publicset_hardware ( v , type ["default"] )[ warranty_db ]
Parameters
requiredv
optionaltype ["default"]
Code
412  public function set_hardware($__v, $__type="default")
413  {
414      $object = is_null(keyval($this->property_objects_array,"{$__type}_hardware")) ? new hardware($this->get_hardware_id($__type)) : $this->property_objects_array["{$__type}_hardware"];
415      if (is_null($__v))
416      {
417          $rel = new hardware_warranty(null,$object->id,$this->id,hardware_warranty::type_id($__type));
418          $rel->delete();
419          if (!is_null(keyval($this->property_objects_array,"{$__type}_hardware")))
420          {
421              $this->property_objects_array["{$__type}_hardware"] = null;
422          }
423      }
424      else
425      {
426          $id = $object->id;
427          $object = $__v;
428          $object->id = $__v->id>0 ? $__v->id : $id;
429          $object->commit();
430          $this->set_hardware_ids(array($object->id),$__type);
431      }
432  }
publicset_hardware_id ( v , type ["default"] )[ warranty_db ]
Parameters
requiredv
optionaltype ["default"]
Code
433  public function set_hardware_id($__v, $__type="default")
434  {
435      $this->set_hardware_ids(array($__v),$__type);
436  }
publicset_hardware_ids ( v , type ["default"] )[ warranty_db ]
Parameters
requiredv
optionaltype ["default"]
Code
437  public function set_hardware_ids($__v, $__type="default")
438  {
439      if ($this->id == 0)
440      {
441          $this->commit();
442      }
443      $type_id = hardware_warranty::type_id($__type);
444      hardware_warranty::delete_all(null,$this->id,$type_id);
445      if (is_array($__v))
446      {
447          foreach ($__v as $index=>$id)
448          {
449              $object = new hardware_warranty(null,$id,$this->id,$type_id);
450              $object->deleted = false;
451              $object->hardware_warranty_type_id = $type_id;
452              $object->commit();
453              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_hardware")))
454              {
455                  $this->property_objects_array["{$__type}_hardware"] = new hardware($object->hardware_id);
456              }
457          }
458          $this->_dirty = true;
459      }
460  }
publicset_hardware_list ( v , type ["default"] )[ warranty_db ]
Parameters
requiredv
optionaltype ["default"]
Code
461  public function set_hardware_list($__v, $__type="default")
462  {
463      if (is_array($__v))
464      {
465          $ids = array();
466          foreach ($__v as $index=>$object)
467          {
468              $ids[] = $object->id;
469          }
470          $this->set_hardware_ids($ids,$__type);
471      }
472  }
publicset_office ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
595  public function set_office($__v, $__type="default")
596  {
597      $object = is_null(keyval($this->property_objects_array,"{$__type}_office")) ? new office($this->get_office_id($__type)) : $this->property_objects_array["{$__type}_office"];
598      if (is_null($__v))
599      {
600          $rel = new asset_office(null,$this->id,$object->id,asset_office::type_id($__type));
601          $rel->delete();
602          if (!is_null(keyval($this->property_objects_array,"{$__type}_office")))
603          {
604              $this->property_objects_array["{$__type}_office"] = null;
605          }
606      }
607      else
608      {
609          $id = $object->id;
610          $object = $__v;
611          $object->id = $__v->id>0 ? $__v->id : $id;
612          $object->commit();
613          $this->set_office_ids(array($object->id),$__type);
614      }
615  }
publicset_office_id ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
616  public function set_office_id($__v, $__type="default")
617  {
618      $this->set_office_ids(array($__v),$__type);
619  }
publicset_office_ids ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
620  public function set_office_ids($__v, $__type="default")
621  {
622      if ($this->id == 0)
623      {
624          $this->commit();
625      }
626      $type_id = asset_office::type_id($__type);
627      asset_office::delete_all($this->id,null,$type_id);
628      if (is_array($__v))
629      {
630          foreach ($__v as $index=>$id)
631          {
632              $object = new asset_office(null,$this->id,$id,$type_id);
633              $object->deleted = false;
634              $object->asset_office_type_id = $type_id;
635              $object->commit();
636              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_office")))
637              {
638                  $this->property_objects_array["{$__type}_office"] = new office($object->office_id);
639              }
640          }
641          $this->_dirty = true;
642      }
643  }
publicset_office_list ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
644  public function set_office_list($__v, $__type="default")
645  {
646      if (is_array($__v))
647      {
648          $ids = array();
649          foreach ($__v as $index=>$object)
650          {
651              $ids[] = $object->id;
652          }
653          $this->set_office_ids($ids,$__type);
654      }
655  }
publicset_person ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
793  public function set_person($__v, $__type="default")
794  {
795      $object = is_null(keyval($this->property_objects_array,"{$__type}_person")) ? new person($this->get_person_id($__type)) : $this->property_objects_array["{$__type}_person"];
796      if (is_null($__v))
797      {
798          $rel = new asset_person(null,$this->id,$object->id,asset_person::type_id($__type));
799          $rel->delete();
800          if (!is_null(keyval($this->property_objects_array,"{$__type}_person")))
801          {
802              $this->property_objects_array["{$__type}_person"] = null;
803          }
804      }
805      else
806      {
807          $id = $object->id;
808          $object = $__v;
809          $object->id = $__v->id>0 ? $__v->id : $id;
810          $object->commit();
811          $this->set_person_ids(array($object->id),$__type);
812      }
813  }
publicset_person_id ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
814  public function set_person_id($__v, $__type="default")
815  {
816      $this->set_person_ids(array($__v),$__type);
817  }
publicset_person_ids ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
818  public function set_person_ids($__v, $__type="default")
819  {
820      if ($this->id == 0)
821      {
822          $this->commit();
823      }
824      $type_id = asset_person::type_id($__type);
825      asset_person::delete_all($this->id,null,$type_id);
826      if (is_array($__v))
827      {
828          foreach ($__v as $index=>$id)
829          {
830              $object = new asset_person(null,$this->id,$id,$type_id);
831              $object->deleted = false;
832              $object->asset_person_type_id = $type_id;
833              $object->commit();
834              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_person")))
835              {
836                  $this->property_objects_array["{$__type}_person"] = new person($object->person_id);
837              }
838          }
839          $this->_dirty = true;
840      }
841  }
publicset_person_list ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
842  public function set_person_list($__v, $__type="default")
843  {
844      if (is_array($__v))
845      {
846          $ids = array();
847          foreach ($__v as $index=>$object)
848          {
849              $ids[] = $object->id;
850          }
851          $this->set_person_ids($ids,$__type);
852      }
853  }
publicset_resource ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
990  public function set_resource($__v, $__type="default")
991  {
992      $object = is_null(keyval($this->property_objects_array,"{$__type}_resource")) ? new resource($this->get_resource_id($__type)) : $this->property_objects_array["{$__type}_resource"];
993      if (is_null($__v))
994      {
995          $rel = new asset_resource(null,$this->id,$object->id,asset_resource::type_id($__type));
996          $rel->delete();
997          if (!is_null(keyval($this->property_objects_array,"{$__type}_resource")))
998          {
999              $this->property_objects_array["{$__type}_resource"] = null;
1000          }
1001      }
1002      else
1003      {
1004          $hash = $object->hash;
1005          $id = $object->id;
1006          $object = $__v;
1007          $object->hash = $__v->id>0 ? $__v->hash : $hash;
1008          $object->id = $__v->id>0 ? $__v->id : $id;
1009          $object->commit();
1010          $this->set_resource_ids(array($object->id),$__type);
1011      }
1012  }
publicset_resource_id ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
1013  public function set_resource_id($__v, $__type="default")
1014  {
1015      $this->set_resource_ids(array($__v),$__type);
1016  }
publicset_resource_ids ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
1017  public function set_resource_ids($__v, $__type="default")
1018  {
1019      if ($this->id == 0)
1020      {
1021          $this->commit();
1022      }
1023      $type_id = asset_resource::type_id($__type);
1024      asset_resource::delete_all($this->id,null,$type_id);
1025      if (is_array($__v))
1026      {
1027          foreach ($__v as $index=>$id)
1028          {
1029              $object = new asset_resource(null,$this->id,$id,$type_id);
1030              $object->deleted = false;
1031              $object->asset_resource_type_id = $type_id;
1032              $object->commit();
1033              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_resource")))
1034              {
1035                  $this->property_objects_array["{$__type}_resource"] = new resource($object->resource_id);
1036              }
1037          }
1038          $this->_dirty = true;
1039      }
1040  }
publicset_resource_list ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
1041  public function set_resource_list($__v, $__type="default")
1042  {
1043      if (is_array($__v))
1044      {
1045          $ids = array();
1046          foreach ($__v as $index=>$object)
1047          {
1048              $ids[] = $object->id;
1049          }
1050          $this->set_resource_ids($ids,$__type);
1051      }
1052  }
publicset_type ( v )[ asset_db ]
Parameters
requiredv
Code
418  public function set_type($v)
419  {
420      $type = new asset_type(null, $v);
421      $this->asset_type_id = $type->id;
422  }
publicset_url ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
892  public function set_url($__v, $__type="default")
893  {
894      $object = is_null(keyval($this->property_objects_array,"{$__type}_url")) ? new url($this->get_url_id($__type)) : $this->property_objects_array["{$__type}_url"];
895      if (is_null($__v))
896      {
897          $rel = new asset_url(null,$this->id,$object->id,asset_url::type_id($__type));
898          $rel->delete();
899          $object->delete();
900          if (!is_null(keyval($this->property_objects_array,"{$__type}_url")))
901          {
902              $this->property_objects_array["{$__type}_url"] = null;
903          }
904      }
905      else
906      {
907          $object->value = is_object($__v) ? $__v->value : $__v;
908          $object->commit();
909          $this->set_url_ids(array($object->id),$__type);
910      }
911  }
publicset_url_id ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
912  public function set_url_id($__v, $__type="default")
913  {
914      $this->set_url_ids(array($__v),$__type);
915  }
publicset_url_ids ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
916  public function set_url_ids($__v, $__type="default")
917  {
918      if ($this->id == 0)
919      {
920          $this->commit();
921      }
922      $type_id = asset_url::type_id($__type);
923      asset_url::delete_all($this->id,null,$type_id);
924      if (is_array($__v))
925      {
926          foreach ($__v as $index=>$id)
927          {
928              $object = new asset_url(null,$this->id,$id,$type_id);
929              $object->deleted = false;
930              $object->asset_url_type_id = $type_id;
931              $object->commit();
932              if (count($__v)==1 && !is_null(keyval($this->property_objects_array,"{$__type}_url")))
933              {
934                  $this->property_objects_array["{$__type}_url"] = new url($object->url_id);
935              }
936          }
937          $this->_dirty = true;
938      }
939  }
publicset_url_list ( v , type ["default"] )[ asset_db ]
Parameters
requiredv
optionaltype ["default"]
Code
940  public function set_url_list($__v, $__type="default")
941  {
942      if (is_array($__v))
943      {
944          $ids = array();
945          foreach ($__v as $index=>$object)
946          {
947              $ids[] = $object->id;
948          }
949          $this->set_url_ids($ids,$__type);
950      }
951  }
public__toString ( )[ warranty_db ]
Parameters
No parameters for this method
Code
358  public function __toString()
359  {
360      return (is_null($this->id) ? "" : $this->id);
361  }
public statictype_id ( type_name )[ asset_db ]
Parameters
requiredtype_name
Code
407  public static function type_id($__type_name)
408  {
409      $type = new asset_type(null, $__type_name);
410      return $type->id;
411  }
publicundelete ( )[ warranty_db ]
Parameters
No parameters for this method
Code
198  public function undelete()
199  {
200      parent::undelete();
201      $db = warranty::db();
202      $q  = " UPDATE am_warranty SET ";
203      $q .= " deleted = 0 ";
204      $q .= " WHERE asset_id = " . $this->_asset_id;
205      $db->query($q);
206      $this->deleted = false;
207      return true;
208  }
protectedupdate ( )[ warranty_db ]
Parameters
No parameters for this method
Code
173  protected function update()
174  {
175      parent::update();
176      $db = warranty::db();
177      $q  = " UPDATE am_warranty SET ";
178      $q .= $db->param_string("asset_id") . " = " . $db->value_string($this->_asset_id) . ", ";
179      $q .= $db->param_string("mdate") . " = " . $db->value_string(timestamp()) . ", ";
180      $q .= $db->param_string("deleted") . " = " . ($this->deleted ? "'1'" : "'0'");
181      $q .= " WHERE asset_id = " . $this->_asset_id;
182      $db->query($q);
183      return true;
184  }
 
Accessors
publicarray[ obj ]
Code
096  public function get_array()
097  {
098      return get_object_vars($this);
099  }
publicasset[ warranty_db ]
Code
363  public function get_asset()
364  {
365      return new asset($this->asset_id);
366  }
Code
367  public function set_asset($v)
368  {
369      if ($v->id > 0)
370      {
371          $this->asset_id = $v->id;
372      }
373  }
publicasset_type[ asset_db ]
Code
424  public function get_asset_type()
425  {
426      return new asset_type($this->asset_type_id);
427  }
Code
428  public function set_asset_type($v)
429  {
430      if ($v->id > 0)
431      {
432          $this->asset_type_id = $v->id;
433      }
434  }
publicassetdate[ asset_db ]
Code
460  public function get_assetdate($__type="default")
461  {
462      $object = is_null(keyval($this->property_objects_array,"{$__type}_assetdate")) ? new assetdate($this->get_assetdate_id($__type)) : $this->property_objects_array["{$__type}_assetdate"];
463      $this->property_objects_array["{$__type}_assetdate"] = $object;
464      return $object;
465  }
Code
497  public function set_assetdate($__v, $__type="default")
498  {
499      $object = is_null(keyval($this->property_objects_array,"{$__type}_assetdate")) ? new assetdate($this->get_assetdate_id($__type)) : $this->property_objects_array["{$__type}_assetdate"];
500      if (is_null($__v))
501      {
502          $rel = new asset_assetdate(null,$this->id,$object->id,asset_assetdate::type_id($__type));
503          $rel->delete();
504          $object->delete();
505          if (!is_null(keyval($this->property_objects_array,"{$__type}_assetdate")))
506          {
507              $this->property_objects_array["{$__type}_assetdate"] = null;
508          }
509      }
510      else
511      {
512          $object->value = is_object($__v) ? $__v->value : $__v;
513          $object->commit();
514          $this->set_assetdate_ids(array($object->id),$__type);
515      }
516  }
publicassetdate_id[ asset_db ]
Code
466  public function get_assetdate_id($__type="default")
467  {
468      $ids = $this->get_assetdate_ids($__type, true);
469      return (count($ids)==1 ? $ids[0] : null);
470  }
Code
517  public function set_assetdate_id($__v, $__type="default")
518  {
519      $this->set_assetdate_ids(array($__v),$__type);
520  }
publicassetdate_ids[ asset_db ]
Code
471  public function get_assetdate_ids($__type=null, $__order=null, $__where_clause=null, $__limit=null, $__offset=0, $__get_primary=false)
472  {
473      $assetdate_ids = array();
474      $db = asset::db();
475      $q  = " SELECT am_assetdate.id FROM am_asset_assetdate INNER JOIN am_assetdate ON am_asset_assetdate.assetdate_id=am_assetdate.id AND am_asset_assetdate.deleted=0 AND am_assetdate.deleted=0 AND am_asset_assetdate.asset_id='$this->id' " . (is_null($__type) ? "" : " AND am_asset_assetdate.asset_assetdate_type_id='" . asset_assetdate::type_id($__type) . "'") . ($__get_primary ? " AND am_asset_assetdate.primary=1 " : "");
476      $q .= is_null($__where_clause) ? "" : " WHERE {$__where_clause}";
477      $q .= is_null($__order) ? "" : " ORDER BY {$__order}";
478      $q .= is_n