Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 9c5f94c0

Von Moritz Bunkus vor mehr als 8 Jahren hinzugefügt

  • ID 9c5f94c0359a8f2c0dba93b5e9bdef99f332fcc8
  • Vorgänger 8192e023
  • Nachfolger 02b714e7

Wiederkerende Rechnungen: Konfiguration für automatischen Versand via E-Mail

Unterschiede anzeigen:

SL/DB/MetaSetup/PeriodicInvoicesConfig.pm
9 9
__PACKAGE__->meta->table('periodic_invoices_configs');
10 10

  
11 11
__PACKAGE__->meta->columns(
12
  active                  => { type => 'boolean', default => 'true' },
13
  ar_chart_id             => { type => 'integer', not_null => 1 },
14
  copies                  => { type => 'integer' },
15
  direct_debit            => { type => 'boolean', default => 'false', not_null => 1 },
16
  end_date                => { type => 'date' },
17
  extend_automatically_by => { type => 'integer' },
18
  first_billing_date      => { type => 'date' },
19
  id                      => { type => 'integer', not_null => 1, sequence => 'id' },
20
  oe_id                   => { type => 'integer', not_null => 1 },
21
  order_value_periodicity => { type => 'varchar', length => 1, not_null => 1 },
22
  periodicity             => { type => 'varchar', length => 1, not_null => 1 },
23
  print                   => { type => 'boolean', default => 'false' },
24
  printer_id              => { type => 'integer' },
25
  start_date              => { type => 'date' },
26
  terminated              => { type => 'boolean', default => 'false' },
12
  active                     => { type => 'boolean', default => 'true' },
13
  ar_chart_id                => { type => 'integer', not_null => 1 },
14
  copies                     => { type => 'integer' },
15
  direct_debit               => { type => 'boolean', default => 'false', not_null => 1 },
16
  email_body                 => { type => 'text' },
17
  email_recipient_address    => { type => 'text' },
18
  email_recipient_contact_id => { type => 'integer' },
19
  email_sender               => { type => 'text' },
20
  email_subject              => { type => 'text' },
21
  end_date                   => { type => 'date' },
22
  extend_automatically_by    => { type => 'integer' },
23
  first_billing_date         => { type => 'date' },
24
  id                         => { type => 'integer', not_null => 1, sequence => 'id' },
25
  oe_id                      => { type => 'integer', not_null => 1 },
26
  order_value_periodicity    => { type => 'varchar', length => 1, not_null => 1 },
27
  periodicity                => { type => 'varchar', length => 1, not_null => 1 },
28
  print                      => { type => 'boolean', default => 'false' },
29
  printer_id                 => { type => 'integer' },
30
  send_email                 => { type => 'boolean', default => 'false', not_null => 1 },
31
  start_date                 => { type => 'date' },
32
  terminated                 => { type => 'boolean', default => 'false' },
27 33
);
28 34

  
29 35
__PACKAGE__->meta->primary_key_columns([ 'id' ]);
......
34 40
    key_columns => { ar_chart_id => 'id' },
35 41
  },
36 42

  
43
  email_recipient_contact => {
44
    class       => 'SL::DB::Contact',
45
    key_columns => { email_recipient_contact_id => 'cp_id' },
46
  },
47

  
37 48
  order => {
38 49
    class       => 'SL::DB::Order',
39 50
    key_columns => { oe_id => 'id' },
SL/OE.pm
805 805

  
806 806
    if ($config_obj) {
807 807
      my $config = { map { $_ => $config_obj->$_ } qw(active terminated periodicity order_value_periodicity start_date_as_date end_date_as_date first_billing_date_as_date extend_automatically_by ar_chart_id
808
                                                      print printer_id copies direct_debit) };
808
                                                      print printer_id copies direct_debit send_email email_recipient_contact_id email_recipient_address email_sender email_subject email_body) };
809 809
      $form->{periodic_invoices_config} = YAML::Dump($config);
810 810
    }
811 811
  }
bin/mozilla/oe.pl
2077 2077
  $::form->{AR}    = [ grep { $_->{link} =~ m/(?:^|:)AR(?::|$)/ } @{ $::form->{ALL_CHARTS} } ];
2078 2078
  $::form->{title} = $::locale->text('Edit the configuration for periodic invoices');
2079 2079

  
2080
  if ($::form->{customer_id}) {
2081
    $::form->{ALL_CONTACTS} = SL::DB::Manager::Contact->get_all_sorted(where => [ cp_cv_id => $::form->{customer_id} ]);
2082
  }
2083

  
2080 2084
  $::form->header(no_layout => 1);
2081 2085
  print $::form->parse_html_template('oe/edit_periodic_invoices_config', $config);
2082 2086

  
......
2105 2109
                 copies                  => $::form->{copies} * 1 ? $::form->{copies} : 1,
2106 2110
                 extend_automatically_by => $::form->{extend_automatically_by} * 1 || undef,
2107 2111
                 ar_chart_id             => $::form->{ar_chart_id} * 1,
