Relation between Problems and Items
Inheritance: extends CommonDBRelation
 /**
  * @since version 0.84
  *
  * @see CommonDBTM::cleanDBonPurge()
  **/
 function cleanDBonPurge()
 {
     $ip = new Item_Problem();
     $ip->cleanDBonItemDelete(__CLASS__, $this->fields['id']);
     $ci = new Change_Item();
     $ci->cleanDBonItemDelete(__CLASS__, $this->fields['id']);
     $ip = new Item_Project();
     $ip->cleanDBonItemDelete(__CLASS__, $this->fields['id']);
     Item_Devices::cleanItemDeviceDBOnItemDelete($this->getType(), $this->fields['id'], !empty($this->input['keep_devices']));
 }
Exemplo n.º 2
0
 /**
  * Actions done when item is deleted from the database
  *
  * @return nothing
  **/
 public function cleanDBonPurge()
 {
     $temp = new PluginAccountsAccount_Item();
     $temp->deleteByCriteria(array('plugin_accounts_accounts_id' => $this->fields['id']));
     $ip = new Item_Problem();
     $ip->cleanDBonItemDelete(__CLASS__, $this->fields['id']);
     $ci = new Change_Item();
     $ci->cleanDBonItemDelete(__CLASS__, $this->fields['id']);
     $ip = new Item_Project();
     $ip->cleanDBonItemDelete(__CLASS__, $this->fields['id']);
 }
Exemplo n.º 3
0
 function cleanDBonPurge()
 {
     $csv = new Computer_SoftwareVersion();
     $csv->cleanDBonItemDelete('Computer', $this->fields['id']);
     $csl = new Computer_SoftwareLicense();
     $csl->cleanDBonItemDelete('Computer', $this->fields['id']);
     $ip = new Item_Problem();
     $ip->cleanDBonItemDelete('Computer', $this->fields['id']);
     $ci = new Change_Item();
     $ci->cleanDBonItemDelete('Computer', $this->fields['id']);
     $ip = new Item_Project();
     $ip->cleanDBonItemDelete(__CLASS__, $this->fields['id']);
     $ci = new Computer_Item();
     $ci->cleanDBonItemDelete('Computer', $this->fields['id']);
     Item_Devices::cleanItemDeviceDBOnItemDelete($this->getType(), $this->fields['id'], !empty($this->input['keep_devices']));
     $disk = new ComputerDisk();
     $disk->cleanDBonItemDelete('Computer', $this->fields['id']);
     $vm = new ComputerVirtualMachine();
     $vm->cleanDBonItemDelete('Computer', $this->fields['id']);
 }
Exemplo n.º 4
0
 function cleanDBonPurge()
 {
     global $DB;
     // Delete all licenses
     $query2 = "SELECT `id`\n                 FROM `glpi_softwarelicenses`\n                 WHERE `softwares_id` = '" . $this->fields['id'] . "'";
     if ($result2 = $DB->query($query2)) {
         if ($DB->numrows($result2)) {
             $lic = new SoftwareLicense();
             while ($data = $DB->fetch_assoc($result2)) {
                 $lic->delete(array("id" => $data["id"]));
             }
         }
     }
     $version = new SoftwareVersion();
     $version->cleanDBonItemDelete(__CLASS__, $this->fields['id']);
     $ip = new Item_Problem();
     $ip->cleanDBonItemDelete(__CLASS__, $this->fields['id']);
 }
Exemplo n.º 5
0
 function cleanDBonPurge()
 {
     global $DB;
     $query = "SELECT `id`\n                FROM `glpi_computers_items`\n                WHERE `itemtype` = '" . $this->getType() . "'\n                      AND `items_id` = '" . $this->fields['id'] . "'";
     if ($result = $DB->query($query)) {
         if ($DB->numrows($result) > 0) {
             $conn = new Computer_Item();
             while ($data = $DB->fetch_assoc($result)) {
                 $data['_no_auto_action'] = true;
                 $conn->delete($data);
             }
         }
     }
     $ip = new Item_Problem();
     $ip->cleanDBonItemDelete(__CLASS__, $this->fields['id']);
 }
