Webdav: Die Links werden nicht mehr wortwörtlich angezeigt, sondern der Typ (Datei...
[kivitendo-erp.git] / bin / mozilla / is.pl
index 815f790..b603f77 100644 (file)
@@ -169,10 +169,6 @@ sub invoice_links {
 
   $form->{oldcustomer} = "$form->{customer}--$form->{customer_id}";
 
-  if (@{ $form->{all_customer} }) {
-     $form->{customer} = "$form->{customer}--$form->{customer_id}";
-  }
-
   # departments
   if ($form->{all_departments}) {
     $form->{selectdepartment} = "<option>\n";
@@ -283,6 +279,13 @@ sub prepare_invoice {
 sub form_header {
   $lxdebug->enter_sub();
 
+  if ($form->{old_employee_id}) {
+    $form->{employee_id} = $form->{old_employee_id};
+  }
+  if ($form->{old_salesman_id}) {
+    $form->{salesman_id} = $form->{old_salesman_id};
+  }
+
   if ($edit) {
 
     if ($form->{type} eq "credit_note") {
@@ -299,7 +302,7 @@ sub form_header {
       }
     }
   }
-
+  $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
   $form->{radier} =
     ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0;
 
@@ -920,9 +923,23 @@ sub form_footer {
              </tr>
            </table>
          </td>
-         <td align="right" width="100%">
+          <td>
+            <table>
+            <tr>
+              <th  align=left>| . $locale->text('Ertrag') . qq|</th>
+              <td>| .  $form->format_amount(\%myconfig, $form->{marge_total}, 2, 0) . qq|</td>
+            </tr>
+            <tr>
+              <th  align=left>| . $locale->text('Ertrag prozentual') . qq|</th>
+              <td>| .  $form->format_amount(\%myconfig, $form->{marge_percent}, 2, 0) . qq| %</td>
+            </tr>
+            <input type=hidden name="marge_total" value="$form->{"marge_total"}">
+            <input type=hidden name="marge_percent" value="$form->{"marge_percent"}">
+            </table>
+          </td>
+         <td align="right">
            $taxincluded
-           <table width="100%">
+           <table>
              $subtotal
              $tax
              <tr>
@@ -948,11 +965,11 @@ sub form_footer {
       <td align="left" width="30%"><b>Dateiname</b></td>
       <td align="left" width="70%"><b>Webdavlink</b></td>
 |;
-    foreach $file (keys %{ $form->{WEBDAV} }) {
+    foreach $file (@{ $form->{WEBDAV} }) {
       $webdav_list .= qq|
       <tr>
-        <td align="left">$file</td>
-        <td align="left"><a href="$form->{WEBDAV}{$file}">$form->{WEBDAV}{$file}</a></td>
+        <td align="left">$file->{name}</td>
+        <td align="left"><a href="$file->{link}">$file->{type}</a></td>
       </tr>
 |;
     }
@@ -1028,6 +1045,9 @@ if ($form->{type} eq "credit_note") {
     $form->{"exchangerate_$i"} =
       $form->format_amount(\%myconfig, $form->{"exchangerate_$i"});
 
+    if ($form->{"exchangerate_$i"} == 0) {
+      $form->{"exchangerate_$i"} = "";
+    }
     $exchangerate = qq|&nbsp;|;
     if ($form->{currency} ne $form->{defaultcurrency}) {
       if ($form->{"forex_$i"}) {
@@ -1165,11 +1185,16 @@ if ($form->{type} eq "credit_note") {
          . Q($form->{id})
          . qq|);" name="history" id="history" value="|
          . $locale->text('history')
-         . qq|">|;
+         . qq|"> |;
   }
   # /button for saving history
-
-
+  
+  # mark_as_paid button 
+  if($form->{id} ne "") {  
+    print qq|<input type="submit" class="submit" name="action" value="| 
+          . $locale->text('mark as paid') . qq|">|;
+  }
+  # /mark_as_paid button
   print $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers) .
     qq|
 
@@ -1190,6 +1215,12 @@ print qq|
   $lxdebug->leave_sub();
 }
 
+sub mark_as_paid {
+  $lxdebug->enter_sub();
+  &mark_as_paid_common(\%myconfig,"ar");  
+  $lxdebug->leave_sub();
+}
+
 sub update {
   $lxdebug->enter_sub();
 
@@ -1365,6 +1396,8 @@ sub update {
 
 sub post_payment {
   $lxdebug->enter_sub();
+
+  $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
   for $i (1 .. $form->{paidaccounts}) {
     if ($form->{"paid_$i"}) {
       $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig);
@@ -1396,6 +1429,8 @@ sub post_payment {
 
 sub post {
   $lxdebug->enter_sub();
+
+  $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
   $form->isblank("invdate",  $locale->text('Invoice Date missing!'));
   $form->isblank("customer", $locale->text('Customer missing!'));
 
@@ -1440,8 +1475,9 @@ sub post {
     }
   }
 
-  ($form->{AR})      = split /--/, $form->{AR};
-  ($form->{AR_paid}) = split /--/, $form->{AR_paid};
+  ($form->{AR})        = split /--/, $form->{AR};
+  ($form->{AR_paid})   = split /--/, $form->{AR_paid};
+  $form->{storno}    ||= 0;
 
   $form->{label} = $locale->text('Invoice');
 
@@ -1539,7 +1575,6 @@ sub preview {
   $form->{preview} = 1;
   $old_form = new Form;
   for (keys %$form) { $old_form->{$_} = $form->{$_} }
-  $old_form->{rowcount}++;
 
   &print_form($old_form);
   $lxdebug->leave_sub();