Index: openacs-4/packages/contacts-lite/www/add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts-lite/www/add-edit.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/contacts-lite/www/add-edit.tcl 20 Jan 2021 18:35:37 -0000 1.1 +++ openacs-4/packages/contacts-lite/www/add-edit.tcl 20 Jan 2021 21:17:08 -0000 1.2 @@ -27,7 +27,7 @@ set user_id [ad_conn user_id] set peeraddr [ad_conn peeraddr] -if { [exists_and_not_null contact_id] } { +if { [info exists contact_id] && $contact_id ne "" } { set link "Edit Addresses
" set phono_link "Edit Phones" } else { Index: openacs-4/packages/contacts-lite/www/csv-export-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts-lite/www/csv-export-2.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/contacts-lite/www/csv-export-2.tcl 20 Jan 2021 18:35:37 -0000 1.1 +++ openacs-4/packages/contacts-lite/www/csv-export-2.tcl 20 Jan 2021 21:17:08 -0000 1.2 @@ -99,13 +99,13 @@ #append output "where: $where_clause\n" -if { ![string compare [lindex $where_clause 0] "" ] == 0 } { +if { [lindex $where_clause 0] eq "" == 0 } { set where_clause "and c.category_id=[join $where_clause]" } else { set where_clause "" } -if { ![string compare [lindex $sort_by 0] "" ] == 0 } { +if { [lindex $sort_by 0] eq "" == 0 } { set order_by "$where_clause \n order by [join $sort_by ,]" } else { set order_by "$where_clause" Index: openacs-4/packages/contacts-lite/www/delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts-lite/www/delete.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/contacts-lite/www/delete.tcl 20 Jan 2021 18:35:37 -0000 1.1 +++ openacs-4/packages/contacts-lite/www/delete.tcl 20 Jan 2021 21:17:08 -0000 1.2 @@ -10,9 +10,9 @@ contact_id:integer,notnull } -validate { contact_exists -requires {contact_id} { - if ![db_0or1row contact_exists { + if {![db_0or1row contact_exists { select 1 from contacts where contact_id = :contact_id - }] { + }]} { ad_complain "Contact $contact_id does not exist" return 0 } Index: openacs-4/packages/contacts-lite/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts-lite/www/index.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/contacts-lite/www/index.tcl 20 Jan 2021 18:35:37 -0000 1.1 +++ openacs-4/packages/contacts-lite/www/index.tcl 20 Jan 2021 21:17:08 -0000 1.2 @@ -41,7 +41,7 @@ default { set ordering "family_name" } } -if { ![empty_string_p $starts_with] } { +if { $starts_with ne "" } { switch $starts_with { "all" { set starts_with_clause "" } "other" { set starts_with_clause "and family_name is null" } @@ -53,7 +53,7 @@ } -if { $search_p == 1 && ![string equal $search_string ""]} { +if { $search_p == 1 && $search_string ne "" } { switch $search_in { "fname" { set search_clause "and lower(given_name) like '%' || lower(:search_string) || '%'" } "lname" { set search_clause "and lower(family_name) like '%' || lower(:search_string) || '%'" } @@ -89,7 +89,7 @@ order by $ordering" { incr count if { $count < $start } continue - if { $count >= [expr $start + $max_dspl] } break + if { $count >= ($start + $max_dspl)] } break } # and o.context_id = :package_id @@ -104,36 +104,36 @@ # and o.context_id = :package_id # make paging links -if { $count < [expr $start + $max_dspl] } { +if { $count < ($start + $max_dspl) } { set next_start "" } else { - if {[expr $start + 2 * $max_dspl - $total_contacts] < 0 } { + if {($start + 2 * $max_dspl - $total_contacts) < 0 } { set next_val $max_dspl } else { - set next_val [expr $total_contacts - $start - $max_dspl + 1] + set next_val [expr {$total_contacts - $start - $max_dspl + 1}] } - set next_start "NEXT $next_val" + set next_start "NEXT $next_val" } if { $start == 1 } { set prev_start "" } else { - set prev_start "PREV $max_dspl" + set prev_start "PREV $max_dspl" } -if { ![empty_string_p $next_start] && ![empty_string_p $prev_start] } { +if { $next_start ne "" && $prev_start ne "" } { set divider " | " } else { set divider "" } -if { [expr $start + $max_dspl - 1] > $total_contacts } { +if { ($start + $max_dspl - 1) > $total_contacts } { if { $total_contacts == 0 } { set start 0 } set showing "Showing: $start - $total_contacts" } else { - set showing "Showing: $start - [expr $start + $max_dspl - 1]" + set showing "Showing: $start - [expr {$start + $max_dspl - 1}]" } set pagination_link " $prev_start$divider$next_start " Index: openacs-4/packages/contacts-lite/www/one.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts-lite/www/one.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/contacts-lite/www/one.tcl 20 Jan 2021 18:35:37 -0000 1.1 +++ openacs-4/packages/contacts-lite/www/one.tcl 20 Jan 2021 21:17:08 -0000 1.2 @@ -8,9 +8,9 @@ contact_id:integer,notnull } -validate { contact_exists -requires {contact_id} { - if ![db_0or1row contact_exists { + if {![db_0or1row contact_exists { select 1 from contacts where contact_id = :contact_id - }] { + }]} { ad_complain "Contact $contact_id does not exist" return 0 } @@ -28,7 +28,7 @@ set contact_admin_p [group::member_p -group_name "Employees"] set admin $contact_admin_p -if { ![string equal $admin "1"] } { +if { $admin ne "1" } { set contact_write_p [ad_permission_p $contact_id "write"] } else { set contact_write_p 1 Index: openacs-4/packages/contacts-lite/www/addresses/address-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts-lite/www/addresses/address-delete.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/contacts-lite/www/addresses/address-delete.tcl 20 Jan 2021 18:35:37 -0000 1.1 +++ openacs-4/packages/contacts-lite/www/addresses/address-delete.tcl 20 Jan 2021 21:17:08 -0000 1.2 @@ -11,9 +11,9 @@ contact_id:integer,notnull } -validate { address_exists -requires {address_id} { - if ![db_0or1row address_exists { + if {![db_0or1row address_exists { select 1 from cn_addresses where address_id = :address_id - }] { + }]} { ad_complain "Address $address_id does not exist" return 0 } Index: openacs-4/packages/contacts-lite/www/addresses/delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts-lite/www/addresses/delete.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/contacts-lite/www/addresses/delete.tcl 20 Jan 2021 18:35:37 -0000 1.1 +++ openacs-4/packages/contacts-lite/www/addresses/delete.tcl 20 Jan 2021 21:17:08 -0000 1.2 @@ -10,7 +10,7 @@ address_id:integer,notnull } -validate { address_exists -requires {address_id} { - if ![db_0or1row address_exists { }] { + if {![db_0or1row address_exists { }]} { ad_complain "Address $address_id does not exist" return 0 } Index: openacs-4/packages/contacts-lite/www/addresses/one.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts-lite/www/addresses/one.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/contacts-lite/www/addresses/one.tcl 20 Jan 2021 18:35:37 -0000 1.1 +++ openacs-4/packages/contacts-lite/www/addresses/one.tcl 20 Jan 2021 21:17:08 -0000 1.2 @@ -9,7 +9,7 @@ contact_id:integer,notnull } -validate { address_exists -requires {address_id} { - if ![db_0or1row address_exists { }] { + if {![db_0or1row address_exists {}]} { ad_complain "Address $address_id does not exist" return 0 } Index: openacs-4/packages/contacts-lite/www/admin/address-type/add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts-lite/www/admin/address-type/add-edit.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/contacts-lite/www/admin/address-type/add-edit.tcl 20 Jan 2021 18:35:37 -0000 1.1 +++ openacs-4/packages/contacts-lite/www/admin/address-type/add-edit.tcl 20 Jan 2021 21:17:08 -0000 1.2 @@ -48,11 +48,11 @@ ### start of processing of update/new ####################################### -if [template::form is_valid new_address_type_name] { +if {[template::form is_valid new_address_type_name]} { set user_id [ad_conn user_id] set peeraddr [ad_conn peeraddr] - if [info exists address_type_id] { + if {[info exists address_type_id]} { db_dml address_set { } } else { Index: openacs-4/packages/contacts-lite/www/admin/address-type/delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts-lite/www/admin/address-type/delete.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/contacts-lite/www/admin/address-type/delete.tcl 20 Jan 2021 18:35:37 -0000 1.1 +++ openacs-4/packages/contacts-lite/www/admin/address-type/delete.tcl 20 Jan 2021 21:17:08 -0000 1.2 @@ -10,9 +10,9 @@ address_type_id:integer,notnull } -validate { address_type_exists -requires {address_type_id} { - if ![db_0or1row address_type_exists { + if {![db_0or1row address_type_exists { - }] { + }]} { ad_complain "Address Type $address_type_id does not exist" return 0 } Index: openacs-4/packages/contacts-lite/www/admin/categories/add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts-lite/www/admin/categories/add-edit.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/contacts-lite/www/admin/categories/add-edit.tcl 20 Jan 2021 18:35:37 -0000 1.1 +++ openacs-4/packages/contacts-lite/www/admin/categories/add-edit.tcl 20 Jan 2021 21:17:08 -0000 1.2 @@ -54,11 +54,11 @@ ### start of processing of update/new ####################################### -if [template::form is_valid new_category] { +if {[template::form is_valid new_category]} { set user_id [ad_conn user_id] set peeraddr [ad_conn peeraddr] - if [info exists category_id] { + if {[info exists category_id]} { db_dml category_update { update contact_categories set category_name = :category_name Index: openacs-4/packages/contacts-lite/www/admin/categories/delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts-lite/www/admin/categories/delete.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/contacts-lite/www/admin/categories/delete.tcl 20 Jan 2021 18:35:37 -0000 1.1 +++ openacs-4/packages/contacts-lite/www/admin/categories/delete.tcl 20 Jan 2021 21:17:08 -0000 1.2 @@ -10,9 +10,9 @@ category_id:integer,notnull } -validate { category_exists -requires {category_id} { - if ![db_0or1row category_exists { + if {![db_0or1row category_exists { select 1 from contact_categories where category_id = :category_id - }] { + }]} { ad_complain "Category $category_id does not exist" return 0 } Index: openacs-4/packages/contacts-lite/www/admin/company-type/add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts-lite/www/admin/company-type/add-edit.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/contacts-lite/www/admin/company-type/add-edit.tcl 20 Jan 2021 18:35:37 -0000 1.1 +++ openacs-4/packages/contacts-lite/www/admin/company-type/add-edit.tcl 20 Jan 2021 21:17:08 -0000 1.2 @@ -52,11 +52,11 @@ ### start of processing of update/new ####################################### -if [template::form is_valid new_company_type_name] { +if {[template::form is_valid new_company_type_name]} { set user_id [ad_conn user_id] set peeraddr [ad_conn peeraddr] - if [info exists company_type_id] { + if {[info exists company_type_id]} { db_dml company_set { } } else { Index: openacs-4/packages/contacts-lite/www/admin/company-type/delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts-lite/www/admin/company-type/delete.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/contacts-lite/www/admin/company-type/delete.tcl 20 Jan 2021 18:35:37 -0000 1.1 +++ openacs-4/packages/contacts-lite/www/admin/company-type/delete.tcl 20 Jan 2021 21:17:08 -0000 1.2 @@ -10,9 +10,9 @@ company_type_id:integer,notnull } -validate { company_type_exists -requires {company_type_id} { - if ![db_0or1row company_type_exists { + if {![db_0or1row company_type_exists { - }] { + }]} { ad_complain "Company Type $company_type_id does not exist" return 0 } Index: openacs-4/packages/contacts-lite/www/admin/phone-type/add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts-lite/www/admin/phone-type/add-edit.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/contacts-lite/www/admin/phone-type/add-edit.tcl 20 Jan 2021 18:35:37 -0000 1.1 +++ openacs-4/packages/contacts-lite/www/admin/phone-type/add-edit.tcl 20 Jan 2021 21:17:08 -0000 1.2 @@ -48,11 +48,11 @@ ### start of processing of update/new ####################################### -if [template::form is_valid new_phone_type_name] { +if {[template::form is_valid new_phone_type_name]} { set user_id [ad_conn user_id] set peeraddr [ad_conn peeraddr] - if [info exists phone_type_id] { + if {[info exists phone_type_id]} { db_dml phone_set { } } else { Index: openacs-4/packages/contacts-lite/www/admin/phone-type/delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts-lite/www/admin/phone-type/delete.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/contacts-lite/www/admin/phone-type/delete.tcl 20 Jan 2021 18:35:37 -0000 1.1 +++ openacs-4/packages/contacts-lite/www/admin/phone-type/delete.tcl 20 Jan 2021 21:17:08 -0000 1.2 @@ -7,14 +7,17 @@ @cvs-id $Id$ $Log$ + Revision 1.1 2021/01/20 18:35:37 gustafn + New package as provided by Jon Griffin + } { phone_type_id:integer,notnull } -validate { phone_type_exists -requires {phone_type_id} { - if ![db_0or1row phone_type_exists { + if {![db_0or1row phone_type_exists { - }] { + }]} { ad_complain "Phone Type $phone_type_id does not exist" return 0 } Index: openacs-4/packages/contacts-lite/www/phones/delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts-lite/www/phones/delete.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/contacts-lite/www/phones/delete.tcl 20 Jan 2021 18:35:37 -0000 1.1 +++ openacs-4/packages/contacts-lite/www/phones/delete.tcl 20 Jan 2021 21:17:08 -0000 1.2 @@ -10,9 +10,9 @@ phone_number_id:integer,notnull } -validate { phone_exists -requires {phone_number_id} { - if ![db_0or1row phone_exists { + if {![db_0or1row phone_exists { select 1 from cn_phone_numbers where phone_number_id = :phone_number_id - }] { + }]} { ad_complain "phone $phone_number_id does not exist" return 0 }