Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 6ef4190e

Von Moritz Bunkus vor mehr als 8 Jahren hinzugefügt

  • ID 6ef4190ee87f3b7ba053bcc247aa92b92ef02cb4
  • Vorgänger 040b466d
  • Nachfolger 6e1a7a2e

CVars: Lieferadressen-CVars in Stammdaten bearbeiten

Unterschiede anzeigen:

js/kivi.CustomerVendor.js
2 2

  
3 3
  this.selectShipto = function(params) {
4 4
    var shiptoId = $('#shipto_shipto_id').val();
5
    var url      = 'controller.pl?action=CustomerVendor/ajaj_get_shipto&id='+ $('#cv_id').val() +'&db='+ $('#db').val() +'&shipto_id='+ shiptoId;
5 6

  
6
    if( shiptoId ) {
7
      var url = 'controller.pl?action=CustomerVendor/ajaj_get_shipto&id='+ $('#cv_id').val() +'&db='+ $('#db').val() +'&shipto_id='+ shiptoId;
7
    $.getJSON(url, function(data) {
8
      var shipto = data.shipto;
9
      for(var key in shipto)
10
        $('#shipto_'+ key).val(shipto[key])
8 11

  
9
      $.getJSON(url, function(data) {
10
        for(var key in data)
11
          $('#shipto_'+ key).val(data[key]);
12
      kivi.CustomerVendor.setCustomVariablesFromAJAJ(data.shipto_cvars, 'shipto_cvars_');
12 13

  
14
      if ( shiptoId )
13 15
        $('#action_delete_shipto').show();
16
      else
17
        $('#action_delete_shipto').hide();
14 18

  
15
        if( params.onFormSet )
16
          params.onFormSet();
17
      });
18
    }
19
    else {
20
      $('#shipto :input').not(':button, :submit, :reset, :hidden').val('');
21

  
22
      $('#action_delete_shipto').hide();
23

  
24
      if( params.onFormSet )
19
      if ( params.onFormSet )
25 20
        params.onFormSet();
26
    }
21
    });
27 22
  };
28 23

  
29 24
  this.selectDelivery = function(fromDate, toDate) {
......
41 36
    }
42 37
  };
43 38

  
44
  this.setCustomVariablesFromAJAJ = function(cvars) {
39
  this.setCustomVariablesFromAJAJ = function(cvars, prefix) {
45 40
    for (var key in cvars) {
46 41
      var cvar  = cvars[key];
47
      var $ctrl = $('#contact_cvars_'+ key);
42
      var $ctrl = $('#' + prefix + key);
48 43

  
49 44
      if (cvar.type == 'bool')
50 45
        $ctrl.prop('checked', cvar.value == 1 ? 'checked' : '');
......
70 65
      for(var key in contact)
71 66
        $('#contact_'+ key).val(contact[key])
72 67

  
73
      kivi.CustomerVendor.setCustomVariablesFromAJAJ(data.contact_cvars);
68
      kivi.CustomerVendor.setCustomVariablesFromAJAJ(data.contact_cvars, 'contact_cvars_');
74 69

  
75 70
      if ( contactId )
76 71
        $('#action_delete_contact').show();

Auch abrufbar als: Unified diff