Test Failed
Push — master ( e0c20c...b8c830 )
by Alxarafe
39:29
created
dolibarr/htdocs/societe/canvas/individual/tpl/card_view.tpl.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@
 block discarded – undo
18 18
 // Protection to avoid direct call of template
19 19
 if (empty($conf) || ! is_object($conf))
20 20
 {
21
-	print "Error, template page can't be called as URL";
22
-	exit;
21
+    print "Error, template page can't be called as URL";
22
+    exit;
23 23
 }
24 24
 
25 25
 
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  */
17 17
 
18 18
 // Protection to avoid direct call of template
19
-if (empty($conf) || ! is_object($conf))
19
+if (empty($conf) || !is_object($conf))
20 20
 {
21 21
 	print "Error, template page can't be called as URL";
22 22
 	exit;
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 
33 33
 $head = societe_prepare_head($object);
34 34
 
35
-dol_fiche_head($head, 'card', $langs->trans("ThirdParty"),0,'company');
35
+dol_fiche_head($head, 'card', $langs->trans("ThirdParty"), 0, 'company');
36 36
 
37 37
 ?>
38 38
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	<td colspan="3"><?php echo $this->control->tpl['showrefnav']; ?></td>
47 47
 </tr>
48 48
 
49
-<?php if (! empty($conf->global->SOCIETE_USEPREFIX)) { ?>
49
+<?php if (!empty($conf->global->SOCIETE_USEPREFIX)) { ?>
50 50
 <tr>
51 51
 	<td><?php echo $langs->trans('Prefix'); ?></td>
52 52
 	<td colspan="3"><?php echo $this->control->tpl['prefix_comm']; ?></td>
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 </tr>
76 76
 <?php } ?>
77 77
 
78
-<?php if (! empty($conf->barcode->enabled)) { ?>
78
+<?php if (!empty($conf->barcode->enabled)) { ?>
79 79
 <tr>
80 80
 	<td><?php echo $langs->trans('Gencod'); ?></td>
81 81
 	<td colspan="3"><?php echo $this->control->tpl['barcode']; ?></td>
@@ -123,14 +123,14 @@  discard block
 block discarded – undo
123 123
 	<td colspan="3"><?php echo $this->control->tpl['tva_assuj']; ?></td>
124 124
 </tr>
125 125
 
126
-<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?>
126
+<?php if (!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?>
127 127
 
128 128
 <tr>
129 129
 	<td><?php echo $langs->trans("Type"); ?></td>
130 130
 	<td colspan="3"><?php echo $this->control->tpl['typent']; ?></td>
131 131
 </tr>
132 132
 
133
-<?php if (! empty($conf->global->MAIN_MULTILANGS)) { ?>
133
+<?php if (!empty($conf->global->MAIN_MULTILANGS)) { ?>
134 134
 <tr>
135 135
 	<td><?php echo $langs->trans("DefaultLang"); ?></td>
136 136
 	<td colspan="3"><?php echo $this->control->tpl['default_lang']; ?></td>
@@ -170,10 +170,10 @@  discard block
 block discarded – undo
170 170
 		</tr>
171 171
 	</table>
172 172
 	</td>
173
-	<td colspan="3"><?php echo $this->control->tpl['sales_representatives'];	?></td>
173
+	<td colspan="3"><?php echo $this->control->tpl['sales_representatives']; ?></td>
174 174
 </tr>
175 175
 
176
-<?php if (! empty($conf->adherent->enabled)) { ?>
176
+<?php if (!empty($conf->adherent->enabled)) { ?>
177 177
 <tr>
178 178
 	<td width="25%" valign="top"><?php echo $langs->trans("LinkedToDolibarrMember"); ?></td>
179 179
 	<td colspan="3"><?php echo $this->control->tpl['linked_member']; ?></td>
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 <?php if ($user->rights->societe->supprimer) { ?>
193 193
 	<?php if ($conf->use_javascript_ajax) { ?>
194 194
 		<span id="action-delete" class="butActionDelete"><?php echo $langs->trans('Delete'); ?></span>
195
-	<?php }	else { ?>
195
+	<?php } else { ?>
196 196
 		<a class="butActionDelete" href="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->control->tpl['id'].'&amp;action=delete&amp;canvas='.$canvas; ?>"><?php echo $langs->trans('Delete'); ?></a>
197 197
 	<?php } ?>
198 198
 <?php } ?>
@@ -206,12 +206,12 @@  discard block
 block discarded – undo
206 206
 /*
207 207
  * Documents generes
208 208
  */
209
-$filedir=$conf->societe->multidir_output[$this->control->tpl['entity']].'/'.$socid;
210
-$urlsource=$_SERVER["PHP_SELF"]."?socid=".$socid;
211
-$genallowed=$user->rights->societe->lire;
212
-$delallowed=$user->rights->societe->creer;
209
+$filedir = $conf->societe->multidir_output[$this->control->tpl['entity']].'/'.$socid;
210
+$urlsource = $_SERVER["PHP_SELF"]."?socid=".$socid;
211
+$genallowed = $user->rights->societe->lire;
212
+$delallowed = $user->rights->societe->creer;
213 213
 
214
-print $formfile->showdocuments('company',$socid,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$objcanvas->control->object->default_lang);
214
+print $formfile->showdocuments('company', $socid, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $objcanvas->control->object->default_lang);
215 215
 ?>
216 216
 
217 217
 </td>
@@ -223,13 +223,13 @@  discard block
 block discarded – undo
223 223
 
224 224
 <?php
225 225
 // Subsidiaries list
226
-$result=show_subsidiaries($conf,$langs,$db,$object);
226
+$result = show_subsidiaries($conf, $langs, $db, $object);
227 227
 
228 228
 // Contacts list
229
-$result=show_contacts($conf,$langs,$db,$object);
229
+$result = show_contacts($conf, $langs, $db, $object);
230 230
 
231 231
 // Projects list
232
-$result=show_projects($conf,$langs,$db,$object);
232
+$result = show_projects($conf, $langs, $db, $object);
233 233
 ?>
234 234
 
235 235
 <!-- END PHP TEMPLATE -->
236 236
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +13 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,8 +36,14 @@  discard block
 block discarded – undo
36 36
 
37 37
 ?>
38 38
 
39
-<?php if ($this->control->tpl['error']) echo $this->control->tpl['error']; ?>
40
-<?php if ($this->control->tpl['action_delete']) echo $this->control->tpl['action_delete']; ?>
39
+<?php if ($this->control->tpl['error']) {
40
+    echo $this->control->tpl['error'];
41
+}
42
+?>
43
+<?php if ($this->control->tpl['action_delete']) {
44
+    echo $this->control->tpl['action_delete'];
45
+}
46
+?>
41 47
 
42 48
 <table class="border allwidth">
43 49
 
@@ -123,7 +129,10 @@  discard block
 block discarded – undo
123 129
 	<td colspan="3"><?php echo $this->control->tpl['tva_assuj']; ?></td>
124 130
 </tr>
125 131
 
126
-<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?>
132
+<?php if(!empty($this->control->tpl['localtax'])) {
133
+    echo $this->control->tpl['localtax'];
134
+}
135
+?>
127 136
 
128 137
 <tr>
129 138
 	<td><?php echo $langs->trans("Type"); ?></td>
@@ -192,7 +201,7 @@  discard block
 block discarded – undo
192 201
 <?php if ($user->rights->societe->supprimer) { ?>
193 202
 	<?php if ($conf->use_javascript_ajax) { ?>
194 203
 		<span id="action-delete" class="butActionDelete"><?php echo $langs->trans('Delete'); ?></span>
195
-	<?php }	else { ?>
204
+	<?php } else { ?>
196 205
 		<a class="butActionDelete" href="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->control->tpl['id'].'&amp;action=delete&amp;canvas='.$canvas; ?>"><?php echo $langs->trans('Delete'); ?></a>
197 206
 	<?php } ?>
198 207
 <?php } ?>
Please login to merge, or discard this patch.
dolibarr/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 // Protection to avoid direct call of template
20 20
 if (empty($conf) || ! is_object($conf))
21 21
 {
22
-	print "Error, template page can't be called as URL";
23
-	exit;
22
+    print "Error, template page can't be called as URL";
23
+    exit;
24 24
 }
25 25
 
26 26
 ?>
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 
109 109
 <?php
110 110
 if ($this->control->tpl['fournisseur']) {
111
-	if (count($this->control->tpl['suppliercategory']) > 0) { ?>
111
+    if (count($this->control->tpl['suppliercategory']) > 0) { ?>
112 112
 <tr>
113 113
 	<td><?php echo $langs->trans('SupplierCategory'); ?></td>
114 114
 	<td colspan="3"><?php echo $this->control->tpl['select_suppliercategory']; ?></td>
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  */
18 18
 
19 19
 // Protection to avoid direct call of template
20
-if (empty($conf) || ! is_object($conf))
20
+if (empty($conf) || !is_object($conf))
21 21
 {
22 22
 	print "Error, template page can't be called as URL";
23 23
 	exit;
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	<td colspan="3"><input type="text" size="40" maxlength="60" name="nom" value="<?php echo $this->control->tpl['nom']; ?>"></td>
51 51
 </tr>
52 52
 
53
-<?php if (! empty($conf->global->SOCIETE_USEPREFIX)) { ?>
53
+<?php if (!empty($conf->global->SOCIETE_USEPREFIX)) { ?>
54 54
 <tr>
55 55
 	<td><?php echo $langs->trans("Prefix"); ?></td>
56 56
 	<td colspan="3">
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 </tr>
116 116
 <?php } }?>
117 117
 
118
-<?php if (! empty($conf->barcode->enabled)) { ?>
118
+<?php if (!empty($conf->barcode->enabled)) { ?>
119 119
 <tr>
120 120
 	<td><?php echo $langs->trans('Gencod'); ?></td>
121 121
 	<td colspan="3"><input type="text" name="barcode" value="<?php echo $this->control->tpl['barcode']; ?>"></td>
@@ -152,13 +152,13 @@  discard block
 block discarded – undo
152 152
 </tr>
153 153
 
154 154
 <tr>
155
-	<td><?php echo $langs->trans('EMail').($conf->global->SOCIETE_EMAIL_MANDATORY?'*':''); ?></td>
155
+	<td><?php echo $langs->trans('EMail').($conf->global->SOCIETE_EMAIL_MANDATORY ? '*' : ''); ?></td>
156 156
 	<td><input type="text" name="email" size="32" value="<?php echo $this->control->tpl['email']; ?>"></td>
157 157
 	<td><?php echo $langs->trans('Web'); ?></td>
158 158
 	<td><input type="text" name="url" size="32" value="<?php echo $this->control->tpl['url']; ?>"></td>
159 159
 </tr>
160 160
 
161
-<?php if (! empty($conf->global->MAIN_MULTILANGS)) { ?>
161
+<?php if (!empty($conf->global->MAIN_MULTILANGS)) { ?>
162 162
 <tr>
163 163
 	<td><?php echo $langs->trans("DefaultLang"); ?></td>
164 164
 	<td colspan="3"><?php echo $this->control->tpl['select_lang']; ?></td>
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	<td colspan="3"><?php echo $this->control->tpl['yn_assujtva']; ?></td>
171 171
 </tr>
172 172
 
173
-<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?>
173
+<?php if (!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?>
174 174
 
175 175
 </table>
176 176
 <br>
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -170,7 +170,10 @@
 block discarded – undo
170 170
 	<td colspan="3"><?php echo $this->control->tpl['yn_assujtva']; ?></td>
171 171
 </tr>
172 172
 
173
-<?php if(!empty($this->control->tpl['localtax'])) echo $this->control->tpl['localtax']; ?>
173
+<?php if(!empty($this->control->tpl['localtax'])) {
174
+    echo $this->control->tpl['localtax'];
175
+}
176
+?>
174 177
 
175 178
 </table>
176 179
 <br>
Please login to merge, or discard this patch.
dolibarr/htdocs/societe/canvas/individual/actions_card_individual.class.php 3 patches
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -29,22 +29,22 @@  discard block
 block discarded – undo
29 29
 class ActionsCardIndividual extends ActionsCardCommon
30 30
 {
31 31
     /**
32
-	 *    Constructor
33
-	 *
32
+     *    Constructor
33
+     *
34 34
      *    @param	DoliDB	$db				Handler acces base de donnees
35 35
      *    @param	string	$dirmodule		Name of directory of module
36 36
      *    @param	string	$targetmodule	Name of directory of module where canvas is stored
37 37
      *    @param	string	$canvas			Name of canvas
38 38
      *    @param	string	$card			Name of tab (sub-canvas)
39 39
      */
40
-	function __construct($db, $dirmodule, $targetmodule, $canvas, $card)
41
-	{
42
-		$this->db				= $db;
43
-		$this->dirmodule		= $dirmodule;
44
-		$this->targetmodule		= $targetmodule;
40
+    function __construct($db, $dirmodule, $targetmodule, $canvas, $card)
41
+    {
42
+        $this->db				= $db;
43
+        $this->dirmodule		= $dirmodule;
44
+        $this->targetmodule		= $targetmodule;
45 45
         $this->canvas			= $canvas;
46 46
         $this->card				= $card;
47
-	}
47
+    }
48 48
 
49 49
 
50 50
     /**
@@ -67,73 +67,73 @@  discard block
 block discarded – undo
67 67
     }
68 68
 
69 69
 
70
-	/**
71
-	 * Execute actions
70
+    /**
71
+     * Execute actions
72 72
      * @deprecated Use the doActions of hooks instead of this.
73
-	 *
74
-	 * @param	string	$action	Action
75
-	 * @param	int		$id			Id of object (may be empty for creation)
76
-	 * @return	int					<0 if KO, >0 if OK
77
-	 */
78
-	function doActions(&$action, $id)
79
-	{
80
-		$ret = $this->getObject($id);
73
+     *
74
+     * @param	string	$action	Action
75
+     * @param	int		$id			Id of object (may be empty for creation)
76
+     * @return	int					<0 if KO, >0 if OK
77
+     */
78
+    function doActions(&$action, $id)
79
+    {
80
+        $ret = $this->getObject($id);
81 81
 
82
-		$return = parent::doActions($action);
82
+        $return = parent::doActions($action);
83 83
 
84
-		return $return;
85
-	}
84
+        return $return;
85
+    }
86 86
 
87 87
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
88
-	/**
89
-	 *    Assign custom values for canvas (for example into this->tpl to be used by templates)
90
-	 *
91
-	 *    @param	string	$action    Type of action
92
-	 *    @param	integer	$id			Id of object
93
-	 *    @param	string	$ref		Ref of object
94
-	 *    @return	void
95
-	 */
96
-	function assign_values(&$action, $id=0, $ref='')
97
-	{
88
+    /**
89
+     *    Assign custom values for canvas (for example into this->tpl to be used by templates)
90
+     *
91
+     *    @param	string	$action    Type of action
92
+     *    @param	integer	$id			Id of object
93
+     *    @param	string	$ref		Ref of object
94
+     *    @return	void
95
+     */
96
+    function assign_values(&$action, $id=0, $ref='')
97
+    {
98 98
         // phpcs:enable
99
-		global $conf, $langs;
100
-		global $form, $formcompany;
99
+        global $conf, $langs;
100
+        global $form, $formcompany;
101 101
 
102
-		$ret = $this->getObject($id,$ref);
102
+        $ret = $this->getObject($id,$ref);
103 103
 
104
-		parent::assign_values($action);
104
+        parent::assign_values($action);
105 105
 
106 106
         $this->tpl['title'] = load_fiche_titre($this->getTitle($action));
107 107
 
108
-		if ($action == 'create' || $action == 'edit')
109
-		{
110
-			$this->tpl['select_civility'] = $formcompany->select_civility(GETPOST('civility_id'));
111
-		}
112
-		else
113
-		{
114
-			// Confirm delete third party
115
-			if ($action == 'delete' || $conf->use_javascript_ajax)
116
-			{
117
-				$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->object->id,$langs->trans("DeleteAnIndividual"),$langs->trans("ConfirmDeleteIndividual"),"confirm_delete",'',0,"1,action-delete");
118
-			}
119
-		}
120
-	}
121
-
122
-	/**
123
-	 * 	Check permissions of a user to show a page and an object. Check read permission
124
-	 * 	If $_REQUEST['action'] defined, we also check write permission.
125
-	 *
126
-	 * 	@param      User	$user      	  	User to check
127
-	 * 	@param      string	$features	    Features to check (in most cases, it's module name)
128
-	 * 	@param      int		$objectid      	Object ID if we want to check permission on a particular record (optional)
129
-	 *  @param      string	$dbtablename    Table name where object is stored. Not used if objectid is null (optional)
130
-	 *  @param      string	$feature2		Feature to check (second level of permission)
131
-	 *  @param      string	$dbt_keyfield   Field name for socid foreign key if not fk_soc. (optional)
132
-	 *  @param      string	$dbt_select		Field name for select if not rowid. (optional)
133
-	 *  @return		int						1
134
-	 */
135
-	function restrictedArea($user, $features='societe', $objectid=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid')
136
-	{
137
-		return restrictedArea($user,$features,$objectid,$dbtablename,$feature2,$dbt_keyfield,$dbt_select);
138
-	}
108
+        if ($action == 'create' || $action == 'edit')
109
+        {
110
+            $this->tpl['select_civility'] = $formcompany->select_civility(GETPOST('civility_id'));
111
+        }
112
+        else
113
+        {
114
+            // Confirm delete third party
115
+            if ($action == 'delete' || $conf->use_javascript_ajax)
116
+            {
117
+                $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->object->id,$langs->trans("DeleteAnIndividual"),$langs->trans("ConfirmDeleteIndividual"),"confirm_delete",'',0,"1,action-delete");
118
+            }
119
+        }
120
+    }
121
+
122
+    /**
123
+     * 	Check permissions of a user to show a page and an object. Check read permission
124
+     * 	If $_REQUEST['action'] defined, we also check write permission.
125
+     *
126
+     * 	@param      User	$user      	  	User to check
127
+     * 	@param      string	$features	    Features to check (in most cases, it's module name)
128
+     * 	@param      int		$objectid      	Object ID if we want to check permission on a particular record (optional)
129
+     *  @param      string	$dbtablename    Table name where object is stored. Not used if objectid is null (optional)
130
+     *  @param      string	$feature2		Feature to check (second level of permission)
131
+     *  @param      string	$dbt_keyfield   Field name for socid foreign key if not fk_soc. (optional)
132
+     *  @param      string	$dbt_select		Field name for select if not rowid. (optional)
133
+     *  @return		int						1
134
+     */
135
+    function restrictedArea($user, $features='societe', $objectid=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid')
136
+    {
137
+        return restrictedArea($user,$features,$objectid,$dbtablename,$feature2,$dbt_keyfield,$dbt_select);
138
+    }
139 139
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -39,10 +39,10 @@  discard block
 block discarded – undo
39 39
      */
40 40
 	function __construct($db, $dirmodule, $targetmodule, $canvas, $card)
41 41
 	{
42
-		$this->db				= $db;
43
-		$this->dirmodule		= $dirmodule;
42
+		$this->db = $db;
43
+		$this->dirmodule = $dirmodule;
44 44
 		$this->targetmodule		= $targetmodule;
45
-        $this->canvas			= $canvas;
45
+        $this->canvas = $canvas;
46 46
         $this->card				= $card;
47 47
 	}
48 48
 
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
     {
58 58
         global $langs;
59 59
 
60
-        $out='';
60
+        $out = '';
61 61
 
62
-        if ($action == 'view')      $out.= $langs->trans("Individual");
63
-        if ($action == 'edit')      $out.= $langs->trans("EditCompany");
64
-        if ($action == 'create')    $out.= $langs->trans("NewCompany");
62
+        if ($action == 'view')      $out .= $langs->trans("Individual");
63
+        if ($action == 'edit')      $out .= $langs->trans("EditCompany");
64
+        if ($action == 'create')    $out .= $langs->trans("NewCompany");
65 65
 
66 66
         return $out;
67 67
     }
@@ -93,13 +93,13 @@  discard block
 block discarded – undo
93 93
 	 *    @param	string	$ref		Ref of object
94 94
 	 *    @return	void
95 95
 	 */
96
-	function assign_values(&$action, $id=0, $ref='')
96
+	function assign_values(&$action, $id = 0, $ref = '')
97 97
 	{
98 98
         // phpcs:enable
99 99
 		global $conf, $langs;
100 100
 		global $form, $formcompany;
101 101
 
102
-		$ret = $this->getObject($id,$ref);
102
+		$ret = $this->getObject($id, $ref);
103 103
 
104 104
 		parent::assign_values($action);
105 105
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 			// Confirm delete third party
115 115
 			if ($action == 'delete' || $conf->use_javascript_ajax)
116 116
 			{
117
-				$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->object->id,$langs->trans("DeleteAnIndividual"),$langs->trans("ConfirmDeleteIndividual"),"confirm_delete",'',0,"1,action-delete");
117
+				$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->object->id, $langs->trans("DeleteAnIndividual"), $langs->trans("ConfirmDeleteIndividual"), "confirm_delete", '', 0, "1,action-delete");
118 118
 			}
119 119
 		}
120 120
 	}
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 	 *  @param      string	$dbt_select		Field name for select if not rowid. (optional)
133 133
 	 *  @return		int						1
134 134
 	 */
135
-	function restrictedArea($user, $features='societe', $objectid=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid')
135
+	function restrictedArea($user, $features = 'societe', $objectid = 0, $dbtablename = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid')
136 136
 	{
137
-		return restrictedArea($user,$features,$objectid,$dbtablename,$feature2,$dbt_keyfield,$dbt_select);
137
+		return restrictedArea($user, $features, $objectid, $dbtablename, $feature2, $dbt_keyfield, $dbt_select);
138 138
 	}
139 139
 }
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -59,9 +59,15 @@  discard block
 block discarded – undo
59 59
 
60 60
         $out='';
61 61
 
62
-        if ($action == 'view')      $out.= $langs->trans("Individual");
63
-        if ($action == 'edit')      $out.= $langs->trans("EditCompany");
64
-        if ($action == 'create')    $out.= $langs->trans("NewCompany");
62
+        if ($action == 'view') {
63
+            $out.= $langs->trans("Individual");
64
+        }
65
+        if ($action == 'edit') {
66
+            $out.= $langs->trans("EditCompany");
67
+        }
68
+        if ($action == 'create') {
69
+            $out.= $langs->trans("NewCompany");
70
+        }
65 71
 
66 72
         return $out;
67 73
     }
@@ -108,8 +114,7 @@  discard block
 block discarded – undo
108 114
 		if ($action == 'create' || $action == 'edit')
109 115
 		{
110 116
 			$this->tpl['select_civility'] = $formcompany->select_civility(GETPOST('civility_id'));
111
-		}
112
-		else
117
+		} else
113 118
 		{
114 119
 			// Confirm delete third party
115 120
 			if ($action == 'delete' || $conf->use_javascript_ajax)
Please login to merge, or discard this patch.
dolibarr/htdocs/societe/ajaxcountries.php 3 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -52,27 +52,27 @@
 block discarded – undo
52 52
 // Generate list of countries
53 53
 if (! empty($country))
54 54
 {
55
-	global $langs;
56
-	$langs->load("dict");
55
+    global $langs;
56
+    $langs->load("dict");
57 57
 
58
-	$sql = "SELECT rowid, code, label, active";
59
-	$sql.= " FROM ".MAIN_DB_PREFIX."c_country";
60
-	$sql.= " WHERE active = 1 AND label LIKE '%" . $db->escape(utf8_decode($country)) . "%'";
61
-	$sql.= " ORDER BY label ASC";
58
+    $sql = "SELECT rowid, code, label, active";
59
+    $sql.= " FROM ".MAIN_DB_PREFIX."c_country";
60
+    $sql.= " WHERE active = 1 AND label LIKE '%" . $db->escape(utf8_decode($country)) . "%'";
61
+    $sql.= " ORDER BY label ASC";
62 62
 
63
-	$resql=$db->query($sql);
64
-	if ($resql)
65
-	{
66
-		print '<ul>';
67
-		while($country = $db->fetch_object($resql))
68
-		{
69
-			print '<li>';
70
-			// Si traduction existe, on l'utilise, sinon on prend le libellé par défaut
71
-			print ($country->code && $langs->trans("Country".$country->code)!="Country".$country->code?$langs->trans("Country".$country->code):($country->label!='-'?$country->label:'&nbsp;'));
72
-			print '<span class="informal" style="display:none">'.$country->rowid.'-idcache</span>';
73
-			print '</li>';
74
-		}
75
-		print '</ul>';
76
-	}
63
+    $resql=$db->query($sql);
64
+    if ($resql)
65
+    {
66
+        print '<ul>';
67
+        while($country = $db->fetch_object($resql))
68
+        {
69
+            print '<li>';
70
+            // Si traduction existe, on l'utilise, sinon on prend le libellé par défaut
71
+            print ($country->code && $langs->trans("Country".$country->code)!="Country".$country->code?$langs->trans("Country".$country->code):($country->label!='-'?$country->label:'&nbsp;'));
72
+            print '<span class="informal" style="display:none">'.$country->rowid.'-idcache</span>';
73
+            print '</li>';
74
+        }
75
+        print '</ul>';
76
+    }
77 77
 }
78 78
 
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -22,16 +22,16 @@  discard block
 block discarded – undo
22 22
  *       \brief      File to return Ajax response on country request
23 23
  */
24 24
 
25
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); // Disables 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('NOCSRFCHECK'))    define('NOCSRFCHECK','1');
25
+if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); // Disables 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('NOCSRFCHECK'))    define('NOCSRFCHECK', '1');
31 31
 
32 32
 require '../main.inc.php';
33 33
 
34
-$country=GETPOST('country', 'alpha');
34
+$country = GETPOST('country', 'alpha');
35 35
 
36 36
 
37 37
 /*
@@ -47,28 +47,28 @@  discard block
 block discarded – undo
47 47
 
48 48
 print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
49 49
 
50
-dol_syslog(join(',',$_POST));
50
+dol_syslog(join(',', $_POST));
51 51
 
52 52
 // Generate list of countries
53
-if (! empty($country))
53
+if (!empty($country))
54 54
 {
55 55
 	global $langs;
56 56
 	$langs->load("dict");
57 57
 
58 58
 	$sql = "SELECT rowid, code, label, active";
59
-	$sql.= " FROM ".MAIN_DB_PREFIX."c_country";
60
-	$sql.= " WHERE active = 1 AND label LIKE '%" . $db->escape(utf8_decode($country)) . "%'";
61
-	$sql.= " ORDER BY label ASC";
59
+	$sql .= " FROM ".MAIN_DB_PREFIX."c_country";
60
+	$sql .= " WHERE active = 1 AND label LIKE '%".$db->escape(utf8_decode($country))."%'";
61
+	$sql .= " ORDER BY label ASC";
62 62
 
63
-	$resql=$db->query($sql);
63
+	$resql = $db->query($sql);
64 64
 	if ($resql)
65 65
 	{
66 66
 		print '<ul>';
67
-		while($country = $db->fetch_object($resql))
67
+		while ($country = $db->fetch_object($resql))
68 68
 		{
69 69
 			print '<li>';
70 70
 			// Si traduction existe, on l'utilise, sinon on prend le libellé par défaut
71
-			print ($country->code && $langs->trans("Country".$country->code)!="Country".$country->code?$langs->trans("Country".$country->code):($country->label!='-'?$country->label:'&nbsp;'));
71
+			print ($country->code && $langs->trans("Country".$country->code) != "Country".$country->code ? $langs->trans("Country".$country->code) : ($country->label != '-' ? $country->label : '&nbsp;'));
72 72
 			print '<span class="informal" style="display:none">'.$country->rowid.'-idcache</span>';
73 73
 			print '</li>';
74 74
 		}
Please login to merge, or discard this patch.
Braces   +19 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,12 +22,25 @@
 block discarded – undo
22 22
  *       \brief      File to return Ajax response on country request
23 23
  */
24 24
 
25
-if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); // Disables 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('NOCSRFCHECK'))    define('NOCSRFCHECK','1');
25
+if (! defined('NOTOKENRENEWAL')) {
26
+    define('NOTOKENRENEWAL',1);
27
+}
28
+// Disables 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('NOCSRFCHECK')) {
42
+    define('NOCSRFCHECK','1');
43
+}
31 44
 
32 45
 require '../main.inc.php';
33 46
 
Please login to merge, or discard this patch.
dolibarr/htdocs/societe/website.php 3 patches
Indentation   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -72,36 +72,36 @@  discard block
 block discarded – undo
72 72
 $search=array();
73 73
 foreach($objectwebsiteaccount->fields as $key => $val)
74 74
 {
75
-	if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha');
75
+    if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha');
76 76
 }
77 77
 
78 78
 // List of fields to search into when doing a "search in all"
79 79
 $fieldstosearchall = array();
80 80
 foreach($objectwebsiteaccount->fields as $key => $val)
81 81
 {
82
-	if ($val['searchall']) $fieldstosearchall['t.'.$key]=$val['label'];
82
+    if ($val['searchall']) $fieldstosearchall['t.'.$key]=$val['label'];
83 83
 }
84 84
 
85 85
 // Definition of fields for list
86 86
 $arrayfields=array();
87 87
 foreach($objectwebsiteaccount->fields as $key => $val)
88 88
 {
89
-	// If $val['visible']==0, then we never show the field
90
-	if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled']);
89
+    // If $val['visible']==0, then we never show the field
90
+    if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled']);
91 91
 }
92 92
 
93 93
 // Extra fields
94 94
 if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
95 95
 {
96
-	foreach($extrafields->attribute_label as $key => $val)
97
-	{
98
-		if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
99
-	}
96
+    foreach($extrafields->attribute_label as $key => $val)
97
+    {
98
+        if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
99
+    }
100 100
 }
101 101
 
102 102
 if ($id > 0)
103 103
 {
104
-	$result = $object->fetch($id);
104
+    $result = $object->fetch($id);
105 105
 }
106 106
 
107 107
 
@@ -128,17 +128,17 @@  discard block
 block discarded – undo
128 128
     // Purge search criteria
129 129
     if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
130 130
     {
131
-    	foreach($objectwebsiteaccount->fields as $key => $val)
132
-    	{
133
-    		$search[$key]='';
134
-    	}
135
-    	$toselect='';
136
-    	$search_array_options=array();
131
+        foreach($objectwebsiteaccount->fields as $key => $val)
132
+        {
133
+            $search[$key]='';
134
+        }
135
+        $toselect='';
136
+        $search_array_options=array();
137 137
     }
138 138
     if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')
139
-    	|| GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha'))
139
+        || GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha'))
140 140
     {
141
-    	$massaction='';     // Protection to avoid mass action if we force a new search during a mass action confirmation
141
+        $massaction='';     // Protection to avoid mass action if we force a new search during a mass action confirmation
142 142
     }
143 143
 
144 144
     // Mass actions
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
172 172
 foreach($search as $key => $val)
173 173
 {
174
-	$param.= '&search_'.$key.'='.urlencode($search[$key]);
174
+    $param.= '&search_'.$key.'='.urlencode($search[$key]);
175 175
 }
176 176
 if ($optioncss != '')     $param.='&optioncss='.urlencode($optioncss);
177 177
 // Add $param from extra fields
@@ -194,25 +194,25 @@  discard block
 block discarded – undo
194 194
 // Prefix
195 195
 if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
196 196
 {
197
-	print '<tr><td class="titlefield">' . $langs->trans('Prefix') . '</td><td colspan="3">' . $object->prefix_comm . '</td></tr>';
197
+    print '<tr><td class="titlefield">' . $langs->trans('Prefix') . '</td><td colspan="3">' . $object->prefix_comm . '</td></tr>';
198 198
 }
199 199
 
200 200
 if ($object->client) {
201
-	print '<tr><td class="titlefield">';
202
-	print $langs->trans('CustomerCode') . '</td><td colspan="3">';
203
-	print $object->code_client;
204
-	if ($object->check_codeclient() != 0)
205
-		print ' <font class="error">(' . $langs->trans("WrongCustomerCode") . ')</font>';
206
-	print '</td></tr>';
201
+    print '<tr><td class="titlefield">';
202
+    print $langs->trans('CustomerCode') . '</td><td colspan="3">';
203
+    print $object->code_client;
204
+    if ($object->check_codeclient() != 0)
205
+        print ' <font class="error">(' . $langs->trans("WrongCustomerCode") . ')</font>';
206
+    print '</td></tr>';
207 207
 }
208 208
 
209 209
 if ($object->fournisseur) {
210
-	print '<tr><td class="titlefield">';
211
-	print $langs->trans('SupplierCode') . '</td><td colspan="3">';
212
-	print $object->code_fournisseur;
213
-	if ($object->check_codefournisseur() != 0)
214
-		print ' <font class="error">(' . $langs->trans("WrongSupplierCode") . ')</font>';
215
-	print '</td></tr>';
210
+    print '<tr><td class="titlefield">';
211
+    print $langs->trans('SupplierCode') . '</td><td colspan="3">';
212
+    print $object->code_fournisseur;
213
+    if ($object->check_codefournisseur() != 0)
214
+        print ' <font class="error">(' . $langs->trans("WrongSupplierCode") . ')</font>';
215
+    print '</td></tr>';
216 216
 }
217 217
 
218 218
 print '</table>';
@@ -223,15 +223,15 @@  discard block
 block discarded – undo
223 223
 
224 224
 $newcardbutton = '';
225 225
 if (! empty($conf->website->enabled)) {
226
-	if (! empty($user->rights->societe->lire)) {
227
-		$newcardbutton .= '<a class="butActionNew" href="' . DOL_URL_ROOT.'/website/websiteaccount_card.php?action=create&fk_soc='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'"><span class="valignmiddle">' . $langs->trans("AddWebsiteAccount").'</span>';
228
-		$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
229
-		$newcardbutton.= '</a>';
230
-	} else {
231
-		$newcardbutton .= '<a class="butActionNewRefused" href="#">' . $langs->trans("AddAction");
232
-		$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
233
-		$newcardbutton.= '</a>';
234
-	}
226
+    if (! empty($user->rights->societe->lire)) {
227
+        $newcardbutton .= '<a class="butActionNew" href="' . DOL_URL_ROOT.'/website/websiteaccount_card.php?action=create&fk_soc='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'"><span class="valignmiddle">' . $langs->trans("AddWebsiteAccount").'</span>';
228
+        $newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
229
+        $newcardbutton.= '</a>';
230
+    } else {
231
+        $newcardbutton .= '<a class="butActionNewRefused" href="#">' . $langs->trans("AddAction");
232
+        $newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
233
+        $newcardbutton.= '</a>';
234
+    }
235 235
 }
236 236
 
237 237
 print '<br>';
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 $sql = 'SELECT ';
244 244
 foreach($objectwebsiteaccount->fields as $key => $val)
245 245
 {
246
-	$sql.='t.'.$key.', ';
246
+    $sql.='t.'.$key.', ';
247 247
 }
248 248
 // Add fields from extrafields
249 249
 foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
@@ -259,8 +259,8 @@  discard block
 block discarded – undo
259 259
 $sql.=" AND fk_soc = ".$object->id;
260 260
 foreach($search as $key => $val)
261 261
 {
262
-	$mode_search=(($objectwebsiteaccount->isInt($objectwebsiteaccount->fields[$key]) || $objectwebsiteaccount->isFloat($objectwebsiteaccount->fields[$key]))?1:0);
263
-	if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'status')?2:$mode_search));
262
+    $mode_search=(($objectwebsiteaccount->isInt($objectwebsiteaccount->fields[$key]) || $objectwebsiteaccount->isFloat($objectwebsiteaccount->fields[$key]))?1:0);
263
+    if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'status')?2:$mode_search));
264 264
 }
265 265
 if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all);
266 266
 // Add where from extra fields
@@ -290,13 +290,13 @@  discard block
 block discarded – undo
290 290
 $nbtotalofrecords = '';
291 291
 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
292 292
 {
293
-	$result = $db->query($sql);
294
-	$nbtotalofrecords = $db->num_rows($result);
295
-	if (($page * $limit) > $nbtotalofrecords)	// if total resultset is smaller then paging size (filtering), goto and load page 0
296
-	{
297
-		$page = 0;
298
-		$offset = 0;
299
-	}
293
+    $result = $db->query($sql);
294
+    $nbtotalofrecords = $db->num_rows($result);
295
+    if (($page * $limit) > $nbtotalofrecords)	// if total resultset is smaller then paging size (filtering), goto and load page 0
296
+    {
297
+        $page = 0;
298
+        $offset = 0;
299
+    }
300 300
 }
301 301
 
302 302
 $sql.= $db->plimit($limit+1, $offset);
@@ -304,8 +304,8 @@  discard block
 block discarded – undo
304 304
 $resql=$db->query($sql);
305 305
 if (! $resql)
306 306
 {
307
-	dol_print_error($db);
308
-	exit;
307
+    dol_print_error($db);
308
+    exit;
309 309
 }
310 310
 
311 311
 $num = $db->num_rows($resql);
@@ -342,8 +342,8 @@  discard block
 block discarded – undo
342 342
 
343 343
 if ($sall)
344 344
 {
345
-	foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
346
-	print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>';
345
+    foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
346
+    print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>';
347 347
 }
348 348
 
349 349
 /*$moreforfilter = '';
@@ -358,9 +358,9 @@  discard block
 block discarded – undo
358 358
 
359 359
 if (! empty($moreforfilter))
360 360
 {
361
-	print '<div class="liste_titre liste_titre_bydiv centpercent">';
362
-	print $moreforfilter;
363
-	print '</div>';
361
+    print '<div class="liste_titre liste_titre_bydiv centpercent">';
362
+    print $moreforfilter;
363
+    print '</div>';
364 364
 }
365 365
 
366 366
 $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
@@ -376,11 +376,11 @@  discard block
 block discarded – undo
376 376
 print '<tr class="liste_titre">';
377 377
 foreach($objectwebsiteaccount->fields as $key => $val)
378 378
 {
379
-	$align='';
380
-	if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
381
-	if (in_array($val['type'], array('timestamp'))) $align.=' nowrap';
382
-	if ($key == 'status') $align.=($align?' ':'').'center';
383
-	if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
379
+    $align='';
380
+    if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
381
+    if (in_array($val['type'], array('timestamp'))) $align.=' nowrap';
382
+    if ($key == 'status') $align.=($align?' ':'').'center';
383
+    if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
384 384
 }
385 385
 // Extra fields
386 386
 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
@@ -401,11 +401,11 @@  discard block
 block discarded – undo
401 401
 print '<tr class="liste_titre">';
402 402
 foreach($objectwebsiteaccount->fields as $key => $val)
403 403
 {
404
-	$align='';
405
-	if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
406
-	if (in_array($val['type'], array('timestamp'))) $align.='nowrap';
407
-	if ($key == 'status') $align.=($align?' ':'').'center';
408
-	if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n";
404
+    $align='';
405
+    if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
406
+    if (in_array($val['type'], array('timestamp'))) $align.='nowrap';
407
+    if ($key == 'status') $align.=($align?' ':'').'center';
408
+    if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n";
409 409
 }
410 410
 // Extra fields
411 411
 // Extra fields
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 $needToFetchEachLine=0;
423 423
 foreach ($extrafields->attribute_computed as $key => $val)
424 424
 {
425
-	if (preg_match('/\$object/',$val)) $needToFetchEachLine++;  // There is at least one compute field that use $object
425
+    if (preg_match('/\$object/',$val)) $needToFetchEachLine++;  // There is at least one compute field that use $object
426 426
 }
427 427
 
428 428
 
@@ -432,90 +432,90 @@  discard block
 block discarded – undo
432 432
 $totalarray=array();
433 433
 while ($i < min($num, $limit))
434 434
 {
435
-	$obj = $db->fetch_object($resql);
436
-	if (empty($obj)) break;		// Should not happen
437
-
438
-	// Store properties in $object
439
-	$objectwebsiteaccount->id = $obj->rowid;
440
-	foreach($objectwebsiteaccount->fields as $key => $val)
441
-	{
442
-		if (isset($obj->$key)) $objectwebsiteaccount->$key = $obj->$key;
443
-	}
444
-
445
-	// Show here line of result
446
-	print '<tr class="oddeven">';
447
-	foreach($objectwebsiteaccount->fields as $key => $val)
448
-	{
449
-		$align='';
450
-		if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
451
-		if (in_array($val['type'], array('timestamp'))) $align.='nowrap';
452
-		if ($key == 'status') $align.=($align?' ':'').'center';
453
-		if (! empty($arrayfields['t.'.$key]['checked']))
454
-		{
455
-			print '<td';
456
-			if ($align) print ' class="'.$align.'"';
457
-			print '>';
458
-			if ($key == 'login') print $objectwebsiteaccount->getNomUrl(1, '', 0, '', 1);
459
-			else print $objectwebsiteaccount->showOutputField($val, $key, $obj->$key, '');
460
-			print '</td>';
461
-			if (! $i) $totalarray['nbfield']++;
462
-			if (! empty($val['isameasure']))
463
-			{
464
-				if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key;
465
-				$totalarray['val']['t.'.$key] += $obj->$key;
466
-			}
467
-		}
468
-	}
469
-	// Extra fields
470
-	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
471
-	// Fields from hook
472
-	$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
473
-	$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $objectwebsiteaccount);    // Note that $action and $object may have been modified by hook
474
-	print $hookmanager->resPrint;
475
-	// Action column
476
-	print '<td class="nowrap" align="center">';
477
-	if ($massactionbutton || $massaction)   // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
478
-	{
479
-		$selected=0;
480
-		if (in_array($obj->rowid, $arrayofselected)) $selected=1;
481
-		print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
482
-	}
483
-	print '</td>';
484
-	if (! $i) $totalarray['nbfield']++;
485
-
486
-	print '</tr>';
487
-
488
-	$i++;
435
+    $obj = $db->fetch_object($resql);
436
+    if (empty($obj)) break;		// Should not happen
437
+
438
+    // Store properties in $object
439
+    $objectwebsiteaccount->id = $obj->rowid;
440
+    foreach($objectwebsiteaccount->fields as $key => $val)
441
+    {
442
+        if (isset($obj->$key)) $objectwebsiteaccount->$key = $obj->$key;
443
+    }
444
+
445
+    // Show here line of result
446
+    print '<tr class="oddeven">';
447
+    foreach($objectwebsiteaccount->fields as $key => $val)
448
+    {
449
+        $align='';
450
+        if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
451
+        if (in_array($val['type'], array('timestamp'))) $align.='nowrap';
452
+        if ($key == 'status') $align.=($align?' ':'').'center';
453
+        if (! empty($arrayfields['t.'.$key]['checked']))
454
+        {
455
+            print '<td';
456
+            if ($align) print ' class="'.$align.'"';
457
+            print '>';
458
+            if ($key == 'login') print $objectwebsiteaccount->getNomUrl(1, '', 0, '', 1);
459
+            else print $objectwebsiteaccount->showOutputField($val, $key, $obj->$key, '');
460
+            print '</td>';
461
+            if (! $i) $totalarray['nbfield']++;
462
+            if (! empty($val['isameasure']))
463
+            {
464
+                if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key;
465
+                $totalarray['val']['t.'.$key] += $obj->$key;
466
+            }
467
+        }
468
+    }
469
+    // Extra fields
470
+    include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
471
+    // Fields from hook
472
+    $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
473
+    $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $objectwebsiteaccount);    // Note that $action and $object may have been modified by hook
474
+    print $hookmanager->resPrint;
475
+    // Action column
476
+    print '<td class="nowrap" align="center">';
477
+    if ($massactionbutton || $massaction)   // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
478
+    {
479
+        $selected=0;
480
+        if (in_array($obj->rowid, $arrayofselected)) $selected=1;
481
+        print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
482
+    }
483
+    print '</td>';
484
+    if (! $i) $totalarray['nbfield']++;
485
+
486
+    print '</tr>';
487
+
488
+    $i++;
489 489
 }
490 490
 
491 491
 // Show total line
492 492
 if (isset($totalarray['pos']))
493 493
 {
494
-	print '<tr class="liste_total">';
495
-	$i=0;
496
-	while ($i < $totalarray['nbfield'])
497
-	{
498
-		$i++;
499
-		if (! empty($totalarray['pos'][$i]))  print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
500
-		else
501
-		{
502
-			if ($i == 1)
503
-			{
504
-				if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
505
-				else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
506
-			}
507
-			else print '<td></td>';
508
-		}
509
-	}
510
-	print '</tr>';
494
+    print '<tr class="liste_total">';
495
+    $i=0;
496
+    while ($i < $totalarray['nbfield'])
497
+    {
498
+        $i++;
499
+        if (! empty($totalarray['pos'][$i]))  print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
500
+        else
501
+        {
502
+            if ($i == 1)
503
+            {
504
+                if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
505
+                else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
506
+            }
507
+            else print '<td></td>';
508
+        }
509
+    }
510
+    print '</tr>';
511 511
 }
512 512
 
513 513
 // If no record found
514 514
 if ($num == 0)
515 515
 {
516
-	$colspan=1;
517
-	foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
518
-	print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
516
+    $colspan=1;
517
+    foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
518
+    print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
519 519
 }
520 520
 
521 521
 
@@ -532,21 +532,21 @@  discard block
 block discarded – undo
532 532
 
533 533
 if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
534 534
 {
535
-	$hidegeneratedfilelistifempty=1;
536
-	if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
535
+    $hidegeneratedfilelistifempty=1;
536
+    if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
537 537
 
538
-	require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
539
-	$formfile = new FormFile($db);
538
+    require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
539
+    $formfile = new FormFile($db);
540 540
 
541
-	// Show list of available documents
542
-	$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
543
-	$urlsource.=str_replace('&amp;','&',$param);
541
+    // Show list of available documents
542
+    $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
543
+    $urlsource.=str_replace('&amp;','&',$param);
544 544
 
545
-	$filedir=$diroutputmassaction;
546
-	$genallowed=$user->rights->mymodule->read;
547
-	$delallowed=$user->rights->mymodule->create;
545
+    $filedir=$diroutputmassaction;
546
+    $genallowed=$user->rights->mymodule->read;
547
+    $delallowed=$user->rights->mymodule->create;
548 548
 
549
-	print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
549
+    print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
550 550
 }
551 551
 
552 552
 // End of page
Please login to merge, or discard this patch.
Spacing   +158 added lines, -158 removed lines patch added patch discarded remove patch
@@ -35,67 +35,67 @@  discard block
 block discarded – undo
35 35
 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
36 36
 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
37 37
 
38
-$langs->loadLangs(array("companies","website"));
38
+$langs->loadLangs(array("companies", "website"));
39 39
 
40
-$search_status=GETPOST('search_status');
40
+$search_status = GETPOST('search_status');
41 41
 
42 42
 // Security check
43
-$id = GETPOST('id','int')?GETPOST('id','int'):GETPOST('socid','int');
44
-if ($user->societe_id) $socid=$user->societe_id;
43
+$id = GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('socid', 'int');
44
+if ($user->societe_id) $socid = $user->societe_id;
45 45
 $result = restrictedArea($user, 'societe', $socid, '&societe');
46 46
 
47
-$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
48
-$sortfield = GETPOST("sortfield",'alpha');
49
-$sortorder = GETPOST("sortorder",'alpha');
50
-$page = GETPOST("page",'int');
47
+$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
48
+$sortfield = GETPOST("sortfield", 'alpha');
49
+$sortorder = GETPOST("sortorder", 'alpha');
50
+$page = GETPOST("page", 'int');
51 51
 if (empty($page) || $page == -1) { $page = 0; }     // If $page is not defined, or '' or -1
52 52
 $offset = $limit * $page;
53 53
 $pageprev = $page - 1;
54 54
 $pagenext = $page + 1;
55
-if (! $sortfield) $sortfield='t.login';
56
-if (! $sortorder) $sortorder='ASC';
55
+if (!$sortfield) $sortfield = 't.login';
56
+if (!$sortorder) $sortorder = 'ASC';
57 57
 
58 58
 // Initialize technical objects
59
-$object=new Societe($db);
60
-$objectwebsiteaccount=new SocieteAccount($db);
59
+$object = new Societe($db);
60
+$objectwebsiteaccount = new SocieteAccount($db);
61 61
 $extrafields = new ExtraFields($db);
62
-$diroutputmassaction=$conf->website->dir_output . '/temp/massgeneration/'.$user->id;
63
-$hookmanager->initHooks(array('websitethirdpartylist'));     // Note that conf->hooks_modules contains array
62
+$diroutputmassaction = $conf->website->dir_output.'/temp/massgeneration/'.$user->id;
63
+$hookmanager->initHooks(array('websitethirdpartylist')); // Note that conf->hooks_modules contains array
64 64
 // Fetch optionals attributes and labels
65 65
 $extralabels = $extrafields->fetch_name_optionals_label('thirdpartyaccount');
66
-$search_array_options=$extrafields->getOptionalsFromPost('thirdpartyaccount','','search_');
66
+$search_array_options = $extrafields->getOptionalsFromPost('thirdpartyaccount', '', 'search_');
67 67
 
68
-unset($objectwebsiteaccount->fields['fk_soc']);		// Remove this field, we are already on the thirdparty
68
+unset($objectwebsiteaccount->fields['fk_soc']); // Remove this field, we are already on the thirdparty
69 69
 
70 70
 // Initialize array of search criterias
71
-$search_all=trim(GETPOST("search_all",'alpha'));
72
-$search=array();
73
-foreach($objectwebsiteaccount->fields as $key => $val)
71
+$search_all = trim(GETPOST("search_all", 'alpha'));
72
+$search = array();
73
+foreach ($objectwebsiteaccount->fields as $key => $val)
74 74
 {
75
-	if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha');
75
+	if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
76 76
 }
77 77
 
78 78
 // List of fields to search into when doing a "search in all"
79 79
 $fieldstosearchall = array();
80
-foreach($objectwebsiteaccount->fields as $key => $val)
80
+foreach ($objectwebsiteaccount->fields as $key => $val)
81 81
 {
82
-	if ($val['searchall']) $fieldstosearchall['t.'.$key]=$val['label'];
82
+	if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label'];
83 83
 }
84 84
 
85 85
 // Definition of fields for list
86
-$arrayfields=array();
87
-foreach($objectwebsiteaccount->fields as $key => $val)
86
+$arrayfields = array();
87
+foreach ($objectwebsiteaccount->fields as $key => $val)
88 88
 {
89 89
 	// If $val['visible']==0, then we never show the field
90
-	if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled']);
90
+	if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>$val['enabled']);
91 91
 }
92 92
 
93 93
 // Extra fields
94 94
 if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
95 95
 {
96
-	foreach($extrafields->attribute_label as $key => $val)
96
+	foreach ($extrafields->attribute_label as $key => $val)
97 97
 	{
98
-		if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
98
+		if (!empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key] = array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key] < 0) ? 0 : 1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key]) != 3 && $extrafields->attribute_perms[$key]));
99 99
 	}
100 100
 }
101 101
 
@@ -109,14 +109,14 @@  discard block
 block discarded – undo
109 109
  *	Actions
110 110
  */
111 111
 
112
-$parameters=array('id'=>$socid);
113
-$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action);    // Note that $action and $object may have been modified by some hooks
112
+$parameters = array('id'=>$socid);
113
+$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
114 114
 if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
115 115
 
116 116
 if (empty($reshook))
117 117
 {
118 118
     // Cancel
119
-    if (GETPOST('cancel','alpha') && ! empty($backtopage))
119
+    if (GETPOST('cancel', 'alpha') && !empty($backtopage))
120 120
     {
121 121
         header("Location: ".$backtopage);
122 122
         exit;
@@ -126,24 +126,24 @@  discard block
 block discarded – undo
126 126
     include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
127 127
 
128 128
     // Purge search criteria
129
-    if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
129
+    if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
130 130
     {
131
-    	foreach($objectwebsiteaccount->fields as $key => $val)
131
+    	foreach ($objectwebsiteaccount->fields as $key => $val)
132 132
     	{
133
-    		$search[$key]='';
133
+    		$search[$key] = '';
134 134
     	}
135
-    	$toselect='';
136
-    	$search_array_options=array();
135
+    	$toselect = '';
136
+    	$search_array_options = array();
137 137
     }
138
-    if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')
139
-    	|| GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha'))
138
+    if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
139
+    	|| GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha'))
140 140
     {
141
-    	$massaction='';     // Protection to avoid mass action if we force a new search during a mass action confirmation
141
+    	$massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
142 142
     }
143 143
 
144 144
     // Mass actions
145
-    $objectclass='WebsiteAccount';
146
-    $objectlabel='WebsiteAccount';
145
+    $objectclass = 'WebsiteAccount';
146
+    $objectlabel = 'WebsiteAccount';
147 147
     $permtoread = $user->rights->societe->lire;
148 148
     $permtodelete = $user->rights->societe->supprimer;
149 149
     $uploaddir = $conf->societe->dir_output;
@@ -165,15 +165,15 @@  discard block
 block discarded – undo
165 165
 $title = $langs->trans("WebsiteAccounts");
166 166
 llxHeader('', $title);
167 167
 
168
-$param='';
169
-if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
170
-if ($id > 0) $param.='&id='.urlencode($id);
171
-if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
172
-foreach($search as $key => $val)
168
+$param = '';
169
+if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
170
+if ($id > 0) $param .= '&id='.urlencode($id);
171
+if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
172
+foreach ($search as $key => $val)
173 173
 {
174
-	$param.= '&search_'.$key.'='.urlencode($search[$key]);
174
+	$param .= '&search_'.$key.'='.urlencode($search[$key]);
175 175
 }
176
-if ($optioncss != '')     $param.='&optioncss='.urlencode($optioncss);
176
+if ($optioncss != '')     $param .= '&optioncss='.urlencode($optioncss);
177 177
 // Add $param from extra fields
178 178
 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
179 179
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
 dol_fiche_head($head, 'website', $langs->trans("ThirdParty"), - 1, 'company');
183 183
 
184
-$linkback = '<a href="' . DOL_URL_ROOT . '/societe/list.php?restore_lastsearch_values=1">' . $langs->trans("BackToList") . '</a>';
184
+$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
185 185
 
186 186
 dol_banner_tab($object, 'socid', $linkback, ($user->societe_id ? 0 : 1), 'rowid', 'nom');
187 187
 
@@ -192,26 +192,26 @@  discard block
 block discarded – undo
192 192
 print '<table class="border centpercent">';
193 193
 
194 194
 // Prefix
195
-if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
195
+if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
196 196
 {
197
-	print '<tr><td class="titlefield">' . $langs->trans('Prefix') . '</td><td colspan="3">' . $object->prefix_comm . '</td></tr>';
197
+	print '<tr><td class="titlefield">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
198 198
 }
199 199
 
200 200
 if ($object->client) {
201 201
 	print '<tr><td class="titlefield">';
202
-	print $langs->trans('CustomerCode') . '</td><td colspan="3">';
202
+	print $langs->trans('CustomerCode').'</td><td colspan="3">';
203 203
 	print $object->code_client;
204 204
 	if ($object->check_codeclient() != 0)
205
-		print ' <font class="error">(' . $langs->trans("WrongCustomerCode") . ')</font>';
205
+		print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
206 206
 	print '</td></tr>';
207 207
 }
208 208
 
209 209
 if ($object->fournisseur) {
210 210
 	print '<tr><td class="titlefield">';
211
-	print $langs->trans('SupplierCode') . '</td><td colspan="3">';
211
+	print $langs->trans('SupplierCode').'</td><td colspan="3">';
212 212
 	print $object->code_fournisseur;
213 213
 	if ($object->check_codefournisseur() != 0)
214
-		print ' <font class="error">(' . $langs->trans("WrongSupplierCode") . ')</font>';
214
+		print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
215 215
 	print '</td></tr>';
216 216
 }
217 217
 
@@ -222,15 +222,15 @@  discard block
 block discarded – undo
222 222
 dol_fiche_end();
223 223
 
224 224
 $newcardbutton = '';
225
-if (! empty($conf->website->enabled)) {
226
-	if (! empty($user->rights->societe->lire)) {
227
-		$newcardbutton .= '<a class="butActionNew" href="' . DOL_URL_ROOT.'/website/websiteaccount_card.php?action=create&fk_soc='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'"><span class="valignmiddle">' . $langs->trans("AddWebsiteAccount").'</span>';
228
-		$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
229
-		$newcardbutton.= '</a>';
225
+if (!empty($conf->website->enabled)) {
226
+	if (!empty($user->rights->societe->lire)) {
227
+		$newcardbutton .= '<a class="butActionNew" href="'.DOL_URL_ROOT.'/website/websiteaccount_card.php?action=create&fk_soc='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'"><span class="valignmiddle">'.$langs->trans("AddWebsiteAccount").'</span>';
228
+		$newcardbutton .= '<span class="fa fa-plus-circle valignmiddle"></span>';
229
+		$newcardbutton .= '</a>';
230 230
 	} else {
231
-		$newcardbutton .= '<a class="butActionNewRefused" href="#">' . $langs->trans("AddAction");
232
-		$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
233
-		$newcardbutton.= '</a>';
231
+		$newcardbutton .= '<a class="butActionNewRefused" href="#">'.$langs->trans("AddAction");
232
+		$newcardbutton .= '<span class="fa fa-plus-circle valignmiddle"></span>';
233
+		$newcardbutton .= '</a>';
234 234
 	}
235 235
 }
236 236
 
@@ -241,34 +241,34 @@  discard block
 block discarded – undo
241 241
 // Build and execute select
242 242
 // --------------------------------------------------------------------
243 243
 $sql = 'SELECT ';
244
-foreach($objectwebsiteaccount->fields as $key => $val)
244
+foreach ($objectwebsiteaccount->fields as $key => $val)
245 245
 {
246
-	$sql.='t.'.$key.', ';
246
+	$sql .= 't.'.$key.', ';
247 247
 }
248 248
 // Add fields from extrafields
249
-foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
249
+foreach ($extrafields->attribute_label as $key => $val) $sql .= ($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
250 250
 // Add fields from hooks
251
-$parameters=array();
252
-$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $objectwebsiteaccount);    // Note that $action and $object may have been modified by hook
253
-$sql.=$hookmanager->resPrint;
254
-$sql=preg_replace('/, $/','', $sql);
255
-$sql.= " FROM ".MAIN_DB_PREFIX."societe_account as t";
256
-if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_account_extrafields as ef on (t.rowid = ef.fk_object)";
257
-if ($objectwebsiteaccount->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity('societeaccount').")";
258
-else $sql.=" WHERE 1 = 1";
259
-$sql.=" AND fk_soc = ".$object->id;
260
-foreach($search as $key => $val)
251
+$parameters = array();
252
+$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook
253
+$sql .= $hookmanager->resPrint;
254
+$sql = preg_replace('/, $/', '', $sql);
255
+$sql .= " FROM ".MAIN_DB_PREFIX."societe_account as t";
256
+if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_account_extrafields as ef on (t.rowid = ef.fk_object)";
257
+if ($objectwebsiteaccount->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity('societeaccount').")";
258
+else $sql .= " WHERE 1 = 1";
259
+$sql .= " AND fk_soc = ".$object->id;
260
+foreach ($search as $key => $val)
261 261
 {
262
-	$mode_search=(($objectwebsiteaccount->isInt($objectwebsiteaccount->fields[$key]) || $objectwebsiteaccount->isFloat($objectwebsiteaccount->fields[$key]))?1:0);
263
-	if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'status')?2:$mode_search));
262
+	$mode_search = (($objectwebsiteaccount->isInt($objectwebsiteaccount->fields[$key]) || $objectwebsiteaccount->isFloat($objectwebsiteaccount->fields[$key])) ? 1 : 0);
263
+	if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
264 264
 }
265
-if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all);
265
+if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
266 266
 // Add where from extra fields
267 267
 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
268 268
 // Add where from hooks
269
-$parameters=array();
270
-$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters, $objectwebsiteaccount);    // Note that $action and $objectwebsiteaccount may have been modified by hook
271
-$sql.=$hookmanager->resPrint;
269
+$parameters = array();
270
+$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $objectwebsiteaccount); // Note that $action and $objectwebsiteaccount may have been modified by hook
271
+$sql .= $hookmanager->resPrint;
272 272
 
273 273
 /* If a group by is required
274 274
  $sql.= " GROUP BY "
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
  $sql.=$hookmanager->resPrint;
285 285
  */
286 286
 
287
-$sql.=$db->order($sortfield,$sortorder);
287
+$sql .= $db->order($sortfield, $sortorder);
288 288
 
289 289
 // Count total nb of records
290 290
 $nbtotalofrecords = '';
@@ -299,10 +299,10 @@  discard block
 block discarded – undo
299 299
 	}
300 300
 }
301 301
 
302
-$sql.= $db->plimit($limit+1, $offset);
302
+$sql .= $db->plimit($limit + 1, $offset);
303 303
 
304
-$resql=$db->query($sql);
305
-if (! $resql)
304
+$resql = $db->query($sql);
305
+if (!$resql)
306 306
 {
307 307
 	dol_print_error($db);
308 308
 	exit;
@@ -310,16 +310,16 @@  discard block
 block discarded – undo
310 310
 
311 311
 $num = $db->num_rows($resql);
312 312
 
313
-$arrayofselected=is_array($toselect)?$toselect:array();
313
+$arrayofselected = is_array($toselect) ? $toselect : array();
314 314
 
315 315
 // List of mass actions available
316
-$arrayofmassactions =  array(
316
+$arrayofmassactions = array(
317 317
 //'presend'=>$langs->trans("SendByMail"),
318 318
 //'builddoc'=>$langs->trans("PDFMerge"),
319 319
 );
320
-if ($user->rights->mymodule->delete) $arrayofmassactions['predelete']=$langs->trans("Delete");
321
-if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
322
-$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
320
+if ($user->rights->mymodule->delete) $arrayofmassactions['predelete'] = $langs->trans("Delete");
321
+if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
322
+$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
323 323
 
324 324
 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
325 325
 if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@@ -334,16 +334,16 @@  discard block
 block discarded – undo
334 334
 
335 335
 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, $newcardbutton, '', $limit);
336 336
 
337
-$topicmail="Information";
338
-$modelmail="societeaccount";
339
-$objecttmp=new SocieteAccount($db);
340
-$trackid='thi'.$object->id;
337
+$topicmail = "Information";
338
+$modelmail = "societeaccount";
339
+$objecttmp = new SocieteAccount($db);
340
+$trackid = 'thi'.$object->id;
341 341
 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
342 342
 
343 343
 if ($sall)
344 344
 {
345
-	foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
346
-	print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>';
345
+	foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
346
+	print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
347 347
 }
348 348
 
349 349
 /*$moreforfilter = '';
@@ -351,46 +351,46 @@  discard block
 block discarded – undo
351 351
 $moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
352 352
 $moreforfilter.= '</div>';*/
353 353
 
354
-$parameters=array();
355
-$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters, $objectwebsiteaccount);    // Note that $action and $objectwebsiteaccount may have been modified by hook
354
+$parameters = array();
355
+$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $objectwebsiteaccount); // Note that $action and $objectwebsiteaccount may have been modified by hook
356 356
 if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
357 357
 else $moreforfilter = $hookmanager->resPrint;
358 358
 
359
-if (! empty($moreforfilter))
359
+if (!empty($moreforfilter))
360 360
 {
361 361
 	print '<div class="liste_titre liste_titre_bydiv centpercent">';
362 362
 	print $moreforfilter;
363 363
 	print '</div>';
364 364
 }
365 365
 
366
-$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
367
-$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage);	// This also change content of $arrayfields
368
-$selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
366
+$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
367
+$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
368
+$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
369 369
 
