Passed
Pull Request — master (#2)
by
unknown
26:19
created
dolibarr/htdocs/core/tpl/resource_view.tpl.php 1 patch
Braces   +6 added lines, -8 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@  discard block
 block discarded – undo
22 22
     print '<div class="tagtd liste_titre" align="center">'.$langs->trans('Mandatory').'</div>';
23 23
     print '<div class="tagtd liste_titre"></div>';
24 24
     print '</form>';
25
-}
26
-else
25
+} else
27 26
 {
28 27
     print '<form class="tagtr liste_titre">';
29 28
     print '<div class="tagtd liste_titre">'.$langs->trans('Resource').'</div>';
@@ -60,12 +59,12 @@  discard block
 block discarded – undo
60 59
 			print '<div class="tagtd" align="center">'.$form->selectyesno('mandatory',$linked_resource['mandatory']?1:0,1).'</div>';
61 60
 			print '<div class="tagtd" align="right"><input type="submit" class="button" value="'.$langs->trans("Update").'"></div>';
62 61
 			print '</form>';
63
-		}
64
-		else
62
+		} else
65 63
 		{
66 64
 			$style='';
67
-			if ($linked_resource['rowid'] == GETPOST('lineid'))
68
-				$style='style="background: orange;"';
65
+			if ($linked_resource['rowid'] == GETPOST('lineid')) {
66
+							$style='style="background: orange;"';
67
+			}
69 68
 
70 69
 			print '<form class="tagtr oddeven" '.$style.'>';
71 70
 
@@ -98,8 +97,7 @@  discard block
 block discarded – undo
98 97
 			print '</form>';
99 98
 		}
100 99
 	}
101
-}
102
-else {
100
+} else {
103 101
 	print '<form class="tagtr oddeven">';
104 102
 	print '<div class="tagtd opacitymedium">'.$langs->trans('NoResourceLinked').'</div>';
105 103
 	print '<div class="tagtd opacitymedium"></div>';
Please login to merge, or discard this patch.
dolibarr/htdocs/core/tpl/commonfields_edit.tpl.php 1 patch
Braces   +28 added lines, -10 removed lines patch added patch discarded remove patch
@@ -27,7 +27,9 @@  discard block
 block discarded – undo
27 27
 	print "Error, template page can't be called as URL";
28 28
 	exit;
29 29
 }
30
-if (! is_object($form)) $form=new Form($db);
30
+if (! is_object($form)) {
31
+    $form=new Form($db);
32
+}
31 33
 
32 34
 ?>
33 35
 <!-- BEGIN PHP TEMPLATE commonfields_edit.tpl.php -->
@@ -38,22 +40,38 @@  discard block
 block discarded – undo
38 40
 foreach($object->fields as $key => $val)
39 41
 {
40 42
 	// Discard if extrafield is a hidden field on form
41
-	if (abs($val['visible']) != 1) continue;
43
+	if (abs($val['visible']) != 1) {
44
+	    continue;
45
+	}
42 46
 
43
-	if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) continue;	// We don't want this field
47
+	if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) {
48
+	    continue;
49
+	}
50
+	// We don't want this field
44 51
 
45 52
 	print '<tr><td';
46 53
 	print ' class="titlefieldcreate';
47
-	if ($val['notnull'] > 0) print ' fieldrequired';
48
-	if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop';
54
+	if ($val['notnull'] > 0) {
55
+	    print ' fieldrequired';
56
+	}
57
+	if ($val['type'] == 'text' || $val['type'] == 'html') {
58
+	    print ' tdtop';
59
+	}
49 60
 	print '">';
50
-	if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $val['help']);
51
-	else print $langs->trans($val['label']);
61
+	if (! empty($val['help'])) {
62
+	    print $form->textwithpicto($langs->trans($val['label']), $val['help']);
63
+	} else {
64
+	    print $langs->trans($val['label']);
65
+	}
52 66
 	print '</td>';
