我遇到的问题是从我们的网站连接到kashflow的脚本,当客户输入他们的订单并完成结账时,该网站应该连接到kashflow但是会出现以下错误。
注意:未定义的索引:$ Name in /home/expressn/public_html/ajax/kashflow/includes/kashflow.inc.php on 第73行
未处理的异常:客户名称不能为空
我们希望将客户名称显然为空白字符串缩小为以下代码?
有人会好心地告诉我需要做些什么才能解决这个问题吗?
public function insertCustomer($customer){
$parameters['custr'] = array(
"CustomerID" => 0,
"Code" => '',
"Name" => $customer['Name'],
"Contact" => '',
"Telephone" => $customer['Telephone'],
"Mobile" => '',
"Fax" => '',
"Email" => $customer['Email'],
"Address1" => $customer['Address1'],
"Address2" => $customer['Address2'],
"Address3" => $customer['Address3'],
"Address4" => $customer['Address4'],
"Postcode" => $customer['Postcode'],
"Website" => '',
"EC" => 0,
"OutsideEC" => 0,
"Notes" => '',
"Source" => $this->m_source,
"Discount" => 0,
"ShowDiscount" => 0,
"PaymentTerms" => 0,
"ExtraText1" => '',
"ExtraText2" => '',
"ExtraText3" => '',
"ExtraText4" => '',
"ExtraText5" => '',
"ExtraText6" => '',
"ExtraText7" => '',
"ExtraText8" => '',
"ExtraText9" => '',
"ExtraText10" => '',
"ExtraText11" => '',
"ExtraText12" => '',
"ExtraText13" => '',
"ExtraText14" => '',
"ExtraText15" => '',
"ExtraText16" => '',
"ExtraText17" => '',
"ExtraText18" => '',
"ExtraText19" => '',
"ExtraText20" => '',
"CheckBox1" => 0,
"CheckBox2" => 0,
"CheckBox3" => 0,
"CheckBox4" => 0,
"CheckBox5" => 0,
"CheckBox6" => 0,
"CheckBox7" => 0,
"CheckBox8" => 0,
"CheckBox9" => 0,
"CheckBox10" => 0,
"CheckBox11" => 0,
"CheckBox12" => 0,
"CheckBox13" => 0,
"CheckBox14" => 0,
"CheckBox15" => 0,
"CheckBox16" => 0,
"CheckBox17" => 0,
"CheckBox18" => 0,
"CheckBox19" => 0,
"CheckBox20" => 0,
"Created" => date( "Y-m-d\TH:i:s"),
"Updated" => date( "Y-m-d\TH:i:s"),
"CurrencyID" => 0,
"ContactTitle" => '',
"ContactFirstName" => '',
"ContactLastName" => '',
"CustHasDeliveryAddress" => 1,
"DeliveryAddress1" => $customer['delAddress1'],
"DeliveryAddress2" => $customer['delAddress2'],
"DeliveryAddress3" => $customer['delAddress3'],
"DeliveryAddress4" => $customer['delAddress4'],
"DeliveryPostcode" => $customer['delPostcode'],
"VATNumber" => ''
);
return $this->makeRequest("InsertCustomer",$parameters);
}
答案 0 :(得分:0)
您好我知道现在已经有一段时间了,但我也遇到了这个问题。
根据我的经验,强制性参数是:
'CustomerID'=>0, 'EC'=>0, 'OutsideEC'=>0, 'Source'=>0, 'Discount'=>0, 'ShowDiscount'=>0, 'PaymentTerms'=>0, 'CheckBox1'=>0, 'CheckBox2'=>0, 'CheckBox3'=>0, 'CheckBox4'=>0, 'CheckBox5'=>0, 'CheckBox6'=>0, 'CheckBox7'=>0, 'CheckBox8'=>0, 'CheckBox9'=>0, 'CheckBox10'=>0, 'CheckBox11'=>0, 'CheckBox12'=>0, 'CheckBox13'=>0, 'CheckBox14'=>0, 'CheckBox15'=>0, 'CheckBox16'=>0, 'CheckBox17'=>0, 'CheckBox18'=>0, 'CheckBox19'=>0, 'CheckBox20'=>0, 'Created'=> '', 'Updated'=>'', 'CurrencyID'=>0, 'Name'=>''
您用于密钥的情况也很重要,因此" EC"与" ec"不同。如果你没有经过身份验证,api也会返回一个空白对象,这可能会使它看起来好像它不工作。
因此,要检查的一件事是,您正在提供用户名' &安培; '密码'不是'用户名' &安培; '密码'另一件事是我发现https://securedwebapp.com/api/service.asmx<<这个文档比http://www.kashflow.com/developers/soap-api/<<这篇文档详细说明了如何调用API。