Formulardaten für Datumsangabe gequoted, da hier sonst onBlur... im value stand.
[kivitendo-erp.git] / bin / mozilla / ct.pl
index de23197..706860a 100644 (file)
@@ -1262,7 +1262,11 @@ sub add_transaction {
 #  # /saving the history
   
   $form->isblank("name", $locale->text("Name missing!"));
-  &{"CT::save_$form->{db}"}("", \%myconfig, \%$form);
+  if ($form->{"db"} eq "customer") {
+    CT->save_customer(\%myconfig, \%$form);
+  } else {
+    CT->save_vendor(\%myconfig, \%$form);
+  }
 
   $form->{callback} = $form->escape($form->{callback}, 1);
   $name = $form->escape("$form->{name}", 1);
@@ -1280,6 +1284,7 @@ sub save_and_ap_transaction {
   $form->{script} = "ap.pl";
   # saving the history
   if(!exists $form->{addition}) {
+    $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
        $form->{addition} = "SAVED";
        $form->save_history($form->dbconnect(\%myconfig));
   }
@@ -1294,6 +1299,7 @@ sub save_and_ar_transaction {
   $form->{script} = "ar.pl";
   # saving the history
   if(!exists $form->{addition}) {
+    $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
        $form->{addition} = "SAVED";
        $form->save_history($form->dbconnect(\%myconfig));
   }
@@ -1309,6 +1315,7 @@ sub save_and_invoice {
   $form->{type} = "invoice";
   # saving the history
   if(!exists $form->{addition}) {
+    $form->{snumbers} = qq|invnumber_| . $form->{invnumber};
        $form->{addition} = "SAVED";
        $form->save_history($form->dbconnect(\%myconfig));
   }
@@ -1324,6 +1331,7 @@ sub save_and_rfq {
   $form->{type}   = "request_quotation";
   # saving the history
   if(!exists $form->{addition}) {
+    $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
        $form->{addition} = "SAVED";
        $form->save_history($form->dbconnect(\%myconfig));
   }
@@ -1339,6 +1347,7 @@ sub save_and_quotation {
   $form->{type}   = "sales_quotation";
   # saving the history
   if(!exists $form->{addition}) {
+    $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
        $form->{addition} = "SAVED";
        $form->save_history($form->dbconnect(\%myconfig));
   }
@@ -1355,6 +1364,7 @@ sub save_and_order {
     ($form->{db} eq 'customer') ? "sales_order" : "purchase_order";
   # saving the history
   if(!exists $form->{addition}) {
+    $form->{snumbers} = qq|ordnumber_| . $form->{ordnumber};
        $form->{addition} = "SAVED";
        $form->save_history($form->dbconnect(\%myconfig));
   }
@@ -1373,13 +1383,18 @@ sub save_and_close {
   $imsg .= " saved!";
 
   $form->isblank("name", $locale->text("Name missing!"));
-  $rc = &{"CT::save_$form->{db}"}("", \%myconfig, \%$form);
+  if ($form->{"db"} eq "customer") {
+    $rc = CT->save_customer(\%myconfig, \%$form);
+  } else {
+    $rc = CT->save_vendor(\%myconfig, \%$form);
+  }
   if ($rc == 3) {
     $form->error($locale->text('customernumber not unique!'));
   }
   # saving the history
   if(!exists $form->{addition}) {
-       $form->{addition} = "SAVED";
+    $form->{snumbers} = ($form->{"db"} eq "customer" ? qq|customernumber_| . $form->{customernumber} : qq|vendornumber_| . $form->{vendornumber});
+    $form->{addition} = "SAVED";
        $form->save_history($form->dbconnect(\%myconfig));
   }
   # /saving the history
@@ -1399,7 +1414,12 @@ sub save {
 
   $form->isblank("name", $locale->text("Name missing!"));
 
-  my $res = &{"CT::save_$form->{db}"}("", \%myconfig, \%$form);
+  my $res;
+  if ($form->{"db"} eq "customer") {
+    $res = CT->save_customer(\%myconfig, \%$form);
+  } else {
+    $res = CT->save_customer(\%myconfig, \%$form);
+  }
 
   if (3 == $res) {
     if ($form->{"db"} eq "customer") {
@@ -1410,6 +1430,7 @@ sub save {
   }
   # saving the history
   if(!exists $form->{addition}) {
+    $form->{snumbers} = ($form->{"db"} eq "customer" ? qq|customernumber_| . $form->{customernumber} : qq|vendornumber_| . $form->{vendornumber});
        $form->{addition} = "SAVED";
        $form->save_history($form->dbconnect(\%myconfig));
   }
@@ -1433,6 +1454,7 @@ sub delete {
   $msg .= " deleted!";
   # saving the history
   if(!exists $form->{addition}) {
+    $form->{snumbers} = ($form->{"db"} eq "customer" ? qq|customernumber_| . $form->{customernumber} : qq|vendornumber_| . $form->{vendornumber});
        $form->{addition} = "DELETED";
        $form->save_history($form->dbconnect(\%myconfig));
   }
@@ -1572,4 +1594,4 @@ sub get_delivery {
 
 }
 
-sub continue { &{ $form->{nextsub} } }
+sub continue { call_sub($form->{nextsub}); }