Exemplo n.º 1
0
 /**
  * @see CommonDBTM::prepareInputForUpdate()
  **/
 function prepareInputForUpdate($input)
 {
     if (empty($input['end_date']) || $input['end_date'] == 'NULL' || $input['end_date'] < $input['begin_date']) {
         $input['end_date'] = $input['begin_date'];
     }
     return parent::prepareInputForUpdate($input);
 }
Exemplo n.º 2
0
 /**
  * @since version 0.85
  *
  * @see CommonDBConnexity::getConnexityMassiveActionsSpecificities()
  **/
 static function getConnexityMassiveActionsSpecificities()
 {
     $specificities = parent::getConnexityMassiveActionsSpecificities();
     $specificities['reaffect'] = true;
     $specificities['itemtypes'] = array('Computer', 'NetworkEquipment');
     $specificities['normalized']['unaffect'] = array();
     $specificities['action_name']['affect'] = _x('button', 'Move');
     return $specificities;
 }
Exemplo n.º 3
0
 /**
  * @since version 0.84
  *
  * @see CommonDBTM::doSpecificMassiveActions()
  **/
 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     //             print_r($input);exit();
     switch ($input['action']) {
         case "give":
             if ($input["give_items_id"] > 0 && !empty($input['give_itemtype'])) {
                 foreach ($input["item"] as $key => $val) {
                     if ($val == 1) {
                         if ($this->can($key, 'w')) {
                             if ($this->out($key, $input['give_itemtype'], $input["give_items_id"])) {
                                 $res['ok']++;
                             } else {
                                 $res['ko']++;
                             }
                         } else {
                             $res['noright']++;
                         }
                     }
                 }
                 if ($item = getItemForItemtype($input['give_itemtype'])) {
                     Event::log($input["consumableitems_id"], "consumables", 5, "inventory", sprintf(__('%s gives a consumable'), $_SESSION["glpiname"]));
                 }
             } else {
                 $res['ko']++;
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
     }
     return $res;
 }
Exemplo n.º 4
0
 /**
  * @see CommonDBTM::doSpecificMassiveActions()
  **/
 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     switch ($input['action']) {
         case "assign_vlan":
             if (!empty($input["vlans_id"])) {
                 $networkportvlan = new NetworkPort_Vlan();
                 foreach ($input["item"] as $key => $val) {
                     if ($val == 1) {
                         if ($this->can($key, 'w')) {
                             if ($networkportvlan->assignVlan($key, $input["vlans_id"], isset($input['tagged']) ? '1' : '0')) {
                                 $res['ok']++;
                             } else {
                                 $res['ko']++;
                             }
                         } else {
                             $res['noright']++;
                         }
                     }
                 }
             } else {
                 $res['ko']++;
             }
             break;
         case "unassign_vlan":
             if (!empty($input["vlans_id"])) {
                 $networkportvlan = new NetworkPort_Vlan();
                 foreach ($input["item"] as $key => $val) {
                     if ($val == 1) {
                         if ($this->can($key, 'w')) {
                             if ($networkportvlan->unassignVlan($key, $input["vlans_id"])) {
                                 $res['ok']++;
                             } else {
                                 $res['ko']++;
                             }
                         } else {
                             $res['noright']++;
                         }
                     }
                 }
             } else {
                 $nbko++;
             }
             break;
             // Interest of this massive action ? Replace switch by another : don't re-create manually all ports
         // Interest of this massive action ? Replace switch by another : don't re-create manually all ports
         case "move_port":
             if (isset($input["items_id"]) && !empty($input["items_id"])) {
                 foreach ($input["item"] as $key => $val) {
                     if ($val == 1) {
                         if ($this->getFromDB($key)) {
                             $input2 = array();
                             $input2['id'] = $key;
                             $input2['items_id'] = $input["items_id"];
                             $input2['itemtype'] = 'NetworkEquipment';
                             if ($this->can($input2['id'], 'w')) {
                                 if ($this->update($input2)) {
                                     $res['ok']++;
                                 } else {
                                     $res['ko']++;
                                 }
                             } else {
                                 $res['noright']++;
                             }
                         } else {
                             $res['ko']++;
                         }
                     }
                 }
             } else {
                 $res['ko']++;
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
     }
     return $res;
 }
