Builds javascript to avoid multiple form submission

@param string $frmId
@return string
343280
protected function setFormJavascriptFinal($frmId)
    {
        $cnt = implode(PHP_EOL, [
            '$(document).ready(function(){',
            '$("form#' . $frmId . '").submit(function(){',
            '$("form#' . $frmId . ' input[type=checkbox]").attr("readonly", true);',
            '$("form#' . $frmId . ' input[type=password]").attr("readonly", true);',
            '$("form#' . $frmId . ' input[type=radio]").attr("readonly", true);',
            '$("form#' . $frmId . ' input[type=text]").attr("readonly", true);',
            '$("form#' . $frmId . ' textarea").attr("readonly", true);',
            '$("form#' . $frmId . ' select").attr("readonly", true);',
            '$("input[type=submit]").attr("disabled", "disabled");',
            '$("input[type=submit]").attr("value", "' . $this->lclMsgCmn('i18n_Form_ButtonSaving') . '");',
            '});',
            '});',
        ]);
        return $this->setJavascriptContent(PHP_EOL . $cnt . PHP_EOL);
    }
379977
public function formScript()
    {
        ob_start();
        $form = $this;
        require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'view' . DIRECTORY_SEPARATOR . 'formScript.php';
        $script = ob_get_clean();
        return $script;

    }
703120
public function buildCommon()
	{

		$filtering_post = \Sifo\FilterPost::getInstance();

		// EXAMPLE OF HOW MODULES WORK. Add an advertising module:
		$this->addModule( 'ads_google_skyscrapper' , 'SharedAdvertising' );

		// TEST FORM SENT
		if ( $filtering_post->isSent( 'testform' ) )
		{
			$form = \Sifo\Form::getInstance( $filtering_post );

			if ( !$form->validateElements( 'forms/example.form' ) )
			{
				// Basic validation: The data sent has an invalid form.
				$errors = $form->getErrors();
				\Sifo\FlashMessages::set( $errors, \Sifo\FlashMessages::MSG_KO );

			}
			else
			{
				\Sifo\FlashMessages::set( "Validated data. Mai inglish is parfect!", \Sifo\FlashMessages::MSG_OK );
			}

			$this->assign( "form_fields", $form->getFields() );

		}

		// INVITE  SENT
		if ( $filtering_post->isSent( 'inviteform' ) )
		{
			if ( ( $account_email = $filtering_post->getEmail( 'account_email' ) ) && ( $account_password = $filtering_post->getString( 'account_password' ) ) )
			{
				if ( strstr( $account_email, '@yahoo.' ) || strstr( $account_email, '@ymail.' ) )
				{
					$account_provider = 'yahoo';
				}
				elseif ( strstr( $account_email, '@hotmail.' ) || strstr( $account_email, '@live.' ) || strstr( $account_email, '@msn.' ) )
				{
					$account_provider = 'hotmail';
				}
				else
				{
					$account_provider = 'gmail';
				}
			}
		}

		$smileys = array(
			':-)',
			':-(',
			'¬¬',
			'xD',
			':_(',
			':-0',
			'=)'
		);

		// Set a system message
		\Sifo\FlashMessages::set( '<strong>Installation correct!</strong> <small>(This is an example OK message.)</small>', \Sifo\FlashMessages::MSG_OK );

		//\Sifo\FlashMessages::set( 'Installation failed!', \Sifo\FlashMessages::MSG_KO );
		//\Sifo\FlashMessages::set( 'For your information...!', \Sifo\FlashMessages::MSG_INFO );
		//\Sifo\FlashMessages::set( 'Your account is incomplete', \Sifo\FlashMessages::MSG_WARNING );

		// Same message translated (include the message in messages_xx_XX.config.php first):
		// \Sifo\FlashMessages::set( $this->translate( 'Installation correct!' ) );

		// Same message translated with variable strings
		// \Sifo\FlashMessages::set( $this->translate( 'Installation correct! %1', $var1 ) );

		// Pass to the template a random smiley:
		$rand = array_rand( $smileys, 1 );
		$this->assign( 'mood', $smileys[$rand] );

		// Parameters in the application
		// var_dump( $this->getParams() );

		// SAMPLE: Get data from the database without a \SifoModel:
		// $this->assign( 'data', Db::getInstance()->getAll( 'SELECT * FROM accounts where id_account < ?', 20 ) );

		// With a \Sifo\Model
		// $user = new UserDataModel();
		// $user->getMyDataInsideMyClass();

		// Add another module (execute a controller and capture the output)
		// $this->addModule( 'name_used_in_tpl', 'Class' );

		// Add pagination
		// @See:  Quick reference for usage in pagination class.
		$pagination = new Pagination();

		$pagination->setNumTotalResults(2500);								// Set total number of items
		$pagination->setCurrentPage(5);										// Set current page.
		$pagination->setUrlBase( 'http://www.test.com/pag');				// Set url base & template.
		$pagination->setTemplate( 'home/pagination.tpl' );					// Set pagination template.

		// Parameters optionals:
		// $pagination->setItemsPerPage(5);									// Set items per page. By default 10.
		// $pagination->setMaxPages(20);									// Set maxim number of pages to show.
		// $pagination->setTemplateParam( 'title', 'pagination test' );		// Set a parameter assigned to the pagination template.
		// $pagination->setSeparatorLink( '-' );							// Set the default separator for the page link.
		// $pagination->setDisplayItemsPerPage( array( 10, 25, 50, 100 ) );	// Set display items per page.
		// $pagination->setWindowPage( 'default', 20 );						// Set page range ( window ). [ 'default'=> 15,	'short'	=> 12,'very_short'	=> 10]

		// Get pagination data and pass data to the template.
		$result = $pagination->getLinks();
		$this->assign( 'pagination_data', $result );

		// Note: To show the paginator, you should use the following smarty function in your template: {pagination data=$result}
		$this->setLayout( 'home/index.tpl' );

	}
