Esempio n. 1
0
								<div class="inside">
									<div class="give-admin-box">

										<?php 
do_action('give_view_order_details_totals_before', $payment_id);
?>

										<div class="give-admin-box-inside">
											<p>
												<span class="label"><?php 
_e('Status:', 'give');
?>
</span>&nbsp;
												<select name="give-payment-status" class="medium-text">
													<?php 
foreach (give_get_payment_statuses() as $key => $status) {
    ?>
														<option value="<?php 
    echo esc_attr($key);
    ?>
"<?php 
    selected(give_get_payment_status($item, true), $status);
    ?>
><?php 
    echo esc_html($status);
    ?>
</option>
													<?php 
}
?>
												</select>
Esempio n. 2
0
/**
 * Renders the 'Export' tab on the Reports Page
 *
 * @since 1.0
 * @return void
 */
function give_reports_tab_export()
{
    ?>
	<div id="give-dashboard-widgets-wrap">
		<div id="post-body">
			<div id="post-body-content">

				<?php 
    do_action('give_reports_tab_export_content_top');
    ?>


				<table class="widefat export-options-table give-table">
					<thead>
					<tr>
						<th class="row-title"><?php 
    _e('Export Type', 'give');
    ?>
</th>
						<th><?php 
    _e('Export Options', 'give');
    ?>
</th>
					</tr>
					</thead>
					<tbody>
					<?php 
    do_action('give_reports_tab_export_table_top');
    ?>
					<tr class="give-export-pdf-sales-earnings">
						<td class="row-title">
							<h3><span><?php 
    _e('Export PDF of Donations and Income', 'give');
    ?>
</span></h3>

							<p><?php 
    _e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give');
    ?>
</p>
						</td>
						<td>
							<a class="button" href="<?php 
    echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf');
    ?>
"><?php 
    _e('Generate PDF', 'give');
    ?>
</a>
						</td>
					</tr>
					<tr class="alternate give-export-sales-earnings">
						<td class="row-title">
							<h3><span><?php 
    _e('Export Income and Donation Stats', 'give');
    ?>
</span></h3>

							<p><?php 
    _e('Download a CSV of income and donations over time.', 'give');
    ?>
</p>
						</td>
						<td>
							<form method="post">
								<?php 
    echo Give()->html->year_dropdown('start_year');
    ?>
								<?php 
    echo Give()->html->month_dropdown('start_month');
    ?>
								<?php 
    echo _x('to', 'Date one to date two', 'give');
    ?>
								<?php 
    echo Give()->html->year_dropdown('end_year');
    ?>
								<?php 
    echo Give()->html->month_dropdown('end_month');
    ?>
								<input type="hidden" name="give-action" value="earnings_export" />
								<input type="submit" value="<?php 
    _e('Generate CSV', 'give');
    ?>
" class="button-secondary" />
							</form>
						</td>
					</tr>
					<tr class="give-export-payment-history">
						<td class="row-title">
							<h3><span><?php 
    _e('Export Donation History', 'give');
    ?>
</span></h3>

							<p><?php 
    _e('Download a CSV of all donations recorded.', 'give');
    ?>
</p>
						</td>
						<td>

							<form method="post">
								<?php 
    echo Give()->html->year_dropdown();
    ?>
								<?php 
    echo Give()->html->month_dropdown();
    ?>
								<select name="give_export_payment_status">
									<option value="0"><?php 
    _e('All Statuses', 'give');
    ?>
</option>
									<?php 
    $statuses = give_get_payment_statuses();
    foreach ($statuses as $status => $label) {
        echo '<option value="' . $status . '">' . $label . '</option>';
    }
    ?>
								</select>
								<input type="hidden" name="give-action" value="payment_export" />
								<input type="submit" value="<?php 
    _e('Generate CSV', 'give');
    ?>
" class="button-secondary" />
							</form>

						</td>
					</tr>
					<tr class="alt give-export-donors">
						<td class="row-title">
							<h3><span><?php 
    _e('Export Donors in CSV', 'give');
    ?>
</span></h3>

							<p><?php 
    _e('Download a CSV of all donors\' emails. Optionally export only donors that have donated to a particular form. Note: if you have a large number of donors, exporting the donation stats may fail.', 'give');
    ?>
</p>
						</td>
						<td>
							<form method="post" id="give_donor_export">
								<select name="give_export_download" id="give_donor_export_download">
									<option value="0"><?php 
    printf(__('All %s', 'give'), give_get_forms_label_plural());
    ?>
</option>
									<?php 
    $forms = get_posts(array('post_type' => 'give_forms', 'posts_per_page' => -1));
    if ($forms) {
        foreach ($forms as $form) {
            echo '<option value="' . $form->ID . '">' . get_the_title($form->ID) . '</option>';
        }
    }
    ?>
								</select>
								<select name="give_export_option" id="give_donor_export_option">
									<option value="emails"><?php 
    _e('Emails', 'give');
    ?>
</option>
									<option value="emails_and_names"><?php 
    _e('Emails and Names', 'give');
    ?>
</option>
									<option value="full"><?php 
    _e('Emails, Names, and Purchase Stats', 'give');
    ?>
</option>
								</select>
								<input type="hidden" name="give-action" value="email_export" />
								<input type="submit" value="<?php 
    _e('Generate CSV', 'give');
    ?>
" class="button-secondary" />
							</form>
						</td>
					</tr>
					<?php 
    do_action('give_reports_tab_export_table_bottom');
    ?>
					</tbody>
				</table>

				<?php 
    do_action('give_reports_tab_export_content_bottom');
    ?>

			</div>
			<!-- .post-body-content -->
		</div>
		<!-- .post-body -->
	</div><!-- #give-dashboard-widgets-wrap -->
	<?php 
}
Esempio n. 3
0
/**
 * Record payment status change
 *
 * @since  1.0
 *
 * @param  int    $payment_id The ID number of the payment.
 * @param  string $new_status The status of the payment, probably "publish".
 * @param  string $old_status The status of the payment prior to being marked as "complete", probably "pending".
 *
 * @return void
 */
