category::update (public)

 category::update -category_id category_id -name name \
    [ -locale locale ] [ -description description ] \
    [ -user_id user_id ] [ -modifying_ip modifying_ip ]

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

Updates/inserts a category translation.

Switches:
-category_id (required)
-name (required)
-locale (optional)
-description (optional)
-user_id (optional)
-modifying_ip (optional)
Options:
-category_id
category_id of the category to be updated.
-locale
locale of the language. [ad_conn locale] used by default.
-name
category name.
-description
description of the category.
-user_id
user that updates the category. [ad_conn user_id] used by default.
-modifying_ip
ip-address of the user that updates the category. [ad_conn peeraddr] used by default.
Author:
Timo Hentschel <timo@timohentschel.de>

Partial Call Graph (max 5 caller/called nodes):
%3 test_category_crud category_crud (test categories) category::update category::update test_category_crud->category::update ad_conn ad_conn (public) category::update->ad_conn category::flush_translation_cache category::flush_translation_cache (public) category::update->category::flush_translation_cache db_0or1row db_0or1row (public) category::update->db_0or1row db_exec_plsql db_exec_plsql (public) category::update->db_exec_plsql db_transaction db_transaction (public) category::update->db_transaction category_tree::xml::add_category category_tree::xml::add_category (private) category_tree::xml::add_category->category::update packages/categories/www/cadmin/category-form.tcl packages/categories/ www/cadmin/category-form.tcl packages/categories/www/cadmin/category-form.tcl->category::update

Testcases:
category_crud
Source code:
    if {$user_id eq ""} {
        set user_id [ad_conn user_id]
    }
    if {$modifying_ip eq ""} {
        set modifying_ip [ad_conn peeraddr]
    }
    if {$locale eq ""} {
        set locale [ad_conn locale]
    }
    db_transaction {
        if {![db_0or1row check_category_existence {
            select 1
            from category_translations
            where category_id = :category_id
            and locale = :locale
        }]} {
            db_exec_plsql insert_category_translation ""
        } else {
            db_exec_plsql update_category_translation ""
        }
        flush_translation_cache $category_id
    }
XQL Not present:
Generic
PostgreSQL XQL file:
<fullquery name="category::update.insert_category_translation">
    <querytext>
		    select category__new_translation (
					      :category_id,
					      :locale,
					      :name,
					      :description,
                                              current_timestamp,
					      :user_id,
					      :modifying_ip
					      )
      </querytext>
</fullquery>

<fullquery name="category::update.update_category_translation">
    <querytext>
		    select category__edit (
				   :category_id,
				   :locale,
				   :name,
				   :description,
                                   current_timestamp,
				   :user_id,
				   :modifying_ip
				   )
      </querytext>
</fullquery>
packages/categories/tcl/categories-procs-postgresql.xql

Oracle XQL file:
<fullquery name="category::update.insert_category_translation">
    <querytext>
      
		    begin
		    category.new_translation (
					      category_id    => :category_id,
					      locale         => :locale,
					      name           => :name,
					      description    => :description,
					      modifying_user => :user_id,
					      modifying_ip   => :modifying_ip
					      );
		    end;
		
      </querytext>
</fullquery>

<fullquery name="category::update.update_category_translation">
    <querytext>
      
		    begin
		    category.edit (
				   category_id    => :category_id,
				   locale         => :locale,
				   name           => :name,
				   description    => :description,
				   modifying_user => :user_id,
				   modifying_ip   => :modifying_ip
				   );
		    end;
		
      </querytext>
</fullquery>
packages/categories/tcl/categories-procs-oracle.xql

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