$main::lxdebug->leave_sub();
}
-# write Trigger JavaScript-Code ($qty = 1 - only one Trigger)
+# write Trigger JavaScript-Code ($qty = quantity of Triggers)
+# changed it to accept an arbitrary number of triggers - sschoeling
sub write_trigger {
$main::lxdebug->enter_sub();
- my ($self, $myconfig, $qty,
- $inputField_1, $align_1, $button_1,
- $inputField_2, $align_2, $button_2)
- = @_;
+ my $self = shift;
+ my $myconfig = shift;
+ my $qty = shift;
# set dateform for jsscript
# default
}
}
- $trigger_1 = qq|
+ while ($#_ >= 2) {
+ push @triggers, qq|
Calendar.setup(
{
- inputField : "$inputField_1",
+ inputField : "|.(shift).qq|",
ifFormat :"$ifFormat",
- align : "$align_1",
- button : "$button_1"
+ align : "|.(shift).qq|",
+ button : "|.(shift).qq|"
}
);
|;
-
- if ($qty == 2) {
- $trigger_2 = qq|
- Calendar.setup(
- {
- inputField : "$inputField_2",
- ifFormat :"$ifFormat",
- align : "$align_2",
- button : "$button_2"
- }
- );
- |;
}
$jsscript = qq|
<script type="text/javascript">
- <!--
- $trigger_1
- $trigger_2
- //-->
+ <!--|.join("", @triggers).qq|//-->
</script>
|;
# set values which could be empty to 0
$form->{terms} *= 1;
$form->{taxincluded} *= 1;
- my $datepaid = ($form->{paid}) ? qq|'$form->{datepaid}'| : "NULL";
- my $duedate = ($form->{duedate}) ? qq|'$form->{duedate}'| : "NULL";
+ my $datepaid = ($form->{paid}) ? qq|'$form->{datepaid}'| : "NULL";
+ my $duedate = ($form->{duedate}) ? qq|'$form->{duedate}'| : "NULL";
+ my $deliverydate = ($form->{deliverydate}) ? qq|'$form->{deliverydate}'| : "NULL";
# fill in subject if there is none
$form->{subject} = qq|$form->{label} $form->{invnumber}|
paid = $form->{paid},
datepaid = $datepaid,
duedate = $duedate,
+ deliverydate = $deliverydate,
invoice = '1',
shippingpoint = '$form->{shippingpoint}',
shipvia = '$form->{shipvia}',
# retrieve invoice
$query = qq|SELECT a.invnumber, a.ordnumber, a.quonumber, a.cusordnumber,
- a.transdate AS invdate, a.paid,
+ a.transdate AS invdate, a.deliverydate, a.paid,
a.shippingpoint, a.shipvia, a.terms, a.notes, a.intnotes,
a.duedate, a.taxincluded, a.curr AS currency,
a.employee_id, e.name AS employee
($form->{currency}) = split /:/, $form->{currencies};
+ # set reqdate if this is an invoice->order conversion. If someone knows a better check to ensure
+ # we come from invoices, feel free.
+ $form->{reqdate} = $form->{deliverydate} if ($form->{deliverydate} and $form->{callback} =~ /action=ar_transactions/);
+
if ($form->{id} or @ids) {
# retrieve order for single id
#write Trigger
$jsscript =
- Form->write_trigger(\%myconfig, "1", "priceupdate", "BL", "trigger1", "",
- "", "");
+ Form->write_trigger(\%myconfig, "1", "priceupdate", "BL", "trigger1");
} else {
# without JavaScript Calendar
}
map { $form->{$_} = $locale->date(\%myconfig, $form->{$_}, 1) }
- ("${inv}date", "${due}date", "shippingdate");
+ ("${inv}date", "${due}date", "shippingdate", "deliverydate");
@a = qw(name street zipcode city country);
push @a,
qw(shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptoemail shippingpoint shipvia company address signature employee contact department_1 department_2);
- push @a, ("${inv}date", "${due}date", email, cc, bcc);
+ push @a, ("${inv}date", "${due}date", "deliverydate", email, cc, bcc);
$form->format_string(@a);
<td width="4"><input type=button name=duedate id="trigger2" value=|
. $locale->text('button') . qq|></td></td>
|;
+ $button3 = qq|
+ <td width="13"><input name=deliverydate id=deliverydate size=11 title="$myconfig{dateformat}" value=$form->{deliverydate}></td>
+ <td width="4"><input type=button name=deliverydate id="trigger3" value=|
+ . $locale->text('button') . qq|></td></td>
+ |;
#write Trigger
$jsscript =
- Form->write_trigger(\%myconfig, "2", "invdate", "BL", "trigger1",
- "duedate", "BL", "trigger2");
+ Form->write_trigger(\%myconfig, "3", "invdate", "BL", "trigger1",
+ "duedate", "BL", "trigger2",
+ "deliverydate", "BL", "trigger3");
} else {
# without JavaScript Calendar
<th align=right>| . $locale->text('Due Date') . qq|</th>
$button2
</tr>
+ <tr>
+ <th align=right>| . $locale->text('Delivery Date') . qq|</th>
+ $button3
+ </tr>
<tr>
<th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
<td><input name=ordnumber size=11 value="$form->{ordnumber}"></td>
$form->isblank("ordnumber", $locale->text('Order Number missing!')) if ( +{ map { $form->{"ordnumber_$_"}, 1 } ( 1 .. $form->{rowcount}-1 ) }->{''} );
$form->isblank("transdate", $locale->text('Order Date missing!')) if ( +{ map { $form->{"transdate_$_"}, 1 } ( 1 .. $form->{rowcount}-1 ) }->{''} );
+ # also copy deliverydate from the order
+ $form->{deliverydate} = $form->{reqdate} if $form->{reqdate};
} else {
$form->isblank("quonumber", $locale->text('Quotation Number missing!'));
$form->isblank("transdate", $locale->text('Quotation Date missing!'));
<td>Angebotsnummer</td>
</tr>
<tr>
- <td><code>shippingdate</code></td>
+ <td><code>deliverydate</code></td>
<td>Lieferdatum</td>
</tr>
<tr>
--
-- add unqiue constraint to project
ALTER TABLE project ADD constraint project_projectnumber_key UNIQUE(projectnumber);
+--
+-- add column deliverydate to ar
+ALTER TABLE ar ADD COLUMN deliverydate date;
update defaults set version = '2.1.2';
"paid" numeric (15,5),
"datepaid" date,
"duedate" date,
+ "deliverydate" date,
"invoice" boolean DEFAULT 'f',
"shippingpoint" text,
"terms" smallint DEFAULT 0,
<th align=right>Nummer</th><td> </td><td><%invnumber%></td></tr>
</tr>
+ <tr>
+ <th align=right>Lieferdatum</th><td> </td><td><%deliverydate%></td></tr>
+ </tr>
<!--
<tr>
<th align=right>Clerk:</th><td> </td><td><%username%></td>
\begin{tabular}[t]{l@{\hspace{0.3cm}}l}
\textbf{Datum} & <%invdate%> \\
\textbf{Nummer} & <%invnumber%> \\
+ \textbf{Lieferdatum} & <%deliverydate%> \\
\end{tabular}
\vspace{1cm}