sub action_edit {
my ($self) = @_;
- $self->linked_records([
- map { @{ $_ } }
- grep { $_ } (
- SL::DB::Manager::Order-> get_all(where => [ globalproject_id => $self->project->id ], with_objects => [ 'customer', 'vendor' ], sort_by => 'transdate ASC'),
- SL::DB::Manager::DeliveryOrder-> get_all(where => [ globalproject_id => $self->project->id ], with_objects => [ 'customer', 'vendor' ], sort_by => 'transdate ASC'),
- SL::DB::Manager::Invoice-> get_all(where => [ globalproject_id => $self->project->id ], with_objects => [ 'customer' ], sort_by => 'transdate ASC'),
- SL::DB::Manager::PurchaseInvoice->get_all(where => [ globalproject_id => $self->project->id ], with_objects => [ 'vendor' ], sort_by => 'transdate ASC'),
- )]);
-
+ $self->get_linked_records;
$self->display_form(title => $::locale->text('Edit project #1', $self->project->projectnumber),
callback => $::form->{callback} || $self->url_for(action => 'edit', id => $self->project->id));
}
$self->project(SL::DB::Project->new(id => $::form->{id})->load);
}
+sub get_linked_records {
+ my ($self) = @_;
+
+ $self->linked_records([
+ map { @{ $_ } }
+ grep { $_ } (
+ SL::DB::Manager::Order-> get_all(where => [ globalproject_id => $self->project->id ], with_objects => [ 'customer', 'vendor' ], sort_by => 'transdate ASC'),
+ SL::DB::Manager::DeliveryOrder-> get_all(where => [ globalproject_id => $self->project->id ], with_objects => [ 'customer', 'vendor' ], sort_by => 'transdate ASC'),
+ SL::DB::Manager::Invoice-> get_all(where => [ globalproject_id => $self->project->id ], with_objects => [ 'customer' ], sort_by => 'transdate ASC'),
+ SL::DB::Manager::PurchaseInvoice->get_all(where => [ globalproject_id => $self->project->id ], with_objects => [ 'vendor' ], sort_by => 'transdate ASC'),
+ )]);
+}
+
sub setup_db_args_from_filter {
my ($self) = @_;
--- /dev/null
+[%- USE T8 %]
+[%- USE L %]
+[%- USE P %]
+[%- USE HTML %]
+[%- USE LxERP %]
+<table>
+ <tr>
+ <th align="right">[% 'Number' | $T8 %]</th>
+ <td>[% L.input_tag("project.projectnumber", SELF.project.projectnumber, size=60, class="initial_focus") %]</td>
+ </tr>
+
+ <tr>
+ <th align="right">[% 'Description' | $T8 %]</th>
+ <td>
+ [%- SET rows = LxERP.numtextrows(SELF.project.description, 60) %]
+ [%- IF rows > 1 %]
+ [%- L.textarea_tag("project.description", SELF.project.description, rows=row, size=60, style="width: 100%", wrap="soft") %]
+ [%- ELSE %]
+ [%- L.input_tag("project.description", SELF.project.description, size=60) %]
+ [%- END %]
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right">[% 'Project Type' | $T8 %]</th>
+ <td>[% L.select_tag('project.project_type_id', ALL_PROJECT_TYPES, default=SELF.project.project_type_id, title_key='description', style='width: 300px') %]</td>
+ </tr>
+
+ <tr>
+ <th align="right">[% 'Customer' | $T8 %]</th>
+ <td>[% L.select_tag('project.customer_id', ALL_CUSTOMERS, default=SELF.project.customer_id, title_key='name', with_empty=1, style='width: 300px') %]</td>
+ </tr>
+
+ <tr>
+ <th align="right">[% 'Valid' | $T8 %]</th>
+ <td>[% L.select_tag('project.valid', [ [ 1, LxERP.t8('Valid') ], [ 0, LxERP.t8('Invalid') ] ], default=SELF.project.valid, style='width: 300px') %]</td>
+ </tr>
+
+ [%- IF SELF.project.id %]
+ <tr>
+ <th align="right">[% 'Active' | $T8 %]</th>
+ <td>[% L.select_tag('project.active', [ [ 1, LxERP.t8('Active') ], [ 0, LxERP.t8('Inactive') ] ], default=SELF.project.active, style='width: 300px') %]</td>
+ </tr>
+ [%- END %]
+</table>
--- /dev/null
+[%- USE HTML %]
+<table>
+[%- FOREACH var = CUSTOM_VARIABLES %]
+<tr>
+ <td align="right" valign="top">[% HTML.escape(var.description) %]</td>
+ <td valign="top">[% var.HTML_CODE %]</td>
+</tr>
+[%- END %]
+</table>
--- /dev/null
+[%- USE P %]
+ [% P.grouped_record_list(records) %]
[%- USE T8 %]
-[%- USE L %][%- USE P %]
-[%- USE HTML %][%- USE LxERP %]
-
+[%- USE L %]
+[%- USE P %]
+[%- USE HTML %]
+[%- USE LxERP %]
<h1>[% title %]</h1>
[%- INCLUDE 'common/flash.html' %]
</ul>
<div id="basic_data">
-
- <table>
- <tr>
- <th align="right">[% 'Number' | $T8 %]</th>
- <td>[% L.input_tag("project.projectnumber", SELF.project.projectnumber, size=60, class='initial_focus') %]</td>
- </tr>
-
- <tr>
- <th align="right">[% 'Description' | $T8 %]</th>
- <td>
- [%- SET rows = LxERP.numtextrows(SELF.project.description, 60) %]
- [%- IF rows > 1 %]
- [%- L.textarea_tag("project.description", SELF.project.description, rows=row, size=60, style="width: 100%", wrap="soft") %]
- [%- ELSE %]
- [%- L.input_tag("project.description", SELF.project.description, size=60) %]
- [%- END %]
- </td>
- </tr>
-
- <tr>
- <th align="right">[% 'Project Type' | $T8 %]</th>
- <td>[% L.select_tag('project.project_type_id', ALL_PROJECT_TYPES, default=SELF.project.project_type_id, title_key='description', style='width: 300px') %]</td>
- </tr>
-
- <tr>
- <th align="right">[% 'Customer' | $T8 %]</th>
- <td>[% L.select_tag('project.customer_id', ALL_CUSTOMERS, default=SELF.project.customer_id, title_key='name', with_empty=1, style='width: 300px') %]</td>
- </tr>
-
- <tr>
- <th align="right">[% 'Valid' | $T8 %]</th>
- <td>[% L.select_tag('project.valid', [ [ 1, LxERP.t8('Valid') ], [ 0, LxERP.t8('Invalid') ] ], default=SELF.project.valid, style='width: 300px') %]</td>
- </tr>
-
- [%- IF SELF.project.id %]
- <tr>
- <th align="right">[% 'Active' | $T8 %]</th>
- <td>[% L.select_tag('project.active', [ [ 1, LxERP.t8('Active') ], [ 0, LxERP.t8('Inactive') ] ], default=SELF.project.active, style='width: 300px') %]</td>
- </tr>
- [%- END %]
- </table>
+ [%- PROCESS 'project/_basic_data.html' %]
</div>
[%- IF CUSTOM_VARIABLES.size %]
<div id="custom_variables">
-
- <p>
- <table>
- [%- FOREACH var = CUSTOM_VARIABLES %]
- <tr>
- <td align="right" valign="top">[% HTML.escape(var.description) %]</td>
- <td valign="top">[% var.HTML_CODE %]</td>
- </tr>
- [%- END %]
- </table>
- </p>
+ [%- PROCESS 'project/_cvars.html' %]
</div>
[%- END %]
[%- IF SELF.project.id %]
<div id="linked_records">
- [% P.grouped_record_list(SELF.linked_records) %]
+ [%- PROCESS 'project/_linked_records.html' records=SELF.linked_records %]
</div>
[%- END %]