53 67
 	print '<td>';
54
-	if (in_array($val['type'], array('int', 'integer'))) $value = GETPOSTISSET($key)?GETPOST($key, 'int'):$object->$key;
55
-	elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOSTISSET($key)?GETPOST($key,'none'):$object->$key;
56
-	else $value = GETPOSTISSET($key)?GETPOST($key, 'alpha'):$object->$key;
68
+	if (in_array($val['type'], array('int', 'integer'))) {
69
+	    $value = GETPOSTISSET($key)?GETPOST($key, 'int'):$object->$key;
70
+	} elseif ($val['type'] == 'text' || $val['type'] == 'html') {
71
+	    $value = GETPOSTISSET($key)?GETPOST($key,'none'):$object->$key;
72
+	} else {
73
+	    $value = GETPOSTISSET($key)?GETPOST($key, 'alpha'):$object->$key;
74
+	}
57 75
 	//var_dump($val.' '.$key.' '.$value);
58 76
 	print $object->showInputField($val, $key, $value, '', '', '', 0);
59 77
 	print '</td>';
Please login to merge, or discard this patch.
dolibarr/htdocs/core/tpl/object_discounts.tpl.php 1 patch
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -42,13 +42,14 @@
 block discarded – undo
42 42
 {
43 43
 	$translationKey = (! empty($discount_type)) ? 'HasRelativeDiscountFromSupplier' : 'CompanyHasRelativeDiscount';
44 44
 	print $langs->trans($translationKey, $fixedDiscount).'.';
45
-}
46
-else
45
+} else
47 46
 {
48 47
 	$translationKey = (! empty($discount_type)) ? 'HasNoRelativeDiscountFromSupplier' : 'CompanyHasNoRelativeDiscount';
49 48
 	print $langs->trans($translationKey).'.';
50 49
 }
51
-if($isNewObject) print ' ('.$addrelativediscount.')';
50
+if($isNewObject) {
51
+    print ' ('.$addrelativediscount.')';
52
+}
52 53
 
53 54
 // Is there is commercial discount or down payment available ?
54 55
 if ($absolute_discount > 0) {
Please login to merge, or discard this patch.
dolibarr/htdocs/core/tpl/notes.tpl.php 1 patch
Braces   +18 added lines, -17 removed lines patch added patch discarded remove patch
@@ -41,8 +41,11 @@  discard block
 block discarded – undo
41 41
 	if (GETPOST('action','aZ09') == 'edit'.$note_public)
42 42
 	{
43 43
 		$value_public=dol_concatdesc($value_public, ($value_public?"\n":"")."-- ".$stringtoadd);
44
-		if (dol_textishtml($value_public)) $value_public.="<br>\n";
45
-		else $value_public.="\n";
44
+		if (dol_textishtml($value_public)) {
45
+		    $value_public.="<br>\n";
46
+		} else {
47
+		    $value_public.="\n";
48
+		}
46 49
 	}
47 50
 }
48 51
 if (! empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES))
@@ -51,27 +54,25 @@  discard block
 block discarded – undo
51 54
 	if (GETPOST('action','aZ09') == 'edit'.$note_private)
52 55
 	{
53 56
 		$value_private=dol_concatdesc($value_private, ($value_private?"\n":"")."-- ".$stringtoadd);
54
-		if (dol_textishtml($value_private)) $value_private.="<br>\n";
55
-		else $value_private.="\n";
57
+		if (dol_textishtml($value_private)) {
58
+		    $value_private.="<br>\n";
59
+		} else {
60
+		    $value_private.="\n";
61
+		}
56 62
 	}
57 63
 }
58 64
 
59 65
 // Special cases
