communigate (phase 2): rules. RT#7514
[freeside.git] / httemplate / edit / REAL_cust_pkg.cgi
index 270ffa3..77ab1fe 100755 (executable)
@@ -47,7 +47,7 @@
   </TR>
 
 % if ( $cust_pkg->setup && ! $cust_pkg->start_date ) {
-  <& .row_display, cust_pkg=>$cust_pkg, column=>'start',   label=>'Start' &>
+  <& .row_display, cust_pkg=>$cust_pkg, column=>'start_date',   label=>'Start' &>
 % } else {
   <& .row_edit, cust_pkg=>$cust_pkg, column=>'start_date', label=>'Start' &>
 % }
@@ -94,7 +94,7 @@
   <SCRIPT TYPE="text/javascript">
     Calendar.setup({
       inputField: "<% $column %>_text",
-      ifFormat:   "%m/%d/%Y",
+      ifFormat:   "<% $date_format %>",
       button:     "<% $column %>_button",
       align:      "BR"
     });
 </FORM>
 
 <% include('/elements/footer.html') %>
+<%shared>
 
-<%once>
+my $conf = new FS::Conf;
+my $date_format = $conf->config('date_format') || '%m/%d/%Y';
 
-#my $format = "%c %z (%Z)";
-my $format = "%m/%d/%Y %T %z (%Z)";
+my $format = $date_format. ' %T %z (%Z)';
 
-#false laziness w/view/cust_main/packages.html
-#my( $billed_or_prepaid,
-
-</%once>
+</%shared>
 <%init>
 
 die "access denied"
   unless $FS::CurrentUser::CurrentUser->access_right('Edit customer package dates');
 
+
 my $error = '';
 my( $pkgnum, $cust_pkg );
 
@@ -188,9 +187,9 @@ if ( $cgi->param('error') ) {
   $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
   die "No package!" unless $cust_pkg;
 
-  foreach my $col (qw( setup last_bill bill adjourn expire )) {
+  foreach my $col (qw( start_date setup last_bill bill adjourn expire )) {
     my $value = $cgi->param($col);
-    $cust_pkg->set( $col, $value ? str2time($value) : '' );
+    $cust_pkg->set( $col, $value ? parse_datetime($value) : '' );
   }
 
 } else {