370
-print '<div class="div-table-responsive">';		// You can use div-table-responsive-no-min if you dont need reserved height for your table
371
-print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
370
+print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
371
+print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
372 372
 
373 373
 
374 374
 // Fields title search
375 375
 // --------------------------------------------------------------------
376 376
 print '<tr class="liste_titre">';
377
-foreach($objectwebsiteaccount->fields as $key => $val)
377
+foreach ($objectwebsiteaccount->fields as $key => $val)
378 378
 {
379
-	$align='';
380
-	if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
381
-	if (in_array($val['type'], array('timestamp'))) $align.=' nowrap';
382
-	if ($key == 'status') $align.=($align?' ':'').'center';
383
-	if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
379
+	$align = '';
380
+	if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $align = 'center';
381
+	if (in_array($val['type'], array('timestamp'))) $align .= ' nowrap';
382
+	if ($key == 'status') $align .= ($align ? ' ' : '').'center';
383
+	if (!empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align ? ' '.$align : '').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
384 384
 }
385 385
 // Extra fields
386 386
 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
387 387
 // Fields from hook
388
-$parameters=array('arrayfields'=>$arrayfields);
389
-$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $objectwebsiteaccount);    // Note that $action and $object may have been modified by hook
388
+$parameters = array('arrayfields'=>$arrayfields);
389
+$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook
390 390
 print $hookmanager->resPrint;
