mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 17:48:25 +01:00
Clean code
This commit is contained in:
@@ -565,6 +565,7 @@ function hideMessage(fieldId,message) {
|
||||
* @param int userid User id
|
||||
* @param int value Value to set
|
||||
* @param string token Token
|
||||
* @retun boolean
|
||||
*/
|
||||
function setConstant(url, code, input, entity, strict, forcereload, userid, token, value) {
|
||||
var saved_url = url; /* avoid undefined url */
|
||||
@@ -654,20 +655,23 @@ function setConstant(url, code, input, entity, strict, forcereload, userid, toke
|
||||
return false;
|
||||
}
|
||||
}).fail(function(error) { console.log("Error, we force reload"); location.reload(); }); /* When it fails, we always force reload to have setEventErrorMessages in session visible */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Used by button to set on/off
|
||||
* Call url then make complementary action (like show/hide, enable/disable or set another option).
|
||||
*
|
||||
* @param string url Url (warning: as any url called in ajax mode, the url called here must not renew the token)
|
||||
* @param string code Code
|
||||
* @param string intput Array of complementary actions to do if success
|
||||
* @param int entity Entity
|
||||
* @param int strict Strict
|
||||
* @param int forcereload Force reload
|
||||
* @param int userid User id
|
||||
* @param string token Token
|
||||
* @param {string} url Url (warning: as any url called in ajax mode, the url called here must not renew the token)
|
||||
* @param {string} code Code
|
||||
* @param {string} intput Array of complementary actions to do if success
|
||||
* @param {int} entity Entity
|
||||
* @param {int} strict Strict
|
||||
* @param {int} forcereload Force reload
|
||||
* @param {int} userid User id
|
||||
* @param {string} token Token
|
||||
* @return boolean
|
||||
*/
|
||||
function delConstant(url, code, input, entity, strict, forcereload, userid, token) {
|
||||
var saved_url = url; /* avoid undefined url */
|
||||
@@ -747,6 +751,8 @@ function delConstant(url, code, input, entity, strict, forcereload, userid, toke
|
||||
return false;
|
||||
}
|
||||
}).fail(function(error) { console.log("Error, we force reload"); location.reload(); }); /* When it fails, we always force reload to have setEventErrorMessages in session visible */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -764,6 +770,7 @@ function delConstant(url, code, input, entity, strict, forcereload, userid, toke
|
||||
* @param int strict Strict
|
||||
* @param int userid User id
|
||||
* @param string token Token
|
||||
* @return boolean
|
||||
*/
|
||||
function confirmConstantAction(action, url, code, input, box, entity, yesButton, noButton, strict, userid, token) {
|
||||
var boxConfirm = box;
|
||||
@@ -809,6 +816,8 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton,
|
||||
if (boxConfirm.info) {
|
||||
$("#noButton_" + code).button().hide();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -931,8 +940,8 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton,
|
||||
/**
|
||||
* Function to output a dialog box for copy/paste
|
||||
*
|
||||
* @param string text Text to put into copy/paste area
|
||||
* @param string text2 Text to put under the copy/paste area
|
||||
* @param text Text to put into copy/paste area
|
||||
* @param text2 Text to put under the copy/paste area
|
||||
*/
|
||||
function copyToClipboard(text,text2)
|
||||
{
|
||||
@@ -942,6 +951,7 @@ function copyToClipboard(text,text2)
|
||||
$("#dialogforpopup").html(newElem);
|
||||
$("#dialogforpopup").dialog();
|
||||
$("#coordsforpopup").select();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -949,9 +959,9 @@ function copyToClipboard(text,text2)
|
||||
/**
|
||||
* Show a popup HTML page. Use the "window.open" function.
|
||||
*
|
||||
* @param string url Url
|
||||
* @param string title Title of popup
|
||||
* @return boolean False
|
||||
* @param url Url
|
||||
* @param title Title of popup
|
||||
* @return boolean False
|
||||
* @see document_preview
|
||||
*/
|
||||
function newpopup(url, title) {
|
||||
@@ -965,6 +975,7 @@ function newpopup(url, title) {
|
||||
var top = (screen.height - h)/2;
|
||||
var wfeatures = "directories=0,menubar=0,status=0,resizable=0,scrollbars=1,toolbar=0,width=" + l +",height=" + h + ",left=" + left + ",top=" + top;
|
||||
fen=window.open(tmp,title,wfeatures);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -972,9 +983,9 @@ function newpopup(url, title) {
|
||||
* Function show document preview. It uses the "dialog" function.
|
||||
* The a tag around the img must have the src='', class='documentpreview', mime='image/xxx', target='_blank' from getAdvancedPreviewUrl().
|
||||
*
|
||||
* @param string file Url
|
||||
* @param string type Mime file type ("image/jpeg", "application/pdf", "text/html")
|
||||
* @param string title Title of popup
|
||||
* @param file Url
|
||||
* @param type Mime file type ("image/jpeg", "application/pdf", "text/html")
|
||||
* @param title Title of popup
|
||||
* @return void
|
||||
* @see newpopup
|
||||
*/
|
||||
@@ -1064,9 +1075,9 @@ function document_preview(file, type, title)
|
||||
/*
|
||||
* Provide a function to get an URL GET parameter in javascript
|
||||
*
|
||||
* @param string name Name of parameter
|
||||
* @param mixed valueifnotfound Value if not found
|
||||
* @return string Value
|
||||
* @param name Name of parameter
|
||||
* @param valueifnotfound Value if not found
|
||||
* @return string Value
|
||||
*/
|
||||
function getParameterByName(name, valueifnotfound)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user