function give_record_status_change($payment_id, $new_status, $old_status)
{
    // Get the list of statuses so that status in the payment note can be translated
    $stati = give_get_payment_statuses();
    $old_status = isset($stati[$old_status]) ? $stati[$old_status] : $old_status;
    $new_status = isset($stati[$new_status]) ? $stati[$new_status] : $new_status;
    $status_change = sprintf(esc_html__('Status changed from %1$s to %2$s.', 'give'), $old_status, $new_status);
    give_insert_payment_note($payment_id, $status_change);
}
Esempio n. 4
0
/**
 * Get Payment Status Keys
 *
 * Retrieves keys for all available statuses for payments
 *
 * @since  1.0
 *
 * @return array $payment_status All the available payment statuses.
 */
function give_get_payment_status_keys()
{
    $statuses = array_keys(give_get_payment_statuses());
    asort($statuses);
    return array_values($statuses);
}
Esempio n. 5
0
 /**
  * Set the payment status and run any status specific changes necessary.
  *
  * @since  1.0
  * @access public
  *
  * @param  string $status The status to set the payment to.
  *
  * @return bool   $updated Returns if the status was successfully updated.
  */
 public function update_status($status = false)
 {
     //standardize the 'complete(d)' status
     if ($status == 'completed' || $status == 'complete') {
         $status = 'publish';
     }
     $old_status = !empty($this->old_status) ? $this->old_status : false;
     if ($old_status === $status) {
         return false;
         // Don't permit status changes that aren't changes
     }
     $do_change = apply_filters('give_should_update_payment_status', true, $this->ID, $status, $old_status);
     $updated = false;
     if ($do_change) {
         do_action('give_before_payment_status_change', $this->ID, $status, $old_status);
         $update_fields = array('ID' => $this->ID, 'post_status' => $status, 'edit_date' => current_time('mysql'));
         $updated = wp_update_post(apply_filters('give_update_payment_status_fields', $update_fields));
         $all_payment_statuses = give_get_payment_statuses();
         $this->status_nicename = array_key_exists($status, $all_payment_statuses) ? $all_payment_statuses[$status] : ucfirst($status);
         // Process any specific status functions
         switch ($status) {
             case 'refunded':
                 $this->process_refund();
                 break;
             case 'failed':
                 $this->process_failure();
                 break;
             case 'pending':
                 $this->process_pending();
                 break;
             case 'cancelled':
                 $this->process_cancelled();
                 break;
             case 'revoked':
                 $this->process_revoked();
                 break;
         }
         do_action('give_update_payment_status', $this->ID, $status, $old_status);
     }
     return $updated;
 }
Esempio n. 6
0
/**
 * Renders the 'Export' tab on the Reports Page
 *
 * @since 1.0
 * @return void
 */
