summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/add_global_usertag36
-rw-r--r--config/pikul_cost.tag11
2 files changed, 47 insertions, 0 deletions
diff --git a/config/add_global_usertag b/config/add_global_usertag
new file mode 100644
index 0000000..321d70f
--- /dev/null
+++ b/config/add_global_usertag
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+CONFDIR=__MVC_RELOCATE____MVC_CATROOT__/config
+TAGDIR=__MVC_RELOCATE____MVC_VENDROOT__/code/template_tag/__MVC_DEMOTYPE__
+
+die() {
+ echo $1
+ exit 1
+}
+
+cd $CONFDIR || die "Cannot find $CONFDIR to change to.";
+
+if [ "x`whoami`" = xroot ]
+then
+ ISROOT=1
+else
+ ISROOT=0
+fi
+
+if test -d $TAGDIR
+then
+ HASTAGDIR=1
+else
+ mkdir -p __MVC_RELOCATE____MVC_VENDROOT__/code/template_tag/__MVC_DEMOTYPE__ \
+ || die "Cannot make $TAGDIR"
+fi
+
+for f in *.tag
+do
+ if test -f __MVC_RELOCATE____MVC_VENDROOT__/usertag/$f
+ then
+ echo "$f appears to be in global usertag/ directory, skipping."
+ else
+ cp $f $TAGDIR || die "Cannot copy $f to $TAGDIR: $!"
+ fi
+done
diff --git a/config/pikul_cost.tag b/config/pikul_cost.tag
new file mode 100644
index 0000000..c8f1052
--- /dev/null
+++ b/config/pikul_cost.tag
@@ -0,0 +1,11 @@
+UserTag pikul_cost Order company provisions origin destination weight service
+UserTag pikul_cost Routine <<EOR
+sub {
+ my ($company, $provisions, $origin, $destination, $weight, $service) = @_;
+ use Pikul;
+ Pikul::init($company, $provisions);
+ my $cost = Pikul::cost($origin, $destination, $weight, $service);
+ Pikul::cleanup();
+ return $cost;
+}
+EOR