<?php
if ( ! function_exists( 'wpj_save_bank_job_proof_of_payment_action' ) ) {
	function wpj_save_bank_job_proof_of_payment_action( $oid = '', $attachments = '' ) {
		if ( ! is_demo_user() ) {
			$oid         = WPJ_Form::post( 'order_id', $oid );
			$attachments = WPJ_Form::post( 'hidden_files_bank_transfer_job_proof_attachments_' . $oid, $attachments );

			if ( $attachments ) {
				if ( ! $oid ) $oid = get_query_var( 'oid' );

				if ( $oid ) {
					$order = wpj_get_job_order_by_id( $oid );

					if ( $order ) {
						wpj_save_attachments( $attachments, $oid, 'bank_transfer_job_proof_attachments_' . $oid, 'edit', 'order' );
					}
				}
			}
		}

		if ( wpj_is_ajax_call() ) wp_die();
	}
}