function give_reports_tab_export()
{
    ?>
	<div id="give-dashboard-widgets-wrap">
		<div id="post-body">
			<div id="post-body-content">

				<?php 
    do_action('give_reports_tab_export_content_top');
    ?>

				<table class="widefat export-options-table give-table">
					<thead>
					<tr>
						<th class="row-title"><?php 
    esc_html_e('Export Type', 'give');
    ?>
</th>
						<th><?php 
    esc_html_e('Export Options', 'give');
    ?>
</th>
					</tr>
					</thead>
					<tbody>
					<?php 
    do_action('give_reports_tab_export_table_top');
    ?>
					<tr class="give-export-pdf-sales-earnings">
						<td class="row-title">
							<h3><span><?php 
    esc_html_e('Export PDF of Donations and Income', 'give');
    ?>
</span></h3>

							<p><?php 
    esc_html_e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give');
    ?>
</p>
						</td>
						<td>
							<a class="button" href="<?php 
    echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf');
    ?>
"><?php 
    esc_html_e('Generate PDF', 'give');
    ?>
</a>
						</td>
					</tr>
					<tr class="alternate give-export-sales-earnings">
						<td class="row-title">
							<h3><span><?php 
    esc_html_e('Export Income and Donation Stats', 'give');
    ?>
</span></h3>

							<p><?php 
    esc_html_e('Download a CSV of income and donations over time.', 'give');
    ?>
</p>
						</td>
						<td>
							<form method="post">
								<?php 
    printf(esc_html__('%1$s to %2$s', 'give'), Give()->html->year_dropdown('start_year') . ' ' . Give()->html->month_dropdown('start_month'), Give()->html->year_dropdown('end_year') . ' ' . Give()->html->month_dropdown('end_month'));
    ?>
								<input type="hidden" name="give-action" value="earnings_export"/>
								<input type="submit" value="<?php 
    esc_attr_e('Generate CSV', 'give');
    ?>
" class="button-secondary"/>
							</form>
						</td>
					</tr>
					<tr class="give-export-payment-history">
						<td class="row-title">
							<h3><span><?php 
    esc_html_e('Export Donation History', 'give');
    ?>
</span></h3>

							<p><?php 
    esc_html_e('Download a CSV of all donations recorded.', 'give');
    ?>
</p>
						</td>
						<td>
							<form id="give-export-payments" class="give-export-form" method="post">
								<?php 
    $args = array('id' => 'give-payment-export-start', 'name' => 'start', 'placeholder' => esc_attr__('Start date', 'give'));
    echo Give()->html->date_field($args);
    ?>
								<?php 
    $args = array('id' => 'give-payment-export-end', 'name' => 'end', 'placeholder' => esc_attr__('End date', 'give'));
    echo Give()->html->date_field($args);
    ?>
								<select name="status">
									<option value="any"><?php 
    esc_html_e('All Statuses', 'give');
    ?>
</option>
									<?php 
    $statuses = give_get_payment_statuses();
    foreach ($statuses as $status => $label) {
        echo '<option value="' . $status . '">' . $label . '</option>';
    }
    ?>
								</select>
								<?php 
    wp_nonce_field('give_ajax_export', 'give_ajax_export');
    ?>
								<input type="hidden" name="give-export-class" value="Give_Batch_Payments_Export"/>
								<span>
									<input type="submit" value="<?php 
    esc_attr_e('Generate CSV', 'give');
    ?>
" class="button-secondary"/>
									<span class="spinner"></span>
								</span>
							</form>

						</td>
					</tr>
					<tr class="alternate give-export-donors">
						<td class="row-title">
							<h3><span><?php 
    esc_html_e('Export Donors in CSV', 'give');
    ?>
</span></h3>

							<p><?php 
    esc_html_e('Download an export of donors for all donation forms or only those who have given to a particular form.', 'give');
    ?>
</p>
						</td>
						<td>
							<form method="post" id="give_donor_export" class="give-export-form">

									<?php 
    $args = array('name' => 'forms', 'id' => 'give_customer_export_form', 'chosen' => true);
    echo Give()->html->forms_dropdown($args);
    ?>
								
								<input type="submit" value="<?php 
    esc_attr_e('Generate CSV', 'give');
    ?>
" class="button-secondary"/>

								<div id="export-donor-options-wrap" class="give-clearfix">
									<p><?php 
    esc_html_e('Export Columns', 'give');
    ?>
:</p>
									<ul id="give-export-option-ul">
										<li>
											<label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php 
    esc_html_e('Name', 'give');
    ?>
											</label>
										</li>
										<li>
											<label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php 
    esc_html_e('Email', 'give');
    ?>
											</label>
										</li>
										<li>
											<label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php 
    esc_html_e('Address', 'give');
    ?>
											</label>
										</li>
										<li>
											<label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php 
    esc_html_e('User ID', 'give');
    ?>
											</label>
										</li>
										<li>
											<label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php 
    esc_html_e('First Donation Date', 'give');
    ?>
											</label>
										</li>
										<li>
											<label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php 
    esc_html_e('Number of Donations', 'give');
    ?>
											</label>
										</li>
										<li>
											<label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php 
    esc_html_e('Total Donated', 'give');
    ?>
											</label>
										</li>
									</ul>
								</div>
								<?php 
    wp_nonce_field('give_ajax_export', 'give_ajax_export');
    ?>
								<input type="hidden" name="give-export-class" value="Give_Batch_Customers_Export"/>
								<input type="hidden" name="give-action" value="email_export"/>
							</form>
						</td>
					</tr>
					<?php 
    do_action('give_reports_tab_export_table_bottom');
    ?>
					</tbody>
				</table>

				<?php 
    do_action('give_reports_tab_export_content_bottom');
    ?>

			</div>
			<!-- .post-body-content -->
		</div>
		<!-- .post-body -->
	</div><!-- #give-dashboard-widgets-wrap -->
	<?php 
}