Esempio n. 1
0
 function createTaskGroup($company_id, $type, $parent_id = 0)
 {
     $jigf = new JobItemGroupFactory();
     $jigf->setCompany($company_id);
     switch ($type) {
         case 10:
             $jigf->setParent($parent_id);
             $jigf->setName('Construction');
             break;
         case 20:
             $jigf->setParent($parent_id);
             $jigf->setName('Inside');
             break;
         case 30:
             $jigf->setParent($parent_id);
             $jigf->setName('Outside');
             break;
         case 40:
             $jigf->setParent($parent_id);
             $jigf->setName('Projects');
             break;
         case 50:
             $jigf->setParent($parent_id);
             $jigf->setName('Accounting');
             break;
         case 60:
             $jigf->setParent($parent_id);
             $jigf->setName('Estimating');
             break;
     }
     if ($jigf->isValid()) {
         $insert_id = $jigf->Save();
         Debug::Text('Job Group ID: ' . $insert_id, __FILE__, __LINE__, __METHOD__, 10);
         return $insert_id;
     }
     Debug::Text('Failed Creating Job Group!', __FILE__, __LINE__, __METHOD__, 10);
     return FALSE;
 }