beginning of prospect/CRM/contact work
[freeside.git] / httemplate / edit / elements / edit.html
index 23d4db3..4935ddc 100644 (file)
@@ -409,7 +409,7 @@ Example:
 %       $label[0] = '/elements/tr-td-label.html';
 
         <% include( @label ) %>
-        <TD>
+        <TD COLSPAN="<% $f->{'colspan'} || 1 %>">
         <% include( @existing ) %>
         </TD>
 
@@ -465,7 +465,7 @@ Example:
 %     $label[0] = '/elements/tr-td-label.html';
 
       <% include( @label ) %>
-      <TD>
+      <TD COLSPAN="<% $f->{'colspan'} || 1 %>">
       <% include( @include ) %>
       </TD>
 
@@ -503,7 +503,7 @@ Example:
 
           // only spawn if we're the last element... return if not
 
-          var field_regex = /(\d+)$/;
+          var field_regex = /(\d+)(_[a-z]+)?$/;
           var match = field_regex.exec(what.name);
           if ( !match ) {
             alert(what.name + " didn't match?!");
@@ -574,6 +574,7 @@ Example:
 
           widget_cell.style.borderTop = "1px solid black";
           widget_cell.style.paddingTop = "3px";
+          widget_cell.colSpan = "<% $f->{'colspan'} || 1 %>"
 
           widget_cell.innerHTML = newrow;
 
@@ -677,7 +678,7 @@ Example:
 
 <BR>
 
-<INPUT TYPE="submit" ID="submit" VALUE="<% ( !$clone && $object->$pkey() ) ? "Apply changes" : "Add $opt{'name'}" %>">
+<INPUT TYPE="submit" ID="submit" VALUE="<% ( !$clone && $object->$pkey() ) ? "Apply changes" : "Add ". ( $opt{'name'} || $opt{'name_singular'} ) %>">
 
 </FORM>
 
@@ -745,7 +746,8 @@ if ( $cgi->param('error') ) {
   $qsearch{'extra_sql'} = ' AND '. $opt{'agent_clone_extra_sql'}
     if $opt{'agent_clone_extra_sql'};
 
-  $object = qsearchs({ %qsearch, 'hashref' => { $pkey => $clone } });
+  $object = qsearchs({ %qsearch, 'hashref' => { $pkey => $clone } })
+    or die "$pkey $clone not found in $table";
 
   &{$opt{'clone_callback'}}( $cgi, $object, $fields, \%opt )
     if $opt{'clone_callback'};
@@ -797,7 +799,7 @@ if ( $cgi->param('error') ) {
 
 $opt{action} ||= $object->$pkey() ? 'Edit' : 'Add';
 
-my $title = $opt{action}. ' '. $opt{name};
+my $title = $opt{action}. ' '. ( $opt{name} || $opt{'name_singular'} );
 
 my $viewall_url = $p . ( $opt{'viewall_dir'} || 'search' ) . "/$table.html";
 $viewall_url = $opt{'viewall_url'} if $opt{'viewall_url'};