Exemplo n.º 5
0
 function post_deleteFromDB()
 {
     // Update calendar cache
     $cal = new Calendar();
     $cal->updateDurationCache($this->fields['calendars_id']);
     parent::post_deleteFromDB();
 }
 function getSearchOptions()
 {
     global $CFG_GLPI;
     $tab = parent::getSearchOptions();
     $optionIndex = 10;
     // From 10 to 14
     foreach (self::getMotives() as $motive => $name) {
         $tab[$optionIndex]['table'] = $this->getTable();
         $tab[$optionIndex]['field'] = $motive;
         $tab[$optionIndex]['name'] = $name;
         $tab[$optionIndex]['datatype'] = 'bool';
         $optionIndex++;
     }
     $tab[20]['table'] = $this->getTable();
     $tab[20]['field'] = 'ip';
     $tab[20]['datatype'] = 'ip';
     $tab[20]['name'] = IPAddress::getTypeName(1);
     $tab[21]['table'] = $this->getTable();
     $tab[21]['field'] = 'netmask';
     $tab[21]['datatype'] = 'string';
     $tab[21]['name'] = IPNetmask::getTypeName(1);
     $tab[22]['table'] = $this->getTable();
     $tab[22]['field'] = 'subnet';
     $tab[22]['datatype'] = 'string';
     $tab[22]['name'] = __('Network address');
     $tab[23]['table'] = $this->getTable();
     $tab[23]['field'] = 'gateway';
     $tab[23]['datatype'] = 'string';
     $tab[23]['name'] = IPAddress::getTypeName(1);
     if (TableExists('glpi_networkinterfaces')) {
         $tab[24]['table'] = 'glpi_networkinterfaces';
         $tab[24]['field'] = 'name';
         $tab[24]['datatype'] = 'dropdown';
         $tab[24]['name'] = __('Network interface');
     }
     return $tab;
 }
Exemplo n.º 7
0
 /**
  * @since version 0.84
  **/
 function getForbiddenStandardMassiveAction()
 {
     $forbidden = parent::getForbiddenStandardMassiveAction();
     $forbidden[] = 'update';
     return $forbidden;
 }
Exemplo n.º 8
0
 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     switch ($ma->getAction()) {
         case 'uninstall':
             foreach ($ids as $key) {
                 if ($item->can($key, UPDATE)) {
                     if ($item->uninstall($key)) {
                         $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_OK);
                     } else {
                         $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_KO);
                         $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));
                     }
                 } else {
                     $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_NORIGHT);
                     $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                 }
             }
             return;
         case 'backtostock':
             foreach ($ids as $id) {
                 if ($item->can($id, UPDATE)) {
                     if ($item->backToStock(array("id" => $id))) {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                     } else {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                         $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));
                     }
                 } else {
                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_NORIGHT);
                     $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                 }
             }
             return;
         case 'updatepages':
             $input = $ma->getInput();
             if (isset($input['pages'])) {
                 foreach ($ids as $key) {
                     if ($item->can($key, UPDATE)) {
                         if ($item->update(array('id' => $key, 'pages' => $input['pages']))) {
                             $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_OK);
                         } else {
                             $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_KO);
                             $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));
                         }
                     } else {
                         $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_NORIGHT);
                         $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                     }
                 }
             } else {
                 $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);
             }
             return;
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
Exemplo n.º 9
0
 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     switch ($ma->getAction()) {
         case 'activate':
             $ic = new self();
             if ($ic->canCreate()) {
                 $itemtype = $item->getType();
                 foreach ($ids as $key) {
                     if (!$ic->getFromDBforDevice($itemtype, $key)) {
                         $input = array('itemtype' => $itemtype, 'items_id' => $key);
                         if ($ic->can(-1, CREATE, $input)) {
                             if ($ic->add($input)) {
                                 $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_OK);
                             } else {
                                 $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_KO);
                                 $ma->addMessage($ic->getErrorMessage(ERROR_ON_ACTION));
                             }
                         } else {
                             $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_NORIGHT);
                             $ma->addMessage($ic->getErrorMessage(ERROR_RIGHT));
                         }
                     } else {
                         $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_KO);
                         $ma->addMessage($ic->getErrorMessage(ERROR_NOT_FOUND));
                     }
                 }
             }
             return;
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
 function post_deleteFromDB()
 {
     global $DB;
     // if default is set : set default to another one
     if ($this->fields["is_default"] == 1) {
         $query = "UPDATE `" . $this->getTable() . "`\n                   SET `is_default` = '1'\n                   WHERE `id` <> '" . $this->fields['id'] . "'\n                         AND `users_id` = '" . $this->fields['users_id'] . "'\n                   LIMIT 1";
         $DB->query($query);
     }
     parent::post_deleteFromDB();
 }
Exemplo n.º 11
0
 function prepareInputForAdd($input)
 {
     // My preparation on $input
     return parent::prepareInputForAdd($input);
 }
Exemplo n.º 12
0
 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     switch ($ma->getAction()) {
         case 'backtostock':
             foreach ($ids as $id) {
                 if ($item->can($id, UPDATE)) {
                     if ($item->backToStock(array("id" => $id))) {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                     } else {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                         $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));
                     }
                 } else {
                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_NORIGHT);
                     $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                 }
             }
             return;
         case 'give':
             $input = $ma->getInput();
             if ($input["give_items_id"] > 0 && !empty($input['give_itemtype'])) {
                 foreach ($ids as $key) {
                     if ($item->can($key, UPDATE)) {
                         if ($item->out($key, $input['give_itemtype'], $input["give_items_id"])) {
                             $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_OK);
                         } else {
                             $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_KO);
                             $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));
                         }
                     } else {
                         $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_NORIGHT);
                         $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                     }
                 }
                 Event::log($item->fields['consumableitems_id'], "consumables", 5, "inventory", sprintf(__('%s gives a consumable'), $_SESSION["glpiname"]));
             } else {
                 $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);
             }
             return;
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
Exemplo n.º 13
0
 /**
  * @see commonDBTM::getRights()
  **/
 function getRights($interface = 'central')
 {
     $values = parent::getRights();
     unset($values[UPDATE], $values[READ]);
     $values[self::VALIDATE] = __('Validate');
     return $values;
 }
Exemplo n.º 14
0
 /**
  * @since version 0.84
  *
  * @see CommonDBTM::doSpecificMassiveActions()
  **/
 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     switch ($input['action']) {
         case "uninstall":
             foreach ($input["item"] as $key => $val) {
                 if ($val == 1) {
                     if ($this->can($key, 'w')) {
                         if ($this->uninstall($key)) {
                             $res['ok']++;
                         } else {
                             $res['ko']++;
                         }
                     } else {
                         $res['noright']++;
                     }
                 }
             }
             break;
         case "updatepages":
             if (isset($input['pages'])) {
                 foreach ($input["item"] as $key => $val) {
                     if ($val == 1) {
                         if ($this->can($key, 'w')) {
                             if ($this->update(array('id' => $key, 'pages' => $input['pages']))) {
                                 $res['ok']++;
                             } else {
                                 $res['ko']++;
                             }
                         } else {
                             $res['noright']++;
                         }
                     }
                 }
             } else {
                 $res['ko']++;
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
     }
     return $res;
 }
 function prepareInputForUpdate($input)
 {
     return parent::prepareInputForUpdate(self::cleanContentHtml($input));
 }
Exemplo n.º 16
0
 function cleanDBonPurge()
 {
     global $DB;
     $pt = new ProjectTaskTeam();
     $pt->cleanDBonItemDelete(__CLASS__, $this->fields['id']);
     $pt = new ProjectTask_Ticket();
     $pt->cleanDBonItemDelete(__CLASS__, $this->fields['id']);
     parent::cleanDBonPurge();
 }
Exemplo n.º 17
0
 /**
  * @see CommonDBTM::post_updateItem()
  **/
 function post_updateItem($history = 1)
 {
     if (isset($this->oldvalues['name']) || isset($this->oldvalues['entities_id'])) {
         $link = new IPAddress_IPNetwork();
         $link->cleanDBonItemDelete($this->getType(), $this->getID());
         $link->addIPAddress($this);
     }
     parent::post_updateItem($history);
 }
Exemplo n.º 18
0
 /**
  * @see CommonDBTM::post_updateItem()
  **/
 function post_updateItem($history = 1)
 {
     $alert = new Alert();
     $alert->clear($this->getType(), $this->fields['id'], Alert::ACTION);
     parent::post_updateItem($history);
 }
