Example #1
0
        'default_tax_id'    => $_POST['default_tax_id'],
        'default_tax_id_2'  => NULL,
        'cost'              => $_POST['cost'],
        'reorder_level'     => $_POST['reoder_level'],
        'custom_field1'     => $_POST['custom_field1'],
        'custom_field2'     => $_POST['custom_field2'],
        'custom_field3'     => $_POST['custom_field3'],
        'custom_field4'     => $_POST['custom_field4'],
        'notes'             => $_POST['notes'],
        'enabled'           => 1,
        'visible'           => 1
    );
	if($id = $SI_PRODUCTS->insert($data)) {
		$product_id = $SI_PRODUCTS->getLastInsertId();
 		$saved = true;
 		saveCustomFieldValues($_POST['categorie'], lastInsertId());
 	}
 	

 	$i = 1;
 	while ($i <= 3 )
 	{
 		if(!empty($_POST['attribute_'.$i]))
 		{
	 		$sql = "INSERT into
				".TB_PREFIX."products_matrix
			VALUES
				(
					NULL,
					:product_id,
					:product_attribute_number,
Example #2
0
* 	http://www.simpleinvoices.or
*/
//stop the direct browsing to this file - let index.php handle which files get displayed
checkLogin();
$pageActive = "invoices";
$smarty->assign('pageActive', $pageActive);
# Deal with op and add some basic sanity checking
if (!isset($_POST['type']) && !isset($_POST['action'])) {
    exit("no save action");
}
$saved = false;
$type = $_POST['type'];
if ($_POST['action'] == "insert") {
    if (insertInvoice($type)) {
        $invoice_id = lastInsertId();
        saveCustomFieldValues($_POST['categorie'], $invoice_id);
        $saved = true;
    }
    /*
     * 1 = Total Invoices
     */
    if ($type == 1 && $saved) {
        insertProduct(0, 0);
        $product_id = lastInsertId();
        if (matrix_invoice::insertInvoiceItem($invoice_id, 1, $product_id, $_POST['tax_id'], $_POST['description'])) {
            //$saved = true;
        } else {
            die(end($dbh->errorInfo()));
        }
    } elseif ($saved) {
        for ($i = 0; !empty($_POST["quantity{$i}"]) && $i < $_POST['max_items']; $i++) {