[interchange-cvs] interchange - heins modified 2 files

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Wed Apr 27 11:02:19 EDT 2005


User:      heins
Date:      2005-04-27 15:02:18 GMT
Modified:  code/UI_Tag write_shipping.coretag
Modified:  dist/lib/UI/pages/admin ship.html
Log:
* Update the hoary [write-shipping] tag so that it will work with the
  standard catalog by writing to the proper directory.

  It would be far better to have it write in the
  new tag: value format, but this will at least make it work.

* Change the [write-shipping] tag so it does a proper backup of
  the old file, not just "rename 'shipping.asc', 'shipping.asc.bak'".

* Update the shipping page so it checks the right file for changes.

Revision  Changes    Path
1.4       +14 -5     interchange/code/UI_Tag/write_shipping.coretag


rev 1.4, prev_rev 1.3
Index: write_shipping.coretag
===================================================================
RCS file: /var/cvs/interchange/code/UI_Tag/write_shipping.coretag,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- write_shipping.coretag	14 Feb 2005 00:42:53 -0000	1.3
+++ write_shipping.coretag	27 Apr 2005 15:02:18 -0000	1.4
@@ -1,18 +1,24 @@
 # Copyright 2002 Interchange Development Group (http://www.icdevgroup.org/)
 # Licensed under the GNU GPL v2. See file LICENSE for details.
-# $Id: write_shipping.coretag,v 1.3 2005/02/14 00:42:53 docelic Exp $
+# $Id: write_shipping.coretag,v 1.4 2005/04/27 15:02:18 mheins Exp $
 
 UserTag write-shipping Order      file
 UserTag write-shipping PosNumber  1
 UserTag write-shipping addAttr
-UserTag write-shipping Version    $Revision: 1.3 $
+UserTag write-shipping Version    $Revision: 1.4 $
 UserTag write-shipping Routine    <<EOR
 sub {
 	my ($file, $opt) = @_;
 	if(! $file) {
-		$file = $Vend::Cfg->{Special}{'shipping.asc'}
-			|| Vend::Util::catfile($Vend::Cfg->{ProductDir},'shipping.asc');
+		unless($file = $Vend::Cfg->{Special}{'shipping.asc'}) {
+			my $dir = $Vend::Cfg->{Shipping}{dir} || $Vend::Cfg->{ProductDir};
+			$file = Vend::Util::catfile($dir,'shipping.asc');
 	}
+	}
+
+	## This is set so the UI knows where to check for changes
+	$::Scratch->{ui_shipping_asc} = $file;
+
 	my $lines = $Vend::Cfg->{Shipping_line};
 	my @outlines;
 	for (@$lines) {
@@ -25,7 +31,10 @@
 		}
 		push @outlines, \@line;
 	}
-	rename($file, "$file.bak");
+
+	# Back the file up
+	$Tag->backup_file($file);
+
 	open(SHIPOUT, ">$file")
 		or die errmsg("Can't write shipping to %s: %s", $file, $!);
 	for(@outlines) {



2.7       +1 -1      interchange/dist/lib/UI/pages/admin/ship.html


rev 2.7, prev_rev 2.6
Index: ship.html
===================================================================
RCS file: /var/cvs/interchange/dist/lib/UI/pages/admin/ship.html,v
retrieving revision 2.6
retrieving revision 2.7
diff -u -r2.6 -r2.7
--- ship.html	23 Apr 2005 18:10:07 -0000	2.6
+++ ship.html	27 Apr 2005 15:02:18 -0000	2.7
@@ -49,7 +49,7 @@
 [if type=explicit
 	compare=|
 			[newer
-				source=__UI_PRODUCT_DIR__/shipping.asc
+				source="[either][scratch ui_shipping_asc][or]__UI_PRODUCT_DIR__/shipping.asc[/either]"
 				target=`"$Config->{ConfDir}/status.$Config->{CatalogName}"`
 				]
 			|]








More information about the interchange-cvs mailing list