979563
function ConfigPrint($fp)
    {
        $rp = $this->rp;
        fprintf($fp, "%s ::=", $rp->lhs->name);
        for ($i = 0; $i <= $rp->nrhs; $i++) {
            if ($i === $this->dot) {
                fwrite($fp,' *');
            }
            if ($i === $rp->nrhs) {
                break;
            }
            $sp = $rp->rhs[$i];
            fprintf($fp,' %s', $sp->name);
            if ($sp->type == PHP_ParserGenerator_Symbol::MULTITERMINAL) {
                for ($j = 1; $j < $sp->nsubsym; $j++) {
                    fprintf($fp, '|%s', $sp->subsym[$j]->name);
                }
            }
        }
    }
408633
public function ___build(): string
    {
        $tables = \implode(', ', $this->from);
        $where = $limit = '';

        if ($this->where !== '') {
            $where = \sprintf(' WHERE %s', $this->where);
        }
        if ($this->limit !== 0) {
            $limit = \sprintf(' LIMIT %s', $this->limit);
        }

        return \sprintf('DELETE FROM %s%s%s', $tables, $where, $limit);
    }
509452
public function getFormRequestDataJavaScriptCode()
    {
        $submittedFormValues = [];
        $fieldsExistingMessages = [];
        $deactivatedFields = [];
        $formWasSubmitted = 'false';

        if ($this->getFormObject()->formWasSubmitted()) {
            $formWasSubmitted = 'true';
            $submittedFormValues = $this->getSubmittedFormValues();
            $fieldsExistingMessages = $this->getFieldsExistingMessages();
            $deactivatedFields = $this->getDeactivatedFields();
        }

        $submittedFormValues = ArrayService::get()->arrayToJavaScriptJson($submittedFormValues);
        $fieldsExistingMessages = ArrayService::get()->arrayToJavaScriptJson($fieldsExistingMessages);
        $deactivatedFields = ArrayService::get()->arrayToJavaScriptJson($deactivatedFields);

        $formName = GeneralUtility::quoteJSvalue($this->getFormObject()->getName());

        $javaScriptCode = <<<JS
(function() {
    Fz.Form.beforeInitialization($formName, function(form) {
        form.injectRequestData($submittedFormValues, $fieldsExistingMessages, $formWasSubmitted, $deactivatedFields)
    });
})();
JS;

        return $javaScriptCode;
    }
138259
public function get_search_form()
    {
        $data = [];

        if (\function_exists('random_int')) {
            try {
                $data['searchform_id'] = 'search_' . \random_int(1000, 8000);
            } catch (\Exception $e) {
                // Fail silently.
            }
        }

        if (! isset($data['searchform_id'])) {
            $data = [
                'searchform_id' => \uniqid('search_', true),
            ];
        }

        \ob_start();
        View::partial('searchform', $data);
        $form = \ob_get_clean();

        return $form;
    }
1356909
public function ajouter()
    {
        $newIdPersonne=0;
        $formulaire = new formGenerator();
        if (isset($this->variablesPost['submit'])) {
            $modeAffichage='';
            if (isset($this->variablesGet['modeAffichage']) && $this->variablesGet['modeAffichage']!='') {
                $modeAffichage = $this->variablesGet['modeAffichage'];
            }


            switch ($modeAffichage) {
                case 'nouveauDossier':
                case "modifEvenement":
                    $tabForm = array(
                    'prenom'    => array('default'=> '',  'value' => '',  'required'=>false, 'error'=>'', 'type'=>'text'),
                    'nom'        => array('default'=> '',  'value' => '',  'required'=>true, 'error'=>'', 'type'=>'text'),
                    'description'    => array('default'=> '',  'value' => '',  'required'=>false, 'error'=>'', 'type'=>'text'),
                    'dateNaissance'    => array('default'=> '',  'value' => '',  'required'=>false, 'error'=>'', 'type'=>'date'),
                    'dateDeces'    => array('default'=> '',  'value' => '',  'required'=>false, 'error'=>'', 'type'=>'date'),
                    'metier'    => array('default'=> 'aucune' ,  'value' => '',  'required'=>false , 'error'=>'', 'type'=>'numeric',  'checkExist'=>
                                    array('table'=> 'metier',  'primaryKey'=> 'idMetier')));

                    break;

                default:
                    $tabForm = array(
                    'prenom'    => array('default'=> '',  'value' => '',  'required'=>false, 'error'=>'', 'type'=>'text'),
                    'nom'        => array('default'=> '',  'value' => '',  'required'=>true, 'error'=>'', 'type'=>'text'),
                    'description'    => array('default'=> '',  'value' => '',  'required'=>false, 'error'=>'', 'type'=>'text'),
                    'nouveauMetier'    => array('default'=> '',  'value' => '',  'required'=>false, 'error'=>'', 'type'=>'text'),
                    'dateNaissance'    => array('default'=> '',  'value' => '',  'required'=>false, 'error'=>'', 'type'=>'date'),
                    'dateDeces'    => array('default'=> '',  'value' => '',  'required'=>false, 'error'=>'', 'type'=>'date'),
                    'metier'    => array('default'=> 'aucune' ,  'value' => '',  'required'=>false , 'error'=>'', 'type'=>'numeric',  'checkExist'=>
                                    array('table'=> 'metier',  'primaryKey'=> 'idMetier')));

                    break;
            }
            $erreur = $formulaire->getArrayFromPost($tabForm);

            if (count($erreur) === 0) {
                $prenom = mysql_escape_string($tabForm['prenom']['value']);
                $nom    = mysql_escape_string($tabForm['nom']['value']);
                $description   = isset($_POST['descriptionPerson'])?mysql_escape_string($_POST['descriptionPerson']):mysql_escape_string(htmlspecialchars($tabForm['description']['value']));
                $dateNaissance = $this->date->toBdd($this->date->convertYears($tabForm['dateNaissance']['value']));
                $dateDeces     = $this->date->toBdd($this->date->convertYears($tabForm['dateDeces']['value']));

                /*if (!empty($tabForm['nouveauMetier']['value']))
                {
                    // nouveau metier
                    $nomMetier = mysql_escape_string($tabForm['nouveauMetier']['value']);
                    $sql = "SELECT idMetier FROM metier WHERE nom='".$nomMetier."' LIMIT 1";
                    $rep = $this->connexionBdd->requete($sql);
                    if (mysql_num_rows($rep) === 1)
                    {
                        $res = mysql_fetch_object($rep);
                        $idMetier = $res->idMetier;
                        echo "métier existe";
                    }
                    else
                    {
                        $sql = "INSERT INTO metier (nom) VALUES ('".$nomMetier."')";
                        $this->connexionBdd->requete($sql);
                        $idMetier = mysql_insert_id();
                        echo 'métier existe pas';
                    }
                }
                else if (empty($tabForm['metier']['error']) AND !empty($tabForm['metier']['value']))
                {*/
                    // valeur du select
                    $idMetier      = $tabForm['metier']['value'];
                    //echo 'métier select';
                /*}
                else
                {
                    // choix par défaut
                    $idMetier = 1;
                    echo 'défaut';
                }*/
                $sql ="INSERT INTO personne (prenom,  nom,  dateNaissance,  dateDeces,  description,  idMetier ) VALUES
                    ('".$prenom."', '".$nom."', '".$dateNaissance."', '".$dateDeces."', '".$description."', ".$idMetier.")";


                $this->connexionBdd->requete($sql);

                $newIdPersonne = mysql_insert_id();
            } else {
                $this->erreurs->ajouter($tabForm);
            }
            $this->erreurs->ajouter($tabForm);
        }

        return $newIdPersonne;
    }
