Example #1
0
            ecommerce.alertsArea(
                form,
                "Sales tax data could not be saved, could not connect to db" +
                dbResult['message'])

        else:

            db = dbResult['result']

            if form["key_id"].value == 'create':

                form["key_id"].value = form['state_abbreviation'].value

            # save the Form
            dbResult = ecommerce.saveForm(
                table_data, db, None, "sales_tax_by_state",
                " WHERE state_name = '" + form["key_id"].value + "'", form)

            # if the form was not successfully saved
            if dbResult['status'] != 'success':
                ecommerce.alertsArea(
                    form,
                    "Sales tax data could not be saved due to an error during save,\n"
                    + dbResult['message'])

            # form was successfully saved
            else:

                table_data = declarations.define_tables()
                table_data = ecommerce.formToTableData(table_data,
                                                       'sales_tax_by_state',
		dbResult = ecommerce.connectDB(form["uHidden"].value, form["pHidden"].value,declarations.store_info['db_name'])

		if dbResult['status'] != 'success':

			 ecommerce.alertsArea(form,"Product Categories could not be saved, could not connect to db" + dbResult['message'])

		else:

			db = dbResult['result']

			if form["key_id"].value == 'create':

					form["key_id"].value = form['category'].value

			# save the Form
			dbResult = ecommerce.saveForm(table_data, db, None, "product_categories", " WHERE category = '" + form["key_id"].value + "'", form)

			# if the form was not successfully saved
			if dbResult['status'] != 'success':
				ecommerce.alertsArea(form,"Product Categories could not be saved due to an error during save,\n" + dbResult['message'] )

			# form was successfully saved
			else:

				table_data = declarations.define_tables()
				table_data = ecommerce.formToTableData(table_data,'product_categories', form)

				ecommerce.display_form(table_data, 'product_categories', 1, 'useValues', 1, db)
			
				ecommerce.alertsArea(form,"Product Categories successfully saved")
Example #3
0
                dbResult['message'])

        else:

            db = dbResult['result']

            if form["key_id"].value == 'create':

                queryResult = ecommerce.executeSQL(
                    db, "SELECT NEXTVAL('customer_id_seq')")

                form["key_id"].value = ` queryResult['result'][0]['nextval'] `

            # save the Form
            dbResult = ecommerce.saveForm(
                table_data, db, form["key_id"].value, "customers",
                " WHERE id = '" + form["key_id"].value + "'", form)

            # if the form was not successfully saved
            if dbResult['status'] != 'success':
                ecommerce.alertsArea(
                    form,
                    "Customer data could not be saved due to an error during save,\n"
                    + dbResult['message'])

            # form was successfully saved
            else:

                table_data = declarations.define_tables()
                table_data = ecommerce.formToTableData(table_data, 'customers',
                                                       form,
Example #4
0
							continue

					table_data['order_items']['line_item']['value'] = `cur_line_item`
				
					table_data['order_items']['order_id']['value'] = form['key_id'].value
					table_data['order_items']['product_id']['value'] = string.strip(form['product_id' + `i`].value)
					table_data['order_items']['quantity']['value'] = string.strip(form['quantity' + `i`].value)
					table_data['order_items']['quantity_shipped']['value'] = string.strip(form['quantity_shipped' + `i`].value)
					table_data['order_items']['price']['value'] = string.strip(form['price' + `i`].value)
				
					lineTotal = string.atoi(form['quantity' + `i`].value) * string.atof(form['price'+ `i`].value)
				
					table_data['order_items']['line_subtotal']['value'] = '%9.2f' % (lineTotal)
				
					# put order item in db
					dbResult = ecommerce.saveForm(table_data, db, None, "order_items", None, form, 0, 0, 1)

					# if the form was not successfully saved
					if dbResult['status'] != 'success':
						ecommerce.alertsArea(form,"Order items could not be saved due to an error during save,\n" + dbResult['message'] )
						print "</FORM>"
						
						ecommerce.trailer(table_data, db)
						db.close()

						print "</BODY>"
						print "</HTML>"
						sys.exit(1)

					i = i + 1
					cur_line_item = cur_line_item + 1
		dbResult = ecommerce.connectDB(form["uHidden"].value, form["pHidden"].value,declarations.store_info['db_name'])

		if dbResult['status'] != 'success':

			 ecommerce.alertsArea(form,"Order Status could not be saved, could not connect to db" + dbResult['message'])

		else:

			db = dbResult['result']

			if form["key_id"].value == 'create':

					form["key_id"].value = form['status_of_order'].value

			# save the Form
			dbResult = ecommerce.saveForm(table_data, db, None, "order_status_values", " WHERE status_of_order = '" + form["key_id"].value + "'", form)

			# if the form was not successfully saved
			if dbResult['status'] != 'success':
				ecommerce.alertsArea(form,"Order Status could not be saved due to an error during save,\n" + dbResult['message'] )

			# form was successfully saved
			else:

				table_data = declarations.define_tables()
				table_data = ecommerce.formToTableData(table_data,'order_status_values', form)

				ecommerce.display_form(table_data, 'order_status_values', 1, 'useValues', 1, db)
			
				ecommerce.alertsArea(form,"Order Status successfully saved")
		dbResult = ecommerce.connectDB(form["uHidden"].value, form["pHidden"].value,declarations.store_info['db_name'])

		if dbResult['status'] != 'success':

			 ecommerce.alertsArea(form,"Shipping Methods could not be saved, could not connect to db" + dbResult['message'])

		else:

			db = dbResult['result']

			if form["key_id"].value == 'create':

					form["key_id"].value = form['method'].value

			# save the Form
			dbResult = ecommerce.saveForm(table_data, db, None, "shipping_methods", " WHERE method = '" + form["key_id"].value + "'", form)

			# if the form was not successfully saved
			if dbResult['status'] != 'success':
				ecommerce.alertsArea(form,"Shipping Methods could not be saved due to an error during save,\n" + dbResult['message'] )

			# form was successfully saved
			else:

				table_data = declarations.define_tables()

				table_data = ecommerce.formToTableData(table_data,'shipping_methods', form)

				ecommerce.display_form(table_data, 'shipping_methods', 1, 'useValues', 1, db)
			
				ecommerce.alertsArea(form,"Shipping Methods successfully saved")
Example #7
0
		dbResult = ecommerce.connectDB(form["uHidden"].value, form["pHidden"].value,declarations.store_info['db_name'])

		if dbResult['status'] != 'success':

			 ecommerce.alertsArea(form,"Payment Method could not be saved, could not connect to db" + dbResult['message'])

		else:

			db = dbResult['result']

			if form["key_id"].value == 'create':

					form["key_id"].value = form['payment_type'].value

			# save the Form
			dbResult = ecommerce.saveForm(table_data, db, None, "payment_methods", " WHERE payment_type = '" + form["key_id"].value + "'", form)

			# if the form was not successfully saved
			if dbResult['status'] != 'success':
				ecommerce.alertsArea(form,"Payment Method could not be saved due to an error during save,\n" + dbResult['message'] )

			# form was successfully saved
			else:

				table_data = declarations.define_tables()
				table_data = ecommerce.formToTableData(table_data,'payment_methods', form)

				ecommerce.display_form(table_data, 'payment_methods', 1, 'useValues', 1, db)
			
				ecommerce.alertsArea(form,"Payment Method successfully saved")
Example #8
0
            db = dbResult['result']

            if form["key_id"].value == 'create':

                queryResult = ecommerce.executeSQL(
                    db, "SELECT NEXTVAL('properties_id_seq')")

                form["key_id"].value = ` queryResult['result'][0]['nextval'] `

            # save the Form

            dbResult = ecommerce.saveForm(table_data=table_data,
                                          db=db,
                                          key=form["key_id"].value,
                                          table_name="properties",
                                          where_clause=" WHERE id = '" +
                                          form["key_id"].value + "'",
                                          form=form,
                                          echoStatement=0)

            # if the form was not successfully saved
            if dbResult['status'] != 'success':
                ecommerce.alertsArea(
                    form,
                    "Property data could not be saved due to an error during save,\n"
                    + dbResult['message'])

            # form was successfully saved
            else:

                table_data = ecommerce.formToTableData(table_data,
Example #9
0
                                       form["pHidden"].value,
                                       declarations.store_info['db_name'])

        if dbResult['status'] != 'success':

            ecommerce.alertsArea(
                form,
                "Store Info could not be saved, could not connect to db" +
                dbResult['message'])

        else:

            db = dbResult['result']

            # save the Form
            dbResult = ecommerce.saveForm(table_data, db, None, "store_info",
                                          " WHERE id = '1'", form)

            # if the form was not successfully saved
            if dbResult['status'] != 'success':
                ecommerce.alertsArea(
                    form,
                    "Store Info could not be saved due to an error during save,\n"
                    + dbResult['message'])

            # form was successfully saved
            else:

                table_data = declarations.define_tables()
                table_data = ecommerce.formToTableData(table_data,
                                                       'store_info', form)