Exemplo n.º 1
0
 public function delete(Vtiger_Request $request)
 {
     $fieldId = $request->get('fieldid');
     $fieldInstance = Settings_LayoutEditor_Field_Model::getInstance($fieldId);
     $response = new Vtiger_Response();
     if (!$fieldInstance->isCustomField()) {
         $response->setError('122', 'Cannot delete Non custom field');
         $response->emit();
         return;
     }
     try {
         $fieldInstance->delete();
         $response->setResult(array('success' => true));
     } catch (Exception $e) {
         $response->setError($e->getCode(), $e->getMessage());
     }
     $response->emit();
 }
Exemplo n.º 2
0
 public function unHide(Vtiger_Request $request)
 {
     $response = new Vtiger_Response();
     try {
         $fieldIds = $request->get('fieldIdList');
         Settings_LayoutEditor_Field_Model::makeFieldActive($fieldIds, $request->get('blockId'));
         $responseData = array();
         foreach ($fieldIds as $fieldId) {
             $fieldModel = Settings_LayoutEditor_Field_Model::getInstance($fieldId);
             $fieldInfo = $fieldModel->getFieldInfo();
             $responseData[] = array_merge(array('id' => $fieldModel->getId(), 'blockid' => $fieldModel->get('block')->id, 'customField' => $fieldModel->isCustomField()), $fieldInfo);
         }
         $response->setResult($responseData);
     } catch (Exception $e) {
         $response->setError($e->getCode(), $e->getMessage());
     }
     $response->emit();
 }
Exemplo n.º 3
0
 public function deleteInheritsharing()
 {
     global $log, $adb;
     $log->debug("Entering YetiForceUpdate::deleteInheritsharing() method ...");
     $result = $adb->pquery("SELECT fieldid FROM vtiger_field WHERE columnname IN (?);", ['inheritsharing']);
     while ($row = $adb->fetch_array($result)) {
         $fieldInstance = Settings_LayoutEditor_Field_Model::getInstance($row['fieldid']);
         try {
             $fieldInstance->delete();
         } catch (Exception $e) {
             $log->debug("ERROR YetiForceUpdate::deleteInheritsharing: code " . $e->getCode() . " message " . $e->getMessage());
         }
     }
     if ($adb->getRowCount($result)) {
         $adb->query('ALTER TABLE `vtiger_crmentity` DROP COLUMN `inheritsharing`;');
     }
     $log->debug("Exiting YetiForceUpdate::deleteInheritsharing() method ...");
 }