Merge branch 'master' of github.com:kivitendo/kivitendo-erp
authorJan Büren <jan@kivitendo-premium.de>
Fri, 13 Dec 2013 13:00:45 +0000 (14:00 +0100)
committerJan Büren <jan@kivitendo-premium.de>
Fri, 13 Dec 2013 13:00:45 +0000 (14:00 +0100)
15 files changed:
SL/DB/DeliveryTerm.pm
SL/DB/Helper/Mappings.pm
SL/DB/MetaSetup/DeliveryTerm.pm
bin/mozilla/is.pl
js/jquery.checkall.js
locale/de/all
t/rdbo_consistency.t
templates/webpages/am/edit_units.html
templates/webpages/am/list_price_factors.html
templates/webpages/am/list_warehouses.html
templates/webpages/custom_variable_config/list.html
templates/webpages/customer_vendor/tabs/shipto.html
templates/webpages/delivery_term/list.html
templates/webpages/dunning/show_dunning_bottom.html
templates/webpages/payment_term/list.html

index 68c5d92..a6ee350 100644 (file)
@@ -1,6 +1,3 @@
-# This file has been auto-generated only because it didn't exist.
-# Feel free to modify it at will; it will not be overwritten automatically.
-
 package SL::DB::DeliveryTerm;
 
 use strict;
@@ -10,6 +7,7 @@ use SL::DB::Manager::DeliveryTerm;
 use SL::DB::Helper::ActsAsList;
 use SL::DB::Helper::TranslatedAttributes;
 