60
-if ($module == 'propal')                 { $permission=$user->rights->propale->creer;}
61
-elseif ($module == 'supplier_proposal')  { $permission=$user->rights->supplier_proposal->creer;}
62
-elseif ($module == 'fichinter')          { $permission=$user->rights->ficheinter->creer;}
63
-elseif ($module == 'project')            { $permission=$user->rights->projet->creer;}
64
-elseif ($module == 'project_task')       { $permission=$user->rights->projet->creer;}
65
-elseif ($module == 'invoice_supplier')   { $permission=$user->rights->fournisseur->facture->creer;}
66
-elseif ($module == 'order_supplier')     { $permission=$user->rights->fournisseur->commande->creer;}
67
-elseif ($module == 'societe')     	 	 { $permission=$user->rights->societe->creer;}
68
-elseif ($module == 'contact')     		 { $permission=$user->rights->societe->creer;}
69
-elseif ($module == 'shipping')    		 { $permission=$user->rights->expedition->creer;}
70
-elseif ($module == 'product')    		 { $permission=$user->rights->produit->creer;}
66
+if ($module == 'propal')                 { $permission=$user->rights->propale->creer;} elseif ($module == 'supplier_proposal')  { $permission=$user->rights->supplier_proposal->creer;} elseif ($module == 'fichinter')          { $permission=$user->rights->ficheinter->creer;} elseif ($module == 'project')            { $permission=$user->rights->projet->creer;} elseif ($module == 'project_task')       { $permission=$user->rights->projet->creer;} elseif ($module == 'invoice_supplier')   { $permission=$user->rights->fournisseur->facture->creer;} elseif ($module == 'order_supplier')     { $permission=$user->rights->fournisseur->commande->creer;} elseif ($module == 'societe')     	 	 { $permission=$user->rights->societe->creer;} elseif ($module == 'contact')     		 { $permission=$user->rights->societe->creer;} elseif ($module == 'shipping')    		 { $permission=$user->rights->expedition->creer;} elseif ($module == 'product')    		 { $permission=$user->rights->produit->creer;}
71 67
 //else dol_print_error('','Bad value '.$module.' for param module');
72 68
 
73
-if (! empty($conf->fckeditor->enabled) && ! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata='ckeditor:dolibarr_notes:100%:200::1:12:95%';	// Rem: This var is for all notes, not only thirdparties note.
74
-else $typeofdata='textarea:12:95%';
69
+if (! empty($conf->fckeditor->enabled) && ! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) {
70
+    $typeofdata='ckeditor:dolibarr_notes:100%:200::1:12:95%';
71
+}
72
+// Rem: This var is for all notes, not only thirdparties note.
73
+else {
74
+    $typeofdata='textarea:12:95%';
75
+}
75 76
 
76 77
 print '<!-- BEGIN PHP TEMPLATE NOTES -->'."\n";
77 78
 print '<div class="tagtable border table-border centpercent">'."\n";
Please login to merge, or discard this patch.
dolibarr/htdocs/core/tpl/extrafields_list_search_param.tpl.php 1 patch
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,12 +8,16 @@
 block discarded – undo
8 8
 }
9 9
 
10 10
 // Loop to complete $param for extrafields
11
-if (! empty($search_array_options))	// $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ...
11
+if (! empty($search_array_options)) {
12
+    // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ...
12 13
 {
13 14
 foreach ($search_array_options as $key => $val)
14 15
 {
15 16
 	$crit=$val;
16
-	$tmpkey=preg_replace('/search_options_/','',$key);
17
-	if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
18 17
 }
18
+	$tmpkey=preg_replace('/search_options_/','',$key);
19
+	if ($val != '') {
20
+	    $param.='&search_options_'.$tmpkey.'='.urlencode($val);
21
+	}
22
+	}
19 23
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/tpl/extrafields_list_search_title.tpl.php 1 patch
Braces   +14 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,10 +7,13 @@  discard block
 block discarded – undo
7 7
 	exit;
8 8
 }
9 9
 
10
-if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey=$object->table_element;
10
+if (empty($extrafieldsobjectkey) && is_object($object)) {
11
+    $extrafieldsobjectkey=$object->table_element;
12
+}
11 13
 
