当前位置: 首页>>代码示例>>PHP>>正文


PHP Ticket::add方法代码示例

本文整理汇总了PHP中Ticket::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Ticket::add方法的具体用法?PHP Ticket::add怎么用?PHP Ticket::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Ticket的用法示例。


在下文中一共展示了Ticket::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testCreateTicketWithActors

 /**
  * @dataProvider ticketProvider
  */
 public function testCreateTicketWithActors($ticketActors)
 {
     $ticket = new Ticket();
     $ticket->add(array('name' => 'ticket title', 'description' => 'a description') + $ticketActors);
     $this->assertFalse($ticket->isNewItem());
     $ticketId = $ticket->getID();
     foreach ($ticketActors as $actorType => $actorsList) {
         // Convert single actor (scalar value) to array
         if (!is_array($actorsList)) {
             $actorsList = array($actorsList);
         }
         // Check all actors are assigned to the ticket
         foreach ($actorsList as $index => $actor) {
             $notify = isset($actorList['_users_id_requester_notif']['use_notification'][$index]) ? $actorList['_users_id_requester_notif']['use_notification'][$index] : 1;
             $alternateEmail = isset($actorList['_users_id_requester_notif']['use_notification'][$index]) ? $actorList['_users_id_requester_notif']['alternative_email'][$index] : '';
             switch ($actorType) {
                 case '_users_id_assign':
                     $this->_testTicketUser($ticket, $actor, CommonITILActor::REQUESTER, $notify, $alternateEmail);
                     break;
                 case '_users_id_observer':
                     $this->_testTicketUser($ticket, $actor, CommonITILActor::OBSERVER, $notify, $alternateEmail);
                     break;
                 case '_users_id_assign':
                     $this->_testTicketUser($ticket, $actor, CommonITILActor::ASSIGN, $notify, $alternateEmail);
                     break;
             }
         }
     }
 }
开发者ID:glpi-project,项目名称:glpi,代码行数:32,代码来源:TicketTest.php

