version-dependency-add-2.tcl

Adds a dependency to a version of a package.

Location:
/packages/acs-admin/www/apm/version-dependency-add-2.tcl
Author:
Bryan Quinn
Created:
17 April 2000
CVS ID:
$Id: version-dependency-add-2.tcl,v 1.18.2.1 2024/08/01 12:04:36 gustafn Exp $

Related Files

[ hide source ] | [ make this the default ]

File Contents

ad_page_contract {
    Adds a dependency to a version of a package.
    @author Bryan Quinn
    @creation-date 17 April 2000
    @cvs-id $Id: version-dependency-add-2.tcl,v 1.18.2.1 2024/08/01 12:04:36 gustafn Exp $
} {
    {dependency_id:naturalnum}
    {version_id:naturalnum,notnull}
    dependency_type
    service:notnull
    our_package_key:notnull
    {update_info_file:boolean,notnull true}
}

set service [split $service ";"]
lassign $service package_key version_name

if {$update_info_file} {
    apm_package_install_spec $version_id
}

db_transaction {
    switch -- $dependency_type {
        require {
            apm_dependency_add -dependency_id $dependency_id ${dependency_type}$version_id $package_key $version_name
            apm_build_one_package_relationships $our_package_key
        }

        extend {
            apm_dependency_add -dependency_id $dependency_id ${dependency_type}$version_id $package_key $version_name
            apm_build_one_package_relationships $our_package_key
            apm_copy_inherited_params $our_package_key [list $package_key $version_name]
        }

        embed {
            apm_dependency_add -dependency_id $dependency_id ${dependency_type}$version_id $package_key $version_name
            apm_build_one_package_relationships $our_package_key
            apm_copy_inherited_params $our_package_key [list $package_key $version_name]
        }

        default {
            ad_return_complaint 1 "Entry error: Allowable dependencies are required, extends and embeds."
        }
    }
} on_error {
    if { ![db_string apm_dependency_doubleclick_check {
        select count(*) from apm_package_dependencies
        where dependency_id = :dependency_id
    } -default 0] } {
        ad_return_complaint 1 "The database returned the following error:
        <blockquote><pre>[ns_quotehtml $errmsg]</pre></blockquote>"
    }
}

ad_returnredirect [export_vars -base version-dependencies {version_id}]
ad_script_abort

# Local variables:
#    mode: tcl
#    tcl-indent-level: 4
#    indent-tabs-mode: nil
# End: