original_string: public static function update_multiple_from_template(template $template) {
          global $DB;
          if (!$template->is_valid()) {
              // As we will bypass this model's validation we rely on the template being validated.
              throw new \coding_exception('The template must be validated before updating plans.');
          }
  
          $params = array(
              'templateid' => $template->get('id'),
              'status' => self::STATUS_COMPLETE,
  
              'name' => $template->get('shortname'),
              'description' => $template->get('description'),
              'descriptionformat' => $template->get('descriptionformat'),
              'duedate' => $template->get('duedate'),
          );
  
          $sql = "UPDATE {" . self::TABLE . "}
                     SET name = :name,
                         description = :description,
                         descriptionformat = :descriptionformat,
                         duedate = :duedate
                   WHERE templateid = :templateid
                     AND status != :status";
  
          return $DB->execute($sql, $params);
      }
code: public static function update_multiple_from_template(template $template) {
          global $DB;
          if (!$template->is_valid()) {
              // As we will bypass this model's validation we rely on the template being validated.
              throw new \coding_exception('The template must be validated before updating plans.');
          }
  
          $params = array(
              'templateid' => $template->get('id'),
              'status' => self::STATUS_COMPLETE,
  
              'name' => $template->get('shortname'),
              'description' => $template->get('description'),
              'descriptionformat' => $template->get('descriptionformat'),
              'duedate' => $template->get('duedate'),
          );
  
          $sql = "UPDATE {" . self::TABLE . "}
                     SET name = :name,
                         description = :description,
                         descriptionformat = :descriptionformat,
                         duedate = :duedate
                   WHERE templateid = :templateid
                     AND status != :status";
  
          return $DB->execute($sql, $params);
      }
code_tokens: public static function update_multiple_from_template ( template $ template ) { global $ DB ; if ( ! $ template -> is_valid ( ) ) { // As we will bypass this model's validation we rely on the template being validated. throw new \ coding_exception ( 'The template must be validated before updating plans.' ) ; } $ params = array ( 'templateid' => $ template -> get ( 'id' ) , 'status' => self :: STATUS_COMPLETE , 'name' => $ template -> get ( 'shortname' ) , 'description' => $ template -> get ( 'description' ) , 'descriptionformat' => $ template -> get ( 'descriptionformat' ) , 'duedate' => $ template -> get ( 'duedate' ) , ) ; $ sql = "UPDATE {" . self :: TABLE . "}
                     SET name = :name,
                         description = :description,
                         descriptionformat = :descriptionformat,
                         duedate = :duedate
                   WHERE templateid = :templateid
                     AND status != :status" ; return $ DB -> execute ( $ sql , $ params ) ; }
docstring: Update from template.
  
  Bulk update a lot of plans from a template
  
  @param  template $template
  @return bool
docstring_tokens: Update from template .