Save and Add New (Expense)
-
In looking to quickly add new expenses without returning to list view, I added a button to the edit-payment screen and modified class-ajax to handle the addnew value in edit_payment function. This could obviously be added to all entry screens, possibly cleaner, but the presence of a second submit button cannot be distinguished in the $_REQUEST variables.
edit-payment.php: add field
eaccounting_hidden_input( array( 'name' => 'addnew' ) );
edit-payment.php: after submit button
<button type="button" name="submitnew" id="submitnew" class="button button-secondary">Save and Add Another</button>
edit-payment.php: in eaccounting_enqueue_js
jQuery('#ea-payment-form #submitnew').click(function(){ jQuery('#ea-payment-form #addnew').val(true); jQuery('#ea-payment-form').submit(); });
class-ajax.php: edit_payment() at line 874
$addnew = empty( $posted['addnew'] ) ? false : true; $redirect = ''; if ( ! $update ) { $message = __( 'Payment created successfully!', 'wp-ever-accounting' ); if ($addnew){ $redirect = eaccounting_clean( $referer ); }else{ $redirect = remove_query_arg( array( 'action' ), eaccounting_clean( $referer ) ); } }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Save and Add New (Expense)’ is closed to new replies.