1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
<?php
namespace AutomateWoo\Actions\Subscriptions;
defined( 'ABSPATH' ) || exit;
/** * Change a subscription's end date. * * @since 5.5.17 */ class UpdateEndDate extends AbstractEditDateItem {
/** * @var string Date field name to update for this subscription. */ protected $date_field = 'end';
/** * @var string Subscription date to update. */ protected $subscription_date = 'end';
/** * Explain to store admin what this action does via a unique title and description. */ public function load_admin_details() { parent::load_admin_details(); $this->title = __( 'Update End Date', 'automatewoo' ); $this->description = __( 'Change a subscription\'s end date.', 'automatewoo' ); }
/** * Load the fields required for the action. */ public function load_fields() { $date_field = ( new \AutomateWoo\Fields\Date() ) ->set_required() ->set_name( 'new_end_date' ) ->set_title( __( 'New End Date', 'automatewoo' ) );
$time_field = ( new \AutomateWoo\Fields\Time() ) ->set_required() ->set_name( 'new_end_time' ) ->set_title( __( 'New End Time', 'automatewoo' ) );
$this->add_field( $date_field ); $this->add_field( $time_field ); }
/** * Get the note on the subscription to record the end date change. * * @param string $new_end_date End date. The return value of @see $this->get_object_for_edit(). */ protected function get_note( $new_end_date ) { return sprintf( /* translators: %1$s: workflow name, %2$s: new end date, %3$s: workflow ID */ __( '%1$s workflow run: updated end date to %2$s. (Workflow ID: %3$d)', 'automatewoo' ), $this->workflow->get_title(), $new_end_date, $this->workflow->get_id() ); } }
|