Skip to content

Instantly share code, notes, and snippets.

@esimonetti
Created August 23, 2019 10:28
Show Gist options
  • Save esimonetti/36ab4ae95eb91a218a16f42d0bb2409a to your computer and use it in GitHub Desktop.
Save esimonetti/36ab4ae95eb91a218a16f42d0bb2409a to your computer and use it in GitHub Desktop.
Enable Cases on Portal for B2C. Test with: patch -p1 --dry-run < ../enable_cases_on_portal_for_b2c.diff Install with: patch -p1 < ../enable_cases_on_portal_for_b2c.diff
diff -auNr -x cache -x upload -x config.php -x config_override.php -x 'uk_UA*' -x 'tr_TR*' -x 'sv_SE*' -x 'sr_RS*' -x 'sq_AL*' -x 'sk_SK*' -x 'ru_RU*' -x 'ro_RO*' -x 'pt_PT*' -x 'pt_BR*' -x 'pl_PL*' -x 'nl_NL*' -x 'nb_NO*' -x 'lv_LV*' -x 'ko_KR*' -x 'ja_JP*' -x 'it_it*' -x 'hu_HU*' -x 'he_IL*' -x 'fr_FR*' -x 'fi_FI*' -x 'et_EE*' -x 'es_LA*' -x 'es_ES*' -x 'en_UK*' -x 'el_EL*' -x 'de_DE*' -x 'da_DK*' -x 'cs_CZ*' -x 'ca_ES*' -x 'bg_BG*' -x 'ar_SA*' -x 'lt_LT*' -x 'zh_TW*' -x 'zh_CN*' -x 'th_TH*' -x 'hr_HR*' '--ignore-matching-lines=// created: ' '--ignore-matching-lines=//created: ' -x '*.php_1*' -x '*.ext.php' -x '*blowfish*' -x .gitignore -x .gitattributes -x .htaccess -x '*.DS_Store' -x '*.git*' -x vendor -x '*.log' -x '*.zip' -x '*.sql' -x '*.tgz' -x '*.md' -x '*.filepart' -x config.js -x working -x modulebuilder sugarMango/custom/Extension/modules/Cases/Ext/clients/base/views/record/accounts_not_required.php sugar/custom/Extension/modules/Cases/Ext/clients/base/views/record/accounts_not_required.php
--- sugarMango/custom/Extension/modules/Cases/Ext/clients/base/views/record/accounts_not_required.php 1970-01-01 10:00:00.000000000 +1000
+++ sugar/custom/Extension/modules/Cases/Ext/clients/base/views/record/accounts_not_required.php 2019-08-23 20:18:41.870760755 +1000
@@ -0,0 +1,22 @@
+<?php
+
+$module = 'Cases';
+$targetView = 'record';
+$targetFieldName = 'account_name';
+$newField = [
+ 'name' => $targetFieldName,
+ 'required' => false,
+];
+
+if (!empty($viewdefs[$module]['base']['view'][$targetView]['panels'])) {
+ $panels = $viewdefs[$module]['base']['view'][$targetView]['panels'];
+ foreach ($panels as $pindex => $panel) {
+ if (!empty($panel['fields'])) {
+ foreach ($panel['fields'] as $findex => $field) {
+ if ($field === $targetFieldName || (!empty($field['name']) && $field['name'] === $targetFieldName)) {
+ $viewdefs[$module]['base']['view'][$targetView]['panels'][$pindex]['fields'][$findex] = $newField;
+ }
+ }
+ }
+ }
+}
diff -auNr -x cache -x upload -x config.php -x config_override.php -x 'uk_UA*' -x 'tr_TR*' -x 'sv_SE*' -x 'sr_RS*' -x 'sq_AL*' -x 'sk_SK*' -x 'ru_RU*' -x 'ro_RO*' -x 'pt_PT*' -x 'pt_BR*' -x 'pl_PL*' -x 'nl_NL*' -x 'nb_NO*' -x 'lv_LV*' -x 'ko_KR*' -x 'ja_JP*' -x 'it_it*' -x 'hu_HU*' -x 'he_IL*' -x 'fr_FR*' -x 'fi_FI*' -x 'et_EE*' -x 'es_LA*' -x 'es_ES*' -x 'en_UK*' -x 'el_EL*' -x 'de_DE*' -x 'da_DK*' -x 'cs_CZ*' -x 'ca_ES*' -x 'bg_BG*' -x 'ar_SA*' -x 'lt_LT*' -x 'zh_TW*' -x 'zh_CN*' -x 'th_TH*' -x 'hr_HR*' '--ignore-matching-lines=// created: ' '--ignore-matching-lines=//created: ' -x '*.php_1*' -x '*.ext.php' -x '*blowfish*' -x .gitignore -x .gitattributes -x .htaccess -x '*.DS_Store' -x '*.git*' -x vendor -x '*.log' -x '*.zip' -x '*.sql' -x '*.tgz' -x '*.md' -x '*.filepart' -x config.js -x working -x modulebuilder sugarMango/custom/Extension/modules/Cases/Ext/Vardefs/accounts_not_required.php sugar/custom/Extension/modules/Cases/Ext/Vardefs/accounts_not_required.php
--- sugarMango/custom/Extension/modules/Cases/Ext/Vardefs/accounts_not_required.php 1970-01-01 10:00:00.000000000 +1000
+++ sugar/custom/Extension/modules/Cases/Ext/Vardefs/accounts_not_required.php 2019-08-23 20:20:36.994763029 +1000
@@ -0,0 +1,3 @@
+<?php
+
+$dictionary['Case']['fields']['account_name']['required'] = false;
diff -auNr -x cache -x upload -x config.php -x config_override.php -x 'uk_UA*' -x 'tr_TR*' -x 'sv_SE*' -x 'sr_RS*' -x 'sq_AL*' -x 'sk_SK*' -x 'ru_RU*' -x 'ro_RO*' -x 'pt_PT*' -x 'pt_BR*' -x 'pl_PL*' -x 'nl_NL*' -x 'nb_NO*' -x 'lv_LV*' -x 'ko_KR*' -x 'ja_JP*' -x 'it_it*' -x 'hu_HU*' -x 'he_IL*' -x 'fr_FR*' -x 'fi_FI*' -x 'et_EE*' -x 'es_LA*' -x 'es_ES*' -x 'en_UK*' -x 'el_EL*' -x 'de_DE*' -x 'da_DK*' -x 'cs_CZ*' -x 'ca_ES*' -x 'bg_BG*' -x 'ar_SA*' -x 'lt_LT*' -x 'zh_TW*' -x 'zh_CN*' -x 'th_TH*' -x 'hr_HR*' '--ignore-matching-lines=// created: ' '--ignore-matching-lines=//created: ' -x '*.php_1*' -x '*.ext.php' -x '*blowfish*' -x .gitignore -x .gitattributes -x .htaccess -x '*.DS_Store' -x '*.git*' -x vendor -x '*.log' -x '*.zip' -x '*.sql' -x '*.tgz' -x '*.md' -x '*.filepart' -x config.js -x working -x modulebuilder sugarMango/custom/src/Portal/Settings.php sugar/custom/src/Portal/Settings.php
--- sugarMango/custom/src/Portal/Settings.php 1970-01-01 10:00:00.000000000 +1000
+++ sugar/custom/src/Portal/Settings.php 2019-08-23 19:36:53.811625212 +1000
@@ -0,0 +1,13 @@
+<?php
+
+namespace Sugarcrm\Sugarcrm\custom\Portal;
+
+use Sugarcrm\Sugarcrm\Portal\Settings as OriginalPortalSettings;
+
+class Settings extends OriginalPortalSettings
+{
+ public function allowCasesForContactsWithoutAccount() : bool
+ {
+ return true;
+ }
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment