Merge pull request #6560 from kurund/CRM-16719-fix
authorDave Greenberg <dave@civicrm.org>
Fri, 4 Sep 2015 04:18:31 +0000 (21:18 -0700)
committerDave Greenberg <dave@civicrm.org>
Fri, 4 Sep 2015 04:18:31 +0000 (21:18 -0700)
CRM-16719 fixes

673 files changed:
CRM/ACL/API.php
CRM/ACL/BAO/ACL.php
CRM/ACL/BAO/Cache.php
CRM/ACL/BAO/EntityRole.php
CRM/ACL/Form/ACL.php
CRM/ACL/Form/ACLBasic.php
CRM/ACL/Form/EntityRole.php
CRM/ACL/Form/WordPress/Permissions.php
CRM/ACL/Page/ACL.php
CRM/ACL/Page/ACLBasic.php
CRM/ACL/Page/EntityRole.php
CRM/Activity/BAO/Activity.php
CRM/Activity/BAO/ActivityAssignment.php
CRM/Activity/BAO/ActivityContact.php
CRM/Activity/BAO/ActivityTarget.php
CRM/Activity/BAO/ICalendar.php
CRM/Activity/BAO/Query.php
CRM/Activity/Controller/Search.php
CRM/Activity/Form/Activity.php
CRM/Activity/Form/ActivityFilter.php
CRM/Activity/Form/ActivityLinks.php
CRM/Activity/Form/ActivityView.php
CRM/Activity/Form/Search.php
CRM/Activity/Form/Task.php
CRM/Activity/Form/Task/AddToTag.php
CRM/Activity/Form/Task/Batch.php
CRM/Activity/Form/Task/Delete.php
CRM/Activity/Form/Task/Email.php
CRM/Activity/Form/Task/FileOnCase.php
CRM/Activity/Form/Task/PickOption.php
CRM/Activity/Form/Task/PickProfile.php
CRM/Activity/Form/Task/Print.php
CRM/Activity/Form/Task/RemoveFromTag.php
CRM/Activity/Form/Task/SMS.php
CRM/Activity/Form/Task/SearchTaskHookSample.php
CRM/Activity/Import/Controller.php
CRM/Activity/Import/Field.php
CRM/Activity/Import/Form/DataSource.php
CRM/Activity/Import/Form/MapField.php
CRM/Activity/Import/Form/Preview.php
CRM/Activity/Import/Form/Summary.php
CRM/Activity/Import/Parser.php
CRM/Activity/Import/Parser/Activity.php
CRM/Activity/Page/Tab.php
CRM/Activity/Page/UserDashboard.php
CRM/Activity/Selector/Activity.php
CRM/Activity/Selector/Search.php
CRM/Activity/StateMachine/Search.php
CRM/Activity/Task.php
CRM/Admin/Form.php
CRM/Admin/Form/CMSUser.php
CRM/Admin/Form/ContactType.php
CRM/Admin/Form/Extensions.php
CRM/Admin/Form/Job.php
CRM/Admin/Form/LabelFormats.php
CRM/Admin/Form/LocationType.php
CRM/Admin/Form/MailSettings.php
CRM/Admin/Form/Mapping.php
CRM/Admin/Form/MessageTemplates.php
CRM/Admin/Form/Navigation.php
CRM/Admin/Form/OptionGroup.php
CRM/Admin/Form/Options.php
CRM/Admin/Form/ParticipantStatusType.php
CRM/Admin/Form/PaymentProcessor.php
CRM/Admin/Form/PaymentProcessorType.php
CRM/Admin/Form/PdfFormats.php
CRM/Admin/Form/Persistent.php
CRM/Admin/Form/Preferences.php
CRM/Admin/Form/Preferences/Address.php
CRM/Admin/Form/Preferences/Contribute.php
CRM/Admin/Form/Preferences/Display.php
CRM/Admin/Form/Preferences/Member.php
CRM/Admin/Form/PreferencesDate.php
CRM/Admin/Form/RelationshipType.php
CRM/Admin/Form/ScheduleReminders.php
CRM/Admin/Form/Setting.php
CRM/Admin/Form/Setting/Component.php
CRM/Admin/Form/Setting/Date.php
CRM/Admin/Form/Setting/Debugging.php
CRM/Admin/Form/Setting/Localization.php
CRM/Admin/Form/Setting/Mail.php
CRM/Admin/Form/Setting/Mapping.php
CRM/Admin/Form/Setting/Miscellaneous.php
CRM/Admin/Form/Setting/Path.php
CRM/Admin/Form/Setting/Smtp.php
CRM/Admin/Form/Setting/UF.php
CRM/Admin/Form/Setting/UpdateConfigBackend.php
CRM/Admin/Form/Setting/Url.php
CRM/Admin/Form/Tag.php
CRM/Admin/Form/WordReplacements.php
CRM/Admin/Page/AJAX.php
CRM/Admin/Page/APIExplorer.php
CRM/Admin/Page/Access.php
CRM/Admin/Page/Admin.php
CRM/Admin/Page/CKEditorConfig.php
CRM/Admin/Page/CMSUser.php
CRM/Admin/Page/ConfigTaskList.php
CRM/Admin/Page/ContactType.php
CRM/Admin/Page/EventTemplate.php
CRM/Admin/Page/Extensions.php
CRM/Admin/Page/Job.php
CRM/Admin/Page/JobLog.php
CRM/Admin/Page/LabelFormats.php
CRM/Admin/Page/LocationType.php
CRM/Admin/Page/MailSettings.php
CRM/Admin/Page/Mapping.php
CRM/Admin/Page/MessageTemplates.php
CRM/Admin/Page/Navigation.php
CRM/Admin/Page/Options.php
CRM/Admin/Page/ParticipantStatusType.php
CRM/Admin/Page/PaymentProcessor.php
CRM/Admin/Page/PaymentProcessorType.php
CRM/Admin/Page/PdfFormats.php
CRM/Admin/Page/Persistent.php
CRM/Admin/Page/PreferencesDate.php
CRM/Admin/Page/RelationshipType.php
CRM/Admin/Page/ScheduleReminders.php
CRM/Admin/Page/Setting.php
CRM/Admin/Page/Tag.php
CRM/Badge/BAO/Badge.php
CRM/Badge/BAO/Layout.php
CRM/Badge/Form/Layout.php
CRM/Badge/Page/Layout.php
CRM/Batch/BAO/Batch.php
CRM/Batch/Form/Entry.php
CRM/Batch/Form/Search.php
CRM/Batch/Page/AJAX.php
CRM/Batch/Page/Batch.php
CRM/Bridge/OG/CiviCRM.php
CRM/Bridge/OG/Drupal.php
CRM/Bridge/OG/Utils.php
CRM/Campaign/BAO/Campaign.php
CRM/Campaign/BAO/Petition.php
CRM/Campaign/BAO/Query.php
CRM/Campaign/BAO/Survey.php
CRM/Campaign/Config.php
CRM/Campaign/Controller/Search.php
CRM/Campaign/Form/Campaign.php
CRM/Campaign/Form/Gotv.php
CRM/Campaign/Form/Petition.php
CRM/Campaign/Form/Petition/Signature.php
CRM/Campaign/Form/Search.php
CRM/Campaign/Form/Search/Campaign.php
CRM/Campaign/Form/Search/Petition.php
CRM/Campaign/Form/Search/Survey.php
CRM/Campaign/Form/Survey.php
CRM/Campaign/Form/Survey/Delete.php
CRM/Campaign/Form/Survey/Main.php
CRM/Campaign/Form/Survey/Questions.php
CRM/Campaign/Form/Survey/Results.php
CRM/Campaign/Form/Survey/TabHeader.php
CRM/Campaign/Form/SurveyType.php
CRM/Campaign/Form/Task.php
CRM/Campaign/Form/Task/Interview.php
CRM/Campaign/Form/Task/Print.php
CRM/Campaign/Form/Task/Release.php
CRM/Campaign/Form/Task/Reserve.php
CRM/Campaign/Form/Task/Result.php
CRM/Campaign/Info.php
CRM/Campaign/Page/DashBoard.php
CRM/Campaign/Page/Petition.php
CRM/Campaign/Page/Petition/Confirm.php
CRM/Campaign/Page/Petition/ThankYou.php
CRM/Campaign/Page/SurveyType.php
CRM/Campaign/Page/Vote.php
CRM/Campaign/PseudoConstant.php
CRM/Campaign/Selector/Search.php
CRM/Campaign/StateMachine/Search.php
CRM/Campaign/Task.php
CRM/Case/BAO/Case.php
CRM/Case/BAO/CaseType.php
CRM/Case/BAO/Query.php
CRM/Case/Config.php
CRM/Case/Controller/Search.php
CRM/Case/Form/Activity.php
CRM/Case/Form/Activity/ChangeCaseStartDate.php
CRM/Case/Form/Activity/ChangeCaseStatus.php
CRM/Case/Form/Activity/ChangeCaseType.php
CRM/Case/Form/Activity/LinkCases.php
CRM/Case/Form/Activity/OpenCase.php
CRM/Case/Form/ActivityToCase.php
CRM/Case/Form/ActivityView.php
CRM/Case/Form/Case.php
CRM/Case/Form/CaseView.php
CRM/Case/Form/CustomData.php
CRM/Case/Form/EditClient.php
CRM/Case/Form/Report.php
CRM/Case/Form/Search.php
CRM/Case/Form/Task.php
CRM/Case/Form/Task/Delete.php
CRM/Case/Form/Task/Print.php
CRM/Case/Form/Task/Restore.php
CRM/Case/Form/Task/Result.php
CRM/Case/Form/Task/SearchTaskHookSample.php
CRM/Case/Info.php
CRM/Case/Page/CaseDetails.php
CRM/Case/Page/DashBoard.php
CRM/Case/Page/Tab.php
CRM/Case/PseudoConstant.php
CRM/Case/Selector/Search.php
CRM/Case/StateMachine/Search.php
CRM/Case/Task.php
CRM/Case/XMLProcessor.php
CRM/Case/XMLProcessor/Process.php
CRM/Case/XMLProcessor/Report.php
CRM/Case/XMLProcessor/Settings.php
CRM/Case/XMLRepository.php
CRM/Contact/BAO/Contact.php
CRM/Contact/BAO/Contact/Location.php
CRM/Contact/BAO/Contact/Optimizer.php
CRM/Contact/BAO/Contact/Permission.php
CRM/Contact/BAO/Contact/Utils.php
CRM/Contact/BAO/ContactType.php
CRM/Contact/BAO/DashboardContact.php
CRM/Contact/BAO/Group.php
CRM/Contact/BAO/GroupContact.php
CRM/Contact/BAO/GroupContactCache.php
CRM/Contact/BAO/GroupNesting.php
CRM/Contact/BAO/GroupNestingCache.php
CRM/Contact/BAO/GroupOrganization.php
CRM/Contact/BAO/Household.php
CRM/Contact/BAO/Individual.php
CRM/Contact/BAO/ProximityQuery.php
CRM/Contact/BAO/Query.php
CRM/Contact/BAO/Query/Hook.php
CRM/Contact/BAO/Query/Interface.php
CRM/Contact/BAO/Relationship.php
CRM/Contact/BAO/RelationshipType.php
CRM/Contact/BAO/SavedSearch.php
CRM/Contact/BAO/SearchCustom.php
CRM/Contact/BAO/SubscriptionHistory.php
CRM/Contact/Controller/Search.php
CRM/Contact/Form/Contact.php
CRM/Contact/Form/CustomData.php
CRM/Contact/Form/DedupeFind.php
CRM/Contact/Form/DedupeRules.php
CRM/Contact/Form/Domain.php
CRM/Contact/Form/Edit/Address.php
CRM/Contact/Form/Edit/CommunicationPreferences.php
CRM/Contact/Form/Edit/CustomData.php
CRM/Contact/Form/Edit/Demographics.php
CRM/Contact/Form/Edit/Email.php
CRM/Contact/Form/Edit/Household.php
CRM/Contact/Form/Edit/IM.php
CRM/Contact/Form/Edit/Individual.php
CRM/Contact/Form/Edit/Lock.php
CRM/Contact/Form/Edit/Notes.php
CRM/Contact/Form/Edit/OpenID.php
CRM/Contact/Form/Edit/Organization.php
CRM/Contact/Form/Edit/Phone.php
CRM/Contact/Form/Edit/TagsAndGroups.php
CRM/Contact/Form/Edit/Website.php
CRM/Contact/Form/GroupContact.php
CRM/Contact/Form/Inline.php
CRM/Contact/Form/Inline/Address.php
CRM/Contact/Form/Inline/CommunicationPreferences.php
CRM/Contact/Form/Inline/ContactInfo.php
CRM/Contact/Form/Inline/ContactName.php
CRM/Contact/Form/Inline/CustomData.php
CRM/Contact/Form/Inline/Demographics.php
CRM/Contact/Form/Inline/Email.php
CRM/Contact/Form/Inline/IM.php
CRM/Contact/Form/Inline/Lock.php
CRM/Contact/Form/Inline/OpenID.php
CRM/Contact/Form/Inline/Phone.php
CRM/Contact/Form/Inline/Website.php
CRM/Contact/Form/Location.php
CRM/Contact/Form/Merge.php
CRM/Contact/Form/ProfileContact.php
CRM/Contact/Form/RelatedContact.php
CRM/Contact/Form/Relationship.php
CRM/Contact/Form/Search.php
CRM/Contact/Form/Search/Advanced.php
CRM/Contact/Form/Search/Basic.php
CRM/Contact/Form/Search/Builder.php
CRM/Contact/Form/Search/Criteria.php
CRM/Contact/Form/Search/Custom.php
CRM/Contact/Form/Search/Custom/ActivitySearch.php
CRM/Contact/Form/Search/Custom/Base.php
CRM/Contact/Form/Search/Custom/Basic.php
CRM/Contact/Form/Search/Custom/ContribSYBNT.php
CRM/Contact/Form/Search/Custom/ContributionAggregate.php
CRM/Contact/Form/Search/Custom/DateAdded.php
CRM/Contact/Form/Search/Custom/EventAggregate.php
CRM/Contact/Form/Search/Custom/FullText.php
CRM/Contact/Form/Search/Custom/FullText/AbstractPartialQuery.php
CRM/Contact/Form/Search/Custom/FullText/Activity.php
CRM/Contact/Form/Search/Custom/FullText/Case.php
CRM/Contact/Form/Search/Custom/FullText/Contact.php
CRM/Contact/Form/Search/Custom/FullText/Contribution.php
CRM/Contact/Form/Search/Custom/FullText/Membership.php
CRM/Contact/Form/Search/Custom/FullText/Participant.php
CRM/Contact/Form/Search/Custom/Group.php
CRM/Contact/Form/Search/Custom/MultipleValues.php
CRM/Contact/Form/Search/Custom/PostalMailing.php
CRM/Contact/Form/Search/Custom/PriceSet.php
CRM/Contact/Form/Search/Custom/Proximity.php
CRM/Contact/Form/Search/Custom/RandomSegment.php
CRM/Contact/Form/Search/Custom/Sample.php
CRM/Contact/Form/Search/Custom/TagContributions.php
CRM/Contact/Form/Search/Custom/ZipCodeRange.php
CRM/Contact/Form/Search/Interface.php
CRM/Contact/Form/Task.php
CRM/Contact/Form/Task/AddToGroup.php
CRM/Contact/Form/Task/AddToOrganization.php
CRM/Contact/Form/Task/AddToTag.php
CRM/Contact/Form/Task/AlterPreferences.php
CRM/Contact/Form/Task/Batch.php
CRM/Contact/Form/Task/Delete.php
CRM/Contact/Form/Task/Email.php
CRM/Contact/Form/Task/EmailCommon.php
CRM/Contact/Form/Task/HookSample.php
CRM/Contact/Form/Task/Label.php
CRM/Contact/Form/Task/LabelCommon.php
CRM/Contact/Form/Task/Map.php
CRM/Contact/Form/Task/Map/Event.php
CRM/Contact/Form/Task/Merge.php
CRM/Contact/Form/Task/PDF.php
CRM/Contact/Form/Task/PDFLetterCommon.php
CRM/Contact/Form/Task/PickProfile.php
CRM/Contact/Form/Task/Print.php
CRM/Contact/Form/Task/ProximityCommon.php
CRM/Contact/Form/Task/RemoveFromGroup.php
CRM/Contact/Form/Task/RemoveFromTag.php
CRM/Contact/Form/Task/Result.php
CRM/Contact/Form/Task/SMS.php
CRM/Contact/Form/Task/SMSCommon.php
CRM/Contact/Form/Task/SaveSearch.php
CRM/Contact/Form/Task/SaveSearch/Update.php
CRM/Contact/Form/Task/Unhold.php
CRM/Contact/Form/Task/Useradd.php
CRM/Contact/Import/Controller.php
CRM/Contact/Import/Form/DataSource.php
CRM/Contact/Import/Form/MapField.php
CRM/Contact/Import/Form/Preview.php
CRM/Contact/Import/Form/Summary.php
CRM/Contact/Import/ImportJob.php
CRM/Contact/Import/Importer.php
CRM/Contact/Import/Page/AJAX.php
CRM/Contact/Import/Parser.php
CRM/Contact/Import/Parser/Contact.php
CRM/Contact/Page/AJAX.php
CRM/Contact/Page/CustomSearch.php
CRM/Contact/Page/DashBoard.php
CRM/Contact/Page/Dashlet.php
CRM/Contact/Page/DedupeException.php
CRM/Contact/Page/DedupeFind.php
CRM/Contact/Page/DedupeMerge.php [new file with mode: 0644]
CRM/Contact/Page/DedupeRules.php
CRM/Contact/Page/ImageFile.php
CRM/Contact/Page/Inline/Actions.php
CRM/Contact/Page/Inline/Address.php
CRM/Contact/Page/Inline/CommunicationPreferences.php
CRM/Contact/Page/Inline/ContactInfo.php
CRM/Contact/Page/Inline/ContactName.php
CRM/Contact/Page/Inline/CustomData.php
CRM/Contact/Page/Inline/Demographics.php
CRM/Contact/Page/Inline/Email.php
CRM/Contact/Page/Inline/IM.php
CRM/Contact/Page/Inline/OpenID.php
CRM/Contact/Page/Inline/Phone.php
CRM/Contact/Page/Inline/Website.php
CRM/Contact/Page/SavedSearch.php
CRM/Contact/Page/Task.php
CRM/Contact/Page/View.php
CRM/Contact/Page/View/ContactSmartGroup.php
CRM/Contact/Page/View/GroupContact.php
CRM/Contact/Page/View/Log.php
CRM/Contact/Page/View/Note.php
CRM/Contact/Page/View/Print.php
CRM/Contact/Page/View/Relationship.php
CRM/Contact/Page/View/Summary.php
CRM/Contact/Page/View/Sunlight.php
CRM/Contact/Page/View/Tag.php
CRM/Contact/Page/View/UserDashBoard.php
CRM/Contact/Page/View/UserDashBoard/GroupContact.php
CRM/Contact/Page/View/Useradd.php
CRM/Contact/Page/View/Vcard.php
CRM/Contact/Selector.php
CRM/Contact/Selector/Controller.php
CRM/Contact/StateMachine/Search.php
CRM/Contact/Task.php
CRM/Contribute/BAO/Contribution.php
CRM/Contribute/BAO/Contribution/Utils.php
CRM/Contribute/BAO/ContributionSoft.php
CRM/Contribute/BAO/ManagePremiums.php
CRM/Contribute/BAO/Premium.php
CRM/Contribute/BAO/Query.php
CRM/Contribute/BAO/Widget.php
CRM/Contribute/Config.php
CRM/Contribute/Controller/Contribution.php
CRM/Contribute/Controller/ContributionPage.php
CRM/Contribute/Controller/Search.php
CRM/Contribute/Form.php
CRM/Contribute/Form/AbstractEditPayment.php
CRM/Contribute/Form/AdditionalInfo.php
CRM/Contribute/Form/AdditionalPayment.php
CRM/Contribute/Form/CancelSubscription.php
CRM/Contribute/Form/Contribution.php
CRM/Contribute/Form/Contribution/Confirm.php
CRM/Contribute/Form/Contribution/Main.php
CRM/Contribute/Form/Contribution/OnBehalfOf.php
CRM/Contribute/Form/Contribution/ThankYou.php
CRM/Contribute/Form/ContributionCharts.php
CRM/Contribute/Form/ContributionPage.php
CRM/Contribute/Form/ContributionPage/AddProduct.php
CRM/Contribute/Form/ContributionPage/Amount.php
CRM/Contribute/Form/ContributionPage/Custom.php
CRM/Contribute/Form/ContributionPage/Delete.php
CRM/Contribute/Form/ContributionPage/Premium.php
CRM/Contribute/Form/ContributionPage/Settings.php
CRM/Contribute/Form/ContributionPage/ThankYou.php
CRM/Contribute/Form/ContributionPage/Widget.php
CRM/Contribute/Form/ContributionView.php
CRM/Contribute/Form/ManagePremiums.php
CRM/Contribute/Form/SearchContribution.php
CRM/Contribute/Form/SoftCredit.php
CRM/Contribute/Form/Task.php
CRM/Contribute/Form/Task/Batch.php
CRM/Contribute/Form/Task/Delete.php
CRM/Contribute/Form/Task/Email.php
CRM/Contribute/Form/Task/Invoice.php
CRM/Contribute/Form/Task/PDF.php
CRM/Contribute/Form/Task/PDFLetter.php
CRM/Contribute/Form/Task/PickProfile.php
CRM/Contribute/Form/Task/Print.php
CRM/Contribute/Form/Task/Result.php
CRM/Contribute/Form/Task/SearchTaskHookSample.php
CRM/Contribute/Form/Task/Status.php
CRM/Contribute/Form/UpdateBilling.php
CRM/Contribute/Form/UpdateSubscription.php
CRM/Contribute/Import/Controller.php
CRM/Contribute/Import/Field.php
CRM/Contribute/Import/Form/DataSource.php
CRM/Contribute/Import/Form/MapField.php
CRM/Contribute/Import/Form/Preview.php
CRM/Contribute/Import/Form/Summary.php
CRM/Contribute/Import/Parser.php
CRM/Contribute/Import/Parser/Contribution.php
CRM/Contribute/Info.php
CRM/Contribute/Page/ContributionPage.php
CRM/Contribute/Page/ContributionRecur.php
CRM/Contribute/Page/DashBoard.php
CRM/Contribute/Page/ManagePremiums.php
CRM/Contribute/Page/PaymentInfo.php
CRM/Contribute/Page/Premium.php
CRM/Contribute/Page/SubscriptionStatus.php
CRM/Contribute/Page/Tab.php
CRM/Contribute/Page/UserDashboard.php
CRM/Contribute/PseudoConstant.php
CRM/Contribute/Selector/Search.php
CRM/Contribute/StateMachine/Contribution.php
CRM/Contribute/StateMachine/ContributionPage.php
CRM/Contribute/StateMachine/Search.php
CRM/Contribute/Task.php
CRM/Core/BAO/ActionSchedule.php
CRM/Core/BAO/Address.php
CRM/Core/BAO/Block.php
CRM/Core/BAO/CMSUser.php
CRM/Core/BAO/Cache.php
CRM/Core/BAO/ConfigSetting.php
CRM/Core/BAO/CustomField.php
CRM/Core/BAO/CustomQuery.php
CRM/Core/BAO/CustomValue.php
CRM/Core/BAO/CustomValueTable.php
CRM/Core/BAO/Dashboard.php
CRM/Core/BAO/Email.php
CRM/Core/BAO/EntityTag.php
CRM/Core/BAO/Extension.php
CRM/Core/BAO/LabelFormat.php
CRM/Core/BAO/Location.php
CRM/Core/BAO/Mapping.php
CRM/Core/BAO/MessageTemplate.php
CRM/Core/BAO/Note.php
CRM/Core/BAO/OptionValue.php
CRM/Core/BAO/PaperSize.php
CRM/Core/BAO/PdfFormat.php
CRM/Core/BAO/Phone.php
CRM/Core/BAO/PreferencesDate.php
CRM/Core/BAO/PrevNextCache.php
CRM/Core/BAO/RecurringEntity.php
CRM/Core/BAO/Setting.php
CRM/Core/BAO/UFField.php
CRM/Core/BAO/UFGroup.php
CRM/Core/BAO/UFMatch.php
CRM/Core/BAO/Website.php
CRM/Core/Block.php
CRM/Core/Config.php
CRM/Core/Controller.php
CRM/Core/DAO.php
CRM/Core/DAO/permissions.php
CRM/Core/Error.php
CRM/Core/Form.php
CRM/Core/Form/Date.php
CRM/Core/Form/RecurringEntity.php
CRM/Core/Form/ShortCode.php
CRM/Core/Form/Tag.php
CRM/Core/I18n.php
CRM/Core/I18n/Schema.php
CRM/Core/JobManager.php
CRM/Core/Joomla.php
CRM/Core/OptionGroup.php
CRM/Core/OptionValue.php
CRM/Core/Page.php
CRM/Core/Page/Basic.php
CRM/Core/Page/RecurringEntityPreview.php
CRM/Core/Payment.php
CRM/Core/Payment/Dummy.php
CRM/Core/Payment/Form.php
CRM/Core/Payment/Google.php
CRM/Core/Payment/GoogleIPN.php
CRM/Core/Payment/PayPalImpl.php
CRM/Core/Payment/PayPalProIPN.php
CRM/Core/Payment/PayflowPro.php
CRM/Core/Payment/PaymentExpress.php
CRM/Core/Payment/PaymentExpressIPN.php
CRM/Core/Payment/ProcessorForm.php
CRM/Core/Permission.php
CRM/Core/PseudoConstant.php
CRM/Core/QuickForm/Action.php
CRM/Core/QuickForm/Action/Back.php
CRM/Core/QuickForm/Action/Cancel.php
CRM/Core/QuickForm/Action/Display.php
CRM/Core/QuickForm/Action/Done.php
CRM/Core/QuickForm/Action/Reload.php
CRM/Core/Session.php
CRM/Core/ShowHideBlocks.php
CRM/Core/State.php
CRM/Core/StateMachine.php
CRM/Core/xml/Menu/Contact.xml
CRM/Custom/Form/CustomDataByType.php
CRM/Cxn/BAO/Cxn.php
CRM/Dedupe/Merger.php
CRM/Event/BAO/Participant.php
CRM/Event/BAO/Query.php
CRM/Event/Form/Registration.php
CRM/Event/Form/Registration/Confirm.php
CRM/Event/Form/Registration/Register.php
CRM/Event/Task.php
CRM/Export/BAO/Export.php
CRM/Financial/Page/AJAX.php
CRM/Grant/Task.php
CRM/Import/DataSource/CSV.php
CRM/Logging/Schema.php
CRM/Mailing/BAO/Mailing.php
CRM/Mailing/BAO/Query.php
CRM/Mailing/Controller/Send.php
CRM/Mailing/Form/Group.php [deleted file]
CRM/Mailing/Form/Schedule.php [deleted file]
CRM/Mailing/Form/Settings.php [deleted file]
CRM/Mailing/Form/Test.php [deleted file]
CRM/Mailing/Form/Upload.php [deleted file]
CRM/Mailing/Info.php
CRM/Mailing/Selector/Event.php
CRM/Mailing/StateMachine/Send.php [deleted file]
CRM/Mailing/xml/Menu/Mailing.xml
CRM/Member/BAO/Membership.php
CRM/Member/BAO/Query.php
CRM/Member/Form.php
CRM/Member/Form/Membership.php
CRM/Member/Form/MembershipBlock.php
CRM/Member/Form/MembershipRenewal.php
CRM/Member/Form/Task/PickProfile.php
CRM/Member/Task.php
CRM/Pledge/BAO/Query.php
CRM/Pledge/Form/Pledge.php
CRM/Pledge/Form/Task.php
CRM/Pledge/Task.php
CRM/Report/Form.php
CRM/Report/Form/Activity.php
CRM/Report/Form/Contribute/Recur.php
CRM/Report/Form/Contribute/Summary.php
CRM/Report/Form/Mailing/Summary.php
CRM/SMS/Form/Upload.php
CRM/Upgrade/4.7.alpha1.msg_template/message_templates/contribution_invoice_receipt_html.tpl [new file with mode: 0644]
CRM/Upgrade/Incremental/sql/4.6.8.mysql.tpl [new file with mode: 0644]
CRM/Upgrade/Incremental/sql/4.6.9.mysql.tpl [new file with mode: 0644]
CRM/Upgrade/Incremental/sql/4.7.alpha1.mysql.tpl
CRM/Utils/Cache/Interface.php
CRM/Utils/Date.php
CRM/Utils/Hook.php
CRM/Utils/ICalendar.php
CRM/Utils/Mail/EmailProcessor.php
CRM/Utils/Migrate/Export.php
CRM/Utils/Migrate/Import.php
CRM/Utils/OptionBag.php
CRM/Utils/Pager.php
CRM/Utils/PseudoConstant.php
CRM/Utils/Recent.php
CRM/Utils/SoapServer.php
CRM/Utils/Sort.php
CRM/Utils/String.php
CRM/Utils/System.php
CRM/Utils/System/Base.php
CRM/Utils/System/Drupal.php
CRM/Utils/System/Drupal6.php
CRM/Utils/System/Drupal8.php
CRM/Utils/System/Joomla.php
CRM/Utils/System/Soap.php
CRM/Utils/Token.php
CRM/Utils/Tree.php
CRM/Utils/Wrapper.php
Civi/CCase/Analyzer.php
Civi/Core/Lock/NullLock.php
ang/crmMailing/BlockMailing.html
ang/crmMailing/MsgTemplateCtrl.js
api/class.api.php
api/v3/Contribution.php
api/v3/utils.php
bin/ContributionProcessor.php
bin/cleanup42.php [deleted file]
bin/deprecated/CiviReportMail.php [deleted file]
bin/deprecated/EmailProcessor.php [deleted file]
bin/deprecated/ParticipantProcessor.php [deleted file]
bin/deprecated/RespondentProcessor.php [deleted file]
bin/deprecated/UpdateAddress.php [deleted file]
bin/deprecated/UpdateGreeting.php [deleted file]
bin/deprecated/UpdateMembershipRecord.php [deleted file]
bin/deprecated/UpdateMembershipReminderDate.php [deleted file]
bin/deprecated/UpdatePledgeRecord.php [deleted file]
bin/deprecated/civimail.cronjob.php [deleted file]
bin/encryptDB.php
bin/gitify [deleted file]
bin/migrate/export.php
bin/migrate/exportJSON.php
bin/migrate/import.php
bin/migrate/importJSON.php
bin/migrate/move.php
templates/CRM/Admin/Form/Setting/Mail.tpl
templates/CRM/Admin/Page/APIExplorer.js
templates/CRM/Case/Form/Search/Common.tpl
templates/CRM/Contact/Form/Domain.tpl
templates/CRM/Contact/Form/Search/Advanced.hlp
templates/CRM/Contact/Form/Task/EmailCommon.js
templates/CRM/Contact/Page/DedupeFind.tpl
templates/CRM/Contact/Page/DedupeMerge.tpl [moved from bin/deprecated/action.cronjob.php with 55% similarity]
templates/CRM/Contribute/Form/AdditionalInfo/Payment.tpl
templates/CRM/Contribute/Page/Widget.tpl
templates/CRM/Core/BillingBlock.tpl
templates/CRM/Event/Form/ManageEvent/Registration.hlp
templates/CRM/Event/Page/DashBoard.tpl
templates/CRM/Mailing/Form/Search/Common.tpl
templates/CRM/Mailing/Page/Report.tpl
templates/CRM/common/SocialNetwork.tpl
templates/CRM/common/jsortable.tpl
tests/phpunit/CRM/Contribute/Form/ContributionTest.php
tests/phpunit/CRM/Member/Form/MembershipRenewalTest.php
tests/phpunit/CRM/Member/Form/MembershipTest.php
tests/phpunit/CiviTest/CiviUnitTestCase.php
tests/phpunit/WebTest/ACL/AssignUsersToRolesTest.php
tests/phpunit/WebTest/Campaign/MailingTest.php
tests/phpunit/WebTest/Contact/AddContactsToEventAdvancedSearchTest.php
tests/phpunit/WebTest/Contact/AdvancedSearchedRelatedContactTest.php
tests/phpunit/WebTest/Contact/DeceasedContactsAdvancedSearchTest.php
tests/phpunit/WebTest/Contact/SearchTest.php
tests/phpunit/WebTest/Contact/TaskActionAddToGroupTest.php
tests/phpunit/WebTest/Contact/TaskActionSendMassMailing.php
tests/phpunit/WebTest/Contact/TaskActionSendSMS.php
tests/phpunit/WebTest/Event/ChangeParticipantStatus.php
tests/phpunit/WebTest/Export/ContactTest.php
tests/phpunit/WebTest/Profile/BatchUpdateTest.php
tests/phpunit/api/v3/ACLPermissionTest.php
tests/phpunit/api/v3/ContributionPageTest.php
tests/phpunit/api/v3/ContributionTest.php
tests/phpunit/api/v3/CustomValueTest.php
tests/phpunit/api/v3/EventTest.php
xml/schema/Activity/Activity.xml
xml/templates/civicrm_navigation.tpl
xml/templates/message_templates/contribution_invoice_receipt_html.tpl
xml/templates/message_templates/event_offline_receipt_html.tpl
xml/templates/message_templates/event_offline_receipt_text.tpl
xml/templates/message_templates/event_online_receipt_html.tpl
xml/templates/message_templates/event_online_receipt_text.tpl

index 3674629ec4132275a2f98a411593bf7006a943be..5a615c170a1692b869568f2edcd2ac840bdc160d 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_ACL_API {
 
@@ -118,21 +116,12 @@ class CRM_ACL_API {
       return $deleteClause;
     }
 
-    $user = CRM_Core_Session::getLoggedInContactID();
-    if ($contactID == NULL) {
-      $contactID = $user ? $user : 0;
-    }
-
-    // Check if contact has permissions on self
-    if ($user && $contactID == $user) {
-      if (CRM_Core_Permission::check('edit my contact') ||
-        ($type == self::VIEW && CRM_Core_Permission::check('view my contact'))
-      ) {
-        return ' ( 1 ) ';
-      }
+    if (!$contactID) {
+      $contactID = CRM_Core_Session::getLoggedInContactID();
     }
+    $contactID = (int) $contactID;
 
-    return implode(' AND ',
+    $where = implode(' AND ',
       array(
         CRM_ACL_BAO_ACL::whereClause($type,
           $tables,
@@ -142,6 +131,14 @@ class CRM_ACL_API {
         $deleteClause,
       )
     );
+
+    // Add permission on self
+    if ($contactID && (CRM_Core_Permission::check('edit my contact') ||
+      $type == self::VIEW && CRM_Core_Permission::check('view my contact'))
+    ) {
+      $where = "contact_a.id = $contactID OR ($where)";
+    }
+    return $where;
   }
 
   /**
index ea00a200703e7d8e1f2e6ad4770fc9725398c3c8..1277fe4c9ed4039f61611dd6dbda9e7022b2b4cd 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -44,6 +42,8 @@ class CRM_ACL_BAO_ACL extends CRM_ACL_DAO_ACL {
   static $_fieldKeys = NULL;
 
   /**
+   * Get ACL entity table.
+   *
    * @return array|null
    */
   public static function entityTable() {
index fa9cd656c1e1fdb324ee3d3245cf4d2eaa9c39f9..2ff804ca227afad57f9b464aa32cbce07aba7388 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- *  Access Control Cache
+ *  Access Control Cache.
  */
 class CRM_ACL_BAO_Cache extends CRM_ACL_DAO_Cache {
 
index 7cbd0850a3938755ba4f9b58b887f5500c1b32ce..bfe68b49d734e30038c38acfc59e31de5b16991e 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- *  Access Control EntityRole
+ *  Access Control EntityRole.
  */
 class CRM_ACL_BAO_EntityRole extends CRM_ACL_DAO_EntityRole {
   static $_entityTable = NULL;
 
   /**
+   * Get entity table.
+   *
    * @return array|null
    */
   public static function entityTable() {
index 04081c984266de1b35b0e5955e5b7a68e531dfbe..cb635d6253dd24402d351d72acf4884da4467f22 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_ACL_Form_ACL extends CRM_Admin_Form {
 
   /**
    * Set default values for the form.
-   *
-   *
-   * @return void
    */
   public function setDefaultValues() {
     $defaults = parent::setDefaultValues();
@@ -113,8 +100,6 @@ class CRM_ACL_Form_ACL extends CRM_Admin_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -266,9 +251,6 @@ class CRM_ACL_Form_ACL extends CRM_Admin_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     // note this also resets any ACL cache
index 83048cc688d4440ba37bae86a62a17683b22a01f..df58d573c4693dcc4aab678c1799626a70925c07 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_ACL_Form_ACLBasic extends CRM_Admin_Form {
 
   /**
    * Set default values for the form.
-   *
-   *
-   * @return void
    */
   public function setDefaultValues() {
     $defaults = array();
@@ -75,8 +62,6 @@ SELECT object_table
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -124,9 +109,6 @@ SELECT object_table
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     CRM_ACL_BAO_Cache::resetCache();
index 2a3379b5c074e76916034e3598aef53fa415d2a9..b11f41ba5d6e01841122ba82307618fe89834dc7 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_ACL_Form_EntityRole extends CRM_Admin_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -70,9 +58,6 @@ class CRM_ACL_Form_EntityRole extends CRM_Admin_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     CRM_ACL_BAO_Cache::resetCache();
index 4b4f8942cba56fa89410c9536fd3f6ca4975997d..1b059b0c3fdee962469903b6480e3fe0ecf4062e 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -40,8 +38,6 @@ class CRM_ACL_Form_WordPress_Permissions extends CRM_Core_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
 
@@ -107,8 +103,6 @@ class CRM_ACL_Form_WordPress_Permissions extends CRM_Core_Form {
 
   /**
    * Process the form submission.
-   *
-   * @return void
    */
   public function postProcess() {
     $params = $this->controller->exportValues($this->_name);
index 72de0edc18b4f2e773b7524b855c4fde4d4f3a0c..eccc9116d05fe7c51bfddfc0772abbd471cefdb9 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_ACL_Page_ACL extends CRM_Core_Page_Basic {
 
@@ -103,8 +93,6 @@ class CRM_ACL_Page_ACL extends CRM_Core_Page_Basic {
    * This method is called after the page is created. It checks for the
    * type of action and executes that action.
    * Finally it calls the parent's run method.
-   *
-   * @return void
    */
   public function run() {
     // get the requested action
@@ -154,8 +142,6 @@ class CRM_ACL_Page_ACL extends CRM_Core_Page_Basic {
 
   /**
    * Browse all acls.
-   *
-   * @return void
    */
   public function browse() {
     // get all acl's sorted by weight
index bc9b1abf818d0e0b734c7e021cf4a174a491712e..a81537304db61dd38bd24b62e6d78c96af0d25d2 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_ACL_Page_ACLBasic extends CRM_Core_Page_Basic {
 
@@ -91,8 +81,6 @@ class CRM_ACL_Page_ACLBasic extends CRM_Core_Page_Basic {
    * This method is called after the page is created. It checks for the
    * type of action and executes that action.
    * Finally it calls the parent's run method.
-   *
-   * @return void
    */
   public function run() {
     // get the requested action
@@ -130,8 +118,6 @@ class CRM_ACL_Page_ACLBasic extends CRM_Core_Page_Basic {
 
   /**
    * Browse all acls.
-   *
-   * @return void
    */
   public function browse() {
 
index 79724aaecf93e712c10ac2981436a739960ba426..4e737f6d9b5051b7d3a0b553081b91a540e0e3eb 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_ACL_Page_EntityRole extends CRM_Core_Page_Basic {
 
@@ -103,8 +93,6 @@ class CRM_ACL_Page_EntityRole extends CRM_Core_Page_Basic {
    * This method is called after the page is created. It checks for the
    * type of action and executes that action.
    * Finally it calls the parent's run method.
-   *
-   * @return void
    */
   public function run() {
     // get the requested action
@@ -151,8 +139,6 @@ class CRM_ACL_Page_EntityRole extends CRM_Core_Page_Basic {
 
   /**
    * Browse all acls.
-   *
-   * @return void
    */
   public function browse() {
 
index 4c28eea292012baca18f2aa909d3de3a47820776..20a66fc1d0857314707bbdf06000ef3d2be62503 100644 (file)
@@ -29,7 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
  */
 
 /**
index f47b2b28e45b34b64117338a334f4fd6037a341e..be0ead74d43709cccd7a69261efe49e8bc711627 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class is for activity assignment functions
- *
+ * This class is for activity assignment functions.
  */
 class CRM_Activity_BAO_ActivityAssignment extends CRM_Activity_DAO_ActivityContact {
 
index 6ce714310ee5c1816cb0f3d5881ea2eddc805c63..9de897ad60ced3dcf2056daa15193674c0abf88f 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class is for activity assignment functions
- *
+ * This class is for activity assignment functions.
  */
 class CRM_Activity_BAO_ActivityContact extends CRM_Activity_DAO_ActivityContact {
 
index a451f5e65cfbc702d17c68897941ec2a571d9ba4..ba08fba8ca707ffa88a56122dbb8d4ee69574431 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class is for activity assignment functions
- *
+ * This class is for activity assignment functions.
  */
 class CRM_Activity_BAO_ActivityTarget extends CRM_Activity_DAO_ActivityContact {
 
index 85f35a5f564889af0d1b752843a1efa655bbc820..14582daa7b674a277e1b218186230fc3e5e7c555 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Generate ical invites for activities
- *
+ * Generate ical invites for activities.
  */
 class CRM_Activity_BAO_ICalendar {
 
index 147dd69d4e7a3af231496f23d4e887b59b69bdf9..9ca167066e762a0b80ef3e66bc8ba0430b8ddb10 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
  */
 class CRM_Activity_BAO_Query {
 
   /**
    * Build select for Case.
    *
-   * @param $query
+   * @param CRM_Contact_BAO_Query $query
    */
   public static function select(&$query) {
     if (!empty($query->_returnProperties['activity_id'])) {
@@ -156,12 +155,9 @@ class CRM_Activity_BAO_Query {
   }
 
   /**
-   * Given a list of conditions in query generate the required.
-   * where clause
+   * Given a list of conditions in query generate the required where clause.
    *
    * @param $query
-   *
-   * @return void
    */
   public static function where(&$query) {
     foreach (array_keys($query->_params) as $id) {
@@ -178,9 +174,8 @@ class CRM_Activity_BAO_Query {
   /**
    * Where clause for a single field.
    *
-   * @param $values
-   * @param $query
-   * @return void
+   * @param array $values
+   * @param CRM_Contact_BAO_Query $query
    */
   public static function whereClauseSingle(&$values, &$query) {
     list($name, $op, $value, $grouping) = $values;
@@ -197,6 +192,8 @@ class CRM_Activity_BAO_Query {
       case 'activity_engagement_level':
       case 'activity_subject':
       case 'activity_id':
+      case 'activity_campaign_id':
+
         $qillName = $name;
         if (in_array($name, array('activity_engagement_level', 'activity_id'))) {
           $name = $qillName = str_replace('activity_', '', $name);
@@ -205,6 +202,10 @@ class CRM_Activity_BAO_Query {
           $name = str_replace('activity_', '', $name);
           $qillName = str_replace('_id', '', $qillName);
         }
+        if ($name == 'activity_campaign_id') {
+          $name  = 'campaign_id';
+        }
+
         $dataType = !empty($fields[$qillName]['type']) ? CRM_Utils_Type::typeToString($fields[$qillName]['type']) : 'String';
 
         $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_activity.$name", $op, $value, $dataType);
@@ -300,16 +301,6 @@ class CRM_Activity_BAO_Query {
         $query->_tables['civicrm_activity_tag'] = $query->_whereTables['civicrm_activity_tag'] = 1;
         break;
 
-      case 'activity_campaign_id':
-        $campParams = array(
-          'op' => $op,
-          'campaign' => $value,
-          'grouping' => $grouping,
-          'tableName' => 'civicrm_activity',
-        );
-        CRM_Campaign_BAO_Query::componentSearchClause($campParams, $query);
-        break;
-
       case 'activity_result':
         if (is_array($value)) {
           $safe = NULL;
@@ -413,9 +404,7 @@ class CRM_Activity_BAO_Query {
   /**
    * Add all the elements shared between case activity search and advanced search.
    *
-   *
    * @param CRM_Core_Form $form
-   * @return void
    */
   public static function buildSearchForm(&$form) {
     $activityOptions = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE);
index 6d404ad392237a29ba5c0b1e3670398add9efa48..a9899a1252187b6806a9308019efa4efc029ee1d 100644 (file)
@@ -29,7 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
  */
 
 /**
index a1790f346ac810563629fced1da5bc226430a7ca..908f7cef64571dd67f6a510b90725e474343cca1 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for Activity
- *
+ * This class generates form components for Activity.
  */
 class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
 
@@ -221,8 +218,6 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function preProcess() {
     CRM_Core_Form_RecurringEntity::preProcess('civicrm_activity');
@@ -513,11 +508,9 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
   }
 
   /**
-   * Set default values for the form. For edit/view mode
-   * the default values are retrieved from the database
-   *
+   * Set default values for the form.
    *
-   * @return void
+   * For edit/view mode the default values are retrieved from the database.
    */
   public function setDefaultValues() {
 
index 1ba55ce65bbfb30c5094de0b54ae3e07a36ed553..3cdd386232aa8f42ae47b76588ed938829fc9494 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for Activity Filter
- *
+ * This class generates form components for Activity Filter.
  */
 class CRM_Activity_Form_ActivityFilter extends CRM_Core_Form {
   public function buildQuickForm() {
index 88f8a2547d5743096f36defc820fe227126c3458..07053d4d6dd228b477e8bec6107299c4ca21c288 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for Activity Links
- *
+ * This class generates form components for Activity Links.
  */
 class CRM_Activity_Form_ActivityLinks extends CRM_Core_Form {
   public function buildQuickForm() {
index 5153296bd9d744314322932853c98e252a4f036e..9f25fbecd0ecfcbe71d71e36ac20458b4c708d40 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class handle activity view mode
- *
+ * This class handle activity view mode.
  */
 class CRM_Activity_Form_ActivityView extends CRM_Core_Form {
 
   /**
    * Set variables up before form is built.
-   *
-   * @return void
    */
   public function preProcess() {
     //get the activity values
@@ -117,8 +112,6 @@ class CRM_Activity_Form_ActivityView extends CRM_Core_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $this->addButtons(array(
index cf8ba69ad0c7cb154fdb10a71257d57ad241788b..1836d3197eade285d80a262e6cfaef5bebc26a77 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-/**
- * Files required
  */
 
 /**
- * This file is for activity search
+ * This file is for activity search.
  */
 class CRM_Activity_Form_Search extends CRM_Core_Form_Search {
 
@@ -77,8 +71,6 @@ class CRM_Activity_Form_Search extends CRM_Core_Form_Search {
 
   /**
    * Processing needed for buildForm and later.
-   *
-   * @return void
    */
   public function preProcess() {
     $this->set('searchFormName', 'Search');
@@ -158,9 +150,6 @@ class CRM_Activity_Form_Search extends CRM_Core_Form_Search {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
index 371028fc5bcca874bcbe13fc9483daa6d3bbf7a6..7a330856f46cc24c72fee44876b20dc92ca90000 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Class for activity task actions
- *
+ * Class for activity task actions.
  */
 class CRM_Activity_Form_Task extends CRM_Core_Form {
 
@@ -76,16 +73,14 @@ class CRM_Activity_Form_Task extends CRM_Core_Form {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @param
-   *
-   * @return void
    */
   public function preProcess() {
     self::preProcessCommon($this);
   }
 
   /**
+   * Common pre-process function.
+   *
    * @param CRM_Core_Form $form
    * @param bool $useTable
    */
@@ -194,8 +189,6 @@ WHERE  activity_id IN ( $IDs ) AND
    *   Button type for the form after processing.
    * @param string $backType
    * @param bool $submitOnce
-   *
-   * @return void
    */
   public function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
     $this->addButtons(array(
index 441a0ea5b8e7c1821ec2bf4f46812a9b9610af0f..f95ec55f916fece65e1e53c4f576ff0dcab711d0 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -56,9 +54,6 @@ class CRM_Activity_Form_Task_AddToTag extends CRM_Activity_Form_Task {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     // add select for tag
@@ -95,9 +90,6 @@ class CRM_Activity_Form_Task_AddToTag extends CRM_Activity_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     //get the submitted values in an array
index 7c6c2a91d8e869c7580033d478f0e3499236a24e..0793f97c872b4df7daec78ef6d7c53b08290d3cd 100755 (executable)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -57,8 +55,6 @@ class CRM_Activity_Form_Task_Batch extends CRM_Activity_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     /*
index 4e3f48c0a636bbc2c646f3648976fe88177bc4ca..addd960599a45973332aff1d48973d72b109c3e6 100755 (executable)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -50,8 +48,6 @@ class CRM_Activity_Form_Task_Delete extends CRM_Activity_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     parent::preProcess();
@@ -59,9 +55,6 @@ class CRM_Activity_Form_Task_Delete extends CRM_Activity_Form_Task {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $this->addDefaultButtons(ts('Delete Activities'), 'done');
@@ -69,9 +62,6 @@ class CRM_Activity_Form_Task_Delete extends CRM_Activity_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     $deleted = $failed = 0;
index 981932a517a1cb9785c6d126e192ba79b7bdd353..6bf8116a6d7bbffc9ddf224f6a31fe023fe1a777 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id: Email.php 26615 2010-03-21 21:05:35Z kurund $
- *
  */
 
 /**
- * This class provides the functionality to email a group of
- * contacts.
+ * This class provides the functionality to email a group of contacts.
  */
 class CRM_Activity_Form_Task_Email extends CRM_Activity_Form_Task {
 
@@ -58,8 +55,6 @@ class CRM_Activity_Form_Task_Email extends CRM_Activity_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     CRM_Contact_Form_Task_EmailCommon::preProcessFromAddress($this);
@@ -73,9 +68,6 @@ class CRM_Activity_Form_Task_Email extends CRM_Activity_Form_Task {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     //enable form element
@@ -86,9 +78,6 @@ class CRM_Activity_Form_Task_Email extends CRM_Activity_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     CRM_Contact_Form_Task_EmailCommon::postProcess($this);
index cc14a1685f0e48dc1c703e910f665822220df41e..508bb29f1bc383fa6bc474ecac7243ad471c23fe 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -57,8 +55,6 @@ class CRM_Activity_Form_Task_FileOnCase extends CRM_Activity_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     parent::preProcess();
@@ -70,9 +66,6 @@ class CRM_Activity_Form_Task_FileOnCase extends CRM_Activity_Form_Task {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $this->add('text', 'unclosed_case_id', ts('Select Case'), array('class' => 'huge'), TRUE);
@@ -81,18 +74,12 @@ class CRM_Activity_Form_Task_FileOnCase extends CRM_Activity_Form_Task {
 
   /**
    * Add local and global form rules.
-   *
-   *
-   * @return void
    */
   public function addRules() {
   }
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     $formparams = $this->exportValues();
index 579bb93be518a502577200f8eb6aa7d815ae04e4..ac0aeb905c30fce0a63bcd2d86985293feb6a2bf 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class provides the functionality to email a group of contacts
+ * This class provides the functionality to email a group of contacts.
  */
 class CRM_Activity_Form_Task_PickOption extends CRM_Activity_Form_Task {
 
@@ -62,8 +60,6 @@ class CRM_Activity_Form_Task_PickOption extends CRM_Activity_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     /*
@@ -93,9 +89,6 @@ class CRM_Activity_Form_Task_PickOption extends CRM_Activity_Form_Task {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $this->addElement('checkbox', 'with_contact', ts('With Contact'));
@@ -107,9 +100,6 @@ class CRM_Activity_Form_Task_PickOption extends CRM_Activity_Form_Task {
 
   /**
    * Add local and global form rules.
-   *
-   *
-   * @return void
    */
   public function addRules() {
     $this->addFormRule(array('CRM_Activity_Form_Task_PickOption', 'formRule'));
@@ -136,9 +126,6 @@ class CRM_Activity_Form_Task_PickOption extends CRM_Activity_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     // Clear any formRule errors from Email form in case they came back here via Cancel button
@@ -177,7 +164,7 @@ class CRM_Activity_Form_Task_PickOption extends CRM_Activity_Form_Task {
       $urlParams = "_qf_PickOption_display=true&qfKey={$params['qfKey']}";
       $urlRedirect = CRM_Utils_System::url('civicrm/activity/search', $urlParams);
       CRM_Core_Error::statusBounce(
-        ts('It appears you have no contacts with emails from the selected recipients.'),
+        ts('It appears you have no contacts with email addresses from the selected recipients.'),
         $urlRedirect
       );
     }
index ff99d7a844ec1f2d4b74f2b34417cd4afd337c39..cd3076865d1a83745075815c129ef1740e84d3c7 100755 (executable)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class provides the functionality for batch profile update for Activity
+ * This class provides the functionality for batch profile update for Activity.
  */
 class CRM_Activity_Form_Task_PickProfile extends CRM_Activity_Form_Task {
 
@@ -57,8 +55,6 @@ class CRM_Activity_Form_Task_PickProfile extends CRM_Activity_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     /*
@@ -74,7 +70,7 @@ class CRM_Activity_Form_Task_PickProfile extends CRM_Activity_Form_Task {
     $validate = FALSE;
     //validations
     if (count($this->_activityHolderIds) > $this->_maxActivities) {
-      CRM_Core_Session::setStatus(ts("The maximum number of Activities you can select for Batch Update is %1. You have selected %2. Please select fewer Activities from your search results and try again.", array(
+      CRM_Core_Session::setStatus(ts("The maximum number of Activities you can select for Batch update is %1. You have selected %2. Please select fewer Activities from your search results and try again.", array(
             1 => $this->_maxActivities,
             2 => count($this->_activityHolderIds),
           )), ts('Maximum Exceeded'), 'error');
@@ -89,9 +85,6 @@ class CRM_Activity_Form_Task_PickProfile extends CRM_Activity_Form_Task {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $types = array('Activity');
@@ -119,7 +112,7 @@ class CRM_Activity_Form_Task_PickProfile extends CRM_Activity_Form_Task {
     }
 
     if (empty($profiles)) {
-      CRM_Core_Session::setStatus(ts("You will need to create a Profile containing the %1 fields you want to edit before you can use Batch Update via Profile. Navigate to Administer > Customize Data and Screens > Profiles to configure a Profile. Consult the online Administrator documentation for more information.", array(1 => $types[0])), ts("No Profile Configured"), "alert");
+      CRM_Core_Session::setStatus(ts("You will need to create a Profile containing the %1 fields you want to edit before you can use Batch update activities via profile. Navigate to Administer > Customize Data and Screens > Profiles to configure a Profile. Consult the online Administrator documentation for more information.", array(1 => $types[0])), ts("No Profile Configured"), "alert");
       CRM_Utils_System::redirect($this->_userContext);
     }
     elseif ($notEditable) {
@@ -137,9 +130,6 @@ class CRM_Activity_Form_Task_PickProfile extends CRM_Activity_Form_Task {
 
   /**
    * Add local and global form rules.
-   *
-   *
-   * @return void
    */
   public function addRules() {
     $this->addFormRule(array('CRM_Activity_Form_Task_PickProfile', 'formRule'));
@@ -160,9 +150,6 @@ class CRM_Activity_Form_Task_PickProfile extends CRM_Activity_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     $params = $this->exportValues();
index 73601ff467b8ef342f884efe983bd032c9127468..a49fda59510953c194685d021c54adacc53a02ef 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class provides the functionality to print activity records
+ * This class provides the functionality to print activity records.
  */
 class CRM_Activity_Form_Task_Print extends CRM_Activity_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     parent::preprocess();
@@ -66,12 +62,11 @@ class CRM_Activity_Form_Task_Print extends CRM_Activity_Form_Task {
   }
 
   /**
-   * Build the form object - it consists of
+   * Build the form object.
+   *
+   * Consists of
    *    - displaying the QILL (query in local language)
    *    - displaying elements for saving the search
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     //
@@ -94,9 +89,6 @@ class CRM_Activity_Form_Task_Print extends CRM_Activity_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     // redirect to the main search page after printing is over
index 1d5239ea883382eba23220f58c7e885bd90b5127..27a3c064aaa38a591562e9207840699df7129786 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -53,10 +51,7 @@ class CRM_Activity_Form_Task_RemoveFromTag extends CRM_Activity_Form_Task {
   protected $_tags;
 
   /**
-   * Build the form object
-   *
-   *
-   * @return void
+   * Build the form object.
    */
   public function buildQuickForm() {
     // add select for tag
@@ -91,9 +86,6 @@ class CRM_Activity_Form_Task_RemoveFromTag extends CRM_Activity_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     //get the submitted values in an array
index aa35bf565a4b950b8339d56cc165ca1cf6fbf9e9..0f12a429bc6abb4c74d530306030f7f977cbbde6 100644 (file)
@@ -26,8 +26,7 @@
  */
 
 /**
- * This class provides the functionality to sms a group of
- * contacts.
+ * This class provides the functionality to sms a group of contacts.
  */
 class CRM_Activity_Form_Task_SMS extends CRM_Activity_Form_Task {
 
@@ -48,8 +47,6 @@ class CRM_Activity_Form_Task_SMS extends CRM_Activity_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     parent::preProcess();
@@ -59,9 +56,6 @@ class CRM_Activity_Form_Task_SMS extends CRM_Activity_Form_Task {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     //enable form element
@@ -71,9 +65,6 @@ class CRM_Activity_Form_Task_SMS extends CRM_Activity_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     CRM_Contact_Form_Task_SMSCommon::postProcess($this);
index 37dc7b098ac9ff87480e213b8b953a8441f3bb23..51b036d393a7d32c132cac26f7ed93f1733bf50e 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -41,8 +39,6 @@ class CRM_Activity_Form_Task_SearchTaskHookSample extends CRM_Activity_Form_Task
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     parent::preProcess();
@@ -81,8 +77,6 @@ INNER JOIN civicrm_contact ct ON ( ac.contact_id = ct.id )
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $this->addButtons(array(
index f86ada89e02db6782ae970eb35873b5a420a0487..a8686829bf5152cb15f8990f743bf1e019c7d7a8 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Activity_Import_Controller extends CRM_Core_Controller {
 
   /**
    * Class constructor.
    *
-   * @param null $title
+   * @param string $title
    * @param bool|int $action
    * @param bool $modal
    */
index 8b677634c23ca51b79b5ba28bcaf10f8ae4ed410..036cfdd0409765b97ddd54081c0a20b23d3eb13d 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Activity_Import_Field {
 
-  /**#@+
-   * @var string
-   */
-
   /**
-   * Name of the field
+   * @var string
+   *   Name of the field
    */
   public $_name;
 
index 73fc897d78c78f327b8ff7dbc55b453d4d36f262..aa412bb2f36df5c0e59cc531f04145457a22347b 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class gets the name of the file to upload
+ * This class gets the name of the file to upload.
  */
 class CRM_Activity_Import_Form_DataSource extends CRM_Import_Form_DataSource {
 
@@ -44,8 +42,6 @@ class CRM_Activity_Import_Form_DataSource extends CRM_Import_Form_DataSource {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -69,8 +65,6 @@ class CRM_Activity_Import_Form_DataSource extends CRM_Import_Form_DataSource {
 
   /**
    * Process the uploaded file.
-   *
-   * @return void
    */
   public function postProcess() {
     $this->storeFormValues(array(
index 20fe0bb3cac6c372908402d00d972694a7715781..e20f6eecb3e60e1bc7b5853366ae26d7132013b5 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class gets the name of the file to upload
+ * This class gets the name of the file to upload.
  */
 class CRM_Activity_Import_Form_MapField extends CRM_Import_Form_MapField {
 
 
   /**
    * Set variables up before form is built.
-   *
-   * @return void
    */
   public function preProcess() {
     $this->_mapperFields = $this->get('fields');
@@ -82,8 +78,6 @@ class CRM_Activity_Import_Form_MapField extends CRM_Import_Form_MapField {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     //to save the current mappings
@@ -371,9 +365,8 @@ class CRM_Activity_Import_Form_MapField extends CRM_Import_Form_MapField {
 
   /**
    * Process the mapped fields and map it into the uploaded file.
-   * preview the file and extract some summary statistics
    *
-   * @return void
+   * Preview the file and extract some summary statistics
    */
   public function postProcess() {
     $params = $this->controller->exportValues('MapField');
index 7f4f46139c0e1eb5f302a6039d82766796d485ef..2d0c18d5b7e46cc34735b228015a86b3f9a0650c 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class previews the uploaded file and returns summary
- * statistics
+ * This class previews the uploaded file and returns summary statistics.
  */
 class CRM_Activity_Import_Form_Preview extends CRM_Import_Form_Preview {
 
   /**
    * Set variables up before form is built.
-   *
-   * @return void
    */
   public function preProcess() {
     $skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader');
@@ -107,9 +102,8 @@ class CRM_Activity_Import_Form_Preview extends CRM_Import_Form_Preview {
 
   /**
    * Process the mapped fields and map it into the uploaded file.
-   * preview the file and extract some summary statistics
    *
-   * @return void
+   * Preview the file and extract some summary statistics
    */
   public function postProcess() {
     $fileName = $this->controller->exportValue('DataSource', 'uploadFile');
index 792b64079ca057344f7e9822329f8fdfe2b36541..6631141d1851aa9475f21838688e68b219239109 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class summarizes the import results
+ * This class summarizes the import results.
  */
 class CRM_Activity_Import_Form_Summary extends CRM_Import_Form_Summary {
 
   /**
    * Set variables up before form is built.
-   *
-   * @return void
    */
   public function preProcess() {
     // set the error message path to display
index aa4c8e0e7868aaa784b85d2dcf696ed7b0fb75d2..9dd3c1c0b24f32eb495f47329c789a3612abe3bd 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 abstract class CRM_Activity_Import_Parser extends CRM_Import_Parser {
 
@@ -275,12 +273,9 @@ abstract class CRM_Activity_Import_Parser extends CRM_Import_Parser {
   }
 
   /**
-   * Given a list of the importable field keys that the user has selected
-   * set the active fields array to this list
+   * Given a list of the importable field keys that the user has selected set the active fields array to this list.
    *
    * @param array $fieldKeys
-   *
-   * @return void
    */
   public function setActiveFields($fieldKeys) {
     $this->_activeFieldCount = count($fieldKeys);
@@ -343,8 +338,6 @@ abstract class CRM_Activity_Import_Parser extends CRM_Import_Parser {
    * @param CRM_Core_Session $store
    *
    * @param int $mode
-   *
-   * @return void
    */
   public function set($store, $mode = self::MODE_SUMMARY) {
     $store->set('fileSize', $this->_fileSize);
@@ -387,8 +380,6 @@ abstract class CRM_Activity_Import_Parser extends CRM_Import_Parser {
    * @param string $fileName
    * @param array $header
    * @param array $data
-   *
-   * @return void
    */
   public static function exportCSV($fileName, $header, $data) {
     $output = array();
index 2f568f7e86411d709e6991f5509a551d3b8399f0..adbc2abb5029444ccf8b9bc76e8a845c59031343 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
-require_once 'api/api.php';
 
 /**
- * class to parse activity csv files
+ * Class to parse activity csv files.
  */
 class CRM_Activity_Import_Parser_Activity extends CRM_Activity_Import_Parser {
 
@@ -56,7 +53,8 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Activity_Import_Parser {
 
   /**
    * Class constructor.
-   * @param $mapperKeys
+   *
+   * @param array $mapperKeys
    * @param null $mapperLocType
    * @param null $mapperPhoneType
    */
@@ -66,9 +64,7 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Activity_Import_Parser {
   }
 
   /**
-   * The initializer code, called before the processing
-   *
-   * @return void
+   * The initializer code, called before the processing.
    */
   public function init() {
     $activityContact = CRM_Activity_BAO_ActivityContact::import();
@@ -398,9 +394,7 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Activity_Import_Parser {
   }
 
   /**
-   * The initializer code, called before the processing
-   *
-   * @return void
+   * The initializer code, called before the processing.
    */
   public function fini() {
   }
index 25148ea0a58a01875cbaab7ce18b60504d7f6047..9d5dbbe918b65a28b18373912973ea3da2d7b4a0 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Main page for viewing activities
- *
+ * Main page for viewing activities,
  */
 class CRM_Activity_Page_Tab extends CRM_Core_Page {
 
   /**
    * Browse all activities for a particular contact.
-   *
-   * @return void
    */
   public function browse() {
     $this->assign('admin', FALSE);
@@ -116,10 +111,9 @@ class CRM_Activity_Page_Tab extends CRM_Core_Page {
   }
 
   /**
-   * Heart of the viewing process. The runner gets all the meta data for
-   * the contact and calls the appropriate type of page to view.
+   * Heart of the viewing process.
    *
-   * @return void
+   * The runner gets all the meta data for the contact and calls the appropriate type of page to view.
    */
   public function preProcess() {
     $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
@@ -158,8 +152,6 @@ class CRM_Activity_Page_Tab extends CRM_Core_Page {
 
   /**
    * Perform actions and display for activities.
-   *
-   * @return void
    */
   public function run() {
     $context = CRM_Utils_Request::retrieve('context', 'String', $this);
index 1a6c9d331462427ea7377616d2cd530dfc5c2a8c..b9d5f89a2b0a70c115558f125cd5bda705c74123 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class is for building event(participation) block on user dashboard
+ * This class is for building event(participation) block on user dashboard.
  */
 class CRM_Activity_Page_UserDashboard extends CRM_Contact_Page_View_UserDashBoard {
 
@@ -66,10 +64,9 @@ class CRM_Activity_Page_UserDashboard extends CRM_Contact_Page_View_UserDashBoar
   }
 
   /**
-   * the main function that is called when the page
-   * loads, it decides the which action has to be taken for the page.
+   * The main function that is called when the page loads.
    *
-   * @return void
+   * It decides the which action has to be taken for the page.
    */
   public function run() {
     parent::preProcess();
index 1181f03c1e0003c2319b6504fbdb6c7f87e58a25..dbac346b6e75fd4641297b97e500ab2b53bcbcc8 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class is used to retrieve and display activities for a contact
- *
+ * This class is used to retrieve and display activities for a contact.
  */
 class CRM_Activity_Selector_Activity extends CRM_Core_Selector_Base implements CRM_Core_Selector_API {
 
index 662afe14483c334bfb076ab4113e4ba894f933f6..e2bbf895a8ba62ff647dc4b9ddf224da54a25222 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class is used to retrieve and display a range of
- * contacts that match the given criteria (specifically for
- * results of advanced search options.
+ * This class is used to retrieve and display a range of  contacts that match the given criteria.
  *
+ * Specifically for results of advanced search options.
  */
 class CRM_Activity_Selector_Search extends CRM_Core_Selector_Base implements CRM_Core_Selector_API {
 
index f6baf0fe1f0cc1a657aa1cab7a1187d10028be27..0f8eea0c411c319932273a73e204283f018dd05c 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Activity_StateMachine_Search extends CRM_Core_StateMachine {
 
index 6c15cef550b82c09a8e00748de97e01ddeff6ac7..0fe4d5f249f917aae67360c749c21a4c6b995ce6 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
  */
 
 /**
- * Class to represent the actions that can be performed on a group of contacts
- * used by the search forms.
+ * Class to represent the actions that can be performed on a group of contacts used by the search forms.
  */
 class CRM_Activity_Task {
   const
@@ -70,17 +68,17 @@ class CRM_Activity_Task {
     if (!(self::$_tasks)) {
       self::$_tasks = array(
         1 => array(
-          'title' => ts('Delete Activities'),
+          'title' => ts('Delete activities'),
           'class' => 'CRM_Activity_Form_Task_Delete',
           'result' => FALSE,
         ),
         2 => array(
-          'title' => ts('Print Selected Rows'),
+          'title' => ts('Print selected rows'),
           'class' => 'CRM_Activity_Form_Task_Print',
           'result' => FALSE,
         ),
         3 => array(
-          'title' => ts('Export Activities'),
+          'title' => ts('Export activities'),
           'class' => array(
             'CRM_Export_Form_Select',
             'CRM_Export_Form_Map',
@@ -88,7 +86,7 @@ class CRM_Activity_Task {
           'result' => FALSE,
         ),
         4 => array(
-          'title' => ts('Batch Update Activities Via Profile'),
+          'title' => ts('Batch update activities via profile'),
           'class' => array(
             'CRM_Activity_Form_Task_PickProfile',
             'CRM_Activity_Form_Task_Batch',
@@ -96,7 +94,7 @@ class CRM_Activity_Task {
           'result' => FALSE,
         ),
         5 => array(
-          'title' => ts('Send Email to Contacts'),
+          'title' => ts('Email - send now'),
           'class' => array(
             'CRM_Activity_Form_Task_PickOption',
             'CRM_Activity_Form_Task_Email',
@@ -104,17 +102,17 @@ class CRM_Activity_Task {
           'result' => FALSE,
         ),
         6 => array(
-          'title' => ts('Send Reply SMS To Contacts'),
+          'title' => ts('SMS - send reply'),
           'class' => 'CRM_Activity_Form_Task_SMS',
           'result' => FALSE,
         ),
         7 => array(
-          'title' => ts('Tag Activities (assign tags)'),
+          'title' => ts('Tag - add to activities'),
           'class' => 'CRM_Activity_Form_Task_AddToTag',
           'result' => FALSE,
         ),
         8 => array(
-          'title' => ts('Untag Activities (remove tags)'),
+          'title' => ts('Tag - remove from activities'),
           'class' => 'CRM_Activity_Form_Task_RemoveFromTag',
           'result' => FALSE,
         ),
@@ -126,7 +124,7 @@ class CRM_Activity_Task {
           CRM_Core_Permission::check('access my cases and activities')
         ) {
           self::$_tasks[6] = array(
-            'title' => ts('File on Case'),
+            'title' => ts('File on case'),
             'class' => 'CRM_Activity_Form_Task_FileOnCase',
             'result' => FALSE,
           );
index 4c45a371fff95fd7960ba1492a267f9da22fb284..897274d55e34c32995c0c44642f32925ccfea300 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Base class for admin forms
+ * Base class for admin forms.
  */
 class CRM_Admin_Form extends CRM_Core_Form {
 
@@ -113,8 +111,6 @@ class CRM_Admin_Form extends CRM_Core_Form {
 
   /**
    * Add standard buttons.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     if ($this->_action & CRM_Core_Action::VIEW || $this->_action & CRM_Core_Action::PREVIEW) {
index fa00057bb64467a56f16035eedecf489068cb4b3..03dd5e866b47f52ce73beb70dbeb22db50800dc4 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
  * This class generates form components for Synchronizing CMS Users
- *
  */
 class CRM_Admin_Form_CMSUser extends CRM_Core_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
 
@@ -62,9 +57,6 @@ class CRM_Admin_Form_CMSUser extends CRM_Core_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     CRM_Core_BAO_CMSUser::synchronize();
index ba79ff909315d1b0047f481c82fd79eda4879857..09f589c871fcf5f34321acaaae89e2741671cd21 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for ContactSub Type
- *
+ * This class generates form components for ContactSub Type.
  */
 class CRM_Admin_Form_ContactType extends CRM_Admin_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -118,9 +113,6 @@ class CRM_Admin_Form_ContactType extends CRM_Admin_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     CRM_Utils_System::flushCache();
index 1c852dad03f1afb7a55f22e9fdea1f7e8c1501b4..df93fbf23bc948e09859bb14fb1e501c0c6de7cd 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for Extensions
- *
+ * This class generates form components for Extensions.
  */
 class CRM_Admin_Form_Extensions extends CRM_Admin_Form {
 
   /**
-   * For pre-processing
-   *
-   * @return void
+   * Form pre-processing.
    */
   public function preProcess() {
     parent::preProcess();
@@ -84,10 +79,6 @@ class CRM_Admin_Form_Extensions extends CRM_Admin_Form {
 
   /**
    * Set default values for the form.
-   * the default values are retrieved from the database
-   *
-   *
-   * @return void
    */
   public function setDefaultValues() {
     $defaults = array();
@@ -96,8 +87,6 @@ class CRM_Admin_Form_Extensions extends CRM_Admin_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     switch ($this->_action) {
@@ -173,9 +162,6 @@ class CRM_Admin_Form_Extensions extends CRM_Admin_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     CRM_Utils_System::flushCache();
index 61a17699eaf0de7d910fc68cd068fab17cb3c43f..f489aeb1bfd9224ac6ba7f87f70fdbbc3fb283e8 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id: $
- *
  */
 
 /**
- *
+ * Class for configuring jobs.
  */
 class CRM_Admin_Form_Job extends CRM_Admin_Form {
   protected $_id = NULL;
@@ -65,8 +63,6 @@ class CRM_Admin_Form_Job extends CRM_Admin_Form {
    * Build the form object.
    *
    * @param bool $check
-   *
-   * @return void
    */
   public function buildQuickForm($check = FALSE) {
     parent::buildQuickForm();
@@ -172,9 +168,6 @@ class CRM_Admin_Form_Job extends CRM_Admin_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
 
index 2acd821200c1854c340e6ae9dba5ae4ece0cd20b..59e1a334d69fbde6fb580f1eaff5b5264c1a08f9 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for Label Format Settings
- *
+ * This class generates form components for Label Format Settings.
  */
 class CRM_Admin_Form_LabelFormats extends CRM_Admin_Form {
 
@@ -62,8 +59,6 @@ class CRM_Admin_Form_LabelFormats extends CRM_Admin_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -180,9 +175,6 @@ class CRM_Admin_Form_LabelFormats extends CRM_Admin_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     if ($this->_action & CRM_Core_Action::DELETE) {
index 7192e54b9d4395b1d7585158c94855dc93b11998..0646f7957f9b98123458c561047b3ae63c8e902b 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for Location Type
- *
+ * This class generates form components for Location Type.
  */
 class CRM_Admin_Form_LocationType extends CRM_Admin_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -89,9 +84,6 @@ class CRM_Admin_Form_LocationType extends CRM_Admin_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     CRM_Utils_System::flushCache('CRM_Core_DAO_LocationType');
index c76cdc77d087e03c8f95bfb0f05edaf7efb10c6b..4365a503c83a91b92f2faeb3e05960e4cdf78b64 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -41,8 +39,6 @@ class CRM_Admin_Form_MailSettings extends CRM_Admin_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -93,9 +89,6 @@ class CRM_Admin_Form_MailSettings extends CRM_Admin_Form {
 
   /**
    * Add local and global form rules.
-   *
-   *
-   * @return void
    */
   public function addRules() {
     $this->addFormRule(array('CRM_Admin_Form_MailSettings', 'formRule'));
@@ -122,9 +115,6 @@ class CRM_Admin_Form_MailSettings extends CRM_Admin_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     if ($this->_action & CRM_Core_Action::DELETE) {
index 7ba6f0fa630e6e27103700a796be3556b4fc1cb9..50284a82950c2936bcd392459a50645ce845483f 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for Mapping
- *
+ * This class generates form components for Mapping.
  */
 class CRM_Admin_Form_Mapping extends CRM_Admin_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function preProcess() {
     parent::preProcess();
@@ -92,9 +87,6 @@ class CRM_Admin_Form_Mapping extends CRM_Admin_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     // store the submitted values in an array
index 0e7874440cc0a361e296090da4e0e1de3b4dfe5c..61b1fa258813d596d6dcffd955ed9b97444ebc82 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
  * This class generates form components for Message templates
  * used by membership, contributions, event registrations, etc.
- *
  */
 class CRM_Admin_Form_MessageTemplates extends CRM_Admin_Form {
   // which (and whether) mailing workflow this template belongs to
@@ -56,10 +53,8 @@ class CRM_Admin_Form_MessageTemplates extends CRM_Admin_Form {
 
   /**
    * Set default values for the form.
-   * The default values are retrieved from the database.
-   *
    *
-   * @return void
+   * The default values are retrieved from the database.
    */
   public function setDefaultValues() {
     $defaults = $this->_values;
@@ -110,8 +105,6 @@ class CRM_Admin_Form_MessageTemplates extends CRM_Admin_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
 
@@ -202,9 +195,6 @@ class CRM_Admin_Form_MessageTemplates extends CRM_Admin_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     if ($this->_action & CRM_Core_Action::DELETE) {
index 6c98a0478e438e7801e7d46568c6ab55b07eba51..318e5bfa8424001d3e1a6923a823d04a6a2826e9 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for Navigation
- *
+ * This class generates form components for Navigation.
  */
 class CRM_Admin_Form_Navigation extends CRM_Admin_Form {
 
@@ -46,8 +43,6 @@ class CRM_Admin_Form_Navigation extends CRM_Admin_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -138,9 +133,6 @@ class CRM_Admin_Form_Navigation extends CRM_Admin_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     // get the submitted form values.
index b2839463e9faace9d89cd70c18da4b4be6823aff..df38787996e942e427416e93db13d6b525aa2377 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for Option Group
- *
+ * This class generates form components for Option Group.
  */
 class CRM_Admin_Form_OptionGroup extends CRM_Admin_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -102,9 +97,6 @@ class CRM_Admin_Form_OptionGroup extends CRM_Admin_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     CRM_Utils_System::flushCache();
index a546c10e5ec44b6a0f4968ebe6ceb19f6f83fc34..25db9ff2737b6774611939302fd29dfb2776a749 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for Options
- *
+ * This class generates form components for Options.
  */
 class CRM_Admin_Form_Options extends CRM_Admin_Form {
 
@@ -55,8 +52,6 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form {
 
   /**
    * Pre-process
-   *
-   * @return void
    */
   public function preProcess() {
     parent::preProcess();
@@ -115,8 +110,6 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form {
 
   /**
    * Set default values for the form.
-   *
-   * @return void
    */
   public function setDefaultValues() {
     $defaults = parent::setDefaultValues();
@@ -146,8 +139,6 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -390,9 +381,6 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     if ($this->_action & CRM_Core_Action::DELETE) {
index bf6f4e7736c99ba7b2e65742b102e3e20f6afd7b..dc7c58aba75de720b63780cba30cd6a62ca639f3 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Admin_Form_ParticipantStatusType extends CRM_Admin_Form {
 
@@ -41,6 +39,9 @@ class CRM_Admin_Form_ParticipantStatusType extends CRM_Admin_Form {
     return 'ParticipantStatusType';
   }
 
+  /**
+   * Build form.
+   */
   public function buildQuickForm() {
     parent::buildQuickForm();
 
@@ -71,6 +72,8 @@ class CRM_Admin_Form_ParticipantStatusType extends CRM_Admin_Form {
   }
 
   /**
+   * Set default values.
+   *
    * @return array
    */
   public function setDefaultValues() {
index dc9339833ab4c8d9bcf24e7b39cda38d62083909..e60b390323ded7e186062c2629a90f212af595d4 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id: PaymentProcessor.php 9702 2007-05-29 23:57:16Z lobo $
- *
  */
 
 /**
- * This class generates form components for Payment Processor
- *
+ * This class generates form components for Payment Processor.
  */
 class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form {
   protected $_id = NULL;
@@ -165,8 +162,6 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form {
    * Build the form object.
    *
    * @param bool $check
-   *
-   * @return void
    */
   public function buildQuickForm($check = FALSE) {
     parent::buildQuickForm();
@@ -338,9 +333,6 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return Void
    */
   public function postProcess() {
     CRM_Utils_System::flushCache('CRM_Financial_DAO_PaymentProcessor');
@@ -367,11 +359,9 @@ class CRM_Admin_Form_PaymentProcessor extends CRM_Admin_Form {
   /**
    * Save a payment processor.
    *
-   * @param $values
+   * @param array $values
    * @param int $domainID
-   * @param $test
-   *
-   * @return void
+   * @param bool $test
    */
   public function updatePaymentProcessor(&$values, $domainID, $test) {
     $dao = new CRM_Financial_DAO_PaymentProcessor();
index d53a55326e3931c2026a57c3a557a150b92b8540..5c4e2e946f38a585dc432c8c43e9c0c6ea66a28c 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id: PaymentProcessorType.php 9702 2007-05-29 23:57:16Z lobo $
- *
  */
 
 /**
- * This class generates form components for Location Type
- *
+ * This class generates form components for Location Type.
  */
 class CRM_Admin_Form_PaymentProcessorType extends CRM_Admin_Form {
   protected $_id = NULL;
@@ -149,8 +146,6 @@ class CRM_Admin_Form_PaymentProcessorType extends CRM_Admin_Form {
    * Build the form object.
    *
    * @param bool $check
-   *
-   * @return void
    */
   public function buildQuickForm($check = FALSE) {
     parent::buildQuickForm();
@@ -206,9 +201,6 @@ class CRM_Admin_Form_PaymentProcessorType extends CRM_Admin_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     CRM_Utils_System::flushCache('CRM_Financial_DAO_PaymentProcessorType');
index c6f6ef5687ab2628ebce701ea706d1183a38f5b2..da53bf5590d469486ce1245adc46c1e12e55e938 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for PDF Page Format Settings
- *
+ * This class generates form components for PDF Page Format Settings.
  */
 class CRM_Admin_Form_PdfFormats extends CRM_Admin_Form {
 
@@ -47,8 +44,6 @@ class CRM_Admin_Form_PdfFormats extends CRM_Admin_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -110,9 +105,6 @@ class CRM_Admin_Form_PdfFormats extends CRM_Admin_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     if ($this->_action & CRM_Core_Action::DELETE) {
index 3cce900a0b1e5ce87d4744b58c781cdd22cbe13f..cfcdf1b4f71cda26ee5fc14d6d4637874ba26d8b 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * customize the output to meet our specific requirements
+ * Customize the output to meet our specific requirements.
  */
 class CRM_Admin_Form_Persistent extends CRM_Core_Form {
 
+  /**
+   * Pre-process form.
+   */
   public function preProcess() {
     $this->_indexID = CRM_Utils_Request::retrieve('id', 'Integer', $this, FALSE);
     $this->_config = CRM_Utils_Request::retrieve('config', 'Integer', $this, 0);
@@ -50,6 +51,8 @@ class CRM_Admin_Form_Persistent extends CRM_Core_Form {
   }
 
   /**
+   * Set default values.
+   *
    * @return array
    */
   public function setDefaultValues() {
index 3d392b2a2d048b0b9a5bb2fead6467cbcaceb333..ef88e38a5d25c801d62a9030f3ab7a7d104d8afd 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Base class for settings forms
- *
+ * Base class for settings forms.
  */
 class CRM_Admin_Form_Preferences extends CRM_Core_Form {
   protected $_system = FALSE;
@@ -140,8 +137,6 @@ class CRM_Admin_Form_Preferences extends CRM_Core_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -235,9 +230,6 @@ class CRM_Admin_Form_Preferences extends CRM_Core_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     $config = CRM_Core_Config::singleton();
@@ -252,9 +244,6 @@ class CRM_Admin_Form_Preferences extends CRM_Core_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcessCommon() {
     foreach ($this->_varNames as $groupName => $groupValues) {
index eb6f4ad1877f09e5d762209fcc48cac0398658d9..61617e458fc8dc9156ac5f5e3ea7ec806fbbbd5f 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for Address Section
+ * This class generates form components for Address Section.
  */
 class CRM_Admin_Form_Preferences_Address extends CRM_Admin_Form_Preferences {
   public function preProcess() {
@@ -136,8 +134,6 @@ class CRM_Admin_Form_Preferences_Address extends CRM_Admin_Form_Preferences {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $this->applyFilter('__ALL__', 'trim');
@@ -180,9 +176,6 @@ class CRM_Admin_Form_Preferences_Address extends CRM_Admin_Form_Preferences {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     if ($this->_action == CRM_Core_Action::VIEW) {
index 29a3ebce3beca1a80766b522a5134bbc37a06113..d08996cd73e4c2af34d91810f6ed14ae7b09f56c 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for the display preferences
- *
+ * This class generates form components for the display preferences.
  */
 class CRM_Admin_Form_Preferences_Contribute extends CRM_Admin_Form_Preferences {
   protected $_settings = array(
     'cvv_backoffice_required' => CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME,
   );
+
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function preProcess() {
     $config = CRM_Core_Config::singleton();
@@ -121,8 +116,6 @@ class CRM_Admin_Form_Preferences_Contribute extends CRM_Admin_Form_Preferences {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     //CRM-16691: Changes made related to settings of 'CVV'.
@@ -152,10 +145,8 @@ class CRM_Admin_Form_Preferences_Contribute extends CRM_Admin_Form_Preferences {
 
   /**
    * Set default values for the form.
-   * default values are retrieved from the database
-   *
    *
-   * @return void
+   * default values are retrieved from the database
    */
   public function setDefaultValues() {
     $defaults = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
@@ -175,9 +166,6 @@ class CRM_Admin_Form_Preferences_Contribute extends CRM_Admin_Form_Preferences {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     // store the submitted values in an array
index 503582934d408f697d696ffe3fd0eb11049e3989..b164585e704e143705d258c81c71e5ae3a5aa032 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id: Display.php 45499 2013-02-08 12:31:05Z kurund $
- *
  */
 
 /**
@@ -126,8 +124,6 @@ class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $wysiwyg_options = CRM_Core_OptionGroup::values('wysiwyg_editor', FALSE, FALSE, FALSE, NULL, 'label', TRUE, FALSE, 'name');
@@ -160,9 +156,6 @@ class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     if ($this->_action == CRM_Core_Action::VIEW) {
index 7a2002fcd1612d08afbac67760593636f082fc72..ad24d2e81d00697ea56e125c752082485baca659 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id: Display.php 36505 2011-10-03 14:19:56Z lobo $
- *
  */
 
 /**
- * This class generates form components for component preferences
- *
+ * This class generates form components for component preferences.
  */
 class CRM_Admin_Form_Preferences_Member extends CRM_Admin_Form_Preferences {
   public function preProcess() {
@@ -57,8 +54,6 @@ class CRM_Admin_Form_Preferences_Member extends CRM_Admin_Form_Preferences {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
index ec3b413344fdc373cbb322ee84539c0dc4e7d242..97d6455b862ab50e9707631cc5d1597c246455e7 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for Location Type
- *
+ * This class generates form components for Location Type.
  */
 class CRM_Admin_Form_PreferencesDate extends CRM_Admin_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
 
@@ -109,9 +104,6 @@ class CRM_Admin_Form_PreferencesDate extends CRM_Admin_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     if (!($this->_action & CRM_Core_Action::UPDATE)) {
index 59ba8b9577b4016d346931aea2aba2d650d13fcd..41d108bf5ba48e3dd487a1c97f5d6312ad3b3718 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for Relationship Type
- *
+ * This class generates form components for Relationship Type.
  */
 class CRM_Admin_Form_RelationshipType extends CRM_Admin_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -135,9 +130,6 @@ class CRM_Admin_Form_RelationshipType extends CRM_Admin_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     if ($this->_action & CRM_Core_Action::DELETE) {
index 7c9d82f31892c41fd112c0f6761b531a70f82a79..4e1893e1b4a19c9b38f74b2c75f7c3fc756ee307 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for Scheduling Reminders
- *
+ * This class generates form components for Scheduling Reminders.
  */
 class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form {
 
@@ -48,8 +45,6 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -386,9 +381,6 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     if ($this->_action & CRM_Core_Action::DELETE) {
index 0948c65b1a009c96c88e024a89c21cce9df98dfd..3e02107b2c77e5ec4a588d4235789c5bf0e6b411 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
  */
 
 /**
- * This class generates form components generic to CiviCRM settings
+ * This class generates form components generic to CiviCRM settings.
  */
 class CRM_Admin_Form_Setting extends CRM_Core_Form {
 
@@ -167,6 +166,11 @@ class CRM_Admin_Form_Setting extends CRM_Core_Form {
     }
   }
 
+  /**
+   * Get default entity.
+   *
+   * @return string
+   */
   public function getDefaultEntity() {
     return 'Setting';
   }
index 7b1fe225c63f02d535e63f85ba04cf2b8af22a08..cdcf59be823fda913654ae2b7c452f4a225021d9 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for Component
+ * This class generates form components for Component.
  */
 class CRM_Admin_Form_Setting_Component extends CRM_Admin_Form_Setting {
   protected $_components;
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     CRM_Utils_System::setTitle(ts('Settings - Enable Components'));
index 575997e204adc5dae0d169dcd24bd20501bfea32..fa068d993dfbdaf5115797f736ff0f93fe2c24e4 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for Date Formatting
- *
+ * This class generates form components for Date Formatting.
  */
 class CRM_Admin_Form_Setting_Date extends CRM_Admin_Form_Setting {
 
@@ -48,8 +45,6 @@ class CRM_Admin_Form_Setting_Date extends CRM_Admin_Form_Setting {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     CRM_Utils_System::setTitle(ts('Settings - Date'));
index b88f2f61372c3711058f6f79ff36423b3e69aa79..3c718484bcb44980f733364c4043e4f513680556 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for Error Handling and Debugging
- *
+ * This class generates form components for Error Handling and Debugging.
  */
 class CRM_Admin_Form_Setting_Debugging extends CRM_Admin_Form_Setting {
 
@@ -47,8 +44,6 @@ class CRM_Admin_Form_Setting_Debugging extends CRM_Admin_Form_Setting {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     CRM_Utils_System::setTitle(ts(' Settings - Debugging and Error Handling '));
index 75f1c6deaf91cacc6925a09a3d4831d2fc6f7101..5921e98275376c7f7dfde9918382825a9080c8fa 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for Localization
- *
+ * This class generates form components for Localization.
  */
 class CRM_Admin_Form_Setting_Localization extends CRM_Admin_Form_Setting {
   // use this variable to store mappings that we compute in buildForm and also
@@ -44,8 +41,6 @@ class CRM_Admin_Form_Setting_Localization extends CRM_Admin_Form_Setting {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $config = CRM_Core_Config::singleton();
index add51c219aea094933bb753a419ed4e4da021fe9..e78d5daf4fa99fec2cdc9b90d1ee9cad5b19dd42 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for CiviMail
+ * This class generates form components for CiviMail.
  */
 class CRM_Admin_Form_Setting_Mail extends CRM_Admin_Form_Setting {
 
@@ -44,8 +42,6 @@ class CRM_Admin_Form_Setting_Mail extends CRM_Admin_Form_Setting {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     CRM_Utils_System::setTitle(ts('Settings - CiviMail'));
index c4c4ebd3d7810e1776fdb4e1340f9efd6e0a978a..4eb31dd7d9a59fa4602ffa71018f3204ffb3746c 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for Mapping and Geocoding
- *
+ * This class generates form components for Mapping and Geocoding.
  */
 class CRM_Admin_Form_Setting_Mapping extends CRM_Admin_Form_Setting {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     CRM_Utils_System::setTitle(ts('Settings - Mapping and Geocoding Providers'));
@@ -85,10 +80,9 @@ class CRM_Admin_Form_Setting_Mapping extends CRM_Admin_Form_Setting {
   }
 
   /**
-   * add the rules (mainly global rules) for form.
-   * All local rules are added near the element
+   * Add the rules (mainly global rules) for form.
    *
-   * @return void
+   * All local rules are added near the element
    */
   public function addRules() {
     $this->addFormRule(array('CRM_Admin_Form_Setting_Mapping', 'formRule'));
index a27a28351e1e0eb22a5125216ab30f5ecf19cbea..1f78d8a22f1f24a43e2913ce166d669040cd844e 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for Miscellaneous
- *
+ * This class generates form components for Miscellaneous.
  */
 class CRM_Admin_Form_Setting_Miscellaneous extends CRM_Admin_Form_Setting {
 
@@ -68,8 +65,6 @@ class CRM_Admin_Form_Setting_Miscellaneous extends CRM_Admin_Form_Setting {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     CRM_Utils_System::setTitle(ts('Misc (Undelete, PDFs, Limits, Logging, Captcha, etc.)'));
index 5e792cd788621c730809b3a84333e0bfa8d0ecc2..f33b15a57e5b5132f9de9c862a8836c3c69ca179 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for File System Path
- *
+ * This class generates form components for File System Path.
  */
 class CRM_Admin_Form_Setting_Path extends CRM_Admin_Form_Setting {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     CRM_Utils_System::setTitle(ts('Settings - Upload Directories'));
index 4a7759f0fe306faa965151ae74a2c876d916fba1..f0a4174d638f8e59029d1d953221d28a5fa6ef0d 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for Smtp Server
- *
+ * This class generates form components for Smtp Server.
  */
 class CRM_Admin_Form_Setting_Smtp extends CRM_Admin_Form_Setting {
   protected $_testButtonName;
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
 
@@ -76,9 +71,6 @@ class CRM_Admin_Form_Setting_Smtp extends CRM_Admin_Form_Setting {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     // flush caches so we reload details for future requests
@@ -243,10 +235,6 @@ class CRM_Admin_Form_Setting_Smtp extends CRM_Admin_Form_Setting {
 
   /**
    * Set default values for the form.
-   * default values are retrieved from the database
-   *
-   *
-   * @return void
    */
   public function setDefaultValues() {
     if (!$this->_defaults) {
index 87fe17b3d659aa8b008695f30288b16df159dbb8..391a0716783327ca4a13e37a8073b94c9e788a0e 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for Site Url
- *
+ * This class generates form components for Site Url.
  */
 class CRM_Admin_Form_Setting_UF extends CRM_Admin_Form_Setting {
 
@@ -45,8 +42,6 @@ class CRM_Admin_Form_Setting_UF extends CRM_Admin_Form_Setting {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $config = CRM_Core_Config::singleton();
index 0e71709a7b82e9a6f91e9a3c3b6c29029c4b1d49..07d612a4e566e740133a1b17200ae0929f1d15b4 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
  * This class generates form components for Error Handling and Debugging
- *
  */
 class CRM_Admin_Form_Setting_UpdateConfigBackend extends CRM_Admin_Form_Setting {
   protected $_oldBaseDir;
@@ -44,8 +41,6 @@ class CRM_Admin_Form_Setting_UpdateConfigBackend extends CRM_Admin_Form_Setting
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     CRM_Utils_System::setTitle(ts('Settings - Cleanup Caches and Update Paths'));
index 8424127a7174552ad1f307b39ba8295cb9f3fe58..4dbcf9eb49a5ca8eeef3260f4fccd6bde411581d 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for Site Url
- *
+ * This class generates form components for Site Url.
  */
 class CRM_Admin_Form_Setting_Url extends CRM_Admin_Form_Setting {
   protected $_settings = array(
@@ -44,8 +41,6 @@ class CRM_Admin_Form_Setting_Url extends CRM_Admin_Form_Setting {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     CRM_Utils_System::setTitle(ts('Settings - Resource URLs'));
index 207278133bd62646b97d87e33b488a656fb8cfa1..af18b37b7f749c7d6955a510bfd6be21dd23fa1e 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for Tag
- *
+ * This class generates form components for Tag.
  */
 class CRM_Admin_Form_Tag extends CRM_Admin_Form {
   protected $_isTagSet;
@@ -49,8 +46,6 @@ class CRM_Admin_Form_Tag extends CRM_Admin_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $this->setPageTitle($this->_isTagSet ? ts('Tag Set') : ts('Tag'));
@@ -137,9 +132,6 @@ class CRM_Admin_Form_Tag extends CRM_Admin_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     $params = $ids = array();
index dffc7bc37b2953fb21e4d2dad52791f7de88def5..070de44dee98c311f56759108ab57c087d6f5699 100644 (file)
@@ -29,7 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
  */
 class CRM_Admin_Form_WordReplacements extends CRM_Core_Form {
   protected $_numStrings = 10;
index 6eb048d17c33e7a4eba4021b988437e8e96aa548..64cfb8e34b0795a3be7b067d269c2fee9cd9e593 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class contains all the function that are called using AJAX
+ * This class contains all the function that are called using AJAX.
  */
 class CRM_Admin_Page_AJAX {
 
   /**
-   * CRM-12337 Output navigation menu as executable javascript
+   * CRM-12337 Output navigation menu as executable javascript.
+   *
    * @see smarty_function_crmNavigationMenu
    */
   public static function getNavigationMenu() {
@@ -62,15 +61,14 @@ class CRM_Admin_Page_AJAX {
   }
 
   /**
-   * Process drag/move action for menu tree
+   * Process drag/move action for menu tree.
    */
   public static function menuTree() {
     CRM_Core_BAO_Navigation::processNavigation($_GET);
   }
 
   /**
-   * Build status message while.
-   * enabling/ disabling various objects
+   * Build status message while enabling/ disabling various objects.
    */
   public static function getStatusMsg() {
     require_once 'api/v3/utils.php';
@@ -295,7 +293,12 @@ LIMIT $limit";
     CRM_Utils_JSON::output($result);
   }
 
-  public function mappingList() {
+  /**
+   * Get a list of mappings.
+   *
+   * This appears to be only used by scheduled reminders.
+   */
+  static public function mappingList() {
     if (empty($_GET['mappingID'])) {
       CRM_Utils_JSON::output(array('status' => 'error', 'error_msg' => 'required params missing.'));
     }
index 705f40df71ab6c8dce1162ab22fa318f227d30cb..0df6d0c9e2af2dfd401fa2071a46d17c43c32cdd 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -39,6 +37,8 @@
 class CRM_Admin_Page_APIExplorer extends CRM_Core_Page {
 
   /**
+   * Run page.
+   *
    * @return string
    */
   public function run() {
@@ -73,7 +73,7 @@ class CRM_Admin_Page_APIExplorer extends CRM_Core_Page {
   }
 
   /**
-   * AJAX callback to fetch examples
+   * AJAX callback to fetch examples.
    */
   public static function getExampleFile() {
     global $civicrm_root;
@@ -102,7 +102,7 @@ class CRM_Admin_Page_APIExplorer extends CRM_Core_Page {
   }
 
   /**
-   * Ajax callback to display code docs
+   * Ajax callback to display code docs.
    */
   public static function getDoc() {
     // Verify the API handler we're talking to is valid.
@@ -126,6 +126,8 @@ class CRM_Admin_Page_APIExplorer extends CRM_Core_Page {
   }
 
   /**
+   * Get documentation block.
+   *
    * @param string $entity
    * @param string|null $action
    * @return array|bool
index dcbd04255af45a9ea1c0dac2c20391da2e181c1c..e7fa0e7bf0d961080fadc2771f6a198afe3f89d6 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Dashboard page for managing Access Control
+ * Dashboard page for managing Access Control.
+ *
  * For initial version, this page only contains static links - so this class is empty for now.
  */
 class CRM_Admin_Page_Access extends CRM_Core_Page {
index 2ccf4770e60023570796453a64bf33ff09b272ec..d9985c9c08a1e720b40344706a64abd4bb5e2056 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page for displaying Administer CiviCRM Control Panel
+ * Page for displaying Administer CiviCRM Control Panel.
  */
 class CRM_Admin_Page_Admin extends CRM_Core_Page {
   /**
+   * Run page.
+   *
    * @return string
    */
   public function run() {
index bd46f6515db589d8fb23e71ec041dd6e2cffefba..ad59a2b37b18c46bf4fd2301961aa06dadbf30ba 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page for configuring CKEditor options
+ * Page for configuring CKEditor options.
  *
  * Note that while this is implemented as a CRM_Core_Page, it is actually a form.
  * Because the form needs to be submitted and refreshed via javascrit, it seemed like
@@ -55,6 +53,8 @@ class CRM_Admin_Page_CKEditorConfig extends CRM_Core_Page {
   );
 
   /**
+   * Run page.
+   *
    * @return string
    */
   public function run() {
@@ -121,6 +121,8 @@ class CRM_Admin_Page_CKEditorConfig extends CRM_Core_Page {
   }
 
   /**
+   * Get CKEditor plugins.
+   *
    * @return array
    */
   private function getCKPlugins() {
@@ -155,6 +157,8 @@ class CRM_Admin_Page_CKEditorConfig extends CRM_Core_Page {
   }
 
   /**
+   * Get CK Editor skins.
+   *
    * @return array
    */
   private function getCKSkins() {
@@ -223,7 +227,7 @@ class CRM_Admin_Page_CKEditorConfig extends CRM_Core_Page {
   }
 
   /**
-   * Delete self::CONFIG_FILENAME
+   * Delete config file.
    */
   public static function deleteConfigFile() {
     $file = self::getConfigFile();
index f276ed75944ab6f7de6e7d3836d01fb7da53d476..6c7b3c56b20bfaf2745726a5d5f796e1eae6a9e2 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -44,8 +42,6 @@ class CRM_Admin_Page_CMSUser extends CRM_Core_Page {
    * This method is called after the page is created. It checks for the
    * type of action and executes that action.
    * Finally it calls the parent's run method.
-   *
-   * @return void
    */
   public function run() {
     //if javascript is enabled
index b0fa9403244e858988b9d58bd31671228f1482f8..016fc2dd01a2e2c82f5b4ba032f0c2f694c981ba 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page for displaying list of site configuration tasks with links to each setting form
+ * Page for displaying list of site configuration tasks with links to each setting form.
  */
 class CRM_Admin_Page_ConfigTaskList extends CRM_Core_Page {
   /**
+   * Run page.
+   *
    * @return string
    */
   public function run() {
index fb5d6bfc8548454099c8575b3af23146a770af55..9da8ab50b3451d01b67693cec73f9464e9e62d94 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page for displaying list of contact Subtypes
+ * Page for displaying list of contact Subtypes.
  */
 class CRM_Admin_Page_ContactType extends CRM_Core_Page_Basic {
 
@@ -93,6 +91,9 @@ class CRM_Admin_Page_ContactType extends CRM_Core_Page_Basic {
     return self::$_links;
   }
 
+  /**
+   * Run page.
+   */
   public function run() {
     $action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 0);
     $this->assign('action', $action);
@@ -103,6 +104,9 @@ class CRM_Admin_Page_ContactType extends CRM_Core_Page_Basic {
     return parent::run();
   }
 
+  /**
+   * Browse contact types.
+   */
   public function browse() {
     $rows = CRM_Contact_BAO_ContactType::contactTypeInfo(TRUE);
     foreach ($rows as $key => $value) {
index 34e18a05d0d6d34d3432bfd7ee27da40e71e3f97..84a7bcae690ba4d7889023e8289d7ff1d8c6c323 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -85,8 +83,6 @@ class CRM_Admin_Page_EventTemplate extends CRM_Core_Page_Basic {
 
   /**
    * Browse all event templates.
-   *
-   * @return void
    */
   public function browse() {
     //get all event templates.
index b221498361773de613a9cf8c19165f862893d6b8..74644323dc3d6f8a16c6e2c1f53eb8a9fba87383 100644 (file)
@@ -30,8 +30,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -48,8 +46,6 @@ class CRM_Admin_Page_Extensions extends CRM_Core_Page_Basic {
 
   /**
    * Obtains the group name from url and sets the title.
-   *
-   * @return void
    */
   public function preProcess() {
     CRM_Utils_System::setTitle(ts('CiviCRM Extensions'));
@@ -117,8 +113,6 @@ class CRM_Admin_Page_Extensions extends CRM_Core_Page_Basic {
 
   /**
    * Run the basic page (run essentially starts execution for that page).
-   *
-   * @return void
    */
   public function run() {
     $this->preProcess();
@@ -127,9 +121,6 @@ class CRM_Admin_Page_Extensions extends CRM_Core_Page_Basic {
 
   /**
    * Browse all options.
-   *
-   *
-   * @return void
    */
   public function browse() {
     $mapper = CRM_Extension_System::singleton()->getMapper();
index e2671f80215a2c3e54ac1ea847ac13d9280dd215..750e9dc57871db7b82aaa4152300e740350f86ee 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page for displaying list of jobs
+ * Page for displaying list of jobs.
  */
 class CRM_Admin_Page_Job extends CRM_Core_Page_Basic {
 
@@ -109,8 +107,6 @@ class CRM_Admin_Page_Job extends CRM_Core_Page_Basic {
    * This method is called after the page is created. It checks for the
    * type of action and executes that action.
    * Finally it calls the parent's run method.
-   *
-   * @return void
    */
   public function run() {
     // set title and breadcrumb
@@ -144,8 +140,6 @@ class CRM_Admin_Page_Job extends CRM_Core_Page_Basic {
    * Browse all jobs.
    *
    * @param null $action
-   *
-   * @return void
    */
   public function browse($action = NULL) {
 
index 9ad36bcfa2932afed632682911f789dd3274f85d..fd19c18100398d04cff99d2d1f4ed785e4229f9e 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page for displaying list of jobs
+ * Page for displaying list of jobs.
  */
 class CRM_Admin_Page_JobLog extends CRM_Core_Page_Basic {
 
@@ -71,8 +69,6 @@ class CRM_Admin_Page_JobLog extends CRM_Core_Page_Basic {
    * This method is called after the page is created. It checks for the
    * type of action and executes that action.
    * Finally it calls the parent's run method.
-   *
-   * @return void
    */
   public function run() {
     // set title and breadcrumb
@@ -93,8 +89,6 @@ class CRM_Admin_Page_JobLog extends CRM_Core_Page_Basic {
    * Browse all jobs.
    *
    * @param null $action
-   *
-   * @return void
    */
   public function browse($action = NULL) {
 
index c93e6a637ca19e55236947fd4711581d77731402..e9e8a0ce65f35e5d9ed5135f3e30d58d844b1e00 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page for displaying list of Label Formats
+ * Page for displaying list of Label Formats.
  */
 class CRM_Admin_Page_LabelFormats extends CRM_Core_Page_Basic {
 
@@ -128,8 +126,6 @@ class CRM_Admin_Page_LabelFormats extends CRM_Core_Page_Basic {
    * Browse all Label Format settings.
    *
    * @param null $action
-   *
-   * @return void
    */
   public function browse($action = NULL) {
     // Get list of configured Label Formats
index 91d0067dbe3c7d8b554f6c19da5f597953ad6809..ce38c28476e8d4cde8f63a4694028b9bcfae488d 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page for displaying list of location types
+ * Page for displaying list of location types.
  */
 class CRM_Admin_Page_LocationType extends CRM_Core_Page_Basic {
 
index 8778b07e83927dcfd1d75ba947afdf0835caeacc..2bf6c4893b34902fdaca97b69bbfda5c4fd9edaf 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page for displaying list of Mail account settings
+ * Page for displaying list of Mail account settings.
  */
 class CRM_Admin_Page_MailSettings extends CRM_Core_Page_Basic {
 
@@ -87,8 +85,6 @@ class CRM_Admin_Page_MailSettings extends CRM_Core_Page_Basic {
 
   /**
    * Browse all mail settings.
-   *
-   * @return void
    */
   public function browse() {
     //get all mail settings.
index 2a474b5d7df926948856b151cd05b717ceef42d0..0aa0b2c81b1bf2dab54836c51f81ed8c79fd1332 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page for displaying list of categories
+ * Page for displaying list of categories.
  */
 class CRM_Admin_Page_Mapping extends CRM_Core_Page_Basic {
 
@@ -139,8 +137,6 @@ class CRM_Admin_Page_Mapping extends CRM_Core_Page_Basic {
 
   /**
    * Run the basic page.
-   *
-   * @return void
    */
   public function run() {
     $sort = 'mapping_type asc';
index 665ac43f74be150c96c1d73699fca12e9416dd31..3a6c203bf4332f6d43d2556dc8f6b3ae4164aa1b 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page for displaying list of message templates
+ * Page for displaying list of message templates.
  */
 class CRM_Admin_Page_MessageTemplates extends CRM_Core_Page_Basic {
 
@@ -241,8 +239,6 @@ class CRM_Admin_Page_MessageTemplates extends CRM_Core_Page_Basic {
 
   /**
    * Browse all entities.
-   *
-   * @return void
    */
   public function browse() {
     $action = func_num_args() ? func_get_arg(0) : NULL;
index ee21dc34fdebf46e037fcc2e12b16f97e749fa5e..b7a301c17307e4e7e28f364e1222e64d8d5b7699 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page for displaying list of location types
+ * Page for displaying list of location types.
  */
 class CRM_Admin_Page_Navigation extends CRM_Core_Page_Basic {
 
index e6c61877ba6c26c3a5a837dc4432dae763f02ba4..cc9d9b8d10bf0dae107fa4b2f8a42617dbd0c0b5 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page for displaying list of Gender
+ * Page for displaying list of Gender.
  */
 class CRM_Admin_Page_Options extends CRM_Core_Page_Basic {
 
@@ -77,9 +75,8 @@ class CRM_Admin_Page_Options extends CRM_Core_Page_Basic {
 
   /**
    * Obtains the group name from url string or id from $_GET['gid'].
-   * Sets the title.
    *
-   * @return void
+   * Sets the title.
    */
   public function preProcess() {
     if (!self::$_gName && !empty($this->urlPath[3])) {
@@ -221,8 +218,6 @@ class CRM_Admin_Page_Options extends CRM_Core_Page_Basic {
 
   /**
    * Run the basic page (run essentially starts execution for that page).
-   *
-   * @return void
    */
   public function run() {
     $this->preProcess();
@@ -231,9 +226,6 @@ class CRM_Admin_Page_Options extends CRM_Core_Page_Basic {
 
   /**
    * Browse all options.
-   *
-   *
-   * @return void
    */
   public function browse() {
     if (!self::$_gName) {
index 9497840e77e9a7cf59b272a652d8f769bf31499b..687bba5519197ffbea368e4f3f465e11a0a5fa12 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Admin_Page_ParticipantStatusType extends CRM_Core_Page_Basic {
 
   public $useLivePageJS = TRUE;
 
   /**
+   * Get BAO name.
+   *
    * @return string
    */
   public function getBAOName() {
index 39530a93e5b6ba1705c1d0e40d9053c6e52a7322..d6ee3042b848a875962c8b675862f0289bd7fcb8 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page for displaying list of payment processors
+ * Page for displaying list of payment processors.
  */
 class CRM_Admin_Page_PaymentProcessor extends CRM_Core_Page_Basic {
 
@@ -97,8 +95,6 @@ class CRM_Admin_Page_PaymentProcessor extends CRM_Core_Page_Basic {
    * This method is called after the page is created. It checks for the
    * type of action and executes that action.
    * Finally it calls the parent's run method.
-   *
-   * @return void
    */
   public function run() {
     // set title and breadcrumb
@@ -125,8 +121,6 @@ class CRM_Admin_Page_PaymentProcessor extends CRM_Core_Page_Basic {
    * Browse all payment processors.
    *
    * @param null $action
-   *
-   * @return void
    */
   public function browse($action = NULL) {
     // get all custom groups sorted by weight
index b7da659cd53afc6046aafe36506685b293ee7959..ef657679148670253bc09c0051a2a62738ef9c68 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page for displaying list of payment processors
+ * Page for displaying list of payment processors.
  */
 class CRM_Admin_Page_PaymentProcessorType extends CRM_Core_Page_Basic {
 
index 90299ce86fc2b47778e2caf64868e267cf3de9c4..57e9396be53e4c376b4c3e7961f6da439fc96779 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page for displaying list of PDF Page Formats
+ * Page for displaying list of PDF Page Formats.
  */
 class CRM_Admin_Page_PdfFormats extends CRM_Core_Page_Basic {
 
@@ -122,8 +120,6 @@ class CRM_Admin_Page_PdfFormats extends CRM_Core_Page_Basic {
    * Browse all PDF Page Formats.
    *
    * @param null $action
-   *
-   * @return void
    */
   public function browse($action = NULL) {
     // Get list of configured PDF Page Formats
index dafe746fd1fb5509cae56a5f34a25f67b0bccb96..e562780e1b4590820e3efedce5c261f5deae0c0f 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -89,8 +87,6 @@ class CRM_Admin_Page_Persistent extends CRM_Core_Page {
 
   /**
    * Run the basic page (run essentially starts execution for that page).
-   *
-   * @return void
    */
   public function run() {
     CRM_Utils_System::setTitle(ts('DB Template Strings'));
@@ -100,9 +96,6 @@ class CRM_Admin_Page_Persistent extends CRM_Core_Page {
 
   /**
    * Browse all options.
-   *
-   *
-   * @return void
    */
   public function browse() {
     $permission = FALSE;
index e58996a25275ecad2f4a9d3b4d60a46fad26e6cd..698773a5e0438cfdf4c040a94b830b10384d5a85 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page for displaying list of location types
+ * Page for displaying list of location types.
  */
 class CRM_Admin_Page_PreferencesDate extends CRM_Core_Page_Basic {
 
@@ -81,8 +79,6 @@ class CRM_Admin_Page_PreferencesDate extends CRM_Core_Page_Basic {
    * This method is called after the page is created. It checks for the
    * type of action and executes that action.
    * Finally it calls the parent's run method.
-   *
-   * @return void
    */
   public function run() {
     // set title and breadcrumb
index 7bb943f321587efe7a1d8487f49aea1f60b1f617..7f35a0c1c635229cb8cbda115d70d18a5f61e754 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page for displaying list of relationship types
+ * Page for displaying list of relationship types.
  */
 class CRM_Admin_Page_RelationshipType extends CRM_Core_Page_Basic {
 
index f53cbc512f5e8a3ad011ebf5b8ac3c452b87cb03..90f89f2e3b5b474fdf2896228b43481b205ae0f5 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page for displaying list of Reminders
+ * Page for displaying list of Reminders.
  */
 class CRM_Admin_Page_ScheduleReminders extends CRM_Core_Page_Basic {
 
@@ -131,8 +129,6 @@ class CRM_Admin_Page_ScheduleReminders extends CRM_Core_Page_Basic {
    * Browse all Scheduled Reminders settings.
    *
    * @param null $action
-   *
-   * @return void
    */
   public function browse($action = NULL) {
     //CRM-16777: Do not permit access to user, for page 'Administer->Communication->Schedule Reminder',
index a86f94b322acde0ecd046bf3cf570ee5b0601eb4..55de3446b840514ce39874c400fc923ded085037 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page for displaying list of categories for Settings
+ * Page for displaying list of categories for Settings.
  */
 class CRM_Admin_Page_Setting extends CRM_Core_Page {
   /**
+   * Run page.
+   *
    * @return string
    * @throws Exception
    */
index 4e4b1dcd0420c59451c26359566f16cbf6910e24..6742447ffdab75ca5ac56b3eba6d8824613ed831 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page for displaying list of categories
+ * Page for displaying list of categories.
  */
 class CRM_Admin_Page_Tag extends CRM_Core_Page_Basic {
 
index 70f179a6f0ab0d0bb32a13bd77926b505dff4f67..741b357f40a253ff7a626b25bfe62c38a9280b27 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Class CRM_Badge_Format_Badge
+ * Class CRM_Badge_Format_Badge.
  *
  * parent class for building name badges
  */
@@ -49,8 +47,6 @@ class CRM_Badge_BAO_Badge {
    *   Associated array with participant info.
    * @param array $layoutInfo
    *   Associated array which contains meta data about format/layout.
-   *
-   * @return void
    */
   public function createLabels(&$participants, &$layoutInfo) {
     $this->pdf = new CRM_Utils_PDF_Label($layoutInfo['format'], 'mm');
@@ -365,8 +361,6 @@ class CRM_Badge_BAO_Badge {
    * @param string $y
    * @param null $w
    * @param null $h
-   *
-   * @return void
    */
   public function printImage($img, $x = '', $y = '', $w = NULL, $h = NULL) {
     if (!$x) {
@@ -409,8 +403,6 @@ class CRM_Badge_BAO_Badge {
    * @param array $params
    *   Associated array of submitted values.
    * @param CRM_Core_Form $form
-   *
-   * @return void
    */
   public static function buildBadges(&$params, &$form) {
     // get name badge layout info
index d8c405b0d1be023505c020f27f8b9d6cd004efdc..b39b54d771ae04f7fbd9c36eb5934b390e70043b 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Badge_BAO_Layout extends CRM_Core_DAO_PrintLabel {
 
index 5c9a195d88e100e764dac06fa13a34af710883f1..6f0fbaa3f51449b44bf25a4fa4e860b6a784d6bc 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for name badge layout
- *
+ * This class generates form components for name badge layout.
  */
 class CRM_Badge_Form_Layout extends CRM_Admin_Form {
 
@@ -43,8 +40,6 @@ class CRM_Badge_Form_Layout extends CRM_Admin_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     if ($this->_action & CRM_Core_Action::DELETE) {
@@ -154,11 +149,7 @@ class CRM_Badge_Form_Layout extends CRM_Admin_Form {
   }
 
   /**
-   * Set default values for the form. MobileProvider that in edit/view mode
-   * the default values are retrieved from the database
-   *
-   *
-   * @return void
+   * Set default values for the form.
    */
   public function setDefaultValues() {
     if (isset($this->_id)) {
@@ -183,9 +174,6 @@ class CRM_Badge_Form_Layout extends CRM_Admin_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     if ($this->_action & CRM_Core_Action::DELETE) {
index e122d9258fa35442ca835bfecd74973bc46c88e8..492dccd8b26953a6a155ce41c94dc2d7e306c0b8 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page for list page badges
+ * Page for list page badges.
  */
 class CRM_Badge_Page_Layout extends CRM_Core_Page_Basic {
 
index 9861b4bfd6069a38d64c200701c47f51429649c2..e6ab88ba1da5f8ca6daffb38538cd893f59dd4ff 100755 (executable)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- *
+ * Batch BAO class.
  */
 class CRM_Batch_BAO_Batch extends CRM_Batch_DAO_Batch {
 
@@ -575,9 +573,6 @@ class CRM_Batch_BAO_Batch extends CRM_Batch_DAO_Batch {
    *   Associated array of batch ids.
    * @param string $exportFormat
    *   Export format.
-   *
-   * @return void
-   *
    */
   public static function exportFinancialBatch($batchIds, $exportFormat) {
     if (empty($batchIds)) {
index 996a7f26d896fa4e7f8ef43c1dee64bb8212419a..73f5610b807a7a445740354d51d30be4670105db 100755 (executable)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class provides the functionality for batch entry for contributions/memberships
+ * This class provides the functionality for batch entry for contributions/memberships.
  */
 class CRM_Batch_Form_Entry extends CRM_Core_Form {
 
@@ -86,8 +84,6 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     $this->_batchId = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
@@ -114,9 +110,6 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     if (!$this->_profileId) {
@@ -356,9 +349,6 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
 
   /**
    * Set default values for the form.
-   *
-   *
-   * @return void
    */
   public function setDefaultValues() {
     if (empty($this->_fields)) {
@@ -397,9 +387,6 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     $params = $this->controller->exportValues($this->_name);
@@ -436,8 +423,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
    * @param array $params
    *   Associated array of submitted values.
    *
-   *
-   * @return void
+   * @return bool
    */
   private function processContribution(&$params) {
     $dates = array(
@@ -859,9 +845,6 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
    *
    * @param array $value
    *   Associated array of submitted values.
-   *
-   *
-   * @return void
    */
   private function updateContactInfo(&$value) {
     $value['preserveDBName'] = $this->_preserveDefault;
@@ -875,9 +858,10 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
   }
 
   /**
-   * Function exists purely for unit testing purposes. If you feel tempted to use this in live code
-   * then it probably means there is some functionality that needs to be moved
-   * out of the form layer
+   * Function exists purely for unit testing purposes.
+   *
+   * If you feel tempted to use this in live code then it probably means there is some functionality
+   * that needs to be moved out of the form layer
    *
    * @param array $params
    *
@@ -888,9 +872,10 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
   }
 
   /**
-   * Function exists purely for unit testing purposes. If you feel tempted to use this in live code
-   * then it probably means there is some functionality that needs to be moved
-   * out of the form layer
+   * Function exists purely for unit testing purposes.
+   *
+   * If you feel tempted to use this in live code then it probably means there is some functionality
+   * that needs to be moved out of the form layer.
    *
    * @param array $params
    *
index a3d9c21ff0ac7058c98cefb2df222013a8472a28..61ca13475e0cb5b147d3866739c0981267cc0e75 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Batch_Form_Search extends CRM_Core_Form {
   /**
+   * Set default values.
+   *
    * @return array
    */
   public function setDefaultValues() {
index 3831fe4d988e149e70d8f529fa08e84b2df3e0bf..3bf89bfa10d7e3ed9f9b538ba02ff1417c803837 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class contains functions that are called using AJAX
+ * This class contains functions that are called using AJAX.
  */
 class CRM_Batch_Page_AJAX {
 
index a7cd8657a4fccde546367c517b8c9c451407be5d..932b3c424cfe15ded035aacc4cb9c8c1ff34fe65 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -57,7 +55,6 @@ class CRM_Batch_Page_Batch extends CRM_Core_Page_Basic {
 
   /**
    * Get action Links.
-   *
    */
   public function &links() {
   }
@@ -96,8 +93,6 @@ class CRM_Batch_Page_Batch extends CRM_Core_Page_Basic {
 
   /**
    * Browse all entities.
-   *
-   * @return void
    */
   public function browse() {
     $status = CRM_Utils_Request::retrieve('status', 'Positive', CRM_Core_DAO::$_nullObject, FALSE, 1);
index 1f64a02d1d2f3e6cfe1ebf53eef721cee35e5297..ddaf959d82b4caf287b128eb3fa2fe65b6b6c23a 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Bridge_OG_CiviCRM {
 
index a0a16755af1245a1acec95d6b145ac0e379ff071..e5557a8626ea9e83ea6fc4b905d985abc576c8c1 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
index db5912771b2da8e208a88a62a75d2f06e49320a8..123efc15cb9009a144f2a3a4d6320b31a3949817 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Bridge_OG_Utils {
   const aclEnabled = 1, syncFromCiviCRM = 1;
index 44136bdfbd460af1438ca7b8c071f68bfe8b3b8d..dd793c9b50884af91ba26ee4c3d3c3e2ad91352e 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Campaign_BAO_Campaign extends CRM_Campaign_DAO_Campaign {
 
@@ -145,7 +143,7 @@ class CRM_Campaign_BAO_Campaign extends CRM_Campaign_DAO_Campaign {
    *
    * @return \CRM_Campaign_DAO_Campaign|null
    */
-  public function retrieve(&$params, &$defaults) {
+  public static function retrieve(&$params, &$defaults) {
     $campaign = new CRM_Campaign_DAO_Campaign();
 
     $campaign->copyValues($params);
index e127d4c245cd5e2bccaa0487e945bcee644b4af9..c1ac5c01c1329c6147562493bc0ba4c2ebddb87c 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Campaign_BAO_Petition extends CRM_Campaign_BAO_Survey {
   /**
+   * Class constructor.
    */
   public function __construct() {
     parent::__construct();
@@ -536,10 +535,9 @@ AND         tag_id = ( SELECT id FROM civicrm_tag WHERE name = %2 )";
    * @param array $params
    *   (reference ) an assoc array of name/value pairs.
    *
-   * @param $sendEmailMode
+   * @param int $sendEmailMode
    *
    * @throws Exception
-   * @return void
    */
   public static function sendEmail($params, $sendEmailMode) {
 
index 79c023a252f54f2f2c8a51948dae4b5183d0be52..78b653f1b001e8830baa0ce38b2fa90276f24e44 100755 (executable)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Campaign_BAO_Query {
   //since normal activity clause clause get collides.
@@ -65,9 +63,7 @@ class CRM_Campaign_BAO_Query {
   /**
    * If survey, campaign are involved, add the specific fields.
    *
-   * @param $query
-   *
-   * @return void
+   * @param CRM_Contact_BAO_Contact $query
    */
   public static function select(&$query) {
     self::$_applySurveyClause = FALSE;
@@ -337,9 +333,7 @@ civicrm_activity_assignment.record_type_id = $assigneeID ) ";
    * Add all the elements shared between,
    * normal voter search and voter listing (GOTV form)
    *
-   *
    * @param CRM_Core_Form $form
-   * @return void
    */
   public static function buildSearchForm(&$form) {
 
@@ -568,64 +562,4 @@ INNER JOIN  civicrm_custom_group grp on fld.custom_group_id = grp.id
     return $voterClause;
   }
 
-  /**
-   * Build the campaign clause for component serach.
-   *
-   */
-  public static function componentSearchClause(&$params, &$query) {
-    $op = CRM_Utils_Array::value('op', $params, '=');
-    $campaign = CRM_Utils_Array::value('campaign', $params);
-    $tableName = CRM_Utils_Array::value('tableName', $params);
-    $grouping = CRM_Utils_Array::value('grouping', $params);
-    if (CRM_Utils_System::isNull($campaign) || empty($tableName)) {
-      return;
-    }
-
-    // fixme - what is the purpose of this code? $campaign should be
-    // an integer, not an array
-    if (is_array($campaign)) {
-      foreach (array(
-                 'current_campaign',
-                 'past_campaign',
-               ) as $ignore) {
-        $index = array_search($ignore, $campaign);
-        if ($index !== FALSE) {
-          unset($campaign[$index]);
-        }
-      }
-    }
-
-    $allCampaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE);
-
-    $campaignIds = $campaignTitles = array();
-    if (is_array($campaign)) {
-      foreach ($campaign as $campId) {
-        $campaignIds[$campId] = $campId;
-        $campaignTitles[$campId] = $allCampaigns[$campId];
-      }
-      if (count($campaignIds) > 1) {
-        $op = 'IN';
-        $campaignIds = '(' . implode(',', $campaignIds) . ')';
-      }
-      else {
-        $campaignIds = reset($campaignIds);
-      }
-    }
-    else {
-      $campaignIds = $campaign;
-      if (array_key_exists($campaignIds, $allCampaigns)) {
-        $campaignTitles[$campaignIds] = $allCampaigns[$campaignIds];
-      }
-    }
-    $query->_qill[$grouping][] = ts('Campaigns %1',
-        array(1 => $op)
-      ) . ' ' . implode(' ' . ts('or') . ' ', $campaignTitles);
-    $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("{$tableName}.campaign_id",
-      $op,
-      $campaignIds,
-      'Integer'
-    );
-    $query->_tables[$tableName] = $query->_whereTables[$tableName] = 1;
-  }
-
 }
index f554c5281673be25206584be04861f617063231f..a7097e704168e62477212510eb5f8d42511c2e5c 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
-require_once 'CRM/Campaign/DAO/Survey.php';
 
 /**
- * Class CRM_Campaign_BAO_Survey
+ * Class CRM_Campaign_BAO_Survey.
  */
 class CRM_Campaign_BAO_Survey extends CRM_Campaign_DAO_Survey {
 
index 14f23f13d4c8a85016f2233ff0e392cc67881faa..eee02200ac76e32af46577c8c92565f2d86a9e73 100644 (file)
@@ -32,8 +32,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Campaign_Config extends CRM_Core_Component_Config {
 }
index f77413a3ae340cb8a6b7b310a190a1db331b53a0..a12cd942c04d449f859e7a3ed72b4940c69a58c9 100755 (executable)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
index c32e985461a6024aec3d3a124132108db9b8d4b7..c9eaaf7076d392f63df9b8a3ffda5df4e17617a7 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for processing a campaign
- *
+ * This class generates form components for processing a campaign.
  */
 class CRM_Campaign_Form_Campaign extends CRM_Core_Form {
 
@@ -294,9 +291,6 @@ class CRM_Campaign_Form_Campaign extends CRM_Core_Form {
 
   /**
    * Form submission of new/edit campaign is processed.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     // store the submitted values in an array
index e7b3e1d650389eef2750bca974e53e9421a48a9a..f6c4c9365694df74848585a53636663c870a9ed3 100755 (executable)
@@ -29,7 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
  */
 
 /**
index 59c7cad45f997ec75bcc45a780fc85cea3f0749e..6931a7917fb10d2b607b4f4693769ba6ed16dd37 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for adding a petition
- *
+ * This class generates form components for adding a petition.
  */
 class CRM_Campaign_Form_Petition extends CRM_Core_Form {
 
index 3e0441893eaf878ca5d5ddd33b26256c877130dc..b4c9c1902320552da96f12ade36322e0ae7be710 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for processing a petition signature
- *
+ * This class generates form components for processing a petition signature.
  */
 class CRM_Campaign_Form_Petition_Signature extends CRM_Core_Form {
   const EMAIL_THANK = 1, EMAIL_CONFIRM = 2, MODE_CREATE = 4;
@@ -232,9 +229,6 @@ class CRM_Campaign_Form_Petition_Signature extends CRM_Core_Form {
 
   /**
    * Set default values for the form.
-   *
-   *
-   * @return void
    */
   public function setDefaultValues() {
     $this->_defaults = array();
@@ -320,8 +314,8 @@ class CRM_Campaign_Form_Petition_Signature extends CRM_Core_Form {
    * @param $files
    * @param $errors
    *
-   * @return void
    * @see valid_date
+   * @return array|bool
    */
   public static function formRule($fields, $files, $errors) {
     $errors = array();
@@ -331,9 +325,6 @@ class CRM_Campaign_Form_Petition_Signature extends CRM_Core_Form {
 
   /**
    * Form submission of petition signature.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     $tag_name = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CAMPAIGN_PREFERENCES_NAME,
@@ -577,8 +568,6 @@ class CRM_Campaign_Form_Petition_Signature extends CRM_Core_Form {
    * @param int $id
    * @param string $name
    * @param bool $viewOnly
-   *
-   * @return void
    */
   public function buildCustom($id, $name, $viewOnly = FALSE) {
     if ($id) {
index 99f053546bd3a3a75380068669ffeab13a9951b2..d223b29d2648d488b7c76b29677cd6126eaf0f7a 100755 (executable)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Files required
+ * Files required.
  */
 class CRM_Campaign_Form_Search extends CRM_Core_Form_Search {
 
@@ -69,8 +67,6 @@ class CRM_Campaign_Form_Search extends CRM_Core_Form_Search {
 
   /**
    * Processing needed for buildForm and later.
-   *
-   * @return void
    */
   public function preProcess() {
     $this->_done = FALSE;
@@ -193,9 +189,6 @@ class CRM_Campaign_Form_Search extends CRM_Core_Form_Search {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -250,10 +243,6 @@ class CRM_Campaign_Form_Search extends CRM_Core_Form_Search {
    *        done.
    * The processing consists of using a Selector / Controller framework for getting the
    * search results.
-   *
-   * @param
-   *
-   * @return void
    */
   public function postProcess() {
     if ($this->_done) {
index e58849f8862c987dad994e7614f46aabf3b3237c..af36fd2645696a6c2fc238a41d18615db2f47391 100755 (executable)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Files required
+ * Files required.
  */
 class CRM_Campaign_Form_Search_Campaign extends CRM_Core_Form {
 
@@ -47,8 +45,6 @@ class CRM_Campaign_Form_Search_Campaign extends CRM_Core_Form {
 
   /**
    * Processing needed for buildForm and later.
-   *
-   * @return void
    */
   public function preProcess() {
     $this->_search = CRM_Utils_Array::value('search', $_GET);
@@ -70,9 +66,6 @@ class CRM_Campaign_Form_Search_Campaign extends CRM_Core_Form {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     if ($this->_search) {
index f8eea7218ba7fea7ed8b2d9ff5c3c8d69dedde0e..4ca5509444ff4c27d7a2045356330b86426a5010 100755 (executable)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Files required
+ * Files required.
  */
 class CRM_Campaign_Form_Search_Petition extends CRM_Core_Form {
 
@@ -47,8 +45,6 @@ class CRM_Campaign_Form_Search_Petition extends CRM_Core_Form {
 
   /**
    * Processing needed for buildForm and later.
-   *
-   * @return void
    */
   public function preProcess() {
     $this->_search = CRM_Utils_Array::value('search', $_GET);
@@ -69,9 +65,6 @@ class CRM_Campaign_Form_Search_Petition extends CRM_Core_Form {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     if ($this->_search) {
index ceb4405953dac26b31a2d4118767526c62b776ca..e1d1bfc045d9e692e68ad3d1336b9aa8aaee2aeb 100755 (executable)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Files required
+ * Files required.
  */
 class CRM_Campaign_Form_Search_Survey extends CRM_Core_Form {
 
@@ -47,8 +45,6 @@ class CRM_Campaign_Form_Search_Survey extends CRM_Core_Form {
 
   /**
    * Processing needed for buildForm and later.
-   *
-   * @return void
    */
   public function preProcess() {
     $this->_search = CRM_Utils_Array::value('search', $_GET);
@@ -70,9 +66,6 @@ class CRM_Campaign_Form_Search_Survey extends CRM_Core_Form {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     if ($this->_search) {
index 8a9a123f8cc47e5afb04c047db071a76e202fd4a..7ebc9887f0d1b188b1da8cdb89d10f22902ff21a 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for processing a survey
- *
+ * This class generates form components for processing a survey.
  */
 class CRM_Campaign_Form_Survey extends CRM_Core_Form {
 
@@ -91,8 +88,6 @@ class CRM_Campaign_Form_Survey extends CRM_Core_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $session = CRM_Core_Session::singleton();
index aee73129f644f52fcd9e4cb2cf8af86cdefe4349..ac3db7c2c2319f1dfc0e053e9f66019795387caa 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class is to build the form for deleting a Survey
+ * This class is to build the form for deleting a Survey.
  */
 class CRM_Campaign_Form_Survey_Delete extends CRM_Core_Form {
 
@@ -55,8 +53,6 @@ class CRM_Campaign_Form_Survey_Delete extends CRM_Core_Form {
 
   /**
    * Set variables up before form is built.
-   *
-   * @return void
    */
   public function preProcess() {
     if (!CRM_Campaign_BAO_Campaign::accessCampaign()) {
@@ -73,8 +69,6 @@ class CRM_Campaign_Form_Survey_Delete extends CRM_Core_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $this->addButtons(array(
@@ -93,8 +87,6 @@ class CRM_Campaign_Form_Survey_Delete extends CRM_Core_Form {
 
   /**
    * Process the form when submitted.
-   *
-   * @return void
    */
   public function postProcess() {
     if ($this->_surveyId) {
index de31df619cb4c0d8d62bd2ed08416c5a71638b52..323664c8fa363bc69707671a9db8d7b39c5c92a7 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for processing a survey
- *
+ * This class generates form components for processing a survey.
  */
 class CRM_Campaign_Form_Survey_Main extends CRM_Campaign_Form_Survey {
 
@@ -137,8 +134,6 @@ class CRM_Campaign_Form_Survey_Main extends CRM_Campaign_Form_Survey {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
 
@@ -179,8 +174,6 @@ class CRM_Campaign_Form_Survey_Main extends CRM_Campaign_Form_Survey {
 
   /**
    * Process the form.
-   *
-   * @return void
    */
   public function postProcess() {
     // store the submitted values in an array
index cd8048830c87a3c3de1c8c4aeeabe213b723663f..d0869b3247d39583bb3afd2ca67e148010ef0b02 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for processing a survey
- *
+ * This class generates form components for processing a survey.
  */
 class CRM_Campaign_Form_Survey_Questions extends CRM_Campaign_Form_Survey {
 
   /**
-   * Set default values for the form. Note that in edit/view mode
-   * the default values are retrieved from the database
+   * Set default values for the form.
+   *
+   * Note that in edit/view mode the default values are retrieved from the database.
    *
    * @return array
    *   array of default values
@@ -64,8 +62,6 @@ class CRM_Campaign_Form_Survey_Questions extends CRM_Campaign_Form_Survey {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $subTypeId = CRM_Core_DAO::getFieldValue('CRM_Campaign_DAO_Survey', $this->_surveyId, 'activity_type_id');
@@ -102,8 +98,6 @@ class CRM_Campaign_Form_Survey_Questions extends CRM_Campaign_Form_Survey {
 
   /**
    * Process the form.
-   *
-   * @return void
    */
   public function postProcess() {
     // store the submitted values in an array
index 470bad8de4f4a51f1e5776d0020dde90b882f705..728fcf2ecc3def0960ccba61aba60646dc04a140 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for processing a survey
- *
+ * This class generates form components for processing a survey.
  */
 class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey {
 
@@ -74,8 +71,9 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey {
   }
 
   /**
-   * Set default values for the form. Note that in edit/view mode
-   * the default values are retrieved from the database
+   * Set default values for the form.
+   *
+   * Note that in edit/view mode the default values are retrieved from the database.
    *
    * @return array
    *   array of default values
@@ -97,8 +95,6 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $optionGroups = CRM_Campaign_BAO_Survey::getResultSets();
@@ -345,8 +341,6 @@ class CRM_Campaign_Form_Survey_Results extends CRM_Campaign_Form_Survey {
 
   /**
    * Process the form.
-   *
-   * @return void
    */
   public function postProcess() {
     // store the submitted values in an array
index 9b4d90ffd751b96449566409f604a4492f9adeee..2e1bc7b3cc0912a6ee33759d115ce7deb29cb921 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -39,6 +37,8 @@
 class CRM_Campaign_Form_Survey_TabHeader {
 
   /**
+   * Build tab header.
+   *
    * @param CRM_Core_Form $form
    *
    * @return array
index 2ba88b6a6a20048b98f5965ed93fca0d55217bfd..a2dc62db54231f5a8088cc87ea6d4e04c6ba4313 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for Option Group
- *
+ * This class generates form components for Option Group.
  */
 class CRM_Campaign_Form_SurveyType extends CRM_Admin_Form {
   protected $_gid;
@@ -63,8 +60,6 @@ class CRM_Campaign_Form_SurveyType extends CRM_Admin_Form {
 
   /**
    * Set variables up before form is built.
-   *
-   * @return void
    */
   public function preProcess() {
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this);
@@ -112,8 +107,6 @@ class CRM_Campaign_Form_SurveyType extends CRM_Admin_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -143,9 +136,6 @@ class CRM_Campaign_Form_SurveyType extends CRM_Admin_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
 
index 0ac3114ee70ae7fc0052e59bc224d843b8a86411..bb5752067f7e8f14df73429ccc26ec1800859638 100755 (executable)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for relationship
- *
+ * This class generates form components for relationship.
  */
 class CRM_Campaign_Form_Task extends CRM_Core_Form {
 
@@ -76,10 +73,6 @@ class CRM_Campaign_Form_Task extends CRM_Core_Form {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @param
-   *
-   * @return void
    */
   public function preProcess() {
     $values = $this->controller->exportValues('Search');
@@ -141,8 +134,6 @@ class CRM_Campaign_Form_Task extends CRM_Core_Form {
    *   Button type for the form after processing.
    * @param string $backType
    * @param bool $submitOnce
-   *
-   * @return void
    */
   public function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
     $this->addButtons(array(
index 1a8d4b6007647b082c36cf9cad410516bdfe0301..4247adb697860fdaabc46775e7f97c436d27a14b 100755 (executable)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -70,8 +68,6 @@ class CRM_Campaign_Form_Task_Interview extends CRM_Campaign_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     $this->_votingTab = $this->get('votingTab');
@@ -281,9 +277,6 @@ WHERE {$clause}
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $this->assign('surveyTypeId', $this->_surveyTypeId);
@@ -387,9 +380,6 @@ WHERE {$clause}
 
   /**
    * Set default values for the form.
-   *
-   *
-   * @return void
    */
   public function setDefaultValues() {
     //load default data for only contact fields.
@@ -442,9 +432,6 @@ WHERE {$clause}
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     $buttonName = $this->controller->getButtonName();
index 2005374d4dabd95944242f3609059273cd31f0b1..4ede318e25240f7c5b8597a8927cc77794e59258 100755 (executable)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -40,8 +38,6 @@ class CRM_Campaign_Form_Task_Print extends CRM_Campaign_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     parent::preprocess();
@@ -75,12 +71,11 @@ class CRM_Campaign_Form_Task_Print extends CRM_Campaign_Form_Task {
   }
 
   /**
-   * Build the form object - it consists of
+   * Build the form object.
+   *
+   * It consists of
    *    - displaying the QILL (query in local language)
    *    - displaying elements for saving the search
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     //
@@ -103,9 +98,6 @@ class CRM_Campaign_Form_Task_Print extends CRM_Campaign_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     // redirect to the main search page after printing is over
index fe1b4860aecfdec50b16be31457d6880e6dd191c..59abf6d3e2f3e983faa02d71c774e21dd609f822 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class provides the functionality to add contacts for
- * voter reservation.
+ * This class provides the functionality to add contacts for voter reservation.
  */
 class CRM_Campaign_Form_Task_Release extends CRM_Campaign_Form_Task {
 
@@ -64,8 +61,6 @@ class CRM_Campaign_Form_Task_Release extends CRM_Campaign_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     $this->_interviewToRelease = $this->get('interviewToRelease');
@@ -137,9 +132,6 @@ class CRM_Campaign_Form_Task_Release extends CRM_Campaign_Form_Task {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
 
index f5596db1773309255b24fb8a6b9d2a6e3b34a91d..14b0e9d735d957e21a607af3185ec6790e102615 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class provides the functionality to add contacts for
- * voter reservation.
+ * This class provides the functionality to add contacts for voter reservation.
  */
 class CRM_Campaign_Form_Task_Reserve extends CRM_Campaign_Form_Task {
 
   /**
-   * Survet id`
-   *
    * @var int
+   *   Survey id.
    */
   protected $_surveyId;
 
@@ -69,8 +65,6 @@ class CRM_Campaign_Form_Task_Reserve extends CRM_Campaign_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     parent::preProcess();
@@ -158,9 +152,6 @@ class CRM_Campaign_Form_Task_Reserve extends CRM_Campaign_Form_Task {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     // allow to add contact to either new or existing group.
@@ -240,9 +231,6 @@ class CRM_Campaign_Form_Task_Reserve extends CRM_Campaign_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     //add reservation.
index ee91ef00af20c0f43e63e069c831bf87b08c1d30..fcbebf5b471db60b5528e49deab341d485c17a4e 100755 (executable)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Used for displaying results
- *
- *
+ * Used for displaying results.
  */
 class CRM_Campaign_Form_Task_Result extends CRM_Campaign_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
   }
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $this->addButtons(array(
index 08fb4eeb86574f1cad70d086514d78f1d503b092..8f3c74f0eb9688f80120921125ae4b9d03330baf 100644 (file)
@@ -32,8 +32,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Campaign_Info extends CRM_Core_Component_Info {
 
index 1a4835842a3b49017cc2478039c8c8d634c4877c..d455035c113cf660a4ac24dbd6a90a6d0ccf5cdc 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page for displaying Campaigns
+ * Page for displaying Campaigns.
  */
 class CRM_Campaign_Page_DashBoard extends CRM_Core_Page {
 
index f6465c5ae7c6c06beea856caf47f22051b9a6fd5..55d316c8cdf86c21a5a8381b325826f227f2f8b8 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page for displaying Petition Signatures
+ * Page for displaying Petition Signatures.
  */
 class CRM_Campaign_Page_Petition extends CRM_Core_Page {
   public function browse() {
index b36d0693c5b79a27aad12c78b1c302d6ce0bd0c7..cf5e02093622c8f29952197fb9e7652e08a0d2d0 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Campaign_Page_Petition_Confirm extends CRM_Core_Page {
   /**
index ed0575c935c58a699464df9fa992e766cbb712a6..6c27ba2bc05969083e7bcda8788a60d26eb4bb9c 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Campaign_Page_Petition_ThankYou extends CRM_Core_Page {
   /**
+   * Run page.
+   *
    * @return string
    */
   public function run() {
index 6c5d60e7c998e947d5c4f3bd35c7790af33703f8..a873a40de57c8ccb938e9a708872bf7d92bb92b3 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page for displaying list of Gender
+ * Page for displaying list of Gender.
  */
 class CRM_Campaign_Page_SurveyType extends CRM_Core_Page_Basic {
 
@@ -70,8 +68,6 @@ class CRM_Campaign_Page_SurveyType extends CRM_Core_Page_Basic {
 
   /**
    * Obtains the group name from url and sets the title.
-   *
-   * @return void
    */
   public function preProcess() {
     $this->_gName = 'activity_type';
@@ -136,8 +132,6 @@ class CRM_Campaign_Page_SurveyType extends CRM_Core_Page_Basic {
 
   /**
    * Run the basic page (run essentially starts execution for that page).
-   *
-   * @return void
    */
   public function run() {
     $this->preProcess();
@@ -146,9 +140,6 @@ class CRM_Campaign_Page_SurveyType extends CRM_Core_Page_Basic {
 
   /**
    * Browse all options.
-   *
-   *
-   * @return void
    */
   public function browse() {
     $campaingCompId = CRM_Core_Component::getComponentID('CiviCampaign');
index b1d83e1d868b93d2a1fb19f922bf982488d2bb13..5c9ea35959e7a4dc5219c7761ae9b32e376db585 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
index b19360165bc2d4cfd37b2387d9e8d18c0195eb52..31b20f7dc09511217cd5a4c7c4e8621f566ba3e0 100755 (executable)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
index a0151c66cf0abee0a624e5c31d354b1acf9a5203..bc9dc5e176f38ad0674fe3fa702a23dd1717c1fe 100755 (executable)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class is used to retrieve and display a range of
- * contacts that match the given criteria (specifically for
- * results of advanced search options.
- *
+ * This class is used to retrieve and display a range of contacts that match the given criteria.
  */
 class CRM_Campaign_Selector_Search extends CRM_Core_Selector_Base implements CRM_Core_Selector_API {
 
index e1fc69438d891ca212f3925c63f358b3d61c89bb..a544c9ade11be03d056a5e9b993518e4ad9b3cb9 100755 (executable)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Campaign_StateMachine_Search extends CRM_Core_StateMachine {
 
index dff92989e82fb224d62ed8812ae81cb20f18ca8d..914c2df17f84374fc00189f9ea96d089626cd55e 100755 (executable)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * class to represent the actions that can be performed on a
- * group of voters.
- * used by the search forms
+ * class to represent the actions that can be performed on a group of voters.
  *
+ * Used by the search forms.
  */
 class CRM_Campaign_Task {
   const INTERVIEW = 1, RESERVE = 2, RELEASE = 3, PRINT_VOTERS = 4;
index 521ba5894d4c7eb5f3c648fdacb7299f9fc41064..33f89bbb8e23e5ac97099586dca98c983d26172a 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
  * This class contains the functions for Case Management.
- *
  */
 class CRM_Case_BAO_Case extends CRM_Case_DAO_Case {
 
@@ -385,8 +382,6 @@ WHERE civicrm_case.id = %1";
    *   Case id.
    * @param bool $enable
    *   Action.
-   *
-   * @return void
    */
   public static function enableDisableCaseRelationships($caseId, $enable) {
     $contactIds = self::retrieveContactIdsByCaseId($caseId);
@@ -409,8 +404,6 @@ WHERE civicrm_case.id = %1";
    *
    * @param int $activityId
    *   Id of the activity.
-   *
-   * @return void
    */
   public static function deleteCaseActivity($activityId) {
     $case = new CRM_Case_DAO_CaseActivity();
@@ -1447,11 +1440,11 @@ SELECT case_status.label AS case_status, status_id, civicrm_case_type.title AS c
    * @param null $attachments
    * @param int $caseId
    *
-   * @return void
+   * @return bool |array
    */
   public static function sendActivityCopy($clientId, $activityId, $contacts, $attachments = NULL, $caseId) {
     if (!$activityId) {
-      return;
+      return FALSE;
     }
 
     $tplParams = $activityInfo = array();
@@ -1929,10 +1922,6 @@ SELECT case_status.label AS case_status, status_id, civicrm_case_type.title AS c
    * @param int $relContactId
    *   Case role assignee contactId.
    * @param int $contactId
-   *
-   * @return void
-   *   on success creates activity and case activity
-   *
    */
   public static function createCaseRoleActivity($caseId, $relationshipId, $relContactId = NULL, $contactId = NULL) {
     if (!$caseId || !$relationshipId || empty($relationshipId)) {
@@ -2788,8 +2777,6 @@ WHERE id IN (' . implode(',', $copiedActivityIds) . ')';
    *   Params to be sent to template for sending email.
    * @param array $activityParams
    *   Info of the activity.
-   *
-   * @return void
    */
   public static function buildPermissionLinks(&$tplParams, $activityParams) {
     $activityTypeId = CRM_Core_DAO::getFieldValue('CRM_Activity_DAO_Activity', $activityParams['source_record_id'],
@@ -3353,8 +3340,6 @@ WHERE id IN (' . implode(',', $copiedActivityIds) . ')';
    *   Case id.
    * @param int $contactId
    *   Contact id / new client id.
-   *
-   * @return void
    */
   public static function addCaseRelationships($caseId, $contactId) {
     // get the case role / relationships for the case
index 5d0f1fdd28e32af320c6728d8e415fd6dab1dc8d..889a9c1a657f91baafd209977b2304b1b23a41d7 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class contains the functions for Case Type management
- *
+ * This class contains the functions for Case Type management.
  */
 class CRM_Case_BAO_CaseType extends CRM_Case_DAO_CaseType {
 
index b1f2c1486e24ab3c493a3451fdfcb72fa6ea4923..e7a2c7a84f127af9eaaf62be0f4ecb2d496112b4 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Case_BAO_Query {
 
   /**
+   * Get fields.
+   *
    * @param bool $excludeActivityFields
    *
    * @return array
@@ -55,8 +55,6 @@ class CRM_Case_BAO_Query {
    * Build select for Case.
    *
    * @param $query
-   *
-   * @return void
    */
   public static function select(&$query) {
     if (($query->_mode & CRM_Contact_BAO_Query::MODE_CASE) || !empty($query->_returnProperties['case_id'])) {
@@ -218,12 +216,9 @@ class CRM_Case_BAO_Query {
   }
 
   /**
-   * Given a list of conditions in query generate the required
-   * where clause
-   *
-   * @param $query
+   * Given a list of conditions in query generate the required where clause.
    *
-   * @return void
+   * @param CRM_Case_BAO_Query $query
    */
   public static function where(&$query) {
     foreach ($query->_params as $id => $values) {
@@ -244,76 +239,37 @@ class CRM_Case_BAO_Query {
   /**
    * Where clause for a single field.
    *
-   * @param $values
-   * @param $query
-   *
-   * @return void
+   * @param array $values
+   * @param CRM_Case_BAO_Query $query
    */
   public static function whereClauseSingle(&$values, &$query) {
     list($name, $op, $value, $grouping, $wildcard) = $values;
     $val = $names = array();
     switch ($name) {
-      case 'case_status':
-      case 'case_status_id':
-        $statuses = CRM_Case_PseudoConstant::caseStatus();
-        // Standardize input from checkboxes or single value
-        if (is_array($value) && $query->_mode == CRM_Contact_BAO_Query::MODE_CASE) {
-          $value = array_keys($value, 1);
-        }
-        foreach ((array) $value as $k) {
-          if ($k && isset($statuses[$k])) {
-            $val[$k] = $k;
-            $names[] = $statuses[$k];
-          }
-          elseif ($k && ($v = CRM_Utils_Array::key($k, $statuses))) {
-            $val[$v] = $v;
-            $names[] = $k;
-          }
-        }
-        if ($val) {
-          $query->_where[$grouping][] = "civicrm_case.status_id IN (" . implode(',', $val) . ")";
-        }
-        else {
-          $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause('civicrm_case.status_id', $op, $value, "Integer");
-        }
-        $query->_qill[$grouping][] = ts('Case Status is %1', array(1 => implode(' ' . ts('or') . ' ', $names)));
-        $query->_tables['civicrm_case'] = $query->_whereTables['civicrm_case'] = 1;
-        return;
 
       case 'case_type_id':
       case 'case_type':
-        $caseTypes = CRM_Case_PseudoConstant::caseType('title', FALSE);
+      case 'case_status':
+      case 'case_status_id':
+      case 'case_id':
 
-        if (is_array($value)) {
-          foreach ($value as $k => $v) {
-            if ($v) {
-              $val[$k] = $k;
-              $names[] = $caseTypes[$k];
-            }
-          }
+        if (strpos($name, 'type')) {
+          $name = 'case_type_id';
+          $label = 'Case Type(s)';
         }
-        elseif (is_numeric($value)) {
-          $val[$value] = $value;
-          $names[] = $value;
-        }
-        elseif ($caseTypeId = CRM_Utils_Array::key($value, $caseTypes)) {
-          $val[$caseTypeId] = $caseTypeId;
-          $names[] = $caseTypes[$caseTypeId];
-        }
-
-        if ($val) {
-          $query->_where[$grouping][] = "(civicrm_case.case_type_id IN (" . implode(',', $val) . "))";
+        elseif (strpos($name, 'status')) {
+          $name = 'status_id';
+          $label = 'Case Status(s)';
         }
         else {
-          $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause('civicrm_case.case_type_id', $op, $value, "Integer");
+          $name = 'id';
+          $label = 'Case ID';
         }
 
-        $query->_qill[$grouping][] = ts('Case Type is %1', array(1 => implode(' ' . ts('or') . ' ', $names)));
-        $query->_tables['civicrm_case'] = $query->_whereTables['civicrm_case'] = 1;
-        return;
+        $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_case.{$name}", $op, $value, "Integer");
+        list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Case_DAO_Case', $name, $value, $op);
 
-      case 'case_id':
-        $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_case.id", $op, $value, 'Int');
+        $query->_qill[$grouping][] = ts('%1 %2 %3', array(1 => $label, 2 => $op, 3 => $value));
         $query->_tables['civicrm_case'] = $query->_whereTables['civicrm_case'] = 1;
         return;
 
@@ -693,12 +649,9 @@ case_relation_type.id = case_relationship.relationship_type_id )";
   }
 
   /**
-   * Add all the elements shared between case search and advanaced search.
-   *
+   * Add all the elements shared between case search and advanced search.
    *
    * @param CRM_Core_Form $form
-   *
-   * @return void
    */
   public static function buildSearchForm(&$form) {
     $config = CRM_Core_Config::singleton();
@@ -707,15 +660,17 @@ case_relation_type.id = case_relationship.relationship_type_id )";
     $configured = CRM_Case_BAO_Case::isCaseConfigured();
     $form->assign('notConfigured', !$configured['configured']);
 
-    $caseTypes = CRM_Case_PseudoConstant::caseType('title', FALSE);
-    foreach ($caseTypes as $id => $name) {
-      $form->addElement('checkbox', "case_type_id[$id]", NULL, $name);
-    }
-
-    $statuses = CRM_Case_PseudoConstant::caseStatus('label', FALSE);
-    foreach ($statuses as $id => $name) {
-      $form->addElement('checkbox', "case_status_id[$id]", NULL, $name);
-    }
+    $form->add('select', 'case_type_id',
+      ts('Case Type'),
+      CRM_Case_PseudoConstant::caseType('title', FALSE),
+      FALSE, array('class' => 'crm-select2', 'multiple' => 'multiple')
+    );
+
+    $form->add('select', 'case_status_id',
+      ts('Case Status'),
+      CRM_Case_PseudoConstant::caseStatus('label', FALSE),
+      FALSE, array('class' => 'crm-select2', 'multiple' => 'multiple')
+    );
 
     CRM_Core_Form_Date::buildDateRange($form, 'case_from', 1, '_start_date_low', '_start_date_high', ts('From'), FALSE);
     CRM_Core_Form_Date::buildDateRange($form, 'case_to', 1, '_end_date_low', '_end_date_high', ts('From'), FALSE);
index c0337fbcea130cc2490850c809aa6e984387acfb..c01f995e49c7e707f254d34f278be5cc7e593050 100644 (file)
@@ -33,8 +33,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Case_Config extends CRM_Core_Component_Config {
 }
index 64610630b085fbb4d7119af4706efcad611ff823..c997926d4271d7f78ad05f2b05de6aa774c07387 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
index 4dc5365c62d340b35164fb241ece0472800e657b..ac997bc85aaeacd25dd5a0b9f14f28662a4090c3 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class create activities for a case
- *
+ * This class create activities for a case.
  */
 class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity {
 
@@ -62,8 +59,6 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function preProcess() {
     $caseIds = CRM_Utils_Request::retrieve('caseid', 'String', $this);
@@ -207,11 +202,7 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity {
   }
 
   /**
-   * Set default values for the form. For edit/view mode
-   * the default values are retrieved from the database
-   *
-   *
-   * @return void
+   * Set default values for the form.
    */
   public function setDefaultValues() {
     $this->_defaults = parent::setDefaultValues();
@@ -354,10 +345,7 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity {
   /**
    * Process the form submission.
    *
-   *
    * @param array $params
-   *
-   * @return void
    */
   public function postProcess($params = NULL) {
     $transaction = new CRM_Core_Transaction();
index d33ac581e8023e43832d521ce202daa57b23298c..07889baffbe77f3977a26603c3e478b0fe59e623 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for OpenCase Activity
- *
+ * This class generates form components for OpenCase Activity.
  */
 class CRM_Case_Form_Activity_ChangeCaseStartDate {
 
@@ -54,13 +51,13 @@ class CRM_Case_Form_Activity_ChangeCaseStartDate {
   }
 
   /**
-   * Set default values for the form. For edit/view mode
-   * the default values are retrieved from the database
+   * Set default values for the form.
    *
+   * For edit/view mode the default values are retrieved from the database.
    *
    * @param CRM_Core_Form $form
    *
-   * @return void
+   * @return array
    */
   public static function setDefaultValues(&$form) {
     $defaults = array();
@@ -122,8 +119,6 @@ class CRM_Case_Form_Activity_ChangeCaseStartDate {
    *
    * @param CRM_Core_Form $form
    * @param array $params
-   *
-   * @return void
    */
   public static function beginPostProcess(&$form, &$params) {
     if ($form->_context == 'case') {
@@ -138,8 +133,6 @@ class CRM_Case_Form_Activity_ChangeCaseStartDate {
    * @param CRM_Core_Form $form
    * @param array $params
    * @param $activity
-   *
-   * @return void
    */
   public static function endPostProcess(&$form, &$params, $activity) {
     if (!empty($params['start_date'])) {
index 8af8f0b25736576a456f9563e9860f150c0e309f..fe0a699e117a649ac078367fea86a3e858fa3360 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for OpenCase Activity
- *
+ * This class generates form components for OpenCase Activity.
  */
 class CRM_Case_Form_Activity_ChangeCaseStatus {
 
@@ -51,13 +48,14 @@ class CRM_Case_Form_Activity_ChangeCaseStatus {
   }
 
   /**
-   * Set default values for the form. For edit/view mode
-   * the default values are retrieved from the database
+   * Set default values for the form.
+   *
+   * For edit/view mode the default values are retrieved from the database.
    *
    *
    * @param CRM_Core_Form $form
    *
-   * @return void
+   * @return array
    */
   public static function setDefaultValues(&$form) {
     $defaults = array();
@@ -122,8 +120,6 @@ class CRM_Case_Form_Activity_ChangeCaseStatus {
    *
    * @param CRM_Core_Form $form
    * @param array $params
-   *
-   * @return void
    */
   public static function beginPostProcess(&$form, &$params) {
     $params['id'] = CRM_Utils_Array::value('case_id', $params);
@@ -135,9 +131,7 @@ class CRM_Case_Form_Activity_ChangeCaseStatus {
    *
    * @param CRM_Core_Form $form
    * @param array $params
-   * @param $activity
-   *
-   * @return void
+   * @param CRM_Activity_BAO_Activity $activity
    */
   public static function endPostProcess(&$form, &$params, $activity) {
     $groupingValues = CRM_Core_OptionGroup::values('case_status', FALSE, TRUE, FALSE, NULL, 'value');
index aa40ad2af5c84ab76df100d4b9f7e159ebd4687b..1d617db5a676e613c4d264168938c7e3d8bdde24 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for OpenCase Activity
- *
+ * This class generates form components for OpenCase Activity.
  */
 class CRM_Case_Form_Activity_ChangeCaseType {
 
@@ -51,13 +48,13 @@ class CRM_Case_Form_Activity_ChangeCaseType {
   }
 
   /**
-   * Set default values for the form. For edit/view mode
-   * the default values are retrieved from the database
+   * Set default values for the form.
    *
+   * For edit/view mode the default values are retrieved from the database.
    *
    * @param CRM_Core_Form $form
    *
-   * @return void
+   * @return array
    */
   public static function setDefaultValues(&$form) {
     $defaults = array();
@@ -119,8 +116,6 @@ class CRM_Case_Form_Activity_ChangeCaseType {
    *
    * @param CRM_Core_Form $form
    * @param array $params
-   *
-   * @return void
    */
   public static function beginPostProcess(&$form, &$params) {
     if ($form->_context == 'case') {
@@ -143,8 +138,6 @@ class CRM_Case_Form_Activity_ChangeCaseType {
    * @param CRM_Core_Form $form
    * @param array $params
    * @param $activity
-   *
-   * @return void
    */
   public static function endPostProcess(&$form, &$params, $activity) {
     if (!$form->_caseId) {
index 598bd4637da11e8c2a26679325e1bfe4392a32a5..25880a8f156652a679e7a74dc857f6691ccf08db 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for OpenCase Activity
- *
+ * This class generates form components for OpenCase Activity.
  */
 class CRM_Case_Form_Activity_LinkCases {
   /**
@@ -70,13 +67,11 @@ class CRM_Case_Form_Activity_LinkCases {
   }
 
   /**
-   * Set default values for the form. For edit/view mode
-   * the default values are retrieved from the database
-   *
+   * Set default values for the form.
    *
    * @param CRM_Core_Form $form
    *
-   * @return void
+   * @return array
    */
   public static function setDefaultValues(&$form) {
     return $defaults = array();
@@ -125,8 +120,6 @@ class CRM_Case_Form_Activity_LinkCases {
    *
    * @param CRM_Core_Form $form
    * @param array $params
-   *
-   * @return void
    */
   public static function beginPostProcess(&$form, &$params) {
   }
@@ -137,9 +130,7 @@ class CRM_Case_Form_Activity_LinkCases {
    *
    * @param CRM_Core_Form $form
    * @param array $params
-   * @param $activity
-   *
-   * @return void
+   * @param CRM_Activity_BAO_Activity $activity
    */
   public static function endPostProcess(&$form, &$params, &$activity) {
     $activityId = $activity->id;
index b6145248e33f10a0276007464296b2ecabf623f4..d78d32617ec174ee26d23afb0b6d8fb74b02c080 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for OpenCase Activity
- *
+ * This class generates form components for OpenCase Activity.
  */
 class CRM_Case_Form_Activity_OpenCase {
 
@@ -94,8 +91,6 @@ class CRM_Case_Form_Activity_OpenCase {
    *
    *
    * @param CRM_Core_Form $form
-   *
-   * @return void
    */
   public static function setDefaultValues(&$form) {
     $defaults = array();
@@ -216,8 +211,6 @@ class CRM_Case_Form_Activity_OpenCase {
    *
    * @param CRM_Core_Form $form
    * @param array $params
-   *
-   * @return void
    */
   public static function beginPostProcess(&$form, &$params) {
     if ($form->_context == 'caseActivity') {
@@ -272,11 +265,8 @@ class CRM_Case_Form_Activity_OpenCase {
   /**
    * Process the form submission.
    *
-   *
-   * @param $form
+   * @param CRM_Core_Form $form
    * @param array $params
-   *
-   * @return void
    */
   public static function endPostProcess(&$form, &$params) {
     if ($form->_context == 'caseActivity') {
index ca074845c5e4f2b5c172160c483ee818cafdbb1f..5ce068eff3903c54f11a6e444c6d9efdfad73eea 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for building activity to a case
- *
+ * This class generates form components for building activity to a case.
  */
 class CRM_Case_Form_ActivityToCase extends CRM_Core_Form {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     $this->_activityId = CRM_Utils_Request::retrieve('activityId', 'Positive', CRM_Core_DAO::$_nullObject);
@@ -90,8 +85,6 @@ class CRM_Case_Form_ActivityToCase extends CRM_Core_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $this->add('text', 'file_on_case_unclosed_case_id', ts('Select Case'), array('class' => 'huge'), TRUE);
index c63eb154bcf6d0ce8543426668c53d68a6209335..c8aff71e14b6fa555ae87400bd1e855bd987e1a5 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class does pre processing for viewing an activity or their revisions
- *
+ * This class does pre processing for viewing an activity or their revisions.
  */
 class CRM_Case_Form_ActivityView extends CRM_Core_Form {
 
   /**
    * Process the view.
-   *
-   *
-   * @return void
    */
   public function preProcess() {
     $contactID = CRM_Utils_Request::retrieve('cid', 'Integer', $this, TRUE);
index 44399b0f0ac1074512e04280c1a03bcdc3714ac2..22b9875ebc0d402c3e9fc714f55888ec75fd9bc1 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for case activity
- *
+ * This class generates form components for case activity.
  */
 class CRM_Case_Form_Case extends CRM_Core_Form {
 
@@ -88,8 +85,6 @@ class CRM_Case_Form_Case extends CRM_Core_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function preProcess() {
 
@@ -196,11 +191,7 @@ class CRM_Case_Form_Case extends CRM_Core_Form {
   }
 
   /**
-   * Set default values for the form. For edit/view mode
-   * the default values are retrieved from the database
-   *
-   *
-   * @return void
+   * Set default values for the form.
    */
   public function setDefaultValues() {
     if ($this->_action & CRM_Core_Action::DELETE || $this->_action & CRM_Core_Action::RENEW) {
@@ -289,8 +280,7 @@ class CRM_Case_Form_Case extends CRM_Core_Form {
   /**
    * Add local and global form rules.
    *
-   *
-   * @return void
+   * @return bool
    */
   public function addRules() {
     if ($this->_action & CRM_Core_Action::DELETE || $this->_action & CRM_Core_Action::RENEW) {
@@ -319,9 +309,6 @@ class CRM_Case_Form_Case extends CRM_Core_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     $transaction = new CRM_Core_Transaction();
index 315972c160e1bd3e49fc9106ff18e50b5a33de52..1b3b74fcf4a85149fe2806df71f5806be8f7dda5 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates view mode for CiviCase
- *
+ * This class generates view mode for CiviCase.
  */
 class CRM_Case_Form_CaseView extends CRM_Core_Form {
   /**
@@ -46,8 +43,6 @@ class CRM_Case_Form_CaseView extends CRM_Core_Form {
 
   /**
    * Set variables up before form is built.
-   *
-   * @return void
    */
   public function preProcess() {
     $this->_showRelatedCases = CRM_Utils_Array::value('relatedCases', $_GET);
@@ -194,11 +189,9 @@ class CRM_Case_Form_CaseView extends CRM_Core_Form {
   }
 
   /**
-   * Set default values for the form. For edit/view mode
-   * the default values are retrieved from the database
+   * Set default values for the form.
    *
-   *
-   * @return void
+   * @return array;
    */
   public function setDefaultValues() {
     $defaults = array();
@@ -207,8 +200,6 @@ class CRM_Case_Form_CaseView extends CRM_Core_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     //this call is for show related cases.
@@ -444,8 +435,6 @@ class CRM_Case_Form_CaseView extends CRM_Core_Form {
 
   /**
    * Process the form.
-   *
-   * @return void
    */
   public function postProcess() {
     $params = $this->controller->exportValues($this->_name);
index f108562e5f390f8165d3b77d9e89617d474aec6b..83eaabb98886cc3ad0350056523465ae819d1eff 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -39,7 +37,6 @@
  * It delegates the work to lower level subclasses and integrates the changes
  * back in. It also uses a lot of functionality with the CRM API's, so any change
  * made here could potentially affect the API etc. Be careful, be aware, use unit tests.
- *
  */
 class CRM_Case_Form_CustomData extends CRM_Core_Form {
 
@@ -68,10 +65,6 @@ class CRM_Case_Form_CustomData extends CRM_Core_Form {
    * Pre processing work done here.
    *
    * gets session variables for table name, id of entity in table, type of entity and stores them.
-   *
-   * @param
-   *
-   * @return void
    */
   public function preProcess() {
     $this->_groupID = CRM_Utils_Request::retrieve('groupID', 'Positive', $this, TRUE);
@@ -108,8 +101,6 @@ class CRM_Case_Form_CustomData extends CRM_Core_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     // make this form an upload since we dont know if the custom data injected dynamically
@@ -130,9 +121,6 @@ class CRM_Case_Form_CustomData extends CRM_Core_Form {
 
   /**
    * Process the user submitted custom data values.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     $params = $this->controller->exportValues($this->_name);
index 07d110036d393db7a213a525bb3ae79abdcd086f..650d3d6b3cdef9daef407af5eaaee83fa4c4ad11 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class assigns the current case to another client
- *
+ * This class assigns the current case to another client.
  */
 class CRM_Case_Form_EditClient extends CRM_Core_Form {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
@@ -78,8 +73,6 @@ class CRM_Case_Form_EditClient extends CRM_Core_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $this->addEntityRef('reassign_contact_id', ts('Select Contact'), array('create' => TRUE), TRUE);
@@ -120,8 +113,6 @@ class CRM_Case_Form_EditClient extends CRM_Core_Form {
 
   /**
    * Process the form.
-   *
-   * @return void
    */
   public function postProcess() {
     $params = $this->controller->exportValues($this->_name);
index 3ed4790ee4b27ec3d845e3fed6279a86c2aa24de..7bfe64f2f14999c51fb588f6d40e4a006cceae33 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for case report
- *
+ * This class generates form components for case report.
  */
 class CRM_Case_Form_Report extends CRM_Core_Form {
 
@@ -58,8 +55,6 @@ class CRM_Case_Form_Report extends CRM_Core_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function preProcess() {
     $this->_caseID = CRM_Utils_Request::retrieve('caseid', 'Integer', $this, TRUE);
@@ -120,9 +115,6 @@ class CRM_Case_Form_Report extends CRM_Core_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     // store the submitted values in an array
index 3f2433459585dfe5ac75f54137daf9c6052f75db..50450942b8cc7e521d856112898f51d6d090c419 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This file is for Case search
+ * This file is for Case search.
  */
 class CRM_Case_Form_Search extends CRM_Core_Form_Search {
 
@@ -66,8 +64,6 @@ class CRM_Case_Form_Search extends CRM_Core_Form_Search {
 
   /**
    * Processing needed for buildForm and later.
-   *
-   * @return void
    */
   public function preProcess() {
     $this->set('searchFormName', 'Search');
@@ -165,9 +161,6 @@ class CRM_Case_Form_Search extends CRM_Core_Form_Search {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -212,10 +205,6 @@ class CRM_Case_Form_Search extends CRM_Core_Form_Search {
    *        done.
    * The processing consists of using a Selector / Controller framework for getting the
    * search results.
-   *
-   * @param
-   *
-   * @return void
    */
   public function postProcess() {
     if ($this->_done) {
@@ -308,10 +297,10 @@ class CRM_Case_Form_Search extends CRM_Core_Form_Search {
   }
 
   /**
-   * add the rules (mainly global rules) for form.
+   * Add the rules (mainly global rules) for form.
+   *
    * All local rules are added near the element
    *
-   * @return void
    * @see valid_date
    */
   public function addRules() {
@@ -324,7 +313,7 @@ class CRM_Case_Form_Search extends CRM_Core_Form_Search {
    * @param array $fields
    *   Posted values of the form.
    *
-   * @return void
+   * @return array|bool
    */
   public static function formRule($fields) {
     $errors = array();
index e8c2a7adbccf2d828f7ef2723f1501f100129a53..71570e58384599f655390d6a532fd69fc68b3516 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates task actions for CiviEvent
- *
+ * This class generates task actions for CiviEvent.
  */
 class CRM_Case_Form_Task extends CRM_Core_Form {
 
@@ -69,10 +66,6 @@ class CRM_Case_Form_Task extends CRM_Core_Form {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @param
-   *
-   * @return void
    */
   public function preProcess() {
     self::preProcessCommon($this);
@@ -158,8 +151,6 @@ class CRM_Case_Form_Task extends CRM_Core_Form {
    *   Button type for the form after processing.
    * @param string $backType
    * @param bool $submitOnce
-   *
-   * @return void
    */
   public function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
     $this->addButtons(array(
index 5d79638836e61b377a1edec5f4b2d1255698bcbd..e517db79a3498d780beea33b9d6211cb0501895a 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class provides the functionality to delete a group of
- * case records. This class provides functionality for the actual
- * deletion.
+ * This class provides the functionality to delete a group of case records.
  */
 class CRM_Case_Form_Task_Delete extends CRM_Case_Form_Task {
 
@@ -67,8 +63,6 @@ class CRM_Case_Form_Task_Delete extends CRM_Case_Form_Task {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $this->addDefaultButtons(ts('Delete Cases'), 'done');
@@ -76,8 +70,6 @@ class CRM_Case_Form_Task_Delete extends CRM_Case_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   * @return void
    */
   public function postProcess() {
     $deleted = $failed = 0;
index 57926f548094c60038ac04aea1fe80fd59c74e6e..1477e5ffd66086f2a7238b19ae12cf594fbaaea1 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -41,8 +39,6 @@ class CRM_Case_Form_Task_Print extends CRM_Case_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     parent::preprocess();
@@ -67,12 +63,11 @@ class CRM_Case_Form_Task_Print extends CRM_Case_Form_Task {
   }
 
   /**
-   * Build the form object - it consists of
+   * Build the form object.
+   *
+   * It consists of
    *    - displaying the QILL (query in local language)
    *    - displaying elements for saving the search
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     //
@@ -95,9 +90,6 @@ class CRM_Case_Form_Task_Print extends CRM_Case_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     // redirect to the main search page after printing is over
index dfbb74a40d4c3beb015378cfac645775395148b9..ec3e5a632e788069d4fbd8ba6f72e67d2e026c45 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class provides the functionality to restore a group of
- * participations. This class provides functionality for the actual
- * deletion.
+ * This class provides the functionality to restore a group of participations.
  */
 class CRM_Case_Form_Task_Restore extends CRM_Case_Form_Task {
 
@@ -50,8 +46,6 @@ class CRM_Case_Form_Task_Restore extends CRM_Case_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     parent::preProcess();
@@ -59,9 +53,6 @@ class CRM_Case_Form_Task_Restore extends CRM_Case_Form_Task {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $this->addDefaultButtons(ts('Restore Cases'), 'done');
@@ -69,9 +60,6 @@ class CRM_Case_Form_Task_Restore extends CRM_Case_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     $restoredCases = $failed = 0;
index 7ca73bb548e7f46e02592a79d83830f7d7b8dc77..fdc52f5cd870daccd90d5bd88dc53f5ab087719a 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Used for displaying results
- *
- *
+ * Used for displaying results.
  */
 class CRM_Case_Form_Task_Result extends CRM_Case_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
   }
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $this->addButtons(array(
index 02ed6d60f39ce4f7afa2e659b1479909cddd8e6f..78a42f4e20c830a29a76ffe8650c6d90c3853ee1 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -41,8 +39,6 @@ class CRM_Case_Form_Task_SearchTaskHookSample extends CRM_Case_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     parent::preProcess();
@@ -74,8 +70,6 @@ WHERE cs.id IN ( {$caseIDs} )";
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $this->addButtons(array(
index 6ebde5ec4f89c62a2ae5b233f50044dce615849a..0c91d9a59cbd8fafbdbac85a46c3e6317fe412d6 100644 (file)
@@ -32,8 +32,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Case_Info extends CRM_Core_Component_Info {
 
index 2555ab6ff95676a3a1f72342e55579995bd76ffa..df9471e764aa2705c1f8317a130fad6661671693 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Case_Page_CaseDetails extends CRM_Core_Page {
 
   /**
-   * the main function that is called when the page loads,
-   * it decides the which action has to be taken for the page.
+   * The main function that is called when the page loads.
+   *
+   * It decides the which action has to be taken for the page.
    *
    * @return null
    */
index 80a5e6cbe877c282e52b370f7efaa134cedc68a4..b22da4aba7d95e2256504ab36bc25231e12aaa34 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This page is for Case Dashboard
+ * This page is for Case Dashboard.
  */
 class CRM_Case_Page_DashBoard extends CRM_Core_Page {
 
   public $useLivePageJS = TRUE;
 
   /**
-   * Heart of the viewing process. The runner gets all the meta data for
-   * the contact and calls the appropriate type of page to view.
+   * Heart of the viewing process.
    *
-   * @return void
+   * The runner gets all the meta data for the contact and calls the appropriate type of page to view.
    */
   public function preProcess() {
     //check for civicase access.
index 80faee59494b93c666fa517a8aac0fc5ba17d5a6..512b50b6776f68565c2551f67522a55606c234e4 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class handle case related functions
- *
+ * This class handle case related functions.
  */
 class CRM_Case_Page_Tab extends CRM_Core_Page {
 
@@ -97,8 +94,6 @@ class CRM_Case_Page_Tab extends CRM_Core_Page {
 
   /**
    * View details of a case.
-   *
-   * @return void
    */
   public function view() {
     $controller = new CRM_Core_Controller_Simple(
@@ -137,9 +132,7 @@ class CRM_Case_Page_Tab extends CRM_Core_Page {
   }
 
   /**
-   * called when action is browse.
-   *
-   * @return void
+   * Called when action is browse.
    */
   public function browse() {
 
index 3cb4fad1838be28d5ab87766c33065e94880a2f5..d40fa669dd7faedbf252e1ad6476b398e6819890 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
  * This class holds all the Pseudo constants that are specific for CiviCase.
- *
  */
 class CRM_Case_PseudoConstant extends CRM_Core_PseudoConstant {
 
index 6acf462fffb0f10d712aed2cca4362713cdcdfc9..283b36d8278d7e3ac19185ce325ca64b2ea38967 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class is used to retrieve and display a range of
- * contacts that match the given criteria (specifically for
- * results of advanced search options.
- *
+ * This class is used to retrieve and display a range of contacts that match the given criteria.
  */
 class CRM_Case_Selector_Search extends CRM_Core_Selector_Base {
 
index 246a8f185387716e3c447ebe6331ccac96f2ad73..9fda0907b3e5653a7fae64959d99fb75d752510a 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Case_StateMachine_Search extends CRM_Core_StateMachine {
 
index cbef459dfe0c237c97755b6add983617beefebb2..ec47b906618d9a775d1a7f7ee92134ad3dc44007 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * class to represent the actions that can be performed on a group of contacts
- * used by the search forms
+ * Class to represent the actions that can be performed on a group of contacts.
  *
+ * Used by the search forms
  */
 class CRM_Case_Task {
   const DELETE_CASES = 1, PRINT_CASES = 2, EXPORT_CASES = 3, RESTORE_CASES = 4;
@@ -66,17 +64,17 @@ class CRM_Case_Task {
     if (!self::$_tasks) {
       self::$_tasks = array(
         1 => array(
-          'title' => ts('Delete Cases'),
+          'title' => ts('Delete cases'),
           'class' => 'CRM_Case_Form_Task_Delete',
           'result' => FALSE,
         ),
         2 => array(
-          'title' => ts('Print Selected Rows'),
+          'title' => ts('Print selected rows'),
           'class' => 'CRM_Case_Form_Task_Print',
           'result' => FALSE,
         ),
         3 => array(
-          'title' => ts('Export Cases'),
+          'title' => ts('Export cases'),
           'class' => array(
             'CRM_Export_Form_Select',
             'CRM_Export_Form_Map',
@@ -84,7 +82,7 @@ class CRM_Case_Task {
           'result' => FALSE,
         ),
         4 => array(
-          'title' => ts('Restore Cases'),
+          'title' => ts('Restore cases'),
           'class' => 'CRM_Case_Form_Task_Restore',
           'result' => FALSE,
         ),
index 48e60d46751b94c621be7c5e4a0db654c9e29b9f..ab60bf19ba9645d4b51aaa10ac5076346750f682 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Case_XMLProcessor {
 
index 7ca2a03f9ed6f549baaf5d32416134ccb7bf040f..b97411828aa869156ddb6bb01533aca205af5dc2 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Case_XMLProcessor_Process extends CRM_Case_XMLProcessor {
   /**
-   * @param $caseType
+   * Run.
+   *
+   * @param string $caseType
    * @param array $params
    *
    * @return bool
index 99c7f98c44fb21f0d1aa9c414565eb6674daed4b..5f68f1f1dbd4e6b3d54c3edabbac1a52a18d2300 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Case_XMLProcessor_Report extends CRM_Case_XMLProcessor {
 
index 61465e61ac2c2896b49bf36cdc9077d2d9276255..a9ea2d5a6f593ff9a50921a7cf226b1ecc1aee6e 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Case_XMLProcessor_Settings extends CRM_Case_XMLProcessor {
 
   private $_settings = array();
 
   /**
-   * Input: The base filename without the .xml extension
-   * Output: An array of settings.
+   * Run.
+   *
    * @param string $filename
+   *   The base filename without the .xml extension
    *
    * @return array
+   *   An array of settings.
    */
   public function run($filename = 'settings') {
     $xml = $this->retrieve($filename);
index 42309337ff8bce09f66918516f4799a6081a7ae4..d8169b7359bb58925161c8043e98d3287dba2b4d 100644 (file)
@@ -29,7 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
  *
  * The XMLRepository is responsible for loading XML for case-types.
  * It includes any bulk operations that apply across the list of all XML
index 6cfb4af7c989edc940fa4276400217f4747f8cea..d2f4889e5c32c4eb4731cd7f2577b2f13005eb36 100644 (file)
@@ -29,7 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
  */
 class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact {
 
index 47154bd3d4b2561a353bb541cab2e8220e305af4..df696802eb51e455578d55ae1cba28a23a6419ae 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_BAO_Contact_Location {
 
   /**
-   * Get the display name, primary email, location type and location id of a contact
+   * Get the display name, primary email, location type and location id of a contact.
    *
    * @param int $id
    *   Id of the contact.
index f9a5e51cc634e8d450a2f4529b0f28b315a36aa5..7b29de360d05322369bc4509fdf273fb21a7a0ae 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_BAO_Contact_Optimizer {
   /**
-   * @param $newValues
-   * @param $oldValues
+   * Edit function.
+   *
+   * @param array $newValues
+   * @param array $oldValues
    */
   public static function edit(&$newValues, &$oldValues) {
     // still need to do more work on this
index 5525c081ab8d914b811142abcb3e890fbff8b5b7..2bd730008a8809cb9b161db663195073b155302e 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_BAO_Contact_Permission {
 
@@ -87,8 +85,6 @@ WHERE contact_a.id = %1 AND $permission";
    * @param int|string $type the type of operation (view|edit)
    * @param bool $force
    *   Should we force a recompute.
-   *
-   * @return void
    */
   public static function cache($userID, $type = CRM_Core_Permission::VIEW, $force = FALSE) {
     static $_processed = array();
index b5d8b596f4c9ee106d3a4b02991ac89feabe0cb3..66de04582cb3ba64ecc2f8378af5646b5aa99444 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_BAO_Contact_Utils {
 
   /**
-   * Given a contact type, get the contact image
+   * Given a contact type, get the contact image.
    *
    * @param string $contactType
    *   Contact type.
@@ -811,8 +809,6 @@ Group By  componentId";
    *
    * @param array $address
    *   This is associated array which contains submitted form values.
-   *
-   * @return void
    */
   public static function processSharedAddress(&$address) {
     if (!is_array($address)) {
@@ -908,8 +904,6 @@ Group By  componentId";
    *
    * @param $contactID
    *   The contactID that was edited / deleted.
-   *
-   * @return void
    */
   public static function clearContactCaches($contactID = NULL) {
     // clear acl cache if any.
@@ -1122,11 +1116,9 @@ WHERE id IN (" . implode(',', $contactIds) . ")";
    * @param string $templateString
    *   The greeting template string with contact tokens + Smarty syntax.
    *
-   * @param $contactDetails
+   * @param array $contactDetails
    * @param int $contactID
    * @param string $className
-   *
-   * @return void
    */
   public static function processGreetingTemplate(&$templateString, $contactDetails, $contactID, $className) {
     CRM_Utils_Token::replaceGreetingTokens($templateString, $contactDetails, $contactID, $className, TRUE);
index e9a9c4e6b1b6ad345bed0ac11eb80deb4c80cde5..15ad7309d1956cee52d752e6f7079586b0c7f178 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_BAO_ContactType extends CRM_Contact_DAO_ContactType {
 
@@ -894,7 +892,7 @@ WHERE extends = %1 AND " . implode(" OR ", $subTypeClause);
    * @param array $subtypes
    *   List of subtypes related to which entry is to be removed.
    *
-   * @return void
+   * @return bool
    */
   public static function deleteCustomRowsOfSubtype($gID, $subtypes = array()) {
     if (!$gID or empty($subtypes)) {
@@ -932,7 +930,7 @@ WHERE ($subtypeClause)";
    * @param int $entityID
    *   Entity id.
    *
-   * @return void
+   * @return null|string
    */
   public static function deleteCustomRowsForEntityID($customTable, $entityID) {
     $customTable = CRM_Utils_Type::escape($customTable, 'String');
index 46d2c9859a3390217b4a69ec4dabb892dd11fb33..c3b034c80e1bded27e89667fa6b61b0e1984def1 100644 (file)
@@ -28,7 +28,6 @@
 /**
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
  */
 class CRM_Contact_BAO_DashboardContact extends CRM_Contact_DAO_DashboardContact {
 }
index 55e5b41a4f166691f21cd5ac8678dc582bd76b10..e9e7056f8cb7cc98847bc8f31bdb155ebb673ebd 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group {
 
   /**
-   * Class constructor
+   * Class constructor.
    */
   public function __construct() {
     parent::__construct();
@@ -65,11 +63,11 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group {
   }
 
   /**
-   * Delete the group and all the object that connect to
-   * this group. Incredibly destructive
+   * Delete the group and all the object that connect to this group.
    *
-   * @param int $id
-   *   Group id.
+   * Incredibly destructive.
+   *
+   * @param int $id Group id.
    */
   public static function discard($id) {
     CRM_Utils_Hook::pre('delete', 'Group', $id, CRM_Core_DAO::$_nullArray);
index da7ebc36040a4ac9af093f45d19b4f22c4b1db1d..7306a4c0d0b8ca887269c9ce90970f8d949659be 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_BAO_GroupContact extends CRM_Contact_DAO_GroupContact {
 
@@ -514,8 +512,6 @@ SELECT    *
    *
    * @param bool $visibility
    * @param string $method
-   *
-   * @return void
    */
   public static function create(&$params, $contactId, $visibility = FALSE, $method = 'Admin') {
     $contactIds = array();
@@ -602,9 +598,6 @@ SELECT    *
    * @see CRM_Dedupe_Merger::cpTables()
    *
    * TODO: use the 3rd $sqls param to append sql statements rather than executing them here
-   *
-   * @return void
-   *
    */
   public static function mergeGroupContact($mainContactId, $otherContactId) {
     $params = array(
index 347e6888a2384ea301363645806abbf0618baef6..d3fbd76136eabddab5de04c6f353451b53febd52 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_BAO_GroupContactCache extends CRM_Contact_DAO_GroupContactCache {
 
   static $_alreadyLoaded = array();
 
   /**
-   * Check to see if we have cache entries for this group
-   * if not, regenerate, else return
+   * Check to see if we have cache entries for this group.
+   *
+   * If not, regenerate, else return.
    *
    * @param $groupIDs
    *   Of group that we are checking against.
@@ -284,8 +283,6 @@ WHERE  id IN ( $groupIDs )
    *   the groupID to delete cache entries, NULL for all groups.
    * @param bool $onceOnly
    *   run the function exactly once for all groups.
-   *
-   * @return void
    */
   public static function remove($groupID = NULL, $onceOnly = TRUE) {
     static $invoked = FALSE;
index 045da9e888e494b3a3aa352e34d4f0cde0086a58..209afb79ff51e6bb11655bcd247424c4803dbcbc 100644 (file)
@@ -30,8 +30,6 @@
  *
  * @package CRM
  * @copyright U.S. PIRG 2007
- * $Id$
- *
  */
 class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implements Iterator {
 
@@ -287,9 +285,6 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen
    *   Id of the group to add the child to.
    * @param int $childID
    *   Id of the new child group.
-   *
-   *
-   * @return void
    */
   public static function add($parentID, $childID) {
     // TODO: Add checks here to make sure invalid nests can't be created
@@ -307,8 +302,6 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen
    *   The id of the group to remove the child from.
    * @param $childID
    *   The id of the child group being removed.
-   *
-   * @return void
    */
   public static function remove($parentID, $childID) {
     $dao = new CRM_Contact_DAO_GroupNesting();
@@ -323,8 +316,6 @@ class CRM_Contact_BAO_GroupNesting extends CRM_Contact_DAO_GroupNesting implemen
    *
    * @param int $childID
    *   The id of the child group being removed.
-   *
-   * @return void
    */
   public static function removeAllParentForChild($childID) {
     $dao = new CRM_Contact_DAO_GroupNesting();
index bb1198f51b9241b192a8893016c00526c3f46831..632277794e86c347b9daae1e1b5f1ef345448058 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_BAO_GroupNestingCache {
+
+  /**
+   * Update cache.
+   *
+   * @throws \Exception
+   */
   static public function update() {
     // lets build the tree in memory first
 
index 9b4d297253495d63b47e901f998702e6415e9e1f..89ad08170c2e04842aa32d5c4b04ce30464d4c5b 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_BAO_GroupOrganization extends CRM_Contact_DAO_GroupOrganization {
 
@@ -72,8 +70,6 @@ class CRM_Contact_BAO_GroupOrganization extends CRM_Contact_DAO_GroupOrganizatio
    *   (reference ) an assoc array of name/value pairs.
    * @param array $formatedValues
    *   (reference ) an assoc array of name/value pairs.
-   *
-   * @return void
    */
   public static function formatValues(&$params, &$formatedValues) {
     if (!empty($params['group_organization'])) {
index 571f730195b76386a598733bf642ca4f6dc8fc2d..e37ec0f0096b63d58dc95aca4128bd1eb9ddd80f 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_BAO_Household extends CRM_Contact_DAO_Contact {
 
   /**
-   * This is a contructor of the class.
+   * Class constructor.
    */
   public function __construct() {
     parent::__construct();
index 00d5d482e6d2287769a90bf6ecb5c4abafa11f9d..578fec08f5ddbf06a557893c463db7ee0893ae66 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Class contains functions for individual contact type
+ * Class contains functions for individual contact type.
  */
 class CRM_Contact_BAO_Individual extends CRM_Contact_DAO_Contact {
 
   /**
-   * This is a contructor of the class.
+   * Class constructor.
    */
   public function __construct() {
   }
@@ -351,14 +349,12 @@ class CRM_Contact_BAO_Individual extends CRM_Contact_DAO_Contact {
   }
 
   /**
-   * Regenerates display_name for contacts with given prefixes/suffixes
+   * Regenerates display_name for contacts with given prefixes/suffixes.
    *
    * @param array $ids
    *   The array with the prefix/suffix id governing which contacts to regenerate.
    * @param int $action
    *   The action describing whether prefix/suffix was UPDATED or DELETED.
-   *
-   * @return void
    */
   public static function updateDisplayNames(&$ids, $action) {
     // get the proper field name (prefix_id or suffix_id) and its value
index dbe5cbe096625df34ce57e2deacbdb46bf5200b0..ca7451899c905a16cb96728258a1f7a51b29f5d1 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_BAO_ProximityQuery {
 
@@ -254,11 +252,13 @@ ACOS(
   }
 
   /**
-   * @param $query
+   * Process form.
+   *
+   * @param CRM_Contact_BAO_Query $query
    * @param array $values
    *
+   * @return null
    * @throws Exception
-   * @return void
    */
   public static function process(&$query, &$values) {
     list($name, $op, $distance, $grouping, $wildcard) = $values;
index d25f0c0f388878641d421e2ea989a3bda9314ae1..d86722e8fef385501add81097458f2426221e851 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -463,8 +461,6 @@ class CRM_Contact_BAO_Query {
 
   /**
    * Function which actually does all the work for the constructor.
-   *
-   * @return void
    */
   public function initialize() {
     $this->_select = array();
@@ -504,12 +500,14 @@ class CRM_Contact_BAO_Query {
     $this->openedSearchPanes(TRUE);
   }
 
+  /**
+   * Fix and handle contact deletion nicely.
+   *
+   * this code is primarily for search builder use case where different clauses can specify if they want deleted.
+   *
+   * CRM-11971
+   */
   public function buildParamsLookup() {
-    // first fix and handle contact deletion nicely
-    // this code is primarily for search builder use case
-    // where different clauses can specify if they want deleted
-    // contacts or not
-    // CRM-11971
     $trashParamExists = FALSE;
     $paramByGroup = array();
     foreach ($this->_params as $k => $param) {
@@ -568,10 +566,7 @@ class CRM_Contact_BAO_Query {
   }
 
   /**
-   * Some composite fields do not appear in the fields array
-   * hack to make them part of the query
-   *
-   * @return void
+   * Some composite fields do not appear in the fields array hack to make them part of the query.
    */
   public function addSpecialFields() {
     static $special = array('contact_type', 'contact_sub_type', 'sort_name', 'display_name');
@@ -589,8 +584,6 @@ class CRM_Contact_BAO_Query {
    * clauses. Note that since the where clause introduces new
    * tables, the initial attempt also retrieves all variables used
    * in the params list
-   *
-   * @return void
    */
   public function selectClause() {
 
@@ -923,10 +916,7 @@ class CRM_Contact_BAO_Query {
   }
 
   /**
-   * If the return Properties are set in a hierarchy, traverse the hierarchy to get
-   * the return values
-   *
-   * @return void
+   * If the return Properties are set in a hierarchy, traverse the hierarchy to get the return values.
    */
   public function addHierarchicalElements() {
     if (empty($this->_returnProperties['location'])) {
@@ -1257,10 +1247,7 @@ class CRM_Contact_BAO_Query {
   }
 
   /**
-   * If the return Properties are set in a hierarchy, traverse the hierarchy to get
-   * the return values
-   *
-   * @return void
+   * If the return Properties are set in a hierarchy, traverse the hierarchy to get the return values.
    */
   public function addMultipleElements() {
     if (empty($this->_returnProperties['website'])) {
@@ -1407,12 +1394,14 @@ class CRM_Contact_BAO_Query {
   }
 
   /**
+   * Get where values from the parameters.
+   *
    * @param string $name
-   * @param $grouping
+   * @param mixed $grouping
    *
-   * @return null
+   * @return mixed
    */
-  public function &getWhereValues($name, $grouping) {
+  public function getWhereValues($name, $grouping) {
     $result = NULL;
     foreach ($this->_params as $values) {
       if ($values[0] == $name && $values[3] == $grouping) {
@@ -1424,9 +1413,11 @@ class CRM_Contact_BAO_Query {
   }
 
   /**
-   * @param $relative
-   * @param $from
-   * @param $to
+   * Fix date values.
+   *
+   * @param bool $relative
+   * @param string $from
+   * @param string $to
    */
   public static function fixDateValues($relative, &$from, &$to) {
     if ($relative) {
@@ -1435,7 +1426,9 @@ class CRM_Contact_BAO_Query {
   }
 
   /**
-   * @param $formValues
+   * Convert form values to array for this object.
+   *
+   * @param array $formValues
    * @param int $wildcard
    * @param bool $useEquals
    *
@@ -1506,8 +1499,10 @@ class CRM_Contact_BAO_Query {
   }
 
   /**
+   * Fix values from query from/to something no-one cared enough to document.
+   *
    * @param int $id
-   * @param $values
+   * @param array $values
    * @param int $wildcard
    * @param bool $useEquals
    *
@@ -1515,7 +1510,7 @@ class CRM_Contact_BAO_Query {
    *
    * @return array|null
    */
-  public static function &fixWhereValues($id, &$values, $wildcard = 0, $useEquals = FALSE, $apiEntity = NULL) {
+  public static function fixWhereValues($id, &$values, $wildcard = 0, $useEquals = FALSE, $apiEntity = NULL) {
     // skip a few search variables
     static $skipWhere = NULL;
     static $likeNames = NULL;
@@ -1614,7 +1609,9 @@ class CRM_Contact_BAO_Query {
   }
 
   /**
-   * @param $values
+   * Get the where clause for a single field.
+   *
+   * @param array $values
    */
   public function whereClauseSingle(&$values) {
     // do not process custom fields or prefixed contact ids or component params
@@ -1856,8 +1853,7 @@ class CRM_Contact_BAO_Query {
   }
 
   /**
-   * Given a list of conditions in params generate the required.
-   * where clause
+   * Given a list of conditions in params generate the required where clause.
    *
    * @return string
    */
@@ -1873,26 +1869,7 @@ class CRM_Contact_BAO_Query {
         }
         // check for both id and contact_id
         if ($this->_params[$id][0] == 'id' || $this->_params[$id][0] == 'contact_id') {
-          if (
-            $this->_params[$id][1] == 'IS NULL' ||
-            $this->_params[$id][1] == 'IS NOT NULL'
-          ) {
-            $this->_where[0][] = "contact_a.id {$this->_params[$id][1]}";
-          }
-          elseif (is_array($this->_params[$id][2])) {
-            $idList = implode("','", $this->_params[$id][2]);
-            //why on earth do they put ' in the middle & not on the outside? We have to assume it's
-            //to support 'something' so lets add them conditionally to support the api (which is a tested flow
-            // so if you are looking to alter this check api test results
-            if (strpos(trim($idList), "'") > 0) {
-              $idList = "'" . $idList . "'";
-            }
-
-            $this->_where[0][] = "contact_a.id IN ({$idList})";
-          }
-          else {
-            $this->_where[0][] = self::buildClause("contact_a.id", "{$this->_params[$id][1]}", "{$this->_params[$id][2]}");
-          }
+          $this->_where[0][] = self::buildClause("contact_a.id", $this->_params[$id][1], $this->_params[$id][2]);
         }
         else {
           $this->whereClauseSingle($this->_params[$id]);
@@ -1905,7 +1882,7 @@ class CRM_Contact_BAO_Query {
     }
 
     if ($this->_customQuery) {
-      // Added following if condition to avoid the wrong value diplay for 'myaccount' / any UF info.
+      // Added following if condition to avoid the wrong value display for 'my account' / any UF info.
       // Hope it wont affect the other part of civicrm.. if it does please remove it.
       if (!empty($this->_customQuery->_where)) {
         $this->_where = CRM_Utils_Array::crmArrayMerge($this->_where, $this->_customQuery->_where);
@@ -1942,7 +1919,9 @@ class CRM_Contact_BAO_Query {
   }
 
   /**
-   * @param $values
+   * Generate where clause for any parameters not already handled.
+   *
+   * @param array $values
    *
    * @throws Exception
    */
@@ -2670,9 +2649,7 @@ class CRM_Contact_BAO_Query {
   /**
    * WHERE / QILL clause for deleted_contacts
    *
-   * @param $values
-   *
-   * @return void
+   * @param array $values
    */
   public function deletedContacts($values) {
     list($_, $_, $value, $grouping, $_) = $values;
@@ -2686,8 +2663,6 @@ class CRM_Contact_BAO_Query {
    * Where / qill clause for contact_type
    *
    * @param $values
-   *
-   * @return void
    */
   public function contactType(&$values) {
     list($name, $op, $value, $grouping, $wildcard) = $values;
@@ -2753,8 +2728,6 @@ class CRM_Contact_BAO_Query {
    * Where / qill clause for contact_sub_type
    *
    * @param $values
-   *
-   * @return void
    */
   public function contactSubType(&$values) {
     list($name, $op, $value, $grouping, $wildcard) = $values;
@@ -2800,8 +2773,6 @@ class CRM_Contact_BAO_Query {
    * Where / qill clause for groups
    *
    * @param $values
-   *
-   * @return void
    */
   public function group(&$values) {
     list($name, $op, $value, $grouping, $wildcard) = $values;
@@ -2963,8 +2934,6 @@ WHERE  $smartGroupClause
    * Where / qill clause for cms users
    *
    * @param $values
-   *
-   * @return void
    */
   public function ufUser(&$values) {
     list($name, $op, $value, $grouping, $wildcard) = $values;
@@ -2985,9 +2954,7 @@ WHERE  $smartGroupClause
   /**
    * All tag search specific.
    *
-   * @param $values
-   *
-   * @return void
+   * @param array $values
    */
   public function tagSearch(&$values) {
     list($name, $op, $value, $grouping, $wildcard) = $values;
@@ -3049,9 +3016,7 @@ WHERE  $smartGroupClause
   /**
    * Where / qill clause for tag
    *
-   * @param $values
-   *
-   * @return void
+   * @param array $values
    */
   public function tag(&$values) {
     list($name, $op, $value, $grouping, $wildcard) = $values;
@@ -3131,9 +3096,7 @@ WHERE  $smartGroupClause
   /**
    * Where/qill clause for notes
    *
-   * @param $values
-   *
-   * @return void
+   * @param array $values
    */
   public function notes(&$values) {
     list($name, $op, $value, $grouping, $wildcard) = $values;
@@ -3207,9 +3170,7 @@ WHERE  $smartGroupClause
   /**
    * Where / qill clause for sort_name
    *
-   * @param $values
-   *
-   * @return void
+   * @param array $values
    */
   public function sortName(&$values) {
     list($fieldName, $op, $value, $grouping, $wildcard) = $values;
@@ -3306,9 +3267,7 @@ WHERE  $smartGroupClause
   /**
    * Where / qill clause for email
    *
-   * @param $values
-   *
-   * @return void
+   * @param array $values
    */
   public function email(&$values) {
     list($name, $op, $value, $grouping, $wildcard) = $values;
@@ -3348,9 +3307,7 @@ WHERE  $smartGroupClause
   /**
    * Where / qill clause for phone number
    *
-   * @param $values
-   *
-   * @return void
+   * @param array $values
    */
   public function phone_numeric(&$values) {
     list($name, $op, $value, $grouping, $wildcard) = $values;
@@ -3370,9 +3327,7 @@ WHERE  $smartGroupClause
   /**
    * Where / qill clause for phone type/location
    *
-   * @param $values
-   *
-   * @return void
+   * @param array $values
    */
   public function phone_option_group($values) {
     list($name, $op, $value, $grouping, $wildcard) = $values;
@@ -3385,11 +3340,9 @@ WHERE  $smartGroupClause
   }
 
   /**
-   * Where / qill clause for street_address
-   *
-   * @param $values
+   * Where / qill clause for street_address.
    *
-   * @return void
+   * @param array $values
    */
   public function street_address(&$values) {
     list($name, $op, $value, $grouping, $wildcard) = $values;
@@ -3419,11 +3372,9 @@ WHERE  $smartGroupClause
   }
 
   /**
-   * Where / qill clause for street_unit
-   *
-   * @param $values
+   * Where / qill clause for street_unit.
    *
-   * @return void
+   * @param array $values
    */
   public function street_number(&$values) {
     list($name, $op, $value, $grouping, $wildcard) = $values;
@@ -3453,11 +3404,9 @@ WHERE  $smartGroupClause
   }
 
   /**
-   * Where / qill clause for sorting by character
-   *
-   * @param $values
+   * Where / qill clause for sorting by character.
    *
-   * @return void
+   * @param array $values
    */
   public function sortByCharacter(&$values) {
     list($name, $op, $value, $grouping, $wildcard) = $values;
@@ -3469,9 +3418,7 @@ WHERE  $smartGroupClause
   }
 
   /**
-   * Where / qill clause for including contact ids
-   *
-   * @return void
+   * Where / qill clause for including contact ids.
    */
   public function includeContactIDs() {
     if (!$this->_includeContactIds || empty($this->_params)) {
@@ -3490,11 +3437,9 @@ WHERE  $smartGroupClause
   }
 
   /**
-   * Where / qill clause for postal code
+   * Where / qill clause for postal code.
    *
-   * @param $values
-   *
-   * @return void
+   * @param array $values
    */
   public function postalCode(&$values) {
     // skip if the fields dont have anything to do with postal_code
@@ -3511,7 +3456,14 @@ WHERE  $smartGroupClause
     }
     else {
       $field = 'civicrm_address.postal_code';
-      $val = CRM_Utils_Type::escape($value, 'String');
+      // Per CRM-17060 we might be looking at an 'IN' syntax so don't case arrays to string.
+      if (!is_array($value)) {
+        $val = CRM_Utils_Type::escape($value, 'String');
+      }
+      else {
+        // Do we need to escape values here? I would expect buildClause does.
+        $val = $value;
+      }
     }
 
     $this->_tables['civicrm_address'] = $this->_whereTables['civicrm_address'] = 1;
@@ -3531,12 +3483,12 @@ WHERE  $smartGroupClause
   }
 
   /**
-   * Where / qill clause for location type
+   * Where / qill clause for location type.
    *
-   * @param $values
+   * @param array $values
    * @param null $status
    *
-   * @return void
+   * @return string
    */
   public function locationType(&$values, $status = NULL) {
     list($name, $op, $value, $grouping, $wildcard) = $values;
@@ -3650,12 +3602,12 @@ WHERE  $smartGroupClause
   }
 
   /**
-   * Where / qill clause for county (if present)
+   * Where / qill clause for county (if present).
    *
-   * @param $values
+   * @param array $values
    * @param null $status
    *
-   * @return void
+   * @return string
    */
   public function county(&$values, $status = NULL) {
     list($name, $op, $value, $grouping, $wildcard) = $values;
@@ -3719,12 +3671,12 @@ WHERE  $smartGroupClause
   }
 
   /**
-   * Where / qill clause for state/province AND country (if present)
+   * Where / qill clause for state/province AND country (if present).
    *
-   * @param $values
+   * @param array $values
    * @param null $status
    *
-   * @return void
+   * @return string
    */
   public function stateProvince(&$values, $status = NULL) {
     list($name, $op, $value, $grouping, $wildcard) = $values;
@@ -3813,11 +3765,9 @@ WHERE  $smartGroupClause
   }
 
   /**
-   * Where / qill clause for change log
+   * Where / qill clause for change log.
    *
-   * @param $values
-   *
-   * @return void
+   * @param array $values
    */
   public function changeLog(&$values) {
     list($name, $op, $value, $grouping, $wildcard) = $values;
@@ -3997,11 +3947,9 @@ WHERE  $smartGroupClause
   }
 
   /**
-   * Where / qill clause for relationship
+   * Where / qill clause for relationship.
    *
-   * @param $values
-   *
-   * @return void
+   * @param array $values
    */
   public function relationship(&$values) {
     list($name, $op, $value, $grouping, $wildcard) = $values;
@@ -4961,11 +4909,13 @@ SELECT COUNT( conts.total_amount ) as cancel_count,
   }
 
   /**
-   * @param $values
+   * Build query for a date field.
+   *
+   * @param array $values
    * @param string $tableName
    * @param string $fieldName
    * @param string $dbFieldName
-   * @param $fieldTitle
+   * @param string $fieldTitle
    * @param bool $appendTimeStamp
    */
   public function dateQueryBuilder(
@@ -5305,6 +5255,7 @@ SELECT COUNT( conts.total_amount ) as cancel_count,
 
       case 'IN':
       case 'NOT IN':
+        // I feel like this would be escaped properly if passed through $queryString = CRM_Core_DAO::createSqlFilter.
         if (!empty($value) && is_array($value) && !array_key_exists($op, $value)) {
           $value = array($op => $value);
         }
@@ -5510,7 +5461,7 @@ AND   displayRelType.is_active = 1
   }
 
   /**
-   * Builds the necessary structures for all fields that are similar to option value lookups.
+   * Builds the necessary structures for all fields that are similar to option value look-ups.
    *
    * @param string $name
    *   the name of the field.
@@ -5529,9 +5480,6 @@ AND   displayRelType.is_active = 1
    * @param string $dataType
    *   The data type for this element.
    * @param bool $useIDsOnly
-   *
-   * @return void
-   *   adds the where clause and qill to the query object
    */
   public function optionValueQuery(
     $name,
index b4a96ac0739bc16923984fb86eef0c595a132cbe..f40a79b6f6b4c2eebe3d0b25f75a7a14f539cb5c 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Delegate query functions based on hook system
+ * Delegate query functions based on hook system.
  */
 class CRM_Contact_BAO_Query_Hook {
 
@@ -57,7 +55,7 @@ class CRM_Contact_BAO_Query_Hook {
   }
 
   /**
-   * Get or build the list of search objects (via hook)
+   * Get or build the list of search objects (via hook).
    *
    * @return array
    *   Array of CRM_Contact_BAO_Query_Interface objects
@@ -93,7 +91,9 @@ class CRM_Contact_BAO_Query_Hook {
   }
 
   /**
-   * @param $query
+   * Alter search query.
+   *
+   * @param string $query
    * @param string $fnName
    */
   public function alterSearchQuery(&$query, $fnName) {
index 1fcf41eb49b960883dc4b3471a804cf159c8fd13..f3c9c41fdb3230a628004ce8e50789a337a83462 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
index 2487c43ef9bc76b5a26a7e645ca52275e8db4b9e..e0f036e707ddecaaeea6d17c22c7f3faef419b84 100644 (file)
@@ -1297,6 +1297,7 @@ LEFT JOIN  civicrm_country ON (civicrm_address.country_id = civicrm_country.id)
               $mask -= CRM_Core_Action::ENABLE;
               $mask -= CRM_Core_Action::DISABLE;
             }
+            $mask = $mask & $permissionMask;
           }
 
           // Give access to manage case link by copying to MAX_ACTION index temporarily, depending on case permission of user.
@@ -1979,19 +1980,13 @@ AND cc.sort_name LIKE '%$name%'";
     $contactRelationships = array();
     $params['total'] = 0;
     if (!empty($relationships)) {
-      // get the total relationships
-      if ($params['context'] != 'user') {
-        $params['total'] = count($relationships);
-      }
-      else {
-        // FIXME: we cannot directly determine total permissioned relationship, hence re-fire query
-        $permissionedRelationships = CRM_Contact_BAO_Relationship::getRelationship($params['contact_id'],
-          $relationshipStatus,
-          0, 0, 0,
-          NULL, NULL, TRUE
-        );
-        $params['total'] = count($permissionedRelationships);
-      }
+      // FIXME: we cannot directly determine total permissioned relationship, hence re-fire query
+      $params['total'] = $permissionedRelationships = CRM_Contact_BAO_Relationship::getRelationship($params['contact_id'],
+        $relationshipStatus,
+        0, 1, 0,
+        NULL, NULL,
+        $permissionedContacts
+      );
 
       // format params
       foreach ($relationships as $relationshipId => $values) {
index 585d60b5d44a5983e7455ad811c23f3f64c0428e..703b0807bfd05b90535ead3ce23451434276c63d 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_BAO_RelationshipType extends CRM_Contact_DAO_RelationshipType {
 
index 657a27082def8ac183685585592271a2723973a8..b89446ee24e973eede7f6c8976f87cd18a619aeb 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Business object for Saved searches
- *
+ * Business object for Saved searches.
  */
 class CRM_Contact_BAO_SavedSearch extends CRM_Contact_DAO_SavedSearch {
 
   /**
    * Class constructor.
-   *
-   * @return \CRM_Contact_BAO_SavedSearch CRM_Contact_BAO_SavedSearch
    */
   public function __construct() {
     parent::__construct();
index 6a39381a4e7c1a172e0ceb77d3aa6358071fd9a0..203a170d2bd3f17d9860e09c0b8def3a2267678d 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_BAO_SearchCustom {
 
   /**
+   * Get details.
+   *
    * @param int $csID
    * @param int $ssID
    * @param int $gID
index 146acb31eac7ba349ff6fd196f23e79a1aa4f147..7ea942ffe4a60f6e42fffcfc4f0593534708e4c9 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * BAO object for crm_email table
+ * BAO object for crm_email table.
  */
 class CRM_Contact_BAO_SubscriptionHistory extends CRM_Contact_DAO_SubscriptionHistory {
   /**
    * Class constructor.
-   *
-   * @return \CRM_Contact_DAO_SubscriptionHistory
-   */
-  /**
    */
   public function __construct() {
     parent::__construct();
@@ -66,12 +60,10 @@ class CRM_Contact_BAO_SubscriptionHistory extends CRM_Contact_DAO_SubscriptionHi
   }
 
   /**
-   * Erase a contact's subscription history records
+   * Erase a contact's subscription history records.
    *
    * @param int $id
    *   The contact id.
-   *
-   * @return void
    */
   public static function deleteContact($id) {
     $history = new CRM_Contact_BAO_SubscriptionHistory();
index 47bb988abd6439400940ff84717d091d82d752f3..e066f451337c48ffdb46ea414389415134c76d0b 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -41,8 +39,7 @@
  *
  * Typically the first form will display the search criteria and it's results
  *
- * The second form is used to process search results with the asscociated actions
- *
+ * The second form is used to process search results with the associated actions.
  */
 class CRM_Contact_Controller_Search extends CRM_Core_Controller {
 
index 2283c49779381ffe954bbaf4889525ab556c3f57..be31f190e36f27c959fb704b20f30d8de66c2a10 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -143,8 +141,6 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add');
@@ -404,15 +400,12 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
   }
 
   /**
-   * Set default values for the form. Note that in edit/view mode
-   * the default values are retrieved from the database
-   *
+   * Set default values for the form.
    *
-   * @return void
+   * Note that in edit/view mode the default values are retrieved from the database
    */
   public function setDefaultValues() {
     $defaults = $this->_values;
-    $params = array();
 
     if ($this->_action & CRM_Core_Action::ADD) {
       if (array_key_exists('TagsAndGroups', $this->_editOptions)) {
@@ -572,7 +565,6 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
    * add the rules (mainly global rules) for form.
    * All local rules are added near the element
    *
-   * @return void
    * @see valid_date
    */
   public function addRules() {
@@ -738,8 +730,6 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     //load form for child blocks
@@ -866,9 +856,6 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
 
   /**
    * Form submission of new/edit contact is processed.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     // check if dedupe button, if so return.
index b8f8d516bf2f23c555df1806d46afc1d400b77eb..1ab2cb17851249bbbeb14a9163f889804e53fc51 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for custom data
+ * This class generates form components for custom data.
  *
  * It delegates the work to lower level subclasses and integrates the changes
  * back in. It also uses a lot of functionality with the CRM API's, so any change
  * made here could potentially affect the API etc. Be careful, be aware, use unit tests.
- *
  */
 class CRM_Contact_Form_CustomData extends CRM_Core_Form {
 
@@ -106,11 +103,7 @@ class CRM_Contact_Form_CustomData extends CRM_Core_Form {
   /**
    * Pre processing work done here.
    *
-   * gets session variables for table name, id of entity in table, type of entity and stores them.
-   *
-   * @param
-   *
-   * @return void
+   * Gets session variables for table name, id of entity in table, type of entity and stores them.
    */
   public function preProcess() {
     $this->_cdType = CRM_Utils_Array::value('type', $_GET);
@@ -172,8 +165,6 @@ class CRM_Contact_Form_CustomData extends CRM_Core_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     if ($this->_cdType || $this->_multiRecordDisplay == 'single') {
@@ -288,9 +279,6 @@ class CRM_Contact_Form_CustomData extends CRM_Core_Form {
 
   /**
    * Process the user submitted custom data values.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     // Get the form values and groupTree
index c1c3966d6fad325820bd8d251f538f71092eced4..a3c7a268ac5777b26b776ab0f7578edc6880acc8 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for DedupeRules
- *
+ * This class generates form components for DedupeRules.
  */
 class CRM_Contact_Form_DedupeFind extends CRM_Admin_Form {
 
@@ -48,8 +45,6 @@ class CRM_Contact_Form_DedupeFind extends CRM_Admin_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
 
@@ -79,9 +74,6 @@ class CRM_Contact_Form_DedupeFind extends CRM_Admin_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     $values = $this->exportValues();
index 5f85f8c52a0c162c614298c9addb713124db6dce..9902739e1f8ef5992e85bcf0057f46242aa4a418 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for DedupeRules
- *
+ * This class generates form components for DedupeRules.
  */
 class CRM_Contact_Form_DedupeRules extends CRM_Admin_Form {
   const RULES_COUNT = 5;
@@ -52,8 +49,6 @@ class CRM_Contact_Form_DedupeRules extends CRM_Admin_Form {
 
   /**
    * Pre processing.
-   *
-   * @return void
    */
   public function preProcess() {
     // Ensure user has permission to be here
@@ -101,8 +96,6 @@ class CRM_Contact_Form_DedupeRules extends CRM_Admin_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $this->addField('title', array('label' => ts('Rule Name')), TRUE);
@@ -190,9 +183,6 @@ class CRM_Contact_Form_DedupeRules extends CRM_Admin_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     $values = $this->exportValues();
index 7f007118af97f85e2c329628ad10e8cd0ff7cc5d..c44dcfede8483581a672e16b58be24b078e30565 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class is to build the form for adding Group
+ * This class is to build the form for adding Group.
  */
 class CRM_Contact_Form_Domain extends CRM_Core_Form {
 
@@ -154,8 +152,6 @@ class CRM_Contact_Form_Domain extends CRM_Core_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $this->addField('name', array('label' => ts('Organization Name')), TRUE);
@@ -188,9 +184,6 @@ class CRM_Contact_Form_Domain extends CRM_Core_Form {
 
   /**
    * Add local and global form rules.
-   *
-   *
-   * @return void
    */
   public function addRules() {
     $this->addFormRule(array('CRM_Contact_Form_Domain', 'formRule'));
@@ -233,8 +226,6 @@ class CRM_Contact_Form_Domain extends CRM_Core_Form {
 
   /**
    * Process the form when submitted.
-   *
-   * @return void
    */
   public function postProcess() {
     $params = $this->exportValues();
index 05037eb0a4d46dceef42656c2ac0e73b52ed5482..efb187b51968b0b966ad351fbb933985ccf2fae4 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class is used to build address block
+ * This class is used to build address block.
  */
 class CRM_Contact_Form_Edit_Address {
 
@@ -48,9 +46,6 @@ class CRM_Contact_Form_Edit_Address {
    *   False, if we want to skip the address sharing features.
    * @param bool $inlineEdit
    *   True when edit used in inline edit.
-   *
-   * @return void
-   *
    */
   public static function buildQuickForm(&$form, $addressBlockCount = NULL, $sharing = TRUE, $inlineEdit = FALSE) {
     // passing this via the session is AWFUL. we need to fix this
@@ -241,13 +236,12 @@ class CRM_Contact_Form_Edit_Address {
   /**
    * Check for correct state / country mapping.
    *
-   * @param $fields
-   * @param $files
-   * @param $self
+   * @param array $fields
+   * @param array $files
+   * @param CRM_Core_Form $self
    *
    * @return array|bool
    *   if no errors
-   *
    */
   public static function formRule($fields, $files, $self) {
     $errors = array();
@@ -303,7 +297,6 @@ class CRM_Contact_Form_Edit_Address {
    *   Defaults associated array.
    * @param CRM_Core_Form $form
    *   Form object.
-   *
    */
   public static function setDefaultValues(&$defaults, &$form) {
     $addressValues = array();
@@ -407,10 +400,11 @@ class CRM_Contact_Form_Edit_Address {
     }
   }
 
-
   /**
+   * Store required custom data info.
+   *
    * @param CRM_Core_Form $form
-   * @param $groupTree
+   * @param array $groupTree
    */
   public static function storeRequiredCustomDataInfo(&$form, $groupTree) {
     if (CRM_Utils_System::getClassName($form) == 'CRM_Contact_Form_Contact') {
index 6ffcba0b76fed1c3e3600da572d9a8f7bd99111c..d3e65e6b37fab193bac0d410df957b9ebd753e01 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * form helper class for an Communication Preferences object
+ * Form helper class for an Communication Preferences object.
  */
 class CRM_Contact_Form_Edit_CommunicationPreferences {
 
   /**
-   * Greetings
+   * Greetings.
+   *
    * @var array
    */
   static $greetings = array();
@@ -49,8 +48,6 @@ class CRM_Contact_Form_Edit_CommunicationPreferences {
    *
    * @param CRM_Core_Form $form
    *   Reference to the form object.
-   *
-   * @return void
    */
   public static function buildQuickForm(&$form) {
     // since the pcm - preferred communication method is logically
@@ -124,7 +121,7 @@ class CRM_Contact_Form_Edit_CommunicationPreferences {
    *   The input form values.
    * @param array $files
    *   The uploaded files if any.
-   * @param $self
+   * @param CRM_Contact_Form_Edit_CommunicationPreferences $self
    *
    * @return bool|array
    *   true if no errors, else array of errors
@@ -145,14 +142,10 @@ class CRM_Contact_Form_Edit_CommunicationPreferences {
   }
 
   /**
-   * Set default values for the form. Note that in edit/view mode
-   * the default values are retrieved from the database
-   *
+   * Set default values for the form.
    *
    * @param CRM_Core_Form $form
-   * @param $defaults
-   *
-   * @return void
+   * @param array $defaults
    */
   public static function setDefaultValues(&$form, &$defaults) {
 
@@ -191,11 +184,9 @@ class CRM_Contact_Form_Edit_CommunicationPreferences {
   }
 
   /**
-   *  set array of greeting fields.
-   *
-   * @param $contactType
+   *  Set array of greeting fields.
    *
-   * @return void
+   * @param string $contactType
    */
   public static function getGreetingFields($contactType) {
     if (empty(self::$greetings[$contactType])) {
index 29ce53225c73ada8a02f167aae1114fcdb1c42ab..03005de06a9cbb2ef899ba3693b04f4ba84e59ef 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * form helper class for an Demographics object
+ * Form helper class for an Demographics object.
  */
 class CRM_Contact_Form_Edit_CustomData {
 
@@ -42,8 +40,6 @@ class CRM_Contact_Form_Edit_CustomData {
    * Build all the data structures needed to build the form.
    *
    * @param CRM_Core_Form $form
-   *
-   * @return void
    */
   public static function preProcess(&$form) {
     $form->_type = CRM_Utils_Request::retrieve('type', 'String', CRM_Core_DAO::$_nullObject);
@@ -70,8 +66,6 @@ class CRM_Contact_Form_Edit_CustomData {
    *
    * @param CRM_Core_Form $form
    *   Reference to the form object.
-   *
-   * @return void
    */
   public static function buildQuickForm(&$form) {
     if (!empty($form->_submitValues)) {
@@ -105,9 +99,7 @@ class CRM_Contact_Form_Edit_CustomData {
    *
    *
    * @param CRM_Core_Form $form
-   * @param $defaults
-   *
-   * @return void
+   * @param array $defaults
    */
   public static function setDefaultValues(&$form, &$defaults) {
     $defaults += CRM_Custom_Form_CustomData::setDefaultValues($form);
index 7f2188a72f6ac2980b54ad323bbdd0e3a3918fe2..144ba4ea0fac272ef327f285840763cb0c6afc1a 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * form helper class for an Demographics object
+ * Form helper class for an Demographics object.
  */
 class CRM_Contact_Form_Edit_Demographics {
 
@@ -43,8 +41,6 @@ class CRM_Contact_Form_Edit_Demographics {
    *
    * @param CRM_Core_Form $form
    *   Reference to the form object.
-   *
-   * @return void
    */
   public static function buildQuickForm(&$form) {
     $form->addField('gender_id', array('entity' => 'contact', 'type' => 'Radio', 'allowClear' => TRUE));
@@ -61,9 +57,7 @@ class CRM_Contact_Form_Edit_Demographics {
    *
    *
    * @param CRM_Core_Form $form
-   * @param $defaults
-   *
-   * @return void
+   * @param array $defaults
    */
   public static function setDefaultValues(&$form, &$defaults) {
   }
index 589d831c7461206562313557ede16f74179e7a84..b5987b2d0ba4b042b2d6cd8841cc49f876f89a80 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * form helper class for an Email object
+ * Form helper class for an Email object.
  */
 class CRM_Contact_Form_Edit_Email {
 
@@ -47,8 +45,6 @@ class CRM_Contact_Form_Edit_Email {
    *   Block number to build.
    * @param bool $blockEdit
    *   Is it block edit.
-   *
-   * @return void
    */
   public static function buildQuickForm(&$form, $blockCount = NULL, $blockEdit = FALSE) {
     // passing this via the session is AWFUL. we need to fix this
index 6959c45bd8c62fc4fe6fa8b5f596f555d6d921ea..74e165228e15bacfd40ee9af0d70eff6000b0c23 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Auxiliary class to provide support to the Contact Form class. Does this by implementing
- * a small set of static methods
+ * Auxiliary class to provide support to the Contact Form class.
  *
+ * Does this by implementing a small set of static methods.
  */
 class CRM_Contact_Form_Edit_Household {
 
   /**
-   * This function provides the HTML form elements that are specific.
-   * to the Household Contact Type
+   * This function provides the HTML form elements that are specific to the Household Contact Type.
    *
    * @param CRM_Core_Form $form
    *   Form object.
    * @param int $inlineEditMode
    *   ( 1 for contact summary.
    * top bar form and 2 for display name edit )
-   *
-   * @return void
    */
   public static function buildQuickForm(&$form, $inlineEditMode = NULL) {
     $form->applyFilter('__ALL__', 'trim');
index 6298b6319f4d67551495c47c789aca590db0087b..a8017737168f13576e953f22fd6530c26ff6e26e 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * form helper class for an IM object
+ * Form helper class for an IM object.
  */
 class CRM_Contact_Form_Edit_IM {
 
@@ -47,8 +45,6 @@ class CRM_Contact_Form_Edit_IM {
    *   Block number to build.
    * @param bool $blockEdit
    *   Is it block edit.
-   *
-   * @return void
    */
   public static function buildQuickForm(&$form, $blockCount = NULL, $blockEdit = FALSE) {
     if (!$blockCount) {
index 4e7925f42d7a264d3933250809179c6d0ccda5df..9db0633cb5ed4a9f65d9a03d054f60646310da64 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Auxiliary class to provide support to the Contact Form class. Does this by implementing
- * a small set of static methods
+ * Auxiliary class to provide support to the Contact Form class.
  *
+ * Does this by implementing a small set of static methods.
  */
 class CRM_Contact_Form_Edit_Individual {
 
   /**
-   * This function provides the HTML form elements that are specific
-   * to the Individual Contact Type
+   * This function provides the HTML form elements that are specific to the Individual Contact Type.
    *
    * @param CRM_Core_Form $form
    *   Form object.
    * @param int $inlineEditMode
    *   ( 1 for contact summary.
    * top bar form and 2 for display name edit )
-   *
-   * @return void
    */
   public static function buildQuickForm(&$form, $inlineEditMode = NULL) {
     $form->applyFilter('__ALL__', 'trim');
index 9768e68c3ed16fbb3cb2aec7aa9015d37c272d11..6ee89261e2b1dc48bd90737a63513a20405c3b04 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Auxiliary class to provide support for locking (and ignoring locks on)
- * contact records.
+ * Auxiliary class to provide support for locking (and ignoring locks on) contact records.
  */
 class CRM_Contact_Form_Edit_Lock {
 
@@ -44,15 +41,13 @@ class CRM_Contact_Form_Edit_Lock {
    *
    * @param CRM_Core_Form $form
    *   Form object.
-   *
-   * @return void
    */
   public static function buildQuickForm(&$form) {
     $form->addField('modified_date', array('type' => 'hidden', 'id' => 'modified_date', 'label' => ''));
   }
 
   /**
-   * Ensure that modified_date hasn't changed in the underlying DB
+   * Ensure that modified_date has not changed in the underlying DB.
    *
    * @param array $fields
    *   The input form values.
index 775a4397e3791d7eb4cdb9a9c5af1f4a0ee47b4f..409ed0dbeaeb2ccc983a4a34fc1381c9856b71d1 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Form_Edit_Notes {
 
   /**
-   * build form elements.
-   * params object $form object of the form
+   * Build form elements.
    *
-   * @param $form
+   * @param CRM_Core_Form $form
    */
   public static function buildQuickForm(&$form) {
     $form->applyFilter('__ALL__', 'trim');
index fead77b58f31b4a241ea83c721a8d35608d1d85f..b73f38c85bdb17f46bce3718564f90471599a61c 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * form helper class for an OpenID object
+ * Form helper class for an OpenID object.
  */
 class CRM_Contact_Form_Edit_OpenID {
 
@@ -47,8 +45,6 @@ class CRM_Contact_Form_Edit_OpenID {
    *   Block number to build.
    * @param bool $blockEdit
    *   Is it block edit.
-   *
-   * @return void
    */
   public static function buildQuickForm(&$form, $blockCount = NULL, $blockEdit = FALSE) {
     if (!$blockCount) {
index fcf3bf7ab6457dbe624973820aeddc09647917a8..5c7bd3c973af66aecd3230d4c52505aec66faf15 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Auxiliary class to provide support to the Contact Form class. Does this by implementing
- * a small set of static methods
+ * Auxiliary class to provide support to the Contact Form class.
  *
+ * Does this by implementing a small set of static methods.
  */
 class CRM_Contact_Form_Edit_Organization {
 
   /**
-   * This function provides the HTML form elements that are specific
-   * to the Organization Contact Type
+   * This function provides the HTML form elements that are specific to the Organization Contact Type.
    *
    * @param CRM_Core_Form $form
    *   Form object.
    * @param int $inlineEditMode
    *   ( 1 for contact summary.
    * top bar form and 2 for display name edit )
-   *
-   * @return void
    */
   public static function buildQuickForm(&$form, $inlineEditMode = NULL) {
     $form->applyFilter('__ALL__', 'trim');
index b465832b1ef28f3a3d7bdf6224f2ac7394c2c3d3..a081122ecd0e0453a75b8ee0468636ad8d34a1a5 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
  */
 
 /**
- * form helper class for a phone object
+ * Form helper class for a phone object.
  */
 class CRM_Contact_Form_Edit_Phone {
 
index db0ad58fba3730ea45a2c8cf12b04c4eec2bf8d5..a8d462468ac0df1df8e6fd50872f798d983fb3a8 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Form_Edit_TagsAndGroups {
 
@@ -42,8 +40,7 @@ class CRM_Contact_Form_Edit_TagsAndGroups {
   const GROUP = 1, TAG = 2, ALL = 3;
 
   /**
-   * build form elements.
-   * params object $form object of the form
+   * Build form elements.
    *
    * @param CRM_Core_Form $form
    *   The form object that we are operating on.
@@ -228,8 +225,6 @@ class CRM_Contact_Form_Edit_TagsAndGroups {
    *   This is used in batch profile(i.e to build multiple blocks).
    *
    * @param string $groupElementType
-   *
-   * @return void
    */
   public static function setDefaults($id, &$defaults, $type = self::ALL, $fieldName = NULL, $groupElementType = 'checkbox') {
     $type = (int ) $type;
@@ -273,9 +268,7 @@ class CRM_Contact_Form_Edit_TagsAndGroups {
    *
    *
    * @param CRM_Core_Form $form
-   * @param $defaults
-   *
-   * @return void
+   * @param array $defaults
    */
   public static function setDefaultValues(&$form, &$defaults) {
     $contactEditOptions = $form->get('contactEditOptions');
index 8ff02a18a22d6c2d647bb604b2efb66d321d792e..576ca7d2c79d0d7d1e2b11088432137b225fe9d1 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * form helper class for an Website object
+ * Form helper class for an Website object.
  */
 class CRM_Contact_Form_Edit_Website {
 
@@ -45,8 +43,6 @@ class CRM_Contact_Form_Edit_Website {
    *   Reference to the form object.
    * @param int $blockCount
    *   Block number to build.
-   *
-   * @return void
    */
   public static function buildQuickForm(&$form, $blockCount = NULL) {
     if (!$blockCount) {
index c55fc4994da4851a5d0d96348fde23987eee63a0..64e83e772cb56b6163f4da5ad091a4fd5833f0e3 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for groupContact
- *
+ * This class generates form components for groupContact.
  */
 class CRM_Contact_Form_GroupContact extends CRM_Core_Form {
 
@@ -67,6 +64,9 @@ class CRM_Contact_Form_GroupContact extends CRM_Core_Form {
     return 'create';
   }
 
+  /**
+   * Pre process form.
+   */
   public function preProcess() {
     $this->_contactId = $this->get('contactId');
     $this->_groupContactId = $this->get('groupContactId');
@@ -75,8 +75,6 @@ class CRM_Contact_Form_GroupContact extends CRM_Core_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     // get the list of all the groups
@@ -129,8 +127,7 @@ class CRM_Contact_Form_GroupContact extends CRM_Core_Form {
   }
 
   /**
-   *
-   * @return void
+   * Post process form.
    */
   public function postProcess() {
     $contactID = array($this->_contactId);
index 4aa5b2db01fbb42df5e98cc5cb979927a139c3e2..bc5add2d281f9783e752743b0767032135aa06e4 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Parent class for inline contact forms
+ * Parent class for inline contact forms.
  */
 abstract class CRM_Contact_Form_Inline extends CRM_Core_Form {
 
@@ -94,8 +92,6 @@ abstract class CRM_Contact_Form_Inline extends CRM_Core_Form {
 
   /**
    * Common form elements.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     CRM_Contact_Form_Inline_Lock::buildQuickForm($this, $this->_contactId);
@@ -116,8 +112,6 @@ abstract class CRM_Contact_Form_Inline extends CRM_Core_Form {
 
   /**
    * Override default cancel action.
-   *
-   * @return void
    */
   public function cancelAction() {
     $response = array('status' => 'cancel');
@@ -140,8 +134,6 @@ abstract class CRM_Contact_Form_Inline extends CRM_Core_Form {
 
   /**
    * Add entry to log table.
-   *
-   * @return void
    */
   protected function log() {
     CRM_Core_BAO_Log::register($this->_contactId,
@@ -152,9 +144,8 @@ abstract class CRM_Contact_Form_Inline extends CRM_Core_Form {
 
   /**
    * Common function for all inline contact edit forms.
-   * Prepares ajaxResponse
    *
-   * @return void
+   * Prepares ajaxResponse
    */
   protected function response() {
     $this->ajaxResponse = array_merge(
index cd4a693377199b668426f388753416d85db740ea..c6abfbfe4776a011aa1b8678e9e2c4b0a39c3fcc 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * form helper class for address section
+ * Form helper class for address section.
  */
 class CRM_Contact_Form_Inline_Address extends CRM_Contact_Form_Inline {
 
@@ -64,9 +62,11 @@ class CRM_Contact_Form_Inline_Address extends CRM_Contact_Form_Inline {
   public $_addressId;
 
   /**
+   * Class constructor.
+   *
    * Since we are using same class / code to generate multiple instances
    * of address block, we need to generate unique form name for each,
-   * hence calling parent contructor
+   * hence calling parent constructor
    */
   public function __construct() {
     $locBlockNo = CRM_Utils_Request::retrieve('locno', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
@@ -121,8 +121,6 @@ class CRM_Contact_Form_Inline_Address extends CRM_Contact_Form_Inline {
 
   /**
    * Build the form object elements for an address object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -160,8 +158,6 @@ class CRM_Contact_Form_Inline_Address extends CRM_Contact_Form_Inline {
 
   /**
    * Process the form.
-   *
-   * @return void
    */
   public function postProcess() {
     $params = $this->exportValues();
index e7fded5ce64497a56d89266d8d9beb583626e940..fe5bc1a13d7cf427a235d040eb9ee00ee4905931 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * form helper class for communication preferences inline edit section
+ * Form helper class for communication preferences inline edit section.
  */
 class CRM_Contact_Form_Inline_CommunicationPreferences extends CRM_Contact_Form_Inline {
 
   /**
    * Build the form object elements for communication preferences.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -81,8 +77,6 @@ class CRM_Contact_Form_Inline_CommunicationPreferences extends CRM_Contact_Form_
 
   /**
    * Process the form.
-   *
-   * @return void
    */
   public function postProcess() {
     $params = $this->exportValues();
index 246b66ce203db454382be53b0951c9f0c9035ce6..9ed6b745972ea934972297315d12473d2b382638 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * form helper class for contact info section
+ * Form helper class for contact info section.
  */
 class CRM_Contact_Form_Inline_ContactInfo extends CRM_Contact_Form_Inline {
 
   /**
    * Build the form object elements.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -62,8 +58,6 @@ class CRM_Contact_Form_Inline_ContactInfo extends CRM_Contact_Form_Inline {
 
   /**
    * Process the form.
-   *
-   * @return void
    */
   public function postProcess() {
     $params = $this->exportValues();
index 484eb98f5c2462f6d9aab095e9beae8255fb1abb..00b5c9bd75e2ab9773cc25b83ecde4d08bf1467e 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * form helper class for contact name section
+ * Form helper class for contact name section.
  */
 class CRM_Contact_Form_Inline_ContactName extends CRM_Contact_Form_Inline {
 
   /**
    * Build the form object elements.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -78,8 +74,6 @@ class CRM_Contact_Form_Inline_ContactName extends CRM_Contact_Form_Inline {
 
   /**
    * Process the form.
-   *
-   * @return void
    */
   public function postProcess() {
     $params = $this->exportValues();
index 11f6c4661b974bf2046d8780090046ace731ca25..18e6dc1c7cc1108fe1f7e3b4b624f1a9987fdba6 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * form helper class for custom data section
+ * Form helper class for custom data section.
  */
 class CRM_Contact_Form_Inline_CustomData extends CRM_Contact_Form_Inline {
 
@@ -69,8 +67,6 @@ class CRM_Contact_Form_Inline_CustomData extends CRM_Contact_Form_Inline {
 
   /**
    * Build the form object elements for custom data.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -88,8 +84,6 @@ class CRM_Contact_Form_Inline_CustomData extends CRM_Contact_Form_Inline {
 
   /**
    * Process the form.
-   *
-   * @return void
    */
   public function postProcess() {
     // Process / save custom data
index 15aacae95ef57af632fc9e93c12b9e6462e6f820..9be0cc7166d36ed9b33717b4e58219349238b902 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * form helper class for demographics section
+ * Form helper class for demographics section.
  */
 class CRM_Contact_Form_Inline_Demographics extends CRM_Contact_Form_Inline {
 
   /**
    * Build the form object elements.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -50,8 +46,6 @@ class CRM_Contact_Form_Inline_Demographics extends CRM_Contact_Form_Inline {
 
   /**
    * Process the form.
-   *
-   * @return void
    */
   public function postProcess() {
     $params = $this->exportValues();
index 4385946184a73bc6950a6d16d73fa366d41188e9..8f4ddfabe4fff233948fcee72537524873dc9f35 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * form helper class for an Email object
+ * Form helper class for an Email object.
  */
 class CRM_Contact_Form_Inline_Email extends CRM_Contact_Form_Inline {
 
@@ -79,8 +77,6 @@ class CRM_Contact_Form_Inline_Email extends CRM_Contact_Form_Inline {
 
   /**
    * Build the form object elements for an email object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -173,8 +169,6 @@ class CRM_Contact_Form_Inline_Email extends CRM_Contact_Form_Inline {
 
   /**
    * Process the form.
-   *
-   * @return void
    */
   public function postProcess() {
     $params = $this->exportValues();
index db17a2876bc4dfb821b116b67737df929b49cd91..6282894704d74dcc44d53f4a9e7cd7a160a0f42d 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * form helper class for an IM object
+ * Form helper class for an IM object.
  */
 class CRM_Contact_Form_Inline_IM extends CRM_Contact_Form_Inline {
 
@@ -63,8 +61,6 @@ class CRM_Contact_Form_Inline_IM extends CRM_Contact_Form_Inline {
 
   /**
    * Build the form object elements for im object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -155,8 +151,6 @@ class CRM_Contact_Form_Inline_IM extends CRM_Contact_Form_Inline {
 
   /**
    * Process the form.
-   *
-   * @return void
    */
   public function postProcess() {
     $params = $this->exportValues();
index 06c29150fae7776d2b19045ad06704dd14dcb4e4..1c367c321693585c4841379a2394bf8ef1245dea 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Auxiliary class to provide support for locking (and ignoring locks on)
- * contact records.
+ * Auxiliary class to provide support for locking (and ignoring locks on) contact records.
  */
 class CRM_Contact_Form_Inline_Lock {
 
@@ -45,8 +42,6 @@ class CRM_Contact_Form_Inline_Lock {
    * @param CRM_Core_Form $form
    *   Form object.
    * @param int $contactID
-   *
-   * @return void
    */
   public static function buildQuickForm(&$form, $contactID) {
     // We provide a value for oplock_ts to client, but JS uses it carefully
@@ -63,7 +58,7 @@ class CRM_Contact_Form_Inline_Lock {
   }
 
   /**
-   * Ensure that oplock_ts hasn't changed in the underlying DB
+   * Ensure that oplock_ts hasn't changed in the underlying DB.
    *
    * @param array $fields
    *   The input form values.
@@ -89,7 +84,7 @@ class CRM_Contact_Form_Inline_Lock {
   }
 
   /**
-   * Return any post-save data
+   * Return any post-save data.
    *
    * @param int $contactID
    *
index 81987882e0822cc7838875656aad49ae250d0c29..bf53a7d112256d40a16fc14505feba4efc861e39 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * form helper class for an OpenID object
+ * Form helper class for an OpenID object.
  */
 class CRM_Contact_Form_Inline_OpenID extends CRM_Contact_Form_Inline {
 
@@ -63,8 +61,6 @@ class CRM_Contact_Form_Inline_OpenID extends CRM_Contact_Form_Inline {
 
   /**
    * Build the form object elements for openID object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -155,8 +151,6 @@ class CRM_Contact_Form_Inline_OpenID extends CRM_Contact_Form_Inline {
 
   /**
    * Process the form.
-   *
-   * @return void
    */
   public function postProcess() {
     $params = $this->exportValues();
index 57fcc78c0e7d2a052e23b122bc876c2b696c6996..f33f8fd97da8a573935a312ce6e0d0e68282b94b 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * form helper class for an Phone object
+ * Form helper class for an Phone object.
  */
 class CRM_Contact_Form_Inline_Phone extends CRM_Contact_Form_Inline {
 
@@ -63,8 +61,6 @@ class CRM_Contact_Form_Inline_Phone extends CRM_Contact_Form_Inline {
 
   /**
    * Build the form object elements for phone object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -156,8 +152,6 @@ class CRM_Contact_Form_Inline_Phone extends CRM_Contact_Form_Inline {
 
   /**
    * Process the form.
-   *
-   * @return void
    */
   public function postProcess() {
     $params = $this->exportValues();
index 2265e20cbf9ec0acfc6d80a6c54a8279c2c65727..c75d05b4954cf9eb2a3b266f2fce0b48fbe820d9 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * form helper class for an Website object
+ * Form helper class for an Website object,
  */
 class CRM_Contact_Form_Inline_Website extends CRM_Contact_Form_Inline {
 
@@ -62,8 +60,6 @@ class CRM_Contact_Form_Inline_Website extends CRM_Contact_Form_Inline {
 
   /**
    * Build the form object elements for website object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -116,8 +112,6 @@ class CRM_Contact_Form_Inline_Website extends CRM_Contact_Form_Inline {
 
   /**
    * Process the form.
-   *
-   * @return void
    */
   public function postProcess() {
     $params = $this->exportValues();
index 442f166b34cae229466117bbf6434029e2e5d478..260d072ccb123cd6461ec0901b533658779e373d 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Form_Location {
 
@@ -38,8 +36,6 @@ class CRM_Contact_Form_Location {
    * Set variables up before form is built.
    *
    * @param CRM_Core_Form $form
-   *
-   * @return void
    */
   public static function preProcess(&$form) {
     $form->_addBlockName = CRM_Utils_Request::retrieve('block', 'String', CRM_Core_DAO::$_nullObject);
@@ -77,8 +73,6 @@ class CRM_Contact_Form_Location {
    * Build the form object.
    *
    * @param CRM_Core_Form $form
-   *
-   * @return void
    */
   public static function buildQuickForm(&$form) {
     // required for subsequent AJAX requests.
index d5afeb957594e1cd1789640c3c7cb72577fcaf2a..183225b1796ce5c19a7d482b6228c53ba149b5dd 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
-require_once 'api/api.php';
-
 /**
- * Class CRM_Contact_Form_Merge
+ * Class CRM_Contact_Form_Merge.
  */
 class CRM_Contact_Form_Merge extends CRM_Core_Form {
   // the id of the contact that tere's a duplicate for; this one will
@@ -269,7 +265,7 @@ class CRM_Contact_Form_Merge extends CRM_Core_Form {
 
     $buttons[] = array(
       'type' => 'next',
-      'name' => $this->next ? ts('Merge and Goto Next Pair') : ts('Merge'),
+      'name' => $this->next ? ts('Merge and go to Next Pair') : ts('Merge'),
       'isDefault' => TRUE,
       'icon' => $this->next ? 'circle-triangle-e' : 'check',
     );
@@ -277,7 +273,7 @@ class CRM_Contact_Form_Merge extends CRM_Core_Form {
     if ($this->next || $this->prev) {
       $buttons[] = array(
         'type' => 'submit',
-        'name' => ts('Merge and Goto Listing'),
+        'name' => ts('Merge and go to Listing'),
       );
       $buttons[] = array(
         'type' => 'done',
index e96af55b07e299f90c3b7b5485d5afb3f61d882f..d60b3ff1fe6d11a71a93eeb70b41892ae0088423 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Form_ProfileContact {
 
@@ -40,8 +38,6 @@ class CRM_Contact_Form_ProfileContact {
    * Set variables up before form is built.
    *
    * @param CRM_Core_Form $form
-   *
-   * @return void
    */
   public static function preProcess(&$form) {
     $session = CRM_Core_Session::singleton();
@@ -110,49 +106,6 @@ class CRM_Contact_Form_ProfileContact {
    * @param $form
    */
   public static function postProcess($form) {
-    $params = $form->_params;
-    if (!empty($form->_honor_block_is_active) && !empty($params['soft_credit_type_id'])) {
-      $honorId = NULL;
-
-      //check if there is any duplicate contact
-      $profileContactType = CRM_Core_BAO_UFGroup::getContactType($params['honoree_profile_id']);
-      $dedupeParams = CRM_Dedupe_Finder::formatParams($params['honor'], $profileContactType);
-      $dedupeParams['check_permission'] = FALSE;
-      $ids = CRM_Dedupe_Finder::dupesByParams($dedupeParams, $profileContactType);
-      if (count($ids)) {
-        $honorId = CRM_Utils_Array::value(0, $ids);
-      }
-
-      $honorId = CRM_Contact_BAO_Contact::createProfileContact(
-        $params['honor'], CRM_Core_DAO::$_nullArray,
-        $honorId, NULL,
-        $params['honoree_profile_id']
-      );
-      $softParams = array();
-      $softParams['contribution_id'] = $form->_contributionID;
-      $softParams['contact_id'] = $honorId;
-      $softParams['soft_credit_type_id'] = $params['soft_credit_type_id'];
-      $contribution = new CRM_Contribute_DAO_Contribution();
-      $contribution->id = $form->_contributionID;
-      $contribution->find();
-      while ($contribution->fetch()) {
-        $softParams['currency'] = $contribution->currency;
-        $softParams['amount'] = $contribution->total_amount;
-      }
-      CRM_Contribute_BAO_ContributionSoft::add($softParams);
-
-      if (CRM_Utils_Array::value('is_email_receipt', $form->_values)) {
-        $form->_values['honor'] = array(
-          'soft_credit_type' => CRM_Utils_Array::value(
-            $params['soft_credit_type_id'],
-            CRM_Core_OptionGroup::values("soft_credit_type")
-          ),
-          'honor_id' => $honorId,
-          'honor_profile_id' => $params['honoree_profile_id'],
-          'honor_profile_values' => $params['honor'],
-        );
-      }
-    }
   }
 
 }
index c4ce3c9420d621b139b9d6d4003acbe439c32a79..0ecca9b30435952737e9953f0157e98359e4eb4b 100644 (file)
@@ -29,7 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
  */
 
 /**
index 6f3926119fbb41a5ff0ffd561558224b215a57bf..21cb3950bd38f30c3ac248e443a60e56ba46f371 100644 (file)
@@ -132,6 +132,13 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form {
 
     $this->assign('display_name_a', $this->_display_name_a);
 
+    // Check for permissions
+    if (in_array($this->_action, array(CRM_Core_Action::ADD, CRM_Core_Action::UPDATE, CRM_Core_Action::DELETE))) {
+      if (!CRM_Contact_BAO_Contact_Permission::allow($this->_contactId, CRM_Core_Permission::EDIT)) {
+        CRM_Core_Error::statusBounce(ts('You do not have the necessary permission to edit this contact.'));
+      }
+    }
+
     // Set page title based on action
     switch ($this->_action) {
       case CRM_Core_Action::VIEW:
index 84dc434b4c65b4e857eecc9df97933987b8507ed..0d25630417a354d0eeacf12aeb5652a9e4dcbbf8 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-/**
- * Files required
  */
 
 /**
@@ -349,8 +343,6 @@ class CRM_Contact_Form_Search extends CRM_Core_Form_Search {
 
   /**
    * Build the common elements between the search/advanced form.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -494,8 +486,6 @@ class CRM_Contact_Form_Search extends CRM_Core_Form_Search {
 
   /**
    * Processing needed for buildForm and later.
-   *
-   * @return void
    */
   public function preProcess() {
     // set the various class variables
@@ -755,8 +745,6 @@ class CRM_Contact_Form_Search extends CRM_Core_Form_Search {
 
   /**
    * Common post processing.
-   *
-   * @return void
    */
   public function postProcess() {
     /*
index db0b74df2ad7fbed897e90bc0179eed682efb4ea..6d400e79c61fdc8213782927791bc3c39a7d3955 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-/**
- * Files required
  */
 
 /**
- * advanced search, extends basic search
+ * Advanced search, extends basic search.
  */
 class CRM_Contact_Form_Search_Advanced extends CRM_Contact_Form_Search {
 
   /**
    * Processing needed for buildForm and later.
-   *
-   * @return void
    */
   public function preProcess() {
     $this->set('searchFormName', 'Advanced');
@@ -58,9 +50,6 @@ class CRM_Contact_Form_Search_Advanced extends CRM_Contact_Form_Search {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $this->set('context', 'advanced');
@@ -87,7 +76,6 @@ class CRM_Contact_Form_Search_Advanced extends CRM_Contact_Form_Search {
     );
 
     //check if there are any custom data searchable fields
-    $groupDetails = array();
     $extends = array_merge(array('Contact', 'Individual', 'Household', 'Organization'),
       CRM_Contact_BAO_ContactType::subTypes()
     );
@@ -223,17 +211,13 @@ class CRM_Contact_Form_Search_Advanced extends CRM_Contact_Form_Search {
    * The post processing of the form gets done here.
    *
    * Key things done during post processing are
-   *      - check for reset or next request. if present, skip post procesing.
+   *      - check for reset or next request. if present, skip post processing.
    *      - now check if user requested running a saved search, if so, then
    *        the form values associated with the saved search are used for searching.
-   *      - if user has done a submit with new values the regular post submissing is
+   *      - if user has done a submit with new values the regular post submitting is
    *        done.
    * The processing consists of using a Selector / Controller framework for getting the
    * search results.
-   *
-   * @param
-   *
-   * @return void
    */
   public function postProcess() {
     $this->set('isAdvanced', '1');
@@ -331,11 +315,10 @@ class CRM_Contact_Form_Search_Advanced extends CRM_Contact_Form_Search {
   }
 
   /**
-   * Normalize the form values to make it look similar to the advanced form values
-   * this prevents a ton of work downstream and allows us to use the same code for
-   * multiple purposes (queries, save/edit etc)
+   * Normalize the form values to make it look similar to the advanced form values.
    *
-   * @return void
+   * This prevents a ton of work downstream and allows us to use the same code for
+   * multiple purposes (queries, save/edit etc)
    */
   public function normalizeFormValues() {
     $contactType = CRM_Utils_Array::value('contact_type', $this->_formValues);
index 9387d6b08bb985dee78fe1f55a75894612078635..2519f9af44fd5da3fd603d54dcfe66807a47e58d 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-/**
- * Files required
  */
 
 /**
- * Base Search / View form for *all* listing of multiple
- * contacts
+ * Base Search / View form for *all* listing of multiple contacts.
  */
 class CRM_Contact_Form_Search_Basic extends CRM_Contact_Form_Search {
 
@@ -52,9 +45,6 @@ class CRM_Contact_Form_Search_Basic extends CRM_Contact_Form_Search {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     // text for sort_name or email criteria
@@ -139,9 +129,6 @@ class CRM_Contact_Form_Search_Basic extends CRM_Contact_Form_Search {
 
   /**
    * Add local and global form rules.
-   *
-   *
-   * @return void
    */
   public function addRules() {
     $this->addFormRule(array('CRM_Contact_Form_Search_Basic', 'formRule'));
@@ -149,8 +136,6 @@ class CRM_Contact_Form_Search_Basic extends CRM_Contact_Form_Search {
 
   /**
    * Processing needed for buildForm and later.
-   *
-   * @return void
    */
   public function preProcess() {
     $this->set('searchFormName', 'Basic');
@@ -167,8 +152,6 @@ class CRM_Contact_Form_Search_Basic extends CRM_Contact_Form_Search {
 
   /**
    * This method is called for processing a submitted search form.
-   *
-   * @return void
    */
   public function postProcess() {
     $this->set('isAdvanced', '0');
@@ -216,11 +199,10 @@ class CRM_Contact_Form_Search_Basic extends CRM_Contact_Form_Search {
   }
 
   /**
-   * Normalize the form values to make it look similar to the advanced form values
-   * this prevents a ton of work downstream and allows us to use the same code for
-   * multiple purposes (queries, save/edit etc)
+   * Normalize the form values to make it look similar to the advanced form values.
    *
-   * @return void
+   * This prevents a ton of work downstream and allows us to use the same code for
+   * multiple purposes (queries, save/edit etc)
    */
   public function normalizeFormValues() {
     $contactType = CRM_Utils_Array::value('contact_type', $this->_formValues);
index d1b6c9b6ae334bffcd81efcffbb64f10510c763f..259748a132c6e566a0c2795bbf83f2feecb05ce3 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class if for search builder processing
+ * This class is for search builder processing.
  */
 class CRM_Contact_Form_Search_Builder extends CRM_Contact_Form_Search {
 
@@ -54,8 +52,6 @@ class CRM_Contact_Form_Search_Builder extends CRM_Contact_Form_Search {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function preProcess() {
     $this->set('searchFormName', 'Builder');
@@ -124,9 +120,6 @@ class CRM_Contact_Form_Search_Builder extends CRM_Contact_Form_Search {
 
   /**
    * Add local and global form rules.
-   *
-   *
-   * @return void
    */
   public function addRules() {
     $this->addFormRule(array('CRM_Contact_Form_Search_Builder', 'formRule'), $this);
@@ -135,9 +128,9 @@ class CRM_Contact_Form_Search_Builder extends CRM_Contact_Form_Search {
   /**
    * Global validation rules for the form.
    *
-   * @param $values
-   * @param $files
-   * @param $self
+   * @param array $values
+   * @param array $files
+   * @param CRM_Core_Form $self
    *
    * @return array
    *   list of errors to be posted back to the form
@@ -334,8 +327,6 @@ class CRM_Contact_Form_Search_Builder extends CRM_Contact_Form_Search {
 
   /**
    * Process the uploaded file.
-   *
-   * @return void
    */
   public function postProcess() {
     $this->set('isAdvanced', '2');
index 91e8e90065619b6d499b51a9beaec86bda5f2bf7..a0dc548a3d3a6a00c65f371d983d016da6314c56 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Form_Search_Criteria {
   /**
@@ -522,13 +520,9 @@ class CRM_Contact_Form_Search_Criteria {
   }
 
   /**
-   * Generate the custom Data Fields based
-   * on the is_searchable
-   *
+   * Generate the custom Data Fields based for those with is_searchable = 1.
    *
-   * @param $form
-   *
-   * @return void
+   * @param CRM_Contact_Form_Search $form
    */
   public static function custom(&$form) {
     $form->add('hidden', 'hidden_custom', 1);
@@ -545,7 +539,6 @@ class CRM_Contact_Form_Search_Criteria {
       $_groupTitle[$key] = $group['name'];
       CRM_Core_ShowHideBlocks::links($form, $group['name'], '', '');
 
-      $groupId = $group['id'];
       foreach ($group['fields'] as $field) {
         $fieldId = $field['id'];
         $elementName = 'custom_' . $fieldId;
@@ -557,8 +550,6 @@ class CRM_Contact_Form_Search_Criteria {
         );
       }
     }
-
-    //TODO: validate for only one state if prox_distance isset
   }
 
   /**
index 65a553fb80fa4418a4a05f6c7d37236b20045111..a0fe82d91ae14bb947d6ed3a5d29a5a142ffd9c8 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Form_Search_Custom extends CRM_Contact_Form_Search {
 
@@ -94,17 +92,11 @@ class CRM_Contact_Form_Search_Custom extends CRM_Contact_Form_Search {
   }
 
   /**
-   * This virtual function is used to set the default values of
-   * various form elements
-   *
-   * access        public
+   * Set the default values of various form elements.
    *
    * @return array
    *   reference to the array of default values
    */
-  /**
-   * @return array
-   */
   public function setDefaultValues() {
     if (method_exists($this->_customSearchClass, 'setDefaultValues')) {
       return $this->_customClass->setDefaultValues();
@@ -172,13 +164,10 @@ class CRM_Contact_Form_Search_Custom extends CRM_Contact_Form_Search {
   }
 
   /**
-   * Return a descriptive name for the page, used in wizard header
+   * Return a descriptive name for the page, used in wizard header.
    *
    * @return string
    */
-  /**
-   * @return string
-   */
   public function getTitle() {
     return ts('Custom Search');
   }
index 9ad5d822865bd5f4d3f8f084846bba2da38d4270..8bb4e8106244da63f86693ad437dba543c2d83a0 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Form_Search_Custom_ActivitySearch extends CRM_Contact_Form_Search_Custom_Base implements CRM_Contact_Form_Search_Interface {
 
@@ -39,10 +37,9 @@ class CRM_Contact_Form_Search_Custom_ActivitySearch extends CRM_Contact_Form_Sea
   protected $_aclWhere = NULL;
 
   /**
-   * @param $formValues
-   */
-  /**
-   * @param $formValues
+   * Class constructor.
+   *
+   * @param array $formValues
    */
   public function __construct(&$formValues) {
     $this->_formValues = $formValues;
index e347bf04a2540c755adc39655f3b5ecdfa2b8407..8f2a9096637601c800d2009acc4a8f77bb234311 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Form_Search_Custom_Base {
 
@@ -41,7 +39,9 @@ class CRM_Contact_Form_Search_Custom_Base {
   protected $_stateID;
 
   /**
-   * @param $formValues
+   * Class constructor.
+   *
+   * @param array $formValues
    */
   public function __construct(&$formValues) {
     $this->_formValues = &$formValues;
index 4a3fab304711155d84c935b484df9cb778c64b38..f4fedf458f1f3746146f2a86dff40b5283b5145e 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Form_Search_Custom_Basic extends CRM_Contact_Form_Search_Custom_Base implements CRM_Contact_Form_Search_Interface {
 
@@ -39,10 +37,9 @@ class CRM_Contact_Form_Search_Custom_Basic extends CRM_Contact_Form_Search_Custo
   protected $_aclWhere = NULL;
 
   /**
-   * @param $formValues
-   */
-  /**
-   * @param $formValues
+   * Class constructor.
+   *
+   * @param array $formValues
    */
   public function __construct(&$formValues) {
     parent::__construct($formValues);
@@ -89,11 +86,10 @@ class CRM_Contact_Form_Search_Custom_Basic extends CRM_Contact_Form_Search_Custo
   }
 
   /**
-   * Normalize the form values to make it look similar to the advanced form values
-   * this prevents a ton of work downstream and allows us to use the same code for
-   * multiple purposes (queries, save/edit etc)
+   * Normalize the form values to make it look similar to the advanced form values.
    *
-   * @return void
+   * This prevents a ton of work downstream and allows us to use the same code for
+   * multiple purposes (queries, save/edit etc)
    */
   public function normalize() {
     $contactType = CRM_Utils_Array::value('contact_type', $this->_formValues);
index 3236149eca93f68a3e3ade8fb909862837ab8a57..e3621e77b789438db5d8e19315d33cbdd582db10 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Form_Search_Custom_ContribSYBNT extends CRM_Contact_Form_Search_Custom_Base implements CRM_Contact_Form_Search_Interface {
 
@@ -40,6 +38,8 @@ class CRM_Contact_Form_Search_Custom_ContribSYBNT extends CRM_Contact_Form_Searc
   public $_permissionedComponent;
 
   /**
+   * Class constructor.
+   *
    * @param $formValues
    */
   public function __construct(&$formValues) {
index 699c9093f0d4b86e59cbad6d8d1475daa12797fd..a2597cc0b43207b1a64266487012950557303f70 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Form_Search_Custom_ContributionAggregate extends CRM_Contact_Form_Search_Custom_Base implements CRM_Contact_Form_Search_Interface {
 
@@ -40,7 +38,9 @@ class CRM_Contact_Form_Search_Custom_ContributionAggregate extends CRM_Contact_F
   public $_permissionedComponent;
 
   /**
-   * @param $formValues
+   * Class constructor.
+   *
+   * @param array $formValues
    */
   public function __construct(&$formValues) {
     $this->_formValues = $formValues;
@@ -58,6 +58,8 @@ class CRM_Contact_Form_Search_Custom_ContributionAggregate extends CRM_Contact_F
   }
 
   /**
+   * Build form.
+   *
    * @param CRM_Core_Form $form
    */
   public function buildForm(&$form) {
index 0a7eacfd3fd8e3feaf777202cf78a206cbbf10d9..c457efa5d552414588f5d8be6ced92b3d94eea81 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Form_Search_Custom_DateAdded extends CRM_Contact_Form_Search_Custom_Base implements CRM_Contact_Form_Search_Interface {
 
@@ -39,7 +37,9 @@ class CRM_Contact_Form_Search_Custom_DateAdded extends CRM_Contact_Form_Search_C
   protected $_aclWhere = NULL;
 
   /**
-   * @param $formValues
+   * Class constructor.
+   *
+   * @param array $formValues
    */
   public function __construct(&$formValues) {
     parent::__construct($formValues);
index 5dfb8b950995e974d8599ad54df4acc332b9a65b..5a65d9ec786ae6a6f18e42390f16c8845bb32222 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Form_Search_Custom_EventAggregate extends CRM_Contact_Form_Search_Custom_Base implements CRM_Contact_Form_Search_Interface {
 
@@ -40,7 +38,9 @@ class CRM_Contact_Form_Search_Custom_EventAggregate extends CRM_Contact_Form_Sea
   public $_permissionedComponent;
 
   /**
-   * @param $formValues
+   * Class constructor.
+   *
+   * @param array $formValues
    */
   public function __construct(&$formValues) {
     $this->_formValues = $formValues;
index 22907cfb11d7f180629770b5e5fb66d640552a52..ee587bbbebb5f11421c2ba8cda2d58b9e6064379 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Form_Search_Custom_FullText extends CRM_Contact_Form_Search_Custom_Base implements CRM_Contact_Form_Search_Interface {
 
@@ -76,7 +74,9 @@ class CRM_Contact_Form_Search_Custom_FullText extends CRM_Contact_Form_Search_Cu
   protected $_foundRows = array();
 
   /**
-   * @param $formValues
+   * Class constructor.
+   *
+   * @param array $formValues
    */
   public function __construct(&$formValues) {
     $this->_partialQueries = array(
index 433aaedc165f5a436d8536128161015cf3766281..5d8ac48661cfeea06adae59d7879c2ba50dbd32b 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 abstract class CRM_Contact_Form_Search_Custom_FullText_AbstractPartialQuery {
 
index 02ff7178e4e6dc6fab44d6dec5e9e1d8158798be..acd1c57c457cc5d7c232ba11054e8c1e25e2838f 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Form_Search_Custom_FullText_Activity extends CRM_Contact_Form_Search_Custom_FullText_AbstractPartialQuery {
 
@@ -66,6 +64,7 @@ class CRM_Contact_Form_Search_Custom_FullText_Activity extends CRM_Contact_Form_
   /**
    * @param string $queryText
    * @param string $entityIDTableName
+   *
    * @return array
    *   list tables/queries (for runQueries)
    */
index 14ef5e130aa546d28b27c31fbc6333d44a33b599..99e6c340f7bad54f78ac7707fa271441dad12a01 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Form_Search_Custom_FullText_Case extends CRM_Contact_Form_Search_Custom_FullText_AbstractPartialQuery {
 
index 149d6e982e798c9dfa898f53ad4fb85b75fd329a..e0d2950ac19cb9329d98ae095ad34ed9d98d7498 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Form_Search_Custom_FullText_Contact extends CRM_Contact_Form_Search_Custom_FullText_AbstractPartialQuery {
 
@@ -42,6 +40,8 @@ class CRM_Contact_Form_Search_Custom_FullText_Contact extends CRM_Contact_Form_S
   }
 
   /**
+   * Check if search is permitted.
+   *
    * @return bool
    */
   public function isActive() {
index f59154a1e9db865fbb8f4a8d4348ecec4e8e5f67..ee7a2ad41d4aa65bdf7f211b13ddb7f907f4fe11 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Form_Search_Custom_FullText_Contribution extends CRM_Contact_Form_Search_Custom_FullText_AbstractPartialQuery {
 
@@ -42,6 +40,8 @@ class CRM_Contact_Form_Search_Custom_FullText_Contribution extends CRM_Contact_F
   }
 
   /**
+   * Check if search is permitted.
+   *
    * @return bool
    */
   public function isActive() {
index 573664d8d6888f0d6eff4d32883aeb92d989d44e..357c2e3adb7674eb133426fd471c52dda6f8d939 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Form_Search_Custom_FullText_Membership extends CRM_Contact_Form_Search_Custom_FullText_AbstractPartialQuery {
 
@@ -42,6 +40,8 @@ class CRM_Contact_Form_Search_Custom_FullText_Membership extends CRM_Contact_For
   }
 
   /**
+   * Check if search is permitted.
+   *
    * @return bool
    */
   public function isActive() {
@@ -68,6 +68,7 @@ class CRM_Contact_Form_Search_Custom_FullText_Membership extends CRM_Contact_For
    *
    * @param string $queryText
    * @param string $entityIDTableName
+   *
    * @return array
    *   list tables/queries (for runQueries)
    */
index 060e5390a30cb90a9f3ee82d525183e2b8f9edaa..43d758483d1efbc1b2f4c4b0fea2d355e1fe301e 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Form_Search_Custom_FullText_Participant extends CRM_Contact_Form_Search_Custom_FullText_AbstractPartialQuery {
 
@@ -42,6 +40,8 @@ class CRM_Contact_Form_Search_Custom_FullText_Participant extends CRM_Contact_Fo
   }
 
   /**
+   * Check if user has permission.
+   *
    * @return bool
    */
   public function isActive() {
@@ -68,6 +68,7 @@ class CRM_Contact_Form_Search_Custom_FullText_Participant extends CRM_Contact_Fo
    *
    * @param string $queryText
    * @param string $entityIDTableName
+   *
    * @return array
    *   list tables/queries (for runQueries)
    */
index 2d437dfceb1b4707437bf75664588a95a1e39da9..2900468923f9a4990416f1350157c8dd4b0c29eb 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Form_Search_Custom_Group extends CRM_Contact_Form_Search_Custom_Base implements CRM_Contact_Form_Search_Interface {
 
@@ -44,7 +42,9 @@ class CRM_Contact_Form_Search_Custom_Group extends CRM_Contact_Form_Search_Custo
   protected $_aclWhere = NULL;
 
   /**
-   * @param $formValues
+   * Class constructor.
+   *
+   * @param array $formValues
    */
   public function __construct(&$formValues) {
     $this->_formValues = $formValues;
@@ -611,6 +611,8 @@ WHERE  gcc.group_id = {$ssGroup->id}
   }
 
   /**
+   * Define columns.
+   *
    * @return array
    */
   public function &columns() {
@@ -618,6 +620,8 @@ WHERE  gcc.group_id = {$ssGroup->id}
   }
 
   /**
+   * Get summary.
+   *
    * @return NULL
    */
   public function summary() {
@@ -625,6 +629,8 @@ WHERE  gcc.group_id = {$ssGroup->id}
   }
 
   /**
+   * Get template file.
+   *
    * @return string
    */
   public function templateFile() {
@@ -632,7 +638,9 @@ WHERE  gcc.group_id = {$ssGroup->id}
   }
 
   /**
-   * @param $title
+   * Set title on search.
+   *
+   * @param string $title
    */
   public function setTitle($title) {
     if ($title) {
@@ -644,6 +652,8 @@ WHERE  gcc.group_id = {$ssGroup->id}
   }
 
   /**
+   * Build ACL clause.
+   *
    * @param string $tableAlias
    */
   public function buildACLClause($tableAlias = 'contact') {
index e86a79ed66c227c65c9e8da1d19c7a259d0e5809..e3ea1e1ae9c32c5f28bcadf65bc594d93662dcbc 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Form_Search_Custom_MultipleValues extends CRM_Contact_Form_Search_Custom_Base implements CRM_Contact_Form_Search_Interface {
 
@@ -41,7 +39,9 @@ class CRM_Contact_Form_Search_Custom_MultipleValues extends CRM_Contact_Form_Sea
   protected $_aclWhere = NULL;
 
   /**
-   * @param $formValues
+   * Class constructor.
+   *
+   * @param array $formValues
    */
   public function __construct(&$formValues) {
     parent::__construct($formValues);
index 85693bf341729b6143e47d0f9ba46f8be5fefbd6..dc19943c87e5d5fe5d831fbb518d4bba0aca199d 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Form_Search_Custom_PostalMailing extends CRM_Contact_Form_Search_Custom_Base implements CRM_Contact_Form_Search_Interface {
   protected $_aclFrom = NULL;
   protected $_aclWhere = NULL;
   /**
-   * @param $formValues
+   * Class constructor.
+   *
+   * @param array $formValues
    */
   public function __construct(&$formValues) {
     parent::__construct($formValues);
index c48da9430748d5a56e180b4bc872770e25ef1b5b..bde740e950332295d619e2c694c05a02600b4bad 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Form_Search_Custom_PriceSet extends CRM_Contact_Form_Search_Custom_Base implements CRM_Contact_Form_Search_Interface {
 
@@ -41,7 +39,9 @@ class CRM_Contact_Form_Search_Custom_PriceSet extends CRM_Contact_Form_Search_Cu
   public $_permissionedComponent;
 
   /**
-   * @param $formValues
+   * Class constructor.
+   *
+   * @param array $formValues
    */
   public function __construct(&$formValues) {
     parent::__construct($formValues);
index af394bc9b0c4b5ad05f3ad684af2a2466dbd33a1..d854c078e6a869e4393338a3390adc4a52e3c09a 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Form_Search_Custom_Proximity extends CRM_Contact_Form_Search_Custom_Base implements CRM_Contact_Form_Search_Interface {
 
@@ -41,7 +39,9 @@ class CRM_Contact_Form_Search_Custom_Proximity extends CRM_Contact_Form_Search_C
   protected $_aclWhere = NULL;
 
   /**
-   * @param $formValues
+   * Class constructor.
+   *
+   * @param array $formValues
    *
    * @throws Exception
    */
index 89dc49280f04298adaee0a17a46c2cb77db55d70..2d55f9e8bf6adf4e146280a6f800baee4bf60fe1 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Form_Search_Custom_RandomSegment extends CRM_Contact_Form_Search_Custom_Base implements CRM_Contact_Form_Search_Interface {
 
@@ -39,7 +37,9 @@ class CRM_Contact_Form_Search_Custom_RandomSegment extends CRM_Contact_Form_Sear
   protected $_aclWhere = NULL;
 
   /**
-   * @param $formValues
+   * Class constructor.
+   *
+   * @param array $formValues
    */
   public function __construct(&$formValues) {
     parent::__construct($formValues);
index 3bac4131a88393d8ff7f7a65dcea27a71556f25f..32b9cdc1bbe76bd8e6a24462e927dc6fbc3ded57 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Form_Search_Custom_Sample extends CRM_Contact_Form_Search_Custom_Base implements CRM_Contact_Form_Search_Interface {
   protected $_aclFrom = NULL;
   protected $_aclWhere = NULL;
   /**
-   * @param $formValues
+   * Class constructor.
+   *
+   * @param array $formValues
    */
   public function __construct(&$formValues) {
     parent::__construct($formValues);
@@ -59,6 +59,8 @@ class CRM_Contact_Form_Search_Custom_Sample extends CRM_Contact_Form_Search_Cust
   }
 
   /**
+   * Build form.
+   *
    * @param CRM_Core_Form $form
    */
   public function buildForm(&$form) {
index ad7caa8d8ace099b10c5802748ecafbce0c27dcb..193774f065c9dc936e3dcae52a3141ad694d51d8 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Form_Search_Custom_TagContributions extends CRM_Contact_Form_Search_Custom_Base implements CRM_Contact_Form_Search_Interface {
 
@@ -40,7 +38,9 @@ class CRM_Contact_Form_Search_Custom_TagContributions extends CRM_Contact_Form_S
   public $_permissionedComponent;
 
   /**
-   * @param $formValues
+   * Class constructor.
+   *
+   * @param array $formValues
    */
   public function __construct(&$formValues) {
     $this->_formValues = $formValues;
index 74691455148bab69714b89c0e181c6203843f5d1..b7331a666497bf52f3f83fdb06f4bb4472e8ae8e 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Form_Search_Custom_ZipCodeRange extends CRM_Contact_Form_Search_Custom_Base implements CRM_Contact_Form_Search_Interface {
   protected $_aclFrom = NULL;
   protected $_aclWhere = NULL;
   /**
-   * @param $formValues
+   * Class constructor.
+   *
+   * @param array $formValues
    */
   public function __construct(&$formValues) {
     parent::__construct($formValues);
index dbaaa34955afa746d886c86cf9bd17b8e0810936..f2a2fba398b8922708b037efce67a74a2de8329d 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 interface CRM_Contact_Form_Search_Interface {
 
index 4b552296c70a9ac0ecd2250f4e1af1c139ac1902..07309072977c08c6f23d24e3c4f1803fb1d39b86 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
  */
 
 /**
- * This class generates form components for search-result tasks
+ * This class generates form components for search-result tasks.
  */
 class CRM_Contact_Form_Task extends CRM_Core_Form {
 
index 9c7ac98dd7949defd4ea063b0181474380d3b8f0..29b4f883eda6c695b0fca759c26c816aa2d392e6 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class provides the functionality to group
- * contacts. This class provides functionality for the actual
+ * This class provides the functionality to group contacts.
+ *
+ * This class provides functionality for the actual
  * addition of contacts to groups.
  */
 class CRM_Contact_Form_Task_AddToGroup extends CRM_Contact_Form_Task {
@@ -63,8 +62,6 @@ class CRM_Contact_Form_Task_AddToGroup extends CRM_Contact_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     // initialize the task and row fields
@@ -76,9 +73,6 @@ class CRM_Contact_Form_Task_AddToGroup extends CRM_Contact_Form_Task {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
 
@@ -166,9 +160,6 @@ class CRM_Contact_Form_Task_AddToGroup extends CRM_Contact_Form_Task {
 
   /**
    * Add local and global form rules.
-   *
-   *
-   * @return void
    */
   public function addRules() {
     $this->addFormRule(array('CRM_Contact_Form_task_AddToGroup', 'formRule'));
@@ -197,9 +188,6 @@ class CRM_Contact_Form_Task_AddToGroup extends CRM_Contact_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     $params = $this->controller->exportValues();
index b7c795bfde27942e0fa343a3f503d5ccf7232077..d1eb806a430b361807a4caa398de34113ded57a8 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class provides the functionality to add contact(s) to Organization
+ * This class provides the functionality to add contact(s) to Organization.
  */
 class CRM_Contact_Form_Task_AddToOrganization extends CRM_Contact_Form_Task_AddToParentClass {
 
index 946235d5c7ba80aecc48f6b9acd624a0af3c769e..99437277a60dab27ba689f75acedff0255b2de93 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class provides the functionality to delete a group of
- * contacts. This class provides functionality for the actual
- * addition of contacts to groups.
+ * This class provides the functionality to delete a group of contacts.
+ *
+ * This class provides functionality for the actual addition of contacts to groups.
+ *
+ * Wow is that copy & paste gone wrong or what? What does this class do? Anyone, anyone.
  */
 class CRM_Contact_Form_Task_AddToTag extends CRM_Contact_Form_Task {
 
@@ -56,9 +56,6 @@ class CRM_Contact_Form_Task_AddToTag extends CRM_Contact_Form_Task {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     // add select for tag
@@ -94,9 +91,6 @@ class CRM_Contact_Form_Task_AddToTag extends CRM_Contact_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     //get the submitted values in an array
index c1949bb1021953311962a20aa42c5c17ccd3a45d..49aabe86a158b656429978ef2cd227841df88521 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -41,9 +39,6 @@ class CRM_Contact_Form_Task_AlterPreferences extends CRM_Contact_Form_Task {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     // add select for preferences
@@ -95,9 +90,6 @@ class CRM_Contact_Form_Task_AlterPreferences extends CRM_Contact_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     //get the submitted values in an array
index 2ec51c6cfd4b7370a9f9223f5485209a458fcefc..66de385ecec483e9ed64c2306d2a138542328447 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class provides the functionality for batch profile update
+ * This class provides the functionality for batch profile update.
  */
 class CRM_Contact_Form_Task_Batch extends CRM_Contact_Form_Task {
 
@@ -67,8 +65,6 @@ class CRM_Contact_Form_Task_Batch extends CRM_Contact_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     // initialize the task and row fields
@@ -77,9 +73,6 @@ class CRM_Contact_Form_Task_Batch extends CRM_Contact_Form_Task {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $ufGroupId = $this->get('ufGroupId');
@@ -220,9 +213,6 @@ class CRM_Contact_Form_Task_Batch extends CRM_Contact_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     $params = $this->exportValues();
@@ -264,6 +254,7 @@ class CRM_Contact_Form_Task_Batch extends CRM_Contact_Form_Task {
 
   /**
    * Parse street address.
+   *
    * @param array $contactValues
    *   Contact values.
    * @param CRM_Core_Form $form
index efa85b4e413f4a937ccd39a9b686ca26edde72a7..1603f811807c06267009e6248d970374cf7f7e4c 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class provides the functionality to delete a group of
- * contacts. This class provides functionality for the actual
- * deletion.
+ * This class provides the functionality to delete a group of contacts.
+ *
+ * This class provides functionality for the actual deletion.
  */
 class CRM_Contact_Form_Task_Delete extends CRM_Contact_Form_Task {
 
@@ -55,8 +53,6 @@ class CRM_Contact_Form_Task_Delete extends CRM_Contact_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
 
@@ -148,9 +144,6 @@ class CRM_Contact_Form_Task_Delete extends CRM_Contact_Form_Task {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $label = $this->_restore ? ts('Restore Contact(s)') : ts('Delete Contact(s)');
@@ -202,9 +195,6 @@ class CRM_Contact_Form_Task_Delete extends CRM_Contact_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     $session = CRM_Core_Session::singleton();
index bd6cd14a4ac0f76c8917fc1a38da1e159b41a853..de2f0fe0797c6a76a2a58f02df3576089ea0870c 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class provides the functionality to email a group of
- * contacts.
+ * This class provides the functionality to email a group of contacts.
  */
 class CRM_Contact_Form_Task_Email extends CRM_Contact_Form_Task {
 
   /**
-   * Are we operating in "single mode", i.e. sending email to one
-   * specific contact?
+   * Are we operating in "single mode".
+   *
+   * Single mode means sending email to one specific contact.
    *
    * @var boolean
    */
@@ -94,8 +92,6 @@ class CRM_Contact_Form_Task_Email extends CRM_Contact_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     // store case id if present
@@ -149,9 +145,6 @@ class CRM_Contact_Form_Task_Email extends CRM_Contact_Form_Task {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     //enable form element
@@ -163,9 +156,6 @@ class CRM_Contact_Form_Task_Email extends CRM_Contact_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     CRM_Contact_Form_Task_EmailCommon::postProcess($this);
index 421dd51c59964102ce29e719cdedcc83de8dfc8a..0f64c32a06a6404e1d111e8eee0663d47171ea88 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -132,10 +130,7 @@ class CRM_Contact_Form_Task_EmailCommon {
   /**
    * Build the form object.
    *
-   *
    * @param CRM_Core_Form $form
-   *
-   * @return void
    */
   public static function buildQuickForm(&$form) {
     $toArray = $ccArray = $bccArray = array();
@@ -359,7 +354,7 @@ class CRM_Contact_Form_Task_EmailCommon {
     }
 
     $form->addFormRule(array('CRM_Contact_Form_Task_EmailCommon', 'formRule'), $form);
-    CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'templates/CRM/Contact/Form/Task/EmailCommon.js');
+    CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'templates/CRM/Contact/Form/Task/EmailCommon.js', 0, 'html-header');
   }
 
   /**
@@ -395,10 +390,7 @@ class CRM_Contact_Form_Task_EmailCommon {
   /**
    * Process the form after the input has been submitted and validated.
    *
-   *
    * @param CRM_Core_Form $form
-   *
-   * @return void
    */
   public static function postProcess(&$form) {
     if (count($form->_contactIds) > self::MAX_EMAILS_KILL_SWITCH) {
index e54703dee00eb5cc177dc4ecbf20331abcbddb69..d3ec87f17c63a32f3f2ffc985cc3c20b9e8349d6 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class provides the functionality to save a search
+ * This class provides the functionality to save a search.
+ *
  * Saved Searches are used for saving frequently used queries
  */
 class CRM_Contact_Form_Task_HookSample extends CRM_Contact_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     parent::preProcess();
@@ -72,10 +69,7 @@ AND    c.id IN ( $contactIDs )";
   }
 
   /**
-   * Build the form object - it consists of
-   *
-   *
-   * @return void
+   * Build the form object.
    */
   public function buildQuickForm() {
     $this->addDefaultButtons(ts('Back to Search'), 'done');
@@ -83,9 +77,6 @@ AND    c.id IN ( $contactIDs )";
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
   }
index a99e65d5c8fd87bf293d165a8753905389b33275..6ea5c7fa048d303a78f3487f84d1185db425f2eb 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class helps to print the labels for contacts
- *
+ * This class helps to print the labels for contacts.
  */
 class CRM_Contact_Form_Task_Label extends CRM_Contact_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     $this->set('contactIds', $this->_contactIds);
@@ -51,9 +46,6 @@ class CRM_Contact_Form_Task_Label extends CRM_Contact_Form_Task {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     CRM_Utils_System::setTitle(ts('Make Mailing Labels'));
@@ -106,9 +98,6 @@ class CRM_Contact_Form_Task_Label extends CRM_Contact_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     $fv = $this->controller->exportValues($this->_name);
@@ -380,10 +369,10 @@ class CRM_Contact_Form_Task_Label extends CRM_Contact_Form_Task {
   }
 
   /**
-   * Create labels (pdf)
+   * Create labels (pdf).
    *
    * @param array $contactRows
-   *   Assciated array of contact data.
+   *   Associated array of contact data.
    * @param string $format
    *   Format in which labels needs to be printed.
    * @param string $fileName
index 72538cf2a811f25d0fcc6fd22f567a3cbae94f2f..992b7e17ada39d55543bce4e51d390802cc86020 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class provides the common functionality for sending email to
- * one or a group of contact ids. This class is reused by all the search
- * components in CiviCRM (since they all have send email as a task)
+ * This class provides the common functionality for sending email to one or a group of contact ids.
  */
 class CRM_Contact_Form_Task_LabelCommon {
 
   /**
-   * Create labels (pdf)
+   * Create labels (pdf).
    *
    * @param array $contactRows
-   *   Assciated array of contact data.
+   *   Associated array of contact data.
    * @param string $format
    *   Format in which labels needs to be printed.
    * @param string $fileName
    *   The name of the file to save the label in.
-   *
    */
   public static function createLabel(&$contactRows, &$format, $fileName = 'MailingLabels_CiviCRM.pdf') {
     $pdf = new CRM_Utils_PDF_Label($format, 'mm');
index 920872a0c08f68d7370ccecd474c002560be299e..e1fef1f9064cddde7082c1882706f00e51ae69db 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -50,8 +48,6 @@ class CRM_Contact_Form_Task_Map extends CRM_Contact_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     $cid = CRM_Utils_Request::retrieve('cid', 'Positive',
@@ -115,9 +111,6 @@ class CRM_Contact_Form_Task_Map extends CRM_Contact_Form_Task {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $this->addButtons(array(
@@ -132,9 +125,6 @@ class CRM_Contact_Form_Task_Map extends CRM_Contact_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
   }
@@ -142,15 +132,12 @@ class CRM_Contact_Form_Task_Map extends CRM_Contact_Form_Task {
   /**
    * Assign smarty variables to the template that will be used by google api to plot the contacts.
    *
-   * @param $ids
+   * @param array $ids
    * @param int $locationId
    *   Location_id.
-   * @param $page
-   * @param $addBreadCrumb
+   * @param CRM_Core_Page $page
+   * @param bool $addBreadCrumb
    * @param string $type
-   *
-   * @return void
-   *   the location of the file we have created
    */
   public static function createMapXML($ids, $locationId, &$page, $addBreadCrumb, $type = 'Contact') {
     $config = CRM_Core_Config::singleton();
index 23d0f4e16e37a1fa5429d76ba7f80e256067f311..955d893d3d52134190d5d7a8fc9e51c0c379d856 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id: Event.php 45499 2013-02-08 12:31:05Z kurund $
- *
  */
 
 /**
- * This class provides the functionality to map
- * the address for group of
- * contacts.
+ * This class provides the functionality to map the address for group of contacts.
  */
 class CRM_Contact_Form_Task_Map_Event extends CRM_Contact_Form_Task_Map {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     $ids = CRM_Utils_Request::retrieve('eid', 'Positive',
@@ -63,9 +57,6 @@ class CRM_Contact_Form_Task_Map_Event extends CRM_Contact_Form_Task_Map {
    *
    * @return string
    */
-  /**
-   * @return string
-   */
   public function getTemplateFileName() {
     return 'CRM/Contact/Form/Task/Map.tpl';
   }
index dcc545898e4479c9d0ca11dfdba929543bcbee36..00c780d5f9a16cfc0d5c389b9b155ae584b20169 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class provides the functionality to Merge Contacts.
+ * This class provides the functionality to Merge contacts.
  *
  */
 class CRM_Contact_Form_Task_Merge extends CRM_Contact_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     parent::preProcess();
index fccbfea8c93419c1680c7ff6c406619139e4a635..0267aa6a503a51a745f8f83574920a9c56a0b158 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class provides the functionality to create PDF letter for a group of
- * contacts or a single contact.
+ * This class provides the functionality to create PDF letter for a group of contacts or a single contact.
  */
 class CRM_Contact_Form_Task_PDF extends CRM_Contact_Form_Task {
 
@@ -54,8 +51,6 @@ class CRM_Contact_Form_Task_PDF extends CRM_Contact_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
 
@@ -87,13 +82,7 @@ class CRM_Contact_Form_Task_PDF extends CRM_Contact_Form_Task {
   }
 
   /**
-   * Set default values for the form. Relationship that in edit/view action
-   * the default values are retrieved from the database
-   *
-   *
-   * @return void
-   */
-  /**
+   * Set default values for the form.
    */
   public function setDefaultValues() {
     $defaults = array();
@@ -108,9 +97,6 @@ class CRM_Contact_Form_Task_PDF extends CRM_Contact_Form_Task {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     //enable form element
@@ -120,9 +106,6 @@ class CRM_Contact_Form_Task_PDF extends CRM_Contact_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     CRM_Contact_Form_Task_PDFLetterCommon::postProcess($this);
index 104f4827209a07f1536f448e5522d068fde85621..94f309254e89533b1d76a954c25b4debb55bee96 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class provides the common functionality for creating PDF letter for
- * one or a group of contact ids.
+ * This class provides the common functionality for creating PDF letter for one or a group of contact ids.
  */
 class CRM_Contact_Form_Task_PDFLetterCommon {
 
@@ -43,8 +40,6 @@ class CRM_Contact_Form_Task_PDFLetterCommon {
    * Build all the data structures needed to build the form.
    *
    * @param CRM_Core_Form $form
-   *
-   * @return void
    */
   public static function preProcess(&$form) {
     $messageText = array();
@@ -76,8 +71,6 @@ class CRM_Contact_Form_Task_PDFLetterCommon {
    * Build the form object.
    *
    * @var CRM_Core_Form $form
-   *
-   * @return void
    */
   public static function buildQuickForm(&$form) {
     // This form outputs a file so should never be submitted via ajax
@@ -315,10 +308,7 @@ class CRM_Contact_Form_Task_PDFLetterCommon {
   /**
    * Process the form after the input has been submitted and validated.
    *
-   *
    * @param CRM_Core_Form $form
-   *
-   * @return void
    */
   public static function postProcess(&$form) {
     list($formValues, $categories, $html_message, $messageToken, $returnProperties) = self::processMessageTemplate($form);
index 92cc886e72728a3c1ac339546bae8071b052d4e1..8aedb2ed2b3490d2d511d80bbc378ddb8563e245 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class provides the functionality for batch profile update
+ * This class provides the functionality for batch profile update.
  */
 class CRM_Contact_Form_Task_PickProfile extends CRM_Contact_Form_Task {
 
@@ -62,8 +60,6 @@ class CRM_Contact_Form_Task_PickProfile extends CRM_Contact_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     // initialize the task and row fields
@@ -75,7 +71,7 @@ class CRM_Contact_Form_Task_PickProfile extends CRM_Contact_Form_Task {
     $validate = FALSE;
     //validations
     if (count($this->_contactIds) > $this->_maxContacts) {
-      CRM_Core_Session::setStatus(ts("The maximum number of contacts you can select for Batch Update is %1. You have selected %2. Please select fewer contacts from your search results and try again.", array(
+      CRM_Core_Session::setStatus(ts("The maximum number of contacts you can select for Batch update is %1. You have selected %2. Please select fewer contacts from your search results and try again.", array(
             1 => $this->_maxContacts,
             2 => count($this->_contactIds),
           )), ts('Maximum Exceeded'), 'error');
@@ -95,9 +91,6 @@ class CRM_Contact_Form_Task_PickProfile extends CRM_Contact_Form_Task {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     CRM_Utils_System::setTitle(ts('Batch Profile Update for Contact'));
@@ -113,7 +106,7 @@ class CRM_Contact_Form_Task_PickProfile extends CRM_Contact_Form_Task {
 
     if (empty($profiles)) {
       $types = implode(' ' . ts('or') . ' ', $this->_contactTypes);
-      CRM_Core_Session::setStatus(ts("The contact type selected for Batch Update does not have a corresponding profile. Please set up a profile for %1s and try again.", array(1 => $types)), ts('No Profile Available'), 'error');
+      CRM_Core_Session::setStatus(ts("The contact type selected for Batch update does not have a corresponding profile. Please set up a profile for %1s and try again.", array(1 => $types)), ts('No Profile Available'), 'error');
       CRM_Utils_System::redirect($this->_userContext);
     }
     $ufGroupElement = $this->add('select', 'uf_group_id', ts('Select Profile'), array('' => ts('- select profile -')) + $profiles, TRUE, array('class' => 'crm-select2 huge'));
@@ -123,9 +116,6 @@ class CRM_Contact_Form_Task_PickProfile extends CRM_Contact_Form_Task {
 
   /**
    * Add local and global form rules.
-   *
-   *
-   * @return void
    */
   public function addRules() {
     $this->addFormRule(array('CRM_Contact_Form_Task_PickProfile', 'formRule'));
@@ -154,9 +144,6 @@ class CRM_Contact_Form_Task_PickProfile extends CRM_Contact_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     $params = $this->exportValues();
index 573454a24d284607b95d43d470dc5722f15273d7..a80f5f665fe9557e6b66e866d48532ad0339dda1 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -41,8 +39,6 @@ class CRM_Contact_Form_Task_Print extends CRM_Contact_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     parent::preprocess();
@@ -110,9 +106,6 @@ class CRM_Contact_Form_Task_Print extends CRM_Contact_Form_Task {
    * Build the form object - it consists of
    *    - displaying the QILL (query in local language)
    *    - displaying elements for saving the search
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     //
@@ -135,9 +128,6 @@ class CRM_Contact_Form_Task_Print extends CRM_Contact_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     // redirect to the main search page after printing is over
index 3660f4d8d0c7eaa8a8a587ddaa63ea71d45cdb4a..c4dc52aa9732ccfc25c1fbb327673d88200f0d0a 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class provides the functionality to support Proximity Searches
+ * This class provides the functionality to support Proximity Searches.
  */
 class CRM_Contact_Form_Task_ProximityCommon extends CRM_Contact_Form_Task {
 
@@ -61,8 +59,6 @@ class CRM_Contact_Form_Task_ProximityCommon extends CRM_Contact_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     // initialize the task and row fields
@@ -72,11 +68,8 @@ class CRM_Contact_Form_Task_ProximityCommon extends CRM_Contact_Form_Task {
   /**
    * Build the form object.
    *
-   *
    * @param CRM_Core_Form $form
-   * @param $proxSearch
-   *
-   * @return void
+   * @param int $proxSearch
    */
   public function buildQuickForm($form, $proxSearch) {
     // is proximity search required (2) or optional (1)?
index c4384bb3c95fbb0094036e3797432b5d982aeee2..664fba80e56585f5a339877f83cc2b71e4df973e 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -42,9 +40,6 @@ class CRM_Contact_Form_Task_RemoveFromGroup extends CRM_Contact_Form_Task {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     // add select for groups
@@ -73,9 +68,6 @@ class CRM_Contact_Form_Task_RemoveFromGroup extends CRM_Contact_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     $groupId = $this->controller->exportValue('RemoveFromGroup', 'group_id');
index 320090ac57d2062257d7ca3406e3317e29384c9e..d2d4820e03743cafbcfc99df9abfc2bcbc5c1b92 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -54,9 +52,6 @@ class CRM_Contact_Form_Task_RemoveFromTag extends CRM_Contact_Form_Task {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     // add select for tag
@@ -91,9 +86,6 @@ class CRM_Contact_Form_Task_RemoveFromTag extends CRM_Contact_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     //get the submitted values in an array
index 1a88df6732dbea1ab72e1626b7600c0c8d6a55e1..f3c4d11f76153e3898d5c0230ae8ce1bf63b1952 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
  * Used for displaying results
- *
- *
  */
 class CRM_Contact_Form_Task_Result extends CRM_Contact_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     $session = CRM_Core_Session::singleton();
@@ -98,8 +92,6 @@ class CRM_Contact_Form_Task_Result extends CRM_Contact_Form_Task {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $this->addButtons(array(
index 09a33e0f98c0f9a00063764483095f4787a75ee9..f9d21595925ee457ba36af975e6db7e23f37bfd5 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class provides the functionality to sms a group of
- * contacts.
+ * This class provides the functionality to sms a group of contacts.
  */
 class CRM_Contact_Form_Task_SMS extends CRM_Contact_Form_Task {
 
@@ -74,9 +71,6 @@ class CRM_Contact_Form_Task_SMS extends CRM_Contact_Form_Task {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     //enable form element
@@ -87,9 +81,6 @@ class CRM_Contact_Form_Task_SMS extends CRM_Contact_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     CRM_Contact_Form_Task_SMSCommon::postProcess($this);
index b48b0be9ca9ea21acdea2eb7aa65d804011a6f2f..23af8cecafea451af4b732467982da0556e412c6 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class provides the common functionality for sending sms to
- * one or a group of contact ids.
+ * This class provides the common functionality for sending sms to one or a group of contact ids.
  */
 class CRM_Contact_Form_Task_SMSCommon {
   const RECIEVED_SMS_ACTIVITY_SUBJECT = "SMS Received";
@@ -48,6 +45,8 @@ class CRM_Contact_Form_Task_SMSCommon {
 
 
   /**
+   * Pre process the provider.
+   *
    * @param CRM_Core_Form $form
    */
   public static function preProcessProvider(&$form) {
@@ -85,10 +84,7 @@ class CRM_Contact_Form_Task_SMSCommon {
   /**
    * Build the form object.
    *
-   *
    * @param CRM_Core_Form $form
-   *
-   * @return void
    */
   public static function buildQuickForm(&$form) {
 
@@ -341,10 +337,7 @@ class CRM_Contact_Form_Task_SMSCommon {
   /**
    * Process the form after the input has been submitted and validated.
    *
-   *
    * @param CRM_Core_Form $form
-   *
-   * @return void
    */
   public static function postProcess(&$form) {
 
index 357d9a919ebd08f80b185d438185ee3bfba2adb9..cb3fd33f45eeb209356d87ddc3816ced83fff3ae 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class provides the functionality to save a search
+ * This class provides the functionality to save a search.
+ *
  * Saved Searches are used for saving frequently used queries
  */
 class CRM_Contact_Form_Task_SaveSearch extends CRM_Contact_Form_Task {
@@ -48,8 +47,6 @@ class CRM_Contact_Form_Task_SaveSearch extends CRM_Contact_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     $this->_id = NULL;
@@ -75,12 +72,11 @@ class CRM_Contact_Form_Task_SaveSearch extends CRM_Contact_Form_Task {
   }
 
   /**
-   * Build the form object - it consists of
+   * Build the form object.
+   *
+   * It consists of
    *    - displaying the QILL (query in local language)
    *    - displaying elements for saving the search
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     // get the qill
@@ -147,9 +143,6 @@ class CRM_Contact_Form_Task_SaveSearch extends CRM_Contact_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     // saved search form values
index 2d52a15bc015dd0006e39d1e571b2d6f604470aa..5b9583eb129fe213e17e3a87c03c882b8aa6331e 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class provides the functionality to update a saved search
- *
+ * This class provides the functionality to update a saved search.
  */
 class CRM_Contact_Form_Task_SaveSearch_Update extends CRM_Contact_Form_Task_SaveSearch {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     parent::preProcess();
@@ -59,10 +54,6 @@ class CRM_Contact_Form_Task_SaveSearch_Update extends CRM_Contact_Form_Task_Save
 
   /**
    * Set default values for the form.
-   * the default values are retrieved from the database
-   *
-   *
-   * @return void
    */
   public function setDefaultValues() {
 
index 61ee1fed842b00ce4fe24aa91d25b358b7fdd3d2..e9ee12d71130ba8bd4431cff2dd6bf8a2ac660fb 100644 (file)
@@ -7,8 +7,6 @@ class CRM_Contact_Form_Task_Unhold extends CRM_Contact_Form_Task {
 
   /**
    * Set variables up before form is built.
-   *
-   * @return void
    */
   public function preProcess() {
     parent::preProcess();
index 837b8c72fbc4a1d0f8037fa24707575dfe138078..60e71357f74fbc7247eaa0cc7ee9f6e59fd70f3a 100755 (executable)
@@ -26,8 +26,7 @@
  */
 
 /**
- * This class generates form components generic to useradd
- *
+ * This class generates form components generic to useradd.
  */
 class CRM_Contact_Form_Task_Useradd extends CRM_Core_Form {
 
@@ -64,11 +63,7 @@ class CRM_Contact_Form_Task_Useradd extends CRM_Core_Form {
   }
 
   /**
-   * Set default values for the form. Note that in edit/view mode
-   * the default values are retrieved from the database
-   *
-   *
-   * @return void
+   * Set default values for the form.
    */
   public function setDefaultValues() {
     $defaults = array();
@@ -83,8 +78,6 @@ class CRM_Contact_Form_Task_Useradd extends CRM_Core_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $element = $this->add('text', 'name', ts('Full Name'), array('class' => 'huge'));
@@ -118,8 +111,7 @@ class CRM_Contact_Form_Task_Useradd extends CRM_Core_Form {
   }
 
   /**
-   *
-   * @return void
+   * Post process function.
    */
   public function postProcess() {
     // store the submitted values in an array
@@ -131,7 +123,6 @@ class CRM_Contact_Form_Task_Useradd extends CRM_Core_Form {
 
   /**
    * Validation Rule.
-   *
    */
   public static function usernameRule($params) {
     $config = CRM_Core_Config::singleton();
index 6f78b677d97d2d5d5a5e6a693fe1d4bf15a0e5ac..d2a661f21f5f277613883a7ffd13d3cebb70cecc 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Import_Controller extends CRM_Core_Controller {
 
index ca38d0a47ec6b400cad76fb16ce09012cd003764..65c8cab55fe472f794fe890b6d2951d8fe071687 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class delegates to the chosen DataSource to grab the data to be
- *  imported.
+ * This class delegates to the chosen DataSource to grab the data to be imported.
  */
 class CRM_Contact_Import_Form_DataSource extends CRM_Core_Form {
 
@@ -49,8 +46,6 @@ class CRM_Contact_Import_Form_DataSource extends CRM_Core_Form {
 
   /**
    * Set variables up before form is built.
-   *
-   * @return void
    */
   public function preProcess() {
 
@@ -128,8 +123,6 @@ class CRM_Contact_Import_Form_DataSource extends CRM_Core_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
 
@@ -295,10 +288,7 @@ class CRM_Contact_Import_Form_DataSource extends CRM_Core_Form {
   }
 
   /**
-   * Call the DataSource's postProcess method to take over
-   * and then setup some common data structures for the next step
-   *
-   * @return void
+   * Call the DataSource's postProcess method.
    */
   public function postProcess() {
     $this->controller->resetPage('MapField');
index 88b7c535a5738ee5d5b52c05ef715811efa0e7e3..2b14e69d429fd0c2ff25ce2d9b51bd23aa7951c0 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class gets the name of the file to upload
+ * This class gets the name of the file to upload.
  */
 class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField {
 
@@ -92,8 +90,6 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField {
 
   /**
    * Set variables up before form is built.
-   *
-   * @return void
    */
   public function preProcess() {
     $dataSource = $this->get('dataSource');
@@ -200,8 +196,6 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     //to save the current mappings
@@ -660,10 +654,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField {
   }
 
   /**
-   * Process the mapped fields and map it into the uploaded file
-   * preview the file and extract some summary statistics
-   *
-   * @return void
+   * Process the mapped fields and map it into the uploaded file.
    */
   public function postProcess() {
     $params = $this->controller->exportValues('MapField');
@@ -984,11 +975,12 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField {
 
   /**
    * Format custom field name.
-   * combine group and field name to avoid conflict.
    *
-   * @param $fields
+   * Combine group and field name to avoid conflict.
    *
-   * @return void
+   * @param array $fields
+   *
+   * @return array
    */
   public function formatCustomFieldName(&$fields) {
     //CRM-2676, replacing the conflict for same custom field name from different custom group.
index 5337e678e8cdabba0d27cb03c151dd97a0497838..714f8c33f201a9f3293a232ad0fc0e96cdbb0487 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class previews the uploaded file and returns summary
- * statistics
+ * This class previews the uploaded file and returns summary statistics.
  */
 class CRM_Contact_Import_Form_Preview extends CRM_Import_Form_Preview {
 
   /**
    * Set variables up before form is built.
-   *
-   * @return void
    */
   public function preProcess() {
     //get the data from the session
@@ -137,8 +132,6 @@ class CRM_Contact_Import_Form_Preview extends CRM_Import_Form_Preview {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $this->addElement('text', 'newGroupName', ts('Name for new group'));
@@ -250,10 +243,7 @@ class CRM_Contact_Import_Form_Preview extends CRM_Import_Form_Preview {
   }
 
   /**
-   * Process the mapped fields and map it into the uploaded file
-   * preview the file and extract some summary statistics
-   *
-   * @return void
+   * Process the mapped fields and map it into the uploaded file.
    */
   public function postProcess() {
 
@@ -343,10 +333,7 @@ class CRM_Contact_Import_Form_Preview extends CRM_Import_Form_Preview {
   }
 
   /**
-   * Process the mapped fields and map it into the uploaded file
-   * preview the file and extract some summary statistics
-   *
-   * @return void
+   * Process the mapped fields and map it into the uploaded file.
    */
   public function postProcessOld() {
 
index 565b536d6d4b1197ae5c6c3613d61e5cd8198404..c326ac76cdc4218debb71f2e25b8e22d58df2e10 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class summarizes the import results
+ * This class summarizes the import results.
  */
 class CRM_Contact_Import_Form_Summary extends CRM_Import_Form_Summary {
 
   /**
    * Set variables up before form is built.
-   *
-   * @return void
    */
   public function preProcess() {
     // set the error message path to display
@@ -125,8 +121,6 @@ class CRM_Contact_Import_Form_Summary extends CRM_Import_Form_Summary {
 
   /**
    * Clean up the import table we used.
-   *
-   * @return void
    */
   public function postProcess() {
     $dao = new CRM_Core_DAO();
index c9696e94b7d428bac6ddb35104ce28c753e93f0a..d1b9efdbe4976b31a1b1091e5e79c730e876a32e 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class acts like a psuedo-BAO for transient import job tables
+ * This class acts like a psuedo-BAO for transient import job tables.
  */
 class CRM_Contact_Import_ImportJob {
 
index 3ec69f117b0cce8a58c03a74b38621f7452c5cf0..90088f6be26e4a5da9e579c58cbe92baee419fc8 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
index d8ee4c0d32369dd05522544929166d66adec4dea..50ac2f340bc6c4441d04179d1fbe7671b494e285 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class contains all the function that are called using AJAX
+ * This class contains all the function that are called using AJAX.
  */
 class CRM_Contact_Import_Page_AJAX {
 
index 2550ec9bc9a159b41531db55865ed6f8162fc1bc..4aae2ad82a3990cdf041a6d9bee05ee9e759dc37 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser {
 
   protected $_tableName;
 
-  /**#@+
-   * @var integer
-   */
-
   /**
    * Total number of lines in file
+   *
+   * @var integer
    */
   protected $_rowCount;
 
   /**
-   * Running total number of un matched Conact
+   * Running total number of un-matched Contacts.
    */
   protected $_unMatchCount;
 
@@ -85,8 +81,10 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser {
   public $_dedupeRuleGroupID = NULL;
 
   /**
+   * Run import.
+   *
    * @param string $tableName
-   * @param $mapper
+   * @param array $mapper
    * @param int $mode
    * @param int $contactType
    * @param string $primaryKeyName
@@ -455,8 +453,6 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser {
    *
    * @param array $elements
    *   IM service provider type ids.
-   *
-   * @return void
    */
   public function setActiveFieldImProviders($elements) {
     for ($i = 0; $i < count($elements); $i++) {
@@ -501,7 +497,9 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser {
   }
 
   /**
-   * @param $elements
+   * Set active field for related contact's phone type.
+   *
+   * @param array $elements
    */
   public function setActiveFieldRelatedContactPhoneType($elements) {
     for ($i = 0; $i < count($elements); $i++) {
@@ -523,8 +521,6 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser {
    *
    * @param array $elements
    *   IM service provider type ids of related contact.
-   *
-   * @return void
    */
   public function setActiveFieldRelatedContactImProvider($elements) {
     for ($i = 0; $i < count($elements); $i++) {
@@ -667,8 +663,6 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser {
    * @param CRM_Core_Session $store
    *
    * @param int $mode
-   *
-   * @return void
    */
   public function set($store, $mode = self::MODE_SUMMARY) {
     $store->set('rowCount', $this->_rowCount);
@@ -731,8 +725,6 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser {
    * @param string $fileName
    * @param array $header
    * @param array $data
-   *
-   * @return void
    */
   public static function exportCSV($fileName, $header, $data) {
 
@@ -774,12 +766,10 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser {
   }
 
   /**
-   * Update the record with PK $id in the import database table
+   * Update the record with PK $id in the import database table.
    *
    * @param int $id
    * @param array $params
-   *
-   * @return void
    */
   public function updateImportRecord($id, &$params) {
     $statusFieldName = $this->_statusFieldName;
index 2a7a90f30a7af0e1c5b46f3f8612e6f8831abd35..4cc793b54923761382ff5ca044836da43fd62655 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 //@todo calling api functions directly is not supported
@@ -125,8 +123,6 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser {
 
   /**
    * The initializer code, called before the processing
-   *
-   * @return void
    */
   public function init() {
     $contactFields = CRM_Contact_BAO_Contact::importableFields($this->_contactType);
@@ -1091,9 +1087,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser {
   }
 
   /**
-   * The initializer code, called before the processing
-   *
-   * @return void
+   * The initializer code, called before the processing.
    */
   public function fini() {
   }
index 814986e0292b52843c888b21df69a932a7fd6f8a..9bcbc2f932dca57bd5e5e25e06da8a68f6d50257 100644 (file)
@@ -669,55 +669,211 @@ LIMIT {$offset}, {$rowCount}
     CRM_Utils_JSON::output(array('status' => ($status) ? $oper : $status));
   }
 
+  /**
+   * Retrieve list of duplicate pairs from cache table.
+   */
   public static function getDedupes() {
-
-    $sEcho = CRM_Utils_Type::escape($_REQUEST['sEcho'], 'Integer');
-    $offset = isset($_REQUEST['iDisplayStart']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayStart'], 'Integer') : 0;
-    $rowCount = isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
-    $sort = 'sort_name';
-    $sortOrder = isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
-
-    $gid = isset($_REQUEST['gid']) ? CRM_Utils_Type::escape($_REQUEST['gid'], 'Integer') : 0;
-    $rgid = isset($_REQUEST['rgid']) ? CRM_Utils_Type::escape($_REQUEST['rgid'], 'Integer') : 0;
+    $offset    = isset($_REQUEST['start']) ? CRM_Utils_Type::escape($_REQUEST['start'], 'Integer') : 0;
+    $rowCount  = isset($_REQUEST['length']) ? CRM_Utils_Type::escape($_REQUEST['length'], 'Integer') : 25;
+
+    $gid         = isset($_REQUEST['gid']) ? CRM_Utils_Type::escape($_REQUEST['gid'], 'Integer') : 0;
+    $rgid        = isset($_REQUEST['rgid']) ? CRM_Utils_Type::escape($_REQUEST['rgid'], 'Integer') : 0;
+    $selected    = isset($_REQUEST['selected']) ? CRM_Utils_Type::escape($_REQUEST['selected'], 'Integer') : 0;
+    if ($rowCount < 0) {
+      $rowCount = 0;
+    }
     $contactType = '';
     if ($rgid) {
       $contactType = CRM_Core_DAO::getFieldValue('CRM_Dedupe_DAO_RuleGroup', $rgid, 'contact_type');
     }
 
-    $cacheKeyString = "merge {$contactType}_{$rgid}_{$gid}";
-    $searchRows = array();
-    $selectorElements = array('src', 'dst', 'weight', 'actions');
+    $cacheKeyString   = "merge {$contactType}_{$rgid}_{$gid}";
+    $searchRows       = array();
+    $selectorElements = array('is_selected', 'is_selected_input', 'src_image', 'src', 'src_email', 'src_street', 'src_postcode', 'dst_image', 'dst', 'dst_email', 'dst_street', 'dst_postcode', 'conflicts', 'weight', 'actions');
 
-    $join = "LEFT JOIN civicrm_dedupe_exception de ON ( pn.entity_id1 = de.contact_id1 AND
-                                                             pn.entity_id2 = de.contact_id2 )";
-    $where = "de.id IS NULL";
+    foreach ($_REQUEST['columns'] as $columnInfo) {
+      if (!empty($columnInfo['search']['value'])) {
+        ${$columnInfo['data']} = CRM_Utils_Type::escape($columnInfo['search']['value'], 'String');
+      }
+    }
+    $join  = '';
+    $where = array();
+    $searchData = CRM_Utils_Array::value('search', $_REQUEST);
+    $searchData['value'] = CRM_Utils_Type::escape($searchData['value'], 'String');
+
+    if ($src || !empty($searchData['value'])) {
+      $src = $src ? $src : $searchData['value'];
+      $where[] = " cc1.display_name LIKE '%{$src}%'";
+    }
+    if ($dst || !empty($searchData['value'])) {
+      $dst = $dst ? $dst : $searchData['value'];
+      $where[] = " cc2.display_name LIKE '%{$dst}%'";
+    }
+    if ($src_email || !empty($searchData['value'])) {
+      $src_email = $src_email ? $src_email : $searchData['value'];
+      $where[] = " (ce1.is_primary = 1 AND ce1.email LIKE '%{$src_email}%')";
+    }
+    if ($dst_email || !empty($searchData['value'])) {
+      $dst_email = $dst_email ? $dst_email : $searchData['value'];
+      $where[] = " (ce2.is_primary = 1 AND ce2.email LIKE '%{$dst_email}%')";
+    }
+    if ($src_postcode || !empty($searchData['value'])) {
+      $src_postcode = $src_postcode ? $src_postcode : $searchData['value'];
+      $where[] = " (ca1.is_primary = 1 AND ca1.postal_code LIKE '%{$src_postcode}%')";
+    }
+    if ($dst_postcode || !empty($searchData['value'])) {
+      $dst_postcode = $dst_postcode ? $dst_postcode : $searchData['value'];
+      $where[] = " (ca2.is_primary = 1 AND ca2.postal_code LIKE '%{$dst_postcode}%')";
+    }
+    if ($src_street || !empty($searchData['value'])) {
+      $src_street = $src_street ? $src_street : $searchData['value'];
+      $where[] = " (ca1.is_primary = 1 AND ca1.street_address LIKE '%{$src_street}%')";
+    }
+    if ($dst_street || !empty($searchData['value'])) {
+      $dst_street = $dst_street ? $dst_street : $searchData['value'];
+      $where[] = " (ca2.is_primary = 1 AND ca2.street_address LIKE '%{$dst_street}%')";
+    }
+    if (!empty($searchData['value'])) {
+      $whereClause   = ' ( ' . implode(' OR ', $where) . ' ) ';
+    }
+    else {
+      if (!empty($where)) {
+        $whereClause  = implode(' AND ', $where);
+      }
+    }
+    $whereClause .= $whereClause ? ' AND de.id IS NULL' : ' de.id IS NULL';
 
-    $iFilteredTotal = $iTotal = CRM_Core_BAO_PrevNextCache::getCount($cacheKeyString, $join, $where);
-    $mainContacts = CRM_Core_BAO_PrevNextCache::retrieve($cacheKeyString, $join, $where, $offset, $rowCount);
+    if ($selected) {
+      $whereClause .= ' AND pn.is_selected = 1';
+    }
+    $join .= " LEFT JOIN civicrm_dedupe_exception de ON ( pn.entity_id1 = de.contact_id1 AND pn.entity_id2 = de.contact_id2 )";
+
+    $select = array(
+      'cc1.contact_type'     => 'src_contact_type',
+      'cc1.display_name'     => 'src_display_name',
+      'cc1.contact_sub_type' => 'src_contact_sub_type',
+      'cc2.contact_type'     => 'dst_contact_type',
+      'cc2.display_name'     => 'dst_display_name',
+      'cc2.contact_sub_type' => 'dst_contact_sub_type',
+      'ce1.email'            => 'src_email',
+      'ce2.email'            => 'dst_email',
+      'ca1.postal_code'      => 'src_postcode',
+      'ca2.postal_code'      => 'dst_postcode',
+      'ca1.street_address'   => 'src_street',
+      'ca2.street_address'   => 'dst_street',
+    );
+
+    if ($select) {
+      $join .= " INNER JOIN civicrm_contact cc1 ON cc1.id = pn.entity_id1";
+      $join .= " INNER JOIN civicrm_contact cc2 ON cc2.id = pn.entity_id2";
+      $join .= " LEFT JOIN civicrm_email ce1 ON (ce1.contact_id = pn.entity_id1 AND ce1.is_primary = 1 )";
+      $join .= " LEFT JOIN civicrm_email ce2 ON (ce2.contact_id = pn.entity_id2 AND ce2.is_primary = 1 )";
+      $join .= " LEFT JOIN civicrm_address ca1 ON (ca1.contact_id = pn.entity_id1 AND ca1.is_primary = 1 )";
+      $join .= " LEFT JOIN civicrm_address ca2 ON (ca2.contact_id = pn.entity_id2 AND ca2.is_primary = 1 )";
+    }
+    $iTotal = CRM_Core_BAO_PrevNextCache::getCount($cacheKeyString, $join, $whereClause);
+    foreach ($_REQUEST['order'] as $orderInfo) {
+      if (!empty($orderInfo['column'])) {
+        $orderColumnNumber = $orderInfo['column'];
+        $dir               = $orderInfo['dir'];
+      }
+    }
+    $columnDetails = CRM_Utils_Array::value($orderColumnNumber, $_REQUEST['columns']);
+    if (!empty($columnDetails)) {
+      switch ($columnDetails['data']) {
+        case 'src':
+          $whereClause .= " ORDER BY cc1.display_name {$dir}";
+          break;
+
+        case 'src_email':
+          $whereClause .= " ORDER BY ce1.email {$dir}";
+          break;
+
+        case 'src_street':
+          $whereClause .= " ORDER BY ca1.street_address {$dir}";
+          break;
+
+        case 'src_postcode':
+          $whereClause .= " ORDER BY ca1.postal_code {$dir}";
+          break;
+
+        case 'dst':
+          $whereClause .= " ORDER BY cc2.display_name {$dir}";
+          break;
+
+        case 'dst_email':
+          $whereClause .= " ORDER BY ce2.email {$dir}";
+          break;
+
+        case 'dst_street':
+          $whereClause .= " ORDER BY ca2.street_address {$dir}";
+          break;
+
+        case 'dst_postcode':
+          $whereClause .= " ORDER BY ca2.postal_code {$dir}";
+          break;
+
+        default:
+          break;
+      }
+    }
 
-    foreach ($mainContacts as $mainId => $main) {
-      $searchRows[$mainId]['src'] = CRM_Utils_System::href($main['srcName'], 'civicrm/contact/view', "reset=1&cid={$main['srcID']}");
-      $searchRows[$mainId]['dst'] = CRM_Utils_System::href($main['dstName'], 'civicrm/contact/view', "reset=1&cid={$main['dstID']}");
-      $searchRows[$mainId]['weight'] = CRM_Utils_Array::value('weight', $main);
+    $dupePairs = CRM_Core_BAO_PrevNextCache::retrieve($cacheKeyString, $join, $whereClause, $offset, $rowCount, $select);
+    $iFilteredTotal = CRM_Core_DAO::singleValueQuery("SELECT FOUND_ROWS()");
+
+    $count = 0;
+    foreach ($dupePairs as $key => $pairInfo) {
+      $pair =& $pairInfo['data'];
+      $srcContactSubType  = CRM_Utils_Array::value('src_contact_sub_type', $pairInfo);
+      $dstContactSubType  = CRM_Utils_Array::value('dst_contact_sub_type', $pairInfo);
+      $srcTypeImage = CRM_Contact_BAO_Contact_Utils::getImage($srcContactSubType ?
+        $srcContactSubType : $pairInfo['src_contact_type'],
+        FALSE,
+        $pairInfo['entity_id1']
+      );
+      $dstTypeImage = CRM_Contact_BAO_Contact_Utils::getImage($dstContactSubType ?
+        $dstContactSubType : $pairInfo['dst_contact_type'],
+        FALSE,
+        $pairInfo['entity_id2']
+      );
 
-      if (!empty($main['canMerge'])) {
-        $mergeParams = "reset=1&cid={$main['srcID']}&oid={$main['dstID']}&action=update&rgid={$rgid}";
+      $searchRows[$count]['is_selected'] = $pairInfo['is_selected'];
+      $searchRows[$count]['is_selected_input'] = "<input type='checkbox' class='crm-dedupe-select' name='pnid_{$pairInfo['prevnext_id']}' value='{$pairInfo['is_selected']}' onclick='toggleDedupeSelect(this)'>";
+      $searchRows[$count]['src_image'] = $srcTypeImage;
+      $searchRows[$count]['src'] = CRM_Utils_System::href($pair['srcName'], 'civicrm/contact/view', "reset=1&cid={$pairInfo['entity_id1']}");
+      $searchRows[$count]['src_email'] = CRM_Utils_Array::value('src_email', $pairInfo);
+      $searchRows[$count]['src_street'] = CRM_Utils_Array::value('src_street', $pairInfo);
+      $searchRows[$count]['src_postcode'] = CRM_Utils_Array::value('src_postcode', $pairInfo);
+      $searchRows[$count]['dst_image'] = $dstTypeImage;
+      $searchRows[$count]['dst'] = CRM_Utils_System::href($pair['dstName'], 'civicrm/contact/view', "reset=1&cid={$pairInfo['entity_id2']}");
+      $searchRows[$count]['dst_email'] = CRM_Utils_Array::value('dst_email', $pairInfo);
+      $searchRows[$count]['dst_street'] = CRM_Utils_Array::value('dst_street', $pairInfo);
+      $searchRows[$count]['dst_postcode'] = CRM_Utils_Array::value('dst_postcode', $pairInfo);
+      $searchRows[$count]['conflicts'] = str_replace("',", "',<br/>", CRM_Utils_Array::value('conflicts', $pair));
+      $searchRows[$count]['weight'] = CRM_Utils_Array::value('weight', $pair);
+
+      if (!empty($pairInfo['data']['canMerge'])) {
+        $mergeParams = "reset=1&cid={$pairInfo['entity_id1']}&oid={$pairInfo['entity_id2']}&action=update&rgid={$rgid}";
         if ($gid) {
           $mergeParams .= "&gid={$gid}";
         }
 
-        $searchRows[$mainId]['actions'] = '<a class="action-item crm-hover-button" href="' . CRM_Utils_System::url('civicrm/contact/merge', $mergeParams) . '">' . ts('merge') . '</a>';
-        $searchRows[$mainId]['actions'] .= "<a class='action-item crm-hover-button crm-notDuplicate' href='#' onClick=\"processDupes( {$main['srcID']}, {$main['dstID']}, 'dupe-nondupe', 'dupe-listing'); return false;\">" . ts('not a duplicate') . "</a>";
+        $searchRows[$count]['actions']  = "<a class='crm-dedupe-flip' href='#' data-pnid={$pairInfo['prevnext_id']}>" . ts('flip') . "</a>&nbsp;|&nbsp;";
+        $searchRows[$count]['actions'] .= CRM_Utils_System::href(ts('merge'), 'civicrm/contact/merge', $mergeParams);
+        $searchRows[$count]['actions'] .= "&nbsp;|&nbsp;<a id='notDuplicate' href='#' onClick=\"processDupes( {$pairInfo['entity_id1']}, {$pairInfo['entity_id2']}, 'dupe-nondupe', 'dupe-listing'); return false;\">" . ts('not a duplicate') . "</a>";
       }
       else {
-        $searchRows[$mainId]['actions'] = '<em>' . ts('Insufficient access rights - cannot merge') . '</em>';
+        $searchRows[$count]['actions'] = '<em>' . ts('Insufficient access rights - cannot merge') . '</em>';
       }
+      $count++;
     }
 
-    CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
-    echo CRM_Utils_JSON::encodeDataTableSelector($searchRows, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
-
-    CRM_Utils_System::civiExit();
+    $dupePairs = array(
+      'data'            => $searchRows,
+      'recordsTotal'    => $iTotal,
+      'recordsFiltered' => $iFilteredTotal,
+    );
+    CRM_Utils_JSON::output($dupePairs);
   }
 
   /**
@@ -742,6 +898,30 @@ LIMIT {$offset}, {$rowCount}
     CRM_Utils_JSON::output($paperSize);
   }
 
+  /**
+   * Swap contacts in a dupe pair i.e main with duplicate contact.
+   */
+  public static function flipDupePairs($prevNextId = NULL) {
+    if (!$prevNextId) {
+      $prevNextId = $_REQUEST['pnid'];
+    }
+    $query = "
+      UPDATE civicrm_prevnext_cache cpc
+      INNER JOIN civicrm_prevnext_cache old on cpc.id = old.id 
+      SET cpc.entity_id1 = cpc.entity_id2, cpc.entity_id2 = old.entity_id1 ";
+    if (is_array($prevNextId) && !CRM_Utils_Array::crmIsEmptyArray($prevNextId)) {
+      $prevNextId = implode(', ', $prevNextId);
+      $prevNextId = CRM_Utils_Type::escape($prevNextId, 'String');
+      $query     .= "WHERE cpc.id IN ({$prevNextId}) AND cpc.is_selected = 1";
+    }
+    else {
+      $prevNextId = CRM_Utils_Type::escape($prevNextId, 'Positive');
+      $query     .= "WHERE cpc.id = $prevNextId";
+    }
+    CRM_Core_DAO::executeQuery($query);
+    CRM_Utils_JSON::output();
+  }
+
   /**
    * Used to store selected contacts across multiple pages in advanced search.
    */
@@ -807,6 +987,44 @@ LIMIT {$offset}, {$rowCount}
     CRM_Utils_JSON::output($addressVal);
   }
 
+  /**
+   * Mark dupe pairs as selected from un-selected state or vice-versa, in dupe cache table.
+   */
+  public static function toggleDedupeSelect() {
+    $rgid = CRM_Utils_Type::escape($_REQUEST['rgid'], 'Integer');
+    $gid  = CRM_Utils_Type::escape($_REQUEST['gid'], 'Integer');
+    $pnid = $_REQUEST['pnid'];
+    $isSelected = CRM_Utils_Type::escape($_REQUEST['is_selected'], 'Boolean');
+
+    $contactType = CRM_Core_DAO::getFieldValue('CRM_Dedupe_DAO_RuleGroup', $rgid, 'contact_type');
+    $cacheKeyString  = "merge $contactType";
+    $cacheKeyString .= $rgid ? "_{$rgid}" : '_0';
+    $cacheKeyString .= $gid ? "_{$gid}" : '_0';
+
+    $params = array(
+      1 => array($isSelected, 'Boolean'),
+      3 => array("$cacheKeyString%", 'String'), // using % to address rows with conflicts as well
+    );
+
+    //check pnid is_array or integer
+    $whereClause = NULL;
+    if (is_array($pnid) && !CRM_Utils_Array::crmIsEmptyArray($pnid)) {
+      $pnid = implode(', ', $pnid);
+      $pnid = CRM_Utils_Type::escape($pnid, 'String');
+      $whereClause = " id IN ( {$pnid} ) ";
+    }
+    else {
+      $pnid = CRM_Utils_Type::escape($pnid, 'Integer');
+      $whereClause = " id = %2";
+      $params[2]   = array($pnid, 'Integer');
+    }
+
+    $sql = "UPDATE civicrm_prevnext_cache SET is_selected = %1 WHERE {$whereClause} AND cacheKey LIKE %3";
+    CRM_Core_DAO::executeQuery($sql, $params);
+
+    CRM_Utils_System::civiExit();
+  }
+
   /**
    * Retrieve contact relationships.
    */
index 64a39ae464566295e818b682de0465e75d70e5b0..c0c7499ef568ab6821a1566f1e0deafc828c89d7 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
  * Main page for viewing all Saved searches.
- *
  */
 class CRM_Contact_Page_CustomSearch extends CRM_Core_Page {
 
@@ -89,8 +86,6 @@ ORDER By  v.weight
 
   /**
    * Run this page (figure out the action needed and perform it).
-   *
-   * @return void
    */
   public function run() {
     $action = CRM_Utils_Request::retrieve('action',
index ed97dbc589d6d7a9d5f9ac15069bcfa3565792a7..3e50cd5cfe8f301841d40d4212537d14cdcf3c62 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * CiviCRM Dashboard
- *
+ * CiviCRM Dashboard.
  */
 class CRM_Contact_Page_DashBoard extends CRM_Core_Page {
 
   /**
    * Run dashboard.
-   *
-   * @return void
    */
   public function run() {
     // Add dashboard js and css
index deae061a2bfe9687b6544b58d0f2ec2275cd9703..721e0559cd8d1f2865c46912cd54029d49bacaa1 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * CiviCRM Dashlet
- *
+ * CiviCRM Dashlet.
  */
 class CRM_Contact_Page_Dashlet extends CRM_Core_Page {
 
   /**
    * Run dashboard.
-   *
-   * @return void
    */
   public function run() {
     CRM_Utils_System::setTitle(ts('Dashlets'));
index ea75e24af57d7709ddcbc57c98f62e55832b7465..3ce43ca50b7c993e4d7f2763d775156a8c6b5a9d 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
  * Main page for viewing contact.
- *
  */
 class CRM_Contact_Page_DedupeException extends CRM_Core_Page {
 
   /**
-   * Heart of the viewing process. The runner gets all the meta data for
-   * the contact and calls the appropriate type of page to view.
+   * Heart of the viewing process.
    *
-   * @return void
+   * The runner gets all the meta data for the contact and calls the appropriate type of page to view.
    */
   public function preProcess() {
     //fetch the dedupe exception contacts.
index e02e9d26471e0db700f5145d3f2ef56554f109c5..1820a8471550da7d0a56fcb6d9aabf879bf514bb 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Page_DedupeFind extends CRM_Core_Page_Basic {
   protected $_cid = NULL;
@@ -50,17 +48,12 @@ class CRM_Contact_Page_DedupeFind extends CRM_Core_Page_Basic {
 
   /**
    * Get action Links.
-   *
-   * @return void
-   *   (reference) of action links
    */
   public function &links() {
   }
 
   /**
    * Browse all rule groups.
-   *
-   * @return void
    */
   public function run() {
     $gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this, FALSE, 0);
@@ -94,7 +87,7 @@ class CRM_Contact_Page_DedupeFind extends CRM_Core_Page_Basic {
     elseif ($action & CRM_Core_Action::MAP) {
       // do a batch merge if requested
       $rgid = CRM_Utils_Request::retrieve('rgid', 'Positive', $this, FALSE, 0);
-      $result = CRM_Dedupe_Merger::batchMerge($rgid, $gid, 'safe', TRUE, TRUE);
+      $result = CRM_Dedupe_Merger::batchMerge($rgid, $gid, 'safe', TRUE, 75);
 
       $skippedCount = CRM_Utils_Request::retrieve('skipped', 'Positive', $this, FALSE, 0);
       $skippedCount = $skippedCount + count($result['skipped']);
@@ -157,6 +150,9 @@ class CRM_Contact_Page_DedupeFind extends CRM_Core_Page_Basic {
       if ($rgid) {
         $sourceParams .= "&rgid={$rgid}";
       }
+      if ($context == 'conflicts') {
+        $sourceParams .= "&selected=1";
+      }
 
       $this->assign('sourceUrl', CRM_Utils_System::url('civicrm/ajax/dedupefind', $sourceParams, FALSE, NULL, FALSE));
 
@@ -165,11 +161,31 @@ class CRM_Contact_Page_DedupeFind extends CRM_Core_Page_Basic {
       $cacheKeyString .= $rgid ? "_{$rgid}" : '_0';
       $cacheKeyString .= $gid ? "_{$gid}" : '_0';
 
+      $stats = CRM_Dedupe_Merger::getMergeStatsMsg($cacheKeyString);
+      if ($stats) {
+        CRM_Core_Session::setStatus($stats);
+        // reset so we not displaying same message again
+        CRM_Dedupe_Merger::resetMergeStats($cacheKeyString);
+      }
       $join = "LEFT JOIN civicrm_dedupe_exception de ON ( pn.entity_id1 = de.contact_id1 AND
                                                                  pn.entity_id2 = de.contact_id2 )";
       $where = "de.id IS NULL";
+      if ($context == 'conflicts') {
+        $where .= " AND pn.is_selected = 1";
+      }
       $this->_mainContacts = CRM_Core_BAO_PrevNextCache::retrieve($cacheKeyString, $join, $where);
       if (empty($this->_mainContacts)) {
+        if ($context == 'conflicts') {
+          // if the current screen was intended to list only selected contacts, move back to full dupe list
+          $sourceParams = 'reset=1&action=update';
+          if ($gid) {
+            $sourceParams .= "&gid={$gid}";
+          }
+          if ($rgid) {
+            $sourceParams .= "&rgid={$rgid}";
+          }
+          CRM_Utils_System::redirect(CRM_Utils_System::url(CRM_Utils_System::currentPath(), $sourceParams));
+        }
         if ($gid) {
           $foundDupes = $this->get("dedupe_dupes_$gid");
           if (!$foundDupes) {
@@ -315,8 +331,6 @@ class CRM_Contact_Page_DedupeFind extends CRM_Core_Page_Basic {
 
   /**
    * Browse all rule groups.
-   *
-   * @return void
    */
   public function browse() {
     $this->assign('main_contacts', $this->_mainContacts);
diff --git a/CRM/Contact/Page/DedupeMerge.php b/CRM/Contact/Page/DedupeMerge.php
new file mode 100644 (file)
index 0000000..49f6bc8
--- /dev/null
@@ -0,0 +1,133 @@
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.5                                                |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM.                                    |
+ |                                                                    |
+ | CiviCRM is free software; you can copy, modify, and distribute it  |
+ | under the terms of the GNU Affero General Public License           |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
+ |                                                                    |
+ | CiviCRM is distributed in the hope that it will be useful, but     |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of         |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
+ | See the GNU Affero General Public License for more details.        |
+ |                                                                    |
+ | You should have received a copy of the GNU Affero General Public   |
+ | License and the CiviCRM Licensing Exception along                  |
+ | with this program; if not, contact CiviCRM LLC                     |
+ | at info[AT]civicrm[DOT]org. If you have questions about the        |
+ | GNU Affero General Public License or the licensing of CiviCRM,     |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+ +--------------------------------------------------------------------+
+ */
+
+/**
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC (c) 2004-2014
+ */
+class CRM_Contact_Page_DedupeMerge extends CRM_Core_Page {
+
+  const BATCHLIMIT = 2;
+
+  /**
+   * Browse batch merges.
+   */
+  public function run() {
+    $runner = self::getRunner();
+    if ($runner) {
+      // Run Everything in the Queue via the Web.
+      $runner->runAllViaWeb();
+    }
+    else {
+      CRM_Core_Session::setStatus(ts('Nothing to merge.'));
+    }
+
+    // parent run
+    return parent::run();
+  }
+
+  /**
+   * Build a queue of tasks by dividing dupe pairs in batches.
+   */
+  public static function getRunner() {
+    $rgid = CRM_Utils_Request::retrieve('rgid', 'Positive', $this, FALSE, 0);
+    $gid  = CRM_Utils_Request::retrieve('gid', 'Positive', $this, FALSE, 0);
+    $action = CRM_Utils_Request::retrieve('action', 'String', CRM_Core_DAO::$_nullObject);
+    $mode   = CRM_Utils_Request::retrieve('mode', 'String', CRM_Core_DAO::$_nullObject, FALSE, 'safe');
+
+    $contactType = CRM_Core_DAO::getFieldValue('CRM_Dedupe_DAO_RuleGroup', $rgid, 'contact_type');
+    $cacheKeyString = "merge {$contactType}";
+    $cacheKeyString .= $rgid ? "_{$rgid}" : '_0';
+    $cacheKeyString .= $gid ? "_{$gid}" : '_0';
+
+    $urlQry = "reset=1&action=update&rgid={$rgid}";
+    $urlQry = $gid ? ($urlQry . "&gid={$gid}") : $urlQry;
+
+    if ($mode == 'aggressive' && !CRM_Core_Permission::check('force merge duplicate contacts')) {
+      CRM_Core_Session::setStatus(ts('You do not have permission to force merge duplicate contact records'), ts('Permission Denied'), 'error');
+      CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/dedupefind', $urlQry));
+    }
+    // Setup the Queue
+    $queue = CRM_Queue_Service::singleton()->create(array(
+      'name'  => $cacheKeyString,
+      'type'  => 'Sql',
+      'reset' => TRUE,
+    ));
+
+    $where = NULL;
+    if ($action == CRM_Core_Action::MAP) {
+      $where = "pn.is_selected = 1";
+      $isSelected = 1;
+    }
+    else {
+      // else merge all (2)
+      $isSelected = 2;
+    }
+
+    $total  = CRM_Core_BAO_PrevNextCache::getCount($cacheKeyString, NULL, $where);
+    if ($total <= 0) {
+      // Nothing to do.
+      CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/dedupefind', $urlQry));
+    }
+
+    // reset merge stats, so we compute new stats
+    CRM_Dedupe_Merger::resetMergeStats($cacheKeyString);
+
+    for ($i = 1; $i <= ceil($total / self::BATCHLIMIT); $i++) {
+      $task  = new CRM_Queue_Task(
+        array('CRM_Contact_Page_DedupeMerge', 'callBatchMerge'),
+        array($rgid, $gid, $mode, TRUE, self::BATCHLIMIT, $isSelected),
+        "Processed " . $i * self::BATCHLIMIT . " pair of duplicates out of " . $total
+      );
+
+      // Add the Task to the Queue
+      $queue->createItem($task);
+    }
+
+    // Setup the Runner
+    $urlQry .= "&context=conflicts";
+    $runner = new CRM_Queue_Runner(array(
+      'title'     => ts('Merging Duplicates..'),
+      'queue'     => $queue,
+      'errorMode' => CRM_Queue_Runner::ERROR_ABORT,
+      'onEndUrl'  => CRM_Utils_System::url('civicrm/contact/dedupefind', $urlQry, TRUE, NULL, FALSE),
+    ));
+
+    return $runner;
+  }
+
+  /**
+   * Carry out batch merges.
+   */
+  public static function callBatchMerge(CRM_Queue_TaskContext $ctx, $rgid, $gid = NULL, $mode = 'safe', $autoFlip = TRUE, $batchLimit = 1, $isSelected = 2) {
+    $result = CRM_Dedupe_Merger::batchMerge($rgid, $gid, $mode, $autoFlip, $batchLimit, $isSelected);
+
+    return CRM_Queue_Task::TASK_SUCCESS;
+  }
+
+}
index e4364f1adc8dfdd83b7f255a042965f47a17224a..56e3dec39be5dbeff690a90c675d44c283e7d490 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Page_DedupeRules extends CRM_Core_Page_Basic {
 
@@ -99,8 +97,6 @@ class CRM_Contact_Page_DedupeRules extends CRM_Core_Page_Basic {
    * This method is called after the page is created. It checks for the type
    * of action and executes that action. Finally it calls the parent's run
    * method.
-   *
-   * @return void
    */
   public function run() {
     // get the requested action, default to 'browse'
@@ -136,8 +132,6 @@ class CRM_Contact_Page_DedupeRules extends CRM_Core_Page_Basic {
 
   /**
    * Browse all rule groups.
-   *
-   * @return void
    */
   public function browse() {
     // get all rule groups
index 69b094b63a7b8de0e5239774c3dd30dfa25d9196..c978901dcf15b881ff2312e724806ee2c555dc49 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Page_ImageFile extends CRM_Core_Page {
   /**
@@ -40,6 +38,11 @@ class CRM_Contact_Page_ImageFile extends CRM_Core_Page {
    */
   private $ttl = 43200;
 
+  /**
+   * Run page.
+   *
+   * @throws \Exception
+   */
   public function run() {
     if (!preg_match('/^[^\/]+\.(jpg|jpeg|png|gif)$/i', $_GET['photo'])) {
       CRM_Core_Error::fatal('Malformed photo name');
@@ -51,6 +54,7 @@ class CRM_Contact_Page_ImageFile extends CRM_Core_Page {
       1 => array("%" . $_GET['photo'], 'String'),
     );
     $dao = CRM_Core_DAO::executeQuery($sql, $params);
+    $cid = NULL;
     while ($dao->fetch()) {
       $cid = $dao->id;
     }
@@ -69,6 +73,8 @@ class CRM_Contact_Page_ImageFile extends CRM_Core_Page {
   }
 
   /**
+   * Download image.
+   *
    * @param string $file
    *   Local file path.
    * @param string $mimeType
@@ -79,7 +85,8 @@ class CRM_Contact_Page_ImageFile extends CRM_Core_Page {
     if (!file_exists($file)) {
       header("HTTP/1.0 404 Not Found");
       return;
-    } elseif (!is_readable($file)) {
+    }
+    elseif (!is_readable($file)) {
       header('HTTP/1.0 403 Forbidden');
       return;
     }
index 9e27f35c808a3d2d001e33c11ad47b2342849eb9..614451c0e59d7f40f76771833a55e840d58a63f8 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Dummy page for actions button
- *
+ * Dummy page for actions button.
  */
 class CRM_Contact_Page_Inline_Actions extends CRM_Core_Page {
 
@@ -43,8 +40,6 @@ class CRM_Contact_Page_Inline_Actions extends CRM_Core_Page {
    * Run the page.
    *
    * This method is called after the page is created.
-   *
-   * @return void
    */
   public function run() {
     $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
index fbe3c03ee4ea677249ddab03b14006db32ab8808..9bd28348547f4f941258d022a4e4a8fae716f735 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Dummy page for details of address
- *
+ * Dummy page for details of address.
  */
 class CRM_Contact_Page_Inline_Address extends CRM_Core_Page {
 
@@ -43,8 +40,6 @@ class CRM_Contact_Page_Inline_Address extends CRM_Core_Page {
    * Run the page.
    *
    * This method is called after the page is created.
-   *
-   * @return void
    */
   public function run() {
     // get the emails for this contact
index b89e51ed37093c2580b96765cc6c3bacc5981cfe..646f2228b508a8ee26bf50e2143e7c56d391dd66 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Dummy page for details of communication preferences
- *
+ * Dummy page for details of communication preferences.
  */
 class CRM_Contact_Page_Inline_CommunicationPreferences extends CRM_Core_Page {
 
@@ -43,8 +40,6 @@ class CRM_Contact_Page_Inline_CommunicationPreferences extends CRM_Core_Page {
    * Run the page.
    *
    * This method is called after the page is created.
-   *
-   * @return void
    */
   public function run() {
     // get the emails for this contact
index 0439b9f3a19cfe6335a7b5ff29590d181a20634f..ec9a5cc0303a83b5d4f2f061a30b16220b759e8f 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page to disply contact information on topi of summary
- *
+ * Page to display contact information on top of summary.
  */
 class CRM_Contact_Page_Inline_ContactInfo extends CRM_Core_Page {
 
@@ -43,8 +40,6 @@ class CRM_Contact_Page_Inline_ContactInfo extends CRM_Core_Page {
    * Run the page.
    *
    * This method is called after the page is created.
-   *
-   * @return void
    */
   public function run() {
     // get the emails for this contact
index 1f92e66678fa856472faa4b57c28705726bbf1c7..7db5a76c5ce05332761edbcbecc57184311312c1 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page to disply contact name on top of the summary
- *
+ * Page to display contact name on top of the summary.
  */
 class CRM_Contact_Page_Inline_ContactName extends CRM_Core_Page {
 
@@ -43,8 +40,6 @@ class CRM_Contact_Page_Inline_ContactName extends CRM_Core_Page {
    * Run the page.
    *
    * This method is called after the page is created.
-   *
-   * @return void
    */
   public function run() {
     // get the emails for this contact
index 31385a1b527f9705f5ad769810de921fe966e1ed..98374a2f8c18a456d781af12d7bc704a2340a2ab 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This page displays custom data during inline edit
- *
+ * This page displays custom data during inline edit.
  */
 class CRM_Contact_Page_Inline_CustomData extends CRM_Core_Page {
 
@@ -43,8 +40,6 @@ class CRM_Contact_Page_Inline_CustomData extends CRM_Core_Page {
    * Run the page.
    *
    * This method is called after the page is created.
-   *
-   * @return void
    */
   public function run() {
     // get the emails for this contact
index 8cb6cabeed519f594ae5f73ebaaa3e3b5be35f56..af8b06b224f50b6af968a56a5d1701381fdfe11c 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Dummy page for details of demographics
- *
+ * Dummy page for details of demographics.
  */
 class CRM_Contact_Page_Inline_Demographics extends CRM_Core_Page {
 
@@ -43,8 +40,6 @@ class CRM_Contact_Page_Inline_Demographics extends CRM_Core_Page {
    * Run the page.
    *
    * This method is called after the page is created.
-   *
-   * @return void
    */
   public function run() {
     // get the emails for this contact
index aec1dd08697bbddacf9050dd5c974649ef365d80..efcace3c3580fd5313dc075a3463e89bc2bfe7b0 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Dummy page for details of Email
- *
+ * Dummy page for details of Email.
  */
 class CRM_Contact_Page_Inline_Email extends CRM_Core_Page {
 
@@ -43,8 +40,6 @@ class CRM_Contact_Page_Inline_Email extends CRM_Core_Page {
    * Run the page.
    *
    * This method is called after the page is created.
-   *
-   * @return void
    */
   public function run() {
     // get the emails for this contact
index 5cb3dc409161b5110a817dca6e085b2aa5195a6f..d7e6736a4c90e10df59bab612379ab0c275b5edc 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Dummy page for details for IM
- *
+ * Dummy page for details for IM.
  */
 class CRM_Contact_Page_Inline_IM extends CRM_Core_Page {
 
@@ -43,8 +40,6 @@ class CRM_Contact_Page_Inline_IM extends CRM_Core_Page {
    * Run the page.
    *
    * This method is called after the page is created.
-   *
-   * @return void
    */
   public function run() {
     // get the emails for this contact
index d48b8ac9497bc1145a4dce8647172813bdebf8bc..72ab101432e0f24d82e9466ce93d8e1c1740231b 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Dummy page for details for OpenID
- *
+ * Dummy page for details for OpenID.
  */
 class CRM_Contact_Page_Inline_OpenID extends CRM_Core_Page {
 
@@ -43,8 +40,6 @@ class CRM_Contact_Page_Inline_OpenID extends CRM_Core_Page {
    * Run the page.
    *
    * This method is called after the page is created.
-   *
-   * @return void
    */
   public function run() {
     // get the emails for this contact
index 20282a8e727c1a65b9cd34c680831ecb418d3857..6a3388cdef0d4553ae222f678837041a7090a115 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Dummy page for details of Phone
- *
+ * Dummy page for details of Phone.
  */
 class CRM_Contact_Page_Inline_Phone extends CRM_Core_Page {
 
@@ -43,8 +40,6 @@ class CRM_Contact_Page_Inline_Phone extends CRM_Core_Page {
    * Run the page.
    *
    * This method is called after the page is created.
-   *
-   * @return void
    */
   public function run() {
     // get the emails for this contact
index ec8d660375cb7796b4b933bd7c894eff1eb258bb..bea1d498ef826092149704ae9d05cb4561d50d71 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Dummy page for details of website
- *
+ * Dummy page for details of website.
  */
 class CRM_Contact_Page_Inline_Website extends CRM_Core_Page {
 
@@ -43,8 +40,6 @@ class CRM_Contact_Page_Inline_Website extends CRM_Core_Page {
    * Run the page.
    *
    * This method is called after the page is created.
-   *
-   * @return void
    */
   public function run() {
     // get the emails for this contact
index 92cad7fcb93dd5f4ab552de58bfe3bdc2feb1431..54091dcf8666512b635dd9f23065593abad5bcb5 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
  * Main page for viewing all Saved searches.
- *
  */
 class CRM_Contact_Page_SavedSearch extends CRM_Core_Page {
 
@@ -51,8 +48,6 @@ class CRM_Contact_Page_SavedSearch extends CRM_Core_Page {
    *
    * @param int $id
    *   Id of saved search.
-   *
-   * @return void
    */
   public function delete($id) {
     // first delete the group associated with this saved search
@@ -124,8 +119,6 @@ class CRM_Contact_Page_SavedSearch extends CRM_Core_Page {
 
   /**
    * Run this page (figure out the action needed and perform it).
-   *
-   * @return void
    */
   public function run() {
     $action = CRM_Utils_Request::retrieve('action', 'String',
index ee0187665255333a82ff0bb6e74ed45438a000f1..7b740caa588dc10c96aabb2058aaeaf93dfed9cb 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
  * This is a dummy class that does nothing at the moment.
- * the template is used primarily for displaying result page
+ *
+ * The template is used primarily for displaying result page
  * of tasks performed on contacts. Contacts are searched/selected
  * and then subjected to Tasks/Actions.
- *
  */
 class CRM_Contact_Page_Task extends CRM_Core_Page {
 
index 6a1038143ff2d3c2976749f7153d6ae232ccb4f5..449c0c2f0485845c6d5eba3d4b4264c497eb967b 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
  * Main page for viewing contact.
- *
  */
 class CRM_Contact_Page_View extends CRM_Core_Page {
 
@@ -68,10 +65,9 @@ class CRM_Contact_Page_View extends CRM_Core_Page {
   protected $_permission;
 
   /**
-   * Heart of the viewing process. The runner gets all the meta data for
-   * the contact and calls the appropriate type of page to view.
+   * Heart of the viewing process.
    *
-   * @return void
+   * The runner gets all the meta data for the contact and calls the appropriate type of page to view.
    */
   public function preProcess() {
     // process url params
index 26e82a2bbf71318f3432bec185990334ddf59811..314dea2f19ecb1b2d44672b50c4bc8166b2c1da5 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Page_View_ContactSmartGroup extends CRM_Core_Page {
 
index a96f225ffb30878a4b528ba280f89bbb482ff67b..d5a2bf45f05168cbba6a85d0063ed70182066c0b 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Page_View_GroupContact extends CRM_Core_Page {
 
   /**
-   * called when action is browse.
-   *
+   * Called when action is browse.
    */
   public function browse() {
 
index 75801615fd4d2c0d6fcd5ec12c25b1ed4e076400..38e7a0ca42d14e387803c8af3d1bdd4b729156c4 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Page_View_Log extends CRM_Core_Page {
 
   /**
-   * called when action is browse.
+   * Called when action is browse.
    *
    * @return null
    */
index 98375fb7412166909ed3fb98a6565c6bdc1ac656..ffc3657c4bc754d4321dae7ca39f8f1ef73ecef1 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
  * Main page for viewing Notes.
- *
  */
 class CRM_Contact_Page_View_Note extends CRM_Core_Page {
 
@@ -55,8 +52,6 @@ class CRM_Contact_Page_View_Note extends CRM_Core_Page {
 
   /**
    * View details of a note.
-   *
-   * @return void
    */
   public function view() {
     $note = new CRM_Core_DAO_Note();
@@ -233,8 +228,6 @@ class CRM_Contact_Page_View_Note extends CRM_Core_Page {
 
   /**
    * Delete the note object from the db.
-   *
-   * @return void
    */
   public function delete() {
     CRM_Core_BAO_Note::del($this->_id);
index 6d0b4630630229afd4ce4687a927d61b413da8e5..202568ebcb4cc02b743b417a3ccc0de5f4b43a94 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
  * Main page for viewing contact.
- *
  */
 class CRM_Contact_Page_View_Print extends CRM_Contact_Page_View_Summary {
 
   /**
-   * Heart of the viewing process. The runner gets all the meta data for
-   * the contact and calls the appropriate type of page to view.
+   * Heart of the viewing process.
    *
-   * @return void
+   * The runner gets all the meta data for the contact and calls the appropriate type of page to view.
    */
   public function run() {
     $this->_print = CRM_Core_Smarty::PRINT_PAGE;
@@ -57,8 +53,6 @@ class CRM_Contact_Page_View_Print extends CRM_Contact_Page_View_Summary {
 
   /**
    * View summary details of a contact.
-   *
-   * @return void
    */
   public function view() {
     $params = array();
index d440f36c6cebc3866f077446b160385c30794712..7e53a60ddb57bbbf538e322dab5f4a69f94f9d4a 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Page_View_Relationship extends CRM_Core_Page {
 
@@ -53,8 +51,6 @@ class CRM_Contact_Page_View_Relationship extends CRM_Core_Page {
 
   /**
    * View details of a relationship.
-   *
-   * @return void
    */
   public function view() {
     $viewRelationship = CRM_Contact_BAO_Relationship::getRelationship($this->_contactId, NULL, NULL, NULL, $this->_id);
index 95090a21ca8ff0444f7c9ee2a6819b90dc4f71c5..1744d8f591a337b89ea455db28c5fe6beb01f125 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
  * Main page for viewing contact.
- *
  */
 class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View {
 
   /**
-   * Heart of the viewing process. The runner gets all the meta data for
-   * the contact and calls the appropriate type of page to view.
+   * Heart of the viewing process.
    *
-   * @return void
+   * The runner gets all the meta data for the contact and calls the appropriate type of page to view.
    */
   public function preProcess() {
     parent::preProcess();
@@ -85,10 +81,9 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View {
   }
 
   /**
-   * Heart of the viewing process. The runner gets all the meta data for
-   * the contact and calls the appropriate type of page to view.
+   * Heart of the viewing process.
    *
-   * @return void
+   * The runner gets all the meta data for the contact and calls the appropriate type of page to view.
    */
   public function run() {
     $this->preProcess();
@@ -105,8 +100,6 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View {
 
   /**
    * Edit name and address of a contact.
-   *
-   * @return void
    */
   public function edit() {
     // set the userContext stack
@@ -122,8 +115,6 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View {
 
   /**
    * View summary details of a contact.
-   *
-   * @return void
    */
   public function view() {
     // Add js for tabs, in-place editing, and jstree for tags
index 8fabcce83206692b56fd3ae97b8ccce5f0ddfde5..add1aa6afc3190fef375043526f87e1f36a46238 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Page_View_Sunlight extends CRM_Contact_Page_View {
 
   /**
-   * called when action is browse.
-   *
-   * @return void
+   * Called when action is browse.
    */
   public function browse() {
     // get the primary city, state and zip for the contact
index 89c7bfe6afae3e2169b98e6d3e466f8b062f3adf..f15688b8890e4a5e53e564d4f85ef3918b9b4d36 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Page_View_Tag extends CRM_Core_Page {
 
   /**
-   * called when action is browse.
-   *
-   * @return void
+   * Called when action is browse.
    */
   public function browse() {
     $controller = new CRM_Core_Controller_Simple('CRM_Tag_Form_Tag', ts('Contact Tags'), $this->_action);
index 2c45bc79610805ad38666175717bd115d31985a9..c14196073aca4c458391d2d39876bd5feab85508 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * CMS User Dashboard
  * This class is used to build User Dashboard
- *
  */
 class CRM_Contact_Page_View_UserDashBoard extends CRM_Core_Page {
   public $_contactId = NULL;
@@ -87,10 +83,9 @@ class CRM_Contact_Page_View_UserDashBoard extends CRM_Core_Page {
   }
 
   /**
-   * Heart of the viewing process. The runner gets all the meta data for
-   * the contact and calls the appropriate type of page to view.
+   * Heart of the viewing process.
    *
-   * @return void
+   * The runner gets all the meta data for the contact and calls the appropriate type of page to view.
    */
   public function preProcess() {
     if (!$this->_contactId) {
@@ -109,8 +104,6 @@ class CRM_Contact_Page_View_UserDashBoard extends CRM_Core_Page {
 
   /**
    * Build user dashboard.
-   *
-   * @return void
    */
   public function buildUserDashBoard() {
     //build component selectors
@@ -200,8 +193,6 @@ class CRM_Contact_Page_View_UserDashBoard extends CRM_Core_Page {
 
   /**
    * Perform actions and display for user dashboard.
-   *
-   * @return void
    */
   public function run() {
     $this->preProcess();
index 67562fc095f2b9446a227c719357d88c33b6b879..11f8c09eb20b7debf96b337e4c1fac9677d660a1 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Page_View_UserDashBoard_GroupContact extends CRM_Contact_Page_View_UserDashBoard {
 
   /**
-   * called when action is browse.
-   *
-   * @return void
+   * Called when action is browse.
    */
   public function browse() {
     $count = CRM_Contact_BAO_GroupContact::getContactGroup(
@@ -127,10 +123,9 @@ class CRM_Contact_Page_View_UserDashBoard_GroupContact extends CRM_Contact_Page_
   }
 
   /**
-   * the main function that is called when the page loads,
-   * it decides the which action has to be taken for the page.
+   * The main function that is called when the page loads.
    *
-   * @return void
+   * It decides the which action has to be taken for the page.
    */
   public function run() {
     $this->edit();
index e4cf8f6b668b27a43013c1c8e8ca4d3077a8ce5b..c8d1da566e33680d1c9348446eb6846854bd7953 100755 (executable)
 /**
  *
  * @package CRM
- * $Id$
- *
  */
 
 /**
- * Dummy page for details of Email
- *
+ * Dummy page for details of Email.
  */
 class CRM_Contact_Page_View_Useradd extends CRM_Core_Page {
 
@@ -42,8 +39,6 @@ class CRM_Contact_Page_View_Useradd extends CRM_Core_Page {
    * Run the page.
    *
    * This method is called after the page is created.
-   *
-   * @return void
    */
   public function run() {
     $controller = new CRM_Core_Controller_Simple('CRM_Contact_Form_Task_Useradd',
index 3a4d7aa8e55d43a40caff4ed64dcd4b5ff3d4cd8..c7cad12c2ab8b238452d522cf54dbd6cca90b209 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 require_once 'Contact/Vcard/Build.php';
 
 /**
- * vCard export class
- *
+ * vCard export class.
  */
 class CRM_Contact_Page_View_Vcard extends CRM_Contact_Page_View {
 
   /**
-   * Heart of the vCard data assignment process. The runner gets all the meta
-   * data for the contact and calls the writeVcard method to output the vCard
-   * to the user.
+   * Heart of the vCard data assignment process.
    *
-   * @return void
+   * The runner gets all the metadata for the contact and calls the writeVcard method to output the vCard
+   * to the user.
    */
   public function run() {
     $this->preProcess();
index 7bd1562f29f893dba8007a1fe748bc1e1b75cf94..636f7ddf40dfb7335fd87e3a9901feb7544b6bd3 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class is used to retrieve and display a range of
- * contacts that match the given criteria (specifically for
- * results of advanced search options.
+ * Class is to retrieve and display a range of contacts that match the given criteria.
  *
+ * It is specifically for results of advanced search options.
  */
 class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Selector_API {
 
@@ -1072,8 +1069,6 @@ SELECT DISTINCT 'civicrm_contact', contact_a.id, contact_a.id, '$cacheKey', cont
    * @param CRM_Utils_Sort $sort
    * @param string $cacheKey
    *   Cache key.
-   *
-   * @return void
    */
   public function rebuildPreNextCache($start, $end, $sort, $cacheKey) {
     // generate full SQL
index e5bcd9021622a07b79e66f7d978b0850dd82cd75..816a854b9ed1fcad535b55302aa52e32815b2615 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_Selector_Controller extends CRM_Core_Selector_Controller {
   /**
-   * Default function for qill, if needed to be implemented, we
-   * expect the subclass to do it
+   * Default function for qill.
+   *
+   * If needed to be implemented, we expect the subclass to do it
    *
    * @return string
    *   the status message
    */
-  /**
-   * @return string
-   */
   public function getQill() {
     return $this->_object->getQILL();
   }
index 06774acdb9417eceafbdf4ddcd8c1d400b86445d..45aee4c3a242c7d53ba1b4605f0d109503169ab6 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contact_StateMachine_Search extends CRM_Core_StateMachine {
 
index 56510a9aba9c6eb57059a27856567f3306469584..b175d8f076837c9f2b61b7d62fb876fd12b589dd 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * class to represent the actions that can be performed on a group of contacts
- * used by the search forms
- *
+ * Class to represent the actions that can be performed on a group of contacts used by the search forms.
  */
 class CRM_Contact_Task {
   const
@@ -84,23 +80,23 @@ class CRM_Contact_Task {
     if (!self::$_tasks) {
       self::$_tasks = array(
         self::GROUP_CONTACTS => array(
-          'title' => ts('Add Contacts to Group'),
+          'title' => ts('Group - add contacts'),
           'class' => 'CRM_Contact_Form_Task_AddToGroup',
         ),
         self::REMOVE_CONTACTS => array(
-          'title' => ts('Remove Contacts from Group'),
+          'title' => ts('Group - remove contacts'),
           'class' => 'CRM_Contact_Form_Task_RemoveFromGroup',
         ),
         self::TAG_CONTACTS => array(
-          'title' => ts('Tag Contacts (assign tags)'),
+          'title' => ts('Tag - add to contacts'),
           'class' => 'CRM_Contact_Form_Task_AddToTag',
         ),
         self::REMOVE_TAGS => array(
-          'title' => ts('Untag Contacts (remove tags)'),
+          'title' => ts('Tag - remove from contacts'),
           'class' => 'CRM_Contact_Form_Task_RemoveFromTag',
         ),
         self::EXPORT_CONTACTS => array(
-          'title' => ts('Export Contacts'),
+          'title' => ts('Export contacts'),
           'class' => array(
             'CRM_Export_Form_Select',
             'CRM_Export_Form_Map',
@@ -108,41 +104,41 @@ class CRM_Contact_Task {
           'result' => FALSE,
         ),
         self::EMAIL_CONTACTS => array(
-          'title' => ts('Send Email to Contacts'),
+          'title' => ts('Email - send now (to 50 or less)'),
           'class' => 'CRM_Contact_Form_Task_Email',
           'result' => TRUE,
         ),
         self::DELETE_CONTACTS => array(
-          'title' => ts('Delete Contacts'),
+          'title' => ts('Delete contacts'),
           'class' => 'CRM_Contact_Form_Task_Delete',
           'result' => FALSE,
         ),
         self::RECORD_CONTACTS => array(
-          'title' => ts('Record Activity for Contacts'),
+          'title' => ts('Add activity'),
           'class' => 'CRM_Activity_Form_Activity',
         ),
         self::SAVE_SEARCH => array(
-          'title' => ts('New Smart Group'),
+          'title' => ts('Smart group - create'),
           'class' => 'CRM_Contact_Form_Task_SaveSearch',
           'result' => TRUE,
         ),
         self::SAVE_SEARCH_UPDATE => array(
-          'title' => ts('Update Smart Group'),
+          'title' => ts('Smart group - update'),
           'class' => 'CRM_Contact_Form_Task_SaveSearch_Update',
           'result' => TRUE,
         ),
         self::PRINT_CONTACTS => array(
-          'title' => ts('Print Selected Rows'),
+          'title' => ts('Print selected rows'),
           'class' => 'CRM_Contact_Form_Task_Print',
           'result' => FALSE,
         ),
         self::LABEL_CONTACTS => array(
-          'title' => ts('Mailing Labels'),
+          'title' => ts('Mailing labels - print'),
           'class' => 'CRM_Contact_Form_Task_Label',
           'result' => TRUE,
         ),
         self::BATCH_UPDATE => array(
-          'title' => ts('Batch Update via Profile'),
+          'title' => ts('Batch update contacts via profile'),
           'class' => array(
             'CRM_Contact_Form_Task_PickProfile',
             'CRM_Contact_Form_Task_Batch',
@@ -150,25 +146,25 @@ class CRM_Contact_Task {
           'result' => TRUE,
         ),
         self::PRINT_FOR_CONTACTS => array(
-          'title' => ts('Print PDF Letter for Contacts'),
+          'title' => ts('PDF letters - print'),
           'class' => 'CRM_Contact_Form_Task_PDF',
           'result' => TRUE,
         ),
         self::EMAIL_UNHOLD => array(
-          'title' => ts('Unhold Emails'),
+          'title' => ts('Email - unhold addresses'),
           'class' => 'CRM_Contact_Form_Task_Unhold',
         ),
         self::COMMUNICATION_PREFS => array(
-          'title' => ts('Alter Contact Communication Preferences'),
+          'title' => ts('Communication preferences - alter'),
           'class' => 'CRM_Contact_Form_Task_AlterPreferences',
         ),
         self::RESTORE => array(
-          'title' => ts('Restore Contacts'),
+          'title' => ts('Restore contacts from trash'),
           'class' => 'CRM_Contact_Form_Task_Delete',
           'result' => FALSE,
         ),
         self::DELETE_PERMANENTLY => array(
-          'title' => ts('Delete Permanently'),
+          'title' => ts('Delete permanently'),
           'class' => 'CRM_Contact_Form_Task_Delete',
           'result' => FALSE,
         ),
@@ -178,16 +174,16 @@ class CRM_Contact_Task {
       $providersCount = CRM_SMS_BAO_Provider::activeProviderCount();
       if ($providersCount) {
         self::$_tasks[self::SMS_CONTACTS] = array(
-          'title' => ts('Send SMS to Contacts'),
+          'title' => ts('SMS - schedule/send'),
           'class' => 'CRM_Contact_Form_Task_SMS',
           'result' => TRUE,
         );
       }
 
       if (CRM_Contact_BAO_ContactType::isActive('Household')) {
-        $label = CRM_Contact_BAO_ContactType::getLabel('Household');
+        $label = CRM_Contact_BAO_ContactType::getLabel('household');
         self::$_tasks[self::HOUSEHOLD_CONTACTS] = array(
-          'title' => ts('Add Contacts to %1',
+          'title' => ts('Add relationship - to %1',
             array(1 => $label)
           ),
           'class' => 'CRM_Contact_Form_Task_AddToHousehold',
@@ -195,9 +191,9 @@ class CRM_Contact_Task {
       }
 
       if (CRM_Contact_BAO_ContactType::isActive('Organization')) {
-        $label = CRM_Contact_BAO_ContactType::getLabel('Organization');
+        $label = CRM_Contact_BAO_ContactType::getLabel('organization');
         self::$_tasks[self::ORGANIZATION_CONTACTS] = array(
-          'title' => ts('Add Contacts to %1',
+          'title' => ts('Add relationship - to %1',
             array(1 => $label)
           ),
           'class' => 'CRM_Contact_Form_Task_AddToOrganization',
@@ -206,7 +202,7 @@ class CRM_Contact_Task {
 
       if (CRM_Core_Permission::check('merge duplicate contacts')) {
         self::$_tasks[self::MERGE_CONTACTS] = array(
-          'title' => ts('Merge Contacts'),
+          'title' => ts('Merge contacts'),
           'class' => 'CRM_Contact_Form_Task_Merge',
           'result' => TRUE,
         );
@@ -229,7 +225,7 @@ class CRM_Contact_Task {
         )
       ) {
         self::$_tasks[self::MAP_CONTACTS] = array(
-          'title' => ts('Map Contacts'),
+          'title' => ts('Map contacts'),
           'class' => 'CRM_Contact_Form_Task_Map',
           'result' => FALSE,
         );
@@ -237,50 +233,19 @@ class CRM_Contact_Task {
 
       if (CRM_Core_Permission::access('CiviEvent')) {
         self::$_tasks[self::ADD_EVENT] = array(
-          'title' => ts('Add Contacts to Event'),
+          'title' => ts('Register participants for event'),
           'class' => 'CRM_Event_Form_Participant',
         );
       }
 
-      if (defined('CIVICRM_CIVIMAIL_UI_LEGACY')) {
-        if (CRM_Core_Permission::access('CiviMail')) {
-          self::$_tasks[self::CREATE_MAILING] = array(
-            'title' => ts('Schedule/Send a Mass Mailing'),
-            'class' => array(
-              'CRM_Mailing_Form_Group',
-              'CRM_Mailing_Form_Settings',
-              'CRM_Mailing_Form_Upload',
-              'CRM_Mailing_Form_Test',
-              'CRM_Mailing_Form_Schedule',
-            ),
-            'result' => FALSE,
-          );
-        }
-        elseif (CRM_Mailing_Info::workflowEnabled() &&
-          CRM_Core_Permission::check('create mailings')
-        ) {
-          self::$_tasks[self::CREATE_MAILING] = array(
-            'title' => ts('Create a Mass Mailing'),
-            'class' => array(
-              'CRM_Mailing_Form_Group',
-              'CRM_Mailing_Form_Settings',
-              'CRM_Mailing_Form_Upload',
-              'CRM_Mailing_Form_Test',
-            ),
-            'result' => FALSE,
-          );
-        }
-      }
-      else {
-        if (CRM_Core_Permission::access('CiviMail')
-          || (CRM_Mailing_Info::workflowEnabled() && CRM_Core_Permission::check('create mailings'))
-        ) {
-          self::$_tasks[self::CREATE_MAILING] = array(
-            'title' => ts('Schedule/Send a Mass Mailing'),
-            'class' => 'CRM_Mailing_Form_Task_AdhocMailing',
-            'result' => FALSE,
-          );
-        }
+      if (CRM_Core_Permission::access('CiviMail')
+        || (CRM_Mailing_Info::workflowEnabled() && CRM_Core_Permission::check('create mailings'))
+      ) {
+        self::$_tasks[self::CREATE_MAILING] = array(
+          'title' => ts('Email - schedule/send via CiviMail'),
+          'class' => 'CRM_Mailing_Form_Task_AdhocMailing',
+          'result' => FALSE,
+        );
       }
 
       self::$_tasks += CRM_Core_Component::taskList();
index fe349413786c6ea7b1fecd7ed399bd434facec64..f0035ca5ae60c95fc375f56026ad0e3bfbc4a818 100644 (file)
@@ -136,8 +136,8 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
     //set defaults in create mode
     if (!$contributionID) {
       CRM_Core_DAO::setCreateDefaults($params, self::getDefaults());
-      self::calculateMissingAmountParams($params);
     }
+    self::calculateMissingAmountParams($params, $contributionID);
 
     if (!empty($params['payment_instrument_id'])) {
       $paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument('name');
@@ -259,9 +259,13 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
    *
    * @param array $params
    *   Params for a new contribution before they are saved.
+   * @param int|null $contributionID
+   *   Contribution ID if we are dealing with an update.
+   *
+   * @throws \CiviCRM_API3_Exception
    */
-  public static function calculateMissingAmountParams(&$params) {
-    if (!isset($params['fee_amount'])) {
+  public static function calculateMissingAmountParams(&$params, $contributionID) {
+    if (!$contributionID && !isset($params['fee_amount'])) {
       if (isset($params['total_amount']) && isset($params['net_amount'])) {
         $params['fee_amount'] = $params['total_amount'] - $params['net_amount'];
       }
@@ -270,7 +274,22 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
       }
     }
     if (!isset($params['net_amount'])) {
-      $params['net_amount'] = $params['total_amount'] - $params['fee_amount'];
+      if (!$contributionID) {
+        $params['net_amount'] = $params['total_amount'] - $params['fee_amount'];
+      }
+      else {
+        if (isset($params['fee_amount']) || isset($params['total_amount'])) {
+          // We have an existing contribution and fee_amount or total_amount has been passed in but not net_amount.
+          // net_amount may need adjusting.
+          $contribution = civicrm_api3('Contribution', 'getsingle', array(
+            'id' => $contributionID,
+            'return' => array('total_amount', 'net_amount'),
+          ));
+          $totalAmount = isset($params['total_amount']) ? $params['total_amount'] : CRM_Utils_Array::value('total_amount', $contribution);
+          $feeAmount = isset($params['fee_amount']) ? $params['fee_amount'] : CRM_Utils_Array::value('fee_amount', $contribution);
+          $params['net_amount'] = $totalAmount - $feeAmount;
+        }
+      }
     }
   }
 
@@ -425,62 +444,7 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
       }
     }
 
-    // Handle soft credit and / or link to personal campaign page
-    $softIDs = CRM_Contribute_BAO_ContributionSoft::getSoftCreditIds($contribution->id);
-
-    $pcpId = CRM_Contribute_BAO_ContributionSoft::getSoftCreditIds($contribution->id, TRUE);
-
-    if ($pcp = CRM_Utils_Array::value('pcp', $params)) {
-      $softParams = array();
-      $softParams['id'] = $pcpId ? $pcpId : NULL;
-      $softParams['contribution_id'] = $contribution->id;
-      $softParams['pcp_id'] = $pcp['pcp_made_through_id'];
-      $softParams['contact_id'] = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP',
-        $pcp['pcp_made_through_id'], 'contact_id'
-      );
-      $softParams['currency'] = $contribution->currency;
-      $softParams['amount'] = $contribution->total_amount;
-      $softParams['pcp_display_in_roll'] = CRM_Utils_Array::value('pcp_display_in_roll', $pcp);
-      $softParams['pcp_roll_nickname'] = CRM_Utils_Array::value('pcp_roll_nickname', $pcp);
-      $softParams['pcp_personal_note'] = CRM_Utils_Array::value('pcp_personal_note', $pcp);
-      $softParams['soft_credit_type_id'] = CRM_Core_OptionGroup::getValue('soft_credit_type', 'pcp', 'name');
-      $contributionSoft = CRM_Contribute_BAO_ContributionSoft::add($softParams);
-      //Send notification to owner for PCP
-      if ($contributionSoft->pcp_id && empty($pcpId)) {
-        CRM_Contribute_Form_Contribution_Confirm::pcpNotifyOwner($contribution, $contributionSoft);
-      }
-    }
-    //Delete PCP against this contribution and create new on submitted PCP information
-    elseif (array_key_exists('pcp', $params) && $pcpId) {
-      $deleteParams = array('id' => $pcpId);
-      CRM_Contribute_BAO_ContributionSoft::del($deleteParams);
-    }
-    if (isset($params['soft_credit'])) {
-      $softParams = $params['soft_credit'];
-      foreach ($softParams as $softParam) {
-        if (!empty($softIDs)) {
-          $key = key($softIDs);
-          $softParam['id'] = $softIDs[$key];
-          unset($softIDs[$key]);
-        }
-        $softParam['contribution_id'] = $contribution->id;
-        $softParam['currency'] = $contribution->currency;
-        //case during Contribution Import when we assign soft contribution amount as contribution's total_amount by default
-        if (empty($softParam['amount'])) {
-          $softParam['amount'] = $contribution->total_amount;
-        }
-        CRM_Contribute_BAO_ContributionSoft::add($softParam);
-      }
-
-      if (!empty($softIDs)) {
-        foreach ($softIDs as $softID) {
-          if (!in_array($softID, $params['soft_credit_ids'])) {
-            $deleteParams = array('id' => $softID);
-            CRM_Contribute_BAO_ContributionSoft::del($deleteParams);
-          }
-        }
-      }
-    }
+    CRM_Contribute_BAO_ContributionSoft::processSoftContribution($params, $contribution);
 
     $transaction->commit();
 
@@ -2462,6 +2426,11 @@ WHERE  contribution_id = %1 ";
       $values['address'] = $addressDetails[0]['display'];
     }
     if ($this->_component == 'contribute') {
+      //get soft contributions
+      $softContributions = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($this->id, TRUE);
+      if (!empty($softContributions)) {
+        $values['softContributions'] = $softContributions['soft_credit'];
+      }
       if (isset($this->contribution_page_id)) {
         CRM_Contribute_BAO_ContributionPage::setValues(
           $this->contribution_page_id,
@@ -2517,6 +2486,52 @@ WHERE  contribution_id = %1 ";
       $values['event'] = array();
 
       CRM_Event_BAO_Event::retrieve($eventParams, $values['event']);
+      // add custom fields for event
+      $eventGroupTree = CRM_Core_BAO_CustomGroup::getTree('Event', $this->_relatedObjects['event'], $this->_relatedObjects['event']->id);
+
+      $eventCustomGroup = array();
+      foreach ($eventGroupTree as $key => $group) {
+        if ($key === 'info') {
+          continue;
+        }
+
+        foreach ($group['fields'] as $k => $customField) {
+          $groupLabel = $group['title'];
+          if (!empty($customField['customValue'])) {
+            foreach ($customField['customValue'] as $customFieldValues) {
+              $eventCustomGroup[$groupLabel][$customField['label']] = CRM_Utils_Array::value('data', $customFieldValues);
+            }
+          }
+        }
+      }
+      $values['event']['customGroup'] = $eventCustomGroup;
+
+      //get participant details
+      $participantParams = array(
+        'id' => $this->_relatedObjects['participant']->id,
+      );
+
+      $values['participant'] = array();
+
+      CRM_Event_BAO_Participant::getValues($participantParams, $values['participant'], $participantIds);
+      // add custom fields for event
+      $participantGroupTree = CRM_Core_BAO_CustomGroup::getTree('Participant', $this->_relatedObjects['participant'], $this->_relatedObjects['participant']->id);
+      $participantCustomGroup = array();
+      foreach ($participantGroupTree as $key => $group) {
+        if ($key === 'info') {
+          continue;
+        }
+
+        foreach ($group['fields'] as $k => $customField) {
+          $groupLabel = $group['title'];
+          if (!empty($customField['customValue'])) {
+            foreach ($customField['customValue'] as $customFieldValues) {
+              $participantCustomGroup[$groupLabel][$customField['label']] = CRM_Utils_Array::value('data', $customFieldValues);
+            }
+          }
+        }
+      }
+      $values['participant']['customGroup'] = $participantCustomGroup;
 
       //get location details
       $locationParams = array(
@@ -2552,6 +2567,25 @@ WHERE  contribution_id = %1 ";
       }
     }
 
+    $groupTree = CRM_Core_BAO_CustomGroup::getTree('Contribution', $this, $this->id);
+
+    $customGroup = array();
+    foreach ($groupTree as $key => $group) {
+      if ($key === 'info') {
+        continue;
+      }
+
+      foreach ($group['fields'] as $k => $customField) {
+        $groupLabel = $group['title'];
+        if (!empty($customField['customValue'])) {
+          foreach ($customField['customValue'] as $customFieldValues) {
+            $customGroup[$groupLabel][$customField['label']] = CRM_Utils_Array::value('data', $customFieldValues);
+          }
+        }
+      }
+    }
+    $values['customGroup'] = $customGroup;
+
     return $values;
   }
 
@@ -2666,6 +2700,12 @@ WHERE  contribution_id = %1 ";
     $template->assign('is_recur', (bool) $recur);
     $template->assign('currency', $this->currency);
     $template->assign('address', CRM_Utils_Address::format($input));
+    if (!empty($values['customGroup'])) {
+      $template->assign('customGroup', $values['customGroup']);
+    }
+    if (!empty($values['softContributions'])) {
+      $template->assign('softContributions', $values['softContributions']);
+    }
     if ($this->_component == 'event') {
       $template->assign('title', $values['event']['title']);
       $participantRoles = CRM_Event_PseudoConstant::participantRole();
@@ -2675,6 +2715,7 @@ WHERE  contribution_id = %1 ";
       }
       $values['event']['participant_role'] = implode(', ', $viewRoles);
       $template->assign('event', $values['event']);
+      $template->assign('participant', $values['participant']);
       $template->assign('location', $values['location']);
       $template->assign('customPre', $values['custom_pre_id']);
       $template->assign('customPost', $values['custom_post_id']);
@@ -3138,7 +3179,7 @@ WHERE  contribution_id = %1 ";
       return;
     }
     if ($context == 'changedAmount' || $context == 'changeFinancialType') {
-      $itemAmount = $params['trxnParams']['total_amount'] = $params['total_amount'] - $params['prevContribution']->total_amount;
+      $itemAmount = $params['trxnParams']['total_amount'] = $params['trxnParams']['net_amount'] = $params['total_amount'] - $params['prevContribution']->total_amount;
     }
     if ($context == 'changedStatus') {
       //get all the statuses
@@ -4180,7 +4221,6 @@ LIMIT 1;";
       if (empty($input['IAmAHorribleNastyBeyondExcusableHackInTheCRMEventFORMTaskClassThatNeedsToBERemoved'])) {
         $eventDetail = civicrm_api3('Event', 'getsingle', array('id' => $objects['event']->id));
         $contributionParams['source'] = ts('Online Event Registration') . ': ' . $eventDetail['title'];
-
         if ($eventDetail['is_email_confirm']) {
           // @todo this should be set by the function that sends the mail after sending.
           $contributionParams['receipt_date'] = $changeDate;
index 4cd6794b14e5479ed63dc5031f9d361c4b6cad44..16c713a5572990541b347cdb1ca886789e7b190e 100644 (file)
@@ -29,7 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
  */
 class CRM_Contribute_BAO_Contribution_Utils {
 
@@ -125,7 +124,6 @@ class CRM_Contribute_BAO_Contribution_Utils {
         $contributionParams,
         $financialType,
         TRUE,
-        TRUE,
         $form->_bltID
       );
 
@@ -160,7 +158,7 @@ class CRM_Contribute_BAO_Contribution_Utils {
         $paymentParams['contributionRecurID'] = $contribution->contribution_recur_id;
       }
 
-      if ($form->_contributeMode && $form->_amount > 0.0) {
+      if (!empty($form->_paymentProcessor) && $form->_amount > 0.0) {
         try {
           $payment = Civi\Payment\System::singleton()->getByProcessor($form->_paymentProcessor);
           if ($form->_contributeMode == 'notify') {
index 1fe24c5166d7c2acd62286a17af80d3ff067ce2d..ea10ddb78a953d541b97120df7e1660628b516f2 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_ContributionSoft {
 
@@ -62,6 +60,147 @@ class CRM_Contribute_BAO_ContributionSoft extends CRM_Contribute_DAO_Contributio
     return $contributionSoft->save();
   }
 
+  /**
+   * Process the soft contribution and/or link to personal campaign page.
+   *
+   * @param array $params
+   * @param object $contribution CRM_Contribute_DAO_Contribution
+   *
+   */
+  public static function processSoftContribution($params, $contribution) {
+    //retrieve existing soft-credit and pcp id(s) if any against $contribution
+    $softIDs = self::getSoftCreditIds($contribution->id);
+    $pcpId = self::getSoftCreditIds($contribution->id, TRUE);
+
+    if ($pcp = CRM_Utils_Array::value('pcp', $params)) {
+      $softParams = array();
+      $softParams['id'] = $pcpId ? $pcpId : NULL;
+      $softParams['contribution_id'] = $contribution->id;
+      $softParams['pcp_id'] = $pcp['pcp_made_through_id'];
+      $softParams['contact_id'] = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP',
+        $pcp['pcp_made_through_id'], 'contact_id'
+      );
+      $softParams['currency'] = $contribution->currency;
+      $softParams['amount'] = $contribution->total_amount;
+      $softParams['pcp_display_in_roll'] = CRM_Utils_Array::value('pcp_display_in_roll', $pcp);
+      $softParams['pcp_roll_nickname'] = CRM_Utils_Array::value('pcp_roll_nickname', $pcp);
+      $softParams['pcp_personal_note'] = CRM_Utils_Array::value('pcp_personal_note', $pcp);
+      $softParams['soft_credit_type_id'] = CRM_Core_OptionGroup::getValue('soft_credit_type', 'pcp', 'name');
+      $contributionSoft = self::add($softParams);
+      //Send notification to owner for PCP
+      if ($contributionSoft->pcp_id && empty($pcpId)) {
+        CRM_Contribute_Form_Contribution_Confirm::pcpNotifyOwner($contribution, $contributionSoft);
+      }
+    }
+    //Delete PCP against this contribution and create new on submitted PCP information
+    elseif (array_key_exists('pcp', $params) && $pcpId) {
+      $deleteParams = array('id' => $pcpId);
+      CRM_Contribute_BAO_ContributionSoft::del($deleteParams);
+    }
+    if (isset($params['soft_credit'])) {
+      $softParams = $params['soft_credit'];
+      foreach ($softParams as $softParam) {
+        if (!empty($softIDs)) {
+          $key = key($softIDs);
+          $softParam['id'] = $softIDs[$key];
+          unset($softIDs[$key]);
+        }
+        $softParam['contribution_id'] = $contribution->id;
+        $softParam['currency'] = $contribution->currency;
+        //case during Contribution Import when we assign soft contribution amount as contribution's total_amount by default
+        if (empty($softParam['amount'])) {
+          $softParam['amount'] = $contribution->total_amount;
+        }
+        CRM_Contribute_BAO_ContributionSoft::add($softParam);
+      }
+
+      // delete any extra soft-credit while updating back-office contribution
+      foreach ((array) $softIDs as $softID) {
+        if (!in_array($softID, $params['soft_credit_ids'])) {
+          $deleteParams = array('id' => $softID);
+          CRM_Contribute_BAO_ContributionSoft::del($deleteParams);
+        }
+      }
+    }
+  }
+
+  /**
+   * Function used to save pcp / soft credit entry.
+   *
+   * This is used by contribution and also event pcps
+   *
+   * @param array $params
+   * @param object $form
+   *   Form object.
+   */
+  public static function formatSoftCreditParams(&$params, &$form) {
+    $pcp = $softParams = $softIDs = array();
+    if (!empty($params['pcp_made_through_id'])) {
+      $fields = array(
+        'pcp_made_through_id',
+        'pcp_display_in_roll',
+        'pcp_roll_nickname',
+        'pcp_personal_note',
+      );
+      foreach ($fields as $f) {
+        $pcp[$f] = CRM_Utils_Array::value($f, $params);
+      }
+    }
+
+    if (!empty($form->_honor_block_is_active) && !empty($params['soft_credit_type_id'])) {
+      $honorId = NULL;
+
+      $contributionSoftParams['soft_credit_type_id'] = CRM_Core_OptionGroup::getValue('soft_credit_type', 'pcp', 'name');
+      //check if there is any duplicate contact
+      $profileContactType = CRM_Core_BAO_UFGroup::getContactType($params['honoree_profile_id']);
+      $dedupeParams = CRM_Dedupe_Finder::formatParams($params['honor'], $profileContactType);
+      $dedupeParams['check_permission'] = FALSE;
+      $ids = CRM_Dedupe_Finder::dupesByParams($dedupeParams, $profileContactType);
+      if (count($ids)) {
+        $honorId = CRM_Utils_Array::value(0, $ids);
+      }
+
+      $honorId = CRM_Contact_BAO_Contact::createProfileContact(
+        $params['honor'], CRM_Core_DAO::$_nullArray,
+        $honorId, NULL,
+        $params['honoree_profile_id']
+      );
+      $softParams[] = array(
+        'contact_id' => $honorId,
+        'soft_credit_type_id' => $params['soft_credit_type_id'],
+      );
+
+      if (CRM_Utils_Array::value('is_email_receipt', $form->_values)) {
+        $form->_values['honor'] = array(
+          'soft_credit_type' => CRM_Utils_Array::value(
+            $params['soft_credit_type_id'],
+            CRM_Core_OptionGroup::values("soft_credit_type")
+          ),
+          'honor_id' => $honorId,
+          'honor_profile_id' => $params['honoree_profile_id'],
+          'honor_profile_values' => $params['honor'],
+        );
+      }
+    }
+    elseif (!empty($params['soft_credit_contact_id'])) {
+      //build soft credit params
+      foreach ($params['soft_credit_contact_id'] as $key => $val) {
+        if ($val && $params['soft_credit_amount'][$key]) {
+          $softParams[$key]['contact_id'] = $val;
+          $softParams[$key]['amount'] = CRM_Utils_Rule::cleanMoney($params['soft_credit_amount'][$key]);
+          $softParams[$key]['soft_credit_type_id'] = $params['soft_credit_type'][$key];
+          if (!empty($params['soft_credit_id'][$key])) {
+            $softIDs[] = $softParams[$key]['id'] = $params['soft_credit_id'][$key];
+          }
+        }
+      }
+    }
+
+    $params['pcp'] = !empty($pcp) ? $pcp : NULL;
+    $params['soft_credit'] = $softParams;
+    $params['soft_credit_ids'] = $softIDs;
+  }
+
   /**
    * Fetch object based on array of properties.
    *
index 63eb9dc979f032a49b1d464f08abfb7fe4a6394a..448bab6422f3707838a5c83d75759292b46276f0 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contribute_BAO_ManagePremiums extends CRM_Contribute_DAO_Product {
 
index 595fd7f6bcb9bfc4791ad5cf3ee9218243dbf36a..7387fa45f007659bd0f5e237d997c310f267b087 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contribute_BAO_Premium extends CRM_Contribute_DAO_Premium {
 
index 7e82e7a80a022e0014df26fd5ce796edab68cf20..71d9519d0f47f946964d3210d1a488abcb0f34e9 100644 (file)
@@ -29,7 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
  */
 class CRM_Contribute_BAO_Query {
 
@@ -360,6 +359,7 @@ class CRM_Contribute_BAO_Query {
       case 'contribution_contact_id':
       case (strpos($name, '_amount') !== FALSE):
       case (strpos($name, '_date') !== FALSE && $name != 'contribution_fulfilled_date'):
+      case 'contribution_campaign_id':
         $qillName = $name;
         $pseudoExtraParam = NULL;
         // @todo including names using a switch statement & then using an 'if' to filter them out is ... odd!
@@ -372,11 +372,12 @@ class CRM_Contribute_BAO_Query {
               'contribution_check_number',
               'contribution_payment_instrument_id',
               'contribution_contact_id',
+              'contribution_campaign_id',
             )
           )
         ) {
           $name = str_replace('contribution_', '', $name);
-          if (!in_array($name, array('source', 'id', 'contact_id'))) {
+          if (!in_array($name, array('source', 'id', 'contact_id', 'campaign_id'))) {
             $qillName = str_replace('contribution_', '', $qillName);
           }
         }
@@ -517,16 +518,6 @@ class CRM_Contribute_BAO_Query {
         $query->_tables['civicrm_contribution_soft'] = $query->_whereTables['civicrm_contribution_soft'] = 1;
         return;
 
-      case 'contribution_campaign_id':
-        $campParams = array(
-          'op' => $op,
-          'campaign' => $value,
-          'grouping' => $grouping,
-          'tableName' => 'civicrm_contribution',
-        );
-        CRM_Campaign_BAO_Query::componentSearchClause($campParams, $query);
-        return;
-
       case 'contribution_batch_id':
         $batches = CRM_Contribute_PseudoConstant::batch();
         $query->_where[$grouping][] = " civicrm_entity_batch.batch_id $op $value";
@@ -871,10 +862,7 @@ class CRM_Contribute_BAO_Query {
   /**
    * Add all the elements shared between contribute search and advnaced search.
    *
-   *
    * @param CRM_Core_Form $form
-   *
-   * @return void
    */
   public static function buildSearchForm(&$form) {
 
index f71555987c66ad3c0147fcae757a467c5ebf140f..c7456707fc70a3ce310a20fd7f2ad542587a142d 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
  */
 
 /**
- * Class to retrieve information about a contribution page
+ * Class to retrieve information about a contribution page.
  */
 class CRM_Contribute_BAO_Widget extends CRM_Contribute_DAO_Widget {
 
index 8f35c380ee894f98ec5e0c3f3e12c3c74117808c..aaecca8ccc8da5a81ced8ddaf4cd0400003c58f6 100644 (file)
@@ -33,8 +33,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contribute_Config extends CRM_Core_Component_Config {
 }
index 8d8dfea18476667e3cc6cbb37d5b8399e036464a..a3914e3817b5560c74479befe0998abea0996d63 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
index 5c3eda116196dbb46c8c3d2d12dd6967965e373d..b87aa8c0654b998230df95722f41aaefb3a4fd69 100644 (file)
@@ -29,7 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
  */
 
 /**
index eae0c9cb0a4720ba0369128c5a1e23d6a2132f49..da2c749f61e41ebf827bbda15ac7d118f1f37831 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
index 36d3785169511d371558e2c2ddb41e12707143fd..43e7529971577b8a2f7340d9aa8a53225af77784 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components generic to Contribution admin
- *
+ * This class generates form components generic to Contribution admin.
  */
 class CRM_Contribute_Form extends CRM_Admin_Form {
 
   /**
-   * Set default values for the form. Note that in edit/view mode
-   * the default values are retrieved from the database
-   *
+   * Set default values for the form.
    *
    * @return array
    */
index fb437dbe3a0a177d99ae73f2f7669cc1fc66fe81..7654b0d065bf8ff7f5055c8491c9cb3c655a800d 100644 (file)
@@ -211,7 +211,7 @@ class CRM_Contribute_Form_AbstractEditPayment extends CRM_Contact_Form_Task {
   public function preProcess() {
     $this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
     $this->assign('contactID', $this->_contactID);
-
+    CRM_Core_Resources::singleton()->addVars('coreForm', array('contact_id' => (int) $this->_contactID));
     $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'add');
   }
 
@@ -421,7 +421,7 @@ LEFT JOIN  civicrm_contribution on (civicrm_contribution.contact_id = civicrm_co
     //only valid processors get display to user
 
     if ($this->_mode) {
-      $this->assign('processorSupportsFutureStartDate', CRM_Financial_BAO_PaymentProcessor::hasPaymentProcessorSupporting(array('supportsFutureRecurStartDate')));
+      $this->assign('processorSupportsFutureStartDate', CRM_Financial_BAO_PaymentProcessor::hasPaymentProcessorSupporting(array('FutureRecurStartDate')));
       $this->_paymentProcessors = $this->getValidProcessors();
       if (!isset($this->_paymentProcessor['id'])) {
         // if the payment processor isn't set yet (as indicated by the presence of an id,) we'll grab the first one which should be the default
@@ -440,6 +440,7 @@ LEFT JOIN  civicrm_contribution on (civicrm_contribution.contact_id = civicrm_co
           $this->_recurPaymentProcessors[$id] = $this->_processors[$id];
         }
       }
+      CRM_Financial_Form_Payment::addCreditCardJs();
     }
     $this->assign('recurringPaymentProcessorIds',
       empty($this->_recurPaymentProcessors) ? '' : implode(',', array_keys($this->_recurPaymentProcessors))
@@ -632,4 +633,89 @@ LEFT JOIN  civicrm_contribution on (civicrm_contribution.contact_id = civicrm_co
     }
   }
 
+  /**
+   * Begin post processing.
+   *
+   * This function aims to start to bring together common postProcessing functions.
+   *
+   * Eventually these are also shared with the front end forms & may need to be moved to where they can also
+   * access this function.
+   */
+  protected function beginPostProcess() {
+    if ($this->_mode) {
+      $this->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment(
+        $this->_params['payment_processor_id'],
+        ($this->_mode == 'test')
+      );
+      if (in_array('credit_card_exp_date', array_keys($this->_params))) {
+        $this->_params['year'] = CRM_Core_Payment_Form::getCreditCardExpirationYear($this->_params);
+        $this->_params['month'] = CRM_Core_Payment_Form::getCreditCardExpirationMonth($this->_params);
+      }
+      $this->assign('credit_card_exp_date', CRM_Utils_Date::mysqlToIso(CRM_Utils_Date::format($this->_params['credit_card_exp_date'])));
+      $this->assign('credit_card_number',
+        CRM_Utils_System::mungeCreditCard($this->_params['credit_card_number'])
+      );
+      $this->assign('credit_card_type', $this->_params['credit_card_type']);
+    }
+    $this->_params['ip_address'] = CRM_Utils_System::ipAddress();
+  }
+
+
+  /**
+   * Add the billing address to the contact who paid.
+   *
+   * Note that this function works based on the presence or otherwise of billing fields & can be called regardless of
+   * whether they are 'expected' (due to assumptions about the payment processor type or the setting to collect billing
+   * for pay later.
+   */
+  protected function processBillingAddress() {
+    $fields = array();
+
+    $fields['email-Primary'] = 1;
+    $this->_params['email-5'] = $this->_params['email-Primary'] = $this->_contributorEmail;
+    // now set the values for the billing location.
+    foreach (array_keys($this->_fields) as $name) {
+      $fields[$name] = 1;
+    }
+
+    // also add location name to the array
+    $this->_params["address_name-{$this->_bltID}"] = CRM_Utils_Array::value('billing_first_name', $this->_params) . ' ' . CRM_Utils_Array::value('billing_middle_name', $this->_params) . ' ' . CRM_Utils_Array::value('billing_last_name', $this->_params);
+    $this->_params["address_name-{$this->_bltID}"] = trim($this->_params["address_name-{$this->_bltID}"]);
+
+    $fields["address_name-{$this->_bltID}"] = 1;
+
+    //ensure we don't over-write the payer's email with the member's email
+    if ($this->_contributorContactID == $this->_contactID) {
+      $fields["email-{$this->_bltID}"] = 1;
+    }
+
+    list($hasBillingField, $addressParams) = CRM_Contribute_BAO_Contribution::getPaymentProcessorReadyAddressParams($this->_params, $this->_bltID);
+    $nameFields = array('first_name', 'middle_name', 'last_name');
+
+    foreach ($nameFields as $name) {
+      $fields[$name] = 1;
+      if (array_key_exists("billing_$name", $this->_params)) {
+        $this->_params[$name] = $this->_params["billing_{$name}"];
+        $this->_params['preserveDBName'] = TRUE;
+      }
+    }
+
+    if ($hasBillingField) {
+      $addressParams = array_merge($this->_params, $addressParams);
+      //here we are setting up the billing contact - if different from the member they are already created
+      // but they will get billing details assigned
+      CRM_Contact_BAO_Contact::createProfileContact($addressParams, $fields,
+        $this->_contributorContactID, NULL, NULL,
+        CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_contactID, 'contact_type')
+      );
+    }
+    // Add additional parameters that the payment processors are used to receiving.
+    if (!empty($this->_params["billing_state_province_id-{$this->_bltID}"])) {
+      $this->_params["state_province-{$this->_bltID}"] = $this->_params["billing_state_province-{$this->_bltID}"] = CRM_Core_PseudoConstant::stateProvinceAbbreviation($this->_params["billing_state_province_id-{$this->_bltID}"]);
+    }
+    if (!empty($this->_params["billing_country_id-{$this->_bltID}"])) {
+      $this->_params["country-{$this->_bltID}"] = $this->_params["billing_country-{$this->_bltID}"] = CRM_Core_PseudoConstant::countryIsoCode($this->_params["billing_country_id-{$this->_bltID}"]);
+    }
+  }
+
 }
index 64082cab62000dc836f8ccf961e26ae006302485..ffe5793052fdff88becc79ffed9cb6c73ec98182 100644 (file)
@@ -88,10 +88,7 @@ class CRM_Contribute_Form_AdditionalInfo {
   /**
    * Build the form object for Additional Details.
    *
-   *
    * @param CRM_Core_Form $form
-   *
-   * @return void
    */
   public static function buildAdditionalDetail(&$form) {
     //Additional information section
@@ -175,10 +172,7 @@ class CRM_Contribute_Form_AdditionalInfo {
    *
    * Build the form object for PaymentReminders Information.
    *
-   *
    * @param CRM_Core_Form $form
-   *
-   * @return void
    */
   public static function buildPaymentReminders(&$form) {
     //PaymentReminders section
@@ -258,8 +252,6 @@ class CRM_Contribute_Form_AdditionalInfo {
    * @param int $contactID
    * @param int $contributionID
    * @param int $contributionNoteID
-   *
-   * @return void
    */
   public static function processNote($params, $contactID, $contributionID, $contributionNoteID = NULL) {
     //process note
@@ -280,11 +272,9 @@ class CRM_Contribute_Form_AdditionalInfo {
   /**
    * Process the Common data.
    *
-   *
    * @param array $params
-   * @param $formatted
+   * @param array $formatted
    * @param CRM_Core_Form $form
-   * @return void
    */
   public static function postProcessCommon(&$params, &$formatted, &$form) {
     $fields = array(
index 30e22ce7170002f1266ad4b04140d3ae416ccd89..e802fd2f11540e7511008e1a75dd299009ae9d22 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -40,7 +38,7 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract
   public $_contributeMode = 'direct';
 
   /**
-   * Related component whose financial payment is being processed
+   * Related component whose financial payment is being processed.
    *
    * @var string
    */
index 787f62a343b897d7e902ec22510315f8846933b5..2dc9ef4c9a588177eaa917dc380662fb929e5da7 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class provides support for canceling recurring subscriptions
- *
+ * This class provides support for canceling recurring subscriptions.
  */
 class CRM_Contribute_Form_CancelSubscription extends CRM_Core_Form {
   protected $_paymentProcessorObj = NULL;
@@ -54,8 +51,6 @@ class CRM_Contribute_Form_CancelSubscription extends CRM_Core_Form {
 
   /**
    * Set variables up before form is built.
-   *
-   * @return void
    */
   public function preProcess() {
     $this->_mid = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE);
@@ -132,8 +127,6 @@ class CRM_Contribute_Form_CancelSubscription extends CRM_Core_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     // Determine if we can cancel recurring contribution via API with this processor
@@ -196,9 +189,6 @@ class CRM_Contribute_Form_CancelSubscription extends CRM_Core_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     $status = $message = NULL;
index ef2f10bc262565fc17e44c6174f65ac03b2ec453..fa4b7e4939b98695978ea23ad8a33fb6b5bfd2f7 100644 (file)
@@ -290,7 +290,6 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
 
     // Set title
     if ($this->_mode) {
-      CRM_Financial_Form_Payment::addCreditCardJs();
       $this->setPageTitle($this->_ppID ? ts('Credit Card Pledge Payment') : ts('Credit Card Contribution'));
     }
     else {
@@ -885,7 +884,6 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
    */
   public static function formRule($fields, $files, $self) {
     $errors = array();
-
     // Check for Credit Card Contribution.
     if ($self->_mode) {
       if (empty($fields['payment_processor_id'])) {
@@ -927,11 +925,17 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
     CRM_Contribute_BAO_ContributionRecur::validateRecurContribution($fields, $files, $self, $errors);
 
     // Form rule for status http://wiki.civicrm.org/confluence/display/CRM/CiviAccounts+4.3+Data+Flow
-    if ($self->_id && $self->_values['contribution_status_id'] != $fields['contribution_status_id']) {
+    if (($self->_action & CRM_Core_Action::UPDATE)
+      && $self->_id
+      && $self->_values['contribution_status_id'] != $fields['contribution_status_id']
+    ) {
       CRM_Contribute_BAO_Contribution::checkStatusValidation($self->_values, $fields, $errors);
     }
     // CRM-16015, add form-rule to restrict change of financial type if using price field of different financial type
-    if ($self->_id && $self->_values['financial_type_id'] != $fields['financial_type_id']) {
+    if (($self->_action & CRM_Core_Action::UPDATE)
+      && $self->_id
+      && $self->_values['financial_type_id'] != $fields['financial_type_id']
+    ) {
       CRM_Contribute_BAO_Contribution::checkFinancialTypeChange(NULL, $self->_id, $errors);
     }
     //FIXME FOR NEW DATA FLOW http://wiki.civicrm.org/confluence/display/CRM/CiviAccounts+4.3+Data+Flow
@@ -1027,7 +1031,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
    *   Contact ID
    *
    * @return bool|\CRM_Contribute_DAO_Contribution
-   * @throws \CiviCRM_API3_Exception
+   * @throws \CRM_Core_Exception
    * @throws \Civi\Payment\Exception\PaymentProcessorException
    */
   protected function processCreditCard($submittedValues, $lineItem, $contactID) {
@@ -1052,13 +1056,13 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
       $submittedValues['source'] = ts('Submit Credit Card Payment by: %1', array(1 => $userSortName));
     }
 
-    $params = $this->_params = $submittedValues;
+    $params = $submittedValues;
+    $this->_params = array_merge($this->_params, $submittedValues);
 
     // Mapping requiring documentation.
     $this->_params['payment_processor'] = $submittedValues['payment_processor_id'];
 
     $now = date('YmdHis');
-    $fields = array();
 
     // we need to retrieve email address
     if ($this->_context == 'standalone' && !empty($submittedValues['is_email_receipt'])) {
@@ -1068,56 +1072,13 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
       $this->assign('displayName', $this->userDisplayName);
     }
 
-    // Set email for primary location.
-    $fields['email-Primary'] = 1;
-    $params['email-Primary'] = $this->userEmail;
-
-    // now set the values for the billing location.
-    foreach (array_keys($this->_fields) as $name) {
-      $fields[$name] = 1;
-    }
-
-    // also add location name to the array
-    $params["address_name-{$this->_bltID}"] = CRM_Utils_Array::value('billing_first_name', $params) . ' ' . CRM_Utils_Array::value('billing_middle_name', $params) . ' ' . CRM_Utils_Array::value('billing_last_name', $params);
-
-    $params["address_name-{$this->_bltID}"] = trim($params["address_name-{$this->_bltID}"]);
-    $fields["address_name-{$this->_bltID}"] = 1;
-
-    $nameFields = array('first_name', 'middle_name', 'last_name');
-    foreach ($nameFields as $name) {
-      $fields[$name] = 1;
-      if (array_key_exists("billing_$name", $params)) {
-        $params[$name] = $params["billing_{$name}"];
-        $params['preserveDBName'] = TRUE;
-      }
-    }
-
+    $this->_contributorEmail = $this->userEmail;
+    $this->_contributorContactID = $contactID;
+    $this->processBillingAddress();
     if (!empty($params['source'])) {
       unset($params['source']);
     }
-    CRM_Contact_BAO_Contact::createProfileContact($params, $fields,
-      $contactID,
-      NULL, NULL,
-      CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact',
-        $contactID,
-        'contact_type'
-      )
-    );
-
-    // add all the additional payment params we need
-    if (!empty($this->_params["billing_state_province_id-{$this->_bltID}"])) {
-      $this->_params["state_province-{$this->_bltID}"] = $this->_params["billing_state_province-{$this->_bltID}"] = CRM_Core_PseudoConstant::stateProvinceAbbreviation($this->_params["billing_state_province_id-{$this->_bltID}"]);
-    }
-    if (!empty($this->_params["billing_country_id-{$this->_bltID}"])) {
-      $this->_params["country-{$this->_bltID}"] = $this->_params["billing_country-{$this->_bltID}"] = CRM_Core_PseudoConstant::countryIsoCode($this->_params["billing_country_id-{$this->_bltID}"]);
-    }
-
-    if (in_array('credit_card_exp_date', array_keys($this->_paymentFields))) {
-      $this->_params['year'] = CRM_Core_Payment_Form::getCreditCardExpirationYear($this->_params);
-      $this->_params['month'] = CRM_Core_Payment_Form::getCreditCardExpirationMonth($this->_params);
-    }
 
-    $this->_params['ip_address'] = CRM_Utils_System::ipAddress();
     $this->_params['amount'] = $this->_params['total_amount'];
     $this->_params['amount_level'] = 0;
     $this->_params['description'] = ts("Contribution submitted by a staff person using contributor's credit card");
@@ -1130,11 +1091,6 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
       $this->_params['receive_date'] = CRM_Utils_Date::processDate($this->_params['receive_date'], $this->_params['receive_date_time']);
     }
 
-    if (!empty($params['soft_credit_to'])) {
-      $this->_params['soft_credit_to'] = $params['soft_credit_to'];
-      $this->_params['pcp_made_through_id'] = $params['pcp_made_through_id'];
-    }
-
     $this->_params['pcp_display_in_roll'] = CRM_Utils_Array::value('pcp_display_in_roll', $params);
     $this->_params['pcp_roll_nickname'] = CRM_Utils_Array::value('pcp_roll_nickname', $params);
     $this->_params['pcp_personal_note'] = CRM_Utils_Array::value('pcp_personal_note', $params);
@@ -1217,7 +1173,6 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
       NULL,
       $contributionParams,
       $financialType,
-      TRUE,
       FALSE,
       $this->_bltID
     );
@@ -1253,6 +1208,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
               'trxn_id' => $result['trxn_id'],
               'payment_processor_id' => $this->_paymentProcessor['id'],
               'is_transactional' => FALSE,
+              'fee_amount' => CRM_Utils_Array::value('fee_amount', $result),
             ));
             // This has now been set to 1 in the DB - declare it here also
             $contribution->contribution_status_id = 1;
@@ -1412,6 +1368,8 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
   protected function submit($submittedValues, $action, $pledgePaymentID) {
     $softParams = $softIDs = array();
     $pId = $contribution = $isRelatedId = FALSE;
+    $this->_params = $submittedValues;
+    $this->beginPostProcess();
 
     if (!empty($submittedValues['price_set_id']) && $action & CRM_Core_Action::UPDATE) {
       $line = CRM_Price_BAO_LineItem::getLineItems($this->_id, 'contribution');
@@ -1547,42 +1505,17 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
     }
     $this->assign('lineItem', !empty($lineItem) && !$isQuickConfig ? $lineItem : FALSE);
 
-    if (!empty($submittedValues['pcp_made_through_id'])) {
-      $pcp = array();
-      $fields = array(
-        'pcp_made_through_id',
-        'pcp_display_in_roll',
-        'pcp_roll_nickname',
-        'pcp_personal_note',
-      );
-      foreach ($fields as $f) {
-        $pcp[$f] = CRM_Utils_Array::value($f, $submittedValues);
-      }
-    }
-
     $isEmpty = array_keys(array_flip($submittedValues['soft_credit_contact_id']));
     if ($this->_id && count($isEmpty) == 1 && key($isEmpty) == NULL) {
       //Delete existing soft credit records if soft credit list is empty on update
       CRM_Contribute_BAO_ContributionSoft::del(array('contribution_id' => $this->_id, 'pcp_id' => 0));
     }
-    else {
-      //build soft credit params
-      foreach ($submittedValues['soft_credit_contact_id'] as $key => $val) {
-        if ($val && $submittedValues['soft_credit_amount'][$key]) {
-          $softParams[$key]['contact_id'] = $val;
-          $softParams[$key]['amount'] = CRM_Utils_Rule::cleanMoney($submittedValues['soft_credit_amount'][$key]);
-          $softParams[$key]['soft_credit_type_id'] = $submittedValues['soft_credit_type'][$key];
-          if (!empty($submittedValues['soft_credit_id'][$key])) {
-            $softIDs[] = $softParams[$key]['id'] = $submittedValues['soft_credit_id'][$key];
-          }
-        }
-      }
-    }
 
     // set the contact, when contact is selected
     if (!empty($submittedValues['contact_id'])) {
       $this->_contactID = $submittedValues['contact_id'];
     }
+
     $formValues = $submittedValues;
 
     // Credit Card Contribution.
@@ -1615,6 +1548,10 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
       $params['contact_id'] = $this->_contactID;
       $params['currency'] = $this->getCurrency($submittedValues);
 
+      //format soft-credit/pcp param first
+      CRM_Contribute_BAO_ContributionSoft::formatSoftCreditParams($submittedValues, $this);
+      $params = array_merge($params, $submittedValues);
+
       $fields = array(
         'financial_type_id',
         'contribution_status_id',
@@ -1627,12 +1564,6 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
         $params[$f] = CRM_Utils_Array::value($f, $formValues);
       }
 
-      if (!empty($pcp)) {
-        $params['pcp'] = $pcp;
-      }
-      $params['soft_credit'] = !empty($softParams) ? $softParams : array();
-      $params['soft_credit_ids'] = !empty($softIDs) ? $softIDs : array();
-
       // CRM-5740 if priceset is used, no need to cleanup money.
       if ($priceSetId) {
         $params['skipCleanMoney'] = 1;
index 33888d22e5a953a7e7b99e214c52c69fea95f8af..4d727c42ac60d5bd57a5c02f7fc725a266c3da5f 100644 (file)
@@ -810,8 +810,6 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
    *   - thankyou_date (not all forms will set this)
    *
    * @param CRM_Financial_DAO_FinancialType $financialType
-   * @param bool $pending
-   *   The intention is this should always be TRUE and we are refactoring towards any completion happening elsewhere.
    * @param bool $online
    *   Is the form a front end form? If so set a bunch of unpredictable things that should be passed in from the form.
    *
@@ -827,7 +825,6 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     $result,
     $contributionParams,
     $financialType,
-    $pending,
     $online,
     $billingLocationID
   ) {
@@ -835,13 +832,10 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     $contactID = $contributionParams['contact_id'];
 
     $isEmailReceipt = !empty($form->_values['is_email_receipt']);
-    // How do these vary from params? These are currently passed to
-    // - custom data function....
-    $formParams = $form->_params;
-    $isSeparateMembershipPayment = empty($formParams['separate_membership_payment']) ? FALSE : TRUE;
-    $pledgeID = empty($formParams['pledge_id']) ? NULL : $formParams['pledge_id'];
+    $isSeparateMembershipPayment = empty($params['separate_membership_payment']) ? FALSE : TRUE;
+    $pledgeID = empty($params['pledge_id']) ? NULL : $params['pledge_id'];
     if (!$isSeparateMembershipPayment && !empty($form->_values['pledge_block_id']) &&
-      (!empty($formParams['is_pledge']) || $pledgeID)) {
+      (!empty($params['is_pledge']) || $pledgeID)) {
       $isPledge = TRUE;
     }
     else {
@@ -871,28 +865,9 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
       $receiptDate = $now;
     }
 
-    // Prepare soft contribution due to pcp or Submit Credit / Debit Card Contribution by admin.
-    if (!empty($params['pcp_made_through_id']) || !empty($params['soft_credit_to'])) {
-      // if its due to pcp
-      if (!empty($params['pcp_made_through_id'])) {
-        $contributionParams['soft_credit_to'] = CRM_Core_DAO::getFieldValue(
-          'CRM_PCP_DAO_PCP',
-          $params['pcp_made_through_id'],
-          'contact_id'
-        );
-        // Pass these details onto with the contribution to make them
-        // available at hook_post_process, CRM-8908
-        // @todo - obsolete?
-        $params['soft_credit_to'] = $contributionParams['soft_credit_to'];
-      }
-      else {
-        $contributionParams['soft_credit_to'] = CRM_Utils_Array::value('soft_credit_to', $params);
-      }
-    }
-
     if (isset($params['amount'])) {
       $contributionParams = array_merge(self::getContributionParams(
-        $params, $financialType->id, $nonDeductibleAmount, $pending,
+        $params, $financialType->id, $nonDeductibleAmount, TRUE,
         $result, $receiptDate,
         $recurringContributionID), $contributionParams
       );
@@ -929,18 +904,18 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
       $form->_contributionID = $contribution->id;
     }
 
-    //CRM-13981, processing honor contact into soft-credit contribution
-    CRM_Contact_Form_ProfileContact::postProcess($form);
+    // process soft credit / pcp params first
+    CRM_Contribute_BAO_ContributionSoft::formatSoftCreditParams($params, $form);
 
-    // process soft credit / pcp pages
-    CRM_Contribute_Form_Contribution_Confirm::processPcpSoft($params, $contribution);
+    //CRM-13981, processing honor contact into soft-credit contribution
+    CRM_Contribute_BAO_ContributionSoft::processSoftContribution($params, $contribution);
 
     //handle pledge stuff.
     if ($isPledge) {
       if ($pledgeID) {
         //when user doing pledge payments.
         //update the schedule when payment(s) are made
-        foreach ($form->_params['pledge_amount'] as $paymentId => $dontCare) {
+        foreach ($params['pledge_amount'] as $paymentId => $dontCare) {
           $scheduledAmount = CRM_Core_DAO::getFieldValue(
             'CRM_Pledge_DAO_PledgePayment',
             $paymentId,
@@ -1013,7 +988,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     }
 
     if ($online && $contribution) {
-      CRM_Core_BAO_CustomValueTable::postProcess($form->_params,
+      CRM_Core_BAO_CustomValueTable::postProcess($params,
         'civicrm_contribution',
         $contribution->id,
         'Contribution'
@@ -1278,47 +1253,6 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     }
   }
 
-  /**
-   * Function used to save pcp / soft credit entry.
-   *
-   * This is used by contribution and also event pcps
-   *
-   * @param array $params
-   * @param object $contribution
-   *   Contribution object.
-   */
-  public static function processPcpSoft(&$params, &$contribution) {
-    // Add soft contribution due to pcp or Submit Credit / Debit Card Contribution by admin.
-    if (!empty($params['soft_credit_to'])) {
-      $contributionSoftParams = array();
-      foreach (array(
-          'pcp_display_in_roll',
-          'pcp_roll_nickname',
-          'pcp_personal_note',
-          'amount',
-        ) as $val) {
-        if (!empty($params[$val])) {
-          $contributionSoftParams[$val] = $params[$val];
-        }
-      }
-
-      $contributionSoftParams['contact_id'] = $params['soft_credit_to'];
-      // add contribution id
-      $contributionSoftParams['contribution_id'] = $contribution->id;
-      // add pcp id
-      $contributionSoftParams['pcp_id'] = $params['pcp_made_through_id'];
-
-      $contributionSoftParams['soft_credit_type_id'] = CRM_Core_OptionGroup::getValue('soft_credit_type', 'pcp', 'name');
-
-      $contributionSoft = CRM_Contribute_BAO_ContributionSoft::add($contributionSoftParams);
-
-      //Send notification to owner for PCP
-      if ($contributionSoft->id && $contributionSoft->pcp_id) {
-        CRM_Contribute_Form_Contribution_Confirm::pcpNotifyOwner($contribution, $contributionSoft);
-      }
-    }
-  }
-
   /**
    * Function used to send notification mail to pcp owner.
    *
@@ -1662,24 +1596,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
       }
       $payment = Civi\Payment\System::singleton()->getByProcessor($form->_paymentProcessor);
       $paymentActionResult = $payment->doPayment($form->_params, 'contribute');
-
-      if (CRM_Utils_Array::value('payment_status_id', $paymentActionResult) == 1) {
-        // Refer to CRM-16737. Payment processors 'should' return payment_status_id
-        // to denote the outcome of the transaction.
-        try {
-          civicrm_api3('contribution', 'completetransaction', array(
-            'id' => $paymentResult['contribution']->id,
-            'trxn_id' => CRM_Utils_Array::value('trxn_id', $paymentActionResult, $paymentResult['contribution']->trxn_id),
-            'is_transactional' => FALSE,
-            'payment_processor_id' => $form->_paymentProcessor['id'],
-          ));
-        }
-        catch (CiviCRM_API3_Exception $e) {
-          if ($e->getErrorCode() != 'contribution_completed') {
-            throw new CRM_Core_Exception('Failed to update contribution in database');
-          }
-        }
-      }
+      $this->completeTransaction($paymentActionResult, $paymentResult['contribution']->id);
       // Do not send an email if Recurring transaction is done via Direct Mode
       // Email will we sent when the IPN is received.
       return;
@@ -1732,19 +1649,6 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     $tempParams['amount'] = $minimumFee;
     $tempParams['invoiceID'] = md5(uniqid(rand(), TRUE));
 
-    $result = NULL;
-    if ($form->_values['is_monetary'] && !$form->_params['is_pay_later'] && $minimumFee > 0.0) {
-      // At the moment our tests are calling this form in a way that leaves 'object' empty. For
-      // now we compensate here.
-      if (empty($form->_paymentProcessor['object'])) {
-        $payment = Civi\Payment\System::singleton()->getByProcessor($this->_paymentProcessor);
-      }
-      else {
-        $payment = $form->_paymentProcessor['object'];
-      }
-      $result = $payment->doPayment($tempParams, 'contribute');
-    }
-
     //assign receive date when separate membership payment
     //and contribution amount not selected.
     if ($form->_amount == 0) {
@@ -1755,22 +1659,13 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
       $form->assign('receive_date', $receiveDate);
     }
 
-    $form->set('membership_trx_id', $result['trxn_id']);
     $form->set('membership_amount', $minimumFee);
-
-    $form->assign('membership_trx_id', $result['trxn_id']);
     $form->assign('membership_amount', $minimumFee);
 
     // we don't need to create the user twice, so lets disable cms_create_account
     // irrespective of the value, CRM-2888
     $tempParams['cms_create_account'] = 0;
 
-    //CRM-16165, scenarios are
-    // 1) If contribution is_pay_later and if contribution amount is > 0.0 we set pending = TRUE, vice-versa FALSE
-    // 2) If not pay later but auto-renewal membership is chosen then pending = TRUE as it later triggers
-    //   pending recurring contribution, vice-versa FALSE
-    $pending = $form->_params['is_pay_later'] ? (($minimumFee > 0.0) ? TRUE : FALSE) : (!empty($form->_params['auto_renew']) ? TRUE : FALSE);
-
     //set this variable as we are not creating pledge for
     //separate membership payment contribution.
     //so for differentiating membership contribution from
@@ -1788,19 +1683,33 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     $isMonetary = !empty($form->_values['is_monetary']);
     if ($isMonetary) {
       if (empty($paymentParams['is_pay_later'])) {
-        // @todo look up payment_instrument_id on payment processor table.
-        $contributionParams['payment_instrument_id'] = 1;
+        $contributionParams['payment_instrument_id'] = $form->_paymentProcessor['payment_instrument_id'];
       }
     }
     $membershipContribution = CRM_Contribute_Form_Contribution_Confirm::processFormContribution($form,
       $tempParams,
-      $result,
+      $tempParams,
       $contributionParams,
       $financialType,
-      $pending,
       TRUE,
       $form->_bltID
     );
+
+    if ($form->_values['is_monetary'] && !$form->_params['is_pay_later'] && $minimumFee > 0.0) {
+      // At the moment our tests are calling this form in a way that leaves 'object' empty. For
+      // now we compensate here.
+      if (empty($form->_paymentProcessor['object'])) {
+        $payment = Civi\Payment\System::singleton()->getByProcessor($this->_paymentProcessor);
+      }
+      else {
+        $payment = $form->_paymentProcessor['object'];
+      }
+      $result = $payment->doPayment($tempParams, 'contribute');
+      $form->set('membership_trx_id', $result['trxn_id']);
+      $form->assign('membership_trx_id', $result['trxn_id']);
+      $this->completeTransaction($result, $membershipContribution->id);
+    }
+
     return $membershipContribution;
   }
 
@@ -2276,27 +2185,13 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
         ($this->_mode == 'test') ? 1 : 0
       );
 
-      if (!empty($result['is_payment_failure'])) {
-        return $result;
-      }
-      // @todo move premium processing to complete transaction if it truly is an 'after' action.
-      $this->postProcessPremium($premiumParams, $result['contribution']);
-      if (CRM_Utils_Array::value('payment_status_id', $result) == 1) {
-        try {
-          civicrm_api3('contribution', 'completetransaction', array(
-              'id' => $result['contribution']->id,
-              'trxn_id' => CRM_Utils_Array::value('trxn_id', $result),
-              'payment_processor_id' => $this->_paymentProcessor['id'],
-              'is_transactional' => FALSE,
-            )
-          );
-        }
-        catch (CiviCRM_API3_Exception $e) {
-          if ($e->getErrorCode() != 'contribution_completed') {
-            throw new CRM_Core_Exception('Failed to update contribution in database');
-          }
-        }
-
+      if (empty($result['is_payment_failure'])) {
+        // @todo move premium processing to complete transaction if it truly is an 'after' action.
+        $this->postProcessPremium($premiumParams, $result['contribution']);
+      }
+      if (!empty($result['contribution'])) {
+        // Not quite sure why it would be empty at this stage but tests show it can be ... at least in tests.
+        $this->completeTransaction($result, $result['contribution']->id);
       }
       return $result;
     }
@@ -2404,4 +2299,36 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     }
   }
 
+  /**
+   * Complete transaction if payment has been processed.
+   *
+   * Check the result for a success outcome & if paid then complete the transaction.
+   *
+   * Completing will trigger update of related entities and emails.
+   *
+   * @param array $result
+   * @param int $contributionID
+   *
+   * @throws \CRM_Core_Exception
+   */
+  protected function completeTransaction($result, $contributionID) {
+    if (CRM_Utils_Array::value('payment_status_id', $result) == 1) {
+      try {
+        civicrm_api3('contribution', 'completetransaction', array(
+            'id' => $contributionID,
+            'trxn_id' => CRM_Utils_Array::value('trxn_id', $result),
+            'payment_processor_id' => $this->_paymentProcessor['id'],
+            'is_transactional' => FALSE,
+            'fee_amount' => CRM_Utils_Array::value('fee_amount', $result),
+          )
+        );
+      }
+      catch (CiviCRM_API3_Exception $e) {
+        if ($e->getErrorCode() != 'contribution_completed') {
+          throw new CRM_Core_Exception('Failed to update contribution in database');
+        }
+      }
+    }
+  }
+
 }
index eeb94c6fcf723106bb68811977e4a321f0dc849f..0832bd9aa47fd006f5fe563461b8d33121ba78f9 100644 (file)
@@ -1294,7 +1294,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
     $this->set('invoiceID', $invoiceID);
     $params['invoiceID'] = $invoiceID;
     $params['description'] = ts('Online Contribution') . ': ' . (($this->_pcpInfo['title']) ? $this->_pcpInfo['title'] : $this->_values['title']);
-
+    $params['button'] = $this->controller->getButtonName();
     // required only if is_monetary and valid positive amount
     if ($this->_values['is_monetary'] &&
       is_array($this->_paymentProcessor) &&
@@ -1346,31 +1346,6 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
 
   }
 
-  /**
-   * Handle pre approval for processors.
-   *
-   * This fits with the flow where a pre-approval is done and then confirmed in the next stage when confirm is hit.
-   *
-   * This applies to processors that
-   * @param array $params
-   */
-  protected function handlePreApproval(&$params) {
-    try {
-      $payment = Civi\Payment\System::singleton()->getByProcessor($this->_paymentProcessor);
-      $params['component'] = 'contribute';
-      $result = $payment->doPreApproval($params);
-    }
-    catch (\Civi\Payment\Exception\PaymentProcessorException $e) {
-      CRM_Core_Error::displaySessionError($e->getMessage());
-      CRM_Utils_System::redirect($params['cancelURL']);
-    }
-
-    $this->set('pre_approval_parameters', $result['pre_approval_parameters']);
-    if (!empty($result['redirect_url'])) {
-      CRM_Utils_System::redirect($result['redirect_url']);
-    }
-  }
-
   /**
    * Process confirm function and pass browser to the thank you page.
    */
index b676e62b371e104cdbda757113afd40c278f96d9..7a87c60884ed9069520d9b5be15039f8b19287a0 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contribute_Form_Contribution_OnBehalfOf {
 
@@ -38,8 +36,6 @@ class CRM_Contribute_Form_Contribution_OnBehalfOf {
    * Set variables up before form is built.
    *
    * @param CRM_Core_Form $form
-   *
-   * @return void
    */
   public static function preProcess(&$form) {
     $session = CRM_Core_Session::singleton();
index 89cdcd82757659a74027a3ed745b509e2567b457..abe880aef8b53e3fb7c196afc3735561de9e7594 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * form for thank-you / success page - 3rd step of online contribution process
+ * Form for thank-you / success page - 3rd step of online contribution process.
  */
 class CRM_Contribute_Form_Contribution_ThankYou extends CRM_Contribute_Form_ContributionBase {
 
@@ -87,8 +85,6 @@ class CRM_Contribute_Form_Contribution_ThankYou extends CRM_Contribute_Form_Cont
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $this->assignToTemplate();
index 17d50d48bb192f61b7f107c2fdaa1e59275056d3..f5868f59c406709f55f5c80e2fd4452fca580ae5 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contribute_Form_ContributionCharts extends CRM_Core_Form {
 
@@ -63,9 +61,6 @@ class CRM_Contribute_Form_ContributionCharts extends CRM_Core_Form {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     //p3 = Three dimensional pie chart.
@@ -99,9 +94,6 @@ class CRM_Contribute_Form_ContributionCharts extends CRM_Core_Form {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     $config = CRM_Core_Config::singleton();
index 76b8125b8d68f281bd8800181b1091e5d3e3db61..3c08ea6338e3962db70962e7f7219d2493cd916e 100644 (file)
@@ -89,8 +89,6 @@ class CRM_Contribute_Form_ContributionPage extends CRM_Core_Form {
 
   /**
    * Set variables up before form is built.
-   *
-   * @return void
    */
   public function preProcess() {
     // current contribution page id
@@ -153,8 +151,6 @@ class CRM_Contribute_Form_ContributionPage extends CRM_Core_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $this->applyFilter('__ALL__', 'trim');
@@ -356,8 +352,6 @@ class CRM_Contribute_Form_ContributionPage extends CRM_Core_Form {
 
   /**
    * Process the form.
-   *
-   * @return void
    */
   public function postProcess() {
     $pageId = $this->get('id');
index d20fad99e902be83d0e1fddb1306b44e73452756..5236b04f9b591a56df2c74a1cc7f9425af95dffa 100644 (file)
@@ -63,11 +63,9 @@ class CRM_Contribute_Form_ContributionPage_AddProduct extends CRM_Contribute_For
   }
 
   /**
-   * Set default values for the form. Note that in edit/view mode
-   * the default values are retrieved from the database
+   * Set default values for the form.
    *
-   *
-   * @return void
+   * Note that in edit/view mode the default values are retrieved from the database.
    */
   public function setDefaultValues() {
     $defaults = array();
@@ -107,8 +105,6 @@ class CRM_Contribute_Form_ContributionPage_AddProduct extends CRM_Contribute_For
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $urlParams = 'civicrm/admin/contribute/premium';
@@ -224,8 +220,6 @@ class CRM_Contribute_Form_ContributionPage_AddProduct extends CRM_Contribute_For
 
   /**
    * Process the form.
-   *
-   * @return void
    */
   public function postProcess() {
     // get the submitted form values.
index edac8f89040ff959b2816868fa063af283e50327..2b12b55fd8cd27b4dbdf2daafde7e6d41fe0d400 100644 (file)
@@ -50,8 +50,6 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
 
@@ -415,8 +413,6 @@ SELECT id
 
   /**
    * Process the form.
-   *
-   * @return void
    */
   public function postProcess() {
     // get the submitted form values.
index 9b2038353544661fbdf1825c368298abc3aaa4c3..36c6bd495267c0c4b70f0cd30afbcd5445afb632 100644 (file)
@@ -37,8 +37,6 @@ class CRM_Contribute_Form_ContributionPage_Custom extends CRM_Contribute_Form_Co
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
 
@@ -81,11 +79,9 @@ class CRM_Contribute_Form_ContributionPage_Custom extends CRM_Contribute_Form_Co
   }
 
   /**
-   * Set default values for the form. Note that in edit/view mode
-   * the default values are retrieved from the database
-   *
+   * Set default values for the form.
    *
-   * @return void
+   * Note that in edit/view mode the default values are retrieved from the database.
    */
   public function setDefaultValues() {
     $defaults = parent::setDefaultValues();
@@ -104,8 +100,6 @@ class CRM_Contribute_Form_ContributionPage_Custom extends CRM_Contribute_Form_Co
 
   /**
    * Process the form.
-   *
-   * @return void
    */
   public function postProcess() {
     // get the submitted form values.
index 956505002dea227abd3f72c527ffbbc99e07f5ed..ae7d9aa685a89e79696de745b8219a0f2ffc0832 100644 (file)
@@ -32,7 +32,7 @@
  */
 
 /**
- * This class is to build the form for Deleting Group
+ * This class is to build the form for Deleting Group.
  */
 class CRM_Contribute_Form_ContributionPage_Delete extends CRM_Contribute_Form_ContributionPage {
 
@@ -50,8 +50,6 @@ class CRM_Contribute_Form_ContributionPage_Delete extends CRM_Contribute_Form_Co
 
   /**
    * Set variables up before form is built.
-   *
-   * @return void
    */
   public function preProcess() {
     //Check if there are contributions related to Contribution Page
@@ -74,8 +72,6 @@ class CRM_Contribute_Form_ContributionPage_Delete extends CRM_Contribute_Form_Co
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $this->_title = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'title');
index 895c329cb472371fb7179c9df66c86c03752453c..e5f7d5ae5c848c2f92ab974da0e04165ec8d769c 100644 (file)
@@ -37,8 +37,7 @@
 class CRM_Contribute_Form_ContributionPage_Premium extends CRM_Contribute_Form_ContributionPage {
 
   /**
-   * Set default values for the form. Note that in edit/view mode
-   * the default values are retrieved from the database
+   * Set default values for the form.
    */
   public function setDefaultValues() {
     $defaults = array();
@@ -54,8 +53,6 @@ class CRM_Contribute_Form_ContributionPage_Premium extends CRM_Contribute_Form_C
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Premium');
@@ -122,8 +119,6 @@ class CRM_Contribute_Form_ContributionPage_Premium extends CRM_Contribute_Form_C
 
   /**
    * Process the form.
-   *
-   * @return void
    */
   public function postProcess() {
     // get the submitted form values.
index a96613fca4b4fb5de892701af920a112f51884fc..448645e660f2ac1d34683409be4c05728f1103b3 100644 (file)
@@ -40,11 +40,7 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_
   }
 
   /**
-   * Set default values for the form. Note that in edit/view mode
-   * the default values are retrieved from the database
-   *
-   *
-   * @return void
+   * Set default values for the form.
    */
   public function setDefaultValues() {
     $defaults = parent::setDefaultValues();
@@ -100,8 +96,6 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
 
@@ -294,8 +288,6 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_
 
   /**
    * Process the form.
-   *
-   * @return void
    */
   public function postProcess() {
     // get the submitted form values.
index 7a87174b4413ea250293f84633a3098ef2ba20e9..5f22ef4ae975f3d14fa0aa0b0738a1c9542f2787 100644 (file)
 class CRM_Contribute_Form_ContributionPage_ThankYou extends CRM_Contribute_Form_ContributionPage {
 
   /**
-   * Set default values for the form. Note that in edit/view mode
-   * the default values are retrieved from the database
+   * Set default values for the form.
    *
-   *
-   * @return void
+   * Note that in edit/view mode the default values are retrieved from the database.
    */
   public function setDefaultValues() {
     return parent::setDefaultValues();
@@ -49,8 +47,6 @@ class CRM_Contribute_Form_ContributionPage_ThankYou extends CRM_Contribute_Form_
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $this->registerRule('emailList', 'callback', 'emailList', 'CRM_Utils_Rule');
@@ -106,8 +102,6 @@ class CRM_Contribute_Form_ContributionPage_ThankYou extends CRM_Contribute_Form_
 
   /**
    * Process the form.
-   *
-   * @return void
    */
   public function postProcess() {
     // get the submitted form values.
index 9ed2d26353445d3e2c7e43eaca7f3557e348382d..1b84182c64508c5c57f77c4b085eb0cab755e9c4 100644 (file)
@@ -93,7 +93,7 @@ class CRM_Contribute_Form_ContributionPage_Widget extends CRM_Contribute_Form_Co
         ts('Progress Bar Color'),
         'text',
         FALSE,
-        '#FFFFFF',
+        '#2786C2',
       ),
       'color_main_text' => array(
         ts('Additional Text Color'),
@@ -120,7 +120,7 @@ class CRM_Contribute_Form_ContributionPage_Widget extends CRM_Contribute_Form_Co
         '#96C0E7',
       ),
       'color_about_link' => array(
-        ts('Button Link Color'),
+        ts('Button Text Color'),
         'text',
         FALSE,
         '#556C82',
@@ -141,13 +141,7 @@ class CRM_Contribute_Form_ContributionPage_Widget extends CRM_Contribute_Form_Co
   }
 
   /**
-   * Set default values for the form. Note that in edit/view mode
-   * the default values are retrieved from the database
-   *
-   *
-   * @return void
-   */
-  /**
+   * Set default values for the form.
    */
   public function setDefaultValues() {
     $defaults = array();
index 21ee9334190ca0977ebde1b0ea94e33827f7b8ce..988a6a423c9251067a877b9ea5246d8bcb2fb0c5 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for Payment-Instrument
- *
+ * This class generates form components for Payment-Instrument.
  */
 class CRM_Contribute_Form_ContributionView extends CRM_Core_Form {
 
   /**
    * Set variables up before form is built.
-   *
-   * @return void
    */
   public function preProcess() {
     $id = $this->get('id');
@@ -204,8 +199,6 @@ class CRM_Contribute_Form_ContributionView extends CRM_Core_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
 
index bac2af38c6c584adc2d2dcf7764b5e2d79cceb9c..35bcb9e09a379226868878f48a215d6147fa6a91 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for Premiums
- *
+ * This class generates form components for Premiums.
  */
 class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form {
 
@@ -47,11 +44,7 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form {
   }
 
   /**
-   * Set default values for the form. Manage Premiums that in edit/view mode
-   * the default values are retrieved from the database
-   *
-   *
-   * @return void
+   * Set default values for the form.
    */
   public function setDefaultValues() {
     $defaults = parent::setDefaultValues();
@@ -83,8 +76,6 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -273,9 +264,6 @@ class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
 
index 4743cf8e84a8331ec1a3f30382895771eff7f9cf..b828bc6434613e46423b7a682394a4c690b65856 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contribute_Form_SearchContribution extends CRM_Core_Form {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'title');
index 35eab138c28f1c9fd519951bc82cfc360f7f4cb0..7561df91bba7629d385466736b63ed0689600fe8 100644 (file)
@@ -40,8 +40,6 @@ class CRM_Contribute_Form_SoftCredit {
    * Set variables up before form is built.
    *
    * @param CRM_Core_Form $form
-   *
-   * @return void
    */
   public static function preProcess(&$form) {
     $contriDAO = new CRM_Contribute_DAO_Contribution();
@@ -63,13 +61,12 @@ class CRM_Contribute_Form_SoftCredit {
     }
   }
 
-
   /**
    * Function used to build form element for soft credit block.
    *
    * @param CRM_Core_Form $form
    *
-   * @return void
+   * @return \CRM_Core_Form
    */
   public static function buildQuickForm(&$form) {
     if (!empty($form->_honor_block_is_active)) {
index 16ed6ad54508449ae6617f47ece012f757ad3499..423c67437a377bdbdd9a08ea573ea498b9e1a424 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for relationship
- *
+ * This class generates form components for relationship.
  */
 class CRM_Contribute_Form_Task extends CRM_Core_Form {
 
@@ -90,10 +87,6 @@ class CRM_Contribute_Form_Task extends CRM_Core_Form {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @param
-   *
-   * @return void
    */
   public function preProcess() {
     self::preProcessCommon($this);
@@ -206,8 +199,6 @@ class CRM_Contribute_Form_Task extends CRM_Core_Form {
    *   Button type for the form after processing.
    * @param string $backType
    * @param bool $submitOnce
-   *
-   * @return void
    */
   public function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
     $this->addButtons(array(
index 139a760647ff95603bce4d574406bf93fc4bccc9..1832a45950800ca3380ceb6af89c9dcd7afaf3f3 100644 (file)
@@ -55,8 +55,6 @@ class CRM_Contribute_Form_Task_Batch extends CRM_Contribute_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     // initialize the task and row fields
@@ -80,9 +78,6 @@ class CRM_Contribute_Form_Task_Batch extends CRM_Contribute_Form_Task {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $ufGroupId = $this->get('ufGroupId');
@@ -183,9 +178,6 @@ class CRM_Contribute_Form_Task_Batch extends CRM_Contribute_Form_Task {
 
   /**
    * Set default values for the form.
-   *
-   *
-   * @return void
    */
   public function setDefaultValues() {
     if (empty($this->_fields)) {
@@ -203,9 +195,6 @@ class CRM_Contribute_Form_Task_Batch extends CRM_Contribute_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     $params = $this->exportValues();
index f14ba2b8eb2650bd7517c47f4b3e88ffbcae2493..222eba1a96a556e58aa457fbde994f9a44e1eafa 100644 (file)
@@ -48,8 +48,6 @@ class CRM_Contribute_Form_Task_Delete extends CRM_Contribute_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     //check for delete
@@ -61,9 +59,6 @@ class CRM_Contribute_Form_Task_Delete extends CRM_Contribute_Form_Task {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $this->addDefaultButtons(ts('Delete Contributions'), 'done');
@@ -71,9 +66,6 @@ class CRM_Contribute_Form_Task_Delete extends CRM_Contribute_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     $deleted = $failed = 0;
index af21b8491e408f662a5b00a662e303ca1d36a9f1..e2db75182a26e3252a349b18b027a12dd9e55f7f 100644 (file)
@@ -55,8 +55,6 @@ class CRM_Contribute_Form_Task_Email extends CRM_Contribute_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     CRM_Contact_Form_Task_EmailCommon::preProcessFromAddress($this);
@@ -70,9 +68,6 @@ class CRM_Contribute_Form_Task_Email extends CRM_Contribute_Form_Task {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     //enable form element
@@ -83,9 +78,6 @@ class CRM_Contribute_Form_Task_Email extends CRM_Contribute_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     CRM_Contact_Form_Task_EmailCommon::postProcess($this);
index 999a5724523637436b6ea4119df998ce5d38ec48..2baabaebb0d70b39a44a4f94e8f5c4cbe9d2fdf4 100644 (file)
@@ -66,8 +66,6 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE);
@@ -138,9 +136,6 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $session = CRM_Core_Session::singleton();
@@ -222,9 +217,6 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     $params = $this->controller->exportValues($this->_name);
@@ -232,8 +224,7 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task {
   }
 
   /**
-   * Process the PDf and email with activity and attachment.
-   * on click of Print Invoices
+   * Process the PDf and email with activity and attachment on click of Print Invoices.
    *
    * @param array $contribIDs
    *   Contribution Id.
@@ -456,12 +447,13 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task {
         $tplParams['creditnote_id'] = $creditNoteId;
       }
 
+      $pdfFileName = "{$invoiceId}.pdf";
       $sendTemplateParams = array(
         'groupName' => 'msg_tpl_workflow_contribution',
         'valueName' => 'contribution_invoice_receipt',
         'contactId' => $contribution->contact_id,
         'tplParams' => $tplParams,
-        'PDFFilename' => 'Invoice.pdf',
+        'PDFFilename' => $pdfFileName,
       );
       $session = CRM_Core_Session::singleton();
       $contactID = $session->get('userID');
@@ -519,7 +511,8 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task {
 
         list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams);
         // functions call for adding activity with attachment
-        $fileName = self::putFile($html);
+        $pdfFileName = "{$invoiceId}.pdf";
+        $fileName = self::putFile($html, $pdfFileName);
         self::addActivities($subject, $contribution->contact_id, $fileName, $params);
       }
       elseif ($contribution->_component == 'event') {
@@ -533,7 +526,8 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task {
 
         list($sent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate($sendTemplateParams);
         // functions call for adding activity with attachment
-        $fileName = self::putFile($html);
+        $pdfFileName = "{$invoiceId}.pdf";
+        $fileName = self::putFile($html, $pdfFileName);
         self::addActivities($subject, $contribution->contact_id, $fileName, $params);
       }
 
@@ -549,13 +543,14 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task {
         return $html;
       }
       else {
-        CRM_Utils_PDF_Utils::html2pdf($messageInvoice, 'Invoice.pdf', FALSE, array(
+        $pdfFileName = "{$invoiceId}.pdf";
+        CRM_Utils_PDF_Utils::html2pdf($messageInvoice, $pdfFileName, FALSE, array(
           'margin_top' => 10,
           'margin_left' => 65,
           'metric' => 'px',
         ));
         // functions call for adding activity with attachment
-        $fileName = self::putFile($html);
+        $fileName = self::putFile($html, $pdfFileName);
         self::addActivities($subject, $contactIds, $fileName, $params);
 
         CRM_Utils_System::civiExit();
@@ -633,14 +628,14 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task {
    * @return string
    *   Name of file which is in pdf format
    */
-  static public function putFile($html) {
+  static public function putFile($html, $name = 'Invoice.pdf') {
     require_once "vendor/dompdf/dompdf/dompdf_config.inc.php";
     $doc = new DOMPDF();
     $doc->load_html($html);
     $doc->render();
     $html = $doc->output();
     $config = CRM_Core_Config::singleton();
-    $fileName = $config->uploadDir . 'Invoice.pdf';
+    $fileName = $config->uploadDir . $name;
     file_put_contents($fileName, $html);
     return $fileName;
   }
index 00f9692061af0317ca1bcf5037b94daa9cf190f5..44db2609557de04e1af68b9532687ebf2d604178 100644 (file)
@@ -49,8 +49,6 @@ class CRM_Contribute_Form_Task_PDF extends CRM_Contribute_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     $id = CRM_Utils_Request::retrieve('id', 'Positive',
@@ -143,9 +141,6 @@ AND    {$this->_componentClause}";
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     // get all the details needed to generate a receipt
index c7ec8f94dce39b4ccb5d5303ae6a64be63d6138c..5b403005b69ece41e6f4e8e279de0f157c804912 100644 (file)
@@ -49,8 +49,6 @@ class CRM_Contribute_Form_Task_PDFLetter extends CRM_Contribute_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     $this->skipOnHold = $this->skipDeceased = FALSE;
@@ -102,9 +100,6 @@ class CRM_Contribute_Form_Task_PDFLetter extends CRM_Contribute_Form_Task {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     //enable form element
@@ -159,9 +154,6 @@ class CRM_Contribute_Form_Task_PDFLetter extends CRM_Contribute_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     CRM_Contribute_Form_Task_PDFLetterCommon::postProcess($this);
index 4ffd1113134a050edd3263c81b8a42c35c0d47f6..97e364987fe3719f9fb99f2745ffc34642db0646 100644 (file)
@@ -55,8 +55,6 @@ class CRM_Contribute_Form_Task_PickProfile extends CRM_Contribute_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     // initialize the task and row fields
@@ -69,7 +67,7 @@ class CRM_Contribute_Form_Task_PickProfile extends CRM_Contribute_Form_Task {
     $validate = FALSE;
     //validations
     if (count($this->_contributionIds) > $this->_maxContributions) {
-      CRM_Core_Session::setStatus(ts("The maximum number of contributions you can select for Batch Update is %1. You have selected %2. Please select fewer contributions from your search results and try again.", array(
+      CRM_Core_Session::setStatus(ts("The maximum number of contributions you can select for Batch update is %1. You have selected %2. Please select fewer contributions from your search results and try again.", array(
             1 => $this->_maxContributions,
             2 => count($this->_contributionIds),
           )), ts('Batch Update Error'), 'error');
@@ -84,9 +82,6 @@ class CRM_Contribute_Form_Task_PickProfile extends CRM_Contribute_Form_Task {
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
 
@@ -94,7 +89,7 @@ class CRM_Contribute_Form_Task_PickProfile extends CRM_Contribute_Form_Task {
     $profiles = CRM_Core_BAO_UFGroup::getProfiles($types, TRUE);
 
     if (empty($profiles)) {
-      CRM_Core_Session::setStatus(ts("You will need to create a Profile containing the %1 fields you want to edit before you can use Batch Update via Profile. Navigate to Administer CiviCRM > Customize Data and Screens > CiviCRM Profile to configure a Profile. Consult the online Administrator documentation for more information.", array(1 => $types[0])), ts('Profile Required'), 'error');
+      CRM_Core_Session::setStatus(ts("You will need to create a Profile containing the %1 fields you want to edit before you can use Batch update contributions via profile. Navigate to Administer CiviCRM > Customize Data and Screens > CiviCRM Profile to configure a Profile. Consult the online Administrator documentation for more information.", array(1 => $types[0])), ts('Profile Required'), 'error');
       CRM_Utils_System::redirect($this->_userContext);
     }
 
@@ -108,9 +103,6 @@ class CRM_Contribute_Form_Task_PickProfile extends CRM_Contribute_Form_Task {
 
   /**
    * Add local and global form rules.
-   *
-   *
-   * @return void
    */
   public function addRules() {
     $this->addFormRule(array('CRM_Contribute_Form_Task_PickProfile', 'formRule'));
@@ -131,9 +123,6 @@ class CRM_Contribute_Form_Task_PickProfile extends CRM_Contribute_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     $params = $this->exportValues();
index c0f522057e5247190bd6179259bf1ada01446870..967f3c3f32846fd4be7c3abb5623cfb133cfabe5 100644 (file)
@@ -38,8 +38,6 @@ class CRM_Contribute_Form_Task_Print extends CRM_Contribute_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     parent::preprocess();
@@ -64,16 +62,15 @@ class CRM_Contribute_Form_Task_Print extends CRM_Contribute_Form_Task {
   }
 
   /**
-   * Build the form object - it consists of
+   * Build the form object.
+   *
+   * It consists of
    *    - displaying the QILL (query in local language)
    *    - displaying elements for saving the search
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     //
-    // just need to add a javacript to popup the window for printing
+    // just need to add a javascript to popup the window for printing
     //
     $this->addButtons(array(
         array(
@@ -92,9 +89,6 @@ class CRM_Contribute_Form_Task_Print extends CRM_Contribute_Form_Task {
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     // redirect to the main search page after printing is over
index 53b954cd91cba883eda40326e8b756bba7d14548..903ae3658db33a04e75195c423ab8c94f00f9195 100644 (file)
@@ -38,8 +38,6 @@ class CRM_Contribute_Form_Task_Result extends CRM_Contribute_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
   }
index 89f59f59c1988f0219f390caae93bcb49bfec531..e455e784d2c04044a29beb28125afbb87676f757 100644 (file)
@@ -39,8 +39,6 @@ class CRM_Contribute_Form_Task_SearchTaskHookSample extends CRM_Contribute_Form_
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     parent::preProcess();
@@ -74,8 +72,6 @@ INNER JOIN civicrm_contact ct ON ( co.contact_id = ct.id )
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $this->addButtons(array(
index b5879ba2b84f49db4d423a30e7bd8728a86af246..2a645f3840427afcefe533b874f9cc38ab13dcc0 100644 (file)
@@ -32,8 +32,7 @@
  */
 
 /**
- * This class provides the functionality to email a group of
- * contacts.
+ * This class provides the functionality to email a group of contacts.
  */
 class CRM_Contribute_Form_Task_Status extends CRM_Contribute_Form_Task {
 
@@ -49,8 +48,6 @@ class CRM_Contribute_Form_Task_Status extends CRM_Contribute_Form_Task {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @return void
    */
   public function preProcess() {
     $id = CRM_Utils_Request::retrieve('id', 'Positive',
@@ -87,9 +84,6 @@ AND    {$this->_componentClause}";
 
   /**
    * Build the form object.
-   *
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $status = CRM_Contribute_PseudoConstant::contributionStatus();
@@ -212,9 +206,6 @@ AND    co.id IN ( $contribIDs )";
 
   /**
    * Process the form after the input has been submitted and validated.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     $params = $this->controller->exportValues($this->_name);
index bd7f21759bf7c87d7f7ad3f18b44823e05582866..38b3199221ea022cc3aa740dae75a46930437a65 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for processing a contribution
- *
+ * This class generates form components for processing a contribution.
  */
 class CRM_Contribute_Form_UpdateBilling extends CRM_Core_Form {
   protected $_crid = NULL;
@@ -57,8 +54,6 @@ class CRM_Contribute_Form_UpdateBilling extends CRM_Core_Form {
 
   /**
    * Set variables up before form is built.
-   *
-   * @return void
    */
   public function preProcess() {
     $this->_mid = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE);
@@ -185,8 +180,6 @@ class CRM_Contribute_Form_UpdateBilling extends CRM_Core_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $type = 'next';
@@ -236,8 +229,6 @@ class CRM_Contribute_Form_UpdateBilling extends CRM_Core_Form {
 
   /**
    * Process the form.
-   *
-   * @return void
    */
   public function postProcess() {
     $params = $this->controller->exportValues($this->_name);
index 9b15174a467a6efc9584a2b927c6029346d74fe1..6d926ccf2d133c0d84b30433d5d6e280abe9087d 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -39,7 +37,6 @@
  * It delegates the work to lower level subclasses and integrates the changes
  * back in. It also uses a lot of functionality with the CRM API's, so any change
  * made here could potentially affect the API etc. Be careful, be aware, use unit tests.
- *
  */
 class CRM_Contribute_Form_UpdateSubscription extends CRM_Core_Form {
 
@@ -126,11 +123,9 @@ class CRM_Contribute_Form_UpdateSubscription extends CRM_Core_Form {
   }
 
   /**
-   * Set default values for the form. Note that in edit/view mode
-   * the default values are retrieved from the database
-   *
+   * Set default values for the form.
    *
-   * @return void
+   * Note that in edit/view mode the default values are retrieved from the database.
    */
   public function setDefaultValues() {
 
@@ -144,8 +139,6 @@ class CRM_Contribute_Form_UpdateSubscription extends CRM_Core_Form {
 
   /**
    * Actually build the components of the form.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     // CRM-16398: If current recurring contribution got > 1 lineitems then make amount field readonly
@@ -185,10 +178,7 @@ class CRM_Contribute_Form_UpdateSubscription extends CRM_Core_Form {
   }
 
   /**
-   * called after the user submits the form.
-   *
-   *
-   * @return void
+   * Called after the user submits the form.
    */
   public function postProcess() {
     // store the submitted values in an array
index d13a6f6360bb14f7d0e9a69cdc54d052d4f51ce8..2e2f9ae042a48f06862d870cf16d90f494c8c74f 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contribute_Import_Controller extends CRM_Core_Controller {
 
   /**
    * Class constructor.
    *
-   * @param null $title
+   * @param string $title
    * @param bool|int $action
    * @param bool $modal
    */
index 8b5dc0b1568da5300b4f944f81580c54b1995873..6aaf46ad36bd9cbe677b8c950cae999e04f91d38 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contribute_Import_Field {
 
index 38eafea32028ad9b70da7a6e5ae88966548ecaaf..009ea1b259da1138bc72be98b03f927fc6b6a7d1 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -44,8 +42,6 @@ class CRM_Contribute_Import_Form_DataSource extends CRM_Import_Form_DataSource {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -70,8 +66,6 @@ class CRM_Contribute_Import_Form_DataSource extends CRM_Import_Form_DataSource {
 
   /**
    * Process the uploaded file.
-   *
-   * @return void
    */
   public function postProcess() {
     $this->storeFormValues(array(
index de43b70f5f2f7ec3d274922b6c0e66802d523c0d..d8ca305e0a386c6b2d8f94712cfab6fd31b54c36 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class gets the name of the file to upload
+ * This class gets the name of the file to upload.
  */
 class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField {
 
 
   /**
    * Set variables up before form is built.
-   *
-   * @return void
    */
   public function preProcess() {
     $this->_mapperFields = $this->get('fields');
@@ -107,8 +103,6 @@ class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     //to save the current mappings
@@ -475,10 +469,7 @@ class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField {
   }
 
   /**
-   * Process the mapped fields and map it into the uploaded file
-   * preview the file and extract some summary statistics
-   *
-   * @return void
+   * Process the mapped fields and map it into the uploaded file preview the file and extract some summary statistics.
    */
   public function postProcess() {
     $params = $this->controller->exportValues('MapField');
index 22ed33b111f66c26dba7bd68bdc7ddada2f1dfda..a0317e44fc6675d27212180483e45d44687bacec 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class previews the uploaded file and returns summary
- * statistics
+ * This class previews the uploaded file and returns summary statistics.
  */
 class CRM_Contribute_Import_Form_Preview extends CRM_Import_Form_Preview {
 
   /**
    * Set variables up before form is built.
-   *
-   * @return void
    */
   public function preProcess() {
     $skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader');
@@ -110,10 +105,7 @@ class CRM_Contribute_Import_Form_Preview extends CRM_Import_Form_Preview {
   }
 
   /**
-   * Process the mapped fields and map it into the uploaded file
-   * preview the file and extract some summary statistics
-   *
-   * @return void
+   * Process the mapped fields and map it into the uploaded file preview the file and extract some summary statistics.
    */
   public function postProcess() {
     $fileName = $this->controller->exportValue('DataSource', 'uploadFile');
index 658fd80d9c290b788fa05debfdf1eccbc445ec10..4c05bf95d3bec760284b94d44d134f18f8e080ba 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class summarizes the import results
+ * This class summarizes the import results.
  */
 class CRM_Contribute_Import_Form_Summary extends CRM_Import_Form_Summary {
 
   /**
    * Set variables up before form is built.
-   *
-   * @return void
    */
   public function preProcess() {
     // set the error message path to display
index 610198af5a963ee99e3c2e03f621e4f9845a3c96..ba7be327fe24a04559afbf130562db205460f56a 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 abstract class CRM_Contribute_Import_Parser extends CRM_Import_Parser {
 
@@ -408,8 +406,6 @@ abstract class CRM_Contribute_Import_Parser extends CRM_Import_Parser {
    * set the active fields array to this list
    *
    * @param array $fieldKeys mapped array of values
-   *
-   * @return void
    */
   public function setActiveFields($fieldKeys) {
     $this->_activeFieldCount = count($fieldKeys);
@@ -567,8 +563,6 @@ abstract class CRM_Contribute_Import_Parser extends CRM_Import_Parser {
    * @param string $fileName
    * @param array $header
    * @param array $data
-   *
-   * @return void
    */
   public static function exportCSV($fileName, $header, $data) {
     $output = array();
index 7901e21234f7da58d57842374ee91af31fd9a71d..aec76b5eea68fe6afaafd8ec600a744e74c08192 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -71,8 +69,6 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa
 
   /**
    * The initializer code, called before the processing
-   *
-   * @return void
    */
   public function init() {
     $fields = CRM_Contribute_BAO_Contribution::importableFields($this->_contactType, FALSE);
@@ -611,9 +607,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa
   }
 
   /**
-   * The initializer code, called before the processing
-   *
-   * @return void
+   * The initializer code, called before the processing.
    */
   public function fini() {
   }
index 79a81ce90a6ca408a62590867974ea46a229929c..af448dcaa5d898063db46db40e7bcd5d07cf3e19 100644 (file)
@@ -32,8 +32,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contribute_Info extends CRM_Core_Component_Info {
 
index 18eb4665ca6d6ec89392c5363699ee90b4aa7d61..d7d456cf5b501dad21b485df9e7807bee132f9e3 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -372,10 +370,7 @@ AND         cp.page_type = 'contribute'
   }
 
   /**
-   * make a copy of a contribution page, including
-   * all the fields in the page
-   *
-   * @return void
+   * Make a copy of a contribution page, including all the fields in the page.
    */
   public function copy() {
     $gid = CRM_Utils_Request::retrieve('gid', 'Positive',
index 15ea51158b00d927b0ba1b9379a9c98b6aa8d502..132b03bb4cbf35e0b8a3e65933fcf4b3de33cfd6 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
  * Main page for viewing Recurring Contributions.
- *
  */
 class CRM_Contribute_Page_ContributionRecur extends CRM_Core_Page {
 
@@ -45,8 +42,6 @@ class CRM_Contribute_Page_ContributionRecur extends CRM_Core_Page {
 
   /**
    * View details of a recurring contribution.
-   *
-   * @return void
    */
   public function view() {
     $recur = new CRM_Contribute_DAO_ContributionRecur();
index 6916a7d0dcf20a8082ffae14d1438030d0e5b2ef..03a45021d9f39172826245c37e5933b4d98242a7 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page for displaying list of Payment-Instrument
+ * Page for displaying list of Payment-Instrument.
  */
 class CRM_Contribute_Page_DashBoard extends CRM_Core_Page {
 
   /**
-   * Heart of the viewing process. The runner gets all the meta data for
-   * the contact and calls the appropriate type of page to view.
+   * Heart of the viewing process.
    *
-   * @return void
+   * The runner gets all the meta data for the contact and calls the appropriate type of page to view.
    */
   public function preProcess() {
     CRM_Utils_System::setTitle(ts('CiviContribute'));
index a7fd59b4afe116bd15e586dd8e294d5cc9dab33e..3483d36c749f8e1a8fa7c117a77fc8d43cdd1c4e 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page for displaying list of Premiums
+ * Page for displaying list of Premiums.
  */
 class CRM_Contribute_Page_ManagePremiums extends CRM_Core_Page_Basic {
 
@@ -105,8 +103,6 @@ class CRM_Contribute_Page_ManagePremiums extends CRM_Core_Page_Basic {
    * This method is called after the page is created. It checks for the
    * type of action and executes that action.
    * Finally it calls the parent's run method.
-   *
-   * @return void
    */
   public function run() {
 
@@ -135,9 +131,6 @@ class CRM_Contribute_Page_ManagePremiums extends CRM_Core_Page_Basic {
 
   /**
    * Browse all custom data groups.
-   *
-   *
-   * @return void
    */
   public function browse() {
     // get all custom groups sorted by weight
index e54b460da84db5d02e67cc3fd3ce7794fc2eb468..016d4a89d5cf5fc058c7d4b360caad2894b18f5c 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contribute_Page_PaymentInfo extends CRM_Core_Page {
   public function preProcess() {
index 0cbbae0e34c89014ba3ecf0e39aa3c4ede48da69..22f2e16aa9d11cb79c52014f661a5a01df251f58 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Page for displaying list of Premiums
+ * Page for displaying list of Premiums.
  */
 class CRM_Contribute_Page_Premium extends CRM_Core_Page_Basic {
 
@@ -97,8 +95,6 @@ class CRM_Contribute_Page_Premium extends CRM_Core_Page_Basic {
    * This method is called after the page is created. It checks for the
    * type of action and executes that action.
    * Finally it calls the parent's run method.
-   *
-   * @return void
    */
   public function run() {
     // get the requested action
@@ -126,7 +122,7 @@ class CRM_Contribute_Page_Premium extends CRM_Core_Page_Basic {
   }
 
   /**
-   * @return void
+   * Browse function.
    */
   public function browse() {
     // get all custom groups sorted by weight
index 3cb975cb02d2bbaf7505a869d4fa7058235669e9..834d9d64d536bba88249a7df6b8e7ec757a2918f 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contribute_Page_SubscriptionStatus extends CRM_Core_Page {
 
index edfd420397f1f3d6e8d38306189ef52b3402906a..2469e4e8b1402e83e4aa78313ff7997fb60c3279 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contribute_Page_Tab extends CRM_Core_Page {
 
index d17a579416805cc180ac333c80d439ad6e19ca35..2e16e0b1dd6ef469d4ac400f68c64aa0cd16cf3b 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contribute_Page_UserDashboard extends CRM_Contact_Page_View_UserDashBoard {
 
index 547d85370cf768d41df66f16983f39044c03ffd5..975be0c6d772dc8d8870ea6928d5595300e0ad2f 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class holds all the Pseudo constants that are specific to Contributions. This avoids
- * polluting the core class and isolates the mass mailer class
+ * This class holds all the Pseudo constants that are specific to Contributions.
+ *
+ * This avoids polluting the core class and isolates the mass mailer class.
  */
 class CRM_Contribute_PseudoConstant extends CRM_Core_PseudoConstant {
 
index aba145eaff211e8369ab09ad0454cc40d9af5314..32d153ebb2ced809d573b7fbffdfe0845fc59bbd 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
index c4508871f9f7e670b2017d6a38aa3fb8370cdba7..086846f728344b9720c86224f3bcbeb9e3d4c25c 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
index d5f645a952bdad1fc11f606ae4c84a8c23080ea6..063f390d2224cbb2293bbc11c140527cbf3c562c 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
  * State machine for managing different states of the Import process.
- *
  */
 class CRM_Contribute_StateMachine_ContributionPage extends CRM_Core_StateMachine {
 
index 40e08b492fd4becc367e66e9bca230444f0a543a..2480d432a5ffd41728799fbdab28401b470ed247 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Contribute_StateMachine_Search extends CRM_Core_StateMachine {
 
index 01ee612c9cf36f1fc2f63c01c08ddaadc34967c3..b48240fc85111d14cbed2af464fbe742d6f09b53 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * class to represent the actions that can be performed on a group of contacts
- * used by the search forms
+ * Class to represent the actions that can be performed on a group of contacts.
  *
+ * Used by the search forms.
  */
 class CRM_Contribute_Task {
   const DELETE_CONTRIBUTIONS = 1, PRINT_CONTRIBUTIONS = 2, EXPORT_CONTRIBUTIONS = 3, BATCH_CONTRIBUTIONS = 4, EMAIL_CONTACTS = 5, UPDATE_STATUS = 6, PDF_RECEIPT = 7;
@@ -66,17 +64,17 @@ class CRM_Contribute_Task {
     if (!(self::$_tasks)) {
       self::$_tasks = array(
         1 => array(
-          'title' => ts('Delete Contributions'),
+          'title' => ts('Delete contributions'),
           'class' => 'CRM_Contribute_Form_Task_Delete',
           'result' => FALSE,
         ),
         2 => array(
-          'title' => ts('Print Selected Rows'),
+          'title' => ts('Print selected rows'),
           'class' => 'CRM_Contribute_Form_Task_Print',
           'result' => FALSE,
         ),
         3 => array(
-          'title' => ts('Export Contributions'),
+          'title' => ts('Export contributions'),
           'class' => array(
             'CRM_Export_Form_Select',
             'CRM_Export_Form_Map',
@@ -84,7 +82,7 @@ class CRM_Contribute_Task {
           'result' => FALSE,
         ),
         4 => array(
-          'title' => ts('Batch Update Contributions Via Profile'),
+          'title' => ts('Batch update contributions via profile'),
           'class' => array(
             'CRM_Contribute_Form_Task_PickProfile',
             'CRM_Contribute_Form_Task_Batch',
@@ -92,27 +90,27 @@ class CRM_Contribute_Task {
           'result' => TRUE,
         ),
         5 => array(
-          'title' => ts('Send Email to Contacts'),
+          'title' => ts('Email - send now'),
           'class' => 'CRM_Contribute_Form_Task_Email',
           'result' => TRUE,
         ),
         6 => array(
-          'title' => ts('Update Pending Contribution Status'),
+          'title' => ts('Update pending contribution status'),
           'class' => 'CRM_Contribute_Form_Task_Status',
           'result' => TRUE,
         ),
         7 => array(
-          'title' => ts('Print or Email Contribution Receipts'),
+          'title' => ts('Receipts - print or email'),
           'class' => 'CRM_Contribute_Form_Task_PDF',
           'result' => FALSE,
         ),
         8 => array(
-          'title' => ts('Thank-you Letters for Contributions'),
+          'title' => ts('Thank-you letters - print or email'),
           'class' => 'CRM_Contribute_Form_Task_PDFLetter',
           'result' => FALSE,
         ),
         9 => array(
-          'title' => ts('Print or Email Contribution Invoices'),
+          'title' => ts('Invoices - print or email'),
           'class' => 'CRM_Contribute_Form_Task_Invoice',
           'result' => FALSE,
         ),
@@ -127,7 +125,7 @@ class CRM_Contribute_Task {
         unset(self::$_tasks[4], self::$_tasks[6]);
       }
 
-      // remove action "Print or Email Contribution Invoices"
+      // remove action "Invoices - print or email"
       $invoiceSettings = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
       $invoicing = CRM_Utils_Array::value('invoicing', $invoiceSettings);
       if (!$invoicing) {
index 42644c759827f5dbdbf617a6298a9ac2ff435aa9..c9e33e341ddba2ad615572253d6e73a09c3e6b1f 100755 (executable)
@@ -1337,25 +1337,25 @@ GROUP BY c.id
         $repeatEvent = ($actionSchedule->end_action == 'before' ? 'DATE_SUB' : 'DATE_ADD') . "({$dateField}, INTERVAL {$actionSchedule->end_frequency_interval} {$actionSchedule->end_frequency_unit})";
 
         if ($actionSchedule->repetition_frequency_unit == 'day') {
-          $hrs = 24 * $actionSchedule->repetition_frequency_interval;
+          $interval = "{$actionSchedule->repetition_frequency_interval} DAY";
         }
         elseif ($actionSchedule->repetition_frequency_unit == 'week') {
-          $hrs = 24 * $actionSchedule->repetition_frequency_interval * 7;
+          $interval = "{$actionSchedule->repetition_frequency_interval} WEEK";
         }
         elseif ($actionSchedule->repetition_frequency_unit == 'month') {
-          $hrs = "24*(DATEDIFF(DATE_ADD(latest_log_time, INTERVAL 1 MONTH ), latest_log_time))";
+          $interval = "{$actionSchedule->repetition_frequency_interval} MONTH";
         }
         elseif ($actionSchedule->repetition_frequency_unit == 'year') {
-          $hrs = "24*(DATEDIFF(DATE_ADD(latest_log_time, INTERVAL 1 YEAR ), latest_log_time))";
+          $interval = "{$actionSchedule->repetition_frequency_interval} YEAR";
         }
         else {
-          $hrs = $actionSchedule->repetition_frequency_interval;
+          $interval = "{$actionSchedule->repetition_frequency_interval} HOUR";
         }
 
         // (now <= repeat_end_time )
         $repeatEventClause = "'{$now}' <= {$repeatEvent}";
         // diff(now && logged_date_time) >= repeat_interval
-        $havingClause = "HAVING TIMEDIFF({$now}, latest_log_time) >= TIME('{$hrs}:00:00')";
+        $havingClause = "HAVING TIMESTAMPDIFF(HOUR, latest_log_time, CAST({$now} AS datetime)) >= TIMESTAMPDIFF(HOUR, latest_log_time, DATE_ADD(latest_log_time, INTERVAL $interval))";
         $groupByClause = 'GROUP BY reminder.contact_id, reminder.entity_id, reminder.entity_table';
         $selectClause .= ', MAX(reminder.action_date_time) as latest_log_time';
         //CRM-15376 - do not send our reminders if original criteria no longer applies
index d824bec5d1ef30f8ed9f37b94d5b7c68056962bc..e6e771312ed47b5d1539e8f5288fadc40b2da854 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This is class to handle address related functions
+ * This is class to handle address related functions.
  */
 class CRM_Core_BAO_Address extends CRM_Core_DAO_Address {
 
@@ -200,8 +198,6 @@ class CRM_Core_BAO_Address extends CRM_Core_DAO_Address {
    *
    * @param array $params
    *   (reference ) an assoc array of name/value pairs.
-   *
-   * @return void
    */
   public static function fixAddress(&$params) {
     if (!empty($params['billing_street_address'])) {
@@ -559,11 +555,10 @@ class CRM_Core_BAO_Address extends CRM_Core_DAO_Address {
   }
 
   /**
-   * Add the formatted address to $this-> display
+   * Add the formatted address to $this-> display.
    *
    * @param bool $microformat
-   *
-   * @return void
+   *   Unexplained parameter that I've always wondered about.
    */
   public function addDisplay($microformat = FALSE) {
     $fields = array(
@@ -1005,8 +1000,6 @@ SELECT is_primary,
    *   Address id.
    * @param array $params
    *   Associated array of address params.
-   *
-   * @return void
    */
   public static function processSharedAddress($addressId, $params) {
     $query = 'SELECT id FROM civicrm_address WHERE master_id = %1';
@@ -1110,8 +1103,6 @@ SELECT is_primary,
    *   Master address id.
    * @param array $params
    *   Associated array of submitted values.
-   *
-   * @return void
    */
   public static function processSharedAddressRelationship($masterAddressId, $params) {
     // get the contact type of contact being edited / created
index a393568fb980dc3eb2e7ae7dc2188d46e2c19a98..c7478eee3e82f6e69c3ab5c915b517bfc9bdb932 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- * add static functions to include some common functionality
- * used across location sub object BAO classes
  *
+ * Add static functions to include some common functionality used across location sub object BAO classes.
  */
 class CRM_Core_BAO_Block {
 
@@ -398,8 +395,6 @@ class CRM_Core_BAO_Block {
    *   Block name.
    * @param int $params
    *   Associates array.
-   *
-   * @return void
    */
   public static function blockDelete($blockName, $params) {
     $name = ucfirst($blockName);
index 4921600790171d136bb8593fb6268390a84301d1..bd6233e88657aacc102a0f37c2db9420ac8f622f 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- *  this file contains functions for synchronizing cms users with CiviCRM contacts
+ * This file contains functions for synchronizing cms users with CiviCRM contacts.
  */
 
 require_once 'DB.php';
@@ -52,12 +50,8 @@ class CRM_Core_BAO_CMSUser {
    *   This behavior is misplaced in the BAO layer, but we'll preserve it to avoid
    *   contract changes in the middle of the support cycle. In the next major
    *   release, we should remove & document it.
-   *
-   * @return void
-   *
    */
   public static function synchronize($is_interactive = TRUE) {
-    //start of schronization code
     $config = CRM_Core_Config::singleton();
 
     // Build an array of rows from UF users table.
index 475c33d995672b652520ec1b86364143ee27949c..3f1bc9fb3d42b3071ade53da9ed73ce2566b4482 100644 (file)
@@ -26,7 +26,9 @@
  */
 
 /**
- * BAO object for civicrm_cache table. This is a database cache and is persisted across sessions. Typically we use
+ * BAO object for civicrm_cache table.
+ *
+ * This is a database cache and is persisted across sessions. Typically we use
  * this to store meta data (like profile fields, custom fields etc).
  *
  * The group_name column is used for grouping together all cache elements that logically belong to the same set.
@@ -262,8 +264,6 @@ class CRM_Core_BAO_Cache extends CRM_Core_DAO_Cache {
    *   Array of session values that should be persisted.
    *                     This is either a form name + qfKey or just a form name
    *                     (in the case of profile)
-   *
-   * @return void
    */
 
   /**
index 83d99da377770a578b4ee471a6ce9f622d026a47..0086008db5bf3ae7cbf246d240f673f292b90f05 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * file contains functions used in civicrm configuration
- *
+ * File contains functions used in civicrm configuration.
  */
 class CRM_Core_BAO_ConfigSetting {
 
@@ -46,8 +43,6 @@ class CRM_Core_BAO_ConfigSetting {
    *
    * @param array $params
    *   Associated array of civicrm variables.
-   *
-   * @return void
    */
   public static function create($params) {
     self::add($params);
@@ -62,8 +57,6 @@ class CRM_Core_BAO_ConfigSetting {
    *
    * @param array $params
    *   Associated array of civicrm variables.
-   *
-   * @return void
    */
   public static function add(&$params) {
     self::fixParams($params);
@@ -130,8 +123,6 @@ class CRM_Core_BAO_ConfigSetting {
    *
    * @param array $params
    *   Associated array of civicrm variables.
-   *
-   * @return void
    */
   public static function fixParams(&$params) {
     // in our old civicrm.settings.php we were using ISO code for country and
@@ -164,8 +155,6 @@ class CRM_Core_BAO_ConfigSetting {
    *   Associated array of civicrm variables(submitted).
    * @param array $values
    *   Associated array of civicrm variables stored in db.
-   *
-   * @return void
    */
   public static function formatParams(&$params, &$values) {
     if (empty($params) ||
index 0f341a8ee083fc5a541e15ec1ee141a07d60fb4e..5ada16367fc84028e90c80dca7caad906b96f43e 100644 (file)
@@ -1171,7 +1171,6 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
           $display = NULL;
           foreach ($value as $data) {
             $display .= $display ? ', ' . $option[$data] : $option[$data];
-
           }
         }
         else {
@@ -1185,6 +1184,12 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
         ) {
           $display = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $value, 'display_name');
         }
+        elseif (is_array($value)) {
+          $display = NULL;
+          foreach ($value as $data) {
+            $display .= $display ? ', ' . $option[$data] : $option[$data];
+          }
+        }
         else {
           $display = CRM_Utils_Array::value($value, $option);
         }
@@ -1247,60 +1252,20 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
         break;
 
       case 'Select State/Province':
-        if (empty($value)) {
-          $display = '';
-        }
-        else {
-          $display = CRM_Core_PseudoConstant::stateProvince($value);
-        }
-        break;
-
       case 'Multi-Select State/Province':
-        if (is_array($value)) {
-          $checkedData = $value;
-        }
-        else {
-          $checkedData = explode(CRM_Core_DAO::VALUE_SEPARATOR,
-            substr($value, 1, -1)
-          );
-        }
-
-        $states = CRM_Core_PseudoConstant::stateProvince();
         $display = NULL;
-        foreach ($checkedData as $stateID) {
-          if ($display) {
-            $display .= ', ';
-          }
-          $display .= $states[$stateID];
+        $option = CRM_Core_PseudoConstant::stateProvince(FALSE, FALSE);
+        foreach ((array) $value as $data) {
+          $display .= $display ? ', ' . $option[$data] : $option[$data];
         }
         break;
 
       case 'Select Country':
-        if (empty($value)) {
-          $display = '';
-        }
-        else {
-          $display = CRM_Core_PseudoConstant::country($value);
-        }
-        break;
-
       case 'Multi-Select Country':
-        if (is_array($value)) {
-          $checkedData = $value;
-        }
-        else {
-          $checkedData = explode(CRM_Core_DAO::VALUE_SEPARATOR,
-            substr($value, 1, -1)
-          );
-        }
-
-        $countries = CRM_Core_PseudoConstant::country();
+        $countries = CRM_Core_PseudoConstant::country(FALSE, FALSE);
         $display = NULL;
-        foreach ($checkedData as $countryID) {
-          if ($display) {
-            $display .= ', ';
-          }
-          $display .= $countries[$countryID];
+        foreach ((array) $value as $countryID) {
+          $display .= $display ? ', ' . $countries[$countryID] : $countries[$countryID];
         }
         break;
 
@@ -1324,16 +1289,17 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
           $display = '';
         }
         else {
-          $display = nl2br($value);
+          $display = is_array($value) ? nl2br(implode(', ', $value)) : nl2br($value);
         }
         break;
 
       case 'Link':
+      case 'Text':
         if (empty($value)) {
           $display = '';
         }
         else {
-          $display = $value;
+          $display = is_array($value) ? implode(', ', $value) : $value;
         }
     }
     return $display ? $display : $value;
index 7b78cd56dbeca45f236b377f296a613281fb7c10..08f54b36cf88c4d2e7202d26d4d85f5d975cdacd 100644 (file)
@@ -30,8 +30,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Core_BAO_CustomQuery {
   const PREFIX = 'custom_value_';
@@ -254,9 +252,6 @@ SELECT label, value
 
   /**
    * Generate the select clause and the associated tables.
-   * for the from clause
-   *
-   * @return void
    */
   public function select() {
     if (empty($this->_fields)) {
@@ -318,15 +313,12 @@ SELECT label, value
   }
 
   /**
-   * Generate the where clause and also the english language.
-   * equivalent
-   *
-   * @return void
+   * Generate the where clause and also the english language equivalent.
    */
   public function where() {
     foreach ($this->_ids as $id => $values) {
 
-      // Fixed for Isuue CRM 607
+      // Fixed for Issue CRM 607
       if (CRM_Utils_Array::value($id, $this->_fields) === NULL ||
         !$values
       ) {
@@ -342,11 +334,6 @@ SELECT label, value
 
         $fieldName = "{$field['table_name']}.{$field['column_name']}";
 
-        // Autocomplete comes back as a string not an array
-        if ($field['data_type'] == 'String' && $field['html_type'] == 'Autocomplete-Select' && $op == '=') {
-          $value = explode(',', $value);
-        }
-
         $isSerialized = CRM_Core_BAO_CustomField::isSerialized($field);
 
         // fix $value here to escape sql injection attacks
@@ -357,10 +344,10 @@ SELECT label, value
         }
         elseif (count($value) && in_array(key($value), CRM_Core_DAO::acceptedSQLOperators(), TRUE)) {
           $op = key($value);
-          $qillValue = CRM_Core_BAO_CustomField::getDisplayValue($value[$op], $id, $this->_options);
+          $qillValue = strstr($op, 'NULL') ? NULL : CRM_Core_BAO_CustomField::getDisplayValue($value[$op], $id, $this->_options);
         }
         else {
-          $op = 'IN';
+          $op = strstr($op, 'IN') ? $op : 'IN';
           $qillValue = CRM_Core_BAO_CustomField::getDisplayValue($value, $id, $this->_options);
         }
 
@@ -395,11 +382,11 @@ SELECT label, value
                   $op = key($value);
                   $value = $value[$op];
                 }
-                $value = implode(',', $value);
+                $value = implode(',', (array) $value);
               }
 
               // CRM-14563,CRM-16575 : Special handling of multi-select custom fields
-              if ($isSerialized && !empty($value)) {
+              if ($isSerialized && !empty($value) && !strstr($op, 'NULL') && !strstr($op, 'LIKE')) {
                 if (strstr($op, 'IN')) {
                   $value = str_replace(",", "[[:cntrl:]]*|[[:cntrl:]]*", $value);
                   $value = str_replace('(', '[[.left-parenthesis.]]', $value);
@@ -456,11 +443,10 @@ SELECT label, value
             break;
 
           case 'Money':
+            $value = CRM_Utils_Array::value($op, (array) $value, $value);
             if (is_array($value)) {
-              $value = CRM_Utils_Array::value($op, $value, $value);
               foreach ($value as $key => $val) {
-                $moneyFormat = CRM_Utils_Rule::cleanMoney($value[$key]);
-                $value[$key] = $moneyFormat;
+                $value[$key] = CRM_Utils_Rule::cleanMoney($value[$key]);
               }
             }
             else {
@@ -480,9 +466,10 @@ SELECT label, value
           case 'Date':
             $fromValue = CRM_Utils_Array::value('from', $value);
             $toValue = CRM_Utils_Array::value('to', $value);
+            $value = CRM_Utils_Array::value($op, $value, $value);
 
             if (!$fromValue && !$toValue) {
-              if (!CRM_Utils_Date::processDate($value) && !in_array($op, array('IS NULL', 'IS NOT NULL', 'IS EMPTY', 'IS NOT EMPTY'))) {
+              if (!is_array($value) && !CRM_Utils_Date::processDate($value) && !in_array($op, array('IS NULL', 'IS NOT NULL', 'IS EMPTY', 'IS NOT EMPTY'))) {
                 continue;
               }
 
@@ -491,9 +478,20 @@ SELECT label, value
                 $value = "01-01-{$value}";
               }
 
-              $date = CRM_Utils_Date::processDate($value);
+              if (is_array($value)) {
+                $date = $qillValue = array();
+                foreach ($value as $key => $val) {
+                  $date[$key] = CRM_Utils_Date::processDate($val);
+                  $qillValue[$key] = CRM_Utils_Date::customFormat($date[$key]);
+                }
+              }
+              else {
+                $date = CRM_Utils_Date::processDate($value);
+                $qillValue = CRM_Utils_Date::customFormat($date);
+              }
+
               $this->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause($fieldName, $op, $date, 'String');
-              $this->_qill[$grouping][] = $field['label'] . " {$qillOp} " . CRM_Utils_Date::customFormat($date);
+              $this->_qill[$grouping][] = $field['label'] . " {$qillOp} " . implode(', ', (array) $qillValue);
             }
             else {
               if (is_numeric($fromValue) && strlen($fromValue) == 4) {
index 89d67d80ea23c769b9813beb67a849ab7057ff61..3d34883fbe68b8ec4a2a723121f2848c1ee65ce4 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
  * Business objects for managing custom data values.
- *
  */
 class CRM_Core_BAO_CustomValue extends CRM_Core_DAO {
 
@@ -208,8 +205,6 @@ class CRM_Core_BAO_CustomValue extends CRM_Core_DAO {
    *   Custom value ID.
    * @param int $customGroupID
    *   Custom group ID.
-   *
-   * @return void
    */
   public static function deleteCustomValue($customValueID, $customGroupID) {
     // first we need to find custom value table, from custom group ID
index a650055fd02e74138a9a140c09a324217fd17ec4..901abf8627ef909bd8a072e1fa49536919121dda 100644 (file)
@@ -85,7 +85,7 @@ class CRM_Core_BAO_CustomValueTable {
                 $value = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, $value) . CRM_Core_DAO::VALUE_SEPARATOR;
                 $type = 'String';
               }
-              elseif (!is_numeric($value)) {
+              elseif (!is_numeric($value) && !strstr($value, CRM_Core_DAO::VALUE_SEPARATOR)) {
                 //fix for multi select state, CRM-3437
                 $mulValues = explode(',', $value);
                 $validStates = array();
@@ -101,7 +101,7 @@ class CRM_Core_BAO_CustomValueTable {
                       CRM_Core_PseudoConstant::stateProvinceAbbreviation(), TRUE
                     );
                   }
-                  $validStates[] = $states['state_province_id'];
+                  $validStates[] = CRM_Utils_Array::value('state_province_id', $states);
                 }
                 $value = implode(CRM_Core_DAO::VALUE_SEPARATOR,
                   $validStates
@@ -115,15 +115,19 @@ class CRM_Core_BAO_CustomValueTable {
                 $value = NULL;
                 $type = 'Timestamp';
               }
+              else {
+                $type = 'String';
+              }
               break;
 
             case 'Country':
               $type = 'Integer';
+              $mulValues = explode(',', $value);
               if (is_array($value)) {
                 $value = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, $value) . CRM_Core_DAO::VALUE_SEPARATOR;
                 $type = 'String';
               }
-              elseif (!is_numeric($value)) {
+              elseif (!is_numeric($value) && !strstr($value, CRM_Core_DAO::VALUE_SEPARATOR)) {
                 //fix for multi select country, CRM-3437
                 $mulValues = explode(',', $value);
                 $validCountries = array();
@@ -138,7 +142,7 @@ class CRM_Core_BAO_CustomValueTable {
                       CRM_Core_PseudoConstant::countryIsoCode(), TRUE
                     );
                   }
-                  $validCountries[] = $countries['country_id'];
+                  $validCountries[] = CRM_Utils_Array::value('country_id', $states);
                 }
                 $value = implode(CRM_Core_DAO::VALUE_SEPARATOR,
                   $validCountries
@@ -152,6 +156,9 @@ class CRM_Core_BAO_CustomValueTable {
                 $value = NULL;
                 $type = 'Timestamp';
               }
+              else {
+                $type = 'String';
+              }
               break;
 
             case 'File':
@@ -210,9 +217,16 @@ class CRM_Core_BAO_CustomValueTable {
             default:
               break;
           }
-          $set[$field['column_name']] = "%{$count}";
-          $params[$count] = array($value, $type);
-          $count++;
+          if (strtolower($value) === "null") {
+            // when unsetting a value to null, we don't need to validate the type
+            // https://projectllr.atlassian.net/browse/VGQBMP-20
+            $set[$field['column_name']] = $value;
+          }
+          else {
+            $set[$field['column_name']] = "%{$count}";
+            $params[$count] = array($value, $type);
+            $count++;
+          }
         }
 
         if (!empty($set)) {
index a48cd701e537589f1e0988e182399c90147bd6f8..353ac87e214a7ef57fd9f662405c8da6e05ae755 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Class contains Contact dashboard related functions
+ * Class contains Contact dashboard related functions.
  */
 class CRM_Core_BAO_Dashboard extends CRM_Core_DAO_Dashboard {
   /**
@@ -356,7 +354,6 @@ class CRM_Core_BAO_Dashboard extends CRM_Core_DAO_Dashboard {
    * @param int $contactID
    *
    * @throws RuntimeException
-   * @return void
    */
   public static function saveDashletChanges($columns, $contactID = NULL) {
     $session = CRM_Core_Session::singleton();
@@ -486,9 +483,7 @@ class CRM_Core_BAO_Dashboard extends CRM_Core_DAO_Dashboard {
   /**
    * Update contact dashboard with new dashlet.
    *
-   * @param object : $dashlet
-   *
-   * @return void
+   * @param object $dashlet
    */
   public static function addContactDashlet($dashlet) {
     $admin = CRM_Core_Permission::check('administer CiviCRM');
@@ -555,8 +550,6 @@ class CRM_Core_BAO_Dashboard extends CRM_Core_DAO_Dashboard {
    *
    * @param int $contactID
    *   Reset cache only for specific contact.
-   *
-   * @return void
    */
   public static function resetDashletCache($contactID = NULL) {
     $whereClause = NULL;
@@ -574,7 +567,7 @@ class CRM_Core_BAO_Dashboard extends CRM_Core_DAO_Dashboard {
    *
    * @param int $dashletID
    *
-   * @return void
+   * @return bool
    */
   public static function deleteDashlet($dashletID) {
     $dashlet = new CRM_Core_DAO_Dashboard();
index 80b6f19593bf727b5beaa9987352c0fae51bc90e..d4f343424b2e29b5a6b3e11539882e846994e11c 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class contains functions for email handling
+ * This class contains functions for email handling.
  */
 class CRM_Core_BAO_Email extends CRM_Core_DAO_Email {
 
   /**
-   * Create email address - note that the create function calls 'add' but
-   * has more business logic
+   * Create email address.
+   *
+   * Note that the create function calls 'add' but  has more business logic.
    *
    * @param array $params
    *   Input parameters.
@@ -235,8 +234,6 @@ ORDER BY e.is_primary DESC, email_id ASC ";
    *
    * @param object $email
    *   Email object.
-   *
-   * @return void
    */
   public static function holdEmail(&$email) {
     //check for update mode
index 1935f79d5bb5067df7d074a7a476c07c29b9be90..9745cb3778179578f53a1f1d190c0b4a99f3277d 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Core_BAO_EntityTag extends CRM_Core_DAO_EntityTag {
 
   /**
-   *
-   * Given a contact id, it returns an array of tag id's the
-   * contact belongs to.
+   * Given a contact id, it returns an array of tag id's the contact belongs to.
    *
    * @param int $entityID
    *   Id of the entity usually the contactID.
@@ -47,7 +43,6 @@ class CRM_Core_BAO_EntityTag extends CRM_Core_DAO_EntityTag {
    *
    * @return array
    *   reference $tag array of category id's the contact belongs to.
-   *
    */
   public static function &getTag($entityID, $entityTable = 'civicrm_contact') {
     $tags = array();
@@ -220,10 +215,8 @@ class CRM_Core_BAO_EntityTag extends CRM_Core_DAO_EntityTag {
    *
    * @param array $params
    *   (reference) an assoc array of name/value pairs.
-   * @param $entityTable
+   * @param string $entityTable
    * @param int $entityID
-   *
-   * @return void
    */
   public static function create(&$params, $entityTable, $entityID) {
     // get categories for the entity id
index e73527c38aa1308fbabbda0aa44733b9e2feeba8..c2347fc2404798d82f34909f5c1ad75fde93c57f 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -65,8 +63,7 @@ class CRM_Core_BAO_Extension extends CRM_Core_DAO_Extension {
    * @param int $id
    *   Id of the extension to be deleted.
    *
-   * @return void
-   *
+   * @return mixed
    */
   public static function del($id) {
     $extension = new CRM_Core_DAO_Extension();
@@ -80,7 +77,8 @@ class CRM_Core_BAO_Extension extends CRM_Core_DAO_Extension {
    * @param string $fullName
    *   the fully-qualified name (eg "com.example.myextension").
    * @param string $schemaVersion
-   * @return void
+   *
+   * @return \CRM_Core_DAO|object
    */
   public static function setSchemaVersion($fullName, $schemaVersion) {
     $sql = 'UPDATE civicrm_extension SET schema_version = %1 WHERE full_name = %2';
index 9b0de33f5ef06bf9486670d11abc3e292b028629..6aafb678abaa972f89eee97c8f7ccd97a9a7e6d1 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class contains functions for managing Label Formats
+ * This class contains functions for managing Label Formats.
  */
 class CRM_Core_BAO_LabelFormat extends CRM_Core_DAO_OptionValue {
 
@@ -452,8 +450,6 @@ class CRM_Core_BAO_LabelFormat extends CRM_Core_DAO_OptionValue {
 
   /**
    * Return the name of the group for customized labels.
-   *
-   * @return void
    */
   public static function customGroupName() {
     return ts('Custom');
@@ -467,8 +463,6 @@ class CRM_Core_BAO_LabelFormat extends CRM_Core_DAO_OptionValue {
    *   Id of the database record (null = new record).
    * @param string $groupName
    *   Group name of the label format.
-   *
-   * @return void
    */
   public function saveLabelFormat(&$values, $id = NULL, $groupName = 'label_format') {
     // get the Option Group ID for Label Formats (create one if it doesn't exist)
index 4923b4b8af8646984afbac3cc745981952f3e161..3a0b04c500c14bd34e79cb460b64e8d4344c5e04 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class handle creation of location block elements
+ * This class handle creation of location block elements.
  */
 class CRM_Core_BAO_Location extends CRM_Core_DAO {
 
@@ -193,8 +191,6 @@ WHERE e.id = %1";
    *
    * @param int $locBlockId
    *   Id of the Location Block.
-   *
-   * @return void
    */
   public static function deleteLocBlock($locBlockId) {
     if (!$locBlockId) {
@@ -289,8 +285,6 @@ WHERE e.id = %1";
    *   Contact id.
    * @param int $locationTypeId
    *   Id of the location to delete.
-   *
-   * @return void
    */
   public static function deleteLocationBlocks($contactId, $locationTypeId) {
     // ensure that contactId has a value
index 36d0912313c882cb1da274e59397ac021977f9f0..3b8b9afb51544dc8ddcd95bc5bdfcdf00419251d 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping {
 
@@ -255,8 +253,6 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping {
    * @param int $blockCount
    *   (no of blocks shown).
    * @param NULL $exportMode
-   *
-   * @return void
    */
   public static function buildMappingForm(&$form, $mappingType = 'Export', $mappingId = NULL, $columnNo, $blockCount = 3, $exportMode = NULL) {
     if ($mappingType == 'Export') {
index 316e6a49fb37b9c22b299516331fb8a9a5ffa7be..fe00feb451daf95c696022a4a01db248dc07055d 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 require_once 'Mail/mime.php';
 
 /**
- * Class CRM_Core_BAO_MessageTemplate
+ * Class CRM_Core_BAO_MessageTemplate.
  */
 class CRM_Core_BAO_MessageTemplate extends CRM_Core_DAO_MessageTemplate {
 
@@ -100,7 +98,6 @@ class CRM_Core_BAO_MessageTemplate extends CRM_Core_DAO_MessageTemplate {
    * Delete the Message Templates.
    *
    * @param int $messageTemplatesID
-   * @return void
    */
   public static function del($messageTemplatesID) {
     // make sure messageTemplatesID is an integer
@@ -270,11 +267,9 @@ class CRM_Core_BAO_MessageTemplate extends CRM_Core_DAO_MessageTemplate {
   }
 
   /**
-   * Revert a message template to its default subject+text+HTML state
+   * Revert a message template to its default subject+text+HTML state.
    *
    * @param int $id id of the template
-   *
-   * @return void
    */
   public static function revert($id) {
     $diverted = new CRM_Core_BAO_MessageTemplate();
index 717b4fbc5d3f11c402bf0a3a84bd2d3905b59c60..ef7dff898ccdfeded5dfe2d29f666d7919a8ba76 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * BAO object for crm_note table
+ * BAO object for crm_note table.
  */
 class CRM_Core_BAO_Note extends CRM_Core_DAO_Note {
 
@@ -45,7 +43,7 @@ class CRM_Core_BAO_Note extends CRM_Core_DAO_Note {
   const MAX_NOTES = 3;
 
   /**
-   * Given a note id, retrieve the note text
+   * Given a note id, retrieve the note text.
    *
    * @param int $id
    *   Id of the note to retrieve.
@@ -336,9 +334,6 @@ class CRM_Core_BAO_Note extends CRM_Core_DAO_Note {
    *
    * @param int $id
    *   ID of the contact for which note needs to be deleted.
-   *
-   * @return void
-   *
    */
   public static function deleteContact($id) {
     // need to delete for both entity_id
@@ -552,8 +547,6 @@ ORDER BY  modified_date desc";
    *
    * @param int $contactID
    *   Contact id whose notes to be deleted.
-   *
-   * @return void
    */
   public static function cleanContactNotes($contactID) {
     $params = array(1 => array($contactID, 'Integer'));
index 3f1f1f604aa2ea6c2aa135cf8a8188568456e4b6..04b0e382377a7d3f7e2618f3507ffb0142b56bcf 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Core_BAO_OptionValue extends CRM_Core_DAO_OptionValue {
 
@@ -42,8 +40,9 @@ class CRM_Core_BAO_OptionValue extends CRM_Core_DAO_OptionValue {
   }
 
   /**
-   * Create option value - note that the create function calls 'add' but
-   * has more business logic
+   * Create option value.
+   *
+   * Note that the create function calls 'add' but has more business logic.
    *
    * @param array $params
    *   Input parameters.
@@ -423,8 +422,6 @@ class CRM_Core_BAO_OptionValue extends CRM_Core_DAO_OptionValue {
    * @param int $opGroupId
    * @param array $opWeights
    *   Options value , weight pair.
-   *
-   * @return void
    */
   public static function updateOptionWeights($opGroupId, $opWeights) {
     if (!is_array($opWeights) || empty($opWeights)) {
index a9e814827536604719ac200e870e5977094b6be9..439ef42cd09b5b68ba67c3a4422942bebe336cd0 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class contains functions for managing Paper Sizes
+ * This class contains functions for managing Paper Sizes.
  */
 class CRM_Core_BAO_PaperSize extends CRM_Core_DAO_OptionValue {
 
@@ -268,8 +266,6 @@ class CRM_Core_BAO_PaperSize extends CRM_Core_DAO_OptionValue {
    * @param array (reference) $values associative array of name/value pairs
    * @param int $id
    *   Id of the database record (null = new record).
-   *
-   * @return void
    */
   public function savePaperSize(&$values, $id) {
     // get the Option Group ID for Paper Sizes (create one if it doesn't exist)
index 94dfc47fdbe9158fe98ab215a17a350c74ec061d..ccdbe4a9f064caf09e3fe14a64785a734278fe97 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class contains functions for managing PDF Page Formats
+ * This class contains functions for managing PDF Page Formats.
  */
 class CRM_Core_BAO_PdfFormat extends CRM_Core_DAO_OptionValue {
 
@@ -144,8 +142,6 @@ class CRM_Core_BAO_PdfFormat extends CRM_Core_DAO_OptionValue {
    * @param array (reference) $list List of PDF Page Formats
    * @param string $returnURL
    *   URL of page calling this function.
-   *
-   * @return void
    */
   public static function addOrder(&$list, $returnURL) {
     $filter = "option_group_id = " . self::_getGid();
@@ -324,11 +320,9 @@ class CRM_Core_BAO_PdfFormat extends CRM_Core_DAO_OptionValue {
   /**
    * Save the PDF Page Format in the DB.
    *
-   * @param array (reference) $values associative array of name/value pairs
+   * @param array $values associative array of name/value pairs
    * @param int $id
    *   Id of the database record (null = new record).
-   *
-   * @return void
    */
   public function savePdfFormat(&$values, $id = NULL) {
     // get the Option Group ID for PDF Page Formats (create one if it doesn't exist)
index 4414faeb4ace3772db096c65595430531e5f7a08..796129085f3dea2d98977972d9f102eef39458b7 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Class contains functions for phone
+ * Class contains functions for phone.
  */
 class CRM_Core_BAO_Phone extends CRM_Core_DAO_Phone {
 
@@ -234,8 +232,6 @@ ORDER BY ph.is_primary DESC, phone_id ASC ";
    *
    * @param $optionId
    *   Value of option to be deleted.
-   *
-   * @return void
    */
   public static function setOptionToNull($optionId) {
     if (!$optionId) {
index 86c544b8e2a3ef63c776bd7732fe0d88e40e8055..607206d760a0bb76c34ede069d4cd98f256431f3 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Core_BAO_PreferencesDate extends CRM_Core_DAO_PreferencesDate {
 
@@ -74,10 +72,6 @@ class CRM_Core_BAO_PreferencesDate extends CRM_Core_DAO_PreferencesDate {
    *   Id of the database record.
    * @param bool $is_active
    *   Value we want to set the is_active field.
-   *
-   * @return void
-   *   DAO object on success, null otherwise
-   *
    */
   public static function setIsActive($id, $is_active) {
     CRM_Core_Error::fatal();
@@ -87,7 +81,6 @@ class CRM_Core_BAO_PreferencesDate extends CRM_Core_DAO_PreferencesDate {
    * Delete preference dates.
    *
    * @param int $id
-   *
    */
   public static function del($id) {
     CRM_Core_Error::fatal();
index 87eea954ac7da5a023414648795f33722c32525d..2c4077cc6c2d61c422a7cba2da3ab07e8d17a1d8 100644 (file)
@@ -153,12 +153,48 @@ WHERE  cacheKey     = %3 AND
 
     if (isset($cacheKey)) {
       $sql .= " AND cacheKey LIKE %4";
-      $params[4] = array("{$cacheKey}%", 'String');
+      $params[4] = array("{$cacheKey}%", 'String'); // used % to address any row with conflict-cacheKey e.g "merge Individual_8_0_conflicts"
     }
 
     CRM_Core_DAO::executeQuery($sql, $params);
   }
 
+  public static function markConflict($id1, $id2, $cacheKey, $conflicts) {
+    if (empty($cacheKey) || empty($conflicts)) {
+      return FALSE;
+    }
+
+    $sql  = "SELECT pn.* 
+      FROM  civicrm_prevnext_cache pn
+      WHERE 
+      ((pn.entity_id1 = %1 AND pn.entity_id2 = %2) OR (pn.entity_id1 = %2 AND pn.entity_id2 = %1)) AND 
+      (cacheKey = %3 OR cacheKey = %4)";
+    $params = array(
+      1 => array($id1, 'Integer'),
+      2 => array($id2, 'Integer'),
+      3 => array("{$cacheKey}", 'String'),
+      4 => array("{$cacheKey}_conflicts", 'String'),
+    );
+    $pncFind = CRM_Core_DAO::executeQuery($sql, $params);
+
+    while ($pncFind->fetch()) {
+      $data = $pncFind->data;
+      if (!empty($data)) {
+        $data = unserialize($data);
+        $data['conflicts'] = implode(",", array_values($conflicts));
+
+        $pncUp = new CRM_Core_DAO_PrevNextCache();
+        $pncUp->id = $pncFind->id;
+        if ($pncUp->find(TRUE)) {
+          $pncUp->data     = serialize($data);
+          $pncUp->cacheKey = "{$cacheKey}_conflicts";
+          $pncUp->save();
+        }
+      }
+    }
+    return TRUE;
+  }
+
   /**
    * @param $cacheKey
    * @param NULL $join
@@ -168,14 +204,25 @@ WHERE  cacheKey     = %3 AND
    *
    * @return array
    */
-  public static function retrieve($cacheKey, $join = NULL, $where = NULL, $offset = 0, $rowCount = 0) {
+  public static function retrieve($cacheKey, $join = NULL, $where = NULL, $offset = 0, $rowCount = 0, $select = array()) {
+    $selectString = 'pn.*';
+    if (!empty($select)) {
+      $aliasArray = array();
+      foreach ($select as $column => $alias) {
+        $aliasArray[] = $column . ' as ' . $alias;
+      }
+      $selectString .= " , " . implode(' , ', $aliasArray);
+    }
     $query = "
-SELECT data
+SELECT SQL_CALC_FOUND_ROWS {$selectString}
 FROM   civicrm_prevnext_cache pn
        {$join}
-WHERE  cacheKey = %1
+WHERE  (pn.cacheKey = %1 OR pn.cacheKey = %2)
 ";
-    $params = array(1 => array($cacheKey, 'String'));
+    $params = array(
+      1 => array($cacheKey, 'String'),
+      2 => array("{$cacheKey}_conflicts", 'String'),
+    );
 
     if ($where) {
       $query .= " AND {$where}";
@@ -190,14 +237,31 @@ WHERE  cacheKey = %1
 
     $dao = CRM_Core_DAO::executeQuery($query, $params);
 
-    $main = array();
+    $main  = array();
+    $count = 0;
     while ($dao->fetch()) {
       if (self::is_serialized($dao->data)) {
-        $main[] = unserialize($dao->data);
+        $main[$count] = unserialize($dao->data);
       }
       else {
-        $main[] = $dao->data;
+        $main[$count] = $dao->data;
+      }
+
+      if (!empty($select)) {
+        $extraData = array();
+        foreach ($select as $dfield => $sfield) {
+          $extraData[$sfield]  = $dao->$sfield;
+        }
+        $main[$count] = array(
+          'prevnext_id' => $dao->id,
+          'is_selected' => $dao->is_selected,
+          'entity_id1'  => $dao->entity_id1,
+          'entity_id2'  => $dao->entity_id2,
+          'data'        => $main[$count],
+        );
+        $main[$count] = array_merge($main[$count], $extraData);
       }
+      $count++;
     }
 
     return $main;
@@ -235,13 +299,16 @@ WHERE  cacheKey = %1
     $query = "
 SELECT COUNT(*) FROM civicrm_prevnext_cache pn
        {$join}
-WHERE cacheKey $op %1
+WHERE (pn.cacheKey $op %1 OR pn.cacheKey $op %2)
 ";
     if ($where) {
       $query .= " AND {$where}";
     }
 
-    $params = array(1 => array($cacheKey, 'String'));
+    $params = array(
+      1 => array($cacheKey, 'String'),
+      2 => array("{$cacheKey}_conflicts", 'String'),
+    );
     return (int) CRM_Core_DAO::singleValueQuery($query, $params, TRUE, FALSE);
   }
 
index fcee1ccc4efcbdb89a2397c4f32066f7be1a82fa..0b43da189ca0166cbbaa7b60394d8d568685ae8a 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 require_once 'packages/When/When.php';
 
 /**
- * Class CRM_Core_BAO_RecurringEntity
+ * Class CRM_Core_BAO_RecurringEntity.
  */
 class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity {
 
@@ -203,10 +201,7 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity {
    * This function updates the mode column in the civicrm_recurring_entity table.
    *
    * @param int $mode
-   *   Mode of the entity to cascade changes across parent/child relations eg 1 - only this entity, 2 - this and the following entities, 3 - All the entity .
-   *
-   *
-   * @return void
+   *   Mode of the entity to cascade changes across parent/child relations eg 1 - only this entity, 2 - this and the following entities, 3 - All the entity.
    */
   public function mode($mode) {
     if ($this->entity_id && $this->entity_table) {
@@ -601,14 +596,12 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity {
   }
 
   /**
-   * This function acts as a listener to dao->update whenever there is an update,
-   * and propagates any changes to all related entities present in recurring entity table
+   * This function acts as a listener to dao->update whenever there is an update.
    *
-   * @param object $event
-   *   An object of /Civi/Core/DAO/Event/PostUpdate containing dao object that was just updated .
+   * It propagates any changes to all related entities present in recurring entity table
    *
-   *
-   * @return void
+   * @param object $event
+   *   An object of /Civi/Core/DAO/Event/PostUpdate containing dao object that was just updated.
    */
   static public function triggerUpdate($event) {
     // if DB version is earlier than 4.6 skip any processing
@@ -623,20 +616,20 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity {
     static $processedEntities = array();
     $obj =& $event->object;
     if (empty($obj->id) || empty($obj->__table)) {
-      return FALSE;
+      return;
     }
     $key = "{$obj->__table}_{$obj->id}";
 
     if (array_key_exists($key, $processedEntities)) {
       // already processed
-      return NULL;
+      return;
     }
 
     // get related entities
     $repeatingEntities = self::getEntitiesFor($obj->id, $obj->__table, FALSE, NULL);
     if (empty($repeatingEntities)) {
       // return if its not a recurring entity parent
-      return NULL;
+      return;
     }
     // mark being processed
     $processedEntities[$key] = 1;
@@ -677,15 +670,12 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity {
    * and creates entries for linked entities in recurring entity table
    *
    * @param object $event
-   *   An object of /Civi/Core/DAO/Event/PostUpdate containing dao object that was just inserted .
-   *
-   *
-   * @return void
+   *   An object of /Civi/Core/DAO/Event/PostUpdate containing dao object that was just inserted.
    */
   static public function triggerInsert($event) {
     $obj =& $event->object;
     if (!array_key_exists($obj->__table, self::$_linkedEntitiesInfo)) {
-      return FALSE;
+      return;
     }
 
     // if DB version is earlier than 4.6 skip any processing
@@ -699,18 +689,18 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity {
 
     static $processedEntities = array();
     if (empty($obj->id) || empty($obj->__table)) {
-      return FALSE;
+      return;
     }
     $key = "{$obj->__table}_{$obj->id}";
 
     if (array_key_exists($key, $processedEntities)) {
       // already being processed. Exit recursive calls.
-      return NULL;
+      return;
     }
 
     if (self::getStatus() == self::RUNNING) {
       // if recursion->generate() is doing some work, lets not intercept
-      return NULL;
+      return;
     }
 
     // mark being processed
@@ -743,7 +733,7 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity {
             foreach ($pRepeatingEntities as $key => $val) {
               if (array_key_exists($key, $processedEntities)) {
                 // this graph is already being processed
-                return NULL;
+                return;
               }
               $processedEntities[$key] = 1;
             }
@@ -787,10 +777,7 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity {
    * This function acts as a listener to dao->delete, and deletes an entry from recurring_entity table
    *
    * @param object $event
-   *   An object of /Civi/Core/DAO/Event/PostUpdate containing dao object that was just deleted .
-   *
-   *
-   * @return void
+   *   An object of /Civi/Core/DAO/Event/PostUpdate containing dao object that was just deleted.
    */
   static public function triggerDelete($event) {
     $obj =& $event->object;
@@ -806,13 +793,13 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity {
 
     static $processedEntities = array();
     if (empty($obj->id) || empty($obj->__table) || !$event->result) {
-      return FALSE;
+      return;
     }
     $key = "{$obj->__table}_{$obj->id}";
 
     if (array_key_exists($key, $processedEntities)) {
       // already processed
-      return NULL;
+      return;
     }
 
     // mark being processed
index f0550013800e01883889431f0b68ddb76cce8508..4ef45dd27b34ef304b9b91e79629135b1173415a 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -39,7 +37,6 @@
  *
  * The group column is used for grouping together all settings that logically belong to the same set.
  * Thus all settings in the same group are retrieved with one DB call and then cached for future needs.
- *
  */
 class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting {
 
@@ -366,8 +363,6 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting {
    *   An optional ID to assign the creator to. If not set, retrieved from session.
    *
    * @param int $domainID
-   *
-   * @return void
    */
   public static function setItem(
     $value,
index a0bb9c5cb4d03709093ca4f97bbc60f29eea466c..11fc22453bba3916f1b04eedccc8b3b69785b1cf 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class contains function for UFField
- *
+ * This class contains function for UFField.
  */
 class CRM_Core_BAO_UFField extends CRM_Core_DAO_UFField {
 
@@ -271,8 +268,6 @@ WHERE cf.id IN (" . $customFieldIds . ") AND is_multiple = 1 LIMIT 0,1";
    *   Custom field id.
    * @param bool $is_active
    *   Set the is_active field.
-   *
-   * @return void
    */
   public static function setUFField($customFieldId, $is_active) {
     //find the profile id given custom field
@@ -294,8 +289,6 @@ WHERE cf.id IN (" . $customFieldIds . ") AND is_multiple = 1 LIMIT 0,1";
    *   From which we need to copy.
    * @param bool $new_id
    *   In which to copy.
-   *
-   * @return void
    */
   public static function copy($old_id, $new_id) {
     $ufField = new CRM_Core_DAO_UFField();
@@ -314,9 +307,6 @@ WHERE cf.id IN (" . $customFieldIds . ") AND is_multiple = 1 LIMIT 0,1";
    *
    * @param int $customFieldId
    *   ID of the custom field to be deleted.
-   *
-   * @return void
-   *
    */
   public static function delUFField($customFieldId) {
     //find the profile id given custom field id
@@ -337,8 +327,6 @@ WHERE cf.id IN (" . $customFieldIds . ") AND is_multiple = 1 LIMIT 0,1";
    *   Custom group id.
    * @param bool $is_active
    *   Value we want to set the is_active field.
-   *
-   * @return void
    */
   public static function setUFFieldStatus($customGroupId, $is_active) {
     //find the profile id given custom group id
@@ -752,8 +740,6 @@ SELECT  id
    * Reset In selector and is searchable values for given $profileID.
    *
    * @param int $profileID
-   *
-   * @return void
    */
   public function resetInSelectorANDSearchable($profileID) {
     if (!$profileID) {
index 5240a93d2a447930e830f3d2a35e8666d04b0ac5..d49553763be7691be5c935eda27517ed1fde721b 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- *
+ * UF group BAO class.
  */
 class CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup {
   const PUBLIC_VISIBILITY = 1,
@@ -952,8 +950,6 @@ class CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup {
    * @param bool $absolute
    *   Return urls in absolute form (useful when sending an email).
    * @param null $additionalWhereClause
-   *
-   * @return void
    */
   public static function getValues(
     $cid, &$fields, &$values,
@@ -1494,8 +1490,6 @@ class CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup {
    *   (reference) an assoc array of name/value pairs.
    * @param int $ufGroupId
    *   Ufgroup id.
-   *
-   * @return void
    */
   public static function createUFJoin(&$params, $ufGroupId) {
     $groupTypes = CRM_Utils_Array::value('uf_group_type', $params);
@@ -1627,8 +1621,6 @@ AND    ( entity_id IS NULL OR entity_id <= 0 )
    *
    * @param array $params
    *   (reference) an assoc array of name/value pairs.
-   *
-   * @return void
    */
   public static function delUFJoin(&$params) {
     $ufJoin = new CRM_Core_DAO_UFJoin();
@@ -2705,7 +2697,7 @@ AND    ( entity_id IS NULL OR entity_id <= 0 )
    * @param int $id
    *   The profile id to copy.
    *
-   * @return void
+   * @return \CRM_Core_DAO
    */
   public static function copy($id) {
     $fieldsFix = array('prefix' => array('title' => ts('Copy of ')));
@@ -2764,8 +2756,6 @@ AND    ( entity_id IS NULL OR entity_id <= 0 )
    *   Contact id.
    * @param array $values
    *   Associative array of name/value pair.
-   *
-   * @return void
    */
   public static function commonSendMail($contactID, &$values) {
     if (!$contactID || !$values) {
@@ -2859,8 +2849,6 @@ AND    ( entity_id IS NULL OR entity_id <= 0 )
    *   Group id.
    * @param array $values
    * @param CRM_Core_Smarty $template
-   *
-   * @return void
    */
   public function profileDisplay($gid, $values, $template) {
     $groupTitle = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $gid, 'title');
@@ -3204,8 +3192,6 @@ AND    ( entity_id IS NULL OR entity_id <= 0 )
    *   An array of default values.
    *
    * @param bool $isStandalone
-   *
-   * @return void
    */
   public static function setComponentDefaults(&$fields, $componentId, $component, &$defaults, $isStandalone = FALSE) {
     if (!$componentId ||
index 3b918ab08615573412a49bb966810a86982f0b3d..e6891dccfc1ae3cdd5cf74cab0dd7d922db81eba 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * The basic class that interfaces with the external user framework
+ * The basic class that interfaces with the external user framework.
  */
 class CRM_Core_BAO_UFMatch extends CRM_Core_DAO_UFMatch {
 
@@ -74,8 +72,6 @@ class CRM_Core_BAO_UFMatch extends CRM_Core_DAO_UFMatch {
    *
    * @param $ctype
    * @param bool $isLogin
-   *
-   * @return void
    */
   public static function synchronize(&$user, $update, $uf, $ctype, $isLogin = FALSE) {
     $userSystem = CRM_Core_Config::singleton()->userSystem;
@@ -362,8 +358,6 @@ AND    domain_id    = %4
    *
    * @param int $contactId
    *   Id of the contact to update.
-   *
-   * @return void
    */
   public static function updateUFName($contactId) {
     if (!$contactId) {
@@ -415,10 +409,8 @@ AND    domain_id    = %4
    *
    * @param int $contactId
    *   Contact ID of the user.
-   * @param $emailAddress
+   * @param string $emailAddress
    *   Email to be modified for the user.
-   *
-   * @return void
    */
   public static function updateContactEmail($contactId, $emailAddress) {
     $strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
@@ -471,8 +463,6 @@ AND    domain_id    = %4
    *
    * @param int $ufID
    *   Id of the user to delete.
-   *
-   * @return void
    */
   public static function deleteUser($ufID) {
     $ufmatch = new CRM_Core_DAO_UFMatch();
index 0ea8c530122453aff85b981a61808375448ec43c..f0a510830d0ba20dd3617835d2fbe5e22a3588f2 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class contain function for Website handling
+ * This class contain function for Website handling.
  */
 class CRM_Core_BAO_Website extends CRM_Core_DAO_Website {
 
@@ -66,9 +64,9 @@ class CRM_Core_BAO_Website extends CRM_Core_DAO_Website {
    * @param int $contactID
    *   Contact id.
    *
-   * @param $skipDelete
+   * @param bool $skipDelete
    *
-   * @return void
+   * @return bool
    */
   public static function create(&$params, $contactID, $skipDelete) {
     if (empty($params)) {
@@ -115,7 +113,7 @@ class CRM_Core_BAO_Website extends CRM_Core_DAO_Website {
    * @param array $ids
    *   Website ids.
    *
-   * @return void
+   * @return bool
    */
   public static function del($ids) {
     $query = 'DELETE FROM civicrm_website WHERE id IN ( ' . implode(',', $ids) . ')';
index 49807e0a33c33c1c2c7b140060a0789167168a0a..db6ad2e00de376c2739b9e3d9870a99d766327d5 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * defines a simple implemenation of a drupal block.
- * blocks definitions and html are in a smarty template file
+ * Defines a simple implementation of a drupal block.
  *
+ * Blocks definitions and html are in a smarty template file.
  */
 class CRM_Core_Block {
 
@@ -67,8 +65,6 @@ class CRM_Core_Block {
 
   /**
    * Initialises the $_properties array
-   *
-   * @return void
    */
   public static function initProperties() {
     if (!defined('BLOCK_CACHE_GLOBAL')) {
@@ -206,8 +202,6 @@ class CRM_Core_Block {
    *   The desired property.
    * @param string $value
    *   The value of the desired property.
-   *
-   * @return void
    */
   public static function setProperty($id, $property, $value) {
     if (!(self::$_properties)) {
@@ -217,7 +211,7 @@ class CRM_Core_Block {
   }
 
   /**
-   * Returns the whole $_properties array
+   * Returns the whole $_properties array.
    *
    * @return array
    *   the $_properties array
@@ -288,8 +282,6 @@ class CRM_Core_Block {
    * hence this hack
    *
    * @param int $id
-   *
-   * @return void
    */
   private static function setTemplateValues($id) {
     switch ($id) {
@@ -347,8 +339,6 @@ class CRM_Core_Block {
 
   /**
    * Create the list of options to create New objects for the application and format is as a block.
-   *
-   * @return void
    */
   private static function setTemplateShortcutValues() {
     $config = CRM_Core_Config::singleton();
@@ -470,8 +460,6 @@ class CRM_Core_Block {
 
   /**
    * Create the list of dashboard links.
-   *
-   * @return void
    */
   private static function setTemplateDashboardValues() {
     static $dashboardLinks = array();
@@ -507,8 +495,6 @@ class CRM_Core_Block {
 
   /**
    * Create the list of mail urls for the application and format is as a block.
-   *
-   * @return void
    */
   private static function setTemplateMailValues() {
     static $shortCuts = NULL;
@@ -540,8 +526,6 @@ class CRM_Core_Block {
 
   /**
    * Create the list of shortcuts for the application and format is as a block.
-   *
-   * @return void
    */
   private static function setTemplateMenuValues() {
     $config = CRM_Core_Config::singleton();
@@ -555,8 +539,6 @@ class CRM_Core_Block {
 
   /**
    * Create the event blocks for upcoming events.
-   *
-   * @return void
    */
   private static function setTemplateEventValues() {
     $config = CRM_Core_Config::singleton();
index c47361175ac0f8500e314904a6f9a38208184222..c78f37520ccb73ddcbb315e6157c4840b253a239 100644 (file)
 
 /**
  * Config handles all the run time configuration changes that the system needs to deal with.
+ *
  * Typically we'll have different values for a user's sandbox, a qa sandbox and a production area.
  * The default values in general, should reflect production values (minimizes chances of screwing up)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 require_once 'Log.php';
@@ -423,8 +422,6 @@ class CRM_Core_Config extends CRM_Core_Config_Variables {
 
   /**
    * Initialize the config variables.
-   *
-   * @return void
    */
   private function _initVariables() {
     // retrieve serialised settings
index e837019699dc9c14ed82e56358c8160acf998157..736406d1a2913379a5dad53af673d3ba8ac607a8 100644 (file)
@@ -39,8 +39,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 require_once 'HTML/QuickForm/Controller.php';
@@ -376,14 +374,12 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller {
   }
 
   /**
-   * Helper function to add all the needed default actions. Note that the framework
-   * redefines all of the default QFC actions
+   * Helper function to add all the needed default actions.
+   *
+   * Note that the framework redefines all of the default QFC actions.
    *
    * @param string $uploadDirectory to store all the uploaded files
    * @param array $uploadNames for the various upload buttons (note u can have more than 1 upload)
-   *
-   *
-   * @return void
    */
   public function addActions($uploadDirectory = NULL, $uploadNames = NULL) {
     $names = array(
@@ -432,8 +428,6 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller {
    * @param CRM_Core_StateMachine $stateMachine
    * @param \const|int $action the mode in which the state machine is operating
    *                              typically this will be add/view/edit
-   *
-   * @return void
    */
   public function addPages(&$stateMachine, $action = CRM_Core_Action::NONE) {
     $pages = $stateMachine->getPages();
@@ -491,9 +485,6 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller {
 
   /**
    * Destroy all the session state of the controller.
-   *
-   *
-   * @return void
    */
   public function reset() {
     $this->container(TRUE);
@@ -502,12 +493,11 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller {
 
   /**
    * Virtual function to do any processing of data.
+   *
    * Sometimes it is useful for the controller to actually process data.
    * This is typically used when we need the controller to figure out
    * what pages are potentially involved in this wizard. (this is dynamic
    * and can change based on the arguments
-   *
-   * @return void
    */
   public function process() {
   }
@@ -518,9 +508,6 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller {
    * @param string|array $name name of the variable or an assoc array of name/value pairs
    * @param mixed $value
    *   Value of the variable if string.
-   *
-   *
-   * @return void
    */
   public function set($name, $value = NULL) {
     self::$_session->set($name, $value, $this->_scope);
@@ -532,7 +519,6 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller {
    * @param string $name
    *   name of the variable.
    *
-   *
    * @return mixed
    */
   public function get($name) {
@@ -601,9 +587,7 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller {
    *
    * @param string $var
    * @param mixed $value
-   *   Value of varaible.
-   *
-   * @return void
+   *   Value of variable.
    */
   public function assign($var, $value = NULL) {
     self::$_template->assign($var, $value);
@@ -614,9 +598,7 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller {
    *
    * @param string $var
    * @param mixed $value
-   *   (reference) value of varaible.
-   *
-   * @return void
+   *   (reference) value of variable.
    */
   public function assign_by_ref($var, &$value) {
     self::$_template->assign_by_ref($var, $value);
@@ -649,8 +631,6 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller {
    * Setter for embedded.
    *
    * @param bool $embedded
-   *
-   * @return void
    */
   public function setEmbedded($embedded) {
     $this->_embedded = $embedded;
@@ -670,8 +650,6 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller {
    * Setter for skipRedirection.
    *
    * @param bool $skipRedirection
-   *
-   * @return void
    */
   public function setSkipRedirection($skipRedirection) {
     $this->_skipRedirection = $skipRedirection;
@@ -720,8 +698,6 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller {
    * Setter for print.
    *
    * @param bool $print
-   *
-   * @return void
    */
   public function setPrint($print) {
     if ($print == "xls") {
@@ -843,10 +819,10 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller {
   }
 
   /**
-   * Write a simple fatal error message. Other controllers can decide to do something else
-   * and present the user a better message and/or redirect to the same page with a reset url
+   * Write a simple fatal error message.
    *
-   * @return void
+   * Other controllers can decide to do something else and present the user a better message
+   * and/or redirect to the same page with a reset url
    */
   public function invalidKey() {
     self::invalidKeyCommon();
@@ -860,8 +836,6 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller {
   /**
    * Instead of outputting a fatal error message, we'll just redirect
    * to the entryURL if present
-   *
-   * @return void
    */
   public function invalidKeyRedirect() {
     if ($this->_entryURL && $url_parts = parse_url($this->_entryURL)) {
index e9b71a689b19d04c2de271eb89e07bb346c6958f..821f818854d4274429a35f49646ab2611a0c0f1d 100644 (file)
@@ -30,8 +30,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 require_once 'PEAR.php';
@@ -99,8 +97,6 @@ class CRM_Core_DAO extends DB_DataObject {
    *
    * @param string $dsn
    *   The database connection string.
-   *
-   * @return void
    */
   public static function init($dsn) {
     $options = &PEAR::getStaticProperty('DB_DataObject', 'options');
@@ -267,11 +263,11 @@ class CRM_Core_DAO extends DB_DataObject {
   }
 
   /**
-   * Reset the DAO object. DAO is kinda crappy in that there is an unwritten
-   * rule of one query per DAO. We attempt to get around this crappy restricrion
-   * by resetting some of DAO's internal fields. Use this with caution
+   * Reset the DAO object.
    *
-   * @return void
+   * DAO is kinda crappy in that there is an unwritten rule of one query per DAO.
+   *
+   * We attempt to get around this crappy restriction by resetting some of DAO's internal fields. Use this with caution
    */
   public function reset() {
 
@@ -330,8 +326,6 @@ class CRM_Core_DAO extends DB_DataObject {
    *
    * @param object $factory
    *   The factory application object.
-   *
-   * @return void
    */
   public static function setFactory(&$factory) {
     self::$_factory = &$factory;
@@ -341,8 +335,6 @@ class CRM_Core_DAO extends DB_DataObject {
    * Factory method to instantiate a new object from a table name.
    *
    * @param string $table
-   *
-   * @return void
    */
   public function factory($table = '') {
     if (!isset(self::$_factory)) {
@@ -355,8 +347,6 @@ class CRM_Core_DAO extends DB_DataObject {
   /**
    * Initialization for all DAO objects. Since we access DB_DO programatically
    * we need to set the links manually.
-   *
-   * @return void
    */
   public function initialize() {
     $this->_connect();
@@ -571,8 +561,6 @@ class CRM_Core_DAO extends DB_DataObject {
    *   The object that we are extracting data from.
    * @param array $values
    *   (reference ) associative array of name/value pairs.
-   *
-   * @return void
    */
   public static function storeValues(&$object, &$values) {
     $fields = &$object->fields();
@@ -1138,8 +1126,6 @@ FROM   civicrm_domain
    *   Name of the dao object.
    * @param int $contactId
    *   Id of the contact to delete.
-   *
-   * @return void
    */
   public static function deleteEntityContact($daoName, $contactId) {
     $object = new $daoName();
index 6396867cb0e3f64310b8b6139b165a27cd8fc7ff..03bbfe0ad9d91d6c06764fe116e5d2db4a2fe206 100644 (file)
@@ -177,6 +177,15 @@ function _civicrm_api3_permissions($entity, $action, &$params) {
     ),
   );
 
+  // Campaign permissions
+  $permissions['campaign'] = array(
+    'get' => array('access CiviCRM'),
+    'create' => array(array('administer CiviCampaign', 'manage campaign')),
+    'update' => array(array('administer CiviCampaign', 'manage campaign')),
+    'delete' => array(array('administer CiviCampaign', 'manage campaign')),
+  );
+  $permissions['survey'] = $permissions['campaign'];
+
   // Financial permissions
   $permissions['contribution'] = array(
     'get' => array(
@@ -516,6 +525,12 @@ function _civicrm_api3_permissions($entity, $action, &$params) {
   $permissions['option_value'] = $permissions['uf_group'];
   $permissions['option_group'] = $permissions['option_value'];
 
+  $permissions['message_template'] = array(
+    'get' => array('access CiviCRM'),
+    'create' => array('edit message templates'),
+    'update' => array('edit message templates'),
+  );
+
   // Translate 'create' action to 'update' if id is set
   if ($action == 'create' && (!empty($params['id']) || !empty($params[$entity . '_id']))) {
     $action = 'update';
index b0c1eba2bb7efe52cf02705a3241640eb65df9f6..5517fd83334e4fc14f0ad8d19d77a62a4cfe8e79 100644 (file)
@@ -31,8 +31,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 require_once 'PEAR/ErrorStack.php';
@@ -46,7 +44,8 @@ require_once 'Log.php';
  */
 class CRM_Exception extends PEAR_Exception {
   /**
-   * Redefine the exception so message isn't optional
+   * Redefine the exception so message isn't optional.
+   *
    * Supported signatures:
    *  - PEAR_Exception(string $message);
    *  - PEAR_Exception(string $message, int $code);
@@ -169,8 +168,6 @@ class CRM_Core_Error extends PEAR_ErrorStack {
    * which currently use PEAR::raiseError to notify of error messages.
    *
    * @param object $pearError PEAR_Error
-   *
-   * @return void
    */
   public static function handle($pearError) {
 
@@ -307,8 +304,6 @@ class CRM_Core_Error extends PEAR_ErrorStack {
    *   The email address to notify of this situation.
    *
    * @throws Exception
-   *
-   * @return void
    */
   public static function fatal($message = NULL, $code = NULL, $email = NULL) {
     $vars = array(
@@ -373,7 +368,7 @@ class CRM_Core_Error extends PEAR_ErrorStack {
         $out['backtrace'] = self::parseBacktrace(debug_backtrace());
         $message .= '<p><em>See console for backtrace</em></p>';
       }
-      CRM_Core_Session::setStatus($message, ts('Sorry an Error Occured'), 'error');
+      CRM_Core_Session::setStatus($message, ts('Sorry an error occurred'), 'error');
       CRM_Core_Transaction::forceRollbackIfEnabled();
       CRM_Core_Page_AJAX::returnJsonResponse($out);
     }
@@ -393,8 +388,6 @@ class CRM_Core_Error extends PEAR_ErrorStack {
    * something that follows a cleaner separation of concerns.
    *
    * @param Exception $exception
-   *
-   * @return void
    */
   public static function handleUnhandledException($exception) {
     try {
@@ -858,7 +851,6 @@ class CRM_Core_Error extends PEAR_ErrorStack {
    *
    * @param null $redirect
    * @param string $title
-   * @return void
    */
   public static function statusBounce($status, $redirect = NULL, $title = NULL) {
     $session = CRM_Core_Session::singleton();
index 932c1d81844525f18d6834de7e778193a5a95fe3..a68d70e3a63d55cea6e9977438d4a1c3f228b129 100644 (file)
@@ -32,8 +32,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 require_once 'HTML/QuickForm/Page.php';
@@ -245,8 +243,6 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
 
   /**
    * Register all the standard rules that most forms potentially use.
-   *
-   * @return void
    */
   public function registerRules() {
     static $rules = array(
@@ -360,24 +356,19 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
    * called before buildForm. Any pre-processing that
    * needs to be done for buildForm should be done here
    *
-   * This is a virtual function and should be redefined if needed
-   *
-   *
-   * @return void
+   * This is a virtual function and should be redefined if needed.
    */
   public function preProcess() {
   }
 
   /**
-   * called after the form is validated. Any
-   * processing of form state etc should be done in this function.
+   * Called after the form is validated.
+   *
+   * Any processing of form state etc should be done in this function.
    * Typically all processing associated with a form should be done
    * here and relevant state should be stored in the session
    *
    * This is a virtual function and should be redefined if needed
-   *
-   *
-   * @return void
    */
   public function postProcess() {
   }
@@ -419,21 +410,16 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
   }
 
   /**
-   * This virtual function is used to build the form. It replaces the
-   * buildForm associated with QuickForm_Page. This allows us to put
-   * preProcess in front of the actual form building routine
+   * This virtual function is used to build the form.
    *
-   *
-   * @return void
+   * It replaces the buildForm associated with QuickForm_Page. This allows us to put
+   * preProcess in front of the actual form building routine
    */
   public function buildQuickForm() {
   }
 
   /**
-   * This virtual function is used to set the default values of
-   * various form elements
-   *
-   * access        public
+   * This virtual function is used to set the default values of various form elements.
    *
    * @return array|NULL
    *   reference to the array of default values
@@ -443,12 +429,10 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
   }
 
   /**
-   * This is a virtual function that adds group and global rules to
-   * the form. Keeping it distinct from the form to keep code small
-   * and localized in the form building code
-   *
+   * This is a virtual function that adds group and global rules to the form.
    *
-   * @return void
+   * Keeping it distinct from the form to keep code small
+   * and localized in the form building code
    */
   public function addRules() {
   }
@@ -545,8 +529,6 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
    *   displayed. The associate array has 3 fields: 'type', 'name' and 'isDefault'
    *   The base form class will define a bunch of static arrays for commonly used
    *   formats.
-   *
-   * @return void
    */
   public function addButtons($params) {
     $prevnext = $spacing = array();
@@ -740,12 +722,43 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
     $this->assign('paymentProcessorID', $this->_paymentProcessorID);
   }
 
+  /**
+   * Handle pre approval for processors.
+   *
+   * This fits with the flow where a pre-approval is done and then confirmed in the next stage when confirm is hit.
+   *
+   * This function is shared between contribution & event forms & this is their common class.
+   *
+   * However, this should be seen as an in-progress refactor, the end goal being to also align the
+   * backoffice forms that action payments.
+   *
+   * @param array $params
+   */
+  protected function handlePreApproval(&$params) {
+    try {
+      $payment = Civi\Payment\System::singleton()->getByProcessor($this->_paymentProcessor);
+      $params['component'] = 'contribute';
+      $result = $payment->doPreApproval($params);
+      if (empty($result)) {
+        // This could happen, for example, when paypal looks at the button value & decides it is not paypal express.
+        return;
+      }
+    }
+    catch (\Civi\Payment\Exception\PaymentProcessorException $e) {
+      CRM_Core_Error::displaySessionError($e->getMessage());
+      CRM_Utils_System::redirect($params['cancelURL']);
+    }
+
+    $this->set('pre_approval_parameters', $result['pre_approval_parameters']);
+    if (!empty($result['redirect_url'])) {
+      CRM_Utils_System::redirect($result['redirect_url']);
+    }
+  }
+
   /**
    * Setter function for options.
    *
    * @param mixed $options
-   *
-   * @return void
    */
   public function setOptions($options) {
     $this->_options = $options;
@@ -785,8 +798,6 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
    * Setter function for Form Action.
    *
    * @param string $action
-   *
-   * @return void
    */
   public function setFormAction($action) {
     $this->_attributes['action'] = $action;
@@ -873,8 +884,6 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
    *   Error Code.
    * @param CRM_Core_DAO $dao
    *   A data access object on which we perform a rollback if non - empty.
-   *
-   * @return void
    */
   public function error($message, $code = NULL, $dao = NULL) {
     if ($dao) {
@@ -893,8 +902,6 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
    *   Name of the variable.
    * @param mixed $value
    *   Value of the variable.
-   *
-   * @return void
    */
   public function set($name, $value) {
     $this->controller->set($name, $value);
@@ -926,8 +933,6 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
    *
    * @param int $action
    *   The mode we want to set the form.
-   *
-   * @return void
    */
   public function setAction($action) {
     $this->_action = $action;
@@ -940,8 +945,6 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
    *   Name of variable.
    * @param mixed $value
    *   Value of variable.
-   *
-   * @return void
    */
   public function assign($var, $value = NULL) {
     self::$_template->assign($var, $value);
@@ -953,9 +956,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
    * @param string $var
    *   Name of variable.
    * @param mixed $value
-   *   Value of varaible.
-   *
-   * @return void
+   *   Value of variable.
    */
   public function assign_by_ref($var, &$value) {
     self::$_template->assign_by_ref($var, $value);
@@ -1104,8 +1105,6 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
    *   Button type for the form after processing.
    * @param string $backType
    * @param bool|string $submitOnce If true, add javascript to next button submit which prevents it from being clicked more than once
-   *
-   * @return void
    */
   public function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
     $buttons = array();
index b6486abc55be32780f5fb4ab5a4b3c8712ae0d1c..ca241e29b6b1983cbf2a18b815cc950bd8bde804 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Core_Form_Date {
 
@@ -40,11 +38,10 @@ class CRM_Core_Form_Date {
   const DATE_yyyy_mm_dd = 1, DATE_mm_dd_yy = 2, DATE_mm_dd_yyyy = 4, DATE_Month_dd_yyyy = 8, DATE_dd_mon_yy = 16, DATE_dd_mm_yyyy = 32;
 
   /**
-   * build the date-format form
+   * Build the date-format form.
    *
    * @param CRM_Core_Form $form
    *   The form object that we are operating on.
-   *
    */
   public static function buildAllowedDateFormats(&$form) {
 
@@ -70,8 +67,7 @@ class CRM_Core_Form_Date {
 
 
   /**
-   * retrieve the date range - relative or absolute
-   * and assign it to the form
+   * Retrieve the date range - relative or absolute and assign it to the form.
    *
    * @param CRM_Core_Form $form
    *   The form the dates should be added to.
@@ -85,7 +81,6 @@ class CRM_Core_Form_Date {
    *   Additional value pairs to add.
    * @param string $dateFormat
    * @param bool|string $displayTime
-   *
    */
   public static function buildDateRange(
     &$form, $fieldName, $count = 1,
@@ -108,8 +103,9 @@ class CRM_Core_Form_Date {
   }
 
   /**
-   * build the date range array that will provide the form option values.
-   * It can be - relative or absolute
+   * Build the date range array that will provide the form option values.
+   *
+   * It can be - relative or absolute.
    *
    * @param CRM_Core_Form $form
    *   The form object that we are operating on.
@@ -123,6 +119,7 @@ class CRM_Core_Form_Date {
    *   Additional Operator Selections to add.
    * @param string $dateFormat
    * @param bool $displayTime
+   *
    * @return array
    *   Values for Selector
    */
@@ -135,65 +132,68 @@ class CRM_Core_Form_Date {
     $selector = array(
       '' => ts('- any -'),
       0 => ts('Choose Date Range'),
-      'previous_2.year' => ts('Previous 2 Years'),
-      'previous_2.quarter' => ts('Previous 2 Quarters'),
-      'previous_2.month' => ts('Previous 2 Months'),
-      'previous_2.week' => ts('Previous 2 Weeks'),
-      'previous_2.day' => ts('Previous 2 Days'),
-      'previous_before.year' => ts('Prior to Previous Year'),
-      'previous_before.quarter' => ts('Prior to Previous Quarter'),
-      'previous_before.month' => ts('Prior to Previous Month'),
-      'previous_before.week' => ts('Prior to Previous Week'),
-      'previous_before.day' => ts('Prior to Previous Day'),
-      'previous.year' => ts('Previous Year'),
-      'previous.fiscal_year' => ts('Previous Fiscal Year'),
-      'previous.quarter' => ts('Previous Quarter'),
-      'previous.month' => ts('Previous Month'),
-      'previous.week' => ts('Previous Week'),
-      'earlier.year' => ts('To End of Previous Year'),
-      'earlier.quarter' => ts('To End of Previous Quarter'),
-      'earlier.month' => ts('To End of Previous Month'),
-      'earlier.week' => ts('To End of Previous Week'),
-      'earlier.day' => ts('To End of Previous Day'),
-      'greater_previous.year' => ts('From End of Previous Year'),
-      'greater_previous.quarter' => ts('From End of Previous Quarter'),
-      'greater_previous.month' => ts('From End of Previous Month'),
-      'greater_previous.week' => ts('From End of Previous Week'),
-      'greater.year' => ts('From Start of Current Year'),
-      'greater.quarter' => ts('From Start of Current Quarter'),
-      'greater.month' => ts('From Start of Current Month'),
-      'greater.week' => ts('From Start of Current Week'),
-      'greater.day' => ts('From Start of Current Day'),
-      'current.year' => ts('Current Year to-date'),
-      'current.quarter' => ts('Current Quarter to-date'),
-      'current.month' => ts('Current Month to-date'),
-      'current.week' => ts('Current Week to-date'),
-      'ending_3.year' => ts('Last 3 Years'),
-      'ending_2.year' => ts('Last 2 Years'),
-      'ending.year' => ts('Last 12 Months'),
-      'ending.quarter' => ts('Last 3 Months'),
-      'ending.month' => ts('Last 30 days'),
-      'ending.week' => ts('Last 7 days'),
+      'previous_2.year' => ts('Previous 2 calendar years'),
+      'previous_2.quarter' => ts('Previous 2 quarters'),
+      'previous_2.month' => ts('Previous 2 calendar months'),
+      'previous_2.week' => ts('Previous 2 weeks'),
+      'previous_2.day' => ts('Previous 2 days'),
+      'previous_before.year' => ts('Year prior to previous calendar year'),
+      'previous_before.quarter' => ts('Quarter prior to previous quarter'),
+      'previous_before.month' => ts('Month prior to previous calendar month'),
+      'previous_before.week' => ts('Week prior to previous week'),
+      'previous_before.day' => ts('Day prior to previous day'),
+      'previous.year' => ts('Previous calendar year'),
+      'previous.fiscal_year' => ts('Previous fiscal year'),
+      'previous.quarter' => ts('Previous quarter'),
+      'previous.month' => ts('Previous calendar month'),
+      'previous.week' => ts('Previous week'),
+      'earlier.year' => ts('To end of previous calendar year'),
+      'earlier.quarter' => ts('To end of previous quarter'),
+      'earlier.month' => ts('To end of previous calendar month'),
+      'earlier.week' => ts('To end of previous week'),
+      'earlier.day' => ts('To end of previous day'),
+      'greater_previous.year' => ts('From end of previous calendar year'),
+      'greater_previous.quarter' => ts('From end of previous quarter'),
+      'greater_previous.month' => ts('From end of previous calendar month'),
+      'greater_previous.week' => ts('From end of previous week'),
+      'greater.year' => ts('From start of current calendar year'),
+      'greater.quarter' => ts('From start of current quarter'),
+      'greater.month' => ts('From start of current calendar month'),
+      'greater.week' => ts('From start of current week'),
+      'greater.day' => ts('From start of current day'),
+      'current.year' => ts('Current calendar year to-date'),
+      'current.quarter' => ts('Current quarter to-date'),
+      'current.month' => ts('Current calendar month to-date'),
+      'current.week' => ts('Current week to-date'),
+      'ending_3.year' => ts('Last 3 years including today'),
+      'ending_2.year' => ts('Last 2 years including today'),
+      'ending.year' => ts('Last 12 months including today'),
+      'ending.quarter' => ts('Last 90 days including today'),
+      'ending_2.month' => ts('Last 60 days including today'),
+      'ending.month' => ts('Last 30 days including today'),
+      'ending.week' => ts('Last 7 days including today'),
       'previous.day' => ts('Yesterday'),
-      'this.year' => ts('This Year'),
-      'this.fiscal_year' => ts('This Fiscal Year'),
-      'this.quarter' => ts('This Quarter'),
-      'this.month' => ts('This Month'),
-      'this.week' => ts('This Week'),
+      'this.year' => ts('This calendar year'),
+      'this.fiscal_year' => ts('This fiscal year'),
+      'this.quarter' => ts('This quarter'),
+      'this.month' => ts('This calendar month'),
+      'this.week' => ts('This week'),
       'this.day' => ts('Today'),
       'starting.day' => ts('Tomorrow'),
-      'starting.week' => ts('Upcoming 7 days'),
-      'starting.month' => ts('Upcoming Month'),
-      'starting.year' => ts('Upcoming 12 Months'),
-      'less.year' => ts('To End of Current Year'),
-      'less.quarter' => ts('To End of Current Quarter'),
-      'less.month' => ts('To End of Current Month'),
-      'less.week' => ts('To End of Current Week'),
-      'next.week' => ts('Next Week'),
-      'next.month' => ts('Next Month'),
-      'next.quarter' => ts('Next Quarter'),
-      'next.fiscal_year' => ts('Next Fiscal Year'),
-      'next.year' => ts('Next Year'),
+      'starting.week' => ts('Next 7 days including today'),
+      'starting.month' => ts('Next 30 days including today'),
+      'starting_2.month' => ts('Next 60 days including today'),
+      'starting.quarter' => ts('Next 90 days including today'),
+      'starting.year' => ts('Next 12 months including today'),
+      'less.year' => ts('To end of current calendar year'),
+      'less.quarter' => ts('To end of current quarter'),
+      'less.month' => ts('To end of current calendar month'),
+      'less.week' => ts('To end of current week'),
+      'next.week' => ts('Next week'),
+      'next.month' => ts('Next calendar month'),
+      'next.quarter' => ts('Next quarter'),
+      'next.fiscal_year' => ts('Next fiscal year'),
+      'next.year' => ts('Next calendar year'),
     );
 
     if (is_array($operators)) {
@@ -211,7 +211,7 @@ class CRM_Core_Form_Date {
   }
 
   /**
-   * build the date range - relative or absolute
+   * Build the date range - relative or absolute.
    *
    * @param CRM_Core_Form $form
    *   The form object that we are operating on.
@@ -220,7 +220,7 @@ class CRM_Core_Form_Date {
    *   Array of option values to add.
    * @param string $from
    *   Label.
-   * @param string|\stringe $to
+   * @param string $to
    * @param string $fromLabel
    * @param bool $required
    * @param string $dateFormat
index 9ac7697bb5fc111e4a98b708ff13f4fc7cba918a..45a35bb0be3bdc54cb3076c5e41de77fa73bd7af 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form components for processing Entity
- *
+ * This class generates form components for processing Entity.
  */
 class CRM_Core_Form_RecurringEntity {
   /**
@@ -329,9 +326,6 @@ class CRM_Core_Form_RecurringEntity {
 
   /**
    * Process the form submission.
-   *
-   *
-   * @return void
    */
   public static function postProcess($params = array(), $type, $linkedEntities = array()) {
     //Check entity_id not present in params take it from class variable
index 4772b011641190a3c874d60e5bca8a2e81c43b55..1c4a8c5aa270c439860ae62f580fd24785bb64f4 100755 (executable)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Builds a form of shortcodes that can be added to WP posts
- * Use hook_civicrm_preProcess to modify this list
+ * Builds a form of shortcodes that can be added to WP posts.
+ *
+ * Use hook_civicrm_preProcess to modify this list.
  */
 class CRM_Core_Form_ShortCode extends CRM_Core_Form {
   /**
@@ -68,9 +67,7 @@ class CRM_Core_Form_ShortCode extends CRM_Core_Form {
 
 
   /**
-   * Build form data. Can be modified via hook_civicrm_preProcess
-   *
-   * @return void
+   * Build form data. Can be modified via hook_civicrm_preProcess.
    */
   public function preProcess() {
     $config = CRM_Core_Config::singleton();
@@ -171,9 +168,7 @@ class CRM_Core_Form_ShortCode extends CRM_Core_Form {
   }
 
   /**
-   * Build form elements based on the above metadata
-   *
-   * @return void
+   * Build form elements based on the above metadata.
    */
   public function buildQuickForm() {
     CRM_Core_Resources::singleton()
index ecb786e8c1392dca0e7b51c9e51f49fafae2aaaf..ffc6e187dbacfb03411a37d750c8d36497d3bfb4 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates form element for free tag widget
- *
+ * This class generates form element for free tag widget.
  */
 class CRM_Core_Form_Tag {
   public $_entityTagValues;
@@ -57,8 +54,6 @@ class CRM_Core_Form_Tag {
    *   True if need to add entry in entry table via ajax.
    * @param string $tagsetElementName
    *   If you need to create tagsetlist with specific name.
-   *
-   * @return void
    */
   public static function buildQuickForm(
     &$form, $parentNames, $entityTable, $entityId = NULL, $skipTagCreate = FALSE,
@@ -131,8 +126,6 @@ class CRM_Core_Form_Tag {
    *   Entity table.
    * @param CRM_Core_Form $form
    *   Form object.
-   *
-   * @return void
    */
   public static function postProcess(&$params, $entityId, $entityTable = 'civicrm_contact', &$form) {
     if ($form && !empty($form->_entityTagValues)) {
index ff01ff3e3b5fd709a9a61b20530121832616439b..75ef9b1c454e587acf0063dff3567c7625d8fa1b 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Core_I18n {
 
@@ -420,8 +418,6 @@ class CRM_Core_I18n {
    *   the array for localization (in place).
    * @param array $params
    *   an array of additional parameters.
-   *
-   * @return void
    */
   public function localizeArray(
     &$array,
@@ -445,8 +441,6 @@ class CRM_Core_I18n {
    *
    * @param array $array
    *   the array for localization (in place).
-   *
-   * @return void
    */
   public function localizeTitles(&$array) {
     foreach ($array as $key => $value) {
index 658c35aad63d09e342e1315df606c9159aeadcd4..c77f0faf544d9b0a7410495a0f0176722a049914 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Core_I18n_Schema {
 
   /**
    * Drop all views (for use by CRM_Core_DAO::dropAllTables() mostly).
-   *
-   * @return void
    */
   public static function dropAllViews() {
     $domain = new CRM_Core_DAO_Domain();
@@ -62,8 +58,6 @@ class CRM_Core_I18n_Schema {
    *
    * @param string $locale
    *   the first locale to create (migrate to).
-   *
-   * @return void
    */
   public static function makeMultilingual($locale) {
     $domain = new CRM_Core_DAO_Domain();
@@ -117,8 +111,6 @@ class CRM_Core_I18n_Schema {
    *
    * @param string $retain
    *   the locale to retain.
-   *
-   * @return void
    */
   public static function makeSinglelingual($retain) {
     $domain = new CRM_Core_DAO_Domain();
@@ -163,8 +155,6 @@ class CRM_Core_I18n_Schema {
    *   schema structure class to use to recreate indices.
    *
    * @param array $triggers
-   *
-   * @return void
    */
   public static function makeSinglelingualTable(
     $retain,
@@ -244,8 +234,6 @@ class CRM_Core_I18n_Schema {
    *   the new locale to add.
    * @param string $source
    *   the locale to copy from.
-   *
-   * @return void
    */
   public static function addLocale($locale, $source) {
     // get the current supported locales
@@ -303,8 +291,6 @@ class CRM_Core_I18n_Schema {
    *   locales to be rebuilt.
    * @param string $version
    *   version of schema structure to use.
-   *
-   * @return void
    */
   public static function rebuildMultilingualSchema($locales, $version = NULL) {
     if ($version) {
index ca6e22a55499d70ff1016bbb1258922098bbb961..c6b0335715b05a70d833b2f6c4eeb62f814cfa75 100644 (file)
@@ -31,8 +31,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Core_JobManager {
 
@@ -53,8 +51,6 @@ class CRM_Core_JobManager {
 
   /**
    * Class constructor.
-   *
-   * @return void
    */
   public function __construct() {
     $config = CRM_Core_Config::singleton();
@@ -207,9 +203,6 @@ class CRM_Core_JobManager {
 
   /**
    * @param string $message
-   *
-   * @return void
-   *   collection of permissions, null if none
    */
   public function logEntry($message) {
     $domainID = CRM_Core_Config::domainID();
index bd4987906f1aa46bb9b5b0fcbfc992530f008571..5d3330d7e4b8d41c48e68b7df9a0aeac64e1c735 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
+ * Joomla class.
+ *
+ * (clearly copied & pasted from a drupal class).
  *
+ * Still used?
  */
 class CRM_Core_Joomla {
 
   /**
-   * Reuse drupal blocks into a left sidebar. Assign the generated template
-   * to the smarty instance
+   * Reuse drupal blocks into a left sidebar.
    *
-   * @return void
+   * Assign the generated template to the smarty instance.
    */
   public static function sidebarLeft() {
     $config = CRM_Core_Config::singleton();
index 26a86343779c47ca8eb98f78d4ed06a6ae6b99f5..c1d39246ee5030ab5754d92c00b48bf88ceab4f4 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Core_OptionGroup {
   static $_values = array();
@@ -272,9 +270,6 @@ WHERE  v.option_group_id = g.id
    *
    *
    * @param bool $flip
-   *
-   * @return void
-   *
    */
   public static function lookupValues(&$params, &$names, $flip = FALSE) {
     foreach ($names as $postName => $value) {
index 90e3ec4e00699e20b15d18c047ab654da655322f..06c066cb7df05f7791453eb72f159ecb87c3929b 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Core_OptionValue {
 
@@ -347,8 +345,6 @@ class CRM_Core_OptionValue {
    * Build select query in case of option-values
    *
    * @param $query
-   *
-   * @return void
    */
   public static function select(&$query) {
     if (!empty($query->_params) || !empty($query->_returnProperties)) {
index a05784288c78b593b6a84f2132bf11692b546326..84907ee01ddcce7f52e56cb0a48eb2ada3d37407 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -161,12 +159,9 @@ class CRM_Core_Page {
   }
 
   /**
-   * This function takes care of all the things common to all
-   * pages. This typically involves assigning the appropriate smarty
-   * variable :)
+   * This function takes care of all the things common to all pages.
    *
-   * @return void|string
-   *   The content generated by running this page
+   * This typically involves assigning the appropriate smarty variables :)
    */
   public function run() {
     if ($this->_embedded) {
@@ -248,9 +243,6 @@ class CRM_Core_Page {
    * @param string|array $name name of the variable or an assoc array of name/value pairs
    * @param mixed $value
    *   Value of the variable if string.
-   *
-   *
-   * @return void
    */
   public function set($name, $value = NULL) {
     self::$_session->set($name, $value, $this->_name);
@@ -272,9 +264,7 @@ class CRM_Core_Page {
    *
    * @param string $var
    * @param mixed $value
-   *   Value of varaible.
-   *
-   * @return void
+   *   Value of variable.
    */
   public function assign($var, $value = NULL) {
     self::$_template->assign($var, $value);
@@ -285,9 +275,7 @@ class CRM_Core_Page {
    *
    * @param string $var
    * @param mixed $value
-   *   (reference) value of varaible.
-   *
-   * @return void
+   *   (reference) value of variable.
    */
   public function assign_by_ref($var, &$value) {
     self::$_template->assign_by_ref($var, $value);
@@ -318,9 +306,6 @@ class CRM_Core_Page {
 
   /**
    * Destroy all the session state of this page.
-   *
-   *
-   * @return void
    */
   public function reset() {
     self::$_session->resetScope($this->_name);
@@ -365,8 +350,6 @@ class CRM_Core_Page {
    * Setter for embedded.
    *
    * @param bool $embedded
-   *
-   * @return void
    */
   public function setEmbedded($embedded) {
     $this->_embedded = $embedded;
@@ -386,8 +369,6 @@ class CRM_Core_Page {
    * Setter for print.
    *
    * @param bool $print
-   *
-   * @return void
    */
   public function setPrint($print) {
     $this->_print = $print;
index 03f20b5728073b7f41c7bb74b7f1a8cd209bcea0..2560d5fee5ca193b43c5949b706a4cd114b69fe6 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 abstract class CRM_Core_Page_Basic extends CRM_Core_Page {
 
@@ -112,8 +110,6 @@ abstract class CRM_Core_Page_Basic extends CRM_Core_Page {
    *
    * @param CRM_Core_Controller $controller
    *   The controller object.
-   *
-   * @return void
    */
   public function addValues($controller) {
   }
@@ -134,12 +130,10 @@ abstract class CRM_Core_Page_Basic extends CRM_Core_Page {
 
   /**
    * Run the basic page (run essentially starts execution for that page).
-   *
-   * @return void
    */
   public function run() {
     // CRM-9034
-    // dont see args or pageArgs being used, so we should
+    // do not see args or pageArgs being used, so we should
     // consider eliminating them in a future version
     $n = func_num_args();
     $args = ($n > 0) ? func_get_arg(0) : NULL;
@@ -190,8 +184,6 @@ abstract class CRM_Core_Page_Basic extends CRM_Core_Page {
 
   /**
    * Browse all entities.
-   *
-   * @return void
    */
   public function browse() {
     $n = func_num_args();
@@ -288,8 +280,6 @@ abstract class CRM_Core_Page_Basic extends CRM_Core_Page {
    *   The permission assigned to this object.
    *
    * @param bool $forceAction
-   *
-   * @return void
    */
   public function action(&$object, $action, &$values, &$links, $permission, $forceAction = FALSE) {
     $values['class'] = '';
@@ -370,8 +360,6 @@ abstract class CRM_Core_Page_Basic extends CRM_Core_Page {
    *
    * @param bool $imageUpload
    * @param bool $pushUserContext
-   *
-   * @return void
    */
   public function edit($mode, $id = NULL, $imageUpload = FALSE, $pushUserContext = TRUE) {
     $controller = new CRM_Core_Controller_Simple($this->editForm(),
index 28bec8043982b6e50e8bea6fcba9458f13a20cc4..d4254459b6374fce6c9e1e25472a95f43d018e08 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Core_Page_RecurringEntityPreview extends CRM_Core_Page {
 
   /**
    * Run the basic page (run essentially starts execution for that page).
-   *
-   * @return void
    */
   public function run() {
     $parentEventId = $startDate = $endDate = NULL;
index 534d81bc9bb926c06ae0d434403ae8f864a5b8aa..431c0bbc688012d8d775f4bab87412b89d91545f 100644 (file)
@@ -82,6 +82,25 @@ abstract class CRM_Core_Payment {
 
   protected $_paymentProcessor;
 
+  /**
+   * Base url of the calling form.
+   *
+   * This is used for processors that need to return the browser back to the CiviCRM site.
+   *
+   * @var string
+   */
+  protected $baseReturnUrl;
+
+  /**
+   * Set Base return URL.
+   *
+   * @param string $url
+   *   Url of site to return browser to.
+   */
+  public function setBaseReturnUrl($url) {
+    $this->baseReturnUrl = $url;
+  }
+
   /**
    * Opportunity for the payment processor to override the entire form build.
    *
@@ -536,12 +555,152 @@ abstract class CRM_Core_Payment {
     );
   }
 
+  /**
+   * Get billing fields required for this processor.
+   *
+   * We apply the existing default of returning fields only for payment processor type 1. Processors can override to
+   * alter.
+   *
+   * @param int $billingLocationID
+   *
+   * @return array
+   */
+  public function getBillingAddressFields($billingLocationID) {
+    if ($this->_paymentProcessor['billing_mode'] != 1 && $this->_paymentProcessor['billing_mode'] != 3) {
+      return array();
+    }
+    return array(
+      'first_name' => 'billing_first_name',
+      'middle_name' => 'billing_middle_name',
+      'last_name' => 'billing_last_name',
+      'street_address' => "billing_street_address-{$billingLocationID}",
+      'city' => "billing_city-{$billingLocationID}",
+      'country' => "billing_country_id-{$billingLocationID}",
+      'state_province' => "billing_state_province_id-{$billingLocationID}",
+      'postal_code' => "billing_postal_code-{$billingLocationID}",
+    );
+  }
+
+  /**
+   * Get form metadata for billing address fields.
+   *
+   * @param int $billingLocationID
+   *
+   * @return array
+   *    Array of metadata for address fields.
+   */
+  public function getBillingAddressFieldsMetadata($billingLocationID) {
+    $metadata = array();
+    $metadata['billing_first_name'] = array(
+      'htmlType' => 'text',
+      'name' => 'billing_first_name',
+      'title' => ts('Billing First Name'),
+      'cc_field' => TRUE,
+      'attributes' => array(
+        'size' => 30,
+        'maxlength' => 60,
+        'autocomplete' => 'off',
+      ),
+      'is_required' => TRUE,
+    );
+
+    $metadata['billing_middle_name'] = array(
+      'htmlType' => 'text',
+      'name' => 'billing_middle_name',
+      'title' => ts('Billing Middle Name'),
+      'cc_field' => TRUE,
+      'attributes' => array(
+        'size' => 30,
+        'maxlength' => 60,
+        'autocomplete' => 'off',
+      ),
+      'is_required' => FALSE,
+    );
+
+    $metadata['billing_last_name'] = array(
+      'htmlType' => 'text',
+      'name' => 'billing_last_name',
+      'title' => ts('Billing Last Name'),
+      'cc_field' => TRUE,
+      'attributes' => array(
+        'size' => 30,
+        'maxlength' => 60,
+        'autocomplete' => 'off',
+      ),
+      'is_required' => TRUE,
+    );
+
+    $metadata["billing_street_address-{$billingLocationID}"] = array(
+      'htmlType' => 'text',
+      'name' => "billing_street_address-{$billingLocationID}",
+      'title' => ts('Street Address'),
+      'cc_field' => TRUE,
+      'attributes' => array(
+        'size' => 30,
+        'maxlength' => 60,
+        'autocomplete' => 'off',
+      ),
+      'is_required' => TRUE,
+    );
+
+    $metadata["billing_city-{$billingLocationID}"] = array(
+      'htmlType' => 'text',
+      'name' => "billing_city-{$billingLocationID}",
+      'title' => ts('City'),
+      'cc_field' => TRUE,
+      'attributes' => array(
+        'size' => 30,
+        'maxlength' => 60,
+        'autocomplete' => 'off',
+      ),
+      'is_required' => TRUE,
+    );
+
+    $metadata["billing_state_province_id-{$billingLocationID}"] = array(
+      'htmlType' => 'chainSelect',
+      'title' => ts('State/Province'),
+      'name' => "billing_state_province_id-{$billingLocationID}",
+      'cc_field' => TRUE,
+      'is_required' => TRUE,
+    );
+
+    $metadata["billing_postal_code-{$billingLocationID}"] = array(
+      'htmlType' => 'text',
+      'name' => "billing_postal_code-{$billingLocationID}",
+      'title' => ts('Postal Code'),
+      'cc_field' => TRUE,
+      'attributes' => array(
+        'size' => 30,
+        'maxlength' => 60,
+        'autocomplete' => 'off',
+      ),
+      'is_required' => TRUE,
+    );
+
+    $metadata["billing_country_id-{$billingLocationID}"] = array(
+      'htmlType' => 'select',
+      'name' => "billing_country_id-{$billingLocationID}",
+      'title' => ts('Country'),
+      'cc_field' => TRUE,
+      'attributes' => array(
+        '' => ts('- select -'),
+      ) + CRM_Core_PseudoConstant::country(),
+      'is_required' => TRUE,
+    );
+    return $metadata;
+  }
+
   /**
    * Get base url dependent on component.
    *
-   * @return string|void
+   * (or preferably set it using the setter function).
+   *
+   * @return string
    */
   protected function getBaseReturnUrl() {
+    if ($this->baseReturnUrl) {
+      return $this->baseReturnUrl;
+    }
     if ($this->_component == 'event') {
       $baseURL = 'civicrm/event/register';
     }
@@ -705,12 +864,7 @@ abstract class CRM_Core_Payment {
       }
     }
     else {
-      if ($this->_paymentProcessor['billing_mode'] == 1) {
-        $result = $this->doDirectPayment($params, $component);
-      }
-      else {
-        $result = $this->doExpressCheckout($params);
-      }
+      $result = $this->doDirectPayment($params, $component);
       if (is_array($result) && !isset($result['payment_status_id'])) {
         if (!empty($params['is_recur'])) {
           // See comment block.
@@ -727,6 +881,24 @@ abstract class CRM_Core_Payment {
     return $result;
   }
 
+  /**
+   * Query payment processor for details about a transaction.
+   *
+   * @param array $params
+   *   Array of parameters containing one of:
+   *   - trxn_id Id of an individual transaction.
+   *   - processor_id Id of a recurring contribution series as stored in the civicrm_contribution_recur table.
+   *
+   * @return array
+   *   Extra parameters retrieved.
+   *   Any parameters retrievable through this should be documented in the function comments at
+   *   CRM_Core_Payment::doQuery. Currently:
+   *   - fee_amount Amount of fee paid
+   */
+  public function doQuery($params) {
+    return array();
+  }
+
   /**
    * This function checks to see if we have the right config values.
    *
index f4e54d6c45f47ce50c3915260ca92f1ce1279547..7a40da5f7921eec81e921b864fb669ff1f245202 100644 (file)
@@ -80,7 +80,9 @@ class CRM_Core_Payment_Dummy extends CRM_Core_Payment {
     // the back-end's canonical set of parameters.  But if a processor
     // does this, it needs to invoke this hook after it has done translation,
     // but before it actually starts talking to its proprietary back-end.
-
+    if (!empty($params['is_recur'])) {
+      $throwAnENoticeIfNotSetAsTheseAreRequired = $params['frequency_interval'] . $params['frequency_unit'];
+    }
     // no translation in Dummy processor
     $cookedParams = $params;
     CRM_Utils_Hook::alterPaymentProcessorParams($this,
index 8591b54c908829922a33315921a8bd6a4118177a..f22423092bf0564f81979a2369518ef3345aac47 100644 (file)
@@ -26,6 +26,7 @@
  */
 
 /**
+ * Class for constructing the payment processor block.
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
@@ -54,40 +55,64 @@ class CRM_Core_Payment_Form {
    */
   static public function setPaymentFieldsByProcessor(&$form, $processor, $forceBillingFieldsForPayLater = FALSE, $isBackOffice = FALSE) {
     $form->billingFieldSets = array();
-    if ($processor != NULL) {
-      // ie it is pay later
-      $paymentFields = self::getPaymentFields($processor);
-      $paymentTypeName = self::getPaymentTypeName($processor);
-      $paymentTypeLabel = self::getPaymentTypeLabel($processor);
-      //@todo if we switch to iterating through $form->billingFieldSets we won't need to assign these directly
-      $form->assign('paymentTypeName', $paymentTypeName);
-      $form->assign('paymentTypeLabel', $paymentTypeLabel);
-
-      $form->billingFieldSets[$paymentTypeName]['fields'] = $form->_paymentFields = array_intersect_key(self::getPaymentFieldMetadata($processor), array_flip($paymentFields));
-      $form->assign('paymentFields', $paymentFields);
-    }
-
-    // @todo - replace this section with one similar to above per discussion - probably use a manual processor shell class to stand in for that capability
-    //return without adding billing fields if billing_mode = 4 (@todo - more the ability to set that to the payment processor)
-    // or payment processor is NULL (pay later)
-    if (($processor == NULL && !$forceBillingFieldsForPayLater) || CRM_Utils_Array::value('billing_mode', $processor) == 4) {
+    if (empty($processor)) {
+      self::hackyHandlePayLaterInPaymentProcessorFunction($form, $forceBillingFieldsForPayLater);
       return;
     }
-    //@todo setPaymentFields defines the billing fields - this should be moved to the processor class & renamed getBillingFields
-    // potentially pay later would also be a payment processor
-    //also set the billingFieldSet to hold all the details required to render the fieldset so we can iterate through the fieldset - making
-    // it easier to re-order in hooks etc. The billingFieldSets param is used to determine whether to show the billing pane
-    CRM_Core_Payment_Form::setBillingDetailsFields($form);
+
+    $paymentTypeName = self::getPaymentTypeName($processor);
+    $paymentTypeLabel = self::getPaymentTypeLabel($processor);
+    $form->assign('paymentTypeName', $paymentTypeName);
+    $form->assign('paymentTypeLabel', $paymentTypeLabel);
+    $form->_paymentFields = $form->billingFieldSets[$paymentTypeName]['fields'] = self::getPaymentFieldMetadata($processor);
+    $form->_paymentFields = array_merge($form->_paymentFields, self::getBillingAddressMetadata($processor, $form->_bltID));
+    $form->assign('paymentFields', self::getPaymentFields($processor));
+    self::setBillingAddressFields($form, $processor);
+    // @todo - this may be obsolete - although potentially it could be used to re-order things in the form.
     $form->billingFieldSets['billing_name_address-group']['fields'] = array();
   }
 
   /**
    * Add general billing fields.
-   * @todo set these like processor fields & let payment processors alter them
    *
    * @param CRM_Core_Form $form
+   * @param CRM_Core_Payment $processor
+   */
+  static protected function setBillingAddressFields(&$form, $processor) {
+    $billingID = $form->_bltID;
+    $smarty = CRM_Core_Smarty::singleton();
+    $smarty->assign('billingDetailsFields', self::getBillingAddressFields($processor, $billingID));
+  }
+
+  /**
+   * Add pay later billing fields
+   *
+   * @deprecated
+   *
+   * This is here to preserve the old flow for pay-later requiring billing as I am unsure how to replicate it or what to
+   * expect from it/ whether it even works.
+   *
+   * Including the pay-later flow in this form is pretty hacky unless we adopt the proposed process of adding
+   * an offline / pay later processor (CRM_Core_Payment_Offline). In which case it would either be implemented
+   * (preferably) like other processors or (possibly) as a pseudo-processor with the Civi\Payment\System->getById
+   * turning that class if $id === 0 or getByProcessor returning it when $processor === array(); If we go down the path
+   * we probably also want to add the default pay-later text into the signature field of the pay later processor and
+   * implement a function similar to the dummy class where the payment processor outcome class can be set.
+   *
+   * Then doPayment could be called regardless of whether the flow is paylater or not - it wouldn't do much although
+   * people might leverage it's hook - but it would simplify the main postProcess flow as it would look like
+   *
+   * if ($paymentStatus === Completed) {
+   *   $processor->setPaymentResult = array('payment_status_id', 1);
+   * }
+   * $processor->doDirectPayment();
+   * etc
    *
-   * @return void
+   * And the postProcess code would not need to distinguish between pay later/ offline & online payments.
+   *
+   * Alternatively enforcing certain fields for pay later in some cases would be a candidate for an extension.
+   *
+   * @param CRM_Core_Form $form
    */
   static protected function setBillingDetailsFields(&$form) {
     $bltID = $form->_bltID;
@@ -180,11 +205,31 @@ class CRM_Core_Payment_Form {
   }
 
   /**
+   * Add the payment fields to the template.
+   *
+   * Generally this is the payment processor fields & the billing fields required
+   * for the payment processor. However, this has been complicated by adding
+   * pay later billing fields into this mix
+   *
+   * We now have the situation where the required fields cannot be set as required
+   * on the form level if they are required for the payment processor, as another
+   * processor might be selected and the validation will then be incorrect.
+   *
+   * However, if they are required for pay later we DO set them on the form level,
+   * presumably assuming they will be required whatever happens.
+   *
+   * As a side-note this seems to re-enforce the argument for making pay later
+   * operate as a payment processor rather than as a 'special thing on its own'.
+   *
    * @param CRM_Core_Form $form
+   *   Form that the payment fields are to be added to.
    * @param bool $useRequired
+   *   Effectively this means are the fields required for pay-later - see above.
    * @param array $paymentFields
+   *   Fields that are to be shown on the payment form.
    */
   protected static function addCommonFields(&$form, $useRequired, $paymentFields) {
+    $requiredPaymentFields = array();
     foreach ($paymentFields as $name => $field) {
       if (!empty($field['cc_field'])) {
         if ($field['htmlType'] == 'chainSelect') {
@@ -199,13 +244,22 @@ class CRM_Core_Payment_Form {
           );
         }
       }
+      // CRM-17071 We seem to be tying ourselves in knots around the addition
+      // of requiring billing fields for pay-later. Here we 'tell' the form the
+      // field is required if it is not otherwise marked as required and is
+      // required for the billing block.
+      $requiredPaymentFields[$field['name']] = !$useRequired ? $field['is_required'] : FALSE;
     }
+    $form->assign('requiredPaymentFields', $requiredPaymentFields);
   }
 
   /**
+   * Get the payment fields that apply to this processor.
+   *
    * @param array $paymentProcessor
-   * @todo it will be necessary to set details that affect it - mostly likely take Country as a param. Should we add generic
-   * setParams on processor class or just setCountry which we know we need?
+   *
+   * @todo sometimes things like the country alter the required fields (e.g direct debit fields). We should possibly
+   * set these before calling getPaymentFormFields (as we identify them).
    *
    * @return array
    */
@@ -221,7 +275,37 @@ class CRM_Core_Payment_Form {
    */
   public static function getPaymentFieldMetadata($paymentProcessor) {
     $paymentProcessorObject = Civi\Payment\System::singleton()->getByProcessor($paymentProcessor);
-    return $paymentProcessorObject->getPaymentFormFieldsMetadata();
+    return array_intersect_key($paymentProcessorObject->getPaymentFormFieldsMetadata(), array_flip(self::getPaymentFields($paymentProcessor)));
+  }
+
+  /**
+   * Get the billing fields that apply to this processor.
+   *
+   * @param array $paymentProcessor
+   * @param int $billingLocationID
+   *   ID of billing location type.
+   *
+   * @todo sometimes things like the country alter the required fields (e.g postal code). We should possibly
+   * set these before calling getPaymentFormFields (as we identify them).
+   *
+   * @return array
+   */
+  public static function getBillingAddressFields($paymentProcessor, $billingLocationID) {
+    $paymentProcessorObject = Civi\Payment\System::singleton()->getByProcessor($paymentProcessor);
+    return $paymentProcessorObject->getBillingAddressFields($billingLocationID);
+  }
+
+  /**
+   * @param array $paymentProcessor
+   *
+   * @param int $billingLocationID
+   *
+   * @return array
+   * @throws \CRM_Core_Exception
+   */
+  public static function getBillingAddressMetadata($paymentProcessor, $billingLocationID) {
+    $paymentProcessorObject = Civi\Payment\System::singleton()->getByProcessor($paymentProcessor);
+    return $paymentProcessorObject->getBillingAddressFieldsMetadata($billingLocationID);
   }
 
   /**
@@ -445,4 +529,22 @@ class CRM_Core_Payment_Form {
     return CRM_Utils_Array::value('Y', $src['credit_card_exp_date']);
   }
 
+  /**
+   * Set billing fields for pay later.
+   *
+   * This is considered hacky because pay later has basically been cludged onto the payment processor form.
+   *
+   * See notes on the deprecated function as to how this could be restructured. Alternatively this pay later
+   * handling could be moved out of the payment processor form all together.
+   *
+   * @param CRM_Core_Form $form
+   * @param int $forceBillingFieldsForPayLater
+   */
+  protected static function hackyHandlePayLaterInPaymentProcessorFunction(&$form, $forceBillingFieldsForPayLater) {
+    if ($forceBillingFieldsForPayLater) {
+      CRM_Core_Payment_Form::setBillingDetailsFields($form);
+      $form->billingFieldSets['billing_name_address-group']['fields'] = array();
+    }
+  }
+
 }
index 7ce10fd6ac679fcbad3b551ef526196443e6fb04..b1837d5c0513dce8e7b7628e14c5fb9506e8569f 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 require_once 'Google/library/googlecart.php';
@@ -39,7 +37,9 @@ require_once 'Google/library/googlesubscription.php';
 require_once 'Google/library/googlerequest.php';
 
 /**
- * Class CRM_Core_Payment_Google
+ * Class CRM_Core_Payment_Google.
+ *
+ * Possibly not functional.
  */
 class CRM_Core_Payment_Google extends CRM_Core_Payment {
 
@@ -101,30 +101,13 @@ class CRM_Core_Payment_Google extends CRM_Core_Payment {
     }
   }
 
-  /**
-   * This function collects all the information from a web/api form and invokes
-   * the relevant payment processor specific functions to perform the transaction
-   *
-   * @param array $params
-   *   Assoc array of input parameters for this transaction.
-   *
-   * @return void
-   *   the result in an nice formatted array (or an error object)
-   * @abstract
-   */
-  public function doDirectPayment(&$params) {
-    CRM_Core_Error::fatal(ts('This function is not implemented'));
-  }
-
   /**
    * Sets appropriate parameters for checking out to google.
    *
    * @param array $params
-   *   Name value pair of contribution datat.
-   *
-   * @param $component
+   *   Name value pair of contribution data.
    *
-   * @return void
+   * @param string $component
    */
   public function doTransferCheckout(&$params, $component) {
     $component = strtolower($component);
@@ -197,9 +180,7 @@ class CRM_Core_Payment_Google extends CRM_Core_Payment {
    * @param string $component
    *   Event/contribution.
    * @param object $cart
-   *   Object of googel cart.
-   *
-   * @return void
+   *   Object of google cart.
    */
   public function submitPostParams($params, $component, $cart) {
     $url = rtrim($this->_paymentProcessor['url_site'], '/') . '/cws/v2/Merchant/' . $this->_paymentProcessor['user_name'] . '/checkout';
index dffaba07eab57302351f81ea70802ff28e845e44..ec61179aee51078c39c1a76cb52c1551473a5399 100644 (file)
  * limitations under the License.
  */
 
-/* This is the response handler code that will be invoked every time
-  * a notification or request is sent by the Google Server
 *
-  * To allow this code to receive responses, the url for this file
-  * must be set on the seller page under Settings->Integration as the
-  * "API Callback URL'
 * Order processing commands can be sent automatically by placing these
-  * commands appropriately
-  *
-  * To use this code for merchant-calculated feedback, this url must be
-  * set also as the merchant-calculations-url when the cart is posted
-  * Depending on your calculations for shipping, taxes, coupons and gift
 * certificates update parts of the code as required
-  *
-  */
-
+/**
+ * Response handler code.
+ *
+ * This will be invoked every time a notification or request is sent by the Google Server.
+ *
+ * To allow this code to receive responses, the url for this file
* must be set on the seller page under Settings->Integration as the
+ * "API Callback URL'
+ * Order processing commands can be sent automatically by placing these
+ * commands appropriately
+ *
+ * To use this code for merchant-calculated feedback, this url must be
* set also as the merchant-calculations-url when the cart is posted
+ * Depending on your calculations for shipping, taxes, coupons and gift
+ * certificates update parts of the code as required.
+ */
 
 define('GOOGLE_DEBUG_PP', 0);
 
 /**
- * Class CRM_Core_Payment_GoogleIPN
+ * Class CRM_Core_Payment_GoogleIPN.
  */
 class CRM_Core_Payment_GoogleIPN extends CRM_Core_Payment_BaseIPN {
 
@@ -107,9 +107,9 @@ class CRM_Core_Payment_GoogleIPN extends CRM_Core_Payment_BaseIPN {
    * @param array $privateData
    *   Contains the name value pair of <merchant-private-data>.
    *
-   * @param $component
+   * @param string $component
    *
-   * @return void
+   * @return bool
    */
   public function newOrderNotify($dataRoot, $privateData, $component) {
     $ids = $input = $params = array();
@@ -149,7 +149,7 @@ class CRM_Core_Payment_GoogleIPN extends CRM_Core_Payment_BaseIPN {
     if ($ids['contributionRecur']) {
       if ($objects['contributionRecur']->invoice_id == $dataRoot['serial-number']) {
         CRM_Core_Error::debug_log_message("The new order notification already handled: {$dataRoot['serial-number']}.");
-        return;
+        return FALSE;
       }
       else {
         $transaction = new CRM_Core_Transaction();
@@ -196,8 +196,8 @@ class CRM_Core_Payment_GoogleIPN extends CRM_Core_Payment_BaseIPN {
     $contribution = &$objects['contribution'];
 
     if ($contribution->invoice_id != $input['invoice']) {
-      CRM_Core_Error::debug_log_message("Invoice values dont match between database and IPN request");
-      return;
+      CRM_Core_Error::debug_log_message("Invoice values don't match between database and IPN request");
+      return FALSE;
     }
 
     // lets replace invoice-id with google-order-number because thats what is common and unique
@@ -208,7 +208,7 @@ class CRM_Core_Payment_GoogleIPN extends CRM_Core_Payment_BaseIPN {
 
     if ($contribution->total_amount != $input['amount']) {
       CRM_Core_Error::debug_log_message("Amount values dont match between database and IPN request");
-      return;
+      return FALSE;
     }
 
     if (!$this->getInput($input, $ids, $dataRoot)) {
@@ -220,7 +220,7 @@ class CRM_Core_Payment_GoogleIPN extends CRM_Core_Payment_BaseIPN {
     // check if contribution is already completed, if so we ignore this ipn
     if ($contribution->contribution_status_id == 1) {
       CRM_Core_Error::debug_log_message("returning since contribution has already been handled");
-      return;
+      return FALSE;
     }
     else {
       /* Since trxn_id hasn't got any use here,
@@ -250,9 +250,9 @@ class CRM_Core_Payment_GoogleIPN extends CRM_Core_Payment_BaseIPN {
    * @param array $privateData
    *   Contains the name value pair of <merchant-private-data>.
    *
-   * @param $component
+   * @param string $component
    *
-   * @return void
+   * @return bool
    */
   public function orderStateChange($status, $dataRoot, $privateData, $component) {
     $input = $objects = $ids = array();
@@ -267,14 +267,14 @@ class CRM_Core_Payment_GoogleIPN extends CRM_Core_Payment_BaseIPN {
 
     if (!$contribution->find(TRUE)) {
       CRM_Core_Error::debug_log_message("orderStateChange: Could not find contribution record with invoice id: $serial");
-      return;
+      return FALSE;
     }
 
     // Google sends the charged notification twice.
     // So to make sure, code is not executed again.
     if ($contribution->contribution_status_id == 1) {
       CRM_Core_Error::debug_log_message("Contribution already handled (ContributionID = {$contribution->id}).");
-      return;
+      return FALSE;
     }
 
     // make sure invoice is set to serial no for recurring payments, to avoid violating uniqueness
index b6b8a7f87d92309141ab2c4d36a1c493a8565256..e513bace19376ec2ec0350cca74a26455d4de2a2 100644 (file)
@@ -25,6 +25,8 @@
  +--------------------------------------------------------------------+
  */
 
+use Civi\Payment\Exception\PaymentProcessorException;
+
 /**
  *
  * @package CRM
@@ -88,7 +90,7 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment {
    * @return bool
    */
   protected function supportsPreApproval() {
-    if ($this->_processorName == ts('PayPal Express')) {
+    if ($this->_processorName == ts('PayPal Express') || $this->_processorName == ts('PayPal Pro')) {
       return TRUE;
     }
     return FALSE;
@@ -226,7 +228,7 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment {
    * @return array
    */
   public function getPreApprovalDetails($storedDetails) {
-    return $this->getExpressCheckoutDetails($storedDetails['token']);
+    return empty($storedDetails['token']) ? array() : $this->getExpressCheckoutDetails($storedDetails['token']);
   }
 
   /**
@@ -281,7 +283,7 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment {
    *   the result in an nice formatted array (or an error object)
    */
   public function doExpressCheckout(&$params) {
-
+    $statuses = CRM_Contribute_BAO_Contribution::buildOptions('contribution_status_id');
     if (!empty($params['is_recur'])) {
       return $this->createRecurringPayments($params);
     }
@@ -304,7 +306,7 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment {
     $result = $this->invokeAPI($args);
 
     if (is_a($result, 'CRM_Core_Error')) {
-      return $result;
+      throw new PaymentProcessorException(CRM_Core_Error::getMessages($result));
     }
 
     /* Success */
@@ -318,7 +320,13 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment {
     }
     $params['payment_status'] = $result['paymentstatus'];
     $params['pending_reason'] = $result['pendingreason'];
-
+    if (!empty($params['is_recur'])) {
+      // See comment block.
+      $result['payment_status_id'] = array_search('Pending', $statuses);
+    }
+    else {
+      $result['payment_status_id'] = array_search('Completed', $statuses);
+    }
     return $params;
   }
 
@@ -395,6 +403,41 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment {
     $args['method'] = $method;
   }
 
+  /**
+   * Process payment - this function wraps around both doTransferPayment and doDirectPayment.
+   *
+   * The function ensures an exception is thrown & moves some of this logic out of the form layer and makes the forms
+   * more agnostic.
+   *
+   * Payment processors should set payment_status_id. This function adds some historical defaults ie. the
+   * assumption that if a 'doDirectPayment' processors comes back it completed the transaction & in fact
+   * doTransferCheckout would not traditionally come back.
+   *
+   * doDirectPayment does not do an immediate payment for Authorize.net or Paypal so the default is assumed
+   * to be Pending.
+   *
+   * Once this function is fully rolled out then it will be preferred for processors to throw exceptions than to
+   * return Error objects
+   *
+   * @param array $params
+   *
+   * @param string $component
+   *
+   * @return array
+   *   Result array
+   *
+   * @throws \Civi\Payment\Exception\PaymentProcessorException
+   */
+  public function doPayment(&$params, $component = 'contribute') {
+    if ($this->_paymentProcessor['payment_processor_type'] != 'PayPal_Express'
+    && (!empty($params['credit_card_number']) && empty($params['token']))
+    ) {
+      return parent::doPayment($params, $component);
+    }
+    $this->_component = $component;
+    return $this->doExpressCheckout($params);
+  }
+
   /**
    * This function collects all the information from a web/api form and invokes
    * the relevant payment processor specific functions to perform the transaction
@@ -477,9 +520,42 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment {
 
     $params['trxn_id'] = CRM_Utils_Array::value('transactionid', $result);
     $params['gross_amount'] = CRM_Utils_Array::value('amt', $result);
+    $params = array_merge($params, $this->doQuery($params));
     return $params;
   }
 
+  /**
+   * Query payment processor for details about a transaction.
+   *
+   * For paypal see : https://developer.paypal.com/webapps/developer/docs/classic/api/merchant/GetTransactionDetails_API_Operation_NVP/
+   *
+   * @param array $params
+   *   Array of parameters containing one of:
+   *   - trxn_id Id of an individual transaction.
+   *   - processor_id Id of a recurring contribution series as stored in the civicrm_contribution_recur table.
+   *
+   * @return array
+   *   Extra parameters retrieved.
+   *   Any parameters retrievable through this should be documented in the function comments at
+   *   CRM_Core_Payment::doQuery. Currently
+   *   - fee_amount Amount of fee paid
+   *
+   * @throws \Civi\Payment\Exception\PaymentProcessorException
+   */
+  public function doQuery($params) {
+    if (empty($params['trxn_id'])) {
+      throw new \Civi\Payment\Exception\PaymentProcessorException('transaction id not set');
+    }
+    $args = array(
+      'TRANSACTIONID' => $params['trxn_id'],
+    );
+    $this->initialize($args, 'GetTransactionDetails');
+    $result = $this->invokeAPI($args);
+    return array(
+      'fee_amount' => $result['feeamt'],
+    );
+  }
+
   /**
    * This function checks to see if we have the right config values.
    *
@@ -669,6 +745,9 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment {
    *   - redirect_url (if set the browser will be redirected to this.
    */
   public function doPreApproval(&$params) {
+    if (!isset($params['button']) || !stristr($params['button'], 'express')) {
+      return array();
+    }
     $this->_component = $params['component'];
     $token = $this->setExpressCheckOut($params);
     return array(
index fd6a7f64b6d8a54ef291e854ac1f66d515dfef7a..efde8f24dbeaab13b5594590e55e865b817c5273 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Core_Payment_PayPalProIPN extends CRM_Core_Payment_BaseIPN {
 
@@ -163,7 +161,7 @@ class CRM_Core_Payment_PayPalProIPN extends CRM_Core_Payment_BaseIPN {
    * @param array $ids
    * @param array $objects
    * @param bool $first
-   * @return void|bool
+   * @return bool
    */
   public function recur(&$input, &$ids, &$objects, $first) {
     if (!isset($input['txnType'])) {
@@ -232,7 +230,7 @@ class CRM_Core_Payment_PayPalProIPN extends CRM_Core_Payment_BaseIPN {
           && !empty($recur->processor_id)
         ) {
           echo "already handled";
-          return;
+          return FALSE;
         }
         $recur->create_date = $now;
         $recur->contribution_status_id = 2;
@@ -254,7 +252,7 @@ class CRM_Core_Payment_PayPalProIPN extends CRM_Core_Payment_BaseIPN {
         if ($this->retrieve('profile_status', 'String') == 'Expired') {
           if (!empty($recur->end_date)) {
             echo "already handled";
-            return;
+            return FALSE;
           }
           $recur->contribution_status_id = 1;
           $recur->end_date = $now;
@@ -289,7 +287,7 @@ class CRM_Core_Payment_PayPalProIPN extends CRM_Core_Payment_BaseIPN {
     }
 
     if ($txnType != 'recurring_payment') {
-      return;
+      return TRUE;
     }
 
     if (!$first) {
@@ -391,14 +389,14 @@ class CRM_Core_Payment_PayPalProIPN extends CRM_Core_Payment_BaseIPN {
    * (with the input parameters) & call this & all will be done
    *
    * @todo the references to POST throughout this class need to be removed
-   * @return void|bool
+   * @return bool
    */
   public function main() {
     CRM_Core_Error::debug_var('GET', $_GET, TRUE, TRUE);
     CRM_Core_Error::debug_var('POST', $_POST, TRUE, TRUE);
     if ($this->_isPaymentExpress) {
       $this->handlePaymentExpress();
-      return NULL;
+      return FALSE;
     }
     $objects = $ids = $input = array();
     $this->_component = $input['component'] = self::getValue('m');
index af5603d443433b6a6c31f1982270bdf09db7c54c..ee5a2bddc41ea2d62b855fe20c37afd65ff6d6c9 100644 (file)
@@ -10,7 +10,7 @@
   */
 
 /**
- * Class CRM_Core_Payment_PayflowPro
+ * Class CRM_Core_Payment_PayflowPro.
  */
 class CRM_Core_Payment_PayflowPro extends CRM_Core_Payment {
   // (not used, implicit in the API, might need to convert?)
@@ -25,16 +25,11 @@ class CRM_Core_Payment_PayflowPro extends CRM_Core_Payment {
    */
   static private $_singleton = NULL;
 
-  /*
+  /**
    * Constructor
    *
    * @param string $mode
    *   The mode of operation: live or test.
-   *
-   * @return void
-   */
-  /**
-   * @param $mode
    * @param $paymentProcessor
    */
   public function __construct($mode, &$paymentProcessor) {
index 19bd88857ff8d6ff8ff06346fa3d381643e5faba..f26ddfd571ba88a0dbc8133fb67af995dab7a07e 100644 (file)
@@ -113,8 +113,6 @@ class CRM_Core_Payment_PaymentExpress extends CRM_Core_Payment {
    *   Name value pair of contribution data.
    *
    * @param $component
-   *
-   * @return void
    */
   public function doTransferCheckout(&$params, $component) {
     $component = strtolower($component);
index cb8f2748953006c5f6ec7b1083b3e91d25e74f48..7525758d9f7c3213ea7e1dea46e045d1bc2ac123 100644 (file)
@@ -108,8 +108,7 @@ class CRM_Core_Payment_PaymentExpressIPN extends CRM_Core_Payment_BaseIPN {
    * @param $amount
    * @param $transactionReference
    *
-   * @internal param \xml $dataRoot response send by google in xml format
-   * @return void
+   * @return bool
    */
   public function newOrderNotify($success, $privateData, $component, $amount, $transactionReference) {
     $ids = $input = $params = array();
index 7b879023ec2592aef91dbf6ad9c65ae90ad2ca6c..8f77bae6c127f067d5cbf8e121e43a3c0eb51d92 100644 (file)
@@ -104,7 +104,9 @@ class CRM_Core_Payment_ProcessorForm {
   }
 
   /**
-   * @param $form
+   * Build the payment processor form.
+   *
+   * @param CRM_Core_Form $form
    */
   public static function buildQuickform(&$form) {
     //@todo document why this addHidden is here
index 37deeed72b3bada7bc87c8cf50bb949845e4a2b1..05f744c0ee4fe30ca84bda53aa533330722710d0 100644 (file)
@@ -771,6 +771,10 @@ class CRM_Core_Permission {
         $prefix . ts('merge duplicate contacts'),
         ts('Delete Contacts must also be granted in order for this to work.'),
       ),
+      'force merge duplicate contacts' => array(
+        $prefix . ts('force merge duplicate contacts'),
+        ts('Delete Contacts must also be granted in order for this to work.'),
+      ),
       'view debug output' => array(
         $prefix . ts('view debug output'),
         ts('View results of debug and backtrace'),
index e77ce3097a9b3186d285e9f8b0b897816744a7cc..a0b2ecc6260b53f65915dbe69601d91730edc9f3 100644 (file)
@@ -44,8 +44,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Core_PseudoConstant {
 
@@ -549,11 +547,11 @@ class CRM_Core_PseudoConstant {
    * @param string $condition
    *   The condition that gets passed to the final query as the WHERE clause.
    *
-   * @param null $orderby
+   * @param bool $orderby
    * @param string $key
-   * @param null $force
+   * @param bool $force
    *
-   * @return void
+   * @return array
    */
   public static function populate(
     &$var,
index 5c4eceada6c29ae3475a3ccb44505fd604200d1a..7a89506e80409e37a1c8f7d6e45b67d897a3177b 100644 (file)
@@ -31,8 +31,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 require_once 'HTML/QuickForm/Action.php';
 
@@ -61,8 +59,6 @@ class CRM_Core_QuickForm_Action extends HTML_QuickForm_Action {
 
   /**
    * Returns the user to the top of the user context stack.
-   *
-   * @return void
    */
   public function popUserContext() {
     $session = CRM_Core_Session::singleton();
index 74a14fc4f6cd44ef6a44001cb6adfa802ecdb335..9efddba2ab89c67f4732acb58b1c80798eba65d6 100644 (file)
@@ -30,8 +30,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Core_QuickForm_Action_Back extends CRM_Core_QuickForm_Action {
 
@@ -54,8 +52,6 @@ class CRM_Core_QuickForm_Action_Back extends CRM_Core_QuickForm_Action {
    *   The current form-page.
    * @param string $actionName
    *   Current action name, as one Action object can serve multiple actions.
-   *
-   * @return void
    */
   public function perform(&$page, $actionName) {
     $this->_stateMachine->perform($page, $actionName, 'Back');
index 1b3d27ffc115b1afeefe6b99d8d4cbeecabcacac..5b1729c5fa7c2dbde7a7ec0ae1a2d35b7cab26d2 100644 (file)
@@ -30,8 +30,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Core_QuickForm_Action_Cancel extends CRM_Core_QuickForm_Action {
 
@@ -54,8 +52,6 @@ class CRM_Core_QuickForm_Action_Cancel extends CRM_Core_QuickForm_Action {
    *   CRM_Core_Form the current form-page.
    * @param string $actionName
    *   Current action name, as one Action object can serve multiple actions.
-   *
-   * @return void
    */
   public function perform(&$page, $actionName) {
     // conditional actions if cancelAction is defined
index 4b77758527bbd0f09bb140c5fefe7c175c71b07b..3d1fb007827468c64c642da410b711e88733625d 100644 (file)
@@ -30,8 +30,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Core_QuickForm_Action_Display extends CRM_Core_QuickForm_Action {
 
@@ -67,7 +65,7 @@ class CRM_Core_QuickForm_Action_Display extends CRM_Core_QuickForm_Action {
    * @param string $actionName
    *   Current action name, as one Action object can serve multiple actions.
    *
-   * @return void
+   * @return object|void
    */
   public function perform(&$page, $actionName) {
     $pageName = $page->getAttribute('id');
@@ -106,9 +104,6 @@ class CRM_Core_QuickForm_Action_Display extends CRM_Core_QuickForm_Action {
    *
    * @param CRM_Core_Form $page
    *   The CRM_Core_Form page.
-   *
-   *
-   * @return void
    */
   public function renderForm(&$page) {
     $this->_setRenderTemplates($page);
@@ -191,8 +186,6 @@ class CRM_Core_QuickForm_Action_Display extends CRM_Core_QuickForm_Action {
    *
    * @param CRM_Core_Form $page
    *   The CRM_Core_Form page.
-   *
-   * @return void
    */
   public function _setRenderTemplates(&$page) {
     if (self::$_requiredTemplate === NULL) {
@@ -207,8 +200,6 @@ class CRM_Core_QuickForm_Action_Display extends CRM_Core_QuickForm_Action {
 
   /**
    * Initialize the various templates.
-   *
-   * @return void
    */
   public function initializeTemplates() {
     if (self::$_requiredTemplate !== NULL) {
index 4cba4bb3952fef11cc21adc893c8b95265ee50bc..f7ce6cc43afaf2ab64e1ebd88a0943abb892cbb4 100644 (file)
@@ -30,8 +30,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Core_QuickForm_Action_Done extends CRM_Core_QuickForm_Action {
 
@@ -58,7 +56,7 @@ class CRM_Core_QuickForm_Action_Done extends CRM_Core_QuickForm_Action {
    * @param string $actionName
    *   Current action name, as one Action object can serve multiple actions.
    *
-   * @return void
+   * @return object|void
    */
   public function perform(&$page, $actionName) {
     $page->isFormBuilt() or $page->buildForm();
index dbf15df2b45f431c4e08634e9d64d30efb5dc03c..413e69a2a32295010ded72412e42d077896236ca 100644 (file)
@@ -33,8 +33,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Core_QuickForm_Action_Reload extends CRM_Core_QuickForm_Action {
 
@@ -58,7 +56,7 @@ class CRM_Core_QuickForm_Action_Reload extends CRM_Core_QuickForm_Action {
    * @param string $actionName
    *   Current action name, as one Action object can serve multiple actions.
    *
-   * @return void
+   * @return object|void
    */
   public function perform(&$page, $actionName) {
     // save the form values and validation status to the session
index 3c1cf6dca6045d917389780d581c427a37003578..dfb0f219e7f91986025a2f425e8655bcea57e28c 100644 (file)
  +--------------------------------------------------------------------+
  */
 
-
-require_once "PEAR.php";
-
 /**
- * Class CRM_Core_Session
+ * Class CRM_Core_Session.
  */
 class CRM_Core_Session {
 
@@ -101,14 +98,12 @@ class CRM_Core_Session {
   }
 
   /**
-   * Creates an array in the session. All variables now will be stored
-   * under this array
+   * Creates an array in the session.
+   *
+   * All variables now will be stored under this array.
    *
    * @param bool $isRead
    *   Is this a read operation, in this case, the session will not be touched.
-   *
-   *
-   * @return void
    */
   public function initialize($isRead = FALSE) {
     // lets initialize the _session variable just before we need it
@@ -144,16 +139,12 @@ class CRM_Core_Session {
     ) {
       $this->_session[$this->_key] = array();
     }
-    return NULL;
   }
 
   /**
    * Resets the session store.
    *
-   *
    * @param int $all
-   *
-   * @return void
    */
   public function reset($all = 1) {
     if ($all != 1) {
@@ -167,7 +158,6 @@ class CRM_Core_Session {
       $this->_session = array();
     }
 
-    return NULL;
   }
 
   /**
@@ -177,9 +167,6 @@ class CRM_Core_Session {
    *   Local scope name.
    * @param bool $isRead
    *   Is this a read operation, in this case, the session will not be touched.
-   *
-   *
-   * @return void
    */
   public function createScope($prefix, $isRead = FALSE) {
     $this->initialize($isRead);
@@ -198,8 +185,6 @@ class CRM_Core_Session {
    *
    * @param string $prefix
    *   Local scope name.
-   *
-   * @return void
    */
   public function resetScope($prefix) {
     $this->initialize();
@@ -228,8 +213,6 @@ class CRM_Core_Session {
    *   Value of the variable.
    * @param string $prefix
    *   A string to prefix the keys in the session with.
-   *
-   * @return void
    */
   public function set($name, $value = NULL, $prefix = NULL) {
     // create session scope
@@ -288,16 +271,12 @@ class CRM_Core_Session {
   }
 
   /**
-   * Gets all the variables in the current session scope
-   * and stuffs them in an associate array
-   *
+   * Gets all the variables in the current session scope and stuffs them in an associate array.
    *
    * @param array $vars
    *   Associative array to store name/value pairs.
    * @param string $prefix
    *   Will be stripped from the key before putting it in the return.
-   *
-   * @return void
    */
   public function getVars(&$vars, $prefix = '') {
     // create session scope
@@ -318,7 +297,10 @@ class CRM_Core_Session {
   }
 
   /**
-   * Set and check a timer. If it's expired, it will be set again.
+   * Set and check a timer.
+   *
+   * If it's expired, it will be set again.
+   *
    * Good for showing a message to the user every hour or day (so not bugging them on every page)
    * Returns true-ish values if the timer is not set or expired, and false if the timer is still running
    * If you want to get more nuanced, you can check the type of the return to see if it's 'not set' or actually expired at a certain time
@@ -347,8 +329,6 @@ class CRM_Core_Session {
    *   The url to return to when done.
    * @param bool $check
    *   Should we do a dupe checking with the top element.
-   *
-   * @return void
    */
   public function pushUserContext($userContext, $check = TRUE) {
     if (empty($userContext)) {
@@ -384,8 +364,6 @@ class CRM_Core_Session {
    *
    * @param string $userContext
    *   The url to return to when done.
-   *
-   * @return void
    */
   public function replaceUserContext($userContext) {
     if (empty($userContext)) {
@@ -426,6 +404,7 @@ class CRM_Core_Session {
 
   /**
    * Dumps the session to the log.
+   *
    * @param int $all
    */
   public function debug($all = 1) {
@@ -462,7 +441,7 @@ class CRM_Core_Session {
   }
 
   /**
-   * Stores an alert to be displayed to the user via crm-messages
+   * Stores an alert to be displayed to the user via crm-messages.
    *
    * @param string $text
    *   The status message
@@ -486,9 +465,6 @@ class CRM_Core_Session {
    *                 set to 0 for no expiration
    *                 defaults to 10 seconds for most messages, 5 if it has a title but no body,
    *                 or 0 for errors or messages containing links
-   *
-   *
-   * @return void
    */
   public static function setStatus($text, $title = '', $type = 'alert', $options = array()) {
     // make sure session is initialized, CRM-8120
@@ -520,6 +496,8 @@ class CRM_Core_Session {
   }
 
   /**
+   * Register and retrieve session objects.
+   *
    * @param string|array $names
    */
   public static function registerAndRetrieveSessionObjects($names) {
@@ -538,6 +516,8 @@ class CRM_Core_Session {
   }
 
   /**
+   * Store session objects.
+   *
    * @param bool $reset
    */
   public static function storeSessionObjects($reset = TRUE) {
@@ -554,6 +534,7 @@ class CRM_Core_Session {
 
   /**
    * Retrieve contact id of the logged in user.
+   *
    * @return int|NULL
    *   contact ID of logged in user
    */
@@ -566,12 +547,13 @@ class CRM_Core_Session {
   }
 
   /**
+   * Check if session is empty.
+   *
+   * if so we don't cache stuff that we can get away with, helps proxies like varnish.
+   *
    * @return bool
    */
   public function isEmpty() {
-    // check if session is empty, if so we don't cache
-    // stuff that we can get away with
-    // helps proxies like varnish
     return empty($_SESSION);
   }
 
index 8a0a426638c5a02c127443a3415ed31dfc01e663..e1a14a468201e2fa1a10a95fe71d5633c2334feb 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Core_ShowHideBlocks {
 
@@ -83,8 +81,6 @@ class CRM_Core_ShowHideBlocks {
 
   /**
    * Load icon vars used in hide and show links.
-   *
-   * @return void
    */
   public static function setIcons() {
     if (!isset(self::$_showIcon)) {
@@ -96,8 +92,6 @@ class CRM_Core_ShowHideBlocks {
 
   /**
    * Add the values from this class to the template.
-   *
-   * @return void
    */
   public function addToTemplate() {
     $hide = $show = '';
@@ -130,8 +124,6 @@ class CRM_Core_ShowHideBlocks {
    *
    * @param string $name
    *   Id to be added.
-   *
-   * @return void
    */
   public function addShow($name) {
     $this->_show[$name] = 1;
@@ -145,8 +137,6 @@ class CRM_Core_ShowHideBlocks {
    *
    * @param string $name
    *   Id to be added.
-   *
-   * @return void
    */
   public function addHide($name) {
     $this->_hide[$name] = 1;
@@ -185,8 +175,7 @@ class CRM_Core_ShowHideBlocks {
    *
    * @param bool $assign
    *
-   *
-   * @return void
+   * @return array
    */
   public static function links(&$form, $prefix, $showLinkText, $hideLinkText, $assign = TRUE) {
     $showCode = "cj('#id_{$prefix}').show(); cj('#id_{$prefix}_show').hide();";
@@ -224,8 +213,6 @@ class CRM_Core_ShowHideBlocks {
    *   The set the class.
    * @param string $hideLink
    *   The hide block string.
-   *
-   * @return void
    */
   public function linksForArray(&$form, $index, $maxIndex, $prefix, $showLinkText, $hideLinkText, $elementType = NULL, $hideLink = NULL) {
     $showHidePrefix = str_replace(array("]", "["), array("", "_"), $prefix);
index 7d02f260cd674179fdcf104435db0f0905608edc..0b385e3ffb2edc17cb57a71dbb5ca97d2fa2a236 100644 (file)
@@ -33,8 +33,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Core_State {
 
@@ -154,20 +152,14 @@ class CRM_Core_State {
   }
 
   /**
-   * Mark this page as valid for the QFC framework. This is needed as
-   * we build more advanced functionality into the StateMachine
-   *
-   * @return void
+   * Mark this page as valid for the QFC framework.
    */
   public function validate(&$data) {
     $data['valid'][$this->_name] = TRUE;
   }
 
   /**
-   * Mark this page as invalid for the QFC framework. This is needed as
-   * we build more advanced functionality into the StateMachine
-   *
-   * @return void
+   * Mark this page as invalid for the QFC framework.
    */
   public function invalidate(&$data) {
     $data['valid'][$this->_name] = NULL;
@@ -184,8 +176,6 @@ class CRM_Core_State {
 
   /**
    * Setter for name.
-   *
-   * @return void
    */
   public function setName($name) {
     $this->_name = $name;
index a1fa72881abc9115cf110b7c8386b7c915f6216b..73850cf078a511fa8fb4a81fc6206d16aed1a642 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Core StateMachine. All statemachines subclass for the core one
- * for functionality specific to their needs.
+ * Core StateMachine.
  *
- * A statemachine keeps track of different states and forms for a
- * html quickform controller.
+ * All state machines subclass for the core one for functionality specific to their needs.
  *
+ * A state machine keeps track of different states and forms for a
+ * html quickform controller.
  */
 class CRM_Core_StateMachine {
 
@@ -112,8 +110,6 @@ class CRM_Core_StateMachine {
    * Setter for name.
    *
    * @param string $name
-   *
-   * @return void
    */
   public function setName($name) {
     $this->_name = $name;
@@ -133,7 +129,7 @@ class CRM_Core_StateMachine {
    * @param string $type
    *   The type of transition being requested (Next or Back).
    *
-   * @return void
+   * @return object
    */
   public function perform(&$page, $actionName, $type = 'Next') {
     // save the form values and validation status to the session
@@ -183,8 +179,6 @@ class CRM_Core_StateMachine {
    *   The previous page if any.
    * @param object $next
    *   The next page if any.
-   *
-   * @return void
    */
   public function addState($name, $type, $prev, $next) {
     $this->_states[$name] = new CRM_Core_State($name, $type, $prev, $next, $this);
@@ -318,8 +312,6 @@ class CRM_Core_StateMachine {
 
   /**
    * Reset the state machine.
-   *
-   * @return void
    */
   public function reset() {
     $this->_controller->reset();
@@ -339,8 +331,6 @@ class CRM_Core_StateMachine {
    *
    * @param string $content
    *   The content generated by this state machine.
-   *
-   * @return void
    */
   public function setContent(&$content) {
     $this->_controller->setContent($content);
index e729f31ca3b7ad8ee64e08075b5093ce64cbda40..7f1ac88b2a4110640171edbd880689b1a2b25bfc 100644 (file)
    <page_callback>CRM_Contact_Page_AJAX::getDedupes</page_callback>
    <access_arguments>merge duplicate contacts</access_arguments>
 </item>
+<item>
+  <path>civicrm/contact/dedupemerge</path>
+   <title>Batch Merge Duplicate Contacts</title>
+   <page_callback>CRM_Contact_Page_DedupeMerge</page_callback>
+   <access_arguments>merge duplicate contacts</access_arguments>
+</item>
 <item>
    <path>civicrm/dedupe/exception</path>
    <title>Dedupe Exceptions</title>
      <page_callback>CRM_Contact_Page_AJAX::selectUnselectContacts</page_callback>
      <access_arguments>access CiviCRM</access_arguments>
 </item>
+<item>
+     <path>civicrm/ajax/toggleDedupeSelect</path>
+     <page_callback>CRM_Contact_Page_AJAX::toggleDedupeSelect</page_callback>
+     <access_arguments>merge duplicate contacts</access_arguments>
+</item>
+<item>
+     <path>civicrm/ajax/flipDupePairs</path>
+     <page_callback>CRM_Contact_Page_AJAX::flipDupePairs</page_callback>
+     <access_arguments>merge duplicate contacts</access_arguments>
+</item>
 <item>
   <path>civicrm/activity/sms/add</path>
   <path_arguments>action=add</path_arguments>
index da5f6544e640d11ed93631b2477482e3a4e3ae2a..6d8d46214be0410ff5184087f9cce05488fbf548 100644 (file)
@@ -50,14 +50,13 @@ class CRM_Custom_Form_CustomDataByType extends CRM_Core_Form {
     $this->assign('cdType', FALSE);
     $this->assign('cgCount', $this->_groupCount);
 
-    // Carry qf key, since this form is not inheriting core form (unclear is still the case).
-    if ($qfKey = CRM_Utils_Request::retrieve('qfKey', 'String')) {
-      $this->assign('qfKey', $qfKey);
-    }
     if (!is_array($this->_subType) && strstr($this->_subType, CRM_Core_DAO::VALUE_SEPARATOR)) {
       $this->_subType = str_replace(CRM_Core_DAO::VALUE_SEPARATOR, ',', trim($this->_subType, CRM_Core_DAO::VALUE_SEPARATOR));
     }
     CRM_Custom_Form_CustomData::setGroupTree($this, $this->_subType, NULL, $this->_groupID);
+
+    $this->assign('suppressForm', TRUE);
+    $this->controller->_generateQFKey = FALSE;
   }
 
   /**
index f0605215aea6c8a133358bdc4258d8710b49a884..b8f4415080bd170fa53077bc650ba076b8f727c0 100644 (file)
@@ -32,8 +32,6 @@ use Civi\Cxn\Rpc\DefaultCertificateValidator;
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
index 36badd2d6c416602501f19989210763bc70e5d9c..e7fb33915f560884df4c159d370dd49abc0e6934 100644 (file)
@@ -565,11 +565,12 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
    *                              Does a force merge otherwise.
    * @param bool $autoFlip to let api decide which contact to retain and which to delete.
    *   Wether to let api decide which contact to retain and which to delete.
-   * @param bool $redirectForPerformance
+   * @param int $batchLimit number of merges to carry out in one batch.
+   * @param int $isSelected if records with is_selected column needs to be processed.
    *
    * @return array|bool
    */
-  public static function batchMerge($rgid, $gid = NULL, $mode = 'safe', $autoFlip = TRUE, $redirectForPerformance = FALSE) {
+  public static function batchMerge($rgid, $gid = NULL, $mode = 'safe', $autoFlip = TRUE, $batchLimit = 1, $isSelected = 2) {
     $contactType = CRM_Core_DAO::getFieldValue('CRM_Dedupe_DAO_RuleGroup', $rgid, 'contact_type');
     $cacheKeyString = "merge {$contactType}";
     $cacheKeyString .= $rgid ? "_{$rgid}" : '_0';
@@ -577,11 +578,16 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
     $join = "LEFT JOIN civicrm_dedupe_exception de ON ( pn.entity_id1 = de.contact_id1 AND
                                                              pn.entity_id2 = de.contact_id2 )";
 
-    $limit = $redirectForPerformance ? 75 : 1;
-    $where = "de.id IS NULL LIMIT {$limit}";
+    $where = "de.id IS NULL";
+    if ($isSelected === 0 || $isSelected === 1) {
+      $where .= " AND pn.is_selected = {$isSelected}";
+    }// else consider all dupe pairs
+    $where .= " LIMIT {$batchLimit}";
+
+    $redirectForPerformance = ($batchLimit > 1) ? TRUE : FALSE;
 
     $dupePairs = CRM_Core_BAO_PrevNextCache::retrieve($cacheKeyString, $join, $where);
-    if (empty($dupePairs) && !$redirectForPerformance) {
+    if (empty($dupePairs) && !$redirectForPerformance && $isSelected == 2) {
       // If we haven't found any dupes, probably cache is empty.
       // Try filling cache and give another try.
       CRM_Core_BAO_PrevNextCache::refillCache($rgid, $gid, $cacheKeyString);
@@ -596,6 +602,65 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
     return CRM_Dedupe_Merger::merge($dupePairs, $cacheParams, $mode, $autoFlip, $redirectForPerformance);
   }
 
+  public static function updateMergeStats($cacheKeyString, $result = array()) {
+    // gather latest stats
+    $merged  = count($result['merged']);
+    $skipped = count($result['skipped']);
+
+    if ($merged <= 0 && $skipped <= 0) {
+      return;
+    }
+
+    // get previous stats
+    $previousStats = CRM_Core_BAO_PrevNextCache::retrieve("{$cacheKeyString}_stats");
+    if (!empty($previousStats)) {
+      if ($previousStats[0]['merged']) {
+        $merged = $merged + $previousStats[0]['merged'];
+      }
+      if ($previousStats[0]['skipped']) {
+        $skipped = $skipped + $previousStats[0]['skipped'];
+      }
+    }
+
+    // delete old stats
+    CRM_Dedupe_Merger::resetMergeStats($cacheKeyString);
+
+    // store the updated stats
+    $data = array(
+      'merged'  => $merged,
+      'skipped' => $skipped,
+    );
+    $data = CRM_Core_DAO::escapeString(serialize($data));
+
+    $values   = array();
+    $values[] = " ( 'civicrm_contact', 0, 0, '{$cacheKeyString}_stats', '$data' ) ";
+    CRM_Core_BAO_PrevNextCache::setItem($values);
+  }
+
+  public static function resetMergeStats($cacheKeyString) {
+    return CRM_Core_BAO_PrevNextCache::deleteItem(NULL, "{$cacheKeyString}_stats");
+  }
+
+  public static function getMergeStats($cacheKeyString) {
+    $stats = CRM_Core_BAO_PrevNextCache::retrieve("{$cacheKeyString}_stats");
+    if (!empty($stats)) {
+      $stats = $stats[0];
+    }
+    return $stats;
+  }
+
+  public static function getMergeStatsMsg($cacheKeyString) {
+    $msg   = '';
+    $stats = CRM_Dedupe_Merger::getMergeStats($cacheKeyString);
+    if (!empty($stats['merged'])) {
+      $msg = "{$stats['merged']} " . ts(' Contact(s) were merged. ');
+    }
+    if (!empty($stats['skipped'])) {
+      $msg .= $stats['skipped'] . ts(' Contact(s) were skipped.');
+    }
+    return $msg;
+  }
+
   /**
    * Merge given set of contacts. Performs core operation.
    *
@@ -656,7 +721,8 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
         $migrationInfo['rows'] = &$rowsElementsAndInfo['rows'];
 
         // go ahead with merge if there is no conflict
-        if (!CRM_Dedupe_Merger::skipMerge($mainId, $otherId, $migrationInfo, $mode)) {
+        $conflicts = array();
+        if (!CRM_Dedupe_Merger::skipMerge($mainId, $otherId, $migrationInfo, $mode, $conflicts)) {
           CRM_Dedupe_Merger::moveAllBelongings($mainId, $otherId, $migrationInfo);
           $resultStats['merged'][] = array('main_id' => $mainId, 'other_id' => $otherId);
         }
@@ -664,10 +730,18 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
           $resultStats['skipped'][] = array('main_id' => $mainId, 'other_id' => $otherId);
         }
 
-        // delete entry from PrevNextCache table so we don't consider the pair next time
-        // pair may have been flipped, so make sure we delete using both orders
-        CRM_Core_BAO_PrevNextCache::deletePair($mainId, $otherId, $cacheKeyString);
-        CRM_Core_BAO_PrevNextCache::deletePair($otherId, $mainId, $cacheKeyString);
+        // store  any conflicts
+        if (!empty($conflicts)) {
+          foreach ($conflicts as $key => $dnc) {
+            $conflicts[$key] = "{$migrationInfo['rows'][$key]['title']}: '{$migrationInfo['rows'][$key]['main']}' vs. '{$migrationInfo['rows'][$key]['other']}'";
+          }
+          CRM_Core_BAO_PrevNextCache::markConflict($mainId, $otherId, $cacheKeyString, $conflicts);
+        }
+        else {
+          // delete entry from PrevNextCache table so we don't consider the pair next time
+          // pair may have been flipped, so make sure we delete using both orders
+          CRM_Core_BAO_PrevNextCache::deletePair($mainId, $otherId, $cacheKeyString, TRUE);
+        }
 
         CRM_Core_DAO::freeResult();
         unset($rowsElementsAndInfo, $migrationInfo);
@@ -685,6 +759,8 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
         unset($dupePairs);
       }
     }
+
+    CRM_Dedupe_Merger::updateMergeStats($cacheKeyString, $resultStats);
     return $resultStats;
   }
 
@@ -705,8 +781,8 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
    *
    * @return bool
    */
-  public static function skipMerge($mainId, $otherId, &$migrationInfo, $mode = 'safe') {
-    $conflicts = array();
+  public static function skipMerge($mainId, $otherId, &$migrationInfo, $mode = 'safe', &$conflicts = array()) {
+    //$conflicts = array();
     $migrationData = array(
       'old_migration_info' => $migrationInfo,
       'mode' => $mode,
@@ -727,15 +803,10 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
         // particular field or not
         if (!empty($migrationInfo['rows'][$key]['main'])) {
           // if main also has a value its a conflict
-          if ($mode == 'safe') {
-            // note it down & lets wait for response from the hook.
-            // For no response skip this merge
-            $conflicts[$key] = NULL;
-          }
-          elseif ($mode == 'aggressive') {
-            // let the main-field be overwritten
-            continue;
-          }
+
+          // note it down & lets wait for response from the hook.
+          // For no response $mode will decide if to skip this merge
+          $conflicts[$key] = NULL;
         }
       }
       elseif (substr($key, 0, 14) == 'move_location_' and $val != NULL) {
@@ -760,16 +831,11 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
               // try insert address at new available loc-type
               $migrationInfo['location'][$fieldName][$fieldCount]['locTypeId'] = $newTypeId;
             }
-            elseif ($mode == 'safe') {
+            else {
               // note it down & lets wait for response from the hook.
-              // For no response skip this merge
+              // For no response $mode will decide if to skip this merge
               $conflicts[$key] = NULL;
             }
-            elseif ($mode == 'aggressive') {
-              // let the loc-type-id be same as that of other-contact & go ahead
-              // with merge assuming aggressive mode
-              continue;
-            }
           }
         }
         elseif ($migrationInfo['rows'][$key]['main'] == $migrationInfo['rows'][$key]['other']) {
@@ -785,13 +851,16 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
     // merge happens with new values filled in here. For a particular field / row not to be merged
     // field should be unset from fields_in_conflict.
     $migrationData['fields_in_conflict'] = $conflicts;
+    $migrationData['merge_mode']         = $mode;
     CRM_Utils_Hook::merge('batch', $migrationData, $mainId, $otherId);
     $conflicts = $migrationData['fields_in_conflict'];
+    // allow hook to override / manipulate migrationInfo as well
+    $migrationInfo = $migrationData['old_migration_info'];
 
     if (!empty($conflicts)) {
       foreach ($conflicts as $key => $val) {
         if ($val === NULL and $mode == 'safe') {
-          // un-resolved conflicts still present. Lets skip this merge.
+          // un-resolved conflicts still present. Lets skip this merge after saving the conflict / reason.
           return TRUE;
         }
         else {
@@ -799,6 +868,10 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
           $migrationInfo[$key] = $val;
         }
       }
+      // if there are conflicts and mode is aggressive, allow hooks to decide if to skip merges
+      if (array_key_exists('skip_merge', $migrationData)) {
+        return (bool) $migrationData['skip_merge'];
+      }
     }
     return FALSE;
   }
index 318066384ce953bf9bb486f93468837dc654ebdd..941aeb6766773ce0de30e1c18999b8f9286720f6 100644 (file)
@@ -1961,13 +1961,18 @@ GROUP BY li.entity_table, li.entity_id, price_field_value_id
         WHERE (li.entity_table = 'civicrm_participant' AND li.entity_id = {$participantId})";
       CRM_Core_DAO::executeQuery($updateLineItem);
     }
+    $amountLevel = array();
+    $totalParticipant = $participantCount = 0;
     if (!empty($updateLines)) {
       foreach ($updateLines as $valueId => $vals) {
+        $taxAmount = "NULL";
         if (isset($vals['tax_amount'])) {
           $taxAmount = $vals['tax_amount'];
         }
-        else {
-          $taxAmount = "NULL";
+        $amountLevel[] = $vals['label'] . ' - ' . (float) $vals['qty'];
+        if (isset($vals['participant_count'])) {
+          $participantCount = $vals['participant_count'];
+          $totalParticipant += $vals['participant_count'];
         }
         $updateLineItem = "
 UPDATE civicrm_line_item li
@@ -1975,6 +1980,7 @@ SET li.qty = {$vals['qty']},
     li.line_total = {$vals['line_total']},
     li.tax_amount = {$taxAmount},
     li.unit_price = {$vals['unit_price']},
+    li.participant_count = {$participantCount},
     li.label = %1
 WHERE (li.entity_table = 'civicrm_participant' AND li.entity_id = {$participantId}) AND
       (price_field_value_id = {$valueId})
@@ -2012,7 +2018,15 @@ WHERE (li.entity_table = 'civicrm_participant' AND li.entity_id = {$participantI
     else {
       $taxAmount = "NULL";
     }
-    $trxn = self::recordAdjustedAmt($updatedAmount, $paidAmount, $contributionId, $taxAmount);
+    $displayParticipantCount = '';
+    if ($totalParticipant > 0) {
+      $displayParticipantCount = ' Participant Count -' . $totalParticipant;
+    }
+    $updateAmountLevel = NULL;
+    if (!empty($amountLevel)) {
+      $updateAmountLevel = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, $amountLevel) . $displayParticipantCount . CRM_Core_DAO::VALUE_SEPARATOR;
+    }
+    $trxn = self::recordAdjustedAmt($updatedAmount, $paidAmount, $contributionId, $taxAmount, $updateAmountLevel);
     $trxnId = array();
     if ($trxn) {
       $trxnId['id'] = $trxn->id;
@@ -2068,7 +2082,7 @@ WHERE (entity_table = 'civicrm_participant' AND entity_id = {$participantId} AND
    * @param $paidAmount
    * @param int $contributionId
    */
-  public static function recordAdjustedAmt($updatedAmount, $paidAmount, $contributionId, $taxAmount = NULL) {
+  public static function recordAdjustedAmt($updatedAmount, $paidAmount, $contributionId, $taxAmount = NULL, $updateAmountLevel = NULL) {
     $pendingAmount = CRM_Core_BAO_FinancialTrxn::getBalanceTrxnAmt($contributionId);
     $pendingAmount = CRM_Utils_Array::value('total_amount', $pendingAmount, 0);
     $balanceAmt = $updatedAmount - $paidAmount;
@@ -2105,6 +2119,9 @@ WHERE (entity_table = 'civicrm_participant' AND entity_id = {$participantId} AND
       $updatedContributionDAO->total_amount = $updatedContributionDAO->net_amount = $updatedAmount;
       $updatedContributionDAO->fee_amount = 0;
       $updatedContributionDAO->tax_amount = $taxAmount;
+      if (!empty($updateAmountLevel)) {
+        $updatedContributionDAO->amount_level = $updateAmountLevel;
+      }
       $updatedContributionDAO->save();
       // adjusted amount financial_trxn creation
       $updatedContribution = CRM_Contribute_BAO_Contribution::getValues(
index b9d18e13815deffbc208028dba28fc36df7c754b..0ac4d404d302ed8d786c895e70d8fc22f49bc1e1 100644 (file)
@@ -309,9 +309,9 @@ class CRM_Event_BAO_Query {
             $value,
             "Boolean"
           );
-          if ($value) {
-            $query->_qill[$grouping][] = ts("Participant is a Test");
-          }
+
+          $isTest = $value ? 'a Test' : 'not a Test';
+          $query->_qill[$grouping][] = ts("Participant is %1", array(1 => $isTest));
           $query->_tables['civicrm_participant'] = $query->_whereTables['civicrm_participant'] = 1;
         }
         return;
@@ -346,6 +346,8 @@ class CRM_Event_BAO_Query {
       case 'participant_is_pay_later':
       case 'participant_fee_amount':
       case 'participant_fee_level':
+      case 'participant_campaign_id':
+
         $qillName = $name;
         if (in_array($name, array(
               'participant_status_id',
@@ -356,6 +358,7 @@ class CRM_Event_BAO_Query {
               'participant_fee_amount',
               'participant_fee_level',
               'participant_is_pay_later',
+              'participant_campaign_id',
             ))) {
           $name = str_replace('participant_', '', $name);
           if ($name == 'is_pay_later') {
@@ -411,16 +414,6 @@ class CRM_Event_BAO_Query {
         list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Event_DAO_Event', $name, $value, $op);
         $query->_qill[$grouping][] = ts('%1 %2 %3', array(1 => $fields[$qillName]['title'], 2 => $op, 3 => $value));
         return;
-
-      case 'participant_campaign_id':
-        $campParams = array(
-          'op' => $op,
-          'campaign' => $value,
-          'grouping' => $grouping,
-          'tableName' => 'civicrm_participant',
-        );
-        CRM_Campaign_BAO_Query::componentSearchClause($campParams, $query);
-        return;
     }
   }
 
index d440fa97e846fd89623b5497aa1a5673e9d6e508..8f57c31af9ff8cc9c6c6e2c9ba11718fbf412b0a 100644 (file)
@@ -1473,7 +1473,7 @@ WHERE  v.option_group_id = g.id
       $this->_values['event']
     ));
     $eventEndDate = CRM_Utils_Date::processDate(CRM_Utils_Array::value('event_end_date', $this->_values['event']));
-    if (($regEndDate && ($regEndDate < $now)) || (empty($regEndDate) && ($eventEndDate < $now))) {
+    if (($regEndDate && ($regEndDate < $now)) || (empty($regEndDate) && !empty($eventEndDate) && ($eventEndDate < $now))) {
       $endDate = CRM_Utils_Date::customFormat(CRM_Utils_Array::value('registration_end_date', $this->_values['event']));
       if (empty($regEndDate)) {
         $endDate = CRM_Utils_Date::customFormat(CRM_Utils_Array::value('event_end_date', $this->_values['event']));
index eaf024563d9d60e1eceeb8545df4a03f776328d8..68fcdc4211f99886487c9d886443ec565064b48a 100644 (file)
@@ -582,6 +582,10 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration {
         if (is_array($this->_paymentProcessor)) {
           $payment = $this->_paymentProcessor['object'];
         }
+        if (!empty($this->_paymentProcessor) &&  $this->_paymentProcessor['object']->supports('preApproval')) {
+          $preApprovalParams = $this->_paymentProcessor['object']->getPreApprovalDetails($this->get('pre_approval_parameters'));
+          $value = array_merge($value, $preApprovalParams);
+        }
         $result = NULL;
 
         if (!empty($value['is_pay_later']) ||
@@ -1045,24 +1049,6 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration {
       $contribParams['address_id'] = CRM_Contribute_BAO_Contribution::createAddress($params, $form->_bltID);
     }
 
-    // Prepare soft contribution due to pcp or Submit Credit / Debit Card Contribution by admin.
-    if (!empty($params['pcp_made_through_id']) || !empty($params['soft_credit_to'])) {
-
-      // if its due to pcp
-      if (!empty($params['pcp_made_through_id'])) {
-        $contribSoftContactId = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP',
-          $params['pcp_made_through_id'],
-          'contact_id'
-        );
-      }
-      else {
-        $contribSoftContactId = CRM_Utils_Array::value('soft_credit_to', $params);
-      }
-
-      // Pass these details onto with the contribution to make them
-      // available at hook_post_process, CRM-8908
-      $contribParams['soft_credit_to'] = $params['soft_credit_to'] = $contribSoftContactId;
-    }
     $contribParams['payment_processor'] = CRM_Utils_Array::value('payment_processor', $params);
     $contribParams['skipLineItem'] = 1;
     // create contribution record
@@ -1071,7 +1057,10 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration {
     CRM_Event_BAO_Participant::createDiscountTrxn($form->_eventId, $contribParams, CRM_Utils_Array::value('amount_priceset_level_radio', $params, NULL));
 
     // process soft credit / pcp pages
-    CRM_Contribute_Form_Contribution_Confirm::processPcpSoft($params, $contribution);
+    if (!empty($params['pcp_made_through_id'])) {
+      CRM_Contribute_Form_Contribution_Confirm::formatSoftCreditParams($params, $form);
+      CRM_Contribute_BAO_ContributionSoft::processSoftContribution($params, $contribution);
+    }
 
     $transaction->commit();
 
index 7362870b6fb2e596968ca489928f7830cbfff3f5..00367dada86328d6e8abc3724415ebdee9c63d15 100644 (file)
@@ -912,7 +912,11 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
   }
 
   /**
-   * Check if profiles are complete when event registration occurs(CRM-9587)
+   * Check if profiles are complete when event registration occurs(CRM-9587).
+   *
+   * @param array $fields
+   * @param array $errors
+   * @param int $eventId
    */
   public static function checkProfileComplete($fields, &$errors, $eventId) {
     $email = '';
@@ -1066,6 +1070,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
 
       if (is_array($this->_paymentProcessor)) {
         $payment = $this->_paymentProcessor['object'];
+        $payment->setBaseReturnUrl('civicrm/event/register');
       }
       // default mode is direct
       $this->set('contributeMode', 'direct');
@@ -1091,6 +1096,8 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
         $params['invoiceID'] = $invoiceID;
       }
       $this->_params = $this->get('params');
+      // Set the button so we know what
+      $params['button'] = $this->controller->getButtonName();
       if (!empty($this->_params) && is_array($this->_params)) {
         $this->_params[0] = $params;
       }
@@ -1099,77 +1106,66 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
         $this->_params[] = $params;
       }
       $this->set('params', $this->_params);
-
       if ($this->_paymentProcessor &&
-        $this->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_BUTTON
+        $this->_paymentProcessor['object']->supports('preApproval')
+        && !$this->_allowWaitlist &&
+        !$this->_requireApproval
       ) {
-        //get the button name
-        $buttonName = $this->controller->getButtonName();
-        if (in_array($buttonName,
-            array(
-              $this->_expressButtonName,
-              $this->_expressButtonName . '_x',
-              $this->_expressButtonName . '_y',
-            )
-          ) && empty($params['is_pay_later']) &&
-          !$this->_allowWaitlist &&
-          !$this->_requireApproval
-        ) {
-          $this->set('contributeMode', 'express');
 
-          // Send Event Name & Id in Params
-          $params['eventName'] = $this->_values['event']['title'];
-          $params['eventId'] = $this->_values['event']['id'];
-
-          $params['cancelURL'] = CRM_Utils_System::url('civicrm/event/register',
-            "_qf_Register_display=1&qfKey={$this->controller->_key}",
-            TRUE, NULL, FALSE
-          );
-          if (CRM_Utils_Array::value('additional_participants', $params, FALSE)) {
-            $urlArgs = "_qf_Participant_1_display=1&rfp=1&qfKey={$this->controller->_key}";
-          }
-          else {
-            $urlArgs = "_qf_Confirm_display=1&rfp=1&qfKey={$this->controller->_key}";
-          }
-          $params['returnURL'] = CRM_Utils_System::url('civicrm/event/register',
-            $urlArgs,
-            TRUE, NULL, FALSE
-          );
-          $params['invoiceID'] = $invoiceID;
+        $this->handlePreApproval($params);
 
-          $params['component'] = 'event';
-          $token = $payment->doPreApproval($params);
-          if (is_a($token, 'CRM_Core_Error')) {
-            CRM_Core_Error::displaySessionError($token);
-            CRM_Utils_System::redirect($params['cancelURL']);
-          }
+        $this->set('contributeMode', 'express');
 
-          $this->set('token', $token);
+        // Send Event Name & Id in Params
+        $params['eventName'] = $this->_values['event']['title'];
+        $params['eventId'] = $this->_values['event']['id'];
 
-          $paymentURL = $this->_paymentProcessor['url_site'] . "/cgi-bin/webscr?cmd=_express-checkout&token=$token";
+        $params['cancelURL'] = CRM_Utils_System::url('civicrm/event/register',
+          "_qf_Register_display=1&qfKey={$this->controller->_key}",
+          TRUE, NULL, FALSE
+        );
+        if (CRM_Utils_Array::value('additional_participants', $params, FALSE)) {
+          $urlArgs = "_qf_Participant_1_display=1&rfp=1&qfKey={$this->controller->_key}";
+        }
+        else {
+          $urlArgs = "_qf_Confirm_display=1&rfp=1&qfKey={$this->controller->_key}";
+        }
+        $params['returnURL'] = CRM_Utils_System::url('civicrm/event/register',
+          $urlArgs,
+          TRUE, NULL, FALSE
+        );
+        $params['invoiceID'] = $invoiceID;
 
-          CRM_Utils_System::redirect($paymentURL);
+        $params['component'] = 'event';
+        $token = $payment->doPreApproval($params);
+        if (is_a($token, 'CRM_Core_Error')) {
+          CRM_Core_Error::displaySessionError($token);
+          CRM_Utils_System::redirect($params['cancelURL']);
         }
+
+        $this->set('token', $token);
+
+        $paymentURL = $this->_paymentProcessor['url_site'] . "/cgi-bin/webscr?cmd=_express-checkout&token=$token";
+        CRM_Utils_System::redirect($paymentURL);
       }
       elseif ($this->_paymentProcessor &&
         $this->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_NOTIFY
       ) {
         $this->set('contributeMode', 'notify');
       }
-    }
-    else {
-      $session = CRM_Core_Session::singleton();
-      $params['description'] = ts('Online Event Registration') . ' ' . $this->_values['event']['title'];
+      else {
+        $params['description'] = ts('Online Event Registration') . ' ' . $this->_values['event']['title'];
 
-      $this->_params = array();
-      $this->_params[] = $params;
-      $this->set('params', $this->_params);
+        $this->_params = array();
+        $this->_params[] = $params;
+        $this->set('params', $this->_params);
 
-      if (
-        empty($params['additional_participants'])
-        && !$this->_values['event']['is_confirm_enabled'] // CRM-11182 - Optional confirmation screen
-      ) {
-        self::processRegistration($this->_params);
+        if (
+          empty($params['additional_participants'])
+          && !$this->_values['event']['is_confirm_enabled'] // CRM-11182 - Optional confirmation screen
+        ) {
+          self::processRegistration($this->_params);
+        }
       }
     }
 
@@ -1186,8 +1182,6 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
    * @param array $params
    *   Form values.
    * @param int $contactID
-   *
-   * @return void
    */
   public function processRegistration($params, $contactID = NULL) {
     $session = CRM_Core_Session::singleton();
@@ -1313,7 +1307,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
         $primaryContactId, $isTest, TRUE
       );
 
-      //lets carry all paticipant params w/ values.
+      //lets carry all participant params w/ values.
       foreach ($additionalIDs as $participantID => $contactId) {
         $participantNum = NULL;
         if ($participantID == $registerByID) {
@@ -1366,7 +1360,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
    *
    * @param array $fields
    *   The input form values(anonymous user).
-   * @param array $self
+   * @param CRM_Event_Form_Registration_Register $self
    *   Event data.
    * @param bool $isAdditional
    *   Treat isAdditional participants a bit differently.
index dbf85c34117ecf58453c4b0d0feff7de978ba5e3..0d674fde9d30aedb8029673476c52f8f6beff21f 100644 (file)
@@ -70,17 +70,17 @@ class CRM_Event_Task {
     if (!(self::$_tasks)) {
       self::$_tasks = array(
         1 => array(
-          'title' => ts('Delete Participants'),
+          'title' => ts('Delete participants from event'),
           'class' => 'CRM_Event_Form_Task_Delete',
           'result' => FALSE,
         ),
         2 => array(
-          'title' => ts('Print Selected Rows'),
+          'title' => ts('Print selected rows'),
           'class' => 'CRM_Event_Form_Task_Print',
           'result' => FALSE,
         ),
         3 => array(
-          'title' => ts('Export Participants'),
+          'title' => ts('Export participants'),
           'class' => array(
             'CRM_Export_Form_Select',
             'CRM_Export_Form_Map',
@@ -88,7 +88,7 @@ class CRM_Event_Task {
           'result' => FALSE,
         ),
         4 => array(
-          'title' => ts('Batch Update Participants Via Profile'),
+          'title' => ts('Batch update participants via profile'),
           'class' => array(
             'CRM_Event_Form_Task_PickProfile',
             'CRM_Event_Form_Task_Batch',
@@ -96,42 +96,42 @@ class CRM_Event_Task {
           'result' => TRUE,
         ),
         5 => array(
-          'title' => ts('Cancel Registration'),
+          'title' => ts('Cancel registration'),
           'class' => 'CRM_Event_Form_Task_Cancel',
           'result' => FALSE,
         ),
         6 => array(
-          'title' => ts('Send Email to Contacts'),
+          'title' => ts('Email - send now'),
           'class' => 'CRM_Event_Form_Task_Email',
           'result' => TRUE,
         ),
         13 => array(
-          'title' => ts('New Smart Group'),
+          'title' => ts('Smart group - create'),
           'class' => 'CRM_Event_Form_Task_SaveSearch',
           'result' => TRUE,
         ),
         14 => array(
-          'title' => ts('Update Smart Group'),
+          'title' => ts('Smart group - update'),
           'class' => 'CRM_Event_Form_Task_SaveSearch_Update',
           'result' => TRUE,
         ),
         15 => array(
-          'title' => ts('Change Participant Status'),
+          'title' => ts('Participant status - change'),
           'class' => 'CRM_Event_Form_Task_ParticipantStatus',
           'result' => TRUE,
         ),
         16 => array(
-          'title' => ts('Print Event Name Badges'),
+          'title' => ts('Name badges - print'),
           'class' => 'CRM_Event_Form_Task_Badge',
           'result' => FALSE,
         ),
         17 => array(
-          'title' => ts('Print PDF Letter for Participants'),
+          'title' => ts('PDF letter - print for participants'),
           'class' => 'CRM_Event_Form_Task_PDF',
           'result' => TRUE,
         ),
         20 => array(
-          'title' => ts('Add Contacts to Group'),
+          'title' => ts('Group - add contacts'),
           'class' => 'CRM_Event_Form_Task_AddToGroup',
           'result' => FALSE,
         ),
index 0d4326b65d3b7d3c6779dda3821b980a9b547a25..dca4f2ec1a3e80635cca4c7bb2bdba8174d9c22c 100644 (file)
@@ -43,6 +43,116 @@ class CRM_Export_BAO_Export {
   // CRM-7675
   const EXPORT_ROW_COUNT = 10000;
 
+  /**
+   * Get Querymode based on ExportMode
+   *
+   * @param int $exportMode
+   *   Export mode.
+   *
+   * return string Querymode
+   */
+  public static function getQueryMode($exportMode) {
+    $queryMode = CRM_Contact_BAO_Query::MODE_CONTACTS;
+
+    switch ($exportMode) {
+      case CRM_Export_Form_Select::CONTRIBUTE_EXPORT:
+        $queryMode = CRM_Contact_BAO_Query::MODE_CONTRIBUTE;
+        break;
+
+      case CRM_Export_Form_Select::EVENT_EXPORT:
+        $queryMode = CRM_Contact_BAO_Query::MODE_EVENT;
+        break;
+
+      case CRM_Export_Form_Select::MEMBER_EXPORT:
+        $queryMode = CRM_Contact_BAO_Query::MODE_MEMBER;
+        break;
+
+      case CRM_Export_Form_Select::PLEDGE_EXPORT:
+        $queryMode = CRM_Contact_BAO_Query::MODE_PLEDGE;
+        break;
+
+      case CRM_Export_Form_Select::CASE_EXPORT:
+        $queryMode = CRM_Contact_BAO_Query::MODE_CASE;
+        break;
+
+      case CRM_Export_Form_Select::GRANT_EXPORT:
+        $queryMode = CRM_Contact_BAO_Query::MODE_GRANT;
+        break;
+
+      case CRM_Export_Form_Select::ACTIVITY_EXPORT:
+        $queryMode = CRM_Contact_BAO_Query::MODE_ACTIVITY;
+        break;
+    }
+    return $queryMode;
+  }
+
+  /**
+   * Get default return property for export based on mode
+   *
+   * @param int $exportMode
+   *   Export mode.
+   *
+   * return string $property
+   */
+  public static function defaultReturnProperty($exportMode) {
+    // hack to add default returnproperty based on export mode
+    if ($exportMode == CRM_Export_Form_Select::CONTRIBUTE_EXPORT) {
+      $property = 'contribution_id';
+    }
+    elseif ($exportMode == CRM_Export_Form_Select::EVENT_EXPORT) {
+      $property = 'participant_id';
+    }
+    elseif ($exportMode == CRM_Export_Form_Select::MEMBER_EXPORT) {
+      $property = 'membership_id';
+    }
+    elseif ($exportMode == CRM_Export_Form_Select::PLEDGE_EXPORT) {
+      $property = 'pledge_id';
+    }
+    elseif ($exportMode == CRM_Export_Form_Select::CASE_EXPORT) {
+      $property = 'case_id';
+    }
+    elseif ($exportMode == CRM_Export_Form_Select::GRANT_EXPORT) {
+      $property = 'grant_id';
+    }
+    elseif ($exportMode == CRM_Export_Form_Select::ACTIVITY_EXPORT) {
+      $property = 'activity_id';
+    }
+    return $property;
+  }
+
+  /**
+   * Get Export component
+   *
+   * @param int $exportMode
+   *   Export mode.
+   *
+   * return string component
+   */
+  public static function exportComponent($exportMode) {
+    switch ($exportMode) {
+      case CRM_Export_Form_Select::CONTRIBUTE_EXPORT:
+        $component = 'civicrm_contribution';
+        break;
+
+      case CRM_Export_Form_Select::EVENT_EXPORT:
+        $component = 'civicrm_participant';
+        break;
+
+      case CRM_Export_Form_Select::MEMBER_EXPORT:
+        $component = 'civicrm_membership';
+        break;
+
+      case CRM_Export_Form_Select::PLEDGE_EXPORT:
+        $component = 'civicrm_pledge';
+        break;
+
+      case CRM_Export_Form_Select::GRANT_EXPORT:
+        $component = 'civicrm_grant';
+        break;
+    }
+    return $component;
+  }
+
   /**
    * Get the list the export fields.
    *
@@ -104,37 +214,9 @@ class CRM_Export_BAO_Export {
       'name',
       FALSE
     );
-    $queryMode = CRM_Contact_BAO_Query::MODE_CONTACTS;
 
-    switch ($exportMode) {
-      case CRM_Export_Form_Select::CONTRIBUTE_EXPORT:
-        $queryMode = CRM_Contact_BAO_Query::MODE_CONTRIBUTE;
-        break;
+    $queryMode = self::getQueryMode($exportMode);
 
-      case CRM_Export_Form_Select::EVENT_EXPORT:
-        $queryMode = CRM_Contact_BAO_Query::MODE_EVENT;
-        break;
-
-      case CRM_Export_Form_Select::MEMBER_EXPORT:
-        $queryMode = CRM_Contact_BAO_Query::MODE_MEMBER;
-        break;
-
-      case CRM_Export_Form_Select::PLEDGE_EXPORT:
-        $queryMode = CRM_Contact_BAO_Query::MODE_PLEDGE;
-        break;
-
-      case CRM_Export_Form_Select::CASE_EXPORT:
-        $queryMode = CRM_Contact_BAO_Query::MODE_CASE;
-        break;
-
-      case CRM_Export_Form_Select::GRANT_EXPORT:
-        $queryMode = CRM_Contact_BAO_Query::MODE_GRANT;
-        break;
-
-      case CRM_Export_Form_Select::ACTIVITY_EXPORT:
-        $queryMode = CRM_Contact_BAO_Query::MODE_ACTIVITY;
-        break;
-    }
     if ($fields) {
       //construct return properties
       $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
@@ -247,32 +329,10 @@ class CRM_Export_BAO_Export {
           }
         }
       }
-
-      // hack to add default returnproperty based on export mode
-      if ($exportMode == CRM_Export_Form_Select::CONTRIBUTE_EXPORT) {
-        $returnProperties['contribution_id'] = 1;
-      }
-      elseif ($exportMode == CRM_Export_Form_Select::EVENT_EXPORT) {
-        $returnProperties['participant_id'] = 1;
-        if (!empty($returnProperties['participant_role'])) {
-          unset($returnProperties['participant_role']);
-          $returnProperties['participant_role_id'] = 1;
-        }
-      }
-      elseif ($exportMode == CRM_Export_Form_Select::MEMBER_EXPORT) {
-        $returnProperties['membership_id'] = 1;
-      }
-      elseif ($exportMode == CRM_Export_Form_Select::PLEDGE_EXPORT) {
-        $returnProperties['pledge_id'] = 1;
-      }
-      elseif ($exportMode == CRM_Export_Form_Select::CASE_EXPORT) {
-        $returnProperties['case_id'] = 1;
-      }
-      elseif ($exportMode == CRM_Export_Form_Select::GRANT_EXPORT) {
-        $returnProperties['grant_id'] = 1;
-      }
-      elseif ($exportMode == CRM_Export_Form_Select::ACTIVITY_EXPORT) {
-        $returnProperties['activity_id'] = 1;
+      $returnProperties[self::defaultReturnProperty($exportMode)] = 1;
+      if ($exportMode == CRM_Export_Form_Select::EVENT_EXPORT && !empty($returnProperties['participant_role'])) {
+        unset($returnProperties['participant_role']);
+        $returnProperties['participant_role_id'] = 1;
       }
     }
     else {
@@ -473,27 +533,7 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c
           }
         }
         else {
-          switch ($exportMode) {
-            case CRM_Export_Form_Select::CONTRIBUTE_EXPORT:
-              $component = 'civicrm_contribution';
-              break;
-
-            case CRM_Export_Form_Select::EVENT_EXPORT:
-              $component = 'civicrm_participant';
-              break;
-
-            case CRM_Export_Form_Select::MEMBER_EXPORT:
-              $component = 'civicrm_membership';
-              break;
-
-            case CRM_Export_Form_Select::PLEDGE_EXPORT:
-              $component = 'civicrm_pledge';
-              break;
-
-            case CRM_Export_Form_Select::GRANT_EXPORT:
-              $component = 'civicrm_grant';
-              break;
-          }
+          $component = self::exportComponent($exportMode);
 
           if ($exportMode == CRM_Export_Form_Select::CASE_EXPORT) {
             $relIDs = CRM_Case_BAO_Case::retrieveContactIdsByCaseId($ids);
@@ -566,11 +606,13 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c
         $excludeTrashed = FALSE;
       }
     }
-    if (empty($where) && $excludeTrashed) {
-      $where = "WHERE contact_a.is_deleted != 1";
+    $trashClause = $excludeTrashed ? "contact_a.is_deleted != 1" : "( 1 )";
+
+    if (empty($where)) {
+      $where = "WHERE $trashClause";
     }
-    elseif ($excludeTrashed) {
-      $where .= " AND contact_a.is_deleted != 1";
+    else {
+      $where .= " AND $trashClause";
     }
 
     $queryString = "$select $from $where $having";
index 5873a2951924f558a0ff947e4d7ff560c7eed59b..2ed6edd9f23dd457fbf314c6eae5ff38db3a50c6 100644 (file)
@@ -207,7 +207,7 @@ class CRM_Financial_Page_AJAX {
           case 'remove':
             $recordPID = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialTrxn', $recordID, 'payment_instrument_id');
             $batchPID = CRM_Core_DAO::getFieldValue('CRM_Batch_DAO_Batch', $entityID, 'payment_instrument_id');
-            $paymentInstrument = CRM_Core_OptionGroup::getLabel('payment_instrument', $batchPID);
+            $paymentInstrument = CRM_Core_PseudoConstant::getLabel('CRM_Batch_BAO_Batch', 'payment_instrument_id', $batchPID);
             if ($op == 'remove' || ($recordPID == $batchPID && $op == 'assign') || !isset($batchPID)) {
               $params = array(
                 'entity_id' => $recordID,
index ddc75500558cb7b2241d520625dacb12568b3900..23ba4386176f0e516811c79f8cf551ea82b08476 100644 (file)
@@ -66,17 +66,17 @@ class CRM_Grant_Task {
     if (!(self::$_tasks)) {
       self::$_tasks = array(
         1 => array(
-          'title' => ts('Delete Grants'),
+          'title' => ts('Delete grants'),
           'class' => 'CRM_Grant_Form_Task_Delete',
           'result' => FALSE,
         ),
         2 => array(
-          'title' => ts('Print Selected Rows'),
+          'title' => ts('Print selected rows'),
           'class' => 'CRM_Grant_Form_Task_Print',
           'result' => FALSE,
         ),
         3 => array(
-          'title' => ts('Export Grants'),
+          'title' => ts('Export grants'),
           'class' => array(
             'CRM_Export_Form_Select',
             'CRM_Export_Form_Map',
@@ -84,7 +84,7 @@ class CRM_Grant_Task {
           'result' => FALSE,
         ),
         4 => array(
-          'title' => ts('Update Grants'),
+          'title' => ts('Update grants'),
           'class' => 'CRM_Grant_Form_Task_Update',
           'result' => FALSE,
         ),
index 57aea4ab912fbb93e61df753b6d4987af660eab8..54218d7fa11a863dc89a2fa9674e1dec9273d33e 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Import_DataSource_CSV extends CRM_Import_DataSource {
   const
@@ -53,14 +51,12 @@ class CRM_Import_DataSource_CSV extends CRM_Import_DataSource {
   }
 
   /**
-   * This is function is called by the form object to get the DataSource's
-   * form snippet. It should add all fields necesarry to get the data
+   * This is function is called by the form object to get the DataSource's form snippet.
+   *
+   * It should add all fields necessary to get the data
    * uploaded to the temporary table in the DB.
    *
    * @param CRM_Core_Form $form
-   *
-   * @return void
-   *   (operates directly on form argument)
    */
   public function buildQuickForm(&$form) {
     $form->add('hidden', 'hidden_dataSource', 'CRM_Import_DataSource_CSV');
index ee88ec526e9e58e50d74bddee3513db9d536397c..17c6c41c87c09906563714ca1f34b28981340261 100644 (file)
@@ -63,9 +63,8 @@ class CRM_Logging_Schema {
   public static function checkLoggingSupport(&$value, $fieldSpec) {
     $domain = new CRM_Core_DAO_Domain();
     $domain->find(TRUE);
-    $disabled = $domain->locales || !(CRM_Core_DAO::checkTriggerViewPermission(FALSE));
-    if ($disabled && $value) {
-      throw new API_Exception("In order to use this functionality, the installation's database user must have privileges to create triggers (in MySQL 5.0 â€“ and in MySQL 5.1 if binary logging is enabled â€“ this means the SUPER privilege). This install either does not seem to have the required privilege enabled. This functionality cannot be enabled on multilingual installations.");
+    if (!(CRM_Core_DAO::checkTriggerViewPermission(FALSE)) && $value) {
+      throw new API_Exception("In order to use this functionality, the installation's database user must have privileges to create triggers (in MySQL 5.0 â€“ and in MySQL 5.1 if binary logging is enabled â€“ this means the SUPER privilege). This install either does not seem to have the required privilege enabled.");
     }
     return TRUE;
   }
@@ -416,7 +415,7 @@ AND    TABLE_NAME LIKE 'log_civicrm_%'
 
     if (!isset($columnsOf[$table]) || $force) {
       $errorScope = CRM_Core_TemporaryErrorScope::ignoreException();
-      $dao = CRM_Core_DAO::executeQuery("SHOW COLUMNS FROM $from");
+      $dao = CRM_Core_DAO::executeQuery("SHOW COLUMNS FROM $from", CRM_Core_DAO::$_nullArray, TRUE, NULL, FALSE, FALSE);
       if (is_a($dao, 'DB_Error')) {
         return array();
       }
@@ -535,7 +534,7 @@ WHERE  table_schema IN ('{$this->db}', '{$civiDB}')";
    * Create a log table with schema mirroring the given table’s structure and seeding it with the given table’s contents.
    */
   private function createLogTableFor($table) {
-    $dao = CRM_Core_DAO::executeQuery("SHOW CREATE TABLE $table");
+    $dao = CRM_Core_DAO::executeQuery("SHOW CREATE TABLE $table", CRM_Core_DAO::$_nullArray, TRUE, NULL, FALSE, FALSE);
     $dao->fetch();
     $query = $dao->Create_Table;
 
@@ -563,10 +562,10 @@ COLS;
     $query = self::fixTimeStampAndNotNullSQL($query);
     $query = preg_replace("/^\) /m", "$cols\n) ", $query);
 
-    CRM_Core_DAO::executeQuery($query);
+    CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray, TRUE, NULL, FALSE, FALSE);
 
     $columns = implode(', ', $this->columnsOf($table));
-    CRM_Core_DAO::executeQuery("INSERT INTO `{$this->db}`.log_$table ($columns, log_conn_id, log_user_id, log_action) SELECT $columns, CONNECTION_ID(), @civicrm_user_id, 'Initialization' FROM {$table}");
+    CRM_Core_DAO::executeQuery("INSERT INTO `{$this->db}`.log_$table ($columns, log_conn_id, log_user_id, log_action) SELECT $columns, CONNECTION_ID(), @civicrm_user_id, 'Initialization' FROM {$table}", CRM_Core_DAO::$_nullArray, TRUE, NULL, FALSE, FALSE);
 
     $this->tables[] = $table;
     $this->logs[$table] = "log_$table";
index c6b375f801509c653f0bf311bb2fe11b52f112b8..be0727cf3476403a6228ef94f974fff4293e7bfe 100644 (file)
@@ -2033,6 +2033,7 @@ ORDER BY   civicrm_email.is_bulkmail DESC
       'unsubscribe',
       'optout',
       'opened',
+      'total_opened',
       'bounce',
       'spool',
     );
@@ -2055,6 +2056,8 @@ ORDER BY   civicrm_email.is_bulkmail DESC
       // CRM-1258
       $row['opened'] = CRM_Mailing_Event_BAO_Opened::getTotalCount($mailing_id, $mailing->id, TRUE);
       $report['event_totals']['opened'] += $row['opened'];
+      $row['total_opened'] = CRM_Mailing_Event_BAO_Opened::getTotalCount($mailing_id, $mailing->id);
+      $report['event_totals']['total_opened'] += $row['total_opened'];
 
       // compute unsub total separately to discount duplicates
       // CRM-1783
@@ -2400,9 +2403,18 @@ ORDER BY   civicrm_email.is_bulkmail DESC
 
     // get all the groups that this user can access
     // if they dont have universal access
-    $groups = CRM_Core_PseudoConstant::group(NULL, FALSE);
+    $groupNames = civicrm_api3('Group', 'get', array(
+      'is_active' => 1,
+      'check_permissions' => TRUE,
+      'return' => array('title', 'id'),
+      'options' => array('limit' => 0),
+    ));
+    foreach ($groupNames['values'] as $group) {
+      $groups[$group['id']] = $group['title'];
+    }
     if (!empty($groups)) {
       $groupIDs = implode(',', array_keys($groups));
+      $domain_id = CRM_Core_Config::domainID();
 
       // get all the mailings that are in this subset of groups
       $query = "
@@ -2410,7 +2422,7 @@ SELECT    DISTINCT( m.id ) as id
   FROM    civicrm_mailing m
 LEFT JOIN civicrm_mailing_group g ON g.mailing_id   = m.id
  WHERE ( ( g.entity_table like 'civicrm_group%' AND g.entity_id IN ( $groupIDs ) )
-    OR   ( g.entity_table IS NULL AND g.entity_id IS NULL ) )
+    OR   ( g.entity_table IS NULL AND g.entity_id IS NULL AND m.domain_id = $domain_id ) )
 ";
       $dao = CRM_Core_DAO::executeQuery($query);
 
index 7b8e0cd0c2b1bd453d9f4fb4aa6fbe695dcc81a9..983a690f3fe86fecf1aa6b3496bf8a8d2b87fa52 100644 (file)
@@ -123,6 +123,12 @@ class CRM_Mailing_BAO_Query {
         $query->_element['mailing_recipients_id'] = 1;
       }
     }
+
+    if (CRM_Utils_Array::value('mailing_campaign_id', $query->_returnProperties)) {
+      $query->_select['mailing_campaign_id'] = 'civicrm_mailing.campaign_id as mailing_campaign_id';
+      $query->_element['mailing_campaign_id'] = 1;
+      $query->_tables['civicrm_campaign'] = 1;
+    }
   }
 
   /**
@@ -207,6 +213,7 @@ class CRM_Mailing_BAO_Query {
     if ($mode & CRM_Contact_BAO_Query::MODE_MAILING) {
       $properties = array(
         'mailing_id' => 1,
+        'mailing_campaign_id' => 1,
         'mailing_name' => 1,
         'sort_name' => 1,
         'email' => 1,
@@ -375,6 +382,15 @@ class CRM_Mailing_BAO_Query {
           $query->_qill[$grouping][] = "Mailing Job Status IS \"$value\"";
         }
         return;
+
+      case 'mailing_campaign_id':
+        $name = 'campaign_id';
+        CRM_Contact_BAO_Query::buildClause("civicrm_mailing.$name", $op, $value, 'Integer');
+        list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Mailing_DAO_Mailing', $name, $value, $op);
+        $query->_qill[$grouping][] = ts('Campaign %1 %2', array(1 => $op, 2 => $value));
+        $query->_tables['civicrm_mailing'] = $query->_whereTables['civicrm_mailing'] = 1;
+        $query->_tables['civicrm_mailing_recipients'] = $query->_whereTables['civicrm_mailing_recipients'] = 1;
+        return;
     }
   }
 
@@ -423,6 +439,8 @@ class CRM_Mailing_BAO_Query {
     $form->add('checkbox', 'mailing_unsubscribe', ts('Unsubscribe Requests'));
     $form->add('checkbox', 'mailing_optout', ts('Opt-out Requests'));
     $form->add('checkbox', 'mailing_forward', ts('Forwards'));
+    // Campaign select field
+    CRM_Campaign_BAO_Campaign::addCampaignInComponentSearch($form, 'mailing_campaign_id');
 
     $form->assign('validCiviMailing', TRUE);
   }
index 7a772096c277d94d11c646c281d07d59bd765e65..acf3fd2a2bca511a4fecfa9d51ead3451b0c107d 100644 (file)
@@ -46,69 +46,29 @@ class CRM_Mailing_Controller_Send extends CRM_Core_Controller {
   public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
     parent::__construct($title, $modal, NULL, FALSE, TRUE);
 
-    if (!defined('CIVICRM_CIVIMAIL_UI_LEGACY')) {
-      // New:            civicrm/mailing/send?reset=1
-      // Re-use:         civicrm/mailing/send?reset=1&mid=%%mid%%
-      // Continue:       civicrm/mailing/send?reset=1&mid=%%mid%%&continue=true
-      $mid = CRM_Utils_Request::retrieve('mid', 'Positive');
-      $continue = CRM_Utils_Request::retrieve('continue', 'String');
-      if (!$mid) {
-        CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/a/', NULL, TRUE, '/mailing/new'));
-      }
-      if ($mid && $continue) {
-        //CRM-15979 - check if abtest exist for mailing then redirect accordingly
-        $abtest = CRM_Mailing_BAO_MailingAB::getABTest($mid);
-        if (!empty($abtest) && !empty($abtest->id)) {
-          $redirect = CRM_Utils_System::url('civicrm/a/', NULL, TRUE, '/abtest/' . $abtest->id);
-        }
-        else {
-          $redirect = CRM_Utils_System::url('civicrm/a/', NULL, TRUE, '/mailing/' . $mid);
-        }
-        CRM_Utils_System::redirect($redirect);
+    // New:            civicrm/mailing/send?reset=1
+    // Re-use:         civicrm/mailing/send?reset=1&mid=%%mid%%
+    // Continue:       civicrm/mailing/send?reset=1&mid=%%mid%%&continue=true
+    $mid = CRM_Utils_Request::retrieve('mid', 'Positive');
+    $continue = CRM_Utils_Request::retrieve('continue', 'String');
+    if (!$mid) {
+      CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/a/', NULL, TRUE, '/mailing/new'));
+    }
+    if ($mid && $continue) {
+      //CRM-15979 - check if abtest exist for mailing then redirect accordingly
+      $abtest = CRM_Mailing_BAO_MailingAB::getABTest($mid);
+      if (!empty($abtest) && !empty($abtest->id)) {
+        $redirect = CRM_Utils_System::url('civicrm/a/', NULL, TRUE, '/abtest/' . $abtest->id);
       }
-      if ($mid && !$continue) {
-        $clone = civicrm_api3('Mailing', 'clone', array('id' => $mid));
-        CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/a/', NULL, TRUE, '/mailing/' . $clone['id']));
+      else {
+        $redirect = CRM_Utils_System::url('civicrm/a/', NULL, TRUE, '/mailing/' . $mid);
       }
+      CRM_Utils_System::redirect($redirect);
     }
-
-    $mailingID = CRM_Utils_Request::retrieve('mid', 'String', $this, FALSE, NULL);
-
-    // also get the text and html file
-    $txtFile = CRM_Utils_Request::retrieve('txtFile', 'String',
-      CRM_Core_DAO::$_nullObject, FALSE, NULL
-    );
-    $htmlFile = CRM_Utils_Request::retrieve('htmlFile', 'String',
-      CRM_Core_DAO::$_nullObject, FALSE, NULL
-    );
-
-    $config = CRM_Core_Config::singleton();
-    if ($txtFile &&
-      file_exists($config->uploadDir . $txtFile)
-    ) {
-      $this->set('textFilePath', $config->uploadDir . $txtFile);
+    if ($mid && !$continue) {
+      $clone = civicrm_api3('Mailing', 'clone', array('id' => $mid));
+      CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/a/', NULL, TRUE, '/mailing/' . $clone['id']));
     }
-
-    if ($htmlFile &&
-      file_exists($config->uploadDir . $htmlFile)
-    ) {
-      $this->set('htmlFilePath', $config->uploadDir . $htmlFile);
-    }
-
-    $this->_stateMachine = new CRM_Mailing_StateMachine_Send($this, $action, $mailingID);
-
-    // create and instantiate the pages
-    $this->addPages($this->_stateMachine, $action);
-
-    // add all the actions
-    $uploadNames = array_merge(array('textFile', 'htmlFile'),
-      CRM_Core_BAO_File::uploadNames()
-    );
-
-    $config = CRM_Core_Config::singleton();
-    $this->addActions($config->uploadDir,
-      $uploadNames
-    );
   }
 
 }
diff --git a/CRM/Mailing/Form/Group.php b/CRM/Mailing/Form/Group.php
deleted file mode 100644 (file)
index dcca8af..0000000
+++ /dev/null
@@ -1,610 +0,0 @@
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.7                                                |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM.                                    |
- |                                                                    |
- | CiviCRM is free software; you can copy, modify, and distribute it  |
- | under the terms of the GNU Affero General Public License           |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
- |                                                                    |
- | CiviCRM is distributed in the hope that it will be useful, but     |
- | WITHOUT ANY WARRANTY; without even the implied warranty of         |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
- | See the GNU Affero General Public License for more details.        |
- |                                                                    |
- | You should have received a copy of the GNU Affero General Public   |
- | License and the CiviCRM Licensing Exception along                  |
- | with this program; if not, contact CiviCRM LLC                     |
- | at info[AT]civicrm[DOT]org. If you have questions about the        |
- | GNU Affero General Public License or the licensing of CiviCRM,     |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
- +--------------------------------------------------------------------+
- */
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-/**
- * Choose include / exclude groups and mailings
- *
- */
-class CRM_Mailing_Form_Group extends CRM_Contact_Form_Task {
-
-  /**
-   * The mailing ID of the mailing if we are resuming a mailing.
-   *
-   * @var integer
-   */
-  protected $_mailingID;
-
-  /**
-   * Set variables up before form is built.
-   *
-   * @return void
-   */
-  public function preProcess() {
-    if (CRM_Core_BAO_MailSettings::defaultDomain() == "EXAMPLE.ORG") {
-      CRM_Core_Error::fatal(ts('The <a href="%1">default mailbox</a> has not been configured. You will find <a href="%2">more info in our online user and administrator guide.</a>', array(
-            1 => CRM_Utils_System::url('civicrm/admin/mailSettings', 'reset=1'),
-            2 => "http://book.civicrm.org/user/advanced-configuration/email-system-configuration/",
-          )));
-    }
-
-    $this->_mailingID = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE, NULL);
-
-    // when user come from search context.
-    $this->_searchBasedMailing = CRM_Contact_Form_Search::isSearchContext($this->get('context'));
-    if ($this->_searchBasedMailing) {
-      $searchParams = $this->controller->exportValues();
-      // number of records that were selected - All or Few.
-      $this->_resultSelectOption = $searchParams['radio_ts'];
-      if (CRM_Utils_Array::value('task', $searchParams) == 20) {
-        parent::preProcess();
-      }
-    }
-
-    $session = CRM_Core_Session::singleton();
-    if ($this->_searchBasedMailing) {
-      $config = CRM_Core_Config::singleton();
-      $path = CRM_Utils_Array::value($config->userFrameworkURLVar, $_GET);
-      $qfKey = CRM_Utils_Array::value('qfKey', $_GET);
-      if ($qfKey) {
-        $session->pushUserContext(CRM_Utils_System::url($path, "qfKey=$qfKey"));
-      }
-      else {
-        $session->pushUserContext(CRM_Utils_System::url('civicrm/mailing', 'reset=1'));
-      }
-    }
-    elseif (strpos($session->readUserContext(), 'civicrm/mailing') === FALSE) {
-      // use previous context unless mailing is not schedule, CRM-4290
-      $session->pushUserContext(CRM_Utils_System::url('civicrm/mailing', 'reset=1'));
-    }
-  }
-
-  /**
-   * Set default values for the form.
-   * the default values are retrieved from the database
-   *
-   *
-   * @return void
-   */
-  public function setDefaultValues() {
-    $continue = CRM_Utils_Request::retrieve('continue', 'String', $this, FALSE, NULL);
-
-    $defaults = array();
-    $defaults['dedupe_email'] = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME,
-      'dedupe_email_default', NULL, FALSE
-    );
-    if ($this->_mailingID) {
-      // check that the user has permission to access mailing id
-      CRM_Mailing_BAO_Mailing::checkPermission($this->_mailingID);
-
-      $mailing = new CRM_Mailing_DAO_Mailing();
-      $mailing->id = $this->_mailingID;
-      $mailing->addSelect('name', 'campaign_id');
-      $mailing->find(TRUE);
-
-      $defaults['name'] = $mailing->name;
-      if (!$continue) {
-        $defaults['name'] = ts('Copy of %1', array(1 => $mailing->name));
-      }
-      else {
-        // CRM-7590, reuse same mailing ID if we are continuing
-        $this->set('mailing_id', $this->_mailingID);
-      }
-
-      $defaults['campaign_id'] = $mailing->campaign_id;
-      $defaults['dedupe_email'] = $mailing->dedupe_email;
-      $defaults['location_type_id'] = $mailing->location_type_id;
-      $defaults['email_selection_method'] = $mailing->email_selection_method;
-
-      $dao = new CRM_Mailing_DAO_MailingGroup();
-
-      $mailingGroups = array(
-        'civicrm_group' => array(),
-        'civicrm_mailing' => array(),
-      );
-      $dao->mailing_id = $this->_mailingID;
-      $dao->find();
-      while ($dao->fetch()) {
-        // account for multi-lingual
-        // CRM-11431
-        $entityTable = 'civicrm_group';
-        if (substr($dao->entity_table, 0, 15) == 'civicrm_mailing') {
-          $entityTable = 'civicrm_mailing';
-        }
-        $mailingGroups[$entityTable][$dao->group_type][] = $dao->entity_id;
-      }
-
-      $defaults['includeGroups'] = CRM_Utils_Array::value('Include', $mailingGroups['civicrm_group']);
-      $defaults['excludeGroups'] = CRM_Utils_Array::value('Exclude', $mailingGroups['civicrm_group']);
-
-      if (!empty($mailingGroups['civicrm_mailing'])) {
-        $defaults['includeMailings'] = CRM_Utils_Array::value('Include', $mailingGroups['civicrm_mailing']);
-        $defaults['excludeMailings'] = CRM_Utils_Array::value('Exclude', $mailingGroups['civicrm_mailing']);
-      }
-    }
-
-    //when the context is search hide the mailing recipients.
-    $showHide = new CRM_Core_ShowHideBlocks();
-    $showGroupSelector = TRUE;
-    if ($this->_searchBasedMailing) {
-      $showGroupSelector = FALSE;
-      $formElements = array('includeGroups', 'excludeGroups', 'includeMailings', 'excludeMailings');
-      $formValues = $this->controller->exportValues($this->_name);
-      foreach ($formElements as $element) {
-        if (!empty($formValues[$element])) {
-          $showGroupSelector = TRUE;
-          break;
-        }
-      }
-    }
-
-    if ($showGroupSelector) {
-      $showHide->addShow("id-additional");
-      $showHide->addHide("id-additional-show");
-    }
-    else {
-      $showHide->addShow("id-additional-show");
-      $showHide->addHide("id-additional");
-    }
-    $showHide->addToTemplate();
-
-    return $defaults;
-  }
-
-  /**
-   * Build the form object.
-   *
-   * @return void
-   */
-  public function buildQuickForm() {
-
-    //get the context
-    $context = $this->get('context');
-    if ($this->_searchBasedMailing) {
-      $context = 'search';
-    }
-    $this->assign('context', $context);
-
-    $this->add('text', 'name', ts('Name Your Mailing'),
-      CRM_Core_DAO::getAttribute('CRM_Mailing_DAO_Mailing', 'name'),
-      TRUE
-    );
-
-    $hiddenMailingGroup = NULL;
-    $campaignId = NULL;
-
-    //CRM-7362 --add campaigns.
-    if ($this->_mailingID) {
-      $campaignId = CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Mailing', $this->_mailingID, 'campaign_id');
-      $hiddenMailingGroup = CRM_Mailing_BAO_Mailing::hiddenMailingGroup($this->_mailingID);
-    }
-    CRM_Campaign_BAO_Campaign::addCampaign($this, $campaignId);
-
-    //dedupe on email option
-    $this->addElement('checkbox', 'dedupe_email', ts('Remove duplicate emails?'));
-
-    // location types
-    $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array('id' => 'display_name'));
-    $this->addElement('select', 'location_type_id', ts("Location Type"), array('' => ts('Automatic')) + $locationTypes);
-
-    $methods = CRM_Core_SelectValues::emailSelectMethods();
-    $this->addElement('select', 'email_selection_method', ts("Email Selection Method"), $methods);
-
-    //get the mailing groups.
-    $groups = CRM_Core_PseudoConstant::nestedGroup('Mailing');
-    if ($hiddenMailingGroup) {
-      $groups[$hiddenMailingGroup]
-        = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $hiddenMailingGroup, 'title');
-    }
-
-    $mailings = CRM_Mailing_PseudoConstant::completed();
-    if (!$mailings) {
-      $mailings = array();
-    }
-
-    // run the groups through a hook so users can trim it if needed
-    CRM_Utils_Hook::mailingGroups($this, $groups, $mailings);
-
-    //when the context is search add base group's.
-    if ($this->_searchBasedMailing) {
-      //CRM-16600 Include Smart Groups in Unsubscribe list as that matches
-      //all other practices in CiviMail
-      $this->add('select', 'baseGroup',
-        ts('Unsubscription Group'),
-        array(
-          '' => ts('- select -'),
-        ) + $groups,
-        TRUE,
-        array('class' => 'crm-select2 huge')
-      );
-    }
-
-    $select2style = array(
-      'multiple' => TRUE,
-      'style' => 'width: 100%; max-width: 60em;',
-      'class' => 'crm-select2',
-      'placeholder' => ts('- select -'),
-    );
-
-    $this->add('select', 'includeGroups',
-      ts('Include Group(s)'),
-      $groups,
-      !$this->_searchBasedMailing,
-      $select2style
-    );
-
-    $this->add('select', 'excludeGroups',
-      ts('Exclude Group(s)'),
-      $groups,
-      FALSE,
-      $select2style
-    );
-
-    $this->add('select', 'includeMailings',
-      ts('INCLUDE Recipients of These Mailing(s)') . ' ',
-      $mailings,
-      FALSE,
-      $select2style
-    );
-    $this->add('select', 'excludeMailings',
-      ts('EXCLUDE Recipients of These Mailing(s)') . ' ',
-      $mailings,
-      FALSE,
-      $select2style
-    );
-
-    $this->addFormRule(array('CRM_Mailing_Form_Group', 'formRule'));
-
-    $buttons = array(
-      array(
-        'type' => 'next',
-        'name' => ts('Next'),
-        'spacing' => '&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;',
-        'isDefault' => TRUE,
-      ),
-      array(
-        'type' => 'submit',
-        'name' => ts('Save & Continue Later'),
-      ),
-      array(
-        'type' => 'cancel',
-        'name' => ts('Cancel'),
-      ),
-    );
-
-    $this->addButtons($buttons);
-
-    $this->assign('groupCount', count($groups));
-    $this->assign('mailingCount', count($mailings));
-    if (count($groups) == 0 && count($mailings) == 0 && !$this->_searchBasedMailing) {
-      CRM_Core_Error::statusBounce("To send a mailing, you must have a valid group of recipients - either at least one group that's a Mailing List or at least one previous mailing or start from a search");
-    }
-  }
-
-  public function postProcess() {
-    $values = $this->controller->exportValues($this->_name);
-
-    //build hidden smart group. when user want to send  mailing
-    //through search contact-> more action -> send Mailing. CRM-3711
-    $groups = array();
-    if ($this->_searchBasedMailing && $this->_contactIds) {
-      $session = CRM_Core_Session::singleton();
-
-      if ($this->_resultSelectOption == 'ts_sel') {
-        // create a static grp if only a subset of result set was selected:
-
-        $randID = md5(time());
-        $grpTitle = "Hidden Group {$randID}";
-        $grpID = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $grpTitle, 'id', 'title');
-
-        if (!$grpID) {
-          $groupParams = array(
-            'title' => $grpTitle,
-            'is_active' => 1,
-            'is_hidden' => 1,
-            'group_type' => array('2' => 1),
-          );
-
-          $group = CRM_Contact_BAO_Group::create($groupParams);
-          $grpID = $group->id;
-
-          CRM_Contact_BAO_GroupContact::addContactsToGroup($this->_contactIds, $group->id);
-
-          $newGroupTitle = "Hidden Group {$grpID}";
-          $groupParams = array(
-            'id' => $grpID,
-            'name' => CRM_Utils_String::titleToVar($newGroupTitle),
-            'title' => $newGroupTitle,
-            'group_type' => array('2' => 1),
-          );
-          $group = CRM_Contact_BAO_Group::create($groupParams);
-        }
-
-        // note at this point its a static group
-        $smartGroupId = $grpID;
-      }
-      else {
-        //get the hidden smart group id.
-        $ssId = $this->get('ssID');
-        $hiddenSmartParams = array(
-          'group_type' => array('2' => 1),
-          'form_values' => $this->get('formValues'),
-          'saved_search_id' => $ssId,
-          'search_custom_id' => $this->get('customSearchID'),
-          'search_context' => $this->get('context'),
-        );
-
-        list($smartGroupId, $savedSearchId) = CRM_Contact_BAO_Group::createHiddenSmartGroup($hiddenSmartParams);
-
-        //set the saved search id.
-        if (!$ssId) {
-          if ($savedSearchId) {
-            $this->set('ssID', $savedSearchId);
-          }
-          else {
-            CRM_Core_Error::fatal();
-          }
-        }
-      }
-
-      //get the base group for this mailing, CRM-3711
-      $groups['base'] = array($values['baseGroup']);
-      $values['includeGroups'][] = $smartGroupId;
-    }
-
-    foreach (
-      array(
-        'name',
-        'group_id',
-        'search_id',
-        'search_args',
-        'campaign_id',
-        'dedupe_email',
-        'location_type_id',
-        'email_selection_method',
-      ) as $n
-    ) {
-      if (!empty($values[$n])) {
-        $params[$n] = $values[$n];
-      }
-    }
-
-    $qf_Group_submit = $this->controller->exportValue($this->_name, '_qf_Group_submit');
-    $this->set('name', $params['name']);
-
-    $inGroups = $values['includeGroups'];
-    $outGroups = $values['excludeGroups'];
-    $inMailings = $values['includeMailings'];
-    $outMailings = $values['excludeMailings'];
-
-    if (is_array($inGroups)) {
-      foreach ($inGroups as $key => $id) {
-        if ($id) {
-          $groups['include'][] = $id;
-        }
-      }
-    }
-    if (is_array($outGroups)) {
-      foreach ($outGroups as $key => $id) {
-        if ($id) {
-          $groups['exclude'][] = $id;
-        }
-      }
-    }
-
-    $mailings = array();
-    if (is_array($inMailings)) {
-      foreach ($inMailings as $key => $id) {
-        if ($id) {
-          $mailings['include'][] = $id;
-        }
-      }
-    }
-    if (is_array($outMailings)) {
-      foreach ($outMailings as $key => $id) {
-        if ($id) {
-          $mailings['exclude'][] = $id;
-        }
-      }
-    }
-
-    $session = CRM_Core_Session::singleton();
-    $params['groups'] = $groups;
-    $params['mailings'] = $mailings;
-    $ids = array();
-    if ($this->get('mailing_id')) {
-
-      // don't create a new mailing if already exists
-      $ids['mailing_id'] = $this->get('mailing_id');
-
-      $groupTableName = CRM_Contact_BAO_Group::getTableName();
-      $mailingTableName = CRM_Mailing_BAO_Mailing::getTableName();
-
-      // delete previous includes/excludes, if mailing already existed
-      foreach (array('groups', 'mailings') as $entity) {
-        $mg = new CRM_Mailing_DAO_MailingGroup();
-        $mg->mailing_id = $ids['mailing_id'];
-        $mg->entity_table = ($entity == 'groups') ? $groupTableName : $mailingTableName;
-        $mg->find();
-        while ($mg->fetch()) {
-          $mg->delete();
-        }
-      }
-    }
-    else {
-      // new mailing, so lets set the created_id
-      $session = CRM_Core_Session::singleton();
-      $params['created_id'] = $session->get('userID');
-      $params['created_date'] = date('YmdHis');
-    }
-    $mailing = CRM_Mailing_BAO_Mailing::create($params, $ids);
-    $this->set('mailing_id', $mailing->id);
-
-    $dedupeEmail = FALSE;
-    if (isset($params['dedupe_email'])) {
-      $dedupeEmail = $params['dedupe_email'];
-    }
-
-    // mailing id should be added to the form object
-    $this->_mailingID = $mailing->id;
-
-    // also compute the recipients and store them in the mailing recipients table
-    CRM_Mailing_BAO_Mailing::getRecipients(
-      $mailing->id,
-      $mailing->id,
-      TRUE,
-      $dedupeEmail
-    );
-
-    $count = CRM_Mailing_BAO_Recipients::mailingSize($mailing->id);
-    $this->set('count', $count);
-    $this->assign('count', $count);
-    $this->set('groups', $groups);
-    $this->set('mailings', $mailings);
-
-    if ($qf_Group_submit) {
-      //when user perform mailing from search context
-      //redirect it to search result CRM-3711.
-      $ssID = $this->get('ssID');
-      $context = $this->get('context');
-      if ($ssID && $this->_searchBasedMailing) {
-        if ($this->_action == CRM_Core_Action::BASIC) {
-          $fragment = 'search';
-        }
-        elseif ($this->_action == CRM_Core_Action::PROFILE) {
-          $fragment = 'search/builder';
-        }
-        elseif ($this->_action == CRM_Core_Action::ADVANCED) {
-          $fragment = 'search/advanced';
-        }
-        else {
-          $fragment = 'search/custom';
-        }
-
-        $context = $this->get('context');
-        if (!CRM_Contact_Form_Search::isSearchContext($context)) {
-          $context = 'search';
-        }
-        $urlParams = "force=1&reset=1&ssID={$ssID}&context={$context}";
-
-        $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
-        if (CRM_Utils_Rule::qfKey($qfKey)) {
-          $urlParams .= "&qfKey=$qfKey";
-        }
-
-        $draftURL = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'scheduled=false&reset=1');
-        $status = ts("You can continue later by clicking the 'Continue' action to resume working on it.<br />From <a href='%1'>Draft and Unscheduled Mailings</a>.", array(1 => $draftURL));
-
-        // Redirect user to search.
-        $url = CRM_Utils_System::url('civicrm/contact/' . $fragment, $urlParams);
-      }
-      else {
-        $status = ts("Click the 'Continue' action to resume working on it.");
-        $url = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'scheduled=false&reset=1');
-      }
-      CRM_Core_Session::setStatus($status, ts('Mailing Saved'), 'success');
-      return $this->controller->setDestination($url);
-    }
-  }
-
-  /**
-   * Display Name of the form.
-   *
-   *
-   * @return string
-   */
-  public function getTitle() {
-    return ts('Select Recipients');
-  }
-
-  /**
-   * Global validation rules for the form.
-   *
-   * @param array $fields
-   *   Posted values of the form.
-   *
-   * @return array
-   *   list of errors to be posted back to the form
-   */
-  public static function formRule($fields) {
-    $errors = array();
-    if (isset($fields['includeGroups']) &&
-      is_array($fields['includeGroups']) &&
-      isset($fields['excludeGroups']) &&
-      is_array($fields['excludeGroups'])
-    ) {
-      $checkGroups = array();
-      $checkGroups = array_intersect($fields['includeGroups'], $fields['excludeGroups']);
-      if (!empty($checkGroups)) {
-        $errors['excludeGroups'] = ts('Cannot have same groups in Include Group(s) and Exclude Group(s).');
-      }
-    }
-
-    if (isset($fields['includeMailings']) &&
-      is_array($fields['includeMailings']) &&
-      isset($fields['excludeMailings']) &&
-      is_array($fields['excludeMailings'])
-    ) {
-      $checkMailings = array();
-      $checkMailings = array_intersect($fields['includeMailings'], $fields['excludeMailings']);
-      if (!empty($checkMailings)) {
-        $errors['excludeMailings'] = ts('Cannot have same mail in Include mailing(s) and Exclude mailing(s).');
-      }
-    }
-
-    if (!empty($fields['search_id']) &&
-      empty($fields['group_id'])
-    ) {
-      $errors['group_id'] = ts('You must select a group to filter on');
-    }
-
-    if (empty($fields['search_id']) &&
-      !empty($fields['group_id'])
-    ) {
-      $errors['search_id'] = ts('You must select a search to filter');
-    }
-
-    if (!empty($fields['location_type_id'])) {
-      if ($fields['email_selection_method'] == 'automatic') {
-        $errors['location_type_id'] = ts("If 'Email Selection Method' is automatic, you are not allowed to choose any 'Location Type'");
-      }
-    }
-    elseif ($fields['email_selection_method'] != 'automatic') {
-      $errors['email_selection_method'] = ts("If 'Location Type' is not selected, you must set the 'Email Selection Method' to automatic as well.");
-    }
-
-    return empty($errors) ? TRUE : $errors;
-  }
-
-}
diff --git a/CRM/Mailing/Form/Schedule.php b/CRM/Mailing/Form/Schedule.php
deleted file mode 100644 (file)
index bed7590..0000000
+++ /dev/null
@@ -1,361 +0,0 @@
-<?php
-/*
-  +--------------------------------------------------------------------+
-  | CiviCRM version 4.7                                                |
-  +--------------------------------------------------------------------+
-  | Copyright CiviCRM LLC (c) 2004-2015                                |
-  +--------------------------------------------------------------------+
-  | This file is a part of CiviCRM.                                    |
-  |                                                                    |
-  | CiviCRM is free software; you can copy, modify, and distribute it  |
-  | under the terms of the GNU Affero General Public License           |
-  | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
-  |                                                                    |
-  | CiviCRM is distributed in the hope that it will be useful, but     |
-  | WITHOUT ANY WARRANTY; without even the implied warranty of         |
-  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
-  | See the GNU Affero General Public License for more details.        |
-  |                                                                    |
-  | You should have received a copy of the GNU Affero General Public   |
-  | License and the CiviCRM Licensing Exception along                  |
-  | with this program; if not, contact CiviCRM LLC                     |
-  | at info[AT]civicrm[DOT]org. If you have questions about the        |
-  | GNU Affero General Public License or the licensing of CiviCRM,     |
-  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
-  +--------------------------------------------------------------------+
- */
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-/**
- *
- */
-class CRM_Mailing_Form_Schedule extends CRM_Core_Form {
-
-  /**
-   * Set variables up before form is built.
-   *
-   * @return void
-   */
-  public function preProcess() {
-    if (CRM_Mailing_Info::workflowEnabled() &&
-      !CRM_Core_Permission::check('schedule mailings') &&
-      !CRM_Core_Permission::check('access CiviMail')
-    ) {
-      $url = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'reset=1&scheduled=false');
-      CRM_Utils_System::redirect($url);
-    }
-
-    //when user come from search context.
-    $ssID = $this->get('ssID');
-    $this->assign('ssid', $ssID);
-    $this->_searchBasedMailing = CRM_Contact_Form_Search::isSearchContext($this->get('context'));
-    if (CRM_Contact_Form_Search::isSearchContext($this->get('context')) && !$ssID) {
-      $params = array();
-      $result = CRM_Core_BAO_PrevNextCache::getSelectedContacts();
-      $this->assign("value", $result);
-    }
-    $this->_mailingID = $this->get('mailing_id');
-    $this->_scheduleFormOnly = FALSE;
-    if (!$this->_mailingID) {
-      $this->_mailingID = CRM_Utils_Request::retrieve('mid', 'Integer', $this, TRUE);
-      $this->_scheduleFormOnly = TRUE;
-    }
-  }
-
-  /**
-   * Set default values for the form.
-   *
-   *
-   * @return void
-   */
-  public function setDefaultValues() {
-    $defaults = array();
-    if ($this->_scheduleFormOnly) {
-      $count = CRM_Mailing_BAO_Recipients::mailingSize($this->_mailingID);
-    }
-    else {
-      $count = $this->get('count');
-    }
-    $this->assign('count', $count);
-    $defaults['now'] = 1;
-    return $defaults;
-  }
-
-  /**
-   * Build the form object for the last step of the mailing wizard.
-   *
-   * @param
-   *
-   * @return void
-   */
-  public function buildQuickform() {
-    $this->addDateTime('start_date', ts('Schedule Mailing'), FALSE, array('formatType' => 'mailing'));
-
-    $this->addElement('checkbox', 'now', ts('Send Immediately'));
-
-    $this->addFormRule(array('CRM_Mailing_Form_Schedule', 'formRule'), $this);
-
-    if ($this->_scheduleFormOnly) {
-      $title = ts('Schedule Mailing') . ' - ' . CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Mailing',
-          $this->_mailingID,
-          'name'
-        );
-      CRM_Utils_System::setTitle($title);
-      $buttons = array(
-        array(
-          'type' => 'next',
-          'name' => ts('Submit Mailing'),
-          'spacing' => '&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;',
-          'isDefault' => TRUE,
-        ),
-        array(
-          'type' => 'cancel',
-          'name' => ts('Cancel'),
-        ),
-      );
-    }
-    else {
-      //FIXME : currently we are hiding save an continue later when
-      //search base mailing, we should handle it when we fix CRM-3876
-      if ($this->_searchBasedMailing) {
-        $buttons = array(
-          array(
-            'type' => 'back',
-            'name' => ts('Previous'),
-          ),
-          array(
-            'type' => 'next',
-            'name' => ts('Submit Mailing'),
-            'spacing' => '&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;',
-            'isDefault' => TRUE,
-          ),
-        );
-      }
-      else {
-        $buttons = array(
-          array(
-            'type' => 'back',
-            'name' => ts('Previous'),
-          ),
-          array(
-            'type' => 'next',
-            'name' => ts('Submit Mailing'),
-            'spacing' => '&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;',
-            'isDefault' => TRUE,
-            'js' => array('onclick' => "return submitOnce(this,'" . $this->_name . "','" . ts('Processing') . "');"),
-          ),
-          array(
-            'type' => 'cancel',
-            'name' => ts('Continue Later'),
-          ),
-        );
-      }
-    }
-    $this->addButtons($buttons);
-
-    if (CRM_Mailing_Info::workflowEnabled() &&
-      $this->_scheduleFormOnly
-    ) {
-      // add the preview elements
-      $preview = array();
-      $preview['type'] = CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Mailing', $this->_mailingID, 'body_html') ? 'html' : 'text';
-      $preview['subject'] = CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Mailing',
-        $this->_mailingID,
-        'subject'
-      );
-
-      $mailingKey = $this->_mailingID;
-      if ($hash = CRM_Mailing_BAO_Mailing::getMailingHash($mailingKey)) {
-        $mailingKey = $hash;
-      }
-
-      $preview['viewURL'] = CRM_Utils_System::url('civicrm/mailing/view', "reset=1&id={$mailingKey}");
-
-      $preview['attachment'] = CRM_Core_BAO_File::attachmentInfo('civicrm_mailing', $this->_mailingID);
-
-      $this->assign_by_ref('preview', $preview);
-    }
-  }
-
-  /**
-   * Form rule to validate the date selector and/or if we should deliver
-   * immediately.
-   *
-   * Warning: if you make changes here, be sure to also make them in
-   * Retry.php
-   *
-   * @param array $params
-   *   The form values.
-   *
-   * @param $files
-   * @param $self
-   *
-   * @return bool
-   *   True if either we deliver immediately, or the
-   *                          date is properly set.
-   */
-  public static function formRule($params, $files, $self) {
-    if (!empty($params['_qf_Schedule_submit'])) {
-      //when user perform mailing from search context
-      //redirect it to search result CRM-3711.
-      $ssID = $self->get('ssID');
-      if ($ssID && $self->_searchBasedMailing) {
-        if ($self->_action == CRM_Core_Action::BASIC) {
-          $fragment = 'search';
-        }
-        elseif ($self->_action == CRM_Core_Action::PROFILE) {
-          $fragment = 'search/builder';
-        }
-        elseif ($self->_action == CRM_Core_Action::ADVANCED) {
-          $fragment = 'search/advanced';
-        }
-        else {
-          $fragment = 'search/custom';
-        }
-
-        $draftURL = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'scheduled=false&reset=1');
-        $status = ts("Your mailing has been saved. You can continue later by clicking the 'Continue' action to resume working on it.<br />From <a href='%1'>Draft and Unscheduled Mailings</a>.", array(1 => $draftURL));
-        CRM_Core_Session::setStatus($status, ts('Mailing Saved'), 'success');
-
-        //replace user context to search.
-        $context = $self->get('context');
-        if (!CRM_Contact_Form_Search::isSearchContext($context)) {
-          $context = 'search';
-        }
-
-        $urlParams = "force=1&reset=1&ssID={$ssID}&context={$context}";
-        $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $self);
-        if (CRM_Utils_Rule::qfKey($qfKey)) {
-          $urlParams .= "&qfKey=$qfKey";
-        }
-        $url = CRM_Utils_System::url('civicrm/contact/' . $fragment, "force=1&reset=1&ssID={$ssID}");
-      }
-      else {
-        $status = ts("Click the 'Continue' action to resume working on it.");
-        $url = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'scheduled=false&reset=1');
-      }
-      CRM_Core_Session::setStatus($status, ts('Mailing Saved'), 'success');
-      CRM_Utils_System::redirect($url);
-    }
-    if (isset($params['now']) || CRM_Utils_Array::value('_qf_Schedule_back', $params) == ts('Previous')) {
-      return TRUE;
-    }
-
-    if (CRM_Utils_Date::format(CRM_Utils_Date::processDate($params['start_date'],
-        $params['start_date_time']
-      )) < CRM_Utils_Date::format(date('YmdHi00'))
-    ) {
-      return array(
-        'start_date' => ts('Start date cannot be earlier than the current time.'),
-      );
-    }
-    return TRUE;
-  }
-
-  /**
-   * Process the posted form values.  Create and schedule a mailing.
-   *
-   * @param
-   *
-   * @return void
-   */
-  public function postProcess() {
-    $params = array();
-
-    $params['mailing_id'] = $ids['mailing_id'] = $this->_mailingID;
-
-    if (empty($params['mailing_id'])) {
-      CRM_Core_Error::fatal(ts('Could not find a mailing id'));
-    }
-
-    foreach (array('now', 'start_date', 'start_date_time') as $parameter) {
-      $params[$parameter] = $this->controller->exportValue($this->_name, $parameter);
-    }
-
-    // Previously, we checked if $mailing->is_template, and did *not*
-    // schedule if it was set. Discussed with Lobo, removed that check
-    // as it appeared to prevent mails being scheduled if they were
-    // saved as a template, and this wasn't the documented behaviour.
-    // $saveTemplate = $this->controller->exportValue('saveTemplate');
-    if ($params['now']) {
-      $params['scheduled_date'] = date('YmdHis');
-    }
-    else {
-      $params['scheduled_date'] = CRM_Utils_Date::processDate($params['start_date'] . ' ' . $params['start_date_time']);
-    }
-
-    $session = CRM_Core_Session::singleton();
-
-    // set the scheduled_id
-    $params['scheduled_id'] = $session->get('userID');
-
-    // set approval details if workflow is not enabled
-    if (!CRM_Mailing_Info::workflowEnabled()) {
-      $params['approver_id'] = $session->get('userID');
-      $params['approval_date'] = date('YmdHis');
-      $params['approval_status_id'] = 1;
-    }
-    else {
-      // reset them in case this mailing was rejected
-      $params['approver_id'] = 'null';
-      $params['approval_date'] = 'null';
-      $params['approval_status_id'] = 'null';
-    }
-
-    /* Build the mailing object */
-    CRM_Mailing_BAO_Mailing::create($params, $ids);
-
-    //when user perform mailing from search context
-    //redirect it to search result CRM-3711.
-    $ssID = $this->get('ssID');
-    if ($ssID && $this->_searchBasedMailing && !CRM_Mailing_Info::workflowEnabled()) {
-      if ($this->_action == CRM_Core_Action::BASIC) {
-        $fragment = 'search';
-      }
-      elseif ($this->_action == CRM_Core_Action::PROFILE) {
-        $fragment = 'search/builder';
-      }
-      elseif ($this->_action == CRM_Core_Action::ADVANCED) {
-        $fragment = 'search/advanced';
-      }
-      else {
-        $fragment = 'search/custom';
-      }
-      $context = $this->get('context');
-      if (!CRM_Contact_Form_Search::isSearchContext($context)) {
-        $context = 'search';
-      }
-      $urlParams = "force=1&reset=1&ssID={$ssID}&context={$context}";
-      $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
-      if (CRM_Utils_Rule::qfKey($qfKey)) {
-        $urlParams .= "&qfKey=$qfKey";
-      }
-
-      $url = CRM_Utils_System::url('civicrm/contact/' . $fragment, $urlParams);
-      return $this->controller->setDestination($url);
-    }
-
-    $session = CRM_Core_Session::singleton();
-    $session->pushUserContext(CRM_Utils_System::url('civicrm/mailing/browse/scheduled',
-      'reset=1&scheduled=true'
-    ));
-  }
-
-  /**
-   * Display Name of the form.
-   *
-   *
-   * @return string
-   */
-  public function getTitle() {
-    return ts('Schedule or Send');
-  }
-
-}
diff --git a/CRM/Mailing/Form/Settings.php b/CRM/Mailing/Form/Settings.php
deleted file mode 100644 (file)
index 3f485a5..0000000
+++ /dev/null
@@ -1,261 +0,0 @@
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.7                                                |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM.                                    |
- |                                                                    |
- | CiviCRM is free software; you can copy, modify, and distribute it  |
- | under the terms of the GNU Affero General Public License           |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
- |                                                                    |
- | CiviCRM is distributed in the hope that it will be useful, but     |
- | WITHOUT ANY WARRANTY; without even the implied warranty of         |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
- | See the GNU Affero General Public License for more details.        |
- |                                                                    |
- | You should have received a copy of the GNU Affero General Public   |
- | License and the CiviCRM Licensing Exception along                  |
- | with this program; if not, contact CiviCRM LLC                     |
- | at info[AT]civicrm[DOT]org. If you have questions about the        |
- | GNU Affero General Public License or the licensing of CiviCRM,     |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
- +--------------------------------------------------------------------+
- */
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-/**
- * This file is used to build the form configuring mailing details
- */
-class CRM_Mailing_Form_Settings extends CRM_Core_Form {
-
-  /**
-   * Set variables up before form is built.
-   *
-   * @return void
-   */
-  public function preProcess() {
-    //when user come from search context.
-    $ssID = $this->get('ssID');
-    $this->assign('ssid', $ssID);
-    $this->_searchBasedMailing = CRM_Contact_Form_Search::isSearchContext($this->get('context'));
-    if (CRM_Contact_Form_Search::isSearchContext($this->get('context')) && !$ssID) {
-      $params = array();
-      $result = CRM_Core_BAO_PrevNextCache::getSelectedContacts();
-      $this->assign("value", $result);
-    }
-  }
-
-  /**
-   * Set default values for the form.
-   * the default values are retrieved from the database
-   *
-   *
-   * @return void
-   */
-  public function setDefaultValues() {
-    $mailingID = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE, NULL);
-    // CRM-14716 - Pick up mailingID from session since most of the time it's not in the URL
-    if (!$mailingID) {
-      $mailingID = $this->get('mailing_id');
-    }
-    $count = $this->get('count');
-    $this->assign('count', $count);
-    $defaults = array();
-
-    $componentFields = array(
-      'reply_id' => 'Reply',
-      'optout_id' => 'OptOut',
-      'unsubscribe_id' => 'Unsubscribe',
-      'resubscribe_id' => 'Resubscribe',
-    );
-
-    foreach ($componentFields as $componentVar => $componentType) {
-      $defaults[$componentVar] = CRM_Mailing_PseudoConstant::defaultComponent($componentType, '');
-    }
-
-    if ($mailingID) {
-      $dao = new CRM_Mailing_DAO_Mailing();
-      $dao->id = $mailingID;
-      $dao->find(TRUE);
-      // override_verp must be flipped, as in 3.2 we reverted
-      // its meaning to â€˜should CiviMail manage replies?’ â€“ i.e.,
-      // â€˜should it *not* override Reply-To: with VERP-ed address?’
-      $dao->override_verp = !$dao->override_verp;
-      $dao->storeValues($dao, $defaults);
-      $defaults['visibility'] = $dao->visibility;
-    }
-
-    return $defaults;
-  }
-
-  /**
-   * Build the form object.
-   *
-   * @return void
-   */
-  public function buildQuickForm() {
-
-    $this->addElement('checkbox', 'override_verp', ts('Track Replies?'));
-
-    $defaults['override_verp'] = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME,
-      'track_civimail_replies', NULL, FALSE
-    );
-
-    $this->add('checkbox', 'forward_replies', ts('Forward Replies?'));
-    $defaults['forward_replies'] = FALSE;
-
-    $this->add('checkbox', 'url_tracking', ts('Track Click-throughs?'));
-    $defaults['url_tracking'] = TRUE;
-
-    $this->add('checkbox', 'open_tracking', ts('Track Opens?'));
-    $defaults['open_tracking'] = TRUE;
-
-    $this->add('checkbox', 'auto_responder', ts('Auto-respond to Replies?'));
-    $defaults['auto_responder'] = FALSE;
-
-    $this->add('select', 'visibility', ts('Mailing Visibility'), CRM_Core_SelectValues::groupVisibility(), TRUE);
-
-    $this->add('select', 'reply_id', ts('Auto-responder'),
-      CRM_Mailing_PseudoConstant::component('Reply'), TRUE
-    );
-
-    $this->add('select', 'unsubscribe_id', ts('Unsubscribe Message'),
-      CRM_Mailing_PseudoConstant::component('Unsubscribe'), TRUE
-    );
-
-    $this->add('select', 'resubscribe_id', ts('Resubscribe Message'),
-      CRM_Mailing_PseudoConstant::component('Resubscribe'), TRUE
-    );
-
-    $this->add('select', 'optout_id', ts('Opt-out Message'),
-      CRM_Mailing_PseudoConstant::component('OptOut'), TRUE
-    );
-
-    $buttons = array(
-      array(
-        'type' => 'back',
-        'name' => ts('Previous'),
-      ),
-      array(
-        'type' => 'next',
-        'name' => ts('Next'),
-        'spacing' => '&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;',
-        'isDefault' => TRUE,
-      ),
-      array(
-        'type' => 'submit',
-        'name' => ts('Save & Continue Later'),
-      ),
-      array(
-        'type' => 'cancel',
-        'name' => ts('Cancel'),
-      ),
-    );
-
-    $this->addButtons($buttons);
-
-    $this->setDefaults($defaults);
-  }
-
-  public function postProcess() {
-    $params = $ids = array();
-
-    $session = CRM_Core_Session::singleton();
-    $params['created_id'] = $session->get('userID');
-
-    $uploadParams = array('reply_id', 'unsubscribe_id', 'optout_id', 'resubscribe_id');
-    $uploadParamsBoolean = array('override_verp', 'forward_replies', 'url_tracking', 'open_tracking', 'auto_responder');
-
-    $qf_Settings_submit = $this->controller->exportValue($this->_name, '_qf_Settings_submit');
-
-    foreach ($uploadParams as $key) {
-      $params[$key] = $this->controller->exportvalue($this->_name, $key);
-      $this->set($key, $this->controller->exportvalue($this->_name, $key));
-    }
-
-    foreach ($uploadParamsBoolean as $key) {
-      if ($this->controller->exportvalue($this->_name, $key)) {
-        $params[$key] = TRUE;
-      }
-      else {
-        $params[$key] = FALSE;
-      }
-      $this->set($key, $this->controller->exportvalue($this->_name, $key));
-    }
-
-    $params['visibility'] = $this->controller->exportvalue($this->_name, 'visibility');
-
-    // override_verp must be flipped, as in 3.2 we reverted
-    // its meaning to â€˜should CiviMail manage replies?’ â€“ i.e.,
-    // â€˜should it *not* override Reply-To: with VERP-ed address?’
-    $params['override_verp'] = !$params['override_verp'];
-
-    $ids['mailing_id'] = $this->get('mailing_id');
-
-    // update mailing
-    CRM_Mailing_BAO_Mailing::create($params, $ids);
-
-    if ($qf_Settings_submit) {
-      //when user perform mailing from search context
-      //redirect it to search result CRM-3711.
-      $ssID = $this->get('ssID');
-      if ($ssID && $this->_searchBasedMailing) {
-        if ($this->_action == CRM_Core_Action::BASIC) {
-          $fragment = 'search';
-        }
-        elseif ($this->_action == CRM_Core_Action::PROFILE) {
-          $fragment = 'search/builder';
-        }
-        elseif ($this->_action == CRM_Core_Action::ADVANCED) {
-          $fragment = 'search/advanced';
-        }
-        else {
-          $fragment = 'search/custom';
-        }
-
-        $context = $this->get('context');
-        if (!CRM_Contact_Form_Search::isSearchContext($context)) {
-          $context = 'search';
-        }
-        $urlParams = "force=1&reset=1&ssID={$ssID}&context={$context}";
-        $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
-        if (CRM_Utils_Rule::qfKey($qfKey)) {
-          $urlParams .= "&qfKey=$qfKey";
-        }
-
-        $draftURL = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'scheduled=false&reset=1');
-        $status = ts("You can continue later by clicking the 'Continue' action to resume working on it.<br />From <a href='%1'>Draft and Unscheduled Mailings</a>.", array(1 => $draftURL));
-
-        // Redirect user to search.
-        $url = CRM_Utils_System::url('civicrm/contact/' . $fragment, $urlParams);
-      }
-      else {
-        $status = ts("Click the 'Continue' action to resume working on it.");
-        $url = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'scheduled=false&reset=1');
-      }
-      CRM_Core_Session::setStatus($status, ts('Mailing Saved'), 'success');
-      CRM_Utils_System::redirect($url);
-    }
-  }
-
-  /**
-   * Display Name of the form.
-   *
-   *
-   * @return string
-   */
-  public function getTitle() {
-    return ts('Track and Respond');
-  }
-
-}
diff --git a/CRM/Mailing/Form/Test.php b/CRM/Mailing/Form/Test.php
deleted file mode 100644 (file)
index 4542efe..0000000
+++ /dev/null
@@ -1,391 +0,0 @@
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.7                                                |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM.                                    |
- |                                                                    |
- | CiviCRM is free software; you can copy, modify, and distribute it  |
- | under the terms of the GNU Affero General Public License           |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
- |                                                                    |
- | CiviCRM is distributed in the hope that it will be useful, but     |
- | WITHOUT ANY WARRANTY; without even the implied warranty of         |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
- | See the GNU Affero General Public License for more details.        |
- |                                                                    |
- | You should have received a copy of the GNU Affero General Public   |
- | License and the CiviCRM Licensing Exception along                  |
- | with this program; if not, contact CiviCRM LLC                     |
- | at info[AT]civicrm[DOT]org. If you have questions about the        |
- | GNU Affero General Public License or the licensing of CiviCRM,     |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
- +--------------------------------------------------------------------+
- */
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-/**
- * Form to send test mail
- */
-class CRM_Mailing_Form_Test extends CRM_Core_Form {
-
-  /**
-   * Set variables up before form is built.
-   *
-   * @return void
-   */
-  public function preProcess() {
-    //when user come from search context.
-    $ssID = $this->get('ssID');
-    $this->assign('ssid', $ssID);
-    $this->_searchBasedMailing = CRM_Contact_Form_Search::isSearchContext($this->get('context'));
-    if (CRM_Contact_Form_Search::isSearchContext($this->get('context')) && !$ssID) {
-      $params = array();
-      $result = CRM_Core_BAO_PrevNextCache::getSelectedContacts();
-      $this->assign("value", $result);
-    }
-  }
-
-  /**
-   * Set default values for the form.
-   *
-   *
-   * @return void
-   */
-  public function setDefaultValues() {
-    $count = $this->get('count');
-    $this->assign('count', $count);
-  }
-
-  public function buildQuickForm() {
-    $session = CRM_Core_Session::singleton();
-    $this->add('text', 'test_email', ts('Send to This Address'));
-    $defaults['test_email'] = $session->get('ufUniqID');
-    $qfKey = $this->get('qfKey');
-
-    $this->add('select',
-      'test_group',
-      ts('Send to This Group'),
-      array('' => ts('- none -')) + CRM_Core_PseudoConstant::group('Mailing')
-    );
-    $this->setDefaults($defaults);
-
-    $this->add('submit', 'sendtest', ts('Send a Test Mailing'));
-    $name = ts('Next');
-    if (CRM_Mailing_Info::workflowEnabled()) {
-      if (!CRM_Core_Permission::check('schedule mailings') &&
-        CRM_Core_Permission::check('create mailings')
-      ) {
-        $name = ts('Inform Scheduler');
-      }
-    }
-
-    $buttons = array(
-      array(
-        'type' => 'back',
-        'name' => ts('Previous'),
-      ),
-      array(
-        'type' => 'next',
-        'name' => $name,
-        'spacing' => '&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;',
-        'isDefault' => TRUE,
-      ),
-      array(
-        'type' => 'submit',
-        'name' => ts('Save & Continue Later'),
-      ),
-      array(
-        'type' => 'cancel',
-        'name' => ts('Cancel'),
-      ),
-    );
-
-    $this->addButtons($buttons);
-
-    $mailingID = $this->get('mailing_id');
-    $textFile = $this->get('textFile');
-    $htmlFile = $this->get('htmlFile');
-
-    $this->addFormRule(array('CRM_Mailing_Form_Test', 'testMail'), $this);
-    $preview = array();
-    if ($textFile) {
-      $preview['text_link'] = CRM_Utils_System::url('civicrm/mailing/preview', "type=text&qfKey=$qfKey");
-    }
-    if ($htmlFile) {
-      $preview['html_link'] = CRM_Utils_System::url('civicrm/mailing/preview', "type=html&qfKey=$qfKey");
-    }
-
-    $preview['attachment'] = CRM_Core_BAO_File::attachmentInfo('civicrm_mailing', $mailingID);
-    $this->assign('preview', $preview);
-    //Token Replacement of Subject in preview mailing
-    $options = array();
-    $prefix = "CRM_Mailing_Controller_Send_$qfKey";
-    if ($this->_searchBasedMailing) {
-      $prefix = "CRM_Contact_Controller_Search_$qfKey";
-    }
-    $session->getVars($options, $prefix);
-
-    $mailing = new CRM_Mailing_BAO_Mailing();
-    $mailing->id = $options['mailing_id'];
-    $mailing->find(TRUE);
-    $fromEmail = $mailing->from_email;
-    $replyToEmail = $mailing->replyto_email;
-
-    $attachments = CRM_Core_BAO_File::getEntityFile('civicrm_mailing',
-      $mailing->id
-    );
-
-    $returnProperties = $mailing->getReturnProperties();
-    $userID = $session->get('userID');
-    $params = array('contact_id' => $userID);
-
-    $details = CRM_Utils_Token::getTokenDetails($params,
-      $returnProperties,
-      TRUE, TRUE, NULL,
-      $mailing->getFlattenedTokens(),
-      get_class($this)
-    );
-
-    $allDetails = &$mailing->compose(NULL, NULL, NULL,
-      $userID,
-      $fromEmail,
-      $fromEmail,
-      TRUE,
-      $details[0][$userID],
-      $attachments
-    );
-
-    $this->assign('subject', $allDetails->_headers['Subject']);
-  }
-
-  /**
-   * Form rule to send out a test mailing.
-   *
-   * @param aray $testParams
-   * @param array $files
-   *   Any files posted to the form.
-   * @param array $self
-   *   An current this object.
-   *
-   * @return bool
-   *   true on successful SMTP handoff
-   */
-  public static function testMail($testParams, $files, $self) {
-    $error = NULL;
-
-    $urlString = 'civicrm/mailing/send';
-    $urlParams = "_qf_Test_display=true&qfKey={$testParams['qfKey']}";
-
-    $ssID = $self->get('ssID');
-    if ($ssID && $self->_searchBasedMailing) {
-      if ($self->_action == CRM_Core_Action::BASIC) {
-        $fragment = 'search';
-      }
-      elseif ($self->_action == CRM_Core_Action::PROFILE) {
-        $fragment = 'search/builder';
-      }
-      elseif ($self->_action == CRM_Core_Action::ADVANCED) {
-        $fragment = 'search/advanced';
-      }
-      else {
-        $fragment = 'search/custom';
-      }
-      $urlString = 'civicrm/contact/' . $fragment;
-    }
-    $emails = NULL;
-    if (!empty($testParams['sendtest'])) {
-      if (!($testParams['test_group'] || $testParams['test_email'])) {
-        CRM_Core_Session::setStatus(ts('You did not provide an email address or select a group.'), ts('Test not sent.'), 'error');
-        $error = TRUE;
-      }
-
-      if ($testParams['test_email']) {
-        $emailAdd = explode(',', $testParams['test_email']);
-        foreach ($emailAdd as $key => $value) {
-          $email = trim($value);
-          $testParams['emails'][] = $email;
-          $emails .= ($emails ? ',' : '') . "'" . CRM_Core_DAO::escapeString($email)  . "'";
-          if (!CRM_Utils_Rule::email($email)) {
-            CRM_Core_Session::setStatus(ts('Please enter a valid email address.'), ts('Test not sent.'), 'error');
-            $error = TRUE;
-          }
-        }
-      }
-
-      if ($error) {
-        $url = CRM_Utils_System::url($urlString, $urlParams);
-        CRM_Utils_System::redirect($url);
-        return $error;
-      }
-    }
-
-    if (!empty($testParams['_qf_Test_submit'])) {
-      //when user perform mailing from search context
-      //redirect it to search result CRM-3711.
-      if ($ssID && $self->_searchBasedMailing) {
-        $draftURL = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'scheduled=false&reset=1');
-        $status = ts("You can continue later by clicking the 'Continue' action to resume working on it.<br />From <a href='%1'>Draft and Unscheduled Mailings</a>.", array(1 => $draftURL));
-
-        //replace user context to search.
-        $context = $self->get('context');
-        if (!CRM_Contact_Form_Search::isSearchContext($context)) {
-          $context = 'search';
-        }
-        $urlParams = "force=1&reset=1&ssID={$ssID}&context={$context}&qfKey={$testParams['qfKey']}";
-        $url = CRM_Utils_System::url($urlString, $urlParams);
-      }
-      else {
-        $status = ts("Click the 'Continue' action to resume working on it.");
-        $url = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'scheduled=false&reset=1');
-      }
-      CRM_Core_Session::setStatus($status, ts('Mailing Saved'), 'success');
-      CRM_Utils_System::redirect($url);
-    }
-
-    if (CRM_Mailing_Info::workflowEnabled()) {
-      if (!CRM_Core_Permission::check('schedule mailings') &&
-        CRM_Core_Permission::check('create mailings')
-      ) {
-        $url = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'scheduled=false&reset=1');
-        CRM_Utils_System::redirect($url);
-      }
-    }
-
-    if (!empty($testParams['_qf_Test_next']) &&
-      $self->get('count') <= 0
-    ) {
-      return array(
-        '_qf_default' =>
-        ts("You can not schedule or send this mailing because there are currently no recipients selected. Click 'Previous' to return to the Select Recipients step, OR click 'Save & Continue Later'."),
-      );
-    }
-
-    if (!empty($_POST['_qf_Import_refresh']) || !empty($testParams['_qf_Test_next']) || empty($testParams['sendtest'])) {
-      $error = TRUE;
-      return $error;
-    }
-
-    $job = new CRM_Mailing_BAO_MailingJob();
-    $job->mailing_id = $self->get('mailing_id');
-    $job->is_test = TRUE;
-    $job->save();
-    $newEmails = NULL;
-    $session = CRM_Core_Session::singleton();
-    if (!empty($testParams['emails'])) {
-      $query = "
-SELECT     e.id, e.contact_id, e.email
-FROM       civicrm_email e
-INNER JOIN civicrm_contact c ON e.contact_id = c.id
-WHERE      e.email IN ($emails)
-AND        e.on_hold = 0
-AND        c.is_opt_out = 0
-AND        c.do_not_email = 0
-AND        c.is_deleted = 0
-AND        c.is_deceased = 0
-GROUP BY   e.id
-ORDER BY   e.is_bulkmail DESC, e.is_primary DESC
-";
-
-      $dao = CRM_Core_DAO::executeQuery($query);
-      $emailDetail = array();
-      // fetch contact_id and email id for all existing emails
-      while ($dao->fetch()) {
-        $emailDetail[$dao->email] = array(
-          'contact_id' => $dao->contact_id,
-          'email_id' => $dao->id,
-        );
-      }
-
-      $dao->free();
-      foreach ($testParams['emails'] as $key => $email) {
-        // Email addresses are forced to lower case when saved, so ensure
-        // we have the same case when comparing.
-        $email = trim(strtolower($email));
-        $contactId = $emailId = NULL;
-        if (array_key_exists($email, $emailDetail)) {
-          $emailId = $emailDetail[$email]['email_id'];
-          $contactId = $emailDetail[$email]['contact_id'];
-        }
-
-        if (!$contactId) {
-          //create new contact.
-          $params = array(
-            'contact_type' => 'Individual',
-            'email' => array(
-              1 => array(
-                'email' => $email,
-                'is_primary' => 1,
-                'location_type_id' => 1,
-              ),
-            ),
-          );
-          $contact = CRM_Contact_BAO_Contact::create($params);
-          $emailId = $contact->email[0]->id;
-          $contactId = $contact->id;
-          $contact->free();
-        }
-        $params = array(
-          'job_id' => $job->id,
-          'email_id' => $emailId,
-          'contact_id' => $contactId,
-        );
-        CRM_Mailing_Event_BAO_Queue::create($params);
-      }
-    }
-
-    $testParams['job_id'] = $job->id;
-    $isComplete = FALSE;
-    while (!$isComplete) {
-      $isComplete = CRM_Mailing_BAO_MailingJob::runJobs($testParams);
-    }
-
-    if (!empty($testParams['sendtest'])) {
-      $status = NULL;
-      if (CRM_Mailing_Info::workflowEnabled()) {
-        if ((
-            CRM_Core_Permission::check('schedule mailings') &&
-            CRM_Core_Permission::check('create mailings')
-          ) ||
-          CRM_Core_Permission::check('access CiviMail')
-        ) {
-          $status = ts("Click 'Next' when you are ready to Schedule or Send your live mailing (you will still have a chance to confirm or cancel sending this mailing on the next page).");
-        }
-      }
-      else {
-        $status = ts("Click 'Next' when you are ready to Schedule or Send your live mailing (you will still have a chance to confirm or cancel sending this mailing on the next page).");
-      }
-
-      if ($status) {
-        CRM_Core_Session::setStatus($status, ts('Test message sent'), 'success');
-      }
-      $url = CRM_Utils_System::url($urlString, $urlParams);
-      CRM_Utils_System::redirect($url);
-    }
-    $error = TRUE;
-    return $error;
-  }
-
-  /**
-   * Display Name of the form.
-   *
-   *
-   * @return string
-   */
-  public function getTitle() {
-    return ts('Test');
-  }
-
-  public function postProcess() {
-  }
-
-}
diff --git a/CRM/Mailing/Form/Upload.php b/CRM/Mailing/Form/Upload.php
deleted file mode 100644 (file)
index 7e1a2e7..0000000
+++ /dev/null
@@ -1,704 +0,0 @@
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.7                                                |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM.                                    |
- |                                                                    |
- | CiviCRM is free software; you can copy, modify, and distribute it  |
- | under the terms of the GNU Affero General Public License           |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
- |                                                                    |
- | CiviCRM is distributed in the hope that it will be useful, but     |
- | WITHOUT ANY WARRANTY; without even the implied warranty of         |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
- | See the GNU Affero General Public License for more details.        |
- |                                                                    |
- | You should have received a copy of the GNU Affero General Public   |
- | License and the CiviCRM Licensing Exception along                  |
- | with this program; if not, contact CiviCRM LLC                     |
- | at info[AT]civicrm[DOT]org. If you have questions about the        |
- | GNU Affero General Public License or the licensing of CiviCRM,     |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
- +--------------------------------------------------------------------+
- */
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-/**
- * This file is used to build the form configuring mailing details
- */
-class CRM_Mailing_Form_Upload extends CRM_Core_Form {
-
-  public $_mailingID;
-
-  public function preProcess() {
-    $this->_mailingID = $this->get('mailing_id');
-    if (CRM_Core_Permission::check('administer CiviCRM')) {
-      $this->assign('isAdmin', 1);
-    }
-
-    //when user come from search context.
-    $ssID = $this->get('ssID');
-    $this->assign('ssid', $ssID);
-    $this->_searchBasedMailing = CRM_Contact_Form_Search::isSearchContext($this->get('context'));
-    if (CRM_Contact_Form_Search::isSearchContext($this->get('context')) && !$ssID) {
-      $params = array();
-      $result = CRM_Core_BAO_PrevNextCache::getSelectedContacts();
-      $this->assign("value", $result);
-    }
-  }
-
-  /**
-   * Set default values for the form.
-   * the default values are retrieved from the database
-   *
-   *
-   * @return void
-   */
-  public function setDefaultValues() {
-    $mailingID = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE, NULL);
-
-    //need to differentiate new/reuse mailing, CRM-2873
-    $reuseMailing = FALSE;
-    if ($mailingID) {
-      $reuseMailing = TRUE;
-    }
-    else {
-      $mailingID = $this->_mailingID;
-    }
-
-    $count = $this->get('count');
-    $this->assign('count', $count);
-
-    $this->set('skipTextFile', FALSE);
-    $this->set('skipHtmlFile', FALSE);
-
-    $defaults = array();
-
-    $htmlMessage = NULL;
-    if ($mailingID) {
-      $dao = new CRM_Mailing_DAO_Mailing();
-      $dao->id = $mailingID;
-      $dao->find(TRUE);
-      $dao->storeValues($dao, $defaults);
-
-      //we don't want to retrieve template details once it is
-      //set in session
-      $templateId = $this->get('template');
-      $this->assign('templateSelected', $templateId ? $templateId : 0);
-      if (isset($defaults['msg_template_id']) && !$templateId) {
-        $defaults['template'] = $defaults['msg_template_id'];
-        $messageTemplate = new CRM_Core_DAO_MessageTemplate();
-        $messageTemplate->id = $defaults['msg_template_id'];
-        $messageTemplate->selectAdd();
-        $messageTemplate->selectAdd('msg_text, msg_html');
-        $messageTemplate->find(TRUE);
-
-        $defaults['text_message'] = $messageTemplate->msg_text;
-        $htmlMessage = $messageTemplate->msg_html;
-      }
-
-      if (isset($defaults['body_text'])) {
-        $defaults['text_message'] = $defaults['body_text'];
-        $this->set('textFile', $defaults['body_text']);
-        $this->set('skipTextFile', TRUE);
-      }
-
-      if (isset($defaults['body_html'])) {
-        $htmlMessage = $defaults['body_html'];
-        $this->set('htmlFile', $defaults['body_html']);
-        $this->set('skipHtmlFile', TRUE);
-      }
-
-      //set default from email address.
-      if (!empty($defaults['from_name']) && !empty($defaults['from_email'])) {
-        $defaults['from_email_address'] = array_search('"' . $defaults['from_name'] . '" <' . $defaults['from_email'] . '>',
-          CRM_Core_OptionGroup::values('from_email_address')
-        );
-      }
-      else {
-        //get the default from email address.
-        $defaultAddress = CRM_Core_OptionGroup::values('from_email_address', NULL, NULL, NULL, ' AND is_default = 1');
-        foreach ($defaultAddress as $id => $value) {
-          $defaults['from_email_address'] = $id;
-        }
-      }
-
-      if (!empty($defaults['replyto_email'])) {
-        $replyToEmail = CRM_Core_OptionGroup::values('from_email_address');
-        foreach ($replyToEmail as $value) {
-          if (strstr($value, $defaults['replyto_email'])) {
-            $replyToEmailAddress = $value;
-            break;
-          }
-        }
-        $replyToEmailAddress = explode('<', $replyToEmailAddress);
-        if (count($replyToEmailAddress) > 1) {
-          $replyToEmailAddress = $replyToEmailAddress[0] . '<' . $replyToEmailAddress[1];
-        }
-        $defaults['reply_to_address'] = array_search($replyToEmailAddress, $replyToEmail);
-      }
-    }
-
-    //fix for CRM-2873
-    if (!$reuseMailing) {
-      $textFilePath = $this->get('textFilePath');
-      if ($textFilePath &&
-        file_exists($textFilePath)
-      ) {
-        $defaults['text_message'] = file_get_contents($textFilePath);
-        if (strlen($defaults['text_message']) > 0) {
-          $this->set('skipTextFile', TRUE);
-        }
-      }
-
-      $htmlFilePath = $this->get('htmlFilePath');
-      if ($htmlFilePath &&
-        file_exists($htmlFilePath)
-      ) {
-        $defaults['html_message'] = file_get_contents($htmlFilePath);
-        if (strlen($defaults['html_message']) > 0) {
-          $htmlMessage = $defaults['html_message'];
-          $this->set('skipHtmlFile', TRUE);
-        }
-      }
-    }
-
-    if ($this->get('html_message')) {
-      $htmlMessage = $this->get('html_message');
-    }
-
-    $htmlMessage = str_replace(array("\n", "\r"), ' ', $htmlMessage);
-    $htmlMessage = str_replace("'", "\'", $htmlMessage);
-    $this->assign('message_html', $htmlMessage);
-
-    $defaults['upload_type'] = 1;
-    if (isset($defaults['body_html'])) {
-      $defaults['html_message'] = $defaults['body_html'];
-    }
-
-    //CRM-4678 setdefault to default component when composing new mailing.
-    if (!$reuseMailing) {
-      $componentFields = array(
-        'header_id' => 'Header',
-        'footer_id' => 'Footer',
-      );
-      foreach ($componentFields as $componentVar => $componentType) {
-        $defaults[$componentVar] = CRM_Mailing_PseudoConstant::defaultComponent($componentType, '');
-      }
-    }
-
-    return $defaults;
-  }
-
-  /**
-   * Build the form object.
-   *
-   * @return void
-   */
-  public function buildQuickForm() {
-    $session = CRM_Core_Session::singleton();
-    $config = CRM_Core_Config::singleton();
-    $options = array();
-    $tempVar = FALSE;
-
-    // this seems so hacky, not sure what we are doing here and why. Need to investigate and fix
-    $session->getVars($options,
-      "CRM_Mailing_Controller_Send_{$this->controller->_key}"
-    );
-
-    $fromEmailAddress = CRM_Core_OptionGroup::values('from_email_address');
-    if (empty($fromEmailAddress)) {
-      //redirect user to enter from email address.
-      $url = CRM_Utils_System::url('civicrm/admin/options/from_email_address', 'action=add&reset=1');
-      $status = ts("There is no valid from email address present. You can add here <a href='%1'>Add From Email Address.</a>", array(1 => $url));
-      $session->setStatus($status, ts('Notice'));
-    }
-    else {
-      foreach ($fromEmailAddress as $key => $email) {
-        $fromEmailAddress[$key] = htmlspecialchars($fromEmailAddress[$key]);
-      }
-    }
-
-    $this->add('select', 'from_email_address',
-      ts('From Email Address'), array(
-        '' => '- select -',
-      ) + $fromEmailAddress, TRUE
-    );
-
-    //Added code to add custom field as Reply-To on form when it is enabled from Mailer settings
-    if ((int) CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'replyTo') && empty($options['override_verp'])) {
-      $this->add('select', 'reply_to_address', ts('Reply-To'),
-        array('' => '- select -') + $fromEmailAddress
-      );
-    }
-    elseif (!empty($options['override_verp'])) {
-      $trackReplies = TRUE;
-      $this->assign('trackReplies', $trackReplies);
-    }
-
-    $this->add('text', 'subject', ts('Mailing Subject'),
-      CRM_Core_DAO::getAttribute('CRM_Mailing_DAO_Mailing', 'subject'), TRUE
-    );
-
-    $attributes = array('onclick' => "showHideUpload();");
-    $options = array(ts('Upload Content'), ts('Compose On-screen'));
-
-    $this->addRadio('upload_type', ts('I want to'), $options, $attributes, "&nbsp;&nbsp;");
-
-    CRM_Mailing_BAO_Mailing::commonCompose($this);
-
-    $this->addElement('file', 'textFile', ts('Upload TEXT Message'), 'size=30 maxlength=60');
-    $this->addUploadElement('textFile');
-    $this->setMaxFileSize(1024 * 1024);
-    $this->addRule('textFile', ts('File size should be less than 1 MByte'), 'maxfilesize', 1024 * 1024);
-    $this->addRule('textFile', ts('File must be in UTF-8 encoding'), 'utf8File');
-
-    $this->addElement('file', 'htmlFile', ts('Upload HTML Message'), 'size=30 maxlength=60');
-    $this->addUploadElement('htmlFile');
-    $this->setMaxFileSize(1024 * 1024);
-    $this->addRule('htmlFile',
-      ts('File size should be less than %1 MByte(s)',
-        array(1 => 1)
-      ),
-      'maxfilesize',
-      1024 * 1024
-    );
-    $this->addRule('htmlFile', ts('File must be in UTF-8 encoding'), 'utf8File');
-
-    //fix upload files when context is search. CRM-3711
-    $ssID = $this->get('ssID');
-    if ($this->_searchBasedMailing && $ssID) {
-      $this->set('uploadNames', array('textFile', 'htmlFile'));
-    }
-
-    CRM_Core_BAO_File::buildAttachment($this,
-      'civicrm_mailing',
-      $this->_mailingID
-    );
-
-    $this->add('select', 'header_id', ts('Mailing Header'),
-      array('' => ts('- none -')) + CRM_Mailing_PseudoConstant::component('Header')
-    );
-
-    $this->add('select', 'footer_id', ts('Mailing Footer'),
-      array('' => ts('- none -')) + CRM_Mailing_PseudoConstant::component('Footer')
-    );
-
-    $this->addFormRule(array('CRM_Mailing_Form_Upload', 'formRule'), $this);
-
-    $buttons = array(
-      array(
-        'type' => 'back',
-        'name' => ts('Previous'),
-      ),
-      array(
-        'type' => 'upload',
-        'name' => ts('Next'),
-        'spacing' => '&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;',
-        'isDefault' => TRUE,
-      ),
-      array(
-        'type' => 'upload',
-        'name' => ts('Save & Continue Later'),
-        'subName' => 'save',
-      ),
-      array(
-        'type' => 'cancel',
-        'name' => ts('Cancel'),
-      ),
-    );
-    $this->addButtons($buttons);
-  }
-
-  public function postProcess() {
-    $params = $ids = array();
-    $uploadParams = array('header_id', 'footer_id', 'subject', 'from_name', 'from_email');
-    $fileType = array('textFile', 'htmlFile');
-
-    $formValues = $this->controller->exportValues($this->_name);
-
-    foreach ($uploadParams as $key) {
-      if (!empty($formValues[$key]) ||
-        in_array($key, array('header_id', 'footer_id'))
-      ) {
-        $params[$key] = $formValues[$key];
-        $this->set($key, $formValues[$key]);
-      }
-    }
-
-    if (!$formValues['upload_type']) {
-      foreach ($fileType as $key) {
-        $contents = NULL;
-        if (isset($formValues[$key]) &&
-          !empty($formValues[$key])
-        ) {
-          $contents = file_get_contents($formValues[$key]['name']);
-          $this->set($key, $formValues[$key]['name']);
-        }
-        if ($contents) {
-          $params['body_' . substr($key, 0, 4)] = $contents;
-        }
-        else {
-          $params['body_' . substr($key, 0, 4)] = 'NULL';
-        }
-      }
-    }
-    else {
-      $text_message = $formValues['text_message'];
-      $params['body_text'] = $text_message;
-      $this->set('textFile', $params['body_text']);
-      $this->set('text_message', $params['body_text']);
-      $html_message = $formValues['html_message'];
-
-      // dojo editor does some html conversion when tokens are
-      // inserted as links. Hence token replacement fails.
-      // this is hack to revert html conversion for { to %7B and
-      // } to %7D by dojo editor
-      $html_message = str_replace('%7B', '{', str_replace('%7D', '}', $html_message));
-
-      $params['body_html'] = $html_message;
-      $this->set('htmlFile', $params['body_html']);
-      $this->set('html_message', $params['body_html']);
-    }
-
-    $params['name'] = $this->get('name');
-
-    $session = CRM_Core_Session::singleton();
-    $params['contact_id'] = $session->get('userID');
-    $composeFields = array(
-      'template',
-      'saveTemplate',
-      'updateTemplate',
-      'saveTemplateName',
-    );
-    $msgTemplate = NULL;
-    //mail template is composed
-    if ($formValues['upload_type']) {
-      $composeParams = array();
-
-      foreach ($composeFields as $key) {
-        if (!empty($formValues[$key])) {
-          $composeParams[$key] = $formValues[$key];
-          $this->set($key, $formValues[$key]);
-        }
-      }
-
-      if (!empty($composeParams['updateTemplate'])) {
-        $templateParams = array(
-          'msg_text' => $text_message,
-          'msg_html' => $html_message,
-          'msg_subject' => $params['subject'],
-          'is_active' => TRUE,
-        );
-
-        $templateParams['id'] = $formValues['template'];
-
-        $msgTemplate = CRM_Core_BAO_MessageTemplate::add($templateParams);
-      }
-
-      if (!empty($composeParams['saveTemplate'])) {
-        $templateParams = array(
-          'msg_text' => $text_message,
-          'msg_html' => $html_message,
-          'msg_subject' => $params['subject'],
-          'is_active' => TRUE,
-        );
-
-        $templateParams['msg_title'] = $composeParams['saveTemplateName'];
-
-        $msgTemplate = CRM_Core_BAO_MessageTemplate::add($templateParams);
-      }
-
-      if (isset($msgTemplate->id)) {
-        $params['msg_template_id'] = $msgTemplate->id;
-      }
-      else {
-        $params['msg_template_id'] = CRM_Utils_Array::value('template', $formValues);
-      }
-      $this->set('template', $params['msg_template_id']);
-    }
-
-    CRM_Core_BAO_File::formatAttachment($formValues,
-      $params,
-      'civicrm_mailing',
-      $this->_mailingID
-    );
-    $ids['mailing_id'] = $this->_mailingID;
-
-    //handle mailing from name & address.
-    $fromEmailAddress = CRM_Utils_Array::value($formValues['from_email_address'],
-      CRM_Core_OptionGroup::values('from_email_address')
-    );
-
-    //get the from email address
-    $params['from_email'] = CRM_Utils_Mail::pluckEmailFromHeader($fromEmailAddress);
-
-    //get the from Name
-    $params['from_name'] = CRM_Utils_Array::value(1, explode('"', $fromEmailAddress));
-
-    //Add Reply-To to headers
-    if (!empty($formValues['reply_to_address'])) {
-      $replyToEmail = CRM_Core_OptionGroup::values('from_email_address');
-      $params['replyto_email'] = CRM_Utils_Array::value($formValues['reply_to_address'], $replyToEmail);
-    }
-
-    /* Build the mailing object */
-
-    CRM_Mailing_BAO_Mailing::create($params, $ids);
-
-    if (isset($this->_submitValues['_qf_Upload_upload_save']) &&
-      $this->_submitValues['_qf_Upload_upload_save'] == 'Save & Continue Later'
-    ) {
-      //when user perform mailing from search context
-      //redirect it to search result CRM-3711.
-      $ssID = $this->get('ssID');
-      if ($ssID && $this->_searchBasedMailing) {
-        if ($this->_action == CRM_Core_Action::BASIC) {
-          $fragment = 'search';
-        }
-        elseif ($this->_action == CRM_Core_Action::PROFILE) {
-          $fragment = 'search/builder';
-        }
-        elseif ($this->_action == CRM_Core_Action::ADVANCED) {
-          $fragment = 'search/advanced';
-        }
-        else {
-          $fragment = 'search/custom';
-        }
-
-        $context = $this->get('context');
-        if (!CRM_Contact_Form_Search::isSearchContext($context)) {
-          $context = 'search';
-        }
-        $urlParams = "force=1&reset=1&ssID={$ssID}&context={$context}";
-        $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
-        if (CRM_Utils_Rule::qfKey($qfKey)) {
-          $urlParams .= "&qfKey=$qfKey";
-        }
-
-        $session = CRM_Core_Session::singleton();
-        $draftURL = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'scheduled=false&reset=1');
-        $status = ts("You can continue later by clicking the 'Continue' action to resume working on it.<br />From <a href='%1'>Draft and Unscheduled Mailings</a>.", array(1 => $draftURL));
-        CRM_Core_Session::setStatus($status, ts('Mailing Saved'), 'success');
-
-        // Redirect user to search.
-        $url = CRM_Utils_System::url('civicrm/contact/' . $fragment, $urlParams);
-      }
-      else {
-        $status = ts("Click the 'Continue' action to resume working on it.");
-        $url = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'scheduled=false&reset=1');
-      }
-      CRM_Core_Session::setStatus($status, ts('Mailing Saved'), 'success');
-      return $this->controller->setDestination($url);
-    }
-  }
-
-  /**
-   * Validation.
-   *
-   * @param array $params
-   *   (ref.) an assoc array of name/value pairs.
-   *
-   * @param $files
-   * @param $self
-   *
-   * @return bool|array
-   *   mixed true or array of errors
-   */
-  public static function formRule($params, $files, $self) {
-    if (!empty($_POST['_qf_Import_refresh'])) {
-      return TRUE;
-    }
-    $errors = array();
-    $template = CRM_Core_Smarty::singleton();
-
-    if (isset($params['html_message'])) {
-      $htmlMessage = str_replace(array("\n", "\r"), ' ', $params['html_message']);
-      $htmlMessage = str_replace("'", "\'", $htmlMessage);
-      $template->assign('htmlContent', $htmlMessage);
-    }
-
-    $domain = CRM_Core_BAO_Domain::getDomain();
-
-    $mailing = new CRM_Mailing_BAO_Mailing();
-    $mailing->id = $self->_mailingID;
-    $mailing->find(TRUE);
-
-    $session = CRM_Core_Session::singleton();
-    $values = array(
-      'contact_id' => $session->get('userID'),
-      'version' => 3,
-    );
-    require_once 'api/api.php';
-    $contact = civicrm_api('contact', 'get', $values);
-
-    //CRM-4524
-    $contact = reset($contact['values']);
-
-    $verp = array_flip(array('optOut', 'reply', 'unsubscribe', 'resubscribe', 'owner'));
-    foreach ($verp as $key => $value) {
-      $verp[$key]++;
-    }
-
-    $urls = array_flip(array('forward', 'optOutUrl', 'unsubscribeUrl', 'resubscribeUrl'));
-    foreach ($urls as $key => $value) {
-      $urls[$key]++;
-    }
-
-    // set $header and $footer
-    foreach (array(
-               'header',
-               'footer',
-             ) as $part) {
-      $$part = array();
-      if ($params["{$part}_id"]) {
-        //echo "found<p>";
-        $component = new CRM_Mailing_BAO_Component();
-        $component->id = $params["{$part}_id"];
-        $component->find(TRUE);
-        ${$part}['textFile'] = $component->body_text;
-        ${$part}['htmlFile'] = $component->body_html;
-        $component->free();
-      }
-      else {
-        ${$part}['htmlFile'] = ${$part}['textFile'] = '';
-      }
-    }
-
-    $skipTextFile = $self->get('skipTextFile');
-    $skipHtmlFile = $self->get('skipHtmlFile');
-
-    if (!$params['upload_type']) {
-      if ((!isset($files['textFile']) || !file_exists($files['textFile']['tmp_name'])) &&
-        (!isset($files['htmlFile']) || !file_exists($files['htmlFile']['tmp_name']))
-      ) {
-        if (!($skipTextFile || $skipHtmlFile)) {
-          $errors['textFile'] = ts('Please provide either a Text or HTML formatted message - or both.');
-        }
-      }
-    }
-    else {
-      if (empty($params['text_message']) && empty($params['html_message'])) {
-        $errors['html_message'] = ts('Please provide either a Text or HTML formatted message - or both.');
-      }
-      if (!empty($params['saveTemplate']) && empty($params['saveTemplateName'])) {
-        $errors['saveTemplateName'] = ts('Please provide a Template Name.');
-      }
-    }
-
-    foreach (array(
-               'text',
-               'html',
-             ) as $file) {
-      if (!$params['upload_type'] && !file_exists(CRM_Utils_Array::value('tmp_name', $files[$file . 'File']))) {
-        continue;
-      }
-      if ($params['upload_type'] && !$params[$file . '_message']) {
-        continue;
-      }
-
-      if (!$params['upload_type']) {
-        $str = file_get_contents($files[$file . 'File']['tmp_name']);
-        $name = $files[$file . 'File']['name'];
-      }
-      else {
-        $str = $params[$file . '_message'];
-        $str = ($file == 'html') ? str_replace('%7B', '{', str_replace('%7D', '}', $str)) : $str;
-        $name = $file . ' message';
-      }
-
-      /* append header/footer */
-
-      $str = $header[$file . 'File'] . $str . $footer[$file . 'File'];
-
-      $dataErrors = array();
-
-      /* First look for missing tokens */
-
-      if (!CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'disable_mandatory_tokens_check')) {
-        $err = CRM_Utils_Token::requiredTokens($str);
-        if ($err !== TRUE) {
-          foreach ($err as $token => $desc) {
-            $dataErrors[] = '<li>' . ts('This message is missing a required token - {%1}: %2',
-                array(1 => $token, 2 => $desc)
-              ) . '</li>';
-          }
-        }
-      }
-
-      /* Do a full token replacement on a dummy verp, the current
-       * contact and domain, and the first organization. */
-
-      // here we make a dummy mailing object so that we
-      // can retrieve the tokens that we need to replace
-      // so that we do get an invalid token error
-      // this is qute hacky and I hope that there might
-      // be a suggestion from someone on how to
-      // make it a bit more elegant
-
-      $dummy_mail = new CRM_Mailing_BAO_Mailing();
-      $mess = "body_{$file}";
-      $dummy_mail->$mess = $str;
-      $tokens = $dummy_mail->getTokens();
-
-      $str = CRM_Utils_Token::replaceSubscribeInviteTokens($str);
-      $str = CRM_Utils_Token::replaceDomainTokens($str, $domain, NULL, $tokens[$file]);
-      $str = CRM_Utils_Token::replaceMailingTokens($str, $mailing, NULL, $tokens[$file]);
-      $str = CRM_Utils_Token::replaceOrgTokens($str, $org);
-      $str = CRM_Utils_Token::replaceActionTokens($str, $verp, $urls, NULL, $tokens[$file]);
-      $str = CRM_Utils_Token::replaceContactTokens($str, $contact, NULL, $tokens[$file]);
-
-      $unmatched = CRM_Utils_Token::unmatchedTokens($str);
-
-      if (!empty($unmatched) && 0) {
-        foreach ($unmatched as $token) {
-          $dataErrors[] = '<li>' . ts('Invalid token code') . ' {' . $token . '}</li>';
-        }
-      }
-      if (!empty($dataErrors)) {
-        $errors[$file . 'File'] = ts('The following errors were detected in %1:', array(
-            1 => $name,
-          )) . ' <ul>' . implode('', $dataErrors) . '</ul><br /><a href="' . CRM_Utils_System::docURL2('Sample CiviMail Messages', TRUE, NULL, NULL, NULL, "wiki") . '" target="_blank">' . ts('More information on required tokens...') . '</a>';
-      }
-    }
-
-    $templateName = CRM_Core_BAO_MessageTemplate::getMessageTemplates();
-    if (!empty($params['saveTemplate']) && in_array(CRM_Utils_Array::value('saveTemplateName', $params), $templateName)
-    ) {
-      $errors['saveTemplate'] = ts('Duplicate Template Name.');
-    }
-    return empty($errors) ? TRUE : $errors;
-  }
-
-  /**
-   * Display Name of the form.
-   *
-   *
-   * @return string
-   */
-  public function getTitle() {
-    return ts('Mailing Content');
-  }
-
-  /**
-   * List available tokens for this form.
-   *
-   * @return array
-   */
-  public function listTokens() {
-    $tokens = CRM_Core_SelectValues::contactTokens();
-    $tokens = array_merge(CRM_Core_SelectValues::mailingTokens(), $tokens);
-    return $tokens;
-  }
-
-}
index 9e46a5536bb91559bf9055d7e8545059c9ba8f74..1ee43684510743b55c9af11fd4bce40439bbc716 100644 (file)
@@ -102,6 +102,7 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info {
     $civiMails = civicrm_api3('Mailing', 'get', array(
       'is_completed' => 1,
       'mailing_type' => array('IN' => array('standalone', 'winner')),
+      'domain_id' => CRM_Core_Config::domainID(),
       'return' => array('id', 'name', 'scheduled_date'),
       'sequential' => 1,
       'options' => array(
@@ -175,6 +176,7 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info {
         'schedule mailings',
         'approve mailings',
         'delete in CiviMail',
+        'edit message templates',
       ));
 
     return $result;
index fb60eabc4cb09ce792f9025c6939e369672d61de..d7a2e9fed0a5200e9cc607505e7dd34e5e9e53a8 100644 (file)
@@ -455,7 +455,7 @@ class CRM_Mailing_Selector_Event extends CRM_Core_Selector_Base implements CRM_C
         'unsubscribe' => ts('Unsubscribe Requests'),
         'optout' => ts('Opt-out Requests'),
         'click' => $this->_is_distinct ? ts('Unique Click-throughs') : ts('Click-throughs'),
-        'opened' => $this->_is_distinct ? ts('Unique Tracked Opens') : ts('Tracked Opens'),
+        'opened' => $this->_is_distinct ? ts('Unique Tracked Opens') : ts('Total Tracked Opens'),
       );
     }
     return $events[$this->_event_type];
diff --git a/CRM/Mailing/StateMachine/Send.php b/CRM/Mailing/StateMachine/Send.php
deleted file mode 100644 (file)
index 6da3a48..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.7                                                |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM.                                    |
- |                                                                    |
- | CiviCRM is free software; you can copy, modify, and distribute it  |
- | under the terms of the GNU Affero General Public License           |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
- |                                                                    |
- | CiviCRM is distributed in the hope that it will be useful, but     |
- | WITHOUT ANY WARRANTY; without even the implied warranty of         |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
- | See the GNU Affero General Public License for more details.        |
- |                                                                    |
- | You should have received a copy of the GNU Affero General Public   |
- | License and the CiviCRM Licensing Exception along                  |
- | with this program; if not, contact CiviCRM LLC                     |
- | at info[AT]civicrm[DOT]org. If you have questions about the        |
- | GNU Affero General Public License or the licensing of CiviCRM,     |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
- +--------------------------------------------------------------------+
- */
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-/**
- * State machine for managing different states of the Import process.
- *
- */
-class CRM_Mailing_StateMachine_Send extends CRM_Core_StateMachine {
-
-  /**
-   * Class constructor.
-   *
-   * @param CRM_Mailing_Controller $controller
-   * @param \const|int $action
-   *
-   * @return \CRM_Mailing_StateMachine_Send CRM_Mailing_StateMachine
-   */
-  public function __construct($controller, $action = CRM_Core_Action::NONE) {
-    parent::__construct($controller, $action);
-
-    $this->_pages = array(
-      'CRM_Mailing_Form_Group' => NULL,
-      'CRM_Mailing_Form_Settings' => NULL,
-      'CRM_Mailing_Form_Upload' => NULL,
-      'CRM_Mailing_Form_Test' => NULL,
-    );
-
-    if (CRM_Mailing_Info::workflowEnabled()) {
-      if (CRM_Core_Permission::check('schedule mailings') || CRM_Core_Permission::check('access CiviMail')) {
-        $this->_pages['CRM_Mailing_Form_Schedule'] = NULL;
-      }
-
-      if (CRM_Core_Permission::check('approve mailings') || CRM_Core_Permission::check('access CiviMail')) {
-        $this->_pages['CRM_Mailing_Form_Approve'] = NULL;
-      }
-    }
-    else {
-      $this->_pages['CRM_Mailing_Form_Schedule'] = NULL;
-    }
-
-    $this->addSequentialPages($this->_pages, $action);
-  }
-
-}
index 6b62c7de2f7e631043b382de53e0b294f39def38..33b9e501ea8c45e9156fcc453d50d6ca308e81c5 100644 (file)
     <page_callback>CRM_Mailing_Page_AJAX::template</page_callback>
     <access_arguments>access CiviCRM</access_arguments>
   </item>
-  <item>
-    <path>civicrm/mailing/schedule</path>
-    <title>Schedule Mailing</title>
-    <page_callback>CRM_Mailing_Form_Schedule</page_callback>
-    <access_arguments>access CiviMail;schedule mailings</access_arguments>
-    <weight>700</weight>
-  </item>
   <item>
     <path>civicrm/mailing/view</path>
     <title>View Mailing</title>
index 212f7593af3779c8aa41b33d85f36db1ff6f1e1a..8fd061802b9e759677aa0660edb72eb807629e3c 100644 (file)
@@ -1853,7 +1853,7 @@ INNER JOIN  civicrm_contact contact ON ( contact.id = membership.contact_id AND
         }
         CRM_Member_BAO_MembershipLog::add($logParams);
 
-        if (!empty($contributionRecurID)) {
+        if ($contributionRecurID) {
           CRM_Core_DAO::setFieldValue('CRM_Member_DAO_Membership', $membership->id,
             'contribution_recur_id', $contributionRecurID
           );
@@ -1983,12 +1983,14 @@ INNER JOIN  civicrm_contact contact ON ( contact.id = membership.contact_id AND
       if (!empty($membershipSource)) {
         $memParams['source'] = $membershipSource;
       }
-      $memParams['contribution_recur_id'] = $contributionRecurID;
-
       $memParams['is_test'] = $is_test;
       $memParams['is_pay_later'] = $isPayLater;
     }
-
+    // Putting this in an IF is precautionary as it seems likely that it would be ignored if empty, but
+    // perhaps shouldn't be?
+    if ($contributionRecurID) {
+      $memParams['contribution_recur_id'] = $contributionRecurID;
+    }
     //CRM-4555
     //if we decided status here and want to skip status
     //calculation in create( ); then need to pass 'skipStatusCal'.
@@ -2354,6 +2356,7 @@ WHERE      civicrm_membership.is_test = 0";
     $contributionSoftParams = CRM_Utils_Array::value('soft_credit', $params);
     $recordContribution = array(
       'contact_id',
+      'fee_amount',
       'total_amount',
       'receive_date',
       'financial_type_id',
index 0ff5dd528363ad28ad84cc412210a39ddbcbd901..524302bde8a5c81d6f4d1d67dddeb0f4b69f2845 100644 (file)
@@ -209,6 +209,8 @@ class CRM_Member_BAO_Query {
       case 'membership_type':
       case 'membership_type_id':
       case 'member_id':
+      case 'member_campaign_id':
+
         if (strpos($name, 'status') !== FALSE) {
           $name = 'status_id';
           $qillName = 'Membership Status(s)';
@@ -217,6 +219,10 @@ class CRM_Member_BAO_Query {
           $name = 'id';
           $qillName = 'Membership ID';
         }
+        elseif ($name == 'member_campaign_id') {
+          $name = 'campaign_id';
+          $qillName = 'Campaign';
+        }
         else {
           $name = 'membership_type_id';
           $qillName = 'Membership Type(s)';
@@ -290,16 +296,6 @@ class CRM_Member_BAO_Query {
         }
         $query->_tables['civicrm_membership'] = $query->_whereTables['civicrm_membership'] = 1;
         return;
-
-      case 'member_campaign_id':
-        $campParams = array(
-          'op' => $op,
-          'campaign' => $value,
-          'grouping' => $grouping,
-          'tableName' => 'civicrm_membership',
-        );
-        CRM_Campaign_BAO_Query::componentSearchClause($campParams, $query);
-        return;
     }
   }
 
index 627fd5c64cbb17125b173b25d4d17f2edcf95890..ca06acb5c566bc2d9bf5e191e56a872e83635f94 100644 (file)
@@ -84,6 +84,13 @@ class CRM_Member_Form extends CRM_Contribute_Form_AbstractEditPayment {
    */
   public $_priceSet;
 
+  /**
+   * Values submitted to the form, processed along the way.
+   *
+   * @var array
+   */
+  protected $_params = array();
+
   public function preProcess() {
     // Check for edit permission.
     if (!CRM_Core_Permission::checkActionPermission('CiviMember', $this->_action)) {
@@ -341,15 +348,14 @@ class CRM_Member_Form extends CRM_Contribute_Form_AbstractEditPayment {
       'return' => $mapping,
     ));
 
+    $returnParams = array('is_recur' => TRUE);
     foreach ($mapping as $recurringFieldName => $membershipTypeFieldName) {
       $contributionRecurParams[$recurringFieldName] = $membershipType[$membershipTypeFieldName];
+      $returnParams[$recurringFieldName] = $membershipType[$membershipTypeFieldName];
     }
 
     $contributionRecur = civicrm_api3('ContributionRecur', 'create', $contributionRecurParams);
-    $returnParams = array(
-      'contributionRecurID' => $contributionRecur['id'],
-      'is_recur' => TRUE,
-    );
+    $returnParams['contributionRecurID'] = $contributionRecur['id'];
     return $returnParams;
   }
 
@@ -429,4 +435,34 @@ class CRM_Member_Form extends CRM_Contribute_Form_AbstractEditPayment {
     return $formValues;
   }
 
+  /**
+   * Assign billing name to the template.
+   */
+  protected function assignBillingName() {
+    $name = '';
+    if (!empty($this->_params['billing_first_name'])) {
+      $name = $this->_params['billing_first_name'];
+    }
+
+    if (!empty($this->_params['billing_middle_name'])) {
+      $name .= " {$this->_params['billing_middle_name']}";
+    }
+
+    if (!empty($this->_params['billing_last_name'])) {
+      $name .= " {$this->_params['billing_last_name']}";
+    }
+    $this->assign('billingName', $name);
+  }
+
+  /**
+   * Wrapper function for unit tests.
+   *
+   * @param array $formValues
+   */
+  public function testSubmit($formValues) {
+    $this->_memType = $formValues['membership_type_id'][1];
+    $this->_params = $formValues;
+    $this->submit();
+  }
+
 }
index 3ce126c72acb69b0dccbcc130f3c2786f4212cd3..2c7fb5a744a6e2a790055379154cac2e82ff9bfc 100644 (file)
@@ -186,7 +186,6 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
         CRM_Core_Error::fatal(ts("This Membership is linked to a contribution. You must have 'delete in CiviContribute' permission in order to delete this record."));
       }
     }
-    CRM_Core_Resources::singleton()->addVars('coreForm', array('contact_id' => (int) $this->_contactID));
 
     if ($this->_action & CRM_Core_Action::ADD) {
       if (!CRM_Member_BAO_Membership::statusAvailabilty($this->_contactID)) {
@@ -371,19 +370,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
       $this->assign('is_pay_later', TRUE);
     }
     if ($this->_mode) {
-      // set default country from config if no country set
-      $config = CRM_Core_Config::singleton();
-      if (empty($defaults["billing_country_id-{$this->_bltID}"])) {
-        $defaults["billing_country_id-{$this->_bltID}"] = $config->defaultContactCountry;
-      }
-
-      if (empty($defaults["billing_state_province_id-{$this->_bltID}"])) {
-        $defaults["billing_state_province_id-{$this->_bltID}"] = $config->defaultContactStateProvince;
-      }
-
-      $billingDefaults = $this->getProfileDefaults('Billing', $this->_contactID);
-      $defaults = array_merge($defaults, $billingDefaults);
-
+      $defaults = $this->getBillingDefaults($defaults);
       // hack to simplify credit card entry for testing
       // $defaults['credit_card_type']     = 'Visa';
       // $defaults['credit_card_number']   = '4807731747657838';
@@ -780,7 +767,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
         $errors['num_terms'] = ts('Please enter an integer for the number of terms.');
       }
 
-      if ($self->_mode || isset($params['record_contribution']) && empty($params['financial_type_id'])) {
+      if (($self->_mode || isset($params['record_contribution'])) && empty($params['financial_type_id'])) {
         $errors['financial_type_id'] = ts('Please enter the financial Type.');
       }
     }
@@ -952,7 +939,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
     // get the submitted form values.
     $this->_params = $this->controller->exportValues($this->_name);
 
-    $this->submit($this->_params);
+    $this->submit();
 
     $this->setUserContext();
   }
@@ -1004,21 +991,6 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
     $form->assign('customValues', $customValues);
 
     if ($form->_mode) {
-      $name = '';
-      if (!empty($form->_params['billing_first_name'])) {
-        $name = $form->_params['billing_first_name'];
-      }
-
-      if (!empty($form->_params['billing_middle_name'])) {
-        $name .= " {$form->_params['billing_middle_name']}";
-      }
-
-      if (!empty($form->_params['billing_last_name'])) {
-        $name .= " {$form->_params['billing_last_name']}";
-      }
-
-      $form->assign('billingName', $name);
-
       // assign the address formatted up for display
       $addressParts = array(
         "street_address-{$form->_bltID}",
@@ -1131,24 +1103,24 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
    *
    * This is also accessed by unit tests.
    *
-   * @param array $formValues
-   *
    * @return array
    */
-  public function submit($formValues) {
+  public function submit() {
     $isTest = ($this->_mode == 'test') ? 1 : 0;
-
+    $this->storeContactFields($this->_params);
+    $this->beginPostProcess();
+    $formValues = $this->_params;
     $joinDate = $startDate = $endDate = NULL;
     $membershipTypes = $membership = $calcDate = array();
     $membershipType = NULL;
 
     $mailSend = FALSE;
     $formValues = $this->setPriceSetParameters($formValues);
-
     $params = $softParams = $ids = array();
 
     $allMemberStatus = CRM_Member_PseudoConstant::membershipStatus();
     $allContributionStatus = CRM_Contribute_PseudoConstant::contributionStatus();
+    $this->processBillingAddress();
 
     if ($this->_id) {
       $ids['membership'] = $params['id'] = $this->_id;
@@ -1235,8 +1207,6 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
       }
     }
 
-    $this->storeContactFields($formValues);
-
     $params['contact_id'] = $this->_contactID;
 
     $fields = array(
@@ -1384,63 +1354,23 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
         $params['financial_type_id'] = CRM_Utils_Array::value('financial_type_id', $formValues);
       }
 
+      // @todo - test removing this line. The beginPostProcess Function should have done it for us.
       $this->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($formValues['payment_processor_id'],
         $this->_mode
       );
 
-      //get the payment processor id as per mode.
+      //get the payment processor id as per mode. Try removing in favour of beginPostProcess.
       $params['payment_processor_id'] = $formValues['payment_processor_id'] = $this->_paymentProcessor['id'];
-
-      $now = date('YmdHis');
-      $fields = array();
-
-      // set email for primary location.
-      $fields['email-Primary'] = 1;
-      $formValues['email-5'] = $formValues['email-Primary'] = $this->_memberEmail;
-      $params['register_date'] = $now;
-
-      // now set the values for the billing location.
-      foreach ($this->_fields as $name => $dontCare) {
-        $fields[$name] = 1;
-      }
-
-      // also add location name to the array
-      $formValues["address_name-{$this->_bltID}"] = CRM_Utils_Array::value('billing_first_name', $formValues) . ' ' . CRM_Utils_Array::value('billing_middle_name', $formValues) . ' ' . CRM_Utils_Array::value('billing_last_name', $formValues);
-
-      $formValues["address_name-{$this->_bltID}"] = trim($formValues["address_name-{$this->_bltID}"]);
-
-      $fields["address_name-{$this->_bltID}"] = 1;
-      //ensure we don't over-write the payer's email with the member's email
-      if ($this->_contributorContactID == $this->_contactID) {
-        $fields["email-{$this->_bltID}"] = 1;
-      }
-
-      $nameFields = array('first_name', 'middle_name', 'last_name');
-
-      foreach ($nameFields as $name) {
-        $fields[$name] = 1;
-        if (array_key_exists("billing_$name", $formValues)) {
-          $formValues[$name] = $formValues["billing_{$name}"];
-          $formValues['preserveDBName'] = TRUE;
-        }
-      }
-      if ($this->_contributorContactID == $this->_contactID) {
-        //see CRM-12869 for discussion of why we don't do this for separate payee payments
-        CRM_Contact_BAO_Contact::createProfileContact($formValues, $fields,
-          $this->_contributorContactID, NULL, NULL,
-          CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_contactID, 'contact_type')
-        );
-      }
+      $params['register_date'] = date('YmdHis');
 
       // add all the additional payment params we need
+      // @todo the country & state values should be set by the call to $this->assignBillingAddress.
       $formValues["state_province-{$this->_bltID}"] = $formValues["billing_state_province-{$this->_bltID}"]
         = CRM_Core_PseudoConstant::stateProvinceAbbreviation($formValues["billing_state_province_id-{$this->_bltID}"]);
       $formValues["country-{$this->_bltID}"] = $formValues["billing_country-{$this->_bltID}"] = CRM_Core_PseudoConstant::countryIsoCode($formValues["billing_country_id-{$this->_bltID}"]);
 
-      $formValues['year'] = CRM_Core_Payment_Form::getCreditCardExpirationYear($formValues);
-      $formValues['month'] = CRM_Core_Payment_Form::getCreditCardExpirationMonth($formValues);
-      $formValues['ip_address'] = CRM_Utils_System::ipAddress();
       $formValues['amount'] = $params['total_amount'];
+      // @todo this is a candidate for beginPostProcessFunction.
       $formValues['currencyID'] = $config->defaultCurrency;
       $formValues['description'] = ts("Contribution submitted by a staff person using member's credit card for signup");
       $formValues['invoiceID'] = md5(uniqid(rand(), TRUE));
@@ -1463,6 +1393,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
         $paymentParams['email'] = $this->_contributorEmail;
       }
 
+      // This is a candidate for shared beginPostProcess function.
       CRM_Core_Payment_Form::mapParams($this->_bltID, $formValues, $paymentParams, TRUE);
       // CRM-7137 -for recurring membership,
       // we do need contribution and recurring records.
@@ -1486,7 +1417,6 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
             'payment_instrument_id' => $this->_paymentProcessor['payment_instrument_id'],
           ),
           $financialType,
-          TRUE,
           FALSE,
           $this->_bltID
         );
@@ -1551,6 +1481,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
           }
         }
       }
+      $now = date('YmdHis');
       $params['receive_date'] = $now;
       $params['invoice_id'] = $formValues['invoiceID'];
       $params['contribution_source'] = ts('%1 Membership Signup: Credit card or direct debit (by %2)',
@@ -1590,6 +1521,9 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
         if (!empty($softParams) && empty($paymentParams['is_recur'])) {
           $membershipParams['soft_credit'] = $softParams;
         }
+        if (isset($result['fee_amount'])) {
+          $membershipParams['fee_amount'] = $result['fee_amount'];
+        }
         // This is required to trigger the recording of the membership contribution in the
         // CRM_Member_BAO_Membership::Create function.
         // @todo stop setting this & 'teach' the create function to respond to something
@@ -1765,6 +1699,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
       // although at some point we should switch in the templates.
       $formValues['receipt_text_signup'] = $formValues['receipt_text'];
       // send email receipt
+      $this->assignBillingName();
       $mailSend = self::emailReceipt($this, $formValues, $membership);
     }
 
index fefe3843d0d4eddcae70c9013c0d7b4e28e8496c..12640d12252a473f5434be38b95fb7dbfd30113f 100644 (file)
@@ -266,12 +266,6 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa
         }
       }
 
-      if ($contributionPageId && !empty($params['member_price_set_id']) &&
-        CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $contributionPageId, 'amount_block_is_active')
-      ) {
-        $errors['member_price_set_id'] = ts('You cannot use Membership Price Sets with the Contribution Amounts section. However, a membership price set may include additional fields for non-membership options that requires an additional fee (e.g. magazine subscription) or an additional voluntary contribution.');
-      }
-
       if (!empty($params['member_price_set_id'])) {
         return $errors;
       }
@@ -360,6 +354,10 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa
         }
       }
 
+      if ($this->_id && !empty($params['member_price_set_id'])) {
+        CRM_Core_DAO::setFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'amount_block_is_active', 0);
+      }
+
       // check for price set.
       $priceSetID = CRM_Utils_Array::value('member_price_set_id', $params);
       if (!empty($params['member_is_active']) && is_array($membershipTypes) && !$priceSetID) {
index 224a3df3e0293eb5c79f1909957616fd26dc2e4c..b9020c78c20daa53f6ef30a48c3dcf95f2a1eef6 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -234,19 +232,7 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form {
     $this->assign('member_is_test', CRM_Utils_Array::value('member_is_test', $defaults));
 
     if ($this->_mode) {
-      // set default country from config if no country set
-      $config = CRM_Core_Config::singleton();
-      if (empty($defaults["billing_country_id-{$this->_bltID}"])) {
-        $defaults["billing_country_id-{$this->_bltID}"] = $config->defaultContactCountry;
-      }
-
-      if (empty($defaults["billing_state_province_id-{$this->_bltID}"])) {
-        $defaults["billing_state_province_id-{$this->_bltID}"] = $config->defaultContactStateProvince;
-      }
-
-      $billingDefaults = $this->getProfileDefaults('Billing', $this->_contactID);
-      $defaults = array_merge($defaults, $billingDefaults);
-
+      $defaults = $this->getBillingDefaults($defaults);
     }
     return $defaults;
   }
@@ -462,9 +448,6 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form {
 
   /**
    * Process the renewal form.
-   *
-   *
-   * @return void
    */
   public function postProcess() {
     // get the submitted form values.
@@ -506,11 +489,11 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form {
    */
   protected function submit() {
     $this->storeContactFields($this->_params);
-
+    $this->beginPostProcess();
     $now = CRM_Utils_Date::getToday(NULL, 'YmdHis');
     $this->convertDateFieldsToMySQL($this->_params);
     $this->assign('receive_date', $this->_params['receive_date']);
-    $this->processBillingAddress($now);
+    $this->processBillingAddress();
     list($userName) = CRM_Contact_BAO_Contact_Location::getEmailDetails(CRM_Core_Session::singleton()->get('userID'));
     $this->_params['total_amount'] = CRM_Utils_Array::value('total_amount', $this->_params,
       CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_memType, 'minimum_fee')
@@ -523,7 +506,7 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form {
     if (empty($this->_params['financial_type_id'])) {
       $this->_params['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_memType, 'financial_type_id');
     }
-
+    $contributionRecurID = NULL;
     $this->assign('membershipID', $this->_id);
     $this->assign('contactID', $this->_contactID);
     $this->assign('module', 'Membership');
@@ -541,17 +524,7 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form {
 
     if ($this->_mode) {
       $this->_params['register_date'] = $now;
-      $this->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($this->_params['payment_processor_id']);
-
-      $this->_params['year'] = CRM_Core_Payment_Form::getCreditCardExpirationYear($this->_params);
-      $this->_params['month'] = CRM_Core_Payment_Form::getCreditCardExpirationMonth($this->_params);
-      $this->assign('credit_card_exp_date', CRM_Utils_Date::mysqlToIso(CRM_Utils_Date::format($this->_params['credit_card_exp_date'])));
-      $this->assign('credit_card_number',
-        CRM_Utils_System::mungeCreditCard($this->_params['credit_card_number'])
-      );
-      $this->assign('credit_card_type', $this->_params['credit_card_type']);
       $this->_params['description'] = ts("Contribution submitted by a staff person using member's credit card for renewal");
-      $this->_params['ip_address'] = CRM_Utils_System::ipAddress();
       $this->_params['amount'] = $this->_params['total_amount'];
 
       // at this point we've created a contact and stored its address etc
@@ -570,6 +543,7 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form {
 
       if (!empty($this->_params['auto_renew'])) {
         $contributionRecurParams = $this->processRecurringContribution($paymentParams);
+        $contributionRecurID = $contributionRecurParams['contributionRecurID'];
         $paymentParams = array_merge($paymentParams, $contributionRecurParams);
       }
 
@@ -642,7 +616,7 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form {
           $li['financial_type_id'] = $submittedFinancialType;
         }
       }
-      $this->_params['total_amount'] = CRM_Utils_Array::value('amount', $this->_params);
+
       if (!empty($lineItem)) {
         $this->_params['lineItems'] = $lineItem;
         $this->_params['processPriceSet'] = TRUE;
@@ -749,62 +723,23 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form {
   }
 
   /**
-   * Wrapper function for unit tests.
+   * @param $defaults
    *
-   * @param array $formValues
+   * @return array
    */
-  public function testSubmit($formValues) {
-    $this->_memType = $formValues['membership_type_id'][1];
-    $this->_params = $formValues;
-    $this->submit($formValues);
-  }
-
-  protected function assignBillingName() {
-    $name = '';
-    if (!empty($this->_params['billing_first_name'])) {
-      $name = $this->_params['billing_first_name'];
-    }
-
-    if (!empty($this->_params['billing_middle_name'])) {
-      $name .= " {$this->_params['billing_middle_name']}";
+  protected function getBillingDefaults($defaults) {
+    // set default country from config if no country set
+    $config = CRM_Core_Config::singleton();
+    if (empty($defaults["billing_country_id-{$this->_bltID}"])) {
+      $defaults["billing_country_id-{$this->_bltID}"] = $config->defaultContactCountry;
     }
 
-    if (!empty($this->_params['billing_last_name'])) {
-      $name .= " {$this->_params['billing_last_name']}";
+    if (empty($defaults["billing_state_province_id-{$this->_bltID}"])) {
+      $defaults["billing_state_province_id-{$this->_bltID}"] = $config->defaultContactStateProvince;
     }
-    $this->assign('billingName', $name);
-  }
-
-  /**
-   * Add the billing address to the contact who paid.
-   */
-  protected function processBillingAddress() {
-    $fields = array();
 
-    // set email for primary location.
-    $fields['email-Primary'] = 1;
-    $this->_params['email-5'] = $this->_params['email-Primary'] = $this->_contributorEmail;
-
-    // also add location name to the array
-    $this->_params["address_name-{$this->_bltID}"] = CRM_Utils_Array::value('billing_first_name', $this->_params) . ' ' . CRM_Utils_Array::value('billing_middle_name', $this->_params) . ' ' . CRM_Utils_Array::value('billing_last_name', $this->_params);
-
-    $this->_params["address_name-{$this->_bltID}"] = trim($this->_params["address_name-{$this->_bltID}"]);
-
-    $fields["address_name-{$this->_bltID}"] = 1;
-    $fields["email-{$this->_bltID}"] = 1;
-
-    list($hasBillingField, $addressParams) = CRM_Contribute_BAO_Contribution::getPaymentProcessorReadyAddressParams($this->_params, $this->_bltID);
-
-    $addressParams['preserveDBName'] = TRUE;
-    if ($hasBillingField) {
-      $addressParams = array_merge($this->_params, $addressParams);
-      //here we are setting up the billing contact - if different from the member they are already created
-      // but they will get billing details assigned
-      CRM_Contact_BAO_Contact::createProfileContact($addressParams, $fields,
-        $this->_contributorContactID, NULL, NULL,
-        CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_contactID, 'contact_type')
-      );
-    }
+    $billingDefaults = $this->getProfileDefaults('Billing', $this->_contactID);
+    return array_merge($defaults, $billingDefaults);
   }
 
 }
index 7ad376ebcac98fc23707151577cbed76d4d812e6..d9cb9f87f903b21753b6c7734f484027f68dbc51 100644 (file)
@@ -71,7 +71,7 @@ class CRM_Member_Form_Task_PickProfile extends CRM_Member_Form_Task {
     $validate = FALSE;
     //validations
     if (count($this->_memberIds) > $this->_maxMembers) {
-      CRM_Core_Session::setStatus(ts("The maximum number of members you can select for Batch Update is %1. You have selected %2. Please select fewer members from your search results and try again.", array(
+      CRM_Core_Session::setStatus(ts("The maximum number of members you can select for Batch update is %1. You have selected %2. Please select fewer members from your search results and try again.", array(
             1 => $this->_maxMembers,
             2 => count($this->_memberIds),
           )), ts('Batch Update Error'), 'error');
@@ -95,7 +95,7 @@ class CRM_Member_Form_Task_PickProfile extends CRM_Member_Form_Task {
     $profiles = CRM_Core_BAO_UFGroup::getProfiles($types, TRUE);
 
     if (empty($profiles)) {
-      CRM_Core_Session::setStatus(ts("You will need to create a Profile containing the %1 fields you want to edit before you can use Batch Update via Profile. Navigate to Administer CiviCRM >> CiviCRM Profile to configure a Profile. Consult the online Administrator documentation for more information.", array(1 => $types[0])), ts('Batch Update Error'), 'error');
+      CRM_Core_Session::setStatus(ts("You will need to create a Profile containing the %1 fields you want to edit before you can use Batch update memberships via profile. Navigate to Administer CiviCRM >> CiviCRM Profile to configure a Profile. Consult the online Administrator documentation for more information.", array(1 => $types[0])), ts('Batch Update Error'), 'error');
       CRM_Utils_System::redirect($this->_userContext);
     }
 
index 4d47489cfab5c9d61516b23b2038bb2e7eb2b531..a317c87e142311e5e02640cb75a89b646685bcca 100644 (file)
@@ -67,17 +67,17 @@ class CRM_Member_Task {
     if (!(self::$_tasks)) {
       self::$_tasks = array(
         1 => array(
-          'title' => ts('Delete Memberships'),
+          'title' => ts('Delete memberships'),
           'class' => 'CRM_Member_Form_Task_Delete',
           'result' => FALSE,
         ),
         2 => array(
-          'title' => ts('Print Selected Rows'),
+          'title' => ts('Print selected rows'),
           'class' => 'CRM_Member_Form_Task_Print',
           'result' => FALSE,
         ),
         3 => array(
-          'title' => ts('Export Members'),
+          'title' => ts('Export members'),
           'class' => array(
             'CRM_Export_Form_Select',
             'CRM_Export_Form_Map',
@@ -85,12 +85,12 @@ class CRM_Member_Task {
           'result' => FALSE,
         ),
         4 => array(
-          'title' => ts('Send Email to Contacts'),
+          'title' => ts('Email - send now'),
           'class' => 'CRM_Member_Form_Task_Email',
           'result' => TRUE,
         ),
         5 => array(
-          'title' => ts('Batch Update Members Via Profile'),
+          'title' => ts('Batch update memberships via profile'),
           'class' => array(
             'CRM_Member_Form_Task_PickProfile',
             'CRM_Member_Form_Task_Batch',
@@ -98,14 +98,14 @@ class CRM_Member_Task {
           'result' => TRUE,
         ),
         6 => array(
-          'title' => ts('Mailing Labels'),
+          'title' => ts('Mailing labels - print'),
           'class' => array(
             'CRM_Member_Form_Task_Label',
           ),
           'result' => TRUE,
         ),
         7 => array(
-          'title' => ts('Print PDF Letters for Memberships'),
+          'title' => ts('PDF letters - print for memberships'),
           'class' => 'CRM_Member_Form_Task_PDFLetter',
           'result' => FALSE,
         ),
index e4b176c9fb5cbb6f646b21ba0a6954bc74d59ead..6d5f4f2c37d7d1fd820b4d3006a129bbbb6b5152 100644 (file)
@@ -355,21 +355,13 @@ class CRM_Pledge_BAO_Query {
         $query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1;
         return;
 
-      case 'pledge_campaign_id':
-        $campParams = array(
-          'op' => $op,
-          'campaign' => $value,
-          'grouping' => $grouping,
-          'tableName' => 'civicrm_pledge',
-        );
-        CRM_Campaign_BAO_Query::componentSearchClause($campParams, $query);
-        return;
-
       case 'pledge_contact_id':
+      case 'pledge_campaign_id':
         $name = str_replace('pledge_', '', $name);
         $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_pledge.$name", $op, $value, 'Integer');
         list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Pledge_DAO_Pledge', $name, $value, $op);
-        $query->_qill[$grouping][] = ts('Contact ID %1 %2', array(1 => $op, 2 => $value));
+        $label = ($name == 'campaign_id') ? 'Campaign' : 'Contact ID';
+        $query->_qill[$grouping][] = ts('%1 %2 %3', array(1 => $label, 2 => $op, 3 => $value));
         $query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1;
         return;
     }
index 80827f2927a7242096d756547b41a55e28f45fd2..c9f1880397c98b216ff3a5a67ddc70d0ac56d787 100644 (file)
@@ -115,7 +115,7 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form {
       $params = array('id' => $this->_id);
       CRM_Pledge_BAO_Pledge::getValues($params, $this->_values);
 
-      $this->_isPending = (CRM_Pledge_BAO_Pledge::pledgeHasFinancialTransactions($this->_id, CRM_Utils_Array::value('status_id', $this->_values))) ? FALSE : T;
+      $this->_isPending = (CRM_Pledge_BAO_Pledge::pledgeHasFinancialTransactions($this->_id, CRM_Utils_Array::value('status_id', $this->_values))) ? FALSE : TRUE;
     }
 
     //get the pledge frequency units.
index 14175f212e19a6a7544d47eea5496dfe60db82a0..7aac36e1d3b8fe4759f05328ba97c19b1657718d 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This class generates task actions for CiviEvent
- *
+ * This class generates task actions for CiviEvent.
  */
 class CRM_Pledge_Form_Task extends CRM_Core_Form {
 
@@ -69,10 +66,6 @@ class CRM_Pledge_Form_Task extends CRM_Core_Form {
 
   /**
    * Build all the data structures needed to build the form.
-   *
-   * @param
-   *
-   * @return void
    */
   public function preProcess() {
     self::preProcessCommon($this);
@@ -154,9 +147,6 @@ class CRM_Pledge_Form_Task extends CRM_Core_Form {
    * @param string $nextType
    * @param string $backType
    * @param bool $submitOnce
-   *
-   *
-   * @return void
    */
   public function addDefaultButtons($title, $nextType = 'next', $backType = 'back', $submitOnce = FALSE) {
     $this->addButtons(array(
index 84d0589feca4e8fb352bd3a929f11128ca779956..ab9dda4aeb3fe42dfd61a03ed7dede10f3ba2222 100644 (file)
@@ -66,17 +66,17 @@ class CRM_Pledge_Task {
     if (!self::$_tasks) {
       self::$_tasks = array(
         1 => array(
-          'title' => ts('Delete Pledges'),
+          'title' => ts('Delete pledges'),
           'class' => 'CRM_Pledge_Form_Task_Delete',
           'result' => FALSE,
         ),
         2 => array(
-          'title' => ts('Print Selected Rows'),
+          'title' => ts('Print selected rows'),
           'class' => 'CRM_Pledge_Form_Task_Print',
           'result' => FALSE,
         ),
         3 => array(
-          'title' => ts('Export Pledges'),
+          'title' => ts('Export pledges'),
           'class' => array(
             'CRM_Export_Form_Select',
             'CRM_Export_Form_Map',
index 5614c0cc683cb787b952ac91bb2e0910d5ff64f0..e7d71e598c00994b09507770dd9e658efd96bb53 100644 (file)
@@ -941,7 +941,7 @@ class CRM_Report_Form extends CRM_Core_Form {
   /**
    * Setter for $_force.
    *
-   * @param $isForce
+   * @param bool $isForce
    */
   public function setForce($isForce) {
     $this->_force = $isForce;
@@ -1418,8 +1418,10 @@ class CRM_Report_Form extends CRM_Core_Form {
   }
 
   /**
-   * A form rule function to ensure that fields selected in group_by
-   * (if any) should only be the ones present in display/select fields criteria;
+   * A form rule function for custom data.
+   *
+   * The rule ensures that fields selected in group_by if any) should only be the ones
+   * present in display/select fields criteria;
    * note: works if and only if any custom field selected in group_by.
    *
    * @param array $fields
@@ -1819,7 +1821,7 @@ class CRM_Report_Form extends CRM_Core_Form {
    * Get SQL where clause for a date field.
    *
    * @param string $fieldName
-   * @param $relative
+   * @param string $relative
    * @param string $from
    * @param string $to
    * @param string $type
@@ -2005,9 +2007,11 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
   }
 
   /**
-   * @param $value
-   * @param $customField
-   * @param $fieldValueMap
+   * Format custom values.
+   *
+   * @param mixed $value
+   * @param array $customField
+   * @param array $fieldValueMap
    *
    * @return float|string|void
    */
@@ -2125,7 +2129,9 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
   }
 
   /**
-   * @param $rows
+   * Remove duplicate rows.
+   *
+   * @param array $rows
    */
   public function removeDuplicates(&$rows) {
     if (empty($this->_noRepeats)) {
@@ -2148,8 +2154,10 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
   }
 
   /**
-   * @param $row
-   * @param $fields
+   * Fix subtotal display.
+   *
+   * @param array $row
+   * @param array $fields
    * @param bool $subtotal
    */
   public function fixSubTotalDisplay(&$row, $fields, $subtotal = TRUE) {
@@ -2169,7 +2177,9 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
   }
 
   /**
-   * @param $rows
+   * Calculate grant total.
+   *
+   * @param array $rows
    *
    * @return bool
    */
@@ -2198,7 +2208,9 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
   }
 
   /**
-   * @param $rows
+   * Format display output.
+   *
+   * @param array $rows
    * @param bool $pager
    */
   public function formatDisplay(&$rows, $pager = TRUE) {
@@ -2248,7 +2260,9 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
   }
 
   /**
-   * @param $rows
+   * Build chart.
+   *
+   * @param array $rows
    */
   public function buildChart(&$rows) {
     // override this method for building charts.
@@ -2259,7 +2273,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
   // towards generalizing the select() method below.
 
   /**
-   * Generate the SELECT clause and set class variable $_select
+   * Generate the SELECT clause and set class variable $_select.
    */
   public function select() {
     $select = $this->_selectAliases = array();
@@ -2282,9 +2296,9 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
           ) {
 
             // 1. In many cases we want select clause to be built in slightly different way
-            //    for a particular field of a particular type.
+            // for a particular field of a particular type.
             // 2. This method when used should receive params by reference and modify $this->_columnHeaders
-            //    as needed.
+            // as needed.
             $selectClause = $this->selectClause($tableName, 'fields', $fieldName, $field);
             if ($selectClause) {
               $select[] = $selectClause;
@@ -2356,9 +2370,9 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
             $this->_phoneField = TRUE;
           }
           // 1. In many cases we want select clause to be built in slightly different way
-          //    for a particular field of a particular type.
+          // for a particular field of a particular type.
           // 2. This method when used should receive params by reference and modify $this->_columnHeaders
-          //    as needed.
+          // as needed.
           $selectClause = $this->selectClause($tableName, 'group_bys', $fieldName, $field);
           if ($selectClause) {
             $select[] = $selectClause;
@@ -2422,10 +2436,12 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
   }
 
   /**
+   * Build select clause for a single field.
+   *
    * @param string $tableName
-   * @param $tableKey
+   * @param string $tableKey
    * @param string $fieldName
-   * @param $field
+   * @param string $field
    *
    * @return bool
    */
@@ -2433,6 +2449,9 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
     return FALSE;
   }
 
+  /**
+   * Build where clause.
+   */
   public function where() {
     $this->storeWhereHavingClauseArray();
 
@@ -2455,8 +2474,9 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
   }
 
   /**
-   * Store Where clauses into an array - breaking out this step makes
-   * over-riding more flexible as the clauses can be used in constructing a
+   * Store Where clauses into an array.
+   *
+   * Breaking out this step makes over-riding more flexible as the clauses can be used in constructing a
    * temp table that may not be part of the final where clause or added
    * in other functions
    */
@@ -2517,6 +2537,9 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
 
   }
 
+  /**
+   * Set output mode.
+   */
   public function processReportMode() {
     $buttonName = $this->controller->getButtonName();
 
@@ -2583,7 +2606,9 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
   }
 
   /**
-   * Post Processing function for Form (postProcessCommon should be used to set other variables from input as the api accesses that function)
+   * Post Processing function for Form.
+   *
+   * postProcessCommon should be used to set other variables from input as the api accesses that function.
    */
   public function beginPostProcess() {
     $this->setParams($this->controller->exportValues($this->_name));
@@ -2617,13 +2642,13 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
   }
 
   /**
-   * BeginPostProcess function run in both report mode and non-report mode (api)
+   * BeginPostProcess function run in both report mode and non-report mode (api).
    */
-  public function beginPostProcessCommon() {
-
-  }
+  public function beginPostProcessCommon() {}
 
   /**
+   * Build the report query.
+   *
    * @param bool $applyLimit
    *
    * @return string
@@ -2651,6 +2676,9 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
     return $sql;
   }
 
+  /**
+   * Build group by clause.
+   */
   public function groupBy() {
     $groupBys = array();
     if (!empty($this->_params['group_bys']) &&
@@ -2673,6 +2701,9 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
     }
   }
 
+  /**
+   * Build order by clause.
+   */
   public function orderBy() {
     $this->_orderBy = "";
     $this->_sections = array();
@@ -2684,6 +2715,8 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
   }
 
   /**
+   * Extract order by fields and store as an array.
+   *
    * In some cases other functions want to know which fields are selected for ordering by
    * Separating this into a separate function allows it to be called separately from constructing
    * the order by clause
@@ -2741,6 +2774,8 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
   }
 
   /**
+   * Determine unselected columns.
+   *
    * @return array
    */
   public function unselectedSectionColumns() {
@@ -2767,8 +2802,10 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
   }
 
   /**
-   * @param $sql
-   * @param $rows
+   * Build output rows.
+   *
+   * @param string $sql
+   * @param array $rows
    */
   public function buildRows($sql, &$rows) {
     $dao = CRM_Core_DAO::executeQuery($sql);
@@ -2801,9 +2838,11 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
   }
 
   /**
+   * Calculate section totals.
+   *
    * When "order by" fields are marked as sections, this assigns to the template
    * an array of total counts for each section. This data is used by the Smarty
-   * plugin {sectionTotal}
+   * plugin {sectionTotal}.
    */
   public function sectionTotals() {
 
@@ -2864,12 +2903,17 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
     }
   }
 
+  /**
+   * Modify column headers.
+   */
   public function modifyColumnHeaders() {
     // use this method to modify $this->_columnHeaders
   }
 
   /**
-   * @param $rows
+   * Assign rows to the template.
+   *
+   * @param array $rows
    */
   public function doTemplateAssignment(&$rows) {
     $this->assign_by_ref('columnHeaders', $this->_columnHeaders);
@@ -2878,8 +2922,11 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
   }
 
   /**
-   * override this method to build your own statistics
-   * @param $rows
+   * Build report statistics.
+   *
+   * Override this method to build your own statistics.
+   *
+   * @param array $rows
    *
    * @return array
    */
@@ -2902,8 +2949,10 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
   }
 
   /**
-   * @param $statistics
-   * @param $count
+   * Add count statistics.
+   *
+   * @param array $statistics
+   * @param int $count
    */
   public function countStat(&$statistics, $count) {
     $statistics['counts']['rowCount'] = array(
@@ -2920,7 +2969,9 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
   }
 
   /**
-   * @param $statistics
+   * Add group by statistics.
+   *
+   * @param array $statistics
    */
   public function groupByStat(&$statistics) {
     if (!empty($this->_params['group_bys']) &&
@@ -2944,7 +2995,9 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
   }
 
   /**
-   * @param $statistics
+   * Filter statistics.
+   *
+   * @param array $statistics
    */
   public function filterStat(&$statistics) {
     foreach ($this->_columns as $tableName => $table) {
@@ -3204,6 +3257,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
 
   /**
    * Compile the report content.
+   *
    * Although this function is super-short it is useful to keep separate so it can be over-ridden by report classes.
    *
    * @return string
@@ -3216,6 +3270,9 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
   }
 
 
+  /**
+   * Post process function.
+   */
   public function postProcess() {
     // get ready with post process params
     $this->beginPostProcess();
@@ -3239,7 +3296,10 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
   }
 
   /**
+   * Set limit.
+   *
    * @param int $rowCount
+   *
    * @return array
    */
   public function limit($rowCount = self::ROW_COUNT_LIMIT) {
@@ -3288,6 +3348,8 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
   }
 
   /**
+   * Set pager.
+   *
    * @param int $rowCount
    */
   public function setPager($rowCount = self::ROW_COUNT_LIMIT) {
@@ -3316,9 +3378,11 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
   }
 
   /**
-   * @param $field
-   * @param $value
-   * @param $op
+   * Build where clause for groups.
+   *
+   * @param string $field
+   * @param mixed $value
+   * @param string $op
    *
    * @return string
    */
@@ -3367,9 +3431,11 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
   }
 
   /**
-   * @param $field
-   * @param $value
-   * @param $op
+   * Build where clause for tags.
+   *
+   * @param string $field
+   * @param mixed $value
+   * @param string $op
    *
    * @return string
    */
@@ -3418,6 +3484,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
 
   /**
    * Generate Membership Type SQL Clause.
+   *
    * @param mixed $value
    * @param string $op
    *
@@ -3444,6 +3511,8 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
   }
 
   /**
+   * Build acl clauses.
+   *
    * @param string $tableAlias
    */
   public function buildACLClause($tableAlias = 'contact_a') {
@@ -3451,6 +3520,8 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
   }
 
   /**
+   * Add custom data to the columns.
+   *
    * @param bool $addFields
    * @param array $permCustomGroupIds
    */
@@ -3643,6 +3714,9 @@ ORDER BY cg.weight, cf.weight";
     }
   }
 
+  /**
+   * Build custom data from clause.
+   */
   public function customDataFrom() {
     if (empty($this->_customGroupExtends)) {
       return;
@@ -3681,7 +3755,9 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a
   }
 
   /**
-   * @param $prop
+   * Check if the field is selected.
+   *
+   * @param string $prop
    *
    * @return bool
    */
@@ -3803,7 +3879,7 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a
   }
 
   /**
-   * Does table name have columns in SELECT clause?
+   * Check if table name has columns in SELECT clause.
    *
    * @param string $tableName
    *   Name of table (index of $this->_columns array).
@@ -3816,7 +3892,8 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a
 
   /**
    * Fetch array of DAO tables having columns included in SELECT or ORDER BY clause.
-   * (building the array if it's unset)
+   *
+   * If the array is unset it will be built.
    *
    * @return array
    *   selectedTables
@@ -3870,6 +3947,8 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a
   }
 
   /**
+   * Add address fields.
+   *
    * @deprecated - use getAddressColumns which is a more accurate description
    * and also accepts an array of options rather than a long list
    *
@@ -4031,11 +4110,11 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a
   /**
    * Do AlterDisplay processing on Address Fields.
    *
-   * @param $row
-   * @param $rows
-   * @param $rowNum
-   * @param $baseUrl
-   * @param $urltxt
+   * @param array $row
+   * @param array $rows
+   * @param int $rowNum
+   * @param string $baseUrl
+   * @param string $urltxt
    *
    * @return bool
    */
@@ -4206,6 +4285,8 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a
   }
 
   /**
+   * Add contact to group.
+   *
    * @param int $groupID
    */
   public function add2group($groupID) {
@@ -4236,7 +4317,7 @@ LEFT JOIN civicrm_contact {$field['alias']} ON {$field['alias']}.id = {$this->_a
   }
 
   /**
-   * function used for showing charts on print screen.
+   * Show charts on print screen.
    */
   public static function uploadChartImage() {
     // upload strictly for '.png' images
index f35071069fd81a06bab16e8f788f6d1b2687531d..3ce059f8f52cda43bcbd059b9ab34b73022ff58d 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Report_Form_Activity extends CRM_Report_Form {
   protected $_selectAliasesTotal = array();
@@ -256,69 +254,16 @@ class CRM_Report_Form_Activity extends CRM_Report_Form {
           'activity_type_id' => array(
             'title' => ts('Activity Type'),
             'default_weight' => '2',
-            'dbAlias' => "option_value_civireport",
+            'dbAlias' => 'field(civicrm_activity_activity_type_id, ' . implode(', ', array_keys($this->activityTypes)) . ')',
           ),
         ),
         'grouping' => 'activity-fields',
         'alias' => 'activity',
       ),
+      // Hack to get $this->_alias populated for the table.
       'civicrm_activity_contact' => array(
         'dao' => 'CRM_Activity_DAO_ActivityContact',
-        'fields' => array(// so we have $this->_alias populated
-        ),
-      ),
-      'civicrm_option_value' => array(
-        'dao' => 'CRM_Core_DAO_OptionValue',
-        'fields' => array(// so we have $this->_alias populated
-        ),
-        'status_id' =>
-        array(
-          'title' => ts('Activity Status'),
-          'default' => TRUE,
-          'type' => CRM_Utils_Type::T_STRING,
-        ),
-        'duration' =>
-        array(
-          'title' => ts('Duration'),
-          'type' => CRM_Utils_Type::T_INT,
-        ),
-        'location' =>
-        array(
-          'title' => ts('Location'),
-          'type' => CRM_Utils_Type::T_STRING,
-        ),
-        'details' => array(
-          'title' => ts('Activity Details'),
-        ),
-      ),
-      'filters' => array(
-        'activity_date_time' => array(
-          'default' => 'this.month',
-          'operatorType' => CRM_Report_Form::OP_DATE,
-        ),
-        'activity_subject' =>
-        array('title' => ts('Activity Subject')),
-        'location' =>
-        array(
-          'title' => ts('Location'),
-          'type' => CRM_Utils_Type::T_TEXT,
-        ),
-        'activity_type_id' =>
-        array(
-          'title' => ts('Activity Type'),
-          'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-          'options' => $this->activityTypes,
-        ),
-        'status_id' =>
-        array(
-          'title' => ts('Activity Status'),
-          'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-          'options' => CRM_Core_PseudoConstant::activityStatus(),
-        ),
-        'details' => array(
-          'title' => ts('Activity Details'),
-          'type' => CRM_Utils_Type::T_TEXT,
-        ),
+        'fields' => array(),
       ),
     ) + $this->addressFields(TRUE);
 
@@ -382,6 +327,8 @@ class CRM_Report_Form_Activity extends CRM_Report_Form {
   }
 
   /**
+   * Build select clause.
+   *
    * @param null $recordType
    */
   public function select($recordType = NULL) {
@@ -475,8 +422,6 @@ class CRM_Report_Form_Activity extends CRM_Report_Form {
           $this->_selectAliases[] = $orderByFld['dbAlias'];
           $this->_selectClauses[] = "{$fldInfo['dbAlias']} as {$orderByFld['dbAlias']}";
         }
-        $this->_selectAliases[] = $this->_aliases['civicrm_option_value'];
-        $this->_selectClauses[] = "{$this->_aliases['civicrm_option_value']}.label as {$this->_aliases['civicrm_option_value']}";
         $this->_selectAliases = array_unique($this->_selectAliases);
         $this->_selectClauses = array_unique($this->_selectClauses);
       }
@@ -485,7 +430,9 @@ class CRM_Report_Form_Activity extends CRM_Report_Form {
   }
 
   /**
-   * @param $recordType
+   * Build from clause.
+   *
+   * @param string $recordType
    */
   public function from($recordType) {
     $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
@@ -569,14 +516,14 @@ class CRM_Report_Form_Activity extends CRM_Report_Form {
       }
       $this->_aliases['civicrm_contact'] = 'civicrm_contact_source';
     }
-    $this->_from .= " INNER JOIN civicrm_option_value {$this->_aliases['civicrm_option_value']}
-            ON {$this->_aliases['civicrm_option_value']}.option_group_id = {$activityTypeId}
-            AND {$this->_aliases['civicrm_option_value']}.value = {$this->_aliases['civicrm_activity']}.activity_type_id";
+
     $this->addAddressFromClause();
   }
 
   /**
-   * @param null $recordType
+   * Build where clause.
+   *
+   * @param string $recordType
    */
   public function where($recordType = NULL) {
     $this->_where = " WHERE {$this->_aliases['civicrm_activity']}.is_test = 0 AND
@@ -668,11 +615,16 @@ class CRM_Report_Form_Activity extends CRM_Report_Form {
     }
   }
 
+  /**
+   * Override group by function.
+   */
   public function groupBy() {
     $this->_groupBy = "GROUP BY {$this->_aliases['civicrm_activity']}.id";
   }
 
   /**
+   * Build ACL clause.
+   *
    * @param string $tableAlias
    */
   public function buildACLClause($tableAlias = 'contact_a') {
index 1f05721dac51e0536125c415413220087f98dd91..e2938671746aeb45f33d2b6686f44a9e27ce6a0d 100644 (file)
@@ -191,22 +191,22 @@ class CRM_Report_Form_Contribute_Recur extends CRM_Report_Form {
           'start_date' => array(
             'title' => ts('Start Date'),
             'operatorType' => CRM_Report_Form::OP_DATE,
-            'type' => CRM_Utils_Type::T_TIME,
+            'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
           ),
           'next_sched_contribution_date' => array(
             'title' => ts('Next Scheduled Contribution Date'),
             'operatorType' => CRM_Report_Form::OP_DATE,
-            'type' => CRM_Utils_Type::T_TIME,
+            'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
           ),
           'end_date' => array(
             'title' => ts('End Date'),
             'operatorType' => CRM_Report_Form::OP_DATE,
-            'type' => CRM_Utils_Type::T_TIME,
+            'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
           ),
-          'contribution_processed_date' => array(
+          'modified_date' => array(
             'title' => ts('Last Contribution Processed'),
             'operatorType' => CRM_Report_Form::OP_DATE,
-            'type' => CRM_Utils_Type::T_TIME,
+            'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
           ),
           'calculated_end_date' => array(
             'title' => ts('Calculated end date (either end date or date all installments will be made)'),
@@ -313,13 +313,8 @@ class CRM_Report_Form_Contribute_Recur extends CRM_Report_Form {
 ";
         $isBreak = TRUE;
       }
-      if (!empty($this->_params['contribution_processed_date_' . $suffix])) {
-        $relative = CRM_Utils_Array::value("contribution_processed_date_relative", $this->_params);
-        $from = CRM_Utils_Array::value("contribution_processed_date_from", $this->_params);
-        $to = CRM_Utils_Array::value("contribution_processed_date_to", $this->_params);
-        $this->_where .= " AND contribution_civireport.id IN (SELECT MAX(cc.id) FROM civicrm_contribution cc WHERE cc.contribution_status_id = 1 AND (" .
-        $this->dateClause("DATE(cc.receive_date)",
-            $relative, $from, $to, CRM_Utils_Type::T_DATE, NULL, NULL) . " ) GROUP BY cc.contribution_recur_id)";
+      if (!empty($this->_params['modified_date_' . $suffix])) {
+        $this->_where .= " AND {$this->_aliases['civicrm_contribution_recur']}.contribution_status_id = 1";
         $isBreak = TRUE;
       }
       if (!empty($isBreak)) {
index 84f7a3cfd46655b5f41022d42cbe4401746b2f0f..9cf28c5cbdc9e5bae4cdd8d6678395c5f44db940 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form {
   protected $_addressField = FALSE;
@@ -46,6 +44,7 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form {
   public $_drilldownReport = array('contribute/detail' => 'Link to Detail Report');
 
   /**
+<<<<<<< HEAD
    * To what frequency group-by a date column
    *
    * @var array
@@ -59,6 +58,9 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form {
   );
 
   /**
+=======
+   * Class constructor.
+>>>>>>> upstream/4.6
    */
   public function __construct() {
 
@@ -283,19 +285,9 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form {
     parent::__construct();
   }
 
-  public function preProcess() {
-    parent::preProcess();
-  }
-
   /**
-   * @param bool $freeze
-   *
-   * @return array
+   * Set select clause.
    */
-  public function setDefaultValues($freeze = TRUE) {
-    return parent::setDefaultValues($freeze);
-  }
-
   public function select() {
     $select = array();
     $this->_columnHeaders = array();
@@ -406,16 +398,17 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form {
   }
 
   /**
-   * @param $fields
-   * @param $files
-   * @param $self
+   * Set form rules.
+   *
+   * @param array $fields
+   * @param array $files
+   * @param CRM_Report_Form_Contribute_Summary $self
    *
    * @return array
    */
   public static function formRule($fields, $files, $self) {
-    $errors = $grouping = array();
-    //check for searching combination of dispaly columns and
-    //grouping criteria
+    // Check for searching combination of display columns and
+    // grouping criteria
     $ignoreFields = array('total_amount', 'sort_name');
     $errors = $self->customDataFormRule($fields, $ignoreFields);
 
@@ -434,6 +427,11 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form {
     return $errors;
   }
 
+  /**
+   * Set from clause.
+   *
+   * @param string $entity
+   */
   public function from($entity = NULL) {
     $softCreditJoinType = "LEFT";
     if (!empty($this->_params['fields']['soft_amount']) &&
@@ -474,6 +472,9 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form {
     }
   }
 
+  /**
+   * Set group by clause.
+   */
   public function groupBy() {
     $this->_groupBy = "";
     $append = FALSE;
@@ -528,6 +529,9 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form {
     }
   }
 
+  /**
+   * Store having clauses as an array.
+   */
   public function storeWhereHavingClauseArray() {
     parent::storeWhereHavingClauseArray();
     if (empty($this->_params['fields']['soft_amount']) &&
@@ -542,7 +546,9 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form {
   }
 
   /**
-   * @param $rows
+   * Set statistics.
+   *
+   * @param array $rows
    *
    * @return array
    */
@@ -550,12 +556,12 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form {
     $statistics = parent::statistics($rows);
 
     $softCredit = CRM_Utils_Array::value('soft_amount', $this->_params['fields']);
-    $onlySoftCredit = $softCredit &&
-      !CRM_Utils_Array::value('total_amount', $this->_params['fields']);
-    $totalAmount = $average = $softTotalAmount = $softAverage = array();
+    $onlySoftCredit = $softCredit && !CRM_Utils_Array::value('total_amount', $this->_params['fields']);
     $group = "\nGROUP BY {$this->_aliases['civicrm_contribution']}.currency";
 
     $this->from('contribution');
+    $this->customDataFrom();
+
     $contriQuery = "
 COUNT({$this->_aliases['civicrm_contribution']}.total_amount )        as civicrm_contribution_total_amount_count,
 SUM({$this->_aliases['civicrm_contribution']}.total_amount )          as civicrm_contribution_total_amount_sum,
@@ -565,12 +571,13 @@ ROUND(AVG({$this->_aliases['civicrm_contribution']}.total_amount), 2) as civicrm
 
     if ($softCredit) {
       $this->from();
-      $softSQL = "SELECT
+      $select = "
 COUNT({$this->_aliases['civicrm_contribution_soft']}.amount )        as civicrm_contribution_soft_soft_amount_count,
 SUM({$this->_aliases['civicrm_contribution_soft']}.amount )          as civicrm_contribution_soft_soft_amount_sum,
-ROUND(AVG({$this->_aliases['civicrm_contribution_soft']}.amount), 2) as civicrm_contribution_soft_soft_amount_avg,
-{$this->_aliases['civicrm_contribution']}.currency                    as currency
-{$this->_from} {$this->_where} {$group} {$this->_having}";
+ROUND(AVG({$this->_aliases['civicrm_contribution_soft']}.amount), 2) as civicrm_contribution_soft_soft_amount_avg";
+      $contriQuery = "{$select}, {$contriQuery}";
+      $softSQL = "SELECT {$select}, {$this->_aliases['civicrm_contribution']}.currency as currency
+      {$this->_from} {$this->_where} {$group} {$this->_having}";
     }
 
     $contriSQL = "SELECT {$contriQuery} {$group} {$this->_having}";
@@ -653,11 +660,20 @@ ROUND(AVG({$this->_aliases['civicrm_contribution_soft']}.amount), 2) as civicrm_
     return $statistics;
   }
 
+  /**
+   * Post process function.
+   */
   public function postProcess() {
     $this->buildACLClause($this->_aliases['civicrm_contact']);
     parent::postProcess();
   }
 
+  /**
+   * Build table rows for output.
+   *
+   * @param string $sql
+   * @param array $rows
+   */
   public function buildRows($sql, &$rows) {
     $dao = CRM_Core_DAO::executeQuery($sql);
     if (!is_array($rows)) {
@@ -666,7 +682,7 @@ ROUND(AVG({$this->_aliases['civicrm_contribution_soft']}.amount), 2) as civicrm_
 
     // use this method to modify $this->_columnHeaders
     $this->modifyColumnHeaders();
-
+    $contriRows = array();
     $unselectedSectionColumns = $this->unselectedSectionColumns();
 
     //CRM-16338 if both soft-credit and contribution are enabled then process the contribution's
@@ -716,7 +732,9 @@ ROUND(AVG({$this->_aliases['civicrm_contribution_soft']}.amount), 2) as civicrm_
   }
 
   /**
-   * @param $rows
+   * Build chart.
+   *
+   * @param array $rows
    */
   public function buildChart(&$rows) {
     $graphRows = array();
index c717bcac79dcaa7add11d25966c852fc45c9017f..662c9d1dabd4e6d278e996323a2a4a17fe090049 100644 (file)
@@ -43,7 +43,7 @@ class CRM_Report_Form_Mailing_Summary extends CRM_Report_Form {
 
   protected $_add2groupSupported = FALSE;
 
-  public $_drilldownReport = array('contact/detail' => 'Link to Detail Report');
+  public $_drilldownReport = array('mailing/detail' => 'Link to Detail Report');
 
   protected $_charts = array(
     '' => 'Tabular',
@@ -62,6 +62,12 @@ class CRM_Report_Form_Mailing_Summary extends CRM_Report_Form {
     $this->_columns['civicrm_mailing'] = array(
       'dao' => 'CRM_Mailing_DAO_Mailing',
       'fields' => array(
+        'id' => array(
+          'name' => 'id',
+          'title' => ts('Mailing ID'),
+          'required' => TRUE,
+          'no_display' => TRUE,
+        ),
         'name' => array(
           'title' => ts('Mailing Name'),
           'required' => TRUE,
@@ -181,12 +187,26 @@ class CRM_Report_Form_Mailing_Summary extends CRM_Report_Form {
     $this->_columns['civicrm_mailing_event_opened'] = array(
       'dao' => 'CRM_Mailing_DAO_Mailing',
       'fields' => array(
+        'unique_open_count' => array(
+          'name' => 'id',
+          'alias' => 'mailing_event_opened_civireport',
+          'dbAlias' => 'mailing_event_opened_civireport.event_queue_id',
+          'title' => ts('Unique Opens'),
+        ),
+        'unique_open_rate' => array(
+          'title' => 'Unique Open Rate',
+          'statistics' => array(
+            'calc' => 'PERCENTAGE',
+            'top' => 'civicrm_mailing_event_opened.unique_open_count',
+            'base' => 'civicrm_mailing_event_delivered.delivered_count',
+          ),
+        ),
         'open_count' => array(
           'name' => 'event_queue_id',
-          'title' => ts('Opened'),
+          'title' => ts('Total Opens'),
         ),
         'open_rate' => array(
-          'title' => 'Confirmed Open Rate',
+          'title' => 'Total Open Rate',
           'statistics' => array(
             'calc' => 'PERCENTAGE',
             'top' => 'civicrm_mailing_event_opened.open_count',
@@ -230,6 +250,14 @@ class CRM_Report_Form_Mailing_Summary extends CRM_Report_Form {
         'unsubscribe_count' => array(
           'name' => 'id',
           'title' => ts('Unsubscribe'),
+          'alias' => 'mailing_event_unsubscribe_civireport',
+          'dbAlias' => 'mailing_event_unsubscribe_civireport.event_queue_id',
+        ),
+        'optout_count' => array(
+          'name' => 'id',
+          'title' => ts('Opt-outs'),
+          'alias' => 'mailing_event_optout_civireport',
+          'dbAlias' => 'mailing_event_optout_civireport.event_queue_id',
         ),
       ),
     );
@@ -348,7 +376,9 @@ class CRM_Report_Form_Mailing_Summary extends CRM_Report_Form {
       LEFT JOIN civicrm_mailing_event_trackable_url_open {$this->_aliases['civicrm_mailing_event_trackable_url_open']}
         ON {$this->_aliases['civicrm_mailing_event_trackable_url_open']}.event_queue_id = {$this->_aliases['civicrm_mailing_event_queue']}.id
       LEFT JOIN civicrm_mailing_event_unsubscribe {$this->_aliases['civicrm_mailing_event_unsubscribe']}
-        ON {$this->_aliases['civicrm_mailing_event_unsubscribe']}.event_queue_id = {$this->_aliases['civicrm_mailing_event_queue']}.id";
+        ON {$this->_aliases['civicrm_mailing_event_unsubscribe']}.event_queue_id = {$this->_aliases['civicrm_mailing_event_queue']}.id AND {$this->_aliases['civicrm_mailing_event_unsubscribe']}.org_unsubscribe = 0
+      LEFT JOIN civicrm_mailing_event_unsubscribe mailing_event_optout_civireport
+        ON mailing_event_optout_civireport.event_queue_id = {$this->_aliases['civicrm_mailing_event_queue']}.id AND mailing_event_optout_civireport.org_unsubscribe = 1";
 
     if ($this->campaignEnabled) {
       $this->_from .= "
@@ -449,14 +479,16 @@ class CRM_Report_Form_Mailing_Summary extends CRM_Report_Form {
       'count' => array(
         'civicrm_mailing_event_delivered_delivered_count' => ts('Delivered'),
         'civicrm_mailing_event_bounce_bounce_count' => ts('Bounce'),
-        'civicrm_mailing_event_opened_open_count' => ts('Opened'),
+        'civicrm_mailing_event_opened_open_count' => ts('Total Opens'),
+        'civicrm_mailing_event_opened_unique_open_count' => ts('Unique Opens'),
         'civicrm_mailing_event_trackable_url_open_click_count' => ts('Clicks'),
         'civicrm_mailing_event_unsubscribe_unsubscribe_count' => ts('Unsubscribe'),
       ),
       'rate' => array(
         'civicrm_mailing_event_delivered_accepted_rate' => ts('Accepted Rate'),
         'civicrm_mailing_event_bounce_bounce_rate' => ts('Bounce Rate'),
-        'civicrm_mailing_event_opened_open_rate' => ts('Confirmed Open Rate'),
+        'civicrm_mailing_event_opened_open_rate' => ts('Total Open Rate'),
+        'civicrm_mailing_event_opened_unique_open_rate' => ts('Unique Open Rate'),
         'civicrm_mailing_event_trackable_url_open_CTR' => ts('Click through Rate'),
         'civicrm_mailing_event_trackable_url_open_CTO' => ts('Click to Open Rate'),
       ),
@@ -470,7 +502,7 @@ class CRM_Report_Form_Mailing_Summary extends CRM_Report_Form {
    *
    * @return array
    */
-  public function formRule($fields, $files, $self) {
+  public static function formRule($fields, $files, $self) {
     $errors = array();
 
     if (empty($fields['charts'])) {
@@ -491,6 +523,8 @@ class CRM_Report_Form_Mailing_Summary extends CRM_Report_Form {
         'open_rate',
         'CTR',
         'CTO',
+        'unique_open_rate',
+        'unique_open_count',
       ))) {
         $isError = FALSE;
       }
@@ -582,34 +616,17 @@ class CRM_Report_Form_Mailing_Summary extends CRM_Report_Form {
   public function alterDisplay(&$rows) {
     $entryFound = FALSE;
     foreach ($rows as $rowNum => $row) {
-      // make count columns point to detail report
-      // convert display name to links
-      if (array_key_exists('civicrm_contact_display_name', $row) &&
-        array_key_exists('civicrm_contact_id', $row)
+      // CRM-16506
+      if (array_key_exists('civicrm_mailing_name', $row) &&
+        array_key_exists('civicrm_mailing_id', $row)
       ) {
-        $url = CRM_Report_Utils_Report::getNextUrl('contact/detail',
-          'reset=1&force=1&id_op=eq&id_value=' . $row['civicrm_contact_id'],
+        $rows[$rowNum]['civicrm_mailing_name_link'] = CRM_Report_Utils_Report::getNextUrl('mailing/detail',
+          'reset=1&force=1&mailing_id_op=eq&mailing_id_value=' . $row['civicrm_mailing_id'],
           $this->_absoluteUrl, $this->_id, $this->_drilldownReport
         );
-        $rows[$rowNum]['civicrm_contact_display_name_link'] = $url;
-        $rows[$rowNum]['civicrm_contact_display_name_hover'] = ts("View Contact details for this contact.");
-        $entryFound = TRUE;
-      }
-
-      // handle country
-      if (array_key_exists('civicrm_address_country_id', $row)) {
-        if ($value = $row['civicrm_address_country_id']) {
-          $rows[$rowNum]['civicrm_address_country_id'] = CRM_Core_PseudoConstant::country($value, FALSE);
-        }
+        $rows[$rowNum]['civicrm_mailing_name_hover'] = ts('View Mailing details for this mailing');
         $entryFound = TRUE;
       }
-      if (array_key_exists('civicrm_address_state_province_id', $row)) {
-        if ($value = $row['civicrm_address_state_province_id']) {
-          $rows[$rowNum]['civicrm_address_state_province_id'] = CRM_Core_PseudoConstant::stateProvince($value, FALSE);
-        }
-        $entryFound = TRUE;
-      }
-
       // skip looking further in rows, if first row itself doesn't
       // have the column we need
       if (!$entryFound) {
index 64a21bc40545929e0ce783a514c45135f40db12e..d2c471f844beb66a02b49b59af257fc6d922bbd7 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * This file is used to build the form configuring mass sms details
+ * This file is used to build the form configuring mass sms details.
  */
 class CRM_SMS_Form_Upload extends CRM_Core_Form {
   public $_mailingID;
@@ -48,10 +46,6 @@ class CRM_SMS_Form_Upload extends CRM_Core_Form {
 
   /**
    * Set default values for the form.
-   * the default values are retrieved from the database
-   *
-   *
-   * @return void
    */
   public function setDefaultValues() {
     $mailingID = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE, NULL);
@@ -120,8 +114,6 @@ class CRM_SMS_Form_Upload extends CRM_Core_Form {
 
   /**
    * Build the form object.
-   *
-   * @return void
    */
   public function buildQuickForm() {
     $session = CRM_Core_Session::singleton();
diff --git a/CRM/Upgrade/4.7.alpha1.msg_template/message_templates/contribution_invoice_receipt_html.tpl b/CRM/Upgrade/4.7.alpha1.msg_template/message_templates/contribution_invoice_receipt_html.tpl
new file mode 100644 (file)
index 0000000..e88f1bd
--- /dev/null
@@ -0,0 +1,433 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns = "http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv = "Content-Type" content="text/html; charset=UTF-8" />
+      <title></title>
+  </head>
+  <body>
+    <table style = "margin-top:2px;padding-left:7px;">
+      <tr>
+        <td><img src = "{$resourceBase}/i/civi99.png" height = "34px" width = "99px"></td>
+      </tr>
+    </table>
+    <center>
+      <table style = "padding-right:19px;font-family: Arial, Verdana, sans-serif;" width = "500" height = "100" border = "0" cellpadding = "2" cellspacing = "1">
+  <tr>
+    <td style = "padding-left:15px;" ><b><font size = "4" align = "center">{ts}INVOICE{/ts}</font></b></td>
+          <td colspan = "1"></td>
+          <td style = "padding-left:70px;"><b><font size = "1" align = "center" >{ts}Invoice Date:{/ts}</font></b></td>
+          <td><font size = "1" align = "right">{$domain_organization}</font></td>
+  </tr>
+        <tr>
+         {if $organization_name}
+           <td style = "padding-left:17px;"><font size = "1" align = "center" >{$display_name}  ({$organization_name})</font></td>
+         {else}
+           <td style = "padding-left:15px;"><font size = "1" align = "center" >{$display_name}</font></td>
+         {/if}
+         <td colspan = "1"></td>
+         <td style = "padding-left:70px;"><font size = "1" align = "right">{$invoice_date}</font></td>
+   <td><font size = "1" align = "right">
+  {if $domain_street_address }
+    {$domain_street_address}
+  {/if}
+  {if $domain_supplemental_address_1 }{$domain_supplemental_address_1}{/if}</font></td>
+  </tr>
+        <tr>
+          <td style = "padding-left:17px;"><font size = "1" align = "center">{$street_address}   {$supplemental_address_1}</font></td>
+          <td colspan = "1"></td>
+          <td style = "padding-left:70px;"><b><font size = "1" align = "right">{ts}Invoice Number:{/ts}</font></b></td>
+    <td ><font size = "1" align = "right">{if $domain_supplemental_address_2 }{$domain_supplemental_address_2}{/if}
+    {if $domain_state }{$domain_state}{/if}</font></td>
+        </tr>
+        <tr>
+          <td style = "padding-left:17px;"><font size = "1" align = "center">{$supplemental_address_2}  {$stateProvinceAbbreviation}</font></td>
+          <td colspan="1"></td>
+          <td style = "padding-left:70px;"><font size = "1" align = "right">{$invoice_id}</font></td>
+    <td><font size = "1" align = "right">{if $domain_city}
+    {$domain_city}
+        {/if}
+        {if $domain_postal_code }
+    {$domain_postal_code}
+        {/if}
+    </font></td>
+  </tr>
+  <tr>
+          <td style = "padding-left:17px;"><font size = "1" align = "right">{$city}  {$postal_code}</font></td>
+          <td colspan="1"></td>
+    <td height = "10" style = "padding-left:70px;"><b><font size = "1"align = "right">{ts}Reference:{/ts}</font></b></td>
+    <td><font size = "1" align = "right"> {if $domain_country}
+    {$domain_country}
+        {/if}</font></td>
+  </tr>
+  <tr>
+    <td></td>
+    <td></td>
+    <td style = "padding-left:70px;"><font size = "1"align = "right">{$source}</font></td>
+    <td><font size = "1" align = "right"> {if $domain_phone}{$domain_phone}{/if}</font> </td>
+  </tr>
+  <tr>
+    <td></td>
+    <td></td>
+    <td></td>
+    <td><font size = "1" align = "right"> {if $domain_email}
+    {$domain_email}
+         {/if}</font> </td>
+  </tr>
+      </table>
+      <table style = "margin-top:75px;font-family: Arial, Verdana, sans-serif" width = "590" border = "0"cellpadding = "-5" cellspacing = "19" id = "desc">
+  <tr>
+          <td colspan = "2" {$valueStyle}>
+            <table> {* FIXME: style this table so that it looks like the text version (justification, etc.) *}
+              <tr>
+                <th style = "padding-right:34px;text-align:left;font-weight:bold;width:200px;"><font size = "1">{ts}Description{/ts}</font></th>
+                <th style = "padding-left:34px;text-align:right;font-weight:bold;" ><font size = "1">{ts}Quantity{/ts}</font></th>
+                <th style = "padding-left:34px;text-align:right;font-weight:bold;"><font size = "1">{ts}Unit Price{/ts}</font></th>
+                <th style = "padding-left:34px;text-align:right;font-weight:bold;width:20px;"><font size = "1">{$taxTerm} </font></th>
+                <th style = "padding-left:34px;text-align:right;font-weight:bold;"><font size = "1">{ts 1=$defaultCurrency}Amount %1{/ts}</font></th>
+              </tr>
+              {foreach from=$lineItem item=value key=priceset name=taxpricevalue}
+    {if $smarty.foreach.taxpricevalue.index eq 0}
+            <tr><td  colspan = "5" ><hr size="3" style = "color:#000;"></hr></td></tr>
+    {else}
+      <tr><td  colspan = "5" style = "color:#F5F5F5;"><hr></hr></td></tr>
+    {/if}
+                <tr>
+                  <td style="text-align:left;" ><font size = "1">
+      {if $value.html_type eq 'Text'}{$value.label}{else}{$value.field_title} - {$value.label}{/if} {if $value.description}<div>{$value.description|truncate:30:"..."}</div>{/if}
+      </font></td>
+      <td style = "padding-left:34px;text-align:right;"><font size = "1"> {$value.qty}</font></td>
+      <td style = "padding-left:34px;text-align:right;"><font size = "1"> {$value.unit_price|crmMoney:$currency}</font></td>
+        {if $value.tax_amount != ''}
+          <td style = "padding-left:34px;text-align:right;width:20px;"><font size = "1"> {$value.tax_rate}%</font></td>
+                    {else}
+          <td style = "padding-left:34px;text-align:right;width:20px;"><font size = "1">{ts 1=$taxTerm}No %1{/ts}</font></td>
+              {/if}
+        <td style = "padding-left:34px;text-align:right;"><font size = "1">{$value.subTotal|crmMoney:$currency}</font></td>
+    </tr>
+              {/foreach}
+          <tr><td  colspan = "5" style = "color:#F5F5F5;"><hr></hr></td></tr>
+          <tr>
+      <td colspan = "3"></td>
+      <td style = "padding-left:20px;text-align:right;"><font size = "1">{ts}Sub Total{/ts}</font></td>
+      <td style = "padding-left:34px;text-align:right;"><font size = "1"> {$subTotal|crmMoney:$currency}</font></td>
+    </tr>
+    {foreach from = $dataArray item = value key = priceset}
+            <tr>
+        <td colspan = "3"></td>
+        {if $priceset}
+          <td style = "padding-left:20px;text-align:right;"><font size = "1"> {ts 1=$taxTerm 2=$priceset}TOTAL %1 %2%{/ts}</font></td>
+          <td style = "padding-left:34px;text-align:right"><font size = "1" align = "right">{$value|crmMoney:$currency}</font> </td>
+                    {elseif $priceset == 0}
+                      <td style = "padding-left:20px;text-align:right;"><font size = "1">{ts 1=$taxTerm}TOTAL NO %1{/ts}</font></td>
+                      <td style = "padding-left:34px;text-align:right"><font size = "1" align = "right">{$value|crmMoney:$currency}</font> </td>
+                  </tr>
+        {/if}
+    {/foreach}
+          <tr>
+      <td colspan = "3"></td>
+      <td colspan = "2"><hr></hr></td>
+    </tr>
+
+          <tr>
+      <td colspan = "3"></td>
+      <td style = "padding-left:20px;text-align:right;"><b><font size = "1">{ts 1=$defaultCurrency}TOTAL %1{/ts}</font></b></td>
+      <td style = "padding-left:34px;text-align:right;"><font size = "1">{$amount|crmMoney:$currency}</font></td>
+    </tr>
+
+    {if $is_pay_later == 0}
+            <tr>
+        <td colspan = "3"></td>
+        <td style = "padding-left:20px;text-align:right;"><font size = "1">
+           {if $contribution_status_id == $refundedStatusId}
+          {ts}LESS Amount Credited{/ts}
+           {else}
+          {ts}LESS Amount Paid{/ts}
+           {/if}
+        </font></td>
+        <td style = "padding-left:34px;text-align:right;"><font size = "1">{$amount|crmMoney:$currency}</font></td>
+      </tr>
+            <tr>
+        <td colspan = "3"></td>
+        <td colspan = "2" ><hr></hr></td>
+      </tr>
+            <tr>
+        <td colspan = "3"></td>
+        <td style = "padding-left:20px;text-align:right;"><b><font size = "1">{ts}AMOUNT DUE:{/ts} </font></b></td>
+                    <td style = "padding-left:34px;text-align:right;"><b><font size = "1">{$amountDue|crmMoney:$currency}</font></b></td>                 <td style = "padding-left:34px;"><font size = "1" align = "right"></fonts></td>
+      </tr>
+    {/if}
+    <br/><br/><br/>
+          <tr>
+      <td colspan = "3"></td>
+    </tr>
+          <tr>
+      <td><b><font size = "1" align = "center">{ts 1=$dueDate}DUE DATE: %1{/ts}</font></b></td>
+      <td colspan = "3"></td>
+    </tr>
+            </table>
+          </td>
+        </tr>
+      </table>
+      <table style = "margin-top:5px;padding-right:45px;">
+        <tr>
+          <td><img src = "{$resourceBase}/i/contribute/cut_line.png" height = "15" width = "630"></td>
+        </tr>
+      </table>
+  <table style = "margin-top:6px;padding-right:20px;font-family: Arial, Verdana, sans-serif" width = "480" border = "0"cellpadding = "-5" cellspacing="19" id = "desc">
+    <tr>
+      <td width="60%"><b><font size = "4" align = "right">{ts}PAYMENT ADVICE{/ts}</font></b> <br/><br/> <font size = "1" align = "right"><b>{ts}To: {/ts}</b>      <div style="width:17em;word-wrap:break-word;">
+    {$domain_organization} <br />
+    {$domain_street_address} {$domain_supplemental_address_1} <br />
+    {$domain_supplemental_address_2} {$domain_state} <br />
+    {$domain_city} {$domain_postal_code} <br />
+    {$domain_country} <br />
+    {$domain_phone} <br />
+    {$domain_email}</div>
+    </font><br/><br/><font size="1" align="right">{$notes}</font>
+            </td>
+            <td width="40%">
+        <table  cellpadding = "-10" cellspacing = "22"  align="right" >
+    <tr>
+            <td  colspan = "2"></td>
+      <td><font size = "1" align = "right" style="font-weight:bold;">{ts}Customer: {/ts}</font></td>
+      <td ><font size = "1" align = "right">{$display_name}</font></td>
+    </tr>
+    <tr>
+      <td colspan = "2"></td>
+      <td><font size = "1" align = "right" style="font-weight:bold;">{ts}Invoice Number: {/ts}</font></td>
+      <td><font size = "1" align = "right">{$invoice_id}</font></td>
+    </tr>
+    <tr><td  colspan = "5"style = "color:#F5F5F5;"><hr></hr></td></tr>
+    {if $is_pay_later == 1}
+    <tr>
+                  <td colspan = "2"></td>
+                  <td><font size = "1" align = "right" style="font-weight:bold;">{ts}Amount Due:{/ts}</font></td>
+                  <td><font size = "1" align = "right" style="font-weight:bold;">{$amount|crmMoney:$currency}</font></td>
+    </tr>
+    {else}
+    <tr>
+      <td colspan = "2"></td>
+      <td><font size = "1" align = "right" style="font-weight:bold;">{ts}Amount Due: {/ts}</font></td>
+      <td><font size = "1" align = "right" style="font-weight:bold;">{$amountDue|crmMoney:$currency}</font></td>
+    </tr>
+    {/if}
+    <tr>
+      <td colspan = "2"></td>
+      <td><font size = "1" align = "right" style="font-weight:bold;">{ts}Due Date:  {/ts}</font></td>
+      <td><font size = "1" align = "right">{$dueDate}</font></td>
+    </tr>
+    <tr>
+                  <td colspan = "5" style = "color:#F5F5F5;"><hr></hr></td>
+                </tr>
+        </table>
+            </td>
+    </tr>
+  </table>
+
+
+      {if $contribution_status_id == $refundedStatusId}
+    <table style = "margin-top:2px;padding-left:7px;page-break-before: always;">
+      <tr>
+        <td><img src = "{$resourceBase}/i/civi99.png" height = "34px" width = "99px"></td>
+      </tr>
+    </table>
+    <center>
+
+      <table style = "padding-right:19px;font-family: Arial, Verdana, sans-serif" width = "500" height = "100" border = "0" cellpadding = "2" cellspacing = "1">
+  <tr>
+          <td style = "padding-left:15px;" ><b><font size = "4" align = "center">{ts}CREDIT NOTE{/ts}</font></b></td>
+          <td colspan = "1"></td>
+          <td style = "padding-left:70px;"><b><font size = "1" align = "right">{ts}Date:{/ts}</font></b></td>
+          <td><font size = "1" align = "right">{$domain_organization}</font></td>
+  </tr>
+        <tr>
+         {if $organization_name}
+           <td style = "padding-left:17px;"><font size = "1" align = "center">{$display_name}  ({$organization_name})</font></td>
+           {else}
+           <td style = "padding-left:17px;"><font size = "1" align = "center">{$display_name}</font></td>
+         {/if}
+         <td colspan = "1"></td>
+         <td style = "padding-left:70px;"><font size = "1" align = "right">{$invoice_date}</font></td>
+   <td ><font size = "1" align = "right">
+  {if $domain_street_address }
+    {$domain_street_address}
+  {/if}
+  {if $domain_supplemental_address_1 }
+    {$domain_supplemental_address_1}
+  {/if}</font></td>
+  </tr>
+        <tr>
+          <td style = "padding-left:17px;"><font size = "1" align = "center">{$street_address}   {$supplemental_address_1}</font></td>
+          <td colspan = "1"></td>
+          <td style = "padding-left:70px;"><b><font size = "1" align = "right">{ts}Credit Note Number:{/ts}</font></b></td>
+          <td><font size = "1" align = "right">{if $domain_supplemental_address_2 }
+    {$domain_supplemental_address_2}
+        {/if}
+        {if $domain_state }
+    {$domain_state}
+        {/if}
+    </font></td>
+        </tr>
+        <tr>
+          <td style = "padding-left:17px;"><font size = "1" align = "center">{$supplemental_address_2}  {$stateProvinceAbbreviation}</font></td>
+          <td colspan="1"></td>
+          <td style = "padding-left:70px;"><font size = "1" align = "right">{$creditnote_id}</font></td>
+    <td ><font size = "1" align = "right">{if $domain_city}
+     {$domain_city}
+         {/if}
+         {if $domain_postal_code }
+     {$domain_postal_code}
+         {/if}
+    </font></td>
+  </tr>
+  <tr>
+          <td style = "padding-left:17px;"><font size = "1" align = "right">{$city}  {$postal_code}</font></td>
+          <td colspan="1"></td>
+          <td height = "10" style = "padding-left:70px;"><b><font size = "1"align = "right">{ts}Reference:{/ts}</font></b></td>
+    <td><font size = "1" align = "right"> {if $domain_country}
+    {$domain_country}
+        {/if}</font></td>
+  </tr>
+  <tr>
+          <td></td>
+          <td></td>
+          <td style = "padding-left:70px;"><font size = "1"align = "right">{$source}</font></td>
+    <td><font size = "1" align = "right"> {if $domain_phone}
+    {$domain_phone}
+         {/if}</font> </td>
+  </tr>
+  <tr>
+    <td></td>
+    <td></td>
+    <td></td>
+    <td><font size = "1" align = "right"> {if $domain_email}
+    {$domain_email}
+        {/if}</font> </td>
+  </tr>
+      </table>
+
+      <table style = "margin-top:75px;font-family: Arial, Verdana, sans-serif" width = "590" border = "0"cellpadding = "-5" cellspacing = "19" id = "desc">
+  <tr>
+          <td colspan = "2" {$valueStyle}>
+            <table> {* FIXME: style this table so that it looks like the text version (justification, etc.) *}
+              <tr>
+                <th style = "padding-right:28px;text-align:left;font-weight:bold;width:200px;"><font size = "1">{ts}Description{/ts}</font></th>
+                <th style = "padding-left:28px;text-align:right;font-weight:bold;"><font size = "1">{ts}Quantity{/ts}</font></th>
+                <th style = "padding-left:28px;text-align:right;font-weight:bold;"><font size = "1">{ts}Unit Price{/ts}</font></th>
+                <th style = "padding-left:28px;text-align:right;font-weight:bold;"><font size = "1">{$taxTerm} </font></th>
+                <th style = "padding-left:28px;text-align:right;font-weight:bold;"><font size = "1">{ts 1=$defaultCurrency}Amount %1{/ts}</font></th>
+              </tr>
+              {foreach from=$lineItem item=value key=priceset name=pricevalue}
+    {if $smarty.foreach.pricevalue.index eq 0}
+          <tr><td  colspan = "5" ><hr size="3" style = "color:#000;"></hr></td></tr>
+    {else}
+    <tr><td  colspan = "5" style = "color:#F5F5F5;"><hr></hr></td></tr>
+    {/if}
+                <tr>
+                  <td style ="text-align:left;"  ><font size = "1">
+      {if $value.html_type eq 'Text'}{$value.label}{else}{$value.field_title} - {$value.label}{/if} {if $value.description}<div>{$value.description|truncate:30:"..."}</div>{/if}
+      </font></td>
+      <td style = "padding-left:28px;text-align:right;"><font size = "1"> {$value.qty}</font></td>
+      <td style = "padding-left:28px;text-align:right;"><font size = "1"> {$value.unit_price|crmMoney:$currency}</font></td>
+        {if $value.tax_amount != ''}
+          <td style = "padding-left:28px;text-align:right;"><font size = "1"> {$value.tax_rate}%</font></td>
+                    {else}
+          <td style = "padding-left:28px;text-align:right"><font size = "1" >{ts 1=$taxTerm}No %1{/ts}</font></td>
+              {/if}
+       <td style = "padding-left:28px;text-align:right;"><font size = "1" >{$value.subTotal|crmMoney:$currency}</font></td>
+    </tr>
+                {/foreach}
+          <tr><td  colspan = "5" style = "color:#F5F5F5;"><hr></hr></td></tr>
+          <tr>
+      <td colspan = "3"></td>
+      <td style = "padding-left:28px;text-align:right;"><font size = "1">{ts}Sub Total{/ts}</font></td>
+      <td style = "padding-left:28px;text-align:right;"><font size = "1"> {$subTotal|crmMoney:$currency}</font></td>
+    </tr>
+    {foreach from = $dataArray item = value key = priceset}
+            <tr>
+        <td colspan = "3"></td>
+        {if $priceset}
+          <td style = "padding-left:28px;text-align:right;"><font size = "1"> {ts 1=$taxTerm 2=$priceset}TOTAL %1 %2%{/ts}</font></td>
+          <td style = "padding-left:28px;text-align:right;"><font size = "1" align = "right">{$value|crmMoney:$currency}</font> </td>
+                    {elseif $priceset == 0}
+                      <td style = "padding-left:28px;text-align:right;"><font size = "1">{ts 1=$taxTerm}TOTAL NO %1{/ts}</font></td>
+                      <td style = "padding-left:28px;text-align:right;"><font size = "1" align = "right">{$value|crmMoney:$currency}</font> </td>
+                  </tr>
+        {/if}
+    {/foreach}
+          <tr>
+      <td colspan = "3"></td>
+      <td colspan = "2"><hr></hr></td>
+    </tr>
+
+          <tr>
+      <td colspan = "3"></td>
+      <td style = "padding-left:28px;text-align:right;"><b><font size = "1">{ts 1=$defaultCurrency}TOTAL %1{/ts}</font></b></td>
+      <td style = "padding-left:28px;text-align:right;"><font size = "1">{$amount|crmMoney:$currency}</font></td>
+    </tr>
+
+    {if $is_pay_later == 0}
+            <tr>
+        <td colspan = "3"></td>
+        <td style = "padding-left:28px;text-align:right;"><font size = "1" >{ts}LESS Credit to invoice(s){/ts}</font></td>
+        <td style = "padding-left:28px;text-align:right;"><font size = "1">{$amount|crmMoney:$currency}</font></td>
+      </tr>
+            <tr>
+        <td colspan = "3"></td>
+        <td colspan = "2" ><hr></hr></td>
+      </tr>
+            <tr>
+        <td colspan = "3"></td>
+        <td style = "padding-left:28px;text-align:right;"><b><font size = "1">{ts}REMAINING CREDIT{/ts}</font></b></td>
+        <td style = "padding-left:28px;text-align:right;"><b><font size = "1">{$amountDue|crmMoney:$currency}</font></b></td>
+        <td style = "padding-left:28px;"><font size = "1" align = "right"></fonts></td>
+      </tr>
+    {/if}
+    <br/><br/><br/>
+          <tr>
+      <td colspan = "3"></td>
+    </tr>
+          <tr>
+      <td></td>
+      <td colspan = "3"></td>
+    </tr>
+            </table>
+          </td>
+        </tr>
+      </table>
+
+      <table style = "margin-top:5px;padding-right:45px;">
+        <tr>
+          <td><img src = "{$resourceBase}/i/contribute/cut_line.png" height = "15" width = "630"></td>
+        </tr>
+      </table>
+
+  <table style = "margin-top:6px;padding-right:20px;font-family: Arial, Verdana, sans-serif" width = "507" border = "0"cellpadding = "-5" cellspacing="19" id = "desc">
+    <tr>
+      <td width="60%"><font size = "4" align = "right"><b>{ts}CREDIT ADVICE{/ts}</b><br/><br /><div  style="font-size:10px;max-width:300px;">{ts}Please do not pay on this advice. Deduct the amount of this Credit Note from your next payment to us{/ts}</div><br/></font></td>
+      <td width="40%">
+              <table    align="right" >
+    <tr>
+            <td colspan = "2"></td>
+      <td><font size = "1" align = "right" style="font-weight:bold;">{ts}Customer:{/ts} </font></td>
+      <td><font size = "1" align = "right" >{$display_name}</font></td>
+    </tr>
+    <tr>
+      <td colspan = "2"></td>
+      <td><font size = "1" align = "right" style="font-weight:bold;">{ts}Credit Note#:{/ts} </font></td>
+      <td><font size = "1" align = "right">{$creditnote_id}</font></td>
+    </tr>
+    <tr><td  colspan = "5"style = "color:#F5F5F5;"><hr></hr></td></tr>
+    <tr>
+                  <td colspan = "2"></td>
+      <td><font size = "1" align = "right" style="font-weight:bold;">{ts}Credit Amount:{/ts}</font></td>
+      <td width='50px'><font size = "1" align = "right" style="font-weight:bold;">{$amount|crmMoney:$currency}</font></td>
+    </tr>
+              </table>
+            </td>
+    </tr>
+  </table>
+ {/if}
+    </center>
+  </body>
+</html>
diff --git a/CRM/Upgrade/Incremental/sql/4.6.8.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.6.8.mysql.tpl
new file mode 100644 (file)
index 0000000..23b84cf
--- /dev/null
@@ -0,0 +1 @@
+{* file to handle db changes in 4.6.8 during upgrade *}
diff --git a/CRM/Upgrade/Incremental/sql/4.6.9.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.6.9.mysql.tpl
new file mode 100644 (file)
index 0000000..81ee9b7
--- /dev/null
@@ -0,0 +1 @@
+{* file to handle db changes in 4.6.9 during upgrade *}
index d5561bb9b9b396d54946d2bba7677797e3cb1891..19f3598b55304a06ed567058cccffcad6a2099a2 100644 (file)
@@ -21,6 +21,7 @@ UPDATE civicrm_option_value SET {localize field="label"}label = 'Activity Summar
   WHERE value = 'activitySummary' AND option_group_id = @option_group_id_report;
 
 --CRM-16853 PCP Owner Notification
+--CRM-16853 Contribution Invoice Receipt Translation
 
 {include file='../CRM/Upgrade/4.7.alpha1.msg_template/civicrm_msg_template.tpl'}
 
@@ -86,3 +87,6 @@ CREATE TABLE IF NOT EXISTS `civicrm_status_pref` (
 
 -- CRM-17005
 UPDATE civicrm_country SET name = 'PALESTINIAN TERRITORY' WHERE name = 'PALESTINIAN TERRITORY, OCCUPIED';
+
+-- CRM-17145 update Activity detail data type
+ALTER TABLE `civicrm_activity` CHANGE `details` `details` LONGTEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'Details about the activity (agenda, notes, etc).';
index 00449c71f853b3c35edbfc3e11805bd52749b44b..4363d51f6f9192f9e69e112118eb2b3cc187d8b8 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 interface CRM_Utils_Cache_Interface {
 
@@ -39,7 +37,6 @@ interface CRM_Utils_Cache_Interface {
    *
    * @param string $key
    * @param mixed $value
-   * @return void
    */
   public function set($key, &$value);
 
@@ -56,14 +53,11 @@ interface CRM_Utils_Cache_Interface {
    * Delete a value from the cache.
    *
    * @param string $key
-   * @return void
    */
   public function delete($key);
 
   /**
    * Delete all values from the cache.
-   *
-   * @return void
    */
   public function flush();
 
index fce84cf8b015dc0272bffd6dccac9436594933d8..e018f9611b4c0d93e95ccd297f0fb697fc6c0d15 100644 (file)
@@ -1263,7 +1263,7 @@ class CRM_Utils_Date {
             $to['Y'] = $now['year'];
             $to['H'] = 23;
             $to['i'] = $to['s'] = 59;
-            $from = self::intervalAdd('month', -3, $to);
+            $from = self::intervalAdd('day', -90, $to);
             $from = self::intervalAdd('second', 1, $from);
             break;
 
@@ -1307,6 +1307,16 @@ class CRM_Utils_Date {
             $to['Y'] = $from['Y'] = $now['year'] - $subtractYear;
             $to['d'] = date('t', mktime(0, 0, 0, $to['M'], 1, $to['Y']));
             break;
+
+          case 'starting':
+            $from['d'] = $now['mday'];
+            $from['M'] = $now['mon'];
+            $from['Y'] = $now['year'];
+            $from['H'] = 00;
+            $from['i'] = $to['s'] = 00;
+            $to = self::intervalAdd('day', 90, $from);
+            $to = self::intervalAdd('second', -1, $to);
+            break;
         }
         break;
 
@@ -1405,6 +1415,16 @@ class CRM_Utils_Date {
             unset($to);
             break;
 
+          case 'ending_2':
+            $to['d'] = $now['mday'];
+            $to['M'] = $now['mon'];
+            $to['Y'] = $now['year'];
+            $to['H'] = 23;
+            $to['i'] = $to['s'] = 59;
+            $from = self::intervalAdd('day', -60, $to);
+            $from = self::intervalAdd('second', 1, $from);
+            break;
+
           case 'ending':
             $to['d'] = $now['mday'];
             $to['M'] = $now['mon'];
@@ -1453,19 +1473,37 @@ class CRM_Utils_Date {
             $from['Y'] = $now['year'];
             $from['H'] = 00;
             $from['i'] = $to['s'] = 00;
-            $to = self::intervalAdd('month', 1, $from);
+            $to = self::intervalAdd('day', 30, $from);
+            $to = self::intervalAdd('second', -1, $to);
+            break;
+
+          case 'starting_2':
+            $from['d'] = $now['mday'];
+            $from['M'] = $now['mon'];
+            $from['Y'] = $now['year'];
+            $from['H'] = 00;
+            $from['i'] = $to['s'] = 00;
+            $to = self::intervalAdd('day', 60, $from);
             $to = self::intervalAdd('second', -1, $to);
             break;
         }
         break;
 
       case 'week':
+        $weekFirst = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME, 'weekBegins', NULL, 0);
+        $thisDay = $now['wday'];
+        if ($weekFirst > $thisDay) {
+          $diffDay = $thisDay - $weekFirst + 7;
+        }
+        else {
+          $diffDay = $thisDay - $weekFirst;
+        }
         switch ($relativeTerm) {
           case 'this':
             $from['d'] = $now['mday'];
             $from['M'] = $now['mon'];
             $from['Y'] = $now['year'];
-            $from = self::intervalAdd('day', -1 * ($now['wday']), $from);
+            $from = self::intervalAdd('day', -1 * ($diffDay), $from);
             $to = self::intervalAdd('day', 6, $from);
             break;
 
@@ -1473,7 +1511,7 @@ class CRM_Utils_Date {
             $from['d'] = $now['mday'];
             $from['M'] = $now['mon'];
             $from['Y'] = $now['year'];
-            $from = self::intervalAdd('day', -1 * ($now['wday']) - 7, $from);
+            $from = self::intervalAdd('day', -1 * ($diffDay) - 7, $from);
             $to = self::intervalAdd('day', 6, $from);
             break;
 
@@ -1481,7 +1519,7 @@ class CRM_Utils_Date {
             $from['d'] = $now['mday'];
             $from['M'] = $now['mon'];
             $from['Y'] = $now['year'];
-            $from = self::intervalAdd('day', -1 * ($now['wday']) - 14, $from);
+            $from = self::intervalAdd('day', -1 * ($diffDay) - 14, $from);
             $to = self::intervalAdd('day', 6, $from);
             break;
 
@@ -1489,7 +1527,7 @@ class CRM_Utils_Date {
             $from['d'] = $now['mday'];
             $from['M'] = $now['mon'];
             $from['Y'] = $now['year'];
-            $from = self::intervalAdd('day', -1 * ($now['wday']) - 14, $from);
+            $from = self::intervalAdd('day', -1 * ($diffDay) - 14, $from);
             $to = self::intervalAdd('day', 13, $from);
             break;
 
@@ -1497,7 +1535,7 @@ class CRM_Utils_Date {
             $to['d'] = $now['mday'];
             $to['M'] = $now['mon'];
             $to['Y'] = $now['year'];
-            $to = self::intervalAdd('day', -1 * ($now['wday']) - 1, $to);
+            $to = self::intervalAdd('day', -1 * ($diffDay) - 1, $to);
             unset($from);
             break;
 
@@ -1505,7 +1543,7 @@ class CRM_Utils_Date {
             $from['d'] = $now['mday'];
             $from['M'] = $now['mon'];
             $from['Y'] = $now['year'];
-            $from = self::intervalAdd('day', -1 * ($now['wday']), $from);
+            $from = self::intervalAdd('day', -1 * ($diffDay), $from);
             unset($to);
             break;
 
@@ -1513,7 +1551,7 @@ class CRM_Utils_Date {
             $from['d'] = $now['mday'];
             $from['M'] = $now['mon'];
             $from['Y'] = $now['year'];
-            $from = self::intervalAdd('day', -1 * ($now['wday']) - 1, $from);
+            $from = self::intervalAdd('day', -1 * ($diffDay) - 1, $from);
             unset($to);
             break;
 
@@ -1531,7 +1569,7 @@ class CRM_Utils_Date {
             $from['d'] = $now['mday'];
             $from['M'] = $now['mon'];
             $from['Y'] = $now['year'];
-            $from = self::intervalAdd('day', -1 * ($now['wday']), $from);
+            $from = self::intervalAdd('day', -1 * ($diffDay), $from);
             $to['d'] = $now['mday'];
             $to['M'] = $now['mon'];
             $to['Y'] = $now['year'];
@@ -1544,7 +1582,7 @@ class CRM_Utils_Date {
             $to['M'] = $now['mon'];
             $to['Y'] = $now['year'];
             //CRM-14550 QA Fix
-            $to = self::intervalAdd('day', -1 * ($now['wday']) + 6, $to);
+            $to = self::intervalAdd('day', -1 * ($diffDay) + 6, $to);
             unset($from);
             break;
 
@@ -1552,7 +1590,7 @@ class CRM_Utils_Date {
             $from['d'] = $now['mday'];
             $from['M'] = $now['mon'];
             $from['Y'] = $now['year'];
-            $from = self::intervalAdd('day', -1 * ($now['wday']) + 7, $from);
+            $from = self::intervalAdd('day', -1 * ($diffDay) + 7, $from);
             $to = self::intervalAdd('day', 6, $from);
             break;
 
index 995cf177159809a7459071dc1e601059e13d3651..8d2ccc633b1998dee18df2621c36dc20d91db732 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CiviCRM_Hook
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id: $
- *
  */
 abstract class CRM_Utils_Hook {
 
@@ -783,7 +781,7 @@ abstract class CRM_Utils_Hook {
    * @param array $tasks
    *   The current set of tasks for that custom field.
    *   You can add/remove existing tasks.
-   *   Each task needs to have a title (eg 'title'  => ts( 'Add Contacts to Group')) and a class
+   *   Each task needs to have a title (eg 'title'  => ts( 'Group - add contacts')) and a class
    *   (eg 'class'  => 'CRM_Contact_Form_Task_AddToGroup').
    *   Optional result (boolean) may also be provided. Class can be an array of classes (not sure what that does :( ).
    *   The key for new Task(s) should not conflict with the keys for core tasks of that $objectType, which can be
@@ -1168,7 +1166,7 @@ abstract class CRM_Utils_Hook {
    *                  fieldHeaders    - field headers
    *                  fields          - import fields
    *
-   * @return void
+   * @return mixed
    */
   public static function import($object, $usage, &$objectRef, &$params) {
     return self::singleton()->invoke(4, $object, $usage, $objectRef, $params,
@@ -1245,7 +1243,7 @@ abstract class CRM_Utils_Hook {
    * @param array $selector
    *   the selector object. Allows you access to the context of the search
    *
-   * @return void
+   * @return mixed
    *   modify the header and values object to pass the data u need
    */
   public static function searchColumns($objectName, &$headers, &$rows, &$selector) {
@@ -1783,7 +1781,7 @@ abstract class CRM_Utils_Hook {
    * @param int $otherCaseId
    * @param bool $changeClient
    *
-   * @return void
+   * @return mixed
    */
   public static function pre_case_merge($mainContactId, $mainCaseId = NULL, $otherContactId = NULL, $otherCaseId = NULL, $changeClient = FALSE) {
     return self::singleton()
@@ -1799,7 +1797,7 @@ abstract class CRM_Utils_Hook {
    * @param int $otherCaseId
    * @param bool $changeClient
    *
-   * @return void
+   * @return mixed
    */
   public static function post_case_merge($mainContactId, $mainCaseId = NULL, $otherContactId = NULL, $otherCaseId = NULL, $changeClient = FALSE) {
     return self::singleton()
index ea56475451ab0c9e6560a3daded8591911ec00e8..bae913ed9dd6442457a3f8b2c3d0f59b5b0dc0fa 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -38,7 +36,6 @@
  * API for event export in iCalendar format
  * as outlined in Internet Calendaring and
  * Scheduling Core Object Specification
- *
  */
 class CRM_Utils_ICalendar {
 
@@ -103,8 +100,6 @@ class CRM_Utils_ICalendar {
    *   The file name (for downloads).
    * @param string $disposition
    *   How the file should be sent ('attachment' for downloads).
-   *
-   * @return void
    */
   public static function send($calendar, $content_type = 'text/calendar', $charset = 'us-ascii', $fileName = NULL, $disposition = NULL) {
     $config = CRM_Core_Config::singleton();
index db9a23e70d5fe12adf039999faea9b89f3296f24..7450684b7b1cdc39e87e57a5725b831bd01ab35c 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 // we should consider moving these to the settings table
@@ -39,7 +37,7 @@ define('EMAIL_ACTIVITY_TYPE_ID', NULL);
 define('MAIL_BATCH_SIZE', 50);
 
 /**
- * Class CRM_Utils_Mail_EmailProcessor
+ * Class CRM_Utils_Mail_EmailProcessor.
  */
 class CRM_Utils_Mail_EmailProcessor {
 
@@ -65,14 +63,12 @@ class CRM_Utils_Mail_EmailProcessor {
   }
 
   /**
-   * Delete old files from a given directory (recursively)
+   * Delete old files from a given directory (recursively).
    *
    * @param string $dir
    *   Directory to cleanup.
    * @param int $age
    *   Files older than this many seconds will be deleted (default: 60 days).
-   *
-   * @return void
    */
   public static function cleanupDir($dir, $age = 5184000) {
     // return early if we can’t read/write the dir
@@ -96,9 +92,7 @@ class CRM_Utils_Mail_EmailProcessor {
   }
 
   /**
-   * Process the mailboxes that aren't default (ie. that aren't used by civiMail for the bounce)
-   *
-   * @return void
+   * Process the mailboxes that aren't default (ie. that aren't used by civiMail for the bounce).
    */
   public static function processActivities() {
     $dao = new CRM_Core_DAO_MailSettings();
@@ -120,8 +114,6 @@ class CRM_Utils_Mail_EmailProcessor {
    * Process the mailbox for all the settings from civicrm_mail_settings.
    *
    * @param bool|string $civiMail if true, processing is done in CiviMail context, or Activities otherwise.
-   *
-   * @return void
    */
   public static function process($civiMail = TRUE) {
     $dao = new CRM_Core_DAO_MailSettings();
index 3b66f0dcbba0476f2ff35782993b996726fee57d..f0e584cb9c585a98d0e2651ed50deeae950526cc 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Utils_Migrate_Export {
 
@@ -166,9 +164,7 @@ class CRM_Utils_Migrate_Export {
   }
 
   /**
-   * Scan local customizations and build an in-memory representation
-   *
-   * @return void
+   * Scan local customizations and build an in-memory representation.
    */
   public function build() {
     // fetch the option group / values for
@@ -266,9 +262,10 @@ class CRM_Utils_Migrate_Export {
   }
 
   /**
+   * Build custom groups.
+   *
    * @param array $customGroupIds
    *   List of custom groups to export.
-   * @return void
    */
   public function buildCustomGroups($customGroupIds) {
     $customGroupIdsSql = implode(',', array_filter($customGroupIds, 'is_numeric'));
@@ -322,7 +319,6 @@ class CRM_Utils_Migrate_Export {
   /**
    * @param array $ufGroupIds
    *   List of custom groups to export.
-   * @return void
    */
   public function buildUFGroups($ufGroupIds) {
     $ufGroupIdsSql = implode(',', array_filter($ufGroupIds, 'is_numeric'));
index fc0e0969888b26057e970724252c1e7a63e3bb92..9f09ccd938a6386d36e1c0078c0f96fd1dc7f761 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Utils_Migrate_Import {
   /**
+   * Class constructor.
    */
   public function __construct() {
   }
 
   /**
-   * Import custom-data from an XML file
+   * Import custom-data from an XML file.
    *
    * @param string $file
    *   Path to an XML file.
+   *
    * @throws CRM_Core_Exception
-   * @return void;
    */
   public function run($file) {
     // read xml file
@@ -58,10 +57,9 @@ class CRM_Utils_Migrate_Import {
   }
 
   /**
-   * Import custom-data from an XML element
+   * Import custom-data from an XML element.
    *
    * @param SimpleXMLElement $xml
-   * @return void
    */
   public function runXmlElement($xml) {
     $idMap = array(
index fe87d410277988fbbf1419dbec7c5b963e8ede65..4149cd272a5980b48bc43acd419da507e448d2ca 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 /**
- * Class CRM_Utils_OptionBag
+ * Class CRM_Utils_OptionBag.
  */
 class CRM_Utils_OptionBag implements ArrayAccess, IteratorAggregate, Countable {
   protected $data;
@@ -99,7 +99,6 @@ class CRM_Utils_OptionBag implements ArrayAccess, IteratorAggregate, Countable {
    *   <p>.
    * The value to set.
    * </p>
-   * @return void
    */
   public function offsetSet($offset, $value) {
     $this->data[$offset] = $value;
@@ -113,7 +112,6 @@ class CRM_Utils_OptionBag implements ArrayAccess, IteratorAggregate, Countable {
    *   <p>.
    * The offset to unset.
    * </p>
-   * @return void
    */
   public function offsetUnset($offset) {
     unset($this->data[$offset]);
index 6eb114209afb3cf59eaa5448f0c1d31d667390c2..9f8d87e8678739c71630cc414b7afc0c4aa7cbc4 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -40,7 +38,6 @@
  * use a POST to jump to a specific page). At some point we should evaluate if we want
  * to use Pager_Jumping instead. We've changed the format to allow navigation by jumping
  * to a page and also First, Prev CURRENT Next Last
- *
  */
 
 require_once 'Pager/Sliding.php';
@@ -131,11 +128,9 @@ class CRM_Utils_Pager extends Pager_Sliding {
    * values.
    *
    * @param array $params
-   *   The set of options needed to initialize the parent.
-   *                             constructor
+   *   The set of options needed to initialize the parent constructor.
    *
-   *
-   * @return void
+   * @return array
    */
   public function initialize(&$params) {
     /* set the mode for the pager to Sliding */
index 9958d5adbc91b4ea1d1dbd6a1bcda002bf7c1c2a..be85fe6bde40fcc163800755d69b65dac5201b65 100644 (file)
@@ -26,7 +26,7 @@
  */
 
 /**
- * Utilities for manipulating/inspecting CRM_*_PseudoConstant classes
+ * Utilities for manipulating/inspecting CRM_*_PseudoConstant classes.
  */
 class CRM_Utils_PseudoConstant {
   /**
@@ -49,10 +49,10 @@ class CRM_Utils_PseudoConstant {
    *
    * Wrapper for Pseudoconstant methods. We use this so the calling function
    * doesn't need to know which class the Pseudoconstant is on
-   * (some are on the Contribute_Pseudoconsant Class etc
+   * (some are on the Contribute_Pseudoconstant Class etc
    *
    *
-   * @param $constant
+   * @param string $constant
    *
    * @return array
    *   array reference of all relevant constant
@@ -155,10 +155,9 @@ class CRM_Utils_PseudoConstant {
   }
 
   /**
-   * Flush all caches related to pseudo-constants. This may be inefficient
-   * and should generally be avoided.
+   * Flush all caches related to pseudo-constants.
    *
-   * @return void
+   * This may be inefficient and should generally be avoided.
    */
   public static function flushAll() {
     foreach (self::findConstants() as $constant) {
index 61c3b5a163abc0dacadc4fdcf7dfad54c4dd5249..d73825dbc5cf08ae8ef0f02cee92c3ad032be523 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- *
+ * Recent items utility class.
  */
 class CRM_Utils_Recent {
 
@@ -54,8 +52,6 @@ class CRM_Utils_Recent {
 
   /**
    * Initialize this class and set the static variables.
-   *
-   * @return void
    */
   public static function initialize() {
     if (!self::$_recent) {
@@ -91,8 +87,6 @@ class CRM_Utils_Recent {
    * @param int $contactId
    * @param string $contactName
    * @param array $others
-   *
-   * @return void
    */
   public static function add(
     $title,
@@ -148,8 +142,6 @@ class CRM_Utils_Recent {
    *
    * @param array $recentItem
    *   Array of the recent Item to be removed.
-   *
-   * @return void
    */
   public static function del($recentItem) {
     self::initialize();
@@ -176,8 +168,6 @@ class CRM_Utils_Recent {
    *
    * @param string $id
    *   Contact id that had to be removed.
-   *
-   * @return void
    */
   public static function delContact($id) {
     self::initialize();
index c4b969761dd74ba29724801401da87988ede2d24..cdf85618a0b5f8f98bf64ca141ece07560294f08 100644 (file)
  +--------------------------------------------------------------------+
  */
 
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
 /**
  * This class handles all SOAP client requests.
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Utils_SoapServer {
 
@@ -88,7 +78,6 @@ class CRM_Utils_SoapServer {
    *   The soap key generated by authenticate().
    *
    * @throws SoapFault
-   * @return void
    */
   public function verify($key) {
     $session = CRM_Core_Session::singleton();
index 5518f4d01bbdab60f864e359558494c19230622e..098ef0e4e625915735b31477ca0d5ffff7953663 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
  *
- * Base class to provide generic sort functionality. Note that some ideas
- * have been borrowed from the drupal tablesort.inc code. Also note that
- * since the Pager and Sort class are similar, do match the function names
+ * Base class to provide generic sort functionality.
+ *
+ * Note that some ideas have been borrowed from the drupal tablesort.inc code.
+ *
+ * Also note that since the Pager and Sort class are similar, do match the function names
  * if introducing additional functionality
  *
  * @package CRM
@@ -188,8 +188,6 @@ class CRM_Utils_Sort {
    *
    * @param string $defaultSortOrder
    *   The sort order to use by default.
-   *
-   * @return void
    */
   public function initSortID($defaultSortOrder) {
     $url = CRM_Utils_Array::value(self::SORT_ID, $_GET, $defaultSortOrder);
@@ -225,8 +223,6 @@ class CRM_Utils_Sort {
    *
    * @param string $defaultSortOrder
    *   The sort order to use by default.
-   *
-   * @return void
    */
   public function initialize($defaultSortOrder) {
     $this->initSortID($defaultSortOrder);
index 9f6cf148f8f8243709f3e6eefb6d6157783ece87..77011a9135a56808c1422e49f55c43003a5fbeef 100644 (file)
@@ -104,6 +104,16 @@ class CRM_Utils_String {
    * @return string
    */
   public static function convertStringToCamel($string) {
+    $map = array(
+      'acl' => 'Acl',
+      'ACL' => 'Acl',
+      'im' => 'Im',
+      'IM' => 'Im',
+    );
+    if (isset($map[$string])) {
+      return $map[$string];
+    }
+
     $fragments = explode('_', $string);
     foreach ($fragments as & $fragment) {
       $fragment = ucfirst($fragment);
index aa4ca4c567a958c8784f8d8604e2f01b95622544..a285329d971032c8c304a57dcdd948f4e9ebee89 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
  * System wide utilities.
- *
  */
 class CRM_Utils_System {
 
@@ -1307,7 +1304,7 @@ class CRM_Utils_System {
    * @param array $params
    *   An array of parameters (see CRM_Utils_System::docURL2 method for names)
    *
-   * @return void|string
+   * @return null|string
    *   URL or link to documentation page, based on provided parameters.
    */
   public static function docURL($params) {
index dec96a5dbc370fc491f804b64879a2628fa5aea2..b16ae7c7775eab0081bff970a3c1923b26d58e5e 100644 (file)
@@ -548,6 +548,10 @@ abstract class CRM_Utils_System_Base {
   public function getTimeZoneOffset() {
     $timezone = $this->getTimeZoneString();
     if ($timezone) {
+      if ($timezone == 'UTC') {
+        // CRM-17072 Let's short-circuit all the zero handling & return it here!
+        return '+00:00';
+      }
       $tzObj = new DateTimeZone($timezone);
       $dateTime = new DateTime("now", $tzObj);
       $tz = $tzObj->getOffset($dateTime);
index 75ed56e6941746e51592c1cc0691326ad4f7675c..e0543b19597d531849c0b213b112a8a68f79c432 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -113,8 +111,6 @@ class CRM_Utils_System_Drupal extends CRM_Utils_System_DrupalBase {
    *   Array of errors.
    * @param string $emailName
    *   Field label for the 'email'.
-   *
-   * @return void
    */
   public static function checkUserNameEmailExists(&$params, &$errors, $emailName = 'email') {
     $config = CRM_Core_Config::singleton();
@@ -699,8 +695,6 @@ AND    u.status = 1
    * @param string $oldPerm
    * @param array $newPerms
    *   Array, strings.
-   *
-   * @return void
    */
   public function replacePermission($oldPerm, $newPerms) {
     $roles = user_roles(FALSE, $oldPerm);
index 7417c61a6b5fe6ee0195c0baefa476f77225252b..935f0471e47340cff61f5912970dc45ccf91b90e 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Drupal specific stuff goes here
+ * Drupal specific stuff goes here.
  */
 class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
 
   /**
-   * If we are using a theming system, invoke theme, else just print the
-   * content
+   * Theme output.
+   *
+   * If we are using a theming system, invoke theme, else just print the content.
    *
    * @param string $content
    *   The content that will be themed.
@@ -49,7 +48,7 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
    * @param bool $maintenance
    *   For maintenance mode.
    *
-   * @return void
+   * @return null|string
    *   prints content on stdout
    */
   public function theme(&$content, $print = FALSE, $maintenance = FALSE) {
@@ -73,9 +72,12 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
     }
 
     print $out;
+    return NULL;
   }
 
   /**
+   * Create user.
+   *
    * @inheritDoc
    */
   public function createUser(&$params, $mail) {
@@ -137,8 +139,6 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
    *   Array of errors.
    * @param string $emailName
    *   Field label for the 'email'.
-   *
-   * @return void
    */
   public function checkUserNameEmailExists(&$params, &$errors, $emailName = 'email') {
     $config = CRM_Core_Config::singleton();
@@ -253,8 +253,6 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
    *
    * @param string $head
    *   The new string to be appended.
-   *
-   * @return void
    */
   public function addHTMLHead($head) {
     drupal_set_html_head($head);
@@ -652,8 +650,6 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
    * @param string $oldPerm
    * @param array $newPerms
    *   Array, strings.
-   *
-   * @return void
    */
   public function replacePermission($oldPerm, $newPerms) {
     $roles = user_roles(FALSE, $oldPerm);
index 73d2882299b6c49b6f094258331fec2d81668f84..4592ef3593f1b518435e99dcbf1ec71a37c12200 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Drupal specific stuff goes here
+ * Drupal specific stuff goes here.
  */
 class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
 
@@ -128,9 +126,6 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
    *   Errors.
    * @param string $emailName
    *   Field label for the 'email'.
-   *
-   *
-   * @return void
    */
   public static function checkUserNameEmailExists(&$params, &$errors, $emailName = 'email') {
     // If we are given a name, let's check to see if it already exists.
@@ -222,6 +217,7 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
       case 'html-header':
       case 'page-footer':
         break;
+
       default:
         return FALSE;
     }
@@ -246,6 +242,7 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
       case 'html-header':
       case 'page-footer':
         break;
+
       default:
         return FALSE;
     }
@@ -484,7 +481,8 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
 
   /**
    * Determine the location of the CMS root.
-   * @param null $path
+   *
+   * @param string $path
    *
    * @return NULL|string
    */
@@ -551,4 +549,5 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
       $cache_backend->deleteAll();
     }
   }
+
 }
index 4b780d84bc0612ba3f9548963aa1943dbb0b3f15..0b7e13a351a3904a94742560fbc34edbeacc6b38 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Joomla specific stuff goes here
+ * Joomla specific stuff goes here.
  */
 class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
   /**
+   * Class constructor.
    */
   public function __construct() {
     /**
@@ -117,8 +116,6 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
    *   Array of errors.
    * @param string $emailName
    *   Field label for the 'email'.
-   *
-   * @return void
    */
   public function checkUserNameEmailExists(&$params, &$errors, $emailName = 'email') {
     $config = CRM_Core_Config::singleton();
@@ -318,8 +315,6 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
    *
    * @param object $user
    *   Handle to the user object.
-   *
-   * @return void
    */
   public function setEmail(&$user) {
     global $database;
index 8f00c2cd32e679c0f898759c68f7d92722eb69f2..d3b43a1e9a599899ed6babadf2606215373f65bf 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Soap specific stuff goes here
+ * Soap specific stuff goes here.
  */
 class CRM_Utils_System_Soap extends CRM_Utils_System_Base {
 
@@ -84,8 +82,6 @@ class CRM_Utils_System_Soap extends CRM_Utils_System_Base {
    *
    * @param object $user
    *   Handle to the user object.
-   *
-   * @return void
    */
   public function setEmail(&$user) {
   }
index 6b2b4da8547e581bebc3453c15a91b0821246b16..192fc5b97bcb4fdb999631dd5b15b61e12fa7cf8 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id: $
- *
  */
 
 /**
- * Class to abstract token replacement
+ * Class to abstract token replacement.
  */
 class CRM_Utils_Token {
   static $_requiredTokens = NULL;
@@ -486,19 +484,15 @@ class CRM_Utils_Token {
         break;
 
       case 'editUrl':
+      case 'scheduleUrl':
+        // Note: editUrl and scheduleUrl used to be different, but now there's
+        // one screen which can adapt based on permissions (in workflow mode).
         $value = CRM_Utils_System::url('civicrm/mailing/send',
           "reset=1&mid={$mailing->id}&continue=true",
           TRUE, NULL, FALSE, TRUE
         );
         break;
 
-      case 'scheduleUrl':
-        $value = CRM_Utils_System::url('civicrm/mailing/schedule',
-          "reset=1&mid={$mailing->id}",
-          TRUE, NULL, FALSE, TRUE
-        );
-        break;
-
       case 'html':
         $page = new CRM_Mailing_Page_View();
         $value = $page->run($mailing->id, NULL, FALSE, TRUE);
@@ -870,8 +864,6 @@ class CRM_Utils_Token {
    *  this routine will remove the extra backslashes and braces
    *
    * @param $str ref to the string that will be scanned and modified
-   * @return void
-   *   this function works directly on the string that is passed
    */
   public static function unescapeTokens(&$str) {
     $str = preg_replace('/\\\\|\{(\{\w+\.\w+\})\}/', '\\1', $str);
@@ -1452,7 +1444,7 @@ class CRM_Utils_Token {
           $greetingDetails,
           TRUE,
           $greetingTokens,
-          FALSE,
+          TRUE,
           $escapeSmarty
         );
       }
@@ -1460,10 +1452,10 @@ class CRM_Utils_Token {
       // check if there are still any unevaluated tokens
       $remainingTokens = self::getTokens($tokenString);
 
-      // contact related $greetingTokens not empty, there are customized or hook tokens to replace
-      if (!empty($remainingTokens['contact'])) {
+      // $greetingTokens not empty, there are customized or hook tokens to replace
+      if (!empty($remainingTokens)) {
         // Fill the return properties array
-        $greetingTokens = $remainingTokens['contact'];
+        $greetingTokens = $remainingTokens;
         reset($greetingTokens);
         $greetingsReturnProperties = array();
         while (list($key) = each($greetingTokens)) {
index 78a84b6cb33990da458e79b4785c8fa03dd53cbf..cc526ae474738dc2722225b9d58425734797539b 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
- * Manage simple Tree data structure
- * example of Tree is
+ * Manage simple Tree data structure.
+ *
+ * Example of Tree is
  *
  *                             'a'
  *                              |
@@ -142,6 +141,7 @@ class CRM_Utils_Tree {
 
   /**
    * Check if node is a leaf node.
+   *
    * Currently leaf nodes are strings and non-leaf nodes are arrays
    *
    * @param array $node node which needs to checked
@@ -174,8 +174,6 @@ class CRM_Utils_Tree {
    * @param string $parentName
    *   Name of the parent ?.
    * @param array (ref) $node - node to be added
-   *
-   * @return void
    */
   public function addNode($parentName, &$node) {
     $temp = '';
@@ -190,8 +188,6 @@ class CRM_Utils_Tree {
    * @param string $parentName Name of the parent ?.
    * @param string $childName - key to be used (optional)
    * @param mixed $data - data to be added
-   *
-   * @return void
    */
   public function addData($parentName, $childName, $data) {
     $temp = '';
@@ -216,8 +212,6 @@ class CRM_Utils_Tree {
 
   /**
    * Print the tree.
-   *
-   * @return void
    */
   public function display() {
     print_r($this->tree);
index 31aed2c902ca2703282ff3f878213ef717d82dfd..5211aa68f74fd14a1eb690dbb16354b723ca1c43 100644 (file)
@@ -34,8 +34,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id: $
- *
  */
 class CRM_Utils_Wrapper {
 
@@ -59,7 +57,7 @@ class CRM_Utils_Wrapper {
    *  - bool addSequence: should we add a unique sequence number to the end of the key
    *  - bool ignoreKey: should we not set a qfKey for this controller (for standalone forms)
    *
-   * @return void
+   * @return mixed
    */
   public function run($formName, $formLabel = NULL, $arguments = NULL) {
     if (is_array($arguments)) {
index 6690495f4b46c19f4abfc64cf8fe8b893c3226fc..5ecf0fa9bc1c0cfcdc315abfd749fc27eac708dc 100644 (file)
@@ -216,8 +216,6 @@ class Analyzer {
 
   /**
    * Flush any cached information.
-   *
-   * @return void
    */
   public function flush() {
     $this->case = NULL;
index 428fc305c56d872c0e5cb013f47b37c0052db841..8691a69a183a7ad9448d33a4878dbe5c6b119769 100644 (file)
@@ -30,15 +30,16 @@ namespace Civi\Core\Lock;
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class NullLock implements LockInterface {
 
   private $hasLock = FALSE;
 
   /**
+   * Create lock.
+   *
    * @param string $name
+   *
    * @return static
    */
   public static function create($name) {
@@ -46,9 +47,12 @@ class NullLock implements LockInterface {
   }
 
   /**
+   * Acquire lock.
+   *
    * @param int|NULL $timeout
    *   The number of seconds to wait to get the lock.
    *   For a default value, use NULL.
+   *
    * @return bool
    */
   public function acquire($timeout = NULL) {
@@ -57,6 +61,8 @@ class NullLock implements LockInterface {
   }
 
   /**
+   * Release lock.
+   *
    * @return bool|null|string
    *   Trueish/falsish.
    */
index d3112f1b01616b82cb712123de6d10e7eb60448c..9aeee561745d1cb3b23c886af34b4ea1008e021b 100644 (file)
@@ -18,7 +18,7 @@ It could perhaps be thinned by 30-60% by making more directives.
           <option value=""></option>
           <option ng-repeat="frm in crmMsgTemplates.getAll() | orderBy:'msg_title'" ng-value="frm.id">{{frm.msg_title}}</option>
         </select>
-        <a crm-icon="disk" ng-click="saveTemplate(mailing)" class="crm-hover-button" title="{{ts('Save As')}}"></a>
+        <a crm-icon="disk" ng-if="checkPerm('edit message templates')" ng-click="saveTemplate(mailing)" class="crm-hover-button" title="{{ts('Save As')}}"></a>
       </div>
     </div>
     <div crm-ui-field="{name: 'subform.fromAddress', title: ts('From'), help: hs('from_email')}">
index d8873075a4a34b87a7091dd76c94c99a1e3cee4e..b635f13fc599e805ecf5a793f7720fc1e9e71d7f 100644 (file)
@@ -4,7 +4,7 @@
   angular.module('crmMailing').controller('MsgTemplateCtrl', function MsgTemplateCtrl($scope, crmMsgTemplates, dialogService) {
     var ts = $scope.ts = CRM.ts(null);
     $scope.crmMsgTemplates = crmMsgTemplates;
-
+    $scope.checkPerm = CRM.checkPerm;
     // @return Promise MessageTemplate (per APIv3)
     $scope.saveTemplate = function saveTemplate(mailing) {
       var model = {
index 7a5f72cdec04c95a304e4a94ea056d892d2cf0ee..177da3eaff8cbbbf8dccc2e1ee453df6d1699bc4 100644 (file)
@@ -177,9 +177,7 @@ class civicrm_api3 {
   public function remoteCall($entity, $action, $params = array()) {
     $fields = "key={$this->key}&api_key={$this->api_key}";
     $query = $this->uri . "&entity=$entity&action=$action";
-    foreach ($params as $k => $v) {
-      $fields .= "&$k=" . urlencode($v);
-    }
+    $fields .= '&' . http_build_query($params);
     if (function_exists('curl_init')) {
       // To facilitate debugging without leaking info, entity & action
       // are GET, other data is POST.
index 91e663629e8f3af35cafd13021135b510801ce2a..ee3d251e2b1d9896550212b7c36aa14ad6a6d59f 100644 (file)
@@ -427,6 +427,9 @@ function civicrm_api3_contribution_completetransaction(&$params) {
     throw new API_Exception(ts('Contribution already completed'), 'contribution_completed');
   }
   $input['trxn_id'] = !empty($params['trxn_id']) ? $params['trxn_id'] : $contribution->trxn_id;
+  if (!empty($params['fee_amount'])) {
+    $input['fee_amount'] = $params['fee_amount'];
+  }
   $params = _ipn_process_transaction($params, $contribution, $input, $ids);
 
 }
@@ -460,12 +463,16 @@ function _civicrm_api3_contribution_completetransaction_spec(&$params) {
     'description' => '. If not provided this will default to domain mail or contribution page',
     'type' => CRM_Utils_Type::T_STRING,
   );
-
   $params['payment_processor_id'] = array(
     'title' => 'Payment processor ID',
-    'description' => 'Providing this is strongly recommended, as not possible to calculate it accurately always',
+    'description' => 'Providing this is strongly recommended, as not possible to calculate it accurately always',
     'type' => CRM_Utils_Type::T_INT,
   );
+  $params['fee_amount'] = array(
+    'title' => 'Fee charged on transaction',
+    'description' => 'If a fee has been charged then the amount',
+    'type' => CRM_Utils_Type::T_FLOAT,
+  );
 }
 
 /**
index 479afac1b60bbe0f7b58e608d8ad5506d59408fd..11ed468c96fb3795951132f0e7f2802fc0ae5e12 100644 (file)
@@ -641,7 +641,7 @@ function _civicrm_api3_get_using_utils_sql($dao_name, $params, $isFillUniqueFiel
         );
       }
       else {
-        $query->where(CRM_Core_DAO::createSQLFilter('a.' . $column_name, $value, $type));
+        $query->where(CRM_Core_DAO::createSQLFilter("{$table_name}.{$column_name}", $value, $type));
       }
     }
   }
@@ -900,17 +900,6 @@ function _civicrm_api3_get_using_query_object($entity, $params, $additional_opti
   }
 
   $newParams = CRM_Contact_BAO_Query::convertFormValues($inputParams);
-  foreach ($newParams as &$newParam) {
-    if ($newParam[1] == '='  && is_array($newParam[2])) {
-      // we may be looking at an attempt to use the 'IN' style syntax
-      // @todo at time of writing only 'IN' & 'NOT IN' are  supported for the array style syntax
-      $sqlFilter = CRM_Core_DAO::createSqlFilter($newParam[0], $params[$newParam[0]], 'String', NULL, TRUE);
-      if ($sqlFilter) {
-        $newParam[1] = key($newParam[2]);
-        $newParam[2] = $sqlFilter;
-      }
-    }
-  }
 
   $skipPermissions = !empty($params['check_permissions']) ? 0 : 1;
 
index bf8096f964cafe5d9ab0bfe2480fe47d7bc8039d..5d007253d6047b318ee95da58a722ad0880d3a2e 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CiviContributeProcessor {
   static $_paypalParamsMapper = array(
diff --git a/bin/cleanup42.php b/bin/cleanup42.php
deleted file mode 100644 (file)
index 75c51e0..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.7                                                |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM.                                    |
- |                                                                    |
- | CiviCRM is free software; you can copy, modify, and distribute it  |
- | under the terms of the GNU Affero General Public License           |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
- |                                                                    |
- | CiviCRM is distributed in the hope that it will be useful, but     |
- | WITHOUT ANY WARRANTY; without even the implied warranty of         |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
- | See the GNU Affero General Public License for more details.        |
- |                                                                    |
- | You should have received a copy of the GNU Affero General Public   |
- | License and the CiviCRM Licensing Exception along                  |
- | with this program; if not, contact CiviCRM LLC                     |
- | at info[AT]civicrm[DOT]org. If you have questions about the        |
- | GNU Affero General Public License or the licensing of CiviCRM,     |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
- +--------------------------------------------------------------------+
- */
-
-/**
- * A PHP script which deletes extraneous civicrm_membership_payment rows
- * in order to correct the condition where a contribution row is linked to > 1 membership.
- */
-
-/**
- * Initialization
- */
-function initialize() {
-  session_start();
-  if (!function_exists('drush_get_context')) {
-    require_once '../civicrm.config.php';
-  }
-
-  // hack to make code think its an upgrade mode, and not do lot of initialization which breaks the code due to new 4.2 schema
-  $_GET['q'] = 'civicrm/upgrade/cleanup42';
-
-  require_once 'CRM/Core/Config.php';
-  $config = CRM_Core_Config::singleton();
-  if (php_sapi_name() != "cli") {
-    // this does not return on failure
-    CRM_Utils_System::authenticateScript(TRUE);
-  }
-}
-
-function run() {
-  initialize();
-
-  $fh = fopen('php://output', 'w');
-  $rows = CRM_Upgrade_Incremental_php_FourTwo::deleteInvalidPairs();
-
-  if (!empty($rows)) {
-    echo "The following records have been processed. If action = Un-linked, that membership has been disconnected from the contribution record.\n";
-    echo "Contact ID, ContributionID, Contribution Status, MembershipID, Membership Type, Start Date, End Date, Membership Status, Action \n";
-  }
-  else {
-    echo "Could not find any records to process.\n";
-  }
-
-  foreach ($rows as $row) {
-    fputcsv($fh, $row);
-  }
-}
-
-run();
diff --git a/bin/deprecated/CiviReportMail.php b/bin/deprecated/CiviReportMail.php
deleted file mode 100644 (file)
index a24287d..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.7                                                |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM.                                    |
- |                                                                    |
- | CiviCRM is free software; you can copy, modify, and distribute it  |
- | under the terms of the GNU Affero General Public License           |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
- |                                                                    |
- | CiviCRM is distributed in the hope that it will be useful, but     |
- | WITHOUT ANY WARRANTY; without even the implied warranty of         |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
- | See the GNU Affero General Public License for more details.        |
- |                                                                    |
- | You should have received a copy of the GNU Affero General Public   |
- | License and the CiviCRM Licensing Exception along                  |
- | with this program; if not, contact CiviCRM LLC                     |
- | at info[AT]civicrm[DOT]org. If you have questions about the        |
- | GNU Affero General Public License or the licensing of CiviCRM,     |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
- +--------------------------------------------------------------------+
- */
-
-/**
- * A PHP cron script to mail the result set of specified report to the
- * recipients mentioned for that report
- */
-class CiviReportMail {
-  /**
-   */
-  public function __construct() {
-    $this->initialize();
-
-    CRM_Utils_System::authenticateScript(TRUE);
-
-    //log the execution of script
-    CRM_Core_Error::debug_log_message('CiviReportMail.php');
-  }
-
-  public function initialize() {
-    require_once '../civicrm.config.php';
-    require_once 'CRM/Core/Config.php';
-
-    $config = CRM_Core_Config::singleton();
-  }
-
-  public function run() {
-    $lock = Civi\Core\Container::singleton()->get('lockManager')->acquire('worker.report.CiviReportMail');
-
-    if ($lock->isAcquired()) {
-      // try to unset any time limits
-      if (!ini_get('safe_mode')) {
-        set_time_limit(0);
-      }
-
-      // if there are named sets of settings, use them - otherwise use the default (null)
-      require_once 'CRM/Report/Utils/Report.php';
-      $result = CRM_Report_Utils_Report::processReport();
-      echo $result['messages'];
-    }
-    else {
-      throw new Exception('Could not acquire lock, another CiviReportMail process is running');
-    }
-
-    $lock->release();
-  }
-
-}
-
-session_start();
-$obj = new CiviReportMail();
-$obj->run();
diff --git a/bin/deprecated/EmailProcessor.php b/bin/deprecated/EmailProcessor.php
deleted file mode 100644 (file)
index d1a91b9..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.7                                                |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM.                                    |
- |                                                                    |
- | CiviCRM is free software; you can copy, modify, and distribute it  |
- | under the terms of the GNU Affero General Public License           |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
- |                                                                    |
- | CiviCRM is distributed in the hope that it will be useful, but     |
- | WITHOUT ANY WARRANTY; without even the implied warranty of         |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
- | See the GNU Affero General Public License for more details.        |
- |                                                                    |
- | You should have received a copy of the GNU Affero General Public   |
- | License and the CiviCRM Licensing Exception along                  |
- | with this program; if not, contact CiviCRM LLC                     |
- | at info[AT]civicrm[DOT]org. If you have questions about the        |
- | GNU Affero General Public License or the licensing of CiviCRM,     |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
- +--------------------------------------------------------------------+
- */
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
- */
-
-/**
- * When running script from cli :
- * 1. By default script is being used for civimail processing.
- * eg : nice -19 php bin/EmailProcessor.php -u<login> -p<password> -s<sites(or default)>
- *
- * 2. Pass "activities" as argument to use script for 'Email To Activity Processing'.
- * eg : nice -19 php bin/EmailProcessor.php -u<login> -p<password> -s<sites(or default)> activities
- *
- */
-
-// bootstrap the environment and run the processor
-// you can run this program either from an apache command, or from the cli
-if (php_sapi_name() == "cli") {
-  require_once "bin/cli.php";
-  $cli = new civicrm_cli();
-  //if it doesn't die, it's authenticated
-  //log the execution of script
-  CRM_Core_Error::debug_log_message('EmailProcessor.php from the cli');
-  $lock = Civi\Core\Container::singleton()->get('lockManager')->acquire('worker.mailing.EmailProcessor');
-
-  if (!$lock->isAcquired()) {
-    throw new Exception('Could not acquire lock, another EmailProcessor process is running');
-  }
-
-  require_once 'CRM/Utils/Mail/EmailProcessor.php';
-
-  // check if the script is being used for civimail processing or email to
-  // activity processing.
-  if (isset($cli->args[0]) && $cli->args[0] == "activities") {
-    CRM_Utils_Mail_EmailProcessor::processActivities();
-  }
-  else {
-    CRM_Utils_Mail_EmailProcessor::processBounces();
-  }
-  $lock->release();
-}
-else {
-  session_start();
-  require_once '../civicrm.config.php';
-  require_once 'CRM/Core/Config.php';
-  $config = CRM_Core_Config::singleton();
-  CRM_Utils_System::authenticateScript(TRUE);
-
-  require_once 'CRM/Utils/System.php';
-  CRM_Utils_System::loadBootStrap();
-
-  //log the execution of script
-  CRM_Core_Error::debug_log_message('EmailProcessor.php');
-
-  $lock = Civi\Core\Container::singleton()->get('lockManager')->acquire('worker.mailing.EmailProcessor');
-
-  if (!$lock->isAcquired()) {
-    throw new Exception('Could not acquire lock, another EmailProcessor process is running');
-  }
-
-  // try to unset any time limits
-  if (!ini_get('safe_mode')) {
-    set_time_limit(0);
-  }
-
-  require_once 'CRM/Utils/Mail/EmailProcessor.php';
-
-  // cleanup directories with old mail files (if they exist): CRM-4452
-  CRM_Utils_Mail_EmailProcessor::cleanupDir($config->customFileUploadDir . DIRECTORY_SEPARATOR . 'CiviMail.ignored');
-  CRM_Utils_Mail_EmailProcessor::cleanupDir($config->customFileUploadDir . DIRECTORY_SEPARATOR . 'CiviMail.processed');
-
-  // check if the script is being used for civimail processing or email to
-  // activity processing.
-  $isCiviMail = !empty($_REQUEST['emailtoactivity']) ? FALSE : TRUE;
-  CRM_Utils_Mail_EmailProcessor::process($isCiviMail);
-
-  $lock->release();
-}
diff --git a/bin/deprecated/ParticipantProcessor.php b/bin/deprecated/ParticipantProcessor.php
deleted file mode 100644 (file)
index aa4d014..0000000
+++ /dev/null
@@ -1,266 +0,0 @@
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.7                                                |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM.                                    |
- |                                                                    |
- | CiviCRM is free software; you can copy, modify, and distribute it  |
- | under the terms of the GNU Affero General Public License           |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
- |                                                                    |
- | CiviCRM is distributed in the hope that it will be useful, but     |
- | WITHOUT ANY WARRANTY; without even the implied warranty of         |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
- | See the GNU Affero General Public License for more details.        |
- |                                                                    |
- | You should have received a copy of the GNU Affero General Public   |
- | License and the CiviCRM Licensing Exception along                  |
- | with this program; if not, contact CiviCRM LLC                     |
- | at info[AT]civicrm[DOT]org. If you have questions about the        |
- | GNU Affero General Public License or the licensing of CiviCRM,     |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
- +--------------------------------------------------------------------+
- */
-
-
-/*
- * This file check and updates the status of all participant records.
- *
- * EventParticipantion.php prior to running this script.
- */
-
-require_once '../civicrm.config.php';
-require_once 'CRM/Core/Config.php';
-
-/**
- * Class CRM_ParticipantProcessor
- */
-class CRM_ParticipantProcessor {
-  /**
-   */
-  public function __construct() {
-    $config = CRM_Core_Config::singleton();
-
-    //this does not return on failure
-    require_once 'CRM/Utils/System.php';
-    require_once 'CRM/Utils/Hook.php';
-
-    CRM_Utils_System::authenticateScript(TRUE);
-
-    //log the execution time of script
-    CRM_Core_Error::debug_log_message('ParticipantProcessor.php');
-  }
-
-  public function updateParticipantStatus() {
-    require_once 'CRM/Event/PseudoConstant.php';
-    $participantRole = CRM_Event_PseudoConstant::participantRole();
-    $pendingStatuses = CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Pending'");
-    $expiredStatuses = CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Negative'");
-    $waitingStatuses = CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Waiting'");
-
-    //build the required status ids.
-    $statusIds = '(' . implode(',', array_merge(array_keys($pendingStatuses), array_keys($waitingStatuses))) . ')';
-
-    $participantDetails = $fullEvents = array();
-    $expiredParticipantCount = $waitingConfirmCount = $waitingApprovalCount = 0;
-
-    //get all participant who's status in class pending and waiting
-    $query = "SELECT * FROM civicrm_participant WHERE status_id IN {$statusIds} ORDER BY register_date";
-
-    $query = "
-   SELECT  participant.id,
-           participant.contact_id,
-           participant.status_id,
-           participant.register_date,
-           participant.registered_by_id,
-           participant.event_id,
-           event.title as eventTitle,
-           event.registration_start_date,
-           event.registration_end_date,
-           event.end_date,
-           event.expiration_time,
-           event.requires_approval
-     FROM  civicrm_participant participant
-LEFT JOIN  civicrm_event event ON ( event.id = participant.event_id )
-    WHERE  participant.status_id IN {$statusIds}
-     AND   (event.end_date > now() OR event.end_date IS NULL)
-     AND   event.is_active = 1
- ORDER BY  participant.register_date, participant.id
-";
-    $dao = CRM_Core_DAO::executeQuery($query);
-    while ($dao->fetch()) {
-      $participantDetails[$dao->id] = array(
-        'id' => $dao->id,
-        'event_id' => $dao->event_id,
-        'status_id' => $dao->status_id,
-        'contact_id' => $dao->contact_id,
-        'register_date' => $dao->register_date,
-        'registered_by_id' => $dao->registered_by_id,
-        'eventTitle' => $dao->eventTitle,
-        'registration_start_date' => $dao->registration_start_date,
-        'registration_end_date' => $dao->registration_end_date,
-        'end_date' => $dao->end_date,
-        'expiration_time' => $dao->expiration_time,
-        'requires_approval' => $dao->requires_approval,
-      );
-    }
-
-    if (!empty($participantDetails)) {
-      //cron 1. move participant from pending to expire if needed
-      foreach ($participantDetails as $participantId => $values) {
-        //process the additional participant at the time of
-        //primary participant, don't process separately.
-        if (!empty($values['registered_by_id'])) {
-          continue;
-        }
-
-        $expirationTime = CRM_Utils_Array::value('expiration_time', $values);
-        if ($expirationTime && array_key_exists($values['status_id'], $pendingStatuses)) {
-
-          //get the expiration and registration pending time.
-          $expirationSeconds = $expirationTime * 3600;
-          $registrationPendingSeconds = CRM_Utils_Date::unixTime($values['register_date']);
-
-          // expired registration since registration cross allow confirmation time.
-          if (($expirationSeconds + $registrationPendingSeconds) < time()) {
-
-            //lets get the transaction mechanism.
-            require_once 'CRM/Core/Transaction.php';
-            $transaction = new CRM_Core_Transaction();
-
-            require_once 'CRM/Event/BAO/Participant.php';
-            $ids = array($participantId);
-            $expiredId = array_search('Expired', $expiredStatuses);
-            $results = CRM_Event_BAO_Participant::transitionParticipants($ids, $expiredId, $values['status_id'], TRUE, TRUE);
-            $transaction->commit();
-
-            if (!empty($results)) {
-              //diaplay updated participants
-              if (is_array($results['updatedParticipantIds']) && !empty($results['updatedParticipantIds'])) {
-                foreach ($results['updatedParticipantIds'] as $processedId) {
-                  $expiredParticipantCount += 1;
-                  echo "<br /><br />- status updated to: Expired";
-
-                  //mailed participants.
-                  if (is_array($results['mailedParticipants']) &&
-                    array_key_exists($processedId, $results['mailedParticipants'])
-                  ) {
-                    echo "<br />Expiration Mail sent to: {$results['mailedParticipants'][$processedId]}";
-                  }
-                }
-              }
-            }
-          }
-        }
-      }
-      //cron 1 end.
-
-      //cron 2. lets move participants from waiting list to pending status
-      foreach ($participantDetails as $participantId => $values) {
-        //process the additional participant at the time of
-        //primary participant, don't process separately.
-        if (!empty($values['registered_by_id'])) {
-          continue;
-        }
-
-        if (array_key_exists($values['status_id'], $waitingStatuses) &&
-          !array_key_exists($values['event_id'], $fullEvents)
-        ) {
-
-          if ($waitingStatuses[$values['status_id']] == 'On waitlist' &&
-            CRM_Event_BAO_Event::validRegistrationDate($values)
-          ) {
-
-            //check the target event having space.
-            require_once 'CRM/Event/BAO/Participant.php';
-            $eventOpenSpaces = CRM_Event_BAO_Participant::eventFull($values['event_id'], TRUE, FALSE);
-
-            if ($eventOpenSpaces && is_numeric($eventOpenSpaces) || ($eventOpenSpaces === NULL)) {
-
-              //get the additional participant if any.
-              $additionalIds = CRM_Event_BAO_Participant::getAdditionalParticipantIds($participantId);
-
-              $allIds = array($participantId);
-              if (!empty($additionalIds)) {
-                $allIds = array_merge($allIds, $additionalIds);
-              }
-              $pClause = ' participant.id IN ( ' . implode(' , ', $allIds) . ' )';
-              $requiredSpaces = CRM_Event_BAO_Event::eventTotalSeats($values['event_id'], $pClause);
-
-              //need to check as to see if event has enough speces
-              if (($requiredSpaces <= $eventOpenSpaces) || ($eventOpenSpaces === NULL)) {
-                require_once 'CRM/Core/Transaction.php';
-                $transaction = new CRM_Core_Transaction();
-
-                require_once 'CRM/Event/BAO/Participant.php';
-                $ids = array($participantId);
-                $updateStatusId = array_search('Pending from waitlist', $pendingStatuses);
-
-                //lets take a call to make pending or need approval
-                if ($values['requires_approval']) {
-                  $updateStatusId = array_search('Awaiting approval', $waitingStatuses);
-                }
-                $results = CRM_Event_BAO_Participant::transitionParticipants($ids, $updateStatusId,
-                  $values['status_id'], TRUE, TRUE
-                );
-                //commit the transaction.
-                $transaction->commit();
-
-                if (!empty($results)) {
-                  //diaplay updated participants
-                  if (is_array($results['updatedParticipantIds']) &&
-                    !empty($results['updatedParticipantIds'])
-                  ) {
-                    foreach ($results['updatedParticipantIds'] as $processedId) {
-                      if ($values['requires_approval']) {
-                        $waitingApprovalCount += 1;
-                        echo "<br /><br />- status updated to: Awaiting approval";
-                        echo "<br />Will send you Confirmation Mail when registration get approved.";
-                      }
-                      else {
-                        $waitingConfirmCount += 1;
-                        echo "<br /><br />- status updated to: Pending from waitlist";
-                        if (is_array($results['mailedParticipants']) &&
-                          array_key_exists($processedId, $results['mailedParticipants'])
-                        ) {
-                          echo "<br />Confirmation Mail sent to: {$results['mailedParticipants'][$processedId]}";
-                        }
-                      }
-                    }
-                  }
-                }
-              }
-              else {
-                //target event is full.
-                $fullEvents[$values['event_id']] = $values['eventTitle'];
-              }
-            }
-            else {
-              //target event is full.
-              $fullEvents[$values['event_id']] = $values['eventTitle'];
-            }
-          }
-        }
-      }
-      //cron 2 ends.
-    }
-
-    echo "<br /><br />Number of Expired registration(s) = {$expiredParticipantCount}";
-    echo "<br />Number of registration(s) require approval =  {$waitingApprovalCount}";
-    echo "<br />Number of registration changed to Pending from waitlist = {$waitingConfirmCount}<br /><br />";
-    if (!empty($fullEvents)) {
-      foreach ($fullEvents as $eventId => $title) {
-        echo "Full Event : {$title}<br />";
-      }
-    }
-  }
-
-}
-
-$obj = new CRM_ParticipantProcessor();
-echo "Updating..";
-$obj->updateParticipantStatus();
-echo "<br />Participant records updated. (Done)";
diff --git a/bin/deprecated/RespondentProcessor.php b/bin/deprecated/RespondentProcessor.php
deleted file mode 100644 (file)
index 3807b9b..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.7                                                |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM.                                    |
- |                                                                    |
- | CiviCRM is free software; you can copy, modify, and distribute it  |
- | under the terms of the GNU Affero General Public License           |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
- |                                                                    |
- | CiviCRM is distributed in the hope that it will be useful, but     |
- | WITHOUT ANY WARRANTY; without even the implied warranty of         |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
- | See the GNU Affero General Public License for more details.        |
- |                                                                    |
- | You should have received a copy of the GNU Affero General Public   |
- | License and the CiviCRM Licensing Exception along                  |
- | with this program; if not, contact CiviCRM LLC                     |
- | at info[AT]civicrm[DOT]org. If you have questions about the        |
- | GNU Affero General Public License or the licensing of CiviCRM,     |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
- +--------------------------------------------------------------------+
- */
-
-
-/*
- * This file check and update the survey respondents.
- *
- */
-
-require_once '../civicrm.config.php';
-require_once 'CRM/Core/Config.php';
-
-/**
- * Class CRM_RespondentProcessor
- */
-class CRM_RespondentProcessor {
-  /**
-   */
-  public function __construct() {
-    $config = CRM_Core_Config::singleton();
-
-    //this does not return on failure
-    require_once 'CRM/Utils/System.php';
-    require_once 'CRM/Utils/Hook.php';
-
-    CRM_Utils_System::authenticateScript(TRUE);
-
-    //log the execution time of script
-    CRM_Core_Error::debug_log_message('RespondentProcessor.php');
-  }
-
-  public function releaseRespondent() {
-    require_once 'CRM/Core/PseudoConstant.php';
-    require_once 'CRM/Campaign/BAO/Survey.php';
-    $activityStatus = CRM_Core_PseudoConstant::activityStatus('name');
-    $reserveStatusId = array_search('Scheduled', $activityStatus);
-    $surveyActivityTypes = CRM_Campaign_BAO_Survey::getSurveyActivityType();
-    $surveyActivityTypesIds = array_keys($surveyActivityTypes);
-
-    //retrieve all survey activities related to reserve action.
-    $releasedCount = 0;
-    if ($reserveStatusId && !empty($surveyActivityTypesIds)) {
-      $query = '
-    SELECT  activity.id as id,
-            activity.activity_date_time as activity_date_time,
-            survey.id as surveyId,
-            survey.release_frequency as release_frequency
-      FROM  civicrm_activity activity
-INNER JOIN  civicrm_survey survey ON ( survey.id = activity.source_record_id )
-     WHERE  activity.is_deleted = 0
-       AND  activity.status_id = %1
-       AND  activity.activity_type_id IN ( ' . implode(', ', $surveyActivityTypesIds) . ' )';
-      $activity = CRM_Core_DAO::executeQuery($query, array(1 => array($reserveStatusId, 'Positive')));
-      $releasedIds = array();
-      while ($activity->fetch()) {
-        if (!$activity->release_frequency) {
-          continue;
-        }
-        $reservedSeconds = CRM_Utils_Date::unixTime($activity->activity_date_time);
-        $releasedSeconds = $activity->release_frequency * 24 * 3600;
-        $totalReservedSeconds = $reservedSeconds + $releasedSeconds;
-        if ($totalReservedSeconds < time()) {
-          $releasedIds[$activity->id] = $activity->id;
-        }
-      }
-
-      //released respondent.
-      if (!empty($releasedIds)) {
-        $query = '
-UPDATE  civicrm_activity
-   SET  is_deleted = 1
- WHERE  id IN ( ' . implode(', ', $releasedIds) . ' )';
-        CRM_Core_DAO::executeQuery($query);
-        $releasedCount = count($releasedIds);
-      }
-    }
-
-    echo "<br /><br />Number of respondents released = {$releasedCount}";
-  }
-
-}
-
-$obj = new CRM_RespondentProcessor();
-echo "Releasing..";
-$obj->releaseRespondent();
-echo "<br /><br />Respondent Release Done";
diff --git a/bin/deprecated/UpdateAddress.php b/bin/deprecated/UpdateAddress.php
deleted file mode 100644 (file)
index 4124ac3..0000000
+++ /dev/null
@@ -1,278 +0,0 @@
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.7                                                |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM.                                    |
- |                                                                    |
- | CiviCRM is free software; you can copy, modify, and distribute it  |
- | under the terms of the GNU Affero General Public License           |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
- |                                                                    |
- | CiviCRM is distributed in the hope that it will be useful, but     |
- | WITHOUT ANY WARRANTY; without even the implied warranty of         |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
- | See the GNU Affero General Public License for more details.        |
- |                                                                    |
- | You should have received a copy of the GNU Affero General Public   |
- | License and the CiviCRM Licensing Exception along                  |
- | with this program; if not, contact CiviCRM LLC                     |
- | at info[AT]civicrm[DOT]org. If you have questions about the        |
- | GNU Affero General Public License or the licensing of CiviCRM,     |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
- +--------------------------------------------------------------------+
- */
-
-/**
- * A PHP cron script to format all the addresses in the database. Currently
- * it only does geocoding if the geocode values are not set. At a later
- * stage we will also handle USPS address cleanup and other formatting
- * issues
- *
- */
-
-define('THROTTLE_REQUESTS', 0);
-function run() {
-  session_start();
-
-  require_once '../civicrm.config.php';
-  require_once 'CRM/Core/Config.php';
-
-  $config = CRM_Core_Config::singleton();
-
-  require_once 'Console/Getopt.php';
-  $shortOptions = "n:p:s:e:k:g:parse";
-  $longOptions = array('name=', 'pass=', 'key=', 'start=', 'end=', 'geocoding=', 'parse=');
-
-  $getopt = new Console_Getopt();
-  $args = $getopt->readPHPArgv();
-
-  array_shift($args);
-  list($valid, $dontCare) = $getopt->getopt2($args, $shortOptions, $longOptions);
-
-  $vars = array(
-    'start' => 's',
-    'end' => 'e',
-    'name' => 'n',
-    'pass' => 'p',
-    'key' => 'k',
-    'geocoding' => 'g',
-    'parse' => 'ap',
-  );
-
-  foreach ($vars as $var => $short) {
-    $$var = NULL;
-    foreach ($valid as $v) {
-      if ($v[0] == $short || $v[0] == "--$var") {
-        $$var = $v[1];
-        break;
-      }
-    }
-    if (!$$var) {
-      $$var = CRM_Utils_Array::value($var, $_REQUEST);
-    }
-    $_REQUEST[$var] = $$var;
-  }
-
-  // this does not return on failure
-  // require_once 'CRM/Utils/System.php';
-  CRM_Utils_System::authenticateScript(TRUE, $name, $pass);
-
-  //log the execution of script
-  CRM_Core_Error::debug_log_message('UpdateAddress.php');
-
-  // do check for geocoding.
-  $processGeocode = FALSE;
-  if (empty($config->geocodeMethod)) {
-    if ($geocoding == 'true') {
-      echo ts('Error: You need to set a mapping provider under Global Settings');
-      exit();
-    }
-  }
-  else {
-    $processGeocode = TRUE;
-    // user might want to over-ride.
-    if ($geocoding == 'false') {
-      $processGeocode = FALSE;
-    }
-  }
-
-  // do check for parse street address.
-  require_once 'CRM/Core/BAO/Setting.php';
-  $parseAddress = CRM_Utils_Array::value('street_address_parsing',
-    CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
-      'address_options'
-    ),
-    FALSE
-  );
-  $parseStreetAddress = FALSE;
-  if (!$parseAddress) {
-    if ($parse == 'true') {
-      echo ts('Error: You need to enable Street Address Parsing under Global Settings >> Address Settings.');
-      exit();
-    }
-  }
-  else {
-    $parseStreetAddress = TRUE;
-    // user might want to over-ride.
-    if ($parse == 'false') {
-      $parseStreetAddress = FALSE;
-    }
-  }
-
-  // don't process.
-  if (!$parseStreetAddress && !$processGeocode) {
-    echo ts('Error: Both Geocode mapping as well as Street Address Parsing are disabled. You must configure one or both options to use this script.');
-    exit();
-  }
-
-  // we have an exclusive lock - run the mail queue
-  processContacts($config, $processGeocode, $parseStreetAddress, $start, $end);
-}
-
-/**
- * @param $config
- * @param $processGeocode
- * @param $parseStreetAddress
- * @param null $start
- * @param null $end
- */
-function processContacts(&$config, $processGeocode, $parseStreetAddress, $start = NULL, $end = NULL) {
-  // build where clause.
-  $clause = array('( c.id = a.contact_id )');
-  if ($start) {
-    $clause[] = "( c.id >= $start )";
-  }
-  if ($end) {
-    $clause[] = "( c.id <= $end )";
-  }
-  if ($processGeocode) {
-    $clause[] = '( a.geo_code_1 is null OR a.geo_code_1 = 0 )';
-    $clause[] = '( a.geo_code_2 is null OR a.geo_code_2 = 0 )';
-    $clause[] = '( a.country_id is not null )';
-  }
-  $whereClause = implode(' AND ', $clause);
-
-  $query = "
-SELECT     c.id,
-           a.id as address_id,
-           a.street_address,
-           a.city,
-           a.postal_code,
-           s.name as state,
-           o.name as country
-FROM       civicrm_contact  c
-INNER JOIN civicrm_address        a ON a.contact_id = c.id
-LEFT  JOIN civicrm_country        o ON a.country_id = o.id
-LEFT  JOIN civicrm_state_province s ON a.state_province_id = s.id
-WHERE      {$whereClause}
-  ORDER BY a.id
-";
-
-  $totalGeocoded = $totalAddresses = $totalAddressParsed = 0;
-
-  $dao = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
-
-  if ($processGeocode) {
-    require_once str_replace('_', DIRECTORY_SEPARATOR, $config->geocodeMethod) . '.php';
-  }
-
-  require_once 'CRM/Core/DAO/Address.php';
-  require_once 'CRM/Core/BAO/Address.php';
-
-  $unparseableContactAddress = array();
-  while ($dao->fetch()) {
-    $totalAddresses++;
-    $params = array(
-      'street_address' => $dao->street_address,
-      'postal_code' => $dao->postal_code,
-      'city' => $dao->city,
-      'state_province' => $dao->state,
-      'country' => $dao->country,
-    );
-
-    $addressParams = array();
-
-    // process geocode.
-    if ($processGeocode) {
-      // loop through the address removing more information
-      // so we can get some geocode for a partial address
-      // i.e. city -> state -> country
-
-      $maxTries = 5;
-      do {
-        if (defined('THROTTLE_REQUESTS') &&
-          THROTTLE_REQUESTS
-        ) {
-          usleep(50000);
-        }
-
-        eval($config->geocodeMethod . '::format( $params, true );');
-        array_shift($params);
-        $maxTries--;
-      } while ((!isset($params['geo_code_1'])) &&
-        ($maxTries > 1)
-      );
-
-      if (isset($params['geo_code_1']) &&
-        $params['geo_code_1'] != 'null'
-      ) {
-        $totalGeocoded++;
-        $addressParams['geo_code_1'] = $params['geo_code_1'];
-        $addressParams['geo_code_2'] = $params['geo_code_2'];
-      }
-    }
-
-    // parse street address
-    if ($parseStreetAddress) {
-      $parsedFields = CRM_Core_BAO_Address::parseStreetAddress($dao->street_address);
-      $success = TRUE;
-      // consider address is automatically parseable,
-      // when we should found street_number and street_name
-      if (empty($parsedFields['street_name']) || empty($parsedFields['street_number'])) {
-        $success = FALSE;
-      }
-
-      // do check for all elements.
-      if ($success) {
-        $totalAddressParsed++;
-      }
-      elseif ($dao->street_address) {
-        //build contact edit url,
-        //so that user can manually fill the street address fields if the street address is not parsed, CRM-5886
-        $url = CRM_Utils_System::url('civicrm/contact/add', "reset=1&action=update&cid={$dao->id}");
-        $unparseableContactAddress[] = " Contact ID: " . $dao->id . " <a href =\"$url\"> " . $dao->street_address . " </a> ";
-        // reset element values.
-        $parsedFields = array_fill_keys(array_keys($parsedFields), '');
-      }
-      $addressParams = array_merge($addressParams, $parsedFields);
-    }
-
-    // finally update address object.
-    if (!empty($addressParams)) {
-      $address = new CRM_Core_DAO_Address();
-      $address->id = $dao->address_id;
-      $address->copyValues($addressParams);
-      $address->save();
-      $address->free();
-    }
-  }
-
-  echo ts("Addresses Evaluated: $totalAddresses\n");
-  if ($processGeocode) {
-    echo ts("Addresses Geocoded : $totalGeocoded\n");
-  }
-  if ($parseStreetAddress) {
-    echo ts("Street Address Parsed : $totalAddressParsed\n");
-    if ($unparseableContactAddress) {
-      echo ts("<br />\nFollowing is the list of contacts whose address is not parsed :<br />\n");
-      foreach ($unparseableContactAddress as $contactLink) {
-        echo ts("%1<br />\n", array(1 => $contactLink));
-      }
-    }
-  }
-}
-
-run();
diff --git a/bin/deprecated/UpdateGreeting.php b/bin/deprecated/UpdateGreeting.php
deleted file mode 100644 (file)
index c1cf1ae..0000000
+++ /dev/null
@@ -1,246 +0,0 @@
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.7                                               |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM.                                    |
- |                                                                    |
- | CiviCRM is free software; you can copy, modify, and distribute it  |
- | under the terms of the GNU Affero General Public License           |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
- |                                                                    |
- | CiviCRM is distributed in the hope that it will be useful, but     |
- | WITHOUT ANY WARRANTY; without even the implied warranty of         |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
- | See the GNU Affero General Public License for more details.        |
- |                                                                    |
- | You should have received a copy of the GNU Affero General Public   |
- | License and the CiviCRM Licensing Exception along                  |
- | with this program; if not, contact CiviCRM LLC                     |
- | at info[AT]civicrm[DOT]org. If you have questions about the        |
- | GNU Affero General Public License or the licensing of CiviCRM,     |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
- +--------------------------------------------------------------------+
- */
-
-
-/*
- * Using this script you can update Email Greetings, Postal Greetings and Addressee for a specific contact type
- *
- * params for this script
- * ct=Individual or ct=Household or ct=Organization (ct = contact type)
- * gt=email_greeting or gt=postal_greeting or gt=addressee (gt = greeting )
- * id=greeting option value
- *
- * IMPORTANT: You must first create valid option value before using via admin interface.
- * Check option lists for Email Greetings, Postal Greetings and Addressee
- */
-
-/**
- * Class CRM_UpdateGreeting
- */
-class CRM_UpdateGreeting {
-  /**
-   */
-  public function __construct() {
-    $this->initialize();
-
-    $config = CRM_Core_Config::singleton();
-
-    require_once 'CRM/Utils/Request.php';
-    require_once 'CRM/Core/PseudoConstant.php';
-    require_once 'CRM/Contact/BAO/Contact.php';
-
-    // this does not return on failure
-    CRM_Utils_System::authenticateScript(TRUE);
-
-    //log the execution time of script
-    CRM_Core_Error::debug_log_message('UpdateGreeting.php');
-  }
-
-  public function initialize() {
-    require_once '../../civicrm.config.php';
-    require_once 'CRM/Core/Config.php';
-  }
-
-  public function updateGreeting() {
-    $config = CRM_Core_Config::singleton();
-    $contactType = CRM_Utils_Request::retrieve('ct', 'String', CRM_Core_DAO::$_nullArray, FALSE, NULL, 'REQUEST');
-    if (!in_array($contactType,
-      array('Individual', 'Household', 'Organization')
-    )
-    ) {
-      CRM_Core_Error::fatal(ts('Invalid Contact Type.'));
-    }
-
-    $greeting = CRM_Utils_Request::retrieve('gt', 'String', CRM_Core_DAO::$_nullArray, FALSE, NULL, 'REQUEST');
-    if (!in_array($greeting,
-      array('email_greeting', 'postal_greeting', 'addressee')
-    )
-    ) {
-      CRM_Core_Error::fatal(ts('Invalid Greeting Type.'));
-    }
-
-    if (in_array($greeting, array(
-        'email_greeting',
-        'postal_greeting',
-      )) && $contactType == 'Organization'
-    ) {
-      CRM_Core_Error::fatal(ts('You cannot use %1 for contact type %2.', array(1 => $greeting, 2 => $contactType)));
-    }
-
-    $valueID = $id = CRM_Utils_Request::retrieve('id', 'Positive', CRM_Core_DAO::$_nullArray, FALSE, NULL, 'REQUEST');
-
-    // if valueID is not passed use default value
-    if (!$valueID) {
-      require_once 'CRM/Core/OptionGroup.php';
-      $contactTypeFilters = array(1 => 'Individual', 2 => 'Household', 3 => 'Organization');
-      $filter = CRM_Utils_Array::key($contactType, $contactTypeFilters);
-      $defaulValueID = CRM_Core_OptionGroup::values($greeting, NULL, NULL, NULL,
-        " AND is_default = 1 AND ( filter = {$filter} OR filter = 0 )",
-        "value"
-      );
-      $valueID = array_pop($defaulValueID);
-    }
-
-    $filter = array(
-      'contact_type' => $contactType,
-      'greeting_type' => $greeting,
-    );
-
-    $allGreetings = CRM_Core_PseudoConstant::greeting($filter);
-    $originalGreetingString = $greetingString = CRM_Utils_Array::value($valueID, $allGreetings);
-    if (!$greetingString) {
-      CRM_Core_Error::fatal(ts('Incorrect greeting value id %1.', array(1 => $valueID)));
-    }
-
-    // build return properties based on tokens
-    require_once 'CRM/Utils/Token.php';
-    $greetingTokens = CRM_Utils_Token::getTokens($greetingString);
-    $tokens = CRM_Utils_Array::value('contact', $greetingTokens);
-    $greetingsReturnProperties = array();
-    if (is_array($tokens)) {
-      $greetingsReturnProperties = array_fill_keys(array_values($tokens), 1);
-    }
-
-    //process all contacts only when force pass.
-    $force = CRM_Utils_Request::retrieve('force', 'String', CRM_Core_DAO::$_nullArray, FALSE, NULL, 'REQUEST');
-    $processAll = $processOnlyIdSet = FALSE;
-    if (in_array($force, array(
-      1,
-      'true',
-    ))) {
-      $processAll = TRUE;
-    }
-    elseif ($force == 2) {
-      $processOnlyIdSet = TRUE;
-    }
-
-    //FIXME : apiQuery should handle these clause.
-    $filterContactFldIds = $filterIds = array();
-    if (!$processAll) {
-      $idFldName = $displayFldName = NULL;
-      if ($greeting == 'email_greeting' || $greeting == 'postal_greeting' || $greeting == 'addressee') {
-        $idFldName = $greeting . '_id';
-        $displayFldName = $greeting . '_display';
-      }
-
-      if ($idFldName) {
-        $sql = "
-SELECT DISTINCT id, $idFldName
-  FROM civicrm_contact
- WHERE contact_type = %1
-   AND ( {$idFldName} IS NULL OR
-         ( {$idFldName} IS NOT NULL AND {$displayFldName} IS NULL ) )
-   ";
-        $dao = CRM_Core_DAO::executeQuery($sql, array(1 => array($contactType, 'String')));
-        while ($dao->fetch()) {
-          $filterContactFldIds[$dao->id] = $dao->$idFldName;
-
-          if (!CRM_Utils_System::isNull($dao->$idFldName)) {
-            $filterIds[$dao->id] = $dao->$idFldName;
-          }
-        }
-      }
-      if (empty($filterContactFldIds)) {
-        $filterContactFldIds[] = 0;
-      }
-    }
-
-    if (empty($filterContactFldIds)) {
-      return;
-    }
-
-    // retrieve only required contact information
-    require_once 'CRM/Utils/Token.php';
-    $extraParams[] = array('contact_type', '=', $contactType, 0, 0);
-    // we do token replacement in the replaceGreetingTokens hook
-    list($greetingDetails) = CRM_Utils_Token::getTokenDetails(array_keys($filterContactFldIds),
-      $greetingsReturnProperties,
-      FALSE, FALSE, $extraParams
-    );
-    // perform token replacement and build update SQL
-    $contactIds = array();
-    $cacheFieldQuery = "UPDATE civicrm_contact SET {$greeting}_display = CASE id ";
-    foreach ($greetingDetails as $contactID => $contactDetails) {
-      if (!$processAll &&
-        !array_key_exists($contactID, $filterContactFldIds)
-      ) {
-        continue;
-      }
-
-      if ($processOnlyIdSet) {
-        if (!array_key_exists($contactID, $filterIds)) {
-          continue;
-        }
-        if ($id) {
-          $greetingString = $originalGreetingString;
-          $contactIds[] = $contactID;
-        }
-        else {
-          if ($greetingBuffer = CRM_Utils_Array::value($filterContactFldIds[$contactID], $allGreetings)) {
-            $greetingString = $greetingBuffer;
-          }
-        }
-        $allContactIds[] = $contactID;
-      }
-      else {
-        $greetingString = $originalGreetingString;
-        if ($greetingBuffer = CRM_Utils_Array::value($filterContactFldIds[$contactID], $allGreetings)) {
-          $greetingString = $greetingBuffer;
-        }
-        else {
-          $contactIds[] = $contactID;
-        }
-      }
-      CRM_Contact_BAO_Contact_Utils::processGreetingTemplate($greetingString, $contactDetails, $contactID, 'CRM_UpdateGreeting');
-      $greetingString = CRM_Core_DAO::escapeString($greetingString);
-      $cacheFieldQuery .= " WHEN {$contactID} THEN '{$greetingString}' ";
-
-      $allContactIds[] = $contactID;
-    }
-
-    if (!empty($allContactIds)) {
-      $cacheFieldQuery .= " ELSE {$greeting}_display
-                              END;";
-      if (!empty($contactIds)) {
-        // need to update greeting _id field.
-        $queryString = "
-UPDATE civicrm_contact
-   SET {$greeting}_id = {$valueID}
- WHERE id IN (" . implode(',', $contactIds) . ")";
-        CRM_Core_DAO::executeQuery($queryString);
-      }
-
-      // now update cache field
-      CRM_Core_DAO::executeQuery($cacheFieldQuery);
-    }
-  }
-
-}
-
-$obj = new CRM_UpdateGreeting();
-$obj->updateGreeting();
-echo "\n\n Greeting is updated for contact(s). (Done) \n";
diff --git a/bin/deprecated/UpdateMembershipRecord.php b/bin/deprecated/UpdateMembershipRecord.php
deleted file mode 100644 (file)
index 3919bc8..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.7                                               |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM.                                    |
- |                                                                    |
- | CiviCRM is free software; you can copy, modify, and distribute it  |
- | under the terms of the GNU Affero General Public License           |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
- |                                                                    |
- | CiviCRM is distributed in the hope that it will be useful, but     |
- | WITHOUT ANY WARRANTY; without even the implied warranty of         |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
- | See the GNU Affero General Public License for more details.        |
- |                                                                    |
- | You should have received a copy of the GNU Affero General Public   |
- | License and the CiviCRM Licensing Exception along                  |
- | with this program; if not, contact CiviCRM LLC                     |
- | at info[AT]civicrm[DOT]org. If you have questions about the        |
- | GNU Affero General Public License or the licensing of CiviCRM,     |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
- +--------------------------------------------------------------------+
- */
-
-
-/*
- * This file checks and updates the status of all membership records for a given domain using the calc_membership_status and
- * update_contact_membership APIs.
- * It takes the first argument as the domain-id if specified, otherwise takes the domain-id as 1.
- *
- * IMPORTANT:
- * We are using the default Domain FROM Name and FROM Email Address as the From email address for emails sent by this script.
- * Verify that this value has been properly set from Administer > Configure > Domain Information
- * If you want to use some other FROM email address, modify line 125 and set your valid email address.
- *
- * Save the file as UpdateMembershipRecord.php prior to running this script.
- */
-
-/**
- * Class CRM_UpdateMembershipRecord
- */
-class CRM_UpdateMembershipRecord {
-  /**
-   */
-  public function __construct() {
-    // you can run this program either from an apache command, or from the cli
-    if (php_sapi_name() == "cli") {
-      require_once "cli.php";
-      $cli = new civicrm_cli();
-      //if it doesn't die, it's authenticated
-    }
-    else {
-      //from the webserver
-      $this->initialize();
-
-      $config = CRM_Core_Config::singleton();
-
-      // this does not return on failure
-      CRM_Utils_System::authenticateScript(TRUE);
-
-      //log the execution time of script
-      CRM_Core_Error::debug_log_message('UpdateMembershipRecord.php');
-    }
-  }
-
-  public function initialize() {
-    require_once '../civicrm.config.php';
-    require_once 'CRM/Core/Config.php';
-
-    $config = CRM_Core_Config::singleton();
-  }
-
-  public function updateMembershipStatus() {
-    require_once 'CRM/Member/BAO/Membership.php';
-    CRM_Member_BAO_Membership::updateAllMembershipStatus();
-  }
-
-}
-
-$obj = new CRM_UpdateMembershipRecord();
-
-echo "\n Updating ";
-$obj->updateMembershipStatus();
-echo "\n\n Membership records updated. (Done) \n";
diff --git a/bin/deprecated/UpdateMembershipReminderDate.php b/bin/deprecated/UpdateMembershipReminderDate.php
deleted file mode 100644 (file)
index 710459f..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.7                                                |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM.                                    |
- |                                                                    |
- | CiviCRM is free software; you can copy, modify, and distribute it  |
- | under the terms of the GNU Affero General Public License           |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
- |                                                                    |
- | CiviCRM is distributed in the hope that it will be useful, but     |
- | WITHOUT ANY WARRANTY; without even the implied warranty of         |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
- | See the GNU Affero General Public License for more details.        |
- |                                                                    |
- | You should have received a copy of the GNU Affero General Public   |
- | License and the CiviCRM Licensing Exception along                  |
- | with this program; if not, contact CiviCRM LLC                     |
- | at info[AT]civicrm[DOT]org. If you have questions about the        |
- | GNU Affero General Public License or the licensing of CiviCRM,     |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
- +--------------------------------------------------------------------+
- */
-
-
-/*
- * This file updates the Reminder dates of all valid membership records.
- *
- */
-
-/**
- * Class CRM_UpdateMembershipReminderDate
- */
-class CRM_UpdateMembershipReminderDate {
-  /**
-   */
-  public function __construct() {
-    // you can run this program either from an apache command, or from the cli
-    if (php_sapi_name() == "cli") {
-      require_once "cli.php";
-      $cli = new civicrm_cli();
-      //if it doesn't die, it's authenticated
-    }
-    else {
-      //from the webserver
-      $this->initialize();
-
-      $config = CRM_Core_Config::singleton();
-
-      // this does not return on failure
-      CRM_Utils_System::authenticateScript(TRUE);
-
-      //log the execution time of script
-      CRM_Core_Error::debug_log_message('UpdateMembershipReminderDate.php');
-    }
-  }
-
-  public function initialize() {
-    require_once '../civicrm.config.php';
-    require_once 'CRM/Core/Config.php';
-
-    $config = CRM_Core_Config::singleton();
-  }
-
-  public function updateMembershipReminderDate() {
-    require_once 'CRM/Member/PseudoConstant.php';
-
-    //get all active statuses of membership.
-    $allStatuses = CRM_Member_PseudoConstant::membershipStatus();
-
-    //set membership reminder date if membership
-    //record has one of the following status.
-    $validStatus = array('New', 'Current', 'Grace');
-
-    $statusIds = array();
-    foreach ($validStatus as $status) {
-      $statusId = array_search($status, $allStatuses);
-      if ($statusId) {
-        $statusIds[$statusId] = $statusId;
-      }
-    }
-
-    //we don't have valid status to check,
-    //therefore no need to proceed further.
-    if (empty($statusIds)) {
-      return;
-    }
-
-    //set reminder date for all memberships,
-    //in case reminder date is missing and
-    //membership type has reminder day set.
-
-    $query = '
-    UPDATE  civicrm_membership membership
-INNER JOIN  civicrm_contact contact ON ( contact.id = membership.contact_id )
-INNER JOIN  civicrm_membership_type type ON ( type.id = membership.membership_type_id )
-       SET  membership.reminder_date = DATE_SUB( membership.end_date, INTERVAL type.renewal_reminder_day + 1 DAY )
-     WHERE  membership.reminder_date IS NULL
-       AND  contact.is_deleted = 0
-       AND  ( contact.is_deceased IS NULL OR contact.is_deceased = 0 )
-       AND  type.renewal_reminder_day IS NOT NULL
-       AND  membership.status_id IN ( ' . implode(' , ', $statusIds) . ' )';
-
-    CRM_Core_DAO::executeQuery($query);
-  }
-
-}
-
-$reminderDate = new CRM_UpdateMembershipReminderDate();
-
-echo "\n Updating... ";
-$reminderDate->updateMembershipReminderDate();
-echo "\n\n Membership(s) reminder date updated. (Done) \n";
diff --git a/bin/deprecated/UpdatePledgeRecord.php b/bin/deprecated/UpdatePledgeRecord.php
deleted file mode 100644 (file)
index 2e1bcb7..0000000
+++ /dev/null
@@ -1,310 +0,0 @@
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.7                                                |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM.                                    |
- |                                                                    |
- | CiviCRM is free software; you can copy, modify, and distribute it  |
- | under the terms of the GNU Affero General Public License           |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
- |                                                                    |
- | CiviCRM is distributed in the hope that it will be useful, but     |
- | WITHOUT ANY WARRANTY; without even the implied warranty of         |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
- | See the GNU Affero General Public License for more details.        |
- |                                                                    |
- | You should have received a copy of the GNU Affero General Public   |
- | License and the CiviCRM Licensing Exception along                  |
- | with this program; if not, contact CiviCRM LLC                     |
- | at info[AT]civicrm[DOT]org. If you have questions about the        |
- | GNU Affero General Public License or the licensing of CiviCRM,     |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
- +--------------------------------------------------------------------+
- */
-
-
-/*
- * This file checks and updates the status of all pledge records for a
- * given domain using the updatePledgePaymentStatus.
- *
- * UpdatePledgeRecord.php prior to running this script.
- */
-
-require_once '../civicrm.config.php';
-require_once 'CRM/Core/Config.php';
-
-/**
- * Class CRM_UpdatePledgeRecord
- */
-class CRM_UpdatePledgeRecord {
-  /**
-   */
-  public function __construct() {
-    $config = CRM_Core_Config::singleton();
-    // this does not return on failure
-    require_once 'CRM/Utils/System.php';
-    require_once 'CRM/Utils/Hook.php';
-
-    CRM_Utils_System::authenticateScript(TRUE);
-    $config->cleanURL = 1;
-
-    //log the execution time of script
-    CRM_Core_Error::debug_log_message('UpdatePledgeRecord.php');
-  }
-
-  /**
-   * @param bool $sendReminders
-   *
-   * @throws Exception
-   */
-  public function updatePledgeStatus($sendReminders = FALSE) {
-
-    // *** Uncomment the next line if you want automated reminders to be sent
-    // $sendReminders = true;
-
-    require_once 'CRM/Contribute/PseudoConstant.php';
-    $allStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
-
-    //unset statues that we never use for pledges
-    foreach (array(
-               'Completed',
-               'Cancelled',
-               'Failed',
-             ) as $statusKey) {
-      if ($key = CRM_Utils_Array::key($statusKey, $allStatus)) {
-        unset($allStatus[$key]);
-      }
-    }
-
-    $statusIds = implode(',', array_keys($allStatus));
-    $updateCnt = 0;
-
-    $query = "
-SELECT  pledge.contact_id              as contact_id,
-        pledge.id                      as pledge_id,
-        pledge.amount                  as amount,
-        payment.scheduled_date         as scheduled_date,
-        pledge.create_date             as create_date,
-        payment.id                     as payment_id,
-        pledge.contribution_page_id    as contribution_page_id,
-        payment.reminder_count         as reminder_count,
-        pledge.max_reminders           as max_reminders,
-        payment.reminder_date          as reminder_date,
-        pledge.initial_reminder_day    as initial_reminder_day,
-        pledge.additional_reminder_day as additional_reminder_day,
-        pledge.status_id               as pledge_status,
-        payment.status_id              as payment_status,
-        pledge.is_test                 as is_test,
-        pledge.campaign_id             as campaign_id,
-        SUM(payment.scheduled_amount)  as amount_due,
-        ( SELECT sum(civicrm_pledge_payment.actual_amount)
-        FROM civicrm_pledge_payment
-        WHERE civicrm_pledge_payment.status_id = 1
-        AND  civicrm_pledge_payment.pledge_id = pledge.id
-        ) as amount_paid
-        FROM      civicrm_pledge pledge, civicrm_pledge_payment payment
-        WHERE     pledge.id = payment.pledge_id
-        AND     payment.status_id IN ( {$statusIds} ) AND pledge.status_id IN ( {$statusIds} )
-        GROUP By  payment.id
-        ";
-
-    $dao = CRM_Core_DAO::executeQuery($query);
-
-    require_once 'CRM/Contact/BAO/Contact/Utils.php';
-    require_once 'CRM/Utils/Date.php';
-    $now = date('Ymd');
-    $pledgeDetails = $contactIds = $pledgePayments = $pledgeStatus = array();
-    while ($dao->fetch()) {
-      $checksumValue = CRM_Contact_BAO_Contact_Utils::generateChecksum($dao->contact_id);
-
-      $pledgeDetails[$dao->payment_id] = array(
-        'scheduled_date' => $dao->scheduled_date,
-        'amount_due' => $dao->amount_due,
-        'amount' => $dao->amount,
-        'amount_paid' => $dao->amount_paid,
-        'create_date' => $dao->create_date,
-        'contact_id' => $dao->contact_id,
-        'pledge_id' => $dao->pledge_id,
-        'checksumValue' => $checksumValue,
-        'contribution_page_id' => $dao->contribution_page_id,
-        'reminder_count' => $dao->reminder_count,
-        'max_reminders' => $dao->max_reminders,
-        'reminder_date' => $dao->reminder_date,
-        'initial_reminder_day' => $dao->initial_reminder_day,
-        'additional_reminder_day' => $dao->additional_reminder_day,
-        'pledge_status' => $dao->pledge_status,
-        'payment_status' => $dao->payment_status,
-        'is_test' => $dao->is_test,
-        'campaign_id' => $dao->campaign_id,
-      );
-
-      $contactIds[$dao->contact_id] = $dao->contact_id;
-      $pledgeStatus[$dao->pledge_id] = $dao->pledge_status;
-
-      if (CRM_Utils_Date::overdue(CRM_Utils_Date::customFormat($dao->scheduled_date, '%Y%m%d'),
-          $now
-        ) && $dao->payment_status != array_search('Overdue', $allStatus)
-      ) {
-        $pledgePayments[$dao->pledge_id][$dao->payment_id] = $dao->payment_id;
-      }
-    }
-
-    require_once 'CRM/Pledge/BAO/PledgePayment.php';
-    // process the updating script...
-
-    foreach ($pledgePayments as $pledgeId => $paymentIds) {
-      // 1. update the pledge /pledge payment status. returns new status when an update happens
-      echo "<br />Checking if status update is needed for Pledge Id: {$pledgeId} (current status is {$allStatus[$pledgeStatus[$pledgeId]]})";
-
-      $newStatus = CRM_Pledge_BAO_PledgePayment::updatePledgePaymentStatus($pledgeId, $paymentIds,
-        array_search('Overdue', $allStatus), NULL, 0, FALSE, TRUE
-      );
-      if ($newStatus != $pledgeStatus[$pledgeId]) {
-        echo "<br />- status updated to: {$allStatus[$newStatus]}";
-        $updateCnt += 1;
-      }
-    }
-
-    if ($sendReminders) {
-      // retrieve domain tokens
-      require_once 'CRM/Core/BAO/Domain.php';
-      require_once 'CRM/Core/SelectValues.php';
-      $domain = CRM_Core_BAO_Domain::getDomain();
-      $tokens = array(
-        'domain' => array('name', 'phone', 'address', 'email'),
-        'contact' => CRM_Core_SelectValues::contactTokens(),
-      );
-
-      require_once 'CRM/Utils/Token.php';
-      $domainValues = array();
-      foreach ($tokens['domain'] as $token) {
-        $domainValues[$token] = CRM_Utils_Token::getDomainTokenReplacement($token, $domain);
-      }
-
-      //get the domain email address, since we don't carry w/ object.
-      require_once 'CRM/Core/BAO/Domain.php';
-      $domainValue = CRM_Core_BAO_Domain::getNameAndEmail();
-      $domainValues['email'] = $domainValue[1];
-
-      // retrieve contact tokens
-
-      // this function does NOT return Deceased contacts since we don't want to send them email
-      require_once 'CRM/Utils/Token.php';
-      list($contactDetails) = CRM_Utils_Token::getTokenDetails($contactIds,
-        NULL,
-        FALSE, FALSE, NULL,
-        $tokens, 'CRM_UpdatePledgeRecord'
-      );
-
-      // assign domain values to template
-      $template = CRM_Core_Smarty::singleton();
-      $template->assign('domain', $domainValues);
-
-      //set receipt from
-      $receiptFrom = '"' . $domainValues['name'] . '" <' . $domainValues['email'] . '>';
-
-      foreach ($pledgeDetails as $paymentId => $details) {
-        if (array_key_exists($details['contact_id'], $contactDetails)) {
-          $contactId = $details['contact_id'];
-          $pledgerName = $contactDetails[$contactId]['display_name'];
-        }
-        else {
-          continue;
-        }
-
-        if (empty($details['reminder_date'])) {
-          $nextReminderDate = new DateTime($details['scheduled_date']);
-          $nextReminderDate->modify("-" . $details['initial_reminder_day'] . "day");
-          $nextReminderDate = $nextReminderDate->format("Ymd");
-        }
-        else {
-          $nextReminderDate = new DateTime($details['reminder_date']);
-          $nextReminderDate->modify("+" . $details['additional_reminder_day'] . "day");
-          $nextReminderDate = $nextReminderDate->format("Ymd");
-        }
-        if (($details['reminder_count'] < $details['max_reminders'])
-          && ($nextReminderDate <= $now)
-        ) {
-
-          $toEmail = $doNotEmail = $onHold = NULL;
-
-          if (!empty($contactDetails[$contactId]['email'])) {
-            $toEmail = $contactDetails[$contactId]['email'];
-          }
-
-          if (!empty($contactDetails[$contactId]['do_not_email'])) {
-            $doNotEmail = $contactDetails[$contactId]['do_not_email'];
-          }
-
-          if (!empty($contactDetails[$contactId]['on_hold'])) {
-            $onHold = $contactDetails[$contactId]['on_hold'];
-          }
-
-          // 2. send acknowledgement mail
-          if ($toEmail && !($doNotEmail || $onHold)) {
-            //assign value to template
-            $template->assign('amount_paid', $details['amount_paid'] ? $details['amount_paid'] : 0);
-            $template->assign('contact', $contactDetails[$contactId]);
-            $template->assign('next_payment', $details['scheduled_date']);
-            $template->assign('amount_due', $details['amount_due']);
-            $template->assign('checksumValue', $details['checksumValue']);
-            $template->assign('contribution_page_id', $details['contribution_page_id']);
-            $template->assign('pledge_id', $details['pledge_id']);
-            $template->assign('scheduled_payment_date', $details['scheduled_date']);
-            $template->assign('amount', $details['amount']);
-            $template->assign('create_date', $details['create_date']);
-
-            require_once 'CRM/Core/BAO/MessageTemplate.php';
-            list($mailSent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate(
-              array(
-                'groupName' => 'msg_tpl_workflow_pledge',
-                'valueName' => 'pledge_reminder',
-                'contactId' => $contactId,
-                'from' => $receiptFrom,
-                'toName' => $pledgerName,
-                'toEmail' => $toEmail,
-              )
-            );
-
-            // 3. update pledge payment details
-            if ($mailSent) {
-              CRM_Pledge_BAO_PledgePayment::updateReminderDetails($paymentId);
-              $activityType = 'Pledge Reminder';
-              $activityParams = array(
-                'subject' => $subject,
-                'source_contact_id' => $contactId,
-                'source_record_id' => $paymentId,
-                'assignee_contact_id' => $contactId,
-                'activity_type_id' => CRM_Core_OptionGroup::getValue('activity_type',
-                  $activityType,
-                  'name'
-                ),
-                'activity_date_time' => CRM_Utils_Date::isoToMysql($now),
-                'due_date_time' => CRM_Utils_Date::isoToMysql($details['scheduled_date']),
-                'is_test' => $details['is_test'],
-                'status_id' => 2,
-                'campaign_id' => $details['campaign_id'],
-              );
-              if (is_a(civicrm_api('activity', 'create', $activityParams), 'CRM_Core_Error')) {
-                CRM_Core_Error::fatal("Failed creating Activity for acknowledgment");
-              }
-              echo "<br />Payment reminder sent to: {$pledgerName} - {$toEmail}";
-            }
-          }
-        }
-      }
-      // end foreach on $pledgeDetails
-    }
-    // end if ( $sendReminders )
-    echo "<br />{$updateCnt} records updated.";
-  }
-
-}
-
-$obj = new CRM_UpdatePledgeRecord();
-echo "Updating<br />";
-$obj->updatePledgeStatus();
-echo "<br />Pledge records update script finished.";
diff --git a/bin/deprecated/civimail.cronjob.php b/bin/deprecated/civimail.cronjob.php
deleted file mode 100644 (file)
index 29e1eb3..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.7                                                |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM.                                    |
- |                                                                    |
- | CiviCRM is free software; you can copy, modify, and distribute it  |
- | under the terms of the GNU Affero General Public License           |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
- |                                                                    |
- | CiviCRM is distributed in the hope that it will be useful, but     |
- | WITHOUT ANY WARRANTY; without even the implied warranty of         |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
- | See the GNU Affero General Public License for more details.        |
- |                                                                    |
- | You should have received a copy of the GNU Affero General Public   |
- | License and the CiviCRM Licensing Exception along                  |
- | with this program; if not, contact CiviCRM LLC                     |
- | at info[AT]civicrm[DOT]org. If you have questions about the        |
- | GNU Affero General Public License or the licensing of CiviCRM,     |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
- +--------------------------------------------------------------------+
- */
-
-/**
- * A PHP cron script to run the outstanding and scheduled CiviMail jobs
- * initiated by Owen Barton from a mailing sent by Lobo to crm-mail
- *
- * The structure of the file is set to mimic soap.php which is a stand-alone
- * script and hence does not have any UF issues. You should be able to run
- * this script using a web url or from the command line
- */
-function run() {
-  session_start();
-
-  if (!function_exists('drush_get_context')) {
-    require_once '../civicrm.config.php';
-  }
-
-  require_once 'CRM/Core/Config.php';
-  $config = CRM_Core_Config::singleton();
-
-  // this does not return on failure
-  CRM_Utils_System::authenticateScript(TRUE);
-
-  // we now use DB locks on a per job basis
-  require_once 'CRM/Mailing/BAO/Mailing.php';
-  CRM_Mailing_BAO_Mailing::processQueue();
-}
-
-// you can run this program either from an apache command, or from the cli
-if (php_sapi_name() == "cli") {
-  require_once "bin/cli.php";
-  $cli = new civicrm_cli();
-
-  require_once 'CRM/Mailing/BAO/Mailing.php';
-  CRM_Mailing_BAO_Mailing::processQueue();
-
-  // from the webserver
-}
-else {
-  run();
-}
index ef1b5aa867bc4e81f46f284de5a3556fb06e36e1..acbc7457d976d532ddf7fd20dc8a320234fa4ec2 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 define('CRM_ENCRYPT', 1);
diff --git a/bin/gitify b/bin/gitify
deleted file mode 100755 (executable)
index dc2b93d..0000000
+++ /dev/null
@@ -1,283 +0,0 @@
-#!/bin/bash
-
-## Take an existing, tar-based CiviCRM directory and convert it to a git working directory
-
-#### Helpers ####
-
-###########################################
-## usage: do_gitify <repo-url> <existing-dir> [git-checkout-options]
-function do_gitify() {
-  REPO="$1"
-  TGT="$2"
-  TMP="${TGT}.tmp"
-  shift 2
-
-  if [ -d "$TGT/.git" ]; then
-    echo "[[Already checked out git repo ($TGT) -- skip $REPO]]"
-    return
-  fi
-  [ -d $TGT ] || mkdir -p "$TGT"
-  [ -d $TMP ] && rm -rf "$TMP"
-  echo "[[Checkout $REPO ($TMP)]]"
-  echo "[git clone "$@" "$REPO" "$TMP"]"
-  git clone "$@" "$REPO" "$TMP"
-
-  echo "[[Swap metadata]]"
-  mv "$TMP/.git" "$TGT/.git"
-
-  echo "[[Remove local modifications]]"
-  pushd "$TGT" > /dev/null
-  git checkout -- .
-  popd > /dev/null
-
-  rm -rf "$TMP"
-}
-
-###########################################
-## add hook shims to a repo
-## usage: do_hookify <canonical-repo-name> <repo-path> <relative-hook-path>
-function do_hookify() {
-  GIT_CANONICAL_REPO_NAME="$1"
-  TGT="$2"
-  HOOK_DIR="$3"
-  if [ -n "$CIVICRM_GIT_HOOKS" ]; then
-    echo "[[Install recommended hooks ($TGT)]]"
-    for HOOK in commit-msg post-checkout post-merge pre-commit prepare-commit-msg post-commit pre-rebase post-rewrite ;do
-          cat << TMPL > "$TGT/.git/hooks/$HOOK"
-#!/bin/bash
-if [ -f "\$GIT_DIR/${HOOK_DIR}/${HOOK}" ]; then
-  ## Note: GIT_CANONICAL_REPO_NAME was not provided by early hook-stubs
-  export GIT_CANONICAL_REPO_NAME="$GIT_CANONICAL_REPO_NAME"
-  source "\$GIT_DIR/${HOOK_DIR}/${HOOK}"
-fi
-TMPL
-      chmod +x "$TGT/.git/hooks/$HOOK"
-    done
-  else
-    echo "[[Skip hook installation ($TGT) -- use \"--hooks\" to enable]]"
-  fi
-}
-
-###########################################
-## Create or update the URL of a git remote
-## usage: git_set_remote <local-repo-path> <remote-name> <remote-url>
-function git_set_remote() {
-  REPODIR="$1"
-  REMOTE_NAME="$2"
-  REMOTE_URL="$3"
-  echo "[[Set remote ($REMOTE_NAME => $REMOTE_URL within $REPODIR)]]"
-
-  pushd "$REPODIR" >> /dev/null
-    git remote set-url "$REMOTE_NAME"  "$REMOTE_URL" >/dev/null 2>&1 || git remote add "$REMOTE_NAME"  "$REMOTE_URL"
-  popd >> /dev/null
-}
-
-###########################################
-## usage: do_targzify <targz-url> <file-name> <existing-dir>
-## Fetches a tar.gz archive and unpacks it in the current directory
-function do_targzify() {
-  TARGZURL="$1"
-  TARFILE="$2"
-  TGT="$3"
-  shift 3
-
-  if [ -d "$TGT" ]; then
-    echo "[[Already have a copy of the archive ($TGT) -- skip $TARGZURL]]"
-    return
-  fi
-
-  TMP=`mktemp -d`
-
-  echo "[[Downloading $TARGZURL ($TMP)]]"
-  echo "[wget \"$TARGZURL\" -O \"$TMP/$TARFILE\"]"
-
-  pushd "$CIVICRM_ROOT" > /dev/null
-  wget -q "$TARGZURL" -O "$TMP/$TARFILE"
-  tar zxfv "$TMP/$TARFILE"
-  popd
-
-  rm "$TMP/$TARFILE"
-  rmdir "$TMP"
-}
-
-###########################################
-## usage: do_gencode <civicrm-path>
-function do_gencode() {
-  pushd "$1/xml" > /dev/null
-    if [ -f "GenCode.php" ]; then
-      echo "[[Generate files]]"
-      php GenCode.php
-    else
-      echo "[[Skip \"Generate files\"]]"
-    fi
-  popd > /dev/null
-}
-
-## usage: do_setupconf <civicrm-path>
-function do_setupconf() {
-  pushd "$1" >> /dev/null
-    echo "[[Initialize bin/setup.conf]]"
-    if [ ! -f "bin/setup.conf" ]; then
-      pwd
-      echo       cp "bin/setup.conf.txt" "bin/setup.conf"
-      cp "bin/setup.conf.txt" "bin/setup.conf"
-    fi
-    echo "[[chmod 600 bin/setup.conf]]"
-    chmod 600 bin/setup.conf
-    echo ""
-    echo "====================[ Next steps (for Civi v4.6+) ]===================="
-    echo "  * Edit the following file and fill in credentials for the CiviCRM DB."
-    echo "    $1/bin/setup.conf"
-    echo "  * Perform one of these steps:"
-    echo "    + Run 'bin/setup.sh -Dg' to download and generate missing code."
-    echo "    + Run 'bin/setup.sh' to download code and reset the CiviCRM DB"
-    echo "      with the latest schema."
-    echo "  * If this is a network-accessible server (eg staging/production), then"
-    echo "    setup.conf may present a security issue. The permissions have been"
-    echo "    preset to restrict access in most servers - but this may not work"
-    echo "    in all environments. Please:"
-    echo "    + Check whether the file is web-accessible."
-    echo "    + Optionally, change the permissions."
-    echo "    + Optionally, delete the file."
-  popd > /dev/null
-}
-
-###########################################
-## config_repo <repo-name> <local-path> <default-branch> <git-scripts-path>
-##                  1            2              3               4
-function config_repo() {
-  do_gitify "${UPSTREAM_GIT_BASE_URL}/${1}.git" "$2" -b "$3"
-  do_hookify "$1" "$2" "$4"
-  ## doesn't work with http -- git ls-remote "git://github.com/civicrm/civicrm-drupalz.git" HEAD --exit-code &>- ; echo $?
-  if [ -n "$FORK_GIT_BASE_URL" ]; then
-    git_set_remote "$2" upstream "${UPSTREAM_GIT_BASE_URL}/${1}.git"
-    git_set_remote "$2" origin "${FORK_GIT_BASE_URL}/${1}.git"
-  else
-    git_set_remote "$2" origin "${UPSTREAM_GIT_BASE_URL}/${1}.git"
-  fi
-}
-
-function check_dep() {
-  if [ -z "`which git`" ]; then
-    echo "command not found: git"
-    exit 3
-  fi
-  if [ -z `which php` ]; then
-    echo "command not found: php"
-  fi
-}
-
-###########################################
-#### Main: Parse arguments
-
-set -e
-
-CIVICRM_CMS=""
-CIVICRM_ROOT=""
-CIVICRM_L10N=""
-CIVICRM_GIT_HOOKS=""
-CIVICRM_BRANCH="master"
-FORK_GIT_BASE_URL=""
-UPSTREAM_GIT_BASE_URL="https://github.com/civicrm"
-SKIP_GENCODE=
-
-while [ -n "$1" ]; do
-  if [ "$1" == "--l10n" ]; then
-    CIVICRM_L10N="$1"
-  elif [ "$1" == "--hooks" ]; then
-    CIVICRM_GIT_HOOKS="$1"
-  elif [ "$1" == "--upstream" ]; then
-    shift
-    UPSTREAM_GIT_BASE_URL="$1"
-  elif [ "$1" == "--fork" ]; then
-    shift
-    FORK_GIT_BASE_URL="$1"
-  elif [ "$1" == "--skip-gencode" ]; then
-    SKIP_GENCODE=1
-  elif [ "$1" == "--branch" ]; then
-    shift
-    CIVICRM_BRANCH="$1"
-  elif [ -z "$CIVICRM_CMS" ]; then
-    ## First arg
-    CIVICRM_CMS="$1"
-  elif [ -z "$CIVICRM_ROOT" ]; then
-    ## Third arg
-    CIVICRM_ROOT="$1"
-  else
-    echo "unrecognized argument: $1"
-    exit 2
-  fi
-  shift
-done
-
-if [ -z "$CIVICRM_ROOT" -o ! -d "$CIVICRM_ROOT" -o -z "$UPSTREAM_GIT_BASE_URL" -o -z "$CIVICRM_CMS" ]; then
-  echo "Convert a directory into a set of CiviCRM git clones"
-  echo "usage: $0 <Drupal|Drupal6|Joomla|WordPress|all> <existing-civicrm-root> [--fork <base-url>] [--upstream <base-url>] [--l10n] [--hooks] [--branch <branch>]"
-  echo "  <cms-name>: one of: Drupal|Drupal6|Joomla|WordPress|all"
-  echo "  <git-base-url>: a base URL shared by the desiried git repos (e.g. git://github.com/civicrm)"
-  echo "  <existing-civicrm-root>: the main directory containing CiviCRM"
-  echo "  --upstream <base-url>: specify the base URL for upstream repositories"
-  echo "  --fork <base-url>: specify the base URL for your personal fork repositories"
-  echo "  --l10n: optionally fetch localization data"
-  echo "  --hooks: optionally install recommended git hooks; the hooks are mostly"
-  echo "           tested with git CLI under Linux and OSX; they haven't been"
-  echo "           tested with git GUIs or Windows"
-  echo "  --branch <branch>: specy the base branch name to checkout (ex: 'master', '4.4')"
-  echo "           For some repos, this name is adapted (ex: Drupal's '7.x-master' or '6.x-master'"
-  echo "  --skip-gencode: optionally disable gencode execution"
-  echo ""
-  echo "Note: If pointing to a pre-existing directory, your local changes may be replaced by"
-  echo "the pristine code from git. If you've made changes, then make sure there's a backup!"
-  echo ""
-  echo "example: $0 Drupal /var/www/drupal7/sites/all/modules/civicrm"
-  echo "  (checkout core code plus Drupal 7.x integration code)"
-  echo ""
-  echo "example: $0 Drupal6 /var/www/drupal6/sites/all/modules/civicrm"
-  echo "  (checkout core code plus Drupal 6.x integration code)"
-  echo ""
-  echo "example: $0 all ~/src/civicrm --upstream git@github.com:civicrm --l10n"
-  echo "  (checkout core code plus Drupal 7.x, Joomla, and WordPress integration code and l10n using SSH)"
-  exit 1
-fi
-
-###########################################
-#### Main: Update git repo metadata ####
-check_dep
-
-## config_repo <repo-name>         <local-path>                <default-branch>      <git-scripts-path>
-config_repo     civicrm-core       "$CIVICRM_ROOT"            "$CIVICRM_BRANCH"      "../tools/scripts/git"
-config_repo     civicrm-packages   "$CIVICRM_ROOT/packages"   "$CIVICRM_BRANCH"      "../../tools/scripts/git"
-case "$CIVICRM_CMS" in
-  Drupal)
-    config_repo civicrm-drupal     "$CIVICRM_ROOT/drupal"     "7.x-$CIVICRM_BRANCH"  "../../tools/scripts/git"
-    ;;
-  Drupal6)
-    config_repo civicrm-drupal     "$CIVICRM_ROOT/drupal"     "6.x-$CIVICRM_BRANCH"  "../../tools/scripts/git"
-    ;;
-  Joomla)
-    config_repo civicrm-joomla     "$CIVICRM_ROOT/joomla"     "$CIVICRM_BRANCH"      "../../tools/scripts/git"
-    ;;
-  WordPress)
-    config_repo civicrm-wordpress  "$CIVICRM_ROOT/WordPress"  "$CIVICRM_BRANCH"      "../../tools/scripts/git"
-    ;;
-  all)
-    config_repo civicrm-drupal     "$CIVICRM_ROOT/drupal"     "7.x-$CIVICRM_BRANCH"  "../../tools/scripts/git"
-    config_repo civicrm-joomla     "$CIVICRM_ROOT/joomla"     "$CIVICRM_BRANCH"      "../../tools/scripts/git"
-    config_repo civicrm-wordpress  "$CIVICRM_ROOT/WordPress"  "$CIVICRM_BRANCH"      "../../tools/scripts/git"
-    ;;
-  none)
-    ;;
-  *)
-    echo "Unrecognized CMS: $CIVICRM_CMS"
-esac
-
-if [ "$CIVICRM_L10N" == "--l10n" ]; then
-  do_targzify "https://download.civicrm.org/civicrm-l10n-core/archives/civicrm-l10n-daily.tar.gz" "civicrm-l10n-daily.tar.gz" "$CIVICRM_ROOT/l10n"
-fi
-
-if [ -f "$CIVICRM_ROOT/composer.json" ]; then
-  ## Civi v4.6+
-  do_setupconf "$CIVICRM_ROOT"
-elif [ -z "$SKIP_GENCODE" ]; then
-  do_gencode "$CIVICRM_ROOT"
-fi
index 11197298c9e300900dbcac0ad1446c5cb8607ffc..84470d5c34e338c1f8584a29550dbaae98c1d1ed 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 function run() {
   session_start();
index 7eadd53e7427eb05378e86345fcfd6639036f14c..d8dd24376ae1343bee1ab98223d5672c5349a900 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 function run() {
   session_start();
index ed01236d90dcfadef0da42d849bf29fb5906f118..4505eadb79bb4793047181add8ee2741b4646809 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 function run() {
   session_start();
index e882ec4f060c3ba54eac6fc9746953b0becd512b..75bfe307f63e39d76798a3e158479c17972d0076 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 function run() {
   session_start();
index c09297b21d313f18cd919e6697d23f3bafcf4b1b..6a94275f05c0d3f063367838a57821ac980ada1d 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 function run() {
   session_start();
index 8eb4a74b0c13408e4ed4fbfe3515ebe336b0f5cc..63e6fb2c2479d790358054b991bc221471d1d404 100644 (file)
@@ -26,7 +26,7 @@
 {capture assign=docLink}{docURL page="CiviMail Mailer Settings" text="CiviMail Mailer Settings and Optimization" resource="wiki"}{/capture}
 <div class="crm-block crm-form-block crm-mail-form-block">
 <div id="help">
-    {ts 1=$docLink}These settings are used to configure mailer properties for the optional CiviMail component and may allow you to significantly optimize performance. Please read the %1 documentation, and make sure you understand it before modifying default values. (These settings are NOT used for the built-in 'Send Email to Contacts' feature).{/ts}
+    {ts 1=$docLink}These settings are used to configure mailer properties for the optional CiviMail component and may allow you to significantly optimize performance. Please read the %1 documentation, and make sure you understand it before modifying default values. (These settings are NOT used for the built-in 'Email - send now' feature).{/ts}
 </div>
 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
       <table class="form-layout-compressed">
index 1c8499dc466af7cc38a7bf651254ec3e96256c02..109d3d442e1686d8cb51232a78e08187e13a6b33 100644 (file)
           entity: entity,
           select: {
             multiple: multiSelect,
-            minimumInputLength: _.includes(OPEN_IMMEDIATELY, entity) ? 0 : 1
+            minimumInputLength: _.includes(OPEN_IMMEDIATELY, entity) ? 0 : 1,
+            // If user types a numeric id, allow it as a choice
+            createSearchChoice: function(input) {
+              var match = /[1-9][0-9]*/.exec(input);
+              if (match && match[0] === input) {
+                return {id: input, label: input};
+              }
+            }
           }
         });
       }
index 417cecfcff4373625ac63ae125f98352e8c020f2..68652ea6e611188bc1349d47327cc637d2d2f9be 100644 (file)
 
 <tr id='case_search_form'>
   <td colspan="2" class="crm-case-common-form-block-case_type" width="25%">
-    <label>{ts}Case Type{/ts}</label><br />
-    <div class="listing-box">
-      {foreach from=$form.case_type_id item="case_type_id_val"}
-        <div class="{cycle values='odd-row,even-row'}">
-          {$case_type_id_val.html}
-        </div>
-      {/foreach}
-    </div><br />
+     <label>{$form.case_type_id.label}</label> <br />
+      {$form.case_type_id.html}
   </td>
 
   <td class="crm-case-common-form-block-case_status_id" width="25%">
-    <label>{ts}Status{/ts}</label><br />
-    <div class="listing-box">
-      {foreach from=$form.case_status_id item="case_status_id_val"}
-        <div class="{cycle values='odd-row,even-row'}">
-          {$case_status_id_val.html}
-        </div>
-      {/foreach}
-    </div>
+      <label>{$form.case_status_id.label}</label> <br />
+      {$form.case_status_id.html}
     {if $accessAllCases}
       <br />
       {$form.case_owner.html}
index ee1ee83e5e5968471580e2f2e384ac5d90634f55..b76905124d23ac232b9736b66288d37887a77234 100644 (file)
@@ -60,7 +60,7 @@
     </table>
 
     <h3>{ts}Default Organization Address{/ts}</h3>
-        <div class="description">{ts 1=&#123;domain.address&#125;}CiviMail mailings must include the sending organization's address. This is done by putting the %1 token in either the body or footer of the mailing. This token may also be used in regular 'Send Email to Contacts' messages and in other Message Templates. The token is replaced by the address entered below when the message is sent.{/ts}</div>
+        <div class="description">{ts 1=&#123;domain.address&#125;}CiviMail mailings must include the sending organization's address. This is done by putting the %1 token in either the body or footer of the mailing. This token may also be used in regular 'Email - send now' messages and in other Message Templates. The token is replaced by the address entered below when the message is sent.{/ts}</div>
         {include file="CRM/Contact/Form/Edit/Address.tpl"}
     <h3>{ts}Organization Contact Information{/ts}</h3>
         <div class="description">{ts}You can also include general email and/or phone contact information in mailings.{/ts} {help id="additional-contact"}</div>
index 53dbde367c7989462ae1cac74165bddd5f5a40b5..6bec466fe3caaf531ff1ec9737349531707dcbce 100644 (file)
@@ -35,7 +35,7 @@
 {ts}Smart Group{/ts}
 {/htxt}
 {htxt id='id-advanced-smart'}
-    <p>{ts}If you've changed search criteria for this 'smart group' and want to save your changes, select <strong>Update Smart Group</strong> from the '- more actions -' drop-down menu, and then click Go.{/ts}</p>
+    <p>{ts}If you've changed search criteria for this 'smart group' and want to save your changes, select <strong>Smart group - update</strong> from the '- more actions -' drop-down menu, and then click Go.{/ts}</p>
 {/htxt}
 
 {htxt id="id-privacy-title"}
index 456a2216891c0d389471ef0667db859dedee852b..d74287631ab205bc306a7ab37ebf62a588da660c 100644 (file)
@@ -1,14 +1,14 @@
 CRM.$(function($) {
   //do not copy & paste this - find a way to generalise it
   'use strict';
-  // NOTE: Might be safer to say $('[name=_qf_Email_upload]')
-   $('.crm-form-submit').not('.cancel').on("click", function() {
-     $('.crm-form-submit').not('.cancel').attr({value: ts('Processing')});
+  // NOTE: Target only fullscreen forms (using #crm-container as context) because popups already have this feature
+   $('.crm-form-submit', '#crm-container').not('.cancel').on("click", function() {
+     $('.crm-form-submit', '#crm-container').not('.cancel').attr({value: ts('Processing')});
      // CRM-13449 : setting a 0 ms timeout is needed
      // for some browsers like chrome. Used for purpose of
      // submit the form and stop accidental multiple clicks
      setTimeout(function(){
-       $('.crm-form-submit').not('.cancel').prop({disabled: true});
+       $('.crm-form-submit', '#crm-container').not('.cancel').prop({disabled: true});
      }, 0);
    });
 });
index 6a777f5b0521f9717484facc1f3e26173ae08c00..9ed0b08e32a22625347bee34f72adf40b0e876bd 100644 (file)
 *}
 {if $action eq 2 || $action eq 16}
 <div class="form-item">
-  <table class='pagerDisplay'>
+  <div class="crm-accordion-wrapper crm-search_filters-accordion">
+    <div class="crm-accordion-header">
+    {ts}Filter Contacts{/ts}</a>
+    </div><!-- /.crm-accordion-header -->
+    <div class="crm-accordion-body">
+      <table class="no-border form-layout-compressed" id="searchOptions" style="width:100%;">
+        <tr>
+          <td class="crm-contact-form-block-contact1">
+            <label for="contact1">{ts}Contact 1{/ts}</label><br />
+            <input type="text" placeholder="Search Contact1" search-column="2" />
+          </td>
+          <td class="crm-contact-form-block-contact2">
+            <label for="contact2">{ts}Contact 2{/ts}</label><br />
+            <input type="text" placeholder="Search Contact2" search-column="4" />
+          </td>
+          <td class="crm-contact-form-block-email1">
+            <label for="email1">{ts}Email 1{/ts}</label><br />
+            <input type="text" placeholder="Search Email1" search-column="5" />
+          </td>
+          <td class="crm-contact-form-block-email2">
+            <label for="email2">{ts}Email 2{/ts}</label><br />
+            <input type="text" placeholder="Search Email2" search-column="6" />
+          </td>
+        </tr>
+        <tr>
+          <td class="crm-contact-form-block-street-address1">
+            <label for="street-adddress1">{ts}Street Address 1{/ts}</label><br />
+            <input type="text" placeholder="Search Street Address1" search-column="7" />
+          </td>
+          <td class="crm-contact-form-block-street-address2">
+            <label for="street-adddress2">{ts}Street Address 2{/ts}</label><br />
+            <input type="text" placeholder="Search Street Address2" search-column="8" />
+          </td>
+          <td class="crm-contact-form-block-postcode1">
+            <label for="postcode1">{ts}Postcode 1{/ts}</label><br />
+            <input type="text" placeholder="Search Postcode1" search-column="9" />
+          </td>
+          <td class="crm-contact-form-block-postcode2">
+            <label for="postcode2">{ts}Postcode 2{/ts}</label><br />
+            <input type="text" placeholder="Search Postcode2" search-column="10" />
+          </td>
+        </tr>
+      </table>
+    </div><!-- /.crm-accordion-body -->
+  </div><!-- /.crm-accordion-wrapper -->
+  <div>
+    Show / Hide columns:
+    <input type='checkbox' id ='steet-address' class='toggle-vis' data-column-main="7" data-column-dupe="8" >  
+        <label for="steet-address">{ts}Street Address{/ts}&nbsp;</label>
+    <input type='checkbox' id ='post-code' class='toggle-vis' data-column-main="9" data-column-dupe="10" >  
+        <label for="post-code">{ts}Post Code{/ts}&nbsp;</label>
+    <input type='checkbox' id ='conflicts' class='toggle-vis' data-column-main="11"  >  
+        <label for="conflicts">{ts}Conflicts{/ts}&nbsp; </label>
+    <input type='checkbox' id ='threshold' class='toggle-vis' data-column-main="12"  >  
+        <label for="threshold">{ts}Threshold{/ts}&nbsp;</label>
+  </div><br/>
+  <span id="dupePairs_length_selection">
+    <input type='checkbox' id ='crm-dedupe-display-selection' name="display-selection">
+    <label for="display-selection">{ts}Within Selections{/ts}&nbsp;</label>  
+  </span>
+
+  <table id="dupePairs"
+    class="nestedActivitySelector crm-ajax-table"
+    cellspacing="0"
+    width="100%"
+    data-page-length="10",
+    data-searching='true',
+    data-dom='flrtip',
+    data-order='[]',
+    data-column-defs='{literal}[{"targets": [0,1,3,13], "orderable":false}, {"targets": [7,8,9,10,11,12], "visible":false}]{/literal}'>
     <thead>
-    <tr class="columnheader"><th id="nosort">{ts}Contact{/ts} 1</th><th id="nosort">{ts}Contact{/ts} 2 ({ts}Duplicate{/ts})</th><th id="nosort">{ts}Threshold{/ts}</th><th id="nosort">&nbsp;</th></tr>
+      <tr class="columnheader"> 
+        <th data-data="is_selected_input" class="crm-dedupe-selection"><input type="checkbox" value="0" name="pnid_all" class="crm-dedupe-select-all"></th>
+        <th data-data="src_image"    class="crm-empty">&nbsp;</th>
+        <th data-data="src"          class="crm-contact">{ts}Contact{/ts} 1</th>
+        <th data-data="dst_image"    class="crm-empty">&nbsp;</th>
+        <th data-data="dst"          class="crm-contact-duplicate">{ts}Contact{/ts} 2 ({ts}Duplicate{/ts})</th>
+        <th data-data="src_email"    class="crm-contact">{ts}Email{/ts} 1</th>
+        <th data-data="dst_email"    class="crm-contact-duplicate">{ts}Email{/ts} 2 ({ts}Duplicate{/ts})</th>
+        <th data-data="src_street"   class="crm-contact">{ts}Street Address{/ts} 1</th>
+        <th data-data="dst_street"   class="crm-contact-duplicate">{ts}Street Address{/ts} 2 ({ts}Duplicate{/ts})</th>
+        <th data-data="src_postcode" class="crm-contact">{ts}Postcode{/ts} 1</th>
+        <th data-data="dst_postcode" class="crm-contact-duplicate">{ts}Postcode{/ts} 2 ({ts}Duplicate{/ts})</th>
+        <th data-data="conflicts"    class="crm-contact-conflicts">{ts}Conflicts{/ts}</th>
+        <th data-data="weight"       class="crm-threshold">{ts}Threshold{/ts}</th>
+        <th data-data="actions"      class="crm-empty">&nbsp;</th>
+      </tr>
     </thead>
+    <tbody>
+    </tbody>
   </table>
-  {include file="CRM/common/jsortable.tpl" sourceUrl=$sourceUrl useAjax=1 }
   {if $cid}
     <table style="width: 45%; float: left; margin: 10px;">
       <tr class="columnheader"><th colspan="2">{ts 1=$main_contacts[$cid]}Merge %1 with{/ts}</th></tr>
 
 {if $context eq 'search'}
    {crmButton href=$backURL icon="close"}{ts}Done{/ts}{/crmButton}
+{elseif $context eq 'conflicts'}
+   {if call_user_func(array('CRM_Core_Permission','check'), 'force merge duplicate contacts')}
+     {if $gid}
+       {capture assign=backURL}{crmURL p="civicrm/contact/dedupemerge" q="reset=1&rgid=`$rgid`&gid=`$gid`&action=map&mode=aggressive" a=1}{/capture}
+     {else}
+       {capture assign=backURL}{crmURL p="civicrm/contact/dedupemerge" q="reset=1&rgid=`$rgid`&action=map&mode=aggressive" a=1}{/capture}
+     {/if}
+     <a href="{$backURL}" title="{ts}Force Merge Selected Duplicates{/ts}" onclick="return confirm('{ts escape="js"}This will run the batch merge process on the selected duplicates. The operation will run in force merge mode - all selected duplicates will be merged into main contacts even in case of any conflicts. Click OK to proceed if you are sure you wish to run this operation.{/ts}');" class="button"><span><div class="icon ui-icon-script"></div>{ts}Force Merge Selected Duplicates{/ts}</span></a>
+
+     {if $gid}
+       {capture assign=backURL}{crmURL p="civicrm/contact/dedupemerge" q="reset=1&rgid=`$rgid`&gid=`$gid`&action=map" a=1}{/capture}
+     {else}
+       {capture assign=backURL}{crmURL p="civicrm/contact/dedupemerge" q="reset=1&rgid=`$rgid`&action=map" a=1}{/capture}
+     {/if}
+     <a href="{$backURL}" title="{ts}Safe Merge Selected Duplicates{/ts}" onclick="return confirm('{ts escape="js"}This will run the batch merge process on the selected duplicates. The operation will run in safe mode - only records with no direct data conflicts will be merged. Click OK to proceed if you are sure you wish to run this operation.{/ts}');" class="button"><span><div class="icon ui-icon-script"></div>{ts}Safe Merge Selected Duplicates{/ts}</span></a>
+   {/if}
+
+   {if $gid}
+      {capture assign=backURL}{crmURL p="civicrm/contact/dedupefind" q="reset=1&action=update&rgid=`$rgid`&gid=`$gid`" a=1}{/capture}
+   {else}
+      {capture assign=backURL}{crmURL p="civicrm/contact/dedupefind" q="reset=1&action=update&rgid=`$rgid`" a=1}{/capture}
+   {/if}
+   <a href="{$backURL}" title="{ts}List All Duplicates{/ts}" class="button"><span><span class="icon ui-icon-refresh"></span> {ts}List All Duplicates{/ts}</span></a>
 {else}
    {if $gid}
       {capture assign=backURL}{crmURL p="civicrm/contact/dedupefind" q="reset=1&rgid=`$rgid`&gid=`$gid`&action=renew" a=1}{/capture}
    </a>
 
    {if $gid}
-      {capture assign=backURL}{crmURL p="civicrm/contact/dedupefind" q="reset=1&rgid=`$rgid`&gid=`$gid`&action=map" a=1}{/capture}
+      {capture assign=backURL}{crmURL p="civicrm/contact/dedupemerge" q="reset=1&rgid=`$rgid`&gid=`$gid`&action=map" a=1}{/capture}
    {else}
-      {capture assign=backURL}{crmURL p="civicrm/contact/dedupefind" q="reset=1&rgid=`$rgid`&action=map" a=1}{/capture}
+      {capture assign=backURL}{crmURL p="civicrm/contact/dedupemerge" q="reset=1&rgid=`$rgid`&action=map" a=1}{/capture}
    {/if}
-   <a href="{$backURL}" title="{ts}Batch Merge Duplicate Contacts{/ts}" onclick="return confirm('{ts escape="js"}This will run the batch merge process on the listed duplicates. The operation will run in safe mode - only records with no direct data conflicts will be merged. Click OK to proceed if you are sure you wish to run this operation.{/ts}');" class="button">
-     <span><div class="icon ui-icon-script"></div> {ts}Batch Merge Duplicates{/ts}</span>
-   </a>
+   <a href="{$backURL}" title="{ts}Batch Merge Duplicate Contacts{/ts}" onclick="return confirm('{ts escape="js"}This will run the batch merge process on the selected duplicates. The operation will run in safe mode - only records with no direct data conflicts will be merged. Click OK to proceed if you are sure you wish to run this operation.{/ts}');" class="button"><span><div class="icon ui-icon-script"></div>{ts}Batch Merge Selected Duplicates{/ts}</span></a>
+
+   {if $gid}
+      {capture assign=backURL}{crmURL p="civicrm/contact/dedupemerge" q="reset=1&rgid=`$rgid`&gid=`$gid`" a=1}{/capture}
+   {else}
+      {capture assign=backURL}{crmURL p="civicrm/contact/dedupemerge" q="reset=1&rgid=`$rgid`" a=1}{/capture}
+   {/if}
+   <a href="{$backURL}" title="{ts}Batch Merge Duplicate Contacts{/ts}" onclick="return confirm('{ts escape="js"}This will run the batch merge process on the listed duplicates. The operation will run in safe mode - only records with no direct data conflicts will be merged. Click OK to proceed if you are sure you wish to run this operation.{/ts}');" class="button"><span><div class="icon ui-icon-script"></div>{ts}Batch Merge All Duplicates{/ts}</span></a>
+
+   <a href='#' title="{ts}Flip Selected Duplicates{/ts}" class="crm-dedupe-flip-selections button"><span><span class="icon ui-icon-refresh"></span> {ts}Flip Selected Duplicates{/ts}</span></a>
 
    {capture assign=backURL}{crmURL p="civicrm/contact/deduperules" q="reset=1" a=1}{/capture}
    <a href="{$backURL}" class="button crm-button-type-cancel">
 {include file='CRM/common/dedupe.tpl'}
 {literal}
 <script type="text/javascript">
-var oTable = null;
+  (function($) {
+    CRM.$('table#dupePairs').data({
+      "ajax": {
+        "url": {/literal}'{$sourceUrl}'{literal}
+      },
+      rowCallback: function (row, data) {
+        // Set the checked state of the checkbox in the table
+        $('input.crm-dedupe-select', row).prop('checked', data.is_selected == 1);
+        if (data.is_selected == 1) {
+          $(row).toggleClass('crm-row-selected');
+        }
+        // for action column at the last, set nowrap
+        $('td:last', row).attr('nowrap','nowrap');
+        // for conflcts column
+        var col = CRM.$('table#dupePairs thead th.crm-contact-conflicts').index();
+        $('td:eq(' + col + ')', row).attr('nowrap','nowrap');
+      }
+    });
+    $(function($) {
+      $('.button').click(function() {
+        // no unsaved changes confirmation dialogs
+        $('[data-warn-changes=true]').attr('data-warn-changes', 'false');
+      });
+
+      var sourceUrl = {/literal}'{$sourceUrl}'{literal};
+      var context   = {/literal}'{$context}'{literal};
+
+      // redraw datatable if searching within selected records
+      $('#crm-dedupe-display-selection').on('click', function(){
+        reloadUrl = sourceUrl;
+        if($(this).prop('checked')){
+          reloadUrl = sourceUrl+'&selected=1';
+        }
+        CRM.$('table#dupePairs').DataTable().ajax.url(reloadUrl).draw();
+      });
+    
+      $('#dupePairs_length_selection').appendTo('#dupePairs_length');
+
+      // apply selected class on click of a row
+      $('#dupePairs tbody').on('click', 'tr', function(e) {
+        $(this).toggleClass('crm-row-selected');
+        $('input.crm-dedupe-select', this).prop('checked', $(this).hasClass('crm-row-selected'));
+        var ele = $('input.crm-dedupe-select', this);
+        toggleDedupeSelect(ele, 0);
+      });
+
+      // when select-all checkbox is checked
+      $('#dupePairs thead tr .crm-dedupe-selection').on('click', function() {
+        var checked = $('.crm-dedupe-select-all').prop('checked');
+        if (checked) {
+          $("#dupePairs tbody tr input[type='checkbox']").prop('checked', true);
+          $("#dupePairs tbody tr").addClass('crm-row-selected');
+        }
+        else{
+          $("#dupePairs tbody tr input[type='checkbox']").prop('checked', false);
+          $("#dupePairs tbody tr").removeClass('crm-row-selected');
+        }
+        var ele = $('#dupePairs tbody tr');
+        toggleDedupeSelect(ele, 1);
+      });
+
+      // inline search boxes placed in tfoot
+      $('#dupePairsColFilters thead th').each( function () {
+        var title = $('#dupePairs thead th').eq($(this).index()).text();
+        if (title.length > 1) {
+          $(this).html( '<input type="text" placeholder="Search '+title+'" />' );
+        }
+      });
+
+      // get dataTable
+      var table = CRM.$('table#dupePairs').DataTable();
+
+      // apply the search
+      $('#searchOptions input').on( 'keyup change', function () {
+        table
+          .column($(this).attr('search-column'))
+          .search(this.value)
+          .draw();
+      });
+
+      // show / hide columns
+      $('input.toggle-vis').on('click', function (e) {
+        var column = table.column( $(this).attr('data-column-main') );
+        column.visible( ! column.visible() );
+  
+        // nowrap to conflicts column is applied only during initial rendering
+        // for show / hide clicks we need to set it explicitly
+        var col = CRM.$('table#dupePairs thead th.crm-contact-conflicts').index() + 1;
+        if (col > 0) {
+          CRM.$('table#dupePairs tbody tr td:nth-child(' + col + ')').attr('nowrap','nowrap');
+        }
+
+        if ($(this).attr('data-column-dupe')) {
+          column = table.column( $(this).attr('data-column-dupe') );
+          column.visible( ! column.visible() );
+        }
+      });
+      
+      // keep the conflicts checkbox checked when context is "conflicts"
+      if(context == 'conflicts') {
+        $('#conflicts').attr('checked', true);  
+        var column = table.column( $('#conflicts').attr('data-column-main') );
+        column.visible( ! column.visible() );
+      }
+  
+      // on click of flip link of a row
+      $('#dupePairs tbody').on('click', 'tr .crm-dedupe-flip', function(e) {
+        e.stopPropagation();
+        var $el   = $(this);
+        var $elTr = $(this).closest('tr');
+        var postUrl = {/literal}"{crmURL p='civicrm/ajax/flipDupePairs' h=0 q='snippet=4'}"{literal};
+        var request = $.post(postUrl, {pnid : $el.data('pnid')});
+        request.done(function(dt) {
+          var mapper = {1:3, 2:4, 5:6, 7:8, 9:10}
+          var idx = table.row($elTr).index();
+          $.each(mapper, function(key, val) {
+            var v1  = table.cell(idx, key).data();
+            var v2  = table.cell(idx, val).data();
+            table.cell(idx, key).data(v2);
+            table.cell(idx, val).data(v1);
+          });
+          // keep the checkbox checked if needed
+          $('input.crm-dedupe-select', $elTr).prop('checked', $elTr.hasClass('crm-row-selected'));
+        });
+      });
+  
+      $(".crm-dedupe-flip-selections").on('click', function(e) {
+        var ids = [];
+        $('.crm-row-selected').each(function() {
+          var ele = CRM.$('input.crm-dedupe-select', this);
+          ids.push(CRM.$(ele).attr('name').substr(5));
+        });
+        if (ids.length > 0) {
+          var dataUrl = {/literal}"{crmURL p='civicrm/ajax/flipDupePairs' h=0 q='snippet=4'}"{literal};
+          CRM.$.post(dataUrl, {pnid: ids}, function (response) {
+            var mapper = {1:3, 2:4, 5:6, 7:8, 9:10}
+            $('.crm-row-selected').each(function() {
+              var idx = table.row(this).index();
+              $.each(mapper, function(key, val) {
+                var v1  = table.cell(idx, key).data();
+                var v2  = table.cell(idx, val).data();
+                table.cell(idx, key).data(v2);
+                table.cell(idx, val).data(v1);
+              });
+              // keep the checkbox checked if needed
+              $('input.crm-dedupe-select', this).prop('checked', $(this).hasClass('crm-row-selected'));
+            });
+          }, 'json');
+        }
+      });
+    });
+  })(CRM.$);
+
+  function toggleDedupeSelect(element, isMultiple) {
+    if (!isMultiple) {
+      var is_selected = CRM.$(element).prop('checked') ? 1: 0;
+      var id = CRM.$(element).prop('name').substr(5);
+    }
+    else {
+      var id = [];
+      CRM.$(element).each(function() {
+        var sth = CRM.$('input.crm-dedupe-select', this);
+        id.push(CRM.$(sth).prop('name').substr(5));
+      });
+      var is_selected = CRM.$('.crm-dedupe-select-all').prop('checked') ? 1 : 0;
+    }
+  
+    var dataUrl = {/literal}"{crmURL p='civicrm/ajax/toggleDedupeSelect' h=0 q='snippet=4'}"{literal};
+    var rgid = {/literal}"{$rgid}"{literal};
+    var gid = {/literal}"{$gid}"{literal};
+  
+    rgid = rgid.length > 0 ? rgid : 0;
+    gid  = gid.length > 0 ? gid : 0;
+    
+    CRM.$.post(dataUrl, {pnid: id, rgid: rgid, gid: gid, is_selected: is_selected}, function (data) {
+      // nothing to do for now
+    }, 'json');
+  }
 </script>
 {/literal}
similarity index 55%
rename from bin/deprecated/action.cronjob.php
rename to templates/CRM/Contact/Page/DedupeMerge.tpl
index 07262239949ac209ae8389cc5589d01f81aff749..a270e4f2d082b366bc92668829cd53deb9b609d1 100644 (file)
@@ -1,9 +1,8 @@
-<?php
-/*
+{*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.7                                               |
+ | CiviCRM version 4.                                               |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
- */
-
-
-/*
- */
-
-/**
- * Class CRM_Cron_Action
- */
-class CRM_Cron_Action {
-  /**
-   */
-  public function __construct() {
-    // you can run this program either from an apache command, or from the cli
-    if (php_sapi_name() == "cli") {
-      require_once "cli.php";
-      $cli = new civicrm_cli();
-      //if it doesn't die, it's authenticated
-    }
-    else {
-      //from the webserver
-      $this->initialize();
-
-      $config = CRM_Core_Config::singleton();
-
-      // this does not return on failure
-      CRM_Utils_System::authenticateScript(TRUE);
-
-      //log the execution time of script
-      CRM_Core_Error::debug_log_message('action.cronjob.php');
-    }
-  }
-
-  public function initialize() {
-    require_once '../civicrm.config.php';
-    require_once 'CRM/Core/Config.php';
-
-    $config = CRM_Core_Config::singleton();
-  }
-
-  /**
-   * @param null $now
-   */
-  public function run($now = NULL) {
-    require_once 'CRM/Core/BAO/ActionSchedule.php';
-    CRM_Core_BAO_ActionSchedule::processQueue($now);
-  }
-
-}
-
-$cron = new CRM_Cron_Action();
-$cron->run();
+*}
index a1f4d4f99f43c0095cc8cf48bac810cd7016e206..a6810dd89aa5127b5fe0782d4ed240304e2473b5 100644 (file)
     }
 
     function buildRecurBlock( processorId ) {
-
       if ( !processorId ) processorId = cj( "#payment_processor_id" ).val( );
       var recurPaymentProIds = {/literal}'{$recurringPaymentProcessorIds}'{literal};
-      var funName = 'hide';
-      if ( recurPaymentProIds.indexOf( processorId ) != -1 ) funName = 'show';
+      var funName = ( cj.inArray(processorId, recurPaymentProIds.split(',')) > -1 ) ? 'show' : 'hide';
 
       var priceSet = cj("#price_set_id");
       if ( priceSet && priceSet.val( ) ) {
index ac4463254da1c7c9ebea2ab72ccaa573a09b6a55..1074e2e1a71f9f0f59f67742f33f8ee07c09e718 100644 (file)
         background-color: {/literal}{$form.color_main_bg.value}{literal};
     } /* title */
     .crm-contribute-widget .crm-amount-raised { color:#000; }
-    .crm-contribute-widget .crm-amount-bar  /* progress bar */
-        background-color:{/literal}{$form.color_bar.value}{literal};
-        border-color:#CECECE;
+    .crm-contribute-widget .crm-amount-fill {
+      background-color:{/literal}{$form.color_bar.value}{literal};
     }
-    .crm-contribute-widget .crm-amount-fill { background-color:#2786C2; }
     .crm-contribute-widget a.crm-contribute-button { /* button color */
         background-color:{/literal}{$form.color_button.value}{literal};
     }
index 24a1d4649338b390480a784366ebf592a988cd60..9797d57f952188041dff05a8986b7bc3efcce55b 100644 (file)
       {/crmRegion}
       <div class="crm-section billing_mode-section {$paymentTypeName}_info-section">
         {foreach from=$paymentFields item=paymentField}
+          {assign var='name' value=$form.$paymentField.name}
           <div class="crm-section {$form.$paymentField.name}-section">
-            <div class="label">{$form.$paymentField.label}</div>
+            <div class="label">{$form.$paymentField.label}
+              {if $requiredPaymentFields.$name}<span class="crm-marker" title="{ts}This field is required.{/ts}">*</span>{/if}
+            </div>
             <div class="content">{$form.$paymentField.html}
               {if $paymentField == 'cvv2'}{* @todo move to form assignment*}
                 <span class="cvv2-icon" title="{ts}Usually the last 3-4 digits in the signature area on the back of the card.{/ts}"> </span>
       <legend>{ts}Billing Name and Address{/ts}</legend>
       <div class="crm-section billing_name_address-section">
         {foreach from=$billingDetailsFields item=billingField}
+          {assign var='name' value=$form.$billingField.name}
           <div class="crm-section {$form.$billingField.name}-section">
-            <div class="label">{$form.$billingField.label}</div>
+            <div class="label">{$form.$billingField.label}
+              {if $requiredPaymentFields.$name}<span class="crm-marker" title="{ts}This field is required.{/ts}">*</span>{/if}
+            </div>
             {if $form.$billingField.type == 'text'}
               <div class="content">{$form.$billingField.html}</div>
             {else}
         }
       }
       if (checked) {
-        $('#billingcheckbox').prop('checked', true);
+        $('#billingcheckbox').prop('checked', true).data('crm-initial-value', true);
         if (!CRM.billing || CRM.billing.billingProfileIsHideable) {
           $('.billing_name_address-group').hide();
         }
index 36c4d19f2adb9939c436ea8f4e7397529e380e17..bfb72e91763725d6663549c47884d058afd81d22 100644 (file)
@@ -1,4 +1,4 @@
-{*
+{*
  +--------------------------------------------------------------------+
  | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
@@ -85,7 +85,7 @@
   {ts}Require Approval{/ts}
 {/htxt}
 {htxt id="id-requires_approval"}
-{ts}Check this box to require administrative approval for all the participants who self-register, prior to being able to complete the registration process. Participants will be placed in 'Awaiting Approval' status. You can review and approve participants from 'Find Participants' - select the 'Change Participant Status' task. Approved participants will move to 'Pending from approval' status, and will be sent an email with a link to complete their registration (including paying event fees - if any). {/ts}
+{ts}Check this box to require administrative approval for all the participants who self-register, prior to being able to complete the registration process. Participants will be placed in 'Awaiting Approval' status. You can review and approve participants from 'Find Participants' - select the 'Participant status - change' task. Approved participants will move to 'Pending from approval' status, and will be sent an email with a link to complete their registration (including paying event fees - if any). {/ts}
 {/htxt}
 
 {htxt id="id-expiration_time-title"}
index 4fa3a7c712c02a2333cf459d01f79c353c958826..969038b3c6235117217d30f462f046f8de724541 100644 (file)
                     {foreach from=$eventSummary.tab key=k item=v}
                       {assign var="fld" value=$v.field}
                       {if NOT $values.$fld}{assign var="status" value="disabled"}{else}{assign var="status" value="enabled"}{/if}
-                      <li><a title="{$v.title}" class="action-item crm-hover-button no-popup {$status}"
-                             href="{crmURL p="`$v.url`" q="reset=1&action=update&id=`$id`"}">{$v.title}</a></li>
+                      {* Schedule Reminders requires a different query string. *}
+                      {if $v.url EQ 'civicrm/event/manage/reminder'}
+                        <li><a title="{$v.title}" class="action-item crm-hover-button no-popup {$status}"
+                            href="{crmURL p="`$v.url`" q="reset=1&action=browse&setTab=1&id=`$id`"}">{$v.title}</a></li>
+                      {else}
+                        <li><a title="{$v.title}" class="action-item crm-hover-button no-popup {$status}"
+                            href="{crmURL p="`$v.url`" q="reset=1&action=update&id=`$id`"}">{$v.title}</a></li>
+                      {/if}
                     {/foreach}
                   </ul>
                 </span>
index cb24ac6180159b8a0da94ee4464a609e1dc0bd66..a309a36c1bb8cf0c85a76c24720f33573a2cbde4 100644 (file)
@@ -65,3 +65,9 @@
     </table>
   </td>
 </tr>
+<tr>
+  <td>{* campaign in Advance search *}
+      {include file="CRM/Campaign/Form/addCampaignToComponent.tpl" campaignContext="componentSearch"
+       campaignTrClass='crmCampaign' campaignTdClass='crmCampaignContainer'}
+  </td>
+</tr>
index af9261a0962107f02dc84bfcf77ad26e38ae7101..10276baf815e372cf052895dc715c52227bae960 100644 (file)
         <td>{$report.event_totals.delivered} ({$report.event_totals.delivered_rate|string_format:"%0.2f"}%)</td>
         <td>{$report.event_totals.actionlinks.delivered}</td></tr>
   {if $report.mailing.open_tracking}
-    <tr><td class="label"><a href="{$report.event_totals.links.opened}">{ts}Tracked Opens{/ts}</a></td>
+    <tr><td class="label"><a href="{$report.event_totals.links.opened}&distinct=1">{ts}Unique Opens{/ts}</a></td>
         <td>{$report.event_totals.opened}</td>
         <td>{$report.event_totals.actionlinks.opened}</td></tr>
+    <tr><td class="label"><a href="{$report.event_totals.links.opened}">{ts}Total Opens{/ts}</a></td>
+        <td>{$report.event_totals.total_opened}</td>
+        <td>{$report.event_totals.actionlinks.opened}</td></tr>
   {/if}
   {if $report.mailing.url_tracking}
     <tr><td class="label"><a href="{$report.event_totals.links.clicks}">{ts}Click-throughs{/ts}</a></td>
index ee6109f2d5f7c2760f778164cd4f6d1a0205eedb..3704c9b79bb3ef7a357f7f0d9cf3d66d779e471f 100644 (file)
@@ -24,7 +24,7 @@
  +--------------------------------------------------------------------+
 *}
 {* Adds social networking buttons (Facebook like, Twitter tweet, Google +1, LinkedIn) to public pages (online contributions, event info) *}
-<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
+
 <div class="crm-section crm-socialnetwork help">
     <h3 class="nobackground">{ts}Help spread the word{/ts}</h3>
     <div class="description">
@@ -42,6 +42,7 @@
                 <img title="Facebook Like Button" src="{$config->userFrameworkResourceURL|replace:'https://':'http://'}/i/fblike.png" alt="Facebook Button" />
             </a>
         {else}
+            <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
             {*use advanced buttons for pages*}
             <div class="label">
                 <iframe allowtransparency="true" frameborder="0" scrolling="no"
index ee34619dd060e2f7207104fa46bc961ffc08b6a1..db86e0876cdd71c1019ace4e6b2e7f648f08149a 100644 (file)
           "bAutoWidth": false,
           "aoColumns": columns,
           "bSort": true,
+          "sDom": 'ti',
           "oLanguage":{
             "sEmptyTable": noRecordFoundMsg,
             "sZeroRecords": noRecordFoundMsg
index c1533a49fce3b6685f1f2764af071c8334666290..133af7e0275fdb0c238105334504e55df4ca5260 100644 (file)
@@ -84,6 +84,13 @@ class CRM_Contribute_Form_ContributionTest extends CiviUnitTestCase {
    */
   protected $paymentProcessor;
 
+  /**
+   * Payment processor ID.
+   *
+   * @var int
+   */
+  protected $paymentProcessorID;
+
   /**
    * Setup function.
    */
@@ -124,8 +131,9 @@ class CRM_Contribute_Form_ContributionTest extends CiviUnitTestCase {
     ));
 
     $this->products[] = $product1['values'][$product1['id']];
-    $this->paymentProcessor = $this->processorCreate();
-
+    $this->paymentProcessor = $this->dummyProcessorCreate();
+    $processor = $this->paymentProcessor->getPaymentProcessor();
+    $this->paymentProcessorID = $processor['id'];
   }
 
   /**
@@ -175,6 +183,114 @@ class CRM_Contribute_Form_ContributionTest extends CiviUnitTestCase {
     1);
   }
 
+  /**
+   * Test the submit function on the contribution page.
+   */
+  public function testSubmitCreditCardPayPal() {
+    $form = new CRM_Contribute_Form_Contribution();
+    $paymentProcessorID = $this->paymentProcessorCreate(array('is_test' => 0));
+    $form->_mode = 'Live';
+    try {
+      $form->testSubmit(array(
+        'total_amount' => 50,
+        'financial_type_id' => 1,
+        'receive_date' => '04/21/2015',
+        'receive_date_time' => '11:27PM',
+        'contact_id' => $this->_individualId,
+        'payment_instrument_id' => array_search('Credit Card', $this->paymentInstruments),
+        'contribution_status_id' => 1,
+        'credit_card_number' => 4444333322221111,
+        'cvv2' => 123,
+        'credit_card_exp_date' => array(
+          'M' => 9,
+          'Y' => 2025,
+        ),
+        'credit_card_type' => 'Visa',
+        'billing_first_name' => 'Junko',
+        'billing_middle_name' => '',
+        'billing_last_name' => 'Adams',
+        'billing_street_address-5' => '790L Lincoln St S',
+        'billing_city-5' => 'Maryknoll',
+        'billing_state_province_id-5' => 1031,
+        'billing_postal_code-5' => 10545,
+        'billing_country_id-5' => 1228,
+        'frequency_interval' => 1,
+        'frequency_unit' => 'month',
+        'installments' => '',
+        'hidden_AdditionalDetail' => 1,
+        'hidden_Premium' => 1,
+        'from_email_address' => '"civi45" <civi45@civicrm.com>',
+        'receipt_date' => '',
+        'receipt_date_time' => '',
+        'payment_processor_id' => $paymentProcessorID,
+        'currency' => 'USD',
+        'source' => '',
+      ), CRM_Core_Action::ADD);
+    }
+    catch (Civi\Payment\Exception\PaymentProcessorException $e) {
+      $this->assertEquals('10544: Transaction cannot be processed. Please use a different payment card.',
+        $e->getMessage());
+    }
+    $this->callAPISuccessGetCount('Contribution', array(
+      'contact_id' => $this->_individualId,
+      'contribution_status_id' => 'Pending',
+    ), 1);
+  }
+
+  /**
+   * Test the submit function on the contribution page.
+   */
+  public function testSubmitCreditCardFee() {
+    $form = new CRM_Contribute_Form_Contribution();
+    print_r($this->paymentProcessor);
+    $this->paymentProcessor->setDoDirectPaymentResult(array('is_error' => 0, 'trxn_id' => 'tx', 'fee_amount' => .08));
+    $form->_mode = 'Live';
+    $form->testSubmit(array(
+      'total_amount' => 50,
+      'financial_type_id' => 1,
+      'receive_date' => '04/21/2015',
+      'receive_date_time' => '11:27PM',
+      'contact_id' => $this->_individualId,
+      'payment_instrument_id' => array_search('Credit Card', $this->paymentInstruments),
+      'contribution_status_id' => 1,
+      'credit_card_number' => 4444333322221111,
+      'cvv2' => 123,
+      'credit_card_exp_date' => array(
+        'M' => 9,
+        'Y' => 2025,
+      ),
+      'credit_card_type' => 'Visa',
+      'billing_first_name' => 'Junko',
+      'billing_middle_name' => '',
+      'billing_last_name' => 'Adams',
+      'billing_street_address-5' => '790L Lincoln St S',
+      'billing_city-5' => 'Maryknoll',
+      'billing_state_province_id-5' => 1031,
+      'billing_postal_code-5' => 10545,
+      'billing_country_id-5' => 1228,
+      'frequency_interval' => 1,
+      'frequency_unit' => 'month',
+      'installments' => '',
+      'hidden_AdditionalDetail' => 1,
+      'hidden_Premium' => 1,
+      'from_email_address' => '"civi45" <civi45@civicrm.com>',
+      'receipt_date' => '',
+      'receipt_date_time' => '',
+      'payment_processor_id' => $this->paymentProcessorID,
+      'currency' => 'USD',
+      'source' => '',
+    ), CRM_Core_Action::ADD);
+
+    $contribution = $this->callAPISuccessGetSingle('Contribution', array(
+      'contact_id' => $this->_individualId,
+      'contribution_status_id' => 'Completed',
+    ));
+    $this->assertEquals('50', $contribution['total_amount']);
+    $this->assertEquals(.08, $contribution['fee_amount']);
+    $this->assertEquals(49.92, $contribution['net_amount']);
+    $this->assertEquals('tx', $contribution['trxn_id']);
+  }
+
   /**
    * Test the submit function with an invalid payment.
    *
@@ -198,7 +314,7 @@ class CRM_Contribute_Form_ContributionTest extends CiviUnitTestCase {
         'receive_date_time' => '11:27PM',
         'contact_id' => $this->_individualId,
         'payment_instrument_id' => array_search('Credit Card', $this->paymentInstruments),
-        'payment_processor_id' => $this->paymentProcessor->id,
+        'payment_processor_id' => $this->paymentProcessorID,
         'credit_card_exp_date' => array('M' => 5, 'Y' => 2012),
         'credit_card_number' => '411111111111111',
       ), CRM_Core_Action::ADD,
@@ -238,7 +354,7 @@ class CRM_Contribute_Form_ContributionTest extends CiviUnitTestCase {
       'receive_date_time' => '11:27PM',
       'contact_id' => $this->_individualId,
       'payment_instrument_id' => array_search('Credit Card', $this->paymentInstruments),
-      'payment_processor_id' => $this->paymentProcessor->id,
+      'payment_processor_id' => $this->paymentProcessorID,
       'credit_card_exp_date' => array('M' => 5, 'Y' => 2025),
       'credit_card_number' => '411111111111111',
       'billing_city-5' => 'Vancouver',
@@ -267,7 +383,7 @@ class CRM_Contribute_Form_ContributionTest extends CiviUnitTestCase {
       'receive_date_time' => '11:27PM',
       'contact_id' => $this->_individualId,
       'payment_instrument_id' => array_search('Credit Card', $this->paymentInstruments),
-      'payment_processor_id' => $this->paymentProcessor->id,
+      'payment_processor_id' => $this->paymentProcessorID,
       'credit_card_exp_date' => array('M' => 5, 'Y' => 2025),
       'credit_card_number' => '411111111111111',
     ), CRM_Core_Action::ADD,
@@ -394,7 +510,7 @@ class CRM_Contribute_Form_ContributionTest extends CiviUnitTestCase {
       'fulfilled_date' => '',
       'is_email_receipt' => TRUE,
       'from_email_address' => 'test@test.com',
-      'payment_processor_id' => $this->paymentProcessor->id,
+      'payment_processor_id' => $this->paymentProcessorID,
       'credit_card_exp_date' => array('M' => 5, 'Y' => 2026),
       'credit_card_number' => '411111111111111',
     ), CRM_Core_Action::ADD,
@@ -504,7 +620,7 @@ class CRM_Contribute_Form_ContributionTest extends CiviUnitTestCase {
    */
   protected function getCreditCardParams() {
     return array(
-      'payment_processor_id' => $this->paymentProcessor->id,
+      'payment_processor_id' => $this->paymentProcessorID,
       'credit_card_exp_date' => array('M' => 5, 'Y' => 2012),
       'credit_card_number' => '411111111111111',
     );
index d6ba3dc80be14bc4d3893c4981a47d87b41d22a4..ca7b17a571cfaa3166eaf395c6bbb43ee6086b62 100644 (file)
@@ -280,6 +280,55 @@ class CRM_Member_Form_MembershipRenewalTest extends CiviUnitTestCase {
     ));
   }
 
+  /**
+   * Test the submit function of the membership form.
+   */
+  public function testSubmitRecurCompleteInstant() {
+    $form = $this->getForm();
+
+    $processor = Civi\Payment\System::singleton()->getById($this->_paymentProcessorID);
+    $processor->setDoDirectPaymentResult(array(
+      'payment_status_id' => 1,
+      'trxn_id' => 'kettles boil water',
+      'fee_amount' => .29,
+    ));
+
+    $this->callAPISuccess('MembershipType', 'create', array(
+      'id' => $this->membershipTypeAnnualFixedID,
+      'duration_unit' => 'month',
+      'duration_interval' => 1,
+      'auto_renew' => TRUE,
+    ));
+    $this->createLoggedInUser();
+    $form->preProcess();
+
+    $form->_contactID = $this->_individualId;
+    $params = $this->getBaseSubmitParams();
+    $form->_mode = 'test';
+
+    $form->testSubmit($params);
+    $membership = $this->callAPISuccessGetSingle('Membership', array('contact_id' => $this->_individualId));
+    $contributionRecur = $this->callAPISuccessGetSingle('ContributionRecur', array('contact_id' => $this->_individualId));
+    $this->assertEquals($contributionRecur['id'], $membership['contribution_recur_id']);
+
+    $contribution = $this->callAPISuccess('Contribution', 'getsingle', array(
+      'contact_id' => $this->_individualId,
+      'is_test' => TRUE,
+    ));
+
+    $this->assertEquals('kettles boil water', $contribution['trxn_id']);
+    $this->assertEquals(.29, $contribution['fee_amount']);
+    $this->assertEquals(78, $contribution['total_amount']);
+    $this->assertEquals(77.71, $contribution['net_amount']);
+
+    $this->callAPISuccessGetCount('LineItem', array(
+      'entity_id' => $membership['id'],
+      'entity_table' => 'civicrm_membership',
+      'contribution_id' => $contribution['id'],
+    ), 1);
+
+  }
+
   /**
    * Test the submit function of the membership form.
    */
@@ -420,6 +469,7 @@ class CRM_Member_Form_MembershipRenewalTest extends CiviUnitTestCase {
       'record_contribution' => TRUE,
       'trxn_id' => 777,
       'contribution_status_id' => 1,
+      'fee_amount' => .5,
     );
     $form->_contactID = $this->_individualId;
 
@@ -433,6 +483,7 @@ class CRM_Member_Form_MembershipRenewalTest extends CiviUnitTestCase {
     ));
 
     $this->assertEquals($contribution['trxn_id'], 777);
+    $this->assertEquals(.5, $contribution['fee_amount']);
     $this->callAPISuccessGetCount('LineItem', array(
       'entity_id' => $membership['id'],
       'entity_table' => 'civicrm_membership',
@@ -460,4 +511,49 @@ class CRM_Member_Form_MembershipRenewalTest extends CiviUnitTestCase {
     return $form;
   }
 
+  /**
+   * Get some re-usable parameters for the submit function.
+   *
+   * @return array
+   */
+  protected function getBaseSubmitParams() {
+    $params = array(
+      'cid' => $this->_individualId,
+      'price_set_id' => 0,
+      'join_date' => date('m/d/Y', time()),
+      'start_date' => '',
+      'end_date' => '',
+      'campaign_id' => '',
+      // This format reflects the 23 being the organisation & the 25 being the type.
+      'membership_type_id' => array(23, $this->membershipTypeAnnualFixedID),
+      'auto_renew' => '1',
+      'is_recur' => 1,
+      'max_related' => 0,
+      'num_terms' => '1',
+      'source' => '',
+      'total_amount' => '78.00',
+      'financial_type_id' => '2', //Member dues, see data.xml
+      'soft_credit_type_id' => 11,
+      'soft_credit_contact_id' => '',
+      'from_email_address' => '"Demonstrators Anonymous" <info@example.org>',
+      'receipt_text' => 'Thank you text',
+      'payment_processor_id' => $this->_paymentProcessorID,
+      'credit_card_number' => '4111111111111111',
+      'cvv2' => '123',
+      'credit_card_exp_date' => array(
+        'M' => '9',
+        'Y' => '2019', // TODO: Future proof
+      ),
+      'credit_card_type' => 'Visa',
+      'billing_first_name' => 'Test',
+      'billing_middlename' => 'Last',
+      'billing_street_address-5' => '10 Test St',
+      'billing_city-5' => 'Test',
+      'billing_state_province_id-5' => '1003',
+      'billing_postal_code-5' => '90210',
+      'billing_country_id-5' => '1228',
+    );
+    return $params;
+  }
+
 }
index 3c88f645154e74b3ed3d6e6f5893cf80971fd652..ae19247929756799f14688ebf5aa490a718489c7 100644 (file)
@@ -468,7 +468,8 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase {
       'billing_postal_code-5' => '90210',
       'billing_country_id-5' => '1228',
     );
-    $form->submit($params);
+    $form->_contactID = $this->_individualId;
+    $form->testSubmit($params);
     $membership = $this->callAPISuccessGetSingle('Membership', array('contact_id' => $this->_individualId));
     $this->callAPISuccessGetCount('ContributionRecur', array('contact_id' => $this->_individualId), 0);
     $contribution = $this->callAPISuccess('Contribution', 'get', array(
@@ -499,8 +500,8 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase {
     $this->createLoggedInUser();
     $params = $this->getBaseSubmitParams();
     $form->_mode = 'test';
-
-    $form->submit($params);
+    $form->_contactID = $this->_individualId;
+    $form->testSubmit($params);
     $membership = $this->callAPISuccessGetSingle('Membership', array('contact_id' => $this->_individualId));
     $this->callAPISuccessGetCount('ContributionRecur', array('contact_id' => $this->_individualId), 1);
 
@@ -517,6 +518,65 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase {
     ), 1);
   }
 
+  /**
+   * Test the submit function of the membership form.
+   */
+  public function testSubmitPayLaterWithBilling() {
+    $form = $this->getForm(NULL);
+    $this->createLoggedInUser();
+    $params = array(
+      'cid' => $this->_individualId,
+      'join_date' => date('m/d/Y', time()),
+      'start_date' => '',
+      'end_date' => '',
+      // This format reflects the 23 being the organisation & the 25 being the type.
+      'membership_type_id' => array(23, $this->membershipTypeAnnualFixedID),
+      'auto_renew' => '0',
+      'max_related' => '',
+      'num_terms' => '2',
+      'source' => '',
+      'total_amount' => '50.00',
+      //Member dues, see data.xml
+      'financial_type_id' => '2',
+      'soft_credit_type_id' => '',
+      'soft_credit_contact_id' => '',
+      'payment_instrument_id' => 4,
+      'from_email_address' => '"Demonstrators Anonymous" <info@example.org>',
+      'receipt_text_signup' => 'Thank you text',
+      'payment_processor_id' => $this->_paymentProcessorID,
+      'record_contribution' => TRUE,
+      'trxn_id' => 777,
+      'contribution_status_id' => 2,
+      'billing_first_name' => 'Test',
+      'billing_middlename' => 'Last',
+      'billing_street_address-5' => '10 Test St',
+      'billing_city-5' => 'Test',
+      'billing_state_province_id-5' => '1003',
+      'billing_postal_code-5' => '90210',
+      'billing_country_id-5' => '1228',
+    );
+    $form->_contactID = $this->_individualId;
+
+    $form->testSubmit($params);
+    $membership = $this->callAPISuccessGetSingle('Membership', array('contact_id' => $this->_individualId));
+    $contribution = $this->callAPISuccessGetSingle('Contribution', array(
+      'contact_id' => $this->_individualId,
+      'contribution_status_id' => 2,
+    ));
+    $this->assertEquals($contribution['trxn_id'], 777);
+
+    $this->callAPISuccessGetCount('LineItem', array(
+      'entity_id' => $membership['id'],
+      'entity_table' => 'civicrm_membership',
+      'contribution_id' => $contribution['id'],
+    ), 1);
+    $this->callAPISuccessGetSingle('address', array(
+      'contact_id' => $this->_individualId,
+      'street_address' => '10 Test St',
+      'postal_code' => 90210,
+    ));
+  }
+
   /**
    * Test the submit function of the membership form.
    */
@@ -524,7 +584,11 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase {
     $form = $this->getForm();
 
     $processor = Civi\Payment\System::singleton()->getById($this->_paymentProcessorID);
-    $processor->setDoDirectPaymentResult(array('payment_status_id' => 1, 'trxn_id' => 'kettles boil water'));
+    $processor->setDoDirectPaymentResult(array(
+      'payment_status_id' => 1,
+      'trxn_id' => 'kettles boil water',
+      'fee_amount' => .14,
+    ));
     $this->callAPISuccess('MembershipType', 'create', array(
       'id' => $this->membershipTypeAnnualFixedID,
       'duration_unit' => 'month',
@@ -535,16 +599,19 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase {
     $this->createLoggedInUser();
     $params = $this->getBaseSubmitParams();
     $form->_mode = 'test';
-
-    $form->submit($params);
+    $form->_contactID = $this->_individualId;
+    $form->testSubmit($params);
     $membership = $this->callAPISuccessGetSingle('Membership', array('contact_id' => $this->_individualId));
     $this->callAPISuccessGetCount('ContributionRecur', array('contact_id' => $this->_individualId), 1);
 
-    $contribution = $this->callAPISuccess('Contribution', 'get', array(
+    $contribution = $this->callAPISuccess('Contribution', 'getsingle', array(
       'contact_id' => $this->_individualId,
       'is_test' => TRUE,
     ));
 
+    $this->assertEquals(.14, $contribution['fee_amount']);
+    $this->assertEquals('kettles boil water', $contribution['trxn_id']);
+
     $this->callAPISuccessGetCount('LineItem', array(
       'entity_id' => $membership['id'],
       'entity_table' => 'civicrm_membership',
index 5694673e56836df7eea68a14ca6b2f37327afce2..a8f17c3ea313cb01f5d37ee36b40b9e109b9464f 100755 (executable)
@@ -1494,7 +1494,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
    * Create Payment Processor.
    *
    * @return CRM_Financial_DAO_PaymentProcessor
-   *   instance of Payment Processsor
+   *   instance of Payment Processor
    */
   public function processorCreate() {
     $processorParams = array(
@@ -1509,8 +1509,20 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
       'url_recur' => 'http://dummy.com',
       'billing_mode' => 1,
     );
-    $paymentProcessor = CRM_Financial_BAO_PaymentProcessor::create($processorParams);
-    return $paymentProcessor;
+    return CRM_Financial_BAO_PaymentProcessor::create($processorParams);
+  }
+
+  /**
+   * Create Payment Processor.
+   *
+   * @param array $processorParams
+   *
+   * @return \CRM_Core_Payment_Dummy
+   *    Instance of Dummy Payment Processor
+   */
+  public function dummyProcessorCreate($processorParams = array()) {
+    $paymentProcessor = $this->processorCreate($processorParams);
+    return Civi\Payment\System::singleton()->getById($paymentProcessor->id);
   }
 
   /**
index 3c0d3aab14136f89e7d084320c82e740f89d29e5..464f5ba27ca8ef0d43d8a64b9c0127284a2870ec 100755 (executable)
@@ -140,7 +140,7 @@ class WebTest_ACL_AssignUsersToRolesTest extends CiviSeleniumTestCase {
     $this->waitForElementPresent("task");
     $this->click('radio_ts', 'ts_all');
     $this->click('task');
-    $this->select('task', 'label=New Smart Group');
+    $this->select('task', 'label=Smart group - create');
     $this->waitForPageToLoad($this->getTimeoutMsec());
     $smartGroupTitle = "SmartGroup" . substr(sha1(rand()), 0, 4);
     $this->type("title", $smartGroupTitle);
index f6146cb5d16cdb02dada2edf7ec6460c28e402dd..22388e61a0bf1707e1b96237f764934f50b28a0f 100644 (file)
@@ -58,6 +58,7 @@ class WebTest_Campaign_MailingTest extends CiviSeleniumTestCase {
     // We're using Quick Add block on the main page for this.
     $firstName = substr(sha1(rand()), 0, 7);
     $this->webtestAddContact($firstName, "Smith", "$firstName.smith@example.org");
+    $this->_contactNames = array("$firstName.smith@example.org" => "Smith, $firstName");
 
     // add contact to group
     // visit group tab
@@ -107,6 +108,7 @@ class WebTest_Campaign_MailingTest extends CiviSeleniumTestCase {
     //---- create mailing contact and add to mailing Group
     $firstName = substr(sha1(rand()), 0, 7);
     $this->webtestAddContact($firstName, "Mailson", "mailino$firstName@mailson.co.in");
+    $this->_contactNames["mailino$firstName@mailson.co.in"] = "Mailson, $firstName";
 
     // go to group tab and add to mailing group
     $this->click("css=li#tab_group a");
@@ -259,6 +261,23 @@ class WebTest_Campaign_MailingTest extends CiviSeleniumTestCase {
     // verify email
     $this->assertElementContainsText('mailing_event', "mailino$firstName@mailson.co.in");
     //------end delivery verification---------
+
+    // Search Advanced Search for contacts associated with Campaign in the Mailings Tab.
+    $this->mailingCampaignAdvancedSearchTest($campaignTitle, $this->_contactNames);
+  }
+
+  public function mailingCampaignAdvancedSearchTest($campaignTitle, $contactNames) {
+    // Go directly to Advanced Search
+    $this->openCiviPage('contact/search/advanced', 'reset=1');
+
+    // Select the Mailing Tab
+    $this->clickAjaxLink("CiviMail", 'campaigns');
+    $this->multiselect2("campaigns", array("$campaignTitle"));
+    $this->click("_qf_Advanced_refresh");
+
+    // Check for contacts inserted while adding Campaing and Mailing
+    $this->waitForElementPresent('search-status');
+    $this->assertElementContainsText('search-status', '2 Contacts');
   }
 
 }
index 0c0fdc02262a94977104905075f157e6b2046506..65e9f52fb91e48dad9edb068a36f20ac230c936f 100644 (file)
@@ -46,7 +46,7 @@ class WebTest_Contact_AddContactsToEventAdvancedSearchTest extends CiviSeleniumT
     $this->waitForElementPresent("xpath=//div[@id='search-status']/table/tbody/tr[2]/td[2]/input[1]");
     $this->click("xpath=//div[@id='search-status']/table/tbody/tr[2]/td[2]/input[1]");
 
-    $this->select('task', "label=Add Contacts to Event");
+    $this->select('task', "label=Register participants for event");
 
     // Select event. Based on label for now.
     $this->waitForElementPresent('event_id');
index 40adff3998517208bea0e6911b967083ef929ed7..af517e9bbc69ee4ed885f4d61cf3561ae551a67f 100644 (file)
@@ -125,7 +125,7 @@ class WebTest_Contact_AdvancedSearchedRelatedContactTest extends CiviSeleniumTes
     $this->waitForElementPresent('search-status');
     $this->assertElementContainsText('search-status', '2 Contact');
 
-    $this->select("task", "label=Add Contacts to Group");
+    $this->select("task", "label=Group - add contacts");
 
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
index 9e639902100027496522e296b9114a08cab98079..e630f42a61320d4a4f2166f800873090e8056e6e 100644 (file)
@@ -70,7 +70,7 @@ class WebTest_Contact_DeceasedContactsAdvancedSearchTest extends CiviSeleniumTes
     $this->click("toggleSelect");
     $this->waitForTextPresent('2 Selected records only');
 
-    $this->select('task', 'label=Remove Contacts from Group');
+    $this->select('task', 'label=Group - remove contacts');
     $this->waitForPageToLoad($this->getTimeoutMsec());
     $this->waitForElementPresent('_qf_RemoveFromGroup_back-bottom');
     $this->assertElementContainsText('crm-container', 'Number of selected contacts: 2');
index f5e568441b67c727c04576d290fba7d4cf92540f..ba536cb43c3188ba3c9c86ba9829a0bd10ca33f2 100644 (file)
@@ -250,7 +250,7 @@ class WebTest_Contact_SearchTest extends CiviSeleniumTestCase {
 
     // Select the task action to export
     $this->click("task");
-    $this->select("task", "label=Export Contacts");
+    $this->select("task", "label=Export contacts");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     $this->click("_qf_Select_next-bottom");
index b79c2aacf7db053fc2d457a15172a9f103256e1d..f2f58a62159aaeeb114926c3416c04a786f59353 100644 (file)
@@ -73,7 +73,7 @@ class WebTest_Contact_TaskActionAddToGroupTest extends CiviSeleniumTestCase {
     // Click "check all" box and act on "Add to group" action
     $this->click('toggleSelect');
     $this->waitForText("xpath=//input[@value='ts_sel']/following-sibling::label/span", '2');
-    $this->select("task", "label=Add Contacts to Group");
+    $this->select("task", "label=Group - add contacts");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // Select the new group and click to add
@@ -120,7 +120,7 @@ class WebTest_Contact_TaskActionAddToGroupTest extends CiviSeleniumTestCase {
     $this->waitForText("xpath=//div[@class='crm-content-block']/div/div[2]/div/span[2]/a", "Next >");
     $this->click("toggleSelect");
     $this->waitForText("xpath=//input[@value='ts_sel']/following-sibling::label/span", '50');
-    $this->select("task", "label=Add Contacts to Group");
+    $this->select("task", "label=Group - add contacts");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     // Select the new group and click to add
index 211bca5f94ad7f4c6e6f1120f916c5a58aa0b1b1..03e6fa2a6e6c653700fbc62f288be3eb718ea632 100644 (file)
@@ -52,7 +52,7 @@ class WebTest_Contact_TaskActionSendMassMailing extends CiviSeleniumTestCase {
     // Click "check all" box and act on "Add to group" action
     $this->click("//form[@id='Advanced']/div[3]/div/div[2]/table/thead/tr/th[1]/input");
     $this->waitForText('search-status', "50 Selected records only");
-    $this->select("task", "label=Schedule/Send a Mass Mailing");
+    $this->select("task", "label=Email - schedule/send via CiviMail");
     $this->clickLink("Go");
 
     //-------select recipients----------
index 8cd1ed7a0c31740da458ca26e01d4376cd8ca606..82562b065d2af9a2de2cdccc0bb6156c4b2093c5 100644 (file)
@@ -108,7 +108,7 @@ class WebTest_Contact_TaskActionSendSMS extends CiviSeleniumTestCase {
     $this->click('CIVICRM_QFID_ts_all_12');
 
     // Perform a task action
-    $this->select("task", "label=Send SMS to Contacts");
+    $this->select("task", "label=SMS - schedule/send");
     $this->clickLink("Go", 'activity_subject');
     $this->type('activity_subject', "Send SMS to Contacts of {$smsGroupName}");
     $this->type('text_message', "Test SMS to Contacts of {$smsGroupName}");
index 53a718c95b1cefa264047d7191658a80f3de6fbf..47288ea80baa960500bb79038592ff4bdc5329fd 100644 (file)
@@ -68,7 +68,7 @@ class WebTest_Event_ChangeParticipantStatus extends CiviSeleniumTestCase {
     $this->click($id2);
 
     // Change participant status for selected participants
-    $this->select('task', "label=Change Participant Status");
+    $this->select('task', "label=Participant status - change");
     $this->waitForElementPresent('_qf_ParticipantStatus_next');
 
     $this->select('status_change', "label=Attended");
index 476fa1b88b85aa282b092cf824784533dab0afb1..9cbc1a3e53e4920dc8c441bda32ee75d9e46d08d 100644 (file)
@@ -100,7 +100,7 @@ class WebTest_Export_ContactTest extends ExportCiviSeleniumTestCase {
 
     // Select the task action to export.
     $this->click("task");
-    $this->select("task", "label=Export Contacts");
+    $this->select("task", "label=Export contacts");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     $csvFile = $this->downloadCSV("_qf_Select_next-bottom");
@@ -212,12 +212,12 @@ class WebTest_Export_ContactTest extends ExportCiviSeleniumTestCase {
     // Is contact present in search result?
     $this->assertElementContainsText('css=div.crm-search-results', $childSortName, "Contact did not found in search result!");
 
-    // select to export all the contasct from search result.
+    // select to export all the contacts from search result.
     $this->click("CIVICRM_QFID_ts_all_4");
 
     // Select the task action to export.
     $this->click("task");
-    $this->select("task", "label=Export Contacts");
+    $this->select("task", "label=Export contacts");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     $csvFile = $this->downloadCSV("_qf_Select_next-bottom");
@@ -370,7 +370,7 @@ class WebTest_Export_ContactTest extends ExportCiviSeleniumTestCase {
 
     // Select the task action to export.
     $this->click("task");
-    $this->select("task", "label=Export Contacts");
+    $this->select("task", "label=Export contacts");
     $this->waitForPageToLoad($this->getTimeoutMsec());
 
     $this->click("CIVICRM_QFID_2_10");
index 286a10e71ae63b35c747507383c44681651ff8d0..fe911eb68f2f9fa718ef1a3bc00e1f55bc176bdd 100644 (file)
@@ -74,7 +74,7 @@ class WebTest_Profile_BatchUpdateTest extends CiviSeleniumTestCase {
     $this->waitForElementPresent('CIVICRM_QFID_ts_all_4');
     $this->click('CIVICRM_QFID_ts_all_4');
 
-    $this->select('task', "label=Batch Update via Profile");
+    $this->select('task', "label=Batch update contacts via profile");
     $this->waitForElementPresent('_qf_PickProfile_next');
     $this->waitForElementPresent('uf_group_id');
     $this->select('uf_group_id', "label={$profileTitle}");
@@ -156,7 +156,7 @@ class WebTest_Profile_BatchUpdateTest extends CiviSeleniumTestCase {
     $this->waitForElementPresent('CIVICRM_QFID_ts_all_4');
     $this->click('CIVICRM_QFID_ts_all_4');
 
-    $this->select('task', "label=Batch Update via Profile");
+    $this->select('task', "label=Batch update contacts via profile");
     $this->waitForElementPresent('_qf_PickProfile_next');
 
     $this->select('uf_group_id', "label={$profileTitle}");
@@ -335,7 +335,7 @@ class WebTest_Profile_BatchUpdateTest extends CiviSeleniumTestCase {
     $this->waitForElementPresent('CIVICRM_QFID_ts_all_4');
     $this->click('CIVICRM_QFID_ts_all_4');
 
-    $this->select('task', "label=Batch Update via Profile");
+    $this->select('task', "label=Batch update contacts via profile");
     $this->waitForElementPresent('_qf_PickProfile_next');
 
     $this->select('uf_group_id', "label={$profileTitle}");
index a5b0a173019c1888319606a2a44264e4b00b40dd..f74de1077bd744a33c53dd5d7b1fa08ad14578a6 100644 (file)
@@ -82,6 +82,36 @@ class api_v3_ACLPermissionTest extends CiviUnitTestCase {
     $this->assertEquals(0, $result['count']);
   }
 
+  /**
+   * Function tests that an empty where hook returns exactly 1 result with "view my contact".
+   *
+   * CRM-16512 caused contacts with Edit my contact to be able to view all records.
+   */
+  public function testContactGetOneResultHookWithViewMyContact() {
+    $this->createLoggedInUser();
+    $this->hookClass->setHook('civicrm_aclWhereClause', array($this, 'aclWhereHookNoResults'));
+    CRM_Core_Config::singleton()->userPermissionClass->permissions = array('access CiviCRM', 'view my contact');
+    $result = $this->callAPISuccess('contact', 'get', array(
+      'check_permissions' => 1,
+      'return' => 'display_name',
+    ));
+    $this->assertEquals(1, $result['count']);
+  }
+
+  /**
+   * Function tests that a user with "edit my contact" can edit themselves.
+   */
+  public function testContactEditHookWithEditMyContact() {
+    $this->markTestIncomplete('api acls only work with contact get so far');
+    $cid = $this->createLoggedInUser();
+    $this->hookClass->setHook('civicrm_aclWhereClause', array($this, 'aclWhereHookNoResults'));
+    CRM_Core_Config::singleton()->userPermissionClass->permissions = array('access CiviCRM', 'edit my contact');
+    $this->callAPISuccess('contact', 'create', array(
+      'check_permissions' => 1,
+      'id' => $cid,
+    ));
+  }
+
   /**
    * Function tests all results are returned.
    */
@@ -122,7 +152,7 @@ class api_v3_ACLPermissionTest extends CiviUnitTestCase {
   }
 
   /**
-   * Confirm that without check permissions we still get 2 contacts returned
+   * Confirm that without check permissions we still get 2 contacts returned.
    */
   public function testContactGetHookLimitingHookDontCheck() {
     $result = $this->callAPISuccess('contact', 'get', array(
@@ -299,7 +329,7 @@ class api_v3_ACLPermissionTest extends CiviUnitTestCase {
   /**
    * @dataProvider entities
    * Function tests that an empty where hook returns no results
-   * @param $entity
+   * @param string $entity
    * @throws \PHPUnit_Framework_IncompleteTestError
    */
   public function testEntityGetNoResultsHook($entity) {
index ee3d429225b50172bfef94f773089d0616ce646f..d167500f7981f72cd66e9b0533b225c1894ac147 100644 (file)
@@ -164,7 +164,11 @@ class api_v3_ContributionPageTest extends CiviUnitTestCase {
       'billing_mode' => 1,
     ));
     $dummyPP = Civi\Payment\System::singleton()->getById($paymentProcessor2ID);
-    $dummyPP->setDoDirectPaymentResult(array('payment_status_id' => 1, 'trxn_id' => 'create_first_success'));
+    $dummyPP->setDoDirectPaymentResult(array(
+      'payment_status_id' => 1,
+      'trxn_id' => 'create_first_success',
+      'fee_amount' => .85,
+    ));
     $this->callAPISuccess('ContributionPage', 'create', array(
       'id' => $this->_ids['contribution_page'],
       'payment_processor' => array($paymentProcessor2ID, $this->_ids['payment_processor']),
@@ -183,11 +187,16 @@ class api_v3_ContributionPageTest extends CiviUnitTestCase {
     );
 
     $this->callAPISuccess('contribution_page', 'submit', $submitParams);
-    $this->callAPISuccess('contribution', 'getsingle', array(
+    $contribution = $this->callAPISuccess('contribution', 'getsingle', array(
       'contribution_page_id' => $this->_ids['contribution_page'],
       'contribution_status_id' => 1,
     ));
+    $this->assertEquals('create_first_success', $contribution['trxn_id']);
+    $this->assertEquals(10, $contribution['total_amount']);
+    $this->assertEquals(.85, $contribution['fee_amount']);
+    $this->assertEquals(9.15, $contribution['net_amount']);
   }
+
   /**
    * Test submit with a membership block in place.
    */
@@ -269,6 +278,8 @@ class api_v3_ContributionPageTest extends CiviUnitTestCase {
    */
   public function testSubmitMembershipBlockIsSeparatePaymentPaymentProcessorNow() {
     $this->setUpMembershipContributionPage(TRUE);
+    $processor = Civi\Payment\System::singleton()->getById($this->_paymentProcessor['id']);
+    $processor->setDoDirectPaymentResult(array('fee_amount' => .72));
     $submitParams = array(
       'price_' . $this->_ids['price_field'][0] => reset($this->_ids['price_field_value']),
       'id' => (int) $this->_ids['contribution_page'],
@@ -294,6 +305,10 @@ class api_v3_ContributionPageTest extends CiviUnitTestCase {
     $this->assertTrue(in_array($membershipPayment['contribution_id'], array_keys($contributions['values'])));
     $membership = $this->callAPISuccessGetSingle('membership', array('id' => $membershipPayment['membership_id']));
     $this->assertEquals($membership['contact_id'], $contributions['values'][$membershipPayment['contribution_id']]['contact_id']);
+    foreach ($contributions['values'] as $contribution) {
+      $this->assertEquals(.72, $contribution['fee_amount']);
+      $this->assertEquals($contribution['total_amount'] - .72, $contribution['net_amount']);
+    }
   }
 
   /**
index 34b8a8ae80ecb5b30c9b6f7d5bc7cea71eca9a11..1c63c2e08b60df9f124d0e9eb3fc77893dea9598 100644 (file)
@@ -1367,6 +1367,28 @@ class api_v3_ContributionTest extends CiviUnitTestCase {
     $mut->stop();
   }
 
+  /**
+   * Test completing a transaction via the API.
+   *
+   * Note that we are creating a logged in user because email goes out from
+   * that person
+   */
+  public function testCompleteTransactionFeeAmount() {
+    $this->createLoggedInUser();
+    $params = array_merge($this->_params, array('contribution_status_id' => 2));
+    $contribution = $this->callAPISuccess('contribution', 'create', $params);
+    $this->callAPISuccess('contribution', 'completetransaction', array(
+      'id' => $contribution['id'],
+      'fee_amount' => '.56',
+      'trxn_id' => '7778888',
+    ));
+    $contribution = $this->callAPISuccess('contribution', 'getsingle', array('id' => $contribution['id'], 'sequential' => 1));
+    $this->assertEquals('Completed', $contribution['contribution_status']);
+    $this->assertEquals('7778888', $contribution['trxn_id']);
+    $this->assertEquals('.56', $contribution['fee_amount']);
+    $this->assertEquals('99.44', $contribution['net_amount']);
+  }
+
   /**
    * Test repeat contribution successfully creates line items.
    */
index a5c1acacb94cc9e809cc991c828533521e7d0f6d..1997b9547e4267b4a7c643b40e30c2e5e26c7ea0 100644 (file)
@@ -32,21 +32,50 @@ require_once 'CiviTest/CiviUnitTestCase.php';
  */
 class api_v3_CustomValueTest extends CiviUnitTestCase {
   protected $_apiversion = 3;
-  protected $individual;
-  protected $params;
   protected $ids;
+  protected $optionGroup;
 
   public $DBResetRequired = FALSE;
 
   public function setUp() {
     parent::setUp();
-    $this->individual = $this->individualCreate();
-    $this->params = array(
-      'entity_id' => $this->individual,
+  }
+
+  public function _populateOptionAndCustomGroup($type = NULL) {
+    $dataValues = array(
+      'integer' => array(1, 2, 3),
+      'number' => array(10.11, 20.22, 30.33),
+      'string' => array(substr(sha1(rand()), 0, 4), substr(sha1(rand()), 0, 3), substr(sha1(rand()), 0, 2)),
+      //'country' => array_rand(CRM_Core_PseudoConstant::country(FALSE, FALSE), 3),
+      'state_province' => array_rand(CRM_Core_PseudoConstant::stateProvince(FALSE, FALSE), 3),
+      'date' => NULL,
+      'contact' => NULL,
     );
-    $this->ids['single'] = $this->entityCustomGroupWithSingleFieldCreate('mySingleField', 'Contacts');
-    $this->ids['multi'] = $this->CustomGroupMultipleCreateWithFields();
-    $this->ids['multi2'] = $this->CustomGroupMultipleCreateWithFields(array('title' => 'group2'));
+
+    $dataValues = !empty($type) ? array($type => $dataValues[$type]) : $dataValues;
+
+    foreach ($dataValues as $dataType => $values) {
+      $this->optionGroup[$dataType] = array('values' => $values);
+      if (!empty($values)) {
+        $result = $this->callAPISuccess('OptionGroup', 'create',
+          array(
+            'name' => "{$dataType}_group",
+            'api.option_value.create' => array('label' => "$dataType 1", 'value' => $values[0]),
+            'api.option_value.create.1' => array('label' => "$dataType 2", 'value' => $values[1]),
+            'api.option_value.create.2' => array('label' => "$dataType 3", 'value' => $values[2]),
+          )
+        );
+        $this->optionGroup[$dataType]['id'] = $result['id'];
+      }
+      elseif ($dataType == 'contact') {
+        for ($i = 0; $i < 3; $i++) {
+          $result = $this->callAPISuccess('Contact', 'create', array('contact_type' => 'Individual', 'email' => substr(sha1(rand()), 0, 7) . '@yahoo.com'));
+          $this->optionGroup[$dataType]['values'][$i] = $result['id'];
+        }
+      }
+      $this->ids[$dataType] = $this->entityCustomGroupWithSingleFieldCreate("$dataType Custom Group", 'Contacts');
+    }
+
   }
 
   public function tearDown() {
@@ -59,119 +88,220 @@ class api_v3_CustomValueTest extends CiviUnitTestCase {
 
     // true tells quickCleanup to drop any tables that might have been created in the test
     $this->quickCleanup($tablesToTruncate, TRUE);
+
+    // cleanup created option group for each custom-set before running next test
+    if (!empty($this->optionGroup)) {
+      foreach ($this->optionGroup as $type => $value) {
+        if (!empty($value['id'])) {
+          $this->callAPISuccess('OptionGroup', 'delete', array('id' => $value['id']));
+        }
+      }
+    }
   }
 
   public function testCreateCustomValue() {
-    $params = array(
-      'custom_' . $this->ids['single']['custom_field_id'] => 'customString',
-    ) + $this->params;
+    $this->_populateOptionAndCustomGroup();
 
-    $result = $this->callAPIAndDocument('custom_value', 'create', $params, __FUNCTION__, __FILE__);
-    $this->assertEquals(1, $result['count']);
-    $result = $this->callAPISuccess('custom_value', 'get', $params);
-  }
+    $customFieldDataType = CRM_Core_BAO_CustomField::dataType();
+    $dataToHtmlTypes = CRM_Core_BAO_CustomField::dataToHtml();
+    $count = 0;
 
-  public function testGetMultipleCustomValues() {
+    foreach ($customFieldDataType as $dataType => $label) {
+      switch ($dataType) {
+        case 'Date':
+        case 'StateProvince';
+        case 'String':
+        case 'Link':
+        case 'Int':
+        case 'Float':
+        case 'Money':
+          if (in_array($dataType, array('String', 'Link'))) {
+            $validSQLOperator = array('=', '!=', 'IN', 'NOT IN', 'LIKE', 'NOT LIKE', 'IS NOT NULL', 'IS NULL');
+            $type = 'string';
+          }
+          else {
+            if ($dataType == 'StateProvince') {
+              $type = 'state_province';
+            }
+            elseif ($dataType == 'ContactReference') {
+              $type = 'contact';
+            }
+            elseif ($dataType == 'Date') {
+              $type = 'date';
+            }
+            else {
+              $type = $dataType == 'Int' ? 'integer' : 'number';
+            }
+            $validSQLOperator = array('=', '!=', 'IN', 'NOT IN', '<=', '>=', '>', '<', 'IS NOT NULL', 'IS NULL');
+          }
 
-    $description = "This demonstrates the use of CustomValue get to fetch single and multi-valued custom data.";
+          foreach ($dataToHtmlTypes[$count] as $html) {
+            $params = array(
+              'custom_group_id' => $this->ids[$type]['custom_group_id'],
+              'label' => "$dataType - $html",
+              'data_type' => $dataType,
+              'html_type' => $html,
+              'default_value' => NULL,
+            );
+            if (!in_array($html, array('Text', 'TextArea')) && !in_array($dataType, array('Link', 'Date', 'ContactReference'))) {
+              $params += array('option_group_id' => $this->optionGroup[$type]['id']);
+            }
+            $customField = $this->customFieldCreate($params);
+            $this->_testCustomValue($customField['values'][$customField['id']], $validSQLOperator, $type);
+          }
+          $count++;
+          break;
 
+        default:
+          //TODO: Test case of Country fields remain as it throws foreign key contraint ONLY in test environment
+          $count++;
+          break;
+      }
+    }
+  }
+
+  public function _testCustomValue($customField, $sqlOps, $type) {
+    $isSerialized = CRM_Core_BAO_CustomField::isSerialized($customField);
+    $customId = $customField['id'];
     $params = array(
-      'first_name' => 'abc3',
-      'last_name' => 'xyz3',
       'contact_type' => 'Individual',
-      'email' => 'man3@yahoo.com',
-      'custom_' . $this->ids['single']['custom_field_id'] => "value 1",
-      'custom_' . $this->ids['multi']['custom_field_id'][0] => "value 2",
-      'custom_' . $this->ids['multi']['custom_field_id'][1] => "warm beer",
-      'custom_' . $this->ids['multi']['custom_field_id'][2] => "fl* w*",
-      'custom_' . $this->ids['multi2']['custom_field_id'][2] => "vegemite",
+      'email' => substr(sha1(rand()), 0, 7) . 'man1@yahoo.com',
     );
-
     $result = $this->callAPISuccess('Contact', 'create', $params);
-    $contact_id = $result['id'];
-    $firstCustomField = $this->ids['multi']['custom_field_id'][0];
-    $secondCustomField = $this->ids['multi2']['custom_field_id'][0];
-    $thirdCustomField = $this->ids['multi2']['custom_field_id'][1];
-    $createParams = array(
-      'contact_type' => 'Individual',
-      'id' => $contact_id,
-      'custom_' . $firstCustomField => "value 3",
-      'custom_' . $secondCustomField => "coffee",
-      'custom_' . $thirdCustomField => "value 4",
-    );
-    $result = $this->callAPISuccess('Contact', 'create', $createParams);
+    $contactId = $result['id'];
 
-    $params = array(
-      'id' => $result['id'],
-      'entity_id' => $result['id'],
-    );
+    $count = rand(1, 2);
+    $seperator = CRM_Core_DAO::VALUE_SEPARATOR;
+    if ($isSerialized) {
+      $selectedValue = $this->optionGroup[$type]['values'];
+      $notselectedValue = $selectedValue[$count];
+      unset($selectedValue[$count]);
+    }
+    elseif ($customField['html_type'] == 'Link') {
+      $selectedValue = "http://" . substr(sha1(rand()), 0, 7) . ".com";
+      $notselectedValue = "http://" . substr(sha1(rand()), 0, 7) . ".com";
+    }
+    elseif ($type == 'date') {
+      $selectedValue = date('Ymd');
+      $notselectedValue = $lesserSelectedValue = date('Ymd', strtotime('yesterday'));
+      $greaterSelectedValue = date('Ymd', strtotime('+ 1 day'));
+    }
+    elseif ($type == 'contact') {
+      $selectedValue = $this->optionGroup[$type]['values'][1];
+      $notselectedValue = $this->optionGroup[$type]['values'][0];
+    }
+    else {
+      $selectedValue = $this->optionGroup[$type]['values'][0];
+      $notselectedValue = $this->optionGroup[$type]['values'][$count];
+      if (in_array(">", $sqlOps)) {
+        $greaterSelectedValue = $selectedValue + 1;
+        $lesserSelectedValue = $selectedValue - 1;
+      }
+    }
 
-    $result = $this->callAPIAndDocument('CustomValue', 'Get', $params, __FUNCTION__, __FILE__, $description);
-    $params['format.field_names'] = 1;
-    $resultformatted = $this->callAPIAndDocument('CustomValue', 'Get', $params, __FUNCTION__, __FILE__, "utilises field names", 'FormatFieldName');
-    // delete the contact
-    $this->callAPISuccess('contact', 'delete', array('id' => $contact_id));
-    $this->assertEquals('coffee', $result['values'][$secondCustomField]['2']);
-    $this->assertEquals('coffee', $result['values'][$secondCustomField]['latest']);
-    $this->assertEquals($secondCustomField, $result['values'][$secondCustomField]['id']);
-    $this->assertEquals('defaultValue', $result['values'][$secondCustomField]['1']);
-    $this->assertEquals($contact_id, $result['values'][$secondCustomField]['entity_id']);
-    $this->assertEquals('value 1', $result['values'][$this->ids['single']['custom_field_id']]['0']);
-    $this->assertEquals('value 1', $result['values'][$this->ids['single']['custom_field_id']]['latest']);
-    $this->assertEquals('value 1', $resultformatted['values']['mySingleField']['latest']);
-    $this->assertEquals('', $result['values'][$thirdCustomField]['1']);
-    $this->assertEquals('value 4', $result['values'][$thirdCustomField]['2']);
-  }
+    $params = array('entity_id' => $contactId, 'custom_' . $customId => $selectedValue);
+    $this->callAPISuccess('CustomValue', 'create', $params);
 
-  public function testMultipleCustomValues() {
-    $params = array(
-      'first_name' => 'abc3',
-      'last_name' => 'xyz3',
-      'contact_type' => 'Individual',
-      'email' => 'man3@yahoo.com',
-      'custom_' . $this->ids['single']['custom_field_id'] => "value 1",
-      'custom_' . $this->ids['multi']['custom_field_id'][0] . '-1' => "multi value 1",
-      'custom_' . $this->ids['multi']['custom_field_id'][0] . '-2' => "multi value 2",
-      'custom_' . $this->ids['multi']['custom_field_id'][1] => "second multi value 1",
-    );
+    foreach ($sqlOps as $op) {
+      $qillOp = CRM_Utils_Array::value($op, CRM_Core_SelectValues::getSearchBuilderOperators(), $op);
+      $description = "\nFind Contact where '$customField[label]' $qillOp ";
+      switch ($op) {
+        case '=':
+          $result = $this->callAPISuccess('Contact', 'Get', array('custom_' . $customId => (is_array($selectedValue) ? implode(CRM_Core_DAO::VALUE_SEPARATOR, $selectedValue) : $selectedValue)));
+          $this->assertEquals($contactId, $result['id']);
+          echo $description . implode("[separator]", (array) $selectedValue);
+          break;
 
-    $result = $this->callAPISuccess('Contact', 'create', $params);
-    $contact_id = $result['id'];
-    $firstCustomField = $this->ids['multi']['custom_field_id'][1];
-    $secondCustomField = $this->ids['single']['custom_field_id'];
-    $thirdCustomField = $this->ids['multi']['custom_field_id'][0];
+        case '!=':
+          $result = $this->callAPISuccess('Contact', 'Get', array('custom_' . $customId => array($op => $notselectedValue)));
+          $this->assertEquals(TRUE, array_key_exists($contactId, $result['values']));
+          echo $description . $notselectedValue;
+          break;
 
-    $createParams = array(
-      'contact_type' => 'Individual',
-      'id' => $contact_id,
-      'custom_' . $firstCustomField . '-1' => "second multi value 2",
-      'custom_' . $firstCustomField . '-2' => "second multi value 3",
-    );
-    $result = $this->callAPISuccess('Contact', 'create', $createParams);
+        case '>':
+        case '<':
+        case '>=':
+        case '<=':
+          if ($isSerialized) {
+            continue;
+          }
+          // To be precise in for these operator we can't just rely on one contact,
+          // hence creating multiple contact with custom value less/more then $selectedValue respectively
+          $result = $this->callAPISuccess('Contact', 'create', array('contact_type' => 'Individual', 'email' => substr(sha1(rand()), 0, 7) . 'man2@yahoo.com'));
+          $contactId2 = $result['id'];
+          $this->callAPISuccess('CustomValue', 'create', array('entity_id' => $contactId2, 'custom_' . $customId => $lesserSelectedValue));
 
-    $params = array(
-      'id' => $result['id'],
-      'entity_id' => $result['id'],
-    );
+          if ($op == '>') {
+            $result = $this->callAPISuccess('Contact', 'Get', array('custom_' . $customId => array($op => $lesserSelectedValue)));
+            $this->assertEquals($contactId, $result['id']);
+            echo $description . $lesserSelectedValue;
+          }
+          elseif ($op == '<') {
+            $result = $this->callAPISuccess('Contact', 'Get', array('custom_' . $customId => array($op => $selectedValue)));
+            $this->assertEquals($contactId2, $result['id']);
+            echo $description . $selectedValue;
+          }
+          else {
+            $result = $this->callAPISuccess('Contact', 'create', array('contact_type' => 'Individual', 'email' => substr(sha1(rand()), 0, 7) . 'man3@yahoo.com'));
+            $contactId3 = $result['id'];
+            $this->callAPISuccess('CustomValue', 'create', array('entity_id' => $contactId3, 'custom_' . $customId => $greaterSelectedValue));
 
-    $result = $this->callAPISuccess('CustomValue', 'Get', $params);
-    // delete the contact
-    $this->callAPISuccess('contact', 'delete', array('id' => $contact_id));
+            $result = $this->callAPISuccess('Contact', 'Get', array('custom_' . $customId => array($op => $selectedValue)));
+            echo $description . $selectedValue;
 
-    $this->assertEquals($contact_id, $result['values'][$secondCustomField]['entity_id']);
-    $this->assertEquals('value 1', $result['values'][$secondCustomField]['latest']);
-    $this->assertEquals('value 1', $result['values'][$secondCustomField][0]);
+            $this->assertEquals($contactId, $result['values'][$contactId]['id']);
+            if ($op == '>=') {
+              $this->assertEquals($contactId3, $result['values'][$contactId3]['id']);
+            }
+            else {
+              $this->assertEquals($contactId2, $result['values'][$contactId2]['id']);
+            }
+            $this->callAPISuccess('contact', 'delete', array('id' => $contactId3));
+          }
 
-    $this->assertEquals($contact_id, $result['values'][$thirdCustomField]['entity_id']);
-    $this->assertEquals('multi value 1', $result['values'][$thirdCustomField][1]);
-    $this->assertEquals('multi value 2', $result['values'][$thirdCustomField][2]);
+          $this->callAPISuccess('contact', 'delete', array('id' => $contactId2));
+          break;
 
-    $this->assertEquals($contact_id, $result['values'][$firstCustomField]['entity_id']);
-    $this->assertEquals('second multi value 1', $result['values'][$firstCustomField][1]);
-    $this->assertEquals('', $result['values'][$firstCustomField][2]);
-    $this->assertEquals('second multi value 2', $result['values'][$firstCustomField][3]);
-    $this->assertEquals('second multi value 3', $result['values'][$firstCustomField][4]);
-    $this->assertEquals('second multi value 3', $result['values'][$firstCustomField]['latest']);
+        case 'IN':
+          $result = $this->callAPISuccess('Contact', 'Get', array('custom_' . $customId => array($op => (array) $selectedValue)));
+          $this->assertEquals($contactId, $result['id']);
+          echo $description . implode(",", (array) $selectedValue);
+          break;
+
+        case 'NOT IN':
+          $result = $this->callAPISuccess('Contact', 'Get', array('custom_' . $customId => array($op => (array) $notselectedValue)));
+          $this->assertEquals($contactId, $result['id']);
+          echo $description . implode(",", (array) $notselectedValue);
+          break;
+
+        case 'LIKE':
+          $selectedValue = is_array($selectedValue) ? $selectedValue[0] : $selectedValue;
+          $result = $this->callAPISuccess('Contact', 'Get', array('custom_' . $customId => array($op => "%$selectedValue%")));
+          $this->assertEquals($contactId, $result['id']);
+          echo $description . "%$selectedValue%";
+          break;
+
+        case 'NOT LIKE':
+          $result = $this->callAPISuccess('Contact', 'Get', array('custom_' . $customId => array($op => $notselectedValue)));
+          $this->assertEquals($contactId, $result['id']);
+          echo $description . "'$notselectedValue'";
+          break;
+
+        case 'IS NULL':
+          $result = $this->callAPISuccess('Contact', 'Get', array('custom_' . $customId => array($op => 1)));
+          $this->assertEquals(FALSE, array_key_exists($contactId, $result['values']));
+          echo $description;
+          break;
+
+        case 'IS NOT NULL':
+          $result = $this->callAPISuccess('Contact', 'Get', array('custom_' . $customId => array($op => 1)));
+          $this->assertEquals($contactId, $result['id']);
+          echo $description;
+          break;
+      }
+    }
+
+    $this->callAPISuccess('Contact', 'delete', array('id' => $contactId));
   }
 
   /**
@@ -182,25 +312,23 @@ class api_v3_CustomValueTest extends CiviUnitTestCase {
    * @throws \CiviCRM_API3_Exception
    */
   public function testAlterOptionValue() {
+    $this->_populateOptionAndCustomGroup('string');
+
     $selectField = $this->customFieldCreate(array(
-      'custom_group_id' => $this->ids['single']['custom_group_id'],
+      'custom_group_id' => $this->ids['string']['custom_group_id'],
       'label' => 'Custom Select',
       'html_type' => 'Select',
-      'option_values' => array(
-        'one' => 'Option1',
-        'two' => 'Option2',
-        'notone' => 'OptionNotOne',
-      ),
+      'option_group_id' => $this->optionGroup['string']['id'],
     ));
     $selectField = civicrm_api3('customField', 'getsingle', array('id' => $selectField['id']));
     $radioField = $this->customFieldCreate(array(
-      'custom_group_id' => $this->ids['single']['custom_group_id'],
+      'custom_group_id' => $this->ids['string']['custom_group_id'],
       'label' => 'Custom Radio',
       'html_type' => 'Radio',
       'option_group_id' => $selectField['option_group_id'],
     ));
     $multiSelectField = $this->customFieldCreate(array(
-      'custom_group_id' => $this->ids['single']['custom_group_id'],
+      'custom_group_id' => $this->ids['string']['custom_group_id'],
       'label' => 'Custom Multi-Select',
       'html_type' => 'Multi-Select',
       'option_group_id' => $selectField['option_group_id'],
@@ -208,18 +336,18 @@ class api_v3_CustomValueTest extends CiviUnitTestCase {
     $selectName = 'custom_' . $selectField['id'];
     $radioName = 'custom_' . $radioField['id'];
     $multiSelectName = 'custom_' . $multiSelectField['id'];
-    $controlFieldName = 'custom_' . $this->ids['single']['custom_field_id'];
+    $controlFieldName = 'custom_' . $this->ids['string']['custom_field_id'];
 
     $params = array(
       'first_name' => 'abc4',
       'last_name' => 'xyz4',
       'contact_type' => 'Individual',
       'email' => 'man4@yahoo.com',
-      $selectName => 'one',
-      $multiSelectName => array('one', 'two', 'notone'),
-      $radioName => 'notone',
+      $selectName => $this->optionGroup['string']['values'][0],
+      $multiSelectName => $this->optionGroup['string']['values'],
+      $radioName => $this->optionGroup['string']['values'][1],
       // The control group in a science experiment should be unaffected
-      $controlFieldName => 'one',
+      $controlFieldName => $this->optionGroup['string']['values'][2],
     );
 
     $contact = $this->callAPISuccess('Contact', 'create', $params);
@@ -228,13 +356,13 @@ class api_v3_CustomValueTest extends CiviUnitTestCase {
       'id' => $contact['id'],
       'return' => array($selectName, $multiSelectName),
     ));
-    $this->assertEquals('one', $result[$selectName]);
-    $this->assertEquals(array('one', 'two', 'notone'), $result[$multiSelectName]);
+    $this->assertEquals($params[$selectName], $result[$selectName]);
+    $this->assertEquals($params[$multiSelectName], $result[$multiSelectName]);
 
     $this->callAPISuccess('OptionValue', 'create', array(
       'value' => 'one-modified',
       'option_group_id' => $selectField['option_group_id'],
-      'name' => 'Option1',
+      'name' => 'string 1',
       'options' => array(
         'match-mandatory' => array('option_group_id', 'name'),
       ),
@@ -246,11 +374,11 @@ class api_v3_CustomValueTest extends CiviUnitTestCase {
     ));
     // Ensure the relevant fields have been updated
     $this->assertEquals('one-modified', $result[$selectName]);
-    $this->assertEquals(array('one-modified', 'two', 'notone'), $result[$multiSelectName]);
+    $this->assertEquals(array('one-modified', $params[$radioName], $params[$controlFieldName]), $result[$multiSelectName]);
     // This field should not have changed because we didn't alter this option
-    $this->assertEquals('notone', $result[$radioName]);
+    $this->assertEquals($params[$radioName], $result[$radioName]);
     // This should not have changed because this field doesn't use the affected option group
-    $this->assertEquals('one', $result[$controlFieldName]);
+    $this->assertEquals($params[$controlFieldName], $result[$controlFieldName]);
   }
 
 }
index 10ca65627161d655c6aa5fcec9236dfb6585ede1..7560a5087e4a586fe5f5ebfc309da84b4a0a7e16 100644 (file)
@@ -449,6 +449,37 @@ class api_v3_EventTest extends CiviUnitTestCase {
     ));
   }
 
+  /**
+   * Test searching on custom fields with less than or equal.
+   *
+   * See CRM-17101.
+   */
+  public function testEventGetCustomFieldLte() {
+    // create custom group with custom field on event
+    $ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__);
+
+    // Create an event, with a custom value.
+    $params = $this->_params;
+    $params['title'] = "My test event.";
+    $params['start_date'] = "2015-03-14";
+    // Just assume that an event type 1 exists.
+    $params['event_type_id'] = 1;
+    $params['custom_' . $ids['custom_field_id']] = "AAAA";
+
+    $save_result = $this->callApiSuccess($this->_entity, 'create', $params);
+
+    // Retrieve the activity, search for custom field < 'BBBB'
+    $get_result = $this->callAPISuccess($this->_entity, 'get', array(
+      'return.custom_' . $ids['custom_field_id'] => 1,
+      'custom_' . $ids['custom_field_id'] => array('<=' => 'BBBB'),
+    ));
+
+    // Expect that we find the saved event.
+    $this->assertArrayKeyExists($save_result['id'], $get_result['values']);
+
+    $this->callAPISuccess($this->_entity, 'Delete', array('id' => $save_result['id']));
+  }
+
   /**
    * Test searching on custom fields with netsted call with id param.
    *
index 4e742852a2f957e460f8e4d2e221151dba09cc0b..59348ba6b63e13acfc47d5a2fc99d1fe4c952b14 100644 (file)
     <uniqueName>activity_details</uniqueName>
     <title>Details</title>
     <import>true</import>
-    <type>text</type>
+    <type>longtext</type>
     <headerPattern>/(activity.)?detail(s)?$/i</headerPattern>
     <comment>Details about the activity (agenda, notes, etc).</comment>
     <html>
index 338399169fb17c241a962a9b199bf370101454df..66639e92aaaadcf5cdafe40297bc586d7abf5a22 100644 (file)
@@ -850,7 +850,7 @@ VALUES
 INSERT INTO `civicrm_report_instance`
     ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`)
 VALUES
-    ( @domainID, '{ts escape="sql" skip="true"}Mailing Summary{/ts}', 'Mailing/summary','{ts escape="sql" skip="true"}Summary statistics for mailings{/ts}', 'access CiviMail','{literal}a:25:{s:6:"fields";a:5:{s:4:"name";s:1:"1";s:11:"queue_count";s:1:"1";s:15:"delivered_count";s:1:"1";s:12:"bounce_count";s:1:"1";s:10:"open_count";s:1:"1";}s:15:"is_completed_op";s:2:"eq";s:18:"is_completed_value";s:1:"1";s:15:"mailing_name_op";s:2:"in";s:18:"mailing_name_value";a:0:{}s:9:"status_op";s:3:"has";s:12:"status_value";s:8:"Complete";s:11:"is_test_min";s:0:"";s:11:"is_test_max";s:0:"";s:10:"is_test_op";s:3:"lte";s:13:"is_test_value";s:1:"0";s:19:"start_date_relative";s:9:"this.year";s:15:"start_date_from";s:0:"";s:13:"start_date_to";s:0:"";s:17:"end_date_relative";s:9:"this.year";s:13:"end_date_from";s:0:"";s:11:"end_date_to";s:0:"";s:11:"description";s:31:"Summary statistics for mailings";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:15:"access CiviMail";s:6:"groups";s:0:"";s:6:"charts";s:0:"";s:9:"domain_id";i:1;}{/literal}');
+    ( @domainID, '{ts escape="sql" skip="true"}Mailing Summary{/ts}', 'Mailing/summary','{ts escape="sql" skip="true"}Summary statistics for mailings{/ts}', 'access CiviMail','{literal}a:25:{s:6:"fields";a:5:{s:4:"name";s:1:"1";s:11:"queue_count";s:1:"1";s:15:"delivered_count";s:1:"1";s:12:"bounce_count";s:1:"1";s:17:"unique_open_count";s:1:"1";}s:15:"is_completed_op";s:2:"eq";s:18:"is_completed_value";s:1:"1";s:15:"mailing_name_op";s:2:"in";s:18:"mailing_name_value";a:0:{}s:9:"status_op";s:3:"has";s:12:"status_value";s:8:"Complete";s:11:"is_test_min";s:0:"";s:11:"is_test_max";s:0:"";s:10:"is_test_op";s:3:"lte";s:13:"is_test_value";s:1:"0";s:19:"start_date_relative";s:9:"this.year";s:15:"start_date_from";s:0:"";s:13:"start_date_to";s:0:"";s:17:"end_date_relative";s:9:"this.year";s:13:"end_date_from";s:0:"";s:11:"end_date_to";s:0:"";s:11:"description";s:31:"Summary statistics for mailings";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:15:"access CiviMail";s:6:"groups";s:0:"";s:6:"charts";s:0:"";s:9:"domain_id";i:1;}{/literal}');
 
 INSERT INTO `civicrm_report_instance`
     ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`)
index e51ffe6bcb903f28823d8bb2c5b04741b9f48cdb..e88f1bd39bafdf111873d12584cb8b73daf9ce2b 100644 (file)
@@ -13,9 +13,9 @@
     <center>
       <table style = "padding-right:19px;font-family: Arial, Verdana, sans-serif;" width = "500" height = "100" border = "0" cellpadding = "2" cellspacing = "1">
   <tr>
-    <td style = "padding-left:15px;" ><b><font size = "4" align = "center">INVOICE</font></b></td>
+    <td style = "padding-left:15px;" ><b><font size = "4" align = "center">{ts}INVOICE{/ts}</font></b></td>
           <td colspan = "1"></td>
-          <td style = "padding-left:70px;"><b><font size = "1" align = "center" >Invoice Date:</font></b></td>
+          <td style = "padding-left:70px;"><b><font size = "1" align = "center" >{ts}Invoice Date:{/ts}</font></b></td>
           <td><font size = "1" align = "right">{$domain_organization}</font></td>
   </tr>
         <tr>
@@ -35,7 +35,7 @@
         <tr>
           <td style = "padding-left:17px;"><font size = "1" align = "center">{$street_address}   {$supplemental_address_1}</font></td>
           <td colspan = "1"></td>
-          <td style = "padding-left:70px;"><b><font size = "1" align = "right">Invoice Number:</font></b></td>
+          <td style = "padding-left:70px;"><b><font size = "1" align = "right">{ts}Invoice Number:{/ts}</font></b></td>
     <td ><font size = "1" align = "right">{if $domain_supplemental_address_2 }{$domain_supplemental_address_2}{/if}
     {if $domain_state }{$domain_state}{/if}</font></td>
         </tr>
@@ -54,7 +54,7 @@
   <tr>
           <td style = "padding-left:17px;"><font size = "1" align = "right">{$city}  {$postal_code}</font></td>
           <td colspan="1"></td>
-    <td height = "10" style = "padding-left:70px;"><b><font size = "1"align = "right">Reference:</font></b></td>
+    <td height = "10" style = "padding-left:70px;"><b><font size = "1"align = "right">{ts}Reference:{/ts}</font></b></td>
     <td><font size = "1" align = "right"> {if $domain_country}
     {$domain_country}
         {/if}</font></td>
           <td colspan = "2" {$valueStyle}>
             <table> {* FIXME: style this table so that it looks like the text version (justification, etc.) *}
               <tr>
-                <th style = "padding-right:34px;text-align:left;font-weight:bold;width:200px;"><font size = "1">Description</font></th>
-                <th style = "padding-left:34px;text-align:right;font-weight:bold;" ><font size = "1">Quantity</font></th>
-                <th style = "padding-left:34px;text-align:right;font-weight:bold;"><font size = "1">Unit Price</font></th>
+                <th style = "padding-right:34px;text-align:left;font-weight:bold;width:200px;"><font size = "1">{ts}Description{/ts}</font></th>
+                <th style = "padding-left:34px;text-align:right;font-weight:bold;" ><font size = "1">{ts}Quantity{/ts}</font></th>
+                <th style = "padding-left:34px;text-align:right;font-weight:bold;"><font size = "1">{ts}Unit Price{/ts}</font></th>
                 <th style = "padding-left:34px;text-align:right;font-weight:bold;width:20px;"><font size = "1">{$taxTerm} </font></th>
-                <th style = "padding-left:34px;text-align:right;font-weight:bold;"><font size = "1">Amount {$defaultCurrency}</font></th>
+                <th style = "padding-left:34px;text-align:right;font-weight:bold;"><font size = "1">{ts 1=$defaultCurrency}Amount %1{/ts}</font></th>
               </tr>
               {foreach from=$lineItem item=value key=priceset name=taxpricevalue}
     {if $smarty.foreach.taxpricevalue.index eq 0}
         {if $value.tax_amount != ''}
           <td style = "padding-left:34px;text-align:right;width:20px;"><font size = "1"> {$value.tax_rate}%</font></td>
                     {else}
-          <td style = "padding-left:34px;text-align:right;width:20px;"><font size = "1">No {$taxTerm}</font></td>
+          <td style = "padding-left:34px;text-align:right;width:20px;"><font size = "1">{ts 1=$taxTerm}No %1{/ts}</font></td>
               {/if}
         <td style = "padding-left:34px;text-align:right;"><font size = "1">{$value.subTotal|crmMoney:$currency}</font></td>
     </tr>
           <tr><td  colspan = "5" style = "color:#F5F5F5;"><hr></hr></td></tr>
           <tr>
       <td colspan = "3"></td>
-      <td style = "padding-left:20px;text-align:right;"><font size = "1">Sub Total</font></td>
+      <td style = "padding-left:20px;text-align:right;"><font size = "1">{ts}Sub Total{/ts}</font></td>
       <td style = "padding-left:34px;text-align:right;"><font size = "1"> {$subTotal|crmMoney:$currency}</font></td>
     </tr>
     {foreach from = $dataArray item = value key = priceset}
             <tr>
         <td colspan = "3"></td>
         {if $priceset}
-          <td style = "padding-left:20px;text-align:right;"><font size = "1"> TOTAL {$taxTerm} {$priceset}%</font></td>
+          <td style = "padding-left:20px;text-align:right;"><font size = "1"> {ts 1=$taxTerm 2=$priceset}TOTAL %1 %2%{/ts}</font></td>
           <td style = "padding-left:34px;text-align:right"><font size = "1" align = "right">{$value|crmMoney:$currency}</font> </td>
                     {elseif $priceset == 0}
-                      <td style = "padding-left:20px;text-align:right;"><font size = "1">TOTAL NO {$taxTerm}</font></td>
+                      <td style = "padding-left:20px;text-align:right;"><font size = "1">{ts 1=$taxTerm}TOTAL NO %1{/ts}</font></td>
                       <td style = "padding-left:34px;text-align:right"><font size = "1" align = "right">{$value|crmMoney:$currency}</font> </td>
                   </tr>
         {/if}
 
           <tr>
       <td colspan = "3"></td>
-      <td style = "padding-left:20px;text-align:right;"><b><font size = "1">TOTAL {$defaultCurrency}</font></b></td>
+      <td style = "padding-left:20px;text-align:right;"><b><font size = "1">{ts 1=$defaultCurrency}TOTAL %1{/ts}</font></b></td>
       <td style = "padding-left:34px;text-align:right;"><font size = "1">{$amount|crmMoney:$currency}</font></td>
     </tr>
 
         <td colspan = "3"></td>
         <td style = "padding-left:20px;text-align:right;"><font size = "1">
            {if $contribution_status_id == $refundedStatusId}
-          LESS Amount Credited
+          {ts}LESS Amount Credited{/ts}
            {else}
-          LESS Amount Paid
+          {ts}LESS Amount Paid{/ts}
            {/if}
         </font></td>
         <td style = "padding-left:34px;text-align:right;"><font size = "1">{$amount|crmMoney:$currency}</font></td>
       </tr>
             <tr>
         <td colspan = "3"></td>
-        <td style = "padding-left:20px;text-align:right;"><b><font size = "1">AMOUNT DUE: </font></b></td>
+        <td style = "padding-left:20px;text-align:right;"><b><font size = "1">{ts}AMOUNT DUE:{/ts} </font></b></td>
                     <td style = "padding-left:34px;text-align:right;"><b><font size = "1">{$amountDue|crmMoney:$currency}</font></b></td>                 <td style = "padding-left:34px;"><font size = "1" align = "right"></fonts></td>
       </tr>
     {/if}
       <td colspan = "3"></td>
     </tr>
           <tr>
-      <td><b><font size = "1" align = "center">DUE DATE: {$dueDate}</font></b></td>
+      <td><b><font size = "1" align = "center">{ts 1=$dueDate}DUE DATE: %1{/ts}</font></b></td>
       <td colspan = "3"></td>
     </tr>
             </table>
       </table>
   <table style = "margin-top:6px;padding-right:20px;font-family: Arial, Verdana, sans-serif" width = "480" border = "0"cellpadding = "-5" cellspacing="19" id = "desc">
     <tr>
-      <td width="60%"><b><font size = "4" align = "right">PAYMENT ADVICE</font></b> <br/><br/> <font size = "1" align = "right"><b>To: </b>      <div style="width:17em;word-wrap:break-word;">
+      <td width="60%"><b><font size = "4" align = "right">{ts}PAYMENT ADVICE{/ts}</font></b> <br/><br/> <font size = "1" align = "right"><b>{ts}To: {/ts}</b>      <div style="width:17em;word-wrap:break-word;">
     {$domain_organization} <br />
     {$domain_street_address} {$domain_supplemental_address_1} <br />
     {$domain_supplemental_address_2} {$domain_state} <br />
         <table  cellpadding = "-10" cellspacing = "22"  align="right" >
     <tr>
             <td  colspan = "2"></td>
-      <td><font size = "1" align = "right" style="font-weight:bold;">Customer: </font></td>
+      <td><font size = "1" align = "right" style="font-weight:bold;">{ts}Customer: {/ts}</font></td>
       <td ><font size = "1" align = "right">{$display_name}</font></td>
     </tr>
     <tr>
       <td colspan = "2"></td>
-      <td><font size = "1" align = "right" style="font-weight:bold;">Invoice Number: </font></td>
+      <td><font size = "1" align = "right" style="font-weight:bold;">{ts}Invoice Number: {/ts}</font></td>
       <td><font size = "1" align = "right">{$invoice_id}</font></td>
     </tr>
     <tr><td  colspan = "5"style = "color:#F5F5F5;"><hr></hr></td></tr>
     {if $is_pay_later == 1}
     <tr>
                   <td colspan = "2"></td>
-                  <td><font size = "1" align = "right" style="font-weight:bold;">Amount Due:</font></td>
+                  <td><font size = "1" align = "right" style="font-weight:bold;">{ts}Amount Due:{/ts}</font></td>
                   <td><font size = "1" align = "right" style="font-weight:bold;">{$amount|crmMoney:$currency}</font></td>
     </tr>
     {else}
     <tr>
       <td colspan = "2"></td>
-      <td><font size = "1" align = "right" style="font-weight:bold;">Amount Due: </font></td>
+      <td><font size = "1" align = "right" style="font-weight:bold;">{ts}Amount Due: {/ts}</font></td>
       <td><font size = "1" align = "right" style="font-weight:bold;">{$amountDue|crmMoney:$currency}</font></td>
     </tr>
     {/if}
     <tr>
       <td colspan = "2"></td>
-      <td><font size = "1" align = "right" style="font-weight:bold;">Due Date:  </font></td>
+      <td><font size = "1" align = "right" style="font-weight:bold;">{ts}Due Date:  {/ts}</font></td>
       <td><font size = "1" align = "right">{$dueDate}</font></td>
     </tr>
     <tr>
 
       <table style = "padding-right:19px;font-family: Arial, Verdana, sans-serif" width = "500" height = "100" border = "0" cellpadding = "2" cellspacing = "1">
   <tr>
-          <td style = "padding-left:15px;" ><b><font size = "4" align = "center">CREDIT NOTE</font></b></td>
+          <td style = "padding-left:15px;" ><b><font size = "4" align = "center">{ts}CREDIT NOTE{/ts}</font></b></td>
           <td colspan = "1"></td>
-          <td style = "padding-left:70px;"><b><font size = "1" align = "right">Date:</font></b></td>
+          <td style = "padding-left:70px;"><b><font size = "1" align = "right">{ts}Date:{/ts}</font></b></td>
           <td><font size = "1" align = "right">{$domain_organization}</font></td>
   </tr>
         <tr>
         <tr>
           <td style = "padding-left:17px;"><font size = "1" align = "center">{$street_address}   {$supplemental_address_1}</font></td>
           <td colspan = "1"></td>
-          <td style = "padding-left:70px;"><b><font size = "1" align = "right">Credit Note Number:</font></b></td>
+          <td style = "padding-left:70px;"><b><font size = "1" align = "right">{ts}Credit Note Number:{/ts}</font></b></td>
           <td><font size = "1" align = "right">{if $domain_supplemental_address_2 }
     {$domain_supplemental_address_2}
         {/if}
   <tr>
           <td style = "padding-left:17px;"><font size = "1" align = "right">{$city}  {$postal_code}</font></td>
           <td colspan="1"></td>
-          <td height = "10" style = "padding-left:70px;"><b><font size = "1"align = "right">Reference:</font></b></td>
+          <td height = "10" style = "padding-left:70px;"><b><font size = "1"align = "right">{ts}Reference:{/ts}</font></b></td>
     <td><font size = "1" align = "right"> {if $domain_country}
     {$domain_country}
         {/if}</font></td>
           <td colspan = "2" {$valueStyle}>
             <table> {* FIXME: style this table so that it looks like the text version (justification, etc.) *}
               <tr>
-                <th style = "padding-right:28px;text-align:left;font-weight:bold;width:200px;"><font size = "1">Description</font></th>
-                <th style = "padding-left:28px;text-align:right;font-weight:bold;"><font size = "1">Quantity</font></th>
-                <th style = "padding-left:28px;text-align:right;font-weight:bold;"><font size = "1">Unit Price</font></th>
+                <th style = "padding-right:28px;text-align:left;font-weight:bold;width:200px;"><font size = "1">{ts}Description{/ts}</font></th>
+                <th style = "padding-left:28px;text-align:right;font-weight:bold;"><font size = "1">{ts}Quantity{/ts}</font></th>
+                <th style = "padding-left:28px;text-align:right;font-weight:bold;"><font size = "1">{ts}Unit Price{/ts}</font></th>
                 <th style = "padding-left:28px;text-align:right;font-weight:bold;"><font size = "1">{$taxTerm} </font></th>
-                <th style = "padding-left:28px;text-align:right;font-weight:bold;"><font size = "1">Amount {$defaultCurrency}</font></th>
+                <th style = "padding-left:28px;text-align:right;font-weight:bold;"><font size = "1">{ts 1=$defaultCurrency}Amount %1{/ts}</font></th>
               </tr>
               {foreach from=$lineItem item=value key=priceset name=pricevalue}
     {if $smarty.foreach.pricevalue.index eq 0}
         {if $value.tax_amount != ''}
           <td style = "padding-left:28px;text-align:right;"><font size = "1"> {$value.tax_rate}%</font></td>
                     {else}
-          <td style = "padding-left:28px;text-align:right"><font size = "1" >No {$taxTerm}</font></td>
+          <td style = "padding-left:28px;text-align:right"><font size = "1" >{ts 1=$taxTerm}No %1{/ts}</font></td>
               {/if}
        <td style = "padding-left:28px;text-align:right;"><font size = "1" >{$value.subTotal|crmMoney:$currency}</font></td>
     </tr>
           <tr><td  colspan = "5" style = "color:#F5F5F5;"><hr></hr></td></tr>
           <tr>
       <td colspan = "3"></td>
-      <td style = "padding-left:28px;text-align:right;"><font size = "1">Sub Total</font></td>
+      <td style = "padding-left:28px;text-align:right;"><font size = "1">{ts}Sub Total{/ts}</font></td>
       <td style = "padding-left:28px;text-align:right;"><font size = "1"> {$subTotal|crmMoney:$currency}</font></td>
     </tr>
     {foreach from = $dataArray item = value key = priceset}
             <tr>
         <td colspan = "3"></td>
         {if $priceset}
-          <td style = "padding-left:28px;text-align:right;"><font size = "1"> TOTAL {$taxTerm} {$priceset}%</font></td>
+          <td style = "padding-left:28px;text-align:right;"><font size = "1"> {ts 1=$taxTerm 2=$priceset}TOTAL %1 %2%{/ts}</font></td>
           <td style = "padding-left:28px;text-align:right;"><font size = "1" align = "right">{$value|crmMoney:$currency}</font> </td>
                     {elseif $priceset == 0}
-                      <td style = "padding-left:28px;text-align:right;"><font size = "1">TOTAL NO {$taxTerm}</font></td>
+                      <td style = "padding-left:28px;text-align:right;"><font size = "1">{ts 1=$taxTerm}TOTAL NO %1{/ts}</font></td>
                       <td style = "padding-left:28px;text-align:right;"><font size = "1" align = "right">{$value|crmMoney:$currency}</font> </td>
                   </tr>
         {/if}
 
           <tr>
       <td colspan = "3"></td>
-      <td style = "padding-left:28px;text-align:right;"><b><font size = "1">TOTAL {$defaultCurrency}</font></b></td>
+      <td style = "padding-left:28px;text-align:right;"><b><font size = "1">{ts 1=$defaultCurrency}TOTAL %1{/ts}</font></b></td>
       <td style = "padding-left:28px;text-align:right;"><font size = "1">{$amount|crmMoney:$currency}</font></td>
     </tr>
 
     {if $is_pay_later == 0}
             <tr>
         <td colspan = "3"></td>
-        <td style = "padding-left:28px;text-align:right;"><font size = "1" >LESS Credit to invoice(s)</font></td>
+        <td style = "padding-left:28px;text-align:right;"><font size = "1" >{ts}LESS Credit to invoice(s){/ts}</font></td>
         <td style = "padding-left:28px;text-align:right;"><font size = "1">{$amount|crmMoney:$currency}</font></td>
       </tr>
             <tr>
       </tr>
             <tr>
         <td colspan = "3"></td>
-        <td style = "padding-left:28px;text-align:right;"><b><font size = "1">REMAINING CREDIT</font></b></td>
+        <td style = "padding-left:28px;text-align:right;"><b><font size = "1">{ts}REMAINING CREDIT{/ts}</font></b></td>
         <td style = "padding-left:28px;text-align:right;"><b><font size = "1">{$amountDue|crmMoney:$currency}</font></b></td>
         <td style = "padding-left:28px;"><font size = "1" align = "right"></fonts></td>
       </tr>
 
   <table style = "margin-top:6px;padding-right:20px;font-family: Arial, Verdana, sans-serif" width = "507" border = "0"cellpadding = "-5" cellspacing="19" id = "desc">
     <tr>
-      <td width="60%"><font size = "4" align = "right"><b>CREDIT ADVICE</b><br/><br /><div  style="font-size:10px;max-width:300px;">Please do not pay on this advice. Deduct the amount of this Credit Note
-from your next payment to us</div><br/></font></td>
+      <td width="60%"><font size = "4" align = "right"><b>{ts}CREDIT ADVICE{/ts}</b><br/><br /><div  style="font-size:10px;max-width:300px;">{ts}Please do not pay on this advice. Deduct the amount of this Credit Note from your next payment to us{/ts}</div><br/></font></td>
       <td width="40%">
               <table    align="right" >
     <tr>
             <td colspan = "2"></td>
-      <td><font size = "1" align = "right" style="font-weight:bold;">Customer: </font></td>
+      <td><font size = "1" align = "right" style="font-weight:bold;">{ts}Customer:{/ts} </font></td>
       <td><font size = "1" align = "right" >{$display_name}</font></td>
     </tr>
     <tr>
       <td colspan = "2"></td>
-      <td><font size = "1" align = "right" style="font-weight:bold;">Credit Note#: </font></td>
+      <td><font size = "1" align = "right" style="font-weight:bold;">{ts}Credit Note#:{/ts} </font></td>
       <td><font size = "1" align = "right">{$creditnote_id}</font></td>
     </tr>
     <tr><td  colspan = "5"style = "color:#F5F5F5;"><hr></hr></td></tr>
     <tr>
                   <td colspan = "2"></td>
-      <td><font size = "1" align = "right" style="font-weight:bold;">Credit Amount:</font></td>
+      <td><font size = "1" align = "right" style="font-weight:bold;">{ts}Credit Amount:{/ts}</font></td>
       <td width='50px'><font size = "1" align = "right" style="font-weight:bold;">{$amount|crmMoney:$currency}</font></td>
     </tr>
               </table>
index 84738868a131a6aaa9447abe4d615c0b08ef003d..0fea47f064b7f13ebc8c70741d302a4793fba034 100644 (file)
@@ -21,6 +21,7 @@
 
   <tr>
    <td>
+    <p>{contact.email_greeting}</p>
 
     {if $event.confirm_email_text AND (not $isOnWaitlist AND not $isRequireApproval)}
      <p>{$event.confirm_email_text|htmlize}</p>
index d1a5a52d74c4093d0929d0c779fcfa373e2165ac..1a7daeb2d82ff9a3337a12178bb83c877f4f9c84 100644 (file)
@@ -1,3 +1,4 @@
+{contact.email_greeting}
 {if $event.confirm_email_text AND (not $isOnWaitlist AND not $isRequireApproval)}
 {$event.confirm_email_text}
 {/if}
index 4de01793ed94c285eb554b4f315a4e4b2b13f834..56db8a152c2cf40b6c6a088ef02860b4ceaa7925 100644 (file)
@@ -25,7 +25,7 @@
 
   <tr>
    <td>
-  <p>Dear {contact.display_name},</p>
+  <p>{contact.email_greeting},</p>
 
     {if $event.confirm_email_text AND (not $isOnWaitlist AND not $isRequireApproval)}
      <p>{$event.confirm_email_text|htmlize}</p>
index e6b33f79b9e77b4e73828bfee605b76a74c0f577..403c2a9caa152a801c43f98225f2c8b03ffeec58 100644 (file)
@@ -1,4 +1,4 @@
-Dear {contact.display_name},
+{contact.email_greeting},
 
 {if $event.confirm_email_text AND (not $isOnWaitlist AND not $isRequireApproval)}
 {$event.confirm_email_text}