391 391
 // Action column
392 392
 print '<td class="liste_titre" align="right">';
393
-$searchpicto=$form->showFilterButtons();
393
+$searchpicto = $form->showFilterButtons();
394 394
 print $searchpicto;
395 395
 print '</td>';
396 396
 print '</tr>'."\n";
@@ -399,58 +399,58 @@  discard block
 block discarded – undo
399 399
 // Fields title label
400 400
 // --------------------------------------------------------------------
401 401
 print '<tr class="liste_titre">';
402
-foreach($objectwebsiteaccount->fields as $key => $val)
402
+foreach ($objectwebsiteaccount->fields as $key => $val)
403 403
 {
404
-	$align='';
405
-	if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
406
-	if (in_array($val['type'], array('timestamp'))) $align.='nowrap';
407
-	if ($key == 'status') $align.=($align?' ':'').'center';
408
-	if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n";
404
+	$align = '';
405
+	if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $align = 'center';
406
+	if (in_array($val['type'], array('timestamp'))) $align .= 'nowrap';
407
+	if ($key == 'status') $align .= ($align ? ' ' : '').'center';
408
+	if (!empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align ? 'class="'.$align.'"' : ''), $sortfield, $sortorder, $align.' ')."\n";
409 409
 }
410 410
 // Extra fields
411 411
 // Extra fields
412 412
 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
413 413
 // Hook fields
414
-$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
415
-$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $objectwebsiteaccount);    // Note that $action and $object may have been modified by hook
414
+$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
415
+$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook
416 416
 print $hookmanager->resPrint;
417
-print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n";
417
+print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n";
418 418
 print '</tr>'."\n";
419 419
 
420 420
 
421 421
 // Detect if we need a fetch on each output line
422
-$needToFetchEachLine=0;
422
+$needToFetchEachLine = 0;
423 423
 foreach ($extrafields->attribute_computed as $key => $val)
424 424
 {
425
-	if (preg_match('/\$object/',$val)) $needToFetchEachLine++;  // There is at least one compute field that use $object
425
+	if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object
426 426
 }
427 427
 
428 428
 
429 429
 // Loop on record
430 430
 // --------------------------------------------------------------------
431
-$i=0;
432
-$totalarray=array();
431
+$i = 0;
432
+$totalarray = array();
433 433
 while ($i < min($num, $limit))
434 434
 {
435 435
 	$obj = $db->fetch_object($resql);
436
-	if (empty($obj)) break;		// Should not happen
436
+	if (empty($obj)) break; // Should not happen
437 437
 
438 438
 	// Store properties in $object
439 439
 	$objectwebsiteaccount->id = $obj->rowid;
440
-	foreach($objectwebsiteaccount->fields as $key => $val)
440
+	foreach ($objectwebsiteaccount->fields as $key => $val)
441 441
 	{
442 442
 		if (isset($obj->$key)) $objectwebsiteaccount->$key = $obj->$key;
443 443
 	}
444 444
 
445 445
 	// Show here line of result
446 446
 	print '<tr class="oddeven">';
447
-	foreach($objectwebsiteaccount->fields as $key => $val)
447
+	foreach ($objectwebsiteaccount->fields as $key => $val)
448 448
 	{
449
-		$align='';
450
-		if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
451
-		if (in_array($val['type'], array('timestamp'))) $align.='nowrap';
452
-		if ($key == 'status') $align.=($align?' ':'').'center';
453
-		if (! empty($arrayfields['t.'.$key]['checked']))
449
+		$align = '';
450
+		if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $align = 'center';
451
+		if (in_array($val['type'], array('timestamp'))) $align .= 'nowrap';
452
+		if ($key == 'status') $align .= ($align ? ' ' : '').'center';
453
+		if (!empty($arrayfields['t.'.$key]['checked']))
454 454
 		{
455 455
 			print '<td';
456 456
 			if ($align) print ' class="'.$align.'"';
@@ -458,10 +458,10 @@  discard block
 block discarded – undo
458 458
 			if ($key == 'login') print $objectwebsiteaccount->getNomUrl(1, '', 0, '', 1);
459 459
 			else print $objectwebsiteaccount->showOutputField($val, $key, $obj->$key, '');
460 460
 			print '</td>';
461
-			if (! $i) $totalarray['nbfield']++;
462
-			if (! empty($val['isameasure']))
461
+			if (!$i) $totalarray['nbfield']++;
462
+			if (!empty($val['isameasure']))
463 463
 			{
464
-				if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key;
464
+				if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
465 465
 				$totalarray['val']['t.'.$key] += $obj->$key;
466 466
 			}
467 467
 		}
@@ -469,19 +469,19 @@  discard block
 block discarded – undo
469 469
 	// Extra fields
470 470
 	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
471 471
 	// Fields from hook
472
-	$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
473
-	$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $objectwebsiteaccount);    // Note that $action and $object may have been modified by hook
472
+	$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
473
+	$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook
474 474
 	print $hookmanager->resPrint;
475 475
 	// Action column
476 476
 	print '<td class="nowrap" align="center">';
477 477
 	if ($massactionbutton || $massaction)   // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
478 478
 	{
479
-		$selected=0;
480
-		if (in_array($obj->rowid, $arrayofselected)) $selected=1;
481
-		print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
479
+		$selected = 0;
480
+		if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
481
+		print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
482 482
 	}
483 483
 	print '</td>';
484
-	if (! $i) $totalarray['nbfield']++;
484
+	if (!$i) $totalarray['nbfield']++;
485 485
 
486 486
 	print '</tr>';
487 487
 
@@ -492,11 +492,11 @@  discard block
 block discarded – undo
492 492
 if (isset($totalarray['pos']))
493 493
 {
494 494
 	print '<tr class="liste_total">';
495
-	$i=0;
495
+	$i = 0;
496 496
 	while ($i < $totalarray['nbfield'])
497 497
 	{
498 498
 		$i++;
499
-		if (! empty($totalarray['pos'][$i]))  print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
499
+		if (!empty($totalarray['pos'][$i]))  print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
500 500
 		else
501 501
 		{
502 502
 			if ($i == 1)
@@ -513,16 +513,16 @@  discard block
 block discarded – undo
513 513
 // If no record found
514 514
 if ($num == 0)
515 515
 {
516
-	$colspan=1;
517
-	foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
516
+	$colspan = 1;
517
+	foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
518 518
 	print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
519 519
 }
520 520
 
521 521
 
522 522
 $db->free($resql);
523 523
 
524
-$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
525
-$reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters, $objectwebsiteaccount);    // Note that $action and $object may have been modified by hook
524
+$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
525
+$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook
526 526
 print $hookmanager->resPrint;
527 527
 
528 528
 print '</table>'."\n";
@@ -530,23 +530,23 @@  discard block
 block discarded – undo
530 530
 
531 531
 print '</form>'."\n";
532 532
 
533
-if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
533
+if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
534 534
 {
535
-	$hidegeneratedfilelistifempty=1;
536
-	if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
535
+	$hidegeneratedfilelistifempty = 1;
536
+	if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0;
537 537
 
538 538
 	require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
539 539
 	$formfile = new FormFile($db);
540 540
 
541 541
 	// Show list of available documents
542
-	$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
543
-	$urlsource.=str_replace('&amp;','&',$param);
542
+	$urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
543
+	$urlsource .= str_replace('&amp;', '&', $param);
544 544
 
545
-	$filedir=$diroutputmassaction;
546
-	$genallowed=$user->rights->mymodule->read;
547
-	$delallowed=$user->rights->mymodule->create;
545
+	$filedir = $diroutputmassaction;
546
+	$genallowed = $user->rights->mymodule->read;
547
+	$delallowed = $user->rights->mymodule->create;
548 548
 
549
-	print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
549
+	print $formfile->showdocuments('massfilesarea_mymodule', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
550 550
 }
551 551
 
552 552
 // End of page
Please login to merge, or discard this patch.
Braces   +174 added lines, -65 removed lines patch added patch discarded remove patch
@@ -41,7 +41,9 @@  discard block
 block discarded – undo
41 41
 
42 42
 // Security check
43 43
 $id = GETPOST('id','int')?GETPOST('id','int'):GETPOST('socid','int');
44
-if ($user->societe_id) $socid=$user->societe_id;
44
+if ($user->societe_id) {
45
+    $socid=$user->societe_id;
46
+}
45 47
 $result = restrictedArea($user, 'societe', $socid, '&societe');
46 48
 
47 49
 $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
@@ -52,8 +54,12 @@  discard block
 block discarded – undo
52 54
 $offset = $limit * $page;
53 55
 $pageprev = $page - 1;
54 56
 $pagenext = $page + 1;
55
-if (! $sortfield) $sortfield='t.login';
56
-if (! $sortorder) $sortorder='ASC';
57
+if (! $sortfield) {
58
+    $sortfield='t.login';
59
+}
60
+if (! $sortorder) {
61
+    $sortorder='ASC';
62
+}
57 63
 
58 64
 // Initialize technical objects
59 65
 $object=new Societe($db);
@@ -72,30 +78,38 @@  discard block
 block discarded – undo
72 78
 $search=array();
73 79
 foreach($objectwebsiteaccount->fields as $key => $val)
74 80
 {
75
-	if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha');
76
-}
81
+	if (GETPOST('search_'.$key,'alpha')) {
82
+	    $search[$key]=GETPOST('search_'.$key,'alpha');
83
+	}
84
+	}
77 85
 
78 86
 // List of fields to search into when doing a "search in all"
79 87
 $fieldstosearchall = array();
80 88
 foreach($objectwebsiteaccount->fields as $key => $val)
81 89
 {
82
-	if ($val['searchall']) $fieldstosearchall['t.'.$key]=$val['label'];
83
-}
90
+	if ($val['searchall']) {
91
+	    $fieldstosearchall['t.'.$key]=$val['label'];
92
+	}
93
+	}
84 94
 
85 95
 // Definition of fields for list
86 96
 $arrayfields=array();
87 97
 foreach($objectwebsiteaccount->fields as $key => $val)
88 98
 {
89 99
 	// If $val['visible']==0, then we never show the field
90
-	if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled']);
91
-}
100
+	if (! empty($val['visible'])) {
101
+	    $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled']);
102
+	}
103
+	}
92 104
 
93 105
 // Extra fields
94 106
 if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
95 107
 {
96 108
 	foreach($extrafields->attribute_label as $key => $val)
97 109
 	{
98
-		if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
110
+		if (! empty($extrafields->attribute_list[$key])) {
111
+		    $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key]));
112
+		}
99 113
 	}
100 114
 }
101 115
 
@@ -111,7 +125,9 @@  discard block
 block discarded – undo
111 125
 
112 126
 $parameters=array('id'=>$socid);
113 127
 $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action);    // Note that $action and $object may have been modified by some hooks
114
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
128
+if ($reshook < 0) {
129
+    setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
130
+}
115 131
 
116 132
 if (empty($reshook))
117 133
 {
@@ -126,11 +142,13 @@  discard block
 block discarded – undo
126 142
     include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
127 143
 
128 144
     // Purge search criteria
129
-    if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
145
+    if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) {
146
+        // All tests are required to be compatible with all browsers
130 147
     {
131 148
     	foreach($objectwebsiteaccount->fields as $key => $val)
132 149
     	{
133 150
     		$search[$key]='';
151
+    }
134 152
     	}
135 153
     	$toselect='';
136 154
     	$search_array_options=array();
@@ -166,14 +184,22 @@  discard block
 block discarded – undo
166 184
 llxHeader('', $title);
167 185
 
168 186
 $param='';
169
-if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
170
-if ($id > 0) $param.='&id='.urlencode($id);
171
-if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
187
+if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
188
+    $param.='&contextpage='.urlencode($contextpage);
189
+}
190
+if ($id > 0) {
191
+    $param.='&id='.urlencode($id);
192
+}
193
+if ($limit > 0 && $limit != $conf->liste_limit) {
194
+    $param.='&limit='.urlencode($limit);
195
+}
172 196
 foreach($search as $key => $val)
173 197
 {
174 198
 	$param.= '&search_'.$key.'='.urlencode($search[$key]);
175 199
 }
176
-if ($optioncss != '')     $param.='&optioncss='.urlencode($optioncss);
200
+if ($optioncss != '') {
201
+    $param.='&optioncss='.urlencode($optioncss);
202
+}
177 203
 // Add $param from extra fields
178 204
 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
179 205
 
@@ -192,17 +218,20 @@  discard block
 block discarded – undo
192 218
 print '<table class="border centpercent">';
193 219
 
194 220
 // Prefix
195
-if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
221
+if (! empty($conf->global->SOCIETE_USEPREFIX)) {
222
+    // Old not used prefix field
196 223
 {
197 224
 	print '<tr><td class="titlefield">' . $langs->trans('Prefix') . '</td><td colspan="3">' . $object->prefix_comm . '</td></tr>';
198 225
 }
226
+}
199 227
 
200 228
 if ($object->client) {
201 229
 	print '<tr><td class="titlefield">';
202 230
 	print $langs->trans('CustomerCode') . '</td><td colspan="3">';
203 231
 	print $object->code_client;
204
-	if ($object->check_codeclient() != 0)
205
-		print ' <font class="error">(' . $langs->trans("WrongCustomerCode") . ')</font>';
232
+	if ($object->check_codeclient() != 0) {
233
+			print ' <font class="error">(' . $langs->trans("WrongCustomerCode") . ')</font>';
234
+	}
206 235
 	print '</td></tr>';
207 236
 }
208 237
 
@@ -210,8 +239,9 @@  discard block
 block discarded – undo
210 239
 	print '<tr><td class="titlefield">';
211 240
 	print $langs->trans('SupplierCode') . '</td><td colspan="3">';
212 241
 	print $object->code_fournisseur;
213
-	if ($object->check_codefournisseur() != 0)
214
-		print ' <font class="error">(' . $langs->trans("WrongSupplierCode") . ')</font>';
242
+	if ($object->check_codefournisseur() != 0) {
243
+			print ' <font class="error">(' . $langs->trans("WrongSupplierCode") . ')</font>';
244
+	}
215 245
 	print '</td></tr>';
216 246
 }
217 247
 
@@ -246,23 +276,34 @@  discard block
 block discarded – undo
246 276
 	$sql.='t.'.$key.', ';
247 277
 }
248 278
 // Add fields from extrafields
249
-foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
279
+foreach ($extrafields->attribute_label as $key => $val) {
280
+    $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
281
+}
250 282
 // Add fields from hooks
251 283
 $parameters=array();
252 284
 $reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $objectwebsiteaccount);    // Note that $action and $object may have been modified by hook
253 285
 $sql.=$hookmanager->resPrint;
254 286
 $sql=preg_replace('/, $/','', $sql);
255 287
 $sql.= " FROM ".MAIN_DB_PREFIX."societe_account as t";
256
-if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_account_extrafields as ef on (t.rowid = ef.fk_object)";
257
-if ($objectwebsiteaccount->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity('societeaccount').")";
258
-else $sql.=" WHERE 1 = 1";
288
+if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) {
289
+    $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_account_extrafields as ef on (t.rowid = ef.fk_object)";
290
+}
291
+if ($objectwebsiteaccount->ismultientitymanaged == 1) {
292
+    $sql.= " WHERE t.entity IN (".getEntity('societeaccount').")";
293
+} else {
294
+    $sql.=" WHERE 1 = 1";
295
+}
259 296
 $sql.=" AND fk_soc = ".$object->id;
260 297
 foreach($search as $key => $val)
261 298
 {
262 299
 	$mode_search=(($objectwebsiteaccount->isInt($objectwebsiteaccount->fields[$key]) || $objectwebsiteaccount->isFloat($objectwebsiteaccount->fields[$key]))?1:0);
263
-	if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'status')?2:$mode_search));
300
+	if ($search[$key] != '') {
301
+	    $sql.=natural_search($key, $search[$key], (($key == 'status')?2:$mode_search));
302
+	}
303
+	}
304
+if ($search_all) {
305
+    $sql.= natural_search(array_keys($fieldstosearchall), $search_all);
264 306
 }
265
-if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all);
266 307
 // Add where from extra fields
267 308
 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
268 309
 // Add where from hooks
@@ -292,9 +333,11 @@  discard block
 block discarded – undo
