134 |
134 |
my $colspan = $#column_index + 1;
|
135 |
135 |
|
136 |
136 |
$form->{invsubtotal} = 0;
|
137 |
|
map { $form->{"${_}_base"} = 0 } (split / /, $form->{taxaccounts});
|
|
137 |
map { $form->{"${_}_base"} = 0 } (split(/ /, $form->{taxaccounts}));
|
138 |
138 |
|
139 |
139 |
########################################
|
140 |
140 |
# Eintrag fuer Version 2.2.0 geaendert #
|
... | ... | |
519 |
519 |
############## ENDE Neueintrag ##################
|
520 |
520 |
|
521 |
521 |
map { $form->{"${_}_base"} += $linetotal }
|
522 |
|
(split / /, $form->{"taxaccounts_$i"});
|
|
522 |
(split(/ /, $form->{"taxaccounts_$i"}));
|
523 |
523 |
|
524 |
524 |
$form->{invsubtotal} += $linetotal;
|
525 |
525 |
}
|
... | ... | |
1128 |
1128 |
|
1129 |
1129 |
$amount = $sellprice * (1 - $discount / 100) * $qty;
|
1130 |
1130 |
map { $form->{"${_}_base"} += $amount }
|
1131 |
|
(split / /, $form->{"taxaccounts_$i"});
|
|
1131 |
(split (/ /, $form->{"taxaccounts_$i"}));
|
1132 |
1132 |
$form->{oldinvtotal} += $amount;
|
1133 |
1133 |
}
|
1134 |
1134 |
|
1135 |
1135 |
map { $form->{oldinvtotal} += ($form->{"${_}_base"} * $form->{"${_}_rate"}) }
|
1136 |
|
split / /, $form->{taxaccounts}
|
|
1136 |
split(/ /, $form->{taxaccounts})
|
1137 |
1137 |
if !$form->{taxincluded};
|
1138 |
1138 |
|
1139 |
1139 |
$form->{oldtotalpaid} = 0;
|
... | ... | |
1359 |
1359 |
$attachment_filename =~ s/ /_/g;
|
1360 |
1360 |
my %umlaute =
|
1361 |
1361 |
(
|
1362 |
|
"?" => "ae", "?" => "oe", "?" => "ue",
|
1363 |
|
"?" => "Ae", "?" => "Oe", "?" => "Ue",
|
1364 |
|
"?" => "ss"
|
1365 |
|
);
|
1366 |
|
map({ $attachment_filename =~ s/$_/$umlaute{$_}/g; } keys(%umlaute));
|
1367 |
|
} else {
|
1368 |
|
$attachment_filename = "";
|
1369 |
|
}
|
1370 |
|
|
1371 |
|
if ($form->{"email"}) {
|
1372 |
|
$form->{"fokus"} = "Form.subject";
|
1373 |
|
} else {
|
1374 |
|
$form->{"fokus"} = "Form.email";
|
1375 |
|
}
|
1376 |
|
$form->header;
|
1377 |
|
|
1378 |
|
print qq|
|
1379 |
|
<body onload="fokus()">
|
1380 |
|
|
1381 |
|
<form name="Form" method="post" action="$form->{script}">
|
1382 |
|
|
1383 |
|
<table width="100%">
|
1384 |
|
<tr class="listtop">
|
1385 |
|
<th class="listtop">$title</th>
|
1386 |
|
</tr>
|
1387 |
|
<tr height="5"></tr>
|
1388 |
|
<tr>
|
1389 |
|
<td>
|
1390 |
|
<table>
|
1391 |
|
<tr>
|
1392 |
|
<th align="right" nowrap>| . $locale->text('To') . qq|</th>
|
1393 |
|
<td><input name="email" size="30" value="| .
|
1394 |
|
Q($form->{"email"}) . qq|"></td>
|
1395 |
|
</tr>
|
1396 |
|
<tr>
|
1397 |
|
<th align="right" nowrap>| . $locale->text('Cc') . qq|</th>
|
1398 |
|
<td><input name="cc" size="30" value="| .
|
1399 |
|
Q($form->{"cc"}) . qq|"></td>
|
1400 |
|
</tr>
|
1401 |
|
$bcc
|
1402 |
|
<tr>
|
1403 |
|
<th align="right" nowrap>| . $locale->text('Subject') . qq|</th>
|
1404 |
|
<td><input name="subject" size="30" value="| .
|
1405 |
|
Q($form->{"subject"}) . qq|"></td>
|
1406 |
|
</tr>
|
1407 |
|
<tr>
|
1408 |
|
<th align="right" nowrap>| . $locale->text('Attachment name') .
|
1409 |
|
qq|</th>
|
1410 |
|
<td><input name="attachment_filename" size="30" value="| .
|
1411 |
|
Q($attachment_filename) . qq|"></td>
|
1412 |
|
</table>
|
1413 |
|
</td>
|
1414 |
|
</tr>
|
1415 |
|
<tr>
|
1416 |
|
<td>
|
1417 |
|
<table>
|
1418 |
|
<tr>
|
1419 |
|
<th align="left" nowrap>| . $locale->text('Message') . qq|</th>
|
1420 |
|
</tr>
|
1421 |
|
<tr>
|
1422 |
|
<td><textarea name="message" rows="15" cols="60" wrap="soft">| .
|
1423 |
|
H($form->{"message"}) . qq|</textarea></td>
|
1424 |
|
</tr>
|
1425 |
|
</table>
|
1426 |
|
</td>
|
1427 |
|
</tr>
|
1428 |
|
<tr>
|
1429 |
|
<td>
|
1430 |
|
|;
|
1431 |
|
|
1432 |
|
&print_options;
|
1433 |
|
|
1434 |
|
map { delete $form->{$_} }
|
1435 |
|
qw(action email cc bcc subject message formname sendmode format header override);
|
1436 |
|
|
1437 |
|
# save all other variables
|
1438 |
|
foreach $key (keys %$form) {
|
1439 |
|
$form->{$key} =~ s/\"/"/g;
|
1440 |
|
print qq|<input type="hidden" name="$key" value="| . Q($form->{$key}) . qq|">\n|;
|
1441 |
|
}
|
1442 |
|
|
1443 |
|
print qq|
|
1444 |
|
</td>
|
1445 |
|
</tr>
|
1446 |
|
<tr>
|
1447 |
|
<td><hr size="3" noshade></td>
|
1448 |
|
</tr>
|
1449 |
|
</table>
|
1450 |
|
|
1451 |
|
<input type="hidden" name="nextsub" value="send_email">
|
1452 |
|
|
1453 |
|
<br>
|
1454 |
|
<input name="action" class="submit" type="submit" value="|
|
1455 |
|
. $locale->text('Continue') . qq|">
|
1456 |
|
</form>
|
1457 |
|
|
1458 |
|
</body>
|
1459 |
|
</html>
|
1460 |
|
|;
|
1461 |
|
|
1462 |
|
$lxdebug->leave_sub();
|
1463 |
|
}
|
1464 |
|
|
1465 |
|
sub send_email {
|
1466 |
|
$lxdebug->enter_sub();
|
1467 |
|
|
1468 |
|
$old_form = new Form;
|
1469 |
|
|
1470 |
|
map { $old_form->{$_} = $form->{$_} } keys %$form;
|
1471 |
|
$old_form->{media} = $form->{oldmedia};
|
1472 |
|
|
1473 |
|
&print_form($old_form);
|
1474 |
|
|
1475 |
|
$lxdebug->leave_sub();
|
1476 |
|
}
|
1477 |
|
|
1478 |
|
sub print_options {
|
1479 |
|
$lxdebug->enter_sub();
|
1480 |
|
$form->{sendmode} = "attachment";
|
1481 |
|
|
1482 |
|
$form->{"format"} =
|
1483 |
|
$form->{"format"} ? $form->{"format"} :
|
1484 |
|
$myconfig{"template_format"} ? $myconfig{"template_format"} :
|
1485 |
|
"pdf";
|
1486 |
|
|
1487 |
|
$form->{"copies"} =
|
1488 |
|
$form->{"copies"} ? $form->{"copies"} :
|
1489 |
|
$myconfig{"copies"} ? $myconfig{"copies"} :
|
1490 |
|
3;
|
1491 |
|
|
1492 |
|
$form->{"media"} =
|
1493 |
|
$form->{"media"} ? $form->{"media"} :
|
1494 |
|
$myconfig{"default_media"} ? $myconfig{"default_media"} :
|
1495 |
|
"screen";
|
1496 |
|
|
1497 |
|
$form->{"printer_id"} =
|
1498 |
|
defined($form->{"printer_id"}) ? $form->{"printer_id"} :
|
1499 |
|
$myconfig{"default_printer_id"} ? $myconfig{"default_printer_id"} :
|
1500 |
|
"";
|
1501 |
|
|
1502 |
|
$form->{PD}{ $form->{formname} } = "selected";
|
1503 |
|
$form->{DF}{ $form->{format} } = "selected";
|
1504 |
|
$form->{OP}{ $form->{media} } = "selected";
|
1505 |
|
$form->{SM}{ $form->{sendmode} } = "selected";
|
1506 |
|
|
1507 |
|
if ($form->{type} eq 'purchase_order') {
|
1508 |
|
$type = qq|<select name=formname>
|
1509 |
|
<option value=purchase_order $form->{PD}{purchase_order}>|
|
1510 |
|
. $locale->text('Purchase Order') . qq|
|
1511 |
|
<option value=bin_list $form->{PD}{bin_list}>|
|
1512 |
|
. $locale->text('Bin List');
|
1513 |
|
}
|
1514 |
|
|
1515 |
|
if ($form->{type} eq 'credit_note') {
|
1516 |
|
$type = qq|<select name=formname>
|
1517 |
|
<option value=credit_note $form->{PD}{credit_note}>|
|
1518 |
|
. $locale->text('Credit Note');
|
1519 |
|
}
|
1520 |
|
|
1521 |
|
if ($form->{type} eq 'sales_order') {
|
1522 |
|
$type = qq|<select name=formname>
|
1523 |
|
<option value=sales_order $form->{PD}{sales_order}>|
|
1524 |
|
. $locale->text('Confirmation') . qq|
|
1525 |
|
<option value=proforma $form->{PD}{proforma}>|
|
1526 |
|
. $locale->text('Proforma Invoice') . qq|
|
1527 |
|
<option value=pick_list $form->{PD}{pick_list}>|
|
1528 |
|
. $locale->text('Pick List') . qq|
|
1529 |
|
<option value=packing_list $form->{PD}{packing_list}>|
|
1530 |
|
. $locale->text('Packing List');
|
1531 |
|
}
|
1532 |
|
|
1533 |
|
if ($form->{type} =~ /_quotation$/) {
|
1534 |
|
$type = qq|<select name=formname>
|
1535 |
|
<option value="$`_quotation" $form->{PD}{"$`_quotation"}>|
|
1536 |
|
. $locale->text('Quotation');
|
1537 |
|
}
|
1538 |
|
|
1539 |
|
if ($form->{type} eq 'invoice') {
|
1540 |
|
$type = qq|<select name=formname>
|
1541 |
|
<option value=invoice $form->{PD}{invoice}>|
|
1542 |
|
. $locale->text('Invoice') . qq|
|
1543 |
|
<option value=proforma $form->{PD}{proforma}>|
|
1544 |
|
. $locale->text('Proforma Invoice') . qq|
|
1545 |
|
<option value=packing_list $form->{PD}{packing_list}>|
|
1546 |
|
. $locale->text('Packing List');
|
1547 |
|
}
|
1548 |
|
|
1549 |
|
if ($form->{type} eq 'invoice' && $form->{storno}) {
|
1550 |
|
$type = qq|<select name=formname>
|
1551 |
|
<option value=storno_invoice $form->{PD}{storno_invoice}>|
|
1552 |
|
. $locale->text('Storno Invoice') . qq|
|
1553 |
|
<option value=storno_packing_list $form->{PD}{storno_packing_list}>|
|
1554 |
|
. $locale->text('Storno Packing List');
|
1555 |
|
}
|
1556 |
|
|
1557 |
|
if ($form->{type} eq 'credit_note') {
|
1558 |
|
$type = qq|<select name=formname>
|
1559 |
|
<option value=credit_note $form->{PD}{credit_note}>|
|
1560 |
|
. $locale->text('Credit Note');
|
1561 |
|
}
|
1562 |
|
|
1563 |
|
if ($form->{media} eq 'email') {
|
1564 |
|
$media = qq|<select name=sendmode>
|
1565 |
|
<option value=attachment $form->{SM}{attachment}>|
|
1566 |
|
. $locale->text('Attachment') . qq|
|
1567 |
|
<option value=inline $form->{SM}{inline}>| . $locale->text('In-line');
|
1568 |
|
} else {
|
1569 |
|
$media = qq|<select name=media>
|
1570 |
|
<option value=screen $form->{OP}{screen}>| . $locale->text('Screen');
|
1571 |
|
if (scalar(keys (%{ $form->{printers} })) !=0 && $latex_templates) {
|
1572 |
|
$media .= qq|
|
1573 |
|
<option value=printer $form->{OP}{printer}>|
|
1574 |
|
. $locale->text('Printer');
|
1575 |
|
}
|
1576 |
|
if ($latex_templates) {
|
1577 |
|
$media .= qq|
|
1578 |
|
<option value=queue $form->{OP}{queue}>| . $locale->text('Queue');
|
1579 |
|
}
|
1580 |
|
}
|
1581 |
|
|
1582 |
|
$format = qq|<select name=format>|;
|
1583 |
|
if ($opendocument_templates && $openofficeorg_writer_bin &&
|
1584 |
|
$xvfb_bin && (-x $openofficeorg_writer_bin) && (-x $xvfb_bin)) {
|
1585 |
|
$format .= qq|<option value=opendocument_pdf | .
|
1586 |
|
$form->{DF}{"opendocument_pdf"} . qq|>| .
|
1587 |
|
$locale->text("PDF (OpenDocument/OASIS)") . qq|</option>|;
|
1588 |
|
}
|
1589 |
|
|
1590 |
|
if ($latex_templates) {
|
1591 |
|
$format .= qq|<option value=pdf $form->{DF}{pdf}>| .
|
1592 |
|
$locale->text('PDF') . qq|</option>|;
|
1593 |
|
}
|
1594 |
|
|
1595 |
|
$format .= qq|<option value=html $form->{DF}{html}>HTML</option>|;
|
1596 |
|
|
1597 |
|
if ($latex_templates) {
|
1598 |
|
$format .= qq|<option value=postscript $form->{DF}{postscript}>| .
|
1599 |
|
$locale->text('Postscript') . qq|</option>|;
|
1600 |
|
}
|
1601 |
|
|
1602 |
|
if ($opendocument_templates) {
|
1603 |
|
$format .= qq|<option value=opendocument $form->{DF}{opendocument}>| .
|
1604 |
|
$locale->text("OpenDocument/OASIS") . qq|</option>|;
|
1605 |
|
}
|
1606 |
|
$format .= qq|</select>|;
|
1607 |
|
|
1608 |
|
if (scalar(keys (%{ $form->{languages} })) !=0) {
|
1609 |
|
$language_select = qq|<select name=language_id>
|
1610 |
|
<option value=""></option>}|;
|
1611 |
|
foreach $item (@{ $form->{languages} }) {
|
1612 |
|
if ($form->{language_id} eq $item->{id}) {
|
1613 |
|
$language_select .= qq|<option value="$item->{id}" selected>$item->{description}</option>|;
|
1614 |
|
} else {
|
1615 |
|
$language_select .= qq|<option value="$item->{id}">$item->{description}</option>|;
|
1616 |
|
}
|
1617 |
|
}
|
1618 |
|
}
|
1619 |
|
|
1620 |
|
if (scalar(keys (%{ $form->{printers} })) !=0) {
|
1621 |
|
my $selected = !$form->{"printer_id"} ? "selected" : "";
|
1622 |
|
$printer_select = qq|<select name=printer_id $selected>
|
1623 |
|
<option value=""></option>|;
|
1624 |
|
foreach $item (@{ $form->{printers} }) {
|
1625 |
|
$selected = $item->{"id"} == $form->{"printer_id"} ? "selected" : "";
|
1626 |
|
$printer_select .= qq|<option value="$item->{id}" $selected>$item->{printer_description}</option>|;
|
1627 |
|
}
|
1628 |
|
}
|
1629 |
|
|
1630 |
|
|
1631 |
|
|
1632 |
|
print qq|
|
1633 |
|
<table width=100% cellspacing=0 cellpadding=0>
|
1634 |
|
<tr>
|
1635 |
|
<td>
|
1636 |
|
<table>
|
1637 |
|
<tr>
|
1638 |
|
<td>$type</select></td>|;
|
1639 |
|
if (scalar(keys (%{ $form->{languages} })) !=0) {
|
1640 |
|
print qq|
|
1641 |
|
<td>${language_select}</select></td>|;
|
1642 |
|
}
|
1643 |
|
print qq|
|
1644 |
|
<td>$format</select></td>
|
1645 |
|
<td>$media</select></td>|;
|
1646 |
|
if (scalar(keys (%{ $form->{printers} })) !=0) {
|
1647 |
|
print qq|
|
1648 |
|
<td>$printer_select</select></td>
|
1649 |
|
|;
|
1650 |
|
}
|
1651 |
|
|
1652 |
|
if (scalar(keys (%{ $form->{printers} })) !=0 && $latex_templates && $form->{media} ne 'email') {
|
1653 |
|
print qq|
|
1654 |
|
<td>| . $locale->text('Copies') . qq|
|
1655 |
|
<input name=copies size=2 value=$form->{copies}></td>
|
1656 |
|
|;
|
1657 |
|
}
|
1658 |
|
|
1659 |
|
$form->{groupitems} = "checked" if $form->{groupitems};
|
1660 |
|
|
1661 |
|
print qq|
|
1662 |
|
<td>| . $locale->text('Group Items') . qq|</td>
|
1663 |
|
<td><input name=groupitems type=checkbox class=checkbox $form->{groupitems}></td>
|
1664 |
|
</tr>
|
1665 |
|
</table>
|
1666 |
|
</td>
|
1667 |
|
<td align=right>
|
1668 |
|
<table>
|
1669 |
|
<tr>
|
1670 |
|
|;
|
1671 |
|
|
1672 |
|
if ($form->{printed} =~ /$form->{formname}/) {
|
1673 |
|
print qq|
|
1674 |
|
<th>\|| . $locale->text('Printed') . qq|\|</th>
|
1675 |
|
|;
|
1676 |
|
}
|
1677 |
|
|
1678 |
|
if ($form->{emailed} =~ /$form->{formname}/) {
|
1679 |
|
print qq|
|
1680 |
|
<th>\|| . $locale->text('E-mailed') . qq|\|</th>
|
1681 |
|
|;
|
1682 |
|
}
|
1683 |
|
|
1684 |
|
if ($form->{queued} =~ /$form->{formname}/) {
|
1685 |
|
print qq|
|
1686 |
|
<th>\|| . $locale->text('Queued') . qq|\|</th>
|
1687 |
|
|;
|
1688 |
|
}
|
1689 |
|
|
1690 |
|
print qq|
|
1691 |
|
</tr>
|
1692 |
|
</table>
|
1693 |
|
</td>
|
1694 |
|
</tr>
|
1695 |
|
</table>
|
1696 |
|
|;
|
1697 |
|
|
1698 |
|
$lxdebug->leave_sub();
|
1699 |
|
}
|
1700 |
|
|
1701 |
|
sub print {
|
1702 |
|
$lxdebug->enter_sub();
|
1703 |
|
|
1704 |
|
# if this goes to the printer pass through
|
1705 |
|
if ($form->{media} eq 'printer' || $form->{media} eq 'queue') {
|
1706 |
|
$form->error($locale->text('Select postscript or PDF!'))
|
1707 |
|
if ($form->{format} !~ /(postscript|pdf)/);
|
1708 |
|
|
1709 |
|
$old_form = new Form;
|
1710 |
|
map { $old_form->{$_} = $form->{$_} } keys %$form;
|
1711 |
|
}
|
1712 |
|
|
1713 |
|
if (!$form->{id} || (($form->{formname} eq "proforma") && !$form->{proforma} && (($form->{type} =~ /_order$/) || ($form->{type} =~ /_quotation$/)))) {
|
1714 |
|
if ($form->{formname} eq "proforma") {
|
1715 |
|
$form->{proforma} = 1;
|
1716 |
|
}
|
1717 |
|
$form->{print_and_save} = 1;
|
1718 |
|
my $formname = $form->{formname};
|
1719 |
|
&save();
|
1720 |
|
$form->{formname} = $formname;
|
1721 |
|
&edit();
|
1722 |
|
exit;
|
1723 |
|
}
|
1724 |
|
|
1725 |
|
&print_form($old_form);
|
1726 |
|
|
1727 |
|
$lxdebug->leave_sub();
|
1728 |
|
}
|
1729 |
|
|
1730 |
|
sub print_form {
|
1731 |
|
$lxdebug->enter_sub();
|
1732 |
|
my ($old_form) = @_;
|
1733 |
|
|
1734 |
|
$inv = "inv";
|
1735 |
|
$due = "due";
|
1736 |
|
$numberfld = "invnumber";
|
1737 |
|
|
1738 |
|
$display_form =
|
1739 |
|
($form->{display_form}) ? $form->{display_form} : "display_form";
|
1740 |
|
|
1741 |
|
# $form->{"notes"} will be overridden by the customer's/vendor's "notes" field. So save it here.
|
1742 |
|
$form->{ $form->{"formname"} . "notes" } = $form->{"notes"};
|
1743 |
|
|
1744 |
|
if ($form->{formname} eq "invoice") {
|
1745 |
|
$form->{label} = $locale->text('Invoice');
|
1746 |
|
}
|
1747 |
|
if ($form->{formname} eq "packing_list") {
|
1748 |
|
|
1749 |
|
# this is from an invoice
|
1750 |
|
$form->{label} = $locale->text('Packing List');
|
1751 |
|
}
|
1752 |
|
if ($form->{formname} eq 'sales_order') {
|
1753 |
|
$inv = "ord";
|
1754 |
|
$due = "req";
|
1755 |
|
$form->{"${inv}date"} = $form->{transdate};
|
1756 |
|
$form->{label} = $locale->text('Sales Order');
|
1757 |
|
$numberfld = "sonumber";
|
1758 |
|
$order = 1;
|
1759 |
|
}
|
1760 |
|
|
1761 |
|
if (($form->{type} eq 'invoice') && ($form->{formname} eq 'proforma') ) {
|
1762 |
|
$inv = "inv";
|
1763 |
|
$due = "due";
|
1764 |
|
$form->{"${inv}date"} = $form->{invdate};
|
1765 |
|
$form->{label} = $locale->text('Proforma Invoice');
|
1766 |
|
$numberfld = "sonumber";
|
1767 |
|
$order = 0;
|
1768 |
|
}
|
1769 |
|
|
1770 |
|
if (($form->{type} eq 'sales_order') && ($form->{formname} eq 'proforma') ) {
|
1771 |
|
$inv = "inv";
|
1772 |
|
$due = "due";
|
1773 |
|
$form->{"${inv}date"} = $form->{transdate};
|
1774 |
|
$form->{"invdate"} = $form->{transdate};
|
1775 |
|
$form->{invnumber} = $form->{ordnumber};
|
1776 |
|
$form->{label} = $locale->text('Proforma Invoice');
|
1777 |
|
$numberfld = "sonumber";
|
1778 |
|
$order = 1;
|
1779 |
|
}
|
1780 |
|
|
1781 |
|
if ($form->{formname} eq 'packing_list' && $form->{type} ne 'invoice') {
|
1782 |
|
|
1783 |
|
# we use the same packing list as from an invoice
|
1784 |
|
$inv = "ord";
|
1785 |
|
$due = "req";
|
1786 |
|
$form->{invdate} = $form->{"${inv}date"} = $form->{transdate};
|
1787 |
|
$form->{label} = $locale->text('Packing List');
|
1788 |
|
$order = 1;
|
1789 |
|
# set invnumber for template packing_list
|
1790 |
|
$form->{invnumber} = $form->{ordnumber};
|
1791 |
|
}
|
1792 |
|
if ($form->{formname} eq 'pick_list') {
|
1793 |
|
$inv = "ord";
|
1794 |
|
$due = "req";
|
1795 |
|
$form->{"${inv}date"} =
|
1796 |
|
($form->{transdate}) ? $form->{transdate} : $form->{invdate};
|
1797 |
|
$form->{label} = $locale->text('Pick List');
|
1798 |
|
$order = 1 unless $form->{type} eq 'invoice';
|
1799 |
|
}
|
1800 |
|
if ($form->{formname} eq 'purchase_order') {
|
1801 |
|
$inv = "ord";
|
1802 |
|
$due = "req";
|
1803 |
|
$form->{"${inv}date"} = $form->{transdate};
|
1804 |
|
$form->{label} = $locale->text('Purchase Order');
|
1805 |
|
$numberfld = "ponumber";
|
1806 |
|
$order = 1;
|
1807 |
|
}
|
1808 |
|
if ($form->{formname} eq 'bin_list') {
|
1809 |
|
$inv = "ord";
|
1810 |
|
$due = "req";
|
1811 |
|
$form->{"${inv}date"} = $form->{transdate};
|
1812 |
|
$form->{label} = $locale->text('Bin List');
|
1813 |
|
$order = 1;
|
1814 |
|
}
|
1815 |
|
if ($form->{formname} eq 'sales_quotation') {
|
1816 |
|
$inv = "quo";
|
1817 |
|
$due = "req";
|
1818 |
|
$form->{"${inv}date"} = $form->{transdate};
|
1819 |
|
$form->{label} = $locale->text('Quotation');
|
1820 |
|
$numberfld = "sqnumber";
|
1821 |
|
$order = 1;
|
1822 |
|
}
|
1823 |
|
|
1824 |
|
if (($form->{type} eq 'sales_quotation') && ($form->{formname} eq 'proforma') ) {
|
1825 |
|
$inv = "quo";
|
1826 |
|
$due = "req";
|
1827 |
|
$form->{"${inv}date"} = $form->{transdate};
|
1828 |
|
$form->{"invdate"} = $form->{transdate};
|
1829 |
|
$form->{label} = $locale->text('Proforma Invoice');
|
1830 |
|
$numberfld = "sqnumber";
|
1831 |
|
$order = 1;
|
1832 |
|
}
|
1833 |
|
|
1834 |
|
if ($form->{formname} eq 'request_quotation') {
|
1835 |
|
$inv = "quo";
|
1836 |
|
$due = "req";
|
1837 |
|
$form->{"${inv}date"} = $form->{transdate};
|
1838 |
|
$form->{label} = $locale->text('Quotation');
|
1839 |
|
$numberfld = "rfqnumber";
|
1840 |
|
$order = 1;
|
1841 |
|
}
|
1842 |
|
|
1843 |
|
$form->isblank("email", $locale->text('E-mail address missing!'))
|
1844 |
|
if ($form->{media} eq 'email');
|
1845 |
|
$form->isblank("${inv}date",
|
1846 |
|
$locale->text($form->{label})
|
1847 |
|
. ": "
|
1848 |
|
. $locale->text(' Date missing!'));
|
1849 |
|
|
1850 |
|
# $locale->text('Invoice Number missing!')
|
1851 |
|
# $locale->text('Invoice Date missing!')
|
1852 |
|
# $locale->text('Packing List Number missing!')
|
1853 |
|
# $locale->text('Packing List Date missing!')
|
1854 |
|
# $locale->text('Order Number missing!')
|
1855 |
|
# $locale->text('Order Date missing!')
|
1856 |
|
# $locale->text('Quotation Number missing!')
|
1857 |
|
# $locale->text('Quotation Date missing!')
|
1858 |
|
|
1859 |
|
# assign number
|
1860 |
|
if (!$form->{"${inv}number"} && !$form->{preview}) {
|
1861 |
|
$form->{"${inv}number"} = $form->update_defaults(\%myconfig, $numberfld);
|
1862 |
|
if ($form->{media} ne 'email') {
|
1863 |
|
|
1864 |
|
# get pricegroups for parts
|
1865 |
|
IS->get_pricegroups_for_parts(\%myconfig, \%$form);
|
1866 |
|
|
1867 |
|
# build up html code for prices_$i
|
1868 |
|
set_pricegroup($form->{rowcount});
|
1869 |
|
|
1870 |
|
$form->{rowcount}--;
|
1871 |
|
|
1872 |
|
&{"$display_form"};
|
1873 |
|
exit;
|
1874 |
|
}
|
1875 |
|
}
|
1876 |
|
|
1877 |
|
&validate_items;
|
1878 |
|
|
1879 |
|
# Save the email address given in the form because it should override the setting saved for the customer/vendor.
|
1880 |
|
my ($saved_email, $saved_cc, $saved_bcc) =
|
1881 |
|
($form->{"email"}, $form->{"cc"}, $form->{"bcc"});
|
1882 |
|
|
1883 |
|
$language_saved = $form->{language_id};
|
1884 |
|
$payment_id_saved = $form->{payment_id};
|
1885 |
|
|
1886 |
|
&{"$form->{vc}_details"}();
|
1887 |
|
|
1888 |
|
$form->{language_id} = $language_saved;
|
1889 |
|
$form->{payment_id} = $payment_id_saved;
|
1890 |
|
|
1891 |
|
$form->{"email"} = $saved_email if ($saved_email);
|
1892 |
|
$form->{"cc"} = $saved_cc if ($saved_cc);
|
1893 |
|
$form->{"bcc"} = $saved_bcc if ($saved_bcc);
|
1894 |
|
|
1895 |
|
my ($language_tc, $output_numberformat, $output_dateformat, $output_longdates);
|
1896 |
|
if ($form->{"language_id"}) {
|
1897 |
|
($language_tc, $output_numberformat, $output_dateformat, $output_longdates) =
|
1898 |
|
AM->get_language_details(\%myconfig, $form, $form->{language_id});
|
1899 |
|
} else {
|
1900 |
|
$output_dateformat = $myconfig{"dateformat"};
|
1901 |
|
$output_numberformat = $myconfig{"numberformat"};
|
1902 |
|
$output_longdates = 1;
|
1903 |
|
}
|
1904 |
|
|
1905 |
|
($form->{employee}) = split /--/, $form->{employee};
|
1906 |
|
|
1907 |
|
# create the form variables
|
1908 |
|
if ($order) {
|
1909 |
|
OE->order_details(\%myconfig, \%$form);
|
1910 |
|
} else {
|
1911 |
|
IS->invoice_details(\%myconfig, \%$form, $locale);
|
1912 |
|
}
|
1913 |
|
|
1914 |
|
if ($form->{shipto_id}) {
|
1915 |
|
$form->get_shipto(\%myconfig);
|
1916 |
|
}
|
1917 |
|
|
1918 |
|
@a = qw(name street zipcode city country);
|
1919 |
|
|
1920 |
|
$shipto = 1;
|
1921 |
|
|
1922 |
|
# if there is no shipto fill it in from billto
|
1923 |
|
foreach $item (@a) {
|
1924 |
|
if ($form->{"shipto$item"}) {
|
1925 |
|
$shipto = 0;
|
1926 |
|
last;
|
1927 |
|
}
|
1928 |
|
}
|
1929 |
|
|
1930 |
|
if ($shipto) {
|
1931 |
|
if ( $form->{formname} eq 'purchase_order'
|
1932 |
|
|| $form->{formname} eq 'request_quotation') {
|
1933 |
|
$form->{shiptoname} = $myconfig{company};
|
1934 |
|
$form->{shiptostreet} = $myconfig{address};
|
1935 |
|
} else {
|
1936 |
|
map { $form->{"shipto$_"} = $form->{$_} } @a;
|
1937 |
|
}
|
1938 |
|
}
|
1939 |
|
|
1940 |
|
$form->{notes} =~ s/^\s+//g;
|
1941 |
|
|
1942 |
|
$form->{templates} = "$myconfig{templates}";
|
1943 |
|
|
1944 |
|
$form->{language} = $form->get_template_language(\%myconfig);
|
1945 |
|
$form->{printer_code} = $form->get_printer_code(\%myconfig);
|
1946 |
|
|
1947 |
|
if ($form->{language} ne "") {
|
1948 |
|
map({ $form->{"unit"}->[$_] =
|
1949 |
|
AM->translate_units($form, $form->{"language"},
|
1950 |
|
$form->{"unit"}->[$_], $form->{"qty"}->[$_]); }
|
1951 |
|
(0..scalar(@{$form->{"unit"}}) - 1));
|
1952 |
|
$form->{language} = "_" . $form->{language};
|
1953 |
|
}
|
1954 |
|
|
1955 |
|
# Format dates.
|
1956 |
|
format_dates($output_dateformat, $output_longdates,
|
1957 |
|
qw(invdate orddate quodate pldate duedate reqdate transdate
|
1958 |
|
shippingdate deliverydate validitydate paymentdate
|
1959 |
|
datepaid transdate_oe deliverydate_oe
|
1960 |
|
employee_startdate employee_enddate
|
1961 |
|
),
|
1962 |
|
grep({ /^datepaid_\d+$/ ||
|
1963 |
|
/^transdate_oe_\d+$/ ||
|
1964 |
|
/^deliverydate_oe_\d+$/ ||
|
1965 |
|
/^reqdate_\d+$/ ||
|
1966 |
|
/^deliverydate_\d+$/ ||
|
1967 |
|
/^transdate_\d+$/
|
1968 |
|
} keys(%{$form})));
|
1969 |
|
|
1970 |
|
reformat_numbers($output_numberformat, 2,
|
1971 |
|
qw(invtotal ordtotal quototal subtotal linetotal
|
1972 |
|
listprice sellprice netprice discount
|
1973 |
|
tax taxbase),
|
1974 |
|
grep({ /^linetotal_\d+$/ ||
|
1975 |
|
/^listprice_\d+$/ ||
|
1976 |
|
/^sellprice_\d+$/ ||
|
1977 |
|
/^netprice_\d+$/ ||
|
1978 |
|
/^taxbase_\d+$/ ||
|
1979 |
|
/^discount_\d+$/ ||
|
1980 |
|
/^tax_\d+$/
|
1981 |
|
} keys(%{$form})));
|
1982 |
|
|
1983 |
|
reformat_numbers($output_numberformat, undef,
|
1984 |
|
qw(qty),
|
1985 |
|
grep({ /^qty_\d+$/
|
1986 |
|
} keys(%{$form})));
|
1987 |
|
|
1988 |
|
if ($form->{printer_code} ne "") {
|
1989 |
|
$form->{printer_code} = "_" . $form->{printer_code};
|
1990 |
|
}
|
1991 |
|
|
1992 |
|
$form->{IN} = "$form->{formname}$form->{language}$form->{printer_code}.html";
|
1993 |
|
if ($form->{format} eq 'postscript') {
|
1994 |
|
$form->{postscript} = 1;
|
1995 |
|
$form->{IN} =~ s/html$/tex/;
|
1996 |
|
} elsif ($form->{"format"} =~ /pdf/) {
|
1997 |
|
$form->{pdf} = 1;
|
1998 |
|
if ($form->{"format"} =~ /opendocument/) {
|
1999 |
|
$form->{IN} =~ s/html$/odt/;
|
2000 |
|
} else {
|
2001 |
|
$form->{IN} =~ s/html$/tex/;
|
2002 |
|
}
|
2003 |
|
} elsif ($form->{"format"} =~ /opendocument/) {
|
2004 |
|
$form->{"opendocument"} = 1;
|
2005 |
|
$form->{"IN"} =~ s/html$/odt/;
|
2006 |
|
}
|
2007 |
|
|
2008 |
|
if ($form->{media} eq 'printer') {
|
2009 |
|
$form->{OUT} = "| $form->{printer_command} &>/dev/null";
|
2010 |
|
$form->{printed} .= " $form->{formname}";
|
2011 |
|
$form->{printed} =~ s/^ //;
|
2012 |
|
}
|
2013 |
|
$printed = $form->{printed};
|
2014 |
|
|
2015 |
|
if ($form->{media} eq 'email') {
|
2016 |
|
$form->{subject} = qq|$form->{label} $form->{"${inv}number"}|
|
2017 |
|
unless $form->{subject};
|
2018 |
|
|
2019 |
|
$form->{OUT} = "$sendmail";
|
2020 |
|
|
2021 |
|
$form->{emailed} .= " $form->{formname}";
|
2022 |
|
$form->{emailed} =~ s/^ //;
|
2023 |
|
}
|
2024 |
|
$emailed = $form->{emailed};
|
2025 |
|
|
2026 |
|
if ($form->{media} eq 'queue') {
|
2027 |
|
%queued = split / /, $form->{queued};
|
2028 |
|
|
2029 |
|
if ($filename = $queued{ $form->{formname} }) {
|
2030 |
|
$form->{queued} =~ s/$form->{formname} $filename//;
|
2031 |
|
unlink "$spool/$filename";
|
2032 |
|
$filename =~ s/\..*$//g;
|
2033 |
|
} else {
|
2034 |
|
$filename = time;
|
2035 |
|
$filename .= $$;
|
2036 |
|
}
|
2037 |
|
|
2038 |
|
$filename .= ($form->{postscript}) ? '.ps' : '.pdf';
|
2039 |
|
$form->{OUT} = ">$spool/$filename";
|
2040 |
|
|
2041 |
|
# add type
|
2042 |
|
$form->{queued} .= " $form->{formname} $filename";
|
2043 |
|
|
2044 |
|
$form->{queued} =~ s/^ //;
|
2045 |
|
}
|
2046 |
|
$queued = $form->{queued};
|
2047 |
|
|
2048 |
|
$form->parse_template(\%myconfig, $userspath);
|
2049 |
|
|
2050 |
|
$form->{callback} = "";
|
2051 |
|
|
2052 |
|
if ($form->{media} eq 'email') {
|
2053 |
|
$form->{message} = $locale->text('sent') unless $form->{message};
|
2054 |
|
}
|
2055 |
|
$message = $form->{message};
|
2056 |
|
|
2057 |
|
# if we got back here restore the previous form
|
2058 |
|
if ($form->{media} =~ /(printer|email|queue)/) {
|
2059 |
|
|
2060 |
|
$form->update_status(\%myconfig)
|
2061 |
|
if ($form->{media} eq 'queue' && $form->{id});
|
2062 |
|
|
2063 |
|
if ($old_form) {
|
2064 |
|
|
2065 |
|
$old_form->{"${inv}number"} = $form->{"${inv}number"};
|
2066 |
|
|
2067 |
|
# restore and display form
|
2068 |
|
map { $form->{$_} = $old_form->{$_} } keys %$old_form;
|
2069 |
|
|
2070 |
|
$form->{queued} = $queued;
|
2071 |
|
$form->{printed} = $printed;
|
2072 |
|
$form->{emailed} = $emailed;
|
2073 |
|
$form->{message} = $message;
|
2074 |
|
|
2075 |
|
$form->{rowcount}--;
|
2076 |
|
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
|
2077 |
|
qw(exchangerate creditlimit creditremaining);
|
2078 |
|
|
2079 |
|
for $i (1 .. $form->{paidaccounts}) {
|
2080 |
|
map {
|
2081 |
|
$form->{"${_}_$i"} =
|
2082 |
|
$form->parse_amount(\%myconfig, $form->{"${_}_$i"})
|
2083 |
|
} qw(paid exchangerate);
|
2084 |
|
}
|
2085 |
|
|
2086 |
|
&{"$display_form"};
|
2087 |
|
exit;
|
2088 |
|
}
|
2089 |
|
|
2090 |
|
$msg =
|
2091 |
|
($form->{media} eq 'printer')
|
2092 |
|
? $locale->text('sent to printer')
|
2093 |
|
: $locale->text('emailed to') . " $form->{email}";
|
2094 |
|
$form->redirect(qq|$form->{label} $form->{"${inv}number"} $msg|);
|
2095 |
|
}
|
2096 |
|
if ($form->{printing}) {
|
2097 |
|
&{"$display_form"};
|
2098 |
|
exit;
|
2099 |
|
}
|
2100 |
|
|
2101 |
|
$lxdebug->leave_sub();
|
2102 |
|
}
|
2103 |
|
|
2104 |
|
sub customer_details {
|
2105 |
|
$lxdebug->enter_sub();
|
2106 |
|
IS->customer_details(\%myconfig, \%$form, @_);
|
2107 |
|
$lxdebug->leave_sub();
|
2108 |
|
}
|
2109 |
|
|
2110 |
|
sub vendor_details {
|
2111 |
|
$lxdebug->enter_sub();
|
2112 |
|
|
2113 |
|
IR->vendor_details(\%myconfig, \%$form, @_);
|
2114 |
|
|
2115 |
|
$lxdebug->leave_sub();
|
2116 |
|
}
|
2117 |
|
|
2118 |
|
sub post_as_new {
|
2119 |
|
$lxdebug->enter_sub();
|
2120 |
|
|
2121 |
|
$form->{postasnew} = 1;
|
2122 |
|
map { delete $form->{$_} } qw(printed emailed queued);
|
2123 |
|
|
2124 |
|
&post;
|
2125 |
|
|
2126 |
|
$lxdebug->leave_sub();
|
2127 |
|
}
|
2128 |
|
|
2129 |
|
sub ship_to {
|
2130 |
|
$lxdebug->enter_sub();
|
2131 |
|
if ($form->{second_run}) {
|
2132 |
|
$form->{print_and_post} = 0;
|
2133 |
|
}
|
2134 |
|
|
2135 |
|
$title = $form->{title};
|
2136 |
|
$form->{title} = $locale->text('Ship to');
|
2137 |
|
|
2138 |
|
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
|
2139 |
|
qw(exchangerate creditlimit creditremaining);
|
2140 |
|
|
2141 |
|
my @shipto_vars =
|
2142 |
|
qw(shiptoname shiptostreet shiptozipcode shiptocity shiptocountry
|
2143 |
|
shiptocontact shiptophone shiptofax shiptoemail
|
2144 |
|
shiptodepartment_1 shiptodepartment_2);
|
2145 |
|
|
2146 |
|
my @addr_vars =
|
2147 |
|
(qw(name department_1 department_2 street zipcode city country
|
2148 |
|
contact email phone fax));
|
2149 |
|
|
2150 |
|
# get details for name
|
2151 |
|
&{"$form->{vc}_details"}(@addr_vars);
|
2152 |
|
|
2153 |
|
$number =
|
2154 |
|
($form->{vc} eq 'customer')
|
2155 |
|
? $locale->text('Customer Number')
|
2156 |
|
: $locale->text('Vendor Number');
|
2157 |
|
|
2158 |
|
# get pricegroups for parts
|
2159 |
|
IS->get_pricegroups_for_parts(\%myconfig, \%$form);
|
2160 |
|
|
2161 |
|
# build up html code for prices_$i
|
2162 |
|
set_pricegroup($form->{rowcount});
|
2163 |
|
|
2164 |
|
$nextsub = ($form->{display_form}) ? $form->{display_form} : "display_form";
|
2165 |
|
|
2166 |
|
$form->{rowcount}--;
|
2167 |
|
|
2168 |
|
$form->header;
|
2169 |
|
|
2170 |
|
print qq|
|
2171 |
|
<body>
|
2172 |
|
|
2173 |
|
<form method=post action=$form->{script}>
|
2174 |
|
|
2175 |
|
<table width=100%>
|
2176 |
|
<tr>
|
2177 |
|
<td>
|
2178 |
|
<table>
|
2179 |
|
<tr class=listheading>
|
2180 |
|
<th class=listheading colspan=2 width=50%>|
|
2181 |
|
. $locale->text('Billing Address') . qq|</th>
|
2182 |
|
<th class=listheading width=50%>|
|
2183 |
|
. $locale->text('Shipping Address') . qq|</th>
|
2184 |
|
</tr>
|
2185 |
|
<tr height="5"></tr>
|
2186 |
|
<tr>
|
2187 |
|
<th align=right nowrap>$number</th>
|
2188 |
|
<td>$form->{"$form->{vc}number"}</td>
|
2189 |
|
</tr>
|
2190 |
|
<tr>
|
2191 |
|
<th align=right nowrap>| . $locale->text('Company Name') . qq|</th>
|
2192 |
|
<td>$form->{name}</td>
|
2193 |
|
<td><input name=shiptoname size=35 value="$form->{shiptoname}"></td>
|
2194 |
|
</tr>
|
2195 |
|
<tr>
|
2196 |
|
<th align=right nowrap>| . $locale->text('Department') . qq|</th>
|
2197 |
|
<td>$form->{department_1}</td>
|
2198 |
|
<td><input name=shiptodepartment_1 size=35 value="$form->{shiptodepartment_1}"></td>
|
2199 |
|
</tr>
|
2200 |
|
<tr>
|
2201 |
|
<th align=right nowrap> </th>
|
2202 |
|
<td>$form->{department_2}</td>
|
2203 |
|
<td><input name=shiptodepartment_2 size=35 value="$form->{shiptodepartment_2}"></td>
|
2204 |
|
</tr>
|
2205 |
|
<tr>
|
2206 |
|
<th align=right nowrap>| . $locale->text('Street') . qq|</th>
|
2207 |
|
<td>$form->{street}</td>
|
2208 |
|
<td><input name=shiptostreet size=35 value="$form->{shiptostreet}"></td>
|
2209 |
|
</tr>
|
2210 |
|
<tr>
|
2211 |
|
<th align=right nowrap>| . $locale->text('Zipcode') . qq|</th>
|
2212 |
|
<td>$form->{zipcode}</td>
|
2213 |
|
<td><input name=shiptozipcode size=35 value="$form->{shiptozipcode}"></td>
|
2214 |
|
</tr>
|
2215 |
|
<tr>
|
2216 |
|
<th align=right nowrap>| . $locale->text('City') . qq|</th>
|
2217 |
|
<td>$form->{city}</td>
|
2218 |
|
<td><input name=shiptocity size=35 value="$form->{shiptocity}"></td>
|
2219 |
|
</tr>
|
2220 |
|
<tr>
|
2221 |
|
<th align=right nowrap>| . $locale->text('Country') . qq|</th>
|
2222 |
|
<td>$form->{country}</td>
|
2223 |
|
<td><input name=shiptocountry size=35 value="$form->{shiptocountry}"></td>
|
2224 |
|
</tr>
|
2225 |
|
<tr>
|
2226 |
|
<th align=right nowrap>| . $locale->text('Contact') . qq|</th>
|
2227 |
|
<td>$form->{contact}</td>
|
2228 |
|
<td><input name=shiptocontact size=35 value="$form->{shiptocontact}"></td>
|
2229 |
|
</tr>
|
2230 |
|
<tr>
|
2231 |
|
<th align=right nowrap>| . $locale->text('Phone') . qq|</th>
|
2232 |
|
<td>$form->{phone}</td>
|
2233 |
|
<td><input name=shiptophone size=20 value="$form->{shiptophone}"></td>
|
2234 |
|
</tr>
|
2235 |
|
<tr>
|
2236 |
|
<th align=right nowrap>| . $locale->text('Fax') . qq|</th>
|
2237 |
|
<td>$form->{fax}</td>
|
2238 |
|
<td><input name=shiptofax size=20 value="$form->{shiptofax}"></td>
|
2239 |
|
</tr>
|
2240 |
|
<tr>
|
2241 |
|
<th align=right nowrap>| . $locale->text('E-mail') . qq|</th>
|
2242 |
|
<td>$form->{email}</td>
|
2243 |
|
<td><input name=shiptoemail size=35 value="$form->{shiptoemail}"></td>
|
2244 |
|
</tr>
|
2245 |
|
</table>
|
2246 |
|
</td>
|
2247 |
|
</tr>
|
2248 |
|
</table>
|
2249 |
|
|
2250 |
|
<input type=hidden name=nextsub value=$nextsub>
|
2251 |
|
|;
|
2252 |
|
|
2253 |
|
# delete shipto
|
2254 |
|
map({ delete $form->{$_} } (@shipto_vars, qw(header)));
|
2255 |
|
$form->{title} = $title;
|
2256 |
|
|
2257 |
|
foreach $key (keys %$form) {
|
2258 |
|
$form->{$key} =~ s/\"/"/g;
|
2259 |
|
print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
|
2260 |
|
}
|
2261 |
|
|
2262 |
|
print qq|
|
2263 |
|
|
2264 |
|
<hr size=3 noshade>
|
2265 |
|
|
2266 |
|
<br>
|
2267 |
|
<input class=submit type=submit name=action value="|
|
2268 |
|
. $locale->text('Continue') . qq|">
|
2269 |
|
</form>
|
2270 |
|
|
2271 |
|
</body>
|
2272 |
|
</html>
|
2273 |
|
|;
|
2274 |
|
|
2275 |
|
$lxdebug->leave_sub();
|
2276 |
|
}
|
2277 |
|
|
2278 |
|
sub new_license {
|
2279 |
|
$lxdebug->enter_sub();
|
2280 |
|
|
2281 |
|
my $row = shift;
|
2282 |
|
|
2283 |
|
# change callback
|
2284 |
|
$form->{old_callback} = $form->escape($form->{callback}, 1);
|
2285 |
|
$form->{callback} = $form->escape("$form->{script}?action=display_form", 1);
|
2286 |
|
$form->{old_callback} = $form->escape($form->{old_callback}, 1);
|
2287 |
|
|
2288 |
|
# delete action
|
2289 |
|
delete $form->{action};
|
2290 |
|
$customer = $form->{customer};
|
2291 |
|
map { $form->{"old_$_"} = $form->{"${_}_$row"} } qw(partnumber description);
|
2292 |
|
|
2293 |
|
# save all other form variables in a previousform variable
|
2294 |
|
$form->{row} = $row;
|
2295 |
|
foreach $key (keys %$form) {
|
2296 |
|
|
2297 |
|
# escape ampersands
|
2298 |
|
$form->{$key} =~ s/&/%26/g;
|
2299 |
|
$previousform .= qq|$key=$form->{$key}&|;
|
2300 |
|
}
|
2301 |
|
chop $previousform;
|
2302 |
|
$previousform = $form->escape($previousform, 1);
|
2303 |
|
|
2304 |
|
$form->{script} = "licenses.pl";
|
2305 |
|
|
2306 |
|
map { $form->{$_} = $form->{"old_$_"} } qw(partnumber description);
|
2307 |
|
map { $form->{$_} = $form->escape($form->{$_}, 1) }
|
2308 |
|
qw(partnumber description);
|
2309 |
|
$form->{callback} =
|
2310 |
|
qq|$form->{script}?login=$form->{login}&path=$form->{path}&password=$form->{password}&action=add&vc=$form->{db}&$form->{db}_id=$form->{id}&$form->{db}=$name&type=$form->{type}&customer=$customer&partnumber=$form->{partnumber}&description=$form->{description}&previousform="$previousform"&initial=1|;
|
2311 |
|
$form->redirect;
|
2312 |
|
|
2313 |
|
$lxdebug->leave_sub();
|
2314 |
|
}
|
2315 |
|
|
2316 |
|
sub relink_accounts {
|
2317 |
|
$lxdebug->enter_sub();
|
2318 |
|
|
2319 |
|
$form->{"taxaccounts"} =~ s/\s*$//;
|
2320 |
|
$form->{"taxaccounts"} =~ s/^\s*//;
|
2321 |
|
foreach my $accno (split(/\s*/, $form->{"taxaccounts"})) {
|
2322 |
|
map({ delete($form->{"${accno}_${_}"}); } qw(rate description taxnumber));
|
2323 |
|
}
|
2324 |
|
$form->{"taxaccounts"} = "";
|
2325 |
|
|
2326 |
|
for (my $i = 1; $i <= $form->{"rowcount"}; $i++) {
|
2327 |
|
if ($form->{"id_$i"}) {
|
2328 |
|
IC->retrieve_accounts(\%myconfig, $form, $form->{"id_$i"}, $i, 1);
|
2329 |
|
}
|
2330 |
|
}
|
2331 |
|
|
2332 |
|
$lxdebug->leave_sub();
|
2333 |
|
}
|
2334 |
|
|
2335 |
|
|
2336 |
|
sub set_duedate {
|
2337 |
|
$lxdebug->enter_sub();
|
2338 |
|
|
2339 |
|
$form->get_duedate(\%myconfig);
|
2340 |
|
|
2341 |
|
my $q = new CGI;
|
2342 |
|
$result = "$form->{duedate}";
|
2343 |
|
print $q->header();
|
2344 |
|
print $result;
|
2345 |
|
$lxdebug->leave_sub();
|
2346 |
|
|
2347 |
|
}
|
2348 |
|
|
|
1362 |
"
|
Historie eingefügt