function content_56962c9ceece3($_smarty_tpl)
    {
        if ($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getName() == 'date_start') {
            $_smarty_tpl->tpl_vars['DATE_FIELD'] = new Smarty_variable($_smarty_tpl->tpl_vars['FIELD_MODEL']->value, null, 0);
            $_smarty_tpl->tpl_vars['MODULE_MODEL'] = new Smarty_variable($_smarty_tpl->tpl_vars['RECORD_STRUCTURE_MODEL']->value->getModule(), null, 0);
            $_smarty_tpl->tpl_vars['TIME_FIELD'] = new Smarty_variable($_smarty_tpl->tpl_vars['MODULE_MODEL']->value->getField('time_start'), null, 0);
        } elseif ($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->getName() == 'due_date') {
            $_smarty_tpl->tpl_vars['DATE_FIELD'] = new Smarty_variable($_smarty_tpl->tpl_vars['FIELD_MODEL']->value, null, 0);
            $_smarty_tpl->tpl_vars['MODULE_MODEL'] = new Smarty_variable($_smarty_tpl->tpl_vars['RECORD_STRUCTURE_MODEL']->value->getModule(), null, 0);
            $_smarty_tpl->tpl_vars['TIME_FIELD'] = new Smarty_variable($_smarty_tpl->tpl_vars['MODULE_MODEL']->value->getField('time_end'), null, 0);
        }
        $_smarty_tpl->tpl_vars['DATE_TIME_VALUE'] = new Smarty_variable($_smarty_tpl->tpl_vars['FIELD_MODEL']->value->get('fieldvalue'), null, 0);
        $_smarty_tpl->tpl_vars['DATE_TIME_COMPONENTS'] = new Smarty_variable(explode(' ', $_smarty_tpl->tpl_vars['DATE_TIME_VALUE']->value), null, 0);
        $_smarty_tpl->tpl_vars['TIME_FIELD'] = new Smarty_variable($_smarty_tpl->tpl_vars['TIME_FIELD']->value->set('fieldvalue', $_smarty_tpl->tpl_vars['DATE_TIME_COMPONENTS']->value[1]), null, 0);
        $_smarty_tpl->tpl_vars['DATE_TIME_CONVERTED_VALUE'] = new Smarty_variable(DateTimeField::convertToUserTimeZone($_smarty_tpl->tpl_vars['DATE_TIME_VALUE']->value)->format('Y-m-d H:i:s'), null, 0);
        $_smarty_tpl->tpl_vars['DATE_TIME_COMPONENTS'] = new Smarty_variable(explode(' ', $_smarty_tpl->tpl_vars['DATE_TIME_CONVERTED_VALUE']->value), null, 0);
        $_smarty_tpl->tpl_vars['DATE_FIELD'] = new Smarty_variable($_smarty_tpl->tpl_vars['DATE_FIELD']->value->set('fieldvalue', $_smarty_tpl->tpl_vars['DATE_TIME_COMPONENTS']->value[0]), null, 0);
        ?>
<div><?php 
        echo $_smarty_tpl->getSubTemplate(vtemplate_path('uitypes/Date.tpl', $_smarty_tpl->tpl_vars['MODULE']->value), $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array('BLOCK_FIELDS' => $_smarty_tpl->tpl_vars['BLOCK_FIELDS']->value, 'FIELD_MODEL' => $_smarty_tpl->tpl_vars['DATE_FIELD']->value), 0);
        ?>
</div><div><?php 
        echo $_smarty_tpl->getSubTemplate(vtemplate_path('uitypes/Time.tpl', $_smarty_tpl->tpl_vars['MODULE']->value), $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array('BLOCK_FIELDS' => $_smarty_tpl->tpl_vars['BLOCK_FIELDS']->value, 'FIELD_MODEL' => $_smarty_tpl->tpl_vars['TIME_FIELD']->value), 0);
        ?>
</div><?php 
    }
 public function beforeGetTaskform($viewer)
 {
     global $adb, $vtiger_current_version;
     if (version_compare($vtiger_current_version, '5.3.0', '>=')) {
         // I have to respect Users timezone
         $setter = $this->get("setter");
         if (!empty($setter) && is_array($setter)) {
             foreach ($setter as $key => $field) {
                 if (strpos($field["value"], "\$") === false && ($field["field"] == "time_start" || $field["field"] == "time_end")) {
                     $date = DateTimeField::convertToUserTimeZone(date("Y-m-d") . " " . $field["value"]);
                     $setter[$key]["value"] = $date->format("H:i");
                 }
             }
         }
         $this->set("setter", $setter);
     }
     parent::beforeGetTaskform($viewer);
 }
예제 #3
0
 function retrieve_entity_info($record, $module)
 {
     parent::retrieve_entity_info($record, $module);
     $start = DateTimeField::convertToUserTimeZone($this->column_fields['date_start'] . ' ' . $this->column_fields['time_start']);
     $this->column_fields['date_start'] = $start->format('Y-m-d');
     $end = DateTimeField::convertToUserTimeZone($this->column_fields['due_date'] . ' ' . $this->column_fields['time_end']);
     $this->column_fields['due_date'] = $end->format('Y-m-d');
 }
예제 #4
0
 private function x10($x92, $x93, $x94 = false, $x95 = false)
 {
     global $x15d, $x15e, $x15f, $x160, $x161, $x162, $x163, $x164, $x165, $x166, $x167, $x168, $x169, $x16a, $x16b, $x16c, $x16d, $x16e, $x16f, $x170, $x171, $x172, $x173, $x174, $x175, $x176, $x177, $x178;
     $x96 = Users_Record_Model::getCurrentUserModel();
     $x97 = array("related_to", "relatedto", "parent_id", "parentid", "product_id", "productid", "service_id", "serviceid", "vendor_id", "product", "account", "invoiceid", "linktoaccountscontacts", "projectid", "sc_related_to");
     if ($x95 !== false) {
         $x98 = array();
     }
     $x51 = getTabid($x92);
     $x99 = $x92;
     if ($x94 === false) {
         $x9a = "";
     } else {
         $x9a = "R_";
         if ($x94 !== true) {
             $x99 = $x94;
         }
     }
     $x9b = array();
     $x9c = array();
     $x9d = array();
     $x9e = array();
     $x9f = array();
     $xa0 = array();
     $xa1 = array();
     if ($x51 == '9') {
         $x3d = "SELECT fieldname, uitype FROM vtiger_field WHERE tabid IN (9,16)";
     } else {
         $x3d = "SELECT fieldname, uitype FROM vtiger_field WHERE tabid = '" . $x51 . "'";
     }
     $x3e = self::$x0f->query($x3d);
     while ($x42 = self::$x0f->fetchByAssoc($x3e)) {
         switch ($x42['uitype']) {
             case '19':
             case '20':
             case '21':
             case '24':
                 $x9d[] = $x42['fieldname'];
                 break;
             case '5':
             case '6':
             case '23':
             case '70':
                 $x9e[] = $x42['fieldname'];
                 break;
             case '15':
                 $x9c[] = $x42['fieldname'];
                 break;
             case '56':
                 $x9b[] = $x42['fieldname'];
                 break;
             case '33':
                 $x9f[] = $x42['fieldname'];
                 break;
             case '71':
                 $xa0[] = $x42['fieldname'];
                 break;
             case '9':
                 $xa1[] = $x42['fieldname'];
                 break;
         }
         if ($x42["fieldname"] == "salutationtype") {
             $x9c[] = $x42["fieldname"];
         }
     }
     foreach ($x93->column_fields as $xa2 => $x83) {
         if ($xa2 == "assigned_user_id") {
             $x83 = $this->x1e($x83);
         } elseif ($xa2 == "account_id") {
             $x83 = getAccountName($x83);
         } elseif ($xa2 == "potential_id") {
             $x83 = getPotentialName($x83);
         } elseif ($xa2 == "contact_id") {
             $x83 = getContactName($x83);
         } elseif ($xa2 == "quote_id") {
             $x83 = getQuoteName($x83);
         } elseif ($xa2 == "salesorder_id") {
             $x83 = getSoName($x83);
         } elseif ($xa2 == "campaignid") {
             $x83 = getCampaignName($x83);
         } elseif ($xa2 == "terms_conditions") {
             $x83 = $this->x25($x83);
         } elseif ($xa2 == "comments") {
             $x83 = $this->x26($x93);
         } elseif ($xa2 == "folderid") {
             $x83 = $this->x27($x83);
         } elseif ($xa2 == "time_start" || $xa2 == "time_end") {
             $xa3 = DateTimeField::convertToUserTimeZone($x83);
             $x83 = $xa3->format('H:i');
         } elseif ($x168($xa2, $x97)) {
             if ($x83 != "") {
                 $xa4 = getSalesEntityType($x83);
                 $xa5 = getEntityName($xa4, $x83);
                 if (!empty($xa5)) {
                     foreach ($xa5 as $xa6) {
                         $x83 = $xa6;
                     }
                 }
                 if ($xa2 == "invoiceid" && $x83 == "0") {
                     $x83 = "";
                 }
             }
         }
         if ($x168($xa2, $x9e)) {
             if ($x92 == "Events" || $x92 == "Calendar") {
                 if ($xa2 == "date_start" && $x93->column_fields["time_start"] != "") {
                     $xa3 = $x93->column_fields['time_start'];
                     $x83 = $x83 . ' ' . $xa3;
                 } elseif ($xa2 == "due_date" && $x93->column_fields["time_end"] != "") {
                     $xa3 = $x93->column_fields['time_end'];
                     $x83 = $x83 . ' ' . $xa3;
                 }
             }
             if ($x83 != "") {
                 $x83 = getValidDisplayDate($x83);
             }
         } elseif ($x168($xa2, $x9c)) {
             if (!$x168($x178($x83), self::$x18)) {
                 $x83 = $this->x20($x83, $x92);
             } else {
                 $x83 = "";
             }
         } elseif ($x168($xa2, $x9b)) {
             if ($x83 == 1) {
                 $x83 = vtranslate('LBL_YES');
             } else {
                 $x83 = vtranslate('LBL_NO');
             }
         } elseif ($x168($xa2, $x9d)) {
             $x83 = $x16d($x83);
             $x83 = $x165($x83, ENT_QUOTES, self::$x11);
         } elseif ($x168($xa2, $x9f)) {
             $x83 = $x173(' |##| ', ', ', $x83);
         } elseif ($x168($xa2, $xa0)) {
             if ($x16a($x83)) {
                 if ($x95 === false) {
                     $xa7 = getCurrencySymbolandCRate($x96->currency_id);
                     $xa8 = $xa7["rate"];
                 } else {
                     $xa8 = $x95["conversion_rate"];
                 }
                 $x83 = $x83 * $xa8;
             }
             $x83 = $this->x23($x83);
         } elseif ($x168($xa2, $xa1)) {
             $x83 = $this->x23($x83);
         }
         if ($x95 !== false) {
             $x98[$x175($x92 . "_" . $xa2)] = $x83;
         } else {
             self::$x21["\$" . $x9a . $x175($x99 . "_" . $xa2) . "\$"] = $x83;
         }
     }
     if ($x95 !== false) {
         return $x98;
     } else {
         $this->x15();
     }
 }