Exemplo n.º 19
0
 /**
  * @see CommonDBChild::prepareInputForUpdate()
  **/
 function prepareInputForUpdate($input)
 {
     // TODO: Check because I replaced creation of a cloned infocom by $this
     if (isset($input['warranty_duration'])) {
         $input['_warranty_duration'] = $this->fields['warranty_duration'];
     }
     //Check if one or more dates needs to be updated
     foreach (self::getAutoManagemendDatesFields() as $key => $field) {
         $result = Entity::getUsedConfig($key, $this->fields['entities_id']);
         //Only update date if it's empty in DB. Otherwise do nothing
         if ($result > 0 && !isset($this->fields[$field])) {
             self::autofillDates($input, $field, $result);
         }
     }
     return parent::prepareInputForUpdate($input);
 }
Exemplo n.º 20
0
 /**
  * @since version 0.84
  *
  * @param $field
  * @param $name               (default '')
  * @param $values             (default '')
  * @param $options      array
  **/
 static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
 {
     global $DB;
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     $options['display'] = false;
     switch ($field) {
         case 'field':
             $generic_rule = new Rule();
             if (isset($values['rules_id']) && !empty($values['rules_id']) && $generic_rule->getFromDB($values['rules_id'])) {
                 if ($rule = getItemForItemtype($generic_rule->fields["sub_type"])) {
                     $options['value'] = $values[$field];
                     $options['name'] = $name;
                     return $rule->dropdownActions($options);
                 }
             }
             break;
         case 'action_type':
             $generic_rule = new Rule();
             if (isset($values['rules_id']) && !empty($values['rules_id']) && $generic_rule->getFromDB($values['rules_id'])) {
                 return self::dropdownActions(array('subtype' => $generic_rule->fields["sub_type"], 'name' => $name, 'value' => $values[$field], 'alreadyused' => false, 'display' => false));
             }
             break;
         case 'pattern':
             if (!isset($values["field"]) || !isset($values["action_type"])) {
                 return NOT_AVAILABLE;
             }
             $generic_rule = new Rule();
             if (isset($values['rules_id']) && !empty($values['rules_id']) && $generic_rule->getFromDB($values['rules_id'])) {
                 if ($rule = getItemForItemtype($generic_rule->fields["sub_type"])) {
                     /// TODO review it : need to pass display param and others...
                     return $this->displayActionSelectPattern($values);
                 }
             }
             break;
     }
     return parent::getSpecificValueToSelect($field, $name, $values, $options);
 }
Exemplo n.º 21
0
 /**
  * @since version 0.84
  *
  * @param $field
  * @param $name              (default '')
  * @param $values            (default '')
  * @param $options   array
  **/
 static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     $options['display'] = false;
     switch ($field) {
         case 'status':
             $options['value'] = $values[$field];
             return self::dropdownStatus($name, $options);
     }
     return parent::getSpecificValueToSelect($field, $name, $values, $options);
 }
Exemplo n.º 22
0
 /**
  * @since version 0.84
  *
  * @param $field
  * @param $name               (default '')
  * @param $values             (default '')
  * @param $options      array
  **/
 static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
 {
     global $DB;
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     $options['display'] = false;
     switch ($field) {
         case 'criteria':
             $generic_rule = new Rule();
             if (isset($values['rules_id']) && !empty($values['rules_id']) && $generic_rule->getFromDB($values['rules_id'])) {
                 if ($rule = getItemForItemtype($generic_rule->fields["sub_type"])) {
                     $options['value'] = $values[$field];
                     $options['name'] = $name;
                     return $rule->dropdownCriteria($options);
                 }
             }
             break;
         case 'condition':
             $generic_rule = new Rule();
             if (isset($values['rules_id']) && !empty($values['rules_id']) && $generic_rule->getFromDB($values['rules_id'])) {
                 if (isset($values['criteria']) && !empty($values['criteria'])) {
                     $options['criterion'] = $values['criteria'];
                 }
                 $options['value'] = $values[$field];
                 $options['name'] = $name;
                 return $rule->dropdownConditions($generic_rule->fields["sub_type"], $options);
             }
             break;
         case 'pattern':
             if (!isset($values["criteria"]) || !isset($values["condition"])) {
                 return NOT_AVAILABLE;
             }
             $generic_rule = new Rule();
             if (isset($values['rules_id']) && !empty($values['rules_id']) && $generic_rule->getFromDB($values['rules_id'])) {
                 if ($rule = getItemForItemtype($generic_rule->fields["sub_type"])) {
                     /// TODO : manage display param to this function : need to send ot to all under functions
                     $rule->displayCriteriaSelectPattern($name, $values["criteria"], $values["condition"], $values[$field]);
                 }
             }
             break;
     }
     return parent::getSpecificValueToSelect($field, $name, $values, $options);
 }
 function post_purgeItem()
 {
     global $DB;
     parent::post_purgeItem();
     $ticket = new Ticket();
     $itemtype_id = $ticket->getSearchOptionIDByField('field', 'itemtype', 'glpi_tickets');
     $items_id_id = $ticket->getSearchOptionIDByField('field', 'items_id', 'glpi_tickets');
     // Try to delete itemtype -> delete items_id
     if ($this->fields['num'] == $itemtype_id) {
         $query = "SELECT `id`\n                   FROM `" . $this->getTable() . "`\n                   WHERE `" . static::$items_id . "` = '" . $this->fields['tickettemplates_id'] . "'\n                         AND `num` = '{$items_id_id}'";
         if ($result = $DB->query($query)) {
             if ($DB->numrows($result)) {
                 $a = new self();
                 $a->delete(array('id' => $DB->result($result, 0, 0)));
             }
         }
     }
 }
