<?php

/*
	groups/edit-process.php

	access: products_write

	Allows product groups to be adjusted or created.
*/
// includes
require "../include/config.php";
require "../include/amberphplib/main.php";
// custom includes
require "../include/products/inc_products_groups.php";
if (user_permissions_get('products_write')) {
    $obj_product_group = new product_groups();
    /*
    	Load POST data
    */
    $obj_product_group->id = @security_form_input_predefined("int", "id_product_group", 0, "");
    $obj_product_group->data["group_name"] = @security_form_input_predefined("any", "group_name", 1, "");
    $obj_product_group->data["group_description"] = @security_form_input_predefined("any", "group_description", 0, "");
    $obj_product_group->data["id_parent"] = @security_form_input_predefined("int", "id_parent", 0, "");
    /*
    	Error Handling
    */
    // verify valid ID (if performing update)
    if ($obj_product_group->id) {
        if (!$obj_product_group->verify_id()) {
            log_write("error", "process", "The product group you have attempted to edit - " . $obj_product_group->id . " - does not exist in this system.");
        }
<?php

/*
	groups/delete-process.php

	access: products_write

	Deletes an unwanted product group.
*/
// includes
require "../include/config.php";
require "../include/amberphplib/main.php";
// custom includes
require "../include/products/inc_products_groups.php";
if (user_permissions_get('products_write')) {
    $obj_product_group = new product_groups();
    /*
    	Load POST data
    */
    $obj_product_group->id = @security_form_input_predefined("int", "id_product_group", 1, "");
    // needed to make error handling work nicely
    @security_form_input_predefined("any", "group_name", 1, "");
    @security_form_input_predefined("any", "group_description", 0, "");
    // verify deletion
    @security_form_input_predefined("any", "delete_confirm", 1, "You must confirm the deletion");
    /*
    	Error Handling
    */
    // verify valid ID
    if (!$obj_product_group->verify_id()) {
        log_write("error", "process", "The product group you have attempted to delete - " . $obj_product_group->id . " - does not exist in this system.");