292 333
 {
293 334
 	$result = $db->query($sql);
294 335
 	$nbtotalofrecords = $db->num_rows($result);
295
-	if (($page * $limit) > $nbtotalofrecords)	// if total resultset is smaller then paging size (filtering), goto and load page 0
336
+	if (($page * $limit) > $nbtotalofrecords) {
337
+	    // if total resultset is smaller then paging size (filtering), goto and load page 0
296 338
 	{
297 339
 		$page = 0;
340
+	}
298 341
 		$offset = 0;
299 342
 	}
300 343
 }
@@ -317,12 +360,18 @@  discard block
 block discarded – undo
317 360
 //'presend'=>$langs->trans("SendByMail"),
318 361
 //'builddoc'=>$langs->trans("PDFMerge"),
319 362
 );
320
-if ($user->rights->mymodule->delete) $arrayofmassactions['predelete']=$langs->trans("Delete");
321
-if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
363
+if ($user->rights->mymodule->delete) {
364
+    $arrayofmassactions['predelete']=$langs->trans("Delete");
365
+}
366
+if (in_array($massaction, array('presend','predelete'))) {
367
+    $arrayofmassactions=array();
368
+}
322 369
 $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
323 370
 
324 371
 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
325
-if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
372
+if ($optioncss != '') {
373
+    print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
374
+}
326 375
 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
327 376
 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
328 377
 print '<input type="hidden" name="action" value="list">';
@@ -342,7 +391,9 @@  discard block
 block discarded – undo
342 391
 
343 392
 if ($sall)
344 393
 {
345
-	foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
394
+	foreach($fieldstosearchall as $key => $val) {
395
+	    $fieldstosearchall[$key]=$langs->trans($val);
396
+	}
346 397
 	print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>';
347 398
 }
348 399
 
@@ -353,8 +404,11 @@  discard block
 block discarded – undo
353 404
 
354 405
 $parameters=array();
355 406
 $reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters, $objectwebsiteaccount);    // Note that $action and $objectwebsiteaccount may have been modified by hook
356
-if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
357
-else $moreforfilter = $hookmanager->resPrint;
407
+if (empty($reshook)) {
408
+    $moreforfilter .= $hookmanager->resPrint;
409
+} else {
410
+    $moreforfilter = $hookmanager->resPrint;
411
+}
358 412
 
359 413
 if (! empty($moreforfilter))
360 414
 {
@@ -377,11 +431,19 @@  discard block
 block discarded – undo
377 431
 foreach($objectwebsiteaccount->fields as $key => $val)
378 432
 {
379 433
 	$align='';
380
-	if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
381
-	if (in_array($val['type'], array('timestamp'))) $align.=' nowrap';
382
-	if ($key == 'status') $align.=($align?' ':'').'center';
383
-	if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
384
-}
434
+	if (in_array($val['type'], array('date','datetime','timestamp'))) {
435
+	    $align='center';
436
+	}
437
+	if (in_array($val['type'], array('timestamp'))) {
438
+	    $align.=' nowrap';
439
+	}
440
+	if ($key == 'status') {
441
+	    $align.=($align?' ':'').'center';
442
+	}
443
+	if (! empty($arrayfields['t.'.$key]['checked'])) {
444
+	    print '<td class="liste_titre'.($align?' '.$align:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
445
+	}
446
+	}
385 447
 // Extra fields
386 448
 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
387 449
 // Fields from hook
@@ -402,11 +464,19 @@  discard block
 block discarded – undo
402 464
 foreach($objectwebsiteaccount->fields as $key => $val)
403 465
 {
404 466
 	$align='';
405
-	if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
406
-	if (in_array($val['type'], array('timestamp'))) $align.='nowrap';
407
-	if ($key == 'status') $align.=($align?' ':'').'center';
408
-	if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n";
409
-}
467
+	if (in_array($val['type'], array('date','datetime','timestamp'))) {
468
+	    $align='center';
469
+	}
470
+	if (in_array($val['type'], array('timestamp'))) {
471
+	    $align.='nowrap';
472
+	}
473
+	if ($key == 'status') {
474
+	    $align.=($align?' ':'').'center';
475
+	}
476
+	if (! empty($arrayfields['t.'.$key]['checked'])) {
477
+	    print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n";
478
+	}
479
+	}
410 480
 // Extra fields
411 481
 // Extra fields
412 482
 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
@@ -422,7 +492,10 @@  discard block
 block discarded – undo
422 492
 $needToFetchEachLine=0;
423 493
 foreach ($extrafields->attribute_computed as $key => $val)
424 494
 {
425
-	if (preg_match('/\$object/',$val)) $needToFetchEachLine++;  // There is at least one compute field that use $object
495
+	if (preg_match('/\$object/',$val)) {
496
+	    $needToFetchEachLine++;
497
+	}
498
+	// There is at least one compute field that use $object
426 499
 }
427 500
 
428 501
 
@@ -433,13 +506,18 @@  discard block
 block discarded – undo
433 506
 while ($i < min($num, $limit))
434 507
 {
435 508
 	$obj = $db->fetch_object($resql);
436
-	if (empty($obj)) break;		// Should not happen
509
+	if (empty($obj)) {
510
+	    break;
511
+	}
512
+	// Should not happen
437 513
 
438 514
 	// Store properties in $object
439 515
 	$objectwebsiteaccount->id = $obj->rowid;
440 516
 	foreach($objectwebsiteaccount->fields as $key => $val)
441 517
 	{
442
-		if (isset($obj->$key)) $objectwebsiteaccount->$key = $obj->$key;
518
+		if (isset($obj->$key)) {
519
+		    $objectwebsiteaccount->$key = $obj->$key;
520
+		}
443 521
 	}
444 522
 
445 523
 	// Show here line of result
@@ -447,21 +525,36 @@  discard block
 block discarded – undo
447 525
 	foreach($objectwebsiteaccount->fields as $key => $val)
448 526
 	{
449 527
 		$align='';
450
-		if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center';
451
-		if (in_array($val['type'], array('timestamp'))) $align.='nowrap';
452
-		if ($key == 'status') $align.=($align?' ':'').'center';
528
+		if (in_array($val['type'], array('date','datetime','timestamp'))) {
529
+		    $align='center';
530
+		}
531
+		if (in_array($val['type'], array('timestamp'))) {
532
+		    $align.='nowrap';
533
+		}
534
+		if ($key == 'status') {
535
+		    $align.=($align?' ':'').'center';
536
+		}
453 537
 		if (! empty($arrayfields['t.'.$key]['checked']))
454 538
 		{
455 539
 			print '<td';
456
-			if ($align) print ' class="'.$align.'"';
540
+			if ($align) {
541
+			    print ' class="'.$align.'"';
542
+			}
457 543
 			print '>';
458
-			if ($key == 'login') print $objectwebsiteaccount->getNomUrl(1, '', 0, '', 1);
459
-			else print $objectwebsiteaccount->showOutputField($val, $key, $obj->$key, '');
544
+			if ($key == 'login') {
545
+			    print $objectwebsiteaccount->getNomUrl(1, '', 0, '', 1);
546
+			} else {
547
+			    print $objectwebsiteaccount->showOutputField($val, $key, $obj->$key, '');
548
+			}
460 549
 			print '</td>';
461
-			if (! $i) $totalarray['nbfield']++;
550
+			if (! $i) {
551
+			    $totalarray['nbfield']++;
552
+			}
462 553
 			if (! empty($val['isameasure']))
463 554
 			{
464
-				if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key;
555
+				if (! $i) {
556
+				    $totalarray['pos'][$totalarray['nbfield']]='t.'.$key;
557
+				}
465 558
 				$totalarray['val']['t.'.$key] += $obj->$key;
466 559
 			}
467 560
 		}
@@ -474,14 +567,20 @@  discard block
 block discarded – undo
474 567
 	print $hookmanager->resPrint;
475 568
 	// Action column
476 569
 	print '<td class="nowrap" align="center">';
477
-	if ($massactionbutton || $massaction)   // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
570
+	if ($massactionbutton || $massaction) {
571
+	    // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
478 572
 	{
479 573
 		$selected=0;
480
-		if (in_array($obj->rowid, $arrayofselected)) $selected=1;
574
+	}
575
+		if (in_array($obj->rowid, $arrayofselected)) {
576
+		    $selected=1;
577
+		}
481 578
 		print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
482 579
 	}
483 580
 	print '</td>';
484
-	if (! $i) $totalarray['nbfield']++;
581
+	if (! $i) {
582
+	    $totalarray['nbfield']++;
583
+	}
485 584
 
486 585
 	print '</tr>';
487 586
 
@@ -496,15 +595,20 @@  discard block
 block discarded – undo
496 595
 	while ($i < $totalarray['nbfield'])
497 596
 	{
498 597
 		$i++;
499
-		if (! empty($totalarray['pos'][$i]))  print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
500
-		else
598
+		if (! empty($totalarray['pos'][$i])) {
599
+		    print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
600
+		} else
501 601
 		{
502 602
 			if ($i == 1)
503 603
 			{
504
-				if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
505
-				else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
604
+				if ($num < $limit) {
605
+				    print '<td align="left">'.$langs->trans("Total").'</td>';
606
+				} else {
607
+				    print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
608
+				}
609
+			} else {
610
+			    print '<td></td>';
506 611
 			}
507
-			else print '<td></td>';
508 612
 		}
509 613
 	}
510 614
 	print '</tr>';
@@ -514,7 +618,10 @@  discard block
 block discarded – undo
514 618
 if ($num == 0)
515 619
 {
516 620
 	$colspan=1;
517
-	foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
621
+	foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) {
622
+	    $colspan++;
623
+	}
624
+	}
518 625
 	print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
519 626
 }
520 627
 
@@ -533,7 +640,9 @@  discard block
 block discarded – undo
533 640
 if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
534 641
 {
535 642
 	$hidegeneratedfilelistifempty=1;
536
-	if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
643
+	if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
644
+	    $hidegeneratedfilelistifempty=0;
645
+	}
537 646
 
538 647
 	require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
539 648
 	$formfile = new FormFile($db);
Please login to merge, or discard this patch.
dolibarr/htdocs/societe/agenda.php 3 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -100,23 +100,23 @@  discard block
 block discarded – undo
100 100
 
101 101
 if ($socid > 0)
102 102
 {
103
-	require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
104
-	require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
103
+    require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
104
+    require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
105 105
 
106
-	$langs->load("companies");
106
+    $langs->load("companies");
107 107
 
108 108
 
109
-	$object = new Societe($db);
110
-	$result = $object->fetch($socid);
109
+    $object = new Societe($db);
110
+    $result = $object->fetch($socid);
111 111
 
112
-	$title=$langs->trans("Agenda");
113
-	if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title;
114
-	llxHeader('',$title);
112
+    $title=$langs->trans("Agenda");
113
+    if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title;
114
+    llxHeader('',$title);
115 115
 
116
-	if (! empty($conf->notification->enabled)) $langs->load("mails");
117
-	$head = societe_prepare_head($object);
116
+    if (! empty($conf->notification->enabled)) $langs->load("mails");
117
+    $head = societe_prepare_head($object);
118 118
 
119
-	dol_fiche_head($head, 'agenda', $langs->trans("ThirdParty"), -1, 'company');
119
+    dol_fiche_head($head, 'agenda', $langs->trans("ThirdParty"), -1, 'company');
120 120
 
121 121
     $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
122 122
 
@@ -127,15 +127,15 @@  discard block
 block discarded – undo
127 127
     print '<div class="underbanner clearboth"></div>';
128 128
 
129 129
     $object->info($socid);
130
-	print dol_print_object_info($object, 1);
130
+    print dol_print_object_info($object, 1);
131 131
 
132
-	print '</div>';
132
+    print '</div>';
133 133
 
134
-	dol_fiche_end();
134
+    dol_fiche_end();
135 135
 
136 136
 
137 137
 
138
-	// Actions buttons
138
+    // Actions buttons
139 139
 
140 140
     $objthirdparty=$object;
141 141
     $objcon=new stdClass();
@@ -147,40 +147,40 @@  discard block
 block discarded – undo
147 147
         //$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
148 148
         if (get_class($objthirdparty) == 'Societe') $out.='&amp;socid='.$objthirdparty->id;
149 149
         $out.=(! empty($objcon->id)?'&amp;contactid='.$objcon->id:'').'&amp;backtopage=1&amp;percentage=-1';
150
-    	//$out.=$langs->trans("AddAnAction").' ';
151
-    	//$out.=img_picto($langs->trans("AddAnAction"),'filenew');
152
-    	//$out.="</a>";
153
-	}
150
+        //$out.=$langs->trans("AddAnAction").' ';
151
+        //$out.=img_picto($langs->trans("AddAnAction"),'filenew');
152
+        //$out.="</a>";
153
+    }
154 154
 
155 155
 
156
-	//print '<div class="tabsAction">';
157
-	//print '</div>';
156
+    //print '<div class="tabsAction">';
157
+    //print '</div>';
158 158
 
159 159
 
160
-	$newcardbutton='';
160
+    $newcardbutton='';
161 161
     if (! empty($conf->agenda->enabled))
162 162
     {
163
-    	if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create))
164
-    	{
165
-        	$newcardbutton.='<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'"><span class="valignmiddle">'.$langs->trans("AddAction").'</span>';
166
-        	$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
167
-        	$newcardbutton.= '</a>';
168
-    	}
163
+        if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create))
164
+        {
165
+            $newcardbutton.='<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'"><span class="valignmiddle">'.$langs->trans("AddAction").'</span>';
166
+            $newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
167
+            $newcardbutton.= '</a>';
168
+        }
169 169
     }
170 170
 
171 171
     if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
172 172
     {
173
-    	print '<br>';
173
+        print '<br>';
174 174
 
175 175
         $param='&socid='.$socid;
176 176
         if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
177 177
         if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
178 178
 
179
-		print load_fiche_titre($langs->trans("ActionsOnCompany"), $newcardbutton, '');
179
+        print load_fiche_titre($langs->trans("ActionsOnCompany"), $newcardbutton, '');
180 180
         //print_barre_liste($langs->trans("ActionsOnCompany"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $newcardbutton, '', 0, 1, 1);
181 181
 
182 182
         // List of all actions
183
-		$filters=array();
183
+        $filters=array();
184 184
         $filters['search_agenda_label']=$search_agenda_label;
185 185
 
186 186
         // TODO Replace this with same code than into list.php
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -34,32 +34,32 @@  discard block
 block discarded – undo
34 34
 
35 35
 $langs->load("companies");
36 36
 
37
-if (GETPOST('actioncode','array'))
37
+if (GETPOST('actioncode', 'array'))
38 38
 {
39
-    $actioncode=GETPOST('actioncode','array',3);
40
-    if (! count($actioncode)) $actioncode='0';
39
+    $actioncode = GETPOST('actioncode', 'array', 3);
40
+    if (!count($actioncode)) $actioncode = '0';
41 41
 }
42 42
 else
43 43
 {
44
-    $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
44
+    $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
45 45
 }
46
-$search_agenda_label=GETPOST('search_agenda_label');
46
+$search_agenda_label = GETPOST('search_agenda_label');
47 47
 
48 48
 // Security check
49
-$socid = GETPOST('socid','int');
50
-if ($user->societe_id) $socid=$user->societe_id;
49
+$socid = GETPOST('socid', 'int');
50
+if ($user->societe_id) $socid = $user->societe_id;
51 51
 $result = restrictedArea($user, 'societe', $socid, '&societe');
52 52
 
53
-$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
54
-$sortfield = GETPOST("sortfield",'alpha');
55
-$sortorder = GETPOST("sortorder",'alpha');
56
-$page = GETPOST("page",'int');
53
+$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
54
+$sortfield = GETPOST("sortfield", 'alpha');
55
+$sortorder = GETPOST("sortorder", 'alpha');
56
+$page = GETPOST("page", 'int');
57 57
 if (empty($page) || $page == -1) { $page = 0; }     // If $page is not defined, or '' or -1
58 58
 $offset = $limit * $page;
59 59
 $pageprev = $page - 1;
60 60
 $pagenext = $page + 1;
61
-if (! $sortfield) $sortfield='a.datep,a.id';
62
-if (! $sortorder) $sortorder='DESC,DESC';
61
+if (!$sortfield) $sortfield = 'a.datep,a.id';
62
+if (!$sortorder) $sortorder = 'DESC,DESC';
63 63
 
64 64
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
65 65
 $hookmanager->initHooks(array('agendathirdparty'));
@@ -69,24 +69,24 @@  discard block
 block discarded – undo
69 69
  *	Actions
70 70
  */
71 71
 
72
-$parameters=array('id'=>$socid);
73
-$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action);    // Note that $action and $object may have been modified by some hooks
72
+$parameters = array('id'=>$socid);
73
+$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
74 74
 if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
75 75
 
76 76
 if (empty($reshook))
77 77
 {
78 78
     // Cancel
79
-    if (GETPOST('cancel','alpha') && ! empty($backtopage))
79
+    if (GETPOST('cancel', 'alpha') && !empty($backtopage))
80 80
     {
81 81
         header("Location: ".$backtopage);
82 82
         exit;
83 83
     }
84 84
 
85 85
     // Purge search criteria
86
-    if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
86
+    if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
87 87
     {
88
-        $actioncode='';
89
-        $search_agenda_label='';
88
+        $actioncode = '';
89
+        $search_agenda_label = '';
90 90
     }
91 91
 }
92 92
 
@@ -109,18 +109,18 @@  discard block
 block discarded – undo
109 109
 	$object = new Societe($db);
110 110
 	$result = $object->fetch($socid);
111 111
 
112
-	$title=$langs->trans("Agenda");
113
-	if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title;
114
-	llxHeader('',$title);
112
+	$title = $langs->trans("Agenda");
113
+	if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->name." - ".$title;
114
+	llxHeader('', $title);
115 115
 
116
-	if (! empty($conf->notification->enabled)) $langs->load("mails");
116
+	if (!empty($conf->notification->enabled)) $langs->load("mails");
117 117
 	$head = societe_prepare_head($object);
118 118
 
119 119
 	dol_fiche_head($head, 'agenda', $langs->trans("ThirdParty"), -1, 'company');
120 120
 
121 121
     $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
122 122
 
123
-    dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom');
123
+    dol_banner_tab($object, 'socid', $linkback, ($user->societe_id ? 0 : 1), 'rowid', 'nom');
124 124
 
125 125
     print '<div class="fichecenter">';
126 126
 
@@ -137,16 +137,16 @@  discard block
 block discarded – undo
137 137
 
138 138
 	// Actions buttons
139 139
 
140
-    $objthirdparty=$object;
141
-    $objcon=new stdClass();
140
+    $objthirdparty = $object;
141
+    $objcon = new stdClass();
142 142
 
143
-    $out='';
144
-    $permok=$user->rights->agenda->myactions->create;
145
-    if ((! empty($objthirdparty->id) || ! empty($objcon->id)) && $permok)
143
+    $out = '';
144
+    $permok = $user->rights->agenda->myactions->create;
145
+    if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok)
146 146
     {
147 147
         //$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
148
-        if (get_class($objthirdparty) == 'Societe') $out.='&amp;socid='.$objthirdparty->id;
149
-        $out.=(! empty($objcon->id)?'&amp;contactid='.$objcon->id:'').'&amp;backtopage=1&amp;percentage=-1';
148
+        if (get_class($objthirdparty) == 'Societe') $out .= '&amp;socid='.$objthirdparty->id;
149
+        $out .= (!empty($objcon->id) ? '&amp;contactid='.$objcon->id : '').'&amp;backtopage=1&amp;percentage=-1';
150 150
     	//$out.=$langs->trans("AddAnAction").' ';
151 151
     	//$out.=img_picto($langs->trans("AddAnAction"),'filenew');
152 152
     	//$out.="</a>";
@@ -157,34 +157,34 @@  discard block
 block discarded – undo
157 157
 	//print '</div>';
158 158
 
159 159
 
160
-	$newcardbutton='';
161
-    if (! empty($conf->agenda->enabled))
160
+	$newcardbutton = '';
161
+    if (!empty($conf->agenda->enabled))
162 162
     {
163
-    	if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create))
163
+    	if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create))
164 164
     	{
165
-        	$newcardbutton.='<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'"><span class="valignmiddle">'.$langs->trans("AddAction").'</span>';
166
-        	$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
167
-        	$newcardbutton.= '</a>';
165
+        	$newcardbutton .= '<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'"><span class="valignmiddle">'.$langs->trans("AddAction").'</span>';
166
+        	$newcardbutton .= '<span class="fa fa-plus-circle valignmiddle"></span>';
167
+        	$newcardbutton .= '</a>';
168 168
     	}
169 169
     }
170 170
 
171
-    if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
171
+    if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read)))
172 172
     {
173 173
     	print '<br>';
174 174
 
175
-        $param='&socid='.$socid;
176
-        if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
177
-        if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
175
+        $param = '&socid='.$socid;
176
+        if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
177
+        if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
178 178
 
179 179
 		print load_fiche_titre($langs->trans("ActionsOnCompany"), $newcardbutton, '');
180 180
         //print_barre_liste($langs->trans("ActionsOnCompany"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $newcardbutton, '', 0, 1, 1);
181 181
 
182 182
         // List of all actions
183
-		$filters=array();
184
-        $filters['search_agenda_label']=$search_agenda_label;
183
+		$filters = array();
184
+        $filters['search_agenda_label'] = $search_agenda_label;
185 185
 
186 186
         // TODO Replace this with same code than into list.php
187
-        show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters, $sortfield, $sortorder);
187
+        show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);
188 188
     }
189 189
 }
190 190
 
Please login to merge, or discard this patch.
Braces   +34 added lines, -13 removed lines patch added patch discarded remove patch
@@ -37,9 +37,10 @@  discard block
 block discarded – undo
37 37
 if (GETPOST('actioncode','array'))
38 38
 {
39 39
     $actioncode=GETPOST('actioncode','array',3);
40
-    if (! count($actioncode)) $actioncode='0';
41
-}
42
-else
40
+    if (! count($actioncode)) {
41
+        $actioncode='0';
42
+    }
43
+    } else
43 44
 {
44 45
     $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
45 46
 }
@@ -47,7 +48,9 @@  discard block
 block discarded – undo
47 48
 
48 49
 // Security check
49 50
 $socid = GETPOST('socid','int');
50
-if ($user->societe_id) $socid=$user->societe_id;
51
+if ($user->societe_id) {
52
+    $socid=$user->societe_id;
53
+}
51 54
 $result = restrictedArea($user, 'societe', $socid, '&societe');
52 55
 
53 56
 $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
@@ -58,8 +61,12 @@  discard block
 block discarded – undo
58 61
 $offset = $limit * $page;
59 62
 $pageprev = $page - 1;
60 63
 $pagenext = $page + 1;
61
-if (! $sortfield) $sortfield='a.datep,a.id';
62
-if (! $sortorder) $sortorder='DESC,DESC';
64
+if (! $sortfield) {
65
+    $sortfield='a.datep,a.id';
66
+}
67
+if (! $sortorder) {
68
+    $sortorder='DESC,DESC';
69
+}
63 70
 
64 71
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
65 72
 $hookmanager->initHooks(array('agendathirdparty'));
@@ -71,7 +78,9 @@  discard block
 block discarded – undo
71 78
 
72 79
 $parameters=array('id'=>$socid);
73 80
 $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action);    // Note that $action and $object may have been modified by some hooks
74
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
81
+if ($reshook < 0) {
82
+    setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
83
+}
75 84
 
76 85
 if (empty($reshook))
77 86
 {
@@ -83,9 +92,11 @@  discard block
 block discarded – undo
83 92
     }
84 93
 
85 94
     // Purge search criteria
86
-    if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
95
+    if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) {
96
+        // All tests are required to be compatible with all browsers
87 97
     {
88 98
         $actioncode='';
99
+    }
89 100
         $search_agenda_label='';
90 101
     }
91 102
 }
@@ -110,10 +121,14 @@  discard block
 block discarded – undo
110 121
 	$result = $object->fetch($socid);
111 122
 
112 123
 	$title=$langs->trans("Agenda");
113
-	if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title;
124
+	if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) {
125
+	    $title=$object->name." - ".$title;
126
+	}
114 127
 	llxHeader('',$title);
115 128
 
116
-	if (! empty($conf->notification->enabled)) $langs->load("mails");
129
+	if (! empty($conf->notification->enabled)) {
130
+	    $langs->load("mails");
131
+	}
117 132
 	$head = societe_prepare_head($object);
118 133
 
119 134
 	dol_fiche_head($head, 'agenda', $langs->trans("ThirdParty"), -1, 'company');
@@ -145,7 +160,9 @@  discard block
 block discarded – undo
145 160
     if ((! empty($objthirdparty->id) || ! empty($objcon->id)) && $permok)
146 161
     {
147 162
         //$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
148
-        if (get_class($objthirdparty) == 'Societe') $out.='&amp;socid='.$objthirdparty->id;
163
+        if (get_class($objthirdparty) == 'Societe') {
164
+            $out.='&amp;socid='.$objthirdparty->id;
165
+        }
149 166
         $out.=(! empty($objcon->id)?'&amp;contactid='.$objcon->id:'').'&amp;backtopage=1&amp;percentage=-1';
150 167
     	//$out.=$langs->trans("AddAnAction").' ';
151 168
     	//$out.=img_picto($langs->trans("AddAnAction"),'filenew');
@@ -173,8 +190,12 @@  discard block
 block discarded – undo
173 190
     	print '<br>';
174 191
 
175 192
         $param='&socid='.$socid;
176
-        if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
177
-        if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
193
+        if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
194
+            $param.='&contextpage='.$contextpage;
195
+        }
196
+        if ($limit > 0 && $limit != $conf->liste_limit) {
197
+            $param.='&limit='.$limit;
198
+        }
178 199
 
179 200
 		print load_fiche_titre($langs->trans("ActionsOnCompany"), $newcardbutton, '');
180 201
         //print_barre_liste($langs->trans("ActionsOnCompany"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $newcardbutton, '', 0, 1, 1);
Please login to merge, or discard this patch.
dolibarr/htdocs/societe/admin/societe.php 3 patches
Indentation   +475 added lines, -475 removed lines patch added patch discarded remove patch
@@ -46,169 +46,169 @@  discard block
 block discarded – undo
46 46
 
47 47
 if ($action == 'setcodeclient')
48 48
 {
49
-	if (dolibarr_set_const($db, "SOCIETE_CODECLIENT_ADDON",$value,'chaine',0,'',$conf->entity) > 0)
50
-	{
51
-		header("Location: ".$_SERVER["PHP_SELF"]);
52
-		exit;
53
-	}
54
-	else
55
-	{
56
-		dol_print_error($db);
57
-	}
49
+    if (dolibarr_set_const($db, "SOCIETE_CODECLIENT_ADDON",$value,'chaine',0,'',$conf->entity) > 0)
50
+    {
51
+        header("Location: ".$_SERVER["PHP_SELF"]);
52
+        exit;
53
+    }
54
+    else
55
+    {
56
+        dol_print_error($db);
57
+    }
58 58
 }
59 59
 
60 60
 if ($action == 'setcodecompta')