예제 #5
0
파일: Events.php 프로젝트: mslokhat/corebos
                    $Actions[] = "<a target='_new' href='index.php?action=EventDetailView&module=Calendar4You&record=" . $record . "&activity_mode={$activity_mode}&parenttab=Tools'>" . $mod['LBL_DETAIL'] . "</a>";
                }
                if ($Calendar4You->CheckPermissions("EDIT", $record)) {
                    $Actions[] = "<a target='_new' href='index.php?action=EventEditView&module=Calendar4You&record=" . $record . "&activity_mode={$activity_mode}&parenttab=Tools'>" . $app['LNK_EDIT'] . "</a>";
                }
                if (vtlib_isModuleActive('Timecontrol')) {
                    $Actions[] = "<a target='_newtc' href='index.php?action=EditView&module=Timecontrol&calendarrecord={$record}&activity_mode={$activity_mode}'>" . getTranslatedString('LBL_TIME_TAKEN') . '</a>';
                }
                if ($Calendar4You->CheckPermissions("DELETE", $record)) {
                    $Actions[] = "<a href='javascript:void(0)' onclick='EditView.record.value=" . $record . ";EditView.return_module.value=" . '"Calendar4You"; EditView.return_action.value="index";  var confirmMsg = "' . getTranslatedString('NTC_DELETE_CONFIRMATION') . '"; submitFormForActionWithConfirmation("EditView", "Delete", confirmMsg);\'>' . $app['LNK_DELETE'] . '</a>';
                }
                $actions = implode(" | ", $Actions);
                $into_title = $app['LBL_ACTION'] . ": " . $actions . "<hr>" . nl2br($into_title);
            }
            $title = "<font style='font-size:12px'>" . $into_title . "</font>";
            if ($add_more_info) {
                if (count($Event_Info[$event]) > 0) {
                    foreach ($Event_Info[$event] as $CD) {
                        $title .= transferForAddIntoTitle(2, $row, $CD);
                    }
                }
            }
            $convert_date_start = DateTimeField::convertToUserTimeZone($row["date_start"] . " " . $row["time_start"]);
            $user_date_start = $convert_date_start->format('Y-m-d H:i');
            $convert_due_date = DateTimeField::convertToUserTimeZone($row["due_date"] . " " . $row["time_end"]);
            $user_due_date = $convert_due_date->format('Y-m-d H:i');
            $Activities[] = array('id' => $row["crmid"], 'typeid' => $activitytypeid, 'userid' => $userid, 'visibility' => $visibility, 'editable' => $editable, 'activity_mode' => $activity_mode, 'title' => $title, 'start' => $user_date_start, 'end' => $user_due_date, 'allDay' => $allDay, 'url' => "");
        }
    }
}
echo json_encode($Activities);
예제 #6
0
 protected function matchHandler($match)
 {
     ${"GLOBALS"}["xkaopqxzm"] = "match";
     if (count(${${"GLOBALS"}["fzudcyrhgcof"]}) == 2) {
         if (${${"GLOBALS"}["fzudcyrhgcof"]}[0] == "\$current_user_id") {
             ${"GLOBALS"}["pcmwmi"] = "sql";
             ${"GLOBALS"}["ikafodlyvv"] = "result";
             global $current_user, $adb;
             ${${"GLOBALS"}["pcmwmi"]} = "SELECT id FROM vtiger_ws_entity WHERE name = 'Users'";
             $qphgzkamlp = "wsTabId";
             ${${"GLOBALS"}["ikafodlyvv"]} = $adb->query(${${"GLOBALS"}["tmrwyiij"]});
             ${"GLOBALS"}["qtfuoyyj"] = "wsTabId";
             ${$qphgzkamlp} = $adb->query_result(${${"GLOBALS"}["lpwetnmjxv"]}, 0, "id");
             return ${${"GLOBALS"}["qtfuoyyj"]} . "x" . $current_user->id;
         }
         ${${"GLOBALS"}["tjyojamrs"]} = ${${"GLOBALS"}["fzudcyrhgcof"]}[1];
         ${${"GLOBALS"}["mduamvfjsqip"]} = $this->_context->get(${${"GLOBALS"}["tjyojamrs"]});
         if (${${"GLOBALS"}["mduamvfjsqip"]} === false) {
             $fhtdikgbwslw = "fieldname";
             return "\$" . ${$fhtdikgbwslw};
         }
         if (!empty(${${"GLOBALS"}["mduamvfjsqip"]})) {
             return ${${"GLOBALS"}["mduamvfjsqip"]};
         }
     } elseif (substr(${${"GLOBALS"}["xkaopqxzm"]}[0], 0, 2) == "\$[") {
         $dijnlqw = "date";
         $mqgzejwr = "parameter";
         ${"GLOBALS"}["nmvdtxgwlrfi"] = "parameter";
         ${"GLOBALS"}["ttjnpwjeoog"] = "function";
         ${${"GLOBALS"}["nnvfnxph"]} = strtolower(${${"GLOBALS"}["fzudcyrhgcof"]}[3]);
         ${"GLOBALS"}["pwzsndhjqsu"] = "format";
         ${"GLOBALS"}["smpvjojh"] = "time";
         if (count(${${"GLOBALS"}["fzudcyrhgcof"]}) > 4 && ${${"GLOBALS"}["fzudcyrhgcof"]}[4] != "") {
             ${"GLOBALS"}["dpyjijot"] = "i";
             $sotxthjssww = "parameter";
             $cwegxum = "i";
             ${"GLOBALS"}["abvuifgun"] = "i";
             ${$sotxthjssww} = explode(",", ${${"GLOBALS"}["fzudcyrhgcof"]}[6]);
             for (${${"GLOBALS"}["abvuifgun"]} = 0; ${$cwegxum} < count(${${"GLOBALS"}["hcmotgp"]}); ${${"GLOBALS"}["dpyjijot"]}++) {
                 ${"GLOBALS"}["grxhbqfel"] = "parameter";
                 $ligygcuopl = "i";
                 ${"GLOBALS"}["ndjfnng"] = "parameter";
                 ${${"GLOBALS"}["grxhbqfel"]}[${$ligygcuopl}] = trim(${${"GLOBALS"}["ndjfnng"]}[${${"GLOBALS"}["kmptlmxqx"]}], "'\" ");
             }
         } else {
             ${${"GLOBALS"}["hcmotgp"]} = false;
         }
         $jgqwmporwhlx = "parameter";
         ${"GLOBALS"}["vrsthbowou"] = "time";
         $rqvrwfirvnlx = "time";
         ${"GLOBALS"}["bpcyoqq"] = "time";
         ${"GLOBALS"}["ihnsia"] = "parameter";
         ${"GLOBALS"}["fnrwpimqo"] = "parameter";
         $jcrssxzdfxv = "parameter";
         switch (${${"GLOBALS"}["ttjnpwjeoog"]}) {
             case "url":
                 if (${$jcrssxzdfxv} != false && count(${${"GLOBALS"}["ihnsia"]}) > 0) {
                     $mrpmif = "parameter";
                     $dqjrkbsn = "parameter";
                     $jzqqvbm = "parameter";
                     ${$dqjrkbsn}[0] = intval(${${"GLOBALS"}["hcmotgp"]}[0]);
                     ${${"GLOBALS"}["xbpvinrmg"]} = VTEntity::getForId(${$mrpmif}[0]);
                     global $site_URL;
                     return ${${"GLOBALS"}["pvutchkhwqsg"]} . "/index.php?action=DetailView&module=" . $objTMP->getModuleName() . "&record=" . ${$jzqqvbm}[0];
                 }
                 break;
             case "round":
                 ${$jgqwmporwhlx}[0] = VTTemplate::parse(${${"GLOBALS"}["hcmotgp"]}[0], $this->_context);
                 if (count(${${"GLOBALS"}["hcmotgp"]}) == 3 && ${${"GLOBALS"}["hcmotgp"]}[2] == "1") {
                     ${"GLOBALS"}["alckvik"] = "return";
                     ${${"GLOBALS"}["alckvik"]} = \CurrencyField::convertToUserFormat(${${"GLOBALS"}["hcmotgp"]}[0]);
                 } else {
                     ${"GLOBALS"}["vlvxrxrbd"] = "return";
                     ${${"GLOBALS"}["vlvxrxrbd"]} = round(${${"GLOBALS"}["hcmotgp"]}[0], ${${"GLOBALS"}["hcmotgp"]}[1]);
                 }
                 return ${${"GLOBALS"}["eklrhak"]};
                 break;
             case "utctz":
                 ${${"GLOBALS"}["nmvdtxgwlrfi"]}[0] = VTTemplate::parse(${${"GLOBALS"}["hcmotgp"]}[0], $this->_context);
                 ${${"GLOBALS"}["eklrhak"]} = \DateTimeField::convertToDBTimeZone(${${"GLOBALS"}["hcmotgp"]}[0]);
                 return $return->format("H:i:s");
                 break;
             case "dateformat":
                 ${${"GLOBALS"}["hcmotgp"]}[0] = VTTemplate::parse(${${"GLOBALS"}["hcmotgp"]}[0], $this->_context);
                 ${$rqvrwfirvnlx} = strtotime(${${"GLOBALS"}["hcmotgp"]}[0]);
                 ${${"GLOBALS"}["gatkidfjf"]} = ${${"GLOBALS"}["hcmotgp"]}[1];
                 return date(${${"GLOBALS"}["gatkidfjf"]}, ${${"GLOBALS"}["bpcyoqq"]});
                 break;
             case "now":
                 ${${"GLOBALS"}["pwzsndhjqsu"]} = "Y-m-d";
                 ${$dijnlqw} = \DateTimeField::convertToUserTimeZone(date("Y-m-d H:i:s"));
                 ${${"GLOBALS"}["vrsthbowou"]} = strtotime($date->format("Y-m-d H:i:s"));
                 if (${${"GLOBALS"}["fnrwpimqo"]} != false) {
                     if (!empty(${${"GLOBALS"}["hcmotgp"]}[0])) {
                         ${${"GLOBALS"}["okbxsjn"]} += intval(${${"GLOBALS"}["hcmotgp"]}[0]) * 86400;
                     }
                     if (!empty(${${"GLOBALS"}["hcmotgp"]}[1])) {
                         ${"GLOBALS"}["ftrqsw"] = "parameter";
                         $mrgqelzfbcf = "format";
                         ${$mrgqelzfbcf} = ${${"GLOBALS"}["ftrqsw"]}[1];
                     }
                 }
                 return date(${${"GLOBALS"}["gatkidfjf"]}, ${${"GLOBALS"}["smpvjojh"]});
                 break;
             case "entityname":
                 if (${$mqgzejwr} != false) {
                     $cskxkqd = "parameter";
                     $hmnhgfaqeyo = "crmid";
                     $fcuyvjmvnnr = "parameter";
                     $gcsofxly = "parameter";
                     ${$fcuyvjmvnnr}[0] = VTTemplate::parse(${$gcsofxly}[0], $this->_context);
                     if (is_array(${$cskxkqd}[0]) || is_object(${${"GLOBALS"}["hcmotgp"]}[0])) {
                         ${"GLOBALS"}["fnlsgqesiuzo"] = "parameter";
                         throw new \Exception("Wrong input entityname: \$parameter=" . serialize(${${"GLOBALS"}["fnlsgqesiuzo"]}[0]));
                     }
                     ${"GLOBALS"}["bkvmzxylrca"] = "return";
                     ${"GLOBALS"}["vlrkemsbzk"] = "result";
                     if (strpos(${${"GLOBALS"}["hcmotgp"]}[0], "x") !== false) {
                         $tatcdibmrbv = "crmid";
                         $wvomkbuc = "parameter";
                         ${$tatcdibmrbv} = explode("x", ${$wvomkbuc}[0]);
                         $mpwtizdqou = "crmid";
                         ${${"GLOBALS"}["hchtdauhxls"]} = intval(${$mpwtizdqou}[1]);
                     } else {
                         ${"GLOBALS"}["shhwvpoq"] = "crmid";
                         ${${"GLOBALS"}["shhwvpoq"]} = intval(${${"GLOBALS"}["hcmotgp"]}[0]);
                     }
                     global $adb;
                     ${${"GLOBALS"}["tmrwyiij"]} = "SELECT setype FROM vtiger_crmentity WHERE crmid=?";
                     ${${"GLOBALS"}["vlrkemsbzk"]} = $adb->pquery(${${"GLOBALS"}["tmrwyiij"]}, array(${${"GLOBALS"}["hchtdauhxls"]}));
                     ${${"GLOBALS"}["ampkew"]} = $adb->fetchByAssoc(${${"GLOBALS"}["lpwetnmjxv"]});
                     ${${"GLOBALS"}["eklrhak"]} = getEntityName(${${"GLOBALS"}["ampkew"]}["setype"], array(${${"GLOBALS"}["hchtdauhxls"]}));
                     return ${${"GLOBALS"}["bkvmzxylrca"]}[${$hmnhgfaqeyo}];
                 } else {
                     return "";
                 }
                 break;
         }
     } else {
         $kwkieejbxn = "full";
         ${"GLOBALS"}["rvksgfjkohv"] = "matches";
         ${"GLOBALS"}["jjauqvcq"] = "referenceModule";
         $eyjfdznjzq = "referenceField";
         ${"GLOBALS"}["ckvljbgm"] = "fieldname";
         ${"GLOBALS"}["lzjihcwqljf"] = "referenceModule";
         ${"GLOBALS"}["nijbiieuq"] = "match";
         preg_match("/\\((\\w+) ?: \\(([_\\w]+)\\) (\\w+)\\)/", ${${"GLOBALS"}["nijbiieuq"]}[1], ${${"GLOBALS"}["vxkunswtk"]});
         list(${$kwkieejbxn}, ${$eyjfdznjzq}, ${${"GLOBALS"}["jjauqvcq"]}, ${${"GLOBALS"}["ckvljbgm"]}) = ${${"GLOBALS"}["rvksgfjkohv"]};
         if (${${"GLOBALS"}["ptyrsnuco"]} == "smownerid") {
             $oakmdiy = "referenceField";
             ${$oakmdiy} = "assigned_user_id";
         }
         if (${${"GLOBALS"}["lzjihcwqljf"]} === "__VtigerMeta__") {
             return $this->_getMetaValue(${${"GLOBALS"}["tjyojamrs"]});
         } else {
             ${"GLOBALS"}["ewdyzm"] = "referenceModule";
             $stlcjxh = "referenceField";
             if (${$stlcjxh} != "current_user") {
                 $conwshpzmoe = "referenceField";
                 ${"GLOBALS"}["utwbycs"] = "referenceField";
                 ${${"GLOBALS"}["itprpkcjk"]} = $this->_context->get(${$conwshpzmoe});
                 if (${${"GLOBALS"}["hncxzlio"]} == "Users" && ${${"GLOBALS"}["utwbycs"]} == "assigned_user_id") {
                     $gcpjmebsqn = "values";
                     $lxcfhlasynj = "values";
                     ${${"GLOBALS"}["hustoopi"]} = $this->_context->getOwners();
                     ${$lxcfhlasynj} = $owner->get(${${"GLOBALS"}["tjyojamrs"]});
                     return implode(",", ${$gcpjmebsqn});
                 }
                 if (empty(${${"GLOBALS"}["itprpkcjk"]})) {
                     return "";
                 }
             } else {
                 $mbxitu = "referenceId";
                 global $current_user;
                 ${$mbxitu} = $current_user->id;
             }
             ${"GLOBALS"}["guyjkru"] = "fieldname";
             ${"GLOBALS"}["xaflwfj"] = "referenceId";
             ${${"GLOBALS"}["qoieougsqps"]} = VTEntity::getForId(${${"GLOBALS"}["xaflwfj"]}, ${${"GLOBALS"}["ewdyzm"]} == "Users" ? "Users" : false);
             return $entity->get(${${"GLOBALS"}["guyjkru"]});
         }
     }
 }
