Commit 96f48f4a authored by infrax's avatar infrax

- Added percentage parser and applied to various

  percentage ranged variables
parent 9c8e94b7
......@@ -145,25 +145,29 @@ ad_proc -public im_csv_import_parser_project_nr {
ad_proc -public im_csv_import_parser_project_name {
{-parser_args "" }
{-parent_id ""}
arg
} {
Returns a project_id from project_name
} {
if {[regexp {'} $arg match]} {
set err "Found a Project Nr with single quote"
set err "Found a Project Name with single quote"
im_security_alert -location "im_csv_import_parser_project_name" -message $err -value $arg
return [list $arg $err]
}
set parent_sql "p.parent_id is null"
if {"" ne $parent_id} { set parent_sql "p.parent_id = :parent_id" }
set sql "
select min(p.project_id)
from im_projects p
where p.parent_id is null and
p.project_name = '$arg'
where $parent_sql and
lower(trim(p.project_name)) = lower(trim('$arg'))
"
set project_id [db_string project_id_from_name $sql -default ""]
set err ""
if {"" == $project_id} { set err "Didn't find project with project_name='$arg'" }
if {"" == $project_id} { set err "Didn't find project with project_name='$arg' and parent_id=#$parent_id" }
return [list $project_id $err]
}
......@@ -265,6 +269,20 @@ ad_proc -public im_csv_import_parser_date_american {
}
ad_proc -public im_csv_import_parser_percentage {
{-parser_args "" }
arg
} {
Parses a percentage number.
Basically just ignores a trailing % char after a number.
} {
if {[regexp {^(.+)%$} $arg match number]} {
set arg $number
}
return [im_csv_import_parser_number -parser_args $parser_args $arg]
}
ad_proc -public im_csv_import_parser_number {
{-parser_args "" }
arg
......
......@@ -31,7 +31,7 @@ ad_proc -public im_csv_import_guess_im_expense { } {} {
{cost_status_id "Cost Status" category "Intranet Cost Status"}
{project_nr "Project Nr" project_parent_nrs "" }
{amount "Amount" number ""}
{vat "VAT" number ""}
{vat "VAT" percentage ""}
{note "Note" no_change ""}
{external_company_name "External Company Name" no_change "" }
{external_company_vat_number "External Vat Nr." no_change "" }
......@@ -60,7 +60,7 @@ ad_proc -public im_csv_import_guess_im_expense_bundle { } {} {
{cost_status "Cost Status" category "Intranet Cost Status"}
{cost_status_id "Cost Status" category "Intranet Cost Status"}
{amount "Amount" number ""}
{vat "VAT" number ""}
{vat "VAT" percentage ""}
{note "Note" no_change ""}
{customer_id "Customer" company_name ""}
{provider_id "Provider" user_name ""}
......@@ -77,7 +77,7 @@ ad_proc -public im_csv_import_guess_rels { } {} {
{object_type_two "Object Type Two" no_change "" }
{object_id_two "Object Id Two" project_parent_nrs "" }
{role_id "Role" category "Intranet Biz Object Role" }
{percentage "Percentage" number "" }
{percentage "Percentage" percentage "" }
}
return $mapping
}
......@@ -115,7 +115,7 @@ ad_proc -public im_csv_import_guess_person { } {} {
{supervisor_id "Supervisor Email" user_name "" }
{supervisor_id "Supervisor ID" no_change "" }
{department_id "Department" no_change "" }
{availability "Availability" number "" }
{availability "Availability" percentage "" }
{personnel_number "Personnel Number" no_change "" }
{ss_number "Social Security Number" no_change "" }
{hourly_cost "Hourly Cost" number "" }
......@@ -164,7 +164,7 @@ ad_proc -public im_csv_import_guess_im_company { } {} {
{referral_source "Referral" no_change ""}
{annual_revenue_id "AnRev" category "Intranet Annual Revenue"}
{note "Note" no_change ""}
{default_vat "Default VAT" no_change ""}
{default_vat "Default VAT" percentage ""}
{default_po_template_id "Default PO Template" category "Intranet Cost Template"}
{default_payment_method_id "Default Payment Method" category "Intranet Invoice Payment Method"}
{default_payment_days "Default Payment Days" no_change ""}
......@@ -174,7 +174,7 @@ ad_proc -public im_csv_import_guess_im_company { } {} {
{default_pm_fee_perc "Default PM Fee Percentage" no_change ""}
{default_surcharge_perc_deref "Default Surcharge Percentage" no_change ""}
{default_discount_perc_deref "Default Discount Percentage" no_change ""}
{default_tax_deref "Default TAX" no_change ""}
{default_tax "Default TAX" percentage ""}
}
return $mapping
}
......@@ -206,8 +206,8 @@ ad_proc -public im_csv_import_guess_im_invoice { } {} {
{payment_days "Payment Days" number ""}
{paid_amount "Paid Amount" number ""}
{parent_nrs "" number ""}
{vat "VAT" number ""}
{tax "TAX" number ""}
{vat "VAT" percentage ""}
{tax "TAX" percentage ""}
{description "Description" no_change ""}
{note "Note" no_change ""}
{vat_type_id "VAT Type" category "Intranet VAT Type"}
......@@ -247,7 +247,7 @@ ad_proc -public im_csv_import_guess_im_project { } {} {
{company_id "Customer Name" company_name ""}
{start_date "Start Date" date ""}
{end_date "End Date" date ""}
{percent_completed "Percent Completed" number ""}
{percent_completed "Percent Completed" percentage ""}
{project_lead_id "Project Manager" user_name ""}
{project_budget "Budget" number ""}
{project_budget_hours "Budget Hours" number ""}
......@@ -261,35 +261,35 @@ ad_proc -public im_csv_import_guess_im_project { } {} {
ad_proc -public im_csv_import_guess_im_timesheet_task { } {} {
set mapping {
{parent_id "Parent Nrs" project_parent_nrs ""}
{parent_nrs "Parent Nrs" project_parent_nrs ""}
{project_nr "Project Nr." no_change ""}
{project_name "Project Name" no_change ""}
{project_type_id "Project Type" category "Intranet Project Type"}
{billable_units "Billable Units" number ""}
{company_id "Customer Name" company_name ""}
{start_date "Start Date" date ""}
{end_date "End Date" date ""}
{percent_completed "Percent Completed" number ""}
{project_lead_id "Project Manager" user_name ""}
{project_budget "Budget" number ""}
{project_budget_hours "Budget Hours" number ""}
{sort_order "Sort Order" number ""}
{note "Note" no_change ""}
{cost_center_id "Cost Center" cost_center ""}
{deadline_date "Deadline Date" date ""}
{description "Description" no_change ""}
{effort_driven_p "Effort driven" no_change ""}
{effort_driven_type_id "Scheduling Constraint Id" number ""}
{end_date "End Date" date ""}
{gantt_project_id "Gantt Project Id" number ""}
{invoice_id "Invoice Id" number ""}
{material_id "Material" material ""}
{uom_id "Unit of measure" category "Intranet UoM"}
{note "Note" no_change ""}
{parent_id "Parent Nrs" project_parent_nrs ""}
{parent_nrs "Parent Nrs" project_parent_nrs ""}
{percent_completed "Percent Completed" percentage ""}
{planned_units "Planned Units" number ""}
{billable_units "Billable Units" number ""}
{cost_center_id "Cost Center" cost_center ""}
{invoice_id "Invoice Id" number ""}
{priority "Priority" number ""}
{sort_order "Sort Order" number ""}
{gantt_project_id "Gantt Project Id" number ""}
{scheduling_constraint_id "Scheduling Constraint Id" category "Intranet Gantt Task Scheduling Type"}
{project_budget "Budget" number ""}
{project_budget_hours "Budget Hours" number ""}
{project_lead_id "Project Manager" user_name ""}
{project_name "Project Name" no_change ""}
{project_nr "Project Nr." no_change ""}
{project_status_id "Project Status" category "Intranet Project Status"}
{project_type_id "Project Type" category "Intranet Project Type"}
{scheduling_constraint_date "Scheduling Constraint Date" date ""}
{effort_driven_type_id "Scheduling Constraint Id" number ""}
{deadline_date "Deadline Date" date ""}
{effort_driven_p "Effort driven" no_change ""}
{scheduling_constraint_id "Scheduling Constraint Id" category "Intranet Gantt Task Scheduling Type"}
{sort_order "Sort Order" number ""}
{start_date "Start Date" date ""}
{uom_id "Unit of measure" category "Intranet UoM"}
}
return $mapping
}
......@@ -364,8 +364,8 @@ ad_proc -public im_csv_import_guess_im_risk { } {} {
{risk_description "Description" no_change ""}
{risk_description "Risk Description" no_change ""}
{risk_impact "Impact" number ""}
{risk_probability_percent "Probability" number ""}
{risk_probability_percent "Risk Probability" number ""}
{risk_probability_percent "Probability" percentage ""}
{risk_probability_percent "Risk Probability" percentage ""}
}
return $mapping
}
......@@ -385,6 +385,7 @@ ad_proc -public im_csv_import_parsers {
switch $object_type {
im_project - im_company - im_conf_item - im_cost - im_invoice - im_risk - im_timesheet_task - im_ticket - im_hour - person - im_expense_bundle - im_expense - rels {
set parsers {
no_change "No Change"
boolean "Boolean"
category "Category ID from Category Name"
company_name "Company ID from Company Name"
......@@ -395,11 +396,11 @@ ad_proc -public im_csv_import_parsers {
date_european "Date European (DD.MM.YYYY)"
date_european_dashes "Date ISO (YYYY-MM-DD)"
hard_coded "Hard Coded Functionality"
no_change "No Change"
material "Material"
number "Number (generic)"
number_american "Number US (20,000.00)"
number_european "Number European (20.000,00)"
percentage "Percentage (generic)"
office_name "Office ID from Office Name"
project_name "Project from Project Name"
project_nr "Project from Project Nr"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment