Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 6d6eb2de

Von Moritz Bunkus vor mehr als 13 Jahren hinzugefügt

  • ID 6d6eb2decd2f3561ae4f4591269165cffce88b25
  • Vorgänger aad6637b
  • Nachfolger f631da56

ship_to() in io.pl auf Template umgestellt

Unterschiede anzeigen:

bin/mozilla/io.pl
1615 1615
sub ship_to {
1616 1616
  $main::lxdebug->enter_sub();
1617 1617

  
1618
  my $form     = $main::form;
1619
  my %myconfig = %main::myconfig;
1620
  my $locale   = $main::locale;
1621
  my $cgi      = $main::cgi;
1622

  
1623 1618
  _check_io_auth();
1624 1619

  
1625
  if ($form->{second_run}) {
1626
    $form->{print_and_post} = 0;
1627
  }
1620
  $::form->{print_and_post} = 0 if $::form->{second_run};
1628 1621

  
1629
  my $title = $form->{title};
1630
  $form->{title} = $locale->text('Ship to');
1622
  map { $::form->{$_} = $::form->parse_amount(\%::myconfig, $::form->{$_}) } qw(exchangerate creditlimit creditremaining);
1631 1623

  
1632
  map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
1633
    qw(exchangerate creditlimit creditremaining);
1634

  
1635
  my @shipto_vars =
1636
    qw(shiptoname shiptostreet shiptozipcode shiptocity shiptocountry
1637
       shiptocontact shiptocp_gender shiptophone shiptofax shiptoemail
1638
       shiptodepartment_1 shiptodepartment_2);
1639

  
1640
  my @addr_vars =
1641
    (qw(name department_1 department_2 street zipcode city country
1642
        contact email phone fax));
1643

  
1644
  # get details for name
1645
  call_sub("$form->{vc}_details", @addr_vars);
1646

  
1647
  my $number =
1648
    ($form->{vc} eq 'customer')
1649
    ? $locale->text('Customer Number')
1650
    : $locale->text('Vendor Number');
1651

  
1652
  # sieht nicht nett aus, funktioniert aber
1653
  # das vorausgewählte select-feld wird über shiptocp_gender
1654
  # entsprechend vorbelegt
1655
  my $selected_m='';
1656
  my $selected_f='';
1657
  if ($form->{shiptocp_gender} eq 'm') {
1658
    $selected_m='selected';
1659
    $selected_f='';
1660
  } elsif ($form->{shiptocp_gender} eq 'f') {
1661
    $selected_m='';
1662
    $selected_f='selected';
1663
  }
1624
  # get details for customer/vendor
1625
  call_sub($::form->{vc} . "_details", qw(name department_1 department_2 street zipcode city country contact email phone fax), $::form->{vc} . "number");
1664 1626

  
1665 1627
  # get pricegroups for parts
1666
  IS->get_pricegroups_for_parts(\%myconfig, \%$form);
1628
  IS->get_pricegroups_for_parts(\%::myconfig, \%$::form);
1667 1629

  
1668 1630
  # build up html code for prices_$i
1669
  set_pricegroup($form->{rowcount});
1631
  set_pricegroup($::form->{rowcount});
1670 1632

  
1671
  my $nextsub = ($form->{display_form}) ? $form->{display_form} : "display_form";
1672

  
1673
  $form->{rowcount}--;
1633
  $::form->{rowcount}--;
1674 1634

  
1675
  $form->header;
1635
  my @shipto_vars   = qw(shiptoname shiptostreet shiptozipcode shiptocity shiptocountry
1636
                         shiptocontact shiptocp_gender shiptophone shiptofax shiptoemail
1637
                         shiptodepartment_1 shiptodepartment_2);
1638
  my $previous_form = $::auth->save_form_in_session(skip_keys => [ @shipto_vars, qw(header shipto_id) ]);
1639
  $::form->{title}  = $::locale->text('Ship to');
1640
  $::form->header;
1676 1641

  
1677
  print qq|
1678
<body>
1679

  
1680
<form method="post" action="$form->{script}">
1681

  
1682
<table width="100%">
1683
  <tr>
1684
    <td>
1685
      <table>
1686
        <tr class="listheading">
1687
          <th class="listheading" colspan="2" width="50%">|
1688
    . $locale->text('Billing Address') . qq|</th>
1689
          <th class="listheading" width="50%">|
1690
    . $locale->text('Shipping Address') . qq|</th>
1691
        </tr>
1692
        <tr height="5"></tr>
1693
        <tr>
1694
          <th align="right" nowrap>$number</th>
1695
          <td>$form->{"$form->{vc}number"}</td>
1696
        </tr>
1697
        <tr>
1698
          <th align="right" nowrap>| . $locale->text('Company Name') . qq|</th>
1699
          <td>$form->{name}</td>
1700
          <td><input name="shiptoname" size="35" value="$form->{shiptoname}"></td>
1701
        </tr>
1702
        <tr>
1703
          <th align="right" nowrap>| . $locale->text('Department') . qq|</th>
1704
          <td>$form->{department_1}</td>
1705
          <td><input name="shiptodepartment_1" size="35" value="$form->{shiptodepartment_1}"></td>
1706
        </tr>
1707
        <tr>
1708
          <th align="right" nowrap>&nbsp;</th>
1709
          <td>$form->{department_2}</td>
1710
          <td><input name="shiptodepartment_2" size="35" value="$form->{shiptodepartment_2}"></td>
1711
        </tr>
1712
        <tr>
1713
          <th align="right" nowrap>| . $locale->text('Street') . qq|</th>
1714
          <td>$form->{street}</td>
1715
          <td><input name="shiptostreet" size="35" value="$form->{shiptostreet}"></td>
1716
        </tr>
1717
        <tr>
1718
          <th align="right" nowrap>| . $locale->text('Zipcode') . qq|</th>
1719
          <td>$form->{zipcode}</td>
1720
          <td><input name="shiptozipcode" size="35" value="$form->{shiptozipcode}"></td>
1721
        </tr>
1722
        <tr>
1723
          <th align="right" nowrap>| . $locale->text('City') . qq|</th>
1724
          <td>$form->{city}</td>
1725
          <td><input name="shiptocity" size="35" value="$form->{shiptocity}"></td>
1726
        </tr>
1727
        <tr>
1728
          <th align="right" nowrap>| . $locale->text('Country') . qq|</th>
1729
          <td>$form->{country}</td>
1730
          <td><input name="shiptocountry" size="35" value="$form->{shiptocountry}"></td>
1731
        </tr>
1732
        <tr>
1733
          <th align="right" nowrap>| . $locale->text('Contact') . qq|</th>
1734
          <td>$form->{contact}</td>
1735
          <td><input name="shiptocontact" size="35" value="$form->{shiptocontact}"></td>
1736
        </tr>
1737
        <tr>
1738
          <th align="right" nowrap>| . $locale->text('Gender') . qq|</th>
1739
          <td></td>
1740
          <td><select id="shiptocp_gender" name="shiptocp_gender">
1741
              <option value="m"| .  $selected_m . qq|>| . $locale->text('male') . qq|</option>
1742
              <option value="f"| .  $selected_f . qq|>| . $locale->text('female') . qq|</option>
1743
              </select>
1744
          </td>
1745
        </tr>
1746
        <tr>
1747
          <th align="right" nowrap>| . $locale->text('Phone') . qq|</th>
1748
          <td>$form->{phone}</td>
1749
          <td><input name="shiptophone" size="20" value="$form->{shiptophone}"></td>
1750
        </tr>
1751
        <tr>
1752
          <th align="right" nowrap>| . $locale->text('Fax') . qq|</th>
1753
          <td>$form->{fax}</td>
1754
          <td><input name="shiptofax" size="20" value="$form->{shiptofax}"></td>
1755
        </tr>
1756
        <tr>
1757
          <th align="right" nowrap>| . $locale->text('E-mail') . qq|</th>
1758
          <td>$form->{email}</td>
1759
          <td><input name="shiptoemail" size="35" value="$form->{shiptoemail}"></td>
1760
        </tr>
1761
      </table>
1762
    </td>
1763
  </tr>
1764
</table>
1765
| . $cgi->hidden("-name" => "nextsub", "-value" => $nextsub);
1766
;
1767

  
1768

  
1769

  
1770
  # delete shipto
1771
  map({ delete $form->{$_} } (@shipto_vars, qw(header shipto_id)));
1772
  $form->{title} = $title;
1773

  
1774
  foreach my $key (keys %$form) {
1775
    next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key}));
1776
    $form->{$key} =~ s/\"/&quot;/g;
1777
    print qq|<input type="hidden" name="$key" value="$form->{$key}">\n|;
1778
  }
1779

  
1780
  print qq|
1781

  
1782
<hr size="3" noshade>
1783

  
1784
<br>
1785
<input class="submit" type="submit" name="action" value="|
1786
    . $locale->text('Continue') . qq|">
1787
</form>
1788

  
1789
</body>
1790
</html>
1791
|;
1642
  print $::form->parse_html_template('io/ship_to', { previousform => $previous_form,
1643
                                                     nextsub      => $::form->{display_form} || 'display_form',
1644
                                                   });
1792 1645

  
1793 1646
  $main::lxdebug->leave_sub();
1794 1647
}
1795 1648

  
1649
sub ship_to_entered {
1650
  $::auth->restore_form_from_session(delete $::form->{previousform});
1651
  call_sub($::form->{nextsub});
1652
}
1653

  
1796 1654
sub relink_accounts {
1797 1655
  $main::lxdebug->enter_sub();
1798 1656

  

Auch abrufbar als: Unified diff