12 14
 // Loop to show all columns of extrafields for the title line
13
-if (! empty($extrafieldsobjectkey))	// $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ...
15
+if (! empty($extrafieldsobjectkey)) {
16
+    // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ...
14 17
 {
15 18
 	if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label']))
16 19
 	{
@@ -19,10 +22,16 @@  discard block
 block discarded – undo
19 22
 			if (! empty($arrayfields["ef.".$key]['checked']))
20 23
 			{
21 24
 				$align=$extrafields->getAlignFlag($key);
25
+}
22 26
 				$sortonfield = "ef.".$key;
23
-				if (! empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) $sortonfield='';
24
-				if ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] == 'separate') print '<th class="liste_titre thseparator"></th>';
25
-				else print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n";
27
+				if (! empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) {
28
+				    $sortonfield='';
29
+				}
30
+				if ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] == 'separate') {
31
+				    print '<th class="liste_titre thseparator"></th>';
32
+				} else {
33
+				    print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n";
34
+				}
26 35
 			}
27 36
 		}
28 37
 	}
Please login to merge, or discard this patch.
dolibarr/htdocs/core/tpl/commonfields_add.tpl.php 1 patch
Braces   +20 added lines, -7 removed lines patch added patch discarded remove patch
@@ -38,15 +38,24 @@  discard block
 block discarded – undo
38 38
 foreach($object->fields as $key => $val)
39 39
 {
40 40
 	// Discard if extrafield is a hidden field on form
41
-	if (abs($val['visible']) != 1) continue;
41
+	if (abs($val['visible']) != 1) {
42
+	    continue;
43
+	}
42 44
 
43
-	if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) continue;	// We don't want this field
45
+	if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) {
46
+	    continue;
47
+	}
48
+	// We don't want this field
44 49
 
45 50
 	print '<tr id="field_'.$key.'">';
46 51
 	print '<td';
47 52
 	print ' class="titlefieldcreate';
48
-	if ($val['notnull'] > 0) print ' fieldrequired';
49
-	if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop';
53
+	if ($val['notnull'] > 0) {
54
+	    print ' fieldrequired';
55
+	}
56
+	if ($val['type'] == 'text' || $val['type'] == 'html') {
57
+	    print ' tdtop';
58
+	}
50 59
 	print '"';
51 60
 	print '>';
52 61
 	print $langs->trans($val['label']);
@@ -55,9 +64,13 @@  discard block
 block discarded – undo
55 64
     }
56 65
 	print '</td>';
57 66
 	print '<td>';
58
-	if (in_array($val['type'], array('int', 'integer'))) $value = GETPOST($key, 'int');
59
-	elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOST($key, 'none');
60
-	else $value = GETPOST($key, 'alpha');
67
+	if (in_array($val['type'], array('int', 'integer'))) {
68
+	    $value = GETPOST($key, 'int');
69
+	} elseif ($val['type'] == 'text' || $val['type'] == 'html') {
70
+	    $value = GETPOST($key, 'none');
71
+	} else {
72
+	    $value = GETPOST($key, 'alpha');
73
+	}
61 74
 	print $object->showInputField($val, $key, $value, '', '', '', 0);
62 75
 	print '</td>';
63 76
 	print '</tr>';
Please login to merge, or discard this patch.
dolibarr/htdocs/core/tpl/extrafields_view.tpl.php 1 patch
Braces   +77 added lines, -30 removed lines patch added patch discarded remove patch
@@ -31,19 +31,31 @@  discard block
 block discarded – undo
31 31
 	exit;
32 32
 }
33 33
 
34
-if (! is_object($form)) $form=new Form($db);
34
+if (! is_object($form)) {
35
+    $form=new Form($db);
36
+}
35 37
 
36 38
 
37 39
 ?>
38 40
 <!-- BEGIN PHP TEMPLATE extrafields_view.tpl.php -->
39 41
 <?php
