From e822adb3f7c61a1148cd6f73be2bb302ab704e0f Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 3 Nov 2014 16:36:18 +0100 Subject: [PATCH] =?utf8?q?Pflichtenhefte:=20Funktion=20Abschnitte/Funktion?= =?utf8?q?sbl=C3=B6cke=20neu=20nummerieren?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/RequirementSpec.pm | 27 +++++++++++++++++++ css/requirement_spec.css | 1 + image/format-list-ordered.png | Bin 0 -> 527 bytes js/locale/de.js | 5 ++++ js/requirement_spec.js | 45 +++++++++++++++++++++++++++++++ locale/de/all | 3 +++ 6 files changed, 81 insertions(+) create mode 100644 image/format-list-ordered.png diff --git a/SL/Controller/RequirementSpec.pm b/SL/Controller/RequirementSpec.pm index f762b9794..d88ec8f29 100644 --- a/SL/Controller/RequirementSpec.pm +++ b/SL/Controller/RequirementSpec.pm @@ -265,6 +265,33 @@ sub action_paste_template { $self->invalidate_version->render($self); } +sub action_renumber_sections { + my ($self) = @_; + + my %numbers = map { ($_ => 1) } qw(section function_block); + my %formats = map { my $method = "${_}_number_format"; ($_ => $self->requirement_spec->type->$method) } qw(section function_block); + my @items = @{ $self->requirement_spec->sections_sorted }; + + $self->requirement_spec->db->with_transaction(sub { + while (@items) { + my $item = shift @items; + my $type = $item->parent_id ? 'function_block' : 'section'; + + $item->update_attributes(fb_number => SL::PrefixedNumber->new(number => $formats{$type} || 0)->set_to($numbers{$type})); + + $numbers{$type}++; + + unshift @items, @{ $item->children_sorted }; + } + + $self->requirement_spec->invalidate_version unless $self->requirement_spec->is_template; + + 1; + }); + + $self->redirect_to(action => 'show', id => $self->requirement_spec->id); +} + # # filters # diff --git a/css/requirement_spec.css b/css/requirement_spec.css index f4c4cd4ec..123713398 100644 --- a/css/requirement_spec.css +++ b/css/requirement_spec.css @@ -50,6 +50,7 @@ table.rs_input_field input, table.rs_input_field select { .context-menu-item.icon-pdf { background-image: url("../image/application-pdf.png"); } .context-menu-item.icon-add-picture { background-image: url("../image/add-picture.png"); } .context-menu-item.icon-download { background-image: url("../image/download.png"); } +.context-menu-item.icon-renumber { background-image: url("../image/format-list-ordered.png"); } /* ------------------------------------------------------------ */ /* Sections & function blocks */ diff --git a/image/format-list-ordered.png b/image/format-list-ordered.png new file mode 100644 index 0000000000000000000000000000000000000000..3ee1ea73f2f000ed67eb6a96ef9d1274fd618ce2 GIT binary patch literal 527 zcmV+q0`UEbP)o+0?^kjF%c8ilFT}}%5c3Hk zq`ngJP))tT#YOy@1(|3XqOp!M9E3KtEuQ8E@K#rWd;(W_j)z}@IUuCaA1N~^9Ngk< zs)I2vNbQmkLy8bXy75WAxt@vfZir>z%OWcWWFGDPEp*VH}qwL*V87)~Kd>b2iL z&{qFvAE{gAfQTx@@-K9*O+$?imJL#ysZ=Tqgq0YW-z;t%k_0@!GZ4T*`~u7_?`thx R8^izr002ovPDHLkV1kcg+

' + text1 + '

' + text2 + '

