diff options
| author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-07-05 10:48:39 +0800 | 
|---|---|---|
| committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-07-05 10:48:39 +0800 | 
| commit | fa7eae39ea37cadd54dc54438d8ed91739621706 (patch) | |
| tree | 2f89f9b80f204e2169a876d752fae5034402911f | |
| parent | 74602ddddbb8d182e61813b87d9653d8ee829a56 (diff) | |
Pikul cost tag with its installer
| -rw-r--r-- | config/add_global_usertag | 36 | ||||
| -rw-r--r-- | config/pikul_cost.tag | 11 | 
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 |