40
-if (! is_array($parameters)) $parameters = array();
41
-if (! empty($cols)) $parameters['colspan'] = ' colspan="'.$cols.'"';
42
-if (! empty($cols)) $parameters['cols'] = $cols;
43
-if (! empty($object->fk_soc)) $parameters['socid'] = $object->fk_soc;
42
+if (! is_array($parameters)) {
43
+    $parameters = array();
44
+}
45
+if (! empty($cols)) {
46
+    $parameters['colspan'] = ' colspan="'.$cols.'"';
47
+}
48
+if (! empty($cols)) {
49
+    $parameters['cols'] = $cols;
50
+}
51
+if (! empty($object->fk_soc)) {
52
+    $parameters['socid'] = $object->fk_soc;
53
+}
44 54
 $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action);
45 55
 print $hookmanager->resPrint;
46
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
56
+if ($reshook < 0) {
57
+    setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
58
+}
47 59
 
48 60
 
49 61
 //var_dump($extrafields->attributes[$object->table_element]);
@@ -70,25 +82,34 @@  discard block
 block discarded – undo
70 82
 		}
71 83
 		//print $key.'-'.$enabled.'-'.$perms.'-'.$label.$_POST["options_" . $key].'<br>'."\n";
72 84
 
73
-		if (empty($enabled)) continue;	// 0 = Never visible field
74
-		if (abs($enabled) != 1 && abs($enabled) != 3) continue;  // <> -1 and <> 1 and <> 3 = not visible on forms, only on list
75
-		if (empty($perms)) continue;    // 0 = Not visible
85
+		if (empty($enabled)) {
86
+		    continue;
87
+		}
88
+		// 0 = Never visible field
89
+		if (abs($enabled) != 1 && abs($enabled) != 3) {
90
+		    continue;
91
+		}
92
+		// <> -1 and <> 1 and <> 3 = not visible on forms, only on list
93
+		if (empty($perms)) {
94
+		    continue;
95
+		}
96
+		// 0 = Not visible
76 97
 
77 98
 		// Load language if required
78
-		if (! empty($extrafields->attributes[$object->table_element]['langfile'][$key])) $langs->load($extrafields->attributes[$object->table_element]['langfile'][$key]);
99
+		if (! empty($extrafields->attributes[$object->table_element]['langfile'][$key])) {
100
+		    $langs->load($extrafields->attributes[$object->table_element]['langfile'][$key]);
101
+		}
79 102
 		if ($action == 'edit_extras')
80 103
 		{
81 104
 			$value = (isset($_POST["options_" . $key]) ? $_POST["options_" . $key] : $object->array_options["options_" . $key]);
82
-		}
83
-		else
105
+		} else
84 106
 		{
85 107
 			$value = $object->array_options["options_" . $key];
86 108
 		}
87 109
 		if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate')