894774
function toHtml() {
        global $CFG, $USER, $COURSE, $PAGE, $OUTPUT;
        require_once("$CFG->dirroot/repository/lib.php");

        // security - never ever allow guest/not logged in user to upload anything or use this element!
        if (isguestuser() or !isloggedin()) {
            print_error('noguest');
        }

        if ($this->_flagFrozen) {
            return $this->getFrozenHtml();
        }

        $id          = $this->_attributes['id'];
        $elname      = $this->_attributes['name'];
        $subdirs     = $this->_options['subdirs'];
        $maxbytes    = $this->_options['maxbytes'];
        $draftitemid = $this->getValue();
        $accepted_types = $this->_options['accepted_types'];

        if (empty($draftitemid)) {
            // no existing area info provided - let's use fresh new draft area
            require_once("$CFG->libdir/filelib.php");
            $this->setValue(file_get_unused_draft_itemid());
            $draftitemid = $this->getValue();
        }

        $client_id = uniqid();

        // filemanager options
        $options = new stdClass();
        $options->mainfile  = $this->_options['mainfile'];
        $options->maxbytes  = $this->_options['maxbytes'];
        $options->maxfiles  = $this->getMaxfiles();
        $options->client_id = $client_id;
        $options->itemid    = $draftitemid;
        $options->subdirs   = $this->_options['subdirs'];
        $options->target    = $id;
        $options->accepted_types = $accepted_types;
        $options->return_types = $this->_options['return_types'];
        $options->context = $PAGE->context;
        $options->areamaxbytes = $this->_options['areamaxbytes'];

        $html = $this->_getTabs();
        $fm = new form_filemanager($options);
        $output = $PAGE->get_renderer('core', 'files');
        $html .= $output->render($fm);

        $html .= html_writer::empty_tag('input', array('value' => $draftitemid, 'name' => $elname, 'type' => 'hidden', 'id' => $id));

        if (!empty($options->accepted_types) && $options->accepted_types != '*') {
            $html .= html_writer::tag('p', get_string('filesofthesetypes', 'form'));
            $util = new \core_form\filetypes_util();
            $filetypes = $options->accepted_types;
            $filetypedescriptions = $util->describe_file_types($filetypes);
            $html .= $OUTPUT->render_from_template('core_form/filetypes-descriptions', $filetypedescriptions);
        }

        return $html;
    }
1272708
public function _fadeIn($element='this', $speed='', $callback='', $immediatly=false) {
		$element=$this->_prep_element($element);
		$speed=$this->_validate_speed($speed);

		if ($callback!='') {
			$callback=", function(){\n{$callback}\n}";
		}

		$str="$({$element}).fadeIn({$speed}{$callback});";

		if ($immediatly)
			$this->jquery_code_for_compile[]=$str;
			return $str;
	}
1188127
public function getFieldsValidationActivationJavaScriptCode()
    {
        $javaScriptBlocks = [];
        $formConfiguration = $this->getFormObject()->getConfiguration();

        foreach ($formConfiguration->getFields() as $field) {
            foreach ($field->getValidation() as $validation) {
                $fieldConditionExpression = [];
                $javaScriptTree = $this->getConditionTreeForValidation($validation)->getJavaScriptConditions();

                if (false === empty($javaScriptTree)) {
                    foreach ($javaScriptTree as $node) {
                        $fieldConditionExpression[] = 'flag = flag || (' . $node . ');';
                    }

                    $javaScriptBlocks[] = $this->getSingleFieldActivationConditionFunction($validation, $fieldConditionExpression);
                }
            }
        }

        $javaScriptBlocks = implode(CRLF, $javaScriptBlocks);
        $formName = GeneralUtility::quoteJSvalue($this->getFormObject()->getName());

        return <<<JS
(function() {
    Fz.Form.get(
        $formName,
        function(form) {
            var field = null;

$javaScriptBlocks

            form.refreshAllFields();
        }
    );
})();
JS;
    }
707810
@Override
    public String dialogScriptSubmit() {

        if (useNewStyle()) {
            return super.dialogScriptSubmit();
        }
        StringBuffer result = new StringBuffer(512);
        result.append("function submitAction(actionValue, theForm, formName) {\n");
        result.append("\tif (theForm == null) {\n");
        result.append("\t\ttheForm = document.forms[formName];\n");
        result.append("\t}\n");
        result.append("\ttheForm." + PARAM_FRAMENAME + ".value = window.name;\n");
        result.append("\tif (actionValue == \"" + DIALOG_OK + "\") {\n");
        result.append("\t\treturn true;\n");
        result.append("\t}\n");
        result.append("\ttheForm." + PARAM_ACTION + ".value = actionValue;\n");
        result.append("\ttheForm.submit();\n");
        result.append("\treturn false;\n");
        result.append("}\n");

        return result.toString();
    }
223721
function(data, fm) { 
			var self   = fm ? fm : this,
				input  = data.input? data.input : false,
				files  = !input ? self.uploads.checkFile(data, self) : false,
				dfrd   = $.Deferred()
					.fail(function(error) {
						error && self.error(error);
					}),
				name = 'iframe-'+fm.namespace+(++self.iframeCnt),
				form = $('<form action="'+self.uploadURL+'" method="post" enctype="multipart/form-data" encoding="multipart/form-data" target="'+name+'" style="display:none"><input type="hidden" name="cmd" value="upload" /></form>'),
				msie = this.UA.IE,
				// clear timeouts, close notification dialog, remove form/iframe
				onload = function() {
					abortto  && clearTimeout(abortto);
					notifyto && clearTimeout(notifyto);
					notify   && self.notify({type : 'upload', cnt : -cnt});
					
					setTimeout(function() {
						msie && $('<iframe src="javascript:false;"/>').appendTo(form);
						form.remove();
						iframe.remove();
					}, 100);
				},
				iframe = $('<iframe src="'+(msie ? 'javascript:false;' : 'about:blank')+'" name="'+name+'" style="position:absolute;left:-1000px;top:-1000px" />')
					.on('load', function() {
						iframe.off('load')
							.on('load', function() {
								onload();
								// data will be processed in callback response or window onmessage
								dfrd.resolve();
							});
							
							// notify dialog
							notifyto = setTimeout(function() {
								notify = true;
								self.notify({type : 'upload', cnt : cnt});
							}, self.options.notifyDelay);
							
							// emulate abort on timeout
							if (self.options.iframeTimeout > 0) {
								abortto = setTimeout(function() {
									onload();
									dfrd.reject([errors.connect, errors.timeout]);
								}, self.options.iframeTimeout);
							}
							
							form.submit();
					}),
				target  = (data.target || self.cwd().hash),
				names   = [],
				dfds    = [],
				renames = [],
				hashes  = {},
				cnt, notify, notifyto, abortto;

			if (files && files.length) {
				$.each(files, function(i, val) {
					form.append('<input type="hidden" name="upload[]" value="'+val+'"/>');
				});
				cnt = 1;
			} else if (input && $(input).is(':file') && $(input).val()) {
				if (fm.options.overwriteUploadConfirm && fm.option('uploadOverwrite', target)) {
					names = input.files? input.files : [{ name: $(input).val().replace(/^(?:.+[\\\/])?([^\\\/]+)$/, '$1') }];
					//names = $.map(names, function(file){return file.name? { name: file.name } : null ;});
					dfds.push(self.uploads.checkExists(names, target, self).done(
						function(res, res2){
							hashes = res2;
							if (res === null) {
								data.overwrite = 0;
							} else{
								renames = res;
								cnt = $.grep(names, function(file){return !file._remove? true : false ;}).length;
								if (cnt != names.length) {
									cnt = 0;
								}
							}
						}
					));
				}
				cnt = input.files ? input.files.length : 1;
				form.append(input);
			} else {
				return dfrd.reject();
			}
			
			$.when.apply($, dfds).done(function() {
				if (cnt < 1) {
					return dfrd.reject();
				}
				form.append('<input type="hidden" name="'+(self.newAPI ? 'target' : 'current')+'" value="'+target+'"/>')
					.append('<input type="hidden" name="html" value="1"/>')
					.append('<input type="hidden" name="node" value="'+self.id+'"/>')
					.append($(input).attr('name', 'upload[]'));
				
				if (renames.length > 0) {
					$.each(renames, function(i, rename) {
						form.append('<input type="hidden" name="renames[]" value="'+self.escape(rename)+'"/>');
					});
					form.append('<input type="hidden" name="suffix" value="'+fm.options.backupSuffix+'"/>');
				}
				if (hashes) {
					$.each(renames, function(i, v) {
						form.append('<input type="hidden" name="['+i+']" value="'+self.escape(v)+'"/>');
					});
				}
				
				if (data.overwrite === 0) {
					form.append('<input type="hidden" name="overwrite" value="0"/>');
				}
				
				$.each(self.options.onlyMimes||[], function(i, mime) {
					form.append('<input type="hidden" name="mimes[]" value="'+self.escape(mime)+'"/>');
				});
				
				$.each(self.customData, function(key, val) {
					form.append('<input type="hidden" name="'+key+'" value="'+self.escape(val)+'"/>');
				});
				
				form.appendTo('body');
				iframe.appendTo('body');
			});
			
			return dfrd;
		}
