[ic] check date in order.profiles

Andrei Gologan interchange-users@icdevgroup.org
Wed Aug 7 05:39:02 2002


> At 12:05 AM 8/7/2002 +0200, you wrote:
> >Hi
> >
> >this look quite hard , at least for me.
> >
> >What are the requirements:
> >
> >If someting is orderd, there is the posibility of putting in, a special
> >delivery date, lets say I order something today and want it delivered in
3
> >weeks on a birthday. This works so far.
> >
> >But I need to check that the date is not in the past, since it would not
> >make any sense. I figured out I have to put some kind of date checking
into
> >order.profiles but I dont know what or how to do it.... I am sitting on
this
> >over a day now.
> >
> >Any help or pointer would be greatly apreciated.
> >
> >Thank you
> >Andrei G
>
> I don't know if it will be of any use, but since you asked I put my
> "date_past" check routine up:
>
> http://www.icdevgroup.org/~danb
>
> [Warning: serious formatting problems, may cause blindness in those
> sensitive to ugly code ]
>
> As the name suggests, it makes sure it is a valid date (leap year, leap
> day, etc.), then it checks to make sure it is in the past (birthday) --
you
> would have to modify it to make it look for dates in the future.  It is
> also rather inclusive, i.e. 2-digit years allowed, 1-digit months/days,
etc.
>

This is good thank you, but it does not work ....

I have on checkout.html the date filed in format MM.DD.YYYY  lets say called
date_delivery I put an required=1 to this field. :

              [error name=date_delivery std_label="Delivery" required=1]
            <INPUT TYPE=text NAME=date_delivery VALUE="[value
date_delivery]" size="60" maxlength="60">


I put you code in order.profile as  a user-defined check routine right at
the beginning of the file.

than I put inside order.profile inside the Purchase_order (we only except
purchase orders)

__NAME__                            purchase_order
lname=required
address1=required
city=required
zip=required
country=required
[if value country =~ /^(US|CA)$/i]
        state=state_province
        zip=postcode
[/if]

date_delivery=date

&fatal = yes

&set = prof_po_accepted [var PO_ACCEPTED]
prof_po_accepted=required This site doesn't accept purchase orders. You
should not have been offered that option; please contact us.

&final = yes

__END__


But it does not do anything ..... Did I do anything wrong ?
Should I put it somewhere else ?

Thank you !!