Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-timesheet2-invoices
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project-open
intranet-timesheet2-invoices
Commits
37defe9b
Commit
37defe9b
authored
Jun 04, 2020
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Moved "promote" function to Proc
parent
dd4563d6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
14 deletions
+34
-14
intranet-timesheet2-invoices-procs.tcl
tcl/intranet-timesheet2-invoices-procs.tcl
+30
-0
promote-invoice-to-timesheet-invoice.tcl
www/invoices/promote-invoice-to-timesheet-invoice.tcl
+4
-14
No files found.
tcl/intranet-timesheet2-invoices-procs.tcl
View file @
37defe9b
...
...
@@ -373,3 +373,33 @@ ad_proc im_timesheet_invoicing_project_hierarchy {
return
$task
_table_rows
}
# ------------------------------------------------------
# Promote invoice to timesheet invoice
# ------------------------------------------------------
ad_proc -public im_timesheet_invoice_promote_invoice
{
-invoice_id:required
}
{
Takes an im_invoice and adds a record to im_timesheet_invoice
}
{
set count
[
db_string count
"select count(*) from im_timesheet_invoices where invoice_id = :invoice_id"
]
if
{
$count
< 1
}
{
db_dml insert
"insert into im_timesheet_invoices (
invoice_id,
invoice_period_start,
invoice_period_end
) values (
:invoice_id,
now() - '1 month'::interval,
now()
)"
}
db_dml up
"update acs_objects set object_type = 'im_timesheet_invoice' where object_id = :invoice_id"
}
www/invoices/promote-invoice-to-timesheet-invoice.tcl
View file @
37defe9b
...
...
@@ -33,20 +33,10 @@ if {!$write} {
# Promote
# ---------------------------------------------------------------
set
count
[
db_string count
"select count(*) from im_timesheet_invoices where invoice_id = :invoice_id"
]
if
{
$count
< 1
}
{
db_dml insert
"insert into im_timesheet_invoices (
invoice_id,
invoice_period_start,
invoice_period_end
) values (
:invoice_id,
now() - '1 month'::interval,
now()
)"
db_dml up
"update acs_objects set object_type = 'im_timesheet_invoice' where object_id = :invoice_id"
}
im_timesheet_invoice_promote_invoice -invoice_id
$invoice
_id
# ---------------------------------------------------------------
# Where do you want to go now?
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment