本文整理汇总了PHP中customer::verify_date_end方法的典型用法代码示例。如果您正苦于以下问题:PHP customer::verify_date_end方法的具体用法?PHP customer::verify_date_end怎么用?PHP customer::verify_date_end使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类customer
的用法示例。
在下文中一共展示了customer::verify_date_end方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
if (!$obj_customer->verify_id()) {
log_write("error", "process", "The customer you have attempted to edit - " . $obj_customer->id . " - does not exist in this system.");
}
}
// make sure we don't choose a customer name that has already been taken
if (!$obj_customer->verify_name_customer()) {
log_write("error", "process", "This customer name is already used for another customer - please choose a unique name.");
$_SESSION["error"]["name_customer-error"] = 1;
}
// make sure we don't choose a customer code that has already been taken
if (!$obj_customer->verify_code_customer()) {
log_write("error", "process", "This customer code is already used for another customer - please choose a unique code or leave blank for an automatically generated value.");
$_SESSION["error"]["name_customer-error"] = 1;
}
// don't allow a date closed to be set if there are active services belonging to this customer
if (!$obj_customer->verify_date_end()) {
log_write("error", "process", "You can not close this customer, as there are still active services on this account");
$_SESSION["error"]["date_end-error"] = 1;
}
//make sure each contact has a name
for ($i = 0; $i < $num_contacts; $i++) {
if (!$obj_customer->verify_name_contact($i)) {
log_write("error", "process", "Each contact must be given a name - please ensure each contact has been assigned a unique name");
error_flag_field("contact_" . $i);
log_debug("edit-process", "NO NAME ERROR FLAG: contact_" . $i);
}
}
//make sure each contact name is unique
for ($i = 0; $i < $num_contacts; $i++) {
$uniqueness = $obj_customer->verify_uniqueness_contact($i);
if ($uniqueness != "unique") {
示例2: customer
function set_customer_details($id, $code_customer, $name_customer, $name_contact, $contact_email, $contact_phone, $contact_fax, $date_start, $date_end, $tax_number, $tax_default, $address1_street, $address1_city, $address1_state, $address1_country, $address1_zipcode, $address2_street, $address2_city, $address2_state, $address2_country, $address2_zipcode, $discount)
{
log_debug("customers_manager", "Executing set_customer_details({$id}, values...)");
if (user_permissions_get("customers_write")) {
$obj_customer = new customer();
/*
Load SOAP Data
*/
$obj_customer->id = @security_script_input_predefined("int", $id);
$obj_customer->data["code_customer"] = @security_script_input_predefined("any", $code_customer);
$obj_customer->data["name_customer"] = @security_script_input_predefined("any", $name_customer);
$obj_customer->data["name_contact"] = @security_script_input_predefined("any", $name_contact);
$obj_customer->data["contact_phone"] = @security_script_input_predefined("any", $contact_phone);
$obj_customer->data["contact_fax"] = @security_script_input_predefined("any", $contact_fax);
$obj_customer->data["contact_email"] = @security_script_input_predefined("email", $contact_email);
$obj_customer->data["date_start"] = @security_script_input_predefined("date", $date_start);
$obj_customer->data["date_end"] = @security_script_input_predefined("date", $date_end);
$obj_customer->data["address1_street"] = @security_script_input_predefined("any", $address1_street);
$obj_customer->data["address1_city"] = @security_script_input_predefined("any", $address1_city);
$obj_customer->data["address1_state"] = @security_script_input_predefined("any", $address1_state);
$obj_customer->data["address1_country"] = @security_script_input_predefined("any", $address1_country);
$obj_customer->data["address1_zipcode"] = @security_script_input_predefined("any", $address1_zipcode);
$obj_customer->data["address2_street"] = @security_script_input_predefined("any", $address2_street);
$obj_customer->data["address2_city"] = @security_script_input_predefined("any", $address2_city);
$obj_customer->data["address2_state"] = @security_script_input_predefined("any", $address2_state);
$obj_customer->data["address2_country"] = @security_script_input_predefined("any", $address2_country);
$obj_customer->data["address2_zipcode"] = @security_script_input_predefined("any", $address2_zipcode);
$obj_customer->data["tax_number"] = @security_script_input_predefined("any", $tax_number);
$obj_customer->data["tax_default"] = @security_script_input_predefined("int", $tax_default);
$obj_customer->data["discount"] = @security_script_input_predefined("float", $discount);
foreach (array_keys($obj_customer->data) as $key) {
if ($obj_customer->data[$key] == "error") {
throw new SoapFault("Sender", "INVALID_INPUT");
}
}
/*
Error Handling
*/
// verify customer ID (if editing an existing customer)
if ($obj_customer->id) {
if (!$obj_customer->verify_id()) {
throw new SoapFault("Sender", "INVALID_ID");
}
}
// make sure we don't choose a customer name that has already been taken
if (!$obj_customer->verify_name_customer()) {
throw new SoapFault("Sender", "DUPLICATE_NAME_CUSTOMER");
}
// make sure we don't choose a customer code that has already been taken
if (!$obj_customer->verify_code_customer()) {
throw new SoapFault("Sender", "DUPLICATE_CODE_CUSTOMER");
}
// prevent a customer with active services from having an date_end value set
if (!$obj_customer->verify_date_end()) {
throw new SoapFault("Sender", "HAS_ACTIVE_SERVICES");
}
/*
Customer Contacts Handling
TODO: API Upgrade Required
Since the API spec is limited in order to retain backwards compatibility, we currently only get provided with the
primary contact details for the "account" contact entry.
This requires some cleverness to adjust the data structure to the new internal associative array, before calling update.
At a future stage, we need to extend the API specification to handle the new flexible contact capabilities.
*/
// ensure a default contact name is set
if (empty($obj_customer->data["name_contact"])) {
$obj_customer->data["name_contact"] = "Accounts";
}
if ($obj_customer->id) {
// existing customer - we need to load the contacts and then adjust the values in the
// primary records with the values provided by the API.
if (!$obj_customer->load_data_contacts()) {
throw new SoapFault("Sender", "UNEXPECTED_ACTION_ERROR");
}
// overwrite the accounts primary values
if (!empty($obj_customer->data["contacts"][0]["records"])) {
$obj_customer->data["contacts"][0]["contact"] = $obj_customer->data["name_contact"];
$set_email = 0;
$set_phone = 0;
$set_fax = 0;
// search and replace values for existing accounts records
for ($i = 0; $i < $obj_customer->data["contacts"][0]["num_records"]; $i++) {
if (!$set_email) {
if ($obj_customer->data["contacts"][0]["records"][$i]["type"] == "email") {
$obj_customer->data["contacts"][0]["records"][$i]["detail"] = $obj_customer->data["contact_email"];
$set_email = 1;
}
}
if (!$set_phone) {
if ($obj_customer->data["contacts"][0]["records"][$i]["type"] == "phone") {
$obj_customer->data["contacts"][0]["records"][$i]["detail"] = $obj_customer->data["contact_phone"];
$set_phone = 1;
}
}
if (!$set_fax) {
if ($obj_customer->data["contacts"][0]["records"][$i]["type"] == "fax") {
$obj_customer->data["contacts"][0]["records"][$i]["detail"] = $obj_customer->data["contact_fax"];
$set_fax = 1;
}
//.........这里部分代码省略.........