Skip to content

Commit

Permalink
Merge remote-tracking branch 'internal/dev_24'
Browse files Browse the repository at this point in the history
  • Loading branch information
bjendres committed Feb 5, 2016
2 parents fabcfcc + 7b4845d commit b5a580e
Show file tree
Hide file tree
Showing 31 changed files with 308 additions and 308 deletions.
34 changes: 17 additions & 17 deletions CRM/Admin/Form/Setting/DonrecSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,26 @@
class CRM_Admin_Form_Setting_DonrecSettings extends CRM_Admin_Form_Setting
{
function buildQuickForm( ) {
CRM_Utils_System::setTitle(ts('Donation Receipts - Settings'));
CRM_Utils_System::setTitle(ts('Donation Receipts - Settings', array('domain' => 'de.systopia.donrec')));

//TODO: why not use the definitions in donrec.setting.php?
// add all required elements
$this->addElement('text', 'draft_text', ts('Draft text'));
$this->addElement('text', 'copy_text', ts('Copy text'));
$this->addElement('text', 'packet_size', ts('Packet size'));
$this->addElement('text', 'draft_text', ts('Draft text', array('domain' => 'de.systopia.donrec')));
$this->addElement('text', 'copy_text', ts('Copy text', array('domain' => 'de.systopia.donrec')));
$this->addElement('text', 'packet_size', ts('Packet size', array('domain' => 'de.systopia.donrec')));
$this->addElement('checkbox','store_pdf'); // actually inserted via template
$this->addElement('checkbox','financial_types_all'); // "
$this->addElement('text', 'pdfinfo_path', ts('External Tool: path to <code>pdfinfo</code>'));
$this->addElement('text', 'pdfinfo_path', ts('External Tool: path to <code>pdfinfo</code>', array('domain' => 'de.systopia.donrec')));

// add location-type-selections
$query = "SELECT `id`, `name` FROM `civicrm_location_type`";
$result = CRM_Core_DAO::executeQuery($query);
$options = array(0 => ts('primary address'));
while ($result->fetch()) {$options[$result->id] = ts($result->name);}
$this->addElement('select', 'legal_address', ts('Legal Address-Type:'), $options);
$this->addElement('select', 'postal_address', ts('Postal Address-Type:'), $options);
$this->addElement('select', 'legal_address_fallback', ts('Fallback:'), $options);
$this->addElement('select', 'postal_address_fallback', ts('Fallback:'), $options);
$options = array(0 => ts('primary address', array('domain' => 'de.systopia.donrec')));
while ($result->fetch()) {$options[$result->id] = ts($result->name, array('domain' => 'de.systopia.donrec'));}
$this->addElement('select', 'legal_address', ts('Legal Address-Type:', array('domain' => 'de.systopia.donrec')), $options);
$this->addElement('select', 'postal_address', ts('Postal Address-Type:', array('domain' => 'de.systopia.donrec')), $options);
$this->addElement('select', 'legal_address_fallback', ts('Fallback:', array('domain' => 'de.systopia.donrec')), $options);
$this->addElement('select', 'postal_address_fallback', ts('Fallback:', array('domain' => 'de.systopia.donrec')), $options);

// add a checkbox for every contribution type
$ct = CRM_Donrec_Logic_Settings::getContributionTypes();
Expand All @@ -43,8 +43,8 @@ function buildQuickForm( ) {
}

$this->addButtons(array(
array('type' => 'next', 'name' => ts('Save'), 'isDefault' => TRUE),
array('type' => 'cancel', 'name' => ts('Cancel')),
array('type' => 'next', 'name' => ts('Save', array('domain' => 'de.systopia.donrec')), 'isDefault' => TRUE),
array('type' => 'cancel', 'name' => ts('Cancel', array('domain' => 'de.systopia.donrec'))),
));

// add a custom form validation rule that allows only positive integers (i > 0)
Expand All @@ -53,9 +53,9 @@ function buildQuickForm( ) {
}

function addRules() {
$this->addRule('draft_text', ts('Draft text can only contain text'), 'onlyLettersUmlauts');
$this->addRule('copy_text', ts('Copy text can only contain text'), 'onlyLettersUmlauts');
$this->addRule('packet_size', ts('Packet size can only contain positive integers'), 'onlypositive');
$this->addRule('draft_text', ts('Draft text can only contain text', array('domain' => 'de.systopia.donrec')), 'onlyLettersUmlauts');
$this->addRule('copy_text', ts('Copy text can only contain text', array('domain' => 'de.systopia.donrec')), 'onlyLettersUmlauts');
$this->addRule('packet_size', ts('Packet size can only contain positive integers', array('domain' => 'de.systopia.donrec')), 'onlypositive');
//TODO add rule for unix paths
}

Expand Down Expand Up @@ -127,7 +127,7 @@ function postProcess() {
}

$session = CRM_Core_Session::singleton();
$session->setStatus(ts("Settings successfully saved"), ts('Settings'), 'success');
$session->setStatus(ts("Settings successfully saved"), ts('Settings', array('domain' => 'de.systopia.donrec')), 'success');
$session->replaceUserContext(CRM_Utils_System::url('civicrm/admin/setting/donrec'));
}

Expand Down
6 changes: 3 additions & 3 deletions CRM/Donrec/DataStructure.php
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ protected static function updateCustomGroups() {
foreach (self::$customGroups as $customGroup) {
$params = array_merge($customGroup, self::$customGroupDefaults);
// DISABLED! THERE'S HARDCODED TABLE NAMES EVERYWHERE:
//$params['title'] = ts($params['title']);
//$params['title'] = ts($params['title'], array('domain' => 'de.systopia.donrec'));
$get_params['name'] = $params['name'];
self::createIfNotExists('CustomGroup', $params, $get_params);
}
Expand Down Expand Up @@ -509,14 +509,14 @@ public static function translateCustomGroups() {
// TRANSLATE zwb_donation_receipt title
$custom_group_receipt = civicrm_api3('CustomGroup', 'getsingle', array('name' => 'zwb_donation_receipt'));
// since the API is not reliable here, we do this via SQL
$new_title = CRM_Utils_DonrecHelper::escapeString(ts('Donation Receipt'));
$new_title = CRM_Utils_DonrecHelper::escapeString(ts('Donation Receipt', array('domain' => 'de.systopia.donrec')));
$custom_group_receipt_id = (int) $custom_group_receipt['id'];
CRM_Core_DAO::executeQuery("UPDATE `civicrm_custom_group` SET title='$new_title' WHERE id=$custom_group_receipt_id;");

// TRANSLATE zwb_donation_receipt_item title
$custom_group_receipt_item = civicrm_api3('CustomGroup', 'getsingle', array('name' => 'zwb_donation_receipt_item'));
// since the API is not reliable here, we do this via SQL
$new_title = CRM_Utils_DonrecHelper::escapeString(ts('Donation Receipt Item'));
$new_title = CRM_Utils_DonrecHelper::escapeString(ts('Donation Receipt Item', array('domain' => 'de.systopia.donrec')));
$custom_group_receipt_item_id = (int) $custom_group_receipt_item['id'];
CRM_Core_DAO::executeQuery("UPDATE `civicrm_custom_group` SET title='$new_title' WHERE id=$custom_group_receipt_item_id;");

Expand Down
4 changes: 2 additions & 2 deletions CRM/Donrec/Exporters/CSV.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CRM_Donrec_Exporters_CSV extends CRM_Donrec_Logic_Exporter {
* @return the display name
*/
static function name() {
return ts("CSV File");
return ts("CSV File", array('domain' => 'de.systopia.donrec'));
}

/**
Expand Down Expand Up @@ -72,7 +72,7 @@ public function wrapUp($snapshot_id, $is_test, $is_bulk) {

// open file
$preferredFileName = ts('donation_receipts');
$preferredFileSuffix = ts('.csv');
$preferredFileSuffix = ts('.csv', array('domain' => 'de.systopia.donrec'));
$temp_file = CRM_Donrec_Logic_File::makeFileName($preferredFileName, $preferredFileSuffix);
$handle = fopen($temp_file, 'w');

Expand Down
2 changes: 1 addition & 1 deletion CRM/Donrec/Exporters/Dummy.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CRM_Donrec_Exporters_Dummy extends CRM_Donrec_Logic_Exporter {
* @return the display name
*/
static function name() {
return ts("Don't generate files");
return ts("Don't generate files", array('domain' => 'de.systopia.donrec'));
}

/**
Expand Down
20 changes: 10 additions & 10 deletions CRM/Donrec/Exporters/GroupedPDF.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CRM_Donrec_Exporters_GroupedPDF extends CRM_Donrec_Exporters_BasePDF {
* @return the display name
*/
static function name() {
return ts('Individual PDFs sorted by page count');
return ts('Individual PDFs sorted by page count', array('domain' => 'de.systopia.donrec'));
}

/**
Expand Down Expand Up @@ -54,26 +54,26 @@ public function checkRequirements() {
$pdfinfo_version = $matches[1];
if(!empty($matches) && count($matches) == 2) {
if (version_compare($pdfinfo_version, '0.18.4') >= 0) {
$result['message'] = sprintf(ts("using pdfinfo %s"), $pdfinfo_version);
$result['message'] = sprintf(ts("using pdfinfo %s", array('domain' => 'de.systopia.donrec')), $pdfinfo_version);
}else{
$result['is_error'] = TRUE;
$result['message'] = sprintf(ts("pdfinfo %s is not supported"), $pdfinfo_version);
$result['message'] = sprintf(ts("pdfinfo %s is not supported", array('domain' => 'de.systopia.donrec')), $pdfinfo_version);
}
}else{
$result['is_error'] = TRUE;
$result['message'] = ts("unknown pdfinfo version");
$result['message'] = ts("unknown pdfinfo version", array('domain' => 'de.systopia.donrec'));
}
}else{
$result['is_error'] = TRUE;
if($ret_status == 126) { // 126 - Permission problem or command is not an executable
$result['message'] = ts("pdfinfo is not executable. check permissions");
$result['message'] = ts("pdfinfo is not executable. check permissions", array('domain' => 'de.systopia.donrec'));
}else{
$result['message'] = ts("pdfinfo not found");
$result['message'] = ts("pdfinfo not found", array('domain' => 'de.systopia.donrec'));
}
}
}else{
$result['is_error'] = TRUE;
$result['message'] = ts("pdfinfo path is not set");
$result['message'] = ts("pdfinfo path is not set", array('domain' => 'de.systopia.donrec'));
}
return $result;
}
Expand Down Expand Up @@ -105,8 +105,8 @@ public function wrapUp($snapshot_id, $is_test, $is_bulk) {
// create the zip file
$config = CRM_Core_Config::singleton();

$preferredFileName = ts("donation_receipts");
$preferredSuffix = ts('.zip');
$preferredFileName = ts("donation_receipts", array('domain' => 'de.systopia.donrec'));
$preferredSuffix = ts('.zip', array('domain' => 'de.systopia.donrec'));
$archiveFileName = CRM_Donrec_Logic_File::makeFileName($preferredFileName, $preferredSuffix);
$fileURL = $archiveFileName;
$outerArchive = new ZipArchive;
Expand All @@ -133,7 +133,7 @@ public function wrapUp($snapshot_id, $is_test, $is_bulk) {
foreach($pageCountArr as $entry) {
foreach ($entry as $item) {
if($item[0] && $item[2]) { // if page count and file name exists
$folder = sprintf(ts('%d-page'), $item[0]).DIRECTORY_SEPARATOR;
$folder = sprintf(ts('%d-page', array('domain' => 'de.systopia.donrec')), $item[0]).DIRECTORY_SEPARATOR;
$opResult = $outerArchive->addFile($item[2], $folder.basename($item[2])) ;
CRM_Donrec_Logic_Exporter::addLogEntry($reply, "adding <span title='{$item[2]}'>created {$item[0]}-page PDF file</span> ($opResult)", CRM_Donrec_Logic_Exporter::LOG_TYPE_DEBUG);
}
Expand Down
6 changes: 3 additions & 3 deletions CRM/Donrec/Exporters/PDF.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CRM_Donrec_Exporters_PDF extends CRM_Donrec_Exporters_BasePDF {
* @return the display name
*/
static function name() {
return ts('Individual PDFs');
return ts('Individual PDFs', array('domain' => 'de.systopia.donrec'));
}

/**
Expand Down Expand Up @@ -50,8 +50,8 @@ public function wrapUp($snapshot_id, $is_test, $is_bulk) {
// create the zip file
$config = CRM_Core_Config::singleton();

$preferredFileName = ts("donation_receipts.zip");
$archiveFileName = CRM_Donrec_Logic_File::makeFileName(ts("donation_receipts"), ".zip");
$preferredFileName = ts("donation_receipts.zip", array('domain' => 'de.systopia.donrec'));
$archiveFileName = CRM_Donrec_Logic_File::makeFileName(ts("donation_receipts", array('domain' => 'de.systopia.donrec')), ".zip");
$zip = new ZipArchive();
$snapshot = CRM_Donrec_Logic_Snapshot::get($snapshot_id);
$ids = $snapshot->getIds();
Expand Down
14 changes: 7 additions & 7 deletions CRM/Donrec/Form/Task/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@
class CRM_Donrec_Form_Task_Create extends CRM_Core_Form {

function buildQuickForm() {
CRM_Utils_System::setTitle(ts('Issue Donation Receipts'));
CRM_Utils_System::setTitle(ts('Issue Donation Receipts', array('domain' => 'de.systopia.donrec')));

$this->addElement('hidden', 'cid');
$this->addElement('hidden', 'rsid');
$options = array(
'current_year' => ts('This Year'),
'last_year' => ts('last year'),
'customized_period' => ts('Choose Date Range')
'current_year' => ts('This Year', array('domain' => 'de.systopia.donrec')),
'last_year' => ts('last year', array('domain' => 'de.systopia.donrec')),
'customized_period' => ts('Choose Date Range', array('domain' => 'de.systopia.donrec'))
);
$this->addElement('select', 'time_period', 'Time Period:', $options);
$this->addDateRange('donrec_contribution_horizon', '_from', '_to', ts('From:'), 'searchDate', TRUE, FALSE);
$this->addDefaultButtons(ts('Continue'));
$this->addDateRange('donrec_contribution_horizon', '_from', '_to', ts('From:', array('domain' => 'de.systopia.donrec')), 'searchDate', TRUE, FALSE);
$this->addDefaultButtons(ts('Continue', array('domain' => 'de.systopia.donrec')));
}

function setDefaultValues() {
Expand Down Expand Up @@ -168,7 +168,7 @@ function postProcess() {
CRM_Core_Session::singleton()->pushUserContext(
CRM_Utils_System::url('civicrm/donrec/task', 'conflict=1' . '&sid=' . $sid . '&ccount=1'));
}elseif (empty($result['snapshot'])) {
CRM_Core_Session::setStatus(ts('This contact has no selectable contributions in the selected time period.'), ts('Warning'), 'warning');
CRM_Core_Session::setStatus(ts('This contact has no selectable contributions in the selected time period.', array('domain' => 'de.systopia.donrec')), ts('Warning', array('domain' => 'de.systopia.donrec')), 'warning');
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/donrec/create', "reset=1&cid=$contactId"));
}else{
CRM_Core_Session::singleton()->pushUserContext(
Expand Down
14 changes: 7 additions & 7 deletions CRM/Donrec/Form/Task/DonrecTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@
class CRM_Donrec_Form_Task_DonrecTask extends CRM_Contact_Form_Task {

function buildQuickForm() {
CRM_Utils_System::setTitle(ts('Issue Donation Receipts'));
CRM_Utils_System::setTitle(ts('Issue Donation Receipts', array('domain' => 'de.systopia.donrec')));

$this->addElement('hidden', 'rsid');
$options = array(
'current_year' => ts('This Year'),
'last_year' => ts('last year'),
'customized_period' => ts('Choose Date Range')
'current_year' => ts('This Year', array('domain' => 'de.systopia.donrec')),
'last_year' => ts('last year', array('domain' => 'de.systopia.donrec')),
'customized_period' => ts('Choose Date Range', array('domain' => 'de.systopia.donrec'))
);
$this->addElement('select', 'time_period', 'Time Period:', $options);
$this->addDateRange('donrec_contribution_horizon', '_from', '_to', ts('From:'), 'searchDate', TRUE, FALSE);
$this->addDateRange('donrec_contribution_horizon', '_from', '_to', ts('From:', array('domain' => 'de.systopia.donrec')), 'searchDate', TRUE, FALSE);

// call the (overwritten) Form's method, so the continue button is on the right...
CRM_Core_Form::addDefaultButtons(ts('Continue'));
CRM_Core_Form::addDefaultButtons(ts('Continue', array('domain' => 'de.systopia.donrec')));
}

function setDefaultValues() {
Expand Down Expand Up @@ -163,7 +163,7 @@ function postProcess() {
CRM_Core_Session::singleton()->pushUserContext(
CRM_Utils_System::url('civicrm/donrec/task', 'conflict=1' . '&sid=' . $result['snapshot']->getId() . '&ccount=' . count($this->_contactIds)));
}elseif (empty($result['snapshot'])) {
CRM_Core_Session::setStatus(ts('There are no selectable contributions for these contacts in the selected time period.'), ts('Warning'), 'warning');
CRM_Core_Session::setStatus(ts('There are no selectable contributions for these contacts in the selected time period.', array('domain' => 'de.systopia.donrec')), ts('Warning', array('domain' => 'de.systopia.donrec')), 'warning');
$qfKey = $values['qfKey'];
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/search', "_qf_DonrecTask_display=true&qfKey=$qfKey"));
}else{
Expand Down
Loading

0 comments on commit b5a580e

Please sign in to comment.