[docs] docs - edl modified ic_ecommerce.sdf
docs@interchange.redhat.com
docs@interchange.redhat.com
Wed Oct 31 17:48:01 2001
User: edl
Date: 2001-10-31 22:47:53 GMT
Modified: . ic_ecommerce.sdf
Log:
Updated stuff pertaining to the creation of custom order checks.
Revision Changes Path
1.3 +16 -8 docs/ic_ecommerce.sdf
rev 1.3, prev_rev 1.2
Index: ic_ecommerce.sdf
===================================================================
RCS file: /var/cvs/docs/ic_ecommerce.sdf,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ic_ecommerce.sdf 2001/10/31 00:58:11 1.2
+++ ic_ecommerce.sdf 2001/10/31 22:47:53 1.3
@@ -1,10 +1,10 @@
!init OPT_LOOK="akopia"; OPT_STYLE="manual"
-# $Id: ic_ecommerce.sdf,v 1.2 2001/10/31 00:58:11 edl Exp $
+# $Id: ic_ecommerce.sdf,v 1.3 2001/10/31 22:47:53 edl Exp $
!define DOC_NAME "Interchange Ecommerce Functions"
!define DOC_TYPE ""
!define DOC_CODE "ic_ecommerce"
-!define DOC_VERSION substr('$Revision: 1.2 $',11, -2)
+!define DOC_VERSION substr('$Revision: 1.3 $',11, -2)
!define DOC_STATUS "Draft"
!define DOC_PROJECT "Interchange"
!define DOC_URL "http://interchange.redhat.com/doc/ic_ecommerce.html"
@@ -1372,10 +1372,11 @@
> my($ref, $var, $val) = @_;
>
> if ($ref->{country} =~ /^(PT|portugal)$/i) {
-> return $val =~ /^\d\d\d\d$/ ? 1 : 0;
+> return $val =~ /^\d\d\d\d$/ ?
+> (1, $var, '') : (undef, $var, "not a Portugese postal code");
> }
> else {
-> return 1;
+> return (1, $var, '');
> }
> }
> }
@@ -1386,10 +1387,17 @@
> postcode=pt_postcode
-There must be an underscore preceding the routine name in this
-case. Very elaborate checks are possible, of course. If some user
-takes on the polyglot it would be appreciated if they contribute
-the routines.
+Very elaborate checks are possible. There must be an underscore
+preceding the routine name. The return value of the subroutine
+should be a three-element array, consisting of:
+^ the pass/fail ('1' or 'undef') status of the check;
++ the name of the variable which was checked;
++ a standard error message for the failure, in case a custom one has
+ not been specified in the order profile.
+
+The latter two elements are used by the C<[error]> tag for on-screen
+display of form errors. The checkout page of the Foundation demo includes
+examples of this.
=head2 Simple Order Report File