merge() public method

The p_rules array is an associative array with the key being the DESTINATION fieldname and the values being the SOURCE fieldname (without Fs). E.g. $p_rules = array('a' => 'a', 'b' => 'title', 'd' => 'body'); p_rules is verified elsewhere (see article_types/merge3.php). If we are doing an actual merge, all that happens is that we rename the Type in Articles from SrcType to DestType and run the merge (p_rules) on the XSrcTable entries and move them over to XDestType. Merged articles have the same ArticleNumber as their originals.
public merge ( $p_src, $p_dest, $p_rules ) : boolean
return boolean
Example #1
0
                            getGS($srcATF->getType()), $srcATF->getDisplayName(),
                            getGS($destATF->getType()), $destATF->getDisplayName());
        $ok = false;
	}
}

//
// if f_action is Merge, do the merge and return them to article_types/ screen (or an error)
//
if ($ok && $f_action == 'Merge') {
	if (!SecurityToken::isValid()) {
		camp_html_display_error(getGS('Invalid security token!'));
		exit;
	}

	$res = ArticleType::merge($f_src, $f_dest, $f_src_c);
    if (!$res) {
        $errMsgs[] = getGS("Merge failed.");
        $ok = false;
    }
    if ($ok) {
    	$f_delete = Input::get('f_delete', 'checkbox', 0);
        if ($f_delete) {
            // delete the source article type
            $at = new ArticleType($f_src);
            $at->delete();
        }

        camp_html_goto_page("/$ADMIN/article_types/");
        exit(0);
    }