Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 7ea32650

Von Moritz Bunkus vor etwa 12 Jahren hinzugefügt

  • ID 7ea32650019b2611e03f83ccaa904a03d6a6b3d1
  • Vorgänger c4ee17ee
  • Nachfolger 7c931a23

Währungen mit mehr als drei Zeichen erlauben & Spaltentyp 'text' anstelle von 'char(3)'

Alle Währungsspalten sind nun vom Typ 'text' anstatt 'char(3)'. Das
hat zwei Effekte:

1. Es ist möglich, Währungen einzugeben, deren Abkürzung nicht exakt
drei Zeichen lang ist.
2. Fixt #1934. Durch Umstellung von "keine Währung" auf "Währungen"
wurden Inhalte von 'char(3)' als drei Leerzeichen von PostgreSQL
zurückgegeben (das ist SQL-Standardkonform), was von kivitendo als
"oh das ist nicht die Standardwährung" interpretiert wurde.

Unterschiede anzeigen:

SL/DB/MetaSetup/Customer.pm
53 53
    iban                => { type => 'varchar', length => 100 },
54 54
    bic                 => { type => 'varchar', length => 100 },
55 55
    direct_debit        => { type => 'boolean', default => 'false' },
56
    curr                => { type => 'character', length => 3 },
56
    curr                => { type => 'text' },
57 57
    taxincluded_checked => { type => 'boolean' },
58 58
  ],
59 59

  
SL/DB/MetaSetup/DeliveryOrder.pm
39 39
    taxzone_id              => { type => 'integer' },
40 40
    taxincluded             => { type => 'boolean' },
41 41
    terms                   => { type => 'integer' },
42
    curr                    => { type => 'character', length => 3 },
42
    curr                    => { type => 'text' },
43 43
  ],
44 44

  
45 45
  primary_key_columns => [ 'id' ],
SL/DB/MetaSetup/Exchangerate.pm
10 10
  table   => 'exchangerate',
11 11

  
12 12
  columns => [
13
    curr      => { type => 'character', length => 3 },
13
    curr      => { type => 'text' },
14 14
    transdate => { type => 'date' },
15 15
    buy       => { type => 'numeric', precision => 5, scale => 15 },
16 16
    sell      => { type => 'numeric', precision => 5, scale => 15 },
SL/DB/MetaSetup/Invoice.pm
26 26
    shippingpoint             => { type => 'text' },
27 27
    terms                     => { type => 'integer', default => '0' },
28 28
    notes                     => { type => 'text' },
29
    curr                      => { type => 'character', length => 3 },
29
    curr                      => { type => 'text' },
30 30
    ordnumber                 => { type => 'text' },
31 31
    employee_id               => { type => 'integer' },
32 32
    quonumber                 => { type => 'text' },
SL/DB/MetaSetup/PurchaseInvoice.pm
23 23
    duedate                 => { type => 'date' },
24 24
    invoice                 => { type => 'boolean', default => 'false' },
25 25
    ordnumber               => { type => 'text' },
26
    curr                    => { type => 'character', length => 3 },
26
    curr                    => { type => 'text' },
27 27
    notes                   => { type => 'text' },
28 28
    employee_id             => { type => 'integer' },
29 29
    quonumber               => { type => 'text' },
SL/DB/MetaSetup/RMA.pm
21 21
    taxincluded          => { type => 'boolean' },
22 22
    shippingpoint        => { type => 'text' },
23 23
    notes                => { type => 'text' },
24
    curr                 => { type => 'character', length => 3 },
24
    curr                 => { type => 'text' },
25 25
    employee_id          => { type => 'integer' },
26 26
    closed               => { type => 'boolean', default => 'false' },
27 27
    quotation            => { type => 'boolean', default => 'false' },
SL/DB/MetaSetup/Vendor.pm
53 53
    iban           => { type => 'varchar', length => 100 },
54 54
    bic            => { type => 'varchar', length => 100 },
55 55
    direct_debit   => { type => 'boolean', default => 'false' },
56
    curr           => { type => 'character', length => 3 },
56
    curr           => { type => 'text' },
57 57
  ],
58 58

  
59 59
  primary_key_columns => [ 'id' ],
SL/Form.pm
1607 1607
  my ($self, $dbh, $curr, $transdate, $fld) = @_;
1608 1608
  my ($query);
