app/GedcomRecord.php
public function updateRecord(string $gedcom, bool $update_chan): void
    {
        // MSDOS line endings will break things in horrible ways
        $gedcom = preg_replace('/[\r\n]+/', "\n", $gedcom);
        $gedcom = trim($gedcom);

        // Update the CHAN record
        if ($update_chan) {
            $gedcom = preg_replace('/\n1 CHAN(\n[2-9].*)*/', '', $gedcom);
            $gedcom .= "\n1 CHAN\n2 DATE " . date('d M Y') . "\n3 TIME " . date('H:i:s') . "\n2 _WT_USER " . Auth::user()->userName();
        }

        // Create a pending change
        DB::table('change')->insert([
            'gedcom_id'  => $this->tree->id(),
            'xref'       => $this->xref,
            'old_gedcom' => $this->gedcom(),
            'new_gedcom' => $gedcom,
            'user_id'    => Auth::id(),
        ]);

        // Clear the cache
        $this->pending = $gedcom;

        // Accept this pending change
        if (Auth::user()->getPreference('auto_accept')) {
            FunctionsImport::acceptAllChanges($this->xref, $this->tree);
            $this->gedcom  = $gedcom;
            $this->pending = null;
        }

        $this->parseFacts();

        Log::addEditLog('Update: ' . static::RECORD_TYPE . ' ' . $this->xref, $this->tree);
    }
public function updateRecord(string $gedcom, bool $update_chan): void
    {
        // MSDOS line endings will break things in horrible ways
        $gedcom = preg_replace('/[\r\n]+/', "\n", $gedcom);
        $gedcom = trim($gedcom);

        // Update the CHAN record
        if ($update_chan) {
            $gedcom = preg_replace('/\n1 CHAN(\n[2-9].*)*/', '', $gedcom);
            $gedcom .= "\n1 CHAN\n2 DATE " . date('d M Y') . "\n3 TIME " . date('H:i:s') . "\n2 _WT_USER " . Auth::user()->userName();
        }

        // Create a pending change
        DB::table('change')->insert([
            'gedcom_id'  => $this->tree->id(),
            'xref'       => $this->xref,
            'old_gedcom' => $this->gedcom(),
            'new_gedcom' => $gedcom,
            'user_id'    => Auth::id(),
        ]);

        // Clear the cache
        $this->pending = $gedcom;

        // Accept this pending change
        if (Auth::user()->getPreference('auto_accept')) {
            FunctionsImport::acceptAllChanges($this->xref, $this->tree);
            $this->gedcom  = $gedcom;
            $this->pending = null;
        }

        $this->parseFacts();

        Log::addEditLog('Update: ' . static::RECORD_TYPE . ' ' . $this->xref, $this->tree);
    }
public function updateRecord ( string $ gedcom , bool $ update_chan ) : void { // MSDOS line endings will break things in horrible ways $ gedcom = preg_replace ( '/[\r\n]+/' , "\n" , $ gedcom ) ; $ gedcom = trim ( $ gedcom ) ; // Update the CHAN record if ( $ update_chan ) { $ gedcom = preg_replace ( '/\n1 CHAN(\n[2-9].*)*/' , '' , $ gedcom ) ; $ gedcom .= "\n1 CHAN\n2 DATE " . date ( 'd M Y' ) . "\n3 TIME " . date ( 'H:i:s' ) . "\n2 _WT_USER " . Auth :: user ( ) -> userName ( ) ; } // Create a pending change DB :: table ( 'change' ) -> insert ( [ 'gedcom_id' => $ this -> tree -> id ( ) , 'xref' => $ this -> xref , 'old_gedcom' => $ this -> gedcom ( ) , 'new_gedcom' => $ gedcom , 'user_id' => Auth :: id ( ) , ] ) ; // Clear the cache $ this -> pending = $ gedcom ; // Accept this pending change if ( Auth :: user ( ) -> getPreference ( 'auto_accept' ) ) { FunctionsImport :: acceptAllChanges ( $ this -> xref , $ this -> tree ) ; $ this -> gedcom = $ gedcom ; $ this -> pending = null ; } $ this -> parseFacts ( ) ; Log :: addEditLog ( 'Update: ' . static :: RECORD_TYPE . ' ' . $ this -> xref , $ this -> tree ) ; }
Update this record

@param string $gedcom
@param bool   $update_chan

@return void
Update this record