Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a2a95b63

Von Bernd Bleßmann vor etwa 1 Jahr hinzugefügt

  • ID a2a95b63e1f266483fea773480aacae8925f32c9
  • Vorgänger 3b1b762c
  • Nachfolger b8dfb10a

S:D:Part: Kosmetik: kein Semikolon nach Kontrollstrukturen, …

… und emacs noch glücklicher machen ;)

Unterschiede anzeigen:

SL/DB/Part.pm
# changed when saving
return join(' ', sort map { $_->part->id } @{$self->items});
};
}
sub validate {
my ($self) = @_;
......
unless ( $self->id ) {
push @errors, $::locale->text('The partnumber already exists.') if SL::DB::Manager::Part->get_all_count(where => [ partnumber => $self->partnumber ]);
};
}
if ($self->is_assortment && $self->orphaned && scalar @{$self->assortment_items} == 0) {
# when assortment isn't orphaned form doesn't contain any items
......
sub last_modification {
my ($self) = @_;
return $self->mtime // $self->itime;
};
}
sub used_in_record {
my ($self) = @_;
......
}
return 0;
}
sub orphaned {
my ($self) = @_;
die 'not an accessor' if @_ > 1;
......
my ($stock) = selectrow_query($::form, $self->db->dbh, $query, @values);
return $stock || 0; # never return undef
};
}
# this is designed to ignore chargenumbers, expiration dates and just give a list of how much <-> where
......
SQL
my $objs = SL::DB::Manager::Inventory->get_all(
query => [ id => [ \"$query" ] ], # make emacs happy "
query => [ id => [ \"$query" ] ], # make emacs happy "]]
with_objects => [ 'parts', 'trans_type', 'bin', 'bin.warehouse' ], # prevent lazy loading in template
sort_by => 'itime DESC',
);
......
# use clone rather than reset_and_clone because the unique constraint would also remove parts_id
$clone->assortment_items( map { $_->clone } @{$self->assortment_items} );
$_->assortment_id(undef) foreach @{ $clone->assortment_items }
};
}
if ( $self->is_assembly ) {
$clone->assemblies( map { $_->clone_and_reset } @{$self->assemblies});
};
}
if ( $self->prices ) {
$clone->prices( map { $_->clone } @{$self->prices}); # pricegroup_id gets reset here because it is part of a unique contraint
......
foreach my $price ( @{$clone->prices} ) {
$price->id(undef);
$price->parts_id(undef);
};
};
};
}
}
}
return $clone;
}
......
@removals = grep { !exists( $comparison{$_} ) } @self_part_ids if @self_part_ids;
return \@additions, \@removals;
};
}
sub items_sellprice_sum {
my ($self, %params) = @_;
......
return unless $self->is_assortment or $self->is_assembly;
return unless $self->items;
sum map { $_->linetotal_lastcost } @{$self->items};
};
}
sub items_weight_sum {
my ($self) = @_;
......
return unless $self->is_assembly;
return unless $self->items;
sum map { $_->linetotal_weight} @{$self->items};
};
}
sub set_lastcost_assemblies_and_assortiments {
my ($self) = @_;

Auch abrufbar als: Unified diff