1609 1609

  
1610
  unless ($transdate) {
1610
  unless ($transdate && $curr) {
1611 1611
    $main::lxdebug->leave_sub();
1612 1612
    return 1;
1613 1613
  }
locale/de/all
794 794
  'End date'                    => 'Enddatum',
795 795
  'Enter a description for this new draft.' => 'Geben Sie eine Beschreibung für diesen Entwurf ein.',
796 796
  'Enter longdescription'       => 'Langtext eingeben',
797
  'Enter the abbreviations separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies' => 'Geben Sie Ihre und weitere Währungen als Abkürzungen durch Doppelpunkte getrennt ein (z.B. EUR:USD:CAD)',
797 798
  'Enter the requested execution date or leave empty for the quickest possible execution:' => 'Geben Sie das jeweils gewünschte Ausführungsdatum an, oder lassen Sie das Feld leer für die schnellstmögliche Ausführung:',
798
  'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies' => 'Geben Sie Ihre und weitere Währungen mit bis zu drei Buchstaben pro Währung und Währungen durch Doppelpunkte getrennt ein (z.B. EUR:USD:CAD)',
799 799
  'Equity'                      => 'Passiva',
800 800
  'Error'                       => 'Fehler',
801 801
  'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
sql/Pg-upgrade2/convert_curr_to_text.sql
1
-- @tag: convert_curr_to_text
2
-- @description: Spalte 'curr' von 'char(3)' nach 'text' konvertieren
3
-- @depends: release_2_7_0
4
-- @charset: utf-8
5

  
6
-- Zuerst alle Spaltentypen konvertieren.
7
ALTER TABLE ap              ALTER COLUMN curr TYPE text;
8
ALTER TABLE ar              ALTER COLUMN curr TYPE text;
9
ALTER TABLE customer        ALTER COLUMN curr TYPE text;
10
ALTER TABLE delivery_orders ALTER COLUMN curr TYPE text;
11
ALTER TABLE exchangerate    ALTER COLUMN curr TYPE text;
12
ALTER TABLE rma             ALTER COLUMN curr TYPE text;
13
ALTER TABLE vendor          ALTER COLUMN curr TYPE text;
14

  
15
-- Eventuell falsche Inhalte (Leerzeichenpadding) auf leere Strings setzen.
16
UPDATE ap              SET curr = '' WHERE (curr SIMILAR TO '^ +$') OR (curr IS NULL);
17
UPDATE ar              SET curr = '' WHERE (curr SIMILAR TO '^ +$') OR (curr IS NULL);
18
UPDATE customer        SET curr = '' WHERE (curr SIMILAR TO '^ +$') OR (curr IS NULL);
19
UPDATE delivery_orders SET curr = '' WHERE (curr SIMILAR TO '^ +$') OR (curr IS NULL);
20
UPDATE exchangerate    SET curr = '' WHERE (curr SIMILAR TO '^ +$') OR (curr IS NULL);
21
UPDATE oe              SET curr = '' WHERE (curr SIMILAR TO '^ +$') OR (curr IS NULL);
22
UPDATE rma             SET curr = '' WHERE (curr SIMILAR TO '^ +$') OR (curr IS NULL);
23
UPDATE vendor          SET curr = '' WHERE (curr SIMILAR TO '^ +$') OR (curr IS NULL);
24

  
25
-- Nun noch die stored procedures anpassen.
26
CREATE OR REPLACE FUNCTION del_exchangerate() RETURNS trigger
27
  LANGUAGE plpgsql
28
  AS $$
29
    DECLARE
30
      t_transdate date;
31
      t_curr      text;
32
      t_id        int;
33
      d_curr      text;
34
    BEGIN
35
      SELECT INTO d_curr substring(curr FROM '[^:]*') FROM DEFAULTS;
36

  
37
      IF TG_RELNAME = 'ar' THEN
38
        SELECT INTO t_curr, t_transdate curr, transdate FROM ar WHERE id = old.id;
39
      END IF;
40

  
41
      IF TG_RELNAME = 'ap' THEN
42
        SELECT INTO t_curr, t_transdate curr, transdate FROM ap WHERE id = old.id;
43
      END IF;
44

  
45
      IF TG_RELNAME = 'oe' THEN
46
        SELECT INTO t_curr, t_transdate curr, transdate FROM oe WHERE id = old.id;
47
      END IF;
48

  
49
      IF TG_RELNAME = 'delivery_orders' THEN
50
        SELECT INTO t_curr, t_transdate curr, transdate FROM delivery_orders WHERE id = old.id;
51
      END IF;
52

  
53
      IF d_curr != t_curr THEN
54
        SELECT INTO t_id a.id FROM acc_trans ac
55
          JOIN ar a ON (a.id = ac.trans_id)
56
          WHERE (a.curr       = t_curr)
57
            AND (ac.transdate = t_transdate)
58
        EXCEPT SELECT a.id
59
          FROM ar a
60
          WHERE (a.id = old.id)
61

  
62
        UNION
63

  
64
        SELECT a.id
65
          FROM acc_trans ac
66
          JOIN ap a ON (a.id = ac.trans_id)
67
          WHERE (a.curr       = t_curr)
68
            AND (ac.transdate = t_transdate)
69
        EXCEPT SELECT a.id
70
          FROM ap a
71
          WHERE (a.id = old.id)
72

  
73
        UNION
74

  
75
        SELECT o.id
76
          FROM oe o
77
          WHERE (o.curr      = t_curr)
78
            AND (o.transdate = t_transdate)
79
        EXCEPT SELECT o.id
80
        FROM oe o
81
        WHERE (o.id = old.id)
82

  
83
        UNION
84

  
85
        SELECT dord.id
86
          FROM delivery_orders dord
87
          WHERE (dord.curr      = t_curr)
88
            AND (dord.transdate = t_transdate)
89
        EXCEPT SELECT dord.id
90
        FROM delivery_orders dord
91
        WHERE (dord.id = old.id);
92

  
93
        IF NOT FOUND THEN
94
          DELETE FROM exchangerate
95
          WHERE (curr      = t_curr)
96
            AND (transdate = t_transdate);
97
        END IF;
98
      END IF;
99

  
100
      RETURN old;
101
    END;
102
$$;
103

  
104
-- Und die stored procedure auch auf delivery_orders anwenden
105
CREATE TRIGGER del_exchangerate
106
    BEFORE DELETE ON delivery_orders
107
    FOR EACH ROW
108
    EXECUTE PROCEDURE del_exchangerate();
templates/webpages/am/edit_defaults.html
206 206
  <hr height="3" noshade>
207 207

  
208 208
  <p>
209
   (1) [% 'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies' | $T8 %]
209
   (1) [% 'Enter the abbreviations separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies' | $T8 %]
210 210
       [% 'IMPORTANT NOTE: You cannot safely change currencies, IF you have already booking entries!' | $T8 %]
211 211
  </p>
212 212
 </form>
213

  

Auch abrufbar als: Unified diff