[ic] ic jobs and scratch value from usertag - solved

Aaron Hazelton aaronmail at hazenet.net
Fri Dec 26 11:03:47 EST 2003


On Fri, 26 Dec 2003 16:43:52 +0100, Stefan Hornburg <racke at linuxia.de> 
wrote:

> On Fri, 26 Dec 2003 10:22:07 -0500
> Aaron Hazelton <aaronmail at hazenet.net> wrote:
>
>> On Thu, 25 Dec 2003 18:31:40 +0100, Stefan Hornburg <racke at linuxia.de>
>> wrote:
>>
>> > On Tue, 23 Dec 2003 12:37:12 -0500
>> > Aaron Hazelton <aaronmail at hazenet.net> wrote:
>> >
>> >> On Tue, 23 Dec 2003 11:05:39 -0500, Aaron Hazelton
>> >> <aaronmail at hazenet.net>
>> >> wrote:
>> >>
>> >> > On Mon, 22 Dec 2003 19:31:28 -0500, Aaron Hazelton
>> >> > <aaronmail at hazenet.net> wrote:
>> >> >
>> >> >> Hi all,
>> >> >>
>> >> >> IC 4.9.8
>> >> >>
>> >> >> I have driven myself crazy with this one, and am at a loss. I have
>> >> >> an IC cron job set up, and the [scratch email_body] value is 
>> either
>> >> >> not being set or displayed in this context.  code below for 
>> further
>> >> >> details. the exact same code produces the expected result when 
>> using
>> >> >> the 'test ITL snippet' page... and there are no errors.  I must be
>> >> >> missing something about how this type of value and the 'jobs' work
>> >> >> together or something.
>> >> >>
>> >> [snip code]
>> >> >>
>> >> >> TIA!
>> >> >>
>> >> >
>> >> > I have now also taken this block of code, which is tested and
>> >> > works as expected, and instead of enclosing it into a [tmp] value
>> >> > i have logged it to a text file, creating a new file at the
>> >> > beginning so that it is blank, then appending each subsequent entry
>> >> > to it if it exists, and then [include]'ing that file into the email
>> >> > that gets sent out.
>> >> >
>> >> > Again, this method also works as a test on the ITL page, and yet
>> >> > will not log anything to the file (although it is created) from
>> >> > the job.
>> >> >
>> >> [snip other stuff, below still applies]
>> >> >
>> >> > dumbfounded.
>> >> >
>> >>
>> >> ok, i have done more testing and finally narrowed down the problem
>> >> although i still cannot get it to work and it was the last thing
>> >> i expected.
>> >>
>> >> my usertag that is being called test dates and compares them and
>> >> then based on how they compare with each other and today, it may
>> >> or may not set $Scratch->{bill_it} = 1;  now, when i test the
>> >> user tag (an example is below) it works just as expected, but in
>> >> the context of the job, the scratch value never shows up.  what
>> >> i do not know is whether or not the usertag is even being executed
>> >> or what.  Any ideas on how i can test this further to determine
>> >> what is causing this strangeness?
>> >>
>> >> EXAMPLE ON A TEST PAGE:
>> >> [loop list="20031123 20031124"]
>> >> [billing-check start_date="[loop-code]"
>> >>                 last_billed=""
>> >>                 type="hosting"]
>> >> test scratch bill_it: [scratch bill_it]
>> >> [/loop]
>> >>
>> >> RESULTS FROM PAGE:
>> >> test scratch bill_it: 1 <- should be 1
>> >> test scratch bill_it:   <- should be blank
>> >>
>> >> RESULTS RUNNING SAME THING FROM JOB:
>> >> test scratch bill_it:   <- is blank
>> >> test scratch bill_it:
>> >>
>> >> any ideas? thanks!
>> >
>> > Can you please give more information about the UserTag ?
>> > Is it global or local (catalog) ?
>> > How do you set the scratch variable in the UserTag ?
>> >
>> > Bye
>> > 	Racke
>> >
>>
>> Hi Racke, this is a global usertag, located in
>> /usr/local/interchange-5/code/UserTag/billing_check.tag
>>
>> This is my first usertag, so please be kind :-) Basically it
>> is pretty simple, but since i am using Date::Calc, I cannot
>> do this in page.  At the top, i delete all of the affected
>> scratch variables. Then, after some calculations with the
>> given dates, I just test for the results of some comparisons
>> and then set the Scratch variables if desired.
>>
>> i.e.:
>>
>> $diff = Delta_Days($ys,$ms,$ds, $y,$m,$d);
>> if ( $diff == 0 )	# today is new bill date
>> {
>> 	$Scratch->{bill_it} = 1;
>> 	$Scratch->{rebill} = 1;
>> 	$Scratch->{next_bill} = $Tag->convert_date( { body => "$ys-$ms-$ds" } 
>> );
>> }
>>
>> .. and this continues on for many different comparisons to
>> figure out exactly what is going on with these dates, and
>> so there are several different sets of  if .. elsif ..else ..
>> like that.
>>
>> any ideas? thanks!
>
> Yes, you may try to use $::Scratch instead of $Scratch in global 
> usertags,
> at least for modifying the scratch namespace. At least it is done this 
> way
> in the most usertags shipped with IC.
>
> bye
> 	racke
>
>

thanks so much! i actually had looked at a couple of other usertags
but had not noticed that.  another quick fix if you know where to look.

thanks again. works great now.

-- 
Aaron Hazelton
Hazenet.net


More information about the interchange-users mailing list