').hide().appendTo('body'); + var buttons = {}; + + buttons[kivi.t8('Yes')] = function() { + $(this).dialog('close'); + ns.renumber_callback(true); + }; + + buttons[kivi.t8('No')] = function() { + $(this).dialog('close'); + ns.renumber_callback(false); + }; + + $dialog.dialog({ + resizable: false + , modal: true + , title: kivi.t8('Are you sure?') + , height: 250 + , width: 400 + , buttons: buttons + }); +}; + // ------------------------------------------------------------------------- // ------------------------------- templates ------------------------------- // ------------------------------------------------------------------------- @@ -829,6 +870,8 @@ ns.create_context_menus = function(is_template) { // , sep99: "---------" , copy_reqspec: { name: kivi.t8('Copy template'), icon: "copy", callback: kivi.requirement_spec.copy_reqspec } , delete_reqspec: { name: kivi.t8('Delete template'), icon: "delete", callback: kivi.requirement_spec.delete_reqspec } + , sep_paste_template: "---------" + , renumber: { name: kivi.t8('Renumber sections and function blocks'), icon: "renumber", callback: kivi.requirement_spec.renumber } }; $.contextMenu({ @@ -848,6 +891,8 @@ ns.create_context_menus = function(is_template) { , copy_reqspec: { name: kivi.t8('Copy requirement spec'), icon: "copy", callback: kivi.requirement_spec.copy_reqspec } , delete_reqspec: { name: kivi.t8('Delete requirement spec'), icon: "delete", callback: kivi.requirement_spec.delete_reqspec } , sep_paste_template: "---------" + , renumber: { name: kivi.t8('Renumber sections and function blocks'), icon: "renumber", callback: kivi.requirement_spec.renumber } + , sep_paste_template: "---------" , paste_template: { name: kivi.t8('Paste template'), icon: "paste", callback: kivi.requirement_spec.paste_template } }; diff --git a/locale/de/all b/locale/de/all index 195c189c7..76b703b30 100755 --- a/locale/de/all +++ b/locale/de/all @@ -834,6 +834,7 @@ $self->{texts} = { 'Do not link to a project.' => 'Nicht mit einem Projekt verknüpfen.', 'Do not modify this position' => 'Diese Position nicht verändern', 'Do not set default buchungsgruppe' => 'Nie Standardbuchungsgruppe setzen', + 'Do you really want do continue?' => 'Wollen Sie wirklich fortfahren?', 'Do you really want to cancel?' => 'Wollen Sie wirklich abbrechen?', 'Do you really want to close the following SEPA exports? No payment will be recorded for bank collections that haven\'t been marked as executed yet.' => 'Wollen Sie wirklich die folgenden SEPA-Exporte abschließen? Für Überweisungen, die noch nicht gebucht wurden, werden dann keine Zahlungen verbucht.', 'Do you really want to close the following SEPA exports? No payment will be recorded for bank transfers that haven\'t been marked as executed yet.' => 'Wollen Sie wirklich die folgenden SEPA-Exporte abschließen? Für Überweisungen, die noch nicht gebucht wurden, werden dann keine Zahlungen verbucht.', @@ -1927,6 +1928,7 @@ $self->{texts} = { 'RFQs' => 'Preisanfragen', 'ROP' => 'Mindestlagerbestand', 'Ranges of numbers' => 'Nummernkreise', + 'Re-numbering all sections and function blocks in the order they are currently shown cannot be undone.' => 'Das Neu-Nummerieren aller Abschnitte und Funktionsblöcke kann nicht rückgängig gemacht werden.', 'Re-run analysis' => 'Analyse wiederholen', 'Receipt' => 'Zahlungseingang', 'Receipt posted!' => 'Beleg gebucht!', @@ -1962,6 +1964,7 @@ $self->{texts} = { 'Removed spoolfiles!' => 'Druckdateien entfernt!', 'Removed text blocks: #1' => 'Entfernte Textblöcke: #1', 'Removing marked entries from queue ...' => 'Markierte Einträge werden von der Warteschlange entfernt ...', + 'Renumber sections and function blocks' => 'Abschnitte/Funktionsblöcke neu nummerieren', 'Replace the orphaned currencies by other not orphaned currencies. To do so, please delete the currency in the textfields above and replace it by another currency. You could loose or change unintentionally exchangerates. Go on very carefully since you could destroy transactions.' => 'Ersetze die Währungen durch andere gültige Währungen. Wenn Sie sich hierfür entscheiden, ersetzen Sie bitte alle Währungen, die oben angegeben sind, durch Währungen, die in Ihrem System ordnungsgemäß eingetragen sind. Alle eingetragenen Wechselkurse für die verwaiste Währung werden dabei gelöscht. Bitte gehen Sie sehr vorsichtig vor, denn die betroffenen Buchungen können unter Umständen kaputt gehen.', 'Report Positions' => 'Berichte', 'Report about warehouse contents' => 'Lagerbestand anzeigen', -- 2.20.1