]> git.mxchange.org Git - friendica.git/commitdiff
"Company" is now "Organisation" and there is an auto update
authorMichael Vogel <ike@pirati.ca>
Mon, 26 Sep 2016 19:35:01 +0000 (19:35 +0000)
committerMichael Vogel <ike@pirati.ca>
Mon, 26 Sep 2016 19:35:01 +0000 (19:35 +0000)
boot.php
mod/settings.php
update.php
view/templates/pagetypes.tpl

index 0ef450f3e2afb951728d79342e449b0e89f57847..44374eefe62163c68e2a64bf559167e4ea44df05 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -187,7 +187,7 @@ define ( 'PAGE_PRVGROUP',          5 );
  * @{
  */
 define ( 'ACCOUNT_TYPE_PERSON',      0 );
-define ( 'ACCOUNT_TYPE_COMPANY',     1 );
+define ( 'ACCOUNT_TYPE_ORGANISATION',1 );
 define ( 'ACCOUNT_TYPE_NEWS',        2 );
 define ( 'ACCOUNT_TYPE_COMMUNITY',   3 );
 /** @}*/
index eb6c53e58dfc885dbd5e84e2629bfeb8be360788..908d828456650584f7cdc47874db9895ffdb261d 100644 (file)
@@ -457,7 +457,7 @@ function settings_post(&$a) {
        // Adjust the page flag if the account type doesn't fit to the page flag.
        if (($account_type == ACCOUNT_TYPE_PERSON) AND !in_array($page_flags, array(PAGE_NORMAL, PAGE_SOAPBOX, PAGE_FREELOVE)))
                $page_flags = PAGE_NORMAL;
-       elseif (($account_type == ACCOUNT_TYPE_COMPANY) AND !in_array($page_flags, array(PAGE_SOAPBOX)))
+       elseif (($account_type == ACCOUNT_TYPE_ORGANISATION) AND !in_array($page_flags, array(PAGE_SOAPBOX)))
                $page_flags = PAGE_SOAPBOX;
        elseif (($account_type == ACCOUNT_TYPE_NEWS) AND !in_array($page_flags, array(PAGE_SOAPBOX)))
                $page_flags = PAGE_SOAPBOX;
@@ -1077,24 +1077,31 @@ function settings_content(&$a) {
        if(! strlen($a->user['timezone']))
                $timezone = date_default_timezone_get();
 
+       // Set the account type to "Community" when the page is a community page but the account type doesn't fit
+       // This is only happening on the first visit after the update
+       if (in_array($a->user['page-flags'], array(PAGE_COMMUNITY, PAGE_PRVGROUP)) AND
+               ($a->user['account-type'] != ACCOUNT_TYPE_COMMUNITY))
+               $a->user['account-type'] = ACCOUNT_TYPE_COMMUNITY;
+
        $pageset_tpl = get_markup_template('pagetypes.tpl');
 
        $pagetype = replace_macros($pageset_tpl, array(
-               '$account_types'=> t("Account Types"),
-               '$user'         => t("Personal Page Subtypes"),
-               '$community'    => t("Community Forum Subtypes"),
-               '$account_type' => $a->user['account-type'],
-               '$type_person'  => ACCOUNT_TYPE_PERSON,
-               '$type_company' => ACCOUNT_TYPE_COMPANY,
-               '$type_news'    => ACCOUNT_TYPE_NEWS,
-               '$type_community' => ACCOUNT_TYPE_COMMUNITY,
+               '$account_types'        => t("Account Types"),
+               '$user'                 => t("Personal Page Subtypes"),
+               '$community'            => t("Community Forum Subtypes"),
+               '$account_type'         => $a->user['account-type'],
+               '$type_person'          => ACCOUNT_TYPE_PERSON,
+               '$type_organisation'    => ACCOUNT_TYPE_ORGANISATION,
+               '$type_news'            => ACCOUNT_TYPE_NEWS,
+               '$type_community'       => ACCOUNT_TYPE_COMMUNITY,
+
                '$account_person'       => array('account-type', t('Personal Page'), ACCOUNT_TYPE_PERSON,
                                                                        t('This account is a regular personal profile'),
                                                                        ($a->user['account-type'] == ACCOUNT_TYPE_PERSON)),
 
-               '$account_company'      => array('account-type', t('Company Page'), ACCOUNT_TYPE_COMPANY,
-                                                                       t('This account is a company profile'),
-                                                                       ($a->user['account-type'] == ACCOUNT_TYPE_COMPANY)),
+               '$account_organisation' => array('account-type', t('Organisation Page'), ACCOUNT_TYPE_ORGANISATION,
+                                                                       t('This account is a profile for an organisation'),
+                                                                       ($a->user['account-type'] == ACCOUNT_TYPE_ORGANISATION)),
 
                '$account_news'         => array('account-type', t('News Page'), ACCOUNT_TYPE_NEWS,
                                                                        t('This account is a news account/reflector'),
index bd37e382e1f10fd5d5e725b37f389c387e1cd44e..31f7852a2f12b5c069ad63b1b903fdb7cb9e9046 100644 (file)
@@ -1723,3 +1723,8 @@ function update_1190() {
        return UPDATE_SUCCESS;
 
 }
+
+function update_1202() {
+       $r = q("UPDATE `user` SET `account-type` = %d WHERE `page-flags` IN (%d, %d)",
+               dbesc(ACCOUNT_TYPE_COMMUNITY), dbesc(PAGE_COMMUNITY), dbesc(PAGE_PRVGROUP));
+}
index ddb5f07b6b9dae976fcf8af0ed78799284c33678..b970f7745f28ec107d37f36b071ba5083a74518f 100644 (file)
@@ -1,6 +1,6 @@
 <h4>{{$account_types}}</h4>
 {{include file="field_radio.tpl" field=$account_person}}
-{{include file="field_radio.tpl" field=$account_company}}
+{{include file="field_radio.tpl" field=$account_organisation}}
 {{include file="field_radio.tpl" field=$account_news}}
 {{include file="field_radio.tpl" field=$account_community}}
 
@@ -11,7 +11,7 @@
        {{include file="field_radio.tpl" field=$page_freelove}}
 {{/if}}
 
-{{if $account_type == $type_company}}
+{{if $account_type == $type_organisation}}
        <input type='hidden' name='page-flags' value='1'>
 {{/if}}