Add procedure stockproduct_create (#340)
* Add procedure stockproduct_create * Replace tabs with spaces * Set visible end browsable default = 0
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
-- PROCEDURE: public.stockproduct_create(text, text, text, integer, integer, integer, integer)
|
||||
|
||||
DROP PROCEDURE IF EXISTS public.stockproduct_create;
|
||||
|
||||
CREATE OR REPLACE PROCEDURE public.stockproduct_create(
|
||||
_article_number text,
|
||||
_name text,
|
||||
_path text,
|
||||
_visible integer DEFAULT 0,
|
||||
_browsable integer DEFAULT 0,
|
||||
INOUT _product_id integer DEFAULT NULL::integer,
|
||||
INOUT _stock_id integer DEFAULT NULL::integer)
|
||||
LANGUAGE 'plpgsql'
|
||||
AS $BODY$
|
||||
|
||||
BEGIN
|
||||
INSERT INTO "product-products" (path, visible, browsable)
|
||||
VALUES (_path, _visible, _browsable)
|
||||
RETURNING productid INTO _product_id;
|
||||
|
||||
INSERT INTO "product-products_fields" (productid, fieldid, value)
|
||||
VALUES
|
||||
(_product_id, 1, _article_number),
|
||||
(_product_id, 2, _name);
|
||||
|
||||
INSERT INTO stockproducts (product_id, name, in_stock)
|
||||
VALUES (_product_id, _name, true)
|
||||
RETURNING id INTO _stock_id;
|
||||
END;
|
||||
$BODY$;
|
||||
Reference in New Issue
Block a user