category_tree::add (public)

 category_tree::add [ -tree_id tree_id ] -name name \
    [ -description description ] [ -site_wide_p site_wide_p ] \
    [ -locale locale ] [ -user_id user_id ] \
    [ -creation_ip creation_ip ] [ -context_id context_id ]

Defined in packages/categories/tcl/category-trees-procs.tcl

Insert a new category tree. The same translation will be added in the default language if it's in a different language.

Switches:
-tree_id (optional)
-name (required)
-description (optional)
-site_wide_p (optional, defaults to "f")
-locale (optional)
-user_id (optional)
-creation_ip (optional)
-context_id (optional)
Options:
-tree_id
tree_id of the category tree to be inserted.
-locale
locale of the language. [ad_conn locale] used by default.
-name
tree name.
-description
description of the category tree.
-user_id
user that adds the category tree. [ad_conn user_id] used by default.
-creation_ip
ip-address of the user that adds the category tree. [ad_conn peeraddr] used by default.
-context_id
context_id of the category tree. [ad_conn package_id] used by default.
Returns:
tree_id
Author:
Timo Hentschel <timo@timohentschel.de>

Partial Call Graph (max 5 caller/called nodes):
%3 test_category_crud category_crud (test categories) category_tree::add category_tree::add test_category_crud->category_tree::add test_category_get_procs category_get_procs (test categories) test_category_get_procs->category_tree::add test_category_link category_link (test categories) test_category_link->category_tree::add test_category_synonyms category_synonyms (test categories) test_category_synonyms->category_tree::add test_category_tree_procs category_tree_procs (test categories) test_category_tree_procs->category_tree::add ad_conn ad_conn (public) category_tree::add->ad_conn category_tree::flush_translation_cache category_tree::flush_translation_cache (public) category_tree::add->category_tree::flush_translation_cache db_exec_plsql db_exec_plsql (public) category_tree::add->db_exec_plsql db_transaction db_transaction (public) category_tree::add->db_transaction parameter::get parameter::get (public) category_tree::add->parameter::get category_tree::import category_tree::import (public) category_tree::import->category_tree::add category_tree::xml::import category_tree::xml::import (public) category_tree::xml::import->category_tree::add packages/categories/lib/tree-form.tcl packages/categories/ lib/tree-form.tcl packages/categories/lib/tree-form.tcl->category_tree::add

Testcases:
category_synonyms, category_link, category_crud, category_get_procs, category_tree_procs
Source code:
        if {$user_id eq ""} {
            set user_id [ad_conn user_id]
        }
        if {$creation_ip eq ""} {
            set creation_ip [ad_conn peeraddr]
        }
        if {$locale eq ""} {
            set locale [ad_conn locale]
        }
        if {$context_id eq ""} {
            set context_id [ad_conn package_id]
        }
        db_transaction {
            set tree_id [db_exec_plsql insert_tree ""]

            set default_locale [parameter::get -parameter DefaultLocale -default en_US]
            if {$locale != $default_locale} {
                db_exec_plsql insert_default_tree ""
            }
        }

        category_tree::flush_translation_cache $tree_id
        return $tree_id
XQL Not present:
Generic
PostgreSQL XQL file:
<fullquery name="category_tree::add.insert_tree">
    <querytext>
        	select category_tree__new (
					 :tree_id,
					 :locale,
					 :name,
					 :description,
                                         :site_wide_p,
                                         current_timestamp,
					 :user_id,
					 :creation_ip,
					 :context_id
					 )
      </querytext>
</fullquery>

<fullquery name="category_tree::add.insert_default_tree">
    <querytext>
		    select category_tree__new_translation (
						   :tree_id,
						   :default_locale,
						   :name,
						   :description,
                                                   current_timestamp,
						   :user_id,
						   :creation_ip
						   )
      </querytext>
</fullquery>
packages/categories/tcl/category-trees-procs-postgresql.xql

Oracle XQL file:
<fullquery name="category_tree::add.insert_tree">
    <querytext>
      
		begin
		:1 := category_tree.new (
					 tree_id       => :tree_id,
					 tree_name     => :name,
					 description   => :description,
					 locale        => :locale,
					 creation_user => :user_id,
					 creation_ip   => :creation_ip,
					 context_id    => :context_id
					 );
		end;
	    
      </querytext>
</fullquery>

<fullquery name="category_tree::add.insert_default_tree">
    <querytext>
      
		    begin
		    category_tree.new_translation (
						   tree_id        => :tree_id,
						   tree_name      => :name,
						   description    => :description,
						   locale         => :default_locale,
						   modifying_user => :user_id,
						   modifying_ip   => :creation_ip
						   );
		    end;
		
      </querytext>
</fullquery>
packages/categories/tcl/category-trees-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: