Пример #1
0
 function store()
 {
     global $helpdesk_available;
     if ($helpdesk_available && $this->file_helpdesk_item != 0) {
         $this->addHelpDeskTaskLog();
     }
     parent::store();
 }
Пример #2
0
 function load($oid = null, $strip = false, $skipUpdate = false)
 {
     // use parent function to load the given object
     $loaded = parent::load($oid, $strip);
     /*
      ** Update the values of a dynamic task from
      ** the children's properties each time the
      ** dynamic task is loaded.
      ** Additionally store the values in the db.
      ** Only treat umbrella tasks of dynamics '1'.
      */
     if ($this->task_dynamic == 1 && !$skipUpdate) {
         // update task from children
         $this->htmlDecode();
         $this->updateDynamics(true);
         /*
          ** Use parent function to store the updated values in the db
          ** instead of store function of this object in order to
          ** prevent from infinite loops.
          */
         parent::store();
         $loaded = parent::load($oid, $strip);
     }
     // return whether the object load process has been successful or not
     return $loaded;
 }
Пример #3
0
 function store()
 {
     $msg = $this->check();
     return $msg ? $msg : parent::store();
 }
Пример #4
0
 function store()
 {
     global $AppUI;
     // Update the last modified time and user
     $this->item_modified = db_unix2dateTime(time());
     $this->item_summary = strip_tags($this->item_summary);
     //if type indicates a contact or a user, then look up that phone and email
     //for those entries
     switch ($this->item_requestor_type) {
         case '0':
             //it's not a user or a contact
             break;
         case '1':
             //it's a system user
             $sql = "SELECT user_id as id,\n                       contact_email as email,\n                       contact_phone as phone,\n                CONCAT(contact_first_name,' ', contact_last_name) as name\n                FROM users\n               LEFT JOIN contacts ON user_contact = contact_id\n                WHERE user_id='{$this->item_requestor_id}'";
             break;
         case '2':
             $sql = "SELECT contact_id as id,\n                       contact_email as email,\n                       contact_phone as phone,\n                CONCAT(contact_first_name,' ', contact_last_name) as name\n                FROM contacts\n                WHERE contact_id='{$this->item_requestor_id}'";
             break;
         default:
             break;
     }
     if (isset($sql)) {
         db_loadHash($sql, $result);
         $this->item_requestor_email = $result['email'];
         $this->item_requestor_phone = $result['phone'];
         $this->item_requestor = $result['name'];
     }
     /* if the store is successful, pull the new id value and insert it into the 
        object. */
     if ($msg = parent::store()) {
         return $msg;
     } else {
         if (!$this->item_id) {
             $this->item_id = mysql_insert_id();
         }
         return $msg;
     }
 }
Пример #5
0
 function store()
 {
     global $AppUI;
     // Update the last modified time and user
     //$this->item_created = new CDate();
     $this->item_summary = strip_tags($this->item_summary);
     //if type indicates a contact or a user, then look up that phone and email
     //for those entries
     switch ($this->item_requestor_type) {
         case '0':
             //it's not a user or a contact
             break;
         case '1':
             //it's a system user
             $q = new DBQuery();
             $q->addTable('users', 'u');
             $q->addQuery('u.user_id as id');
             $q->addJoin('contacts', 'c', 'u.user_contact = c.contact_id');
             $q->addQuery("c.contact_email as email, c.contact_phone as phone, CONCAT(c.contact_first_name,' ', c.contact_last_name) as name");
             /*        $sql = "SELECT user_id as id,
                               contact_email as email,
                               contact_phone as phone,
                        CONCAT(contact_first_name,' ', contact_last_name) as name
                        FROM users
                       LEFT JOIN contacts ON user_contact = contact_id
                        WHERE user_id='{$this->item_requestor_id}'";*/
             break;
         case '2':
             $q = new DBQuery();
             $q->addTable('contacts', 'c');
             $q->addQuery("c.contact_email as email, c.contact_phone as phone, CONCAT(c.contact_first_name,' ', c.contact_last_name) as name");
             $q->addWhere('contact_id=' . $this->item_requestor_id);
             /*        $sql = "SELECT contact_id as id,
                              contact_email as email,
                              contact_phone as phone,
                       CONCAT(contact_first_name,' ', contact_last_name) as name
                       FROM contacts
                       WHERE contact_id='{$this->item_requestor_id}'";*/
             break;
         default:
             break;
     }
     if (isset($q)) {
         $result = $q->loadHash();
         $q->clear();
         $this->item_requestor_email = $result['email'];
         $this->item_requestor_phone = $result['phone'];
         $this->item_requestor = $result['name'];
     }
     /* if the store is successful, pull the new id value and insert it into the 
        object. */
     if ($msg = parent::store()) {
         return $msg;
     } else {
         if (!$this->item_id) {
             $this->item_id = mysql_insert_id();
         }
         return $msg;
     }
 }