示例2: explode

        Html::header(__('Simplified interface'), '', $_SESSION["glpiname"], "helpdesk", "tracking");
    }
}
if (isset($_POST["my_items"]) && !empty($_POST["my_items"])) {
    $splitter = explode("_", $_POST["my_items"]);
    if (count($splitter) == 2) {
        $_POST["itemtype"] = $splitter[0];
        $_POST["items_id"] = $splitter[1];
    }
}
if (!isset($_POST["itemtype"]) || empty($_POST["items_id"]) && $_POST["itemtype"] != 0) {
    $_POST["itemtype"] = '';
    $_POST["items_id"] = 0;
}
if (isset($_POST['add'])) {
    if ($newID = $track->add($_POST)) {
        if (isset($_POST["_type"]) && $_POST["_type"] == "Helpdesk") {
            echo "<div class='center spaced'>" . __('Your ticket has been registered, its treatment is in progress.');
            Html::displayBackLink();
            echo "</div>";
        } else {
            echo "<div class='center b spaced'>";
            echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/ok.png' alt='" . __s('OK') . "'>";
            Session::addMessageAfterRedirect(__('Thank you for using our automatic helpdesk system.'));
            Html::displayMessageAfterRedirect();
            echo "</div>";
        }
    } else {
        echo "<div class='center'>";
        echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/warning.png' alt='" . __s('Warning') . "'><br>";
        Html::displayMessageAfterRedirect();
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:31,代码来源:tracking.injector.php

示例3: save

 public function save($form, $input)
 {
     $datas = array();
     $ticket = new Ticket();
     $docItem = new Document_Item();
     // Get default request type
     $query = "SELECT id FROM `glpi_requesttypes` WHERE `name` LIKE 'Formcreator';";
     $result = $GLOBALS['DB']->query($query) or die($DB->error());
     list($requesttypes_id) = $GLOBALS['DB']->fetch_array($result);
     $datas['requesttypes_id'] = $requesttypes_id;
     // Get predefined Fields
     $ttp = new TicketTemplatePredefinedField();
     $predefined_fields = $ttp->getPredefinedFields($this->fields['tickettemplates_id'], true);
     $datas = array_merge($datas, $predefined_fields);
     $datas['name'] = $this->parseTags($this->fields['name'], $form, $input);
     $datas['content'] = $this->parseTags($this->fields['comment'], $form, $input);
     $datas['entities_id'] = isset($_SESSION['glpiactive_entity']) ? $_SESSION['glpiactive_entity'] : $form->fields['entities_id'];
     $ticketID = $ticket->add($datas);
     if (!empty($_SESSION['formcreator_documents'])) {
         foreach ($_SESSION['formcreator_documents'] as $docID) {
             $docItem->add(array('documents_id' => $docID, 'itemtype' => 'Ticket', 'items_id' => $ticketID));
         }
     }
 }
开发者ID:nicholaseduardo,项目名称:formcreator,代码行数:24,代码来源:targetticket.class.php

示例4: createTicket

 /**
  * Create a ticket based on ticket recurrent infos
  *
  * @param $data array data of a entry of glpi_ticketrecurrents
  *
  * @return boolean
  **/
 static function createTicket($data)
 {
     $result = false;
     $tt = new TicketTemplate();
     // Create ticket based on ticket template and entity information of ticketrecurrent
     if ($tt->getFromDB($data['tickettemplates_id'])) {
         // Get default values for ticket
         $input = Ticket::getDefaultValues($data['entities_id']);
         // Apply tickettemplates predefined values
         $ttp = new TicketTemplatePredefinedField();
         $predefined = $ttp->getPredefinedFields($data['tickettemplates_id'], true);
         if (count($predefined)) {
             foreach ($predefined as $predeffield => $predefvalue) {
                 $input[$predeffield] = $predefvalue;
             }
         }
         // Set date to creation date
         $createtime = strtotime($data['next_creation_date']) + $data['create_before'];
         $input['date'] = date('Y-m-d H:i:s', $createtime);
         if (isset($predefined['date'])) {
             $input['date'] = Html::computeGenericDateTimeSearch($predefined['date'], false, $createtime);
         }
         // Compute due_date if predefined based on create date
         if (isset($predefined['due_date'])) {
             $input['due_date'] = Html::computeGenericDateTimeSearch($predefined['due_date'], false, $createtime);
         }
         // Set entity
         $input['entities_id'] = $data['entities_id'];
         $input['_auto_import'] = true;
         $ticket = new Ticket();
         $input = Toolbox::addslashes_deep($input);
         if ($tid = $ticket->add($input)) {
             $msg = sprintf(__('Ticket %d successfully created'), $tid);
             $result = true;
         } else {
             $msg = __('Ticket creation failed (check mandatory fields)');
         }
     } else {
         $msg = __('Ticket creation failed (no template)');
     }
     $changes[0] = 0;
     $changes[1] = '';
     $changes[2] = addslashes($msg);
     Log::history($data['id'], __CLASS__, $changes, '', Log::HISTORY_LOG_SIMPLE_MESSAGE);
     // Compute next creation date
     $tr = new self();
     if ($tr->getFromDB($data['id'])) {
         $input = array();
         $input['id'] = $data['id'];
         $input['next_creation_date'] = $tr->computeNextCreationDate($data['begin_date'], $data['end_date'], $data['periodicity'], $data['create_before'], $data['calendars_id']);
         $tr->update($input);
     }
     return $result;
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:61,代码来源:ticketrecurrent.class.php

示例5: generateNewItem

 public function generateNewItem($params)
 {
     global $DB;
     // Retrieve plugin configuration
     $config = new PluginOrderConfig();
     $reference = new PluginOrderReference();
     foreach ($params["id"] as $tmp => $values) {
         //If itemtype cannot be generated, go to the new occurence
         if (in_array($values['itemtype'], self::getTypesThanCannotBeGenerared())) {
             continue;
         }
         $entity = $values["entities_id"];
         //------------- Template management -----------------------//
         //Look for a template in the entity
         $templateID = $reference->checkIfTemplateExistsInEntity($values["id"], $values["itemtype"], $entity);
         $item = new $values["itemtype"]();
         if ($values['itemtype']) {
             $order = new PluginOrderOrder();
         }
         $order->getFromDB($values["plugin_order_orders_id"]);
         $reference->getFromDB($params["plugin_order_references_id"]);
         if ($templateID) {
             $item->getFromDB($templateID);
             unset($item->fields["is_template"]);
             unset($item->fields["date_mod"]);
             $fields = array();
             foreach ($item->fields as $key => $value) {
                 if ($value != '' && (!isset($fields[$key]) || $fields[$key] == '' || $fields[$key] == 0)) {
                     $input[$key] = $value;
                 }
             }
             if ($config->getGeneratedAssetState()) {
                 $input["states_id"] = $config->getGeneratedAssetState();
             }
             $input["entities_id"] = $entity;
             $input["serial"] = $values["serial"];
             if ($item->fields['name']) {
                 $input["name"] = autoName($item->fields["name"], "name", $templateID, $values["itemtype"], $entity);
             } else {
                 $input["name"] = $values["name"];
             }
             if ($item->getField('otherserial') != NOT_AVAILABLE) {
                 if ($item->fields['otherserial']) {
                     $input["otherserial"] = autoName($item->fields["otherserial"], "otherserial", $templateID, $values["itemtype"], $entity);
                 } else {
                     $input["otherserial"] = $values["otherserial"];
                 }
             }
             if ($config->canAddLocation()) {
                 $input['locations_id'] = $order->fields['locations_id'];
             }
         } elseif ($values["itemtype"] == 'Contract') {
             $input["name"] = $values["name"];
             $input["entities_id"] = $entity;
             $input['contracttypes_id'] = $reference->fields['types_id'];
         } else {
             if ($config->getGeneratedAssetState()) {
                 $input["states_id"] = $config->getGeneratedAssetState();
             } else {
                 $input["states_id"] = 0;
             }
             $input["entities_id"] = $entity;
             $input["serial"] = $values["serial"];
             $input["otherserial"] = $values["otherserial"];
             $input["name"] = $values["name"];
             // Get bill data
             if ($config->canAddLocation()) {
                 $input['locations_id'] = $order->fields['locations_id'];
             }
             $input["manufacturers_id"] = $reference->fields["manufacturers_id"];
             $typefield = getForeignKeyFieldForTable(getTableForItemType($values["itemtype"] . "Type"));
             $input[$typefield] = $reference->fields["types_id"];
             $modelfield = getForeignKeyFieldForTable(getTableForItemType($values["itemtype"] . "Model"));
             $input[$modelfield] = $reference->fields["models_id"];
         }
         $input = Toolbox::addslashes_deep($input);
         $newID = $item->add($input);
         // Attach new ticket if option is on
         if (isset($params['generate_ticket'])) {
             $tkt = new TicketTemplate();
             if ($tkt->getFromDB($params['generate_ticket']['tickettemplates_id'])) {
                 $input = array();
                 $input = Ticket::getDefaultValues($entity);
                 $ttp = new TicketTemplatePredefinedField();
                 $predefined = $ttp->getPredefinedFields($params['generate_ticket']['tickettemplates_id'], true);
                 if (count($predefined)) {
                     foreach ($predefined as $predeffield => $predefvalue) {
                         $input[$predeffield] = $predefvalue;
                     }
                 }
                 $input['entities_id'] = $entity;
                 $input['_users_id_requester'] = empty($order->fields['users_id']) ? Session::getLoginUserID() : $order->fields['users_id'];
                 $input['items_id'] = $newID;
                 $input['itemtype'] = $values["itemtype"];
                 $ticket = new Ticket();
                 $ticketID = $ticket->add($input);
             }
         }
         //-------------- End template management ---------------------------------//
         $result = $this->createLinkWithItem($values["id"], $newID, $values["itemtype"], $values["plugin_order_orders_id"], $entity, $templateID, false, false);
//.........这里部分代码省略.........
开发者ID:pluginsGLPI,项目名称:order,代码行数:101,代码来源:link.class.php

示例6: createSubTicket

 /**
  * 
  * @param type $items_id id of the ticket
  */
 static function createSubTicket($items_id)
 {
     global $CFG_GLPI;
     if ($_POST['slas_id'] == 0 || $_POST['groupsubticket'] == 0) {
         //         return;
     }
     $ticket = new Ticket();
     $ticketFollowup = new TicketFollowup();
     $ticketTask = new TicketTask();
     $document_Item = new Document_Item();
     $ticket_User = new Ticket_User();
     $group_Ticket = new Group_Ticket();
     // Disable send notification
     $use_mailing = $CFG_GLPI["use_mailing"];
     $CFG_GLPI["use_mailing"] = false;
     $ticket->getFromDB($items_id);
     unset($ticket->fields['id']);
     $ticket->fields['_link']['link'] = 1;
     $ticket->fields['_link']['tickets_id_1'] = 0;
     $ticket->fields['_link']['tickets_id_2'] = $items_id;
     $ticket->fields['bypassgrouponadd'] = true;
     $ticket->fields['slas_id'] = $_POST['slas_id'];
     $ticket->fields['date'] = date("Y-m-d H:i:s");
     $ticket->fields = Toolbox::addslashes_deep($ticket->fields);
     foreach ($ticket->fields as $key => $value) {
         if ($value == '') {
             unset($ticket->fields[$key]);
         }
     }
     $new_tickets_id = $ticket->add($ticket->fields);
     $a_followups = $ticketFollowup->find("`tickets_id`='" . $items_id . "'", "`id`");
     foreach ($a_followups as $data) {
         unset($data['id']);
         $data = Toolbox::addslashes_deep($data);
         $data['tickets_id'] = $new_tickets_id;
         $ticketFollowup->add($data);
     }
     $a_tasks = $ticketTask->find("`tickets_id`='" . $items_id . "'", "`id`");
     foreach ($a_tasks as $data) {
         unset($data['id']);
         $data = Toolbox::addslashes_deep($data);
         $data['tickets_id'] = $new_tickets_id;
         foreach ($data as $key => $value) {
             if ($value == '') {
                 unset($data[$key]);
             }
         }
         $ticketTask->add($data);
     }
     $a_documents = $document_Item->find("`items_id`='" . $items_id . "'\n         AND `itemtype`='Ticket'", "`id`");
     foreach ($a_documents as $data) {
         unset($data['id']);
         $data = Toolbox::addslashes_deep($data);
         $data['items_id'] = $new_tickets_id;
         $document_Item->add($data);
     }
     $a_ticketusers = $ticket_User->find("`tickets_id`='" . $items_id . "'\n         AND `type`='1'", "`id`");
     foreach ($a_ticketusers as $data) {
         unset($data['id']);
         $data = Toolbox::addslashes_deep($data);
         $data['tickets_id'] = $new_tickets_id;
         $ticket_User->add($data);
     }
     $a_ticketgroups = $group_Ticket->find("`tickets_id`='" . $items_id . "'\n         AND `type`='1'", "`id`");
     foreach ($a_ticketgroups as $data) {
         unset($data['id']);
         $data = Toolbox::addslashes_deep($data);
         $data['tickets_id'] = $new_tickets_id;
         $group_Ticket->add($data);
     }
     $CFG_GLPI["use_mailing"] = $use_mailing;
     $input = array();
     $input['tickets_id'] = $new_tickets_id;
     $input['groups_id'] = $_POST['groupsubticket'];
     $input['type'] = 2;
     $group_Ticket->add($input);
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:81,代码来源:ticketcopy.class.php

示例7: Ticket

You should have received a copy of the GNU General Public License
along with GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
include '../inc/includes.php';
Session::checkLoginUser();
$track = new Ticket();
if (!isset($_GET['id'])) {
    $_GET['id'] = "";
}
if (isset($_POST["add"])) {
    $track->check(-1, CREATE, $_POST);
    if ($id = $track->add($_POST)) {
        if ($_SESSION['glpibackcreated']) {
            Html::redirect($track->getFormURL() . "?id=" . $id);
        }
    }
    Html::back();
} else {
    if (isset($_POST['update'])) {
        $track->check($_POST['id'], UPDATE);
        $track->update($_POST);
        Event::log($_POST["id"], "ticket", 4, "tracking", sprintf(__('%s updates an item'), $_SESSION["glpiname"]));
        if ($track->can($_POST["id"], READ)) {
            $toadd = '';
            // Copy solution to KB redirect to KB
            if (isset($_POST['_sol_to_kb']) && $_POST['_sol_to_kb']) {
                $toadd = "&_sol_to_kb=1";
开发者ID:stweil,项目名称:glpi,代码行数:31,代码来源:ticket.form.php

示例8: addTracking

/** Generate bigdump : add tickets to an item
 *
 * @param $type      item type
 * @param $ID        item ID
 * @param $ID_entity entity ID
**/
function addTracking($type, $ID, $ID_entity) {
   global $percent, $DB, $MAX, $FIRST, $LAST;

   $current_year = date("Y");

   while (mt_rand(0,100)<$percent['tracking_on_item']) {
      // ticket closed ?
      $status    = CommonITILObject::CLOSED;
      $closedate = "";
      $solvedate = "";

      $opendate  = time() - mt_rand(0, 365)*DAY_TIMESTAMP - mt_rand(0, 10)*HOUR_TIMESTAMP
                   - mt_rand(0, 60)*MINUTE_TIMESTAMP - mt_rand(0, 60);

      if (mt_rand(0,100)<$percent['closed_tracking']) {
         $rtype = mt_rand(0, 100);

         if ($rtype<20) {
            $status = CommonITILObject::SOLVED;
         } else {
            $status = CommonITILObject::CLOSED;
         }

      } else {
         $rtype = mt_rand(0, 100);

         if ($rtype<20) {
            $status = CommonITILObject::INCOMING;

         } else if ($rtype<40) {
            $status = CommonITILObject::WAITING;

         } else if ($rtype<80) {
            $status = CommonITILObject::PLANNED;
            $date3  = $opendate+mt_rand(10800, 7776000); // + entre 3 heures et 3 mois
            $date4  = $date3+10800; // + 3 heures

         } else {
            $status = CommonITILObject::ASSIGNED;
         }
      }

      // Author
      $users[0] = mt_rand($FIRST['users_normal'], $LAST['users_postonly']);

      // Assign user
      $users[1] = 0;

      if ($status != CommonITILObject::INCOMING) {
         $users[1] = mt_rand($FIRST['users_sadmin'], $LAST['users_admin']);
      }
      $enterprise = 0;

      if (mt_rand(0,100)<20) {
         $enterprise = mt_rand($FIRST["enterprises"], $LAST['enterprises']);
      }

      $firstactiontime = mt_rand(0, 10)*DAY_TIMESTAMP+mt_rand(0, 10)*HOUR_TIMESTAMP
                         +mt_rand(0, 60)*MINUTE_TIMESTAMP;
      $solvetime       = 0;
      $closetime       = 0;
      $actiontime      = 0;

      $solution        = "";
      $solutiontype    = 0;
      $due_date        = $opendate + $firstactiontime+mt_rand(0, 10)*DAY_TIMESTAMP+
                         mt_rand(0, 10)*HOUR_TIMESTAMP+mt_rand(0, 60)*MINUTE_TIMESTAMP;
      $duedatetoadd    = date("Y-m-d H:i:s", intval($due_date));


      if (($status == CommonITILObject::CLOSED) || ($status == CommonITILObject::SOLVED)) {
         $solvetime = $firstactiontime+mt_rand(0, 10)*DAY_TIMESTAMP+mt_rand(0, 10)*HOUR_TIMESTAMP+
                      mt_rand(0, 60)*MINUTE_TIMESTAMP;
         $solvedate = $opendate+$solvetime;
         $closedate = $opendate+$solvetime;
         $actiontime = mt_rand(0, 10)*HOUR_TIMESTAMP+
                      mt_rand(0, 60)*MINUTE_TIMESTAMP;
         if ($status == CommonITILObject::CLOSED) {
            $closetime = $solvetime+mt_rand(0, 5)*DAY_TIMESTAMP+mt_rand(0, 10)*HOUR_TIMESTAMP+
                         mt_rand(0, 60)*MINUTE_TIMESTAMP;
            $closedate = $opendate+$closetime;
         }
         $solutiontype = mt_rand($FIRST['solutiontypes'], $LAST['solutiontypes']);
         $solution     = "Solution '".Toolbox::getRandomString(20);
      }
      $updatedate = $opendate+max($firstactiontime, $solvetime, $closetime);
      $hour_cost  = 100;

      $closedatetoadd = 'NULL';
      if (!empty($closedate)) {
         $closedatetoadd = date("Y-m-d H:i:s", intval($closedate));
      }

      $solvedatetoadd = 'NULL';
//.........这里部分代码省略.........
开发者ID:KaneoGmbH,项目名称:glpi,代码行数:101,代码来源:generate_bigdump.function.php

示例9: add_ticket

 public function add_ticket()
 {
     if (!Visitor::current()->group->can("add_ticket")) {
         show_403(__("Access Denied"), __("You do not have sufficient privileges to create tickets.", "progress"));
     }
     if (empty($_POST['title'])) {
         Flash::warning(__("Please provide a summary of the ticket in the form of a title.", "progress"));
     }
     if (empty($_POST['milestone_id'])) {
         Flash::warning(__("No milestone selected.", "progress"));
     }
     $milestone = new Milestone($_POST['milestone_id']);
     if ($milestone->no_results) {
         error(__("Error"), __("Invalid milestone.", "progress"));
     }
     if (Flash::exists()) {
         redirect($milestone->url());
     }
     $ticket = Ticket::add($_POST['title'], $_POST['description'], "new", $_POST['milestone_id'], $_POST['owner_id']);
     $files = array();
     foreach ($_FILES['attachment'] as $key => $val) {
         foreach ($val as $file => $attr) {
             $files[$file][$key] = $attr;
         }
     }
     foreach ($files as $attachment) {
         if ($attachment['error'] != 4) {
             $path = upload($attachment, null, "attachments");
             Attachment::add(basename($path), $path, "ticket", $ticket->id);
         }
     }
     $domain = parse_url(Config::current()->url, PHP_URL_HOST);
     if (!empty($ticket->owner->email) and Visitor::current()->id != $ticket->owner->id) {
         mail($ticket->owner->email, _f("Ticket #%d Created! (%s)", array($ticket->id, $ticket->title), "progress"), _f("%s has created the ticket \"%s\" and assigned the owner to you. Description:<br />\n<br />\n%s", array(oneof($ticket->user->full_name, $ticket->user->login), $ticket->title, $ticket->description)), "MIME-Version: 1.0\r\n" . "Content-type: text/html; charset=utf-8\r\n" . "From: no-reply@" . $domain);
     }
     Flash::notice(__("Ticket added.", "progress"), $ticket->url());
 }
开发者ID:vito,项目名称:chyrp-site,代码行数:37,代码来源:controller.Progress.php

示例10: cloneAndLink

 /**
  * CLone a ticket and his relations
  * @param  integer $tickets_id id of the ticket to clone
  * @return print a json response (return nothing)
  */
 static function cloneAndLink($tickets_id)
 {
     global $DB;
     //get old ticket
     $ticket = new Ticket();
     if (!$ticket->getFromDB($tickets_id)) {
         echo "{\"success\":false, \"message\":\"" . __("Error : get old ticket", "escalade") . "\"}";
         exit;
     }
     //set fields
     $fields = $ticket->fields;
     $fields = array_map(array('Toolbox', 'addslashes_deep'), $fields);
     $fields['id'] = 0;
     $fields['_users_id_requester'] = 0;
     $fields['status'] = CommonITILObject::INCOMING;
     /*var_dump($fields);
       exit;*/
     //create new ticket (duplicate from previous)
     if (!($newID = $ticket->add($fields))) {
         echo "{\"success\":false, \"message\":\"" . __("Error : adding new ticket", "escalade") . "\"}";
         exit;
     }
     //add link between them
     $ticket_ticket = new Ticket_Ticket();
     if (!$ticket_ticket->add(array('tickets_id_1' => $tickets_id, 'tickets_id_2' => $newID, 'link' => Ticket_Ticket::LINK_TO))) {
         echo "{\"success\":false, \"message\":\"" . __("Error : adding link between the two tickets", "escalade") . "\"}";
         exit;
     }
     //add a followup to indicate duplication
     $followup = new TicketFollowup();
     if (!$followup->add(array('tickets_id' => $newID, 'users_id' => Session::getLoginUserID(), 'content' => __("This ticket has been from the ticket num", "escalade") . " " . $tickets_id, 'is_private' => true, 'requesttypes_id' => 6))) {
         echo "{\"success\":false, \"message\":\"" . __("Error : adding followups", "escalade") . "\"}";
         exit;
     }
     //add actors to the new ticket (without assign)
     //users
     $query_users = "INSERT INTO glpi_tickets_users\n      SELECT '' AS id, {$newID} as tickets_id, users_id, type, use_notification, alternative_email\n      FROM glpi_tickets_users\n      WHERE tickets_id = {$tickets_id} AND type != 2";
     if (!($res = $DB->query($query_users))) {
         echo "{\"success\":false, \"message\":\"" . __("Error : adding actors (user)", "escalade") . "\"}";
         exit;
     }
     //groups
     $query_groups = "INSERT INTO glpi_groups_tickets\n      SELECT '' AS id, {$newID} as tickets_id, groups_id, type\n      FROM glpi_groups_tickets\n      WHERE tickets_id = {$tickets_id} AND type != 2";
     if (!($res = $DB->query($query_groups))) {
         echo "{\"success\":false, \"message\":\"" . __("Error : adding actors (group)", "escalade") . "\"}";
         exit;
     }
     //add documents
     $query_docs = "INSERT INTO glpi_documents_items (documents_id, items_id, itemtype, entities_id, is_recursive, date_mod)\n      SELECT documents_id, {$newID}, 'Ticket', entities_id, is_recursive, date_mod\n      FROM glpi_documents_items\n      WHERE items_id = {$tickets_id} AND itemtype = 'Ticket'";
     if (!($res = $DB->query($query_docs))) {
         echo "{\"success\":false, \"message\":\"" . __("Error : adding documents", "escalade") . "\"}";
         exit;
     }
     //add history to the new ticket
     $changes[0] = '0';
     $changes[1] = __("This ticket has been from the ticket num", "escalade") . " " . $tickets_id;
     $changes[2] = "";
     Log::history($newID, 'Ticket', $changes, 'Ticket');
     //add message (ticket cloned) after redirect
     Session::addMessageAfterRedirect(__("This ticket has been from the ticket num", "escalade") . " " . $tickets_id);
     //all ok
     echo "{\"success\":true, \"newID\":{$newID}}";
 }
开发者ID:korial29,项目名称:escalade,代码行数:68,代码来源:ticket.class.php

示例11: die

        $fields['items_id'] = $_POST['items_id'];
        // $fields['slas_id'] =             $_POST['slas_id'];
        $fields['entities_id'] = $_POST['entities_id'];
        // $fields['type'] =                $_POST['type'];
        $fields['itilcategories_id'] = $_POST['itilcategories_id'];
        $fields['locations_id'] = $_POST['locations_id'];
        $fields['name'] = $track_name;
        $fields['content'] .= "\n-----\n" . $_POST['comment'];
        /*
              echo "<pre>";
              print_r($fields);
              echo "</pre>";
              die('test');
        */
        // Create a new ticket ...
        $_POST['tickets_id'] = $track->add($fields);
        // Create new downtime with associated ticket ...
        $pmDowntime->add($_POST);
        // Redirect to new ticket form if required
        if (isset($_POST["redirect"])) {
            Html::redirect($_POST["redirect"] . "?id=" . $_POST['tickets_id']);
        } else {
            $pmDowntime->redirectToList();
        }
    } else {
        // Create new downtime without associated ticket ...
        $pmDowntime->add($_POST);
        $pmDowntime->redirectToList();
    }
} else {
    if (isset($_POST["update"])) {
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:31,代码来源:downtime.form.php

示例12: RuleTicketCollection

                     $input["itemtype"] = "PluginResourcesResource";
                     $input["items_id"] = $checklist->fields["plugin_resources_resources_id"];
                     $input["requesttypes_id"] = "6";
                     $input["urgency"] = "3";
                     $input["_users_id_assign"] = 0;
                     $input['_groups_id_assign'] = 0;
                     $input["entities_id"] = $checklist->fields["entities_id"];
                     if ($cat->getfromDB(1)) {
                         $input["itilcategories_id"] = $cat->fields["ticketcategories_id"];
                     } else {
                         $input["itilcategories_id"] = 0;
                     }
                     $rules = new RuleTicketCollection();
                     $input = $rules->processAllRules($input, $input);
                     $Ticket = new Ticket();
                     $Ticket->add($input);
                 }
             }
         }
     }
     Html::redirect(Toolbox::getItemTypeFormURL('PluginResourcesResource') . "?id=" . $_POST["plugin_resources_resources_id"]);
 } else {
     if (isset($_POST["report"])) {
         $restrict = "`itemtype` = 'User' AND `plugin_resources_resources_id` = '" . $_POST["id"] . "'";
         $linkeduser = getAllDatasFromTable('glpi_plugin_resources_resources_items', $restrict);
         if (!empty($linkeduser)) {
             $resource->sendReport($_POST);
             Session::addMessageAfterRedirect(__('Creation report sent', 'resources'), true);
         } else {
             Session::addMessageAfterRedirect(__('The report is not sent because the resource is not linked with a user', 'resources'), true, ERROR);
         }
开发者ID:geldarr,项目名称:hack-space,代码行数:31,代码来源:resource.form.php

示例13: User

 }
 if (isset($predefined['suppliers_id_assign'])) {
     $ticket['suppliers_id_assign'] = $predefined['suppliers_id_assign'];
 }
 if (isset($predefined['requesttypes_id'])) {
     $ticket['requesttypes_id'] = $predefined['requesttypes_id'];
 }
 // **********fin modif yt pour prendre en compte valeurs prédéfinies du gabarit**********;
 $user = new User();
 $user->getFromDB(Session::getLoginUserID());
 $ticket['users_id_recipient'] = $user->fields['id'];
 $ticket['users_id_lastupdater'] = $user->fields['id'];
 $ticket['type'] = $target_value['type'];
 $ticket['name'] = str_replace("'", "\\'", $ticket['name']);
 $track = new Ticket();
 $ticketID = $track->add($ticket);
 if ($validation_exist) {
     for ($cpt_valid = 0; $cpt_valid < count($validationTab); $cpt_valid++) {
         $validationTab[$cpt_valid]['tickets_id'] = $ticketID;
         $validation = new Ticketvalidation();
         $validation->add($validationTab[$cpt_valid]);
     }
 }
 $sections = new PluginFormcreatorSection();
 $sections = $sections->find("plugin_formcreator_targets_id = '{$target_id}'");
 foreach ($sections as $section_id => $section_value) {
     $questions = $helpdesk->getQuestionBySectionTypeFile($section_id);
     foreach ($questions as $question_id => $question_value) {
         $question_name = "question_" . $question_id;
         if (array_key_exists($question_name, $_FILES)) {
             if ($_FILES[$question_name]['error'] != 4) {
开发者ID:geldarr,项目名称:hack-space,代码行数:31,代码来源:helpdesk.form.php

示例14: createTicket

 static function createTicket($data)
 {
     $result = false;
     $tt = new TicketTemplate();
     // Create ticket based on ticket template and entity informations of ticketrecurrent
     if ($tt->getFromDB($data['tickettemplates_id'])) {
         // Get default values for ticket
         $input = Ticket::getDefaultValues($data['entities_id']);
         // Apply tickettemplates predefined values
         $ttp = new TicketTemplatePredefinedField();
         $predefined = $ttp->getPredefinedFields($data['tickettemplates_id'], true);
         if (count($predefined)) {
             foreach ($predefined as $predeffield => $predefvalue) {
                 $input[$predeffield] = $predefvalue;
             }
         }
         // Set date to creation date
         $createtime = date('Y-m-d H:i:s');
         $input['date'] = $createtime;
         // Compute due_date if predefined based on create date
         if (isset($predefined['due_date'])) {
             $input['due_date'] = Html::computeGenericDateTimeSearch($predefined['due_date'], false, $createtime);
         }
         // Set entity
         $input['entities_id'] = $data['entities_id'];
         $input['actiontime'] = $data['actiontime'];
         $res = new PluginResourcesResource();
         if ($res->getFromDB($data['plugin_resources_resources_id'])) {
             $input['users_id_recipient'] = $res->fields['users_id_recipient'];
             $input['_users_id_requester'] = $res->fields['users_id_recipient'];
             if (isset($res->fields['users_id'])) {
                 $input['_users_id_observer'] = $res->fields['users_id'];
             }
             $input['_users_id_assign'] = Session::getLoginUserID();
             $input["itemtype"] = "PluginResourcesResource";
             $input["items_id"] = $data['plugin_resources_resources_id'];
             $input["name"] .= addslashes(" " . PluginResourcesResource::getResourceName($data['plugin_resources_resources_id']));
         }
         //TODO : ADD checklist lists or add config into plugin ?
         $input["content"] .= addslashes("\n\n");
         $input['status'] = Ticket::CLOSED;
         $ticket = new Ticket();
         $input = Toolbox::addslashes_deep($input);
         if ($tid = $ticket->add($input)) {
             $msg = __('Create a end treatment ticket', 'resources') . " OK - ({$tid})";
             // Success
             $result = true;
         } else {
             $msg = __('Failed operation');
             // Failure
         }
     } else {
         $msg = __('No selected element or badly defined operation');
         // Not defined
     }
     if ($tid) {
         $changes[0] = 0;
         $changes[1] = '';
         $changes[2] = addslashes($msg);
         Log::history($data['plugin_resources_resources_id'], "PluginResourcesResource", $changes, '', Log::HISTORY_LOG_SIMPLE_MESSAGE);
     }
     return $result;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:63,代码来源:checklist.class.php

示例15: collect

 /**
  * Constructor
  *
  * @param $mailgateID ID of the mailgate
  * @param $display display messages in MessageAfterRedirect or just return error
  *
  * @return if $display = false return messages result string
  **/
 function collect($mailgateID, $display = 0)
 {
     global $LANG, $CFG_GLPI;
     if ($this->getFromDB($mailgateID)) {
         $this->mid = -1;
         $this->fetch_emails = 0;
         //Connect to the Mail Box
         $this->connect();
         $rejected = new NotImportedEmail();
         // Clean from previous collect (from GUI, cron already truncate the table)
         $rejected->deleteByCriteria(array('mailcollectors_id' => $this->fields['id']));
         if ($this->marubox) {
             // Get Total Number of Unread Email in mail box
             $tot = $this->getTotalMails();
             //Total Mails in Inbox Return integer value
             $error = 0;
             $refused = 0;
             for ($i = 1; $i <= $tot && $this->fetch_emails < $this->maxfetch_emails; $i++) {
                 $tkt = $this->buildTicket($i, array('mailgates_id' => $mailgateID, 'play_rules' => true));
                 //Indicates that the mail must be deleted from the mailbox
                 $delete_mail = false;
                 //If entity assigned, or email refused by rule, or no user associated with the email
                 $user_condition = $CFG_GLPI["use_anonymous_helpdesk"] || isset($tkt['_users_id_requester']) && $tkt['_users_id_requester'] > 0;
                 // Manage blacklisted emails
                 if (isset($tkt['_blacklisted']) && $tkt['_blacklisted']) {
                     $this->deleteMails($i);
                     // entities_id set when new ticket / tickets_id when new followup
                 } else {
                     if ((isset($tkt['entities_id']) || isset($tkt['tickets_id'])) && $user_condition || isset($tkt['_refuse_email_no_response']) || isset($tkt['_refuse_email_with_response'])) {
                         if (isset($tkt['_refuse_email_with_response'])) {
                             $this->sendMailRefusedResponse($tkt['_head']['from'], $tkt['name']);
                             $delete_mail = true;
                             $refused++;
                         } else {
                             if (isset($tkt['_refuse_email_no_response'])) {
                                 $delete_mail = true;
                                 $refused++;
                             } else {
                                 if (isset($tkt['entities_id']) || isset($tkt['tickets_id'])) {
                                     $tkt['_mailgate'] = $mailgateID;
                                     $result = imap_fetchheader($this->marubox, $i);
                                     // Is a mail responding of an already existgin ticket ?
                                     if (isset($tkt['tickets_id'])) {
                                         // Deletion of message with sucess
                                         if (false === is_array($result)) {
                                             $fup = new TicketFollowup();
                                             if ($fup->add($tkt)) {
                                                 $delete_mail = true;
                                             }
                                         } else {
                                             $error++;
                                         }
                                     } else {
                                         // New ticket
                                         // Deletion of message with sucess
                                         if (false === is_array($result)) {
                                             $track = new Ticket();
                                             if ($track->add($tkt)) {
                                                 $delete_mail = true;
                                             }
                                         } else {
                                             $error++;
                                         }
                                     }
                                 } else {
                                     // Case never raise
                                     $delete_mail = true;
                                     $refused++;
                                 }
                             }
                         }
                         //Delete Mail from Mail box if ticket is added successfully
                         if ($delete_mail) {
                             $this->deleteMails($i);
                         }
                     } else {
                         $input = array();
                         $input['mailcollectors_id'] = $mailgateID;
                         $input['from'] = $tkt['_head']['from'];
                         $input['to'] = $tkt['_head']['to'];
                         if (!$tkt['_users_id_requester']) {
                             $input['reason'] = NotImportedEmail::USER_UNKNOWN;
                         } else {
                             $input['reason'] = NotImportedEmail::MATCH_NO_RULE;
                         }
                         $input['users_id'] = $tkt['_users_id_requester'];
                         $input['subject'] = $this->textCleaner($tkt['_head']['subject']);
                         $input['messageid'] = $tkt['_head']['message_id'];
                         $input['date'] = $_SESSION["glpi_currenttime"];
                         $rejected->add($input);
                     }
                 }
//.........这里部分代码省略.........
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:101,代码来源:mailcollector.class.php


注:本文中的Ticket::add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。