[freeside-commits] freeside/httemplate/edit/elements edit.html, 1.32, 1.33

Ivan,,, ivan at wavetail.420.am
Sun Jan 25 15:58:27 PST 2009


Update of /home/cvs/cvsroot/freeside/httemplate/edit/elements
In directory wavetail.420.am:/tmp/cvs-serv18602/httemplate/edit/elements

Modified Files:
	edit.html 
Log Message:
fix one-time charges and package customization for employees who don't have 'Edit global package definition' ACL, RT#4668

Index: edit.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/elements/edit.html,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- edit.html	21 Jan 2009 02:02:09 -0000	1.32
+++ edit.html	25 Jan 2009 23:58:25 -0000	1.33
@@ -93,32 +93,18 @@
     #agent virtualization
     'agent_virt'       => 1,
     'agent_null_right' => 'Access Right Name',
-   
-    #run when re-displaying with an error
-    'error_callback' => sub { my( $cgi, $object, $fields_listref, $opt_hashref ) = @_; },
-   
-    #run when editing
-    'edit_callback' => sub { my( $cgi, $object, $fields_listref ) = @_; },
-   
-    # returns a hashref for the new object
-    'new_hashref_callback'
 
-    # returns the new object iself (otherwise, ->new is called)
-    'new_object_callback'
-   
-    #run when adding
-    'new_callback' => sub { my( $cgi, $object, $fields_listref, $optref ) = @_; },
+    'viewall_dir' => '', #'search' or 'browse', defaults to 'search'
 
-    #run when cloning
-    'clone_callback' => sub { my( $cgi, $object, $fields_listref, $optref ) = @_; },
-   
-    #run before display to return a different value
-    'value_callback' => sub { my( $columname, $value ) = @_; },
+    # overrides default popurl(1)."process/$table.html"
+    'post_url' => popurl(1).'process/something', 
 
-    #run before display to manipulate element of the 'fields' arrayref
-    'field_callback' => sub { my( $cgi, $object, $field_hashref ) = @_; },
+    #we're in a popup (no title/menu/searchboxes)
+    'popup' => 1,
 
-    'viewall_dir' => '', #'search' or 'browse', defaults to 'search'
+    ###
+    # HTML callbacks
+    ###
 
     'html_init'   => '', #after the header/menubar
 
@@ -136,12 +122,50 @@
     #at the very bottom (well, as low as you can go from here)
     'html_foot'  => '',
 
-    # overrides default popurl(1)."process/$table.html"
-    'post_url' => popurl(1).'process/something', 
+    ###
+    # initialization callbacks
+    ###
 
-    #we're in a popup (no title/menu/searchboxes)
-    'popup' => 1,
+    ###global callbacks
+
+    #always run if provided, after decoding long CGI "redirect=" responses but
+    # before object creation/search
+    # (useful if you have a long form that might trigger redirect= and you need
+    #  to do things with $cgi params - they're not decoded in the calling
+    #  <%init> block yet)
+    'begin_callback' = sub { my( $cgi, $fields_listref, $opt_hashref ) = @_; },
+
+    #always run, after the mode-specific object creation/search
+    'end_callback' = sub { my( $cgi, $object, $fields_listref, $opt_hashref ) = @_; },
+
+    ###mode-specific callbacks
+   
+    #run when re-displaying with an error
+    'error_callback' => sub { my( $cgi, $object, $fields_listref, $opt_hashref ) = @_; },
+   
+    #run when editing
+    'edit_callback' => sub { my( $cgi, $object, $fields_listref ) = @_; },
+   
+    # returns a hashref for the new object
+    'new_hashref_callback'
+
+    # returns the new object iself (otherwise, ->new is called)
+    'new_object_callback'
    
+    #run when adding
+    'new_callback' => sub { my( $cgi, $object, $fields_listref ) = @_; },
+
+    #run when cloning
+    'clone_callback' => sub { my( $cgi, $object, $fields_listref, $opt_hashref ) = @_; },
+
+    ###display callbacks
+
+    #run before display to return a different value
+    'value_callback' => sub { my( $columname, $value ) = @_; },
+
+    #run before display to manipulate element of the 'fields' arrayref
+    'field_callback' => sub { my( $cgi, $object, $field_hashref ) = @_; },
+
   );
 
 </%doc>
@@ -563,6 +587,9 @@
   $cgi = new CGI($pref);
 }
 
+&{$opt{'begin_callback'}}( $cgi, $fields, \%opt )
+  if $opt{'begin_callback'};
+
 my %qsearch = (
     'table'     => $table,
     'extra_sql' => ( $opt{'agent_virt'}
@@ -639,6 +666,9 @@
 
 }
 
+&{$opt{'end_callback'}}( $cgi, $object, $fields, \%opt )
+  if $opt{'end_callback'};
+
 $opt{action} ||= $object->$pkey() ? 'Edit' : 'Add';
 
 my $title = $opt{action}. ' '. $opt{name};



More information about the freeside-commits mailing list