Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision d1054383

Von Bernd Bleßmann vor etwa 3 Jahren hinzugefügt

  • ID d1054383fa90478db0424f5dc255d5836bc494d7
  • Vorgänger c4ad2c7c
  • Nachfolger 1e091879

Artikelstamm: "Erneuert am" aus parts_price_history holen …

… und in "Preisänderung am" umbenennen.

Das ganze ist mit Rose gelöst und holt die Preise aus parts_price_history.
Das hat den Nachteil, dass im Artikelbericht nicht nach der Preisanpassung
sortiert werden kann und es wahrscheinlich nicht performant ist.

Der aktuelle Trigger für parts.priceupdate funktionierte nicht, und hätte
auch bei jeder Änderung eines Artikels das Datum angepasst. Dafür kann man auch
mtime nehmen.

Todo 1: Spalte priceupdate (und den Trigger) aus parts löschen (und alle
Vorkommen finden).
Todo 2: Query auf SQL umschreiben und soriteren wieder ermöglichen.

Refs #254 (redmine)

Unterschiede anzeigen:

SL/DB/Part.pm
76 76
    column_map   => { id => 'part_id' },
77 77
    manager_args => { with_objects => [ 'shop' ] },
78 78
  },
79
  last_price_update => {
80
    type         => 'one to one',
81
    class        => 'SL::DB::PartsPriceHistory',
82
    column_map   => { id => 'part_id' },
83
    manager_args => { sort_by => 'valid_from DESC', limit => 1 },
84
  },
79 85
);
80 86

  
81 87
__PACKAGE__->meta->initialize;
SL/IC.pm
481 481

  
482 482
  my $token_builder = $make_token_builder->(\%joins_needed);
483 483

  
484
  my @sort_cols    = (@simple_filters, qw(id priceupdate onhand invnumber ordnumber quonumber name serialnumber soldtotal deliverydate insertdate shop));
484
  my @sort_cols    = (@simple_filters, qw(id onhand invnumber ordnumber quonumber name serialnumber soldtotal deliverydate insertdate shop));
485 485
     $form->{sort} = 'id' unless grep { $form->{"l_$_"} } grep { $form->{sort} eq $_ } @sort_cols; # sort by id if unknown or invisible column
486 486
  my $sort_order   = ($form->{revers} ? ' DESC' : ' ASC');
487 487
  my $order_clause = " ORDER BY " . $token_builder->($form->{sort}) . ($form->{revers} ? ' DESC' : ' ASC');
......
567 567
      qq|SELECT p.id, p.partnumber, p.description, a.qty AS onhand,
568 568
           p.unit, p.notes, p.itime::DATE as insertdate,
569 569
           p.sellprice, p.listprice, p.lastcost,
570
           p.rop, p.weight, p.priceupdate,
570
           p.rop, p.weight,
571 571
           p.image, p.drawing, p.microfiche,
572 572
           pfac.factor
573 573
         FROM parts p
bin/mozilla/ic.pl
188 188
    'ordnumber'          => { 'text' => $locale->text('Order Number'), },
189 189
    'partnumber'         => { 'text' => $locale->text('Part Number'), },
190 190
    'partsgroup'         => { 'text' => $locale->text('Partsgroup'), },
191
    'priceupdate'        => { 'text' => $locale->text('Updated'), },
191
    'priceupdate'        => { 'text' => $locale->text('Price updated'), },
192 192
    'quonumber'          => { 'text' => $locale->text('Quotation'), },
193 193
    'rop'                => { 'text' => $locale->text('ROP'), },
194 194
    'sellprice'          => { 'text' => $locale->text('Sell Price'), },
......
435 435
  my $callback         = build_std_url('action=generate_report', grep { $form->{$_} } @hidden_variables);
436 436

  
437 437
  my @sort_full        = qw(partnumber description onhand soldtotal deliverydate insertdate shop);
438
  my @sort_no_revers   = qw(partsgroup priceupdate invnumber ordnumber quonumber name image drawing serialnumber);
438
  my @sort_no_revers   = qw(partsgroup invnumber ordnumber quonumber name image drawing serialnumber);
439 439

  
440 440
  foreach my $col (@sort_full) {
441 441
    $column_defs{$col}->{link} = join '&', $callback, "sort=$col", map { "$_=" . E($form->{$_}) } qw(revers lastsort);
......
582 582
    $row->{type_and_classific}{data} = SL::Presenter::Part::type_abbreviation($ref->{part_type}).
583 583
                                       SL::Presenter::Part::classification_abbreviation($ref->{classification_id});
584 584

  
585
    # last price update
586
    $row->{priceupdate}{data} = SL::DB::Part->new(id => $ref->{id})->load->last_price_update->valid_from->to_kivitendo;
587

  
585 588
    $report->add_data($row);
586 589

  
587 590
    my $next_ref = $form->{parts}[$idx + 1];
locale/de/all
2501 2501
  'Price sources deactivated in this client' => 'Preisquellen die in diesem Mandanten deaktiviert sind',
2502 2502
  'Price type'                  => 'Preistyp',
2503 2503
  'Price type explanation'      => 'Preistyp Erklärung',
2504
  'Price updated'               => 'Preisänderung am',
2504 2505
  'Pricegroup'                  => 'Preisgruppe',
2505 2506
  'Pricegroups'                 => 'Preisgruppen',
2506 2507
  'Prices'                      => 'Preise',
locale/en/all
2501 2501
  'Price sources deactivated in this client' => '',
2502 2502
  'Price type'                  => '',
2503 2503
  'Price type explanation'      => '',
2504
  'Price updated'               => '',
2504 2505
  'Pricegroup'                  => '',
2505 2506
  'Pricegroups'                 => '',
2506 2507
  'Prices'                      => '',
templates/webpages/ic/search.html
192 192
         </tr>
193 193

  
194 194
         <tr>
195
          <td>[%- L.checkbox_tag('l_priceupdate', label=LxERP.t8('Updated'), value='Y') %]</td>
195
          <td>[%- L.checkbox_tag('l_priceupdate', label=LxERP.t8('Price updated'), value='Y') %]</td>
196 196
          <td>[%- L.checkbox_tag('l_deliverydate', label=LxERP.t8('Delivery Date'), value='Y') %]</td>
197 197
          <td>[%- L.checkbox_tag('l_rop', label=LxERP.t8('ROP'), value='Y') %]</td>
198 198
          <td>[%- L.checkbox_tag('l_weight', label=LxERP.t8('Weight'), value='Y') %]</td>
templates/webpages/part/_basic_data.html
84 84
        <td>
85 85
         <table id="ic5">
86 86
          <tr>
87
           <th align="right" nowrap="true">[% 'Updated' | $T8 %]</th>
87
           <th align="right" nowrap="true">[% 'Price updated' | $T8 %]</th>
88 88
           <td>
89
           [% SELF.part.priceupdate.to_kivitendo | html %]
89
           [% SELF.part.last_price_update.valid_from.to_kivitendo | html %]
90 90
           </td>
91 91
          </tr>
92 92

  

Auch abrufbar als: Unified diff