+__PACKAGE__->meta->initialize;
 
 sub validate {
   my ($self) = @_;
index e8dfb56..35d601d 100644 (file)
@@ -120,6 +120,7 @@ my %kivitendo_package_names = (
   delivery_orders                => 'delivery_order',
   delivery_order_items           => 'delivery_order_item',
   delivery_order_items_stock     => 'delivery_order_items_stock',
+  delivery_terms                 => 'delivery_term',
   department                     => 'department',
   drafts                         => 'draft',
   dunning                        => 'dunning',
index ebcc7ea..672aba1 100644 (file)
@@ -6,22 +6,20 @@ use strict;
 
 use base qw(SL::DB::Object);
 
-__PACKAGE__->meta->setup(
-  table   => 'delivery_terms',
+__PACKAGE__->meta->table('delivery_terms');
 
-  columns => [
-    id               => { type => 'integer', not_null => 1, sequence => 'id' },
-    description      => { type => 'text' },
-    description_long => { type => 'text' },
-    sortkey          => { type => 'integer', not_null => 1 },
-    itime            => { type => 'timestamp', default => 'now()' },
-    mtime            => { type => 'timestamp' },
-  ],
+__PACKAGE__->meta->columns(
+  description      => { type => 'text' },
+  description_long => { type => 'text' },
+  id               => { type => 'integer', not_null => 1, sequence => 'id' },
+  itime            => { type => 'timestamp', default => 'now()' },
+  mtime            => { type => 'timestamp' },
+  sortkey          => { type => 'integer', not_null => 1 },
+);
 
-  primary_key_columns => [ 'id' ],
+__PACKAGE__->meta->primary_key_columns([ 'id' ]);
 
-  allow_inline_column_values => 1,
-);
+__PACKAGE__->meta->allow_inline_column_values(1);
 
 1;
 ;
index e7515e1..d67aac5 100644 (file)
@@ -843,6 +843,9 @@ sub storno {
   if (IS->has_storno(\%myconfig, $form, "ar")) {
     $form->error($locale->text("Invoice has already been storno'd!"));
   }
+  if ($form->datetonum($form->{invdate},  \%myconfig) <= $form->datetonum($form->{closedto}, \%myconfig)) {
+    $form->error($locale->text('Cannot storno invoice for a closed period!'));
+  }
 
   map({ my $key = $_; delete($form->{$key}) unless (grep({ $key eq $_ } qw(id login password type))); } keys(%{ $form }));
 
index cef64ef..00798d8 100644 (file)
@@ -7,11 +7,11 @@
 ;(function($) {
 
 $.fn.extend({
-  checkall: function(target, property) {
+  checkall: function(target, property, inverted) {
     if (property == null)
       property = 'checked';
     return $(this).click(function() {
-      $(target).prop(property, $(this).prop('checked'));
+      $(target).prop(property, inverted ? !$(this).prop('checked') : $(this).prop('checked'));
     });
   }
 });
index ecaa55c..175623e 100755 (executable)
@@ -402,6 +402,7 @@ $self->{texts} = {
   'Cannot save order!'          => 'Auftrag kann nicht gespeichert werden!',
   'Cannot save preferences!'    => 'Einstellungen können nicht gespeichert werden!',
   'Cannot save quotation!'      => 'Angebot kann nicht gespeichert werden!',
+  'Cannot storno invoice for a closed period!' => 'Das Rechnungsdatum der zu stornierenden Rechnung fällt in einen abgeschlossen Zeitraum!',
   'Cannot storno storno invoice!' => 'Kann eine Stornorechnung nicht stornieren',
   'Cannot transfer. <br> Reason:<br>#1' => 'Kann nicht auslagern. <br>Grund:<br>#1',
   'Carry over shipping address' => 'Lieferadresse &uuml;bernehmen',
index 89d78a5..635585f 100644 (file)
@@ -23,6 +23,7 @@ my %no_metasetup_ok   = map { ($_ => 1) } qw(Object.pm VC.pm);
 my @dbs               = find_pms('SL/DB');
 my @metasetups        = find_pms('SL/DB/MetaSetup');
 my %metasetup_content = map { ($_ => scalar(read_file("SL/DB/MetaSetup/$_"))) } @metasetups;
+my %db_content        = map { ($_ => scalar(read_file("SL/DB/$_")))           } @dbs;
 my $all_content       = read_file('SL/DB/Helper/ALL.pm');
 my $mapping_content   = read_file('SL/DB/Helper/Mappings.pm');
 
@@ -78,10 +79,17 @@ sub test_metasetup_has_table_to_class_mapping {
   }
 }
 
+sub test_db_contains_meta_initialize {
+  foreach my $pm (grep { !m{^(?:Object|VC)\.pm$} } @dbs) {
+    ok($db_content{$pm} =~ m/\n__PACKAGE__->meta->initialize;/, "$pm contains __PACKAGE__->meta->initialize;");
+  }
+}
+
 test_db_has_metasetup();
 test_metasetup_has_db();
 test_db_included_in_all();
 test_use_in_all_exists_as_db();
 test_metasetup_has_table_to_class_mapping();
+test_db_contains_meta_initialize();
 
 done_testing();
index c8d6ae7..db3ae65 100644 (file)
@@ -83,7 +83,7 @@
  <table id="unit_list">
   <thead>
   <tr class="listheading">
-   <th align="center"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></th>
+   <th align="center"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></th>
    <th>[% 'Delete' | $T8 %]</th>
    <th>[% 'Unit' | $T8 %]</th>
    <th>[% 'Base unit' | $T8 %]</th>
@@ -97,7 +97,7 @@
   <tbody>
   [% FOREACH row = UNITS %]
    <tr class="listrow[% loop.count % 2 %]" id="unit_id_[% row.id %]">
-    <td align="center" class="dragdrop"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></td>
+    <td align="center" class="dragdrop"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></td>
     [% IF row.in_use %]
      <td>
       <input type="hidden" name="unchangeable_[% loop.count %]" value="1">
index 6b3757b..4e91ca3 100644 (file)
@@ -9,7 +9,7 @@
   <table width="100%" id="price_factor_list">
    <thead>
    <tr class="listheading">
-    <th align="center"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></th>
+    <th align="center"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></th>
     <th width="80%">[% 'Description' | $T8 %]</th>
     <th width="20%">[% 'Factor' | $T8 %]</th>
    </tr>
@@ -18,7 +18,7 @@
    <tbody>
    [% FOREACH factor = PRICE_FACTORS %]
    <tr class="listrow[% loop.count % 2 %]" id="price_factor_id_[% factor.id %]">
-    <td align="center" class="dragdrop"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></td>
+    <td align="center" class="dragdrop"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></td>
     <td><a href="[% url_base %]&action=edit_price_factor&id=[% HTML.url(factor.id) %]">[% HTML.escape(factor.description) %]</a></td>
     <td>[% HTML.escape(factor.factor) %]</td>
    </tr>
index 958913a..dde162c 100644 (file)
@@ -8,7 +8,7 @@
  <p>
   <table width="100%" id="warehouse_list">
    <tr class="listheading">
-    <th align="center"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></th>
+    <th align="center"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></th>
     <th width="70%">[% 'Description' | $T8 %]</th>
     <th width="20%">[% 'Number of bins' | $T8 %]</th>
     <th width="10%">[% 'Invalid' | $T8 %]</th>
@@ -16,7 +16,7 @@
 
    [% FOREACH warehouse = WAREHOUSES %]
    <tr class="listrow[% loop.count % 2 %]" id="warehouse_id_[% warehouse.id %]">
-    <td align="center" class="dragdrop"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></td>
+    <td align="center" class="dragdrop"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></td>
     <td><a href="[% url_base %]&action=edit_warehouse&id=[% HTML.url(warehouse.id) %]">[% HTML.escape(warehouse.description) %]</a></td>
     <td>[% HTML.escape(warehouse.number_of_bins) %]</td>
     <td>[% IF warehouse.invalid %][% 'Yes' | $T8 %][% ELSE %][% 'No' | $T8 %][% END %]</td>
index 74f90a2..1f26429 100644 (file)
@@ -11,7 +11,7 @@
  <table width="100%" id="cvarcfg_list">
   <thead>
    <tr class="listheading">
-    <th align="center"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></th>
+    <th align="center"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></th>
     <th width="20%">[% 'Name' | $T8 %]</th>
     <th width="20%">[% 'Description' | $T8 %]</th>
     <th width="20%">[% 'Type' | $T8 %]</th>
@@ -26,7 +26,7 @@
   <tbody>
    [%- FOREACH cfg = CONFIGS %]
     <tr class="listrow" id="cvarcfg_id_[% cfg.id %]">
-     <td align="center" class="dragdrop"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></td>
+     <td align="center" class="dragdrop"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></td>
 
      <td><a href="[% SELF.url_for(action='edit', module=SELF.module, id=cfg.id) %]">[% HTML.escape(cfg.name) %]</a></td>
 
index 0b238c3..8f49977 100644 (file)
@@ -59,7 +59,7 @@
       <th align="right" nowrap>[% 'Zipcode' | $T8 %]/[% 'City' | $T8 %]</th>
 
       <td>
-        [% L.input_tag('shipto.shiptozipcode', SELF.shipto.shiptostreet,  size = 5, maxlength = 75) %]
+        [% L.input_tag('shipto.shiptozipcode', SELF.shipto.shiptozipcode,  size = 5, maxlength = 75) %]
         [% L.input_tag('shipto.shiptocity', SELF.shipto.shiptocity,  size = 30, maxlength = 75) %]
       </td>
     </tr>
index b47f9d1..661e2da 100644 (file)
@@ -14,7 +14,7 @@
    <table id="delivery_term_list">
     <thead>
     <tr class="listheading">
-     <th align="center"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></th>
+     <th align="center"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></th>
      <th>[%- 'Description' | $T8 %]</th>
      <th>[%- 'Long Description' | $T8 %]</th>
     </tr>
@@ -23,7 +23,7 @@
     <tbody>
     [%- FOREACH delivery_term = DELIVERY_TERMS %]
     <tr class="listrow[% loop.count % 2 %]" id="delivery_term_id_[% delivery_term.id %]">
-     <td align="center" class="dragdrop"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></td>
+     <td align="center" class="dragdrop"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></td>
      <td>
       <a href="[% SELF.url_for(action => 'edit', id => delivery_term.id) %]">
        [%- HTML.escape(delivery_term.description) %]
index e7cad6f..f0b225e 100644 (file)
@@ -17,7 +17,7 @@
  </form>
  <script type='text/javascript'>
    $(function() {
-     $("select[name='language_id']").prop('disabled', $('#force_lang').prop('checked'));
-     $('#force_lang').checkall('select[name="language_id"]', 'disabled');
+     $("select[name='language_id']").prop('disabled', !$('#force_lang').prop('checked'));
+     $('#force_lang').checkall('select[name="language_id"]', 'disabled', 'inverted');
    });
  </script>
index 20533f6..41290c2 100644 (file)
@@ -14,7 +14,7 @@
    <table id="payment_term_list">
     <thead>
     <tr class="listheading">
-     <th align="center"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></th>
+     <th align="center"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></th>
      <th>[%- 'Description' | $T8 %]</th>
      <th>[%- 'Long Description' | $T8 %]</th>
      <th align="right">[%- 'Netto Terms' | $T8 %]</th>
@@ -26,7 +26,7 @@
     <tbody>
     [%- FOREACH payment_term = PAYMENT_TERMS %]
     <tr class="listrow[% loop.count % 2 %]" id="payment_term_id_[% payment_term.id %]">
-     <td align="center" class="dragdrop"><img src="image/updown.png" alt="[ LxERP.t8('reorder item') %]"></td>
+     <td align="center" class="dragdrop"><img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]"></td>
      <td>
       <a href="[% SELF.url_for(action => 'edit', id => payment_term.id) %]">
        [%- HTML.escape(payment_term.description) %]