671006
public function getFormInitializationJavaScriptCode()
    {
        $formName = GeneralUtility::quoteJSvalue($this->getFormObject()->getName());
        $formConfigurationJson = $this->handleFormConfiguration($this->getFormConfiguration());

        $javaScriptCode = <<<JS
(function() {
    Fz.Form.register($formName, $formConfigurationJson);
})();
JS;

        return $javaScriptCode;
    }
1129336
public function getJavaScriptCode()
    {
        $fieldsJavaScriptCode = [];
        $formConfiguration = $this->getFormObject()->getConfiguration();

        foreach ($formConfiguration->getFields() as $field) {
            $fieldsJavaScriptCode[] = $this->processField($field);
        }

        $formName = GeneralUtility::quoteJSvalue($this->getFormObject()->getName());
        $fieldsJavaScriptCode = implode(CRLF, $fieldsJavaScriptCode);

        return <<<JS
(function() {
    Fz.Form.get(
        $formName,
        function(form) {
            var field = null;

$fieldsJavaScriptCode
        }
    );
})();
JS;
    }
516192
function toHtml(){
        $html = '';
        if ($this->getMultiple()) {
            // Adding an hidden field forces the browser to send an empty data even though the user did not
            // select any element. This value will be cleaned up in self::exportValue() as it will not be part
            // of the select options.
            $html .= '<input type="hidden" name="'.$this->getName().'" value="_qf__force_multiselect_submission">';
        }
        if ($this->_hiddenLabel){
            $this->_generateId();
            $html .= '<label class="accesshide" for="'.$this->getAttribute('id').'" >'.$this->getLabel().'</label>';
        }
        $html .= parent::toHtml();
        return $html;
    }
58299
public function getPaymorrowJavaScriptPmInitFull()
    {
        $sPmPrintData = $this->_getPaymorrowPrintData();
        $sPmControllerPrepareOrder = $this->getPaymorrowControllerPrepareOrderProcessPaymentURL();
        $sSelectedMethod = $this->getSelectedPaymorrowMethod();
        $sNextButtonId = 'paymentNextStepBottom';

        $sSDD = sprintf(
            'pmInitFull("SDD", "pmsdd", "rb_payment_sdd", "dl_payment_sdd", "payment", %s, "%s", %s, "%s");',
            $sPmPrintData,
            $sPmControllerPrepareOrder,
            ($sSelectedMethod == 'pm_sdd') ? 'true' : 'false',
            $sNextButtonId
        );

        $sInvoice = sprintf(
            'pmInitFull("INVOICE", "pminvoice", "rb_payment_invoice", "dl_payment_invoice", "payment", %s, "%s", %s, "%s");',
            $sPmPrintData,
            $sPmControllerPrepareOrder,
            ($sSelectedMethod == 'pm_invoice') ? 'true' : 'false',
            $sNextButtonId
        );

        return sprintf('$(document).ready(function(){%s%s});', $sSDD, $sInvoice);
    }