is: actionbar implementiert.
authorSven Schöling <s.schoeling@linet-services.de>
Fri, 21 Oct 2016 11:51:34 +0000 (13:51 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Tue, 28 Feb 2017 09:04:33 +0000 (10:04 +0100)
Änderungen:
- post_and_[print/mail] sind wie geplant raus.
- zurück ist raus
- confirm bei mark as paid eingefügt
- show_delete als Bedingung für post sieht falsch aus

bin/mozilla/is.pl
templates/webpages/is/form_footer.html
templates/webpages/is/form_header.html

index 00b99a7..b5ce917 100644 (file)
@@ -359,6 +359,98 @@ sub form_header {
   $TMPL_VAR{payment_terms_obj} = get_payment_terms_for_invoice();
   $form->{duedate}             = $TMPL_VAR{payment_terms_obj}->calc_date(reference_date => $form->{invdate}, due_date => $form->{duedate})->to_kivitendo if $TMPL_VAR{payment_terms_obj};
 
+  my @req_trans_desc = qw(kivi.SalesPurchase.check_transaction_description) x!!$::instance_conf->get_require_transaction_description_ps;
+  my $show_delete = ($::instance_conf->get_is_changeable == 2 && $form->current_date(\%myconfig) eq $form->{gldate})
+                  || $::instance_conf->get_is_changeable == 1;
+
+  for my $bar ($::request->layout->get('actionbar')) {
+    $bar->add_actions([ t8('Update'),
+      submit => [ '#form', { action_update         => 1 } ],
+      disabled => !$::form->{id} && $::form->{locked},
+    ]);
+    $bar->add_actions("combobox");
+    $bar->actions->[-1]->add_actions([ t8('Post'),
+      submit => [ '#form', { action_post           => 1 } ],
+      checks => [ @req_trans_desc ],
+      disabled => (!$::form->{id} && $::form->{locked}) || !$show_delete || $::form->{storno},
+    ]);
+    $bar->actions->[-1]->add_actions([ t8('Post Payment'),
+      submit => [ '#form', { action_post_payment    => 1 } ],
+      checks => [ @req_trans_desc ],
+      disabled => !$::form->{id},
+    ]);
+    $bar->actions->[-1]->add_actions([ t8('mark as paid'),
+      submit => [ '#form', { action_mark_as_paid    => 1 } ],
+      confirm => t8('This will remove the invoice from showing as unpaid even if the unpaid amount does not match the amount. Proceed?'),
+      disabled => !$::form->{id},
+    ]) if $::instance_conf->get_is_show_mark_as_paid;
+
+    $bar->add_actions("combobox");
+    $bar->actions->[-1]->add_actions([ t8('Storno'),
+      submit => [ '#form', { action_storno         => 1 } ],
+      confirm => t8('Do you really want to cancel this invoice?'),
+      checks => [ @req_trans_desc ],
+      disabled => !$::form->{id},
+    ]);
+    $bar->actions->[-1]->add_actions([ t8('Delete'),
+      submit => [ '#form', { action_delete         => 1 } ],
+      confirm => t8('Do you really want to delete this object?'),
+      checks => [ @req_trans_desc ],
+      disabled => !$::form->{id},
+    ]);
+    $bar->add_actions('separator');
+
+    $bar->add_actions('combobox');
+    $bar->actions->[-1]->add_actions([ t8('Workflow'),
+      disabled => 1,
+    ]);
+    $bar->actions->[-1]->add_actions([ t8('Use As New'),
+      submit => [ '#form', { action_use_as_new    => 1 } ],
+      disabled => !$::form->{id},
+    ]);
+    $bar->actions->[-1]->add_actions([ t8('Credit Note'),
+      submit => [ '#form', { action_credit_note    => 1 } ],
+      checks => [ @req_trans_desc ],
+      disabled => !$::form->{id} || $form->{type} eq "credit_note",
+    ]);
+    $bar->actions->[-1]->add_actions([ t8('Sales Order'),
+      submit => [ '#form', { action_sales_order   => 1 } ],
+      disabled => !$::form->{id},
+    ]);
+
+    $bar->add_actions('combobox');
+    $bar->actions->[-1]->add_actions([ t8('Export'),
+      disabled => 1,
+    ]);
+    $bar->actions->[-1]->add_actions([ ($::form->{id} ? t8('Print') : t8('Preview')),
+      submit => [ '#form', { action_print          => 1 } ],
+      checks => [ @req_trans_desc ],
+      disabled => !$::form->{id} && $::form->{locked},
+    ]);
+    $bar->actions->[-1]->add_actions([ t8('E Mail'),
+      submit => [ '#form', { action_print          => 1 } ],
+      checks => [ @req_trans_desc ],
+      disabled => !$::form->{id},
+    ]);
+    $bar->add_actions('combobox');
+    $bar->actions->[-1]->add_actions([ t8('more'),
+      disabled => 1,
+    ]);
+    $bar->actions->[-1]->add_actions([ t8('History'),
+      call     => [ 'set_history_window', $::form->{id} * 1, 'id' ],
+      disabled => !$::form->{id},
+    ]);
+    $bar->actions->[-1]->add_actions([ t8('Follow-Up'),
+      call     => [ 'follow_up_window' ],
+      disabled => !$::form->{id},
+    ]);
+    $bar->actions->[-1]->add_actions([ t8('Drafts'),
+      call     => [ 'kivi.Draft.popup', 'is', 'invoice', $::form->{draft_id}, $::form->{draft_description} ],
+      disabled => $::form->{id} || $::form->{locked},
+    ]);
+
+  }
+
   $form->header();
 
   print $form->parse_html_template("is/form_header", \%TMPL_VAR);
index 1cb4a18..80376da 100644 (file)
 
 <p>[% print_options %]</p>
 
-<div id='form_action_bar'>
-  <input type="hidden" id="action" name="action" value="dispatcher">
-
-  [% IF id %]
-    <input class="submit" type="submit" accesskey="u" name="action_update" id="update_button" value="[% 'Update' | $T8 %]">
-    <input class="submit" type="submit" name="action_ship_to" value="[% 'Ship to' | $T8 %]">
-    <input class="submit" type="submit" name="action_print" id="action_print" value="[% 'Print' | $T8 %]" data-require-transaction-description="[% INSTANCE_CONF.get_require_transaction_description_ps %]">
-    <input class="submit" type="submit" name="action_e_mail" value="[% 'E-mail' | $T8 %]" data-require-transaction-description="[% INSTANCE_CONF.get_require_transaction_description_ps %]">
-[% IF  show_storno %]
-    [% L.submit_tag("action_storno", LxERP.t8("Storno"), "data-require-transaction-description"=INSTANCE_CONF.get_require_transaction_description_ps, confirm=LxERP.t8('Do you really want to cancel this invoice?')) %]
-[% END %]
-    <input class="submit" type="submit" name="action_post_payment" value="[% 'Post Payment' | $T8 %]">
-    <input class="submit" type="submit" name="action_use_as_new" value="[% 'Use As New' | $T8 %]">
-
-[% IF id && !is_type_credit_note %]
-    <input class="submit" type="submit" name="action_credit_note" value="[% 'Credit Note' | $T8 %]" data-require-transaction-description="[% INSTANCE_CONF.get_require_transaction_description_ps %]">
-[% END %]
-[% IF show_delete && (!storno || storno_id) %]
-    [% L.submit_tag("action_delete", LxERP.t8("Delete"), confirm=LxERP.t8('Do you really want to delete this invoice?')) %]
-[% END %]
-[% IF show_delete && !storno %]
-    <input class="submit" type="submit" name="action_post" value="[% 'Post' | $T8 %]" data-require-transaction-description="[% INSTANCE_CONF.get_require_transaction_description_ps %]">
-[% END %]
-    <input class="submit" type="submit" name="action_order" value="[% 'Order' | $T8 %]">
-    <input type="button" class="submit" onclick="follow_up_window()" value="[% 'Follow-Up' | $T8 %]">
-
- [% ELSE # no id %]
-   [% UNLESS locked %]
-      <input class="submit" type="submit" name="action_update" id="update_button" value="[% 'Update' | $T8 %]">
-      <input class="submit" type="submit" name="action_ship_to" value="[% 'Ship to' | $T8 %]">
-      <input class="submit" type="submit" name="action_preview" value="[% 'Preview' | $T8 %]" data-require-transaction-description="[% INSTANCE_CONF.get_require_transaction_description_ps %]">
-      <input class="submit" type="submit" name="action_post_and_e_mail" value="[% 'Post and E-mail' | $T8 %]" data-require-transaction-description="[% INSTANCE_CONF.get_require_transaction_description_ps %]">
-      <input class="submit" type="submit" name="action_print_and_post" value="[% 'Print and Post' | $T8 %]" data-require-transaction-description="[% INSTANCE_CONF.get_require_transaction_description_ps %]">
-      <input class="submit" type="submit" name="action_post" value="[% 'Post' | $T8 %]" data-require-transaction-description="[% INSTANCE_CONF.get_require_transaction_description_ps %]">
-      [% L.button_tag('kivi.Draft.popup("is", "invoice", "' _ draft_id _ '", "' _ draft_description _ '")', LxERP.t8('Drafts')) %]
-   [%- END %]
- [% END # id %]
-
-  [% IF id %]
-      [%#- button for saving history %]
-      <input type="button" class="submit" onclick="set_history_window([% id | html %], 'glid');" name="history" id="history" value="[% 'history' | $T8 %]">
-      [% IF INSTANCE_CONF.get_is_show_mark_as_paid %]
-        [% L.submit_tag("action_mark_as_paid", LxERP.t8('mark as paid'), confirm=LxERP.t8('This will remove the invoice from showing as unpaid even if the unpaid amount does not match the amount. Proceed?')) %]
-      [% END %]
-  [% END %]
-
-  [% IF callback %]
-    <a href="[% callback %]">[% 'back' | $T8  %]</a>
-  [% END %]
-</div>
-
 <input type="hidden" name="rowcount" value="[% rowcount %]">
 <input type="hidden" name="callback" value="[% callback | html %]">
 [% P.hidden_tag('draft_id', draft_id) %]
index 1f89639..18d6fb5 100644 (file)
@@ -8,7 +8,7 @@
 <script type="text/javascript" src="js/calculate_qty.js"></script>
 <script type="text/javascript" src="js/follow_up.js"></script>
 
-<form method="post" name="invoice" action="[% script %]">
+<form method="post" id='form' name="invoice" action="[% script %]">
 
 [%- FOREACH key = HIDDENS %]
 <input type="hidden" name="[% HTML.escape(key) %]" value="[% HTML.escape($key)  %]">
@@ -74,6 +74,7 @@
           <td>
             [% shiptos = [ [ "", LxERP.t8("No/individual shipping address") ] ] ;
                L.select_tag('shipto_id', shiptos.import(ALL_SHIPTO), default=shipto_id, value_key='shipto_id', title_key='displayable_id', style='width: 250px') %]
+            <input class="submit" type="submit" name="action_ship_to" value="[% 'Ship to' | $T8 %]">
           </td>
         </tr>
 [%- END %]