61 61
 {
62
-	if (dolibarr_set_const($db, "SOCIETE_CODECOMPTA_ADDON",$value,'chaine',0,'',$conf->entity) > 0)
63
-	{
64
-		header("Location: ".$_SERVER["PHP_SELF"]);
65
-		exit;
66
-	}
67
-	else
68
-	{
69
-		dol_print_error($db);
70
-	}
62
+    if (dolibarr_set_const($db, "SOCIETE_CODECOMPTA_ADDON",$value,'chaine',0,'',$conf->entity) > 0)
63
+    {
64
+        header("Location: ".$_SERVER["PHP_SELF"]);
65
+        exit;
66
+    }
67
+    else
68
+    {
69
+        dol_print_error($db);
70
+    }
71 71
 }
72 72
 
73 73
 if ($action == 'updateoptions')
74 74
 {
75
-	if (GETPOST('COMPANY_USE_SEARCH_TO_SELECT'))
76
-	{
77
-		$companysearch = GETPOST('activate_COMPANY_USE_SEARCH_TO_SELECT','alpha');
78
-		$res = dolibarr_set_const($db, "COMPANY_USE_SEARCH_TO_SELECT", $companysearch,'chaine',0,'',$conf->entity);
79
-		if (! $res > 0) $error++;
80
-		if (! $error)
81
-	    {
82
-		    setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
83
-	    }
84
-	    else
85
-	    {
86
-		    setEventMessages($langs->trans("Error"), null, 'errors');
87
-		}
88
-	}
89
-
90
-	if (GETPOST('CONTACT_USE_SEARCH_TO_SELECT'))
91
-	{
92
-		$contactsearch = GETPOST('activate_CONTACT_USE_SEARCH_TO_SELECT','alpha');
93
-		$res = dolibarr_set_const($db, "CONTACT_USE_SEARCH_TO_SELECT", $contactsearch,'chaine',0,'',$conf->entity);
94
-		if (! $res > 0) $error++;
95
-		if (! $error)
96
-		{
97
-			setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
98
-		}
99
-		else
100
-		{
101
-			setEventMessages($langs->trans("Error"), null, 'errors');
102
-		}
103
-	}
75
+    if (GETPOST('COMPANY_USE_SEARCH_TO_SELECT'))
76
+    {
77
+        $companysearch = GETPOST('activate_COMPANY_USE_SEARCH_TO_SELECT','alpha');
78
+        $res = dolibarr_set_const($db, "COMPANY_USE_SEARCH_TO_SELECT", $companysearch,'chaine',0,'',$conf->entity);
79
+        if (! $res > 0) $error++;
80
+        if (! $error)
81
+        {
82
+            setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
83
+        }
84
+        else
85
+        {
86
+            setEventMessages($langs->trans("Error"), null, 'errors');
87
+        }
88
+    }
89
+
90
+    if (GETPOST('CONTACT_USE_SEARCH_TO_SELECT'))
91
+    {
92
+        $contactsearch = GETPOST('activate_CONTACT_USE_SEARCH_TO_SELECT','alpha');
93
+        $res = dolibarr_set_const($db, "CONTACT_USE_SEARCH_TO_SELECT", $contactsearch,'chaine',0,'',$conf->entity);
94
+        if (! $res > 0) $error++;
95
+        if (! $error)
96
+        {
97
+            setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
98
+        }
99
+        else
100
+        {
101
+            setEventMessages($langs->trans("Error"), null, 'errors');
102
+        }
103
+    }
104 104
 }
105 105
 
106 106
 // Activate a document generator module
107 107
 if ($action == 'set')
108 108
 {
109
-	$label = GETPOST('label','alpha');
110
-	$scandir = GETPOST('scan_dir','alpha');
109
+    $label = GETPOST('label','alpha');
110
+    $scandir = GETPOST('scan_dir','alpha');
111 111
 
112
-	$type='company';
113
-	$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
114
-	$sql.= " VALUES ('".$db->escape($value)."','".$type."',".$conf->entity.", ";
115
-	$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
116
-	$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
117
-	$sql.= ")";
112
+    $type='company';
113
+    $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
114
+    $sql.= " VALUES ('".$db->escape($value)."','".$type."',".$conf->entity.", ";
115
+    $sql.= ($label?"'".$db->escape($label)."'":'null').", ";
116
+    $sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
117
+    $sql.= ")";
118 118
 
119
-	$resql=$db->query($sql);
120
-	if (! $resql) dol_print_error($db);
119
+    $resql=$db->query($sql);
120
+    if (! $resql) dol_print_error($db);
121 121
 }
122 122
 
123 123
 // Disable a document generator module
124 124
 if ($action== 'del')
125 125
 {
126
-	$type='company';
127
-	$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
128
-	$sql.= " WHERE nom='".$db->escape($value)."' AND type='".$type."' AND entity=".$conf->entity;
129
-	$resql=$db->query($sql);
130
-	if (! $resql) dol_print_error($db);
126
+    $type='company';
127
+    $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
128
+    $sql.= " WHERE nom='".$db->escape($value)."' AND type='".$type."' AND entity=".$conf->entity;
129
+    $resql=$db->query($sql);
130
+    if (! $resql) dol_print_error($db);
131 131
 }
132 132
 
133 133
 // Define default generator
134 134
 if ($action == 'setdoc')
135 135
 {
136
-	$label = GETPOST('label','alpha');
137
-	$scandir = GETPOST('scan_dir','alpha');
136
+    $label = GETPOST('label','alpha');
137
+    $scandir = GETPOST('scan_dir','alpha');
138 138
 
139
-	$db->begin();
139
+    $db->begin();
140 140
 
141
-	dolibarr_set_const($db, "COMPANY_ADDON_PDF",$value,'chaine',0,'',$conf->entity);
141
+    dolibarr_set_const($db, "COMPANY_ADDON_PDF",$value,'chaine',0,'',$conf->entity);
142 142
 
143
-	// On active le modele
144
-	$type='company';
145
-	$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
146
-	$sql_del.= " WHERE nom = '".$db->escape(GETPOST('value','alpha'))."'";
147
-	$sql_del.= " AND type = '".$type."'";
148
-	$sql_del.= " AND entity = ".$conf->entity;
143
+    // On active le modele
144
+    $type='company';
145
+    $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
146
+    $sql_del.= " WHERE nom = '".$db->escape(GETPOST('value','alpha'))."'";
147
+    $sql_del.= " AND type = '".$type."'";
148
+    $sql_del.= " AND entity = ".$conf->entity;
149 149
     dol_syslog("societe.php ".$sql);
150
-	$result1=$db->query($sql_del);
150
+    $result1=$db->query($sql_del);
151 151
 
152
-	$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
153
-	$sql.= " VALUES ('".$db->escape($value)."', '".$type."', ".$conf->entity.", ";
154
-	$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
155
-	$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
156
-	$sql.= ")";
152
+    $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
153
+    $sql.= " VALUES ('".$db->escape($value)."', '".$type."', ".$conf->entity.", ";
154
+    $sql.= ($label?"'".$db->escape($label)."'":'null').", ";
155
+    $sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
156
+    $sql.= ")";
157 157
     dol_syslog("societe.php", LOG_DEBUG);
158
-	$result2=$db->query($sql);
159
-	if ($result1 && $result2)
160
-	{
161
-		$db->commit();
162
-	}
163
-	else
164
-	{
165
-	    $db->rollback();
166
-	}
158
+    $result2=$db->query($sql);
159
+    if ($result1 && $result2)
160
+    {
161
+        $db->commit();
162
+    }
163
+    else
164
+    {
165
+        $db->rollback();
166
+    }
167 167
 }
168 168
 
169 169
 //Activate Set ref in list
170 170
 if ($action=="setaddrefinlist") {
171
-	$setaddrefinlist = GETPOST('value','int');
172
-	$res = dolibarr_set_const($db, "SOCIETE_ADD_REF_IN_LIST", $setaddrefinlist,'yesno',0,'',$conf->entity);
173
-	if (! $res > 0) $error++;
174
-	if (! $error)
175
-	{
176
-		setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
177
-	}
178
-	else
179
-	{
180
-		setEventMessages($langs->trans("Error"), null, 'errors');
181
-	}
171
+    $setaddrefinlist = GETPOST('value','int');
172
+    $res = dolibarr_set_const($db, "SOCIETE_ADD_REF_IN_LIST", $setaddrefinlist,'yesno',0,'',$conf->entity);
173
+    if (! $res > 0) $error++;
174
+    if (! $error)
175
+    {
176
+        setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
177
+    }
178
+    else
179
+    {
180
+        setEventMessages($langs->trans("Error"), null, 'errors');
181
+    }
182 182
 }
183 183
 
184 184
 //Activate Set adress in list
185 185
 if ($action=="setaddadressinlist") {
186
-	$val = GETPOST('value','int');
187
-	$res = dolibarr_set_const($db, "COMPANY_SHOW_ADDRESS_SELECTLIST", $val,'yesno',0,'',$conf->entity);
188
-	if (! $res > 0) $error++;
189
-	if (! $error)
190
-	{
191
-		setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
192
-	}
193
-	else
194
-	{
195
-		setEventMessages($langs->trans("Error"), null, 'errors');
196
-	}
186
+    $val = GETPOST('value','int');
187
+    $res = dolibarr_set_const($db, "COMPANY_SHOW_ADDRESS_SELECTLIST", $val,'yesno',0,'',$conf->entity);
188
+    if (! $res > 0) $error++;
189
+    if (! $error)
190
+    {
191
+        setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
192
+    }
193
+    else
194
+    {
195
+        setEventMessages($langs->trans("Error"), null, 'errors');
196
+    }
197 197
 }
198 198
 
199 199
 //Activate Ask For Preferred Shipping Method
200 200
 if ($action=="setaskforshippingmet") {
201
-	$setaskforshippingmet = GETPOST('value','int');
202
-	$res = dolibarr_set_const($db, "SOCIETE_ASK_FOR_SHIPPING_METHOD", $setaskforshippingmet,'yesno',0,'',$conf->entity);
203
-	if (! $res > 0) $error++;
204
-	if (! $error)
205
-	{
206
-		setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
207
-	}
208
-	else
209
-	{
210
-		setEventMessages($langs->trans("Error"), null, 'errors');
211
-	}
201
+    $setaskforshippingmet = GETPOST('value','int');
202
+    $res = dolibarr_set_const($db, "SOCIETE_ASK_FOR_SHIPPING_METHOD", $setaskforshippingmet,'yesno',0,'',$conf->entity);
203
+    if (! $res > 0) $error++;
204
+    if (! $error)
205
+    {
206
+        setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
207
+    }
208
+    else
209
+    {
210
+        setEventMessages($langs->trans("Error"), null, 'errors');
211
+    }
212 212
 }
213 213
 
214 214
 //Activate "Disable prospect/customer type"
@@ -229,81 +229,81 @@  discard block
 block discarded – undo
229 229
 //Activate ProfId unique
230 230
 if ($action == 'setprofid')
231 231
 {
232
-	$status = GETPOST('status','alpha');
232
+    $status = GETPOST('status','alpha');
233 233
 
234
-	$idprof="SOCIETE_".$value."_UNIQUE";
235
-	if (dolibarr_set_const($db, $idprof, $status, 'chaine', 0, '', $conf->entity) > 0)
236
-	{
237
-		//header("Location: ".$_SERVER["PHP_SELF"]);
238
-		//exit;
239
-	}
240
-	else
241
-	{
242
-		dol_print_error($db);
243
-	}
234
+    $idprof="SOCIETE_".$value."_UNIQUE";
235
+    if (dolibarr_set_const($db, $idprof, $status, 'chaine', 0, '', $conf->entity) > 0)
236
+    {
237
+        //header("Location: ".$_SERVER["PHP_SELF"]);
238
+        //exit;
239
+    }
240
+    else
241
+    {
242
+        dol_print_error($db);
243
+    }
244 244
 }
245 245
 
246 246
 //Activate ProfId mandatory
247 247
 if ($action == 'setprofidmandatory')
248 248
 {
249
-	$status = GETPOST('status','alpha');
249
+    $status = GETPOST('status','alpha');
250 250
 
251
-	$idprof="SOCIETE_".$value."_MANDATORY";
252
-	if (dolibarr_set_const($db, $idprof, $status, 'chaine', 0, '', $conf->entity) > 0)
253
-	{
254
-		//header("Location: ".$_SERVER["PHP_SELF"]);
255
-		//exit;
256
-	}
257
-	else
258
-	{
259
-		dol_print_error($db);
260
-	}
251
+    $idprof="SOCIETE_".$value."_MANDATORY";
252
+    if (dolibarr_set_const($db, $idprof, $status, 'chaine', 0, '', $conf->entity) > 0)
253
+    {
254
+        //header("Location: ".$_SERVER["PHP_SELF"]);
255
+        //exit;
256
+    }
257
+    else
258
+    {
259
+        dol_print_error($db);
260
+    }
261 261
 }
262 262
 
263 263
 //Activate ProfId invoice mandatory
264 264
 if ($action == 'setprofidinvoicemandatory')
265 265
 {
266
-	$status = GETPOST('status','alpha');
266
+    $status = GETPOST('status','alpha');
267 267
 
268
-	$idprof="SOCIETE_".$value."_INVOICE_MANDATORY";
269
-	if (dolibarr_set_const($db, $idprof, $status, 'chaine', 0, '', $conf->entity) > 0)
270
-	{
271
-		//header("Location: ".$_SERVER["PHP_SELF"]);
272
-		//exit;
273
-	}
274
-	else
275
-	{
276
-		dol_print_error($db);
277
-	}
268
+    $idprof="SOCIETE_".$value."_INVOICE_MANDATORY";
269
+    if (dolibarr_set_const($db, $idprof, $status, 'chaine', 0, '', $conf->entity) > 0)
270
+    {
271
+        //header("Location: ".$_SERVER["PHP_SELF"]);
272
+        //exit;
273
+    }
274
+    else
275
+    {
276
+        dol_print_error($db);
277
+    }
278 278
 }
279 279
 
280 280
 //Set hide closed customer into combox or select
281 281
 if ($action == 'sethideinactivethirdparty')
282 282
 {
283
-	$status = GETPOST('status','alpha');
283
+    $status = GETPOST('status','alpha');
284 284
 
285
-	if (dolibarr_set_const($db, "COMPANY_HIDE_INACTIVE_IN_COMBOBOX",$status,'chaine',0,'',$conf->entity) > 0)
286
-	{
287
-		header("Location: ".$_SERVER["PHP_SELF"]);
288
-		exit;
289
-	}
290
-	else
291
-	{
292
-		dol_print_error($db);
293
-	}
285
+    if (dolibarr_set_const($db, "COMPANY_HIDE_INACTIVE_IN_COMBOBOX",$status,'chaine',0,'',$conf->entity) > 0)
286
+    {
287
+        header("Location: ".$_SERVER["PHP_SELF"]);
288
+        exit;
289
+    }
290
+    else
291
+    {
292
+        dol_print_error($db);
293
+    }
294 294
 }
295 295
 if($action=='setonsearchandlistgooncustomerorsuppliercard'){
296
-       $setonsearchandlistgooncustomerorsuppliercard = GETPOST('value','int');
297
-       $res = dolibarr_set_const($db, "SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD", $setonsearchandlistgooncustomerorsuppliercard,'yesno',0,'',$conf->entity);
298
-       if (! $res > 0) $error++;
299
-       if (! $error)
300
-       {
301
-               setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
302
-       }
303
-       else
304
-       {
305
-               setEventMessages($langs->trans("Error"), null, 'errors');
306
-       }
296
+        $setonsearchandlistgooncustomerorsuppliercard = GETPOST('value','int');
297
+        $res = dolibarr_set_const($db, "SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD", $setonsearchandlistgooncustomerorsuppliercard,'yesno',0,'',$conf->entity);
298
+        if (! $res > 0) $error++;
299
+        if (! $error)
300
+        {
301
+                setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
302
+        }
303
+        else
304
+        {
305
+                setEventMessages($langs->trans("Error"), null, 'errors');
306
+        }
307 307
 }
308 308
 
309 309
 
@@ -343,63 +343,63 @@  discard block
 block discarded – undo
343 343
 
344 344
 foreach ($dirsociete as $dirroot)
