Example #1
0
function servePostRequest($params)
{
    //logger("POST Params : ".print_r($params, true) );
    switch ($params['task']) {
        case 'UPDATE_MODULE':
            $ret = updateLineItem($params);
            break;
            // Handles the case when a module/project/item has to be marked complete. Identifiers in $params['identifier']
        // Handles the case when a module/project/item has to be marked complete. Identifiers in $params['identifier']
        case 'MARK_COMPLETE':
            $tmp = $params['identifier']['project_name'];
            $tmp_proj = new ProjectController();
            $tmp_proj->markAsComplete($params);
            logger("{$tmp} is COMPLETE");
            break;
            // Handles the case when a module/project/item is to be marked invalid. Identifiers in $params['identifier']
        // Handles the case when a module/project/item is to be marked invalid. Identifiers in $params['identifier']
        case 'MARK_DISABLED':
            $tmp = $params['identifier']['project_name'];
            $tmp_proj = new ProjectController();
            $tmp_proj->markAsInactive($params);
            logger("{$tmp} is INVALID");
            break;
        case 'NEW_PROJECT':
            $ret = addNewProject($params);
            //$ret = "New project initiated";
            break;
        default:
            # code...
            break;
    }
    return $ret;
}
    if ($action !== "updateResults" || "commitTransaction") {
        $errors[] = "action: \"" . $action . "\"" . " is not a valid action.";
    }
    switch ($invoiceType) {
        case 'sales':
            $table = "s5_1_sales_invoice_line_items";
            break;
        case 'purchases':
            $table = "s6_1_purchases_invoice_line_items";
            break;
        default:
            $errors[] = "invoiceType: \"" . $action . "\"" . " is not a valid invoiceType.";
            break;
    }
    if (empty($errors)) {
        $lineID = mysqli_real_escape_string($dbC2, trim($lineID));
        $pID = mysqli_real_escape_string($dbC2, trim($pID));
        $p = mysqli_real_escape_string($dbC2, trim($p));
        $u = mysqli_real_escape_string($dbC2, trim($u));
        $q = mysqli_real_escape_string($dbC2, trim($q));
        $location = mysqli_real_escape_string($dbC2, trim($location));
        $q1 = "SELECT productID, unit, enteredPrice, quantity FROM {$table} WHERE lineID='{$lineID}'";
        $r1 = mysqli_query($dbC2, $q1);
        if (mysqli_num_rows($r1) !== 1) {
            $errors[] = "Line ID was not found in the database.";
        }
        $q2 = "SELECT productDescription, sellingPriceWholeSale, sellingPriceRetail, defaultSellingUnit, multiplyingFactor, minimumSellingUnit, productType\n\t\tFROM m2_1_inventory_info\n\t\tWHERE productID='{$pID}' AND location='{$location}'";
    }
}
updateLineItem("hi", "yo");