88 110
 		{
89 111
 			print $extrafields->showSeparator($key, $object);
90
-		}
91
-		else
112
+		} else
92 113
 		{
93 114
 			print '<tr>';
94 115
 			print '<td class="titlefield">';
@@ -98,30 +119,53 @@  discard block
 block discarded – undo
98 119
 			print ' class="';
99 120
 			//var_dump($action);exit;
100 121
 
101
-			if ((! empty($action) && ($action == 'create' || $action == 'edit')) && ! empty($extrafields->attributes[$object->table_element]['required'][$key])) print ' fieldrequired';
122
+			if ((! empty($action) && ($action == 'create' || $action == 'edit')) && ! empty($extrafields->attributes[$object->table_element]['required'][$key])) {
123
+			    print ' fieldrequired';
124
+			}
102 125
 			print '">';
103
-			if (! empty($extrafields->attributes[$object->table_element]['help'][$key])) print $form->textwithpicto($langs->trans($label), $langs->trans($extrafields->attributes[$object->table_element]['help'][$key]));
104
-			else print $langs->trans($label);
126
+			if (! empty($extrafields->attributes[$object->table_element]['help'][$key])) {
127
+			    print $form->textwithpicto($langs->trans($label), $langs->trans($extrafields->attributes[$object->table_element]['help'][$key]));
128
+			} else {
129
+			    print $langs->trans($label);
130
+			}
105 131
 			print '</td>';
106 132
 
107 133
 			//TODO Improve element and rights detection
108 134
 			//var_dump($user->rights);
109 135
 			$permok=false;
110 136
 			$keyforperm=$object->element;
111
-			if ($object->element == 'fichinter') $keyforperm='ficheinter';
112
-			if (isset($user->rights->$keyforperm)) $permok=$user->rights->$keyforperm->creer||$user->rights->$keyforperm->create||$user->rights->$keyforperm->write;
113
-			if ($object->element=='order_supplier')   $permok=$user->rights->fournisseur->commande->creer;
114
-			if ($object->element=='invoice_supplier') $permok=$user->rights->fournisseur->facture->creer;
115
-			if ($object->element=='shipping')         $permok=$user->rights->expedition->creer;
116
-			if ($object->element=='delivery')         $permok=$user->rights->expedition->livraison->creer;
117
-			if ($object->element=='productlot')       $permok=$user->rights->stock->creer;
118
-			if ($object->element=='facturerec') 	  $permok=$user->rights->facture->creer;
137
+			if ($object->element == 'fichinter') {
138
+			    $keyforperm='ficheinter';
139
+			}
140
+			if (isset($user->rights->$keyforperm)) {
141
+			    $permok=$user->rights->$keyforperm->creer||$user->rights->$keyforperm->create||$user->rights->$keyforperm->write;
142
+			}
143
+			if ($object->element=='order_supplier') {
144
+			    $permok=$user->rights->fournisseur->commande->creer;
145
+			}
146
+			if ($object->element=='invoice_supplier') {
147
+			    $permok=$user->rights->fournisseur->facture->creer;
148
+			}
149
+			if ($object->element=='shipping') {
150
+			    $permok=$user->rights->expedition->creer;
151
+			}
152
+			if ($object->element=='delivery') {
153
+			    $permok=$user->rights->expedition->livraison->creer;
154
+			}
155
+			if ($object->element=='productlot') {
156
+			    $permok=$user->rights->stock->creer;
157
+			}
158
+			if ($object->element=='facturerec') {
159
+			    $permok=$user->rights->facture->creer;
160
+			}
119 161
 			if (($object->statut == 0 || ! empty($extrafields->attributes[$object->table_element]['alwayseditable'][$key]))
120 162
 				&& $permok && ($action != 'edit_extras' || GETPOST('attribute') != $key)
121 163
 			    && empty($extrafields->attributes[$object->table_element]['computed'][$key]))
122 164
 			{
123 165
 			    $fieldid='id';
124
-			    if ($object->table_element == 'societe') $fieldid='socid';
166
+			    if ($object->table_element == 'societe') {
167
+			        $fieldid='socid';
168
+			    }
125 169
 				print '<td align="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?'.$fieldid.'=' . $object->id . '&action=edit_extras&attribute=' . $key . '">' . img_edit().'</a></td>';
126 170
 			}
127 171
 			print '</tr></table>';
@@ -136,10 +180,12 @@  discard block
 block discarded – undo
136 180
 			{
137 181
 				$datenotinstring = $object->array_options['options_' . $key];
138 182
 				// print 'X'.$object->array_options['options_' . $key].'-'.$datenotinstring.'x';
139
-				if (! is_numeric($object->array_options['options_' . $key]))	// For backward compatibility
183
+				if (! is_numeric($object->array_options['options_' . $key])) {
184
+				    // For backward compatibility
140 185
 				{
141 186
 					$datenotinstring = $db->jdate($datenotinstring);
142 187
 				}
188
+				}
143 189
 				//print 'x'.$object->array_options['options_' . $key].'-'.$datenotinstring.' - '.dol_print_date($datenotinstring, 'dayhour');
144 190
 				$value = isset($_POST["options_" . $key]) ? dol_mktime($_POST["options_" . $key . "hour"], $_POST["options_" . $key . "min"], 0, $_POST["options_" . $key . "month"], $_POST["options_" . $key . "day"], $_POST["options_" . $key . "year"]) : $datenotinstring;
145 191
 			}
@@ -147,7 +193,9 @@  discard block
 block discarded – undo
147 193
 			if ($action == 'edit_extras' && $permok && GETPOST('attribute','none') == $key)
148 194
 			{
149 195
 			    $fieldid='id';
150
-			    if ($object->table_element == 'societe') $fieldid='socid';
196
+			    if ($object->table_element == 'societe') {
197
+			        $fieldid='socid';
198
+			    }
151 199
 			    print '<form enctype="multipart/form-data" action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formextra">';
152 200
 				print '<input type="hidden" name="action" value="update_extras">';
153 201
 				print '<input type="hidden" name="attribute" value="' . $key . '">';
@@ -159,8 +207,7 @@  discard block
 block discarded – undo
159 207
 				print '<input type="submit" class="button" value="' . dol_escape_htmltag($langs->trans('Modify')) . '">';
160 208
 
161 209
 				print '</form>';
162
-			}
163
-			else
210
+			} else
164 211
 			{
165 212
 				//print $key.'-'.$value.'-'.$object->table_element;
166 213
 				print $extrafields->showOutputField($key, $value, '', $object->table_element);
Please login to merge, or discard this patch.
dolibarr/htdocs/core/tpl/extrafields_list_search_sql.tpl.php 1 patch
Braces   +19 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,27 +7,39 @@
 block discarded – undo
7 7
 	exit;
8 8
 }
