$query = "UPDATE " . $tables['selectedcomponents'] . " SET component_id=" . $_POST['configuration_system_name'] . " WHERE " . $tables['selectedcomponents'] . ".id=" . $result_array[0] . " LIMIT 1";
            } else {
                $query = "INSERT INTO " . $tables['selectedcomponents'] . " VALUES ( NULL, " . $_POST['configuration_system_name'] . ", " . $_POST['orderline_id'] . ", 0 )";
            }
            mysqlQuery($query, $database);
            updateFlags($class_id, $database);
            if ($_GET['finished']) {
                redirect($_GET['finished']);
            } else {
                if ($_POST['finished']) {
                    redirect($_POST['finished']);
                } else {
                    if (isOrderLineFull($_POST['orderline_id'])) {
                        if ($_GET['return_to_class']) {
                            $class_id = $_GET['return_to_class'];
                            setup();
                        } else {
                            orderComplete($_POST['orderline_id']);
                        }
                    } else {
                        setup();
                    }
                }
            }
        } else {
            setup();
        }
    }
}
addSpacing();
require_once 'footer.php';
Esempio n. 2
0
        if (mysql_num_rows($result) < 1) {
            noItemsInCart();
        }
        while ($result_array = mysql_fetch_array($result)) {
            $orderlines++;
            displayOrderline($result_array[0], $orderlines);
            if (!isOrderlineFull($result_array[0])) {
                $incomplete++;
                renderError("This item is not full!");
            }
        }
        if (!$orderlines) {
            noItemsInCart();
        }
        if (!$incomplete) {
            orderComplete(0, $order, 1);
        } else {
            renderError("Please complete all incomplete items before checking out.");
        }
        echo "<br/><br/>";
    }
}
function displayOrderline($orderline_id_in, $orderline_number_in)
{
    //SELECT component.name,component.description,class.id,class.name
    //FROM selectedcomponent
    //JOIN ( component, family, class )
    //ON ( selectedcomponent.component_id=component.id
    //AND component.family_id=family.id
    //AND family.class_id=class.id )
    //WHERE orderline_id=3
function getCurrentOrderline($order_id_in)
{
    if ($_GET['orderline_id']) {
        return $_GET['orderline_id'];
    }
    global $tables;
    $database = connectToDatabase();
    $query = "SELECT id FROM " . $tables['orderlines'] . " WHERE order_id=" . $order_id_in;
    $result = mysqlQuery($query, $database);
    $rows = mysql_num_rows($result);
    if ($rows <= 0) {
        return createNewOrderline($order_id_in);
    }
    for ($row = 0; $row < $rows; $row++) {
        $result_array = mysql_fetch_array($result);
        $orderline_id = $result_array[0];
        if (!isOrderlineFull($orderline_id)) {
            return $orderline_id;
        }
    }
    orderComplete($orderline_id, $order_id, 0, 1);
    return -1;
}