コード例 #1
0
ファイル: Person.php プロジェクト: armic/erpts
 function updateRecord()
 {
     $sql = sprintf("update %s set" . " personType = '%s'" . ", lastName = '%s'" . ", firstName = '%s'" . ", middleName = '%s'" . ", gender = '%s'" . ", birthday = '%s'" . ", maritalStatus = '%s'" . ", tin = '%s'" . ", telephone = '%s'" . ", mobileNumber = '%s'" . ", email = '%s'" . " where personID = '%s';", PERSON_TABLE, fixQuotes($this->personType), fixQuotes($this->lastName), fixQuotes($this->firstName), fixQuotes($this->middleName), fixQuotes($this->gender), toMysqlDate($this->birthday), fixQuotes($this->maritalStatus), fixQuotes($this->tin), fixQuotes($this->telephone), fixQuotes($this->mobileNumber), fixQuotes($this->email), $this->personID);
     //echo $sql;
     $this->setDB();
     $this->db->beginTransaction();
     $this->db->query($sql);
     if ($this->db->Errno != 0) {
         $this->db->rollbackTransaction();
         $this->db->resetErrors();
         $ret = false;
     } else {
         $this->db->endTransaction();
         foreach ($this->addressArray as $key => $value) {
             //$value = $this->addressArray;
             if ($value->addressID) {
                 $addressID = $value->updateRecord();
             } else {
                 $addressID = $value->insertRecord();
                 $sql = sprintf("insert into %s (" . "personID" . ", addressID" . ")" . " values (%s, %s);", PERSON_ADDRESS_TABLE, $this->personID, $addressID);
                 $this->db->beginTransaction();
                 $this->db->query($sql);
                 if ($this->db->Errno != 0) {
                     $this->db->rollbackTransaction();
                     $this->db->resetErrors();
                     $ret = false;
                 } else {
                     $this->db->endTransaction();
                 }
             }
         }
         $ret = $this->personID;
     }
     return $ret;
 }
コード例 #2
0
ファイル: Due.php プロジェクト: armic/erpts
 function updateRecord()
 {
     $sql = sprintf("update %s set" . " dueID = '%s'" . ", tdID = '%s'" . ", dueType = '%s'" . ", dueDate = '%s'" . ", basicTax = '%s'" . ", basicTaxRate = '%s'" . ", sefTax = '%s'" . ", sefTaxRate = '%s'" . ", idleTax = '%s'" . ", idleTaxRate = '%s'" . " where dueID = '%s';", DUE_TABLE, fixQuotes($this->dueID), fixQuotes($this->tdID), fixQuotes($this->dueType), toMysqlDate($this->dueDate), fixQuotes($this->basicTax), fixQuotes($this->basicTaxRate), fixQuotes($this->sefTax), fixQuotes($this->sefTaxRate), fixQuotes($this->idleTax), fixQuotes($this->idleTaxRate), fixQuotes($this->dueID));
     $this->setDB();
     $this->db->beginTransaction();
     $this->db->query($sql);
     if ($this->db->Errno != 0) {
         $this->db->rollbackTransaction();
         $this->db->resetErrors();
         $ret = false;
     } else {
         $this->db->endTransaction();
         $ret = $this->dueID;
     }
     return $ret;
 }