예제 #7
0
 function getUserRecurringInfo()
 {
     $recurringType = $this->getRecurringType();
     $recurringInfo = array();
     if ($recurringType == 'Weekly') {
         if ($this->dayofweek_to_rpt != null) {
             $recurringInfo['dayofweek_to_repeat'] = $this->dayofweek_to_rpt;
         }
     } elseif ($recurringType == 'Monthly') {
         $dbStartDateTime = new DateTime($this->startdate->get_DB_formatted_date() . ' ' . $this->startdate->get_formatted_time());
         $recurringInfo['repeatmonth_type'] = $this->repeat_monthby;
         if ($this->repeat_monthby == 'date') {
             $dayOfMonth = $this->rptmonth_datevalue;
             $dbStartDateTime->setDate($dbStartDateTime->format('Y'), $dbStartDateTime->format('m'), $dayOfMonth);
             $userStartDateTime = DateTimeField::convertToUserTimeZone($dbStartDateTime->format('Y-m-d') . ' ' . $dbStartDateTime->format('H:i'));
             $recurringInfo['repeatmonth_date'] = $userStartDateTime->format('d');
         } else {
             $dayOfWeek = $this->dayofweek_to_rpt[0];
             $recurringInfo['repeatmonth_daytype'] = $this->rptmonth_daytype;
             if ($this->rptmonth_daytype == 'first') {
                 $dbStartDateTime->setDate($dbStartDateTime->format('Y'), $dbStartDateTime->format('m'), 1);
                 $dayOfWeekForFirstDay = $dbStartDateTime->format('N');
                 if ($dayOfWeekForFirstDay < $dayOfWeek) {
                     $date = $dayOfWeek - $dayOfWeekForFirstDay + 1;
                 } else {
                     $date = 7 - $dayOfWeekForFirstDay + $dayOfWeek + 1;
                 }
             } elseif ($this->rptmonth_daytype == 'last') {
                 $daysInMonth = $dbStartDateTime->format('t');
                 $dbStartDateTime->setDate($dbStartDateTime->format('Y'), $dbStartDateTime->format('m'), $daysInMonth);
                 $dayOfWeekForLastDay = $dbStartDateTime->format('N');
                 if ($dayOfWeekForLastDay < $dayOfWeek) {
                     $date = $daysInMonth - 7 + ($dayOfWeek - $dayOfWeekForLastDay);
                 } else {
                     $date = $daysInMonth - ($dayOfWeekForLastDay - $dayOfWeek);
                 }
             }
             $dbStartDateTime->setDate($dbStartDateTime->format('Y'), $dbStartDateTime->format('m'), $date);
             $userStartDateTime = DateTimeField::convertToUserTimeZone($dbStartDateTime->format('Y-m-d') . ' ' . $dbStartDateTime->format('H:i'));
             $recurringInfo['dayofweek_to_repeat'][0] = (int) $userStartDateTime->format('N') % 7;
         }
     }
     return $recurringInfo;
 }
예제 #8
0
/** This function returns the vtiger_field details for a given vtiger_fieldname.
 * Param $uitype - UI type of the vtiger_field
 * Param $fieldname - Form vtiger_field name
 * Param $fieldlabel - Form vtiger_field label name
 * Param $maxlength - maximum length of the vtiger_field
 * Param $col_fields - array contains the vtiger_fieldname and values
 * Param $generatedtype - Field generated type (default is 1)
 * Param $module_name - module name
 * Return type is an array
 */
