Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision be776964

Von Niclas Zimmermann vor mehr als 11 Jahren hinzugefügt

  • ID be776964b83340e69fa2f02eae59b703c0c95b88
  • Vorgänger 6d06b178
  • Nachfolger 014161b8

Nutzung der Tabelle currencies

Dieser Commmit passt den Code an, um die Tabelle currencies zu nutzen.

Unterschiede anzeigen:

SL/AR.pm
56 56

  
57 57
  my $dbh = $provided_dbh ? $provided_dbh : $form->dbconnect_noauto($myconfig);
58 58
  $form->{defaultcurrency} = $form->get_default_currency($myconfig);
59
  delete $form->{currency} unless $form->{defaultcurrency};
60 59

  
61 60
  # set exchangerate
62 61
  $form->{exchangerate} = ($form->{currency} eq $form->{defaultcurrency}) ? 1 :
......
135 134
    } else {
136 135
      $query = qq|SELECT nextval('glid')|;
137 136
      ($form->{id}) = selectrow_query($form, $dbh, $query);
138
      $query = qq|INSERT INTO ar (id, invnumber, employee_id) VALUES (?, 'dummy', ?)|;
139
      do_query($form, $dbh, $query, $form->{id}, $form->{employee_id});
137
      $query = qq|INSERT INTO ar (id, invnumber, employee_id, curr) VALUES (?, 'dummy', ?, (SELECT id FROM currencies WHERE curr=?))|;
138
      do_query($form, $dbh, $query, $form->{id}, $form->{employee_id}, $form->{currency});
140 139
      $form->{invnumber} = $form->update_defaults($myconfig, "invnumber", $dbh) unless $form->{invnumber};
141 140
    }
142 141
  }
......
156 155
      qq|UPDATE ar set
157 156
           invnumber = ?, ordnumber = ?, transdate = ?, customer_id = ?,
158 157
           taxincluded = ?, amount = ?, duedate = ?, paid = ?,
159
           netamount = ?, curr = ?, notes = ?, department_id = ?,
158
           netamount = ?, notes = ?, department_id = ?,
160 159
           employee_id = ?, storno = ?, storno_id = ?, globalproject_id = ?,
161 160
           direct_debit = ?
162 161
         WHERE id = ?|;
163 162
    my @values = ($form->{invnumber}, $form->{ordnumber}, conv_date($form->{transdate}), conv_i($form->{customer_id}), $form->{taxincluded} ? 't' : 'f', $form->{amount},
164
                  conv_date($form->{duedate}), $form->{paid}, $form->{netamount}, $form->{currency}, $form->{notes}, conv_i($form->{department_id}),
163
                  conv_date($form->{duedate}), $form->{paid}, $form->{netamount}, $form->{notes}, conv_i($form->{department_id}),
165 164
                  conv_i($form->{employee_id}), $form->{storno} ? 't' : 'f', $form->{storno_id},
166 165
                  conv_i($form->{globalproject_id}), $form->{direct_debit} ? 't' : 'f', conv_i($form->{id}));
167 166
    do_query($form, $dbh, $query, @values);
......
426 425

  
427 426
  $form->{exchangerate}    = $form->format_amount($myconfig, $form->{exchangerate});
428 427
  $form->{defaultcurrency} = $form->get_default_currency($myconfig);
429
  delete $form->{currency} unless $form->{defaultcurrency};
430 428

  
431 429
  # Get the AR accno (which is normally done by Form::create_links()).
432 430
  $query =

Auch abrufbar als: Unified diff