diff --git a/CRM/Admin/Form/ResourceConfigOption.php b/CRM/Admin/Form/ResourceConfigOption.php
index 16d1a31b..3d987030 100644
--- a/CRM/Admin/Form/ResourceConfigOption.php
+++ b/CRM/Admin/Form/ResourceConfigOption.php
@@ -66,6 +66,7 @@ public function buildQuickForm($check = FALSE) {
$this->add('text', 'label', ts('Label'), array('size' => 50, 'maxlength' => 255), TRUE);
$this->add('text', 'price', ts('Price'), CRM_Core_DAO::getAttribute('CRM_Booking_DAO_ResourceConfigOption', 'price '), TRUE);
$this->add('text', 'max_size', ts('Max Size'), CRM_Core_DAO::getAttribute('CRM_Booking_DAO_ResourceConfigOption', 'max_size '), TRUE);
+ $this->addEntityRef('owner_id', ts('Select Resource Owner'));
$this->add('text', 'weight', ts('Weight'), CRM_Core_DAO::getAttribute('CRM_Booking_DAO_ResourceConfigOption', 'weight'), TRUE);
$this->add('checkbox', 'is_active', ts('Enabled?'));
diff --git a/CRM/Admin/Page/ResourceConfigOption.php b/CRM/Admin/Page/ResourceConfigOption.php
index 5d97e386..a9d13a02 100644
--- a/CRM/Admin/Page/ResourceConfigOption.php
+++ b/CRM/Admin/Page/ResourceConfigOption.php
@@ -144,6 +144,17 @@ function browse($action = NULL) {
CRM_Core_DAO::storeValues($dao, $configOptions[$dao->id]);
$configOptions[$dao->id]['unit'] = CRM_Utils_Array::value(CRM_Utils_Array::value('unit_id', $configOptions[$dao->id]), $units);
+ if ($dao->owner_id > 0) {
+ $configOptions[$dao->id]['owner'] = civicrm_api3('Contact', 'getvalue', array(
+ 'sequential' => 1,
+ 'return' => "display_name",
+ 'id' => $dao->owner_id,
+ ));
+ }
+ else {
+ $configOptions[$dao->id]['owner'] = '';
+ }
+
// form all action links
$action = array_sum(array_keys($this->links()));
diff --git a/CRM/Booking/DAO/ResourceConfigOption.php b/CRM/Booking/DAO/ResourceConfigOption.php
index bd33457c..4b3afec8 100644
--- a/CRM/Booking/DAO/ResourceConfigOption.php
+++ b/CRM/Booking/DAO/ResourceConfigOption.php
@@ -243,6 +243,16 @@ static function &fields()
'dataPattern' => '',
'export' => true,
) ,
+ 'owner_id' => array(
+ 'name' => 'owner_id',
+ 'type' => CRM_Utils_Type::T_INT,
+ 'title' => ts('Owner Id') ,
+ 'import' => true,
+ 'where' => 'civicrm_booking_resource_config_option.owner_id',
+ 'headerPattern' => '',
+ 'dataPattern' => '',
+ 'export' => true,
+ ) ,
);
}
return self::$_fields;
diff --git a/CRM/Booking/Upgrader.php b/CRM/Booking/Upgrader.php
index ee1e7eb4..7e2918a4 100755
--- a/CRM/Booking/Upgrader.php
+++ b/CRM/Booking/Upgrader.php
@@ -119,7 +119,11 @@ public function upgrade_1100() {
return TRUE;
}
-
+ public function upgrade_1510() {
+ $this->ctx->log->info('Applying update 1510');
+ $this->executeSqlFile('sql/upgrade_1510.sql');
+ return TRUE;
+ }
/**
* Example: Run a couple simple queries
diff --git a/booking.php b/booking.php
index fa718f34..c5fc04f4 100644
--- a/booking.php
+++ b/booking.php
@@ -188,23 +188,33 @@ function booking_civicrm_entityTypes(&$entityTypes) {
* Implementation of hook_civicrm_merge
*/
function booking_civicrm_merge ( $type, &$data, $mainId = NULL, $otherId = NULL, $tables = NULL ){
-if (!empty($mainId) && !empty($otherId) && $type == 'sqls'){
+ if (!empty($mainId) && !empty($otherId)){
+ if ($type == 'sqls') {
+ $query1 = "
+ UPDATE civicrm_booking
+ SET primary_contact_id=$mainId
+ WHERE primary_contact_id=$otherId;
+ ";
+ $query2 = "
+ UPDATE civicrm_booking
+ SET secondary_contact_id=$mainId
+ WHERE secondary_contact_id=$otherId;
+ ";
+
+ require_once('CRM/Core/DAO.php');
+ $dao = CRM_Core_DAO::executeQuery( $query1 );
+ $dao = CRM_Core_DAO::executeQuery( $query2 );
+ }
- $query1 = "
- UPDATE civicrm_booking
- SET primary_contact_id=$mainId
- WHERE primary_contact_id=$otherId;
- ";
- $query2 = "
- UPDATE civicrm_booking
- SET secondary_contact_id=$mainId
- WHERE secondary_contact_id=$otherId;
+ $updateResourceOwnerQuery = "
+ UPDATE civicrm_booking_resource_config_option
+ SET owner_id=$mainId
+ WHERE owner_id=$otherId;
";
- require_once('CRM/Core/DAO.php');
- $dao = CRM_Core_DAO::executeQuery( $query1 );
- $dao = CRM_Core_DAO::executeQuery( $query2 );
+ $dao = CRM_Core_DAO::executeQuery( $updateResourceOwnerQuery );
+ echo "merge hook thrown\n";
}
}
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
new file mode 100644
index 00000000..0f9f25d3
--- /dev/null
+++ b/phpunit.xml.dist
@@ -0,0 +1,18 @@
+
+