345 345
 {
346
-	$dir = dol_buildpath($dirroot,0);
346
+    $dir = dol_buildpath($dirroot,0);
347 347
 
348 348
     $handle = @opendir($dir);
349 349
     if (is_resource($handle))
350 350
     {
351
-    	// Loop on each module find in opened directory
352
-    	while (($file = readdir($handle))!==false)
353
-    	{
354
-    		if (substr($file, 0, 15) == 'mod_codeclient_' && substr($file, -3) == 'php')
355
-    		{
356
-    			$file = substr($file, 0, dol_strlen($file)-4);
357
-
358
-    			try {
359
-        			dol_include_once($dirroot.$file.'.php');
360
-    			}
361
-    			catch(Exception $e)
362
-    			{
363
-    			    dol_syslog($e->getMessage(), LOG_ERR);
364
-    			}
365
-
366
-    			$modCodeTiers = new $file;
367
-
368
-    			// Show modules according to features level
369
-    			if ($modCodeTiers->version == 'development'  && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
370
-    			if ($modCodeTiers->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
371
-
372
-    			print '<tr class="oddeven">'."\n";
373
-    			print '<td width="140">'.$modCodeTiers->name.'</td>'."\n";
374
-    			print '<td>'.$modCodeTiers->info($langs).'</td>'."\n";
375
-    			print '<td class="nowrap">'.$modCodeTiers->getExample($langs).'</td>'."\n";
376
-
377
-    			if ($conf->global->SOCIETE_CODECLIENT_ADDON == "$file")
378
-    			{
379
-    				print '<td align="center">'."\n";
380
-    				print img_picto($langs->trans("Activated"),'switch_on');
381
-    				print "</td>\n";
382
-    			}
383
-    			else
384
-    			{
385
-    				$disabled = false;
386
-    				if (! empty($conf->multicompany->enabled) && (is_object($mc) && ! empty($mc->sharings['referent']) && $mc->sharings['referent'] == $conf->entity) ? false : true);
387
-    				print '<td align="center">';
388
-    				if (! $disabled) print '<a href="'.$_SERVER['PHP_SELF'].'?action=setcodeclient&value='.$file.'">';
389
-    				print img_picto($langs->trans("Disabled"),'switch_off');
390
-    				if (! $disabled) print '</a>';
391
-    				print '</td>';
392
-    			}
393
-
394
-    			print '<td align="center">';
395
-    			$s=$modCodeTiers->getToolTip($langs,null,-1);
396
-    			print $form->textwithpicto('',$s,1);
397
-    			print '</td>';
398
-
399
-    			print '</tr>';
400
-    		}
401
-    	}
402
-    	closedir($handle);
351
+        // Loop on each module find in opened directory
352
+        while (($file = readdir($handle))!==false)
353
+        {
354
+            if (substr($file, 0, 15) == 'mod_codeclient_' && substr($file, -3) == 'php')
355
+            {
356
+                $file = substr($file, 0, dol_strlen($file)-4);
357
+
358
+                try {
359
+                    dol_include_once($dirroot.$file.'.php');
360
+                }
361
+                catch(Exception $e)
362
+                {
363
+                    dol_syslog($e->getMessage(), LOG_ERR);
364
+                }
365
+
366
+                $modCodeTiers = new $file;
367
+
368
+                // Show modules according to features level
369
+                if ($modCodeTiers->version == 'development'  && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
370
+                if ($modCodeTiers->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
371
+
372
+                print '<tr class="oddeven">'."\n";
373
+                print '<td width="140">'.$modCodeTiers->name.'</td>'."\n";
374
+                print '<td>'.$modCodeTiers->info($langs).'</td>'."\n";
375
+                print '<td class="nowrap">'.$modCodeTiers->getExample($langs).'</td>'."\n";
376
+
377
+                if ($conf->global->SOCIETE_CODECLIENT_ADDON == "$file")
378
+                {
379
+                    print '<td align="center">'."\n";
380
+                    print img_picto($langs->trans("Activated"),'switch_on');
381
+                    print "</td>\n";
382
+                }
383
+                else
384
+                {
385
+                    $disabled = false;
386
+                    if (! empty($conf->multicompany->enabled) && (is_object($mc) && ! empty($mc->sharings['referent']) && $mc->sharings['referent'] == $conf->entity) ? false : true);
387
+                    print '<td align="center">';
388
+                    if (! $disabled) print '<a href="'.$_SERVER['PHP_SELF'].'?action=setcodeclient&value='.$file.'">';
389
+                    print img_picto($langs->trans("Disabled"),'switch_off');
390
+                    if (! $disabled) print '</a>';
391
+                    print '</td>';
392
+                }
393
+
394
+                print '<td align="center">';
395
+                $s=$modCodeTiers->getToolTip($langs,null,-1);
396
+                print $form->textwithpicto('',$s,1);
397
+                print '</td>';
398
+
399
+                print '</tr>';
400
+            }
401
+        }
402
+        closedir($handle);
403 403
     }
404 404
 }
405 405
 print '</table>';
@@ -423,53 +423,53 @@  discard block
 block discarded – undo
423 423
 
424 424
 foreach ($dirsociete as $dirroot)
425 425
 {
426
-	$dir = dol_buildpath($dirroot,0);
426
+    $dir = dol_buildpath($dirroot,0);
427 427
 
428
-	$handle = @opendir($dir);
428
+    $handle = @opendir($dir);
429 429
     if (is_resource($handle))
430 430
     {
431
-    	while (($file = readdir($handle))!==false)
432
-    	{
433
-    		if (substr($file, 0, 15) == 'mod_codecompta_' && substr($file, -3) == 'php')
434
-    		{
435
-    			$file = substr($file, 0, dol_strlen($file)-4);
436
-
437
-    		    try {
438
-        			dol_include_once($dirroot.$file.'.php');
439
-    			}
440
-    			catch(Exception $e)
441
-    			{
442
-    			    dol_syslog($e->getMessage(), LOG_ERR);
443
-    			}
444
-
445
-    			$modCodeCompta = new $file;
446
-
447
-    			print '<tr class="oddeven">';
448
-    			print '<td>'.$modCodeCompta->name."</td><td>\n";
449
-    			print $modCodeCompta->info($langs);
450
-    			print '</td>';
451
-    			print '<td class="nowrap">'.$modCodeCompta->getExample($langs)."</td>\n";
452
-
453
-    			if ($conf->global->SOCIETE_CODECOMPTA_ADDON == "$file")
454
-    			{
455
-    				print '<td align="center">';
456
-    				print img_picto($langs->trans("Activated"),'switch_on');
457
-    				print '</td>';
458
-    			}
459
-    			else
460
-    			{
461
-    				print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setcodecompta&value='.$file.'">';
462
-    				print img_picto($langs->trans("Disabled"),'switch_off');
463
-    				print '</a></td>';
464
-    			}
465
-    			print '<td align="center">';
466
-    			$s=$modCodeCompta->getToolTip($langs,null,-1);
467
-    			print $form->textwithpicto('',$s,1);
468
-    			print '</td>';
469
-    			print "</tr>\n";
470
-    		}
471
-    	}
472
-    	closedir($handle);
431
+        while (($file = readdir($handle))!==false)
432
+        {
433
+            if (substr($file, 0, 15) == 'mod_codecompta_' && substr($file, -3) == 'php')
434
+            {
435
+                $file = substr($file, 0, dol_strlen($file)-4);
436
+
437
+                try {
438
+                    dol_include_once($dirroot.$file.'.php');
439
+                }
440
+                catch(Exception $e)
441
+                {
442
+                    dol_syslog($e->getMessage(), LOG_ERR);
443
+                }
444
+
445
+                $modCodeCompta = new $file;
446
+
447
+                print '<tr class="oddeven">';
448
+                print '<td>'.$modCodeCompta->name."</td><td>\n";
449
+                print $modCodeCompta->info($langs);
450
+                print '</td>';
451
+                print '<td class="nowrap">'.$modCodeCompta->getExample($langs)."</td>\n";
452
+
453
+                if ($conf->global->SOCIETE_CODECOMPTA_ADDON == "$file")
454
+                {
455
+                    print '<td align="center">';
456
+                    print img_picto($langs->trans("Activated"),'switch_on');
457
+                    print '</td>';
458
+                }
459
+                else
460
+                {
461
+                    print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setcodecompta&value='.$file.'">';
462
+                    print img_picto($langs->trans("Disabled"),'switch_off');
463
+                    print '</a></td>';
464
+                }
465
+                print '<td align="center">';
466
+                $s=$modCodeCompta->getToolTip($langs,null,-1);
467
+                print $form->textwithpicto('',$s,1);
468
+                print '</td>';
469
+                print "</tr>\n";
470
+            }
471
+        }
472
+        closedir($handle);
473 473
     }
474 474
 }
475 475
 print "</table>\n";
@@ -490,18 +490,18 @@  discard block
 block discarded – undo
490 490
 $resql=$db->query($sql);
491 491
 if ($resql)
492 492
 {
493
-	$i = 0;
494
-	$num_rows=$db->num_rows($resql);
495
-	while ($i < $num_rows)
496
-	{
497
-		$array = $db->fetch_array($resql);
498
-		array_push($def, $array[0]);
499
-		$i++;
500
-	}
493
+    $i = 0;
494
+    $num_rows=$db->num_rows($resql);
495
+    while ($i < $num_rows)
496
+    {
497
+        $array = $db->fetch_array($resql);
498
+        array_push($def, $array[0]);
499
+        $i++;
500
+    }
501 501
 }
502 502
 else
503 503
 {
504
-	dol_print_error($db);
504
+    dol_print_error($db);
505 505
 }
506 506
 
507 507
 print '<table class="noborder" width="100%">';
@@ -515,108 +515,108 @@  discard block
 block discarded – undo
515 515
 
516 516
 foreach ($dirsociete as $dirroot)
517 517
 {
518
-	$dir = dol_buildpath($dirroot.'doc/',0);
519
-
520
-	$handle=@opendir($dir);
521
-	if (is_resource($handle))
522
-	{
523
-		while (($file = readdir($handle))!==false)
524
-		{
525
-			if (preg_match('/\.modules\.php$/i',$file))
526
-			{
527
-				$name = substr($file, 4, dol_strlen($file) -16);
528
-				$classname = substr($file, 0, dol_strlen($file) -12);
529
-
530
-			    try {
531
-        			dol_include_once($dirroot.'doc/'.$file);
532
-    			}
533
-    			catch(Exception $e)
534
-    			{
535
-    			    dol_syslog($e->getMessage(), LOG_ERR);
536
-    			}
537
-
538
-    			$module = new $classname($db);
539
-
540
-				$modulequalified=1;
541
-				if (! empty($module->version)) {
542
-					if ($module->version == 'development'  && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
543
-					else if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
544
-				}
545
-
546
-				if ($modulequalified)
547
-				{
548
-					print '<tr class="oddeven"><td width="100">';
549
-					print $module->name;
550
-					print "</td><td>\n";
551
-					if (method_exists($module,'info')) print $module->info($langs);
552
-					else print $module->description;
553
-					print '</td>';
554
-
555
-					// Activate / Disable
556
-					if (in_array($name, $def))
557
-					{
558
-						print "<td align=\"center\">\n";
559
-						//if ($conf->global->COMPANY_ADDON_PDF != "$name")
560
-						//{
561
-							print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">';
562
-							print img_picto($langs->trans("Enabled"),'switch_on');
563
-							print '</a>';
564
-						//}
565
-						//else
566
-						//{
567
-						//	print img_picto($langs->trans("Enabled"),'on');
568
-						//}
569
-						print "</td>";
570
-					}
571
-					else
572
-					{
573
-						if (versioncompare($module->phpmin,versionphparray()) > 0)
574
-						{
575
-							print "<td align=\"center\">\n";
576
-							print img_picto(dol_escape_htmltag($langs->trans("ErrorModuleRequirePHPVersion",join('.',$module->phpmin))),'switch_off');
577
-							print "</td>";
578
-						}
579
-						else
580
-						{
581
-							print "<td align=\"center\">\n";
582
-							print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
583
-							print "</td>";
584
-						}
585
-					}
586
-
587
-					// Info
588
-					$htmltooltip =    ''.$langs->trans("Name").': '.$module->name;
589
-					$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
590
-					if ($module->type == 'pdf')
591
-					{
592
-						$htmltooltip.='<br>'.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur;
593
-					}
594
-					$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
595
-					$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraft").': '.yn((! empty($module->option_draft_watermark)?$module->option_draft_watermark:''), 1, 1);
596
-
597
-					print '<td align="center" class="nowrap">';
598
-					print $form->textwithpicto('',$htmltooltip,1,0);
599
-					print '</td>';
600
-
601
-					// Preview
602
-					print '<td align="center" class="nowrap">';
603
-					if ($module->type == 'pdf')
604
-					{
605
-						$linkspec='<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>';
606
-					}
607
-					else
608
-					{
609
-						$linkspec=img_object($langs->trans("PreviewNotAvailable"),'generic');
610
-					}
611
-					print $linkspec;
612
-					print '</td>';
613
-
614
-					print "</tr>\n";
615
-				}
616
-			}
617
-		}
618
-		closedir($handle);
619
-	}
518
+    $dir = dol_buildpath($dirroot.'doc/',0);
519
+
520
+    $handle=@opendir($dir);
521
+    if (is_resource($handle))
522
+    {
523
+        while (($file = readdir($handle))!==false)
524
+        {
525
+            if (preg_match('/\.modules\.php$/i',$file))
526
+            {
527
+                $name = substr($file, 4, dol_strlen($file) -16);
528
+                $classname = substr($file, 0, dol_strlen($file) -12);
529
+
530
+                try {
531
+                    dol_include_once($dirroot.'doc/'.$file);
532
+                }
533
+                catch(Exception $e)
534
+                {
535
+                    dol_syslog($e->getMessage(), LOG_ERR);
536
+                }
537
+
538
+                $module = new $classname($db);
539
+
540
+                $modulequalified=1;
541
+                if (! empty($module->version)) {
542
+                    if ($module->version == 'development'  && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
543
+                    else if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
544
+                }
545
+
546
+                if ($modulequalified)
547
+                {
548
+                    print '<tr class="oddeven"><td width="100">';
549
+                    print $module->name;
550
+                    print "</td><td>\n";
551
+                    if (method_exists($module,'info')) print $module->info($langs);
552
+                    else print $module->description;
553
+                    print '</td>';
554
+
555
+                    // Activate / Disable
556
+                    if (in_array($name, $def))
557
+                    {
558
+                        print "<td align=\"center\">\n";
559
+                        //if ($conf->global->COMPANY_ADDON_PDF != "$name")
560
+                        //{
561
+                            print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">';
562
+                            print img_picto($langs->trans("Enabled"),'switch_on');
563
+                            print '</a>';
564
+                        //}
565
+                        //else
566
+                        //{
567
+                        //	print img_picto($langs->trans("Enabled"),'on');
568
+                        //}
569
+                        print "</td>";
570
+                    }
571
+                    else
572
+                    {
573
+                        if (versioncompare($module->phpmin,versionphparray()) > 0)
574
+                        {
575
+                            print "<td align=\"center\">\n";
576
+                            print img_picto(dol_escape_htmltag($langs->trans("ErrorModuleRequirePHPVersion",join('.',$module->phpmin))),'switch_off');
577
+                            print "</td>";
578
+                        }
579
+                        else
580
+                        {
581
+                            print "<td align=\"center\">\n";
582
+                            print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
583
+                            print "</td>";
584
+                        }
585
+                    }
586
+
587
+                    // Info
588
+                    $htmltooltip =    ''.$langs->trans("Name").': '.$module->name;
589
+                    $htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
590
+                    if ($module->type == 'pdf')
591
+                    {
592
+                        $htmltooltip.='<br>'.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur;
593
+                    }
594
+                    $htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
595
+                    $htmltooltip.='<br>'.$langs->trans("WatermarkOnDraft").': '.yn((! empty($module->option_draft_watermark)?$module->option_draft_watermark:''), 1, 1);
596
+
597
+                    print '<td align="center" class="nowrap">';
598
+                    print $form->textwithpicto('',$htmltooltip,1,0);
599
+                    print '</td>';
600
+
601
+                    // Preview
602
+                    print '<td align="center" class="nowrap">';
603
+                    if ($module->type == 'pdf')
604
+                    {
605
+                        $linkspec='<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>';
606
+                    }
607
+                    else
608
+                    {
609
+                        $linkspec=img_object($langs->trans("PreviewNotAvailable"),'generic');
610
+                    }
611
+                    print $linkspec;
612
+                    print '</td>';
613
+
614
+                    print "</tr>\n";
615
+                }
616
+            }
617
+        }
618
+        closedir($handle);
619
+    }
620 620
 }
621 621
 print '</table>';
622 622
 
@@ -652,63 +652,63 @@  discard block
 block discarded – undo
652 652
 $nbofloop=count($profid);
653 653
 foreach($profid as $key => $val)
654 654
 {
655
-	if ($profid[$key][1]!='-')
656
-	{
657
-		print '<tr class="oddeven">';
658
-		print '<td>'.$profid[$key][0]."</td><td>\n";
659
-		print $profid[$key][1];
660
-		print '</td>';
661
-
662
-		$idprof_unique ='SOCIETE_'.$key.'_UNIQUE';
663
-		$idprof_mandatory ='SOCIETE_'.$key.'_MANDATORY';
664
-		$idprof_invoice_mandatory ='SOCIETE_'.$key.'_INVOICE_MANDATORY';
665
-
666
-		$verif=(empty($conf->global->$idprof_unique)?false:true);
667
-		$mandatory=(empty($conf->global->$idprof_mandatory)?false:true);
668
-		$invoice_mandatory=(empty($conf->global->$idprof_invoice_mandatory)?false:true);
669
-
670
-		if ($verif)
671
-		{
672
-			print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofid&value='.$key.'&status=0">';
673
-			print img_picto($langs->trans("Activated"),'switch_on');
674
-			print '</a></td>';
675
-		}
676
-		else
677
-		{
678
-			print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofid&value='.$key.'&status=1">';
679
-			print img_picto($langs->trans("Disabled"),'switch_off');
680
-			print '</a></td>';
681
-		}
682
-
683
-		if ($mandatory)
684
-		{
685
-			print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidmandatory&value='.$key.'&status=0">';
686
-			print img_picto($langs->trans("Activated"),'switch_on');
687
-			print '</a></td>';
688
-		}
689
-		else
690
-		{
691
-			print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidmandatory&value='.$key.'&status=1">';
692
-			print img_picto($langs->trans("Disabled"),'switch_off');
693
-			print '</a></td>';
694
-		}
695
-
696
-		if ($invoice_mandatory)
697
-		{
698
-			print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidinvoicemandatory&value='.$key.'&status=0">';
699
-			print img_picto($langs->trans("Activated"),'switch_on');
700
-			print '</a></td>';
701
-		}
702
-		else
703
-		{
704
-			print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidinvoicemandatory&value='.$key.'&status=1">';
705
-			print img_picto($langs->trans("Disabled"),'switch_off');
706
-			print '</a></td>';
707
-		}
708
-
709
-		print "</tr>\n";
710
-	}
711
-	$i++;
655
+    if ($profid[$key][1]!='-')
656
+    {
657
+        print '<tr class="oddeven">';
658
+        print '<td>'.$profid[$key][0]."</td><td>\n";
659
+        print $profid[$key][1];
660
+        print '</td>';
661
+
662
+        $idprof_unique ='SOCIETE_'.$key.'_UNIQUE';
663
+        $idprof_mandatory ='SOCIETE_'.$key.'_MANDATORY';
664
+        $idprof_invoice_mandatory ='SOCIETE_'.$key.'_INVOICE_MANDATORY';
665
+
666
+        $verif=(empty($conf->global->$idprof_unique)?false:true);
667
+        $mandatory=(empty($conf->global->$idprof_mandatory)?false:true);
668
+        $invoice_mandatory=(empty($conf->global->$idprof_invoice_mandatory)?false:true);
669
+
670
+        if ($verif)
671
+        {
672
+            print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofid&value='.$key.'&status=0">';
673
+            print img_picto($langs->trans("Activated"),'switch_on');
674
+            print '</a></td>';
675
+        }
676
+        else
677
+        {
678
+            print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofid&value='.$key.'&status=1">';
679
+            print img_picto($langs->trans("Disabled"),'switch_off');
680
+            print '</a></td>';
681
+        }
682
+
683
+        if ($mandatory)
684
+        {
685
+            print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidmandatory&value='.$key.'&status=0">';
686
+            print img_picto($langs->trans("Activated"),'switch_on');
687
+            print '</a></td>';
688
+        }
689
+        else
690
+        {
691
+            print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidmandatory&value='.$key.'&status=1">';
692
+            print img_picto($langs->trans("Disabled"),'switch_off');
693
+            print '</a></td>';
694
+        }
695
+
696
+        if ($invoice_mandatory)
697
+        {
698
+            print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidinvoicemandatory&value='.$key.'&status=0">';
699
+            print img_picto($langs->trans("Activated"),'switch_on');
700
+            print '</a></td>';
701
+        }
702
+        else
703
+        {
704
+            print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidinvoicemandatory&value='.$key.'&status=1">';
705
+            print img_picto($langs->trans("Disabled"),'switch_off');
706
+            print '</a></td>';
707
+        }
708
+
709
+        print "</tr>\n";
710
+    }
711
+    $i++;
712 712
 }
713 713
 
714 714
 print "</table><br>\n";
@@ -735,22 +735,22 @@  discard block
 block discarded – undo
735 735
 print '<td width="80%">'.$form->textwithpicto($langs->trans("DelaiedFullListToSelectCompany"),$langs->trans('UseSearchToSelectCompanyTooltip'),1).' </td>';
736 736
 if (! $conf->use_javascript_ajax)
737 737
 {
738
-	print '<td class="nowrap" align="right" colspan="2">';
739
-	print $langs->trans("NotAvailableWhenAjaxDisabled");
740
-	print "</td>";
738
+    print '<td class="nowrap" align="right" colspan="2">';
739
+    print $langs->trans("NotAvailableWhenAjaxDisabled");
740
+    print "</td>";
741 741
 }
742 742
 else
743 743
 {
744
-	print '<td width="60" align="right">';
745
-	$arrval=array('0'=>$langs->trans("No"),
746
-	'1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",1).')',
744
+    print '<td width="60" align="right">';
745
+    $arrval=array('0'=>$langs->trans("No"),
746
+    '1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",1).')',
747 747
     '2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",2).')',
748 748
     '3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",3).')',
749
-	);
750
-	print $form->selectarray("activate_COMPANY_USE_SEARCH_TO_SELECT", $arrval, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
751
-	print '</td><td align="right">';
752
-	print '<input type="submit" class="button" name="COMPANY_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">';
753
-	print "</td>";
749
+    );
750
+    print $form->selectarray("activate_COMPANY_USE_SEARCH_TO_SELECT", $arrval, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
751
+    print '</td><td align="right">';
752
+    print '<input type="submit" class="button" name="COMPANY_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">';
753
+    print "</td>";
754 754
 }
755 755
 print '</tr>';
756 756
 
@@ -759,22 +759,22 @@  discard block
 block discarded – undo
759 759
 print '<td width="80%">'.$form->textwithpicto($langs->trans("DelaiedFullListToSelectContact"),$langs->trans('UseSearchToSelectContactTooltip'),1).'</td>';
760 760
 if (! $conf->use_javascript_ajax)
761 761
 {
762
-	print '<td class="nowrap" align="right" colspan="2">';
763
-	print $langs->trans("NotAvailableWhenAjaxDisabled");
764
-	print "</td>";
762
+    print '<td class="nowrap" align="right" colspan="2">';
763
+    print $langs->trans("NotAvailableWhenAjaxDisabled");
764
+    print "</td>";
765 765
 }
766 766
 else
767 767
 {
768
-	print '<td width="60" align="right">';
769
-	$arrval=array('0'=>$langs->trans("No"),
770
-	'1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",1).')',
771
-	'2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",2).')',
772
-	'3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",3).')',
773
-	);
774
-	print $form->selectarray("activate_CONTACT_USE_SEARCH_TO_SELECT", $arrval, $conf->global->CONTACT_USE_SEARCH_TO_SELECT);
775
-	print '</td><td align="right">';
776
-	print '<input type="submit" class="button" name="CONTACT_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">';
777
-	print "</td>";
768
+    print '<td width="60" align="right">';
769
+    $arrval=array('0'=>$langs->trans("No"),
770
+    '1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",1).')',
771
+    '2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",2).')',
772
+    '3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",3).')',
773
+    );
774
+    print $form->selectarray("activate_CONTACT_USE_SEARCH_TO_SELECT", $arrval, $conf->global->CONTACT_USE_SEARCH_TO_SELECT);
775
+    print '</td><td align="right">';
776
+    print '<input type="submit" class="button" name="CONTACT_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">';
777
+    print "</td>";
778 778
 }
779 779
 print '</tr>';
780 780
 
@@ -786,13 +786,13 @@  discard block
 block discarded – undo
786 786
 print '<td align="center">';
787 787
 if (!empty($conf->global->SOCIETE_ADD_REF_IN_LIST))
788 788
 {
789
-	print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaddrefinlist&value=0">';
790
-	print img_picto($langs->trans("Activated"),'switch_on');
789
+    print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaddrefinlist&value=0">';
790
+    print img_picto($langs->trans("Activated"),'switch_on');
791 791
 }
792 792
 else
793 793
 {
794
-	print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaddrefinlist&value=1">';
795
-	print img_picto($langs->trans("Disabled"),'switch_off');
794
+    print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaddrefinlist&value=1">';
795
+    print img_picto($langs->trans("Disabled"),'switch_off');
796 796
 }
797 797
 print '</a></td>';
798 798
 print '</tr>';
@@ -803,13 +803,13 @@  discard block
 block discarded – undo
803 803
 print '<td align="center">';
804 804
 if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST))
805 805
 {
806
-	print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaddadressinlist&value=0">';
807
-	print img_picto($langs->trans("Activated"),'switch_on');
806
+    print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaddadressinlist&value=0">';
807
+    print img_picto($langs->trans("Activated"),'switch_on');
808 808
 }
809 809
 else
810 810
 {
811
-	print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaddadressinlist&value=1">';
812
-	print img_picto($langs->trans("Disabled"),'switch_off');
811
+    print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaddadressinlist&value=1">';
812
+    print img_picto($langs->trans("Disabled"),'switch_off');
813 813
 }
814 814
 print '</a></td>';
815 815
 print '</tr>';
@@ -822,13 +822,13 @@  discard block
 block discarded – undo
822 822
 print '<td align="center">';
823 823
 if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD))
824 824
 {
825
-	print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaskforshippingmet&value=0">';
826
-	print img_picto($langs->trans("Activated"),'switch_on');
825
+    print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaskforshippingmet&value=0">';
826
+    print img_picto($langs->trans("Activated"),'switch_on');
827 827
 }
828 828
 else
829 829
 {
830
-	print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaskforshippingmet&value=1">';
831
-	print img_picto($langs->trans("Disabled"),'switch_off');
830
+    print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaskforshippingmet&value=1">';
831
+    print img_picto($langs->trans("Disabled"),'switch_off');
832 832
 }
833 833
 print '</a></td>';
834 834
 print '</tr>';
Please login to merge, or discard this patch.
Spacing   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 
32 32
 $langs->loadLangs(array("admin", "other"));
33 33
 
34
-$action=GETPOST('action','alpha');
35
-$value=GETPOST('value','alpha');
34
+$action = GETPOST('action', 'alpha');
35
+$value = GETPOST('value', 'alpha');
36 36
 
37 37
 if (!$user->admin) accessforbidden();
38 38
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
 if ($action == 'setcodeclient')
