original_string: 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);
      }
code: 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);
      }
code_tokens: 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 ) ; }
docstring: 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
docstring_tokens: Save the data from the policydoc form as a new policy document .