Ejemplo n.º 1
0
<?php

/* Spiros Ioannou 2009 , sivann _at_ gmail.com */
if (!isset($initok)) {
    echo "do not run this script directly";
    exit;
}
//form variables
$formvars = array("itemtypeid", "function", "manufacturerid", "label", "warrinfo", "model", "sn", "sn2", "sn3", "locationid", "locareaid", "origin", "warrantymonths", "purchasedate", "purchprice", "dnsname", "userid", "comments", "maintenanceinfo", "ispart", "hd", "cpu", "cpuno", "corespercpu", "ram", "rackmountable", "rackid", "rackposition", "rackposdepth", "usize", "status", "macs", "ipv4", "ipv6", "remadmip", "panelport", "switchid", "switchport", "ports");
/* delete item */
if (isset($_GET['delid'])) {
    //first handle file associations
    //get a list of files associated with us
    $f = itemid2files($delid, $dbh);
    for ($fids = array(), $c = 0; $c < count($f); $c++) {
        array_push($fids, $f[$c]['id']);
    }
    //remove file links
    $sql = "DELETE from item2file where itemid={$delid}";
    $sth = db_exec($dbh, $sql);
    //for each file: check if others link to it, and if not remove it:
    for ($c = 0; $c < count($fids); $c++) {
        $nlinks = countfileidlinks($fids[$c], $dbh);
        if ($nlinks == 0) {
            delfile($fids[$c], $dbh);
        }
    }
    //delete invoice links
    $sql = "DELETE from item2inv where itemid=" . $_GET['delid'];
    $sth = db_exec($dbh, $sql);
    //delete software links
Ejemplo n.º 2
0
    echo "  <option {$s} value='{$i}'>{$i}</option>\n";
}
?>
      </select>
      </td>
      </tr>
      </table>

    </td>

    </tr>

  <?php 
//Associated files
//
$f = itemid2files($id, $dbh);
$flnk = showfiles($f);
$f2 = itemid2invoicefiles($id, $dbh);
$flnk .= showfiles($f2, 'fileslist2', 0, 'File of related invoice');
$f3 = itemid2contractfiles($id, $dbh);
$flnk .= showfiles($f3, 'fileslist3', 0, 'File of related contract');
?>

    <tr>
    <td class='tdtop' colspan=1>
      <!-- related item & software links -->
      <h3><?php 
te("Associations Overview");
?>
</h3>
      <div style='text-align:center'>