@@ 117-137 (lines=21) @@ | ||
114 | * @throws \EE_Error |
|
115 | * @throws \EventEspresso\core\libraries\rest_api\Rest_Exception |
|
116 | */ |
|
117 | public static function spots_taken_pending_payment( $wpdb_row, $request, $controller ){ |
|
118 | if( ! is_array( $wpdb_row ) || ! isset( $wpdb_row[ 'Datetime.DTT_ID' ] ) ) { |
|
119 | throw new \EE_Error( |
|
120 | sprintf( |
|
121 | __( 'Cannot calculate spots_taken_pending_payment because the database row %1$s does not have an entry for "Datetime.DTT_ID"', 'event_espresso' ), |
|
122 | print_r( $wpdb_row, true ) |
|
123 | ) |
|
124 | ); |
|
125 | } |
|
126 | self::_verify_current_user_can( 'ee_read_registrations', 'spots_taken_pending_payment' ); |
|
127 | return \EEM_Registration::instance()->count( |
|
128 | array( |
|
129 | array( |
|
130 | 'Ticket.Datetime.DTT_ID' => $wpdb_row[ 'Datetime.DTT_ID' ], |
|
131 | 'STS_ID' => \EEM_Registration::status_id_pending_payment |
|
132 | ) |
|
133 | ), |
|
134 | 'REG_ID', |
|
135 | true |
|
136 | ); |
|
137 | } |
|
138 | } |
|
139 |
@@ 129-148 (lines=20) @@ | ||
126 | * @return int |
|
127 | * @throws \EE_Error |
|
128 | */ |
|
129 | public static function spots_taken( $wpdb_row, $request, $controller ){ |
|
130 | if( ! is_array( $wpdb_row ) || ! isset( $wpdb_row[ 'Event_CPT.ID' ] ) ) { |
|
131 | throw new \EE_Error( |
|
132 | sprintf( |
|
133 | __( 'Cannot calculate spots_taken because the database row %1$s does not have an entry for "Event_CPT.ID"', 'event_espresso' ), |
|
134 | print_r( $wpdb_row, true ) |
|
135 | ) |
|
136 | ); |
|
137 | } |
|
138 | return \EEM_Registration::instance()->count( |
|
139 | array( |
|
140 | array( |
|
141 | 'EVT_ID' => $wpdb_row[ 'Event_CPT.ID' ], |
|
142 | 'STS_ID' => \EEM_Registration::status_id_approved |
|
143 | ) |
|
144 | ), |
|
145 | 'REG_ID', |
|
146 | true |
|
147 | ); |
|
148 | } |
|
149 | ||
150 | ||
151 | ||
@@ 163-183 (lines=21) @@ | ||
160 | * @throws \EE_Error |
|
161 | * @throws \EventEspresso\core\libraries\rest_api\Rest_Exception |
|
162 | */ |
|
163 | public static function spots_taken_pending_payment( $wpdb_row, $request, $controller ){ |
|
164 | if( ! is_array( $wpdb_row ) || ! isset( $wpdb_row[ 'Event_CPT.ID' ] ) ) { |
|
165 | throw new \EE_Error( |
|
166 | sprintf( |
|
167 | __( 'Cannot calculate spots_taken_pending_payment because the database row %1$s does not have an entry for "Event_CPT.ID"', 'event_espresso' ), |
|
168 | print_r( $wpdb_row, true ) |
|
169 | ) |
|
170 | ); |
|
171 | } |
|
172 | self::_verify_current_user_can( 'ee_read_registrations', 'spots_taken_pending_payment' ); |
|
173 | return \EEM_Registration::instance()->count( |
|
174 | array( |
|
175 | array( |
|
176 | 'EVT_ID' => $wpdb_row[ 'Event_CPT.ID' ], |
|
177 | 'STS_ID' => \EEM_Registration::status_id_pending_payment |
|
178 | ) |
|
179 | ), |
|
180 | 'REG_ID', |
|
181 | true |
|
182 | ); |
|
183 | } |
|
184 | ||
185 | ||
186 |