function getOutputHtml($uitype, $fieldname, $fieldlabel, $maxlength, $col_fields, $generatedtype, $module_name, $mode = '', $typeofdata = null)
{
    global $log, $app_strings, $adb, $default_charset, $theme, $mod_strings, $current_user;
    $log->debug("Entering getOutputHtml(" . $uitype . "," . $fieldname . "," . $fieldlabel . "," . $maxlength . "," . print_r($col_fields, true) . "," . $generatedtype . "," . $module_name . ") method ...");
    require 'user_privileges/sharing_privileges_' . $current_user->id . '.php';
    require 'user_privileges/user_privileges_' . $current_user->id . '.php';
    $theme_path = "themes/" . $theme . "/";
    $image_path = $theme_path . "images/";
    $fieldlabel = from_html($fieldlabel);
    $fieldvalue = array();
    $final_arr = array();
    $value = $col_fields[$fieldname];
    $custfld = '';
    $ui_type[] = $uitype;
    $editview_fldname[] = $fieldname;
    // vtlib customization: Related type field
    if ($uitype == '10') {
        global $adb;
        $fldmod_result = $adb->pquery('SELECT relmodule, status FROM vtiger_fieldmodulerel WHERE fieldid=
			(SELECT fieldid FROM vtiger_field, vtiger_tab WHERE vtiger_field.tabid=vtiger_tab.tabid AND fieldname=? AND name=? and vtiger_field.presence in (0,2)) order by sequence', array($fieldname, $module_name));
        $entityTypes = array();
        $parent_id = $value;
        for ($index = 0; $index < $adb->num_rows($fldmod_result); ++$index) {
            $entityTypes[] = $adb->query_result($fldmod_result, $index, 'relmodule');
        }
        if (!empty($value)) {
            if ($adb->num_rows($fldmod_result) == 1) {
                $valueType = $adb->query_result($fldmod_result, 0, 0);
            } else {
                $valueType = getSalesEntityType($value);
            }
            $displayValueArray = getEntityName($valueType, $value);
            if (!empty($displayValueArray)) {
                foreach ($displayValueArray as $key => $value) {
                    $displayValue = $value;
                }
            }
        } else {
            $displayValue = '';
            $valueType = '';
            $value = '';
        }
        $editview_label[] = array('options' => $entityTypes, 'selected' => $valueType, 'displaylabel' => getTranslatedString($fieldlabel, $module_name));
        $fieldvalue[] = array('displayvalue' => $displayValue, 'entityid' => $parent_id);
    } else {
        if ($uitype == 5 || $uitype == 6 || $uitype == 23) {
            $log->info("uitype is " . $uitype);
            if ($value == '') {
                //modified to fix the issue in trac(http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/1469)
                if ($fieldname != 'birthday' && $generatedtype != 2 && getTabid($module_name) != 14) {
                    $disp_value = getNewDisplayDate();
                }
                if (($module_name == 'Events' || $module_name == 'Calendar') && $uitype == 6) {
                    $curr_time = date('H:i', strtotime('+5 minutes'));
                }
                if (($module_name == 'Events' || $module_name == 'Calendar') && $uitype == 23) {
                    $curr_time = date('H:i', strtotime('+10 minutes'));
                }
                //Added to display the Contact - Support End Date as one year future instead of
                //today's date -- 30-11-2005
                if ($fieldname == 'support_end_date' && $_REQUEST['module'] == 'Contacts') {
                    $addyear = strtotime("+1 year");
                    $disp_value = DateTimeField::convertToUserFormat(date('Y-m-d', $addyear));
                } elseif ($fieldname == 'validtill' && $_REQUEST['module'] == 'Quotes') {
                    $disp_value = '';
                }
            } else {
                if ($uitype == 6) {
                    if ($col_fields['time_start'] != '' && ($module_name == 'Events' || $module_name == 'Calendar')) {
                        $curr_time = $col_fields['time_start'];
                        $value = $value . ' ' . $curr_time;
                    } else {
                        $curr_time = date('H:i', strtotime('+5 minutes'));
                    }
                }
                if (($module_name == 'Events' || $module_name == 'Calendar') && $uitype == 23) {
                    if ($col_fields['time_end'] != '') {
                        $curr_time = $col_fields['time_end'];
                        $value = $value . ' ' . $curr_time;
                    } else {
                        $curr_time = date('H:i', strtotime('+10 minutes'));
                    }
                }
                $disp_value = getValidDisplayDate($value);
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $date_format = parse_calendardate($app_strings['NTC_DATE_FORMAT']);
            if (!empty($curr_time)) {
                if (($module_name == 'Events' || $module_name == 'Calendar') && ($uitype == 23 || $uitype == 6)) {
                    $curr_time = DateTimeField::convertToUserTimeZone($curr_time);
                    $curr_time = $curr_time->format('H:i');
                }
            } else {
                $curr_time = '';
            }
            if (empty($disp_value)) {
                $disp_value = '';
            }
            $fieldvalue[] = array($disp_value => $curr_time);
            if ($uitype == 5 || $uitype == 23) {
                if ($module_name == 'Events' && $uitype == 23) {
                    $fieldvalue[] = array($date_format => $current_user->date_format . ' ' . $app_strings['YEAR_MONTH_DATE']);
                } else {
                    $fieldvalue[] = array($date_format => $current_user->date_format);
                }
            } else {
                $fieldvalue[] = array($date_format => $current_user->date_format . ' ' . $app_strings['YEAR_MONTH_DATE']);
            }
        } elseif ($uitype == 16) {
            require_once 'modules/PickList/PickListUtils.php';
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldname = $adb->sql_escape_string($fieldname);
            $pick_query = "select {$fieldname} from vtiger_{$fieldname} order by sortorderid";
            $params = array();
            $pickListResult = $adb->pquery($pick_query, $params);
            $noofpickrows = $adb->num_rows($pickListResult);
            $options = array();
            $pickcount = 0;
            $found = false;
            for ($j = 0; $j < $noofpickrows; $j++) {
                $value = decode_html($value);
                $pickListValue = decode_html($adb->query_result($pickListResult, $j, strtolower($fieldname)));
                if ($value == trim($pickListValue)) {
                    $chk_val = "selected";
                    $pickcount++;
                    $found = true;
                } else {
                    $chk_val = '';
                }
                $pickListValue = to_html($pickListValue);
                if (isset($_REQUEST['file']) && $_REQUEST['file'] == 'QuickCreate') {
                    $options[] = array(htmlentities(getTranslatedString($pickListValue), ENT_QUOTES, $default_charset), $pickListValue, $chk_val);
                } else {
                    $options[] = array(getTranslatedString($pickListValue), $pickListValue, $chk_val);
                }
            }
            $fieldvalue[] = $options;
        } elseif ($uitype == 1613) {
            require_once 'modules/PickList/PickListUtils.php';
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldname = $adb->sql_escape_string($fieldname);
            $pickListResult = getAllowedPicklistModules();
            $options = array();
            $options[] = "";
            $pickcount = 0;
            $found = false;
            foreach ($pickListResult as $pKey => $pValue) {
                $value = decode_html($value);
                $pickListValue = decode_html($pValue);
                if ($value == trim($pickListValue)) {
                    $chk_val = "selected";
                    $pickcount++;
                    $found = true;
                } else {
                    $chk_val = '';
                }
                $pickListValue = to_html($pickListValue);
                if (isset($_REQUEST['file']) && $_REQUEST['file'] == 'QuickCreate') {
                    $options[] = array(htmlentities(getTranslatedString($pickListValue, $pickListValue), ENT_QUOTES, $default_charset), $pickListValue, $chk_val);
                } else {
                    $options[] = array(getTranslatedString($pickListValue, $pickListValue), $pickListValue, $chk_val);
                }
            }
            uasort($options, function ($a, $b) {
                return strtolower($a[0]) < strtolower($b[0]) ? -1 : 1;
            });
            $fieldvalue[] = $options;
        } elseif ($uitype == 15 || $uitype == 33) {
            require_once 'modules/PickList/PickListUtils.php';
            $roleid = $current_user->roleid;
            $picklistValues = getAssignedPicklistValues($fieldname, $roleid, $adb);
            $valueArr = explode("|##|", $value);
            foreach ($valueArr as $key => $value) {
                $valueArr[$key] = trim(html_entity_decode($value, ENT_QUOTES, $default_charset));
            }
            $pickcount = 0;
            if (!empty($picklistValues)) {
                foreach ($picklistValues as $order => $pickListValue) {
                    if (in_array(trim($pickListValue), $valueArr)) {
                        $chk_val = "selected";
                        $pickcount++;
                    } else {
                        $chk_val = '';
                    }
                    if (isset($_REQUEST['file']) && $_REQUEST['file'] == 'QuickCreate') {
                        $options[] = array(htmlentities(getTranslatedString($pickListValue), ENT_QUOTES, $default_charset), $pickListValue, $chk_val);
                    } else {
                        $options[] = array(getTranslatedString($pickListValue), $pickListValue, $chk_val);
                    }
                }
                if ($pickcount == 0 && !empty($value)) {
                    $options[] = array($app_strings['LBL_NOT_ACCESSIBLE'], $value, 'selected');
                }
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $options;
        } elseif ($uitype == 3313) {
            require_once 'modules/PickList/PickListUtils.php';
            $picklistValues = getAllowedPicklistModules();
            $valueArr = explode("|##|", $value);
            foreach ($valueArr as $key => $value) {
                $valueArr[$key] = trim(html_entity_decode($value, ENT_QUOTES, $default_charset));
            }
            $pickcount = 0;
            if (!empty($picklistValues)) {
                foreach ($picklistValues as $order => $pickListValue) {
                    if (in_array(trim($pickListValue), $valueArr)) {
                        $chk_val = "selected";
                        $pickcount++;
                    } else {
                        $chk_val = '';
                    }
                    if (isset($_REQUEST['file']) && $_REQUEST['file'] == 'QuickCreate') {
                        $options[] = array(htmlentities(getTranslatedString($pickListValue, $pickListValue), ENT_QUOTES, $default_charset), $pickListValue, $chk_val);
                    } else {
                        $options[] = array(getTranslatedString($pickListValue, $pickListValue), $pickListValue, $chk_val);
                    }
                }
                if ($pickcount == 0 && !empty($value)) {
                    $options[] = array($app_strings['LBL_NOT_ACCESSIBLE'], $value, 'selected');
                }
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            uasort($options, function ($a, $b) {
                return strtolower($a[0]) < strtolower($b[0]) ? -1 : 1;
            });
            $fieldvalue[] = $options;
        } elseif ($uitype == 1024) {
            $options = array();
            $arr_evo = explode(' |##| ', $value);
            $roleid = $current_user->roleid;
            $subrole = getRoleSubordinates($roleid);
            $uservalues = array_merge($subrole, array($roleid));
            for ($i = 0; $i < sizeof($uservalues); $i++) {
                $currentValId = $uservalues[$i];
                $currentValName = getRoleName($currentValId);
                if (in_array(trim($currentValId), $arr_evo)) {
                    $chk_val = 'selected';
                } else {
                    $chk_val = '';
                }
                $options[] = array($currentValName, $currentValId, $chk_val);
            }
            $fieldvalue[] = $options;
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
        } elseif ($uitype == 17) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $value;
        } elseif ($uitype == 85) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $value;
        } elseif ($uitype == 14) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $value;
        } elseif ($uitype == 19 || $uitype == 20) {
            if (isset($_REQUEST['body'])) {
                $value = $_REQUEST['body'];
            }
            if ($fieldname == 'terms_conditions') {
                //Assign the value from focus->column_fields (if we create Invoice from SO the SO's terms and conditions will be loaded to Invoice's terms and conditions, etc.,)
                $value = $col_fields['terms_conditions'];
                //if the value is empty then only we should get the default Terms and Conditions
                if ($value == '' && $mode != 'edit') {
                    $value = getTermsandConditions();
                }
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $value;
        } elseif ($uitype == 21 || $uitype == 24) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $value;
        } elseif ($uitype == 22) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $value;
        } elseif ($uitype == 52 || $uitype == 77) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            global $current_user;
            if ($value != '') {
                $assigned_user_id = $value;
            } else {
                $assigned_user_id = $current_user->id;
            }
            if ($uitype == 52) {
                $combo_lbl_name = 'assigned_user_id';
            } elseif ($uitype == 77) {
                $combo_lbl_name = 'assigned_user_id1';
            }
            //Control will come here only for Products - Handler and Quotes - Inventory Manager
            if ($is_admin == false && $profileGlobalPermission[2] == 1 && ($defaultOrgSharingPermission[getTabid($module_name)] == 3 or $defaultOrgSharingPermission[getTabid($module_name)] == 0)) {
                $users_combo = get_select_options_array(get_user_array(FALSE, "Active", $assigned_user_id, 'private'), $assigned_user_id);
            } else {
                $users_combo = get_select_options_array(get_user_array(FALSE, "Active", $assigned_user_id), $assigned_user_id);
            }
            $fieldvalue[] = $users_combo;
        } elseif ($uitype == 53) {
            global $noof_group_rows;
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            //Security Checks
            if ($fieldname == 'assigned_user_id' && $is_admin == false && $profileGlobalPermission[2] == 1 && ($defaultOrgSharingPermission[getTabid($module_name)] == 3 or $defaultOrgSharingPermission[getTabid($module_name)] == 0)) {
                $result = get_current_user_access_groups($module_name);
            } else {
                $result = get_group_options();
            }
            if ($result) {
                $nameArray = $adb->fetch_array($result);
            }
            $assigned_user_id = empty($value) ? $current_user->id : $value;
            if ($fieldname == 'assigned_user_id' && $is_admin == false && $profileGlobalPermission[2] == 1 && ($defaultOrgSharingPermission[getTabid($module_name)] == 3 or $defaultOrgSharingPermission[getTabid($module_name)] == 0)) {
                $users_combo = get_select_options_array(get_user_array(FALSE, "Active", $assigned_user_id, 'private'), $assigned_user_id);
            } else {
                $users_combo = get_select_options_array(get_user_array(FALSE, "Active", $assigned_user_id), $assigned_user_id);
            }
            if ($noof_group_rows != 0) {
                if ($fieldname == 'assigned_user_id' && $is_admin == false && $profileGlobalPermission[2] == 1 && ($defaultOrgSharingPermission[getTabid($module_name)] == 3 or $defaultOrgSharingPermission[getTabid($module_name)] == 0)) {
                    $groups_combo = get_select_options_array(get_group_array(FALSE, "Active", $assigned_user_id, 'private'), $assigned_user_id);
                } else {
                    $groups_combo = get_select_options_array(get_group_array(FALSE, "Active", $assigned_user_id), $assigned_user_id);
                }
            }
            $fieldvalue[] = $users_combo;
            $fieldvalue[] = $groups_combo;
        } elseif ($uitype == 51 || $uitype == 50 || $uitype == 73) {
            if (!isset($_REQUEST['convertmode']) || $_REQUEST['convertmode'] != 'update_quote_val' && $_REQUEST['convertmode'] != 'update_so_val') {
                if (isset($_REQUEST['account_id']) && $_REQUEST['account_id'] != '') {
                    $value = vtlib_purify($_REQUEST['account_id']);
                }
            }
            if ($value != '') {
                $account_name = getAccountName($value);
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $account_name;
            $fieldvalue[] = $value;
        } elseif ($uitype == 54) {
            $options = array();
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $pick_query = "select * from vtiger_groups";
            $pickListResult = $adb->pquery($pick_query, array());
            $noofpickrows = $adb->num_rows($pickListResult);
            for ($j = 0; $j < $noofpickrows; $j++) {
                $pickListValue = $adb->query_result($pickListResult, $j, "name");
                if ($value == $pickListValue) {
                    $chk_val = "selected";
                } else {
                    $chk_val = '';
                }
                $options[] = array($pickListValue => $chk_val);
            }
            $fieldvalue[] = $options;
        } elseif ($uitype == 55 || $uitype == 255) {
            require_once 'modules/PickList/PickListUtils.php';
            if ($uitype == 255) {
                $fieldpermission = getFieldVisibilityPermission($module_name, $current_user->id, 'firstname', 'readwrite');
            }
            if ($uitype == 255 && $fieldpermission == '0') {
                $fieldvalue[] = '';
            } else {
                $fieldpermission = getFieldVisibilityPermission($module_name, $current_user->id, 'salutationtype', 'readwrite');
                if ($fieldpermission == '0') {
                    $roleid = $current_user->roleid;
                    $picklistValues = getAssignedPicklistValues('salutationtype', $roleid, $adb);
                    $pickcount = 0;
                    $salt_value = $col_fields["salutationtype"];
                    foreach ($picklistValues as $order => $pickListValue) {
                        if ($salt_value == trim($pickListValue)) {
                            $chk_val = "selected";
                            $pickcount++;
                        } else {
                            $chk_val = '';
                        }
                        if (isset($_REQUEST['file']) && $_REQUEST['file'] == 'QuickCreate') {
                            $options[] = array(htmlentities(getTranslatedString($pickListValue), ENT_QUOTES, $default_charset), $pickListValue, $chk_val);
                        } else {
                            $options[] = array(getTranslatedString($pickListValue), $pickListValue, $chk_val);
                        }
                    }
                    if ($pickcount == 0 && $salt_value != '') {
                        $options[] = array($app_strings['LBL_NOT_ACCESSIBLE'], $salt_value, 'selected');
                    }
                    $fieldvalue[] = $options;
                } else {
                    $fieldvalue[] = '';
                }
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $value;
        } elseif ($uitype == 59) {
            if ($_REQUEST['module'] == 'HelpDesk') {
                if (isset($_REQUEST['product_id']) & $_REQUEST['product_id'] != '') {
                    $value = $_REQUEST['product_id'];
                }
            } elseif (isset($_REQUEST['parent_id']) & $_REQUEST['parent_id'] != '') {
                $value = vtlib_purify($_REQUEST['parent_id']);
            }
            if ($value != '') {
                $product_name = getProductName($value);
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $product_name;
            $fieldvalue[] = $value;
        } elseif ($uitype == 63) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            if ($value == '') {
                $value = 1;
            }
            $options = array();
            $pick_query = "select * from vtiger_duration_minutes order by sortorderid";
            $pickListResult = $adb->pquery($pick_query, array());
            $noofpickrows = $adb->num_rows($pickListResult);
            $salt_value = $col_fields["duration_minutes"];
            for ($j = 0; $j < $noofpickrows; $j++) {
                $pickListValue = $adb->query_result($pickListResult, $j, "duration_minutes");
                if ($salt_value == $pickListValue) {
                    $chk_val = "selected";
                } else {
                    $chk_val = '';
                }
                $options[$pickListValue] = $chk_val;
            }
            $fieldvalue[] = $value;
            $fieldvalue[] = $options;
        } elseif ($uitype == 64) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $date_format = parse_calendardate($app_strings['NTC_DATE_FORMAT']);
            $fieldvalue[] = $value;
        } elseif ($uitype == 156) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $value;
            $fieldvalue[] = $is_admin;
        } elseif ($uitype == 56) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $value;
        } elseif ($uitype == 57) {
            if ($value != '') {
                $displayValueArray = getEntityName('Contacts', $value);
                if (!empty($displayValueArray)) {
                    foreach ($displayValueArray as $key => $field_value) {
                        $contact_name = $field_value;
                    }
                }
            } elseif (isset($_REQUEST['contact_id']) && $_REQUEST['contact_id'] != '') {
                if ($_REQUEST['module'] == 'Contacts' && ($fieldname = 'contact_id')) {
                    $contact_name = '';
                } else {
                    $value = $_REQUEST['contact_id'];
                    $displayValueArray = getEntityName('Contacts', $value);
                    if (!empty($displayValueArray)) {
                        foreach ($displayValueArray as $key => $field_value) {
                            $contact_name = $field_value;
                        }
                    } else {
                        $contact_name = '';
                    }
                }
            }
            //Checking for contacts duplicate
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $contact_name;
            $fieldvalue[] = $value;
        } elseif ($uitype == 58) {
            if ($value != '') {
                $campaign_name = getCampaignName($value);
            } elseif (isset($_REQUEST['campaignid']) && $_REQUEST['campaignid'] != '') {
                if ($_REQUEST['module'] == 'Campaigns' && ($fieldname = 'campaignid')) {
                    $campaign_name = '';
                } else {
                    $value = $_REQUEST['campaignid'];
                    $campaign_name = getCampaignName($value);
                }
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $campaign_name;
            $fieldvalue[] = $value;
        } elseif ($uitype == 61) {
            if ($value != '') {
                $assigned_user_id = $value;
            } else {
                $assigned_user_id = $current_user->id;
            }
            if ($module_name == 'Emails' && $col_fields['record_id'] != '') {
                $attach_result = $adb->pquery("select * from vtiger_seattachmentsrel where crmid = ?", array($col_fields['record_id']));
                //to fix the issue in mail attachment on forwarding mails
                if (isset($_REQUEST['forward']) && $_REQUEST['forward'] != '') {
                    global $att_id_list;
                }
                for ($ii = 0; $ii < $adb->num_rows($attach_result); $ii++) {
                    $attachmentid = $adb->query_result($attach_result, $ii, 'attachmentsid');
                    if ($attachmentid != '') {
                        $attachquery = "select * from vtiger_attachments where attachmentsid=?";
                        $attachmentsname = $adb->query_result($adb->pquery($attachquery, array($attachmentid)), 0, 'name');
                        if ($attachmentsname != '') {
                            $fieldvalue[$attachmentid] = '[ ' . $attachmentsname . ' ]';
                        }
                        if (isset($_REQUEST['forward']) && $_REQUEST['forward'] != '') {
                            $att_id_list .= $attachmentid . ';';
                        }
                    }
                }
            } else {
                if ($col_fields['record_id'] != '') {
                    $attachmentid = $adb->query_result($adb->pquery("select * from vtiger_seattachmentsrel where crmid = ?", array($col_fields['record_id'])), 0, 'attachmentsid');
                    if ($col_fields[$fieldname] == '' && $attachmentid != '') {
                        $attachquery = "select * from vtiger_attachments where attachmentsid=?";
                        $value = $adb->query_result($adb->pquery($attachquery, array($attachmentid)), 0, 'name');
                    }
                }
                if ($value != '') {
                    $filename = ' [ ' . $value . ' ]';
                }
                if ($filename != '') {
                    $fieldvalue[] = $filename;
                }
                if ($value != '') {
                    $fieldvalue[] = $value;
                }
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
        } elseif ($uitype == 28) {
            if ($col_fields['record_id'] != '') {
                $attachmentid = $adb->query_result($adb->pquery("select * from vtiger_seattachmentsrel where crmid = ?", array($col_fields['record_id'])), 0, 'attachmentsid');
                if ($col_fields[$fieldname] == '' && $attachmentid != '') {
                    $attachquery = "select * from vtiger_attachments where attachmentsid=?";
                    $value = $adb->query_result($adb->pquery($attachquery, array($attachmentid)), 0, 'name');
                }
            }
            if ($value != '' && $module_name != 'Documents') {
                $filename = ' [ ' . $value . ' ]';
            } elseif ($value != '' && $module_name == 'Documents') {
                $filename = $value;
            }
            if ($filename != '') {
                $fieldvalue[] = $filename;
            }
            if ($value != '') {
                $fieldvalue[] = $value;
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
        } elseif ($uitype == 69) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            if ($col_fields['record_id'] != "") {
                if ($module_name == 'Products') {
                    $query = 'select vtiger_attachments.path, vtiger_attachments.attachmentsid, vtiger_attachments.name ,vtiger_crmentity.setype from vtiger_products left join vtiger_seattachmentsrel on vtiger_seattachmentsrel.crmid=vtiger_products.productid inner join vtiger_attachments on vtiger_attachments.attachmentsid=vtiger_seattachmentsrel.attachmentsid inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_attachments.attachmentsid where vtiger_crmentity.setype="Products Image" and productid=?';
                    $params = array($col_fields['record_id']);
                } else {
                    if ($module_name == 'Contacts') {
                        $imageattachment = 'Image';
                    } else {
                        $imageattachment = 'Attachment';
                    }
                    $query = "select vtiger_attachments.*,vtiger_crmentity.setype\n\t\t\t\t from vtiger_attachments\n\t\t\t\t inner join vtiger_seattachmentsrel on vtiger_seattachmentsrel.attachmentsid = vtiger_attachments.attachmentsid\n\t\t\t\t inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_attachments.attachmentsid\n\t\t\t\t where vtiger_crmentity.setype='{$module_name} {$imageattachment}'\n\t\t\t\t  and vtiger_attachments.name = ?\n\t\t\t\t  and vtiger_seattachmentsrel.crmid=?";
                    $params = array($col_fields[$fieldname], $col_fields['record_id']);
                }
                $result_image = $adb->pquery($query, $params);
                for ($image_iter = 0; $image_iter < $adb->num_rows($result_image); $image_iter++) {
                    $image_id_array[] = $adb->query_result($result_image, $image_iter, 'attachmentsid');
                    //decode_html  - added to handle UTF-8   characters in file names
                    //urlencode    - added to handle special characters like #, %, etc.,
                    $image_array[] = urlencode(decode_html($adb->query_result($result_image, $image_iter, 'name')));
                    $image_orgname_array[] = decode_html($adb->query_result($result_image, $image_iter, 'name'));
                    $image_path_array[] = $adb->query_result($result_image, $image_iter, 'path');
                }
                if (is_array($image_array)) {
                    for ($img_itr = 0; $img_itr < count($image_array); $img_itr++) {
                        $fieldvalue[] = array('name' => $image_array[$img_itr], 'path' => $image_path_array[$img_itr] . $image_id_array[$img_itr] . "_", "orgname" => $image_orgname_array[$img_itr]);
                    }
                } else {
                    $fieldvalue[] = '';
                }
            } else {
                $fieldvalue[] = '';
            }
        } elseif ($uitype == 62) {
            if (isset($_REQUEST['parent_id']) && $_REQUEST['parent_id'] != '') {
                $value = vtlib_purify($_REQUEST['parent_id']);
            }
            if ($value != '') {
                $parent_module = getSalesEntityType($value);
            }
            if (isset($_REQUEST['account_id']) && $_REQUEST['account_id'] != '') {
                $parent_module = "Accounts";
                $value = $_REQUEST['account_id'];
            }
            if ($parent_module != 'Contacts') {
                if ($parent_module == "Leads") {
                    $displayValueArray = getEntityName($parent_module, $value);
                    if (!empty($displayValueArray)) {
                        foreach ($displayValueArray as $key => $field_value) {
                            $parent_name = $field_value;
                        }
                    }
                    $lead_selected = "selected";
                } elseif ($parent_module == "Accounts") {
                    $sql = "select * from vtiger_account where accountid=?";
                    $result = $adb->pquery($sql, array($value));
                    $parent_name = $adb->query_result($result, 0, "accountname");
                    $account_selected = "selected";
                } elseif ($parent_module == "Potentials") {
                    $sql = "select * from vtiger_potential where potentialid=?";
                    $result = $adb->pquery($sql, array($value));
                    $parent_name = $adb->query_result($result, 0, "potentialname");
                    $potential_selected = "selected";
                } elseif ($parent_module == "Products") {
                    $sql = "select * from vtiger_products where productid=?";
                    $result = $adb->pquery($sql, array($value));
                    $parent_name = $adb->query_result($result, 0, "productname");
                    $product_selected = "selected";
                } elseif ($parent_module == "PurchaseOrder") {
                    $sql = "select * from vtiger_purchaseorder where purchaseorderid=?";
                    $result = $adb->pquery($sql, array($value));
                    $parent_name = $adb->query_result($result, 0, "subject");
                    $porder_selected = "selected";
                } elseif ($parent_module == "SalesOrder") {
                    $sql = "select * from vtiger_salesorder where salesorderid=?";
                    $result = $adb->pquery($sql, array($value));
                    $parent_name = $adb->query_result($result, 0, "subject");
                    $sorder_selected = "selected";
                } elseif ($parent_module == "Invoice") {
                    $sql = "select * from vtiger_invoice where invoiceid=?";
                    $result = $adb->pquery($sql, array($value));
                    $parent_name = $adb->query_result($result, 0, "subject");
                    $invoice_selected = "selected";
                } elseif ($parent_module == "Quotes") {
                    $sql = "select * from vtiger_quotes where quoteid=?";
                    $result = $adb->pquery($sql, array($value));
                    $parent_name = $adb->query_result($result, 0, "subject");
                    $quote_selected = "selected";
                } elseif ($parent_module == "HelpDesk") {
                    $sql = "select * from vtiger_troubletickets where ticketid=?";
                    $result = $adb->pquery($sql, array($value));
                    $parent_name = $adb->query_result($result, 0, "title");
                    $ticket_selected = "selected";
                }
            }
            $editview_label[] = array($app_strings['COMBO_LEADS'], $app_strings['COMBO_ACCOUNTS'], $app_strings['COMBO_POTENTIALS'], $app_strings['COMBO_PRODUCTS'], $app_strings['COMBO_INVOICES'], $app_strings['COMBO_PORDER'], $app_strings['COMBO_SORDER'], $app_strings['COMBO_QUOTES'], $app_strings['COMBO_HELPDESK']);
            $editview_label[] = array($lead_selected, $account_selected, $potential_selected, $product_selected, $invoice_selected, $porder_selected, $sorder_selected, $quote_selected, $ticket_selected);
            $editview_label[] = array("Leads&action=Popup", "Accounts&action=Popup", "Potentials&action=Popup", "Products&action=Popup", "Invoice&action=Popup", "PurchaseOrder&action=Popup", "SalesOrder&action=Popup", "Quotes&action=Popup", "HelpDesk&action=Popup");
            $fieldvalue[] = $parent_name;
            $fieldvalue[] = $value;
        } elseif ($uitype == 66) {
            if (!empty($_REQUEST['parent_id'])) {
                $value = vtlib_purify($_REQUEST['parent_id']);
            }
            if (!empty($value)) {
                $parent_module = getSalesEntityType($value);
                if ($parent_module != "Contacts") {
                    $entity_names = getEntityName($parent_module, $value);
                    $parent_name = $entity_names[$value];
                    $fieldvalue[] = $parent_name;
                    $fieldvalue[] = $value;
                }
            }
            // Check for vtiger_activity type if task orders to be added in select option
            $act_mode = $_REQUEST['activity_mode'];
            $parentModulesList = array('Leads' => $app_strings['COMBO_LEADS'], 'Accounts' => $app_strings['COMBO_ACCOUNTS'], 'Potentials' => $app_strings['COMBO_POTENTIALS'], 'HelpDesk' => $app_strings['COMBO_HELPDESK'], 'Campaigns' => $app_strings['COMBO_CAMPAIGNS'], 'Vendors' => $app_strings['COMBO_VENDORS']);
            if ($act_mode == "Task") {
                $parentModulesList['Quotes'] = $app_strings['COMBO_QUOTES'];
                $parentModulesList['PurchaseOrder'] = $app_strings['COMBO_PORDER'];
                $parentModulesList['SalesOrder'] = $app_strings['COMBO_SORDER'];
                $parentModulesList['Invoice'] = $app_strings['COMBO_INVOICES'];
            }
            $parentModuleNames = array_keys($parentModulesList);
            $parentModuleLabels = array_values($parentModulesList);
            $editview_label[0] = $parentModuleLabels;
            $editview_label[1] = array_fill(0, count($parentModulesList), '');
            $selectedModuleIndex = array_search($parent_module, $parentModuleNames);
            if ($selectedModuleIndex > -1) {
                $editview_label[1][$selectedModuleIndex] = 'selected';
            }
            $parentModulePopupUrl = array();
            foreach ($parentModuleNames as $parentModule) {
                $parentModulePopupUrl[] = $parentModule . '&action=Popup';
            }
            $editview_label[2] = $parentModulePopupUrl;
        } elseif ($uitype == 357) {
            $pmodule = $_REQUEST['pmodule'];
            if (empty($pmodule)) {
                $pmodule = $_REQUEST['par_module'];
            }
            if ($pmodule == 'Contacts') {
                $contact_selected = 'selected';
            } elseif ($pmodule == 'Accounts') {
                $account_selected = 'selected';
            } elseif ($pmodule == 'Leads') {
                $lead_selected = 'selected';
            } elseif ($pmodule == 'Vendors') {
                $vendor_selected = 'selected';
            } elseif ($pmodule == 'Users') {
                $user_selected = 'selected';
            } elseif ($pmodule == 'Project') {
                $project_selected = 'selected';
            } elseif ($pmodule == 'ProjectTask') {
                $projecttask_selected = 'selected';
            } elseif ($pmodule == 'Potentials') {
                $potentials_selected = 'selected';
            } elseif ($pmodule == 'HelpDesk') {
                $helpdesk_selected = 'selected';
            }
            if (isset($_REQUEST['emailids']) && $_REQUEST['emailids'] != '') {
                $parent_id = $_REQUEST['emailids'];
                $parent_name = '';
                $myids = explode("|", $parent_id);
                for ($i = 0; $i < count($myids) - 1; $i++) {
                    $realid = explode("@", $myids[$i]);
                    $entityid = $realid[0];
                    $nemail = count($realid);
                    if ($pmodule == 'Accounts') {
                        require_once 'modules/Accounts/Accounts.php';
                        $myfocus = new Accounts();
                        $myfocus->retrieve_entity_info($entityid, "Accounts");
                        $fullname = br2nl($myfocus->column_fields['accountname']);
                        $account_selected = 'selected';
                    } elseif ($pmodule == 'Contacts') {
                        require_once 'modules/Contacts/Contacts.php';
                        $myfocus = new Contacts();
                        $myfocus->retrieve_entity_info($entityid, "Contacts");
                        $fname = br2nl($myfocus->column_fields['firstname']);
                        $lname = br2nl($myfocus->column_fields['lastname']);
                        $fullname = $lname . ' ' . $fname;
                        $contact_selected = 'selected';
                    } elseif ($pmodule == 'Leads') {
                        require_once 'modules/Leads/Leads.php';
                        $myfocus = new Leads();
                        $myfocus->retrieve_entity_info($entityid, "Leads");
                        $fname = br2nl($myfocus->column_fields['firstname']);
                        $lname = br2nl($myfocus->column_fields['lastname']);
                        $fullname = $lname . ' ' . $fname;
                        $lead_selected = 'selected';
                    } elseif ($pmodule == 'Project') {
                        require_once 'modules/Project/Project.php';
                        $myfocus = new Project();
                        $myfocus->retrieve_entity_info($entityid, "Project");
                        $fname = br2nl($myfocus->column_fields['projectname']);
                        $lname = br2nl($myfocus->column_fields['projectid']);
                        $fullname = $fname;
                        $project_selected = 'selected';
                    } elseif ($pmodule == 'ProjectTask') {
                        require_once 'modules/ProjectTask/ProjectTask.php';
                        $myfocus = new ProjectTask();
                        $myfocus->retrieve_entity_info($entityid, "ProjectTask");
                        $fname = br2nl($myfocus->column_fields['projecttaskname']);
                        $lname = br2nl($myfocus->column_fields['projecttaskid']);
                        $fullname = $fname;
                        $projecttask_selected = 'selected';
                    } elseif ($pmodule == 'Potentials') {
                        require_once 'modules/Potentials/Potentials.php';
                        $myfocus = new Potentials();
                        $myfocus->retrieve_entity_info($entityid, "Potentials");
                        $fname = br2nl($myfocus->column_fields['potentialname']);
                        $lname = br2nl($myfocus->column_fields['potentialid']);
                        $fullname = $fname;
                        $potentials_selected = 'selected';
                    } elseif ($pmodule == 'HelpDesk') {
                        require_once 'modules/HelpDesk/HelpDesk.php';
                        $myfocus = new HelpDesk();
                        $myfocus->retrieve_entity_info($entityid, "HelpDesk");
                        $fname = br2nl($myfocus->column_fields['title']);
                        $lname = br2nl($myfocus->column_fields['ticketid']);
                        $fullname = $fname;
                        $helpdesk_selected = 'selected';
                    }
                    for ($j = 1; $j < $nemail; $j++) {
                        $querystr = 'select columnname from vtiger_field where fieldid=? and vtiger_field.presence in (0,2)';
                        $result = $adb->pquery($querystr, array($realid[$j]));
                        $temp = $adb->query_result($result, 0, 'columnname');
                        $temp1 = br2nl($myfocus->column_fields[$temp]);
                        //Modified to display the entities in red which don't have email id
                        if (!empty($temp_parent_name) && strlen($temp_parent_name) > 150) {
                            $parent_name .= '<br>';
                            $temp_parent_name = '';
                        }
                        if ($temp1 != '') {
                            $parent_name .= $fullname . '&lt;' . $temp1 . '&gt;; ';
                            $temp_parent_name .= $fullname . '&lt;' . $temp1 . '&gt;; ';
                        } else {
                            $parent_name .= "<b style='color:red'>" . $fullname . '&lt;' . $temp1 . '&gt;; ' . "</b>";
                            $temp_parent_name .= "<b style='color:red'>" . $fullname . '&lt;' . $temp1 . '&gt;; ' . "</b>";
                        }
                    }
                }
            } else {
                if ($_REQUEST['record'] != '' && $_REQUEST['record'] != NULL) {
                    $parent_name = '';
                    $parent_id = '';
                    $myemailid = $_REQUEST['record'];
                    $mysql = "select crmid from vtiger_seactivityrel where activityid=?";
                    $myresult = $adb->pquery($mysql, array($myemailid));
                    $mycount = $adb->num_rows($myresult);
                    if ($mycount > 0) {
                        for ($i = 0; $i < $mycount; $i++) {
                            $mycrmid = $adb->query_result($myresult, $i, 'crmid');
                            $parent_module = getSalesEntityType($mycrmid);
                            if ($parent_module == "Leads") {
                                $sql = "select firstname,lastname,email from vtiger_leaddetails where leadid=?";
                                $result = $adb->pquery($sql, array($mycrmid));
                                $full_name = getFullNameFromQResult($result, 0, "Leads");
                                $myemail = $adb->query_result($result, 0, "email");
                                $parent_id .= $mycrmid . '@0|';
                                //make it such that the email adress sent is remebered and only that one is retrived
                                $parent_name .= $full_name . '<' . $myemail . '>; ';
                                $lead_selected = 'selected';
                            } elseif ($parent_module == "Contacts") {
                                $sql = "select * from vtiger_contactdetails where contactid=?";
                                $result = $adb->pquery($sql, array($mycrmid));
                                $full_name = getFullNameFromQResult($result, 0, "Contacts");
                                $myemail = $adb->query_result($result, 0, "email");
                                $parent_id .= $mycrmid . '@0|';
                                //make it such that the email adress sent is remebered and only that one is retrived
                                $parent_name .= $full_name . '<' . $myemail . '>; ';
                                $contact_selected = 'selected';
                            } elseif ($parent_module == "Accounts") {
                                $sql = "select * from vtiger_account where accountid=?";
                                $result = $adb->pquery($sql, array($mycrmid));
                                $account_name = $adb->query_result($result, 0, "accountname");
                                $myemail = $adb->query_result($result, 0, "email1");
                                $parent_id .= $mycrmid . '@0|';
                                //make it such that the email adress sent is remebered and only that one is retrived
                                $parent_name .= $account_name . '<' . $myemail . '>; ';
                                $account_selected = 'selected';
                            } elseif ($parent_module == "Users") {
                                $sql = "select user_name,email1 from vtiger_users where id=?";
                                $result = $adb->pquery($sql, array($mycrmid));
                                $account_name = $adb->query_result($result, 0, "user_name");
                                $myemail = $adb->query_result($result, 0, "email1");
                                $parent_id .= $mycrmid . '@0|';
                                //make it such that the email adress sent is remebered and only that one is retrived
                                $parent_name .= $account_name . '<' . $myemail . '>; ';
                                $user_selected = 'selected';
                            } elseif ($parent_module == "Vendors") {
                                $sql = "select * from vtiger_vendor where vendorid=?";
                                $result = $adb->pquery($sql, array($mycrmid));
                                $vendor_name = $adb->query_result($result, 0, "vendorname");
                                $myemail = $adb->query_result($result, 0, "email");
                                $parent_id .= $mycrmid . '@0|';
                                //make it such that the email adress sent is remebered and only that one is retrived
                                $parent_name .= $vendor_name . '<' . $myemail . '>; ';
                                $vendor_selected = 'selected';
                            }
                        }
                    }
                }
                $custfld .= '<td width="20%" class="dataLabel">' . $app_strings['To'] . '&nbsp;</td>';
                $custfld .= '<td width="90%" colspan="3"><input name="parent_id" type="hidden" value="' . $parent_id . '"><textarea readonly name="parent_name" cols="70" rows="2">' . $parent_name . '</textarea>&nbsp;<select name="parent_type" >';
                $custfld .= '<OPTION value="Contacts" selected>' . $app_strings['COMBO_CONTACTS'] . '</OPTION>';
                $custfld .= '<OPTION value="Accounts" >' . $app_strings['COMBO_ACCOUNTS'] . '</OPTION>';
                $custfld .= '<OPTION value="Leads" >' . $app_strings['COMBO_LEADS'] . '</OPTION>';
                $custfld .= '<OPTION value="Vendors" >' . $app_strings['COMBO_VENDORS'] . '</OPTION></select><img src="' . vtiger_imageurl('select.gif', $theme) . '" alt="Select" title="Select" LANGUAGE=javascript onclick=\'$log->debug("Exiting getOutputHtml method ..."); return window.open("index.php?module="+ document.EditView.parent_type.value +"&action=Popup&popuptype=set_$log->debug("Exiting getOutputHtml method ..."); return_emails&form=EmailEditView&form_submit=false","test","width=600,height=400,resizable=1,scrollbars=1,top=150,left=200");\' align="absmiddle" style=\'cursor:hand;cursor:pointer\'>&nbsp;<input type="image" src="' . vtiger_imageurl('clear_field.gif', $theme) . '" alt="Clear" title="Clear" LANGUAGE=javascript onClick="this.form.parent_id.value=\'\';this.form.parent_name.value=\'\';$log->debug("Exiting getOutputHtml method ..."); return false;" align="absmiddle" style=\'cursor:hand;cursor:pointer\'></td>';
                $editview_label[] = array('Contacts' => $contact_selected, 'Accounts' => $account_selected, 'Vendors' => $vendor_selected, 'Leads' => $lead_selected, 'Users' => $user_selected);
                $fieldvalue[] = $parent_name;
                $fieldvalue[] = $parent_id;
            }
        } elseif ($uitype == 68) {
            if (empty($value) && isset($_REQUEST['parent_id']) && $_REQUEST['parent_id'] != '') {
                $value = vtlib_purify($_REQUEST['parent_id']);
            }
            if ($value != '') {
                $parent_module = getSalesEntityType($value);
                if ($parent_module == "Contacts") {
                    $displayValueArray = getEntityName($parent_module, $value);
                    if (!empty($displayValueArray)) {
                        foreach ($displayValueArray as $key => $field_value) {
                            $parent_name = $field_value;
                        }
                    }
                    $contact_selected = "selected";
                } elseif ($parent_module == "Accounts") {
                    $sql = "select * from vtiger_account where accountid=?";
                    $result = $adb->pquery($sql, array($value));
                    $parent_name = $adb->query_result($result, 0, "accountname");
                    $account_selected = "selected";
                } else {
                    $parent_name = "";
                    $value = "";
                }
            }
            $editview_label[0] = array();
            $editview_label[1] = array();
            $editview_label[2] = array();
            if (vtlib_isModuleActive('Accounts')) {
                array_push($editview_label[0], $app_strings['COMBO_ACCOUNTS']);
                array_push($editview_label[1], $account_selected);
                array_push($editview_label[2], "Accounts");
            }
            if (vtlib_isModuleActive('Contacts')) {
                array_push($editview_label[0], $app_strings['COMBO_CONTACTS']);
                array_push($editview_label[1], $contact_selected);
                array_push($editview_label[2], "Contacts");
            }
            $fieldvalue[] = $parent_name;
            $fieldvalue[] = $value;
        } elseif ($uitype == 9 || $uitype == 7) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fldrs = $adb->pquery('select typeofdata from vtiger_field
			where vtiger_field.fieldname=? and vtiger_field.tabid=?', array($fieldname, getTabid($module_name)));
            $typeofdata = $adb->query_result($fldrs, 0, 0);
            $typeinfo = explode('~', $typeofdata);
            if ($typeinfo[0] == 'I') {
                $fieldvalue[] = $value;
            } else {
                $currencyField = new CurrencyField($value);
                $decimals = CurrencyField::getDecimalsFromTypeOfData($typeofdata);
                $currencyField->initialize($current_user);
                $currencyField->setNumberofDecimals(min($decimals, $currencyField->getCurrencyDecimalPlaces()));
                $fieldvalue[] = $currencyField->getDisplayValue(null, false, true);
            }
        } elseif ($uitype == 71 || $uitype == 72) {
            $currencyField = new CurrencyField($value);
            // Some of the currency fields like Unit Price, Total, Sub-total etc of Inventory modules, do not need currency conversion
            if ($col_fields['record_id'] != '' && $uitype == 72) {
                if ($fieldname == 'unit_price') {
                    $rate_symbol = getCurrencySymbolandCRate(getProductBaseCurrency($col_fields['record_id'], $module_name));
                    $currencySymbol = $rate_symbol['symbol'];
                } else {
                    $currency_info = getInventoryCurrencyInfo($module, $col_fields['record_id']);
                    $currencySymbol = $currency_info['currency_symbol'];
                }
                $fieldvalue[] = $currencyField->getDisplayValue(null, true);
            } else {
                $decimals = CurrencyField::getDecimalsFromTypeOfData($typeofdata);
                $currencyField->initialize($current_user);
                $currencyField->setNumberofDecimals(min($decimals, $currencyField->getCurrencyDecimalPlaces()));
                $fieldvalue[] = $currencyField->getDisplayValue(null, false, true);
                $currencySymbol = $currencyField->getCurrencySymbol();
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name) . ': (' . $currencySymbol . ')';
        } elseif ($uitype == 75 || $uitype == 81) {
            if ($value != '') {
                $vendor_name = getVendorName($value);
            } elseif (isset($_REQUEST['vendor_id']) && $_REQUEST['vendor_id'] != '') {
                $value = $_REQUEST['vendor_id'];
                $vendor_name = getVendorName($value);
            }
            $pop_type = 'specific';
            if ($uitype == 81) {
                $pop_type = 'specific_vendor_address';
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $vendor_name;
            $fieldvalue[] = $value;
        } elseif ($uitype == 76) {
            if ($value != '') {
                $potential_name = getPotentialName($value);
            } elseif (isset($_REQUEST['potential_id']) && $_REQUEST['potential_id'] != '') {
                $value = $_REQUEST['potental_id'];
                $potential_name = getPotentialName($value);
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $potential_name;
            $fieldvalue[] = $value;
        } elseif ($uitype == 78) {
            if ($value != '') {
                $quote_name = getQuoteName($value);
            } elseif (isset($_REQUEST['quote_id']) && $_REQUEST['quote_id'] != '') {
                $value = $_REQUEST['quote_id'];
                $potential_name = getQuoteName($value);
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $quote_name;
            $fieldvalue[] = $value;
        } elseif ($uitype == 79) {
            if ($value != '') {
                $purchaseorder_name = getPoName($value);
            } elseif (isset($_REQUEST['purchaseorder_id']) && $_REQUEST['purchaseorder_id'] != '') {
                $value = $_REQUEST['purchaseorder_id'];
                $purchaseorder_name = getPoName($value);
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $purchaseorder_name;
            $fieldvalue[] = $value;
        } elseif ($uitype == 80) {
            if ($value != '') {
                $salesorder_name = getSoName($value);
            } elseif (isset($_REQUEST['salesorder_id']) && $_REQUEST['salesorder_id'] != '') {
                $value = $_REQUEST['salesorder_id'];
                $salesorder_name = getSoName($value);
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $salesorder_name;
            $fieldvalue[] = $value;
        } elseif ($uitype == 30) {
            $rem_days = 0;
            $rem_hrs = 0;
            $rem_min = 0;
            if ($value != '') {
                $SET_REM = 'CHECKED';
            } else {
                $SET_REM = '';
            }
            $rem_days = floor($col_fields[$fieldname] / (24 * 60));
            $rem_hrs = floor(($col_fields[$fieldname] - $rem_days * 24 * 60) / 60);
            $rem_min = ($col_fields[$fieldname] - $rem_days * 24 * 60) % 60;
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $day_options = getReminderSelectOption(0, 31, 'remdays', $rem_days);
            $hr_options = getReminderSelectOption(0, 23, 'remhrs', $rem_hrs);
            $min_options = getReminderSelectOption(10, 59, 'remmin', $rem_min);
            $fieldvalue[] = array(array(0, 32, 'remdays', getTranslatedString('LBL_DAYS', 'Calendar'), $rem_days), array(0, 24, 'remhrs', getTranslatedString('LBL_HOURS', 'Calendar'), $rem_hrs), array(10, 60, 'remmin', getTranslatedString('LBL_MINUTES', 'Calendar') . '&nbsp;&nbsp;' . getTranslatedString('LBL_BEFORE_EVENT', 'Calendar'), $rem_min));
            $fieldvalue[] = array($SET_REM, getTranslatedString('LBL_YES'), getTranslatedString('LBL_NO'));
            $SET_REM = '';
        } elseif ($uitype == 115) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $pick_query = "select * from vtiger_" . $adb->sql_escape_string($fieldname);
            $pickListResult = $adb->pquery($pick_query, array());
            $noofpickrows = $adb->num_rows($pickListResult);
            //Mikecrowe fix to correctly default for custom pick lists
            $options = array();
            $found = false;
            for ($j = 0; $j < $noofpickrows; $j++) {
                $pickListValue = $adb->query_result($pickListResult, $j, strtolower($fieldname));
                if ($value == $pickListValue) {
                    $chk_val = "selected";
                    $found = true;
                } else {
                    $chk_val = '';
                }
                $options[] = array(getTranslatedString($pickListValue), $pickListValue, $chk_val);
            }
            $fieldvalue[] = $options;
            $fieldvalue[] = $is_admin;
        } elseif ($uitype == 116 || $uitype == 117) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $pick_query = "select * from vtiger_currency_info where currency_status = 'Active' and deleted=0";
            $pickListResult = $adb->pquery($pick_query, array());
            $noofpickrows = $adb->num_rows($pickListResult);
            //Mikecrowe fix to correctly default for custom pick lists
            $options = array();
            $found = false;
            for ($j = 0; $j < $noofpickrows; $j++) {
                $pickListValue = $adb->query_result($pickListResult, $j, 'currency_name');
                $currency_id = $adb->query_result($pickListResult, $j, 'id');
                if ($value == $currency_id) {
                    $chk_val = "selected";
                    $found = true;
                } else {
                    $chk_val = '';
                }
                $options[$currency_id] = array($pickListValue => $chk_val);
            }
            $fieldvalue[] = $options;
            $fieldvalue[] = $is_admin;
        } elseif ($uitype == 98) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $value;
            $fieldvalue[] = getRoleName($value);
            $fieldvalue[] = $is_admin;
        } elseif ($uitype == 105) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            if (isset($col_fields['record_id']) && $col_fields['record_id'] != '') {
                $query = "select vtiger_attachments.path, vtiger_attachments.name from vtiger_contactdetails left join vtiger_seattachmentsrel on vtiger_seattachmentsrel.crmid=vtiger_contactdetails.contactid inner join vtiger_attachments on vtiger_attachments.attachmentsid=vtiger_seattachmentsrel.attachmentsid where vtiger_contactdetails.imagename=vtiger_attachments.name and contactid=?";
                $result_image = $adb->pquery($query, array($col_fields['record_id']));
                for ($image_iter = 0; $image_iter < $adb->num_rows($result_image); $image_iter++) {
                    $image_array[] = $adb->query_result($result_image, $image_iter, 'name');
                    $image_path_array[] = $adb->query_result($result_image, $image_iter, 'path');
                }
            }
            if (is_array($image_array)) {
                for ($img_itr = 0; $img_itr < count($image_array); $img_itr++) {
                    $fieldvalue[] = array('name' => $image_array[$img_itr], 'path' => $image_path_array[$img_itr]);
                }
            } else {
                $fieldvalue[] = '';
            }
        } elseif ($uitype == 101) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = getOwnerName($value);
            $fieldvalue[] = $value;
        } elseif ($uitype == 26) {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $folderid = $col_fields['folderid'];
            $foldername_query = 'select foldername from vtiger_attachmentsfolder where folderid = ?';
            $res = $adb->pquery($foldername_query, array($folderid));
            $foldername = $adb->query_result($res, 0, 'foldername');
            if ($foldername != '' && $folderid != '') {
                $fldr_name[$folderid] = $foldername;
            }
            $sql = "select foldername,folderid from vtiger_attachmentsfolder order by foldername";
            $res = $adb->pquery($sql, array());
            for ($i = 0; $i < $adb->num_rows($res); $i++) {
                $fid = $adb->query_result($res, $i, "folderid");
                $fldr_name[$fid] = $adb->query_result($res, $i, "foldername");
            }
            $fieldvalue[] = $fldr_name;
        } elseif ($uitype == 27) {
            if ($value == 'E') {
                $external_selected = "selected";
                $filename = $col_fields['filename'];
            } else {
                $internal_selected = "selected";
                $filename = $col_fields['filename'];
            }
            $editview_label[] = array(getTranslatedString('Internal'), getTranslatedString('External'));
            $editview_label[] = array($internal_selected, $external_selected);
            $editview_label[] = array("I", "E");
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $fieldvalue[] = $value;
            $fieldvalue[] = $filename;
        } elseif ($uitype == '31') {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $options = array();
            $themeList = get_themes();
            foreach ($themeList as $theme) {
                if ($value == $theme) {
                    $selected = 'selected';
                } else {
                    $selected = '';
                }
                $options[] = array(getTranslatedString($theme), $theme, $selected);
            }
            $fieldvalue[] = $options;
        } elseif ($uitype == '32') {
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            $options = array();
            $languageList = Vtiger_Language::getAll();
            foreach ($languageList as $prefix => $label) {
                if ($value == $prefix) {
                    $selected = 'selected';
                } else {
                    $selected = '';
                }
                $options[] = array(getTranslatedString($label), $prefix, $selected);
            }
            $fieldvalue[] = $options;
        } else {
            //Added condition to set the subject if click Reply All from web mail
            if ($_REQUEST['module'] == 'Emails' && $_REQUEST['mg_subject'] != '') {
                $value = $_REQUEST['mg_subject'];
            }
            $editview_label[] = getTranslatedString($fieldlabel, $module_name);
            if ($fieldname == 'fileversion') {
                if (empty($value)) {
                    $value = '';
                } else {
                    $fieldvalue[] = $value;
                }
            } else {
                $fieldvalue[] = $value;
            }
        }
    }
    // Mike Crowe Mod --------------------------------------------------------force numerics right justified.
    if (!preg_match("/id=/i", $custfld)) {
        $custfld = preg_replace("/<input/iS", "<input id='{$fieldname}' ", $custfld);
    }
    if (in_array($uitype, array(71, 72, 7, 9, 90))) {
        $custfld = preg_replace("/<input/iS", "<input align=right ", $custfld);
    }
    $final_arr[] = $ui_type;
    $final_arr[] = $editview_label;
    $final_arr[] = $editview_fldname;
    $final_arr[] = $fieldvalue;
    $type_of_data = explode('~', $typeofdata);
    $final_arr[] = $type_of_data[1];
    $log->debug('Exiting getOutputHtml method ...');
    return $final_arr;
}
예제 #9
0
 /**
  * Function to get the display value in edit view
  * @param $value
  * @return converted value
  */
 public function getEditViewDisplayValue($value, $record = false)
 {
     $value = DateTimeField::convertToUserTimeZone(date('Y-m-d') . ' ' . $value);
     $value = $value->format('H:i:s');
     return self::getTimeValueInAMorPM($value);
 }
