Passed
Push — master ( 49af33...3cffbe )
by Alxarafe
21:21
created
dolibarr/htdocs/core/ajax/row.php 3 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -43,34 +43,34 @@
 block discarded – undo
43 43
 
44 44
 // Registering the location of boxes
45 45
 if ((! empty($_POST['roworder'])) && (! empty($_POST['table_element_line']))
46
-	&& (! empty($_POST['fk_element'])) && (! empty($_POST['element_id'])))
46
+    && (! empty($_POST['fk_element'])) && (! empty($_POST['element_id'])))
47 47
 {
48
-	$roworder=GETPOST('roworder','alpha',2);
49
-	$table_element_line=GETPOST('table_element_line','alpha',2);
50
-	$fk_element=GETPOST('fk_element','alpha',2);
51
-	$element_id=GETPOST('element_id','int',2);
48
+    $roworder=GETPOST('roworder','alpha',2);
49
+    $table_element_line=GETPOST('table_element_line','alpha',2);
50
+    $fk_element=GETPOST('fk_element','alpha',2);
51
+    $element_id=GETPOST('element_id','int',2);
52 52
 
53
-	dol_syslog("AjaxRow roworder=".$roworder." table_element_line=".$table_element_line." fk_element=".$fk_element." element_id=".$element_id, LOG_DEBUG);
53
+    dol_syslog("AjaxRow roworder=".$roworder." table_element_line=".$table_element_line." fk_element=".$fk_element." element_id=".$element_id, LOG_DEBUG);
54 54
 
55
-	$rowordertab = explode(',',$roworder);
56
-	$newrowordertab = array();
57
-	foreach($rowordertab as $value)
58
-	{
59
-		if (! empty($value)) $newrowordertab[] = $value;
60
-	}
55
+    $rowordertab = explode(',',$roworder);
56
+    $newrowordertab = array();
57
+    foreach($rowordertab as $value)
58
+    {
59
+        if (! empty($value)) $newrowordertab[] = $value;
60
+    }
61 61
 
62
-	$row=new GenericObject($db);
63
-	$row->table_element_line = $table_element_line;
64
-	$row->fk_element = $fk_element;
65
-	$row->id = $element_id;
62
+    $row=new GenericObject($db);
63
+    $row->table_element_line = $table_element_line;
64
+    $row->fk_element = $fk_element;
65
+    $row->id = $element_id;
66 66
 
67
-	$row->line_ajaxorder($newrowordertab);		// This update field rank or position in table row->table_element_line
67
+    $row->line_ajaxorder($newrowordertab);		// This update field rank or position in table row->table_element_line
68 68
 
69
-	// Reorder line to have position of children lines sharing same counter than parent lines
70
-	// This should be useless because there is no need to have children sharing same counter than parent, but well, it's cleaner into database.
71
-	if (in_array($fk_element,array('fk_facture','fk_propal','fk_commande')))
72
-	{
73
-		$result=$row->line_order(true);
74
-	}
69
+    // Reorder line to have position of children lines sharing same counter than parent lines
70
+    // This should be useless because there is no need to have children sharing same counter than parent, but well, it's cleaner into database.
71
+    if (in_array($fk_element,array('fk_facture','fk_propal','fk_commande')))
72
+    {
73
+        $result=$row->line_order(true);
74
+    }
75 75
 }
76 76
 
Please login to merge, or discard this patch.
Braces   +22 added lines, -7 removed lines patch added patch discarded remove patch
@@ -22,12 +22,25 @@  discard block
 block discarded – undo
22 22
  *                   This ajax page is called when doing an up or down drag and drop.
23 23
  */
24 24
 
