|
stores customer with password. Returns true, if successful |
|
CUr |
Customer record |
passw |
Password |
|
external procedure WebHWStartMainPage(string);
external procedure WebHWStartPage();
external procedure WebHWEndPage();
external procedure WebLineStart();
external procedure WebLineEnd();
external procedure WebHWInfoCellError(string,string,string);
external procedure WebHWEditLine(string,string,string,string,Boolean);
external function Boolean GetNextCustNr(var string);
external function Boolean InterNetAddrTest(string);
external function Boolean CustomerWithEmailExists(string,string);
external function Boolean CeckVATNrMask(string,string,Integer);
external updating procedure CreateMailFromNewCur(record CUVc,string);
procedure WebHWPrintRegister()
begin
WebOutString("<form method=""post"" action=""");
WebOutLink("WebHWStoreCust.hal?sessionid=" & WebGetArg("sessionid"));
WebOutString(""">");
WebOutString("<table width=""100%"" border=""0"" cellpadding=""1"" cellspacing=""0"">");
WebHWEditLine(USetStr(20504) & " (*)","companyname","text",WebGetArg("companyname"),false);
WebHWEditLine(USetStr(20505) & " (*)","person","text",WebGetArg("person"),false);
WebHWEditLine(USetStr(20506) & " 1" & " (*)","address1","text",WebGetArg("address1"),false);
WebHWEditLine(USetStr(20506) & " 2","address2","text",WebGetArg("address2"),false);
WebHWEditLine(USetStr(20506) & " 3","address3","text",WebGetArg("address3"),false);
WebHWEditLine(USetStr(20506) & " 4","address4","text",WebGetArg("address4"),false);
WebHWEditLine(USetStr(20506) & " 5","address5","text",WebGetArg("address5"),false);
WebHWEditLine(USetStr(20507) & " (*)","orgnr","text",WebGetArg("orgnr"),false);
WebHWEditLine(USetStr(20508) & " (*)","phone","text",WebGetArg("phone"),false);
WebHWEditLine(USetStr(20509),"email","text",WebGetArg("email"),false);
WebHWEditLine(USetStr(20510),"fax","text",WebGetArg("fax"),false);
WebHWEditLine(USetStr(20511) & " (*)","passwd","password",WebGetArg("passwd"),false);
WebHWEditLine(USetStr(20552) & " (*)","passwd2","password",WebGetArg("passwd2"),false);
WebHWEditLine(USetStr(20512),"message","text",WebGetArg("message"),false);
WebHWEditLine(USetStr(20513),"","text","",false);
WebOutString("<tr valign=""top"">");
WebOutString("<td width=""28%""> </td>");
WebOutString("<td width=""72%"">");
WebOutString("<input type=""submit"" name=""" & USetStr(20514) & """ value=""Submit"">");
WebOutString("<input type=""reset"" name=""" & USetStr(20515) & """ value=""Reset"">");
WebOutString("</td>");
WebOutString("</tr>");
WebOutString("</table>");
WebOutString("</form>");
return;
end;
global
updating procedure WebHWStoreCust()
begin
record WebControlBlock WCr;
record CUVc CUr;
Boolean storef;
string 255 passw,passw2;
BlockLoad(WCr);
storef = true;
WebHWStartMainPage("companyname");
WebOutString("<table width=""100%"" border=""0"" cellpadding=""1"" cellspacing=""0"">");
WebLineStart;
RecordNew(CUr);
CUr.Name = WebGetArg("companyname");
if (nonblank(CUr.Name)) then begin
if (ReadFirstKey("Name",CUr,1,true)) then begin
WebHWInfoCellError(USetStr(20516),"100%","false");
WebLineEnd;
WebLineStart;
WebOutString("<td>");
WebHWPrintRegister;
storef = false;
end;
end;
CUr.VATNr = WebGetArg("orgnr");
if ((storef) and (nonblank(CUr.VATNr))) then begin
if (ReadFirstKey("VATNr",CUr,1,true)) then begin
WebHWInfoCellError(USetStr(20516),"100%","false");
WebLineEnd;
WebLineStart;
WebOutString("<td>");
WebHWPrintRegister;
storef = false;
end;
end;
if (storef) then begin
CUr.Name = WebGetArg("companyname");
CUr.Person = WebGetArg("person");
CUr.InvAddr0 = WebGetArg("address1");
CUr.InvAddr1 = WebGetArg("address2");
CUr.InvAddr2 = WebGetArg("address3");
CUr.InvAddr3 = WebGetArg("address4");
CUr.InvAddr4 = WebGetArg("address5");
CUr.VATNr = WebGetArg("orgnr");
CUr.eMail = WebGetArg("email");
CUr.Phone = WebGetArg("phone");
CUr.Fax = WebGetArg("fax");
CUr.PLCode = WCr.DefPLCode;
CUr.AllowLogin = 1;
CUr.CUType = 1;
CUr.Comment = WebGetArg("message");
if (GetNextCustNr(passw)) then begin end;
CUr.Code = passw;
passw = WebGetArg("passwd");
passw2 = WebGetArg("passwd2");
if (blank(CUr.Code)) then begin
WebHWInfoCellError(USetStr(20517),"100%","false");
WebLineEnd;
WebLineStart;
WebOutString("<td>");
WebHWPrintRegister;
storef = false;
goto LWebHWStoreCust;
end;
if ((blank(CUr.Name)) or
(blank(CUr.Person)) or
(blank(CUr.VATNr)) or
(blank(CUr.Phone)) or
(blank(CUr.InvAddr0)) or
(blank(passw)) or
(blank(passw2))) then begin
WebHWInfoCellError(USetStr(20518),"100%","false");
WebLineEnd;
WebLineStart;
WebOutString("<td>");
WebHWPrintRegister;
storef = false;
goto LWebHWStoreCust;
end;
if (nonblank(CUr.eMail)) then begin
if (InterNetAddrTest(CUr.eMail)==false) then begin
WebHWInfoCellError(USetStr(2289),"100%","false");
WebLineEnd;
WebLineStart;
WebOutString("<td>");
WebHWPrintRegister;
storef = false;
goto LWebHWStoreCust;
end;
if (CustomerWithEmailExists("",CUr.eMail)) then begin
WebHWInfoCellError(USetStr(20766) & ": " & CUr.eMail,"100%","false");
WebLineEnd;
WebLineStart;
WebOutString("<td>");
WebHWPrintRegister;
storef = false;
goto LWebHWStoreCust;
end;
end;
if (CeckVATNrMask(CUr.VATNr,CUr.CountryCode,CUr.CustType)==false) then begin
WebHWInfoCellError(USetStr(1705) & ": " & CUr.VATNr,"100%","false");
WebLineEnd;
WebLineStart;
WebOutString("<td>");
WebHWPrintRegister;
storef = false;
goto LWebHWStoreCust;
end;
if (passw<>passw2) then begin
WebHWInfoCellError("Passwords doesn't match !","100%","false");
WebLineEnd;
WebLineStart;
WebOutString("<td>");
WebHWPrintRegister;
storef = false;
goto LWebHWStoreCust;
end;
end;
LWebHWStoreCust:;
if (storef) then begin
storef = WebStoreCust(CUr,passw);
WebHWInfoCellError(USetStr(20519) & " " & CUr.Code,"100%","false");
CreateMailFromNewCur(CUr,passw);
end else begin
WebOutString("</td>");
end;
WebLineEnd;
WebOutString("</table>");
WebHWEndPage;
return;
end;
|
««