<commit_before>%{--
  JBILLING CONFIDENTIAL
  _____________________

  [2003] - [2012] Enterprise jBilling Software Ltd.
  All Rights Reserved.

  NOTICE:  All information contained herein is, and remains
  the property of Enterprise jBilling Software.
  The intellectual and technical concepts contained
  herein are proprietary to Enterprise jBilling Software
  and are protected by trade secret or copyright law.
  Dissemination of this information or reproduction of this material
  is strictly forbidden.
  --}%

<%@ page import="com.sapienter.jbilling.server.process.db.PeriodUnitDTO; com.sapienter.jbilling.server.customer.CustomerBL; com.sapienter.jbilling.server.user.UserBL; com.sapienter.jbilling.common.Constants; com.sapienter.jbilling.server.user.contact.db.ContactDTO; com.sapienter.jbilling.server.util.Util"%>

<html>
<head>
    <meta name="layout" content="main" />
</head>
<body>
<div class="form-edit">

    <g:set var="customer" value="${user.customer}"/>
    <g:set var="contact" value="${ContactDTO.findByUserId(user.id)}"/>

    <div class="heading">
        <strong>
            <g:if test="${contact && (contact.firstName || contact.lastName)}">
                ${contact.firstName} ${contact.lastName}
            </g:if>
            <g:else>
                ${user.userName}
            </g:else>
            <em><g:if test="${contact}">${contact.organizationName}</g:if></em>
        </strong>
    </div>

    <div class="form-hold">
        <fieldset>
            <!-- user details -->
            <div class="form-columns">
                <div class="column">
                    <g:applyLayout name="form/text">
                        <content tag="label"><g:message code="customer.detail.user.username"/></content>
                        <span><g:link controller="customer" action="list" id="${user.id}">${user.userName}</g:link></span>
                    </g:applyLayout>

                    <g:applyLayout name="form/text">
                        <content tag="label">Last Login</content>
                        <span><g:formatDate date="${user.lastLogin}" formatName="date.pretty.format"/></span>
                    </g:applyLayout>

                    <g:applyLayout name="form/text">
                        <content tag="label"><g:message code="customer.detail.contact.telephone"/></content>
                        <span>
                            <g:phoneNumber countryCode="${contact?.phoneCountryCode}" 
                                areaCode="${contact?.phoneAreaCode}" number="${contact?.phoneNumber}"/>
                        </span>
                    </g:applyLayout>

                    <g:applyLayout name="form/text">
                        <content tag="label"><g:message code="customer.detail.contact.fax"/></content>
                        <span>
                            <g:if test="${contact?.faxCountryCode}">${contact?.faxCountryCode}.</g:if>
                            <g:if test="${contact?.faxAreaCode}">${contact?.faxAreaCode}.</g:if>
                            ${contact?.faxNumber}
                        </span>
                    </g:applyLayout>

                    <g:applyLayout name="form/text">
                        <content tag="label"><g:message code="customer.detail.user.email"/></content>
                        <span><a href="mailto:${contact?.email}">${contact?.email}</a></span>
                    </g:applyLayout>

                    <g:applyLayout name="form/text">
                        <content tag="label"><g:message code="customer.detail.user.status"/></content>
                        <span>${user.userStatus.getDescription(session['language_id'])}</span>
                    </g:applyLayout>

                    <g:applyLayout name="form/text">
                        <content tag="label"><g:message code="customer.detail.user.subscriber.status"/></content>
                        <span>${user.subscriberStatus.getDescription(session['language_id'])}</span>
                    </g:applyLayout>

                    <g:applyLayout name="form/text">
                        <content tag="label"><g:message code="prompt.user.language"/></content>
                        <span>${user.language.getDescription()}</span>
                    </g:applyLayout>

                    <g:applyLayout name="form/text">
                        <content tag="label"><g:message code="prompt.user.currency"/></content>
                        <span>${user.currency.getDescription(session['language_id'])}</span>
                    </g:applyLayout>

                    <g:applyLayout name="form/text">
                        <content tag="label"><g:message code="prompt.exclude.ageing"/></content>
                        <span><g:formatBoolean boolean="${customer?.excludeAging > 0}"/></span>
                    </g:applyLayout>
                </div>

                <div class="column">
                    <g:applyLayout name="form/text">
                        <content tag="label"><g:message code="customer.detail.user.user.id"/></content>
                        <span><g:link controller="customer" action="list" id="${user.id}">${user.id}</g:link></span>
                    </g:applyLayout>

                    <g:applyLayout name="form/text">
                        <content tag="label"><g:message code="customer.detail.user.type"/></content>
                        <g:set var="mainRole" value="${user.roles.asList()?.min{ it.id }}"/>
                        <span title="${mainRole.getDescription(session['language_id'])}">${mainRole.getTitle(session['language_id'])}</span>
                    </g:applyLayout>

                    <g:applyLayout name="form/text">
                        <content tag="label"><g:message code="prompt.partner.id"/></content>
                        <span>${user.partner?.id}</span>
                    </g:applyLayout>

                    <!-- custom contact fields -->
                    <g:each var="ccf" in="${company.contactFieldTypes?.sort{ it.id }}">
                        <g:set var="field" value="${contact?.fields?.find{ it.type.id == ccf.id }}"/>

                        <g:applyLayout name="form/text">
                            <content tag="label"><g:message code="${ccf.getDescription(session['language_id'])}"/></content>
                            <span>${field?.content}</span>
                        </g:applyLayout>
                    </g:each>

                    <g:applyLayout name="form/text">
                        <content tag="label"><g:message code="customer.detail.user.next.invoice.date"/></content>
                        <g:set var="nextInvoiceDate" value="${new UserBL(user.id).getNextInvoiceDate()}"/>

                        <g:if test="${nextInvoiceDate}">
                            <span><g:formatDate date="${nextInvoiceDate}" formatName="date.pretty.format"/></span>
                        </g:if>
                        <g:else>
                            <g:message code="prompt.no.active.orders"/>
                        </g:else>
                    </g:applyLayout><commit_msg>Customer inspectof meta field list values<commit_after>%{--
  JBILLING CONFIDENTIAL
  _____________________

  [2003] - [2012] Enterprise jBilling Software Ltd.
  All Rights Reserved.

  NOTICE:  All information contained herein is, and remains
  the property of Enterprise jBilling Software.
  The intellectual and technical concepts contained
  herein are proprietary to Enterprise jBilling Software
  and are protected by trade secret or copyright law.
  Dissemination of this information or reproduction of this material
  is strictly forbidden.
  --}%