Exemplo n.º 24
0
 function prepareInputForUpdate($input)
 {
     return parent::prepareInputForUpdate($this->prepareInput($input));
 }
Exemplo n.º 25
0
 /**
  * Define how to display a specific value in search result table
  *
  * @param  String $field   Name of the field as define in $this->getSearchOptions()
  * @param  Mixed  $values  The value as it is stored in DB
  * @param  Array  $options Options (optional)
  * @return Mixed           Value to be displayed
  */
 public static function getSpecificValueToDisplay($field, $values, array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     switch ($field) {
         case 'status':
             $output = '<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/' . $values[$field] . '.png"
                      alt="' . __($values[$field], 'formcreator') . '" title="' . __($values[$field], 'formcreator') . '" />';
             return $output;
             break;
     }
     return parent::getSpecificValueToDisplay($field, $values, $options);
 }
Exemplo n.º 26
0
 /**
  * Overload canChildItem to make specific checks
  * @since version 0.84
  **/
 function canChildItem($methodItem, $methodNotItem)
 {
     // Original user always have right
     if ($this->fields['users_id'] === Session::getLoginUserID()) {
         return true;
     }
     if (!parent::canChildItem($methodItem, $methodNotItem)) {
         return false;
     }
     $ri = $this->getItem();
     if ($ri === false) {
         return false;
     }
     $item = $ri->getItem();
     if ($item === false) {
         return false;
     }
     return Session::haveAccessToEntity($item->getEntityID());
 }
Exemplo n.º 27
0
 /**
  * @since version 0.85
  *
  * @see commonDBTM::getRights()
  **/
 function getRights($interface = 'central')
 {
     if ($interface == 'central') {
         $values = parent::getRights();
     }
     $values[self::RESERVEANITEM] = __('Make a reservation');
     return $values;
 }
Exemplo n.º 28
0
 /**
  * Define how to display search field for a specific type
  *
  * @since version 0.84
  *
  * @param String $field           Name of the field as define in $this->getSearchOptions()
  * @param String $name            Name attribute for the field to be posted (default '')
  * @param Array  $values          Array of all values to display in search engine (default '')
  * @param Array  $options         Options (optional)
  *
  * @return String                 Html string to be displayed for the form field
  **/
 public static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     $options['display'] = false;
     switch ($field) {
         case 'status':
             $output = '<select name="' . $name . '">';
             $output .= '<option value="waiting" ' . ($values[$field] == 'waiting' ? ' selected ' : '') . '>' . __('waiting', 'formcreator') . '</option>';
             $output .= '<option value="accepted" ' . ($values[$field] == 'accepted' ? ' selected ' : '') . '>' . __('accepted', 'formcreator') . '</option>';
             $output .= '<option value="refused" ' . ($values[$field] == 'refused' ? ' selected ' : '') . '>' . __('refused', 'formcreator') . '</option>';
             $output .= '</select>';
             return $output;
             break;
     }
     return parent::getSpecificValueToSelect($field, $name, $values, $options);
 }