コード例 #1
0
ファイル: edit.php プロジェクト: athenasystems/athena
include "/srv/athenace/lib/intranet/common.php";
include "/srv/athenace/lib/shared/functions_form.php";
if (!is_numeric($_GET['id'])) {
    header("Location: /invoices/?id=notFound");
    exit;
}
// Check if we have Form Data to process
if (isset($_GET['go']) && $_GET['go'] == "y") {
    $_POST['incept'] = mktime(0, 0, 0, $_POST['incept']['month'], $_POST['incept']['day'], $_POST['incept']['year']);
    $logContent = "\n";
    // Update DB
    $invoicesUpdate = new Invoices();
    $invoicesUpdate->setInvoicesid($_GET['id']);
    $invoicesUpdate->setCustid($_POST['custid']);
    $invoicesUpdate->setIncept($_POST['incept']);
    $invoicesUpdate->setContent($_POST['content']);
    $invoicesUpdate->setPrice($_POST['price']);
    $invoicesUpdate->setNotes($_POST['notes']);
    $invoicesUpdate->updateDB();
    $logresult = logEvent(5, $logContent);
    header("Location: /invoices/?Edited=" . $_GET['id']);
    exit;
}
// Define elements for the HTML Header include
$pagetitle = "Edit Invoice";
$pagescript = array("/pub/calpop/calendar_eu.js");
$pagestyle = array("/css/calendar.css");
include "../tmpl/header.php";
$sqltext = "SELECT * FROM invoices WHERE invoicesid=?";
$q = $db->select($sqltext, array($_GET['id']), 'i');
if (!empty($q)) {
コード例 #2
0
ファイル: add.php プロジェクト: athenasystems/athena
include "/srv/athenace/lib/intranet/common.php";
include "/srv/athenace/lib/shared/functions_form.php";
$fields = array("custid", 'price', 'content', "notes");
foreach ($fields as $field) {
    if (!isset($_POST[$field])) {
        $_POST[$field] = '';
    }
}
// Check if we have Form Data to process
if (isset($_GET['go']) && $_GET['go'] == "y") {
    $logContent = "\n";
    // Insert into DB
    $invoicesNew = new Invoices();
    $invoicesNew->setCustid($_POST['custid']);
    $invoicesNew->setIncept(time());
    $invoicesNew->setContent($_POST['content']);
    $invoicesNew->setPrice($_POST['price']);
    $invoicesNew->setNotes($_POST['notes']);
    $invoicesNew->insertIntoDB();
    $logresult = logEvent(4, $logContent);
    header("Location: /invoices/?highlight=" . $result['id']);
    exit;
}
// Define elements for the HTML Header include
$pagetitle = "Create An Invoice";
$pagescript = array('/pub/js/jquery.js');
$pagestyle = array();
include "../tmpl/header.php";
?>

<h1><?php