示例#1
0
 public function lAddNewVolunteer()
 {
     //-----------------------------------------------------------------------
     //
     //-----------------------------------------------------------------------
     global $glUserID;
     $clsUFC = new muser_fields_create();
     if (!isset($this->volRecs[0]->lRegFormID) || is_null($this->volRecs[0]->lRegFormID)) {
         $strRegFormID = 'null';
     } else {
         $strRegFormID = (int) $this->volRecs[0]->lRegFormID;
     }
     $sqlStr = 'INSERT INTO volunteers
         SET
            vol_lPeopleID     = ' . $this->volRecs[0]->lPeopleID . ',
            vol_bInactive     = 0,
            vol_dteInactive   = NULL,
            vol_Notes         = ' . strPrepStr($this->volRecs[0]->Notes) . ",\n               vol_bRetired      = 0,\n               vol_lRegFormID    = {$strRegFormID},\n               vol_lOriginID     = {$glUserID},\n               vol_lLastUpdateID = {$glUserID},\n               vol_dteOrigin     = NOW(),\n               vol_dteLastUpdate = NOW()\n            ON DUPLICATE KEY UPDATE\n               vol_bInactive     = 0,\n               vol_dteInactive   = NULL;";
     $query = $this->db->query($sqlStr);
     $this->volRecs[0]->lKeyID = $lKeyID = $this->db->insert_id();
     //--------------------------------------------------------
     // create blank/default records for all the personalized
     // people tables
     //--------------------------------------------------------
     $clsUFC->enumTType = CENUM_CONTEXT_VOLUNTEER;
     $clsUFC->loadTablesViaTType();
     if ($clsUFC->lNumTables > 0) {
         foreach ($clsUFC->userTables as $clsTable) {
             $clsUFC->createSingleEmptyRec($clsTable, $lKeyID);
         }
     }
     return $lKeyID;
 }
示例#2
0
 public function lCreateNewBizRec()
 {
     //-----------------------------------------------------------------------
     //
     //-----------------------------------------------------------------------
     global $glUserID, $glChapterID;
     $clsUFC = new muser_fields_create();
     $sqlStr = "INSERT INTO people_names\n        SET\n             pe_lOriginID    = {$glUserID},\n             pe_dteOrigin    = NOW(), " . $this->strBizSQLCommon();
     $query = $this->db->query($sqlStr);
     $this->lBID = $lBID = $this->db->insert_id();
     //      $result = mysql_query($sqlStr);
     //      if (bSQLError('SQL error on line '.__LINE__.', file '.__FILE__.', function '.__FUNCTION__, $sqlStr) ) {
     //         screamForHelp('Unexpected SQL error');
     //      }
     //
     //      $this->lBID = $lBID = mysql_insert_id();
     //--------------------------------------------------------
     // create blank/default records for all the personalized
     // people tables
     //--------------------------------------------------------
     $clsUFC->enumTType = CENUM_CONTEXT_BIZ;
     $clsUFC->loadTablesViaTType();
     if ($clsUFC->lNumTables > 0) {
         foreach ($clsUFC->userTables as $clsTable) {
             $clsUFC->createSingleEmptyRec($clsTable, $lBID);
         }
     }
     return $this->lBID;
 }
 public function lAddNewGiftRecord()
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $glUserID;
     $sqlCommon = $this->strCommonGiftSQL();
     $sqlStr = "INSERT INTO gifts\n              SET {$sqlCommon},\n                 gi_lOriginID   = {$glUserID},\n                 gi_lForeignID  = " . $this->gifts[0]->gi_lForeignID . ',
              gi_bRetired    = 0,
              gi_dteOrigin   = NOW();';
     $this->db->query($sqlStr);
     $this->gifts[0]->gi_lKeyID = $lGiftID = $this->db->insert_id();
     //--------------------------------------------------------
     // create blank/default records for all the personalized
     // gift tables
     //--------------------------------------------------------
     $clsUFC = new muser_fields_create();
     $clsUFC->enumTType = CENUM_CONTEXT_GIFT;
     $clsUFC->loadTablesViaTType();
     if ($clsUFC->lNumTables > 0) {
         foreach ($clsUFC->userTables as $clsTable) {
             $clsUFC->createSingleEmptyRec($clsTable, $lGiftID);
         }
     }
     return $lGiftID;
 }
 public function lAddNewClient()
 {
     //-----------------------------------------------------------------------
     //
     //-----------------------------------------------------------------------
     global $gdteNow, $glUserID;
     $clsUFC = new muser_fields_create();
     $sqlCommon = $this->strCommonClientSQL();
     $sqlStr = "INSERT INTO client_records\n           SET {$sqlCommon},\n             cr_lStatusCatID = " . $this->clients[0]->lStatusCatID . ",\n             cr_lOriginID    = {$glUserID},\n             cr_bRetired     = 0,\n             cr_dteOrigin    = NOW();";
     $query = $this->db->query($sqlStr);
     $this->clients[0]->lKeyID = $lKeyID = $this->db->insert_id();
     //mysql_insert_id();
     //--------------------------------------------------------
     // create blank/default records for all the personalized
     // client tables
     //--------------------------------------------------------
     $clsUFC->enumTType = CENUM_CONTEXT_CLIENT;
     $clsUFC->loadTablesViaTType();
     if ($clsUFC->lNumTables > 0) {
         foreach ($clsUFC->userTables as $clsTable) {
             $clsUFC->createSingleEmptyRec($clsTable, $lKeyID);
         }
     }
     return $lKeyID;
 }
示例#5
0
 public function lCreateNewPeopleRec()
 {
     //-----------------------------------------------------------------------
     //
     //-----------------------------------------------------------------------
     global $glUserID, $glChapterID;
     $clsUFC = new muser_fields_create();
     $lHID = $this->people[0]->lHouseholdID;
     $sqlStr = "INSERT INTO people_names\n        SET\n             pe_lChapterID   = {$glChapterID},\n             pe_lHouseholdID = " . strDBValueConvert_INT($lHID) . ",\n             pe_lOriginID    = {$glUserID},\n             pe_dteOrigin    = NOW(), " . $this->strPeopleSQLCommon() . ';';
     $query = $this->db->query($sqlStr);
     $this->people[0]->lKeyID = $lKeyID = $this->db->insert_id();
     //------------------------------------------------------------
     // if not part of a household, make person head of household
     //------------------------------------------------------------
     if ($lHID == 0) {
         $sqlStr = "UPDATE people_names\n             SET\n                pe_lHouseholdID={$lKeyID}\n             WHERE pe_lKeyID={$lKeyID};";
         $this->db->query($sqlStr);
     }
     //--------------------------------------------------------
     // create blank/default records for all the personalized
     // people tables
     //--------------------------------------------------------
     $clsUFC->enumTType = CENUM_CONTEXT_PEOPLE;
     $clsUFC->loadTablesViaTType();
     if ($clsUFC->lNumTables > 0) {
         foreach ($clsUFC->userTables as $clsTable) {
             $clsUFC->createSingleEmptyRec($clsTable, $lKeyID);
         }
     }
     return $lKeyID;
 }