From 1612421d7d21648e1b3a09e00df2ee37c1bd9be0 Mon Sep 17 00:00:00 2001 From: Thomas Johansen Date: Mon, 17 Mar 2014 13:55:23 +0100 Subject: [PATCH 01/20] Added check to see if not is FALSE --- includes/alma.user.inc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/alma.user.inc b/includes/alma.user.inc index d1f7738..893e271 100644 --- a/includes/alma.user.inc +++ b/includes/alma.user.inc @@ -17,7 +17,9 @@ function alma_user_authenticate($uid, $pass) { try { $res = alma_client_invoke('get_patron_info', $uid, $pass, TRUE); - $return['success'] = TRUE; + if ($res) { + $return['success'] = TRUE; + } } catch (Exception $e) { return $return; From 1577406d40df461b1f82d059702e0d6a32e437d2 Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Tue, 29 Apr 2014 12:17:08 +0200 Subject: [PATCH 02/20] Removed WAYF requirement (move to ding_wayf) --- alma.install | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/alma.install b/alma.install index a37b560..c456560 100644 --- a/alma.install +++ b/alma.install @@ -1,4 +1,8 @@ the settings page.', array('@link' => url('admin/config/ding/provider/alma'))); $requirements['alma']['severity'] = REQUIREMENT_ERROR; } - $requirements['alma_wayf'] = array( - 'title' => $t('Alma WAYF'), - 'value' => $t('Alma WAYF configured'), - 'severity' => REQUIREMENT_OK, - ); - if (!variable_get('wayf_hash', FALSE)) { - $requirements['alma']['value'] = $t('Alma WAYF not configured'); - $requirements['alma']['description'] = $t('Alma WAYF is not properly configured, you need to set $conf[\'wayf_hash\'] in setttings.php.'); - $requirements['alma']['severity'] = REQUIREMENT_ERROR; - } } return $requirements; From 8360489b8f5ab61050b95cda5f6608a3e9012fd4 Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Tue, 29 Apr 2014 13:46:23 +0200 Subject: [PATCH 03/20] Fixed typo in results variable name in alma_debt_list --- includes/alma.debt.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/alma.debt.inc b/includes/alma.debt.inc index 5bf93b8..4cf3405 100644 --- a/includes/alma.debt.inc +++ b/includes/alma.debt.inc @@ -18,14 +18,14 @@ function alma_debt_list($account, $reset = FALSE) { $creds = ding_user_get_creds($account); - // Use session cache to speed up communication with Alma. + // Use static cache to speed up communication with Alma. $results = &drupal_static(__FUNCTION__, FALSE); if (!$results || $reset) { // Get debts from Alma. $debts = alma_client_invoke('get_debts', $creds['name'], $creds['pass']); // Create DingProviderDebt instances from Alma's list. - $result = array(); + $results = array(); foreach ($debts['debts'] as $debt) { // Get the material number from the display name and remove it form it. preg_match('/^(\w+)\s+(.+)/', $debt['display_name'], $matchs); @@ -38,11 +38,11 @@ function alma_debt_list($account, $reset = FALSE) { $debt['type'] = alma_debt_translate_debt_type($debt['type']); $debt_object = new DingProviderDebt($debt['id'], $debt); - $result[$debt['id']] = $debt_object; + $results[$debt['id']] = $debt_object; } } - return $result; + return $results; } /** From 4e0f865d9fba8263c73f0d25829527bd9a902a0c Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Tue, 29 Apr 2014 13:51:33 +0200 Subject: [PATCH 04/20] Updated debt status texts to work better with module such as potx --- includes/alma.debt.inc | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/includes/alma.debt.inc b/includes/alma.debt.inc index 4cf3405..ca62dc9 100644 --- a/includes/alma.debt.inc +++ b/includes/alma.debt.inc @@ -78,69 +78,69 @@ function alma_debt_translate_debt_type($debt_type) { switch ($debt_type) { case 'overdueFeeInvoiceDebt': - $str = 'Overdue fee invoice'; + $str = t('Overdue fee invoice'); break; case 'overdueFeeDebt': - $str = 'Overdue fee'; + $str = t('Overdue fee'); break; case 'loanFeeDebt': - $str = 'Loan fee'; + $str = t('Loan fee'); break; case 'reservationPickupFeeDebt': - $str = 'Reservation pick-up fee'; + $str = t('Reservation pick-up fee'); break; case 'reservationFeeDebt': - $str = 'Reservation fee'; + $str = t('Reservation fee'); break; case 'deleteReservationFeeDebt': - $str = 'Delete reservation fee'; + $str = t('Delete reservation fee'); break; case 'illFeeDebt': - $str = 'Interlibrary fee'; + $str = t('Interlibrary fee'); break; case 'smsReservationFeeDebt': - $str = 'SMS reservation fee'; + $str = t('SMS reservation fee'); break; case 'smsReminderFeeDebt': - $str = 'SMS reminder fee'; + $str = t('SMS reminder fee'); break; case 'smsRecall1FeeDebt': - $str = 'SMS first recall fee'; + $str = t('SMS first recall fee'); break; case 'smsRecall2FeeDebt': - $str = 'SMS second recall fee'; + $str = t('SMS second recall fee'); break; case 'smsRecall3FeeDebt': - $str = 'SMS third recall fee'; + $str = t('SMS third recall fee'); break; case 'smsRecall4FeeDebt': - $str = 'SMS fourth recall fee'; + $str = t('SMS fourth recall fee'); break; case 'smsRecall5FeeDebt': - $str = 'SMS fifth recall fee'; + $str = t('SMS fifth recall fee'); break; case 'emailReminderFeeDebt': - $str = 'E-mail reminder fee'; + $str = t('E-mail reminder fee'); break; case 'otherFeeDebt': - $str = 'Unknown or other fee'; + $str = t('Unknown or other fee'); break; }; - return t($str); + return $str; } From a726da38c2f17af48bb158ff0d8f66ca204ff123 Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Tue, 29 Apr 2014 13:54:24 +0200 Subject: [PATCH 05/20] Updated comment about inter library loans --- includes/alma.loan.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/alma.loan.inc b/includes/alma.loan.inc index 1cfe34d..a349d9c 100644 --- a/includes/alma.loan.inc +++ b/includes/alma.loan.inc @@ -109,7 +109,8 @@ function alma_loan_populate_pseudo_entity($ting_entity) { $ting_entity->reply->record['dc:creator']['dkdcplus:aut'] = $source['authors']; } - // If it a ill Alma record isbn are not always available. + // If it is an inter library loan (ill) Alma record isbn are not always + // available. if (isset($source['isbns'][0])) { $ting_entity->reply->record['dc:identifier']['dkdcplus:ISBN'][0] = str_replace(array('-', ' ', 'ISBN'), '', $source['isbns'][0]); } From e9df7b0910b4af928c77e1d77441c261ca7335fb Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Tue, 29 Apr 2014 15:01:58 +0200 Subject: [PATCH 06/20] Added check for ding_session cache in alma reservation cache clear --- includes/alma.reservation.inc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/alma.reservation.inc b/includes/alma.reservation.inc index fd4c921..b560c6c 100644 --- a/includes/alma.reservation.inc +++ b/includes/alma.reservation.inc @@ -442,7 +442,10 @@ function alma_reservation_get_reservations($account, $reset = FALSE) { * Clear reservations stored in the current session cache. */ function alma_reservation_clear_cache() { - ding_session_cache_clear('alma', 'reservations'); + // Check if ding_session_cache is available. + if (module_exists('ding_session_cache')) { + ding_session_cache_clear('alma', 'reservations'); + } } /** From 5f349aedbf2eebbbcbcc4924a888dd3bf306d1b5 Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Tue, 6 May 2014 12:22:56 +0200 Subject: [PATCH 07/20] Updated virtual field to version 1.2 --- alma.make | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alma.make b/alma.make index 17b4a6d..6c5ffdb 100644 --- a/alma.make +++ b/alma.make @@ -16,7 +16,7 @@ projects[profile2][subdir] = "contrib" projects[profile2][version] = "1.3" projects[virtual_field][subdir] = "contrib" -projects[virtual_field][version] = "1.1" +projects[virtual_field][version] = "1.2" ; Ding! modules From 1cb5f80445f4854ec76a817b045cf335931e32e3 Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Tue, 6 May 2014 13:46:04 +0200 Subject: [PATCH 08/20] Updated features to version 2.0 --- alma.make | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alma.make b/alma.make index 6c5ffdb..980378b 100644 --- a/alma.make +++ b/alma.make @@ -10,7 +10,7 @@ projects[email][subdir] = "contrib" projects[email][version] = "1.2" projects[features][subdir] = "contrib" -projects[features][version] = "2.0-beta2" +projects[features][version] = "2.0" projects[profile2][subdir] = "contrib" projects[profile2][version] = "1.3" From 02cc6f4f3d64b8e790de814182c4434e18f870ea Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Tue, 6 May 2014 13:56:31 +0200 Subject: [PATCH 09/20] Updated email to version 1.3 --- alma.make | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alma.make b/alma.make index 980378b..effa41e 100644 --- a/alma.make +++ b/alma.make @@ -7,7 +7,7 @@ projects[date][subdir] = "contrib" projects[date][version] = "2.6" projects[email][subdir] = "contrib" -projects[email][version] = "1.2" +projects[email][version] = "1.3" projects[features][subdir] = "contrib" projects[features][version] = "2.0" From 03ad8080534e4a74591e2b6f7c61dcb9b7e20649 Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Tue, 6 May 2014 13:59:10 +0200 Subject: [PATCH 10/20] Updated date to version 2.7 --- alma.make | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alma.make b/alma.make index effa41e..1b02f91 100644 --- a/alma.make +++ b/alma.make @@ -4,7 +4,7 @@ core = 7.x ; Contrib projects[date][subdir] = "contrib" -projects[date][version] = "2.6" +projects[date][version] = "2.7" projects[email][subdir] = "contrib" projects[email][version] = "1.3" From c4460bbf470afd4ee5264a90f094cf92853f08bc Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Mon, 19 May 2014 15:39:56 +0200 Subject: [PATCH 11/20] Issue #140 cableman: Added block status vaiable on user authentication --- includes/alma.user.inc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/alma.user.inc b/includes/alma.user.inc index 893e271..9407530 100644 --- a/includes/alma.user.inc +++ b/includes/alma.user.inc @@ -25,8 +25,6 @@ function alma_user_authenticate($uid, $pass) { return $return; } - // @todo Check block status. - // Set creds. $return['creds'] = array( 'name' => $uid, @@ -60,6 +58,11 @@ function alma_user_authenticate($uid, $pass) { ); } + $return['user']['blocked'] = FALSE; + if (!empty($res['blocks'])) { + $return['user']['blocked'] = TRUE; + } + return $return; } From c24d9f9e01b34ab8be1769d583bac416c7333d1c Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Tue, 20 May 2014 14:01:33 +0200 Subject: [PATCH 12/20] Issue #339 cableman: Added SMS and phone number to alma --- alma.features.field_base.inc | 82 +++++++++++++++++++++++++++++++ alma.features.field_instance.inc | 84 ++++++++++++++++++++++++++++---- alma.info | 7 ++- alma.module | 80 +++++++++++++++++++++++++++--- 4 files changed, 236 insertions(+), 17 deletions(-) diff --git a/alma.features.field_base.inc b/alma.features.field_base.inc index fd8dc6f..f8a527f 100644 --- a/alma.features.field_base.inc +++ b/alma.features.field_base.inc @@ -385,6 +385,88 @@ function alma_field_default_field_bases() { ), ); + // Exported field_base: 'field_alma_sms' + $field_bases['field_alma_sms'] = array( + 'active' => 1, + 'cardinality' => 1, + 'deleted' => 0, + 'entity_types' => array(), + 'field_name' => 'field_alma_sms', + 'foreign keys' => array( + 'format' => array( + 'columns' => array( + 'format' => 'format', + ), + 'table' => 'filter_format', + ), + ), + 'indexes' => array( + 'format' => array( + 0 => 'format', + ), + ), + 'locked' => 0, + 'module' => 'text', + 'settings' => array( + 'max_length' => 255, + 'profile2_private' => 0, + ), + 'storage' => array( + 'active' => 1, + 'module' => 'virtual_field', + 'settings' => array(), + 'type' => 'virtual_field', + ), + 'translatable' => 0, + 'type' => 'text', + 'virtual_field' => array( + 'entity_types' => array( + 0 => 'profile2', + ), + ), + ); + + // Exported field_base: 'field_alma_sms_id' + $field_bases['field_alma_sms_id'] = array( + 'active' => 1, + 'cardinality' => 1, + 'deleted' => 0, + 'entity_types' => array(), + 'field_name' => 'field_alma_sms_id', + 'foreign keys' => array( + 'format' => array( + 'columns' => array( + 'format' => 'format', + ), + 'table' => 'filter_format', + ), + ), + 'indexes' => array( + 'format' => array( + 0 => 'format', + ), + ), + 'locked' => 0, + 'module' => 'text', + 'settings' => array( + 'max_length' => 255, + 'profile2_private' => 0, + ), + 'storage' => array( + 'active' => 1, + 'module' => 'virtual_field', + 'settings' => array(), + 'type' => 'virtual_field', + ), + 'translatable' => 0, + 'type' => 'text', + 'virtual_field' => array( + 'entity_types' => array( + 0 => 'profile2', + ), + ), + ); + // Exported field_base: 'field_alma_street_name' $field_bases['field_alma_street_name'] = array( 'active' => 1, diff --git a/alma.features.field_instance.inc b/alma.features.field_instance.inc index 149a19f..6d03c53 100644 --- a/alma.features.field_instance.inc +++ b/alma.features.field_instance.inc @@ -21,7 +21,7 @@ function alma_field_default_field_instances() { 'label' => 'hidden', 'settings' => array(), 'type' => 'hidden', - 'weight' => 9, + 'weight' => 10, ), ), 'entity_type' => 'profile2', @@ -36,7 +36,7 @@ function alma_field_default_field_instances() { 'module' => 'virtual_field', 'settings' => array(), 'type' => 'hidden', - 'weight' => 9, + 'weight' => 10, ), ); @@ -118,7 +118,7 @@ function alma_field_default_field_instances() { 'module' => 'list', 'settings' => array(), 'type' => 'list_default', - 'weight' => 8, + 'weight' => 9, ), ), 'entity_type' => 'profile2', @@ -182,7 +182,7 @@ function alma_field_default_field_instances() { 'module' => 'text', 'settings' => array(), 'type' => 'text_default', - 'weight' => 5, + 'weight' => 6, ), ), 'entity_type' => 'profile2', @@ -200,7 +200,7 @@ function alma_field_default_field_instances() { 'size' => 12, ), 'type' => 'text_textfield', - 'weight' => 8, + 'weight' => 9, ), ); @@ -215,7 +215,7 @@ function alma_field_default_field_instances() { 'label' => 'hidden', 'settings' => array(), 'type' => 'hidden', - 'weight' => 10, + 'weight' => 11, ), ), 'entity_type' => 'profile2', @@ -230,7 +230,7 @@ function alma_field_default_field_instances() { 'module' => 'virtual_field', 'settings' => array(), 'type' => 'hidden', - 'weight' => 10, + 'weight' => 12, ), ); @@ -277,7 +277,7 @@ function alma_field_default_field_instances() { 'module' => 'list', 'settings' => array(), 'type' => 'list_default', - 'weight' => 6, + 'weight' => 7, ), ), 'entity_type' => 'profile2', @@ -313,7 +313,7 @@ function alma_field_default_field_instances() { 'multiple_to' => '', ), 'type' => 'date_default', - 'weight' => 7, + 'weight' => 8, ), ), 'entity_type' => 'profile2', @@ -345,6 +345,70 @@ function alma_field_default_field_instances() { ), ); + // Exported field_instance: 'profile2-provider_alma-field_alma_sms' + $field_instances['profile2-provider_alma-field_alma_sms'] = array( + 'bundle' => 'provider_alma', + 'default_value' => NULL, + 'deleted' => 0, + 'description' => '', + 'display' => array( + 'default' => array( + 'label' => 'inline', + 'module' => 'text', + 'settings' => array(), + 'type' => 'text_default', + 'weight' => 5, + ), + ), + 'entity_type' => 'profile2', + 'field_name' => 'field_alma_sms', + 'label' => 'SMS', + 'required' => 0, + 'settings' => array( + 'text_processing' => 0, + 'user_register_form' => FALSE, + ), + 'widget' => array( + 'active' => 1, + 'module' => 'text', + 'settings' => array( + 'size' => 60, + ), + 'type' => 'text_textfield', + 'weight' => 8, + ), + ); + + // Exported field_instance: 'profile2-provider_alma-field_alma_sms_id' + $field_instances['profile2-provider_alma-field_alma_sms_id'] = array( + 'bundle' => 'provider_alma', + 'default_value' => NULL, + 'deleted' => 0, + 'description' => '', + 'display' => array( + 'default' => array( + 'label' => 'hidden', + 'settings' => array(), + 'type' => 'hidden', + 'weight' => 12, + ), + ), + 'entity_type' => 'profile2', + 'field_name' => 'field_alma_sms_id', + 'label' => 'SMS id', + 'required' => 0, + 'settings' => array( + 'text_processing' => 0, + 'user_register_form' => FALSE, + ), + 'widget' => array( + 'module' => 'virtual_field', + 'settings' => array(), + 'type' => 'hidden', + 'weight' => 11, + ), + ); + // Exported field_instance: 'profile2-provider_alma-field_alma_street_name' $field_instances['profile2-provider_alma-field_alma_street_name'] = array( 'bundle' => 'provider_alma', @@ -388,6 +452,8 @@ function alma_field_default_field_instances() { t('Postal code'); t('Preferred branch'); t('Reservation pause'); + t('SMS'); + t('SMS id'); t('Set your reservations on pause.'); t('Street name'); t('The e-mail address is not made public and will only be used if you wish to receive certain news or notifications by e-mail.'); diff --git a/alma.info b/alma.info index 4c69ca5..cc822cd 100644 --- a/alma.info +++ b/alma.info @@ -2,7 +2,6 @@ name = Alma description = Implementation of Axiell’s Alma API for DDELibra. core = 7.x package = Providers -php = 5.2.4 project = alma dependencies[] = date dependencies[] = ding_provider @@ -16,7 +15,7 @@ dependencies[] = options dependencies[] = profile2 dependencies[] = text dependencies[] = virtual_field -features[features_api][] = api:1 +features[features_api][] = api:2 features[field_base][] = field_alma_absent_id features[field_base][] = field_alma_city features[field_base][] = field_alma_full_name @@ -27,6 +26,8 @@ features[field_base][] = field_alma_phone_id features[field_base][] = field_alma_postal_code features[field_base][] = field_alma_preferred_branch features[field_base][] = field_alma_reservation_pause +features[field_base][] = field_alma_sms +features[field_base][] = field_alma_sms_id features[field_base][] = field_alma_street_name features[field_instance][] = profile2-provider_alma-field_alma_absent_id features[field_instance][] = profile2-provider_alma-field_alma_city @@ -38,6 +39,8 @@ features[field_instance][] = profile2-provider_alma-field_alma_phone_id features[field_instance][] = profile2-provider_alma-field_alma_postal_code features[field_instance][] = profile2-provider_alma-field_alma_preferred_branch features[field_instance][] = profile2-provider_alma-field_alma_reservation_pause +features[field_instance][] = profile2-provider_alma-field_alma_sms +features[field_instance][] = profile2-provider_alma-field_alma_sms_id features[field_instance][] = profile2-provider_alma-field_alma_street_name features[profile2_type][] = provider_alma files[] = alma.module diff --git a/alma.module b/alma.module index b0a791d..e81d2a6 100644 --- a/alma.module +++ b/alma.module @@ -312,6 +312,22 @@ function alma_profile2_presave($entity) { } } + // SMS number. + $value = $wrapper->field_alma_sms->value(); + if (!is_null($wrapper_original->field_alma_sms->value())) { + // Update sms phone number. + $value = is_null($value) ? 'DELETE' : $value; + if ($value != $wrapper_original->field_alma_sms->value()) { + $changes['sms'] = $value; + + // Get sms id. + $changes['sms_id'] = $wrapper->field_alma_sms_id->value(); + } + } + elseif (!is_null($value) && is_null($wrapper_original->field_alma_sms->value())) { + $changes['sms'] = $value; + } + // Mobile phone. $value = $wrapper->field_alma_mobile_phone->value(); if (!is_null($wrapper_original->field_alma_mobile_phone->value())) { @@ -400,7 +416,7 @@ function alma_update_provider($changes, $entity) { else { // Update mobile. try { - $res = alma_client_invoke('change_phone_number', $creds['name'], $creds['pass'], $changes['phone_id'], $changes['mobile']); + $res = alma_client_invoke('change_phone_number', $creds['name'], $creds['pass'], $changes['phone_id'], $changes['mobile'], FALSE); } catch (Exception $exception) { watchdog_exception('Alma provider', $exception); @@ -415,7 +431,7 @@ function alma_update_provider($changes, $entity) { elseif (isset($changes['mobile'])) { // Add mobile. try { - $res = alma_client_invoke('add_phone_number', $creds['name'], $creds['pass'], $changes['mobile']); + $res = alma_client_invoke('add_phone_number', $creds['name'], $creds['pass'], $changes['mobile'], FALSE); } catch (Exception $exception) { watchdog_exception('Alma provider', $exception); @@ -426,6 +442,51 @@ function alma_update_provider($changes, $entity) { } } + // Mobile phone; add, change, delete. + if (isset($changes['sms_id'])) { + if ($changes['sms'] == 'DELETE') { + // Delete mobile. + try { + $res = alma_client_invoke('remove_phone_number', $creds['name'], $creds['pass'], $changes['sms_id']); + } + catch (Exception $exception) { + watchdog_exception('Alma provider', $exception); + } + + if (empty($res)) { + $error_message .= t('sms not deleted'); + drupal_set_message($error_message, 'warning'); + } + } + else { + // Update mobile. + try { + $res = alma_client_invoke('change_phone_number', $creds['name'], $creds['pass'], $changes['sms_id'], $changes['sms']); + } + catch (Exception $exception) { + watchdog_exception('Alma provider', $exception); + } + + if (!$res) { + $error_message .= t('sms not updated'); + drupal_set_message($error_message, 'warning'); + } + } + } + elseif (isset($changes['sms'])) { + // Add mobile. + try { + $res = alma_client_invoke('add_phone_number', $creds['name'], $creds['pass'], $changes['sms']); + } + catch (Exception $exception) { + watchdog_exception('Alma provider', $exception); + } + if (!$res) { + $error_message .= t('sms not added'); + drupal_set_message($error_message, 'warning'); + } + } + // Update reservation pause (absentPeriod). if (!empty($changes['absent_id']) && !empty($changes['reservation_pause_start']) && @@ -625,10 +686,17 @@ function alma_profile2_load($entities) { // Preferred_branch. $wrapper->field_alma_preferred_branch->set($patron->branch); - // Mobile; also here alma supports multiple phones - again we pick the - // first. - $wrapper->field_alma_mobile_phone->set(isset($patron->mobiles[0]['phone']) ? $patron->mobiles[0]['phone'] : ''); - $wrapper->field_alma_phone_id->set(isset($patron->mobiles[0]['id']) ? $patron->mobiles[0]['id'] : NULL); + // Mobile (SMS and telephone). + foreach ($patron->mobiles as $mobile) { + if ($mobile['sms']) { + $wrapper->field_alma_sms->set(isset($mobile['phone']) ? $mobile['phone'] : ''); + $wrapper->field_alma_sms_id->set(isset($mobile['id']) ? $mobile['id'] : NULL); + } + else { + $wrapper->field_alma_mobile_phone->set(isset($mobile['phone']) ? $mobile['phone'] : ''); + $wrapper->field_alma_phone_id->set(isset($mobile['id']) ? $mobile['id'] : NULL); + } + } // Mail address. $wrapper->field_alma_mail->set($patron->email); From a83bdb48ff56f588b1c8c55770b727d62ff24491 Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Tue, 20 May 2014 14:06:42 +0200 Subject: [PATCH 13/20] Added alma code about sms number from ding_user --- alma.module | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/alma.module b/alma.module index e81d2a6..2f92b8c 100644 --- a/alma.module +++ b/alma.module @@ -704,6 +704,20 @@ function alma_profile2_load($entities) { } } +/** + * Implements hook_field_attach_view_alter(). + * + * Alter user profile view with SMS TAX. + */ +function alma_field_attach_view_alter(&$output, $context) { + if (isset($output['field_alma_sms'][0]['#markup'])) { + $ding_user_tax_sms = variable_get('ding_user_tax_sms', t('Notice that there is a fee for receiving a SMS')); + if ($ding_user_tax_sms) { + $output['field_alma_sms'][0]['#markup'] .= '(' . $ding_user_tax_sms . ')'; + } + } +} + /** * Implements hook_ding_session_cache_defaults(). * From 490373bbeb546bcb40c99e755504cc05aabcdb4c Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Tue, 20 May 2014 16:33:43 +0200 Subject: [PATCH 14/20] Issue #354 cableman: Updated alma reservations to display the status from alma on inter libaray loans --- includes/alma.reservation.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/alma.reservation.inc b/includes/alma.reservation.inc index b560c6c..906d4d8 100644 --- a/includes/alma.reservation.inc +++ b/includes/alma.reservation.inc @@ -179,7 +179,7 @@ function alma_reservation_list($account, $type = NULL) { elseif ($reservation['id'] < 0) { // Inter-library loan reservations have negative IDs (undocumented // Axiell "feature"). - $data['ill_status'] = TRUE; + $data['ill_status'] = $reservation['status']; $data['reservation_type'] = DING_RESERVATION_INTERLIBRARY_LOANS; // Create reservation object. From 5d34657ed83144f7eaf142c2cfd2351febe40b94 Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Thu, 22 May 2014 10:37:50 +0200 Subject: [PATCH 15/20] Updated SMS tax naming to SMS fee --- alma.module | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/alma.module b/alma.module index 2f92b8c..4f6ae8e 100644 --- a/alma.module +++ b/alma.module @@ -707,13 +707,13 @@ function alma_profile2_load($entities) { /** * Implements hook_field_attach_view_alter(). * - * Alter user profile view with SMS TAX. + * Alter user profile view with SMS fee. */ function alma_field_attach_view_alter(&$output, $context) { if (isset($output['field_alma_sms'][0]['#markup'])) { - $ding_user_tax_sms = variable_get('ding_user_tax_sms', t('Notice that there is a fee for receiving a SMS')); - if ($ding_user_tax_sms) { - $output['field_alma_sms'][0]['#markup'] .= '(' . $ding_user_tax_sms . ')'; + $ding_user_fee_sms = variable_get('ding_user_fee_sms', t('Notice that there is a fee for receiving a SMS')); + if ($ding_user_fee_sms) { + $output['field_alma_sms'][0]['#markup'] .= '(' . $ding_user_fee_sms . ')'; } } } From dbbe6841bee17f3974d36f2cdbd6e6d68a3d39f2 Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Wed, 25 Jun 2014 15:37:44 +0200 Subject: [PATCH 16/20] Ensured that alma parton cache is refreshed on save --- alma.module | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/alma.module b/alma.module index 4f6ae8e..d4dccde 100644 --- a/alma.module +++ b/alma.module @@ -162,6 +162,9 @@ function alma_client() { * @param string $method * The desired method. * + * @throws Exception + * Provider exception if communication fails. + * * @return array * NULL on error, or the result of the method call. */ @@ -569,6 +572,11 @@ function alma_update_provider($changes, $entity) { user_save($user); } } + + // Update patron information and update cache. + if (!empty($changes)) { + alma_get_patron($creds, TRUE); + } } /** From cf97641dca3ef4875a85e3bdc751752cef0401fe Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Mon, 8 Sep 2014 11:17:16 +0200 Subject: [PATCH 17/20] Updated date to 2.8 --- alma.make | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alma.make b/alma.make index 1b02f91..814def9 100644 --- a/alma.make +++ b/alma.make @@ -4,7 +4,7 @@ core = 7.x ; Contrib projects[date][subdir] = "contrib" -projects[date][version] = "2.7" +projects[date][version] = "2.8" projects[email][subdir] = "contrib" projects[email][version] = "1.3" From fae4ec8c5edc5f57251add08a262ddd626ee1adb Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Tue, 23 Sep 2014 15:58:12 +0200 Subject: [PATCH 18/20] Added user category and blocks code to the user information --- includes/alma.user.inc | 7 +++++++ lib/AlmaClient/AlmaClient.class.php | 1 + 2 files changed, 8 insertions(+) diff --git a/includes/alma.user.inc b/includes/alma.user.inc index 9407530..98addb4 100644 --- a/includes/alma.user.inc +++ b/includes/alma.user.inc @@ -58,8 +58,15 @@ function alma_user_authenticate($uid, $pass) { ); } + // Set the users categories. + if (!empty($res['category'])) { + $return['user']['category'] = $res['category']; + } + $return['user']['blocked'] = FALSE; if (!empty($res['blocks'])) { + // Send block codes back with the user. + $return['user']['blocks'] = $res['blocks']; $return['user']['blocked'] = TRUE; } diff --git a/lib/AlmaClient/AlmaClient.class.php b/lib/AlmaClient/AlmaClient.class.php index f552f47..fd1a1b2 100644 --- a/lib/AlmaClient/AlmaClient.class.php +++ b/lib/AlmaClient/AlmaClient.class.php @@ -266,6 +266,7 @@ public function get_patron_info($borr_card, $pin_code, $extended = FALSE) { 'addresses' => array(), 'mails' => array(), 'phones' => array(), + 'category' => $info->getAttribute('patronCategory'), ); foreach ($info->getElementsByTagName('address') as $address) { From 44f6a0bf85476a437f8142b43023843696be181d Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Mon, 6 Oct 2014 11:06:42 +0200 Subject: [PATCH 19/20] Updated makefile to point to development branch --- alma.make | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/alma.make b/alma.make index 140f067..814def9 100644 --- a/alma.make +++ b/alma.make @@ -22,10 +22,10 @@ projects[virtual_field][version] = "1.2" 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][branch] = "master" +projects[ding_provider][download][url] = "git@github.com:ding2tal/ding_provider.git" +projects[ding_provider][download][branch] = "development" projects[ding_reservation][type] = "module" projects[ding_reservation][download][type] = "git" -projects[ding_reservation][download][url] = "git@github.com:ding2/ding_reservation.git" -projects[ding_reservation][download][branch] = "master" +projects[ding_reservation][download][url] = "git@github.com:ding2tal/ding_reservation.git" +projects[ding_reservation][download][branch] = "development" From e22dcd6acb766092dd4415b510763357a711ec6d Mon Sep 17 00:00:00 2001 From: Jesper Kristensen Date: Mon, 6 Oct 2014 14:30:59 +0200 Subject: [PATCH 20/20] Updated make file to point to master branch --- alma.make | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/alma.make b/alma.make index 814def9..140f067 100644 --- a/alma.make +++ b/alma.make @@ -22,10 +22,10 @@ projects[virtual_field][version] = "1.2" 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] = "development" +projects[ding_provider][download][url] = "git@github.com:ding2/ding_provider.git" +projects[ding_provider][download][branch] = "master" projects[ding_reservation][type] = "module" projects[ding_reservation][download][type] = "git" -projects[ding_reservation][download][url] = "git@github.com:ding2tal/ding_reservation.git" -projects[ding_reservation][download][branch] = "development" +projects[ding_reservation][download][url] = "git@github.com:ding2/ding_reservation.git" +projects[ding_reservation][download][branch] = "master"