Exemplo n.º 6
0
 function cleanDBonPurge()
 {
     global $DB;
     $ci = new Computer_Item();
     $ci->cleanDBonItemDelete(__CLASS__, $this->fields['id']);
     $query = "UPDATE `glpi_cartridges`\n                SET `printers_id` = NULL\n                WHERE `printers_id` = '" . $this->fields['id'] . "'";
     $result = $DB->query($query);
     $ip = new Item_Problem();
     $ip->cleanDBonItemDelete(__CLASS__, $this->fields['id']);
     $ci = new Change_Item();
     $ci->cleanDBonItemDelete(__CLASS__, $this->fields['id']);
     $ip = new Item_Project();
     $ip->cleanDBonItemDelete(__CLASS__, $this->fields['id']);
     Item_Devices::cleanItemDeviceDBOnItemDelete($this->getType(), $this->fields['id'], !empty($this->input['keep_devices']));
 }
Exemplo n.º 7
0
 function post_addItem()
 {
     global $CFG_GLPI;
     parent::post_addItem();
     if (isset($this->input['_tickets_id'])) {
         $ticket = new Ticket();
         if ($ticket->getFromDB($this->input['_tickets_id'])) {
             $pt = new Problem_Ticket();
             $pt->add(array('tickets_id' => $this->input['_tickets_id'], 'problems_id' => $this->fields['id'], '_no_notif' => true));
             if (!empty($ticket->fields['itemtype']) && $ticket->fields['items_id'] > 0) {
                 $it = new Item_Problem();
                 $it->add(array('problems_id' => $this->fields['id'], 'itemtype' => $ticket->fields['itemtype'], 'items_id' => $ticket->fields['items_id'], '_no_notif' => true));
             }
         }
     }
     // Processing Email
     if ($CFG_GLPI["use_mailing"]) {
         // Clean reload of the problem
         $this->getFromDB($this->fields['id']);
         $type = "new";
         if (isset($this->fields["status"]) && $this->fields["status"] == self::SOLVED) {
             $type = "solved";
         }
         NotificationEvent::raiseEvent($type, $this);
     }
 }
Exemplo n.º 8
0
This file is part of GLPI.

GLPI is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

GLPI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
include '../inc/includes.php';
Session::checkLoginUser();
$item = new Item_Problem();
if (isset($_POST["add"])) {
    $item->check(-1, CREATE, $_POST);
    if ($item->add($_POST)) {
        Event::log($_POST["problems_id"], "problem", 4, "tracking", sprintf(__('%s adds a link with an item'), $_SESSION["glpiname"]));
    }
    Html::back();
}
Html::displayErrorAndDie("lost");
Exemplo n.º 9
0
This file is part of GLPI.

GLPI is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

GLPI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
include '../inc/includes.php';
Session::checkLoginUser();
$item = new Item_Problem();
if (isset($_POST["add"])) {
    $item->check(-1, 'w', $_POST);
    if ($item->add($_POST)) {
        Event::log($_POST["problems_id"], "problem", 4, "tracking", sprintf(__('%s adds a link with an item'), $_SESSION["glpiname"]));
    }
    Html::back();
}
Html::displayErrorAndDie("lost");
Exemplo n.º 10
0
   function cleanDBonPurge() {
      $parameters = array('items_id' => $this->getID(), 'itemtype' => get_called_class());
      $types      = array('Ticket', 'NetworkPort', 'Computer_Item',
                          'ReservationItem', 'Document_Item', 'Infocom', 'Contract_Item');
      foreach ($types as $type) {
         $item = new $type();
         $item->deleteByCriteria($parameters);
      }

      $ip = new Item_Problem();
      $ip->cleanDBonItemDelete(get_called_class(), $this->getID());

   }
Exemplo n.º 11
0
 /**
  * @since version 0.84
  *
  * @see CommonDBTM::cleanDBonPurge()
  **/
 function cleanDBonPurge()
 {
     $ip = new Item_Problem();
     $ip->cleanDBonItemDelete(__CLASS__, $this->fields['id']);
 }
Exemplo n.º 12
0
 function cleanDBonPurge()
 {
     $csv = new Computer_SoftwareVersion();
     $csv->cleanDBonItemDelete('Computer', $this->fields['id']);
     $csl = new Computer_SoftwareLicense();
     $csl->cleanDBonItemDelete('Computer', $this->fields['id']);
     $ip = new Item_Problem();
     $ip->cleanDBonItemDelete('Computer', $this->fields['id']);
     $ci = new Computer_Item();
     $ci->cleanDBonItemDelete('Computer', $this->fields['id']);
     Item_Devices::cleanItemDeviceDBOnItemDelete('Computer', $this->fields['id']);
     $disk = new ComputerDisk();
     $disk->cleanDBonItemDelete('Computer', $this->fields['id']);
     $vm = new ComputerVirtualMachine();
     $vm->cleanDBonItemDelete('Computer', $this->fields['id']);
 }