<%@ page import="com.sapienter.jbilling.server.metafields.db.DataType; com.sapienter.jbilling.server.process.db.PeriodUnitDTO; com.sapienter.jbilling.server.customer.CustomerBL; com.sapienter.jbilling.server.user.UserBL; com.sapienter.jbilling.common.Constants; com.sapienter.jbilling.server.user.contact.db.ContactDTO; com.sapienter.jbilling.server.util.Util"%>

<html>
<head>
    <meta name="layout" content="main" />
</head>
<body>
<div class="form-edit">

    <g:set var="customer" value="${user.customer}"/>
    <g:set var="contact" value="${ContactDTO.findByUserId(user.id)}"/>

    <div class="heading">
        <strong>
            <g:if test="${contact && (contact.firstName || contact.lastName)}">
                ${contact.firstName} ${contact.lastName}
            </g:if>
            <g:else>
                ${user.userName}
            </g:else>
            <em><g:if test="${contact}">${contact.organizationName}</g:if></em>
        </strong>
    </div>

    <div class="form-hold">
        <fieldset>
            <!-- user details -->
            <div class="form-columns">
                <div class="column">
                    <g:applyLayout name="form/text">
                        <content tag="label"><g:message code="customer.detail.user.username"/></content>
                        <span><g:link controller="customer" action="list" id="${user.id}">${user.userName}</g:link></span>
                    </g:applyLayout>

                    <g:applyLayout name="form/text">
                        <content tag="label">Last Login</content>
                        <span><g:formatDate date="${user.lastLogin}" formatName="date.pretty.format"/></span>
                    </g:applyLayout>

                    <g:applyLayout name="form/text">
                        <content tag="label"><g:message code="customer.detail.contact.telephone"/></content>
                        <span>
                            <g:phoneNumber countryCode="${contact?.phoneCountryCode}" 
                                areaCode="${contact?.phoneAreaCode}" number="${contact?.phoneNumber}"/>
                        </span>
                    </g:applyLayout>

                    <g:applyLayout name="form/text">
                        <content tag="label"><g:message code="customer.detail.contact.fax"/></content>
                        <span>
                            <g:if test="${contact?.faxCountryCode}">${contact?.faxCountryCode}.</g:if>
                            <g:if test="${contact?.faxAreaCode}">${contact?.faxAreaCode}.</g:if>
                            ${contact?.faxNumber}
                        </span>
                    </g:applyLayout>

                    <g:applyLayout name="form/text">
                        <content tag="label"><g:message code="customer.detail.user.email"/></content>
                        <span><a href="mailto:${contact?.email}">${contact?.email}</a></span>
                    </g:applyLayout>

                    <g:applyLayout name="form/text">
                        <content tag="label"><g:message code="customer.detail.user.status"/></content>
                        <span>${user.userStatus.getDescription(session['language_id'])}</span>
                    </g:applyLayout>

                    <g:applyLayout name="form/text">
                        <content tag="label"><g:message code="customer.detail.user.subscriber.status"/></content>
                        <span>${user.subscriberStatus.getDescription(session['language_id'])}</span>
                    </g:applyLayout>

                    <g:applyLayout name="form/text">
                        <content tag="label"><g:message code="prompt.user.language"/></content>
                        <span>${user.language.getDescription()}</span>
                    </g:applyLayout>

                    <g:applyLayout name="form/text">
                        <content tag="label"><g:message code="prompt.user.currency"/></content>
                        <span>${user.currency.getDescription(session['language_id'])}</span>
                    </g:applyLayout>

                    <g:applyLayout name="form/text">
                        <content tag="label"><g:message code="prompt.exclude.ageing"/></content>
                        <span><g:formatBoolean boolean="${customer?.excludeAging > 0}"/></span>
                    </g:applyLayout>
                </div>

                <div class="column">
                    <g:applyLayout name="form/text">
                        <content tag="label"><g:message code="customer.detail.user.user.id"/></content>
                        <span><g:link controller="customer" action="list" id="${user.id}">${user.id}</g:link></span>
                    </g:applyLayout>

                    <g:applyLayout name="form/text">
                        <content tag="label"><g:message code="customer.detail.user.type"/></content>
                        <g:set var="mainRole" value="${user.roles.asList()?.min{ it.id }}"/>
                        <span title="${mainRole.getDescription(session['language_id'])}">${mainRole.getTitle(session['language_id'])}</span>
                    </g:applyLayout>

                    <g:applyLayout name="form/text">
                        <content tag="label"><g:message code="prompt.partner.id"/></content>
                        <span>${user.partner?.id}</span>
                    </g:applyLayout>

                    <!-- custom contact fields -->
                    <g:if test="${customer?.metaFields}">
                        <!-- meta fields -->
                        <g:each var="metaField" in="${customer?.metaFields?.sort{ it.field.displayOrder }}">
                            <g:if test="${!metaField.field.disabled}">
                                <g:set var="fieldValue" value="${metaField.getValue()}"/>

                                <g:applyLayout name="form/text">
                                    <content tag="label">${metaField.field.name}</content>
                                    <span title="${metaField.field.name}">
                                        <g:if test="${metaField.field.getDataType() == DataType.DATE}">
                                            <g:formatDate date="${fieldValue}" formatName="date.pretty.format"/>
                                        </g:if>
                                        <g:elseif test="${metaField.field.getDataType() == DataType.LIST}">
                                            ${fieldValue?.join(', ')}
                                        </g:elseif>
                                        <g:else>
                                            ${fieldValue}
                                        </g:else>
                                    </span>
                                </g:applyLayout>

                            </g:if>
                        </g:each>
                    </g:if>

                    <g:applyLayout name="form/text">
                        <content tag="label"><g:message code="customer.detail.user.next.invoice.date"/></content>
                        <g:set var="nextInvoiceDate" value="${new UserBL(user.id).getNextInvoiceDate()}"/>

                        <g:if test="${nextInvoiceDate}">
                            <span><g:formatDate date="${nextInvoiceDate}" formatName="date.pretty.format"/></span>
                        </g:if>
                        <g:else>
                            <g:message code="prompt.no.active.orders"/>
                        </g:else>
                    </g:applyLayout>
{'fraction_non_alphanumeric': 0.1543258500722069, 'fraction_numerical': 0.0011815675462780622, 'mean_word_length': 1.6217518499397694, 'pattern_counts': {'":': 0, '<': 328, '<?xml version=': 0, '>': 330, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 15, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4930853', 'n_tokens_mistral': 4013, 'n_tokens_neox': 3772, 'n_words': 565}