use SL::GenericTranslations;
use SL::Helper::UserPreferences::PositionsScrollbar;
use SL::Helper::UserPreferences::PartPickerSearch;
+use SL::Helper::UserPreferences::UpdatePositions;
use strict;
SL::Helper::UserPreferences::PartPickerSearch->new()->get_sales_search_customer_partnumber();
}
+sub positions_show_update_button {
+ SL::Helper::UserPreferences::UpdatePositions->new()->get_show_update_button();
+}
+
sub save_preferences {
$main::lxdebug->enter_sub();
if (exists $form->{sales_search_customer_partnumber}) {
SL::Helper::UserPreferences::PartPickerSearch->new()->store_sales_search_customer_partnumber($form->{sales_search_customer_partnumber})
}
+ if (exists $form->{positions_show_update_button}) {
+ SL::Helper::UserPreferences::UpdatePositions->new()->store_show_update_button($form->{positions_show_update_button})
+ }
$main::lxdebug->leave_sub();
use SL::Helper::PrintOptions;
use SL::Helper::ShippedQty;
use SL::Helper::UserPreferences::PositionsScrollbar;
+use SL::Helper::UserPreferences::UpdatePositions;
use SL::Controller::Helper::GetModels;
use Rose::Object::MakeMethods::Generic
(
scalar => [ qw(item_ids_to_delete) ],
- 'scalar --get_set_init' => [ qw(order valid_types type cv p multi_items_models all_price_factors search_cvpartnumber) ],
+ 'scalar --get_set_init' => [ qw(order valid_types type cv p multi_items_models all_price_factors search_cvpartnumber show_update_button) ],
);
TYPE => $self->type,
ALL_PRICE_FACTORS => $self->all_price_factors,
SEARCH_CVPARTNUMBER => $self->search_cvpartnumber,
+ SHOW_UPDATE_BUTTON => $self->show_update_button,
);
$self->js
TYPE => $self->type,
ALL_PRICE_FACTORS => $self->all_price_factors,
SEARCH_CVPARTNUMBER => $self->search_cvpartnumber,
+ SHOW_UPDATE_BUTTON => $self->show_update_button,
);
$self->js
->append('#row_table_id', $row_as_html);
TYPE => $self->type,
ALL_PRICE_FACTORS => $self->all_price_factors,
SEARCH_CVPARTNUMBER => $self->search_cvpartnumber,
+ SHOW_UPDATE_BUTTON => $self->show_update_button,
);
$self->js->append('#row_table_id', $row_as_html);
return $search_cvpartnumber;
}
+sub init_show_update_button {
+ my ($self) = @_;
+
+ !!SL::Helper::UserPreferences::UpdatePositions->new()->get_show_update_button();
+}
+
sub init_p {
SL::Presenter->get;
}
--- /dev/null
+package SL::Helper::UserPreferences::UpdatePositions;
+
+use strict;
+use parent qw(Rose::Object);
+
+use Carp;
+use List::MoreUtils qw(none);
+
+use SL::Helper::UserPreferences;
+
+use Rose::Object::MakeMethods::Generic (
+ 'scalar --get_set_init' => [ qw(user_prefs) ],
+);
+
+sub get_show_update_button {
+ !!$_[0]->user_prefs->get('show_update_button');
+}
+
+sub store_show_update_button {
+ $_[0]->user_prefs->store('show_update_button', $_[1]);
+}
+
+sub init_user_prefs {
+ SL::Helper::UserPreferences->new(
+ namespace => $_[0]->namespace,
+ )
+}
+
+# read only stuff
+sub namespace { 'UpdatePositions' }
+sub version { 1 }
+
+1;
+
+__END__
+
+=pod
+
+=encoding utf-8
+
+=head1 NAME
+
+SL::Helper::UserPreferences::UpdatePositions - preferences intended
+to store user settings for displaying an update button for the postions
+of document forms to update the positions (parts) from master data.
+
+=head1 SYNOPSIS
+
+ use SL::Helper::UserPreferences::UpdatePositions;
+ my $prefs = SL::Helper::UserPreferences::UpdatePositions->new();
+
+ $prefs->store_show_update_button(1);
+ my $value = $prefs->get_show_update_button;
+
+=head1 DESCRIPTION
+
+This module manages storing the user's choise for displaying an update button
+in the positions area in forms (new order controller).
+
+=head1 BUGS
+
+None yet :)
+
+=head1 AUTHOR
+
+Bernd Bleßmann E<lt>bernd@kivitendo-premium.deE<gt>
+
+=cut
$form->{positions_scrollbar_height} = AM->positions_scrollbar_height();
$form->{purchase_search_makemodel} = AM->purchase_search_makemodel();
$form->{sales_search_customer_partnumber} = AM->sales_search_customer_partnumber();
+ $form->{positions_show_update_button} = AM->positions_show_update_button();
$myconfig{show_form_details} = 1 unless (defined($myconfig{show_form_details}));
$form->{CAN_CHANGE_PASSWORD} = $main::auth->can_change_password();
'Show the picture in the part form' => 'Bild in Warenmaske anzeigen',
'Show the pictures in the result for search parts' => 'Bilder in Suchergebnis für Stammdaten -> Berichte -> Waren anzeigen',
'Show the weights of articles and the total weight in orders, invoices and delivery notes?' => 'Sollen Warengewichte und Gesamtgewicht in Aufträgen, Rechnungen und Lieferscheinen angezeigt werden?',
+ 'Show update button for positions in order forms' => 'Aktualisieren-Knopf bei Positionen in Belegen anzeigen (neuer Auftrags-Controller)',
'Show weights' => 'Gewichte anzeigen',
'Show your TODO list after logging in' => 'Aufgabenliste nach dem Anmelden anzeigen',
'Show »not delivered qty/value« column in sales and purchase orders' => 'Spalte »Nicht gelieferte Menge/Wert« in Aufträgen anzeigen',
'Show the picture in the part form' => '',
'Show the pictures in the result for search parts' => '',
'Show the weights of articles and the total weight in orders, invoices and delivery notes?' => '',
+ 'Show update button for positions in order forms' => '',
'Show weights' => '',
'Show your TODO list after logging in' => '',
'Show »not delivered qty/value« column in sales and purchase orders' => '',
[%- 'This also enables displaying a column with the customer partnumber (new order controller).' | $T8 %]
</td>
</tr>
+ <tr>
+ <th align="right">[% 'Show update button for positions in order forms' | $T8 %]</th>
+ <td>
+ [% L.yes_no_tag('positions_show_update_button', positions_show_update_button) %]
+ </td>
+ </tr>
[%- END -%]
<tr>
LxERP.t8("X"),
confirm=LxERP.t8("Are you sure?")) %]
</td>
+ [%- IF SHOW_UPDATE_BUTTON -%]
<td align="center">
[%- L.img_tag(src="image/rotate_cw.svg",
alt=LxERP.t8('Update from master data'),
onclick="if (!confirm('" _ LxERP.t8("Are you sure to update this position from master data?") _ "')) return false; kivi.Order.update_row_from_master_data(this);",
id='update_from_master') %]
</td>
+ [%- END -%]
<td>
<div name="partnumber">[% HTML.escape(ITEM.part.partnumber) %]</div>
</td>
<th class="listheading" nowrap width="3" >[%- 'position' | $T8 %] </th>
<th class="listheading" style='text-align:center' nowrap width="1"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></th>
<th class="listheading" style='text-align:center' nowrap width="1"><img src="image/close.png" alt="[%- LxERP.t8('delete item') %]"></th>
+ [%- IF SELF.show_update_button -%]
<th class="listheading" style='text-align:center' nowrap width="1">
[%- L.img_tag(src="image/rotate_cw.svg",
alt=LxERP.t8('Update from master data'),
onclick="if (!confirm('" _ LxERP.t8("Are you sure to update all positions from master data?") _ "')) return false; kivi.Order.update_all_rows_from_master_data();",
id='update_from_master') %]
</th>
+ [%- END %]
<th id="partnumber_header_id" class="listheading" nowrap width="15"><a href='#' onClick='javascript:kivi.Order.reorder_items("partnumber")'> [%- 'Partnumber' | $T8 %]</a></th>
[%- IF SELF.search_cvpartnumber -%]
<th id="cvpartnumber_header_id" class="listheading" nowrap width="15"><a href='#' onClick='javascript:kivi.Order.reorder_items("cvpartnumber")' > [%- SELF.cv == "customer" ? LxERP.t8('Customer Part Number') : LxERP.t8('Model') %]</a></th>
</thead>
[%- FOREACH item = SELF.order.items_sorted %]
- [%- PROCESS order/tabs/_row.html ITEM=item ID=(item.id||item.new_fake_id) TYPE=SELF.type ALL_PRICE_FACTORS=SELF.all_price_factors SEARCH_CVPARTNUMBER=SELF.search_cvpartnumber %]
+ [%- PROCESS order/tabs/_row.html
+ ITEM=item
+ ID=(item.id||item.new_fake_id)
+ TYPE=SELF.type
+ ALL_PRICE_FACTORS=SELF.all_price_factors
+ SEARCH_CVPARTNUMBER=SELF.search_cvpartnumber
+ SHOW_UPDATE_BUTTON=SELF.show_update_button
+ -%]
[%- END %]
</table>