Revision 332b5ec7
Von Bernd Bleßmann vor mehr als 2 Jahren hinzugefügt
SL/Controller/Order.pm | ||
---|---|---|
24 | 24 |
use SL::DB::PartClassification; |
25 | 25 |
use SL::DB::PartsGroup; |
26 | 26 |
use SL::DB::Printer; |
27 |
use SL::DB::Note; |
|
27 | 28 |
use SL::DB::Language; |
28 | 29 |
use SL::DB::RecordLink; |
29 | 30 |
use SL::DB::RequirementSpec; |
... | ... | |
1239 | 1240 |
$self->js->render(); |
1240 | 1241 |
} |
1241 | 1242 |
|
1243 |
sub action_save_phone_note { |
|
1244 |
my ($self) = @_; |
|
1245 |
|
|
1246 |
if (!$::form->{phone_note}->{subject} || !$::form->{phone_note}->{body}) { |
|
1247 |
return $self->js->flash('error', t8('Phone note needs a subject and a body.'))->render; |
|
1248 |
} |
|
1249 |
|
|
1250 |
my $phone_note; |
|
1251 |
if ($::form->{phone_note}->{id}) { |
|
1252 |
$phone_note = first { $_->id == $::form->{phone_note}->{id} } @{$self->order->phone_notes}; |
|
1253 |
return $self->js->flash('error', t8('Phone note not found for this order.'))->render if !$phone_note; |
|
1254 |
} |
|
1255 |
|
|
1256 |
$phone_note = SL::DB::Note->new() if !$phone_note; |
|
1257 |
my $is_new = !$phone_note->id; |
|
1258 |
|
|
1259 |
$phone_note->assign_attributes(%{ $::form->{phone_note} }, |
|
1260 |
trans_id => $self->order->id, |
|
1261 |
trans_module => 'oe', |
|
1262 |
employee => SL::DB::Manager::Employee->current); |
|
1263 |
|
|
1264 |
$phone_note->save; |
|
1265 |
$self->order(SL::DB::Order->new(id => $self->order->id)->load); |
|
1266 |
|
|
1267 |
my $tab_as_html = $self->p->render('order/tabs/phone_notes', SELF => $self); |
|
1268 |
|
|
1269 |
return $self->js |
|
1270 |
->replaceWith('#phone-notes', $tab_as_html) |
|
1271 |
->html('#num_phone_notes', (scalar @{$self->order->phone_notes}) ? ' (' . scalar @{$self->order->phone_notes} . ')' : '') |
|
1272 |
->flash('info', $is_new ? t8('Phone note has been created.') : t8('Phone note has been updated.')) |
|
1273 |
->render; |
|
1274 |
} |
|
1275 |
|
|
1276 |
sub action_delete_phone_note { |
|
1277 |
my ($self) = @_; |
|
1278 |
|
|
1279 |
my $phone_note = first { $_->id == $::form->{phone_note}->{id} } @{$self->order->phone_notes}; |
|
1280 |
|
|
1281 |
return $self->js->flash('error', t8('Phone note not found for this order.'))->render if !$phone_note; |
|
1282 |
|
|
1283 |
$phone_note->delete; |
|
1284 |
$self->order(SL::DB::Order->new(id => $self->order->id)->load); |
|
1285 |
|
|
1286 |
my $tab_as_html = $self->p->render('order/tabs/phone_notes', SELF => $self); |
|
1287 |
|
|
1288 |
return $self->js |
|
1289 |
->replaceWith('#phone-notes', $tab_as_html) |
|
1290 |
->html('#num_phone_notes', (scalar @{$self->order->phone_notes}) ? ' (' . scalar @{$self->order->phone_notes} . ')' : '') |
|
1291 |
->flash('info', t8('Phone note has been deleted.')) |
|
1292 |
->render; |
|
1293 |
} |
|
1294 |
|
|
1242 | 1295 |
sub js_load_second_row { |
1243 | 1296 |
my ($self, $item, $item_id, $do_parse) = @_; |
1244 | 1297 |
|
... | ... | |
1802 | 1855 |
my $errors = []; |
1803 | 1856 |
my $db = $self->order->db; |
1804 | 1857 |
|
1858 |
# check for new or updated phone note |
|
1859 |
if ($::form->{phone_note}->{subject} || $::form->{phone_note}->{body}) { |
|
1860 |
if (!$::form->{phone_note}->{subject} || !$::form->{phone_note}->{body}) { |
|
1861 |
return [t8('Phone note needs a subject and a body.')]; |
|
1862 |
die; |
|
1863 |
} |
|
1864 |
|
|
1865 |
my $phone_note; |
|
1866 |
if ($::form->{phone_note}->{id}) { |
|
1867 |
$phone_note = first { $_->id == $::form->{phone_note}->{id} } @{$self->order->phone_notes}; |
|
1868 |
return [t8('Phone note not found for this order.')] if !$phone_note; |
|
1869 |
} |
|
1870 |
|
|
1871 |
$phone_note = SL::DB::Note->new() if !$phone_note; |
|
1872 |
my $is_new = !$phone_note->id; |
|
1873 |
|
|
1874 |
$phone_note->assign_attributes(%{ $::form->{phone_note} }, |
|
1875 |
trans_id => $self->order->id, |
|
1876 |
trans_module => 'oe', |
|
1877 |
employee => SL::DB::Manager::Employee->current); |
|
1878 |
|
|
1879 |
$self->order->add_phone_notes($phone_note) if $is_new; |
|
1880 |
} |
|
1881 |
|
|
1805 | 1882 |
$db->with_transaction(sub { |
1806 | 1883 |
# delete custom shipto if it is to be deleted or if it is empty |
1807 | 1884 |
if ($self->order->custom_shipto && ($self->is_custom_shipto_to_delete || $self->order->custom_shipto->is_empty)) { |
... | ... | |
2026 | 2103 |
|
2027 | 2104 |
$self->get_item_cvpartnumber($_) for @{$self->order->items_sorted}; |
2028 | 2105 |
|
2106 |
$self->{template_args}->{num_phone_notes} = scalar @{ $self->order->phone_notes || [] }; |
|
2107 |
|
|
2029 | 2108 |
$::request->{layout}->use_javascript("${_}.js") for qw(kivi.Validator kivi.SalesPurchase kivi.Order kivi.File ckeditor/ckeditor ckeditor/adapters/jquery |
2030 | 2109 |
edit_periodic_invoices_config calculate_qty follow_up show_history); |
2031 | 2110 |
$self->setup_edit_action_bar; |
SL/DB/Order.pm | ||
---|---|---|
47 | 47 |
class => 'SL::DB::Exchangerate', |
48 | 48 |
column_map => { currency_id => 'currency_id', transdate => 'transdate' }, |
49 | 49 |
}, |
50 |
phone_notes => { |
|
51 |
type => 'one to many', |
|
52 |
class => 'SL::DB::Note', |
|
53 |
column_map => { id => 'trans_id' }, |
|
54 |
query_args => [ trans_module => 'oe' ], |
|
55 |
manager_args => { |
|
56 |
with_objects => [ 'employee' ], |
|
57 |
sort_by => 'notes.itime', |
|
58 |
} |
|
59 |
}, |
|
50 | 60 |
); |
51 | 61 |
|
52 | 62 |
SL::DB::Helper::Attr::make(__PACKAGE__, daily_exchangerate => 'numeric'); |
js/kivi.Order.js | ||
---|---|---|
878 | 878 |
ns.create_part = function() { |
879 | 879 |
var data = $('#order_form').serializeArray(); |
880 | 880 |
data.push({ name: 'action', value: 'Order/create_part' }); |
881 |
|
|
882 | 881 |
$.post("controller.pl", data, kivi.eval_json_result); |
883 | 882 |
}; |
884 | 883 |
|
... | ... | |
906 | 905 |
return true; |
907 | 906 |
}; |
908 | 907 |
|
908 |
ns.load_phone_note = function(id, subject, body) { |
|
909 |
$('#phone_note_edit_text').html(kivi.t8('Edit note')); |
|
910 |
$('#phone_note_id').val(id); |
|
911 |
$('#phone_note_subject').val(subject); |
|
912 |
$('#phone_note_body').val(body); |
|
913 |
$('#phone_note_delete_button').show(); |
|
914 |
}; |
|
915 |
|
|
916 |
ns.cancel_phone_note = function() { |
|
917 |
$('#phone_note_edit_text').html(kivi.t8('Add note')); |
|
918 |
$('#phone_note_id').val(''); |
|
919 |
$('#phone_note_subject').val(''); |
|
920 |
$('#phone_note_body').val(''); |
|
921 |
$('#phone_note_delete_button').hide(); |
|
922 |
}; |
|
923 |
|
|
924 |
ns.save_phone_note = function() { |
|
925 |
var data = $('#order_form').serializeArray(); |
|
926 |
data.push({ name: 'action', value: 'Order/save_phone_note' }); |
|
927 |
|
|
928 |
$.post("controller.pl", data, kivi.eval_json_result); |
|
929 |
}; |
|
930 |
|
|
931 |
ns.delete_phone_note = function() { |
|
932 |
if ($('#phone_note_id').val() === '') return; |
|
933 |
|
|
934 |
var data = $('#order_form').serializeArray(); |
|
935 |
data.push({ name: 'action', value: 'Order/delete_phone_note' }); |
|
936 |
|
|
937 |
$.post("controller.pl", data, kivi.eval_json_result); |
|
938 |
}; |
|
939 |
|
|
909 | 940 |
}); |
910 | 941 |
|
911 | 942 |
$(function() { |
js/locale/de.js | ||
---|---|---|
4 | 4 |
"Add function block":"Funktionsblock hinzufügen", |
5 | 5 |
"Add linked record":"Verknüpften Beleg hinzufügen", |
6 | 6 |
"Add multiple items":"Mehrere Artikel hinzufügen", |
7 |
"Add note":"Notiz erfassen", |
|
7 | 8 |
"Add picture":"Bild hinzufügen", |
8 | 9 |
"Add picture to text block":"Bild dem Textblock hinzufügen", |
9 | 10 |
"Add section":"Abschnitt hinzufügen", |
... | ... | |
61 | 62 |
"Edit":"Bearbeiten", |
62 | 63 |
"Edit article/section assignments":"Zuweisung Artikel/Abschnitte bearbeiten", |
63 | 64 |
"Edit custom shipto":"Individuelle Lieferadresse bearbeiten", |
65 |
"Edit note":"Notiz bearbeiten", |
|
64 | 66 |
"Edit picture":"Bild bearbeiten", |
65 | 67 |
"Edit project link":"Projektverknüpfung bearbeiten", |
66 | 68 |
"Edit text block":"Textblock bearbeiten", |
js/locale/en.js | ||
---|---|---|
4 | 4 |
"Add function block":"", |
5 | 5 |
"Add linked record":"", |
6 | 6 |
"Add multiple items":"", |
7 |
"Add note":"", |
|
7 | 8 |
"Add picture":"", |
8 | 9 |
"Add picture to text block":"", |
9 | 10 |
"Add section":"", |
... | ... | |
61 | 62 |
"Edit":"", |
62 | 63 |
"Edit article/section assignments":"", |
63 | 64 |
"Edit custom shipto":"", |
65 |
"Edit note":"", |
|
64 | 66 |
"Edit picture":"", |
65 | 67 |
"Edit project link":"", |
66 | 68 |
"Edit text block":"", |
locale/de/all | ||
---|---|---|
2530 | 2530 |
'Perpetual inventory' => 'Bestandsmethode', |
2531 | 2531 |
'Personal settings' => 'Persönliche Einstellungen', |
2532 | 2532 |
'Phone' => 'Telefon', |
2533 |
'Phone Notes' => 'Telefonnotizen', |
|
2533 | 2534 |
'Phone extension' => 'Durchwahl', |
2534 | 2535 |
'Phone extension missing in user configuration' => 'Durchwahl fehlt in der Benutzerkonfiguration', |
2536 |
'Phone note has been created.' => 'Die Telefonnotiz wurde angelegt.', |
|
2537 |
'Phone note has been deleted.' => 'Die Telefonnotiz wurde gelöscht.', |
|
2538 |
'Phone note has been updated.' => 'Die Telefonnotiz wurde aktualisiert.', |
|
2539 |
'Phone note needs a subject and a body.' => 'Eine Telefonnotiz muss einen Betreff und einen Text haben.', |
|
2540 |
'Phone note not found for this order.' => 'Diese Telefonnotiz wurde für dieses Dokument nicht gefunden.', |
|
2535 | 2541 |
'Phone password' => 'Telefonpasswort', |
2536 | 2542 |
'Phone password missing in user configuration' => 'Telefonpasswort fehlt in der Benutzerkonfiguration', |
2537 | 2543 |
'Phone1' => 'Telefon 1 ', |
locale/en/all | ||
---|---|---|
2530 | 2530 |
'Perpetual inventory' => '', |
2531 | 2531 |
'Personal settings' => '', |
2532 | 2532 |
'Phone' => '', |
2533 |
'Phone Notes' => '', |
|
2533 | 2534 |
'Phone extension' => '', |
2534 | 2535 |
'Phone extension missing in user configuration' => '', |
2536 |
'Phone note has been created.' => '', |
|
2537 |
'Phone note has been deleted.' => '', |
|
2538 |
'Phone note has been updated.' => '', |
|
2539 |
'Phone note needs a subject and a body.' => '', |
|
2540 |
'Phone note not found for this order.' => '', |
|
2535 | 2541 |
'Phone password' => '', |
2536 | 2542 |
'Phone password missing in user configuration' => '', |
2537 | 2543 |
'Phone1' => '', |
templates/webpages/order/form.html | ||
---|---|---|
38 | 38 |
[%- IF SELF.order.id %] |
39 | 39 |
<li><a href="controller.pl?action=RecordLinks/ajax_list&object_model=Order&object_id=[% HTML.url(SELF.order.id) %]">[% 'Linked Records' | $T8 %]</a></li> |
40 | 40 |
[%- END %] |
41 |
[% IF SELF.order.id %] |
|
42 |
<li><a href="#ui-tabs-phone-notes">[% 'Phone Notes' | $T8 %]<span id="num_phone_notes">[%- num_phone_notes ? ' (' _ num_phone_notes _ ')' : '' -%]</span></a></li> |
|
43 |
[% END %] |
|
41 | 44 |
</ul> |
42 | 45 |
|
43 | 46 |
[% PROCESS "order/tabs/basic_data.html" %] |
... | ... | |
45 | 48 |
<div id="ui-tabs-1"> |
46 | 49 |
[%- LxERP.t8("Loading...") %] |
47 | 50 |
</div> |
48 |
|
|
51 |
[% IF SELF.order.id %] |
|
52 |
<div id="ui-tabs-phone-notes"> |
|
53 |
[% PROCESS "order/tabs/phone_notes.html" %] |
|
54 |
</div> |
|
55 |
[% END %] |
|
49 | 56 |
<div id="shipto_inputs" class="hidden"> |
50 | 57 |
[%- PROCESS 'common/_ship_to_dialog.html' |
51 | 58 |
vc_obj=SELF.order.customervendor |
templates/webpages/order/tabs/phone_notes.html | ||
---|---|---|
1 |
[%- USE T8 %] |
|
2 |
[%- USE HTML %] |
|
3 |
[%- USE L %] |
|
4 |
[%- USE LxERP %] |
|
5 |
[%- USE P %] |
|
6 |
|
|
7 |
<div id="phone-notes"> |
|
8 |
[% IF ( SELF.order.phone_notes && SELF.order.phone_notes.size ) %] |
|
9 |
<table> |
|
10 |
<tr> |
|
11 |
<th class="listheading">[% 'Subject' | $T8 %]</th> |
|
12 |
<th class="listheading">[% 'Created on' | $T8 %]</th> |
|
13 |
<th class="listheading">[% 'Created by' | $T8 %]</th> |
|
14 |
</tr> |
|
15 |
|
|
16 |
[%- FOREACH row = SELF.order.phone_notes %] |
|
17 |
<tr class="listrow"> |
|
18 |
<td>[% P.link_tag('#', row.subject, onclick="kivi.Order.load_phone_note(" _ HTML.url(row.id) _ ", '" _ HTML.escape(row.subject) _ "', '" _ HTML.escape(row.body) _ "')") %]</td> |
|
19 |
<td>[% row.itime.to_kivitendo | html %]</td> |
|
20 |
<td>[% row.employee.safe_name | html %]</td> |
|
21 |
</tr> |
|
22 |
[% END %] |
|
23 |
</table> |
|
24 |
[% END %] |
|
25 |
|
|
26 |
<h2 id='phone_note_edit_text'>[% 'Add note' | $T8 %]</h2> |
|
27 |
|
|
28 |
[% L.hidden_tag('phone_note.id') %] |
|
29 |
|
|
30 |
<table> |
|
31 |
<tr> |
|
32 |
<td valign="right">[% 'Subject' | $T8 %]</td> |
|
33 |
<td>[% L.input_tag('phone_note.subject', '', size = 50) %]</td> |
|
34 |
</tr> |
|
35 |
<tr> |
|
36 |
<td valign="right" align="top">[% 'Body' | $T8 %]</td> |
|
37 |
<td align="top">[% L.textarea_tag('phone_note.body', '', cols = 50 rows = 10) %]</td> |
|
38 |
</tr> |
|
39 |
</table> |
|
40 |
|
|
41 |
<p> |
|
42 |
[% P.button_tag("kivi.Order.save_phone_note()", LxERP.t8('Save')) %] |
|
43 |
[% P.button_tag("kivi.Order.delete_phone_note()", LxERP.t8('Delete'), id = 'phone_note_delete_button', style='display:none') %] |
|
44 |
[% P.button_tag("kivi.Order.cancel_phone_note()", LxERP.t8('Cancel')) %] |
|
45 |
</p> |
|
46 |
|
|
47 |
</div> |
Auch abrufbar als: Unified diff
Telefonnotizen Angebot/Auftrag
In einem neuen Reiter können Notizen zum Beleg erfasst werden.