[ic] Consignment Tracking - A Gift & A Problem

Stefan Hornburg racke at linuxia.de
Wed Dec 15 05:03:19 EST 2004


On Wed, 15 Dec 2004 09:36:05 -0000
"Adrian P Wilkinson" <junk at puffin.org> wrote:

> Dear All,
> 
> For those of you that have noticed that consignment tracking disappeared 
> from check_orders.html with the 'standard' demo, you might want to consider 
> the following simple modifcation around line 326:
> 
>         <td>
>           [display table=transactions type=display col=status 
> key="[sql-code]"]
>           <br>[&nbsp;<a href="/go/parceltrack.cgi?[sql-param 
> tracking_number]">Track</a>&nbsp;]
>         </td>
> 
> I'm yet to put any kind of check to see if there is a tracking_number 
> present in the transactions table as that's something to do a little later.
> 
> The problem is with the parcel tracking script I've written.  The tracking 
> number entered is in the form of AA-11111111 where 'AA' is a code to 
> represent a service offered by a particular courier company.  "BP" is 
> Business Post Next Day and "SD" is Royal Mail Special Delivery, for example.
> 
> What is happening is that when it tries to work out who the parcel has been 
> sent with, it doesn't always pick the correct one:
> 
> if ( $CARRIERCODE eq "BP" )
> {
>         $CARRIERNAME = "Business Post";
>         $CARRIERSERV = "Next Day";
>         $CARRIERURL = "http://www.businesspost.com/";
>         $TRACKURL = 
> "http://www.business-post.com/scripts/wsisa.dll/ws_quickpod.html?lc_SearchValue=$CONSIGNMENT";
>         goto pagebody;
> }
> 
> if ( $CARRIERCODE eq "SD" )
> {
>         $CARRIERNAME = "Royal Mail";
>         $CARRIERSERV = "Special Delivery";
>         $CARRIERURL = "www.royalmail.com";
>         goto pagebody;
> }
> 
> if ( $CARRIERCODE eq "CL" )
> {
>         $CARRIERNAME = "Initial CityLink";
>         $CARRIERSERV = "Next Day";
>         $CARRIERURL = "www.city-link.co.uk";
>         $TRACKURL = 
> "http://www.city-link.co.uk/pod/podfrm.php?JobNo=$CONSIGNMENT";
>         goto pagebody;
> }
> 
> I've tried matching using "eq" and "==" but it seems to just decide to pick 
> one at random.  Any suggestions how I can get it to match $CARRIERCODE 
> (created by taking the first two characters of the string passed) against 
> the above criteria correctly every time?

eq should be correct for matching strings. I don't have an idea why this
doesn't work. However, using "goto" within a condition causes me a shudder. 
Perl is not a basic dialect at all :-/.

Bye
	Racke


-- 
LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team



More information about the interchange-users mailing list