Revision c96c4bb2
Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt
SL/Controller/RequirementSpec.pm | ||
---|---|---|
176 | 176 |
$self->redirect_to(action => 'list'); |
177 | 177 |
} |
178 | 178 |
|
179 |
sub action_revert_to { |
|
180 |
my ($self, %params) = @_; |
|
181 |
|
|
182 |
return $self->js->error(t8('Cannot revert a versioned copy.'))->render($self) if $self->requirement_spec->working_copy_id; |
|
183 |
|
|
184 |
my $versioned_copy = SL::DB::RequirementSpec->new(id => $::form->{versioned_copy_id})->load; |
|
185 |
|
|
186 |
$self->requirement_spec->delete_items; |
|
187 |
$self->requirement_spec->copy_from( |
|
188 |
$versioned_copy, |
|
189 |
version_id => $versioned_copy->version_id, |
|
190 |
); |
|
191 |
|
|
192 |
flash_later('info', t8('The requirement spec has been reverted to version #1.', $self->requirement_spec->version->version_number)); |
|
193 |
$self->js->redirect_to($self->url_for(action => 'show', id => $self->requirement_spec->id))->render($self); |
|
194 |
} |
|
195 |
|
|
179 | 196 |
# |
180 | 197 |
# filters |
181 | 198 |
# |
SL/DB/RequirementSpec.pm | ||
---|---|---|
133 | 133 |
$id_to_clone{ $item->id }->update_attributes(dependencies => [ map { $id_to_clone{$_->id} } @{ $item->dependencies } ]); |
134 | 134 |
} |
135 | 135 |
|
136 |
$self->update_attributes(%attributes); |
|
137 |
|
|
136 | 138 |
return $self; |
137 | 139 |
} |
138 | 140 |
|
141 |
sub delete_items { |
|
142 |
my ($self) = @_; |
|
143 |
|
|
144 |
my $worker = sub { |
|
145 |
# First convert all items to sections so that deleting won't |
|
146 |
# violate foreign key constraints on parent_id. |
|
147 |
SL::DB::Manager::RequirementSpecItem->update_all( |
|
148 |
set => { parent_id => undef, item_type => 'section' }, |
|
149 |
where => [ |
|
150 |
requirement_spec_id => $self->id, |
|
151 |
'!parent_id' => undef, |
|
152 |
]); |
|
153 |
|
|
154 |
# Now delete all items in one go. |
|
155 |
SL::DB::Manager::RequirementSpecItem->delete_all(where => [ requirement_spec_id => $self->id ]); |
|
156 |
|
|
157 |
# Last clear values in ourself. |
|
158 |
$self->items([]); |
|
159 |
}; |
|
160 |
|
|
161 |
return $self->db->in_transaction ? $worker->() : $self->db->do_transaction($worker); |
|
162 |
} |
|
163 |
|
|
139 | 164 |
sub previous_version { |
140 | 165 |
my ($self) = @_; |
141 | 166 |
|
js/locale/de.js | ||
---|---|---|
7 | 7 |
"Are you sure?":"Sind Sie sicher?", |
8 | 8 |
"Copy":"Kopieren", |
9 | 9 |
"Copy requirement spec":"Pflichtenheft kopieren", |
10 |
"Create PDF":"PDF erzeugen", |
|
10 | 11 |
"Create new version":"Neue Version anlegen", |
11 | 12 |
"Database Connection Test":"Test der Datenbankverbindung", |
12 | 13 |
"Delete":"Löschen", |
13 | 14 |
"Delete requirement spec":"Pflichtenheft löschen", |
14 | 15 |
"Delete text block":"Textblock löschen", |
15 | 16 |
"Do you really want to cancel?":"Wollen Sie wirklich abbrechen?", |
17 |
"Do you really want to revert to this version?":"Wollen Sie wirklich auf diese Version zurücksetzen?", |
|
16 | 18 |
"Do you want to set the account number \"#1\" to \"#2\" and the name \"#3\" to \"#4\"?":"Soll die Kontonummer \"#1\" zu \"#2\" und den Name \"#3\" zu \"#4\" geändert werden?", |
19 |
"Edit":"Bearbeiten", |
|
17 | 20 |
"Edit text block":"Textblock bearbeiten", |
18 | 21 |
"Edit":"Bearbeiten", |
19 | 22 |
"Enter longdescription":"Langtext eingeben", |
... | ... | |
21 | 24 |
"Part picker":"Artikelauswahl", |
22 | 25 |
"Paste":"Einfügen", |
23 | 26 |
"Requirement spec actions:":"Pflichtenheftaktionen:", |
27 |
"Revert to version":"Auf Version zurücksetzen", |
|
24 | 28 |
"Save":"Speichern", |
25 | 29 |
"The description is missing.":"Die Beschreibung fehlt.", |
26 | 30 |
"The name is missing.":"Der Name fehlt.", |
js/requirement_spec.js | ||
---|---|---|
252 | 252 |
return handle_text_block_popup_menu_markings(opt, false); |
253 | 253 |
} |
254 | 254 |
|
255 |
|
|
256 | 255 |
function handle_item_popup_menu_markings(opt, add) { |
257 | 256 |
var id = find_item_id(opt.$trigger); |
258 | 257 |
if (id) |
... | ... | |
323 | 322 |
// -------------------------------- versions ------------------------------- |
324 | 323 |
// ------------------------------------------------------------------------- |
325 | 324 |
|
325 |
function find_versioned_copy_id(clicked_elt) { |
|
326 |
var id = $(clicked_elt).find("[name=versioned_copy_id]"); |
|
327 |
return id ? id.val() : undefined; |
|
328 |
} |
|
329 |
|
|
330 |
function disable_versioned_copy_item_commands(key, opt) { |
|
331 |
if (key === "revert_to_version") |
|
332 |
return !find_versioned_copy_id(opt.$trigger); |
|
333 |
return false; |
|
334 |
} |
|
335 |
|
|
326 | 336 |
function create_requirement_spec_version() { |
327 | 337 |
open_jqm_window({ url: 'controller.pl', |
328 | 338 |
data: { action: 'RequirementSpecVersion/new', |
... | ... | |
331 | 341 |
return true; |
332 | 342 |
} |
333 | 343 |
|
344 |
function create_pdf_for_versioned_copy_ajax_call(key, opt) { |
|
345 |
// TODO: create_pdf_for_versioned_copy_ajax_call |
|
346 |
|
|
347 |
return true; |
|
348 |
} |
|
349 |
|
|
350 |
function revert_to_versioned_copy_ajax_call(key, opt) { |
|
351 |
if (!confirm(kivi.t8('Do you really want to revert to this version?'))) |
|
352 |
return true; |
|
353 |
|
|
354 |
var data = { |
|
355 |
action: 'RequirementSpec/revert_to', |
|
356 |
versioned_copy_id: find_versioned_copy_id(opt.$trigger), |
|
357 |
id: $('#requirement_spec_id').val() |
|
358 |
}; |
|
359 |
|
|
360 |
$.post("controller.pl", data, eval_json_result); |
|
361 |
|
|
362 |
return true; |
|
363 |
} |
|
364 |
|
|
334 | 365 |
// ------------------------------------------------------------------------- |
335 | 366 |
// ----------------------------- context menus ----------------------------- |
336 | 367 |
// ------------------------------------------------------------------------- |
... | ... | |
414 | 445 |
|
415 | 446 |
$.contextMenu({ |
416 | 447 |
selector: '.time-cost-estimate-context-menu', |
417 |
events: events, |
|
418 | 448 |
items: $.extend({ edit: { name: kivi.t8('Edit'), icon: "edit", callback: standard_time_cost_estimate_ajax_call } }, general_actions) |
419 | 449 |
}); |
420 | 450 |
|
421 | 451 |
$.contextMenu({ |
422 | 452 |
selector: '.edit-time-cost-estimate-context-menu', |
423 |
events: events, |
|
424 | 453 |
items: $.extend({ |
425 | 454 |
save: { name: kivi.t8('Save'), icon: "save", callback: standard_time_cost_estimate_ajax_call } |
426 | 455 |
, cancel: { name: kivi.t8('Cancel'), icon: "close", callback: standard_time_cost_estimate_ajax_call } |
427 | 456 |
}, general_actions) |
428 | 457 |
}); |
458 |
|
|
459 |
$.contextMenu({ |
|
460 |
selector: '.versioned-copy-context-menu', |
|
461 |
items: $.extend({ |
|
462 |
// create_pdf: { name: kivi.t8('Create PDF'), icon: "pdf", callback: create_pdf_for_versioned_copy_ajax_call } |
|
463 |
revert_to_version: { name: kivi.t8('Revert to version'), icon: "revert", callback: revert_to_versioned_copy_ajax_call, disabled: disable_versioned_copy_item_commands } |
|
464 |
}, general_actions) |
|
465 |
}); |
|
429 | 466 |
} |
locale/de/all | ||
---|---|---|
420 | 420 |
'Cannot post transaction!' => 'Rechnung kann nicht gebucht werden!', |
421 | 421 |
'Cannot process payment for a closed period!' => 'Es kann keine Zahlung in einem abgeschlossenen Zeitraum verbucht werden!', |
422 | 422 |
'Cannot remove files!' => 'Dateien können nicht gelöscht werden!', |
423 |
'Cannot revert a versioned copy.' => 'Eine versionierte Kopie selber kann nicht zurückgesetzt werden.', |
|
423 | 424 |
'Cannot save account!' => 'Konto kann nicht gespeichert werden!', |
424 | 425 |
'Cannot save order!' => 'Auftrag kann nicht gespeichert werden!', |
425 | 426 |
'Cannot save preferences!' => 'Einstellungen können nicht gespeichert werden!', |
... | ... | |
534 | 535 |
'Create Chart of Accounts' => 'Zu verwendender Kontenplan', |
535 | 536 |
'Create Dataset' => 'Neue Datenbank anlegen', |
536 | 537 |
'Create Date' => 'Erstelldatum', |
538 |
'Create PDF' => 'PDF erzeugen', |
|
537 | 539 |
'Create a new acceptance status' => 'Einen neuen Abnahmestatus anlegen', |
538 | 540 |
'Create a new background job' => 'Einen neuen Hintergrund-Job anlegen', |
539 | 541 |
'Create a new business' => 'Einen neuen Kunden-/Lieferantentyp erfassen', |
... | ... | |
785 | 787 |
'Do you really want to delete the selected links?' => 'Wollen Sie wirklich die ausgewählten Verknüpfungen löschen?', |
786 | 788 |
'Do you really want to delete this object?' => 'Wollen Sie dieses Objekt wirklich löschen?', |
787 | 789 |
'Do you really want to delete this warehouse?' => 'Wollen Sie dieses Lager wirklich löschen?', |
790 |
'Do you really want to revert to this version?' => 'Wollen Sie wirklich auf diese Version zurücksetzen?', |
|
788 | 791 |
'Do you want to <b>limit</b> your search?' => 'Wollen Sie Ihre Suche <b>spezialisieren</b>?', |
789 | 792 |
'Do you want to carry this shipping address over to the new purchase order so that the vendor can deliver the goods directly to your customer?' => 'Wollen Sie diese Lieferadresse in den neuen Lieferantenauftrag übernehmen, damit der Händler die Waren direkt an Ihren Kunden liefern kann?', |
790 | 793 |
'Do you want to overwrite your current title?' => 'Wollen Sie den aktuellen Titel überschreiben?', |
... | ... | |
1876 | 1879 |
'Revenue Account' => 'Erlöskonto', |
1877 | 1880 |
'Revenues EU with UStId' => 'Erlöse EU m. UStId', |
1878 | 1881 |
'Revenues EU without UStId' => 'Erlöse EU o. UStId', |
1882 |
'Revert to version' => 'Auf Version zurücksetzen', |
|
1879 | 1883 |
'Review of Aging list' => 'Altersstrukturliste', |
1880 | 1884 |
'Right' => 'Rechts', |
1881 | 1885 |
'Risk' => 'Risiko', |
... | ... | |
2363 | 2367 |
'The required information consists of the IBAN, the BIC, the mandator ID and the mandate\'s date of signature.' => 'Die benötigten Informationen bestehen aus IBAN, BIC, Mandanten-ID und dem Unterschriftsdatum des Mandates.', |
2364 | 2368 |
'The requirement spec has been created.' => 'Das Pflichtenheft wurde angelegt.', |
2365 | 2369 |
'The requirement spec has been deleted.' => 'Das Pflichtenheft wurde gelöscht.', |
2370 |
'The requirement spec has been reverted to version #1.' => 'Das Pflichtenheft wurde auf Version #1 zurückgesetzt.', |
|
2366 | 2371 |
'The requirement spec has been saved.' => 'Das Pflichtenheft wurde gespeichert.', |
2367 | 2372 |
'The requirement spec is in use and cannot be deleted.' => 'Das Pflichtenheft wird verwendet und kann nicht gelöscht werden.', |
2368 | 2373 |
'The requirement spec status has been created.' => 'Der Pflichtenheftstatus wurde angelegt.', |
templates/webpages/requirement_spec_version/list.html | ||
---|---|---|
1 | 1 |
[% USE HTML %][% USE L %][% USE LxERP %][%- USE P -%] |
2 | 2 |
|
3 |
<table> |
|
3 |
<table id="versioned_copies_list">
|
|
4 | 4 |
<thead> |
5 | 5 |
<tr class="listheading"> |
6 |
<th>[%- LxERP.t8("Version number") %]</th> |
|
6 |
<th><div class="thingy" style="width: 10px; height: 100%; background-color: red; position: relative; left: -10px;"></div>[%- LxERP.t8("Version number") %]</th>
|
|
7 | 7 |
<th>[%- LxERP.t8("Description") %]</th> |
8 | 8 |
<th>[%- LxERP.t8("Internal comment") %]</th> |
9 | 9 |
<th>[%- LxERP.t8("Last modification") %]</th> |
... | ... | |
11 | 11 |
</thead> |
12 | 12 |
|
13 | 13 |
<tbody> |
14 |
<tr class="listrow"> |
|
15 |
<td> |
|
16 |
[%- IF SELF.requirement_spec.version_id %] |
|
17 |
[%- LxERP.t8("Working copy identical to version number #1", SELF.requirement_spec.version.version_number) %] |
|
18 |
[%- ELSE %] |
|
19 |
[%- LxERP.t8("Working copy without version") %] |
|
20 |
[%- END -%] |
|
21 |
</td> |
|
14 |
<tr class="listrow versioned-copy-context-menu"> |
|
15 |
[%- IF SELF.requirement_spec.version_id %] |
|
16 |
[% L.hidden_tag('versioned_copy_id', SELF.requirement_spec.version_id, no_id=1) %] |
|
17 |
<td>[%- LxERP.t8("Working copy identical to version number #1", SELF.requirement_spec.version.version_number) %]</td> |
|
18 |
[%- ELSE %] |
|
19 |
<td>[%- LxERP.t8("Working copy without version") %]</td> |
|
20 |
[%- END -%] |
|
22 | 21 |
<td>[%- LxERP.t8("Working copy; no description yet") %]</td> |
23 | 22 |
<td> </td> |
24 | 23 |
<td>[% SELF.requirement_spec.mtime.to_kivitendo(precision='minute') %]</td> |
25 | 24 |
</tr> |
26 | 25 |
|
27 | 26 |
[%- FOREACH versioned = SELF.versioned_copies %] |
28 |
<tr class="listrow versioned_copy_context_menu"> |
|
27 |
<tr class="listrow versioned-copy-context-menu"> |
|
28 |
[% L.hidden_tag('versioned_copy_id', versioned.id, no_id=1) %] |
|
29 | 29 |
<td>[% HTML.escape(versioned.version.version_number) %]</td> |
30 | 30 |
<td>[% HTML.escape(P.truncate(versioned.description)) %]</td> |
31 | 31 |
<td>[% HTML.escape(P.truncate(versioned.comment)) %]</td> |
Auch abrufbar als: Unified diff
Pflichtenhefte auf Versionen zurücksetzen können