From 26aaaac7231a8d4cbd446190c869a03303ed5b32 Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Mon, 17 Jun 2013 10:41:43 +0200 Subject: [PATCH 01/13] Updated make file to point to ding2tal --- ding_debt.make | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ding_debt.make b/ding_debt.make index fa42be6..35e3a42 100644 --- a/ding_debt.make +++ b/ding_debt.make @@ -3,26 +3,26 @@ core = 7.x projects[ding_base][type] = "module" projects[ding_base][download][type] = "git" -projects[ding_base][download][url] = "git@github.com:ding2/ding_base.git" +projects[ding_base][download][url] = "git@github.com:ding2tal/ding_base.git" projects[ding_base][download][branch] = "master" projects[ding_dibs][type] = "module" projects[ding_dibs][download][type] = "git" -projects[ding_dibs][download][url] = "git@github.com:ding2/ding_dibs.git" +projects[ding_dibs][download][url] = "git@github.com:ding2tal/ding_dibs.git" projects[ding_dibs][download][branch] = "master" projects[ding_popup][type] = "module" projects[ding_popup][download][type] = "git" -projects[ding_popup][download][url] = "git@github.com:ding2/ding_popup.git" +projects[ding_popup][download][url] = "git@github.com:ding2tal/ding_popup.git" projects[ding_popup][download][branch] = "master" projects[ding_user][type] = "module" projects[ding_user][download][type] = "git" -projects[ding_user][download][url] = "git@github.com:ding2/ding_user.git" +projects[ding_user][download][url] = "git@github.com:ding2tal/ding_user.git" projects[ding_user][download][branch] = "master" projects[ding_provider][type] = "module" projects[ding_provider][download][type] = "git" -projects[ding_provider][download][url] = "git@github.com:ding2/ding_provider.git" +projects[ding_provider][download][url] = "git@github.com:ding2tal/ding_provider.git" projects[ding_provider][download][branch] = "master" From effbc5adac446e375a93687d4dc5244b8e8c04d6 Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Mon, 24 Jun 2013 14:58:50 +0200 Subject: [PATCH 02/13] Changed makefile to use development branch --- ding_debt.make | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ding_debt.make b/ding_debt.make index 35e3a42..5461777 100644 --- a/ding_debt.make +++ b/ding_debt.make @@ -4,25 +4,25 @@ core = 7.x projects[ding_base][type] = "module" projects[ding_base][download][type] = "git" projects[ding_base][download][url] = "git@github.com:ding2tal/ding_base.git" -projects[ding_base][download][branch] = "master" +projects[ding_base][download][branch] = "development" projects[ding_dibs][type] = "module" projects[ding_dibs][download][type] = "git" projects[ding_dibs][download][url] = "git@github.com:ding2tal/ding_dibs.git" -projects[ding_dibs][download][branch] = "master" +projects[ding_dibs][download][branch] = "development" projects[ding_popup][type] = "module" projects[ding_popup][download][type] = "git" projects[ding_popup][download][url] = "git@github.com:ding2tal/ding_popup.git" -projects[ding_popup][download][branch] = "master" +projects[ding_popup][download][branch] = "development" projects[ding_user][type] = "module" projects[ding_user][download][type] = "git" projects[ding_user][download][url] = "git@github.com:ding2tal/ding_user.git" -projects[ding_user][download][branch] = "master" +projects[ding_user][download][branch] = "development" projects[ding_provider][type] = "module" projects[ding_provider][download][type] = "git" projects[ding_provider][download][url] = "git@github.com:ding2tal/ding_provider.git" -projects[ding_provider][download][branch] = "master" +projects[ding_provider][download][branch] = "development" From 9269e8130221cb5938fbb2914d7ffc8bdca5e3e0 Mon Sep 17 00:00:00 2001 From: pjohans Date: Wed, 29 Feb 2012 09:52:21 +0100 Subject: [PATCH 03/13] pass all parameters not only debt_ids --- ding_debt.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ding_debt.module b/ding_debt.module index b2988d4..ca56189 100644 --- a/ding_debt.module +++ b/ding_debt.module @@ -35,6 +35,6 @@ function ding_debt_ding_provider_user() { * Callback for successful payment transaction. */ function ding_debt_payment_callback($transaction) { - return ding_provider_invoke_page('debt', 'payment_received', $transaction['payment_price'], $transaction['params']['debt_ids'], $transaction['payment_order_id']); + return ding_provider_invoke_page('debt', 'payment_received', $transaction['payment_price'], $transaction['params'], $transaction['payment_order_id']); } From ecbe1983eb74aa87137372af602215f39146e3fc Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Wed, 17 Jul 2013 14:15:15 +0200 Subject: [PATCH 04/13] Also pass debt objects --- plugins/content_types/debts/debts.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/content_types/debts/debts.inc b/plugins/content_types/debts/debts.inc index d230dff..14d9473 100644 --- a/plugins/content_types/debts/debts.inc +++ b/plugins/content_types/debts/debts.inc @@ -243,7 +243,7 @@ function ding_debt_debts_form_submit_pay_selected($form, &$form_state) { function ding_debt_debts_perform_payment($debts, $amount, &$form_state) { global $user; if ($amount > 0) { - $params = array('params' => array('debt_ids' => array_keys($debts))); + $params = $params = array('params' => array('debt_ids' => array_keys($debts),'debts'=> $debts)); $url = ding_provider_invoke('payment', 'get_url', $amount, $params, 'ding_debt_payment_callback'); if ($url) { From 044254a3345e65542a5e8a59e9b3921b4f8454d8 Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Wed, 17 Jul 2013 14:20:31 +0200 Subject: [PATCH 05/13] Removed unused veriables left over form merge --- plugins/content_types/debts/debts.inc | 6 ------ 1 file changed, 6 deletions(-) diff --git a/plugins/content_types/debts/debts.inc b/plugins/content_types/debts/debts.inc index 14d9473..0e1e53d 100644 --- a/plugins/content_types/debts/debts.inc +++ b/plugins/content_types/debts/debts.inc @@ -17,13 +17,7 @@ $plugin = array( * Render the block */ function ding_debt_debts_content_type_render($subtype, $conf, $panel_args, $context) { - $preload_debts = &drupal_static('ids'); $account = isset($context->data) ? $context->data : NULL; - $preload_ids = array(); - $items = array(); - $debt_list = array(); - $rows = array(); - $row = array(); $total_amount = 0; $has_invoiced_fees = FALSE; From e9fe4356f52b61f36339b4023d2d7b646b8301ff Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Thu, 5 Sep 2013 16:43:23 +0200 Subject: [PATCH 06/13] Fixed some basic coding style --- plugins/content_types/debts/debts.inc | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/plugins/content_types/debts/debts.inc b/plugins/content_types/debts/debts.inc index 0e1e53d..a7f9a94 100644 --- a/plugins/content_types/debts/debts.inc +++ b/plugins/content_types/debts/debts.inc @@ -35,13 +35,14 @@ function ding_debt_debts_content_type_render($subtype, $conf, $panel_args, $cont $total_amount += $debt->amount; $total_amount -= $debt->amount_paid; $debt->is_invoice = FALSE; - } else { + } + else { $debt->is_invoice = TRUE; $has_invoiced_fees = TRUE; } } - $build = ding_provider_get_form('ding_debt_debts_form', $debts, $has_invoiced_fees, $total_amount); - $block->content = render($build); + $build = ding_provider_get_form('ding_debt_debts_form', $debts, $has_invoiced_fees, $total_amount); + $block->content = render($build); } else { $block->content = t('No debts'); @@ -49,7 +50,6 @@ function ding_debt_debts_content_type_render($subtype, $conf, $panel_args, $cont return $block; } - /** * Form for configuring the content type. * @@ -64,6 +64,7 @@ function ding_debt_debts_content_type_edit_form($form, &$form_state) { */ function ding_debt_debts_form($form, &$form_state, $debts = array(), $has_invoiced_fees, $total_amount) { ding_debt_form_details($form, $debts, $has_invoiced_fees, $total_amount); + if ($total_amount) { $form['debt_data'] = array( '#type' => 'value', @@ -123,6 +124,7 @@ function ding_debt_form_details(&$form, $debts, $has_invoiced_fees, $total_amoun ), ); } + // add total $options['total_amount'] = array( '#disabled' => TRUE, @@ -171,7 +173,7 @@ function ding_debt_form_details(&$form, $debts, $has_invoiced_fees, $total_amoun 'class' => 'fee-invoice-note', 'header' => TRUE ), - ); + ); } $form['debts'] = array( '#type' => 'tableselect_form', @@ -207,7 +209,8 @@ function ding_debt_debts_form_submit_pay_all($form, &$form_state) { if ( !$form_state['values']['debt_data'][$debt_id]->invoice_number ) { $amount += $form_state['values']['debt_data'][$debt_id]->amount; $amount -= $form_state['values']['debt_data'][$debt_id]->amount_paid; - } else { + } + else { unset($debts[$debt_id]); } } @@ -225,19 +228,23 @@ function ding_debt_debts_form_submit_pay_selected($form, &$form_state) { $amount += $form_state['values']['debt_data'][$debt_id]->amount; $amount -= $form_state['values']['debt_data'][$debt_id]->amount_paid; $debts[$debt_id] = $form_state['values']['debt_data'][$debt_id]; - } + } } ding_debt_debts_perform_payment($debts, $amount, $form_state); - + } /** * Performs the payment */ function ding_debt_debts_perform_payment($debts, $amount, &$form_state) { - global $user; if ($amount > 0) { - $params = $params = array('params' => array('debt_ids' => array_keys($debts),'debts'=> $debts)); + $params = array( + 'params' => array( + 'debt_ids' => array_keys($debts), + 'debts' => $debts, + ), + ); $url = ding_provider_invoke('payment', 'get_url', $amount, $params, 'ding_debt_payment_callback'); if ($url) { From fe08925ae3350a54cffd7ef444d465744a520e95 Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Thu, 5 Sep 2013 17:16:03 +0200 Subject: [PATCH 07/13] Changed debt list to use material item as form elements --- plugins/content_types/debts/debts.inc | 146 ++++++++------------------ 1 file changed, 45 insertions(+), 101 deletions(-) diff --git a/plugins/content_types/debts/debts.inc b/plugins/content_types/debts/debts.inc index a7f9a94..cedf894 100644 --- a/plugins/content_types/debts/debts.inc +++ b/plugins/content_types/debts/debts.inc @@ -95,116 +95,58 @@ function ding_debt_debts_form($form, &$form_state, $debts = array(), $has_invoic * Helper function to render the details of the debt form */ function ding_debt_form_details(&$form, $debts, $has_invoiced_fees, $total_amount) { - $options = array(); - $header = array( - 'fee_date' => t('Fee date'), - 'title' => t('Title'), - 'type' => t('Fee type'), - 'amount' => t('Amount'), - ); - foreach ($debts as $debt) { - $options[$debt->id] = array( - '#disabled' => $debt->is_invoice, - 'fee_date' => array( - 'data' => format_date(strtotime(check_plain($debt->date)), 'date_only'), - 'class' => 'feedate', - ), - 'title' => array( - 'data' => $debt->display_name, - 'class' => 'feetitle', - ), - 'type' => array( - 'data' => t($debt->type), - 'class' => 'feetype', - ), - 'amount' => array( - 'data' => ( $debt->is_invoice ) ? number_format(($debt->amount - $debt->amount_paid), 2, ',', ' ') . ' *' : number_format(($debt->amount - $debt->amount_paid), 2, ',', ' '), - 'class' => 'feeamount', + $item = array( + '#type' => 'material_item', + '#id' => $debt->id, + '#title' => $debt->display_name, + '#information' => array( + 'fee_date' => array( + 'label' => t('Fee date'), + 'data' => format_date(strtotime(check_plain($debt->date)), 'date_only'), + 'class' => 'fee-date', + ), + 'fee_type' => array( + 'label' => t('Fee type'), + 'data' => t($debt->type), + 'class' => 'fee-type', + ), + 'amount' => array( + 'label' => t('Amount'), + 'data' => ($debt->is_invoice ) ? number_format(($debt->amount - $debt->amount_paid), 2, ',', ' ') . ' *' : number_format(($debt->amount - $debt->amount_paid), 2, ',', ' '), + 'class' => 'fee_amount', + ), ), ); + + // Add the debt to the form. + $form['debts'][$debt->id] = $item; } - // add total - $options['total_amount'] = array( - '#disabled' => TRUE, - 'fee_date' => array( - 'data' => t('Total'), - 'class' => 'feedate', - 'header' => TRUE - ), - 'title' => array( - 'data' => '', - 'class' => 'feetitle', - 'header' => TRUE - ), - 'type' => array( - 'data' => '', - 'class' => 'feetype', - 'header' => TRUE - ), - 'amount' => array( - 'data' => number_format($total_amount, 2, ',', ' '), - 'class' => 'feeamount', - 'header' => TRUE - ), + // Add item with the total amount. + $form['total'] = array( + '#type' => 'item', + '#prefix' => '

', + '#suffix' => '

', + '#markup' => t('Total') . ': ' . number_format($total_amount, 2, ',', ' ') . '', ); if ($has_invoiced_fees) { - $options['invoice-note'] = array( - '#disabled' => TRUE, - 'fee_date' => array( - 'data' => '', - 'class' => 'fee-invoice-note', - 'header' => TRUE - ), - 'title' => array( - 'data' => t("* Invoiced fees can't be paid online."), - 'class' => 'fee-invoice-note', - 'header' => TRUE - ), - 'type' => array( - 'data' => '', - 'class' => 'fee-invoice-note', - 'header' => TRUE - ), - 'amount' => array( - 'data' => '', - 'class' => 'fee-invoice-note', - 'header' => TRUE - ), + $form['notice'] = array( + '#type' => 'item', + '#prefix' => '

', + '#suffix' => '

', + '#markup' => t("* Invoiced fees can't be paid online."), ); } - $form['debts'] = array( - '#type' => 'tableselect_form', - '#header' => $header, - '#options' => $options, - '#empty' => t('No Debt'), - '#process' => array('ding_base_element_process_tableselect_form', '_ding_debt_debt_disable'), - '#weight' => -1, - ); -} - -/** - * Process function to disable checkboxes for unpayable debts. - */ -function _ding_debt_debt_disable($element) { - foreach ($element['#options'] as $key => $choice) { - if (isset($choice['#disabled']) && $choice['#disabled']) { - $element[$key]['#disabled'] = TRUE; - $element[$key]['#attributes']['title'] = t('Not payable here'); - } - } - return $element; } - /** * Submit handler for the pay all submit button. */ function ding_debt_debts_form_submit_pay_all($form, &$form_state) { $amount = 0; - $debts = array_filter($form_state['values']['debt_data']); + $debts = $form_state['values']['debt_data']; foreach ($debts as $debt_id => $debt_data) { if ( !$form_state['values']['debt_data'][$debt_id]->invoice_number ) { $amount += $form_state['values']['debt_data'][$debt_id]->amount; @@ -222,16 +164,18 @@ function ding_debt_debts_form_submit_pay_all($form, &$form_state) { */ function ding_debt_debts_form_submit_pay_selected($form, &$form_state) { $amount = 0; - $debts = array(); - foreach (array_filter($form_state['values']['debts']) as $debt_id => $debt_data) { - if ( !$form_state['values']['debt_data'][$debt_id]->invoice_number ) { - $amount += $form_state['values']['debt_data'][$debt_id]->amount; - $amount -= $form_state['values']['debt_data'][$debt_id]->amount_paid; - $debts[$debt_id] = $form_state['values']['debt_data'][$debt_id]; + $payments = array(); + $debts = $form_state['values']['debt_data']; + foreach ($debts as $debt_id => $debt_data) { + if (!empty($form_state['values'][$debt_id])) { + if ( !$debt_data->invoice_number ) { + $amount += $form_state['values']['debt_data'][$debt_id]->amount; + $amount -= $form_state['values']['debt_data'][$debt_id]->amount_paid; + $payments[$debt_id] = $form_state['values']['debt_data'][$debt_id]; + } } } - ding_debt_debts_perform_payment($debts, $amount, $form_state); - + ding_debt_debts_perform_payment($payments, $amount, $form_state); } /** From 222ea350c4161aabe29dca4be38a932bf3f6e280 Mon Sep 17 00:00:00 2001 From: Rasmus Frey Date: Tue, 10 Sep 2013 10:09:41 +0200 Subject: [PATCH 08/13] Fix some markup for total amount and message output --- plugins/content_types/debts/debts.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/content_types/debts/debts.inc b/plugins/content_types/debts/debts.inc index cedf894..65d7698 100644 --- a/plugins/content_types/debts/debts.inc +++ b/plugins/content_types/debts/debts.inc @@ -126,16 +126,16 @@ function ding_debt_form_details(&$form, $debts, $has_invoiced_fees, $total_amoun // Add item with the total amount. $form['total'] = array( '#type' => 'item', - '#prefix' => '

', - '#suffix' => '

', + '#prefix' => '
', + '#suffix' => '
', '#markup' => t('Total') . ': ' . number_format($total_amount, 2, ',', ' ') . '', ); if ($has_invoiced_fees) { $form['notice'] = array( '#type' => 'item', - '#prefix' => '

', - '#suffix' => '

', + '#prefix' => '
', + '#suffix' => '
', '#markup' => t("* Invoiced fees can't be paid online."), ); } From 3ea9ea393c3e0ffc3e172ed78db0613ddf6b0ac1 Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Tue, 10 Sep 2013 11:31:57 +0200 Subject: [PATCH 09/13] Added material number into the debt list in the user profile --- plugins/content_types/debts/debts.inc | 34 +++++++++++++++++++-------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/plugins/content_types/debts/debts.inc b/plugins/content_types/debts/debts.inc index 65d7698..52414e2 100644 --- a/plugins/content_types/debts/debts.inc +++ b/plugins/content_types/debts/debts.inc @@ -14,7 +14,7 @@ $plugin = array( ); /** - * Render the block + * Render the block. */ function ding_debt_debts_content_type_render($subtype, $conf, $panel_args, $context) { $account = isset($context->data) ? $context->data : NULL; @@ -30,8 +30,8 @@ function ding_debt_debts_content_type_render($subtype, $conf, $panel_args, $cont if (count($debts) == TRUE) { foreach ($debts as $debt) { - // invoiced fees can't be paid online. - if ( !$debt->invoice_number ) { + // Invoiced fees can't be paid online. + if (!$debt->invoice_number) { $total_amount += $debt->amount; $total_amount -= $debt->amount_paid; $debt->is_invoice = FALSE; @@ -60,12 +60,17 @@ function ding_debt_debts_content_type_edit_form($form, &$form_state) { } /** - * Implements a drupal form, which implements a pay button and debts data + * Implements a drupal form, which implements a pay button and debts data. */ -function ding_debt_debts_form($form, &$form_state, $debts = array(), $has_invoiced_fees, $total_amount) { +function ding_debt_debts_form($form, &$form_state, $debts, $has_invoiced_fees, $total_amount) { ding_debt_form_details($form, $debts, $has_invoiced_fees, $total_amount); if ($total_amount) { + // Init debts. + if (!isset($debts)) { + $debts = array(); + } + $form['debt_data'] = array( '#type' => 'value', '#value' => $debts, @@ -92,7 +97,7 @@ function ding_debt_debts_form($form, &$form_state, $debts = array(), $has_invoic } /** - * Helper function to render the details of the debt form + * Helper function to render the details of the debt form. */ function ding_debt_form_details(&$form, $debts, $has_invoiced_fees, $total_amount) { foreach ($debts as $debt) { @@ -113,12 +118,21 @@ function ding_debt_form_details(&$form, $debts, $has_invoiced_fees, $total_amoun ), 'amount' => array( 'label' => t('Amount'), - 'data' => ($debt->is_invoice ) ? number_format(($debt->amount - $debt->amount_paid), 2, ',', ' ') . ' *' : number_format(($debt->amount - $debt->amount_paid), 2, ',', ' '), + 'data' => $debt->is_invoice ? number_format(($debt->amount - $debt->amount_paid), 2, ',', ' ') . ' *' : number_format(($debt->amount - $debt->amount_paid), 2, ',', ' '), 'class' => 'fee_amount', ), ), ); + // Add material number if available. + if (isset($debt->material_number)) { + array_unshift($item['#information'], array( + 'label' => t('Material no.'), + 'data' => $debt->material_number, + 'class' => 'material-number', + )); + } + // Add the debt to the form. $form['debts'][$debt->id] = $item; } @@ -148,7 +162,7 @@ function ding_debt_debts_form_submit_pay_all($form, &$form_state) { $amount = 0; $debts = $form_state['values']['debt_data']; foreach ($debts as $debt_id => $debt_data) { - if ( !$form_state['values']['debt_data'][$debt_id]->invoice_number ) { + if (!$form_state['values']['debt_data'][$debt_id]->invoice_number) { $amount += $form_state['values']['debt_data'][$debt_id]->amount; $amount -= $form_state['values']['debt_data'][$debt_id]->amount_paid; } @@ -168,7 +182,7 @@ function ding_debt_debts_form_submit_pay_selected($form, &$form_state) { $debts = $form_state['values']['debt_data']; foreach ($debts as $debt_id => $debt_data) { if (!empty($form_state['values'][$debt_id])) { - if ( !$debt_data->invoice_number ) { + if (!$debt_data->invoice_number) { $amount += $form_state['values']['debt_data'][$debt_id]->amount; $amount -= $form_state['values']['debt_data'][$debt_id]->amount_paid; $payments[$debt_id] = $form_state['values']['debt_data'][$debt_id]; @@ -179,7 +193,7 @@ function ding_debt_debts_form_submit_pay_selected($form, &$form_state) { } /** - * Performs the payment + * Performs the payment. */ function ding_debt_debts_perform_payment($debts, $amount, &$form_state) { if ($amount > 0) { From 666ae26bd71801da73100334fdb57e6f68b198f2 Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Tue, 10 Sep 2013 13:24:28 +0200 Subject: [PATCH 10/13] Added #weight to debt list form --- plugins/content_types/debts/debts.inc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/content_types/debts/debts.inc b/plugins/content_types/debts/debts.inc index 52414e2..cdcab11 100644 --- a/plugins/content_types/debts/debts.inc +++ b/plugins/content_types/debts/debts.inc @@ -110,27 +110,31 @@ function ding_debt_form_details(&$form, $debts, $has_invoiced_fees, $total_amoun 'label' => t('Fee date'), 'data' => format_date(strtotime(check_plain($debt->date)), 'date_only'), 'class' => 'fee-date', + '#weight' => 0, ), 'fee_type' => array( 'label' => t('Fee type'), 'data' => t($debt->type), 'class' => 'fee-type', + '#weight' => 4, ), 'amount' => array( 'label' => t('Amount'), 'data' => $debt->is_invoice ? number_format(($debt->amount - $debt->amount_paid), 2, ',', ' ') . ' *' : number_format(($debt->amount - $debt->amount_paid), 2, ',', ' '), 'class' => 'fee_amount', + '#weight' => 8, ), ), ); // Add material number if available. if (isset($debt->material_number)) { - array_unshift($item['#information'], array( + $item['#information']['material-number'] = array( 'label' => t('Material no.'), 'data' => $debt->material_number, 'class' => 'material-number', - )); + '#weight' => -4, + ); } // Add the debt to the form. From 3cdfd54a282e303debd2d0cd5b5c9ff16d8c1487 Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Thu, 12 Sep 2013 16:16:13 +0200 Subject: [PATCH 11/13] Renamed label in material list to better match the content --- plugins/content_types/debts/debts.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/content_types/debts/debts.inc b/plugins/content_types/debts/debts.inc index cdcab11..8165465 100644 --- a/plugins/content_types/debts/debts.inc +++ b/plugins/content_types/debts/debts.inc @@ -113,8 +113,8 @@ function ding_debt_form_details(&$form, $debts, $has_invoiced_fees, $total_amoun '#weight' => 0, ), 'fee_type' => array( - 'label' => t('Fee type'), - 'data' => t($debt->type), + 'label' => t('Fee cause'), + 'data' => $debt->type, 'class' => 'fee-type', '#weight' => 4, ), From 6ec45f5192b360b4165afa771afd10c565b05f08 Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Tue, 8 Oct 2013 12:08:34 +0200 Subject: [PATCH 12/13] Changed the parameter to debt payment received provider call to send the debt_ids and not all parameters --- ding_debt.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ding_debt.module b/ding_debt.module index ca56189..b2988d4 100644 --- a/ding_debt.module +++ b/ding_debt.module @@ -35,6 +35,6 @@ function ding_debt_ding_provider_user() { * Callback for successful payment transaction. */ function ding_debt_payment_callback($transaction) { - return ding_provider_invoke_page('debt', 'payment_received', $transaction['payment_price'], $transaction['params'], $transaction['payment_order_id']); + return ding_provider_invoke_page('debt', 'payment_received', $transaction['payment_price'], $transaction['params']['debt_ids'], $transaction['payment_order_id']); } From a7b7a348c884148c57b2720edfe4fc8e9089f0c7 Mon Sep 17 00:00:00 2001 From: Jesper Bisgaard Date: Thu, 10 Oct 2013 15:08:24 +0200 Subject: [PATCH 13/13] Added payment service information to payment callback --- ding_debt.module | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/ding_debt.module b/ding_debt.module index b2988d4..409f445 100644 --- a/ding_debt.module +++ b/ding_debt.module @@ -33,8 +33,31 @@ function ding_debt_ding_provider_user() { /** * Callback for successful payment transaction. + * + * @param array $transaction + * + * @return TRUE */ function ding_debt_payment_callback($transaction) { - return ding_provider_invoke_page('debt', 'payment_received', $transaction['payment_price'], $transaction['params']['debt_ids'], $transaction['payment_order_id']); + // Get user account. + $account = user_load($transaction['customer_uid']); + // Get user credentials. + $creds = ding_user_get_creds($account); + // Get payment information from provider. + $payment_information = ding_provider_invoke_page( + 'debt', + 'get_payment_service_information', + $account, + $transaction['payment_price'] + ); + // Invoke payment service. + return ding_provider_invoke_page( + 'debt', + 'payment_received', + $transaction['payment_price'], + $transaction['params']['debt_ids'], + $transaction['payment_transaction_id'], + $payment_information['order_id'] + ); }