function getCalendarCustomFields($tabid, $mode = 'edit', $col_fields = '')
{
    global $adb, $log, $current_user;
    $log->debug("Entering getCalendarCustomFields({$tabid}, {$mode}, {$col_fields})");
    require 'user_privileges/user_privileges_' . $current_user->id . '.php';
    $isduplicate = vtlib_purify($_REQUEST['isDuplicate']);
    $calmode = vtlib_purify($_REQUEST['action']);
    $block = getBlockId($tabid, "LBL_CUSTOM_INFORMATION");
    $custparams = array($block, $tabid);
    if ($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] == 0) {
        $custquery = "select * from vtiger_field where block=? AND vtiger_field.tabid=? ORDER BY fieldid";
    } else {
        $profileList = getCurrentUserProfileList();
        $custquery = "SELECT vtiger_field.* FROM vtiger_field" . " INNER JOIN vtiger_profile2field ON vtiger_profile2field.fieldid=vtiger_field.fieldid" . " INNER JOIN vtiger_def_org_field ON vtiger_def_org_field.fieldid=vtiger_field.fieldid" . " WHERE vtiger_field.block=? AND vtiger_field.tabid=? AND vtiger_profile2field.visible=0" . " AND vtiger_def_org_field.visible=0 AND vtiger_profile2field.profileid IN (" . generateQuestionMarks($profileList) . ")";
        if ($mode == 'edit') {
            $custquery .= "  AND vtiger_profile2field.readonly = 0";
        }
        $custquery .= " GROUP BY vtiger_field.fieldid";
        array_push($custparams, $profileList);
    }
    $custresult = $adb->pquery($custquery, $custparams);
    $custFldArray = array();
    $noofrows = $adb->num_rows($custresult);
    for ($i = 0; $i < $noofrows; $i++) {
        $fieldname = $adb->query_result($custresult, $i, "fieldname");
        $fieldlabel = $adb->query_result($custresult, $i, "fieldlabel");
        $columnName = $adb->query_result($custresult, $i, "columnname");
        $uitype = $adb->query_result($custresult, $i, "uitype");
        $maxlength = $adb->query_result($custresult, $i, "maximumlength");
        $generatedtype = $adb->query_result($custresult, $i, "generatedtype");
        $typeofdata = $adb->query_result($custresult, $i, "typeofdata");
        $defaultvalue = $adb->query_result($custresult, $i, "defaultvalue");
        if (empty($col_fields[$fieldname]) && $mode != 'detail_view' && !$isduplicate && $calmode != 'EventEditView' && $calmode != 'EditView') {
            $col_fields[$fieldname] = $defaultvalue;
        }
        if ($mode == 'edit') {
            $custfld = getOutputHtml($uitype, $fieldname, $fieldlabel, $maxlength, $col_fields, $generatedtype, 'Calendar', $mode, $typeofdata);
        }
        if ($mode == 'detail_view') {
            $custfld = getDetailViewOutputHtml($uitype, $fieldname, $fieldlabel, $col_fields, $generatedtype, $tabid);
        }
        $custFldArray[] = $custfld;
    }
    $log->debug("Exiting getCalendarCustomFields()");
    return $custFldArray;
}
     $uitype = 85;
     $type = "C(255) default () ";
     //adodb type
     $uichekdata = 'V~O';
 } elseif ($fldType == 'Time') {
     $uitype = 14;
     $type = "TIME";
     $uichekdata = 'T~O';
 }
 // No Decimal Places Handling
 //1. add the customfield vtiger_table to the vtiger_field vtiger_table as Block4
 //2. fetch the contents of the custom vtiger_field and show in the UI
 $custfld_sequece = $adb->getUniqueID("vtiger_customfield_sequence");
 $blockid = '';
 //get the blockid for this custom block
 $blockid = getBlockId($tabid, 'LBL_CUSTOM_INFORMATION');
 if (is_numeric($blockid)) {
     if ($mode == "edit" && $_REQUEST['fieldid'] != '') {
         $query = "update vtiger_field set fieldlabel=?, typeofdata=? where fieldid=?";
         $adb->pquery($query, array($fldlabel, $uichekdata, $_REQUEST['fieldid']));
     } else {
         if ($_REQUEST['fieldid'] == '') {
             $query = "insert into vtiger_field (tabid,fieldid,columnname,tablename,generatedtype,uitype,fieldname,fieldlabel,\n\t\t\t\treadonly,presence,defaultvalue,maximumlength,sequence,block,displaytype,typeofdata,quickcreate,quickcreatesequence,info_type) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
             $qparams = array($tabid, $custfld_fieldid, $columnName, $tableName, 2, $uitype, $columnName, $fldlabel, 0, 0, '', 100, $custfld_sequece, $blockid, 1, $uichekdata, 1, 0, 'BAS');
             $adb->pquery($query, $qparams);
             $adb->alterTable($tableName, $columnName . " " . $type, "Add_Column");
             //Inserting values into vtiger_profile2field vtiger_tables
             $sql1 = "select * from vtiger_profile";
             $sql1_result = $adb->pquery($sql1, array());
             $sql1_num = $adb->num_rows($sql1_result);
             for ($i = 0; $i < $sql1_num; $i++) {
Example #3
0
function isMoveout($conn, $route, $neighborhood, $block)
{
    if (getBlockId($conn, $route, $neighborhood) != $block) {
        return true;
    }
    return false;
}
Example #4
0
//88 starts
Migration_Index_View::ExecuteQuery("UPDATE vtiger_currencies SET currency_symbol=? WHERE currency_code=?", array('₹', 'INR'));
Migration_Index_View::ExecuteQuery("UPDATE vtiger_currency_info SET currency_symbol=? WHERE currency_code=?", array('₹', 'INR'));
Migration_Index_View::ExecuteQuery('UPDATE vtiger_projecttaskstatus set presence = 0 where projecttaskstatus in (?,?,?,?,?)', array('Open', 'In Progress', 'Completed', 'Deferred', 'Canceled'));
echo '<br> made projecttaskstatus picklist values as non editable';
//88 ends
//89 starts
//89 ends
//90 starts
//Updating User fields Sequence
$userFields = array('user_name', 'email1', 'first_name', 'last_name', 'user_password', 'confirm_password', 'is_admin', 'roleid', 'lead_view', 'status', 'end_hour', 'is_owner', 'dayoftheweek', 'start_hour', 'date_format', 'hour_format', 'time_zone', 'activity_view', 'callduration', 'othereventduration', 'defaulteventstatus', 'defaultactivitytype', 'reminder_interval', 'calendarsharedtype');
$sequence = 0;
$usersTabId = getTabId('Users');
$blockIds = array();
$blockIds[] = getBlockId($usersTabId, 'LBL_USERLOGIN_ROLE');
$blockIds[] = getBlockId($usersTabId, 'LBL_CALENDAR_SETTINGS');
$updateQuery = "UPDATE vtiger_field SET sequence = CASE fieldname ";
foreach ($userFields as $fieldName) {
    if ($fieldName == 'dayoftheweek') {
        $sequence = 0;
    }
    $updateQuery .= " WHEN '{$fieldName}' THEN  " . ++$sequence;
}
$updateQuery .= " END WHERE tabid = {$usersTabId} AND block IN (" . generateQuestionMarks($blockIds) . ")";
Migration_Index_View::ExecuteQuery($updateQuery, $blockIds);
echo "<br>User Fields Sequence Updated";
// updating Emails module in sharing access rules
$EmailsTabId = getTabId('Emails');
$query = "SELECT tabid FROM vtiger_def_org_share";
$result = $adb->pquery($query, array());
$resultCount = $adb->num_rows($result);
Example #5
0
function webserviceMigration()
{
    global $adb;
    require_once 'include/utils/CommonUtils.php';
    require_once 'include/Webservices/Utils.php';
    $fieldTypeInfo = array('picklist' => array(15, 16), 'text' => array(19, 20, 21, 24), 'autogenerated' => array(3), 'phone' => array(11), 'multipicklist' => array(33), 'url' => array(17), 'skype' => array(85), 'boolean' => array(56, 156), 'owner' => array(53), 'file' => array(61, 28));
    $referenceMapping = array("50" => array("Accounts"), "51" => array("Accounts"), "57" => array("Contacts"), "58" => array("Campaigns"), "73" => array("Accounts"), "75" => array("Vendors"), "76" => array("Potentials"), "78" => array("Quotes"), "80" => array("SalesOrder"), "81" => array("Vendors"), "101" => array("Users"), "52" => array("Users"), "357" => array("Contacts", "Accounts", "Leads", "Users", "Vendors"), "59" => array("Products"), "66" => array("Leads", "Accounts", "Potentials", "HelpDesk"), "77" => array("Users"), "68" => array("Contacts", "Accounts"), "117" => array('Currency'), "116" => array('Currency'), '26' => array('DocumentFolders'), '10' => array());
    ExecuteQuery("CREATE TABLE IF NOT EXISTS vtiger_ws_fieldtype(fieldtypeid integer(19) not null auto_increment,uitype varchar(30)not null,fieldtype varchar(200) not null,PRIMARY KEY(fieldtypeid),UNIQUE KEY uitype_idx (uitype)) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
    ExecuteQuery("CREATE TABLE IF NOT EXISTS vtiger_ws_referencetype(fieldtypeid integer(19) not null,type varchar(25) not null,PRIMARY KEY(fieldtypeid,type),  CONSTRAINT `fk_1_vtiger_referencetype` FOREIGN KEY (`fieldtypeid`) REFERENCES `vtiger_ws_fieldtype` (`fieldtypeid`) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
    ExecuteQuery("CREATE TABLE IF NOT EXISTS vtiger_ws_userauthtoken(userid integer(19) not null,token varchar(25) not null,expiretime INTEGER(19),PRIMARY KEY(userid,expiretime),UNIQUE KEY userid_idx (userid)) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
    ExecuteQuery("alter table vtiger_users add column accesskey varchar(36);");
    $fieldid = $adb->getUniqueID("vtiger_field");
    $usersTabId = getTabid("Users");
    $user_adv_block_id = getBlockId($usersTabId, 'LBL_USER_ADV_OPTIONS');
    ExecuteQuery("insert into vtiger_field (tabid, fieldid, columnname, tablename, generatedtype, uitype, fieldname, fieldlabel, readonly, presence, selected, maximumlength, sequence, block, displaytype, typeofdata, quickcreate, quickcreatesequence, info_type, masseditable, helpinfo) values({$usersTabId},{$fieldid},'accesskey','vtiger_users',1,3,'accesskey','Webservice Access Key',1,0,0,100,2,{$user_adv_block_id},2,'V~O',1,null,'BAS',0,'Webservice Access Key');");
    foreach ($referenceMapping as $uitype => $referenceArray) {
        $success = true;
        $result = $adb->pquery("insert into vtiger_ws_fieldtype(uitype,fieldtype) values(?,?)", array($uitype, "reference"));
        if (!is_object($result)) {
            $success = false;
        }
        $result = $adb->pquery("select * from vtiger_ws_fieldtype where uitype=?", array($uitype));
        $rowCount = $adb->num_rows($result);
        for ($i = 0; $i < $rowCount; $i++) {
            $fieldTypeId = $adb->query_result($result, $i, "fieldtypeid");
            foreach ($referenceArray as $index => $referenceType) {
                $result = $adb->pquery("insert into vtiger_ws_referencetype(fieldtypeid,type) values(?,?)", array($fieldTypeId, $referenceType));
                if (!is_object($result)) {
                    echo "failed for: {$referenceType}, uitype: {$fieldTypeId}";
                    $success = false;
                }
            }
        }
        if (!$success) {
            echo "Migration Query Failed";
            break;
        }
    }
    foreach ($fieldTypeInfo as $type => $uitypes) {
        foreach ($uitypes as $uitype) {
            $result = $adb->pquery("insert into vtiger_ws_fieldtype(uitype,fieldtype) values(?,?)", array($uitype, $type));
            if (!is_object($result)) {
                "Query for fieldtype details({$uitype}:uitype,{$type}:fieldtype)";
            }
        }
    }
    $sql = "select * from vtiger_users";
    $updateQuery = "update vtiger_users set accesskey=? where id=?";
    $result = $adb->pquery($sql, array());
    $rowCount = $adb->num_rows($result);
    for ($i = 0; $i < $rowCount; $i++) {
        $userId = $adb->query_result($result, $i, "id");
        $insertResult = $adb->pquery($updateQuery, array(vtws_generateRandomAccessKey(16), $userId));
        if (!is_object($insertResult)) {
            echo "failed for user: "******"user_name");
            break;
        }
    }
    ExecuteQuery("CREATE TABLE IF NOT EXISTS vtiger_ws_entity(id integer(11) not null auto_increment PRIMARY\n\t\tKEY,name varchar(25) not null UNIQUE,handler_path varchar(255) NOT NULL,handler_class varchar(64) NOT NULL,\n\t\tismodule int(3) NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
    ExecuteQuery("CREATE TABLE IF NOT EXISTS vtiger_ws_entity_name(entity_id integer(11) not null PRIMARY\n\t\tKEY,name_fields varchar(50),index_field varchar(50),table_name varchar(50)) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
    $names = vtws_getModuleNameList();
    $moduleHandler = array('file' => 'include/Webservices/VtigerModuleOperation.php', 'class' => 'VtigerModuleOperation');
    foreach ($names as $tab) {
        if (in_array($tab, array('Rss', 'Webmails', 'Recyclebin'))) {
            continue;
        }
        $entityId = $adb->getUniqueID("vtiger_ws_entity");
        $adb->pquery('insert into vtiger_ws_entity(id,name,handler_path,handler_class,ismodule) values (?,?,?,?,?)', array($entityId, $tab, $moduleHandler['file'], $moduleHandler['class'], 1));
    }
    $entityId = $adb->getUniqueID("vtiger_ws_entity");
    $adb->pquery('insert into vtiger_ws_entity(id,name,handler_path,handler_class,ismodule) values (?,?,?,?,?)', array($entityId, 'Events', $moduleHandler['file'], $moduleHandler['class'], 1));
    $entityId = $adb->getUniqueID("vtiger_ws_entity");
    $adb->pquery('insert into vtiger_ws_entity(id,name,handler_path,handler_class,ismodule) values (?,?,?,?,?)', array($entityId, 'Users', $moduleHandler['file'], $moduleHandler['class'], 1));
    vtws_addDefaultActorTypeEntity('Groups', array('fieldNames' => 'groupname', 'indexField' => 'groupid', 'tableName' => 'vtiger_groups'));
    ExecuteQuery("CREATE TABLE IF NOT EXISTS `vtiger_ws_entity_tables` (`webservice_entity_id` int(11) NOT NULL ,`table_name` varchar(50) NOT NULL , PRIMARY KEY  (`webservice_entity_id`,`table_name`), CONSTRAINT `fk_1_vtiger_ws_actor_tables` FOREIGN KEY (`webservice_entity_id`) REFERENCES `vtiger_ws_entity` (`id`) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=utf8");
    ExecuteQuery("CREATE TABLE IF NOT EXISTS vtiger_ws_entity_fieldtype(fieldtypeid integer(19) not null auto_increment,table_name varchar(50) not null,field_name varchar(50) not null,fieldtype varchar(200) not null,PRIMARY KEY(fieldtypeid),UNIQUE KEY vtiger_idx_1_tablename_fieldname (table_name,field_name)) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
    ExecuteQuery("CREATE TABLE IF NOT EXISTS vtiger_ws_entity_referencetype(fieldtypeid integer(19) not null,type varchar(25) not null,PRIMARY KEY(fieldtypeid,type),  CONSTRAINT `vtiger_fk_1_actors_referencetype` FOREIGN KEY (`fieldtypeid`) REFERENCES `vtiger_ws_entity_fieldtype` (`fieldtypeid`) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
    require_once "include/Webservices/WebServiceError.php";
    require_once 'include/Webservices/VtigerWebserviceObject.php';
    $webserviceObject = VtigerWebserviceObject::fromName($adb, 'Groups');
    ExecuteQuery("insert into vtiger_ws_entity_tables(webservice_entity_id,table_name) values ({$webserviceObject->getEntityId()},'vtiger_groups')");
    ExecuteQuery("CREATE TABLE IF NOT EXISTS vtiger_ws_operation(operationid int(11) not null auto_increment PRIMARY KEY,name varchar(128) \n\tnot null UNIQUE,handler_path varchar(255),handler_method varchar(64), type varchar(8) not null,prelogin int(3) not null, KEY vtiger_idx_ws_oepration_prelogin (prelogin)) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
    ExecuteQuery("CREATE TABLE IF NOT EXISTS `vtiger_ws_operation_parameters` (`operationid` int(11) NOT NULL, `name` varchar(128) NOT NULL,\n\t\t`type` varchar(64) NOT NULL, sequence int(11) not null,PRIMARY KEY  (`operationid`,`name`), CONSTRAINT \n\t\t`vtiger_fk_1_ws_operation_params` FOREIGN KEY (`operationid`) REFERENCES `vtiger_ws_operation` (`operationid`) \n\t\tON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
    $operationMeta = array("login" => array("include" => array("include/Webservices/Login.php"), "handler" => "vtws_login", "params" => array("username" => "String", "accessKey" => "String"), "prelogin" => 1, "type" => "POST"), "retrieve" => array("include" => array("include/Webservices/Retrieve.php"), "handler" => "vtws_retrieve", "params" => array("id" => "String"), "prelogin" => 0, "type" => "GET"), "create" => array("include" => array("include/Webservices/Create.php"), "handler" => "vtws_create", "params" => array("elementType" => "String", "element" => "encoded"), "prelogin" => 0, "type" => "POST"), "update" => array("include" => array("include/Webservices/Update.php"), "handler" => "vtws_update", "params" => array("element" => "encoded"), "prelogin" => 0, "type" => "POST"), "delete" => array("include" => array("include/Webservices/Delete.php"), "handler" => "vtws_delete", "params" => array("id" => "String"), "prelogin" => 0, "type" => "POST"), "sync" => array("include" => array("include/Webservices/GetUpdates.php"), "handler" => "vtws_sync", "params" => array("modifiedTime" => "DateTime", "elementType" => "String"), "prelogin" => 0, "type" => "GET"), "query" => array("include" => array("include/Webservices/Query.php"), "handler" => "vtws_query", "params" => array("query" => "String"), "prelogin" => 0, "type" => "GET"), "logout" => array("include" => array("include/Webservices/Logout.php"), "handler" => "vtws_logout", "params" => array("sessionName" => "String"), "prelogin" => 0, "type" => "POST"), "listtypes" => array("include" => array("include/Webservices/ModuleTypes.php"), "handler" => "vtws_listtypes", "params" => array(), "prelogin" => 0, "type" => "GET"), "getchallenge" => array("include" => array("include/Webservices/AuthToken.php"), "handler" => "vtws_getchallenge", "params" => array("username" => "String"), "prelogin" => 1, "type" => "GET"), "describe" => array("include" => array("include/Webservices/DescribeObject.php"), "handler" => "vtws_describe", "params" => array("elementType" => "String"), "prelogin" => 0, "type" => "GET"), "extendsession" => array("include" => array("include/Webservices/ExtendSession.php"), "handler" => "vtws_extendSession", 'params' => array(), "prelogin" => 1, "type" => "POST"));
    $createOperationQuery = "insert into vtiger_ws_operation(operationid,name,handler_path,handler_method,type,prelogin) \n\t\tvalues (?,?,?,?,?,?);";
    $createOperationParamsQuery = "insert into vtiger_ws_operation_parameters(operationid,name,type,sequence) \n\t\tvalues (?,?,?,?);";
    foreach ($operationMeta as $operationName => $operationDetails) {
        $operationId = $adb->getUniqueID("vtiger_ws_operation");
        $result = $adb->pquery($createOperationQuery, array($operationId, $operationName, $operationDetails['include'], $operationDetails['handler'], $operationDetails['type'], $operationDetails['prelogin']));
        $params = $operationDetails['params'];
        $sequence = 1;
        foreach ($params as $paramName => $paramType) {
            $result = $adb->pquery($createOperationParamsQuery, array($operationId, $paramName, $paramType, $sequence++));
        }
    }
    vtws_addDefaultActorTypeEntity('Currency', array('fieldNames' => 'currency_name', 'indexField' => 'id', 'tableName' => 'vtiger_currency_info'));
    require_once 'include/Webservices/VtigerWebserviceObject.php';
    $webserviceObject = VtigerWebserviceObject::fromName($adb, 'Currency');
    ExecuteQuery("insert into vtiger_ws_entity_tables(webservice_entity_id,table_name) values ({$webserviceObject->getEntityId()},'vtiger_currency_info')");
    vtws_addDefaultActorTypeEntity('DocumentFolders', array('fieldNames' => 'foldername', 'indexField' => 'folderid', 'tableName' => 'vtiger_attachmentsfolder'));
    $webserviceObject = VtigerWebserviceObject::fromName($adb, 'DocumentFolders');
    ExecuteQuery("insert into vtiger_ws_entity_tables(webservice_entity_id,table_name) values ({$webserviceObject->getEntityId()},'vtiger_attachmentsfolder')");
    $success = true;
    $fieldTypeId = $adb->getUniqueID("vtiger_ws_entity_fieldtype");
    $result = $adb->pquery("insert into vtiger_ws_entity_fieldtype(fieldtypeid,table_name,field_name,fieldtype) values(?,?,?,?);", array($fieldTypeId, 'vtiger_attachmentsfolder', 'createdby', "reference"));
    if (!is_object($result)) {
        echo "failed fo init<br>";
        $success = false;
    }
    $result = $adb->pquery("insert into vtiger_ws_entity_referencetype(fieldtypeid,type) values(?,?)", array($fieldTypeId, 'Users'));
    if (!is_object($result)) {
        echo "failed for: Users, fieldtypeid: {$fieldTypeId}";
        $success = false;
    }
    if (!$success) {
        echo "Migration Query Failed";
    }
}
Example #6
0
 /**
  * Dodaje od modułu pole uitype 10
  *
  * @param string $moduleName nazwa modułu
  * @param string $blockLabel etykieta bloku
  * @param array $relModuleList tablica zawierająca listę modułów powiązanych
  * @param string $fieldName nazwa pola 
  * @param bool $mandatory czy pole ma być obowiązkowe
  * @param string $fieldLabel etykieta pola, jeśli nie jest podany etykieta jest taka jak nazwa pola
  */
 public static function addUitype10Field($moduleName, $blockLabel, $relModuleList, $fieldName, $mandatory = false, $fieldLabel = NULL)
 {
     if (self::checkArg(func_get_args(), 4)) {
         vglobal('Vtiger_Utils_Log', TRUE);
         $tabid = Vtiger_Functions::getModuleId($moduleName);
         $blockId = getBlockId($tabid, $blockLabel);
         $moduleInstance = Vtiger_Module::getInstance($moduleName);
         $blockInstance = Vtiger_Block::getInstance($blockId, $moduleInstance);
         $fieldInstance = new Vtiger_Field();
         $fieldInstance->name = strtolower($fieldName);
         if ($moduleInstance->table_name) {
             $fieldInstance->table = $moduleInstance->table_name;
         } else {
             $fieldInstance->table = 'vtiger_' . strtolower($moduleName);
         }
         if ($fieldLabel) {
             $fieldInstance->label = $fieldLabel;
         } else {
             $fieldInstance->label = $fieldName;
         }
         $fieldInstance->column = $fieldName;
         $fieldInstance->columntype = 'int(19)';
         $fieldInstance->uitype = 10;
         if ($mandatory) {
             $fieldInstance->typeofdata = 'V~M';
         } else {
             $fieldInstance->typeofdata = 'V~O';
         }
         $blockInstance->addField($fieldInstance);
         $fieldInstance->setRelatedModules($relModuleList);
     }
 }
//SalesPlatform.ru begin
Migration_Index_View::ExecuteQuery('UPDATE vtiger_users SET dayoftheweek = ?, callduration = ?, othereventduration = ?, start_hour = ? ', array('Monday', 5, 5, '00:00'));
/*vtiger commented code
Migration_Index_View::ExecuteQuery('UPDATE vtiger_users SET dayoftheweek = ?, callduration = ?, othereventduration = ?, start_hour = ? ', array('Sunday', 5, 5, '00:00'));
 */
//SalesPlatform.ru end
$moduleInstance = Vtiger_Module::getInstance('Events');
$tabId = getTabid('Events');
// Update/Increment the sequence for the succeeding blocks of Events module, with starting sequence 4
Migration_Index_View::ExecuteQuery('UPDATE vtiger_blocks SET sequence = sequence+1 WHERE tabid=? AND sequence >= 4', array($tabId));
// Create Recurrence Information block
$recurrenceBlock = new Vtiger_Block();
$recurrenceBlock->label = 'LBL_RELATED_TO';
$recurrenceBlock->sequence = 4;
$moduleInstance->addBlock($recurrenceBlock);
$blockId = getBlockId($tabId, 'LBL_RELATED_TO');
Migration_Index_View::ExecuteQuery('UPDATE vtiger_field SET block=? WHERE fieldname IN (?,?) and tabid=?', array($blockId, 'contact_id', 'parent_id', $tabId));
Migration_Index_View::ExecuteQuery('UPDATE vtiger_field SET displaytype=1 WHERE fieldname=? and tabid=?', array('recurringtype', $tabId));
// END 2012.12.02
// //////////////////////////////////////////////
$inventoryModules = array('Invoice' => array('LBL_INVOICE_INFORMATION', 'vtiger_invoice', 'invoiceid'), 'SalesOrder' => array('LBL_SO_INFORMATION', 'vtiger_salesorder', 'salesorderid'), 'PurchaseOrder' => array('LBL_PO_INFORMATION', 'vtiger_purchaseorder', 'purchaseorderid'), 'Quotes' => array('LBL_QUOTE_INFORMATION', 'vtiger_quotes', 'quoteid'));
foreach ($inventoryModules as $module => $details) {
    $tableName = $details[1];
    $moduleInstance = Vtiger_Module::getInstance($module);
    $block = Vtiger_Block::getInstance($details[0], $moduleInstance);
    $preTaxTotalField = new Vtiger_Field();
    $preTaxTotalField->name = 'pre_tax_total';
    $preTaxTotalField->label = 'Pre Tax Total';
    $preTaxTotalField->table = $tableName;
    $preTaxTotalField->column = 'pre_tax_total';
    $preTaxTotalField->columntype = 'decimal(25,8)';
Example #8
0
         }
     }
     if ($error) {
         $error = 'You have mistakes with your enter:' . $error;
     } else {
         $checkexistquery = "SELECT * FROM user WHERE email='" . $_POST['email'] . "'";
         $checkesistresult = mysqli_query($link, $checkexistquery);
         $checkexistrows = mysqli_num_rows($checkesistresult);
         if ($checkexistrows) {
             $error = "this email has registered, Do you want to Log in?";
         } else {
             $addnewuserquery = "INSERT INTO `User`(`Email`, `Password`,`Address`,`Name`,`RegisterTime`,`LastAccessTime`) VALUES ('" . $_POST['registeremail'] . "','" . $_POST['registerpassword'] . "','" . $_POST['registeraddress'] . "','" . $_POST['registername'] . "','" . $registertime . "','" . $registertime . "')";
             mysqli_query($link, $addnewuserquery);
             $_SESSION['id'] = mysqli_insert_id($link);
             $array = getaddress($_POST['registeraddress']);
             insertWaitingList($link, $_SESSION['id'], getBlockId($link, $array[1], $array[2]));
             //echo getBlockId($link,$array[1],$array[2]);
             header("Location:NotMemberYet.php");
         }
     }
 }
 if ($_POST['submit'] == "Log in") {
     date_default_timezone_set("America/New_York");
     $lastaccesstime = date("Y-m-d H:i:s");
     $loginquery = "SELECT * FROM User WHERE Email='" . $_POST['loginemail'] . "' AND Password='******'loginpassword'] . "'";
     $loginresult = mysqli_query($link, $loginquery);
     $rows = mysqli_fetch_array($loginresult);
     if ($rows) {
         $_SESSION['id'] = $rows['UserId'];
         $_SESSION['blockid'] = $rows['BlockId'];
         $updatelastaccesstime = "UPDATE User SET LastAccessTime='" . $lastaccesstime . "'WHERE UserId='" . $_SESSION['id'] . "' ";
Example #9
0
 function databaseData()
 {
     global $log, $adb;
     $log->debug("Entering YetiForceUpdate::databaseData() method ...");
     $result = $adb->query('SELECT * FROM `a_yf_discounts_config`;');
     if (!$adb->getRowCount($result)) {
         $adb->pquery('insert  into `a_yf_discounts_config`(`param`,`value`) values (?,?);', ['active', '0']);
         $adb->pquery('insert  into `a_yf_discounts_config`(`param`,`value`) values (?,?);', ['aggregation', '0']);
         $adb->pquery('insert  into `a_yf_discounts_config`(`param`,`value`) values (?,?);', ['discounts', '0,1,2']);
     }
     $result = $adb->query('SELECT * FROM `a_yf_taxes_config`;');
     if (!$adb->getRowCount($result)) {
         $adb->pquery('insert  into `a_yf_taxes_config`(`param`,`value`) values (?,?);', ['active', '0']);
         $adb->pquery('insert  into `a_yf_taxes_config`(`param`,`value`) values (?,?);', ['aggregation', '0']);
         $adb->pquery('insert  into `a_yf_taxes_config`(`param`,`value`) values (?,?);', ['taxs', '0,1,2,3']);
     }
     $blockId = getBlockId(getTabid('Accounts'), 'LBL_FINANSIAL_SUMMARY');
     if ($blockId) {
         $adb->pquery('UPDATE `vtiger_field` SET `block` = ?, `sequence` = ? WHERE `tabid` = ? AND `columnname` = ?;', [$blockId, '6', getTabid('Accounts'), 'payment_balance']);
     }
     $this->addFields();
     $integrationBlock = $adb->pquery('SELECT * FROM vtiger_settings_blocks WHERE label=?', ['LBL_EXTENDED_MODULES']);
     $integrationBlockCount = $adb->getRowCount($integrationBlock);
     // To add Block
     if ($integrationBlockCount > 0) {
         $blockid = $adb->query_result($integrationBlock, 0, 'blockid');
     } else {
         $blockid = $adb->getUniqueID('vtiger_settings_blocks');
         $sequenceResult = $adb->pquery("SELECT max(sequence) as sequence FROM vtiger_settings_blocks", []);
         if ($adb->getRowCount($sequenceResult)) {
             $sequence = $adb->query_result($sequenceResult, 0, 'sequence');
         }
         $adb->pquery("INSERT INTO vtiger_settings_blocks(blockid, label, sequence) VALUES(?,?,?)", [$blockid, 'LBL_EXTENDED_MODULES', ++$sequence]);
     }
     $result = $adb->pquery("SELECT * FROM `vtiger_settings_field` WHERE `name` = ? ", ['LBL_CREDITLIMITS']);
     if (!$adb->getRowCount($result)) {
         $sequence = (int) $adb->query_result($adb->pquery("SELECT max(sequence) as sequence FROM vtiger_settings_field WHERE blockid=?", [$blockid]), 0, 'sequence') + 1;
         $fieldid = $adb->getUniqueId('vtiger_settings_field');
         $adb->pquery("INSERT INTO vtiger_settings_field (fieldid,blockid,sequence,name,iconpath,description,linkto)\n\t\t\tVALUES (?,?,?,?,?,?,?)", [$fieldid, $blockid, $sequence, 'LBL_CREDITLIMITS', '', 'LBL_CREDITLIMITS_DESCRIPTION', 'index.php?module=Inventory&parent=Settings&view=CreditLimits']);
     }
     $result = $adb->pquery("SELECT * FROM `vtiger_settings_field` WHERE `name` = ? ", ['LBL_TAXES']);
     if (!$adb->getRowCount($result)) {
         $sequence = (int) $adb->query_result($adb->pquery("SELECT max(sequence) as sequence FROM vtiger_settings_field WHERE blockid=?", [$blockid]), 0, 'sequence') + 1;
         $fieldid = $adb->getUniqueId('vtiger_settings_field');
         $adb->pquery("INSERT INTO vtiger_settings_field (fieldid,blockid,sequence,name,iconpath,description,linkto)\n\t\t\tVALUES (?,?,?,?,?,?,?)", [$fieldid, $blockid, $sequence, 'LBL_TAXES', '', 'LBL_TAXES_DESCRIPTION', 'index.php?module=Inventory&parent=Settings&view=Taxes']);
     }
     $result = $adb->pquery("SELECT * FROM `vtiger_settings_field` WHERE `name` = ? ", ['LBL_TAXCONFIGURATION']);
     if (!$adb->getRowCount($result)) {
         $sequence = (int) $adb->query_result($adb->pquery("SELECT max(sequence) as sequence FROM vtiger_settings_field WHERE blockid=?", [$blockid]), 0, 'sequence') + 1;
         $fieldid = $adb->getUniqueId('vtiger_settings_field');
         $adb->pquery("INSERT INTO vtiger_settings_field (fieldid,blockid,sequence,name,iconpath,description,linkto)\n\t\t\tVALUES (?,?,?,?,?,?,?)", [$fieldid, $blockid, $sequence, 'LBL_TAXCONFIGURATION', '', 'LBL_TAXCONFIGURATION_DESCRIPTION', 'index.php?module=Inventory&parent=Settings&view=TaxConfiguration']);
     }
     $result = $adb->pquery("SELECT * FROM `vtiger_settings_field` WHERE `name` = ? ", ['LBL_DISCOUNTS']);
     if (!$adb->getRowCount($result)) {
         $sequence = (int) $adb->query_result($adb->pquery("SELECT max(sequence) as sequence FROM vtiger_settings_field WHERE blockid=?", [$blockid]), 0, 'sequence') + 1;
         $fieldid = $adb->getUniqueId('vtiger_settings_field');
         $adb->pquery("INSERT INTO vtiger_settings_field (fieldid,blockid,sequence,name,iconpath,description,linkto)\n\t\t\tVALUES (?,?,?,?,?,?,?)", [$fieldid, $blockid, $sequence, 'LBL_DISCOUNTS', '', 'LBL_DISCOUNTS_DESCRIPTION', 'index.php?module=Inventory&parent=Settings&view=Discounts']);
     }
     $result = $adb->pquery("SELECT * FROM `vtiger_settings_field` WHERE `name` = ? ", ['LBL_DISCOUNTCONFIGURATION']);
     if (!$adb->getRowCount($result)) {
         $sequence = (int) $adb->query_result($adb->pquery("SELECT max(sequence) as sequence FROM vtiger_settings_field WHERE blockid=?", [$blockid]), 0, 'sequence') + 1;
         $fieldid = $adb->getUniqueId('vtiger_settings_field');
         $adb->pquery("INSERT INTO vtiger_settings_field (fieldid,blockid,sequence,name,iconpath,description,linkto)\n\t\t\tVALUES (?,?,?,?,?,?,?)", [$fieldid, $blockid, $sequence, 'LBL_DISCOUNTCONFIGURATION', '', 'LBL_DISCOUNTCONFIGURATION_DESCRIPTION', 'index.php?module=Inventory&parent=Settings&view=DiscountConfiguration']);
     }
     $result = $adb->pquery("SELECT * FROM `vtiger_ossmailscanner_config` WHERE `conf_type` = ? AND `parameter` = ? ", ['exceptions', 'crating_mails']);
     $num = $adb->getRowCount($result);
     if ($num > 1) {
         $adb->pquery('UPDATE `vtiger_ossmailscanner_config` SET `parameter` = ?, `value` = ? WHERE `parameter` = ? AND `conf_type` = ? LIMIT 1;', ['crating_tickets', '', 'crating_mails', 'exceptions']);
     }
     $adb->pquery("UPDATE `vtiger_relatedlists` SET `actions` = ?, `name` = ?  WHERE tabid = ? AND `related_tabid` = ? AND `name` = ?;", ['ADD', 'get_dependents_list', getTabid('Vendors'), getTabid('Contacts'), 'get_contacts']);
     $adb->pquery("UPDATE `vtiger_entityname` SET `fieldname` = ?, `searchcolumn` = ? WHERE `fieldname` = ? AND `tabid` = ?;", ['company', 'company', 'lastname', getTabid('Leads')]);
     $adb->pquery("UPDATE `vtiger_field` SET `uitype` = ?, `typeofdata` = ?, `presence` = ? WHERE `fieldname` = ? AND `tabid` = ?;", ['2', 'V~O', '1', 'lastname', getTabid('Leads')]);
     $adb->pquery("UPDATE `vtiger_field` SET `typeofdata` = ? WHERE `fieldname` IN (?) AND `tabid` = ?;", ['V~O', 'legal_form', getTabid('Leads')]);
     $adb->pquery("UPDATE `vtiger_field` SET `typeofdata` = ? WHERE `fieldname` IN (?) AND `tabid` = ?;", ['V~O', 'vat_id', getTabid('Leads')]);
     $adb->pquery("UPDATE `vtiger_blocks` SET `sequence` = ? WHERE `tabid` = ? AND `blocklabel` = ? AND `sequence` = ?;", [7, getTabid('Events'), 'LBL_DESCRIPTION_INFORMATION', 6]);
     $adb->pquery("UPDATE `vtiger_blocks` SET `sequence` = ? WHERE `tabid` = ? AND `blocklabel` = ? AND `sequence` = ?;", [6, getTabid('SMSNotifier'), 'LBL_DESCRIPTION_INFORMATION', 5]);
     $adb->pquery("UPDATE `vtiger_blocks` SET `sequence` = ? WHERE `tabid` = ? AND `blocklabel` = ? AND `sequence` = ?;", [7, getTabid('OSSMailView'), 'LBL_DESCRIPTION_INFORMATION', 6]);
     $adb->pquery("UPDATE `vtiger_blocks` SET `sequence` = ? WHERE `tabid` = ? AND `blocklabel` = ? AND `sequence` = ?;", [7, getTabid('OSSPasswords'), 'LBL_DESCRIPTION_INFORMATION', 6]);
     $adb->pquery("UPDATE `vtiger_blocks` SET `sequence` = ? WHERE `tabid` = ? AND `blocklabel` = ? AND `sequence` = ?;", [7, getTabid('OSSPasswords'), 'LBL_DESCRIPTION_INFORMATION', 6]);
     $this->deleteInheritsharing();
     $this->move();
     $result = $adb->pquery("SELECT actionid FROM `vtiger_actionmapping` WHERE `actionname` = ? ", ['TagCloud']);
     if ($adb->getRowCount($result)) {
         $actionid = $adb->getSingleValue($result);
         $result = $adb->pquery("SELECT actionid FROM `vtiger_actionmapping` WHERE `actionid` = ? ", [$actionid]);
         if ($adb->getRowCount($result) > 1) {
             $adb->pquery('DELETE FROM vtiger_actionmapping WHERE actionname=?', ['TagCloud']);
         }
     }
     $this->addActionMap();
     $this->addWorkflowType();
     $result = $adb->pquery("SELECT * FROM `vtiger_relatedlists` WHERE tabid = ? AND related_tabid = ? AND name = ?;", array(getTabid('Contacts'), getTabid('Events'), 'get_dependents_list'));
     if ($adb->getRowCount($result) == 0) {
         $moduleInstance = Vtiger_Module::getInstance('Events');
         $target_Module = Vtiger_Module::getInstance('Contacts');
         $target_Module->setRelatedList($moduleInstance, 'Events', array('ADD'), 'get_dependents_list');
     }
     $result = $adb->pquery('SELECT * FROM `yetiforce_proc_tc` WHERE type = ?;', ['timeControlWidget']);
     if (!$adb->getRowCount($result)) {
         $adb->pquery('insert  into `yetiforce_proc_tc`(`type`,`param`,`value`) values (?,?,?);', ['timeControlWidget', 'holidays', 'true']);
         $adb->pquery('insert  into `yetiforce_proc_tc`(`type`,`param`,`value`) values (?,?,?);', ['timeControlWidget', 'workingDays', 'true']);
         $adb->pquery('insert  into `yetiforce_proc_tc`(`type`,`param`,`value`) values (?,?,?);', ['timeControlWidget', 'workingTime', 'true']);
     }
     $result = $adb->pquery('SELECT * FROM `vtiger_ws_fieldtype` WHERE fieldtype = ?;', ['taxes']);
     if (!$adb->getRowCount($result)) {
         $key = $this->getMax('vtiger_ws_fieldtype', 'fieldtypeid');
         $adb->pquery('insert  into `vtiger_ws_fieldtype`(`fieldtypeid`,`uitype`,`fieldtype`) values (?,?,?);', [$key, '303', 'taxes']);
     }
     $result = $adb->pquery('SELECT * FROM `vtiger_ws_fieldtype` WHERE fieldtype = ?;', ['inventoryLimit']);
     if (!$adb->getRowCount($result)) {
         $key = $this->getMax('vtiger_ws_fieldtype', 'fieldtypeid');
         $adb->pquery('insert  into `vtiger_ws_fieldtype`(`fieldtypeid`,`uitype`,`fieldtype`) values (?,?,?);', [$key, '304', 'inventoryLimit']);
     }
     $result = $adb->pquery('SELECT * FROM `vtiger_ws_fieldtype` WHERE fieldtype = ?;', ['multiReferenceValue']);
     if (!$adb->getRowCount($result)) {
         $key = $this->getMax('vtiger_ws_fieldtype', 'fieldtypeid');
         $adb->pquery('insert  into `vtiger_ws_fieldtype`(`fieldtypeid`,`uitype`,`fieldtype`) values (?,?,?);', [$key, '305', 'multiReferenceValue']);
     }
     $this->changeActivity();
     $addHandler[] = ['vtiger.entity.link.after', 'modules/Vtiger/handlers/MultiReferenceUpdater.php', 'Vtiger_MultiReferenceUpdater_Handler', '', '1', '[]'];
     $addHandler[] = ['vtiger.entity.unlink.after', 'modules/Vtiger/handlers/MultiReferenceUpdater.php', 'Vtiger_MultiReferenceUpdater_Handler', '', '1', '[]'];
     $this->addHandler($addHandler);
     $this->addCron([['LBL_MULTI_REFERENCE_VALUE', 'cron/MultiReference.service', '900', NULL, NULL, '1', 'com_vtiger_workflow', '15', NULL]]);
     $adb->pquery("UPDATE com_vtiger_workflow_tasktypes SET  modules = CASE " . " WHEN tasktypename = 'VTCreateTodoTask' THEN ? " . "WHEN tasktypename = 'VTCreateEventTask' THEN ? " . "ELSE modules END WHERE tasktypename IN (?,?) ", ['{"include":["Accounts","Contacts","Leads","OSSEmployees","Vendors","Campaigns","HelpDesk","Potentials","Project","ServiceContracts"],"exclude":["Calendar","FAQ","Events"]}', '{"include":["Accounts","Contacts","Leads","OSSEmployees","Vendors","Campaigns","HelpDesk","Potentials","Project","ServiceContracts"],"exclude":["Calendar","FAQ","Events"]}', 'VTCreateTodoTask', 'VTCreateEventTask']);
     $result = $adb->pquery('SELECT * FROM `vtiger_dataaccess_cnd` WHERE fieldname = ?;', ['taskstatus']);
     if ($adb->getRowCount($result)) {
         $adb->pquery('UPDATE `vtiger_dataaccess_cnd` SET `val` = ?, fieldname = ?  WHERE `fieldname` = ?;', ['PLL_PLANNED', 'activitystatus', 'taskstatus']);
     }
     $result = $adb->pquery('SELECT * FROM `vtiger_dataaccess_cnd` WHERE fieldname = ?;', ['eventstatus']);
     if ($adb->getRowCount($result)) {
         $adb->pquery('UPDATE `vtiger_dataaccess_cnd` SET `val` = ?, fieldname = ?  WHERE `fieldname` = ?;', ['PLL_COMPLETED', 'activitystatus', 'eventstatus']);
     }
     $adb->pquery('UPDATE `vtiger_picklist` SET `name` = ? WHERE `name` = ?;', ['activitystatus', 'taskstatus']);
     $this->updateForgotPassword();
     $this->changeOutgoingServerFile();
     $adb->pquery("UPDATE `vtiger_field` SET `quickcreate` = ?, `quickcreatesequence` = ? WHERE `fieldname` = ? AND tabid IN (?,?);", [2, 8, 'shownerid', getTabid('Events'), getTabid('Calendar')]);
     $integrationBlock = $adb->pquery('SELECT * FROM vtiger_settings_blocks WHERE label=?', ['LBL_OTHER_SETTINGS']);
     $blockid = 0;
     if ($adb->getRowCount($integrationBlock) > 0) {
         $blockid = $adb->query_result($integrationBlock, 0, 'blockid');
     }
     $result = $adb->pquery("SELECT * FROM `vtiger_settings_field` WHERE `name` = ? ", ['LBL_SWITCH_USERS']);
     if (!$adb->getRowCount($result) && $blockid) {
         $sequence = (int) $adb->query_result($adb->pquery("SELECT max(sequence) as sequence FROM vtiger_settings_field WHERE blockid=?", [$blockid]), 0, 'sequence') + 1;
         $fieldid = $adb->getUniqueId('vtiger_settings_field');
         $adb->pquery("INSERT INTO vtiger_settings_field (fieldid,blockid,sequence,name,iconpath,description,linkto)\n\t\t\tVALUES (?,?,?,?,?,?,?)", [$fieldid, $blockid, $sequence, 'LBL_SWITCH_USERS', '', 'LBL_SWITCH_USERS_DESCRIPTION', 'index.php?module=Users&view=SwitchUsers&parent=Settings']);
     }
     $log->debug("Exiting YetiForceUpdate::databaseData() method ...");
 }