payment_id = $form->{payment_id},
delivery_vendor_id = $form->{delivery_vendor_id},
delivery_customer_id = $form->{delivery_customer_id},
+ globalproject_id = | . conv_i($form->{"globalproject_id"}, 'NULL') . qq|,
employee_id = $form->{employee_id},
cp_id = | . conv_i($form->{cp_id}, 'NULL') . qq|
WHERE id = $form->{id}|;
o.closed, o.reqdate, o.quonumber, o.department_id, o.cusordnumber,
d.description AS department, o.payment_id, o.language_id, o.taxzone_id,
o.delivery_customer_id, o.delivery_vendor_id, o.proforma, o.shipto_id,
+ o.globalproject_id, pr.projectnumber AS globalprojectnumber,
o.delivered
FROM oe o
JOIN $form->{vc} cv ON (o.$form->{vc}_id = cv.id)
LEFT JOIN employee e ON (o.employee_id = e.id)
LEFT JOIN department d ON (o.department_id = d.id)
+ LEFT JOIN project pr ON (o.globalproject_id = pr.id)
|
. ($form->{id}
? qq|WHERE o.id = $form->{id}|
<th align=right nowrap>| . $locale->text('Due Date') . qq|</th>
$button2
</tr>
- </table>
+ </table>
</td>
</tr>
</table>
sub check_project {
$lxdebug->enter_sub();
- for $i (1 .. $form->{rowcount}) {
- $form->{"project_id_$i"} = "" unless $form->{"projectnumber_$i"};
- if ($form->{"projectnumber_$i"} ne $form->{"oldprojectnumber_$i"}) {
- if ($form->{"projectnumber_$i"}) {
+ for $i (0 .. $form->{rowcount}) {
+ my $suffix = $i ? "_$i" : "";
+ my $prefix = $i ? "" : "global";
+ $form->{"${prefix}project_id${suffix}"} = "" unless $form->{"${prefix}projectnumber$suffix"};
+ if ($form->{"${prefix}projectnumber${suffix}"} ne $form->{"old${prefix}projectnumber${suffix}"}) {
+ if ($form->{"${prefix}projectnumber${suffix}"}) {
# get new project
- $form->{projectnumber} = $form->{"projectnumber_$i"};
+ $form->{projectnumber} = $form->{"${prefix}projectnumber${suffix}"};
if (($rows = PE->projects(\%myconfig, $form)) > 1) {
# check form->{project_list} how many there are
$form->{rownumber} = $i;
- &select_project;
+ &select_project($i ? undef : 1);
exit;
}
if ($rows == 1) {
- $form->{"project_id_$i"} = $form->{project_list}->[0]->{id};
- $form->{"projectnumber_$i"} =
+ $form->{"${prefix}project_id${suffix}"} =
+ $form->{project_list}->[0]->{id};
+ $form->{"${prefix}projectnumber${suffix}"} =
$form->{project_list}->[0]->{projectnumber};
- $form->{"oldprojectnumber_$i"} =
+ $form->{"old${prefix}projectnumber${suffix}"} =
$form->{project_list}->[0]->{projectnumber};
} else {
$form->error($locale->text('Project not on file!'));
}
} else {
- $form->{"oldprojectnumber_$i"} = "";
+ $form->{"old${prefix}projectnumber${suffix}"} = "";
}
}
}
sub select_project {
$lxdebug->enter_sub();
+ my ($is_global) = @_;
+
@column_index = qw(ndx projectnumber description);
$column_data{ndx} = qq|<th> </th>|;
|;
# delete action variable
- map { delete $form->{$_} } qw(action project_list header);
+ map { delete $form->{$_} } qw(action project_list header update);
# save all other form variables
foreach $key (keys %${form}) {
}
print qq|
+<input type="hidden" name="is_global" value="$is_global">
<input type=hidden name=nextsub value=project_selected>
<br>
# index for new item
$i = $form->{ndx};
- $form->{"projectnumber_$form->{rownumber}"} =
+ my $prefix = $form->{"is_global"} ? "global" : "";
+ my $suffix = $form->{"is_global"} ? "" : "_$form->{rownumber}";
+
+ $form->{"${prefix}projectnumber${suffix}"} =
$form->{"new_projectnumber_$i"};
- $form->{"oldprojectnumber_$form->{rownumber}"} =
+ $form->{"old${prefix}projectnumber${suffix}"} =
$form->{"new_projectnumber_$i"};
- $form->{"project_id_$form->{rownumber}"} = $form->{"new_id_$i"};
+ $form->{"${prefix}project_id${suffix}"} = $form->{"new_id_$i"};
# delete all the new_ variables
for $i (1 .. $form->{lastndx}) {
map { delete $form->{"new_${_}_$i"} } qw(id projectnumber description);
}
- map { delete $form->{$_} } qw(ndx lastndx nextsub);
+ map { delete $form->{$_} } qw(ndx lastndx nextsub is_global);
if ($form->{update}) {
&{ $form->{update} };
<td><input name="quodate" id="quodate" size="11" title="$myconfig{dateformat}" value="| . Q($form->{quodate}) . qq|"></td>
<td><input type="button" name="b_quodate" id="trigger_quodate" value="?"></td>
</tr>
- </table>
+ <tr>
+ <th align="right" nowrap>| . $locale->text('Project Number') . qq|</th>
+ <td>
+ <input name="globalprojectnumber" size="11" value="| . Q($form->{globalprojectnumber}) . qq|">
+ <input type="hidden" name="oldglobalprojectnumber" value="| . Q($form->{globalprojectnumber}) . qq|">
+ <input type="hidden" name="globalproject_id" value="| . Q($form->{globalproject_id}) . qq|">
+ </td:>
+ </tr>
+ </table>
</td>
</tr>
</table>
<th align=right nowrap>| . $locale->text('Customer Order Number') . qq|</th>
<td><input name=cusordnumber size=11 value="$form->{cusordnumber}"></td>
</tr>
+ <tr>
+ <th align="right" nowrap>| . $locale->text('Project Number') . qq|</th>
+ <td>
+ <input name="globalprojectnumber" size="11" value="| . Q($form->{globalprojectnumber}) . qq|">
+ <input type="hidden" name="oldglobalprojectnumber" value="| . Q($form->{globalprojectnumber}) . qq|">
+ <input type="hidden" name="globalproject_id" value="| . Q($form->{globalproject_id}) . qq|">
+ </td>
+ </tr>
</table>
</td>
</tr>
$openclosed
$employee
$ordnumber
+ <tr>
+ <th width="70%" align="right" nowrap>| . $locale->text('Project Number') . qq|</th>
+ <td>
+ <input name="globalprojectnumber" size="11" value="| . Q($form->{globalprojectnumber}) . qq|">
+ <input type="hidden" name="oldglobalprojectnumber" value="| . Q($form->{globalprojectnumber}) . qq|">
+ <input type="hidden" name="globalproject_id" value="| . Q($form->{globalproject_id}) . qq|">
+ </td>
+ </tr>
</table>
</td>
</tr>
'post' => 'post',
'post_as_new' => 'post_as_new',
'prepare_credit_note' => 'prepare_credit_note',
+ 'preset_projectnumber' => 'preset_projectnumber',
'preview' => 'preview',
'print' => 'print',
'print_and_post' => 'print_and_post',
'order' => 'order',
'part_selection_internal' => 'part_selection_internal',
'post_as_new' => 'post_as_new',
+ 'preset_projectnumber' => 'preset_projectnumber',
'print' => 'print',
'print_dunning' => 'print_dunning',
'print_form' => 'print_form',
'parts_language_selection' => 'parts_language_selection',
'parts_subtotal' => 'parts_subtotal',
'post_as_new' => 'post_as_new',
+ 'preset_projectnumber' => 'preset_projectnumber',
'price_row' => 'price_row',
'print' => 'print',
'print_form' => 'print_form',
'order' => 'order',
'part_selection_internal' => 'part_selection_internal',
'post_as_new' => 'post_as_new',
+ 'preset_projectnumber' => 'preset_projectnumber',
'print' => 'print',
'print_form' => 'print_form',
'print_options' => 'print_options',
'post_as_new' => 'post_as_new',
'post_payment' => 'post_payment',
'prepare_invoice' => 'prepare_invoice',
+ 'preset_projectnumber' => 'preset_projectnumber',
'print' => 'print',
'print_form' => 'print_form',
'print_options' => 'print_options',
'post_as_new' => 'post_as_new',
'post_payment' => 'post_payment',
'prepare_invoice' => 'prepare_invoice',
+ 'preset_projectnumber' => 'preset_projectnumber',
'preview' => 'preview',
'print' => 'print',
'print_and_post' => 'print_and_post',
'poso' => 'poso',
'post_as_new' => 'post_as_new',
'prepare_order' => 'prepare_order',
+ 'preset_projectnumber' => 'preset_projectnumber',
'print' => 'print',
'print_form' => 'print_form',
'print_options' => 'print_options',
--- /dev/null
+-- @tag: globalprojectnumber_ap_ar_oe
+-- @description: Neue Spalte für eine globale Projektnummer in Einkaufs- und Verkaufsbelegen
+-- @depends: release_2_4_1
+ALTER TABLE ap ADD COLUMN globalproject_id integer;
+ALTER TABLE ap ADD FOREIGN KEY (globalproject_id) REFERENCES project (id);
+ALTER TABLE ar ADD COLUMN globalproject_id integer;
+ALTER TABLE ar ADD FOREIGN KEY (globalproject_id) REFERENCES project (id);
+ALTER TABLE oe ADD COLUMN globalproject_id integer;
+ALTER TABLE oe ADD FOREIGN KEY (globalproject_id) REFERENCES project (id);