<?php
/**
 * @copyright (c) Kufer Software GmbH, Loisachstrasse 4, D-84453 Mühldorf
 */


class DBWorkWebToolsUsers extends DBWorkGenerated
{
  public function __construct($pDBTyp = 1, $pNewInstance = false)
  {
    parent::__construct($pDBTyp, $pNewInstance);
    $this->select = 'validfrom, validuntil, tool_id, user_id, template_id, id';
    $this->_dataModulFields = array('validfrom', 'validuntil', 'tool_id', 'user_id', 'template_id', 'id');
  }

  
  public function getNewObject()
  {
    return new WebToolsUsers();
  }

  public function getTableName(): string
  {
    return 'web_tools_users';
  }

  
  public function insertWebToolsUsers($pWebToolsUsers, $pStatus5 = null)
  {
    $dbInserter = new DBInserterOhneGenTable($this, 'web_tools_users', $pWebToolsUsers->getAttributeNames());
    $pWebToolsUsers->id = $dbInserter->insert($pWebToolsUsers, 'id', false);

    return $pWebToolsUsers->id;
  }

  public function deleteWebToolsUsers($pWtuId)
  {
    $wtuId = $this->dboperation->getInt4Sql($pWtuId);
    $this->dboperation->clear();
    $this->dboperation->execute('DELETE FROM web_tools_users WHERE id=' . $wtuId);

    $this->saveChanging('web_tools_users', '', '', "'" . $wtuId . "'", '', 'D', true);
    $this->setActionIDs();
  }
}