|
From: <si...@us...> - 2006-04-12 09:15:46
|
Revision: 671 Author: sickpig Date: 2006-04-12 02:15:37 -0700 (Wed, 12 Apr 2006) ViewCVS: http://svn.sourceforge.net/yaacs/?rev=671&view=rev Log Message: ----------- * handle error the same way we do in admin.tcl an sample.tcl (more to do on this) Modified Paths: -------------- trunk/yaacs/cati.tcl trunk/yacati.tcl Modified: trunk/yaacs/cati.tcl =================================================================== --- trunk/yaacs/cati.tcl 2006-04-12 08:19:29 UTC (rev 670) +++ trunk/yaacs/cati.tcl 2006-04-12 09:15:37 UTC (rev 671) @@ -25,6 +25,13 @@ variable ::cati::bb_single_type 1 variable ::cati::bb_sum_type 2 variable ::cati::bb_pause_list [list] + + #code err and msg + + variable ::cati::ERRMSG + variable ::cati::ERR + + variable ::cati::ERR_ } @@ -510,7 +517,9 @@ set prio [::yamisc::conf_priorita $db $state] if { $prio == -1 } { - return [list -1 [mc "There's an error on priority configuration!"]] + set ::cati::ERR $::cati::ERR_PRIO + set ::cati::ERRMSG [mc "There's an error on priority configuration!"] + return -1 } if {$recruit} { @@ -558,20 +567,28 @@ # <something else> --> hopefully it's a valid timestamp, so let's go to set # the call back; switch $date { - -1 {return [list -1 [mc "Unable to fix a call back: a (valid) timestamp is needed."]]} - "" {yalog::debug "We can safely continue, we are on last retry, no call backs are needed"} + -1 { + set ::cati::ERR $::cati::ERR_DATE + set ::cati::ERRMSG [mc "Unable to fix a call back: a (valid) timestamp is needed."] + return -1 + } + "" {::yalog::debug "We can safely continue, we are on last retry, no call backs are needed"} default { set sql "select ${storeCallBack}( $contact(rid),$contact(com_sql),'$date', $survey(proj), $prio)" if {[::yadb::execl $db $sql]} { ::yalog::error "unable to fix tha call back, check db logs " - return [list -1 [mc "Data Base error while callback saving. "]] + set ::cati::ERR $::cati::ERR_STOR + set ::cati::ERRMSG [mc "Data Base error while callback saving"] + return -1 } if {$contact(annoapp)==""} {set contact(annoapp) "null"} set sql_appstuff "update $schedule set name='$contact(nomeapp)', byear=$contact(annoapp), sex='$contact(sexapp)', \ uid=$user(uid) where rid=$contact(rid) and cod_com=$contact(com_sql) and proj=$survey(proj)" if {[::yadb::execl $db $sql_appstuff] == -1} { - return [list -1 [mc "Error on saving call back infos. Check them and try again"]] + set ::cati::ERR $::cati::ERR_ANAG + set ::cati::ERRMSG [mc "Error on saving call back infos. Check them and try again"] + return -1 } } @@ -592,7 +609,9 @@ set ne [::yadb::execl $db "update $tcontacts set quota=true where rid= $contact(rid) and cod_com=$contact(com_sql)"] if {$ne == -1} { - return [list -1 [mc "unable to set contact $contact(rid) (and cod_com is $contact(com_sql) as no elegible"]] + set ::cati::ERR $::cati::ERR_QUOT + set ::cati::ERRMSG [mc "unable to set contact $contact(rid) (and cod_com is $contact(com_sql) as no elegible"] + return -1 } } @@ -608,7 +627,9 @@ set up [::yadb::execl $db $sql] if {$up == -1} { ::yalog::error "unable to update contact's data on db." - return [list -1 [mc "Error while saving contact's data. Please contact YaaCs's administrator"]] + set ::cati::ERR $::cati::ERR_QUOT + set ::cati::ERRMSG [mc "Error while saving contact's data. Please contact YaaCs's administrator"] + return -1 } return 0 Modified: trunk/yacati.tcl =================================================================== --- trunk/yacati.tcl 2006-04-12 08:19:29 UTC (rev 670) +++ trunk/yacati.tcl 2006-04-12 09:15:37 UTC (rev 671) @@ -786,8 +786,8 @@ [::yacati::getWdjValue tel3] [yacati::getWdjValue tel4] [array get survey] \ [array get contact] [array get user] $::yacati::recruit $edata(email)] - if {[lindex $res 0] == -1} { - return [::yatk_dlg::error [lindex $res 1]] + if {$res == -1} { + return [::yatk_dlg::error $::cati::ERRMSG] } ::cati::managePhones $db $::yacati::phoneStatus(phone1) $::yacati::phoneStatus(phone2) \ @@ -980,8 +980,8 @@ [::yacati::getWdjValue tel3] [::yacati::getWdjValue tel4] [array get survey] [array get contact] \ [array get user] $::yacati::recruit $edata(email) $ret(timestamp)] - if {[lindex $res 0] == -1} { - return [::yatk_dlg::error [lindex $res 1]] + if {$res == -1} { + return [::yatk_dlg::error $::cati::ERRMSG] } if { $ret(annoapp) == "" } { @@ -1043,8 +1043,8 @@ [::yacati::getWdjValue tel3] [::yacati::getWdjValue tel4] [array get survey] \ [array get contact] [array get user] $::yacati::recruit $edata(email)] - if {[lindex $res 0] == -1} { - return [::yatk_dlg::error [lindex $res 1]] + if {$res == -1} { + return [::yatk_dlg::error $::cati::ERRMSG] } ::yacati::configureWdj bbr state normal @@ -1136,8 +1136,8 @@ [yacati::getWdjValue tel3] [::yacati::getWdjValue tel4] [array get survey] [array get contact] \ [array get user] $::yacati::recruit $edata(email)] - if {[lindex $res 0] == -1} { - return [::yatk_dlg::error [lindex $res 1]] + if {$res == -1} { + return [::yatk_dlg::error $::cati::ERRMSG] } ::yacati::configureWdj bbr state normal This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |