]> git.decadent.org.uk Git - maypole.git/blobdiff - lib/Maypole/Model/CDBI/DFV.pm
applied patch from nicg : Modified DFV.pm to allow for multiple column primary keys
[maypole.git] / lib / Maypole / Model / CDBI / DFV.pm
index ded183fde396e24a5c74bc98b75b9cd37ef82743..ca3609c193578760322f983fc1eb0840426332ca 100644 (file)
@@ -152,10 +152,6 @@ sub do_edit : Exported {
   if (ref $errors) {
     # pass errors to template
     $r->template_args->{errors} = $errors;
-    foreach my $error (keys %$errors) {
-      $r->template_args->{errors}{ucfirst($error)} = $errors->{$error}
-    }
-
     # Set it up as it was:
     $r->template_args->{cgi_params} = $r->params;
     $r->template("edit");
@@ -185,8 +181,16 @@ sub _do_update {
 
 
   my $this_class_params = {};
+
+
+  # NG changes start here.
+  # Code below fails to handle multi col PKs
+  my @pks = $class->columns('Primary');
+
   foreach my $param ( $class->columns ) {
-    next if ($param eq $class->columns('Primary'));
+    # next if ($param eq $class->columns('Primary'));
+    next if grep {/^${param}$/} @pks;
+
     my $value = $r->params->{$param};
     next unless (defined $value);
     $this_class_params->{$param} = ( $value eq '' ) ?  undef : $value;