예제 #10
0
 function getUserRecurringInfo()
 {
     $recurringType = $this->getRecurringType();
     $recurringInfo = array();
     if ($recurringType == 'Weekly') {
         if ($this->dayofweek_to_rpt != null) {
             $dbStartDateTime = new DateTime($this->startdate->get_DB_formatted_date() . ' ' . $this->startdate->get_formatted_time());
             $dayOfWeek = $this->dayofweek_to_rpt;
             $userDaysOfWeek = array();
             for ($i = 0; $i < count($dayOfWeek); ++$i) {
                 $selectedDayOfWeek = $dayOfWeek[$i];
                 $currentDayOfWeek = $dbStartDateTime->format('w');
                 $newDate = $dbStartDateTime->format('d') + ($selectedDayOfWeek - $currentDayOfWeek);
                 $dbStartDateTime->setDate($dbStartDateTime->format('Y'), $dbStartDateTime->format('m'), $newDate);
                 $userStartDateTime = DateTimeField::convertToUserTimeZone($dbStartDateTime->format('Y-m-d') . ' ' . $dbStartDateTime->format('H:i'));
                 $userDaysOfWeek[] = $userStartDateTime->format('w');
             }
             $recurringInfo['dayofweek_to_repeat'] = $userDaysOfWeek;
         }
     } elseif ($recurringType == 'Monthly') {
         $dbStartDateTime = new DateTime($this->startdate->get_DB_formatted_date() . ' ' . $this->startdate->get_formatted_time());
         $recurringInfo['repeatmonth_type'] = $this->repeat_monthby;
         if ($this->repeat_monthby == 'date') {
             $dayOfMonth = $this->rptmonth_datevalue;
             $dbStartDateTime->setDate($dbStartDateTime->format('Y'), $dbStartDateTime->format('m'), $dayOfMonth);
             $userStartDateTime = DateTimeField::convertToUserTimeZone($dbStartDateTime->format('Y-m-d') . ' ' . $dbStartDateTime->format('H:i'));
             $recurringInfo['repeatmonth_date'] = $userStartDateTime->format('d');
         } else {
             $dayOfWeek = $this->dayofweek_to_rpt[0];
             $recurringInfo['repeatmonth_daytype'] = $this->rptmonth_daytype;
             if ($this->rptmonth_daytype == 'first' or $this->rptmonth_daytype == 'second' or $this->rptmonth_daytype == 'third') {
                 $dbStartDateTime->setDate($dbStartDateTime->format('Y'), $dbStartDateTime->format('m'), 1);
                 $dayOfWeekForFirstDay = $dbStartDateTime->format('N');
                 if ($dayOfWeekForFirstDay < $dayOfWeek) {
                     $date = $dayOfWeek - $dayOfWeekForFirstDay + 1;
                 } else {
                     $date = 7 - $dayOfWeekForFirstDay + $dayOfWeek + 1;
                 }
                 if ($this->rptmonth_daytype == 'second') {
                     $date += 7;
                 }
                 if ($this->rptmonth_daytype == 'third') {
                     $date += 14;
                 }
             } elseif ($this->rptmonth_daytype == 'last') {
                 $daysInMonth = $dbStartDateTime->format('t');
                 $dbStartDateTime->setDate($dbStartDateTime->format('Y'), $dbStartDateTime->format('m'), $daysInMonth);
                 $dayOfWeekForLastDay = $dbStartDateTime->format('N');
                 if ($dayOfWeekForLastDay < $dayOfWeek) {
                     $date = $daysInMonth - 7 + ($dayOfWeek - $dayOfWeekForLastDay);
                 } else {
                     $date = $daysInMonth - ($dayOfWeekForLastDay - $dayOfWeek);
                 }
             }
             $dbStartDateTime->setDate($dbStartDateTime->format('Y'), $dbStartDateTime->format('m'), $date);
             $userStartDateTime = DateTimeField::convertToUserTimeZone($dbStartDateTime->format('Y-m-d') . ' ' . $dbStartDateTime->format('H:i'));
             $recurringInfo['dayofweek_to_repeat'][0] = $userStartDateTime->format('N');
         }
     }
     return $recurringInfo;
 }
