CommonDBTM::isNewID PHP Method

isNewID() static public method

is the parameter ID must be considered as new one ? Default is empty of <0 may be overriden (for entity for example)
static public isNewID ( $ID ) : boolean
$ID ID of the item (-1 if new item)
return boolean
    static function isNewID($ID)
    {
        return empty($ID) || $ID <= 0;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Show documents associated to an item
  *
  * @since version 0.84
  *
  * @param $item            CommonDBTM object for which associated documents must be displayed
  * @param $withtemplate    (default '')
  **/
 static function showForItem(CommonDBTM $item, $withtemplate = '')
 {
     $ID = $item->getField('id');
     if ($item->isNewID($ID)) {
         return false;
     }
     if ($item->getType() != 'Ticket' && $item->getType() != 'KnowbaseItem' && $item->getType() != 'Reminder' && !Document::canView()) {
         return false;
     }
     $params = array();
     $params['rand'] = mt_rand();
     self::showAddFormForItem($item, $withtemplate, $params);
     self::showListForItem($item, $withtemplate, $params);
 }
All Usage Examples Of CommonDBTM::isNewID
CommonDBTM