48 48
 {
49
-	if (dolibarr_set_const($db, "SOCIETE_CODECLIENT_ADDON",$value,'chaine',0,'',$conf->entity) > 0)
49
+	if (dolibarr_set_const($db, "SOCIETE_CODECLIENT_ADDON", $value, 'chaine', 0, '', $conf->entity) > 0)
50 50
 	{
51 51
 		header("Location: ".$_SERVER["PHP_SELF"]);
52 52
 		exit;
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
 if ($action == 'setcodecompta')
61 61
 {
62
-	if (dolibarr_set_const($db, "SOCIETE_CODECOMPTA_ADDON",$value,'chaine',0,'',$conf->entity) > 0)
62
+	if (dolibarr_set_const($db, "SOCIETE_CODECOMPTA_ADDON", $value, 'chaine', 0, '', $conf->entity) > 0)
63 63
 	{
64 64
 		header("Location: ".$_SERVER["PHP_SELF"]);
65 65
 		exit;
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
 {
75 75
 	if (GETPOST('COMPANY_USE_SEARCH_TO_SELECT'))
76 76
 	{
77
-		$companysearch = GETPOST('activate_COMPANY_USE_SEARCH_TO_SELECT','alpha');
78
-		$res = dolibarr_set_const($db, "COMPANY_USE_SEARCH_TO_SELECT", $companysearch,'chaine',0,'',$conf->entity);
79
-		if (! $res > 0) $error++;
80
-		if (! $error)
77
+		$companysearch = GETPOST('activate_COMPANY_USE_SEARCH_TO_SELECT', 'alpha');
78
+		$res = dolibarr_set_const($db, "COMPANY_USE_SEARCH_TO_SELECT", $companysearch, 'chaine', 0, '', $conf->entity);
79
+		if (!$res > 0) $error++;
80
+		if (!$error)
81 81
 	    {
82 82
 		    setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
83 83
 	    }
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
 
90 90
 	if (GETPOST('CONTACT_USE_SEARCH_TO_SELECT'))
91 91
 	{
92
-		$contactsearch = GETPOST('activate_CONTACT_USE_SEARCH_TO_SELECT','alpha');
93
-		$res = dolibarr_set_const($db, "CONTACT_USE_SEARCH_TO_SELECT", $contactsearch,'chaine',0,'',$conf->entity);
94
-		if (! $res > 0) $error++;
95
-		if (! $error)
92
+		$contactsearch = GETPOST('activate_CONTACT_USE_SEARCH_TO_SELECT', 'alpha');
93
+		$res = dolibarr_set_const($db, "CONTACT_USE_SEARCH_TO_SELECT", $contactsearch, 'chaine', 0, '', $conf->entity);
94
+		if (!$res > 0) $error++;
95
+		if (!$error)
96 96
 		{
97 97
 			setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
98 98
 		}
@@ -106,56 +106,56 @@  discard block
 block discarded – undo
106 106
 // Activate a document generator module
107 107
 if ($action == 'set')
108 108
 {
109
-	$label = GETPOST('label','alpha');
110
-	$scandir = GETPOST('scan_dir','alpha');
109
+	$label = GETPOST('label', 'alpha');
110
+	$scandir = GETPOST('scan_dir', 'alpha');
111 111
 
112
-	$type='company';
112
+	$type = 'company';
113 113
 	$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
114
-	$sql.= " VALUES ('".$db->escape($value)."','".$type."',".$conf->entity.", ";
115
-	$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
116
-	$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
117
-	$sql.= ")";
114
+	$sql .= " VALUES ('".$db->escape($value)."','".$type."',".$conf->entity.", ";
115
+	$sql .= ($label ? "'".$db->escape($label)."'" : 'null').", ";
116
+	$sql .= (!empty($scandir) ? "'".$db->escape($scandir)."'" : "null");
117
+	$sql .= ")";
118 118
 
119
-	$resql=$db->query($sql);
120
-	if (! $resql) dol_print_error($db);
119
+	$resql = $db->query($sql);
120
+	if (!$resql) dol_print_error($db);
121 121
 }
122 122
 
123 123
 // Disable a document generator module
124
-if ($action== 'del')
124
+if ($action == 'del')
125 125
 {
126
-	$type='company';
126
+	$type = 'company';
127 127
 	$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
128
-	$sql.= " WHERE nom='".$db->escape($value)."' AND type='".$type."' AND entity=".$conf->entity;
129
-	$resql=$db->query($sql);
130
-	if (! $resql) dol_print_error($db);
128
+	$sql .= " WHERE nom='".$db->escape($value)."' AND type='".$type."' AND entity=".$conf->entity;
129
+	$resql = $db->query($sql);
130
+	if (!$resql) dol_print_error($db);
131 131
 }
132 132
 
133 133
 // Define default generator
134 134
 if ($action == 'setdoc')
135 135
 {
136
-	$label = GETPOST('label','alpha');
137
-	$scandir = GETPOST('scan_dir','alpha');
136
+	$label = GETPOST('label', 'alpha');
137
+	$scandir = GETPOST('scan_dir', 'alpha');
138 138
 
139 139
 	$db->begin();
140 140
 
141
-	dolibarr_set_const($db, "COMPANY_ADDON_PDF",$value,'chaine',0,'',$conf->entity);
141
+	dolibarr_set_const($db, "COMPANY_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity);
142 142
 
143 143
 	// On active le modele
144
-	$type='company';
144
+	$type = 'company';
145 145
 	$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
146
-	$sql_del.= " WHERE nom = '".$db->escape(GETPOST('value','alpha'))."'";
147
-	$sql_del.= " AND type = '".$type."'";
148
-	$sql_del.= " AND entity = ".$conf->entity;
146
+	$sql_del .= " WHERE nom = '".$db->escape(GETPOST('value', 'alpha'))."'";
147
+	$sql_del .= " AND type = '".$type."'";
148
+	$sql_del .= " AND entity = ".$conf->entity;
149 149
     dol_syslog("societe.php ".$sql);
150
-	$result1=$db->query($sql_del);
150
+	$result1 = $db->query($sql_del);
151 151
 
152 152
 	$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
153
-	$sql.= " VALUES ('".$db->escape($value)."', '".$type."', ".$conf->entity.", ";
154
-	$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
155
-	$sql.= (! empty($scandir)?"'".$db->escape($scandir)."'":"null");
156
-	$sql.= ")";
153
+	$sql .= " VALUES ('".$db->escape($value)."', '".$type."', ".$conf->entity.", ";
154
+	$sql .= ($label ? "'".$db->escape($label)."'" : 'null').", ";
155
+	$sql .= (!empty($scandir) ? "'".$db->escape($scandir)."'" : "null");
156
+	$sql .= ")";
157 157
     dol_syslog("societe.php", LOG_DEBUG);
158
-	$result2=$db->query($sql);
158
+	$result2 = $db->query($sql);
159 159
 	if ($result1 && $result2)
160 160
 	{
161 161
 		$db->commit();
@@ -167,11 +167,11 @@  discard block
 block discarded – undo
167 167
 }
168 168
 
169 169
 //Activate Set ref in list
170
-if ($action=="setaddrefinlist") {
171
-	$setaddrefinlist = GETPOST('value','int');
172
-	$res = dolibarr_set_const($db, "SOCIETE_ADD_REF_IN_LIST", $setaddrefinlist,'yesno',0,'',$conf->entity);
173
-	if (! $res > 0) $error++;
174
-	if (! $error)
170
+if ($action == "setaddrefinlist") {
171
+	$setaddrefinlist = GETPOST('value', 'int');
172
+	$res = dolibarr_set_const($db, "SOCIETE_ADD_REF_IN_LIST", $setaddrefinlist, 'yesno', 0, '', $conf->entity);
173
+	if (!$res > 0) $error++;
174
+	if (!$error)
175 175
 	{
176 176
 		setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
177 177
 	}
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
 }
183 183
 
184 184
 //Activate Set adress in list
185
-if ($action=="setaddadressinlist") {
186
-	$val = GETPOST('value','int');
187
-	$res = dolibarr_set_const($db, "COMPANY_SHOW_ADDRESS_SELECTLIST", $val,'yesno',0,'',$conf->entity);
188
-	if (! $res > 0) $error++;
189
-	if (! $error)
185
+if ($action == "setaddadressinlist") {
186
+	$val = GETPOST('value', 'int');
187
+	$res = dolibarr_set_const($db, "COMPANY_SHOW_ADDRESS_SELECTLIST", $val, 'yesno', 0, '', $conf->entity);
188
+	if (!$res > 0) $error++;
189
+	if (!$error)
190 190
 	{
191 191
 		setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
192 192
 	}
@@ -197,11 +197,11 @@  discard block
 block discarded – undo
197 197
 }
198 198
 
199 199
 //Activate Ask For Preferred Shipping Method
200
-if ($action=="setaskforshippingmet") {
201
-	$setaskforshippingmet = GETPOST('value','int');
202
-	$res = dolibarr_set_const($db, "SOCIETE_ASK_FOR_SHIPPING_METHOD", $setaskforshippingmet,'yesno',0,'',$conf->entity);
203
-	if (! $res > 0) $error++;
204
-	if (! $error)
200
+if ($action == "setaskforshippingmet") {
201
+	$setaskforshippingmet = GETPOST('value', 'int');
202
+	$res = dolibarr_set_const($db, "SOCIETE_ASK_FOR_SHIPPING_METHOD", $setaskforshippingmet, 'yesno', 0, '', $conf->entity);
203
+	if (!$res > 0) $error++;
204
+	if (!$error)
205 205
 	{
206 206
 		setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
207 207
 	}
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
 }
213 213
 
214 214
 //Activate "Disable prospect/customer type"
215
-if ($action=="setdisableprospectcustomer") {
216
-    $setdisableprospectcustomer = GETPOST('value','int');
217
-    $res = dolibarr_set_const($db, "SOCIETE_DISABLE_PROSPECTSCUSTOMERS", $setdisableprospectcustomer,'yesno',0,'',$conf->entity);
218
-    if (! $res > 0) $error++;
219
-    if (! $error)
215
+if ($action == "setdisableprospectcustomer") {
216
+    $setdisableprospectcustomer = GETPOST('value', 'int');
217
+    $res = dolibarr_set_const($db, "SOCIETE_DISABLE_PROSPECTSCUSTOMERS", $setdisableprospectcustomer, 'yesno', 0, '', $conf->entity);
218
+    if (!$res > 0) $error++;
219
+    if (!$error)
220 220
     {
221 221
         setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
222 222
     }
@@ -229,9 +229,9 @@  discard block
 block discarded – undo
229 229
 //Activate ProfId unique
230 230
 if ($action == 'setprofid')
231 231
 {
232
-	$status = GETPOST('status','alpha');
232
+	$status = GETPOST('status', 'alpha');
233 233
 
234
-	$idprof="SOCIETE_".$value."_UNIQUE";
234
+	$idprof = "SOCIETE_".$value."_UNIQUE";
235 235
 	if (dolibarr_set_const($db, $idprof, $status, 'chaine', 0, '', $conf->entity) > 0)
236 236
 	{
237 237
 		//header("Location: ".$_SERVER["PHP_SELF"]);
@@ -246,9 +246,9 @@  discard block
 block discarded – undo
246 246
 //Activate ProfId mandatory
247 247
 if ($action == 'setprofidmandatory')
248 248
 {
249
-	$status = GETPOST('status','alpha');
249
+	$status = GETPOST('status', 'alpha');
250 250
 
251
-	$idprof="SOCIETE_".$value."_MANDATORY";
251
+	$idprof = "SOCIETE_".$value."_MANDATORY";
252 252
 	if (dolibarr_set_const($db, $idprof, $status, 'chaine', 0, '', $conf->entity) > 0)
253 253
 	{
254 254
 		//header("Location: ".$_SERVER["PHP_SELF"]);
@@ -263,9 +263,9 @@  discard block
 block discarded – undo
263 263
 //Activate ProfId invoice mandatory
264 264
 if ($action == 'setprofidinvoicemandatory')
265 265
 {
266
-	$status = GETPOST('status','alpha');
266
+	$status = GETPOST('status', 'alpha');
267 267
 
268
-	$idprof="SOCIETE_".$value."_INVOICE_MANDATORY";
268
+	$idprof = "SOCIETE_".$value."_INVOICE_MANDATORY";
269 269
 	if (dolibarr_set_const($db, $idprof, $status, 'chaine', 0, '', $conf->entity) > 0)
270 270
 	{
271 271
 		//header("Location: ".$_SERVER["PHP_SELF"]);
@@ -280,9 +280,9 @@  discard block
 block discarded – undo
280 280
 //Set hide closed customer into combox or select
281 281
 if ($action == 'sethideinactivethirdparty')
282 282
 {
283
-	$status = GETPOST('status','alpha');
283
+	$status = GETPOST('status', 'alpha');
284 284
 
285
-	if (dolibarr_set_const($db, "COMPANY_HIDE_INACTIVE_IN_COMBOBOX",$status,'chaine',0,'',$conf->entity) > 0)
285
+	if (dolibarr_set_const($db, "COMPANY_HIDE_INACTIVE_IN_COMBOBOX", $status, 'chaine', 0, '', $conf->entity) > 0)
286 286
 	{
287 287
 		header("Location: ".$_SERVER["PHP_SELF"]);
288 288
 		exit;
@@ -292,11 +292,11 @@  discard block
 block discarded – undo
292 292
 		dol_print_error($db);
293 293
 	}
294 294
 }
295
-if($action=='setonsearchandlistgooncustomerorsuppliercard'){
296
-       $setonsearchandlistgooncustomerorsuppliercard = GETPOST('value','int');
297
-       $res = dolibarr_set_const($db, "SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD", $setonsearchandlistgooncustomerorsuppliercard,'yesno',0,'',$conf->entity);
298
-       if (! $res > 0) $error++;
299
-       if (! $error)
295
+if ($action == 'setonsearchandlistgooncustomerorsuppliercard') {
296
+       $setonsearchandlistgooncustomerorsuppliercard = GETPOST('value', 'int');
297
+       $res = dolibarr_set_const($db, "SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD", $setonsearchandlistgooncustomerorsuppliercard, 'yesno', 0, '', $conf->entity);
298
+       if (!$res > 0) $error++;
299
+       if (!$error)
300 300
        {
301 301
                setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
302 302
        }
@@ -313,24 +313,24 @@  discard block
 block discarded – undo
313 313
 
314 314
 clearstatcache();
315 315
 
316
-$form=new Form($db);
316
+$form = new Form($db);
317 317
 
318
-$help_url='EN:Module Third Parties setup|FR:Paramétrage_du_module_Tiers|ES:Configuración_del_módulo_terceros';
319
-llxHeader('',$langs->trans("CompanySetup"),$help_url);
318
+$help_url = 'EN:Module Third Parties setup|FR:Paramétrage_du_module_Tiers|ES:Configuración_del_módulo_terceros';
319
+llxHeader('', $langs->trans("CompanySetup"), $help_url);
320 320
 
321
-$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
322
-print load_fiche_titre($langs->trans("CompanySetup"),$linkback,'title_setup');
321
+$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
322
+print load_fiche_titre($langs->trans("CompanySetup"), $linkback, 'title_setup');
323 323
 
324 324
 
325 325
 $head = societe_admin_prepare_head();
326 326
 
327 327
 dol_fiche_head($head, 'general', $langs->trans("ThirdParties"), -1, 'company');
328 328
 
329
-$dirsociete=array_merge(array('/core/modules/societe/'),$conf->modules_parts['societe']);
329
+$dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']);
330 330
 
331 331
 // Module to manage customer/supplier code
332 332
 
333
-print load_fiche_titre($langs->trans("CompanyCodeChecker"),'','');
333
+print load_fiche_titre($langs->trans("CompanyCodeChecker"), '', '');
334 334
 
335 335
 print '<table class="noborder" width="100%">'."\n";
336 336
 print '<tr class="liste_titre">'."\n";
@@ -343,22 +343,22 @@  discard block
 block discarded – undo
343 343
 
344 344
 foreach ($dirsociete as $dirroot)
345 345
 {
346
-	$dir = dol_buildpath($dirroot,0);
346
+	$dir = dol_buildpath($dirroot, 0);
347 347
 
348 348
     $handle = @opendir($dir);
349 349
     if (is_resource($handle))
350 350
     {
351 351
     	// Loop on each module find in opened directory
352
-    	while (($file = readdir($handle))!==false)
352
+    	while (($file = readdir($handle)) !== false)
353 353
     	{
354 354
     		if (substr($file, 0, 15) == 'mod_codeclient_' && substr($file, -3) == 'php')
355 355
     		{
356
-    			$file = substr($file, 0, dol_strlen($file)-4);
356
+    			$file = substr($file, 0, dol_strlen($file) - 4);
357 357
 
358 358
     			try {
359 359
         			dol_include_once($dirroot.$file.'.php');
360 360
     			}
361
-    			catch(Exception $e)
361
+    			catch (Exception $e)
362 362
     			{
363 363
     			    dol_syslog($e->getMessage(), LOG_ERR);
364 364
     			}
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
     			$modCodeTiers = new $file;
367 367
 
368 368
     			// Show modules according to features level
369
-    			if ($modCodeTiers->version == 'development'  && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
369
+    			if ($modCodeTiers->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
370 370
     			if ($modCodeTiers->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
371 371
 
372 372
     			print '<tr class="oddeven">'."\n";
@@ -377,23 +377,23 @@  discard block
 block discarded – undo
377 377
     			if ($conf->global->SOCIETE_CODECLIENT_ADDON == "$file")
378 378
     			{
379 379
     				print '<td align="center">'."\n";
380
-    				print img_picto($langs->trans("Activated"),'switch_on');
380
+    				print img_picto($langs->trans("Activated"), 'switch_on');
381 381
     				print "</td>\n";
382 382
     			}
383 383
     			else
384 384
     			{
385 385
     				$disabled = false;
386
-    				if (! empty($conf->multicompany->enabled) && (is_object($mc) && ! empty($mc->sharings['referent']) && $mc->sharings['referent'] == $conf->entity) ? false : true);
386
+    				if (!empty($conf->multicompany->enabled) && (is_object($mc) && !empty($mc->sharings['referent']) && $mc->sharings['referent'] == $conf->entity) ? false : true);
387 387
     				print '<td align="center">';
388
-    				if (! $disabled) print '<a href="'.$_SERVER['PHP_SELF'].'?action=setcodeclient&value='.$file.'">';
389
-    				print img_picto($langs->trans("Disabled"),'switch_off');
390
-    				if (! $disabled) print '</a>';
388
+    				if (!$disabled) print '<a href="'.$_SERVER['PHP_SELF'].'?action=setcodeclient&value='.$file.'">';
389
+    				print img_picto($langs->trans("Disabled"), 'switch_off');
390
+    				if (!$disabled) print '</a>';
391 391
     				print '</td>';
392 392
     			}
393 393
 
394 394
     			print '<td align="center">';
395
-    			$s=$modCodeTiers->getToolTip($langs,null,-1);
396
-    			print $form->textwithpicto('',$s,1);
395
+    			$s = $modCodeTiers->getToolTip($langs, null, -1);
396
+    			print $form->textwithpicto('', $s, 1);
397 397
     			print '</td>';
398 398
 
399 399
     			print '</tr>';
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 
411 411
 // Select accountancy code numbering module
412 412
 
413
-print load_fiche_titre($langs->trans("AccountCodeManager"),'','');
413
+print load_fiche_titre($langs->trans("AccountCodeManager"), '', '');
414 414
 
415 415
 print '<table class="noborder" width="100%">';
416 416
 print '<tr class="liste_titre">';
@@ -423,21 +423,21 @@  discard block
 block discarded – undo
423 423
 
424 424
 foreach ($dirsociete as $dirroot)
425 425
 {
426
-	$dir = dol_buildpath($dirroot,0);
426
+	$dir = dol_buildpath($dirroot, 0);
427 427
 
428 428
 	$handle = @opendir($dir);
429 429
     if (is_resource($handle))
430 430
     {
431
-    	while (($file = readdir($handle))!==false)
431
+    	while (($file = readdir($handle)) !== false)
432 432
     	{
433 433
     		if (substr($file, 0, 15) == 'mod_codecompta_' && substr($file, -3) == 'php')
434 434
     		{
435
-    			$file = substr($file, 0, dol_strlen($file)-4);
435
+    			$file = substr($file, 0, dol_strlen($file) - 4);
436 436
 
437 437
     		    try {
438 438
         			dol_include_once($dirroot.$file.'.php');
439 439
     			}
440
-    			catch(Exception $e)
440
+    			catch (Exception $e)
441 441
     			{
442 442
     			    dol_syslog($e->getMessage(), LOG_ERR);
443 443
     			}
@@ -453,18 +453,18 @@  discard block
 block discarded – undo
453 453
     			if ($conf->global->SOCIETE_CODECOMPTA_ADDON == "$file")
454 454
     			{
455 455
     				print '<td align="center">';
456
-    				print img_picto($langs->trans("Activated"),'switch_on');
456
+    				print img_picto($langs->trans("Activated"), 'switch_on');
457 457
     				print '</td>';
458 458
     			}
459 459
     			else
460 460
     			{
461 461
     				print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setcodecompta&value='.$file.'">';
462
-    				print img_picto($langs->trans("Disabled"),'switch_off');
462
+    				print img_picto($langs->trans("Disabled"), 'switch_off');
463 463
     				print '</a></td>';
464 464
     			}
465 465
     			print '<td align="center">';
466
-    			$s=$modCodeCompta->getToolTip($langs,null,-1);
467
-    			print $form->textwithpicto('',$s,1);
466
+    			$s = $modCodeCompta->getToolTip($langs, null, -1);
467
+    			print $form->textwithpicto('', $s, 1);
468 468
     			print '</td>';
469 469
     			print "</tr>\n";
470 470
     		}
@@ -479,19 +479,19 @@  discard block
 block discarded – undo
479 479
  *  Document templates generators
480 480
  */
481 481
 print '<br>';
482
-print load_fiche_titre($langs->trans("ModelModules"),'','');
482
+print load_fiche_titre($langs->trans("ModelModules"), '', '');
483 483
 
484 484
 // Load array def with activated templates
485 485
 $def = array();
486 486
 $sql = "SELECT nom";
487
-$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
488
-$sql.= " WHERE type = 'company'";
489
-$sql.= " AND entity = ".$conf->entity;
490
-$resql=$db->query($sql);
487
+$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
488
+$sql .= " WHERE type = 'company'";
489
+$sql .= " AND entity = ".$conf->entity;
490
+$resql = $db->query($sql);
491 491
 if ($resql)
492 492
 {
493 493
 	$i = 0;
494
-	$num_rows=$db->num_rows($resql);
494
+	$num_rows = $db->num_rows($resql);
495 495
 	while ($i < $num_rows)
496 496
 	{
497 497
 		$array = $db->fetch_array($resql);
@@ -515,32 +515,32 @@  discard block
 block discarded – undo
515 515
 
516 516
 foreach ($dirsociete as $dirroot)
517 517
 {
518
-	$dir = dol_buildpath($dirroot.'doc/',0);
518
+	$dir = dol_buildpath($dirroot.'doc/', 0);
519 519
 
520
-	$handle=@opendir($dir);
520
+	$handle = @opendir($dir);
521 521
 	if (is_resource($handle))
522 522
 	{
523
-		while (($file = readdir($handle))!==false)
523
+		while (($file = readdir($handle)) !== false)
524 524
 		{
525
-			if (preg_match('/\.modules\.php$/i',$file))
525
+			if (preg_match('/\.modules\.php$/i', $file))
526 526
 			{
527
-				$name = substr($file, 4, dol_strlen($file) -16);
528
-				$classname = substr($file, 0, dol_strlen($file) -12);
527
+				$name = substr($file, 4, dol_strlen($file) - 16);
528
+				$classname = substr($file, 0, dol_strlen($file) - 12);
529 529
 
530 530
 			    try {
531 531
         			dol_include_once($dirroot.'doc/'.$file);
532 532
     			}
533
-    			catch(Exception $e)
533
+    			catch (Exception $e)
534 534
     			{
535 535
     			    dol_syslog($e->getMessage(), LOG_ERR);
536 536
     			}
537 537
 
538 538
     			$module = new $classname($db);
539 539
 
540
-				$modulequalified=1;
541
-				if (! empty($module->version)) {
542
-					if ($module->version == 'development'  && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
543
-					else if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
540
+				$modulequalified = 1;
541
+				if (!empty($module->version)) {
542
+					if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
543
+					else if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
544 544
 				}
545 545
 
546 546
 				if ($modulequalified)
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
 					print '<tr class="oddeven"><td width="100">';
549 549
 					print $module->name;
550 550
 					print "</td><td>\n";
551
-					if (method_exists($module,'info')) print $module->info($langs);
551
+					if (method_exists($module, 'info')) print $module->info($langs);
552 552
 					else print $module->description;
553 553
 					print '</td>';
554 554
 
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 						//if ($conf->global->COMPANY_ADDON_PDF != "$name")
560 560
 						//{
561 561
 							print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">';
562
-							print img_picto($langs->trans("Enabled"),'switch_on');
562
+							print img_picto($langs->trans("Enabled"), 'switch_on');
563 563
 							print '</a>';
564 564
 						//}
565 565
 						//else
@@ -570,43 +570,43 @@  discard block
 block discarded – undo
570 570
 					}
571 571
 					else
572 572
 					{
573
-						if (versioncompare($module->phpmin,versionphparray()) > 0)
573
+						if (versioncompare($module->phpmin, versionphparray()) > 0)
574 574
 						{
575 575
 							print "<td align=\"center\">\n";
576
-							print img_picto(dol_escape_htmltag($langs->trans("ErrorModuleRequirePHPVersion",join('.',$module->phpmin))),'switch_off');
576
+							print img_picto(dol_escape_htmltag($langs->trans("ErrorModuleRequirePHPVersion", join('.', $module->phpmin))), 'switch_off');
577 577
 							print "</td>";
578 578
 						}
579 579
 						else
580 580
 						{
581 581
 							print "<td align=\"center\">\n";
582
-							print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
582
+							print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
583 583
 							print "</td>";
584 584
 						}
585 585
 					}
586 586
 
587 587
 					// Info
588
-					$htmltooltip =    ''.$langs->trans("Name").': '.$module->name;
589
-					$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
588
+					$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
589
+					$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
590 590
 					if ($module->type == 'pdf')
591 591
 					{
592
-						$htmltooltip.='<br>'.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur;
592
+						$htmltooltip .= '<br>'.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur;
593 593
 					}
594
-					$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
595
-					$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraft").': '.yn((! empty($module->option_draft_watermark)?$module->option_draft_watermark:''), 1, 1);
594
+					$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
595
+					$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraft").': '.yn((!empty($module->option_draft_watermark) ? $module->option_draft_watermark : ''), 1, 1);
596 596
 
597 597
 					print '<td align="center" class="nowrap">';
598
-					print $form->textwithpicto('',$htmltooltip,1,0);
598
+					print $form->textwithpicto('', $htmltooltip, 1, 0);
599 599
 					print '</td>';
600 600
 
601 601
 					// Preview
602 602
 					print '<td align="center" class="nowrap">';
603 603
 					if ($module->type == 'pdf')
604 604
 					{
605
-						$linkspec='<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>';
605
+						$linkspec = '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
606 606
 					}
607 607
 					else
608 608
 					{
609
-						$linkspec=img_object($langs->trans("PreviewNotAvailable"),'generic');
609
+						$linkspec = img_object($langs->trans("PreviewNotAvailable"), 'generic');
610 610
 					}
611 611
 					print $linkspec;
612 612
 					print '</td>';
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 print '<br>';
624 624
 
625 625
 //IDProf
626
-print load_fiche_titre($langs->trans("CompanyIdProfChecker"),'','');
626
+print load_fiche_titre($langs->trans("CompanyIdProfChecker"), '', '');
627 627
 
628 628
 print '<table class="noborder" width="100%">';
629 629
 print '<tr class="liste_titre">';
@@ -634,75 +634,75 @@  discard block
 block discarded – undo
634 634
 print '<td align="center">'.$langs->trans("MustBeInvoiceMandatory").'</td>';
635 635
 print "</tr>\n";
636 636
 
637
-$profid['IDPROF1'][0]=$langs->trans("ProfId1");
638
-$profid['IDPROF1'][1]=$langs->transcountry('ProfId1', $mysoc->country_code);
639
-$profid['IDPROF2'][0]=$langs->trans("ProfId2");
640
-$profid['IDPROF2'][1]=$langs->transcountry('ProfId2', $mysoc->country_code);
641
-$profid['IDPROF3'][0]=$langs->trans("ProfId3");
642
-$profid['IDPROF3'][1]=$langs->transcountry('ProfId3', $mysoc->country_code);
643
-$profid['IDPROF4'][0]=$langs->trans("ProfId4");
644
-$profid['IDPROF4'][1]=$langs->transcountry('ProfId4', $mysoc->country_code);
645
-$profid['IDPROF5'][0]=$langs->trans("ProfId5");
646
-$profid['IDPROF5'][1]=$langs->transcountry('ProfId5', $mysoc->country_code);
647
-$profid['IDPROF6'][0]=$langs->trans("ProfId6");
648
-$profid['IDPROF6'][1]=$langs->transcountry('ProfId6', $mysoc->country_code);
649
-$profid['EMAIL'][0]=$langs->trans("EMail");
650
-$profid['EMAIL'][1]=$langs->trans('Email');
651
-
652
-$nbofloop=count($profid);
653
-foreach($profid as $key => $val)
654
-{
655
-	if ($profid[$key][1]!='-')
637
+$profid['IDPROF1'][0] = $langs->trans("ProfId1");
638
+$profid['IDPROF1'][1] = $langs->transcountry('ProfId1', $mysoc->country_code);
639
+$profid['IDPROF2'][0] = $langs->trans("ProfId2");
640
+$profid['IDPROF2'][1] = $langs->transcountry('ProfId2', $mysoc->country_code);
641
+$profid['IDPROF3'][0] = $langs->trans("ProfId3");
642
+$profid['IDPROF3'][1] = $langs->transcountry('ProfId3', $mysoc->country_code);
643
+$profid['IDPROF4'][0] = $langs->trans("ProfId4");
644
+$profid['IDPROF4'][1] = $langs->transcountry('ProfId4', $mysoc->country_code);
645
+$profid['IDPROF5'][0] = $langs->trans("ProfId5");
646
+$profid['IDPROF5'][1] = $langs->transcountry('ProfId5', $mysoc->country_code);
647
+$profid['IDPROF6'][0] = $langs->trans("ProfId6");
648
+$profid['IDPROF6'][1] = $langs->transcountry('ProfId6', $mysoc->country_code);
649
+$profid['EMAIL'][0] = $langs->trans("EMail");
650
+$profid['EMAIL'][1] = $langs->trans('Email');
651
+
652
+$nbofloop = count($profid);
653
+foreach ($profid as $key => $val)
654
+{
655
+	if ($profid[$key][1] != '-')
656 656
 	{
657 657
 		print '<tr class="oddeven">';
658 658
 		print '<td>'.$profid[$key][0]."</td><td>\n";
659 659
 		print $profid[$key][1];
660 660
 		print '</td>';
661 661
 
662
-		$idprof_unique ='SOCIETE_'.$key.'_UNIQUE';
663
-		$idprof_mandatory ='SOCIETE_'.$key.'_MANDATORY';
664
-		$idprof_invoice_mandatory ='SOCIETE_'.$key.'_INVOICE_MANDATORY';
662
+		$idprof_unique = 'SOCIETE_'.$key.'_UNIQUE';
663
+		$idprof_mandatory = 'SOCIETE_'.$key.'_MANDATORY';
664
+		$idprof_invoice_mandatory = 'SOCIETE_'.$key.'_INVOICE_MANDATORY';
665 665
 
666
-		$verif=(empty($conf->global->$idprof_unique)?false:true);
667
-		$mandatory=(empty($conf->global->$idprof_mandatory)?false:true);
668
-		$invoice_mandatory=(empty($conf->global->$idprof_invoice_mandatory)?false:true);
666
+		$verif = (empty($conf->global->$idprof_unique) ?false:true);
667
+		$mandatory = (empty($conf->global->$idprof_mandatory) ?false:true);
668
+		$invoice_mandatory = (empty($conf->global->$idprof_invoice_mandatory) ?false:true);
669 669
 
670 670
 		if ($verif)
671 671
 		{
672 672
 			print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofid&value='.$key.'&status=0">';
673
-			print img_picto($langs->trans("Activated"),'switch_on');
673
+			print img_picto($langs->trans("Activated"), 'switch_on');
674 674
 			print '</a></td>';
675 675
 		}
676 676
 		else
677 677
 		{
678 678
 			print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofid&value='.$key.'&status=1">';
679
-			print img_picto($langs->trans("Disabled"),'switch_off');
679
+			print img_picto($langs->trans("Disabled"), 'switch_off');
680 680
 			print '</a></td>';
681 681
 		}
682 682
 
683 683
 		if ($mandatory)
684 684
 		{
685 685
 			print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidmandatory&value='.$key.'&status=0">';
686
-			print img_picto($langs->trans("Activated"),'switch_on');
686
+			print img_picto($langs->trans("Activated"), 'switch_on');
687 687
 			print '</a></td>';
688 688
 		}
689 689
 		else
690 690
 		{
691 691
 			print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidmandatory&value='.$key.'&status=1">';
692
-			print img_picto($langs->trans("Disabled"),'switch_off');
692
+			print img_picto($langs->trans("Disabled"), 'switch_off');
693 693
 			print '</a></td>';
694 694
 		}
695 695
 
696 696
 		if ($invoice_mandatory)
697 697
 		{
698 698
 			print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidinvoicemandatory&value='.$key.'&status=0">';
699
-			print img_picto($langs->trans("Activated"),'switch_on');
699
+			print img_picto($langs->trans("Activated"), 'switch_on');
700 700
 			print '</a></td>';
701 701
 		}
702 702
 		else
703 703
 		{
704 704
 			print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidinvoicemandatory&value='.$key.'&status=1">';
705
-			print img_picto($langs->trans("Disabled"),'switch_off');
705
+			print img_picto($langs->trans("Disabled"), 'switch_off');
706 706
 			print '</a></td>';
707 707
 		}
708 708
 
@@ -714,10 +714,10 @@  discard block
 block discarded – undo
714 714
 print "</table><br>\n";
715 715
 
716 716
 
717
-print load_fiche_titre($langs->trans("Other"),'','');
717
+print load_fiche_titre($langs->trans("Other"), '', '');
718 718
 
719 719
 // Autres options
720
-$form=new Form($db);
720
+$form = new Form($db);
721 721
 
722 722
 print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
723 723
 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@@ -732,8 +732,8 @@  discard block
 block discarded – undo
732 732
 // Utilisation formulaire Ajax sur choix societe
733 733
 
734 734
 print '<tr class="oddeven">';
735
-print '<td width="80%">'.$form->textwithpicto($langs->trans("DelaiedFullListToSelectCompany"),$langs->trans('UseSearchToSelectCompanyTooltip'),1).' </td>';
736
-if (! $conf->use_javascript_ajax)
735
+print '<td width="80%">'.$form->textwithpicto($langs->trans("DelaiedFullListToSelectCompany"), $langs->trans('UseSearchToSelectCompanyTooltip'), 1).' </td>';
736
+if (!$conf->use_javascript_ajax)
737 737
 {
738 738
 	print '<td class="nowrap" align="right" colspan="2">';
739 739
 	print $langs->trans("NotAvailableWhenAjaxDisabled");
@@ -742,10 +742,10 @@  discard block
 block discarded – undo
742 742
 else
743 743
 {
744 744
 	print '<td width="60" align="right">';
745
-	$arrval=array('0'=>$langs->trans("No"),
746
-	'1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",1).')',
747
-    '2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",2).')',
748
-    '3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",3).')',
745
+	$arrval = array('0'=>$langs->trans("No"),
746
+	'1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 1).')',
747
+    '2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')',
748
+    '3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 3).')',
749 749
 	);
750 750
 	print $form->selectarray("activate_COMPANY_USE_SEARCH_TO_SELECT", $arrval, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
751 751
 	print '</td><td align="right">';
@@ -756,8 +756,8 @@  discard block
 block discarded – undo
756 756
 
757 757
 
758 758
 print '<tr class="oddeven">';
759
-print '<td width="80%">'.$form->textwithpicto($langs->trans("DelaiedFullListToSelectContact"),$langs->trans('UseSearchToSelectContactTooltip'),1).'</td>';
760
-if (! $conf->use_javascript_ajax)
759
+print '<td width="80%">'.$form->textwithpicto($langs->trans("DelaiedFullListToSelectContact"), $langs->trans('UseSearchToSelectContactTooltip'), 1).'</td>';
760
+if (!$conf->use_javascript_ajax)
761 761
 {
762 762
 	print '<td class="nowrap" align="right" colspan="2">';
763 763
 	print $langs->trans("NotAvailableWhenAjaxDisabled");
@@ -766,10 +766,10 @@  discard block
 block discarded – undo
766 766
 else
767 767
 {
768 768
 	print '<td width="60" align="right">';
769
-	$arrval=array('0'=>$langs->trans("No"),
770
-	'1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",1).')',
771
-	'2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",2).')',
772
-	'3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",3).')',
769
+	$arrval = array('0'=>$langs->trans("No"),
770
+	'1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 1).')',
771
+	'2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')',
772
+	'3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 3).')',
773 773
 	);
774 774
 	print $form->selectarray("activate_CONTACT_USE_SEARCH_TO_SELECT", $arrval, $conf->global->CONTACT_USE_SEARCH_TO_SELECT);
775 775
 	print '</td><td align="right">';
@@ -787,12 +787,12 @@  discard block
 block discarded – undo
787 787
 if (!empty($conf->global->SOCIETE_ADD_REF_IN_LIST))
788 788
 {
789 789
 	print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaddrefinlist&value=0">';
790
-	print img_picto($langs->trans("Activated"),'switch_on');
790
+	print img_picto($langs->trans("Activated"), 'switch_on');
791 791
 }
792 792
 else
793 793
 {
794 794
 	print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaddrefinlist&value=1">';
795
-	print img_picto($langs->trans("Disabled"),'switch_off');
795
+	print img_picto($langs->trans("Disabled"), 'switch_off');
796 796
 }
797 797
 print '</a></td>';
798 798
 print '</tr>';
@@ -804,12 +804,12 @@  discard block
 block discarded – undo
804 804
 if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST))
805 805
 {
806 806
 	print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaddadressinlist&value=0">';
807
-	print img_picto($langs->trans("Activated"),'switch_on');
807
+	print img_picto($langs->trans("Activated"), 'switch_on');
808 808
 }
809 809
 else
810 810
 {
811 811
 	print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaddadressinlist&value=1">';
812
-	print img_picto($langs->trans("Disabled"),'switch_off');
812
+	print img_picto($langs->trans("Disabled"), 'switch_off');
813 813
 }
814 814
 print '</a></td>';
815 815
 print '</tr>';
@@ -823,12 +823,12 @@  discard block
 block discarded – undo
823 823
 if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD))
824 824
 {
825 825
 	print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaskforshippingmet&value=0">';
826
-	print img_picto($langs->trans("Activated"),'switch_on');
826
+	print img_picto($langs->trans("Activated"), 'switch_on');
827 827
 }
828 828
 else
829 829
 {
830 830
 	print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaskforshippingmet&value=1">';
831
-	print img_picto($langs->trans("Disabled"),'switch_off');
831
+	print img_picto($langs->trans("Disabled"), 'switch_off');
832 832
 }
833 833
 print '</a></td>';
834 834
 print '</tr>';
@@ -841,12 +841,12 @@  discard block
 block discarded – undo
841 841
 if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS))
842 842
 {
843 843
     print '<a href="'.$_SERVER['PHP_SELF'].'?action=setdisableprospectcustomer&value=0">';
844
-    print img_picto($langs->trans("Activated"),'switch_on');
844
+    print img_picto($langs->trans("Activated"), 'switch_on');
845 845
 }
846 846
 else
847 847
 {
848 848
     print '<a href="'.$_SERVER['PHP_SELF'].'?action=setdisableprospectcustomer&value=1">';
849
-    print img_picto($langs->trans("Disabled"),'switch_off');
849
+    print img_picto($langs->trans("Disabled"), 'switch_off');
850 850
 }
851 851
 print '</a></td>';
852 852
 print '</tr>';
Please login to merge, or discard this patch.
Braces   +86 added lines, -84 removed lines patch added patch discarded remove patch
@@ -34,7 +34,9 @@  discard block
 block discarded – undo
34 34
 $action=GETPOST('action','alpha');
35 35
 $value=GETPOST('value','alpha');
36 36
 
37
-if (!$user->admin) accessforbidden();
37
+if (!$user->admin) {
38
+    accessforbidden();
39
+}
38 40
 
39 41
 
40 42
 
@@ -50,8 +52,7 @@  discard block
 block discarded – undo
50 52
 	{
51 53
 		header("Location: ".$_SERVER["PHP_SELF"]);
52 54
 		exit;
53
-	}
54
-	else
55
+	} else
55 56
 	{
56 57
 		dol_print_error($db);
57 58
 	}
@@ -63,8 +64,7 @@  discard block
 block discarded – undo
63 64
 	{
64 65
 		header("Location: ".$_SERVER["PHP_SELF"]);
65 66
 		exit;
66
-	}
67
-	else
67
+	} else
68 68
 	{
69 69
 		dol_print_error($db);
70 70
 	}
@@ -76,12 +76,13 @@  discard block
 block discarded – undo
76 76
 	{
77 77
 		$companysearch = GETPOST('activate_COMPANY_USE_SEARCH_TO_SELECT','alpha');
78 78
 		$res = dolibarr_set_const($db, "COMPANY_USE_SEARCH_TO_SELECT", $companysearch,'chaine',0,'',$conf->entity);
79
-		if (! $res > 0) $error++;
79
+		if (! $res > 0) {
80
+		    $error++;
81
+		}
80 82
 		if (! $error)
81 83
 	    {
82 84
 		    setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
83
-	    }
84
-	    else
85
+	    } else
85 86
 	    {
86 87
 		    setEventMessages($langs->trans("Error"), null, 'errors');
87 88
 		}
@@ -91,12 +92,13 @@  discard block
 block discarded – undo
91 92
 	{
92 93
 		$contactsearch = GETPOST('activate_CONTACT_USE_SEARCH_TO_SELECT','alpha');
93 94
 		$res = dolibarr_set_const($db, "CONTACT_USE_SEARCH_TO_SELECT", $contactsearch,'chaine',0,'',$conf->entity);
94
-		if (! $res > 0) $error++;
95
+		if (! $res > 0) {
96
+		    $error++;
97
+		}
95 98
 		if (! $error)
96 99
 		{
97 100
 			setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
98
-		}
99
-		else
101
+		} else
100 102
 		{
101 103
 			setEventMessages($langs->trans("Error"), null, 'errors');
102 104
 		}
@@ -117,8 +119,10 @@  discard block
 block discarded – undo
117 119
 	$sql.= ")";
118 120
 
119 121
 	$resql=$db->query($sql);
120
-	if (! $resql) dol_print_error($db);
121
-}
122
+	if (! $resql) {
123
+	    dol_print_error($db);
124
+	}
125
+	}
122 126
 
123 127
 // Disable a document generator module
124 128
 if ($action== 'del')
@@ -127,8 +131,10 @@  discard block
 block discarded – undo
127 131
 	$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
128 132
 	$sql.= " WHERE nom='".$db->escape($value)."' AND type='".$type."' AND entity=".$conf->entity;
129 133
 	$resql=$db->query($sql);
130
-	if (! $resql) dol_print_error($db);
131
-}
134
+	if (! $resql) {
135
+	    dol_print_error($db);
136
+	}
137
+	}
132 138
 
133 139
 // Define default generator
134 140
 if ($action == 'setdoc')
@@ -159,8 +165,7 @@  discard block
 block discarded – undo
159 165
 	if ($result1 && $result2)
160 166
 	{
161 167
 		$db->commit();
162
-	}
163
-	else
168
+	} else
164 169
 	{
165 170
 	    $db->rollback();
166 171
 	}
@@ -170,12 +175,13 @@  discard block
 block discarded – undo
170 175
 if ($action=="setaddrefinlist") {
171 176
 	$setaddrefinlist = GETPOST('value','int');
172 177
 	$res = dolibarr_set_const($db, "SOCIETE_ADD_REF_IN_LIST", $setaddrefinlist,'yesno',0,'',$conf->entity);
173
-	if (! $res > 0) $error++;
178
+	if (! $res > 0) {
179
+	    $error++;
180
+	}
174 181
 	if (! $error)
175 182
 	{
176 183
 		setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
177
-	}
178
-	else
184
+	} else
179 185
 	{
180 186
 		setEventMessages($langs->trans("Error"), null, 'errors');
181 187
 	}
@@ -185,12 +191,13 @@  discard block
 block discarded – undo
185 191
 if ($action=="setaddadressinlist") {
186 192
 	$val = GETPOST('value','int');
187 193
 	$res = dolibarr_set_const($db, "COMPANY_SHOW_ADDRESS_SELECTLIST", $val,'yesno',0,'',$conf->entity);
188
-	if (! $res > 0) $error++;
194
+	if (! $res > 0) {
195
+	    $error++;
196
+	}
189 197
 	if (! $error)
190 198
 	{
191 199
 		setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
192
-	}
193
-	else
200
+	} else
194 201
 	{
195 202
 		setEventMessages($langs->trans("Error"), null, 'errors');
196 203
 	}
@@ -200,12 +207,13 @@  discard block
 block discarded – undo
200 207
 if ($action=="setaskforshippingmet") {
201 208
 	$setaskforshippingmet = GETPOST('value','int');
202 209
 	$res = dolibarr_set_const($db, "SOCIETE_ASK_FOR_SHIPPING_METHOD", $setaskforshippingmet,'yesno',0,'',$conf->entity);
203
-	if (! $res > 0) $error++;
210
+	if (! $res > 0) {
211
+	    $error++;
212
+	}
204 213
 	if (! $error)
205 214
 	{
206 215
 		setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
207
-	}
208
-	else
216
+	} else
209 217
 	{
210 218
 		setEventMessages($langs->trans("Error"), null, 'errors');
211 219
 	}
@@ -215,12 +223,13 @@  discard block
 block discarded – undo
215 223
 if ($action=="setdisableprospectcustomer") {
216 224
     $setdisableprospectcustomer = GETPOST('value','int');
217 225
     $res = dolibarr_set_const($db, "SOCIETE_DISABLE_PROSPECTSCUSTOMERS", $setdisableprospectcustomer,'yesno',0,'',$conf->entity);
218
-    if (! $res > 0) $error++;
226
+    if (! $res > 0) {
227
+        $error++;
228
+    }
219 229
     if (! $error)
220 230
     {
221 231
         setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
222
-    }
223
-    else
232
+    } else
224 233
     {
225 234
         setEventMessages($langs->trans("Error"), null, 'errors');
226 235
     }
@@ -236,8 +245,7 @@  discard block
 block discarded – undo
236 245
 	{
237 246
 		//header("Location: ".$_SERVER["PHP_SELF"]);
238 247
 		//exit;
239
-	}
240
-	else
248
+	} else
241 249
 	{
242 250
 		dol_print_error($db);
243 251
 	}
@@ -253,8 +261,7 @@  discard block
 block discarded – undo
253 261
 	{
254 262
 		//header("Location: ".$_SERVER["PHP_SELF"]);
255 263
 		//exit;
256
-	}
257
-	else
264
+	} else
258 265
 	{
259 266
 		dol_print_error($db);
260 267
 	}
@@ -270,8 +277,7 @@  discard block
 block discarded – undo
270 277
 	{
271 278
 		//header("Location: ".$_SERVER["PHP_SELF"]);
272 279
 		//exit;
273
-	}
274
-	else
280
+	} else
275 281
 	{
276 282
 		dol_print_error($db);
277 283
 	}
@@ -286,8 +292,7 @@  discard block
 block discarded – undo
286 292
 	{
287 293
 		header("Location: ".$_SERVER["PHP_SELF"]);
288 294
 		exit;
289
-	}
290
-	else
295
+	} else
291 296
 	{
292 297
 		dol_print_error($db);
293 298
 	}
@@ -295,12 +300,13 @@  discard block
 block discarded – undo
295 300
 if($action=='setonsearchandlistgooncustomerorsuppliercard'){
296 301
        $setonsearchandlistgooncustomerorsuppliercard = GETPOST('value','int');
297 302
        $res = dolibarr_set_const($db, "SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD", $setonsearchandlistgooncustomerorsuppliercard,'yesno',0,'',$conf->entity);
298
-       if (! $res > 0) $error++;
303
+       if (! $res > 0) {
304
+           $error++;
305
+       }
299 306
        if (! $error)
300 307
        {
301 308
                setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
302
-       }
303
-       else
309
+       } else
304 310
        {
305 311
                setEventMessages($langs->trans("Error"), null, 'errors');
306 312
        }
@@ -357,8 +363,7 @@  discard block
 block discarded – undo
357 363
 
358 364
     			try {
359 365
         			dol_include_once($dirroot.$file.'.php');
360
-    			}
361
-    			catch(Exception $e)
366
+    			} catch(Exception $e)
362 367
     			{
363 368
     			    dol_syslog($e->getMessage(), LOG_ERR);
364 369
     			}
@@ -366,8 +371,12 @@  discard block
 block discarded – undo
366 371
     			$modCodeTiers = new $file;
367 372
 
368 373
     			// Show modules according to features level
369
-    			if ($modCodeTiers->version == 'development'  && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
370
-    			if ($modCodeTiers->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
374
+    			if ($modCodeTiers->version == 'development'  && $conf->global->MAIN_FEATURES_LEVEL < 2) {
375
+    			    continue;
376
+    			}
377
+    			if ($modCodeTiers->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
378
+    			    continue;
379
+    			}
371 380
 
372 381
     			print '<tr class="oddeven">'."\n";
373 382
     			print '<td width="140">'.$modCodeTiers->name.'</td>'."\n";
@@ -379,15 +388,18 @@  discard block
 block discarded – undo
379 388
     				print '<td align="center">'."\n";
380 389
     				print img_picto($langs->trans("Activated"),'switch_on');
381 390
     				print "</td>\n";
382
-    			}
383
-    			else
391
+    			} else
384 392
     			{
385 393
     				$disabled = false;
386 394
     				if (! empty($conf->multicompany->enabled) && (is_object($mc) && ! empty($mc->sharings['referent']) && $mc->sharings['referent'] == $conf->entity) ? false : true);
387 395
     				print '<td align="center">';
388
-    				if (! $disabled) print '<a href="'.$_SERVER['PHP_SELF'].'?action=setcodeclient&value='.$file.'">';
396
+    				if (! $disabled) {
397
+    				    print '<a href="'.$_SERVER['PHP_SELF'].'?action=setcodeclient&value='.$file.'">';
398
+    				}
389 399
     				print img_picto($langs->trans("Disabled"),'switch_off');
390
-    				if (! $disabled) print '</a>';
400
+    				if (! $disabled) {
401
+    				    print '</a>';
402
+    				}
391 403
     				print '</td>';
392 404
     			}
393 405
 
@@ -436,8 +448,7 @@  discard block
 block discarded – undo
436 448
 
437 449
     		    try {
438 450
         			dol_include_once($dirroot.$file.'.php');
439
-    			}
440
-    			catch(Exception $e)
451
+    			} catch(Exception $e)
441 452
     			{
442 453
     			    dol_syslog($e->getMessage(), LOG_ERR);
443 454
     			}
@@ -455,8 +466,7 @@  discard block
 block discarded – undo
455 466
     				print '<td align="center">';
456 467
     				print img_picto($langs->trans("Activated"),'switch_on');
457 468
     				print '</td>';
458
-    			}
459
-    			else
469
+    			} else
460 470
     			{
461 471
     				print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setcodecompta&value='.$file.'">';
462 472
     				print img_picto($langs->trans("Disabled"),'switch_off');
@@ -498,8 +508,7 @@  discard block
 block discarded – undo
498 508
 		array_push($def, $array[0]);
499 509
 		$i++;
500 510
 	}
501
-}
502
-else
511
+} else
503 512
 {
504 513
 	dol_print_error($db);
505 514
 }
@@ -529,8 +538,7 @@  discard block
 block discarded – undo
529 538
 
530 539
 			    try {
531 540
         			dol_include_once($dirroot.'doc/'.$file);
532
-    			}
533
-    			catch(Exception $e)
541
+    			} catch(Exception $e)
534 542
     			{
535 543
     			    dol_syslog($e->getMessage(), LOG_ERR);
536 544
     			}
@@ -539,8 +547,11 @@  discard block
 block discarded – undo
539 547
 
540 548
 				$modulequalified=1;
541 549
 				if (! empty($module->version)) {
542
-					if ($module->version == 'development'  && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
543
-					else if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
550
+					if ($module->version == 'development'  && $conf->global->MAIN_FEATURES_LEVEL < 2) {
551
+					    $modulequalified=0;
552
+					} else if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
553
+					    $modulequalified=0;
554
+					}
544 555
 				}
545 556
 
546 557
 				if ($modulequalified)
@@ -548,8 +559,11 @@  discard block
 block discarded – undo
548 559
 					print '<tr class="oddeven"><td width="100">';
549 560
 					print $module->name;
550 561
 					print "</td><td>\n";
551
-					if (method_exists($module,'info')) print $module->info($langs);
552
-					else print $module->description;
562
+					if (method_exists($module,'info')) {
563
+					    print $module->info($langs);
564
+					} else {
565
+					    print $module->description;
566
+					}
553 567
 					print '</td>';
554 568
 
555 569
 					// Activate / Disable
@@ -567,16 +581,14 @@  discard block
 block discarded – undo
567 581
 						//	print img_picto($langs->trans("Enabled"),'on');
568 582
 						//}
569 583
 						print "</td>";
570
-					}
571
-					else
584
+					} else
572 585
 					{
573 586
 						if (versioncompare($module->phpmin,versionphparray()) > 0)
574 587
 						{
575 588
 							print "<td align=\"center\">\n";
576 589
 							print img_picto(dol_escape_htmltag($langs->trans("ErrorModuleRequirePHPVersion",join('.',$module->phpmin))),'switch_off');
577 590
 							print "</td>";
578
-						}
579
-						else
591
+						} else
580 592
 						{
581 593
 							print "<td align=\"center\">\n";
582 594
 							print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
@@ -603,8 +615,7 @@  discard block
 block discarded – undo
603 615
 					if ($module->type == 'pdf')
604 616
 					{
605 617
 						$linkspec='<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>';
606
-					}
607
-					else
618
+					} else
608 619
 					{
609 620
 						$linkspec=img_object($langs->trans("PreviewNotAvailable"),'generic');
610 621
 					}
@@ -672,8 +683,7 @@  discard block
 block discarded – undo
672 683
 			print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofid&value='.$key.'&status=0">';
673 684
 			print img_picto($langs->trans("Activated"),'switch_on');
674 685
 			print '</a></td>';
675
-		}
676
-		else
686
+		} else
677 687
 		{
678 688
 			print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofid&value='.$key.'&status=1">';
679 689
 			print img_picto($langs->trans("Disabled"),'switch_off');
@@ -685,8 +695,7 @@  discard block
 block discarded – undo
685 695
 			print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidmandatory&value='.$key.'&status=0">';
686 696
 			print img_picto($langs->trans("Activated"),'switch_on');
687 697
 			print '</a></td>';
688
-		}
689
-		else
698
+		} else
690 699
 		{
691 700
 			print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidmandatory&value='.$key.'&status=1">';
692 701
 			print img_picto($langs->trans("Disabled"),'switch_off');
@@ -698,8 +707,7 @@  discard block
 block discarded – undo
698 707
 			print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidinvoicemandatory&value='.$key.'&status=0">';
699 708
 			print img_picto($langs->trans("Activated"),'switch_on');
700 709
 			print '</a></td>';
701
-		}
702
-		else
710
+		} else
703 711
 		{
704 712
 			print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setprofidinvoicemandatory&value='.$key.'&status=1">';
705 713
 			print img_picto($langs->trans("Disabled"),'switch_off');
@@ -738,8 +746,7 @@  discard block
 block discarded – undo
738 746
 	print '<td class="nowrap" align="right" colspan="2">';
739 747
 	print $langs->trans("NotAvailableWhenAjaxDisabled");
740 748
 	print "</td>";
741
-}
742
-else
749
+} else
743 750
 {
744 751
 	print '<td width="60" align="right">';
745 752
 	$arrval=array('0'=>$langs->trans("No"),
@@ -762,8 +769,7 @@  discard block
 block discarded – undo
762 769
 	print '<td class="nowrap" align="right" colspan="2">';
763 770
 	print $langs->trans("NotAvailableWhenAjaxDisabled");
764 771
 	print "</td>";
765
-}
766
-else
772
+} else
767 773
 {
768 774
 	print '<td width="60" align="right">';
769 775
 	$arrval=array('0'=>$langs->trans("No"),
@@ -788,8 +794,7 @@  discard block
 block discarded – undo
788 794
 {
789 795
 	print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaddrefinlist&value=0">';
790 796
 	print img_picto($langs->trans("Activated"),'switch_on');
791
-}
792
-else
797
+} else
793 798
 {
794 799
 	print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaddrefinlist&value=1">';
795 800
 	print img_picto($langs->trans("Disabled"),'switch_off');
@@ -805,8 +810,7 @@  discard block
 block discarded – undo
805 810
 {
806 811
 	print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaddadressinlist&value=0">';
807 812
 	print img_picto($langs->trans("Activated"),'switch_on');
808
-}
809
-else
813
+} else
810 814
 {
811 815
 	print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaddadressinlist&value=1">';
812 816
 	print img_picto($langs->trans("Disabled"),'switch_off');
@@ -824,8 +828,7 @@  discard block
 block discarded – undo
824 828
 {
825 829
 	print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaskforshippingmet&value=0">';
826 830
 	print img_picto($langs->trans("Activated"),'switch_on');
827
-}
828
-else
831
+} else
829 832
 {
830 833
 	print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaskforshippingmet&value=1">';
831 834
 	print img_picto($langs->trans("Disabled"),'switch_off');
@@ -842,8 +845,7 @@  discard block
 block discarded – undo
842 845
 {
843 846
     print '<a href="'.$_SERVER['PHP_SELF'].'?action=setdisableprospectcustomer&value=0">';
844 847
     print img_picto($langs->trans("Activated"),'switch_on');
845
-}
846
-else
848
+} else
847 849
 {
848 850
     print '<a href="'.$_SERVER['PHP_SELF'].'?action=setdisableprospectcustomer&value=1">';
849 851
     print img_picto($langs->trans("Disabled"),'switch_off');
Please login to merge, or discard this patch.
dolibarr/htdocs/societe/admin/societe_extrafields.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
 $form = new Form($db);
35 35
 
36 36
 // List of supported format
37
-$tmptype2label=ExtraFields::$type2label;
38
-$type2label=array('');
39
-foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
37
+$tmptype2label = ExtraFields::$type2label;
38
+$type2label = array('');
39
+foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
40 40
 
41
-$action=GETPOST('action', 'alpha');
42
-$attrname=GETPOST('attrname', 'alpha');
43
-$elementtype='societe';  //Must be the $element of the class that manage extrafield
41
+$action = GETPOST('action', 'alpha');
42
+$attrname = GETPOST('attrname', 'alpha');
43
+$elementtype = 'societe'; //Must be the $element of the class that manage extrafield
44 44
 
45 45
 if (!$user->admin) accessforbidden();
46 46
 
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
  * View
58 58
  */
59 59
 
60
-$textobject=$langs->transnoentitiesnoconv("ThirdParty");
60
+$textobject = $langs->transnoentitiesnoconv("ThirdParty");
61 61
 
62
-$help_url='EN:Module Third Parties setup|FR:Paramétrage_du_module_Tiers';
63
-llxHeader('',$langs->trans("CompanySetup"),$help_url);
62
+$help_url = 'EN:Module Third Parties setup|FR:Paramétrage_du_module_Tiers';
63
+llxHeader('', $langs->trans("CompanySetup"), $help_url);
64 64
 
65 65
 
66
-$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
67
-print load_fiche_titre($langs->trans("CompanySetup"),$linkback,'title_setup');
66
+$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
67
+print load_fiche_titre($langs->trans("CompanySetup"), $linkback, 'title_setup');
68 68
 
69 69
 
70 70
 $head = societe_admin_prepare_head();
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 /* Edition d'un champ optionnel                                               */
105 105
 /*                                                                            */
106 106
 /* ************************************************************************** */
107
-if ($action == 'edit' && ! empty($attrname))
107
+if ($action == 'edit' && !empty($attrname))
108 108
 {
109 109
     print '<br><div id="editattrib"></div>';
110 110
     print load_fiche_titre($langs->trans("FieldEdition", $attrname));
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,13 +36,17 @@
 block discarded – undo
36 36
 // List of supported format
37 37
 $tmptype2label=ExtraFields::$type2label;
38 38
 $type2label=array('');
39
-foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
39
+foreach ($tmptype2label as $key => $val) {
40
+    $type2label[$key]=$langs->transnoentitiesnoconv($val);
41
+}
40 42
 
41 43
 $action=GETPOST('action', 'alpha');
42 44
 $attrname=GETPOST('attrname', 'alpha');
43 45
 $elementtype='societe';  //Must be the $element of the class that manage extrafield
44 46
 
45
-if (!$user->admin) accessforbidden();
47
+if (!$user->admin) {
48
+    accessforbidden();
49
+}
46 50
 
47 51
 
48 52
 /*
Please login to merge, or discard this patch.
dolibarr/htdocs/societe/admin/contact_extrafields.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -93,8 +93,8 @@
 block discarded – undo
93 93
 
94 94
 if ($action == 'create')
95 95
 {
96
-	print '<br><div id="newattrib"></div>';
97
-	print load_fiche_titre($langs->trans('NewAttribute'));
96
+    print '<br><div id="newattrib"></div>';
97
+    print load_fiche_titre($langs->trans('NewAttribute'));
98 98
 
99 99
     require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
100 100
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
 $form = new Form($db);
35 35
 
36 36
 // List of supported format
37
-$tmptype2label=ExtraFields::$type2label;
38
-$type2label=array('');
39
-foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
37
+$tmptype2label = ExtraFields::$type2label;
38
+$type2label = array('');
39
+foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
40 40
 
41
-$action=GETPOST('action', 'alpha');
42
-$attrname=GETPOST('attrname', 'alpha');
43
-$elementtype='socpeople'; //Must be the $element of the class that manage extrafield
41
+$action = GETPOST('action', 'alpha');
42
+$attrname = GETPOST('attrname', 'alpha');
43
+$elementtype = 'socpeople'; //Must be the $element of the class that manage extrafield
44 44
 
45 45
 if (!$user->admin) accessforbidden();
46 46
 
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
  * View
58 58
  */
59 59
 
60
-$textobject=$langs->transnoentitiesnoconv("ContactsAddresses");
60
+$textobject = $langs->transnoentitiesnoconv("ContactsAddresses");
61 61
 
62
-$help_url='EN:Module Third Parties setup|FR:Paramétrage_du_module_Tiers';
63
-llxHeader('',$langs->trans("CompanySetup"),$help_url);
62
+$help_url = 'EN:Module Third Parties setup|FR:Paramétrage_du_module_Tiers';
63
+llxHeader('', $langs->trans("CompanySetup"), $help_url);
64 64
 
65 65
 
66
-$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
67
-print load_fiche_titre($langs->trans("CompanySetup"),$linkback,'title_setup');
66
+$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
67
+print load_fiche_titre($langs->trans("CompanySetup"), $linkback, 'title_setup');
68 68
 
69 69
 
70 70
 $head = societe_admin_prepare_head();
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 /* Edition of an optional field                                               */
105 105
 /*                                                                            */
106 106
 /* ************************************************************************** */
107
-if ($action == 'edit' && ! empty($attrname))
107
+if ($action == 'edit' && !empty($attrname))
108 108
 {
109 109
     print "<br>";
110 110
     print load_fiche_titre($langs->trans("FieldEdition", $attrname));
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,13 +36,17 @@
 block discarded – undo
36 36
 // List of supported format
37 37
 $tmptype2label=ExtraFields::$type2label;
38 38
 $type2label=array('');
39
-foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
39
+foreach ($tmptype2label as $key => $val) {
40
+    $type2label[$key]=$langs->transnoentitiesnoconv($val);
41
+}
40 42
 
41 43
 $action=GETPOST('action', 'alpha');
42 44
 $attrname=GETPOST('attrname', 'alpha');
43 45
 $elementtype='socpeople'; //Must be the $element of the class that manage extrafield
44 46
 
45
-if (!$user->admin) accessforbidden();
47
+if (!$user->admin) {
48
+    accessforbidden();
49
+}
46 50
 
47 51
 
48 52
 /*
Please login to merge, or discard this patch.