[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[4867] branches/1.3



Revision: 4867
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4867&view=rev
Author:   einhverfr
Date:     2012-06-08 07:15:48 +0000 (Fri, 08 Jun 2012)
Log Message:
-----------
Editing localized template now falls back to default if not found.  Note that directories still need write permission to save templates

Modified Paths:
--------------
    branches/1.3/LedgerSMB/AM.pm
    branches/1.3/bin/am.pl

Modified: branches/1.3/LedgerSMB/AM.pm
===================================================================
--- branches/1.3/LedgerSMB/AM.pm	2012-06-08 02:15:30 UTC (rev 4866)
+++ branches/1.3/LedgerSMB/AM.pm	2012-06-08 07:15:48 UTC (rev 4867)
@@ -1543,8 +1543,11 @@
     $self->check_template_name( \%$myconfig, \%$form );
     open( TEMPLATE, '<', "$form->{file}" ) || ($testval = 1);
     if ($testval == 1 && ($! eq 'No such file or directory')){
-      $form->error('Template not found.  
-         Perhaps you meant to edit the default template instead?');
+      my $file = $form->{file};
+      $file =~ s|$form->{code}/||;
+      open( TEMPLATE, '<', "$file" ) ||  $form->error(
+                    "Template not found: $file"
+      );
     } elsif ($testval == 1){
        $form->error("$form->{file} : $!");
     }

Modified: branches/1.3/bin/am.pl
===================================================================
--- branches/1.3/bin/am.pl	2012-06-08 02:15:30 UTC (rev 4866)
+++ branches/1.3/bin/am.pl	2012-06-08 07:15:48 UTC (rev 4867)
@@ -1372,7 +1372,7 @@
 s/<%include (.*?)%>/<a href=$form->{script}\?action=display_form&file=$myconfig{templates}\/$form->{code}\/$1&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}>$1<\/a>/g;
 
     $form->{type} = "template";
-    $hiddens{$_} = $form->{$_} foreach qw(file type path login sessionid);
+    $hiddens{$_} = $form->{$_} foreach qw(file type path login sessionid code);
 
 ##SC: Temporary commenting
 ##    if ( $form->{lynx} ) {
@@ -1407,7 +1407,7 @@
     $form->{body} =~ s/&nbsp;/&amp;nbsp;/gi;
 
     $hiddens{type} = 'template';
-    $hiddens{$_} = $form->{$_} foreach qw(file path login sessionid);
+    $hiddens{$_} = $form->{$_} foreach qw(file path login sessionid code);
     $hiddens{callback} = qq|$form->{script}?action=display_form&file=$form->{file}&path=$form->{path}&login=$form->{login}&sessionid=$form->{sessionid}|;
 
 ##SC: Temporary commenting

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.