public static function form_policydoc_add(stdClass $form) {
        global $DB;

        $form = clone($form);

        $form->policyid = $DB->insert_record('tool_policy', (object) [
            'sortorder' => 999,
        ]);

        static::distribute_policy_document_sortorder();

        return static::form_policydoc_update_new($form);
    }
public static function form_policydoc_add(stdClass $form) {
        global $DB;

        $form = clone($form);

        $form->policyid = $DB->insert_record('tool_policy', (object) [
            'sortorder' => 999,
        ]);

        static::distribute_policy_document_sortorder();

        return static::form_policydoc_update_new($form);
    }
public static function form_policydoc_add ( stdClass $ form ) { global $ DB ; $ form = clone ( $ form ) ; $ form -> policyid = $ DB -> insert_record ( 'tool_policy' , ( object ) [ 'sortorder' => 999 , ] ) ; static :: distribute_policy_document_sortorder ( ) ; return static :: form_policydoc_update_new ( $ form ) ; }
Save the data from the policydoc form as a new policy document.

@param stdClass $form data submitted from the {@link \tool_policy\form\policydoc} form.
@return \tool_policy\policy_version persistent
Save the data from the policydoc form as a new policy document .