function applyChange()
 {
     global $adb;
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         global $adb;
         $moduleInstance = Vtiger_Module::getInstance('Users');
         $block = Vtiger_Block::getInstance('LBL_CALENDAR_SETTINGS', $moduleInstance);
         if (!$block) {
             $block = new Vtiger_Block();
             $block->label = 'LBL_CALENDAR_SETTINGS';
             $block->sequence = 2;
             $moduleInstance->addBlock($block);
         }
         $this->ExecuteQuery("delete from vtiger_picklist where name='hour_format'");
         $this->ExecuteQuery("delete from vtiger_picklist where name='start_hour'");
         $field = Vtiger_Field::getInstance('hour_format', $moduleInstance);
         $this->ExecuteQuery('update vtiger_field set presence=2,uitype=16 where fieldid=' . $field->id);
         $field->setPicklistValues(array('am/pm', '12', '24'));
         $start_hour = Vtiger_Field::getInstance('start_hour', $moduleInstance);
         $this->ExecuteQuery('update vtiger_field set presence=2,uitype=16 where fieldid=' . $start_hour->id);
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
 function applyChange()
 {
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         global $adb;
         $moduleInstance = Vtiger_Module::getInstance('GlobalVariable');
         // change uitype and label
         $field = Vtiger_Field::getInstance('module_list', $moduleInstance);
         if ($field) {
             $this->ExecuteQuery("update vtiger_field set uitype=3313,fieldlabel='Module List' where fieldid=" . $field->id);
         }
         // convert all existing records to new format
         $gvrs = $adb->pquery('select globalvariableid,module_list from vtiger_globalvariable', array());
         $updsql = 'update vtiger_globalvariable set module_list=? where globalvariableid=?';
         while ($gv = $adb->fetch_array($gvrs)) {
             if (trim($gv['module_list']) != '') {
                 $ml = array_map('trim', explode(',', $gv['module_list']));
                 $ml = implode(' |##| ', $ml);
                 $this->ExecuteQuery($updsql, array($ml, $gv['globalvariableid']));
             }
         }
         // fix incorrect entiyidentifier
         $updsql = "UPDATE `vtiger_entityname` SET \n\t\t\t\t`fieldname`='globalno',\n\t\t\t\t`entityidfield`='globalvariableid',\n\t\t\t\t`entityidcolumn`='globalvariableid'\n\t\t\t\tWHERE `modulename`='GlobalVariable' and `tablename`='vtiger_globalvariable'";
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
Example #3
0
 function applyChange()
 {
     global $adb;
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         global $adb;
         $modname = 'SalesOrder';
         $module = Vtiger_Module::getInstance($modname);
         $field = Vtiger_Field::getInstance('recurring_frequency', $module);
         if ($field) {
             $field->setPicklistValues(array('2years', '3years', '4years', '5years'));
             $this->ExecuteQuery("UPDATE vtiger_recurring_frequency SET sortorderid=7 WHERE recurring_frequency='2years'");
             $this->ExecuteQuery("UPDATE vtiger_recurring_frequency SET sortorderid=8 WHERE recurring_frequency='3years'");
             $this->ExecuteQuery("UPDATE vtiger_recurring_frequency SET sortorderid=9 WHERE recurring_frequency='4years'");
             $this->ExecuteQuery("UPDATE vtiger_recurring_frequency SET sortorderid=10 WHERE recurring_frequency='5years'");
         }
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
 function applyChange()
 {
     global $adb;
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         $moduleInstance = Vtiger_Module::getInstance('Users');
         $block = Vtiger_Block::getInstance('LBL_USER_ADV_OPTIONS', $moduleInstance);
         $field = Vtiger_Field::getInstance('failed_login_attempts', $moduleInstance);
         if ($field) {
             $this->ExecuteQuery('update vtiger_field set presence=2 where fieldid=' . $field->id);
         } else {
             $user_field = new Vtiger_Field();
             $user_field->name = 'failed_login_attempts';
             $user_field->label = 'LBL_FAILED_LOGIN_ATTEMPTS';
             $user_field->table = 'vtiger_users';
             $user_field->column = 'failed_login_attempts';
             $user_field->columntype = 'int(11)';
             $user_field->typeofdata = 'I~O';
             $user_field->uitype = '7';
             $user_field->masseditable = '0';
             $block->addField($user_field);
             $this->ExecuteQuery('update vtiger_users set failed_login_attempts=0');
             RecalculateSharingRules();
         }
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
 function applyChange()
 {
     global $adb;
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         $moduleInstance = Vtiger_Module::getInstance('Products');
         $field = Vtiger_Field::getInstance('discontinued', $moduleInstance);
         if ($field) {
             $this->ExecuteQuery("update vtiger_field set defaultvalue='1' where fieldid=" . $field->id);
         }
         $moduleInstance = Vtiger_Module::getInstance('Services');
         $field = Vtiger_Field::getInstance('discontinued', $moduleInstance);
         if ($field) {
             $this->ExecuteQuery("update vtiger_field set defaultvalue='1' where fieldid=" . $field->id);
         }
         $moduleInstance = Vtiger_Module::getInstance('PriceBooks');
         $field = Vtiger_Field::getInstance('active', $moduleInstance);
         if ($field) {
             $this->ExecuteQuery("update vtiger_field set defaultvalue='1' where fieldid=" . $field->id);
         }
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
 function undoChange()
 {
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         // undo your magic here
         $moduleInstance = Vtiger_Module::getInstance('Potentials');
         $field = Vtiger_Field::getInstance('forecast_amount', $moduleInstance);
         if ($field) {
             $this->ExecuteQuery('update vtiger_field set presence=1 where fieldid=' . $field->id);
         }
         global $adb;
         $wfrs = $adb->query("SELECT workflow_id FROM com_vtiger_workflows WHERE summary='Calculate or Update forecast amount'");
         if ($wfrs and $adb->num_rows($wfrs) == 1) {
             $wfid = $adb->query_result($wfrs, 0, 0);
             $this->deleteWorkflow($wfid);
             $this->sendMsg('Workflow deleted!');
         }
         $this->sendMsg('Changeset ' . get_class($this) . ' undone!');
         $this->markUndone();
     } else {
         $this->sendMsg('Changeset ' . get_class($this) . ' not applied!');
     }
     $this->finishExecution();
 }
 function applyChange()
 {
     global $adb;
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         $moduleInstance = Vtiger_Module::getInstance('Users');
         $block = Vtiger_Block::getInstance('LBL_MORE_INFORMATION', $moduleInstance);
         $field = Vtiger_Field::getInstance('send_email_to_sender', $moduleInstance);
         if ($field) {
             $this->ExecuteQuery('update vtiger_field set presence=2 where fieldid=' . $field->id);
         } else {
             $user_field = new Vtiger_Field();
             $user_field->name = 'send_email_to_sender';
             $user_field->label = 'LBL_SEND_EMAIL_TO_SENDER';
             $user_field->table = 'vtiger_users';
             $user_field->column = 'send_email_to_sender';
             $user_field->columntype = 'varchar(3)';
             $user_field->typeofdata = 'C~O';
             $user_field->uitype = '56';
             $user_field->masseditable = '0';
             $block->addField($user_field);
             $this->ExecuteQuery("update vtiger_users set send_email_to_sender='1'");
             RecalculateSharingRules();
         }
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
 function applyChange()
 {
     global $adb;
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         global $adb;
         $moduleInstance = Vtiger_Module::getInstance('Users');
         $block = Vtiger_Block::getInstance('LBL_CALENDAR_SETTINGS', $moduleInstance);
         if (!$block) {
             $block = new Vtiger_Block();
             $block->label = 'LBL_CALENDAR_SETTINGS';
             $block->sequence = 2;
             $moduleInstance->addBlock($block);
         }
         $this->ExecuteQuery('drop table if exists vtiger_hour_format');
         $this->ExecuteQuery('drop table if exists vtiger_start_hour');
         $field = Vtiger_Field::getInstance('hour_format', $moduleInstance);
         if ($field) {
             $this->ExecuteQuery('update vtiger_field set presence=2,uitype=16 where fieldid=' . $field->id);
         } else {
             $field = new Vtiger_Field();
             $field->name = 'hour_format';
             $field->label = 'Calendar Hour Format';
             $field->table = 'vtiger_users';
             $field->column = 'hour_format';
             $field->columntype = 'varchar(4)';
             $field->typeofdata = 'V~O';
             $field->uitype = '16';
             $field->masseditable = '0';
             $block->addField($field);
         }
         $field->setPicklistValues(array('12', '24'));
         $start_hour = Vtiger_Field::getInstance('start_hour', $moduleInstance);
         if ($start_hour) {
             $this->ExecuteQuery('update vtiger_field set presence=2,uitype=16 where fieldid=' . $start_hour->id);
         } else {
             $start_hour = new Vtiger_Field();
             $start_hour->name = 'start_hour';
             $start_hour->label = 'Day starts at';
             $start_hour->table = 'vtiger_users';
             $start_hour->column = 'start_hour';
             $start_hour->columntype = 'varchar(5)';
             $start_hour->typeofdata = 'V~O';
             $start_hour->uitype = '16';
             $start_hour->masseditable = '0';
             $block->addField($start_hour);
         }
         $start_hour->setPicklistValues(array('00:00', '01:00', '02:00', '03:00', '04:00', '05:00', '06:00', '07:00', '08:00', '09:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00', '23:00'));
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
Example #9
0
 public function getHeaders()
 {
     $this->initListViewController();
     if (!$this->listviewHeaders) {
         $headerFieldModels = array();
         foreach ($this->listviewController->getListViewHeaderFields() as $fieldName => $webserviceField) {
             $fieldObj = Vtiger_Field::getInstance($webserviceField->getFieldId());
             $headerFieldModels[$fieldName] = Vtiger_Field_Model::getInstanceFromFieldObject($fieldObj);
         }
         $this->listviewHeaders = $headerFieldModels;
     }
     return $this->listviewHeaders;
 }
Example #10
0
 function applyChange()
 {
     global $adb;
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         global $adb;
         $modname = 'Products';
         $module = Vtiger_Module::getInstance($modname);
         $block = Vtiger_Block::getInstance('LBL_PRICING_INFORMATION', $module);
         $field = Vtiger_Field::getInstance('cost_price', $module);
         if (!$field) {
             $field1 = new Vtiger_Field();
             $field1->name = 'cost_price';
             $field1->label = 'Cost Price';
             $field1->column = 'cost_price';
             $field1->columntype = 'DECIMAL(28,6)';
             $field1->uitype = 71;
             $field1->typeofdata = 'N~O';
             $field1->displaytype = 1;
             $field1->presence = 0;
             $block->addField($field1);
         }
         $modname = 'Services';
         $module = Vtiger_Module::getInstance($modname);
         $block = Vtiger_Block::getInstance('LBL_PRICING_INFORMATION', $module);
         $field = Vtiger_Field::getInstance('cost_price', $module);
         if (!$field) {
             $field1 = new Vtiger_Field();
             $field1->name = 'cost_price';
             $field1->label = 'Cost Price';
             $field1->column = 'cost_price';
             $field1->columntype = 'DECIMAL(28,6)';
             $field1->uitype = 71;
             $field1->typeofdata = 'N~O';
             $field1->displaytype = 1;
             $field1->presence = 0;
             $block->addField($field1);
         }
     }
     $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
     $this->markApplied();
     $this->finishExecution();
 }
 function applyChange()
 {
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         $moduleInstance = Vtiger_Module::getInstance('Vendors');
         $field = Vtiger_Field::getInstance('phone', $moduleInstance);
         if ($field) {
             $this->ExecuteQuery('update vtiger_field set uitype=11 where fieldid=' . $field->id);
         }
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
 function applyChange()
 {
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         $moduleInstance = Vtiger_Module::getInstance('Project');
         $field = Vtiger_Field::getInstance('targetbudget', $moduleInstance);
         if ($field) {
             $this->ExecuteQuery("update vtiger_field set typeofdata='N~O' where fieldid=" . $field->id);
         }
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
 function applyChange()
 {
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         global $adb;
         $moduleInstance = Vtiger_Module::getInstance('GlobalVariable');
         $field = Vtiger_Field::getInstance('gvname', $moduleInstance);
         if ($field) {
             $field->setPicklistValues(array('product_service_default'));
         }
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
 function applyChange()
 {
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         $global_variables = array('product_service_default', 'Debug_Record_Not_Found', 'Product_Default_Units', 'Service_Default_Units', 'Maximum_Scheduled_Workflows', 'Billing_Address_Checked', 'Shipping_Address_Checked', 'Tax_Type_Default', 'calendar_call_default_duration', 'calendar_other_default_duration', 'calendar_sort_users_by', 'Debug_Send_VtigerCron_Error', 'Import_Full_CSV', 'Lead_Convert_TransferToAccount', 'Show_Copy_Adress_Header', 'SalesOrderStatusOnInvoiceSave', 'QuoteStatusOnSalesOrderSave');
         $moduleInstance = Vtiger_Module::getInstance('GlobalVariable');
         $field = Vtiger_Field::getInstance('gvname', $moduleInstance);
         if ($field) {
             $field->setPicklistValues($global_variables);
         }
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
 function applyChange()
 {
     global $adb;
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         $moduleInstance = Vtiger_Module::getInstance('Products');
         $field = Vtiger_Field::getInstance('discontinued', $moduleInstance);
         if ($field) {
             $this->ExecuteQuery("update vtiger_field set typeofdata='C~O' where typeofdata='V~O' and fieldid=" . $field->id);
             $this->ExecuteQuery("update vtiger_field set typeofdata='C~M' where typeofdata='V~M' and fieldid=" . $field->id);
         }
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
Example #16
0
 function applyChange()
 {
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         $global_variables = array('Debug_Record_Not_Found', 'Debug_Report_Query', 'Debug_ListView_Query', 'Debug_Popup_Query', 'Debug_Send_VtigerCron_Error', 'Debug_Send_AdminLoginIPAuth_Error', 'Application_Global_Search_SelectedModules', 'Application_Storage_Directory', 'Application_Storage_SaveStrategy', 'Application_Global_Search_Binary', 'Application_OpenRecordInNewXOnRelatedList', 'Application_OpenRecordInNewXOnListView', 'Application_MaxFailedLoginAttempts', 'Application_ExpirePasswordAfterDays', 'Application_AdminLoginIPs', 'Application_ListView_MaxColumns', 'Application_Action_Panel_Open', 'Application_Search_Panel_Open', 'Calendar_Modules_Panel_Visible', 'Calendar_Default_Reminder_Minutes', 'Calendar_Slot_Minutes', 'Calendar_Show_Inactive_Users', 'Calendar_Show_Group_Events', 'calendar_call_default_duration', 'calendar_other_default_duration', 'calendar_sort_users_by', 'CronTasks_cronWatcher_mailto', 'BusinessMapping_SalesOrder2Invoice', 'BusinessMapping_PotentialOnCampaignRelation', 'Webservice_showUserAdvancedBlock', 'Users_ReplyTo_SecondEmail', 'Users_Default_Send_Email_Template', 'Accounts_BlockDuplicateName', 'Campaign_CreatePotentialOnAccountRelation', 'Campaign_CreatePotentialOnContactRelation', 'GoogleCalendarSync_BaseUpdateMonths', 'GoogleCalendarSync_BaseCreateMonths', 'Import_Full_CSV', 'Lead_Convert_TransferToAccount', 'Product_Copy_Bundle_OnDuplicate', 'Product_Show_Subproducts_Popup', 'Product_Permit_Relate_Bundle_Parent', 'Product_Permit_Subproduct_Be_Parent', 'Product_Maximum_Number_Images', 'Workflow_Send_Email_ToCCBCC', 'Workflow_GeoDistance_Country_Default', 'ModComments_DefaultCriteria', 'ModComments_DefaultBlockStatus', 'Report_Send_Scheduled_ifEmpty', 'Maximum_Scheduled_Workflows', 'Billing_Address_Checked', 'Shipping_Address_Checked', 'Show_Copy_Adress_Header', 'Tax_Type_Default', 'product_service_default', 'Product_Default_Units', 'Service_Default_Units', 'SalesOrderStatusOnInvoiceSave', 'QuoteStatusOnSalesOrderSave', 'Report.Excel.Export.RowHeight');
         $moduleInstance = Vtiger_Module::getInstance('GlobalVariable');
         $field = Vtiger_Field::getInstance('gvname', $moduleInstance);
         if ($field) {
             $field->setPicklistValues($global_variables);
         }
         $this->ExecuteQuery("ALTER TABLE `vtiger_globalvariable` CHANGE `value` `value` VARCHAR(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;");
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
 function applyChange()
 {
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         $global_variables = array('product_service_default', 'Debug_Record_Not_Found', 'Debug_Report_Query', 'Product_Default_Units', 'Service_Default_Units', 'Maximum_Scheduled_Workflows', 'Billing_Address_Checked', 'Shipping_Address_Checked', 'Tax_Type_Default', 'calendar_call_default_duration', 'calendar_other_default_duration', 'calendar_sort_users_by', 'Debug_Send_VtigerCron_Error', 'Import_Full_CSV', 'Lead_Convert_TransferToAccount', 'Show_Copy_Adress_Header', 'SalesOrderStatusOnInvoiceSave', 'QuoteStatusOnSalesOrderSave', 'GoogleCalendarSync_BaseUpdateMonths', 'GoogleCalendarSync_BaseCreateMonths', 'Report.Excel.Export.RowHeight', 'Calendar_Modules_Panel_Visible', 'Calendar_Default_Reminder_Minutes', 'Application_Global_Search_Binary', 'Calendar_Slot_Minutes', 'Users_ReplyTo_SecondEmail', 'Workflow_Send_Email_ToCCBCC', 'BusinessMapping_SalesOrder2Invoice', 'Calendar_Show_Inactive_Users', 'Campaign_CreatePotentialOnAccountRelation', 'Campaign_CreatePotentialOnContactRelation', 'BusinessMapping_PotentialOnCampaignRelation', 'Application_Global_Search_SelectedModules');
         $moduleInstance = Vtiger_Module::getInstance('GlobalVariable');
         $field = Vtiger_Field::getInstance('gvname', $moduleInstance);
         if ($field) {
             $field->setPicklistValues($global_variables);
         }
         $this->ExecuteQuery("ALTER TABLE `vtiger_globalvariable` CHANGE `value` `value` VARCHAR(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;");
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
Example #18
0
 function applyChange()
 {
     global $adb;
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         $cbmaptypes = array('Record Access Control', 'Record Set Mapping', 'Module Set Mapping', 'ListColumns', 'DuplicateRelations', 'MasterDetailLayout');
         $moduleInstance = Vtiger_Module::getInstance('cbMap');
         $field = Vtiger_Field::getInstance('maptype', $moduleInstance);
         if ($field) {
             $field->setPicklistValues($cbmaptypes);
         }
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
 function applyChange()
 {
     global $adb;
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         global $adb;
         $vendorsInstance = Vtiger_Module::getInstance('Vendors');
         $blockInstance = Vtiger_Block::getInstance('LBL_VENDOR_INFORMATION', $vendorsInstance);
         $field = Vtiger_Field::getInstance('assigned_user_id', $vendorsInstance);
         if ($field) {
             $this->ExecuteQuery('update vtiger_field set presence=2 where fieldid=' . $field->id);
         } else {
             $field = new Vtiger_Field();
             $field->name = 'assigned_user_id';
             $field->label = 'Assigned To';
             $field->table = 'vtiger_crmentity';
             $field->column = 'smownerid';
             $field->columntype = 'INT(11)';
             $field->uitype = 53;
             $field->displaytype = 1;
             $field->typeofdata = 'V~M';
             $field->presence = 2;
             $field->quickcreate = 0;
             $field->quicksequence = 5;
             $blockInstance->addField($field);
             // Allow Sharing access and role-based security for Vendors
             Vtiger_Access::deleteSharing($vendorsInstance);
             Vtiger_Access::initSharing($vendorsInstance);
             Vtiger_Access::allowSharing($vendorsInstance);
             Vtiger_Access::setDefaultSharing($vendorsInstance);
         }
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
    function applyChange()
    {
        global $adb;
        if ($this->hasError()) {
            $this->sendError();
        }
        if ($this->isApplied()) {
            $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
        } else {
            global $adb;
            $moduleInstance = Vtiger_Module::getInstance('ModComments');
            $block = Vtiger_Block::getInstance('LBL_OTHER_INFORMATION', $moduleInstance);
            $field = Vtiger_Field::getInstance('relatedassignedemail', $moduleInstance);
            if ($field) {
                $this->ExecuteQuery('update vtiger_field set presence=2 where fieldid=' . $field->id);
            } else {
                $modfield = new Vtiger_Field();
                $modfield->name = 'relatedassignedemail';
                $modfield->label = 'Related Assigned Email';
                $modfield->table = $moduleInstance->basetable;
                $modfield->column = 'relatedassignedemail';
                $modfield->columntype = 'varchar(254)';
                $modfield->typeofdata = 'E~O';
                $modfield->uitype = '13';
                $modfield->displaytype = 2;
                // read only
                $modfield->masseditable = '0';
                $block->addField($modfield);
            }
            $this->ExecuteQuery('UPDATE vtiger_modcomments
				INNER JOIN vtiger_crmentity on crmid=related_to
				INNER JOIN vtiger_users on id = smownerid
				SET relatedassignedemail = email1');
            $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
            $this->markApplied();
        }
        $this->finishExecution();
    }
 function applyChange()
 {
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         global $adb;
         $global_variables = array('preload_prototype', 'preload_jquery');
         $moduleInstance = Vtiger_Module::getInstance('GlobalVariable');
         $block = new Vtiger_Block();
         $block->label = 'GVarDefinitions';
         $moduleInstance->addBlock($block);
         if (!empty($block->id)) {
             $this->ExecuteQuery('update vtiger_blocks set display_status=0 where blockid=?', array($block->id));
         }
         $moduleInstance->addLink('LISTVIEWBASIC', 'Definitions', "javascript:gotourl('index.php?module=GlobalVariable&action=GlobalVariableDefinitions&parenttab=Tools')", '', 4);
         $field = Vtiger_Field::getInstance('gvname', $moduleInstance);
         if ($field) {
             foreach ($global_variables as $gvar) {
                 $sql = 'select * from vtiger_gvname where gvname=?';
                 $result = $adb->pquery($sql, array($gvar));
                 $origPicklistID = $adb->query_result($result, 0, 'picklist_valueid');
                 $sql = 'delete from vtiger_gvname where gvname=?';
                 $this->ExecuteQuery($sql, array($gvar));
                 $sql = 'delete from vtiger_role2picklist where picklistvalueid=?';
                 $this->ExecuteQuery($sql, array($origPicklistID));
                 $sql = 'DELETE FROM vtiger_picklist_dependency WHERE sourcevalue=? AND sourcefield=? AND tabid=?';
                 $this->ExecuteQuery($sql, array($gvar, 'gvname', $moduleInstance->id));
             }
         }
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
 function applyChange()
 {
     global $adb;
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         global $adb;
         //Fix types to hours in HelpDesk
         $modname = 'HelpDesk';
         $module = Vtiger_Module::getInstance($modname);
         $field = Vtiger_Field::getInstance('hours', $module);
         if ($field) {
             $this->ExecuteQuery("UPDATE vtiger_field SET typeofdata='N~O', uitype='7' WHERE fieldid=?", array($field->id));
             $this->ExecuteQuery("ALTER TABLE `vtiger_troubletickets` CHANGE `hours` `hours` DECIMAL( 28, 6 ) NULL DEFAULT NULL ;");
         }
         //Fix types to Used_units in ServiceContracts
         $modname = 'ServiceContracts';
         $module = Vtiger_Module::getInstance($modname);
         $field = Vtiger_Field::getInstance('used_units', $module);
         if ($field) {
             $this->ExecuteQuery("UPDATE vtiger_field SET typeofdata='N~O' WHERE fieldid=?", array($field->id));
             $this->ExecuteQuery("ALTER TABLE `vtiger_servicecontracts` CHANGE `used_units` `used_units` DECIMAL( 28, 6 ) NULL DEFAULT NULL ;");
         }
         $field = Vtiger_Field::getInstance('total_units', $module);
         if ($field) {
             $this->ExecuteQuery("UPDATE vtiger_field SET typeofdata='N~O' WHERE fieldid=?", array($field->id));
             $this->ExecuteQuery("ALTER TABLE `vtiger_servicecontracts` CHANGE `total_units` `total_units` DECIMAL( 28, 6 ) NULL DEFAULT NULL ;");
         }
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
Example #23
0
 function applyChange()
 {
     global $adb;
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         $moduleInstance = Vtiger_Module::getInstance('cbMap');
         $block = Vtiger_Block::getInstance('LBL_MAP_INFORMATION', $moduleInstance);
         $field = Vtiger_Field::getInstance('targetname', $moduleInstance);
         if ($field) {
             $this->ExecuteQuery('update vtiger_field set presence=2 where fieldid=' . $field->id);
         } else {
             $field = new Vtiger_Field();
             $field->name = 'targetname';
             $field->label = 'Target Module';
             $field->table = 'vtiger_cbmap';
             $field->column = 'targetname';
             $field->columntype = 'varchar(200)';
             $field->typeofdata = 'V~O';
             $field->uitype = '1613';
             $field->masseditable = '0';
             $field->sequence = 4;
             $block->addField($field);
         }
         $field = Vtiger_Field::getInstance('assigned_user_id', $moduleInstance);
         $this->ExecuteQuery('update vtiger_field set sequence=6 where fieldid=' . $field->id);
         $field = Vtiger_Field::getInstance('createdtime', $moduleInstance);
         $this->ExecuteQuery('update vtiger_field set sequence=7 where fieldid=' . $field->id);
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
 function applyChange()
 {
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         global $adb;
         $emm = new VTEntityMethodManager($adb);
         // Adding EntityMethod for Updating Products data after updating PurchaseOrder
         $emm->addEntityMethod("PurchaseOrder", "UpdateInventory", "include/InventoryHandler.php", "handleInventoryProductRel");
         // Creating Workflow for Updating Inventory Stock on PO
         $vtWorkFlow = new VTWorkflowManager($adb);
         $invWorkFlow = $vtWorkFlow->newWorkFlow("PurchaseOrder");
         $invWorkFlow->test = '[{"fieldname":"subject","operation":"does not contain","value":"`!`"}]';
         $invWorkFlow->description = "UpdateInventoryProducts On Every Save";
         $invWorkFlow->defaultworkflow = 1;
         $vtWorkFlow->save($invWorkFlow);
         $tm = new VTTaskManager($adb);
         $task = $tm->createTask('VTEntityMethodTask', $invWorkFlow->id);
         $task->active = true;
         $task->methodName = "UpdateInventory";
         $task->summary = "Update product stock";
         $tm->saveTask($task);
         // add Cancel status to Invoice and SO for stock control
         $moduleInstance = Vtiger_Module::getInstance('Invoice');
         $field = Vtiger_Field::getInstance('invoicestatus', $moduleInstance);
         if ($field) {
             $field->setPicklistValues(array('Cancel'));
         }
         $this->sendMsg('Changeset ' . get_class($this) . ' applied! Add Workflow Custom Function complete!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
Example #25
0
 /**
  * Remove widget from other modules.
  * @param unknown_type $moduleNames
  * @param unknown_type $widgetType
  * @param unknown_type $widgetName
  * @return unknown_type
  */
 static function removeWidgetFrom($moduleNames, $widgetType = 'DETAILVIEWWIDGET', $widgetName = 'DetailViewBlockCommentWidget')
 {
     if (empty($moduleNames)) {
         return;
     }
     include_once 'vtlib/Vtiger/Module.php';
     if (is_string($moduleNames)) {
         $moduleNames = array($moduleNames);
     }
     $commentWidgetModules = array();
     foreach ($moduleNames as $moduleName) {
         $module = Vtiger_Module::getInstance($moduleName);
         if ($module) {
             $module->deleteLink($widgetType, $widgetName, "block://ModComments:modules/ModComments/ModComments.php");
             $commentWidgetModules[] = $moduleName;
         }
     }
     if (count($commentWidgetModules) > 0) {
         $modCommentsModule = Vtiger_Module::getInstance('ModComments');
         $modCommentsRelatedToField = Vtiger_Field::getInstance('related_to', $modCommentsModule);
         $modCommentsRelatedToField->unsetRelatedModules($commentWidgetModules);
     }
 }
Example #26
0
 /**
  * Function to get instance
  * @param <String> $value - fieldname or fieldid
  * @param <type> $module - optional - module instance
  * @return <Vtiger_Field_Model>
  */
 public static function getInstance($value, $module = false)
 {
     $fieldObject = null;
     if ($module) {
         $fieldObject = Vtiger_Cache::get('field-' . $module->getId(), $value);
     }
     if (!$fieldObject) {
         $fieldObject = parent::getInstance($value, $module);
         if ($module) {
             Vtiger_Cache::set('field-' . $module->getId(), $value, $fieldObject);
         }
     }
     if ($fieldObject) {
         return self::getInstanceFromFieldObject($fieldObject);
     }
     return false;
 }
 function applyChange()
 {
     global $adb;
     if ($this->hasError()) {
         $this->sendError();
     }
     if ($this->isApplied()) {
         $this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
     } else {
         global $adb;
         $em = new VTEventsManager($adb);
         $em->registerHandler('vtiger.entity.aftersave', 'modules/Emails/evcbrcHandler.php', 'evcbrcHandler');
         $modPrj = Vtiger_Module::getInstance('Project');
         $modPrjTsk = Vtiger_Module::getInstance('ProjectTask');
         $modPot = Vtiger_Module::getInstance('Potentials');
         $modHD = Vtiger_Module::getInstance('HelpDesk');
         $modEmail = Vtiger_Module::getInstance('Emails');
         $modPrj->setRelatedList($modEmail, 'Emails', array('add'), 'get_emails');
         $modPrjTsk->setRelatedList($modEmail, 'Emails', array('add'), 'get_emails');
         $modPot->setRelatedList($modEmail, 'Emails', array('add'), 'get_emails');
         $modHD->setRelatedList($modEmail, 'Emails', array('add'), 'get_emails');
         $block = VTiger_Block::getInstance('LBL_PROJECT_INFORMATION', $modPrj);
         $field = Vtiger_Field::getInstance('email', $modPrj);
         if ($field) {
             $this->ExecuteQuery('update vtiger_field set presence=2 where fieldid=' . $field->id);
         } else {
             $field = new Vtiger_Field();
             $field->name = 'email';
             $field->uitype = 13;
             $field->label = 'Email';
             $field->columntype = 'VARCHAR(150)';
             $field->typeofdata = 'E~O';
             $field->displaytype = 2;
             $block->addField($field);
         }
         $block = VTiger_Block::getInstance('LBL_PROJECT_TASK_INFORMATION', $modPrjTsk);
         $field = Vtiger_Field::getInstance('email', $modPrjTsk);
         if ($field) {
             $this->ExecuteQuery('update vtiger_field set presence=2 where fieldid=' . $field->id);
         } else {
             $field = new Vtiger_Field();
             $field->name = 'email';
             $field->uitype = 13;
             $field->label = 'Email';
             $field->columntype = 'VARCHAR(150)';
             $field->typeofdata = 'E~O';
             $field->displaytype = 2;
             $block->addField($field);
         }
         $block = VTiger_Block::getInstance('LBL_OPPORTUNITY_INFORMATION', $modPot);
         $field = Vtiger_Field::getInstance('email', $modPot);
         if ($field) {
             $this->ExecuteQuery('update vtiger_field set presence=2 where fieldid=' . $field->id);
         } else {
             $field = new Vtiger_Field();
             $field->name = 'email';
             $field->uitype = 13;
             $field->label = 'Email';
             $field->columntype = 'VARCHAR(150)';
             $field->typeofdata = 'E~O';
             $field->displaytype = 2;
             $block->addField($field);
         }
         $block = VTiger_Block::getInstance('LBL_TICKET_INFORMATION', $modHD);
         $field = Vtiger_Field::getInstance('email', $modHD);
         if ($field) {
             $this->ExecuteQuery('update vtiger_field set presence=2 where fieldid=' . $field->id);
         } else {
             $field = new Vtiger_Field();
             $field->name = 'email';
             $field->uitype = 13;
             $field->label = 'Email';
             $field->columntype = 'VARCHAR(150)';
             $field->typeofdata = 'E~O';
             $field->displaytype = 2;
             $block->addField($field);
         }
         $this->sendMsg('Changeset ' . get_class($this) . ' applied!');
         $this->markApplied();
     }
     $this->finishExecution();
 }
Example #28
0
    $rec_id = vtlib_purify($_REQUEST['rec_id']);
    $fieldname = vtlib_purify($_REQUEST['fieldname']);
    //added for getting list-ids to compose email popup from list view(Accounts,Contacts,Leads)
    if (isset($_REQUEST['field_id']) && strlen($_REQUEST['field_id']) != 0) {
        if ($_REQUEST['par_module'] == "Users") {
            $id_list = $rec_id . '@' . '-1|';
        } else {
            $id_list = $rec_id . '@' . vtlib_purify($_REQUEST['field_id']) . '|';
        }
        $smarty->assign("IDLISTS", $id_list);
    }
    if ($rec_type == "record_id") {
        $type = vtlib_purify($_REQUEST['par_module']);
        //check added for email link in user detail view
        $module_focus = Vtiger_Module::getInstance($type);
        $field_focus = Vtiger_Field::getInstance($fieldname, $module_focus);
        $q = "select {$fieldname} from " . $field_focus->table . " where " . $module_focus->basetableid . "= ?";
        $email1 = $adb->query_result($adb->pquery($q, array($rec_id)), 0, $fieldname);
    } elseif ($rec_type == "email_addy") {
        $email1 = vtlib_purify($_REQUEST["email_addy"]);
    }
    $smarty->assign('TO_MAIL', trim($email1, ",") . ",");
}
//handled for replying emails
if ($_REQUEST['reply'] == "true") {
    $fromadd = $_REQUEST['record'];
    $query = "select from_email,idlists,cc_email,bcc_email from vtiger_emaildetails where emailid =?";
    $result = $adb->pquery($query, array($fromadd));
    $from_mail = $adb->query_result($result, 0, 'from_email');
    $smarty->assign('TO_MAIL', trim($from_mail, ",") . ',');
    $cc_add = implode(',', $json->decode($adb->query_result($result, 0, 'cc_email')));
<?php

chdir('..');
$Vtiger_Utils_Log = true;
include_once 'vtlib/Vtiger/Menu.php';
include_once 'vtlib/Vtiger/Module.php';
include_once 'modules/PickList/DependentPickListUtils.php';
$moduleInstance = Vtiger_Module::getInstance('vtiger_crmentity');
$field = Vtiger_Field::getInstance('charge1', $moduleInstance);
$field->delete();
$field = Vtiger_Field::getInstance('charge2', $moduleInstance);
$field->delete();
$field = Vtiger_Field::getInstance('charge3', $moduleInstance);
$field->delete();
Example #30
0
 /**
  * To get the lists of sharedids and colors
  * @param $id --  user id
  * @returns <Array> $sharedUsers
  */
 public static function getCalendarViewTypes($id)
 {
     $db = PearDatabase::getInstance();
     $query = "SELECT * FROM vtiger_calendar_user_activitytypes \n\t\t\tINNER JOIN vtiger_calendar_default_activitytypes on vtiger_calendar_default_activitytypes.id=vtiger_calendar_user_activitytypes.defaultid \n\t\t\tWHERE vtiger_calendar_user_activitytypes.userid=? AND vtiger_calendar_default_activitytypes.active = ?";
     $result = $db->pquery($query, array($id, 1));
     $rows = $db->num_rows($result);
     $calendarViewTypes = array();
     for ($i = 0; $i < $rows; $i++) {
         $activityTypes = $db->query_result_rowdata($result, $i);
         $moduleInstance = Vtiger_Module::getInstance($activityTypes['module']);
         $fieldInstance = Vtiger_Field::getInstance($activityTypes['fieldname'], $moduleInstance);
         if ($fieldInstance) {
             $fieldLabel = $fieldInstance->label;
         } else {
             $fieldLabel = $activityTypes['fieldname'];
         }
         if ($activityTypes['visible'] == '1') {
             $calendarViewTypes['visible'][] = array('module' => $activityTypes['module'], 'fieldname' => $activityTypes['fieldname'], 'fieldlabel' => $fieldLabel, 'visible' => $activityTypes['visible'], 'color' => $activityTypes['color']);
         } else {
             $calendarViewTypes['invisible'][] = array('module' => $activityTypes['module'], 'fieldname' => $activityTypes['fieldname'], 'fieldlabel' => $fieldLabel, 'visible' => $activityTypes['visible'], 'color' => $activityTypes['color']);
         }
     }
     return $calendarViewTypes;
 }