Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 61a56bb4

Von Sven Schöling vor mehr als 7 Jahren hinzugefügt

  • ID 61a56bb4796ca9edb098541c55a00c990a9f227c
  • Vorgänger 1aa2686b
  • Nachfolger f24b365c

display_row: id, parts_id in $record_items gefixt

Unterschiede anzeigen:

bin/mozilla/io.pl
1831 1831

  
1832 1832
  $class = 'SL::DB::' . $class;
1833 1833

  
1834
  my %translated_methods = (
1835
    'SL::DB::OrderItem' => {
1836
      id                      => 'parts_id',
1837
      orderitems_id           => 'id',
1838
    },
1839
    'SL::DB::DeliveryOrderItem' => {
1840
      id                      => 'parts_id',
1841
      delivery_order_items_id => 'id',
1842
    },
1843
    'SL::DB::InvoiceItem' => {
1844
      id                      => 'parts_id',
1845
      invoice_id => 'id',
1846
    },
1847
  );
1848

  
1834 1849
  eval "require $class";
1835 1850

  
1836 1851
  my $obj = $::form->{"orderitems_id_$row"}
1837 1852
          ? $class->meta->convention_manager->auto_manager_class_name->find_by(id => $::form->{"orderitems_id_$row"})
1838 1853
          : $class->new;
1839 1854

  
1840
  for my $method (apply { s/_$row$// } grep { /_$row$/ } keys %$::form) {
1855
  for my $key (grep { /_$row$/ } keys %$::form) {
1856
    my $method = $key;
1857
    $method =~ s/_$row$//;
1858
    $method = $translated_methods{$class}{$method} // $method;
1859
    my $value = $::form->{$key};
1841 1860
    if ($obj->meta->column($method)) {
1842 1861
      if ($obj->meta->column($method)->isa('Rose::DB::Object::Metadata::Column::Date')) {
1843
        $obj->${\"$method\_as_date"}($::form->{"$method\_$row"});
1862
        $obj->${\"$method\_as_date"}($value);
1844 1863
      } elsif ((ref $obj->meta->column($method)) =~ /^Rose::DB::Object::Metadata::Column::(?:Numeric|Float|DoublePrecsion)$/) {
1845
        $obj->${\"$method\_as_number"}($::form->{"$method\_$row"});
1864
        $obj->${\"$method\_as_number"}($value);
1846 1865
      } elsif ((ref $obj->meta->column($method)) =~ /^Rose::DB::Object::Metadata::Column::Boolean$/) {
1847
        $obj->$method(!!$::form->{$method});
1866
        $obj->$method(!!$value);
1848 1867
      } else {
1849
        $obj->$method($::form->{"$method\_$row"});
1868
        $obj->$method($value);
1850 1869
      }
1851 1870
    } else {
1852
      $obj->{__additional_form_attributes}{$method} = $::form->{"$method\_$row"};
1871
      $obj->{__additional_form_attributes}{$method} = $value;
1853 1872
    }
1854 1873
  }
1855 1874

  

Auch abrufbar als: Unified diff