25
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disable token renewal
26
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU','1');
27
-if (! defined('NOREQUIREHTML'))  define('NOREQUIREHTML','1');
28
-if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX','1');
29
-if (! defined('NOREQUIRESOC'))   define('NOREQUIRESOC','1');
30
-if (! defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN','1');
25
+if (! defined('NOTOKENRENEWAL')) {
26
+    define('NOTOKENRENEWAL','1');
27
+}
28
+// Disable token renewal
29
+if (! defined('NOREQUIREMENU')) {
30
+    define('NOREQUIREMENU','1');
31
+}
32
+if (! defined('NOREQUIREHTML')) {
33
+    define('NOREQUIREHTML','1');
34
+}
35
+if (! defined('NOREQUIREAJAX')) {
36
+    define('NOREQUIREAJAX','1');
37
+}
38
+if (! defined('NOREQUIRESOC')) {
39
+    define('NOREQUIRESOC','1');
40
+}
41
+if (! defined('NOREQUIRETRAN')) {
42
+    define('NOREQUIRETRAN','1');
43
+}
31 44
 
32 45
 
33 46
 // Copyright (C) 2018 Alxarafe/Alixar  <[email protected]>
@@ -59,7 +72,9 @@  discard block
 block discarded – undo
59 72
 	$newrowordertab = array();
60 73
 	foreach($rowordertab as $value)
61 74
 	{
62
-		if (! empty($value)) $newrowordertab[] = $value;
75
+		if (! empty($value)) {
76
+		    $newrowordertab[] = $value;
77
+		}
63 78
 	}
64 79
 
65 80
 	$row=new GenericObject($db);
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@  discard block
 block discarded – undo
22 22
  *                   This ajax page is called when doing an up or down drag and drop.
23 23
  */
24 24
 
25
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disable token renewal
26
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU','1');
27
-if (! defined('NOREQUIREHTML'))  define('NOREQUIREHTML','1');
28
-if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX','1');
29
-if (! defined('NOREQUIRESOC'))   define('NOREQUIRESOC','1');
30
-if (! defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN','1');
25
+if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disable token renewal
26
+if (!defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1');
27
+if (!defined('NOREQUIREHTML'))  define('NOREQUIREHTML', '1');
28
+if (!defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX', '1');
29
+if (!defined('NOREQUIRESOC'))   define('NOREQUIRESOC', '1');
30
+if (!defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN', '1');
31 31
 
32 32
 
33 33
 // Copyright (C) 2018 Alxarafe/Alixar  <[email protected]>
34 34
 defined('BASE_PATH') or die('Single entry point through the index.php of the main folder');
35
-require DOL_BASE_PATH . '/main.inc.php';
35
+require DOL_BASE_PATH.'/main.inc.php';
36 36
 require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
37 37
 
38 38
 
@@ -45,35 +45,35 @@  discard block
 block discarded – undo
45 45
 print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
46 46
 
47 47
 // Registering the location of boxes
48
-if ((! empty($_POST['roworder'])) && (! empty($_POST['table_element_line']))
49
-	&& (! empty($_POST['fk_element'])) && (! empty($_POST['element_id'])))
48
+if ((!empty($_POST['roworder'])) && (!empty($_POST['table_element_line']))
49
+	&& (!empty($_POST['fk_element'])) && (!empty($_POST['element_id'])))
50 50
 {
51
-	$roworder=GETPOST('roworder','alpha',2);
52
-	$table_element_line=GETPOST('table_element_line','alpha',2);
53
-	$fk_element=GETPOST('fk_element','alpha',2);
54
-	$element_id=GETPOST('element_id','int',2);
51
+	$roworder = GETPOST('roworder', 'alpha', 2);
52
+	$table_element_line = GETPOST('table_element_line', 'alpha', 2);
53
+	$fk_element = GETPOST('fk_element', 'alpha', 2);
54
+	$element_id = GETPOST('element_id', 'int', 2);
55 55
 
56 56
 	dol_syslog("AjaxRow roworder=".$roworder." table_element_line=".$table_element_line." fk_element=".$fk_element." element_id=".$element_id, LOG_DEBUG);
57 57
 
58
-	$rowordertab = explode(',',$roworder);
58
+	$rowordertab = explode(',', $roworder);
59 59
 	$newrowordertab = array();
60
-	foreach($rowordertab as $value)
60
+	foreach ($rowordertab as $value)
61 61
 	{
62
-		if (! empty($value)) $newrowordertab[] = $value;
62
+		if (!empty($value)) $newrowordertab[] = $value;
63 63
 	}
64 64
 
65
-	$row=new GenericObject($db);
65
+	$row = new GenericObject($db);
66 66
 	$row->table_element_line = $table_element_line;
67 67
 	$row->fk_element = $fk_element;
68 68
 	$row->id = $element_id;
69 69
 
70
-	$row->line_ajaxorder($newrowordertab);		// This update field rank or position in table row->table_element_line
70
+	$row->line_ajaxorder($newrowordertab); // This update field rank or position in table row->table_element_line
71 71
 
72 72
 	// Reorder line to have position of children lines sharing same counter than parent lines
73 73
 	// This should be useless because there is no need to have children sharing same counter than parent, but well, it's cleaner into database.
74
-	if (in_array($fk_element,array('fk_facture','fk_propal','fk_commande')))
74
+	if (in_array($fk_element, array('fk_facture', 'fk_propal', 'fk_commande')))
75 75
 	{
76
-		$result=$row->line_order(true);
76
+		$result = $row->line_order(true);
77 77
 	}
78 78
 }
79 79
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/ajax/security.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -42,11 +42,11 @@
 block discarded – undo
42 42
 // Registering the location of boxes
43 43
 if (isset($_GET['action']) && ! empty($_GET['action']))
44 44
 {
45
-	if ($_GET['action'] == 'getrandompassword' && $user->admin)
46
-	{
45
+    if ($_GET['action'] == 'getrandompassword' && $user->admin)
46
+    {
47 47
         require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
48
-	    $generic = $_GET['generic'] ? true : false;
49
-		echo getRandomPassword($generic);
50
-	}
48
+        $generic = $_GET['generic'] ? true : false;
49
+        echo getRandomPassword($generic);
50
+    }
51 51
 }
52 52
 
Please login to merge, or discard this patch.
Braces   +19 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,12 +21,25 @@
 block discarded – undo
21 21
  *                   like key to use into URL to protect them.
22 22
  */
23 23
 
24
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
25
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU','1');
26
-if (! defined('NOREQUIREHTML'))  define('NOREQUIREHTML','1');
27
-if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX','1');
28
-if (! defined('NOREQUIRESOC'))   define('NOREQUIRESOC','1');
29
-if (! defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN','1');
24
+if (! defined('NOTOKENRENEWAL')) {
25
+    define('NOTOKENRENEWAL','1');
26
+}
27
+// Disables token renewal
28
+if (! defined('NOREQUIREMENU')) {
29
+    define('NOREQUIREMENU','1');
30
+}
31
+if (! defined('NOREQUIREHTML')) {
32
+    define('NOREQUIREHTML','1');
33
+}
34
+if (! defined('NOREQUIREAJAX')) {
35
+    define('NOREQUIREAJAX','1');
36
+}
37
+if (! defined('NOREQUIRESOC')) {
38
+    define('NOREQUIRESOC','1');
39
+}
40
+if (! defined('NOREQUIRETRAN')) {
41
+    define('NOREQUIRETRAN','1');
42
+}
30 43
 
31 44
 
32 45
 // Copyright (C) 2018 Alxarafe/Alixar  <[email protected]>
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,17 +21,17 @@  discard block
 block discarded – undo
21 21
  *                   like key to use into URL to protect them.
22 22
  */
23 23
 
24
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
25
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU','1');
26
-if (! defined('NOREQUIREHTML'))  define('NOREQUIREHTML','1');
27
-if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX','1');
28
-if (! defined('NOREQUIRESOC'))   define('NOREQUIRESOC','1');
29
-if (! defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN','1');
24
+if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal
25
+if (!defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1');
26
+if (!defined('NOREQUIREHTML'))  define('NOREQUIREHTML', '1');
27
+if (!defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX', '1');
28
+if (!defined('NOREQUIRESOC'))   define('NOREQUIRESOC', '1');
29
+if (!defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN', '1');
30 30
 
31 31
 
32 32
 // Copyright (C) 2018 Alxarafe/Alixar  <[email protected]>
33 33
 defined('BASE_PATH') or die('Single entry point through the index.php of the main folder');
34
-require DOL_BASE_PATH . '/main.inc.php';
34
+require DOL_BASE_PATH.'/main.inc.php';
35 35
 
36 36
 /*
37 37
  * View
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 //print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
44 44
 
45 45
 // Registering the location of boxes
46
-if (isset($_GET['action']) && ! empty($_GET['action']))
46
+if (isset($_GET['action']) && !empty($_GET['action']))
47 47
 {
48 48
 	if ($_GET['action'] == 'getrandompassword' && $user->admin)
49 49
 	{
Please login to merge, or discard this patch.
dolibarr/htdocs/core/ajax/selectsearchbox.php 3 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
     $res=@include '../../main.inc.php';
36 36
     if ($res == 'ERROR_NOT_LOGGED')
37 37
     {
38
-    	$langs->load("other");
39
-    	$arrayresult['jumptologin']=array('img'=>'object_generic', 'label'=>$langs->trans("JumpToLogin"), 'text'=>'<span class="fa fa-sign-in"></span> '.$langs->trans("JumpToLogin"), 'url'=>DOL_URL_ROOT.'/index.php');
40
-    	print json_encode($arrayresult);
41
-    	if (is_object($db)) $db->close();
42
-    	exit;
38
+        $langs->load("other");
39
+        $arrayresult['jumptologin']=array('img'=>'object_generic', 'label'=>$langs->trans("JumpToLogin"), 'text'=>'<span class="fa fa-sign-in"></span> '.$langs->trans("JumpToLogin"), 'url'=>DOL_URL_ROOT.'/index.php');
40
+        print json_encode($arrayresult);
41
+        if (is_object($db)) $db->close();
42
+        exit;
43 43
     }
44 44
 }
45 45
 
@@ -56,85 +56,85 @@  discard block
 block discarded – undo
56 56
 
57 57
 if (! empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->rights->adherent->lire)
58 58
 {
59
-	$arrayresult['searchintomember']=array('position'=>8, 'shortcut'=>'M', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
59
+    $arrayresult['searchintomember']=array('position'=>8, 'shortcut'=>'M', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
60 60
 }
61 61
 
62 62
 if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && empty($conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED) && $user->rights->societe->lire)
63 63
 {
64
-	$arrayresult['searchintothirdparty']=array('position'=>10, 'shortcut'=>'T', 'img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('','object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
64
+    $arrayresult['searchintothirdparty']=array('position'=>10, 'shortcut'=>'T', 'img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('','object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
65 65
 }
66 66
 
67 67
 if (! empty($conf->societe->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED) && $user->rights->societe->lire)
68 68
 {
69
-	$arrayresult['searchintocontact']=array('position'=>15, 'shortcut'=>'A', 'img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('','object_contact').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
69
+    $arrayresult['searchintocontact']=array('position'=>15, 'shortcut'=>'A', 'img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('','object_contact').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
70 70
 }
71 71
 
72 72
 if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire))
73 73
 && empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_DISABLED))
74 74
 {
75
-	$arrayresult['searchintoproduct']=array('position'=>30, 'shortcut'=>'P', 'img'=>'object_product', 'label'=>$langs->trans("SearchIntoProductsOrServices", $search_boxvalue),'text'=>img_picto('','object_product').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
75
+    $arrayresult['searchintoproduct']=array('position'=>30, 'shortcut'=>'P', 'img'=>'object_product', 'label'=>$langs->trans("SearchIntoProductsOrServices", $search_boxvalue),'text'=>img_picto('','object_product').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
76 76
 }
77 77
 
78 78
 if (! empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_PROJECT_DISABLED) && $user->rights->projet->lire)
79 79
 {
80
-	$arrayresult['searchintoprojects']=array('position'=>40, 'shortcut'=>'Q', 'img'=>'object_projectpub', 'label'=>$langs->trans("SearchIntoProjects", $search_boxvalue), 'text'=>img_picto('','object_projectpub').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php'.($search_boxvalue?'?search_all='.urlencode($search_boxvalue):''));
80
+    $arrayresult['searchintoprojects']=array('position'=>40, 'shortcut'=>'Q', 'img'=>'object_projectpub', 'label'=>$langs->trans("SearchIntoProjects", $search_boxvalue), 'text'=>img_picto('','object_projectpub').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php'.($search_boxvalue?'?search_all='.urlencode($search_boxvalue):''));
81 81
 }
82 82
 if (! empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_TASK_DISABLED) && $user->rights->projet->lire)
83 83
 {
84
-	$arrayresult['searchintotasks']=array('position'=>45, 'img'=>'object_task', 'label'=>$langs->trans("SearchIntoTasks", $search_boxvalue), 'text'=>img_picto('','object_task').' '.$langs->trans("SearchIntoTasks", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/tasks/list.php'.($search_boxvalue?'?search_all='.urlencode($search_boxvalue):''));
84
+    $arrayresult['searchintotasks']=array('position'=>45, 'img'=>'object_task', 'label'=>$langs->trans("SearchIntoTasks", $search_boxvalue), 'text'=>img_picto('','object_task').' '.$langs->trans("SearchIntoTasks", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/tasks/list.php'.($search_boxvalue?'?search_all='.urlencode($search_boxvalue):''));
85 85
 }
86 86
 
87 87
 if (! empty($conf->propal->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_PROPAL_DISABLED) && $user->rights->propal->lire)
88 88
 {
89
-	$arrayresult['searchintopropal']=array('position'=>60, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/comm/propal/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
89
+    $arrayresult['searchintopropal']=array('position'=>60, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/comm/propal/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
90 90
 }
91 91
 if (! empty($conf->commande->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_ORDER_DISABLED) && $user->rights->commande->lire)
92 92
 {
93
-	$arrayresult['searchintoorder']=array('position'=>70, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/commande/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
93
+    $arrayresult['searchintoorder']=array('position'=>70, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/commande/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
94 94
 }
95 95
 if (! empty($conf->expedition->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_SHIPMENT_DISABLED) && $user->rights->expedition->lire)
96 96
 {
97
-	$arrayresult['searchintoshipment']=array('position'=>80, 'img'=>'object_sending', 'label'=>$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'text'=>img_picto('','object_sending').' '.$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expedition/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
97
+    $arrayresult['searchintoshipment']=array('position'=>80, 'img'=>'object_sending', 'label'=>$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'text'=>img_picto('','object_sending').' '.$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expedition/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
98 98
 }
99 99
 if (! empty($conf->facture->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED) && $user->rights->facture->lire)
100 100
 {
101
-	$arrayresult['searchintoinvoice']=array('position'=>90, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
101
+    $arrayresult['searchintoinvoice']=array('position'=>90, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
102 102
 }
103 103
 
104 104
 if (! empty($conf->supplier_proposal->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_PROPAL_DISABLED) && $user->rights->supplier_proposal->lire)
105 105
 {
106
-	$arrayresult['searchintosupplierpropal']=array('position'=>100, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
106
+    $arrayresult['searchintosupplierpropal']=array('position'=>100, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
107 107
 }
108 108
 if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_ORDER_DISABLED) && $user->rights->fournisseur->commande->lire)
109 109
 {
110
-	$arrayresult['searchintosupplierorder']=array('position'=>110, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php'.($search_boxvalue?'?search_all='.urlencode($search_boxvalue):''));
110
+    $arrayresult['searchintosupplierorder']=array('position'=>110, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php'.($search_boxvalue?'?search_all='.urlencode($search_boxvalue):''));
111 111
 }
112 112
 if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED) && $user->rights->fournisseur->facture->lire)
113 113
 {
114
-	$arrayresult['searchintosupplierinvoice']=array('position'=>120, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
114
+    $arrayresult['searchintosupplierinvoice']=array('position'=>120, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
115 115
 }
116 116
 
117 117
 if (! empty($conf->contrat->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTRACT_DISABLED) && $user->rights->contrat->lire)
118 118
 {
119
-	$arrayresult['searchintocontract']=array('position'=>130, 'img'=>'object_contract', 'label'=>$langs->trans("SearchIntoContracts", $search_boxvalue), 'text'=>img_picto('','object_contract').' '.$langs->trans("SearchIntoContracts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contrat/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
119
+    $arrayresult['searchintocontract']=array('position'=>130, 'img'=>'object_contract', 'label'=>$langs->trans("SearchIntoContracts", $search_boxvalue), 'text'=>img_picto('','object_contract').' '.$langs->trans("SearchIntoContracts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contrat/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
120 120
 }
121 121
 if (! empty($conf->ficheinter->enabled) && empty($conf->global->MAIN_SEARCHFORM_FICHINTER_DISABLED) && $user->rights->ficheinter->lire)
122 122
 {
123
-	$arrayresult['searchintointervention']=array('position'=>140, 'img'=>'object_intervention', 'label'=>$langs->trans("SearchIntoInterventions", $search_boxvalue), 'text'=>img_picto('','object_intervention').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
123
+    $arrayresult['searchintointervention']=array('position'=>140, 'img'=>'object_intervention', 'label'=>$langs->trans("SearchIntoInterventions", $search_boxvalue), 'text'=>img_picto('','object_intervention').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
124 124
 }
125 125
 
126 126
 // HR
127 127
 if (! empty($conf->user->enabled) && empty($conf->global->MAIN_SEARCHFORM_USER_DISABLED) && $user->rights->user->user->lire)
128 128
 {
129
-	$arrayresult['searchintouser']=array('position'=>200, 'shortcut'=>'U', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoUsers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
129
+    $arrayresult['searchintouser']=array('position'=>200, 'shortcut'=>'U', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoUsers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
130 130
 }
131 131
 if (! empty($conf->expensereport->enabled) && empty($conf->global->MAIN_SEARCHFORM_EXPENSEREPORT_DISABLED) && $user->rights->expensereport->lire)
132 132
 {
133
-	$arrayresult['searchintoexpensereport']=array('position'=>210, 'img'=>'object_trip', 'label'=>$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'text'=>img_picto('','object_trip').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm'.($search_boxvalue?'&sall='.urlencode($search_boxvalue):''));
133
+    $arrayresult['searchintoexpensereport']=array('position'=>210, 'img'=>'object_trip', 'label'=>$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'text'=>img_picto('','object_trip').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm'.($search_boxvalue?'&sall='.urlencode($search_boxvalue):''));
134 134
 }
135 135
 if (! empty($conf->holiday->enabled) && empty($conf->global->MAIN_SEARCHFORM_HOLIDAY_DISABLED) && $user->rights->holiday->read)
136 136
 {
137
-	$arrayresult['searchintoleaves']=array('position'=>220, 'img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('','object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm'.($search_boxvalue?'&sall='.urlencode($search_boxvalue):''));
137
+    $arrayresult['searchintoleaves']=array('position'=>220, 'img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('','object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm'.($search_boxvalue?'&sall='.urlencode($search_boxvalue):''));
138 138
 }
139 139
 
140 140
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 $reshook=$hookmanager->executeHooks('addSearchEntry',$parameters);
152 152
 if (empty($reshook))
153 153
 {
154
-	$arrayresult=array_merge($arrayresult, $hookmanager->resArray);
154
+    $arrayresult=array_merge($arrayresult, $hookmanager->resArray);
155 155
 }
156 156
 else $arrayresult=$hookmanager->resArray;
157 157
 
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -24,19 +24,19 @@  discard block
 block discarded – undo
24 24
 
25 25
 // This script is called with a POST method or as an include.
26 26
 
27
-if (! isset($usedbyinclude) || empty($usedbyinclude))
27
+if (!isset($usedbyinclude) || empty($usedbyinclude))
28 28
 {
29
-    if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); // Disables token renewal
30
-    if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU','1');
31
-    if (! defined('NOREQUIREHTML'))  define('NOREQUIREHTML','1');
32
-    if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX','1');
33
-    if (! defined('NOREDIRECTBYMAINTOLOGIN')) define('NOREDIRECTBYMAINTOLOGIN','1');
29
+    if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables token renewal
30
+    if (!defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1');
31
+    if (!defined('NOREQUIREHTML'))  define('NOREQUIREHTML', '1');
32
+    if (!defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX', '1');
33
+    if (!defined('NOREDIRECTBYMAINTOLOGIN')) define('NOREDIRECTBYMAINTOLOGIN', '1');
34 34
 
35
-    $res=@include '../../main.inc.php';
35
+    $res = @include '../../main.inc.php';
36 36
     if ($res == 'ERROR_NOT_LOGGED')
37 37
     {
38 38
     	$langs->load("other");
39
-    	$arrayresult['jumptologin']=array('img'=>'object_generic', 'label'=>$langs->trans("JumpToLogin"), 'text'=>'<span class="fa fa-sign-in"></span> '.$langs->trans("JumpToLogin"), 'url'=>DOL_URL_ROOT.'/index.php');
39
+    	$arrayresult['jumptologin'] = array('img'=>'object_generic', 'label'=>$langs->trans("JumpToLogin"), 'text'=>'<span class="fa fa-sign-in"></span> '.$langs->trans("JumpToLogin"), 'url'=>DOL_URL_ROOT.'/index.php');
40 40
     	print json_encode($arrayresult);
41 41
     	if (is_object($db)) $db->close();
42 42
     	exit;
@@ -48,93 +48,93 @@  discard block
 block discarded – undo
48 48
 //global $hookmanager;
49 49
 $hookmanager->initHooks(array('searchform'));
50 50
 
51
-$search_boxvalue=GETPOST('q', 'none');
51
+$search_boxvalue = GETPOST('q', 'none');
52 52
 
53
-$arrayresult=array();
53
+$arrayresult = array();
54 54
 
55 55
 // Define $searchform
56 56
 
57
-if (! empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->rights->adherent->lire)
57
+if (!empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->rights->adherent->lire)
58 58
 {
59
-	$arrayresult['searchintomember']=array('position'=>8, 'shortcut'=>'M', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
59
+	$arrayresult['searchintomember'] = array('position'=>8, 'shortcut'=>'M', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('', 'object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
60 60
 }
61 61
 
62
-if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && empty($conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED) && $user->rights->societe->lire)
62
+if (((!empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || !empty($conf->fournisseur->enabled)) && empty($conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED) && $user->rights->societe->lire)
63 63
 {
64
-	$arrayresult['searchintothirdparty']=array('position'=>10, 'shortcut'=>'T', 'img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('','object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
64
+	$arrayresult['searchintothirdparty'] = array('position'=>10, 'shortcut'=>'T', 'img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('', 'object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
65 65
 }
66 66
 
67
-if (! empty($conf->societe->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED) && $user->rights->societe->lire)
67
+if (!empty($conf->societe->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED) && $user->rights->societe->lire)
68 68
 {
69
-	$arrayresult['searchintocontact']=array('position'=>15, 'shortcut'=>'A', 'img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('','object_contact').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
69
+	$arrayresult['searchintocontact'] = array('position'=>15, 'shortcut'=>'A', 'img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('', 'object_contact').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
70 70
 }
71 71
 
72
-if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire))
72
+if (((!empty($conf->product->enabled) && $user->rights->produit->lire) || (!empty($conf->service->enabled) && $user->rights->service->lire))
73 73
 && empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_DISABLED))
74 74
 {
75
-	$arrayresult['searchintoproduct']=array('position'=>30, 'shortcut'=>'P', 'img'=>'object_product', 'label'=>$langs->trans("SearchIntoProductsOrServices", $search_boxvalue),'text'=>img_picto('','object_product').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
75
+	$arrayresult['searchintoproduct'] = array('position'=>30, 'shortcut'=>'P', 'img'=>'object_product', 'label'=>$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'text'=>img_picto('', 'object_product').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
76 76
 }
77 77
 
78
-if (! empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_PROJECT_DISABLED) && $user->rights->projet->lire)
78
+if (!empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_PROJECT_DISABLED) && $user->rights->projet->lire)
79 79
 {
80
-	$arrayresult['searchintoprojects']=array('position'=>40, 'shortcut'=>'Q', 'img'=>'object_projectpub', 'label'=>$langs->trans("SearchIntoProjects", $search_boxvalue), 'text'=>img_picto('','object_projectpub').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php'.($search_boxvalue?'?search_all='.urlencode($search_boxvalue):''));
80
+	$arrayresult['searchintoprojects'] = array('position'=>40, 'shortcut'=>'Q', 'img'=>'object_projectpub', 'label'=>$langs->trans("SearchIntoProjects", $search_boxvalue), 'text'=>img_picto('', 'object_projectpub').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
81 81
 }
82
-if (! empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_TASK_DISABLED) && $user->rights->projet->lire)
82
+if (!empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_TASK_DISABLED) && $user->rights->projet->lire)
83 83
 {
84
-	$arrayresult['searchintotasks']=array('position'=>45, 'img'=>'object_task', 'label'=>$langs->trans("SearchIntoTasks", $search_boxvalue), 'text'=>img_picto('','object_task').' '.$langs->trans("SearchIntoTasks", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/tasks/list.php'.($search_boxvalue?'?search_all='.urlencode($search_boxvalue):''));
84
+	$arrayresult['searchintotasks'] = array('position'=>45, 'img'=>'object_task', 'label'=>$langs->trans("SearchIntoTasks", $search_boxvalue), 'text'=>img_picto('', 'object_task').' '.$langs->trans("SearchIntoTasks", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/tasks/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
85 85
 }
86 86
 
87
-if (! empty($conf->propal->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_PROPAL_DISABLED) && $user->rights->propal->lire)
87
+if (!empty($conf->propal->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_PROPAL_DISABLED) && $user->rights->propal->lire)
88 88
 {
89
-	$arrayresult['searchintopropal']=array('position'=>60, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/comm/propal/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
89
+	$arrayresult['searchintopropal'] = array('position'=>60, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'text'=>img_picto('', 'object_propal').' '.$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/comm/propal/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
90 90
 }
91
-if (! empty($conf->commande->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_ORDER_DISABLED) && $user->rights->commande->lire)
91
+if (!empty($conf->commande->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_ORDER_DISABLED) && $user->rights->commande->lire)
92 92
 {
93
-	$arrayresult['searchintoorder']=array('position'=>70, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/commande/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
93
+	$arrayresult['searchintoorder'] = array('position'=>70, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'text'=>img_picto('', 'object_order').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/commande/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
94 94
 }
95
-if (! empty($conf->expedition->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_SHIPMENT_DISABLED) && $user->rights->expedition->lire)
95
+if (!empty($conf->expedition->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_SHIPMENT_DISABLED) && $user->rights->expedition->lire)
96 96
 {
97
-	$arrayresult['searchintoshipment']=array('position'=>80, 'img'=>'object_sending', 'label'=>$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'text'=>img_picto('','object_sending').' '.$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expedition/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
97
+	$arrayresult['searchintoshipment'] = array('position'=>80, 'img'=>'object_sending', 'label'=>$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'text'=>img_picto('', 'object_sending').' '.$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expedition/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
98 98
 }
99
-if (! empty($conf->facture->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED) && $user->rights->facture->lire)
99
+if (!empty($conf->facture->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED) && $user->rights->facture->lire)
100 100
 {
101
-	$arrayresult['searchintoinvoice']=array('position'=>90, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
101
+	$arrayresult['searchintoinvoice'] = array('position'=>90, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_bill').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
102 102
 }
103 103
 
104
-if (! empty($conf->supplier_proposal->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_PROPAL_DISABLED) && $user->rights->supplier_proposal->lire)
104
+if (!empty($conf->supplier_proposal->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_PROPAL_DISABLED) && $user->rights->supplier_proposal->lire)
105 105
 {
106
-	$arrayresult['searchintosupplierpropal']=array('position'=>100, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('','object_propal').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
106
+	$arrayresult['searchintosupplierpropal'] = array('position'=>100, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('', 'object_propal').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
107 107
 }
108
-if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_ORDER_DISABLED) && $user->rights->fournisseur->commande->lire)
108
+if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_ORDER_DISABLED) && $user->rights->fournisseur->commande->lire)
109 109
 {
110
-	$arrayresult['searchintosupplierorder']=array('position'=>110, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('','object_order').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php'.($search_boxvalue?'?search_all='.urlencode($search_boxvalue):''));
110
+	$arrayresult['searchintosupplierorder'] = array('position'=>110, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('', 'object_order').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
111 111
 }
112
-if (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED) && $user->rights->fournisseur->facture->lire)
112
+if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED) && $user->rights->fournisseur->facture->lire)
113 113
 {
114
-	$arrayresult['searchintosupplierinvoice']=array('position'=>120, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('','object_bill').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
114
+	$arrayresult['searchintosupplierinvoice'] = array('position'=>120, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_bill').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
115 115
 }
116 116
 
117
-if (! empty($conf->contrat->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTRACT_DISABLED) && $user->rights->contrat->lire)
117
+if (!empty($conf->contrat->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTRACT_DISABLED) && $user->rights->contrat->lire)
118 118
 {
119
-	$arrayresult['searchintocontract']=array('position'=>130, 'img'=>'object_contract', 'label'=>$langs->trans("SearchIntoContracts", $search_boxvalue), 'text'=>img_picto('','object_contract').' '.$langs->trans("SearchIntoContracts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contrat/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
119
+	$arrayresult['searchintocontract'] = array('position'=>130, 'img'=>'object_contract', 'label'=>$langs->trans("SearchIntoContracts", $search_boxvalue), 'text'=>img_picto('', 'object_contract').' '.$langs->trans("SearchIntoContracts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contrat/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
120 120
 }
121
-if (! empty($conf->ficheinter->enabled) && empty($conf->global->MAIN_SEARCHFORM_FICHINTER_DISABLED) && $user->rights->ficheinter->lire)
121
+if (!empty($conf->ficheinter->enabled) && empty($conf->global->MAIN_SEARCHFORM_FICHINTER_DISABLED) && $user->rights->ficheinter->lire)
122 122
 {
123
-	$arrayresult['searchintointervention']=array('position'=>140, 'img'=>'object_intervention', 'label'=>$langs->trans("SearchIntoInterventions", $search_boxvalue), 'text'=>img_picto('','object_intervention').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
123
+	$arrayresult['searchintointervention'] = array('position'=>140, 'img'=>'object_intervention', 'label'=>$langs->trans("SearchIntoInterventions", $search_boxvalue), 'text'=>img_picto('', 'object_intervention').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
124 124
 }
125 125
 
126 126
 // HR
127
-if (! empty($conf->user->enabled) && empty($conf->global->MAIN_SEARCHFORM_USER_DISABLED) && $user->rights->user->user->lire)
127
+if (!empty($conf->user->enabled) && empty($conf->global->MAIN_SEARCHFORM_USER_DISABLED) && $user->rights->user->user->lire)
128 128
 {
129
-	$arrayresult['searchintouser']=array('position'=>200, 'shortcut'=>'U', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoUsers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
129
+	$arrayresult['searchintouser'] = array('position'=>200, 'shortcut'=>'U', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoUsers", $search_boxvalue), 'text'=>img_picto('', 'object_user').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
130 130
 }
131
-if (! empty($conf->expensereport->enabled) && empty($conf->global->MAIN_SEARCHFORM_EXPENSEREPORT_DISABLED) && $user->rights->expensereport->lire)
131
+if (!empty($conf->expensereport->enabled) && empty($conf->global->MAIN_SEARCHFORM_EXPENSEREPORT_DISABLED) && $user->rights->expensereport->lire)
132 132
 {
133
-	$arrayresult['searchintoexpensereport']=array('position'=>210, 'img'=>'object_trip', 'label'=>$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'text'=>img_picto('','object_trip').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm'.($search_boxvalue?'&sall='.urlencode($search_boxvalue):''));
133
+	$arrayresult['searchintoexpensereport'] = array('position'=>210, 'img'=>'object_trip', 'label'=>$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'text'=>img_picto('', 'object_trip').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : ''));
134 134
 }
135
-if (! empty($conf->holiday->enabled) && empty($conf->global->MAIN_SEARCHFORM_HOLIDAY_DISABLED) && $user->rights->holiday->read)
135
+if (!empty($conf->holiday->enabled) && empty($conf->global->MAIN_SEARCHFORM_HOLIDAY_DISABLED) && $user->rights->holiday->read)
136 136
 {
137
-	$arrayresult['searchintoleaves']=array('position'=>220, 'img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('','object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm'.($search_boxvalue?'&sall='.urlencode($search_boxvalue):''));
137
+	$arrayresult['searchintoleaves'] = array('position'=>220, 'img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('', 'object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : ''));
138 138
 }
139 139
 
140 140
 
@@ -147,25 +147,25 @@  discard block
 block discarded – undo
147 147
 */
148 148
 
149 149
 // Execute hook addSearchEntry
150
-$parameters=array('search_boxvalue'=>$search_boxvalue, 'arrayresult'=>$arrayresult);
151
-$reshook=$hookmanager->executeHooks('addSearchEntry',$parameters);
150
+$parameters = array('search_boxvalue'=>$search_boxvalue, 'arrayresult'=>$arrayresult);
151
+$reshook = $hookmanager->executeHooks('addSearchEntry', $parameters);
152 152
 if (empty($reshook))
153 153
 {
154
-	$arrayresult=array_merge($arrayresult, $hookmanager->resArray);
154
+	$arrayresult = array_merge($arrayresult, $hookmanager->resArray);
155 155
 }
156
-else $arrayresult=$hookmanager->resArray;
156
+else $arrayresult = $hookmanager->resArray;
157 157
 
158 158
 // This allow to keep a search entry to the top
159
-if(! empty($conf->global->DEFAULT_SEARCH_INTO_MODULE)) {
159
+if (!empty($conf->global->DEFAULT_SEARCH_INTO_MODULE)) {
160 160
     $key = 'searchinto'.$conf->global->DEFAULT_SEARCH_INTO_MODULE;
161
-    if(array_key_exists($key, $arrayresult)) $arrayresult[$key]['position'] = -10;
161
+    if (array_key_exists($key, $arrayresult)) $arrayresult[$key]['position'] = -10;
162 162
 }
163 163
 
164 164
 // Sort on position
165 165
 $arrayresult = dol_sort_array($arrayresult, 'position');
166 166
 
167 167
 // Print output if called by ajax or do nothing (var $arrayresult will be used) if called by an include
168
-if (! isset($usedbyinclude) || empty($usedbyinclude))
168
+if (!isset($usedbyinclude) || empty($usedbyinclude))
169 169
 {
170 170
     print json_encode($arrayresult);
171 171
     if (is_object($db)) $db->close();
Please login to merge, or discard this patch.
Braces   +29 added lines, -11 removed lines patch added patch discarded remove patch
@@ -26,11 +26,22 @@  discard block
 block discarded – undo
26 26
 
27 27
 if (! isset($usedbyinclude) || empty($usedbyinclude))
28 28
 {
29
-    if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); // Disables token renewal
30
-    if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU','1');
31
-    if (! defined('NOREQUIREHTML'))  define('NOREQUIREHTML','1');
32
-    if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX','1');
33
-    if (! defined('NOREDIRECTBYMAINTOLOGIN')) define('NOREDIRECTBYMAINTOLOGIN','1');
29
+    if (! defined('NOTOKENRENEWAL')) {
30
+        define('NOTOKENRENEWAL',1);
31
+    }
32
+    // Disables token renewal
33
+    if (! defined('NOREQUIREMENU')) {
34
+        define('NOREQUIREMENU','1');
35
+    }
36
+    if (! defined('NOREQUIREHTML')) {
37
+        define('NOREQUIREHTML','1');
38
+    }
39
+    if (! defined('NOREQUIREAJAX')) {
40
+        define('NOREQUIREAJAX','1');
41
+    }
42
+    if (! defined('NOREDIRECTBYMAINTOLOGIN')) {
43
+        define('NOREDIRECTBYMAINTOLOGIN','1');
44
+    }
34 45
 
35 46
     $res=@include '../../main.inc.php';
36 47
     if ($res == 'ERROR_NOT_LOGGED')
@@ -38,7 +49,9 @@  discard block
 block discarded – undo
38 49
     	$langs->load("other");
39 50
     	$arrayresult['jumptologin']=array('img'=>'object_generic', 'label'=>$langs->trans("JumpToLogin"), 'text'=>'<span class="fa fa-sign-in"></span> '.$langs->trans("JumpToLogin"), 'url'=>DOL_URL_ROOT.'/index.php');
40 51
     	print json_encode($arrayresult);
41
-    	if (is_object($db)) $db->close();
52
+    	if (is_object($db)) {
53
+    	    $db->close();
54
+    	}
42 55
     	exit;
43 56
     }
44 57
 }
@@ -152,14 +165,17 @@  discard block
 block discarded – undo
152 165
 if (empty($reshook))
153 166
 {
154 167
 	$arrayresult=array_merge($arrayresult, $hookmanager->resArray);
168
+} else {
169
+    $arrayresult=$hookmanager->resArray;
155 170
 }
156
-else $arrayresult=$hookmanager->resArray;
157 171
 
158 172
 // This allow to keep a search entry to the top
159 173
 if(! empty($conf->global->DEFAULT_SEARCH_INTO_MODULE)) {
160 174
     $key = 'searchinto'.$conf->global->DEFAULT_SEARCH_INTO_MODULE;
161
-    if(array_key_exists($key, $arrayresult)) $arrayresult[$key]['position'] = -10;
162
-}
175
+    if(array_key_exists($key, $arrayresult)) {
176
+        $arrayresult[$key]['position'] = -10;
177
+    }
178
+    }
163 179
 
164 180
 // Sort on position
165 181
 $arrayresult = dol_sort_array($arrayresult, 'position');
@@ -168,6 +184,8 @@  discard block
 block discarded – undo
168 184
 if (! isset($usedbyinclude) || empty($usedbyinclude))
169 185
 {
170 186
     print json_encode($arrayresult);
171
-    if (is_object($db)) $db->close();
172
-}
187
+    if (is_object($db)) {
188
+        $db->close();
189
+    }
190
+    }
173 191
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/ajax/fileupload.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,14 +51,14 @@
 block discarded – undo
51 51
 header('Access-Control-Allow-Headers: X-File-Name, X-File-Type, X-File-Size');
52 52
 
53 53
 switch ($_SERVER['REQUEST_METHOD']) {
54
-	case 'OPTIONS':
55
-		break;
54
+    case 'OPTIONS':
55
+        break;
56 56
     case 'HEAD':
57 57
     case 'GET':
58 58
         $upload_handler->get();
59 59
         break;
60 60
     case 'POST':
61
-    	if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') {
61
+        if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') {
62 62
             $upload_handler->delete();
63 63
         } else {
64 64
             $upload_handler->post();
Please login to merge, or discard this patch.
Braces   +14 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,10 +21,20 @@
 block discarded – undo
21 21
  *       \brief      File to return Ajax response on file upload
22 22
  */
23 23
 
24
-if (! defined('NOCSRFCHECK'))    define('NOCSRFCHECK','1');
25
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1');
26
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU','1'); // If there is no menu to show
27
-if (! defined('NOREQUIREHTML'))  define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
24
+if (! defined('NOCSRFCHECK')) {
25
+    define('NOCSRFCHECK','1');
26
+}
27
+if (! defined('NOTOKENRENEWAL')) {
28
+    define('NOTOKENRENEWAL','1');
29
+}
30
+if (! defined('NOREQUIREMENU')) {
31
+    define('NOREQUIREMENU','1');
32
+}
33
+// If there is no menu to show
34
+if (! defined('NOREQUIREHTML')) {
35
+    define('NOREQUIREHTML','1');
36
+}
37
+// If we don't need to load the html.form.class.php
28 38
 
29 39
 
30 40
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,16 +21,16 @@  discard block
 block discarded – undo
21 21
  *       \brief      File to return Ajax response on file upload
22 22
  */
23 23
 
24
-if (! defined('NOCSRFCHECK'))    define('NOCSRFCHECK','1');
25
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1');
26
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU','1'); // If there is no menu to show
27
-if (! defined('NOREQUIREHTML'))  define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
24
+if (!defined('NOCSRFCHECK'))    define('NOCSRFCHECK', '1');
25
+if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
26
+if (!defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1'); // If there is no menu to show
27
+if (!defined('NOREQUIREHTML'))  define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
28 28
 
29 29
 
30 30
 
31 31
 // Copyright (C) 2018 Alxarafe/Alixar  <[email protected]>
32 32
 defined('BASE_PATH') or die('Single entry point through the index.php of the main folder');
33
-require DOL_BASE_PATH . '/main.inc.php';
33
+require DOL_BASE_PATH.'/main.inc.php';
34 34
 require_once DOL_DOCUMENT_ROOT.'/core/class/fileupload.class.php';
35 35
 
36 36
 error_reporting(E_ALL | E_STRICT);
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 //print_r($_GET);
40 40
 //print 'upload_dir='.GETPOST('upload_dir');
41 41
 
42
-$fk_element = GETPOST('fk_element','int');
43
-$element = GETPOST('element','alpha');
42
+$fk_element = GETPOST('fk_element', 'int');
43
+$element = GETPOST('element', 'alpha');
44 44
 
45 45
 
46
-$upload_handler = new FileUpload(null,$fk_element,$element);
46
+$upload_handler = new FileUpload(null, $fk_element, $element);
47 47
 
48 48
 header('Pragma: no-cache');
49 49
 header('Cache-Control: no-store, no-cache, must-revalidate');
Please login to merge, or discard this patch.
dolibarr/htdocs/core/ajax/bankconciliate.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 
50 50
 if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $action == 'dvnext')
51 51
 {
52
-	// Increase date
53
-	$al = new AccountLine($db);
52
+    // Increase date
53
+    $al = new AccountLine($db);
54 54
     $al->datev_next(GETPOST('rowid','int'));
55 55
     $al->fetch(GETPOST('rowid','int'));
56 56
 
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
 
62 62
 if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $action == 'dvprev')
63 63
 {
64
-	// Decrease date
65
-	$al =new AccountLine($db);
64
+    // Decrease date
65
+    $al =new AccountLine($db);
66 66
     $al->datev_previous(GETPOST('rowid','int'));
67 67
     $al->fetch(GETPOST('rowid','int'));
68 68
 
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 
74 74
 if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $action == 'donext')
75 75
 {
76
-	// Increase date
77
-	$al = new AccountLine($db);
76
+    // Increase date
77
+    $al = new AccountLine($db);
78 78
     $al->dateo_next(GETPOST('rowid','int'));
79 79
     $al->fetch(GETPOST('rowid','int'));
80 80
 
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 
86 86
 if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $action == 'doprev')
87 87
 {
88
-	// Decrease date
89
-	$al =new AccountLine($db);
88
+    // Decrease date
89
+    $al =new AccountLine($db);
90 90
     $al->dateo_previous(GETPOST('rowid','int'));
91 91
     $al->fetch(GETPOST('rowid','int'));
92 92
 
Please login to merge, or discard this patch.
Braces   +16 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,11 +20,22 @@
 block discarded – undo
20 20
  *       \brief      File to set data for bank concilation
21 21
  */
22 22
 
23
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
24
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU','1');
25
-if (! defined('NOREQUIREHTML'))  define('NOREQUIREHTML','1');
26
-if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX','1');
27
-if (! defined('NOREQUIRESOC'))   define('NOREQUIRESOC','1');
23
+if (! defined('NOTOKENRENEWAL')) {
24
+    define('NOTOKENRENEWAL','1');
25
+}
26
+// Disables token renewal
27
+if (! defined('NOREQUIREMENU')) {
28
+    define('NOREQUIREMENU','1');
29
+}
30
+if (! defined('NOREQUIREHTML')) {
31
+    define('NOREQUIREHTML','1');
32
+}
33
+if (! defined('NOREQUIREAJAX')) {
34
+    define('NOREQUIREAJAX','1');
35
+}
36
+if (! defined('NOREQUIRESOC')) {
37
+    define('NOREQUIRESOC','1');
38
+}
28 39
 //if (! defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN','1');    // Required to know date format for dol_print_date
29 40
 
30 41
 
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -20,21 +20,21 @@  discard block
 block discarded – undo
20 20
  *       \brief      File to set data for bank concilation
21 21
  */
22 22
 
23
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
24
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU','1');
25
-if (! defined('NOREQUIREHTML'))  define('NOREQUIREHTML','1');
26
-if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX','1');
27
-if (! defined('NOREQUIRESOC'))   define('NOREQUIRESOC','1');
23
+if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal
24
+if (!defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1');
25
+if (!defined('NOREQUIREHTML'))  define('NOREQUIREHTML', '1');
26
+if (!defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX', '1');
27
+if (!defined('NOREQUIRESOC'))   define('NOREQUIRESOC', '1');
28 28
 //if (! defined('NOREQUIRETRAN'))  define('NOREQUIRETRAN','1');    // Required to know date format for dol_print_date
29 29
 
30 30
 
31 31
 // Copyright (C) 2018 Alxarafe/Alixar  <[email protected]>
32 32
 defined('BASE_PATH') or die('Single entry point through the index.php of the main folder');
33
-require DOL_BASE_PATH . '/main.inc.php';
33
+require DOL_BASE_PATH.'/main.inc.php';
34 34
 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
35 35
 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
36 36
 
37
-$action=GETPOST('action','aZ09');
37
+$action = GETPOST('action', 'aZ09');
38 38
 
39 39
 
40 40
 /*
@@ -54,10 +54,10 @@  discard block
 block discarded – undo
54 54
 {
55 55
 	// Increase date
56 56
 	$al = new AccountLine($db);
57
-    $al->datev_next(GETPOST('rowid','int'));
58
-    $al->fetch(GETPOST('rowid','int'));
57
+    $al->datev_next(GETPOST('rowid', 'int'));
58
+    $al->fetch(GETPOST('rowid', 'int'));
59 59
 
60
-    print '<span>'.dol_print_date($db->jdate($al->datev),"day").'</span>';
60
+    print '<span>'.dol_print_date($db->jdate($al->datev), "day").'</span>';
61 61
 
62 62
     exit;
63 63
 }
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
 if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $action == 'dvprev')
66 66
 {
67 67
 	// Decrease date
68
-	$al =new AccountLine($db);
69
-    $al->datev_previous(GETPOST('rowid','int'));
70
-    $al->fetch(GETPOST('rowid','int'));
68
+	$al = new AccountLine($db);
69
+    $al->datev_previous(GETPOST('rowid', 'int'));
70
+    $al->fetch(GETPOST('rowid', 'int'));
71 71
 
72
-    print '<span>'.dol_print_date($db->jdate($al->datev),"day").'</span>';
72
+    print '<span>'.dol_print_date($db->jdate($al->datev), "day").'</span>';
73 73
 
74 74
     exit;
75 75
 }
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
 {
79 79
 	// Increase date
80 80
 	$al = new AccountLine($db);
81
-    $al->dateo_next(GETPOST('rowid','int'));
82
-    $al->fetch(GETPOST('rowid','int'));
81
+    $al->dateo_next(GETPOST('rowid', 'int'));
82
+    $al->fetch(GETPOST('rowid', 'int'));
83 83
 
84
-    print '<span>'.dol_print_date($db->jdate($al->dateo),"day").'</span>';
84
+    print '<span>'.dol_print_date($db->jdate($al->dateo), "day").'</span>';
85 85
 
86 86
     exit;
87 87
 }
@@ -89,11 +89,11 @@  discard block
 block discarded – undo
89 89
 if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $action == 'doprev')
90 90
 {
91 91
 	// Decrease date
92
-	$al =new AccountLine($db);
93
-    $al->dateo_previous(GETPOST('rowid','int'));
94
-    $al->fetch(GETPOST('rowid','int'));
92
+	$al = new AccountLine($db);
93
+    $al->dateo_previous(GETPOST('rowid', 'int'));
94
+    $al->fetch(GETPOST('rowid', 'int'));
95 95
 
96
-    print '<span>'.dol_print_date($db->jdate($al->dateo),"day").'</span>';
96
+    print '<span>'.dol_print_date($db->jdate($al->dateo), "day").'</span>';
97 97
 
98 98
     exit;
99 99
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/ajax/price.php 3 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -42,25 +42,25 @@
 block discarded – undo
42 42
 // Load original field value
43 43
 if (! empty($output) && isset($amount) && isset($tva_tx))
44 44
 {
45
-	$return=array();
46
-	$price='';
45
+    $return=array();
46
+    $price='';
47 47
 
48
-	if (is_numeric($amount) && $amount != '')
49
-	{
50
-		if ($output == 'price_ttc') {
48
+    if (is_numeric($amount) && $amount != '')
49
+    {
50
+        if ($output == 'price_ttc') {
51 51
 
52
-			$price = price2num($amount * (1 + ($tva_tx/100)), 'MU');
53
-			$return['price_ht'] = $amount;
54
-			$return['price_ttc'] = (isset($price) && $price != '' ? price($price) : '');
55
-		}
56
-		else if ($output == 'price_ht') {
52
+            $price = price2num($amount * (1 + ($tva_tx/100)), 'MU');
53
+            $return['price_ht'] = $amount;
54
+            $return['price_ttc'] = (isset($price) && $price != '' ? price($price) : '');
55
+        }
56
+        else if ($output == 'price_ht') {
57 57
 
58
-			$price = price2num($amount / (1 + ($tva_tx/100)), 'MU');
59
-			$return['price_ht'] = (isset($price) && $price != '' ? price($price) : '');
60
-			$return['price_ttc'] = ($tva_tx == 0 ? $price : $amount);
61
-		}
62
-	}
58
+            $price = price2num($amount / (1 + ($tva_tx/100)), 'MU');
59
+            $return['price_ht'] = (isset($price) && $price != '' ? price($price) : '');
60
+            $return['price_ttc'] = ($tva_tx == 0 ? $price : $amount);
61
+        }
62
+    }
63 63
 
64
-	echo json_encode($return);
64
+    echo json_encode($return);
65 65
 }
66 66
 
Please login to merge, or discard this patch.
Braces   +14 added lines, -6 removed lines patch added patch discarded remove patch
@@ -20,10 +20,19 @@  discard block
 block discarded – undo
20 20
  *       \brief      File to get ht and ttc
21 21
  */
22 22
 
23
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
24
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU','1');
25
-if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX','1');
26
-if (! defined('NOREQUIRESOC'))   define('NOREQUIRESOC','1');
23
+if (! defined('NOTOKENRENEWAL')) {
24
+    define('NOTOKENRENEWAL','1');
25
+}
26
+// Disables token renewal
27
+if (! defined('NOREQUIREMENU')) {
28
+    define('NOREQUIREMENU','1');
29
+}
30
+if (! defined('NOREQUIREAJAX')) {
31
+    define('NOREQUIREAJAX','1');
32
+}
33
+if (! defined('NOREQUIRESOC')) {
34
+    define('NOREQUIRESOC','1');
35
+}
27 36
 
28 37
 
29 38
 // Copyright (C) 2018 Alxarafe/Alixar  <[email protected]>
@@ -55,8 +64,7 @@  discard block
 block discarded – undo
55 64
 			$price = price2num($amount * (1 + ($tva_tx/100)), 'MU');
56 65
 			$return['price_ht'] = $amount;
57 66
 			$return['price_ttc'] = (isset($price) && $price != '' ? price($price) : '');
58
-		}
59
-		else if ($output == 'price_ht') {
67
+		} else if ($output == 'price_ht') {
60 68
 
61 69
 			$price = price2num($amount / (1 + ($tva_tx/100)), 'MU');
62 70
 			$return['price_ht'] = (isset($price) && $price != '' ? price($price) : '');
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -20,19 +20,19 @@  discard block
 block discarded – undo
20 20
  *       \brief      File to get ht and ttc
21 21
  */
22 22
 
23
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
24
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU','1');
25
-if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX','1');
26
-if (! defined('NOREQUIRESOC'))   define('NOREQUIRESOC','1');
23
+if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal
24
+if (!defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1');
25
+if (!defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX', '1');
26
+if (!defined('NOREQUIRESOC'))   define('NOREQUIRESOC', '1');
27 27
 
28 28
 
29 29
 // Copyright (C) 2018 Alxarafe/Alixar  <[email protected]>
30 30
 defined('BASE_PATH') or die('Single entry point through the index.php of the main folder');
31
-require DOL_BASE_PATH . '/main.inc.php';
31
+require DOL_BASE_PATH.'/main.inc.php';
32 32
 
33
-$output		= GETPOST('output','alpha');
34
-$amount		= price2num(GETPOST('amount','alpha'));
35
-$tva_tx		= str_replace('*','',GETPOST('tva_tx','alpha'));
33
+$output		= GETPOST('output', 'alpha');
34
+$amount		= price2num(GETPOST('amount', 'alpha'));
35
+$tva_tx		= str_replace('*', '', GETPOST('tva_tx', 'alpha'));
36 36
 
37 37
 /*
38 38
  * View
@@ -43,22 +43,22 @@  discard block
 block discarded – undo
43 43
 //print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
44 44
 
45 45
 // Load original field value
46
-if (! empty($output) && isset($amount) && isset($tva_tx))
46
+if (!empty($output) && isset($amount) && isset($tva_tx))
47 47
 {
48
-	$return=array();
49
-	$price='';
48
+	$return = array();
49
+	$price = '';
50 50
 
51 51
 	if (is_numeric($amount) && $amount != '')
52 52
 	{
53 53
 		if ($output == 'price_ttc') {
54 54
 
55
-			$price = price2num($amount * (1 + ($tva_tx/100)), 'MU');
55
+			$price = price2num($amount * (1 + ($tva_tx / 100)), 'MU');
56 56
 			$return['price_ht'] = $amount;
57 57
 			$return['price_ttc'] = (isset($price) && $price != '' ? price($price) : '');
58 58
 		}
59 59
 		else if ($output == 'price_ht') {
60 60
 
61
-			$price = price2num($amount / (1 + ($tva_tx/100)), 'MU');
61
+			$price = price2num($amount / (1 + ($tva_tx / 100)), 'MU');
62 62
 			$return['price_ht'] = (isset($price) && $price != '' ? price($price) : '');
63 63
 			$return['price_ttc'] = ($tva_tx == 0 ? $price : $amount);
64 64
 		}
Please login to merge, or discard this patch.
dolibarr/htdocs/core/ajax/vatrates.php 3 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -43,28 +43,28 @@
 block discarded – undo
43 43
 // Load original field value
44 44
 if (! empty($id) && ! empty($action) && ! empty($htmlname))
45 45
 {
46
-	$form = new Form($db);
47
-	$soc = new Societe($db);
46
+    $form = new Form($db);
47
+    $soc = new Societe($db);
48 48
 
49
-	$soc->fetch($id);
49
+    $soc->fetch($id);
50 50
 
51
-	if ($action == 'getSellerVATRates')
52
-	{
53
-		$seller = $mysoc;
54
-		$buyer = $soc;
55
-	}
56
-	else
57
-	{
58
-		$buyer = $mysoc;
59
-		$seller = $soc;
60
-	}
51
+    if ($action == 'getSellerVATRates')
52
+    {
53
+        $seller = $mysoc;
54
+        $buyer = $soc;
55
+    }
56
+    else
57
+    {
58
+        $buyer = $mysoc;
59
+        $seller = $soc;
60
+    }
61 61
 
62
-	$return=array();
62
+    $return=array();
63 63
 
64
-	$return['value']	= $form->load_tva('tva_tx',$selected,$seller,$buyer,$productid,0,'',true);
65
-	$return['num']		= $form->num;
66
-	$return['error']	= $form->error;
64
+    $return['value']	= $form->load_tva('tva_tx',$selected,$seller,$buyer,$productid,0,'',true);
65
+    $return['num']		= $form->num;
66
+    $return['error']	= $form->error;
67 67
 
68
-	echo json_encode($return);
68
+    echo json_encode($return);
69 69
 }
70 70
 
Please login to merge, or discard this patch.
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,9 +20,16 @@  discard block
 block discarded – undo
20 20
  *       \brief      File to load vat rates combobox
21 21
  */
22 22
 
23
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
24
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU','1');
25
-if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX','1');
23
+if (! defined('NOTOKENRENEWAL')) {
24
+    define('NOTOKENRENEWAL','1');
25
+}
26
+// Disables token renewal
27
+if (! defined('NOREQUIREMENU')) {
28
+    define('NOREQUIREMENU','1');
29
+}
30
+if (! defined('NOREQUIREAJAX')) {
31
+    define('NOREQUIREAJAX','1');
32
+}
26 33
 
27 34
 
28 35
 // Copyright (C) 2018 Alxarafe/Alixar  <[email protected]>
@@ -55,8 +62,7 @@  discard block
 block discarded – undo
55 62
 	{
56 63
 		$seller = $mysoc;
57 64
 		$buyer = $soc;
58
-	}
59
-	else
65
+	} else
60 66
 	{
61 67
 		$buyer = $mysoc;
62 68
 		$seller = $soc;
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -20,20 +20,20 @@  discard block
 block discarded – undo
20 20
  *       \brief      File to load vat rates combobox
21 21
  */
22 22
 
23
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
24
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU','1');
25
-if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX','1');
23
+if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal
24
+if (!defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1');
25
+if (!defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX', '1');
26 26
 
27 27
 
28 28
 // Copyright (C) 2018 Alxarafe/Alixar  <[email protected]>
29 29
 defined('BASE_PATH') or die('Single entry point through the index.php of the main folder');
30
-require DOL_BASE_PATH . '/main.inc.php';
30
+require DOL_BASE_PATH.'/main.inc.php';
31 31
 
32
-$id			= GETPOST('id','int');
33
-$action		= GETPOST('action','alpha');
34
-$htmlname	= GETPOST('htmlname','alpha');
35
-$selected	= (GETPOST('selected')?GETPOST('selected'):'-1');
36
-$productid	= (GETPOST('productid','int')?GETPOST('productid','int'):0);
32
+$id = GETPOST('id', 'int');
33
+$action = GETPOST('action', 'alpha');
34
+$htmlname	= GETPOST('htmlname', 'alpha');
35
+$selected	= (GETPOST('selected') ?GETPOST('selected') : '-1');
36
+$productid = (GETPOST('productid', 'int') ?GETPOST('productid', 'int') : 0);
37 37
 
38 38
 /*
39 39
  * View
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 //print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
45 45
 
46 46
 // Load original field value
47
-if (! empty($id) && ! empty($action) && ! empty($htmlname))
47
+if (!empty($id) && !empty($action) && !empty($htmlname))
48 48
 {
49 49
 	$form = new Form($db);
50 50
 	$soc = new Societe($db);
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
 		$seller = $soc;
63 63
 	}
64 64
 
65
-	$return=array();
65
+	$return = array();
66 66
 
67
-	$return['value']	= $form->load_tva('tva_tx',$selected,$seller,$buyer,$productid,0,'',true);
68
-	$return['num']		= $form->num;
67
+	$return['value']	= $form->load_tva('tva_tx', $selected, $seller, $buyer, $productid, 0, '', true);
68
+	$return['num'] = $form->num;
69 69
 	$return['error']	= $form->error;
70 70
 
71 71
 	echo json_encode($return);
Please login to merge, or discard this patch.
dolibarr/htdocs/core/ajax/contacts.php 3 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -43,15 +43,15 @@
 block discarded – undo
43 43
 // Load original field value
44 44
 if (! empty($id) && ! empty($action) && ! empty($htmlname))
45 45
 {
46
-	$form = new Form($db);
46
+    $form = new Form($db);
47 47
 
48
-	$return=array();
49
-	if (empty($showempty)) $showempty=0;
48
+    $return=array();
49
+    if (empty($showempty)) $showempty=0;
50 50
 
51
-	$return['value']	= $form->selectcontacts($id,'',$htmlname,$showempty,'','',0,'',true);
52
-	$return['num']		= $form->num;
53
-	$return['error']	= $form->error;
51
+    $return['value']	= $form->selectcontacts($id,'',$htmlname,$showempty,'','',0,'',true);
52
+    $return['num']		= $form->num;
53
+    $return['error']	= $form->error;
54 54
 
55
-	echo json_encode($return);
55
+    echo json_encode($return);
56 56
 }
57 57
 
Please login to merge, or discard this patch.
Braces   +13 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,9 +21,16 @@  discard block
 block discarded – undo
21 21
  *       \brief      File to load contacts combobox
22 22
  */
23 23
 
24
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
25
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU','1');
26
-if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX','1');
24
+if (! defined('NOTOKENRENEWAL')) {
25
+    define('NOTOKENRENEWAL','1');
26
+}
27
+// Disables token renewal
28
+if (! defined('NOREQUIREMENU')) {
29
+    define('NOREQUIREMENU','1');
30
+}
31
+if (! defined('NOREQUIREAJAX')) {
32
+    define('NOREQUIREAJAX','1');
33
+}
27 34
 
28 35
 
29 36
 // Copyright (C) 2018 Alxarafe/Alixar  <[email protected]>
@@ -49,7 +56,9 @@  discard block
 block discarded – undo
49 56
 	$form = new Form($db);
50 57
 
51 58
 	$return=array();
52
-	if (empty($showempty)) $showempty=0;
59
+	if (empty($showempty)) {
60
+	    $showempty=0;
61
+	}
53 62
 
54 63
 	$return['value']	= $form->selectcontacts($id,'',$htmlname,$showempty,'','',0,'',true);
55 64
 	$return['num']		= $form->num;
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -21,19 +21,19 @@  discard block
 block discarded – undo
21 21
  *       \brief      File to load contacts combobox
22 22
  */
23 23
 
24
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
25
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU','1');
26
-if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX','1');
24
+if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal
25
+if (!defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1');
26
+if (!defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX', '1');
27 27
 
28 28
 
29 29
 // Copyright (C) 2018 Alxarafe/Alixar  <[email protected]>
30 30
 defined('BASE_PATH') or die('Single entry point through the index.php of the main folder');
31
-require DOL_BASE_PATH . '/main.inc.php';
31
+require DOL_BASE_PATH.'/main.inc.php';
32 32
 
33
-$id			= GETPOST('id','int');
34
-$action		= GETPOST('action','alpha');
35
-$htmlname	= GETPOST('htmlname','alpha');
36
-$showempty	= GETPOST('showempty','int');
33
+$id = GETPOST('id', 'int');
34
+$action = GETPOST('action', 'alpha');
35
+$htmlname = GETPOST('htmlname', 'alpha');
36
+$showempty = GETPOST('showempty', 'int');
37 37
 
38 38
 /*
39 39
  * View
@@ -44,15 +44,15 @@  discard block
 block discarded – undo
44 44
 //print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
45 45
 
46 46
 // Load original field value
47
-if (! empty($id) && ! empty($action) && ! empty($htmlname))
47
+if (!empty($id) && !empty($action) && !empty($htmlname))
48 48
 {
49 49
 	$form = new Form($db);
50 50
 
51
-	$return=array();
52
-	if (empty($showempty)) $showempty=0;
51
+	$return = array();
52
+	if (empty($showempty)) $showempty = 0;
53 53
 
54
-	$return['value']	= $form->selectcontacts($id,'',$htmlname,$showempty,'','',0,'',true);
55
-	$return['num']		= $form->num;
54
+	$return['value']	= $form->selectcontacts($id, '', $htmlname, $showempty, '', '', 0, '', true);
55
+	$return['num'] = $form->num;
56 56
 	$return['error']	= $form->error;
57 57
 
58 58
 	echo json_encode($return);
Please login to merge, or discard this patch.
dolibarr/htdocs/core/ajax/saveinplace.php 3 patches
Indentation   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -58,175 +58,175 @@
 block discarded – undo
58 58
 // Load original field value
59 59
 if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($fk_element))
60 60
 {
61
-	$ext_element		= GETPOST('ext_element','alpha',2);
62
-	$field				= substr($field, 8); // remove prefix val_
63
-	$type				= GETPOST('type','alpha',2);
64
-	$value				= ($type == 'ckeditor' ? GETPOST('value','',2) : GETPOST('value','alpha',2));
65
-	$loadmethod			= GETPOST('loadmethod','alpha',2);
66
-	$savemethod			= GETPOST('savemethod','alpha',2);
67
-	$savemethodname		= (! empty($savemethod) ? $savemethod : 'setValueFrom');
68
-	$newelement			= $element;
69
-
70
-	$view='';
71
-	$format='text';
72
-	$return=array();
73
-	$error=0;
74
-
75
-	if ($element != 'order_supplier' && $element != 'invoice_supplier' && preg_match('/^([^_]+)_([^_]+)/i',$element,$regs))
76
-	{
77
-		$element = $regs[1];
78
-		$subelement = $regs[2];
79
-	}
80
-
81
-	if ($element == 'propal') $newelement = 'propale';
82
-	else if ($element == 'fichinter') $newelement = 'ficheinter';
83
-	else if ($element == 'product') $newelement = 'produit';
84
-	else if ($element == 'member') $newelement = 'adherent';
85
-	else if ($element == 'order_supplier') {
86
-		$newelement = 'fournisseur';
87
-		$subelement = 'commande';
88
-	}
89
-	else if ($element == 'invoice_supplier') {
90
-		$newelement = 'fournisseur';
91
-		$subelement = 'facture';
92
-	}
93
-	else $newelement = $element;
94
-
95
-	$_POST['action']='update';	// Hack so restrictarea will test permissions on write too
96
-	$feature = $newelement;
97
-	$feature2 = $subelement;
98
-	$object_id = $fk_element;
99
-	if ($feature == 'expedition' || $feature == 'shipping')
100
-	{
101
-		$feature = 'commande';
102
-		$object_id = 0;
103
-	}
104
-	if ($feature == 'shipping') $feature = 'commande';
105
-	if ($feature == 'payment') { $feature = 'facture'; }
106
-	if ($feature == 'payment_supplier') { $feature = 'fournisseur'; $feature2 = 'facture'; }
107
-	//var_dump(GETPOST('action','aZ09'));
108
-	//var_dump($newelement.'-'.$subelement."-".$feature."-".$object_id);
109
-	$check_access = restrictedArea($user, $feature, $object_id, '', $feature2);
110
-	//var_dump($user->rights);
111
-	/*
61
+    $ext_element		= GETPOST('ext_element','alpha',2);
62
+    $field				= substr($field, 8); // remove prefix val_
63
+    $type				= GETPOST('type','alpha',2);
64
+    $value				= ($type == 'ckeditor' ? GETPOST('value','',2) : GETPOST('value','alpha',2));
65
+    $loadmethod			= GETPOST('loadmethod','alpha',2);
66
+    $savemethod			= GETPOST('savemethod','alpha',2);
67
+    $savemethodname		= (! empty($savemethod) ? $savemethod : 'setValueFrom');
68
+    $newelement			= $element;
69
+
70
+    $view='';
71
+    $format='text';
72
+    $return=array();
73
+    $error=0;
74
+
75
+    if ($element != 'order_supplier' && $element != 'invoice_supplier' && preg_match('/^([^_]+)_([^_]+)/i',$element,$regs))
76
+    {
77
+        $element = $regs[1];
78
+        $subelement = $regs[2];
79
+    }
80
+
81
+    if ($element == 'propal') $newelement = 'propale';
82
+    else if ($element == 'fichinter') $newelement = 'ficheinter';
83
+    else if ($element == 'product') $newelement = 'produit';
84
+    else if ($element == 'member') $newelement = 'adherent';
85
+    else if ($element == 'order_supplier') {
86
+        $newelement = 'fournisseur';
87
+        $subelement = 'commande';
88
+    }
89
+    else if ($element == 'invoice_supplier') {
90
+        $newelement = 'fournisseur';
91
+        $subelement = 'facture';
92
+    }
93
+    else $newelement = $element;
94
+
95
+    $_POST['action']='update';	// Hack so restrictarea will test permissions on write too
96
+    $feature = $newelement;
97
+    $feature2 = $subelement;
98
+    $object_id = $fk_element;
99
+    if ($feature == 'expedition' || $feature == 'shipping')
100
+    {
101
+        $feature = 'commande';
102
+        $object_id = 0;
103
+    }
104
+    if ($feature == 'shipping') $feature = 'commande';
105
+    if ($feature == 'payment') { $feature = 'facture'; }
106
+    if ($feature == 'payment_supplier') { $feature = 'fournisseur'; $feature2 = 'facture'; }
107
+    //var_dump(GETPOST('action','aZ09'));
108
+    //var_dump($newelement.'-'.$subelement."-".$feature."-".$object_id);
109
+    $check_access = restrictedArea($user, $feature, $object_id, '', $feature2);
110
+    //var_dump($user->rights);
111
+    /*
112 112
 	if (! empty($user->rights->$newelement->creer) || ! empty($user->rights->$newelement->create) || ! empty($user->rights->$newelement->write)
113 113
 		|| (isset($subelement) && (! empty($user->rights->$newelement->$subelement->creer) || ! empty($user->rights->$newelement->$subelement->write)))
114 114
 		|| ($element == 'payment' && $user->rights->facture->paiement)
115 115
 		|| ($element == 'payment_supplier' && $user->rights->fournisseur->facture->creer))
116 116
 	*/
117 117
 
118
-	if ($check_access)
119
-	{
120
-		// Clean parameters
121
-		$newvalue = trim($value);
122
-
123
-		if ($type == 'numeric')
124
-		{
125
-			$newvalue = price2num($newvalue);
126
-
127
-			// Check parameters
128
-			if (! is_numeric($newvalue))
129
-			{
130
-				$error++;
131
-				$return['error'] = $langs->trans('ErrorBadValue');
132
-			}
133
-		}
134
-		else if ($type == 'datepicker')
135
-		{
136
-			$timestamp	= GETPOST('timestamp','int',2);
137
-			$format		= 'date';
138
-			$newvalue	= ($timestamp / 1000);
139
-		}
140
-		else if ($type == 'select')
141
-		{
142
-			$loadmethodname	= 'load_cache_'.$loadmethod;
143
-			$loadcachename	= 'cache_'.$loadmethod;
144
-			$loadviewname	= 'view_'.$loadmethod;
145
-
146
-			$form = new Form($db);
147
-			if (method_exists($form, $loadmethodname))
148
-			{
149
-				$ret = $form->$loadmethodname();
150
-				if ($ret > 0)
151
-				{
152
-					$loadcache = $form->$loadcachename;
153
-					$value = $loadcache[$newvalue];
154
-
155
-					if (! empty($form->$loadviewname))
156
-					{
157
-						$loadview = $form->$loadviewname;
158
-						$view = $loadview[$newvalue];
159
-					}
160
-				}
161
-				else
162
-				{
163
-					$error++;
164
-					$return['error'] = $form->error;
165
-				}
166
-			}
167
-			else
168
-			{
169
-				$module = $subelement = $ext_element;
170
-				if (preg_match('/^([^_]+)_([^_]+)/i',$ext_element,$regs))
171
-				{
172
-					$module = $regs[1];
173
-					$subelement = $regs[2];
174
-				}
175
-
176
-				dol_include_once('/'.$module.'/class/actions_'.$subelement.'.class.php');
177
-				$classname = 'Actions'.ucfirst($subelement);
178
-				$object = new $classname($db);
179
-				$ret = $object->$loadmethodname();
180
-				if ($ret > 0)
181
-				{
182
-					$loadcache = $object->$loadcachename;
183
-					$value = $loadcache[$newvalue];
184
-
185
-					if (! empty($object->$loadviewname))
186
-					{
187
-						$loadview = $object->$loadviewname;
188
-						$view = $loadview[$newvalue];
189
-					}
190
-				}
191
-				else
192
-				{
193
-					$error++;
194
-					$return['error'] = $object->error;
195
-				}
196
-			}
197
-		}
198
-
199
-		if (! $error)
200
-		{
201
-			if ((isset($object) && ! is_object($object)) || empty($savemethod)) $object = new GenericObject($db);
202
-
203
-			// Specific for add_object_linked()
204
-			// TODO add a function for variable treatment
205
-			$object->ext_fk_element = $newvalue;
206
-			$object->ext_element = $ext_element;
207
-			$object->fk_element = $fk_element;
208
-			$object->element = $element;
209
-
210
-			$ret=$object->$savemethodname($field, $newvalue, $table_element, $fk_element, $format);
211
-			if ($ret > 0)
212
-			{
213
-				if ($type == 'numeric') $value = price($newvalue);
214
-				else if ($type == 'textarea') $value = dol_nl2br($newvalue);
215
-
216
-				$return['value'] = $value;
217
-				$return['view'] = (! empty($view) ? $view : $value);
218
-			}
219
-			else
220
-			{
221
-				$return['error'] = $object->error;
222
-			}
223
-		}
224
-
225
-		echo json_encode($return);
226
-	}
227
-	else
228
-	{
229
-		echo $langs->trans('NotEnoughPermissions');
230
-	}
118
+    if ($check_access)
119
+    {
120
+        // Clean parameters
121
+        $newvalue = trim($value);
122
+
123
+        if ($type == 'numeric')
124
+        {
125
+            $newvalue = price2num($newvalue);
126
+
127
+            // Check parameters
128
+            if (! is_numeric($newvalue))
129
+            {
130
+                $error++;
131
+                $return['error'] = $langs->trans('ErrorBadValue');
132
+            }
133
+        }
134
+        else if ($type == 'datepicker')
135
+        {
136
+            $timestamp	= GETPOST('timestamp','int',2);
137
+            $format		= 'date';
138
+            $newvalue	= ($timestamp / 1000);
139
+        }
140
+        else if ($type == 'select')
141
+        {
142
+            $loadmethodname	= 'load_cache_'.$loadmethod;
143
+            $loadcachename	= 'cache_'.$loadmethod;
144
+            $loadviewname	= 'view_'.$loadmethod;
145
+
146
+            $form = new Form($db);
147
+            if (method_exists($form, $loadmethodname))
148
+            {
149
+                $ret = $form->$loadmethodname();
150
+                if ($ret > 0)
151
+                {
152
+                    $loadcache = $form->$loadcachename;
153
+                    $value = $loadcache[$newvalue];
154
+
155
+                    if (! empty($form->$loadviewname))
156
+                    {
157
+                        $loadview = $form->$loadviewname;
158
+                        $view = $loadview[$newvalue];
159
+                    }
160
+                }
161
+                else
162
+                {
163
+                    $error++;
164
+                    $return['error'] = $form->error;
165
+                }
166
+            }
167
+            else
168
+            {
169
+                $module = $subelement = $ext_element;
170
+                if (preg_match('/^([^_]+)_([^_]+)/i',$ext_element,$regs))
171
+                {
172
+                    $module = $regs[1];
173
+                    $subelement = $regs[2];
174
+                }
175
+
176
+                dol_include_once('/'.$module.'/class/actions_'.$subelement.'.class.php');
177
+                $classname = 'Actions'.ucfirst($subelement);
178
+                $object = new $classname($db);
179
+                $ret = $object->$loadmethodname();
180
+                if ($ret > 0)
181
+                {
182
+                    $loadcache = $object->$loadcachename;
183
+                    $value = $loadcache[$newvalue];
184
+
185
+                    if (! empty($object->$loadviewname))
186
+                    {
187
+                        $loadview = $object->$loadviewname;
188
+                        $view = $loadview[$newvalue];
189
+                    }
190
+                }
191
+                else
192
+                {
193
+                    $error++;
194
+                    $return['error'] = $object->error;
195
+                }
196
+            }
197
+        }
198
+
199
+        if (! $error)
200
+        {
201
+            if ((isset($object) && ! is_object($object)) || empty($savemethod)) $object = new GenericObject($db);
202
+
203
+            // Specific for add_object_linked()
204
+            // TODO add a function for variable treatment
205
+            $object->ext_fk_element = $newvalue;
206
+            $object->ext_element = $ext_element;
207
+            $object->fk_element = $fk_element;
208
+            $object->element = $element;
209
+
210
+            $ret=$object->$savemethodname($field, $newvalue, $table_element, $fk_element, $format);
211
+            if ($ret > 0)
212
+            {
213
+                if ($type == 'numeric') $value = price($newvalue);
214
+                else if ($type == 'textarea') $value = dol_nl2br($newvalue);
215
+
216
+                $return['value'] = $value;
217
+                $return['view'] = (! empty($view) ? $view : $value);
218
+            }
219
+            else
220
+            {
221
+                $return['error'] = $object->error;
222
+            }
223
+        }
224
+
225
+        echo json_encode($return);
226
+    }
227
+    else
228
+    {
229
+        echo $langs->trans('NotEnoughPermissions');
230
+    }
231 231
 }
232 232
 
Please login to merge, or discard this patch.
Braces   +43 added lines, -30 removed lines patch added patch discarded remove patch
@@ -20,10 +20,19 @@  discard block
 block discarded – undo
20 20
  *       \brief      File to save field value
21 21
  */
22 22
 
23
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
24
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU','1');
25
-if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX','1');
26
-if (! defined('NOREQUIRESOC'))   define('NOREQUIRESOC','1');
23
+if (! defined('NOTOKENRENEWAL')) {
24
+    define('NOTOKENRENEWAL','1');
25
+}
26
+// Disables token renewal
27
+if (! defined('NOREQUIREMENU')) {
28
+    define('NOREQUIREMENU','1');
29
+}
30
+if (! defined('NOREQUIREAJAX')) {
31
+    define('NOREQUIREAJAX','1');
32
+}
33
+if (! defined('NOREQUIRESOC')) {
34
+    define('NOREQUIRESOC','1');
35
+}
27 36
 
28 37
 
29 38
 // Copyright (C) 2018 Alxarafe/Alixar  <[email protected]>
@@ -81,19 +90,23 @@  discard block
 block discarded – undo
81 90
 		$subelement = $regs[2];
82 91
 	}
83 92
 
84
-	if ($element == 'propal') $newelement = 'propale';
85
-	else if ($element == 'fichinter') $newelement = 'ficheinter';
86
-	else if ($element == 'product') $newelement = 'produit';
87
-	else if ($element == 'member') $newelement = 'adherent';
88
-	else if ($element == 'order_supplier') {
93
+	if ($element == 'propal') {
94
+	    $newelement = 'propale';
95
+	} else if ($element == 'fichinter') {
96
+	    $newelement = 'ficheinter';
97
+	} else if ($element == 'product') {
98
+	    $newelement = 'produit';
99
+	} else if ($element == 'member') {
100
+	    $newelement = 'adherent';
101
+	} else if ($element == 'order_supplier') {
89 102
 		$newelement = 'fournisseur';
90 103
 		$subelement = 'commande';
91
-	}
92
-	else if ($element == 'invoice_supplier') {
104
+	} else if ($element == 'invoice_supplier') {
93 105
 		$newelement = 'fournisseur';
94 106
 		$subelement = 'facture';
107
+	} else {
108
+	    $newelement = $element;
95 109
 	}
96
-	else $newelement = $element;
97 110
 
98 111
 	$_POST['action']='update';	// Hack so restrictarea will test permissions on write too
99 112
 	$feature = $newelement;
@@ -104,7 +117,9 @@  discard block
 block discarded – undo
104 117
 		$feature = 'commande';
105 118
 		$object_id = 0;
106 119
 	}
107
-	if ($feature == 'shipping') $feature = 'commande';
120
+	if ($feature == 'shipping') {
121
+	    $feature = 'commande';
122
+	}
108 123
 	if ($feature == 'payment') { $feature = 'facture'; }
109 124
 	if ($feature == 'payment_supplier') { $feature = 'fournisseur'; $feature2 = 'facture'; }
110 125
 	//var_dump(GETPOST('action','aZ09'));
@@ -133,14 +148,12 @@  discard block
 block discarded – undo
133 148
 				$error++;
134 149
 				$return['error'] = $langs->trans('ErrorBadValue');
135 150
 			}
136
-		}
137
-		else if ($type == 'datepicker')
151
+		} else if ($type == 'datepicker')
138 152
 		{
139 153
 			$timestamp	= GETPOST('timestamp','int',2);
140 154
 			$format		= 'date';
141 155
 			$newvalue	= ($timestamp / 1000);
142
-		}
143
-		else if ($type == 'select')
156
+		} else if ($type == 'select')
144 157
 		{
145 158
 			$loadmethodname	= 'load_cache_'.$loadmethod;
146 159
 			$loadcachename	= 'cache_'.$loadmethod;
@@ -160,14 +173,12 @@  discard block
 block discarded – undo
160 173
 						$loadview = $form->$loadviewname;
161 174
 						$view = $loadview[$newvalue];
162 175
 					}
163
-				}
164
-				else
176
+				} else
165 177
 				{
166 178
 					$error++;
167 179
 					$return['error'] = $form->error;
168 180
 				}
169
-			}
170
-			else
181
+			} else
171 182
 			{
172 183
 				$module = $subelement = $ext_element;
173 184
 				if (preg_match('/^([^_]+)_([^_]+)/i',$ext_element,$regs))
@@ -190,8 +201,7 @@  discard block
 block discarded – undo
190 201
 						$loadview = $object->$loadviewname;
191 202
 						$view = $loadview[$newvalue];
192 203
 					}
193
-				}
194
-				else
204
+				} else
195 205
 				{
196 206
 					$error++;
197 207
 					$return['error'] = $object->error;
@@ -201,7 +211,9 @@  discard block
 block discarded – undo
201 211
 
202 212
 		if (! $error)
203 213
 		{
204
-			if ((isset($object) && ! is_object($object)) || empty($savemethod)) $object = new GenericObject($db);
214
+			if ((isset($object) && ! is_object($object)) || empty($savemethod)) {
215
+			    $object = new GenericObject($db);
216
+			}
205 217
 
206 218
 			// Specific for add_object_linked()
207 219
 			// TODO add a function for variable treatment
@@ -213,21 +225,22 @@  discard block
 block discarded – undo
213 225
 			$ret=$object->$savemethodname($field, $newvalue, $table_element, $fk_element, $format);
214 226
 			if ($ret > 0)
215 227
 			{
216
-				if ($type == 'numeric') $value = price($newvalue);
217
-				else if ($type == 'textarea') $value = dol_nl2br($newvalue);
228
+				if ($type == 'numeric') {
229
+				    $value = price($newvalue);
230
+				} else if ($type == 'textarea') {
231
+				    $value = dol_nl2br($newvalue);
232
+				}
218 233
 
219 234
 				$return['value'] = $value;
220 235
 				$return['view'] = (! empty($view) ? $view : $value);
221
-			}
222
-			else
236
+			} else
223 237
 			{
224 238
 				$return['error'] = $object->error;
225 239
 			}
226 240
 		}
227 241
 
228 242
 		echo json_encode($return);
229
-	}
230
-	else
243
+	} else
231 244
 	{
232 245
 		echo $langs->trans('NotEnoughPermissions');
233 246
 	}
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -20,21 +20,21 @@  discard block
 block discarded – undo
20 20
  *       \brief      File to save field value
21 21
  */
22 22
 
23
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
24
-if (! defined('NOREQUIREMENU'))  define('NOREQUIREMENU','1');
25
-if (! defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX','1');
26
-if (! defined('NOREQUIRESOC'))   define('NOREQUIRESOC','1');
23
+if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal
24
+if (!defined('NOREQUIREMENU'))  define('NOREQUIREMENU', '1');
25
+if (!defined('NOREQUIREAJAX'))  define('NOREQUIREAJAX', '1');
26
+if (!defined('NOREQUIRESOC'))   define('NOREQUIRESOC', '1');
27 27
 
28 28
 
29 29
 // Copyright (C) 2018 Alxarafe/Alixar  <[email protected]>
30 30
 defined('BASE_PATH') or die('Single entry point through the index.php of the main folder');
31
-require DOL_BASE_PATH . '/main.inc.php';
31
+require DOL_BASE_PATH.'/main.inc.php';
32 32
 require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
33 33
 
34
-$field			= GETPOST('field','alpha',2);
35
-$element		= GETPOST('element','alpha',2);
36
-$table_element	= GETPOST('table_element','alpha',2);
37
-$fk_element		= GETPOST('fk_element','alpha',2);
34
+$field = GETPOST('field', 'alpha', 2);
35
+$element = GETPOST('element', 'alpha', 2);
36
+$table_element = GETPOST('table_element', 'alpha', 2);
37
+$fk_element = GETPOST('fk_element', 'alpha', 2);
38 38
 
39 39
 /* Example:
40 40
 field:editval_ref_customer (8 first chars will removed to know name of property)
@@ -59,23 +59,23 @@  discard block
 block discarded – undo
59 59
 //print_r($_POST);
60 60
 
61 61
 // Load original field value
62
-if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($fk_element))
62
+if (!empty($field) && !empty($element) && !empty($table_element) && !empty($fk_element))
63 63
 {
64
-	$ext_element		= GETPOST('ext_element','alpha',2);
64
+	$ext_element = GETPOST('ext_element', 'alpha', 2);
65 65
 	$field				= substr($field, 8); // remove prefix val_
66
-	$type				= GETPOST('type','alpha',2);
67
-	$value				= ($type == 'ckeditor' ? GETPOST('value','',2) : GETPOST('value','alpha',2));
68
-	$loadmethod			= GETPOST('loadmethod','alpha',2);
69
-	$savemethod			= GETPOST('savemethod','alpha',2);
70
-	$savemethodname		= (! empty($savemethod) ? $savemethod : 'setValueFrom');
66
+	$type = GETPOST('type', 'alpha', 2);
67
+	$value				= ($type == 'ckeditor' ? GETPOST('value', '', 2) : GETPOST('value', 'alpha', 2));
68
+	$loadmethod			= GETPOST('loadmethod', 'alpha', 2);
69
+	$savemethod			= GETPOST('savemethod', 'alpha', 2);
70
+	$savemethodname = (!empty($savemethod) ? $savemethod : 'setValueFrom');
71 71
 	$newelement			= $element;
72 72
 
73
-	$view='';
74
-	$format='text';
75
-	$return=array();
76
-	$error=0;
73
+	$view = '';
74
+	$format = 'text';
75
+	$return = array();
76
+	$error = 0;
77 77
 
78
-	if ($element != 'order_supplier' && $element != 'invoice_supplier' && preg_match('/^([^_]+)_([^_]+)/i',$element,$regs))
78
+	if ($element != 'order_supplier' && $element != 'invoice_supplier' && preg_match('/^([^_]+)_([^_]+)/i', $element, $regs))
79 79
 	{
80 80
 		$element = $regs[1];
81 81
 		$subelement = $regs[2];
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	}
96 96
 	else $newelement = $element;
97 97
 
98
-	$_POST['action']='update';	// Hack so restrictarea will test permissions on write too
98
+	$_POST['action'] = 'update'; // Hack so restrictarea will test permissions on write too
99 99
 	$feature = $newelement;
100 100
 	$feature2 = $subelement;
101 101
 	$object_id = $fk_element;
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 			$newvalue = price2num($newvalue);
129 129
 
130 130
 			// Check parameters
131
-			if (! is_numeric($newvalue))
131
+			if (!is_numeric($newvalue))
132 132
 			{
133 133
 				$error++;
134 134
 				$return['error'] = $langs->trans('ErrorBadValue');
@@ -136,15 +136,15 @@  discard block
 block discarded – undo
136 136
 		}
137 137
 		else if ($type == 'datepicker')
138 138
 		{
139
-			$timestamp	= GETPOST('timestamp','int',2);
140
-			$format		= 'date';
141
-			$newvalue	= ($timestamp / 1000);
139
+			$timestamp = GETPOST('timestamp', 'int', 2);
140
+			$format = 'date';
141
+			$newvalue = ($timestamp / 1000);
142 142
 		}
143 143
 		else if ($type == 'select')
144 144
 		{
145
-			$loadmethodname	= 'load_cache_'.$loadmethod;
146
-			$loadcachename	= 'cache_'.$loadmethod;
147
-			$loadviewname	= 'view_'.$loadmethod;
145
+			$loadmethodname = 'load_cache_'.$loadmethod;
146
+			$loadcachename = 'cache_'.$loadmethod;
147
+			$loadviewname = 'view_'.$loadmethod;
148 148
 
149 149
 			$form = new Form($db);
150 150
 			if (method_exists($form, $loadmethodname))
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 					$loadcache = $form->$loadcachename;
156 156
 					$value = $loadcache[$newvalue];
157 157
 
158
-					if (! empty($form->$loadviewname))
158
+					if (!empty($form->$loadviewname))
159 159
 					{
160 160
 						$loadview = $form->$loadviewname;
161 161
 						$view = $loadview[$newvalue];
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 			else
171 171
 			{
172 172
 				$module = $subelement = $ext_element;
173
-				if (preg_match('/^([^_]+)_([^_]+)/i',$ext_element,$regs))
173
+				if (preg_match('/^([^_]+)_([^_]+)/i', $ext_element, $regs))
174 174
 				{
175 175
 					$module = $regs[1];
176 176
 					$subelement = $regs[2];
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 					$loadcache = $object->$loadcachename;
186 186
 					$value = $loadcache[$newvalue];
187 187
 
188
-					if (! empty($object->$loadviewname))
188
+					if (!empty($object->$loadviewname))
189 189
 					{
190 190
 						$loadview = $object->$loadviewname;
191 191
 						$view = $loadview[$newvalue];
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
 			}
200 200
 		}
201 201
 
202
-		if (! $error)
202
+		if (!$error)
203 203
 		{
204
-			if ((isset($object) && ! is_object($object)) || empty($savemethod)) $object = new GenericObject($db);
204
+			if ((isset($object) && !is_object($object)) || empty($savemethod)) $object = new GenericObject($db);
205 205
 
206 206
 			// Specific for add_object_linked()
207 207
 			// TODO add a function for variable treatment
@@ -210,14 +210,14 @@  discard block
 block discarded – undo
210 210
 			$object->fk_element = $fk_element;
211 211
 			$object->element = $element;
212 212
 
213
-			$ret=$object->$savemethodname($field, $newvalue, $table_element, $fk_element, $format);
213
+			$ret = $object->$savemethodname($field, $newvalue, $table_element, $fk_element, $format);
214 214
 			if ($ret > 0)
215 215
 			{
216 216
 				if ($type == 'numeric') $value = price($newvalue);
217 217
 				else if ($type == 'textarea') $value = dol_nl2br($newvalue);
218 218
 
219 219
 				$return['value'] = $value;
220
-				$return['view'] = (! empty($view) ? $view : $value);
220
+				$return['view'] = (!empty($view) ? $view : $value);
221 221
 			}
222 222
 			else
223 223
 			{
Please login to merge, or discard this patch.