Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Commit

Permalink
Merge pull request #180 from compucorp/develop
Browse files Browse the repository at this point in the history
Merge develop into master
  • Loading branch information
guanhuan authored Dec 12, 2018
2 parents 6ab812e + 517141f commit 7d20e05
Show file tree
Hide file tree
Showing 76 changed files with 861 additions and 697 deletions.
25 changes: 13 additions & 12 deletions CRM/Admin/Form/AdhocChargesItem.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
use CRM_Booking_ExtensionUtil as E;
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.4 |
Expand Down Expand Up @@ -41,7 +42,7 @@ class CRM_Admin_Form_AdhocChargesItem extends CRM_Admin_Form {

function preProcess() {
parent::preProcess();
CRM_Utils_System::setTitle(ts('Settings - Additional Charges Item'));
CRM_Utils_System::setTitle(E::ts('Settings - Additional Charges Item'));
}

/**
Expand All @@ -58,12 +59,12 @@ public function buildQuickForm($check = FALSE) {
}

// create form elements
$this->add('text', 'label', ts('Label'), array('size' => 50, 'maxlength' => 255), TRUE);
$this->add('text', 'price', ts('Price'), array('size' => 10, 'maxlength' => 255), TRUE);
$this->add('text', 'weight', ts('Weight'), CRM_Core_DAO::getAttribute('CRM_Booking_DAO_AdhocChargesItem', 'weight'), TRUE);
$this->add('checkbox', 'is_active', ts('Enabled?'));
$this->add('text', 'label', E::ts('Label'), array('size' => 50, 'maxlength' => 255), TRUE);
$this->add('text', 'price', E::ts('Price'), array('size' => 10, 'maxlength' => 255), TRUE);
$this->add('text', 'weight', E::ts('Weight'), CRM_Core_DAO::getAttribute('CRM_Booking_DAO_AdhocChargesItem', 'weight'), TRUE);
$this->add('checkbox', 'is_active', E::ts('Enabled?'));

$this->addRule("price", ts('Please enter a valid amount.'), 'money');
$this->addRule("price", E::ts('Please enter a valid amount.'), 'money');

// add form rule
$this->addFormRule(array('CRM_Admin_Form_AdhocChargesItem', 'formRule'), $this);
Expand All @@ -75,12 +76,12 @@ public function buildQuickForm($check = FALSE) {
array(
array(
'type' => 'next',
'name' => ts('Save'),
'name' => E::ts('Save'),
'isDefault' => TRUE,
),
array(
'type' => 'cancel',
'name' => ts('Cancel'),
'name' => E::ts('Cancel'),
'js' => array('onclick' => "location.href='{$cancelURL}'; return false;"),
),
)
Expand All @@ -94,7 +95,7 @@ static function formRule($fields) {
// put validation
if(!is_numeric($price)){
// set error msg
$errors['price'] = ts('This field should be numeric.');
$errors['price'] = E::ts('This field should be numeric.');
}
if (!empty($errors)) {
return $errors;
Expand Down Expand Up @@ -131,7 +132,7 @@ public function postProcess() {
// TODO::Make sure we cannot delete if the entity is linked to bookings
if ($this->_action & CRM_Core_Action::DELETE) {
CRM_Booking_BAO_AdhocChargesItem::del($this->_id);
CRM_Core_Session::setStatus(ts('Selected additional charges item has been deleted.'), ts('Record Deleted'), 'success');
CRM_Core_Session::setStatus(E::ts('Selected additional charges item has been deleted.'), E::ts('Record Deleted'), 'success');
}
else {
$params = $this->exportValues();
Expand All @@ -145,12 +146,12 @@ public function postProcess() {

// udpate action
if ($this->_action & CRM_Core_Action::UPDATE) {
CRM_Core_Session::setStatus(ts('The Record \'%1\' has been saved.', array(1 => $set->label)), ts('Saved'), 'success');
CRM_Core_Session::setStatus(E::ts('The Record \'%1\' has been saved.', array(1 => $set->label)), E::ts('Saved'), 'success');
}
else {
$url = CRM_Utils_System::url('civicrm/admin/adhoc_charges_item', 'reset=1&action=browse&sid=' . $set->id);
CRM_Core_Session::setStatus(
ts("Your additional charges item '%1' has been added.", array(1 => $set->label)), ts('Saved'), 'success');
E::ts("Your additional charges item '%1' has been added.", array(1 => $set->label)), E::ts('Saved'), 'success');
$session = CRM_Core_Session::singleton();
$session->replaceUserContext($url);
}
Expand Down
29 changes: 15 additions & 14 deletions CRM/Admin/Form/Preferences/Booking.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
use CRM_Booking_ExtensionUtil as E;
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.4 |
Expand Down Expand Up @@ -41,7 +42,7 @@ class CRM_Admin_Form_Preferences_Booking extends CRM_Core_Form {

function preProcess() {
parent::preProcess();
CRM_Utils_System::setTitle(ts('Settings - Booking Preferences Configuration'));
CRM_Utils_System::setTitle(E::ts('Settings - Booking Preferences Configuration'));

$configValue = CRM_Booking_BAO_BookingConfig::getConfig();
$this->_config = $configValue;
Expand All @@ -66,32 +67,32 @@ public function buildQuickForm($check = FALSE) {
$timeOptions[$option] = $option;
}

$this->add('select', 'day_start_at', ts('Day starts at'),
$this->add('select', 'day_start_at', E::ts('Day starts at'),
$timeOptions ,
FALSE,
array()
);

$this->add('select', 'day_end_at', ts('Day ends at'),
$this->add('select', 'day_end_at', E::ts('Day ends at'),
$timeOptions,
FALSE,
array()
);
/*
$this->add('select', 'time_period', ts('Time period'),
$this->add('select', 'time_period', E::ts('Time period'),
array(10 => '10', 15 => '15', 20 => '20', 30 => '30', 60 => '60'),
FALSE,
array()
);*/

$this->add('text', 'cc_email_address', ts('CC'), array('size' => 50, 'maxlength' => 255), FALSE);
$this->add('text', 'bcc_email_address', ts('BCC'), array('size' => 50, 'maxlength' => 255), FALSE);
$this->add('checkbox', 'log_confirmation_email', ts('Log email?'));
$this->add('checkbox', 'unlimited_resource_time_config', ts(''));
$this->add('text', 'slot_new_colour', ts('New Slot Colour'));
$this->add('text', 'slot_being_edited_colour', ts('Slot Editing Colour'));
$this->add('text', 'slot_booked_colour', ts('Booked Slot Colour'));
$this->add('text', 'slot_provisional_colour', ts('Provisional Slot Colour'));
$this->add('text', 'cc_email_address', E::ts('CC'), array('size' => 50, 'maxlength' => 255), FALSE);
$this->add('text', 'bcc_email_address', E::ts('BCC'), array('size' => 50, 'maxlength' => 255), FALSE);
$this->add('checkbox', 'log_confirmation_email', E::ts('Log email?'));
$this->add('checkbox', 'unlimited_resource_time_config', E::ts(''));
$this->add('text', 'slot_new_colour', E::ts('New Slot Colour'));
$this->add('text', 'slot_being_edited_colour', E::ts('Slot Editing Colour'));
$this->add('text', 'slot_booked_colour', E::ts('Booked Slot Colour'));
$this->add('text', 'slot_provisional_colour', E::ts('Provisional Slot Colour'));


$this->addFormRule(array('CRM_Admin_Form_Preferences_Booking', 'formRule'), $this);
Expand All @@ -100,7 +101,7 @@ public function buildQuickForm($check = FALSE) {
array(
array(
'type' => 'next',
'name' => ts('Save'),
'name' => E::ts('Save'),
'isDefault' => TRUE,
),
)
Expand Down Expand Up @@ -160,7 +161,7 @@ public function postProcess() {

$url = CRM_Utils_System::url('civicrm/admin/setting/preferences/booking', 'reset=1');
// show message
CRM_Core_Session::setStatus(ts('The Booking configuration has been saved.'), ts('Saved'), 'success');
CRM_Core_Session::setStatus(E::ts('The Booking configuration has been saved.'), E::ts('Saved'), 'success');
$session = CRM_Core_Session::singleton();
$session->replaceUserContext($url);
}
Expand Down
37 changes: 19 additions & 18 deletions CRM/Admin/Form/Resource.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
use CRM_Booking_ExtensionUtil as E;
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.4 |
Expand Down Expand Up @@ -41,7 +42,7 @@ class CRM_Admin_Form_Resource extends CRM_Admin_Form {

function preProcess() {
parent::preProcess();
CRM_Utils_System::setTitle(ts('Settings - Resource'));
CRM_Utils_System::setTitle(E::ts('Settings - Resource'));
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive',
$this, FALSE, 0
);
Expand All @@ -62,26 +63,26 @@ public function buildQuickForm($check = FALSE) {


$types = CRM_Booking_BAO_Resource::buildOptions('type_id', 'create');
$this->add('select', 'type_id', ts('Resource type'),
array('' => ts('- select -')) + $types,
$this->add('select', 'type_id', E::ts('Resource type'),
array('' => E::ts('- select -')) + $types,
TRUE,
array()
);

$this->add('text', 'label', ts('Label'), array('size' => 50, 'maxlength' => 255), TRUE);
$this->add('textarea', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Booking_DAO_Resource', 'description'), FALSE);
$this->add('text', 'label', E::ts('Label'), array('size' => 50, 'maxlength' => 255), TRUE);
$this->add('textarea', 'description', E::ts('Description'), CRM_Core_DAO::getAttribute('CRM_Booking_DAO_Resource', 'description'), FALSE);
/*
$this->addWysiwyg('description',
ts('Description'),
E::ts('Description'),
CRM_Core_DAO::getAttribute('CRM_Booking_DAO_Resource', 'description')
);*/

$this->add('text', 'weight', ts('Weight'), CRM_Core_DAO::getAttribute('CRM_Booking_DAO_Resource', 'weight'), TRUE);
$statusCheckbox = $this->add('advcheckbox', 'is_active', ts('Enabled?'));
$this->add('advcheckbox', 'is_unlimited', ts('Is Unlimited?'));
$this->add('text', 'weight', E::ts('Weight'), CRM_Core_DAO::getAttribute('CRM_Booking_DAO_Resource', 'weight'), TRUE);
$statusCheckbox = $this->add('advcheckbox', 'is_active', E::ts('Enabled?'));
$this->add('advcheckbox', 'is_unlimited', E::ts('Is Unlimited?'));


$configSets = array('' => ts('- select -'));
$configSets = array('' => E::ts('- select -'));
try{
$activeSets = civicrm_api3('ResourceConfigSet', 'get', array('is_active' => 1, 'is_deleted' => 0));
foreach ($activeSets['values'] as $key => $set) {
Expand All @@ -100,11 +101,11 @@ public function buildQuickForm($check = FALSE) {
$statusCheckbox->setAttribute('disabled', 'disabled');
}

$this->add('select', 'set_id', ts('Resource configuration set'), $configSets, TRUE);
$this->add('select', 'set_id', E::ts('Resource configuration set'), $configSets, TRUE);

$locations = CRM_Booking_BAO_Resource::buildOptions('location_id', 'create');
$this->add('select', 'location_id', ts('Resource Location'),
array('' => ts('- select -')) + $locations,
$this->add('select', 'location_id', E::ts('Resource Location'),
array('' => E::ts('- select -')) + $locations,
FALSE,
array()
);
Expand All @@ -116,12 +117,12 @@ public function buildQuickForm($check = FALSE) {
array(
array(
'type' => 'next',
'name' => ts('Save'),
'name' => E::ts('Save'),
'isDefault' => TRUE,
),
array(
'type' => 'cancel',
'name' => ts('Cancel'),
'name' => E::ts('Cancel'),
'js' => array('onclick' => "location.href='{$cancelURL}'; return false;"),
),
)
Expand All @@ -136,7 +137,7 @@ static function formRule($fields) {
$options = civicrm_api3('ResourceConfigOption', 'get', array('set_id' => $setId));
$count = CRM_Utils_Array::value('count', $options);
if($count == 0){
$errors['set_id'] = ts('The selected set does not contain any options, please select another');
$errors['set_id'] = E::ts('The selected set does not contain any options, please select another');
}
}
catch (CiviCRM_API3_Exception $e) {}
Expand Down Expand Up @@ -174,7 +175,7 @@ public function postProcess() {
CRM_Booking_BAO_Slot::delByResource($this->_id);

CRM_Booking_BAO_Resource::del($this->_id);
CRM_Core_Session::setStatus(ts('Selected resource has been deleted.'), ts('Record Deleted'), 'success');
CRM_Core_Session::setStatus(E::ts('Selected resource has been deleted.'), E::ts('Record Deleted'), 'success');

}
else {
Expand All @@ -184,7 +185,7 @@ public function postProcess() {


$resource = CRM_Booking_BAO_Resource::create($params);
CRM_Core_Session::setStatus(ts('The Record \'%1\' has been saved.', array(1 => $resource->label)), ts('Saved'), 'success');
CRM_Core_Session::setStatus(E::ts('The Record \'%1\' has been saved.', array(1 => $resource->label)), E::ts('Saved'), 'success');
}
}

Expand Down
27 changes: 14 additions & 13 deletions CRM/Admin/Form/ResourceConfigOption.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
use CRM_Booking_ExtensionUtil as E;
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.4 |
Expand Down Expand Up @@ -42,7 +43,7 @@ class CRM_Admin_Form_ResourceConfigOption extends CRM_Admin_Form {

function preProcess() {
parent::preProcess();
CRM_Utils_System::setTitle(ts('Settings - Resource Configuration Option'));
CRM_Utils_System::setTitle(E::ts('Settings - Resource Configuration Option'));
$this->_sid = CRM_Utils_Request::retrieve('sid', 'Positive',
$this, FALSE, 0
);
Expand All @@ -63,17 +64,17 @@ public function buildQuickForm($check = FALSE) {
return;
}

$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->add('text', 'weight', ts('Weight'), CRM_Core_DAO::getAttribute('CRM_Booking_DAO_ResourceConfigOption', 'weight'), TRUE);
$this->add('checkbox', 'is_active', ts('Enabled?'));
$this->add('text', 'label', E::ts('Label'), array('size' => 50, 'maxlength' => 255), TRUE);
$this->add('text', 'price', E::ts('Price'), CRM_Core_DAO::getAttribute('CRM_Booking_DAO_ResourceConfigOption', 'price '), TRUE);
$this->add('text', 'max_size', E::ts('Max Size'), CRM_Core_DAO::getAttribute('CRM_Booking_DAO_ResourceConfigOption', 'max_size '), TRUE);
$this->add('text', 'weight', E::ts('Weight'), CRM_Core_DAO::getAttribute('CRM_Booking_DAO_ResourceConfigOption', 'weight'), TRUE);
$this->add('checkbox', 'is_active', E::ts('Enabled?'));

$this->addRule("price", ts('Please enter a valid amount.'), 'money');
$this->addRule("price", E::ts('Please enter a valid amount.'), 'money');

$units = CRM_Booking_BAO_ResourceConfigOption::buildOptions('unit_id', 'create');
$this->add('select', 'unit_id', ts('Unit'),
array('' => ts('- select -')) + $units,
$this->add('select', 'unit_id', E::ts('Unit'),
array('' => E::ts('- select -')) + $units,
TRUE,
array()
);
Expand All @@ -85,12 +86,12 @@ public function buildQuickForm($check = FALSE) {
array(
array(
'type' => 'next',
'name' => ts('Save'),
'name' => E::ts('Save'),
'isDefault' => TRUE,
),
array(
'type' => 'cancel',
'name' => ts('Cancel'),
'name' => E::ts('Cancel'),
'js' => array('onclick' => "location.href='{$cancelURL}'; return false;"),
),
)
Expand Down Expand Up @@ -132,7 +133,7 @@ public function postProcess() {
$params = $this->exportValues();
if ($this->_action & CRM_Core_Action::DELETE) {
CRM_Booking_BAO_ResourceConfigOption::del($this->_id);
CRM_Core_Session::setStatus(ts('Selected resource configuration option has been deleted.'), ts('Record Deleted'), 'success');
CRM_Core_Session::setStatus(E::ts('Selected resource configuration option has been deleted.'), E::ts('Record Deleted'), 'success');
}
else {
$params = $this->exportValues();
Expand All @@ -149,7 +150,7 @@ public function postProcess() {
$params['id'] = $this->_id;
}
$resource = CRM_Booking_BAO_ResourceConfigOption::create($params);
CRM_Core_Session::setStatus(ts('The Record \'%1\' has been saved.', array(1 => $resource->label)), ts('Saved'), 'success');
CRM_Core_Session::setStatus(E::ts('The Record \'%1\' has been saved.', array(1 => $resource->label)), E::ts('Saved'), 'success');

}

Expand Down
Loading

0 comments on commit 7d20e05

Please sign in to comment.