9 9
 
10
-if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey=$object->table_element;
10
+if (empty($extrafieldsobjectkey) && is_object($object)) {
11
+    $extrafieldsobjectkey=$object->table_element;
12
+}
11 13
 
12 14
 // Loop to complete the sql search criterias from extrafields
13
-if (! empty($extrafieldsobjectkey) && ! empty($search_array_options) && is_array($search_array_options))	// $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ...
15
+if (! empty($extrafieldsobjectkey) && ! empty($search_array_options) && is_array($search_array_options)) {
16
+    // $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ...
14 17
 {
15 18
 	foreach ($search_array_options as $key => $val)
16 19
 	{
17 20
 		$crit=$val;
21
+}
18 22
 		$tmpkey=preg_replace('/search_options_/','',$key);
19 23
 		$typ=$extrafields->attributes[$extrafieldsobjectkey]['type'][$tmpkey];
20 24
 
21 25
 		if ($crit != '' && in_array($typ, array('date', 'datetime', 'timestamp')))
22 26
 		{
23 27
 			$sql .= " AND ef.".$tmpkey." = '".$db->idate($crit)."'";
24
-		}
25
-		elseif ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1'))
28
+		} elseif ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1'))
26 29
 		{
27 30
 			$mode_search=0;
28
-			if (in_array($typ, array('int','double','real'))) $mode_search=1;								// Search on a numeric
29
-			if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2;	// Search on a foreign key int
30
-			if (in_array($typ, array('chkbxlst','checkbox'))) $mode_search=4;	                            // Search on a multiselect field with sql type = text
31
+			if (in_array($typ, array('int','double','real'))) {
32
+			    $mode_search=1;
33
+			}
34
+			// Search on a numeric
35
+			if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') {
36
+			    $mode_search=2;
37
+			}
38
+			// Search on a foreign key int
39
+			if (in_array($typ, array('chkbxlst','checkbox'))) {
40
+			    $mode_search=4;
41
+			}
42
+			// Search on a multiselect field with sql type = text
31 43
 
32 44
 			$sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search);
33 45
 		}
Please login to merge, or discard this patch.