list($total, $added, $notAdded) = CRM_Core_BAO_EntityTag::addEntitiesToTag($this->_activityHolderIds, $key, 'civicrm_activity');
- $status = array(ts('%count activities tagged', array('count' => $added, 'plural' => '%count activities tagged')));
+ $status = array(ts('Activity tagged', array('count' => $added, 'plural' => '%count activities tagged')));
if ($notAdded) {
- $status[] = ts('%count activities already had this tag', array(
+ $status[] = ts('1 activity already had this tag', array(
'count' => $notAdded,
'plural' => '%count activities already had this tag',
));
* @return void
*/
public function postProcess() {
- $deletedActivities = 0;
+ $deleted = $failed = 0;
foreach ($this->_activityHolderIds as $activityId['id']) {
$moveToTrash = CRM_Case_BAO_Case::isCaseActivity($activityId['id']);
if (CRM_Activity_BAO_Activity::deleteActivity($activityId, $moveToTrash)) {
- $deletedActivities++;
+ $deleted++;
}
+ else {
+ $failed++;
+ }
+ }
+
+ if ($deleted) {
+ $msg = ts('%count activity deleted.', array('plural' => '%count activities deleted.', 'count' => $deleted));
+ CRM_Core_Session::setStatus($msg, ts('Removed'), 'success');
}
- CRM_Core_Session::setStatus($deletedActivities, ts('Deleted Activities'), "success");
- CRM_Core_Session::setStatus("", ts('Total Selected Activities: %1', array(1 => count($this->_activityHolderIds))), "info");
+ if ($failed) {
+ CRM_Core_Session::setStatus(ts('1 could not be deleted.', array('plural' => '%count could not be deleted.', 'count' => $failed)), ts('Error'), 'error');
+ }
}
}
list($total, $removed, $notRemoved) = CRM_Core_BAO_EntityTag::removeEntitiesFromTag($this->_activityHolderIds, $key, 'civicrm_activity');
$status = array(
- ts('%count activities un-tagged', array(
+ ts('%count activity un-tagged', array(
'count' => $removed,
'plural' => '%count activities un-tagged',
)),
$query = 'UPDATE civicrm_activity SET is_deleted = 1 WHERE id IN ( ' . implode(', ', $deleteActivityIds) . ' )';
CRM_Core_DAO::executeQuery($query);
- $status = array(ts("%1 respondent(s) have been released.", array(1 => count($deleteActivityIds))));
+ if ($deleteActivityIds) {
+ $status = ts("Respondent has been released.", array(
+ 'count' => count($deleteActivityIds),
+ 'plural' => '%count respondents have been released.',
+ ));
+ CRM_Core_Session::setStatus($status, ts('Released'), 'success');
+ }
+
if (count($this->_contactIds) > count($deleteActivityIds)) {
- $status[] = ts("%1 respondents did not release.",
- array(1 => (count($this->_contactIds) - count($deleteActivityIds)))
+ $status = ts('1 respondent did not release.',
+ array(
+ 'count' => (count($this->_contactIds) - count($deleteActivityIds)),
+ 'plural' => '%count respondents did not release.',
+ )
);
+ CRM_Core_Session::setStatus($status, ts('Notice'), 'alert');
}
- CRM_Core_Session::setStatus(implode(' ', $status), '', 'info');
}
}
$errorMsg = ts('The maximum number of contacts is already reserved for this interviewer.');
}
elseif (count($this->_contactIds) > ($maxVoters - $this->_numVoters)) {
- $errorMsg = ts('You can reserve a maximum of %1 contact(s) at a time for this survey.',
- array(1 => $maxVoters - $this->_numVoters)
+ $errorMsg = ts('You can reserve a maximum of %count contact at a time for this survey.',
+ array(
+ 'plural' => 'You can reserve a maximum of %count contacts at a time for this survey.',
+ 'count' => $maxVoters - $this->_numVoters,
+ )
);
}
}
$defaultNum = CRM_Utils_Array::value('default_number_of_contacts', $this->_surveyDetails);
if (!$errorMsg && $defaultNum && (count($this->_contactIds) > $defaultNum)) {
- $errorMsg = ts('You can reserve a maximum of %1 contact(s) at a time for this survey.',
- array(1 => $defaultNum)
+ $errorMsg = ts('You can reserve a maximum of %count contact at a time for this survey.',
+ array(
+ 'plural' => 'You can reserve a maximum of %count contacts at a time for this survey.',
+ 'count' => $defaultNum,
+ )
);
}
// Success message
if ($countVoters > 0) {
- $status = '<p>' . ts("%1 Contact(s) have been reserved.", array(1 => $countVoters)) . '</p>';
+ $status = '<p>' . ts("%count contact has been reserved.", array('plural' => '%count contacts have been reserved.', 'count' => $countVoters)) . '</p>';
if ($groupAdditions) {
- $status .= '<p>' . ts('Respondent(s) has been added to %1 group(s).',
- array(1 => implode(', ', $groupAdditions))
+ $status .= '<p>' . ts('They have been added to %1.',
+ array(1 => implode(' ' . ts('and') . ' ', $groupAdditions))
) . '</p>';
}
CRM_Core_Session::setStatus($status, ts('Reservation Added'), 'success');
}
// Error message
if (count($this->_contactIds) > $countVoters) {
- CRM_Core_Session::setStatus(ts('Reservation did not add for %1 contact(s).',
- array(1 => (count($this->_contactIds) - $countVoters))
+ CRM_Core_Session::setStatus(ts('Reservation did not add for %count contact.',
+ array(
+ 'plural' => 'Reservation did not add for %count contacts.',
+ 'count' => (count($this->_contactIds) - $countVoters),
+ )
), ts('Notice'));
}
$surveysData[$sid]['campaign'] = CRM_Utils_Array::value($campaignId, $campaigns);
$surveysData[$sid]['activity_type'] = $surveyType[$survey['activity_type_id']];
if (!empty($survey['release_frequency'])) {
- $surveysData[$sid]['release_frequency'] = $survey['release_frequency'] . ' ' . ts('Day(s)');
+ $surveysData[$sid]['release_frequency'] = ts('1 Day', array('plural' => '%count Days', 'count' => $survey['release_frequency']));
}
$action = array_sum(array_keys(self::surveyActionLinks($surveysData[$sid]['activity_type'])));
* @return void
*/
public function postProcess() {
- $deletedCases = 0;
+ $deleted = $failed = 0;
foreach ($this->_caseIds as $caseId) {
if (CRM_Case_BAO_Case::deleteCase($caseId, $this->_moveToTrash)) {
- $deletedCases++;
+ $deleted++;
}
+ else {
+ $failed++;
+ }
+ }
+
+ if ($deleted) {
+ if ($this->_moveToTrash) {
+ $msg = ts('%count case moved to trash.', array('plural' => '%count cases moved to trash.', 'count' => $deleted));
+ }
+ else {
+ $msg = ts('%count case permanently deleted.', array('plural' => '%count cases permanently deleted.', 'count' => $deleted));
+ }
+ CRM_Core_Session::setStatus($msg, ts('Removed'), 'success');
}
- CRM_Core_Session::setStatus($deletedCases, ts('Deleted Cases'), 'success');
- CRM_Core_Session::setStatus('', ts('Total Selected Case(s): %1', array(1 => count($this->_caseIds))), 'info');
+ if ($failed) {
+ CRM_Core_Session::setStatus(ts('1 could not be deleted.', array('plural' => '%count could not be deleted.', 'count' => $failed)), ts('Error'), 'error');
+ }
}
}
* @return void
*/
public function postProcess() {
- $restoredCases = 0;
+ $restoredCases = $failed = 0;
foreach ($this->_caseIds as $caseId) {
if (CRM_Case_BAO_Case::restoreCase($caseId)) {
$restoredCases++;
}
+ else {
+ $failed++;
+ }
+ }
+
+ if ($restoredCases) {
+ $msg = ts('%count case restored from trash.', array(
+ 'plural' => '%count cases restored from trash.',
+ 'count' => $restoredCases,
+ ));
+ CRM_Core_Session::setStatus($msg, ts('Restored'), 'success');
}
- CRM_Core_Session::setStatus($restoredCases, ts('Restored Cases'), 'success');
- CRM_Core_Session::setStatus('', ts('Total Selected Case(s): %1', array(1 => count($this->_caseIds))), 'info');
+ if ($failed) {
+ CRM_Core_Session::setStatus(ts('1 could not be restored.', array('plural' => '%count could not be restored.', 'count' => $failed)), ts('Error'), 'error');
+ }
}
}
* @return void
*/
public function postProcess() {
- $deletedContributions = 0;
+ $deleted = $failed = 0;
foreach ($this->_contributionIds as $contributionId) {
if (CRM_Contribute_BAO_Contribution::deleteContribution($contributionId)) {
- $deletedContributions++;
+ $deleted++;
}
+ else {
+ $failed++;
+ }
+ }
+
+ if ($deleted) {
+ $msg = ts('%count contribution deleted.', array('plural' => '%count contributions deleted.', 'count' => $deleted));
+ CRM_Core_Session::setStatus($msg, ts('Removed'), 'success');
+ }
+
+ if ($failed) {
+ CRM_Core_Session::setStatus(ts('1 could not be deleted.', array('plural' => '%count could not be deleted.', 'count' => $failed)), ts('Error'), 'error');
}
- $status = ts('Deleted Contribution(s): %1 (Total Selected: %2) ', array(
- 1 => $deletedContributions,
- 2 => count($this->_contributionIds),
- ));
- CRM_Core_Session::setStatus($status, '', 'info');
}
}
$deletedParticipants += $additionalCount;
}
- $status = array(
- ts('Participant(s) Deleted: %1 (Total Selected: %2)', array(
- 1 => $deletedParticipants,
- 2 => count($this->_participantIds),
- )),
- );
- if (!empty($participantLinks)) {
- $status[] = ts('The following participants no longer have an event fee recorded. You can edit their registration and record a replacement contribution by clicking the links below:') . '<br/>' . $participantLinks;
- }
- foreach ($status as $text) {
- CRM_Core_Session::setStatus($text, '', 'info');
+ $status = ts('%count participant deleted.', array('plural' => '%count participants deleted.', 'count' => $deletedParticipants));
+
+ if ($participantLinks) {
+ $status .= '<p>' . ts('The following participants no longer have an event fee recorded. You can edit their registration and record a replacement contribution by clicking the links below:')
+ . '</p>' . $participantLinks;
}
+ CRM_Core_Session::setStatus($status, ts('Removed'), 'info');
}
}
* @return void
*/
public function postProcess() {
- $deletedGrants = 0;
+ $deleted = $failed = 0;
foreach ($this->_grantIds as $grantId) {
if (CRM_Grant_BAO_Grant::del($grantId)) {
- $deletedGrants++;
+ $deleted++;
}
+ else {
+ $failed++;
+ }
+ }
+
+ if ($deleted) {
+ $msg = ts('%count grant deleted.', array('plural' => '%count grants deleted.', 'count' => $deleted));
+ CRM_Core_Session::setStatus($msg, ts('Removed'), 'success');
}
- CRM_Core_Session::setStatus(ts('Deleted Grant(s): %1', array(1 => $deletedGrants)), '', 'info');
- CRM_Core_Session::setStatus(ts('Total Selected Grant(s): %1', array(1 => count($this->_grantIds))), '', 'info');
+ if ($failed) {
+ CRM_Core_Session::setStatus(ts('1 could not be deleted.', array('plural' => '%count could not be deleted.', 'count' => $failed)), ts('Error'), 'error');
+ }
}
}
* @return void
*/
public function postProcess() {
- $deletedMembers = 0;
+ $deleted = $failed = 0;
foreach ($this->_memberIds as $memberId) {
if (CRM_Member_BAO_Membership::del($memberId)) {
- $deletedMembers++;
+ $deleted++;
}
+ else {
+ $failed++;
+ }
+ }
+
+ if ($deleted) {
+ $msg = ts('%count membership deleted.', array('plural' => '%count memberships deleted.', 'count' => $deleted));
+ CRM_Core_Session::setStatus($msg, ts('Removed'), 'success');
}
- CRM_Core_Session::setStatus($deletedMembers, ts('Deleted Membership(s)'), 'success');
- CRM_Core_Session::setStatus(ts('Total Selected Membership(s): %1', array(1 => count($this->_memberIds))), '', 'info');
+ if ($failed) {
+ CRM_Core_Session::setStatus(ts('1 could not be deleted.', array('plural' => '%count could not be deleted.', 'count' => $failed)), ts('Error'), 'error');
+ }
}
}
* @return void
*/
public function postProcess() {
- $deletedPledges = 0;
+ $deleted = $failed = 0;
foreach ($this->_pledgeIds as $pledgeId) {
if (CRM_Pledge_BAO_Pledge::deletePledge($pledgeId)) {
- $deletedPledges++;
+ $deleted++;
}
+ else {
+ $failed++;
+ }
+ }
+
+ if ($deleted) {
+ $msg = ts('%count pledge deleted.', array('plural' => '%count pledges deleted.', 'count' => $deleted));
+ CRM_Core_Session::setStatus($msg, ts('Removed'), 'success');
}
- $status = ts('Deleted Pledge(s): %1 (Total Selected: %2) ', array(
- 1 => $deletedPledges,
- 2 => count($this->_pledgeIds),
- ));
- CRM_Core_Session::setStatus($status, '', 'info');
+ if ($failed) {
+ CRM_Core_Session::setStatus(ts('1 could not be deleted.', array('plural' => '%count could not be deleted.', 'count' => $failed)), ts('Error'), 'error');
+ }
}
}