예제 #11
0
 /**
  * Function to get formatted date in users time zone
  * @return <Date>
  */
 function get_userTimezone_formatted_date()
 {
     $dateTimeInUserFormat = DateTimeField::convertToUserTimeZone($this->get_DB_formatted_date() . ' ' . $this->get_formatted_time());
     return $dateTimeInUserFormat->format('Y-m-d');
 }
예제 #12
0
파일: VtUtils.php 프로젝트: Wasage/werpa
 public static function convertToUserTZ($date)
 {
     if (class_exists("DateTimeField")) {
         $fslfitv = "date";
         ${${"GLOBALS"}["rfzzycoqwhw"]} = DateTimeField::convertToUserTimeZone(${$fslfitv});
         return $return->format("Y-m-d H:i:s");
     } else {
         $nbgifml = "date";
         return ${$nbgifml};
     }
 }
예제 #13
0
 public static function convertToUserTZ($date)
 {
     if (class_exists("DateTimeField")) {
         $return = \DateTimeField::convertToUserTimeZone($date);
         return $return->format("Y-m-d H:i:s");
     } else {
         return $date;
     }
 }
예제 #14
0
 public static function convertToUserTZ($date)
 {
     if (class_exists("DateTimeField")) {
         ${"GLOBALS"}["zmihcgdsngi"] = "date";
         ${${"GLOBALS"}["ruafhkaxlbyo"]} = \DateTimeField::convertToUserTimeZone(${${"GLOBALS"}["zmihcgdsngi"]});
         return $return->format("Y-m-d H:i:s");
     } else {
         return ${${"GLOBALS"}["thoumpsfcdy"]};
     }
 }