Revision eae5f8bd
Von Kivitendo Admin vor mehr als 7 Jahren hinzugefügt
SL/Controller/Part.pm | ||
---|---|---|
40 | 40 |
sub action_add_part { |
41 | 41 |
my ($self, %params) = @_; |
42 | 42 |
|
43 |
$::form->{callback} = $self->url_for(action => 'add_part') unless $::form->{callback}; |
|
43 | 44 |
$self->part( SL::DB::Part->new_part ); |
44 | 45 |
$self->add; |
45 | 46 |
}; |
... | ... | |
47 | 48 |
sub action_add_service { |
48 | 49 |
my ($self, %params) = @_; |
49 | 50 |
|
51 |
$::form->{callback} = $self->url_for(action => 'add_service') unless $::form->{callback}; |
|
50 | 52 |
$self->part( SL::DB::Part->new_service ); |
51 | 53 |
$self->add; |
52 | 54 |
}; |
... | ... | |
54 | 56 |
sub action_add_assembly { |
55 | 57 |
my ($self, %params) = @_; |
56 | 58 |
|
59 |
$::form->{callback} = $self->url_for(action => 'add_assembly') unless $::form->{callback}; |
|
57 | 60 |
$self->part( SL::DB::Part->new_assembly ); |
58 | 61 |
$self->add; |
59 | 62 |
}; |
... | ... | |
61 | 64 |
sub action_add_assortment { |
62 | 65 |
my ($self, %params) = @_; |
63 | 66 |
|
67 |
$::form->{callback} = $self->url_for(action => 'add_assortment') unless $::form->{callback}; |
|
64 | 68 |
$self->part( SL::DB::Part->new_assortment ); |
65 | 69 |
$self->add; |
66 | 70 |
}; |
... | ... | |
130 | 134 |
|
131 | 135 |
flash_later('info', $is_new ? t8('The item has been created.') : t8('The item has been saved.')); |
132 | 136 |
|
133 |
# reload item, this also resets last_modification! |
|
134 |
$self->redirect_to(controller => 'Part', action => 'edit', 'part.id' => $self->part->id); |
|
137 |
if ( $::form->{callback} ) { |
|
138 |
$self->redirect_to($::form->unescape($::form->{callback})); |
|
139 |
} else { |
|
140 |
# default behaviour after save: reload item, this also resets last_modification! |
|
141 |
$self->redirect_to(controller => 'Part', action => 'edit', 'part.id' => $self->part->id); |
|
142 |
} |
|
135 | 143 |
} |
136 | 144 |
|
137 | 145 |
sub action_save_as_new { |
... | ... | |
164 | 172 |
}) or return $self->js->error(t8('The item couldn\'t be deleted!') . " " . $self->part->db->error)->render; |
165 | 173 |
|
166 | 174 |
flash_later('info', t8('The item has been deleted.')); |
167 |
my @redirect_params = ( |
|
168 |
controller => 'controller.pl', |
|
169 |
action => 'LoginScreen/user_login' |
|
170 |
); |
|
171 |
$self->redirect_to(@redirect_params); |
|
175 |
if ( $::form->{callback} ) { |
|
176 |
$self->redirect_to($::form->unescape($::form->{callback})); |
|
177 |
} else { |
|
178 |
my @redirect_params = ( |
|
179 |
controller => 'controller.pl', |
|
180 |
action => 'LoginScreen/user_login' |
|
181 |
); |
|
182 |
$self->redirect_to(@redirect_params); |
|
183 |
} |
|
172 | 184 |
} |
173 | 185 |
|
174 | 186 |
sub action_use_as_new { |
Auch abrufbar als: Unified diff
Part Controller - callbacks für Artikel speichern und löschen
Nach dem Speichern und Löschen eines Artikels zur vorherigen Seite
springen, wenn $::form->{callback} gesetzt ist.
Das Default-Verhalten für das Speichern eines Artikels ist es auf der
Artikelseite zu bleiben.
Das Default-Verhalten für das Löschen eines Artikels ist es zur
Login-Seite zu springen.