コード例 #1
0
ファイル: class.Part.php プロジェクト: AlexanderS/Part-DB
 /**
  * @brief Create a new part
  *
  * @param Database  &$database          reference to the database object
  * @param User      &$current_user      reference to the user which is logged in
  * @param Log       &$log               reference to the Log-object
  * @param string    $name               the name of the new part (see Part::set_name())
  * @param integer   $category_id        the category ID of the new part (see Part::set_category_id())
  * @param string    $description        the description of the new part (see Part::set_description())
  * @param integer   $instock            the instock of the new part (see Part::set_instock())
  * @param integer   $mininstock         the mininstock of the new part (see Part::set_mininstock())
  * @param integer   $storelocation_id   the storelocation ID of the new part (see Part::set_storelocation_id())
  * @param integer   $manufacturer_id    the manufacturer ID of the new part (see Part::set_manufacturer_id())
  * @param integer   $footprint_id       the footprint ID of the new part (see Part::set_footprint_id())
  * @param string    $comment            the comment of the new part (see Part::set_comment())
  * @param boolean   $visible            the visible attribute of the new part (see Part::set_visible())
  *
  * @retval Part     the new part
  *
  * @throws Exception    if (this combination of) values is not valid
  * @throws Exception    if there was an error
  *
  * @see DBElement::add()
  */
 public static function add(&$database, &$current_user, &$log, $name, $category_id, $description = '', $instock = 0, $mininstock = 0, $storelocation_id = NULL, $manufacturer_id = NULL, $footprint_id = NULL, $comment = '', $visible = false)
 {
     return parent::add($database, $current_user, $log, 'parts', array('name' => $name, 'id_category' => $category_id, 'description' => $description, 'instock' => $instock, 'mininstock' => $mininstock, 'id_storelocation' => $storelocation_id, 'id_manufacturer' => $manufacturer_id, 'id_footprint' => $footprint_id, 'visible' => $visible, 'comment' => $comment, 'id_master_picture_attachement' => NULL, 'manual_order' => false, 'order_orderdetails_id' => NULL, 'order_quantity' => 1));
     // the column "datetime_added" will be automatically filled by MySQL
     // the column "last_modified" will be filled in the function check_values_validity()
 }