+ + | + ++ + | +
+
Index: openacs-4/packages/invoices/www/invoice-send-1.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/invoice-send-1.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/invoices/www/invoice-send-1.tcl 4 Jan 2006 08:06:48 -0000 1.3 +++ openacs-4/packages/invoices/www/invoice-send-1.tcl 2 Apr 2006 22:08:02 -0000 1.4 @@ -5,6 +5,7 @@ @creation-date 2005-12-24 } { invoice_id:integer + {return_url:optional ""} } -properties { context:onevalue page_title:onevalue @@ -23,12 +24,18 @@ set rec_organization_id $recipient_id } +# warn if invoice already got sent +set sent_p 0 +if {![empty_string_p $invoice_nr]} { + set sent_p 1 +} + set rec_orga_revision_id [content::item::get_best_revision -item_id $rec_organization_id] set invoice_copy [ams::value -attribute_name "invoice_copy" -object_id $rec_orga_revision_id] set boolean_options [list [list "[_ invoices.yes]" 1] [list "[_ invoices.no]" 0]] -ad_form -name invoice_send -action invoice-send-1 -form { +ad_form -name invoice_send -action invoice-send-1 -export {return_url} -form { {invoice_id:key} } @@ -41,15 +48,26 @@ ad_form -extend -name invoice_send -form { {invoice_p:text(radio) {label "[_ invoices.iv_invoice_p]"} {options $boolean_options}} {copy_p:text(radio) {label "[_ invoices.iv_invoice_copy_p]"} {options $boolean_options}} + {email_p:text(radio) {label "[_ invoices.iv_invoice_email_p]"} {options $boolean_options}} } -edit_request { set opening_p 0 set invoice_p 1 + set email_p 0 set copy_p [ad_decode $invoice_copy t 1 0] if {[empty_string_p $copy_p]} { set copy_p 0 } + if {$sent_p} { + # if invoice is already sent, let user send copy by default + set invoice_p 0 + set copy_p 1 + } } -after_submit { - ad_returnredirect [export_vars -base "invoice-send" {invoice_id opening_p invoice_p copy_p}] + if {$email_p} { + ad_returnredirect [export_vars -base "invoice-send" {invoice_id opening_p invoice_p copy_p return_url}] + } else { + ad_returnredirect [export_vars -base "invoice-documents" {invoice_id opening_p invoice_p copy_p return_url}] + } ad_script_abort } Index: openacs-4/packages/invoices/www/invoice-send.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/invoice-send.tcl,v diff -u -r1.15 -r1.16 --- openacs-4/packages/invoices/www/invoice-send.tcl 15 Mar 2006 17:05:06 -0000 1.15 +++ openacs-4/packages/invoices/www/invoice-send.tcl 2 Apr 2006 22:08:02 -0000 1.16 @@ -9,6 +9,7 @@ {invoice_p 1} {copy_p 0} {file_ids ""} + {return_url:optional ""} } -properties { context:onevalue page_title:onevalue @@ -34,7 +35,7 @@ lappend document_types opening } -if {$total_amount > 0} { +if {$total_amount >= 0} { # send invoice set invoice_text "#invoices.iv_invoice_email#" set subject [lang::util::localize "#invoices.iv_invoice_email_subject#" $locale] @@ -80,9 +81,9 @@ if {![empty_string_p $project_id]} { acs_object::get -object_id $project_id -array project set pm_url [lindex [site_node::get_url_from_object_id -object_id $project(package_id)] 0] - set return_url [export_vars -base "${pm_url}one" {{project_item_id $project_id}}] + # set return_url [export_vars -base "${pm_url}one" {{project_item_id $project_id}}] } else { - set return_url [export_vars -base invoice-list {organization_id}] + # set return_url [export_vars -base invoice-list {organization_id}] } set file_ids {} @@ -119,28 +120,34 @@ if {![empty_string_p $project_id]} { acs_object::get -object_id $project_id -array project set pm_url [lindex [site_node::get_url_from_object_id -object_id $project(package_id)] 0] - set return_url [export_vars -base "${pm_url}one" {{project_item_id $project_id}}] + # set return_url [export_vars -base "${pm_url}one" {{project_item_id $project_id}}] } else { - set return_url [export_vars -base invoice-list {organization_id}] + # set return_url [export_vars -base invoice-list {organization_id}] } set root_folder_id [lindex [application_data_link::get_linked -from_object_id $organization_id -to_object_type content_folder] 0] set invoice_folder_id [fs::get_folder -name "invoices_${root_folder_id}" -parent_id $root_folder_id] + if {[empty_string_p $invoice_folder_id]} { + # use folder of party if no invoice-folder exists + set invoice_folder_id $organization_id + } + db_transaction { # move files to invoice_folder foreach one_file $file_id { - content::item::move -item_id $one_file -target_folder_id $invoice_folder_id application_data_link::new -this_object_id $invoice_id -target_object_id $one_file - db_dml set_publish_status {} + db_dml set_publish_status_and_parent {} db_dml set_context_id {} } - if {$status != "paid"} { + if {$status == "new" || [empty_string_p $status]} { iv::invoice::set_status -invoice_id $invoice_id -status "billed" } } } - -set return_url [export_vars -base invoice-list {organization_id}] +if {[empty_string_p $return_url]} { + set return_url [export_vars -base invoice-list {organization_id}] +} + ad_return_template Index: openacs-4/packages/invoices/www/invoice-send.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/invoice-send.xql,v diff -u -r1.7 -r1.8 --- openacs-4/packages/invoices/www/invoice-send.xql 15 Mar 2006 17:05:06 -0000 1.7 +++ openacs-4/packages/invoices/www/invoice-send.xql 2 Apr 2006 22:08:02 -0000 1.8 @@ -17,17 +17,19 @@
Rechnung | Datum | Kunde | Netto | MWSt | Brutto | Währung |
---|---|---|---|---|---|---|
$invoice_nr | $invoice_date | $client_id | $total_amount | $vat | $final_amount | $currency |
$total_sum | $vat_sum | $final_sum |
+Index: openacs-4/packages/invoices/www/journal-check.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/journal-check.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/invoices/www/journal-check.tcl 2 Apr 2006 22:08:02 -0000 1.1 @@ -0,0 +1,28 @@ +ad_page_contract { + Check before creation of journal + + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2006-01-30 +} { +} -properties { + context:onevalue + page_title:onevalue +} + +set user_id [auth::require_login] +set page_title "[_ invoices.iv_journal_check]" +set context [list [list [export_vars -base invoice-list {organization_id}] "[_ invoices.iv_invoice_2]"] $page_title] + +set confirm_options [list [list "[_ invoices.continue_with_journal]" t] [list "[_ invoices.cancel_and_return]" f]] + +ad_form -name journal_confirm -action journal-check -form { + {user_id:key} + {confirmation:text(radio) {label " "} {options $confirm_options} {value f}} +} -edit_request { +} -on_submit { +} -after_submit { + ad_returnredirect "journal-add" + ad_script_abort +} + +ad_return_template Index: openacs-4/packages/invoices/www/offer-ae.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/offer-ae.tcl,v diff -u -r1.21 -r1.22 --- openacs-4/packages/invoices/www/offer-ae.tcl 15 Mar 2006 17:05:06 -0000 1.21 +++ openacs-4/packages/invoices/www/offer-ae.tcl 2 Apr 2006 22:08:02 -0000 1.22 @@ -131,6 +131,7 @@ {title:text {label "[_ invoices.iv_offer_Title]"} {html {size 80 maxlength 1000}} {help_text "[_ invoices.iv_offer_Title_help]"}} {description:text(textarea),optional {label "[_ invoices.iv_offer_Description]"} {html {rows 5 cols 80}} {help_text "[_ invoices.iv_offer_Description_help]"}} {comment:text(textarea),optional {label "[_ invoices.iv_offer_comment]"} {html {rows 5 cols 80}} {help_text "[_ invoices.iv_offer_comment_help]"}} + {reservation:text(textarea),optional {label "[_ invoices.iv_offer_reservation]"} {html {rows 5 cols 80}} {help_text "[_ invoices.iv_offer_reservation_help]"}} } if {![empty_string_p [category_tree::get_mapped_trees $container_objects(offer_id)]]} { @@ -273,6 +274,13 @@ } else { # we are just displaying an offer + if {![empty_string_p $_credit_percent] && $_credit_percent > 0} { + set _credit_percent [format "%.1f" $_credit_percent] + ad_form -extend -name iv_offer_form -form { + {credit_percent:float {label "[_ invoices.iv_offer_credit_percent]"} {html {size 5 maxlength 10}} {help_text "[_ invoices.iv_offer_credit_percent_help]"} {value $_credit_percent} {after_html {%}}} + } + } + # display uploaded files if {[exists_and_not_null files]} { ad_form -extend -name iv_offer_form -form { @@ -686,6 +694,7 @@ -title $title \ -description $description \ -comment $comment \ + -reservation $reservation \ -offer_nr $offer_nr \ -organization_id $organization_id \ -amount_total $amount_total \ @@ -730,8 +739,9 @@ set new_offer_rev_id [iv::offer::edit \ -offer_id $offer_id \ -title $title \ - -description $description \ + -description $description \ -comment $comment \ + -reservation $reservation \ -offer_nr $offer_nr \ -organization_id $organization_id \ -amount_total $amount_total \ Index: openacs-4/packages/invoices/www/offer-ae.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/offer-ae.xql,v diff -u -r1.10 -r1.11 --- openacs-4/packages/invoices/www/offer-ae.xql 15 Mar 2006 17:05:06 -0000 1.10 +++ openacs-4/packages/invoices/www/offer-ae.xql 2 Apr 2006 22:08:02 -0000 1.11 @@ -136,7 +136,7 @@ select t.offer_id as offer_rev_id, r.title, r.description, t.offer_nr, t.amount_total, t.vat, t.vat_percent, t.comment, to_char(t.finish_date, 'YYYY-MM-DD HH24:MI:SS') as finish_ansi, - o.creation_user, p.first_names, p.last_name, + o.creation_user, p.first_names, p.last_name, t.reservation, to_char(o.creation_date, 'YYYY-MM-DD HH24:MI:SS') as creation_ansi, to_char(t.accepted_date, 'YYYY-MM-DD HH24:MI:SS') as accepted_ansi, t.amount_sum as amount_sum_, t.payment_days, t.date_comment Index: openacs-4/packages/invoices/www/project-search.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/project-search.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/invoices/www/project-search.tcl 2 Apr 2006 22:08:02 -0000 1.1 @@ -0,0 +1,28 @@ +ad_page_contract { + Page to redirect to project. + + @author Timo Hentschel (timo@timohentschel.de) + @creation-date 2005-06-06 +} { + project_id +} + +set match_projects [db_list_of_lists get_projects { }] +set match_length [llength $match_projects] + +if { [string equal $match_length 0] } { + # No Match just redirect + ad_returnredirect $return_url + +} else { + set project_item_id [lindex [lindex $match_projects 0] 0] + set object_package_id [lindex [lindex $match_projects 0] 2] + + # We get the node_id from the package_id and use it + # to get the url of the project-manager + set pm_node_id [site_node::get_node_id_from_object_id -object_id $object_package_id] + set pm_url [site_node::get_url -node_id $pm_node_id] + + # Just redirect to the pm_url and project_item_id + ad_returnredirect "${pm_url}one?project_item_id=$project_item_id" +} Index: openacs-4/packages/invoices/www/project-search.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/invoices/www/project-search.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/invoices/www/project-search.xql 2 Apr 2006 22:08:02 -0000 1.1 @@ -0,0 +1,21 @@ + ++