2112
                 send_email                 => $::form->{send_email} ? 1 : 0,
2113
                 email_recipient_contact_id => $::form->{email_recipient_contact_id} * 1 || undef,
2114
                 email_recipient_address    => $::form->{email_recipient_address},
2115
                 email_sender               => $::form->{email_sender},
2116
                 email_subject              => $::form->{email_subject},
2117
                 email_body                 => $::form->{email_body},
2108 2118
               };
2109 2119

  
2110 2120
  $::form->{periodic_invoices_config} = YAML::Dump($config);
......
2214 2224

  
2215 2225
  $::form->error($::locale->text('No action defined.'));
2216 2226
}
2217

  
css/kivitendo/main.css
73 73
	height: 2px;
74 74
}
75 75

  
76
tr.rule-before th, tr.rule-before td {
77
  padding-top: 2px;
78
  border-top: 2px solid #EBEBEB;
79
}
80

  
76 81
/* I.E. & Chrome können das nicht! */
77 82
/* input[type="radio"], input[type="checkbox"]{
78 83
	width:1.15em;
js/edit_periodic_invoices_config.js
1 1
function edit_periodic_invoices_config() {
2
  var width     = 750;
3
  var height    = 550;
2
  var width     = 800;
3
  var height    = 650;
4 4
  var parm      = centerParms(width, height) + ",width=" + width + ",height=" + height + ",status=yes,scrollbars=yes";
5 5

  
6 6
  var config    = $('#periodic_invoices_config').val();
7
  var cus_id    = $('[name=customer_id]').val();
7 8
  var transdate = $('#transdate').val();
8 9

  
9 10
  var url       = "oe.pl?" +
10 11
    "action=edit_periodic_invoices_config&" +
12
    "customer_id="              + encodeURIComponent(cus_id) + "&" +
11 13
    "periodic_invoices_config=" + encodeURIComponent(config) + "&" +
12 14
    "transdate="                + encodeURIComponent(transdate || '');
13 15

  
locale/de/all
595 595
  'Contact is in use and was flagged invalid.' => 'Die Ansprechperson ist noch in Verwendung und wurde deshalb nur als ungültig markiert.',
596 596
  'Contact person (surname)'    => 'Ansprechperson (Nachname)',
597 597
  'Contact persons'             => 'Ansprechpersonen',
598
  'Contact to send to'          => 'An Ansprechperson schicken',
598 599
  'Contacts'                    => 'Ansprechpersonen',
599 600
  'Content'                     => 'Inhalt',
600 601
  'Continue'                    => 'Weiter',
......
1704 1705
  'More than one #1 found matching, please be more specific.' => 'Mehr als ein #1 wurde gefunden, bitte geben Sie den Namen genauer an.',
1705 1706
  'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
1706 1707
  'Multi mode not supported.'   => 'Multimodus wird nicht unterstützt.',
1708
  'Multiple addresses can be entered separated by commas.' => 'Mehrere Adressen können durch Kommata getrennt angegeben werden.',
1707 1709
  'MwSt. inkl.'                 => 'MwSt. inkl.',
1708 1710
  'Name'                        => 'Name',
1709 1711
  'Name and Street'             => 'Name und Straße',
......
1912 1914
  'Orphaned'                    => 'Nie benutzt',
1913 1915
  'Orphaned currencies'         => 'Verwaiste Währungen',
1914 1916
  'Other Matches'               => 'Andere Treffer',
1917
  'Other recipients'            => 'Weitere EmpfängerInnen',
1915 1918
  'Other users\' follow-ups'    => 'Wiedervorlagen anderer Benutzer',
1916 1919
  'Other values are ignored.'   => 'Andere Eingaben werden ignoriert.',
1917 1920
  'Others'                      => 'Andere',
......
2448 2451
  'Sellprice for price group \'#1\'' => 'Verkaufspreis für Preisgruppe \'#1\'',
2449 2452
  'Sellprice significant places' => 'Verkaufspreis: Nachkommastellen',
2450 2453
  'Semicolon'                   => 'Semikolon',
2454
  'Send invoice via email'      => 'Rechnung via E-Mail verschicken',
2451 2455
  'Send letter via e-mail'      => 'Brief via E-Mail verschicken',
2452 2456
  'Sender'                      => 'AbsenderIn',
2453 2457
  'Sending E-mail: '            => 'E-Mail versenden: ',
scripts/rose_auto_create_model.pl
73 73
    follow_ups                => { created_for_user => 'created_for_employee', created_by => 'created_by_employee', },
74 74
    follow_up_access          => { who => 'with_access', what => 'to_follow_ups_by', },
75 75

  
76
    periodic_invoices_configs => { oe_id => 'order' },
76
    periodic_invoices_configs => { oe_id => 'order', email_recipient_contact_id => 'email_recipient_contact' },
77 77
    reconciliation_links      => { acc_trans_id => 'acc_trans' },
78 78
  },
79 79
);
sql/Pg-upgrade2/periodic_invoices_send_email.sql
1
-- @tag: periodic_invoices_send_email
2
-- @description: Wiederkehrende Rechnungen automatisch per E-Mail verschicken
3
-- @depends: release_3_4_0
4
ALTER TABLE periodic_invoices_configs ADD COLUMN send_email                 BOOLEAN;
5
ALTER TABLE periodic_invoices_configs ADD COLUMN email_recipient_contact_id INTEGER;
6
ALTER TABLE periodic_invoices_configs ADD COLUMN email_recipient_address    TEXT;
7
ALTER TABLE periodic_invoices_configs ADD COLUMN email_sender               TEXT;
8
ALTER TABLE periodic_invoices_configs ADD COLUMN email_subject              TEXT;
9
ALTER TABLE periodic_invoices_configs ADD COLUMN email_body                 TEXT;
10

  
11
UPDATE periodic_invoices_configs SET send_email = FALSE;
12

  
13
ALTER TABLE periodic_invoices_configs ALTER COLUMN send_email SET DEFAULT FALSE;
14
ALTER TABLE periodic_invoices_configs ALTER COLUMN send_email SET NOT NULL;
15

  
16
ALTER TABLE periodic_invoices_configs
17
ADD FOREIGN KEY (email_recipient_contact_id) REFERENCES contacts (cp_id)
18
ON DELETE SET NULL;
templates/webpages/oe/edit_periodic_invoices_config.html
77 77
     <td valign="top">[% L.checkbox_tag("direct_debit", checked=direct_debit) %]</td>
78 78
    </tr>
79 79

  
80
    <tr>
80
    <tr class="rule-before">
81 81
     <th align="right">[%- LxERP.t8('Print automatically') %]</th>
82 82
     <td valign="top">
83 83
      [% L.checkbox_tag("print", onclick => "toggle_printer_id_ctrl()", checked => print) %]
......
95 95
     <th align="right">[%- LxERP.t8('Copies') %]</th>
96 96
     <td valign="top">[% L.input_tag("copies", copies, size => 6, disabled => !print) %]</td>
97 97
    </tr>
98

  
99
    <tr class="rule-before">
100
     <th align="right">[%- LxERP.t8("Send invoice via email") %]</th>
101
     <td>[% L.checkbox_tag("send_email", onclick => "toggle_send_email_ctrl()", checked=send_email) %]</td>
102
    </tr>
103

  
104
    <tr>
105
     <th align="right">[%- LxERP.t8("Contact to send to") %]</th>
106
     <td>[% L.select_tag("email_recipient_contact_id", ALL_CONTACTS, title_key="full_name_dep", value_key="cp_id", default=email_recipient_contact_id, with_empty=1, disabled=!send_email, style=style) %]</td>
107
    </tr>
108

  
109
    <tr>
110
     <th align="right">[%- LxERP.t8("Other recipients") %]<sup>3</sup></th>
111
     <td>[% L.input_tag("email_recipient_address", email_recipient_address, disabled=!send_email, style=style) %]</td>
112
    </tr>
113

  
114
    <tr>
115
     <th align="right">[%- LxERP.t8("Sender") %]</th>
116
     <td>[% L.input_tag("email_sender", email_sender, disabled=!send_email, style=style) %]</td>
117
    </tr>
118

  
119
    <tr>
120
     <th align="right">[%- LxERP.t8("Subject") %]</th>
121
     <td>[% L.input_tag("email_subject", email_subject, disabled=!send_email, style=style) %]</td>
122
    </tr>
123

  
124
    <tr>
125
     <th align="right" valign="top">[%- LxERP.t8("Message") %]</th>
126
     <td valign="top">[% L.textarea_tag("email_body", email_body, disabled=!send_email, rows=8, style=style) %]</td>
127
    </tr>
98 128
   </table>
99 129
  </p>
100 130

  
......
102 132

  
103 133
  <p>(1): [%- LxERP.t8('The end date is the last day for which invoices will possibly be created.') %]</p>
104 134
  <p>(2): [% LxERP.t8("If missing then the start date will be used.") %]</p>
135
  <p>(3): [% LxERP.t8("Multiple addresses can be entered separated by commas.") %]</p>
105 136

  
106 137
  [% L.hidden_tag('action', 'save_periodic_invoices_config') %]
107 138

  
......
118 149
      $('#printer_id').prop('disabled', disabled);
119 150
      $('#copies').prop('disabled', disabled);
120 151
    }
152

  
153
    function toggle_send_email_ctrl() {
154
      var disabled = !$('#send_email').prop('checked');
155
      $('#email_recipient_contact_id').prop('disabled', disabled);
156
      $('#email_recipient_address').prop('disabled', disabled);
157
      $('#email_from').prop('disabled', disabled);
158
      $('#email_subject').prop('disabled', disabled);
159
      $('#email_body').prop('disabled', disabled);
160
    }
121 161
    -->
122 162
 </script>

Auch abrufbar als: Unified diff