Passed
Push — master ( 65bdac...4e88da )
by Alxarafe
32:38
created
dolibarr/htdocs/core/lib/report.lib.php 1 patch
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -40,86 +40,86 @@
 block discarded – undo
40 40
  */
41 41
 function report_header($reportname,$notused,$period,$periodlink,$description,$builddate,$exportlink='',$moreparam=array(),$calcmode='', $varlink='')
42 42
 {
43
-	global $langs;
44
-
45
-	if (empty($hselected)) $hselected='report';
46
-
47
-	print "\n\n<!-- start banner of report -->\n";
48
-
49
-	if(! empty($varlink)) $varlink = '?'.$varlink;
50
-
51
-	$h=0;
52
-	$head[$h][0] = $_SERVER["PHP_SELF"].$varlink;
53
-	$head[$h][1] = $langs->trans("Report");
54
-	$head[$h][2] = 'report';
55
-
56
-	print '<form method="POST" action="'.$_SERVER["PHP_SELF"].$varlink.'">';
57
-
58
-	dol_fiche_head($head, 'report');
59
-
60
-	foreach($moreparam as $key => $value)
61
-	{
62
-		 print '<input type="hidden" name="'.$key.'" value="'.$value.'">';
63
-	}
64
-	print '<table width="100%" class="border">';
65
-
66
-	$variante = ($periodlink || $exportlink);
67
-
68
-	// Ligne de titre
69
-	print '<tr>';
70
-	print '<td width="110">'.$langs->trans("ReportName").'</td>';
71
-	print '<td>';
72
-	print $reportname;
73
-	print '</td>';
74
-	if ($variante) print '<td></td>';
75
-	print '</tr>';
76
-
77
-	// Calculation mode
78
-	if ($calcmode)
79
-	{
80
-		print '<tr>';
81
-		print '<td width="110">'.$langs->trans("CalculationMode").'</td>';
82
-		print '<td>';
83
-		print $calcmode;
84
-		if ($variante) print '<td></td>';
85
-		print '</td>';
86
-		print '</tr>';
87
-	}
88
-
89
-	// Ligne de la periode d'analyse du rapport
90
-	print '<tr>';
91
-	print '<td>'.$langs->trans("ReportPeriod").'</td>';
92
-	print '<td>';
93
-	if ($period) print $period;
94
-	if ($variante) print '<td class="nowraponall">'.$periodlink.'</td>';
95
-	print '</td>';
96
-	print '</tr>';
97
-
98
-	// Ligne de description
99
-	print '<tr>';
100
-	print '<td>'.$langs->trans("ReportDescription").'</td>';
101
-	print '<td>'.$description.'</td>';
102
-	if ($variante) print '<td></td>';
103
-	print '</tr>';
104
-
105
-	// Ligne d'export
106
-	print '<tr>';
107
-	print '<td>'.$langs->trans("GeneratedOn").'</td>';
108
-	print '<td>';
109
-	print dol_print_date($builddate, 'dayhour');
110
-	print '</td>';
111
-	if ($variante) print '<td>'.($exportlink ? $langs->trans("Export").': '.$exportlink : '').'</td>';
112
-	print '</tr>';
113
-
114
-	print '</table>';
115
-
116
-	dol_fiche_end();
117
-
118
-	print '<div class="center"><input type="submit" class="button" name="submit" value="'.$langs->trans("Refresh").'"></div>';
119
-
120
-	print '</form>';
121
-	print '<br>';
122
-
123
-	print "\n<!-- end banner of report -->\n\n";
43
+    global $langs;
44
+
45
+    if (empty($hselected)) $hselected='report';
46
+
47
+    print "\n\n<!-- start banner of report -->\n";
48
+
49
+    if(! empty($varlink)) $varlink = '?'.$varlink;
50
+
51
+    $h=0;
52
+    $head[$h][0] = $_SERVER["PHP_SELF"].$varlink;
53
+    $head[$h][1] = $langs->trans("Report");
54
+    $head[$h][2] = 'report';
55
+
56
+    print '<form method="POST" action="'.$_SERVER["PHP_SELF"].$varlink.'">';
57
+
58
+    dol_fiche_head($head, 'report');
59
+
60
+    foreach($moreparam as $key => $value)
61
+    {
62
+            print '<input type="hidden" name="'.$key.'" value="'.$value.'">';
63
+    }
64
+    print '<table width="100%" class="border">';
65
+
66
+    $variante = ($periodlink || $exportlink);
67
+
68
+    // Ligne de titre
69
+    print '<tr>';
70
+    print '<td width="110">'.$langs->trans("ReportName").'</td>';
71
+    print '<td>';
72
+    print $reportname;
73
+    print '</td>';
74
+    if ($variante) print '<td></td>';
75
+    print '</tr>';
76
+
77
+    // Calculation mode
78
+    if ($calcmode)
79
+    {
80
+        print '<tr>';
81
+        print '<td width="110">'.$langs->trans("CalculationMode").'</td>';
82
+        print '<td>';
83
+        print $calcmode;
84
+        if ($variante) print '<td></td>';
85
+        print '</td>';
86
+        print '</tr>';
87
+    }
88
+
89
+    // Ligne de la periode d'analyse du rapport
90
+    print '<tr>';
91
+    print '<td>'.$langs->trans("ReportPeriod").'</td>';
92
+    print '<td>';
93
+    if ($period) print $period;
94
+    if ($variante) print '<td class="nowraponall">'.$periodlink.'</td>';
95
+    print '</td>';
96
+    print '</tr>';
97
+
98
+    // Ligne de description
99
+    print '<tr>';
100
+    print '<td>'.$langs->trans("ReportDescription").'</td>';
101
+    print '<td>'.$description.'</td>';
102
+    if ($variante) print '<td></td>';
103
+    print '</tr>';
104
+
105
+    // Ligne d'export
106
+    print '<tr>';
107
+    print '<td>'.$langs->trans("GeneratedOn").'</td>';
108
+    print '<td>';
109
+    print dol_print_date($builddate, 'dayhour');
110
+    print '</td>';
111
+    if ($variante) print '<td>'.($exportlink ? $langs->trans("Export").': '.$exportlink : '').'</td>';
112
+    print '</tr>';
113
+
114
+    print '</table>';
115
+
116
+    dol_fiche_end();
117
+
118
+    print '<div class="center"><input type="submit" class="button" name="submit" value="'.$langs->trans("Refresh").'"></div>';
119
+
120
+    print '</form>';
121
+    print '<br>';
122
+
123
+    print "\n<!-- end banner of report -->\n\n";
124 124
 }
125 125
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/actions_sendmails.inc.php 1 patch
Indentation   +394 added lines, -394 removed lines patch added patch discarded remove patch
@@ -34,16 +34,16 @@  discard block
 block discarded – undo
34 34
  */
35 35
 if (GETPOST('addfile','alpha'))
36 36
 {
37
-	$trackid = GETPOST('trackid','aZ09');
37
+    $trackid = GETPOST('trackid','aZ09');
38 38
 
39
-	require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
39
+    require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
40 40
 
41
-	// Set tmp user directory
42
-	$vardir=$conf->user->dir_output."/".$user->id;
43
-	$upload_dir_tmp = $vardir.'/temp';             // TODO Add $keytoavoidconflict in upload_dir path
41
+    // Set tmp user directory
42
+    $vardir=$conf->user->dir_output."/".$user->id;
43
+    $upload_dir_tmp = $vardir.'/temp';             // TODO Add $keytoavoidconflict in upload_dir path
44 44
 
45
-	dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', '', null, $trackid, 0);
46
-	$action='presend';
45
+    dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', '', null, $trackid, 0);
46
+    $action='presend';
47 47
 }
48 48
 
49 49
 /*
@@ -51,18 +51,18 @@  discard block
 block discarded – undo
51 51
  */
52 52
 if (! empty($_POST['removedfile']) && empty($_POST['removAll']))
53 53
 {
54
-	$trackid = GETPOST('trackid','aZ09');
54
+    $trackid = GETPOST('trackid','aZ09');
55 55
 
56
-	require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
56
+    require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
57 57
 
58
-	// Set tmp user directory
59
-	$vardir=$conf->user->dir_output."/".$user->id;
60
-	$upload_dir_tmp = $vardir.'/temp';             // TODO Add $keytoavoidconflict in upload_dir path
58
+    // Set tmp user directory
59
+    $vardir=$conf->user->dir_output."/".$user->id;
60
+    $upload_dir_tmp = $vardir.'/temp';             // TODO Add $keytoavoidconflict in upload_dir path
61 61
 
62
-	// TODO Delete only files that was uploaded from email form. This can be addressed by adding the trackid into the temp path then changing donotdeletefile to 2 instead of 1 to say "delete only if into temp dir"
63
-	// GETPOST('removedfile','alpha') is position of file into $_SESSION["listofpaths"...] array.
64
-	dol_remove_file_process(GETPOST('removedfile','alpha'), 0, 1, $trackid);   // We do not delete because if file is the official PDF of doc, we don't want to remove it physically
65
-	$action='presend';
62
+    // TODO Delete only files that was uploaded from email form. This can be addressed by adding the trackid into the temp path then changing donotdeletefile to 2 instead of 1 to say "delete only if into temp dir"
63
+    // GETPOST('removedfile','alpha') is position of file into $_SESSION["listofpaths"...] array.
64
+    dol_remove_file_process(GETPOST('removedfile','alpha'), 0, 1, $trackid);   // We do not delete because if file is the official PDF of doc, we don't want to remove it physically
65
+    $action='presend';
66 66
 }
67 67
 
68 68
 /*
@@ -70,31 +70,31 @@  discard block
 block discarded – undo
70 70
  */
71 71
 if (GETPOST('removAll','alpha'))
72 72
 {
73
-	$trackid = GETPOST('trackid','aZ09');
74
-
75
-	$listofpaths=array();
76
-	$listofnames=array();
77
-	$listofmimes=array();
78
-	$keytoavoidconflict = empty($trackid)?'':'-'.$trackid;
79
-	if (! empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths=explode(';',$_SESSION["listofpaths".$keytoavoidconflict]);
80
-	if (! empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames=explode(';',$_SESSION["listofnames".$keytoavoidconflict]);
81
-	if (! empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes=explode(';',$_SESSION["listofmimes".$keytoavoidconflict]);
82
-
83
-	include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
84
-	$formmail = new FormMail($db);
85
-	$formmail->trackid = $trackid;
86
-
87
-	foreach($listofpaths as $key => $value)
88
-	{
89
-		$pathtodelete = $value;
90
-		$filetodelete = $listofnames[$key];
91
-		$result = dol_delete_file($pathtodelete,1); // Delete uploded Files
92
-
93
-		$langs->load("other");
94
-		setEventMessages($langs->trans("FileWasRemoved",$filetodelete), null, 'mesgs');
95
-
96
-		$formmail->remove_attached_files($key); // Update Session
97
-	}
73
+    $trackid = GETPOST('trackid','aZ09');
74
+
75
+    $listofpaths=array();
76
+    $listofnames=array();
77
+    $listofmimes=array();
78
+    $keytoavoidconflict = empty($trackid)?'':'-'.$trackid;
79
+    if (! empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths=explode(';',$_SESSION["listofpaths".$keytoavoidconflict]);
80
+    if (! empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames=explode(';',$_SESSION["listofnames".$keytoavoidconflict]);
81
+    if (! empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes=explode(';',$_SESSION["listofmimes".$keytoavoidconflict]);
82
+
83
+    include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
84
+    $formmail = new FormMail($db);
85
+    $formmail->trackid = $trackid;
86
+
87
+    foreach($listofpaths as $key => $value)
88
+    {
89
+        $pathtodelete = $value;
90
+        $filetodelete = $listofnames[$key];
91
+        $result = dol_delete_file($pathtodelete,1); // Delete uploded Files
92
+
93
+        $langs->load("other");
94
+        setEventMessages($langs->trans("FileWasRemoved",$filetodelete), null, 'mesgs');
95
+
96
+        $formmail->remove_attached_files($key); // Update Session
97
+    }
98 98
 }
99 99
 
100 100
 /*
@@ -102,244 +102,244 @@  discard block
 block discarded – undo
102 102
  */
103 103
 if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removAll'] && ! $_POST['removedfile'] && ! $_POST['cancel'] && !$_POST['modelselected'])
104 104
 {
105
-	if (empty($trackid)) $trackid = GETPOST('trackid','aZ09');
106
-
107
-	$subject='';$actionmsg='';$actionmsg2='';
108
-
109
-	$langs->load('mails');
110
-
111
-	if (is_object($object))
112
-	{
113
-		$result=$object->fetch($id);
114
-
115
-		$sendtosocid=0;    // Thirdparty on object
116
-		if (method_exists($object,"fetch_thirdparty") && ! in_array($object->element, array('societe','member','user','expensereport', 'contact')))
117
-		{
118
-			$result=$object->fetch_thirdparty();
119
-			if ($object->element == 'user' && $result == 0) $result=1;    // Even if not found, we consider ok
120
-			$thirdparty=$object->thirdparty;
121
-			$sendtosocid=$thirdparty->id;
122
-		}
123
-		else if ($object->element == 'member' || $object->element == 'user')
124
-		{
125
-			$thirdparty=$object;
126
-			if ($thirdparty->id > 0) $sendtosocid=$thirdparty->id;
127
-		}
128
-		else if ($object->element == 'societe')
129
-		{
130
-			$thirdparty=$object;
131
-			if ($thirdparty->id > 0) $sendtosocid=$thirdparty->id;
132
-		}
133
-		else if ($object->element == 'contact')
134
-		{
135
-			$contact=$object;
136
-			if ($contact->id > 0) $sendtosocid=$contact->fetch_thirdparty()->id;
137
-		}
138
-		else dol_print_error('','Use actions_sendmails.in.php for an element/object that is not supported');
139
-
140
-		if (is_object($hookmanager))
141
-		{
142
-			$parameters=array();
143
-			$reshook=$hookmanager->executeHooks('initSendToSocid',$parameters,$object,$action);    // Note that $action and $object may have been modified by some hooks
144
-		}
145
-	}
146
-	else $thirdparty = $mysoc;
147
-
148
-	if ($result > 0)
149
-	{
150
-		$sendto='';
151
-		$sendtocc='';
152
-		$sendtobcc='';
153
-		$sendtoid = array();
154
-		$sendtouserid=array();
155
-		$sendtoccuserid=array();
156
-
157
-		// Define $sendto
158
-		$receiver=$_POST['receiver'];
159
-		if (! is_array($receiver))
160
-		{
161
-			if ($receiver == '-1') $receiver=array();
162
-			else $receiver=array($receiver);
163
-		}
164
-		$tmparray=array();
165
-		if (trim($_POST['sendto']))
166
-		{
167
-			// Recipients are provided into free text
168
-			$tmparray[] = trim($_POST['sendto']);
169
-		}
170
-		if (count($receiver)>0)
171
-		{
172
-			foreach($receiver as $key=>$val)
173
-			{
174
-				// Recipient was provided from combo list
175
-				if ($val == 'thirdparty') // Id of third party
176
-				{
177
-					$tmparray[] = dol_string_nospecial($thirdparty->name, ' ', array(",")).' <'.$thirdparty->email.'>';
178
-				}
179
-				// Recipient was provided from combo list
180
-				elseif ($val == 'contact') // Id of contact
181
-				{
182
-					$tmparray[] = dol_string_nospecial($contact->name, ' ', array(",")).' <'.$contact->email.'>';
183
-				}
184
-				elseif ($val)	// Id du contact
185
-				{
186
-					$tmparray[] = $thirdparty->contact_get_property((int) $val,'email');
187
-					$sendtoid[] = $val;
188
-				}
189
-			}
190
-		}
191
-		if (!empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT))
192
-		{
193
-			$receiveruser=$_POST['receiveruser'];
194
-			if (is_array($receiveruser) && count($receiveruser)>0)
195
-			{
196
-				$fuserdest = new User($db);
197
-				foreach($receiveruser as $key=>$val)
198
-				{
199
-					$tmparray[] = $fuserdest->user_get_property($val,'email');
200
-					$sendtouserid[] = $val;
201
-				}
202
-			}
203
-		}
204
-
205
-		$sendto=implode(',',$tmparray);
206
-
207
-		// Define $sendtocc
208
-		$receivercc=$_POST['receivercc'];
209
-		if (! is_array($receivercc))
210
-		{
211
-			if ($receivercc == '-1') $receivercc=array();
212
-			else $receivercc=array($receivercc);
213
-		}
214
-		$tmparray=array();
215
-		if (trim($_POST['sendtocc']))
216
-		{
217
-			$tmparray[] = trim($_POST['sendtocc']);
218
-		}
219
-		if (count($receivercc) > 0)
220
-		{
221
-			foreach($receivercc as $key=>$val)
222
-			{
223
-				// Recipient was provided from combo list
224
-				if ($val == 'thirdparty') // Id of third party
225
-				{
226
-					$tmparray[] = dol_string_nospecial($thirdparty->name, ' ', array(",")).' <'.$thirdparty->email.'>';
227
-				}
228
-				// Recipient was provided from combo list
229
-				elseif ($val == 'contact') // Id of contact
230
-				{
231
-					$tmparray[] = dol_string_nospecial($contact->name, ' ', array(",")).' <'.$contact->email.'>';
232
-				}
233
-				elseif ($val)	// Id du contact
234
-				{
235
-					$tmparray[] = $thirdparty->contact_get_property((int) $val,'email');
236
-					//$sendtoid[] = $val;  TODO Add also id of contact in CC ?
237
-				}
238
-			}
239
-		}
240
-		if (!empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) {
241
-			$receiverccuser=$_POST['receiverccuser'];
242
-
243
-			if (is_array($receiverccuser) && count($receiverccuser)>0)
244
-			{
245
-				$fuserdest = new User($db);
246
-				foreach($receiverccuser as $key=>$val)
247
-				{
248
-					$tmparray[] = $fuserdest->user_get_property($val,'email');
249
-					$sendtoccuserid[] = $val;
250
-				}
251
-			}
252
-		}
253
-		$sendtocc=implode(',',$tmparray);
254
-
255
-		if (dol_strlen($sendto))
256
-		{
105
+    if (empty($trackid)) $trackid = GETPOST('trackid','aZ09');
106
+
107
+    $subject='';$actionmsg='';$actionmsg2='';
108
+
109
+    $langs->load('mails');
110
+
111
+    if (is_object($object))
112
+    {
113
+        $result=$object->fetch($id);
114
+
115
+        $sendtosocid=0;    // Thirdparty on object
116
+        if (method_exists($object,"fetch_thirdparty") && ! in_array($object->element, array('societe','member','user','expensereport', 'contact')))
117
+        {
118
+            $result=$object->fetch_thirdparty();
119
+            if ($object->element == 'user' && $result == 0) $result=1;    // Even if not found, we consider ok
120
+            $thirdparty=$object->thirdparty;
121
+            $sendtosocid=$thirdparty->id;
122
+        }
123
+        else if ($object->element == 'member' || $object->element == 'user')
124
+        {
125
+            $thirdparty=$object;
126
+            if ($thirdparty->id > 0) $sendtosocid=$thirdparty->id;
127
+        }
128
+        else if ($object->element == 'societe')
129
+        {
130
+            $thirdparty=$object;
131
+            if ($thirdparty->id > 0) $sendtosocid=$thirdparty->id;
132
+        }
133
+        else if ($object->element == 'contact')
134
+        {
135
+            $contact=$object;
136
+            if ($contact->id > 0) $sendtosocid=$contact->fetch_thirdparty()->id;
137
+        }
138
+        else dol_print_error('','Use actions_sendmails.in.php for an element/object that is not supported');
139
+
140
+        if (is_object($hookmanager))
141
+        {
142
+            $parameters=array();
143
+            $reshook=$hookmanager->executeHooks('initSendToSocid',$parameters,$object,$action);    // Note that $action and $object may have been modified by some hooks
144
+        }
145
+    }
146
+    else $thirdparty = $mysoc;
147
+
148
+    if ($result > 0)
149
+    {
150
+        $sendto='';
151
+        $sendtocc='';
152
+        $sendtobcc='';
153
+        $sendtoid = array();
154
+        $sendtouserid=array();
155
+        $sendtoccuserid=array();
156
+
157
+        // Define $sendto
158
+        $receiver=$_POST['receiver'];
159
+        if (! is_array($receiver))
160
+        {
161
+            if ($receiver == '-1') $receiver=array();
162
+            else $receiver=array($receiver);
163
+        }
164
+        $tmparray=array();
165
+        if (trim($_POST['sendto']))
166
+        {
167
+            // Recipients are provided into free text
168
+            $tmparray[] = trim($_POST['sendto']);
169
+        }
170
+        if (count($receiver)>0)
171
+        {
172
+            foreach($receiver as $key=>$val)
173
+            {
174
+                // Recipient was provided from combo list
175
+                if ($val == 'thirdparty') // Id of third party
176
+                {
177
+                    $tmparray[] = dol_string_nospecial($thirdparty->name, ' ', array(",")).' <'.$thirdparty->email.'>';
178
+                }
179
+                // Recipient was provided from combo list
180
+                elseif ($val == 'contact') // Id of contact
181
+                {
182
+                    $tmparray[] = dol_string_nospecial($contact->name, ' ', array(",")).' <'.$contact->email.'>';
183
+                }
184
+                elseif ($val)	// Id du contact
185
+                {
186
+                    $tmparray[] = $thirdparty->contact_get_property((int) $val,'email');
187
+                    $sendtoid[] = $val;
188
+                }
189
+            }
190
+        }
191
+        if (!empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT))
192
+        {
193
+            $receiveruser=$_POST['receiveruser'];
194
+            if (is_array($receiveruser) && count($receiveruser)>0)
195
+            {
196
+                $fuserdest = new User($db);
197
+                foreach($receiveruser as $key=>$val)
198
+                {
199
+                    $tmparray[] = $fuserdest->user_get_property($val,'email');
200
+                    $sendtouserid[] = $val;
201
+                }
202
+            }
203
+        }
204
+
205
+        $sendto=implode(',',$tmparray);
206
+
207
+        // Define $sendtocc
208
+        $receivercc=$_POST['receivercc'];
209
+        if (! is_array($receivercc))
210
+        {
211
+            if ($receivercc == '-1') $receivercc=array();
212
+            else $receivercc=array($receivercc);
213
+        }
214
+        $tmparray=array();
215
+        if (trim($_POST['sendtocc']))
216
+        {
217
+            $tmparray[] = trim($_POST['sendtocc']);
218
+        }
219
+        if (count($receivercc) > 0)
220
+        {
221
+            foreach($receivercc as $key=>$val)
222
+            {
223
+                // Recipient was provided from combo list
224
+                if ($val == 'thirdparty') // Id of third party
225
+                {
226
+                    $tmparray[] = dol_string_nospecial($thirdparty->name, ' ', array(",")).' <'.$thirdparty->email.'>';
227
+                }
228
+                // Recipient was provided from combo list
229
+                elseif ($val == 'contact') // Id of contact
230
+                {
231
+                    $tmparray[] = dol_string_nospecial($contact->name, ' ', array(",")).' <'.$contact->email.'>';
232
+                }
233
+                elseif ($val)	// Id du contact
234
+                {
235
+                    $tmparray[] = $thirdparty->contact_get_property((int) $val,'email');
236
+                    //$sendtoid[] = $val;  TODO Add also id of contact in CC ?
237
+                }
238
+            }
239
+        }
240
+        if (!empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) {
241
+            $receiverccuser=$_POST['receiverccuser'];
242
+
243
+            if (is_array($receiverccuser) && count($receiverccuser)>0)
244
+            {
245
+                $fuserdest = new User($db);
246
+                foreach($receiverccuser as $key=>$val)
247
+                {
248
+                    $tmparray[] = $fuserdest->user_get_property($val,'email');
249
+                    $sendtoccuserid[] = $val;
250
+                }
251
+            }
252
+        }
253
+        $sendtocc=implode(',',$tmparray);
254
+
255
+        if (dol_strlen($sendto))
256
+        {
257 257
             // Define $urlwithroot
258 258
             $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
259 259
             $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT;		// This is to use external domain name found into config file
260 260
             //$urlwithroot=DOL_MAIN_URL_ROOT;					// This is to use same domain name than current
261 261
 
262
-		    require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
263
-
264
-			$langs->load("commercial");
265
-
266
-			$fromtype = GETPOST('fromtype','alpha');
267
-			if ($fromtype === 'robot') {
268
-				$from = dol_string_nospecial($conf->global->MAIN_MAIL_EMAIL_FROM, ' ', array(",")) .' <'.$conf->global->MAIN_MAIL_EMAIL_FROM.'>';
269
-			}
270
-			elseif ($fromtype === 'user') {
271
-				$from = dol_string_nospecial($user->getFullName($langs), ' ', array(",")) .' <'.$user->email.'>';
272
-			}
273
-			elseif ($fromtype === 'company') {
274
-				$from = dol_string_nospecial($conf->global->MAIN_INFO_SOCIETE_NOM, ' ', array(",")) .' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>';
275
-			}
276
-			elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) {
277
-				$tmp=explode(',', $user->email_aliases);
278
-				$from = trim($tmp[($reg[1] - 1)]);
279
-			}
280
-			elseif (preg_match('/global_aliases_(\d+)/', $fromtype, $reg)) {
281
-				$tmp=explode(',', $conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES);
282
-				$from = trim($tmp[($reg[1] - 1)]);
283
-			}
284
-			elseif (preg_match('/senderprofile_(\d+)_(\d+)/', $fromtype, $reg)) {
285
-				$sql='SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE rowid = '.(int) $reg[1];
286
-				$resql = $db->query($sql);
287
-				$obj = $db->fetch_object($resql);
288
-				if ($obj)
289
-				{
290
-					$from = dol_string_nospecial($obj->label, ' ', array(",")).' <'.$obj->email.'>';
291
-				}
292
-			}
293
-			else {
294
-				$from = dol_string_nospecial($_POST['fromname'], ' ', array(",")) . ' <' . $_POST['frommail'] .'>';
295
-			}
296
-
297
-			$replyto = dol_string_nospecial($_POST['replytoname'], ' ', array(",")). ' <' . $_POST['replytomail'].'>';
298
-			$message = GETPOST('message','none');
299
-			$subject = GETPOST('subject','none');
300
-
301
-			// Make a change into HTML code to allow to include images from medias directory with an external reabable URL.
302
-			// <img alt="" src="/dolibarr_dev/htdocs/viewimage.php?modulepart=medias&amp;entity=1&amp;file=image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
303
-			// become
304
-			// <img alt="" src="'.$urlwithroot.'viewimage.php?modulepart=medias&amp;entity=1&amp;file=image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
305
-			$message=preg_replace('/(<img.*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^\/]*\/>)/', '\1'.$urlwithroot.'/viewimage.php\2modulepart=medias\3file=\4\5', $message);
306
-
307
-			$sendtobcc= GETPOST('sendtoccc');
308
-			// Autocomplete the $sendtobcc
309
-			// $autocopy can be MAIN_MAIL_AUTOCOPY_PROPOSAL_TO, MAIN_MAIL_AUTOCOPY_ORDER_TO, MAIN_MAIL_AUTOCOPY_INVOICE_TO, MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO...
310
-			if (! empty($autocopy))
311
-			{
312
-				$sendtobcc .= (empty($conf->global->$autocopy) ? '' : (($sendtobcc?", ":"").$conf->global->$autocopy));
313
-			}
314
-
315
-			$deliveryreceipt = $_POST['deliveryreceipt'];
316
-
317
-			if ($action == 'send' || $action == 'relance')
318
-			{
319
-				$actionmsg2=$langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from,4,0,1).' '.$langs->transnoentities('To').' '.CMailFile::getValidAddress($sendto,4,0,1);
320
-				if ($message)
321
-				{
322
-					$actionmsg=$langs->transnoentities('MailFrom').': '.dol_escape_htmltag($from);
323
-					$actionmsg=dol_concatdesc($actionmsg, $langs->transnoentities('MailTo').': '.dol_escape_htmltag($sendto));
324
-					if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . dol_escape_htmltag($sendtocc));
325
-					$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
326
-					$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
327
-					$actionmsg = dol_concatdesc($actionmsg, $message);
328
-				}
329
-			}
330
-
331
-			// Create form object
332
-			include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
333
-			$formmail = new FormMail($db);
334
-			$formmail->trackid = $trackid;      // $trackid must be defined
335
-
336
-			$attachedfiles=$formmail->get_attached_files();
337
-			$filepath = $attachedfiles['paths'];
338
-			$filename = $attachedfiles['names'];
339
-			$mimetype = $attachedfiles['mimes'];
340
-
341
-			// Feature to push mail sent into Sent folder
342
-			/* This code must be now included into the hook mail, method sendMailAfter
262
+            require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
263
+
264
+            $langs->load("commercial");
265
+
266
+            $fromtype = GETPOST('fromtype','alpha');
267
+            if ($fromtype === 'robot') {
268
+                $from = dol_string_nospecial($conf->global->MAIN_MAIL_EMAIL_FROM, ' ', array(",")) .' <'.$conf->global->MAIN_MAIL_EMAIL_FROM.'>';
269
+            }
270
+            elseif ($fromtype === 'user') {
271
+                $from = dol_string_nospecial($user->getFullName($langs), ' ', array(",")) .' <'.$user->email.'>';
272
+            }
273
+            elseif ($fromtype === 'company') {
274
+                $from = dol_string_nospecial($conf->global->MAIN_INFO_SOCIETE_NOM, ' ', array(",")) .' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>';
275
+            }
276
+            elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) {
277
+                $tmp=explode(',', $user->email_aliases);
278
+                $from = trim($tmp[($reg[1] - 1)]);
279
+            }
280
+            elseif (preg_match('/global_aliases_(\d+)/', $fromtype, $reg)) {
281
+                $tmp=explode(',', $conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES);
282
+                $from = trim($tmp[($reg[1] - 1)]);
283
+            }
284
+            elseif (preg_match('/senderprofile_(\d+)_(\d+)/', $fromtype, $reg)) {
285
+                $sql='SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE rowid = '.(int) $reg[1];
286
+                $resql = $db->query($sql);
287
+                $obj = $db->fetch_object($resql);
288
+                if ($obj)
289
+                {
290
+                    $from = dol_string_nospecial($obj->label, ' ', array(",")).' <'.$obj->email.'>';
291
+                }
292
+            }
293
+            else {
294
+                $from = dol_string_nospecial($_POST['fromname'], ' ', array(",")) . ' <' . $_POST['frommail'] .'>';
295
+            }
296
+
297
+            $replyto = dol_string_nospecial($_POST['replytoname'], ' ', array(",")). ' <' . $_POST['replytomail'].'>';
298
+            $message = GETPOST('message','none');
299
+            $subject = GETPOST('subject','none');
300
+
301
+            // Make a change into HTML code to allow to include images from medias directory with an external reabable URL.
302
+            // <img alt="" src="/dolibarr_dev/htdocs/viewimage.php?modulepart=medias&amp;entity=1&amp;file=image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
303
+            // become
304
+            // <img alt="" src="'.$urlwithroot.'viewimage.php?modulepart=medias&amp;entity=1&amp;file=image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
305
+            $message=preg_replace('/(<img.*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^\/]*\/>)/', '\1'.$urlwithroot.'/viewimage.php\2modulepart=medias\3file=\4\5', $message);
306
+
307
+            $sendtobcc= GETPOST('sendtoccc');
308
+            // Autocomplete the $sendtobcc
309
+            // $autocopy can be MAIN_MAIL_AUTOCOPY_PROPOSAL_TO, MAIN_MAIL_AUTOCOPY_ORDER_TO, MAIN_MAIL_AUTOCOPY_INVOICE_TO, MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO...
310
+            if (! empty($autocopy))
311
+            {
312
+                $sendtobcc .= (empty($conf->global->$autocopy) ? '' : (($sendtobcc?", ":"").$conf->global->$autocopy));
313
+            }
314
+
315
+            $deliveryreceipt = $_POST['deliveryreceipt'];
316
+
317
+            if ($action == 'send' || $action == 'relance')
318
+            {
319
+                $actionmsg2=$langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from,4,0,1).' '.$langs->transnoentities('To').' '.CMailFile::getValidAddress($sendto,4,0,1);
320
+                if ($message)
321
+                {
322
+                    $actionmsg=$langs->transnoentities('MailFrom').': '.dol_escape_htmltag($from);
323
+                    $actionmsg=dol_concatdesc($actionmsg, $langs->transnoentities('MailTo').': '.dol_escape_htmltag($sendto));
324
+                    if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . dol_escape_htmltag($sendtocc));
325
+                    $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
326
+                    $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
327
+                    $actionmsg = dol_concatdesc($actionmsg, $message);
328
+                }
329
+            }
330
+
331
+            // Create form object
332
+            include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
333
+            $formmail = new FormMail($db);
334
+            $formmail->trackid = $trackid;      // $trackid must be defined
335
+
336
+            $attachedfiles=$formmail->get_attached_files();
337
+            $filepath = $attachedfiles['paths'];
338
+            $filename = $attachedfiles['names'];
339
+            $mimetype = $attachedfiles['mimes'];
340
+
341
+            // Feature to push mail sent into Sent folder
342
+            /* This code must be now included into the hook mail, method sendMailAfter
343 343
 			if (! empty($conf->dolimail->enabled))
344 344
 			{
345 345
 				$mailfromid = explode("#", $_POST['frommail'],3);	// $_POST['frommail'] = 'aaa#Sent# <[email protected]>'	// TODO Use a better way to define Sent dir.
@@ -382,39 +382,39 @@  discard block
 block discarded – undo
382 382
 			}
383 383
 			*/
384 384
 
385
-			// Make substitution in email content
386
-			$substitutionarray=getCommonSubstitutionArray($langs, 0, null, $object);
387
-			$substitutionarray['__EMAIL__'] = $sendto;
388
-			$substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty))?'<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$object->thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>':'';
389
-
390
-			$parameters=array('mode'=>'formemail');
391
-			complete_substitutions_array($substitutionarray, $langs, $object, $parameters);
392
-
393
-			$subject=make_substitutions($subject, $substitutionarray);
394
-			$message=make_substitutions($message, $substitutionarray);
395
-
396
-			if (method_exists($object, 'makeSubstitution'))
397
-			{
398
-				$subject = $object->makeSubstitution($subject);
399
-				$message = $object->makeSubstitution($message);
400
-			}
401
-
402
-			// Send mail (substitutionarray must be done just before this)
403
-			if (empty($sendcontext)) $sendcontext = 'standard';
404
-			$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1,'','',$trackid,'', $sendcontext);
405
-
406
-			if ($mailfile->error)
407
-			{
408
-				setEventMessages($mailfile->error, $mailfile->errors, 'errors');
409
-				$action='presend';
410
-			}
411
-			else
412
-			{
413
-				$result=$mailfile->sendfile();
414
-				if ($result)
415
-				{
416
-					// Two hooks are available into method $mailfile->sendfile, so dedicated code is no more required
417
-					/*
385
+            // Make substitution in email content
386
+            $substitutionarray=getCommonSubstitutionArray($langs, 0, null, $object);
387
+            $substitutionarray['__EMAIL__'] = $sendto;
388
+            $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty))?'<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$object->thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>':'';
389
+
390
+            $parameters=array('mode'=>'formemail');
391
+            complete_substitutions_array($substitutionarray, $langs, $object, $parameters);
392
+
393
+            $subject=make_substitutions($subject, $substitutionarray);
394
+            $message=make_substitutions($message, $substitutionarray);
395
+
396
+            if (method_exists($object, 'makeSubstitution'))
397
+            {
398
+                $subject = $object->makeSubstitution($subject);
399
+                $message = $object->makeSubstitution($message);
400
+            }
401
+
402
+            // Send mail (substitutionarray must be done just before this)
403
+            if (empty($sendcontext)) $sendcontext = 'standard';
404
+            $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1,'','',$trackid,'', $sendcontext);
405
+
406
+            if ($mailfile->error)
407
+            {
408
+                setEventMessages($mailfile->error, $mailfile->errors, 'errors');
409
+                $action='presend';
410
+            }
411
+            else
412
+            {
413
+                $result=$mailfile->sendfile();
414
+                if ($result)
415
+                {
416
+                    // Two hooks are available into method $mailfile->sendfile, so dedicated code is no more required
417
+                    /*
418 418
 					if (! empty($conf->dolimail->enabled))
419 419
 					{
420 420
 						$mid = (GETPOST('mid','int') ? GETPOST('mid','int') : 0);	// Original mail id is set ?
@@ -434,91 +434,91 @@  discard block
 block discarded – undo
434 434
 						}
435 435
 					}*/
436 436
 
437
-					// Initialisation of datas of object to call trigger
438
-					if (is_object($object))
439
-					{
440
-					    if (empty($actiontypecode)) $actiontypecode='AC_OTH_AUTO'; // Event insert into agenda automatically
441
-
442
-						$object->socid			= $sendtosocid;	   // To link to a company
443
-						$object->sendtoid		= $sendtoid;	   // To link to contact addresses. This is an array.
444
-						$object->actiontypecode	= $actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
445
-						$object->actionmsg		= $actionmsg;      // Long text (@TODO Replace this with $message, we already have details of email in dedicated properties)
446
-						$object->actionmsg2		= $actionmsg2;     // Short text ($langs->transnoentities('MailSentBy')...);
447
-
448
-						$object->trackid        = $trackid;
449
-						$object->fk_element		= $object->id;
450
-						$object->elementtype	= $object->element;
451
-						if (is_array($attachedfiles) && count($attachedfiles)>0) {
452
-							$object->attachedfiles	= $attachedfiles;
453
-						}
454
-						if (is_array($sendtouserid) && count($sendtouserid)>0 && !empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) {
455
-							$object->sendtouserid	= $sendtouserid;
456
-						}
457
-
458
-						$object->email_msgid = $mailfile->msgid;	// @TODO Set msgid into $mailfile after sending
459
-						$object->email_from = $from;
460
-						$object->email_subject = $subject;
461
-						$object->email_to = $sendto;
462
-						$object->email_tocc = $sendtocc;
463
-						$object->email_tobcc = $sendtobcc;
464
-						$object->email_subject = $subject;
465
-						$object->email_msgid = $mailfile->msgid;
466
-
467
-						// Call of triggers
468
-						if (! empty($trigger_name))
469
-						{
470
-    						include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
471
-    						$interface=new Interfaces($db);
472
-    						$result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf);
473
-							if ($result < 0) {
474
-    							setEventMessages($interface->error, $interface->errors, 'errors');
475
-    						}
476
-						}
477
-					}
478
-
479
-					// Redirect here
480
-					// This avoid sending mail twice if going out and then back to page
481
-					$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2));
482
-					setEventMessages($mesg, null, 'mesgs');
483
-
484
-  					$moreparam='';
485
-	  				if (isset($paramname2) || isset($paramval2)) $moreparam.= '&'.($paramname2?$paramname2:'mid').'='.$paramval2;
486
-		  			header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.(is_object($object)?$object->id:'').$moreparam);
487
-			  		exit;
488
-				}
489
-				else
490
-				{
491
-					$langs->load("other");
492
-					$mesg='<div class="error">';
493
-					if ($mailfile->error)
494
-					{
495
-						$mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto);
496
-						$mesg.='<br>'.$mailfile->error;
497
-					}
498
-					else
499
-					{
500
-						$mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
501
-					}
502
-					$mesg.='</div>';
503
-
504
-					setEventMessages($mesg, null, 'warnings');
505
-					$action = 'presend';
506
-				}
507
-			}
508
-		}
509
-		else
510
-		{
511
-			$langs->load("errors");
512
-			setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("MailTo")), null, 'warnings');
513
-			dol_syslog('Try to send email with no recipient defined', LOG_WARNING);
514
-			$action = 'presend';
515
-		}
516
-	}
517
-	else
518
-	{
519
-		$langs->load("other");
520
-		setEventMessages($langs->trans('ErrorFailedToReadObject',$object->element), null, 'errors');
521
-		dol_syslog('Failed to read data of object id='.$object->id.' element='.$object->element);
522
-		$action = 'presend';
523
-	}
437
+                    // Initialisation of datas of object to call trigger
438
+                    if (is_object($object))
439
+                    {
440
+                        if (empty($actiontypecode)) $actiontypecode='AC_OTH_AUTO'; // Event insert into agenda automatically
441
+
442
+                        $object->socid			= $sendtosocid;	   // To link to a company
443
+                        $object->sendtoid		= $sendtoid;	   // To link to contact addresses. This is an array.
444
+                        $object->actiontypecode	= $actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
445
+                        $object->actionmsg		= $actionmsg;      // Long text (@TODO Replace this with $message, we already have details of email in dedicated properties)
446
+                        $object->actionmsg2		= $actionmsg2;     // Short text ($langs->transnoentities('MailSentBy')...);
447
+
448
+                        $object->trackid        = $trackid;
449
+                        $object->fk_element		= $object->id;
450
+                        $object->elementtype	= $object->element;
451
+                        if (is_array($attachedfiles) && count($attachedfiles)>0) {
452
+                            $object->attachedfiles	= $attachedfiles;
453
+                        }
454
+                        if (is_array($sendtouserid) && count($sendtouserid)>0 && !empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) {
455
+                            $object->sendtouserid	= $sendtouserid;
456
+                        }
457
+
458
+                        $object->email_msgid = $mailfile->msgid;	// @TODO Set msgid into $mailfile after sending
459
+                        $object->email_from = $from;
460
+                        $object->email_subject = $subject;
461
+                        $object->email_to = $sendto;
462
+                        $object->email_tocc = $sendtocc;
463
+                        $object->email_tobcc = $sendtobcc;
464
+                        $object->email_subject = $subject;
465
+                        $object->email_msgid = $mailfile->msgid;
466
+
467
+                        // Call of triggers
468
+                        if (! empty($trigger_name))
469
+                        {
470
+                            include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
471
+                            $interface=new Interfaces($db);
472
+                            $result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf);
473
+                            if ($result < 0) {
474
+                                setEventMessages($interface->error, $interface->errors, 'errors');
475
+                            }
476
+                        }
477
+                    }
478
+
479
+                    // Redirect here
480
+                    // This avoid sending mail twice if going out and then back to page
481
+                    $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2));
482
+                    setEventMessages($mesg, null, 'mesgs');
483
+
484
+                        $moreparam='';
485
+                        if (isset($paramname2) || isset($paramval2)) $moreparam.= '&'.($paramname2?$paramname2:'mid').'='.$paramval2;
486
+                        header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.(is_object($object)?$object->id:'').$moreparam);
487
+                        exit;
488
+                }
489
+                else
490
+                {
491
+                    $langs->load("other");
492
+                    $mesg='<div class="error">';
493
+                    if ($mailfile->error)
494
+                    {
495
+                        $mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto);
496
+                        $mesg.='<br>'.$mailfile->error;
497
+                    }
498
+                    else
499
+                    {
500
+                        $mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
501
+                    }
502
+                    $mesg.='</div>';
503
+
504
+                    setEventMessages($mesg, null, 'warnings');
505
+                    $action = 'presend';
506
+                }
507
+            }
508
+        }
509
+        else
510
+        {
511
+            $langs->load("errors");
512
+            setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("MailTo")), null, 'warnings');
513
+            dol_syslog('Try to send email with no recipient defined', LOG_WARNING);
514
+            $action = 'presend';
515
+        }
516
+    }
517
+    else
518
+    {
519
+        $langs->load("other");
520
+        setEventMessages($langs->trans('ErrorFailedToReadObject',$object->element), null, 'errors');
521
+        dol_syslog('Failed to read data of object id='.$object->id.' element='.$object->element);
522
+        $action = 'presend';
523
+    }
524 524
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/tpl/resource_view.tpl.php 1 patch
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 // Protection to avoid direct call of template
4 4
 if (empty($conf) || ! is_object($conf))
5 5
 {
6
-	print "Error, template page can't be called as URL";
7
-	exit;
6
+    print "Error, template page can't be called as URL";
7
+    exit;
8 8
 }
9 9
 
10 10
 
@@ -37,76 +37,76 @@  discard block
 block discarded – undo
37 37
 if( (array) $linked_resources && count($linked_resources) > 0)
38 38
 {
39 39
 
40
-	foreach ($linked_resources as $linked_resource)
41
-	{
42
-
43
-		$object_resource = fetchObjectByElement($linked_resource['resource_id'],$linked_resource['resource_type']);
44
-
45
-		//$element_id = $linked_resource['rowid'];
46
-
47
-		if ($mode == 'edit' && $linked_resource['rowid'] == GETPOST('lineid'))
48
-		{
49
-
50
-			print '<form class="tagtr oddeven" action="'.$_SERVER["PHP_SELF"].'?element='.$element.'&element_id='.$element_id.'" method="POST">';
51
-			print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
52
-			print '<input type="hidden" name="id" value="'.$object->id.'" />';
53
-			print '<input type="hidden" name="action" value="update_linked_resource" />';
54
-			print '<input type="hidden" name="resource_type" value="'.$resource_type.'" />';
55
-			print '<input type="hidden" name="lineid" value="'.$linked_resource['rowid'].'" />';
56
-
57
-			print '<div class="tagtd">'.$object_resource->getNomUrl(1).'</div>';
58
-			print '<div class="tagtd">'.$object_resource->type_label.'</div>';
59
-			print '<div class="tagtd" align="center">'.$form->selectyesno('busy',$linked_resource['busy']?1:0,1).'</div>';
60
-			print '<div class="tagtd" align="center">'.$form->selectyesno('mandatory',$linked_resource['mandatory']?1:0,1).'</div>';
61
-			print '<div class="tagtd" align="right"><input type="submit" class="button" value="'.$langs->trans("Update").'"></div>';
62
-			print '</form>';
63
-		}
64
-		else
65
-		{
66
-			$style='';
67
-			if ($linked_resource['rowid'] == GETPOST('lineid'))
68
-				$style='style="background: orange;"';
69
-
70
-			print '<form class="tagtr oddeven" '.$style.'>';
71
-
72
-			print '<div class="tagtd">';
73
-			print $object_resource->getNomUrl(1);
74
-			print '</div>';
75
-
76
-			print '<div class="tagtd">';
77
-			print $object_resource->type_label;
78
-			print '</div>';
79
-
80
-			print '<div class="tagtd" align="center">';
81
-			print yn($linked_resource['busy']);
82
-			print '</div>';
83
-
84
-			print '<div class="tagtd" align="center">';
85
-			print yn($linked_resource['mandatory']);
86
-			print '</div>';
87
-
88
-			print '<div class="tagtd" align="right">';
89
-			print '<a href="'.$_SERVER['PHP_SELF'].'?mode=edit&resource_type='.$linked_resource['resource_type'].'&element='.$element.'&element_id='.$element_id.'&lineid='.$linked_resource['rowid'].'">';
90
-			print img_edit();
91
-			print '</a>';
92
-			print '&nbsp;';
93
-			print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete_resource&id='.$linked_resource['resource_id'].'&element='.$element.'&element_id='.$element_id.'&lineid='.$linked_resource['rowid'].'">';
94
-			print img_delete();
95
-			print '</a>';
96
-			print '</div>';
97
-
98
-			print '</form>';
99
-		}
100
-	}
40
+    foreach ($linked_resources as $linked_resource)
41
+    {
42
+
43
+        $object_resource = fetchObjectByElement($linked_resource['resource_id'],$linked_resource['resource_type']);
44
+
45
+        //$element_id = $linked_resource['rowid'];
46
+
47
+        if ($mode == 'edit' && $linked_resource['rowid'] == GETPOST('lineid'))
48
+        {
49
+
50
+            print '<form class="tagtr oddeven" action="'.$_SERVER["PHP_SELF"].'?element='.$element.'&element_id='.$element_id.'" method="POST">';
51
+            print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
52
+            print '<input type="hidden" name="id" value="'.$object->id.'" />';
53
+            print '<input type="hidden" name="action" value="update_linked_resource" />';
54
+            print '<input type="hidden" name="resource_type" value="'.$resource_type.'" />';
55
+            print '<input type="hidden" name="lineid" value="'.$linked_resource['rowid'].'" />';
56
+
57
+            print '<div class="tagtd">'.$object_resource->getNomUrl(1).'</div>';
58
+            print '<div class="tagtd">'.$object_resource->type_label.'</div>';
59
+            print '<div class="tagtd" align="center">'.$form->selectyesno('busy',$linked_resource['busy']?1:0,1).'</div>';
60
+            print '<div class="tagtd" align="center">'.$form->selectyesno('mandatory',$linked_resource['mandatory']?1:0,1).'</div>';
61
+            print '<div class="tagtd" align="right"><input type="submit" class="button" value="'.$langs->trans("Update").'"></div>';
62
+            print '</form>';
63
+        }
64
+        else
65
+        {
66
+            $style='';
67
+            if ($linked_resource['rowid'] == GETPOST('lineid'))
68
+                $style='style="background: orange;"';
69
+
70
+            print '<form class="tagtr oddeven" '.$style.'>';
71
+
72
+            print '<div class="tagtd">';
73
+            print $object_resource->getNomUrl(1);
74
+            print '</div>';
75
+
76
+            print '<div class="tagtd">';
77
+            print $object_resource->type_label;
78
+            print '</div>';
79
+
80
+            print '<div class="tagtd" align="center">';
81
+            print yn($linked_resource['busy']);
82
+            print '</div>';
83
+
84
+            print '<div class="tagtd" align="center">';
85
+            print yn($linked_resource['mandatory']);
86
+            print '</div>';
87
+
88
+            print '<div class="tagtd" align="right">';
89
+            print '<a href="'.$_SERVER['PHP_SELF'].'?mode=edit&resource_type='.$linked_resource['resource_type'].'&element='.$element.'&element_id='.$element_id.'&lineid='.$linked_resource['rowid'].'">';
90
+            print img_edit();
91
+            print '</a>';
92
+            print '&nbsp;';
93
+            print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete_resource&id='.$linked_resource['resource_id'].'&element='.$element.'&element_id='.$element_id.'&lineid='.$linked_resource['rowid'].'">';
94
+            print img_delete();
95
+            print '</a>';
96
+            print '</div>';
97
+
98
+            print '</form>';
99
+        }
100
+    }
101 101
 }
102 102
 else {
103
-	print '<form class="tagtr oddeven">';
104
-	print '<div class="tagtd opacitymedium">'.$langs->trans('NoResourceLinked').'</div>';
105
-	print '<div class="tagtd opacitymedium"></div>';
106
-	print '<div class="tagtd opacitymedium"></div>';
107
-	print '<div class="tagtd opacitymedium"></div>';
108
-	print '<div class="tagtd opacitymedium"></div>';
109
-	print '</form>';
103
+    print '<form class="tagtr oddeven">';
104
+    print '<div class="tagtd opacitymedium">'.$langs->trans('NoResourceLinked').'</div>';
105
+    print '<div class="tagtd opacitymedium"></div>';
106
+    print '<div class="tagtd opacitymedium"></div>';
107
+    print '<div class="tagtd opacitymedium"></div>';
108
+    print '<div class="tagtd opacitymedium"></div>';
109
+    print '</form>';
110 110
 }
111 111
 
112 112
 print '</div>';
Please login to merge, or discard this patch.
dolibarr/htdocs/core/tpl/commonfields_edit.tpl.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
 // Protection to avoid direct call of template
25 25
 if (empty($conf) || ! is_object($conf))
26 26
 {
27
-	print "Error, template page can't be called as URL";
28
-	exit;
27
+    print "Error, template page can't be called as URL";
28
+    exit;
29 29
 }
30 30
 if (! is_object($form)) $form=new Form($db);
31 31
 
@@ -37,27 +37,27 @@  discard block
 block discarded – undo
37 37
 
38 38
 foreach($object->fields as $key => $val)
39 39
 {
40
-	// Discard if extrafield is a hidden field on form
41
-	if (abs($val['visible']) != 1) continue;
40
+    // Discard if extrafield is a hidden field on form
41
+    if (abs($val['visible']) != 1) continue;
42 42
 
43
-	if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) continue;	// We don't want this field
43
+    if (array_key_exists('enabled', $val) && isset($val['enabled']) && ! verifCond($val['enabled'])) continue;	// We don't want this field
44 44
 
45
-	print '<tr><td';
46
-	print ' class="titlefieldcreate';
47
-	if ($val['notnull'] > 0) print ' fieldrequired';
48
-	if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop';
49
-	print '">';
50
-	if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $val['help']);
51
-	else print $langs->trans($val['label']);
52
-	print '</td>';
53
-	print '<td>';
54
-	if (in_array($val['type'], array('int', 'integer'))) $value = GETPOSTISSET($key)?GETPOST($key, 'int'):$object->$key;
55
-	elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOSTISSET($key)?GETPOST($key,'none'):$object->$key;
56
-	else $value = GETPOSTISSET($key)?GETPOST($key, 'alpha'):$object->$key;
57
-	//var_dump($val.' '.$key.' '.$value);
58
-	print $object->showInputField($val, $key, $value, '', '', '', 0);
59
-	print '</td>';
60
-	print '</tr>';
45
+    print '<tr><td';
46
+    print ' class="titlefieldcreate';
47
+    if ($val['notnull'] > 0) print ' fieldrequired';
48
+    if ($val['type'] == 'text' || $val['type'] == 'html') print ' tdtop';
49
+    print '">';
50
+    if (! empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $val['help']);
51
+    else print $langs->trans($val['label']);
52
+    print '</td>';
53
+    print '<td>';
54
+    if (in_array($val['type'], array('int', 'integer'))) $value = GETPOSTISSET($key)?GETPOST($key, 'int'):$object->$key;
55
+    elseif ($val['type'] == 'text' || $val['type'] == 'html') $value = GETPOSTISSET($key)?GETPOST($key,'none'):$object->$key;
56
+    else $value = GETPOSTISSET($key)?GETPOST($key, 'alpha'):$object->$key;
57
+    //var_dump($val.' '.$key.' '.$value);
58
+    print $object->showInputField($val, $key, $value, '', '', '', 0);
59
+    print '</td>';
60
+    print '</tr>';
61 61
 }
62 62
 
63 63
 ?>
Please login to merge, or discard this patch.
dolibarr/htdocs/core/tpl/object_discounts.tpl.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -35,74 +35,74 @@
 block discarded – undo
35 35
 
36 36
 $fixedDiscount = $thirdparty->remise_percent;
37 37
 if(! empty($discount_type)) {
38
-	$fixedDiscount = $thirdparty->remise_supplier_percent;
38
+    $fixedDiscount = $thirdparty->remise_supplier_percent;
39 39
 }
40 40
 
41 41
 if ($fixedDiscount > 0)
42 42
 {
43
-	$translationKey = (! empty($discount_type)) ? 'HasRelativeDiscountFromSupplier' : 'CompanyHasRelativeDiscount';
44
-	print $langs->trans($translationKey, $fixedDiscount).'.';
43
+    $translationKey = (! empty($discount_type)) ? 'HasRelativeDiscountFromSupplier' : 'CompanyHasRelativeDiscount';
44
+    print $langs->trans($translationKey, $fixedDiscount).'.';
45 45
 }
46 46
 else
47 47
 {
48
-	$translationKey = (! empty($discount_type)) ? 'HasNoRelativeDiscountFromSupplier' : 'CompanyHasNoRelativeDiscount';
49
-	print $langs->trans($translationKey).'.';
48
+    $translationKey = (! empty($discount_type)) ? 'HasNoRelativeDiscountFromSupplier' : 'CompanyHasNoRelativeDiscount';
49
+    print $langs->trans($translationKey).'.';
50 50
 }
51 51
 if($isNewObject) print ' ('.$addrelativediscount.')';
52 52
 
53 53
 // Is there is commercial discount or down payment available ?
54 54
 if ($absolute_discount > 0) {
55 55
 
56
-	if ($cannotApplyDiscount || ! $isInvoice || $isNewObject || $object->statut > $classname::STATUS_DRAFT || $object->type == $classname::TYPE_CREDIT_NOTE || $object->type == $classname::TYPE_DEPOSIT) {
57
-		$translationKey = ! empty($discount_type) ? 'HasAbsoluteDiscountFromSupplier' : 'CompanyHasAbsoluteDiscount';
58
-		$text = $langs->trans($translationKey, price($absolute_discount), $langs->transnoentities("Currency" . $conf->currency)).'.';
56
+    if ($cannotApplyDiscount || ! $isInvoice || $isNewObject || $object->statut > $classname::STATUS_DRAFT || $object->type == $classname::TYPE_CREDIT_NOTE || $object->type == $classname::TYPE_DEPOSIT) {
57
+        $translationKey = ! empty($discount_type) ? 'HasAbsoluteDiscountFromSupplier' : 'CompanyHasAbsoluteDiscount';
58
+        $text = $langs->trans($translationKey, price($absolute_discount), $langs->transnoentities("Currency" . $conf->currency)).'.';
59 59
 
60
-		if ($isInvoice && ! $isNewObject && $object->statut > $classname::STATUS_DRAFT && $object->type != $classname::TYPE_CREDIT_NOTE && $object->type != $classname::TYPE_DEPOSIT) {
61
-			$text = $form->textwithpicto($text, $langs->trans('AbsoluteDiscountUse'));
62
-		}
60
+        if ($isInvoice && ! $isNewObject && $object->statut > $classname::STATUS_DRAFT && $object->type != $classname::TYPE_CREDIT_NOTE && $object->type != $classname::TYPE_DEPOSIT) {
61
+            $text = $form->textwithpicto($text, $langs->trans('AbsoluteDiscountUse'));
62
+        }
63 63
 
64
-		if ($isNewObject) {
65
-			$text.= ' ('.$addabsolutediscount.')';
66
-		}
64
+        if ($isNewObject) {
65
+            $text.= ' ('.$addabsolutediscount.')';
66
+        }
67 67
 
68
-		print '<br>'.$text;
69
-	} else {
70
-		// Discount available of type fixed amount (not credit note)
71
-		$more = '(' . $addabsolutediscount . ')';
72
-		$form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, GETPOST('discountid'), 'remise_id', $thirdparty->id, $absolute_discount, $filterabsolutediscount, $resteapayer, $more, 0, $discount_type);
73
-	}
68
+        print '<br>'.$text;
69
+    } else {
70
+        // Discount available of type fixed amount (not credit note)
71
+        $more = '(' . $addabsolutediscount . ')';
72
+        $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, GETPOST('discountid'), 'remise_id', $thirdparty->id, $absolute_discount, $filterabsolutediscount, $resteapayer, $more, 0, $discount_type);
73
+    }
74 74
 }
75 75
 
76 76
 // Is there credit notes availables ?
77 77
 if ($absolute_creditnote > 0) {
78 78
 
79
-	// If validated, we show link "add credit note to payment"
80
-	if ($cannotApplyDiscount || ! $isInvoice || $isNewObject || $object->statut != $classname::STATUS_VALIDATED || $object->type == $classname::TYPE_CREDIT_NOTE) {
81
-		$translationKey = ! empty($discount_type) ? 'HasCreditNoteFromSupplier' : 'CompanyHasCreditNote';
82
-		$text = $langs->trans($translationKey, price($absolute_creditnote), $langs->transnoentities("Currency" . $conf->currency)) . '.';
83
-
84
-		if ($isInvoice && ! $isNewObject && $object->statut == $classname::STATUS_DRAFT && $object->type != $classname::TYPE_DEPOSIT) {
85
-			$text = $form->textwithpicto($text, $langs->trans('CreditNoteDepositUse'));
86
-		}
87
-
88
-		if ($absolute_discount <= 0 || $isNewObject) {
89
-			$text.= '('.$addabsolutediscount.')';
90
-		}
91
-
92
-		print '<br>'.$text;
93
-	} else {  // We can add a credit note on a down payment or standard invoice or situation invoice
94
-		// There is credit notes discounts available
95
-		$more = $isInvoice && ! $isNewObject ? ' (' . $viewabsolutediscount . ')' : '';
96
-		$form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, 0, 'remise_id_for_payment', $thirdparty->id, $absolute_creditnote, $filtercreditnote, 0, $more, 0, $discount_type); // We allow credit note even if amount is higher
97
-	}
79
+    // If validated, we show link "add credit note to payment"
80
+    if ($cannotApplyDiscount || ! $isInvoice || $isNewObject || $object->statut != $classname::STATUS_VALIDATED || $object->type == $classname::TYPE_CREDIT_NOTE) {
81
+        $translationKey = ! empty($discount_type) ? 'HasCreditNoteFromSupplier' : 'CompanyHasCreditNote';
82
+        $text = $langs->trans($translationKey, price($absolute_creditnote), $langs->transnoentities("Currency" . $conf->currency)) . '.';
83
+
84
+        if ($isInvoice && ! $isNewObject && $object->statut == $classname::STATUS_DRAFT && $object->type != $classname::TYPE_DEPOSIT) {
85
+            $text = $form->textwithpicto($text, $langs->trans('CreditNoteDepositUse'));
86
+        }
87
+
88
+        if ($absolute_discount <= 0 || $isNewObject) {
89
+            $text.= '('.$addabsolutediscount.')';
90
+        }
91
+
92
+        print '<br>'.$text;
93
+    } else {  // We can add a credit note on a down payment or standard invoice or situation invoice
94
+        // There is credit notes discounts available
95
+        $more = $isInvoice && ! $isNewObject ? ' (' . $viewabsolutediscount . ')' : '';
96
+        $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, 0, 'remise_id_for_payment', $thirdparty->id, $absolute_creditnote, $filtercreditnote, 0, $more, 0, $discount_type); // We allow credit note even if amount is higher
97
+    }
98 98
 }
99 99
 
100 100
 if($absolute_discount <= 0 && $absolute_creditnote <= 0) {
101
-	$translationKey = ! empty($discount_type) ? 'HasNoAbsoluteDiscountFromSupplier' : 'CompanyHasNoAbsoluteDiscount';
102
-	print '<br>'.$langs->trans($translationKey).'.';
101
+    $translationKey = ! empty($discount_type) ? 'HasNoAbsoluteDiscountFromSupplier' : 'CompanyHasNoAbsoluteDiscount';
102
+    print '<br>'.$langs->trans($translationKey).'.';
103 103
 
104
-	if ($isInvoice && $object->statut == $classname::STATUS_DRAFT && $object->type != $classname::TYPE_CREDIT_NOTE && $object->type != $classname::TYPE_DEPOSIT) {
105
-		print ' (' . $addabsolutediscount . ')';
106
-	}
104
+    if ($isInvoice && $object->statut == $classname::STATUS_DRAFT && $object->type != $classname::TYPE_CREDIT_NOTE && $object->type != $classname::TYPE_DEPOSIT) {
105
+        print ' (' . $addabsolutediscount . ')';
106
+    }
107 107
 }
108 108
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/tpl/notes.tpl.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 
20 20
 // Protection to avoid direct call of template
21 21
 if (empty($object) || ! is_object($object)) {
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
 // $permissionnote 	must be defined by caller. For example $permissionnote=$user->rights->module->create
@@ -37,23 +37,23 @@  discard block
 block discarded – undo
37 37
 $value_private=$object->note_private;
38 38
 if (! empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PUBLIC_NOTES))
39 39
 {
40
-	$stringtoadd=dol_print_date(dol_now(), 'dayhour').' '.$user->getFullName($langs).' --';
41
-	if (GETPOST('action','aZ09') == 'edit'.$note_public)
42
-	{
43
-		$value_public=dol_concatdesc($value_public, ($value_public?"\n":"")."-- ".$stringtoadd);
44
-		if (dol_textishtml($value_public)) $value_public.="<br>\n";
45
-		else $value_public.="\n";
46
-	}
40
+    $stringtoadd=dol_print_date(dol_now(), 'dayhour').' '.$user->getFullName($langs).' --';
41
+    if (GETPOST('action','aZ09') == 'edit'.$note_public)
42
+    {
43
+        $value_public=dol_concatdesc($value_public, ($value_public?"\n":"")."-- ".$stringtoadd);
44
+        if (dol_textishtml($value_public)) $value_public.="<br>\n";
45
+        else $value_public.="\n";
46
+    }
47 47
 }
48 48
 if (! empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES))
49 49
 {
50
-	$stringtoadd=dol_print_date(dol_now(), 'dayhour').' '.$user->getFullName($langs).' --';
51
-	if (GETPOST('action','aZ09') == 'edit'.$note_private)
52
-	{
53
-		$value_private=dol_concatdesc($value_private, ($value_private?"\n":"")."-- ".$stringtoadd);
54
-		if (dol_textishtml($value_private)) $value_private.="<br>\n";
55
-		else $value_private.="\n";
56
-	}
50
+    $stringtoadd=dol_print_date(dol_now(), 'dayhour').' '.$user->getFullName($langs).' --';
51
+    if (GETPOST('action','aZ09') == 'edit'.$note_private)
52
+    {
53
+        $value_private=dol_concatdesc($value_private, ($value_private?"\n":"")."-- ".$stringtoadd);
54
+        if (dol_textishtml($value_private)) $value_private.="<br>\n";
55
+        else $value_private.="\n";
56
+    }
57 57
 }
58 58
 
59 59
 // Special cases
@@ -76,25 +76,25 @@  discard block
 block discarded – undo
76 76
 print '<!-- BEGIN PHP TEMPLATE NOTES -->'."\n";
77 77
 print '<div class="tagtable border table-border centpercent">'."\n";
78 78
 if ($module != 'product') {
79
-	// No public note yet on products
80
-	print '<div class="tagtr pair table-border-row">'."\n";
81
-	print '<div class="tagtd tagtdnote tdtop table-key-border-col'.(empty($cssclass)?'':' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n";
82
-	print $form->editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam, '', 0);
83
-	print '</div>'."\n";
84
-	print '<div class="tagtd table-val-border-col">'."\n";
85
-	print $form->editfieldval("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, '', null, null, $moreparam, 1)."\n";
86
-	print '</div>'."\n";
87
-	print '</div>'."\n";
79
+    // No public note yet on products
80
+    print '<div class="tagtr pair table-border-row">'."\n";
81
+    print '<div class="tagtd tagtdnote tdtop table-key-border-col'.(empty($cssclass)?'':' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n";
82
+    print $form->editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam, '', 0);
83
+    print '</div>'."\n";
84
+    print '<div class="tagtd table-val-border-col">'."\n";
85
+    print $form->editfieldval("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, '', null, null, $moreparam, 1)."\n";
86
+    print '</div>'."\n";
87
+    print '</div>'."\n";
88 88
 }
89 89
 if (empty($user->societe_id)) {
90
-	print '<div class="tagtr '.($module != 'product'?'impair':'pair').' table-border-row">'."\n";
91
-	print '<div class="tagtd tagtdnote tdtop table-key-border-col'.(empty($cssclass)?'':' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n";
92
-	print $form->editfieldkey("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, $moreparam, '', 0);
93
-	print '</div>'."\n";
94
-	print '<div class="tagtd table-val-border-col">'."\n";
95
-	print $form->editfieldval("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, '', null, null, $moreparam, 1);
96
-	print '</div>'."\n";
97
-	print '</div>'."\n";
90
+    print '<div class="tagtr '.($module != 'product'?'impair':'pair').' table-border-row">'."\n";
91
+    print '<div class="tagtd tagtdnote tdtop table-key-border-col'.(empty($cssclass)?'':' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n";
92
+    print $form->editfieldkey("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, $moreparam, '', 0);
93
+    print '</div>'."\n";
94
+    print '<div class="tagtd table-val-border-col">'."\n";
95
+    print $form->editfieldval("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, '', null, null, $moreparam, 1);
96
+    print '</div>'."\n";
97
+    print '</div>'."\n";
98 98
 }
99 99
 print '</div>'."\n";
100 100
 ?>
Please login to merge, or discard this patch.
dolibarr/htdocs/core/tpl/extrafields_list_search_param.tpl.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 // Protection to avoid direct call of template
4 4
 if (empty($conf) || ! is_object($conf))
5 5
 {
6
-	print "Error, template page can't be called as URL";
7
-	exit;
6
+    print "Error, template page can't be called as URL";
7
+    exit;
8 8
 }
9 9
 
10 10
 // Loop to complete $param for extrafields
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
12 12
 {
13 13
 foreach ($search_array_options as $key => $val)
14 14
 {
15
-	$crit=$val;
16
-	$tmpkey=preg_replace('/search_options_/','',$key);
17
-	if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
15
+    $crit=$val;
16
+    $tmpkey=preg_replace('/search_options_/','',$key);
17
+    if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
18 18
 }
19 19
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/tpl/extrafields_edit.tpl.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
 // Protection to avoid direct call of template
29 29
 if (empty($conf) || ! is_object($conf))
30 30
 {
31
-	print "Error, template page can't be called as URL";
32
-	exit;
31
+    print "Error, template page can't be called as URL";
32
+    exit;
33 33
 }
34 34
 
35 35
 ?>
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
42 42
 print $hookmanager->resPrint;
43 43
 if (empty($reshook)) {
44
-	print $object->showOptionals($extrafields, 'edit');
44
+    print $object->showOptionals($extrafields, 'edit');
45 45
 }
46 46
 
47 47
 ?>
Please login to merge, or discard this patch.
dolibarr/htdocs/core/tpl/extrafields_list_search_title.tpl.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 // Protection to avoid direct call of template
4 4
 if (empty($conf) || ! is_object($conf))
5 5
 {
6
-	print "Error, template page can't be called as URL";
7
-	exit;
6
+    print "Error, template page can't be called as URL";
7
+    exit;
8 8
 }
9 9
 
10 10
 if (empty($extrafieldsobjectkey) && is_object($object)) $extrafieldsobjectkey=$object->table_element;
@@ -12,18 +12,18 @@  discard block
 block discarded – undo
12 12
 // Loop to show all columns of extrafields for the title line
13 13
 if (! empty($extrafieldsobjectkey))	// $extrafieldsobject is the $object->table_element like 'societe', 'socpeople', ...
14 14
 {
15
-	if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label']))
16
-	{
17
-		foreach($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val)
18
-		{
19
-			if (! empty($arrayfields["ef.".$key]['checked']))
20
-			{
21
-				$align=$extrafields->getAlignFlag($key);
22
-				$sortonfield = "ef.".$key;
23
-				if (! empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) $sortonfield='';
24
-				if ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] == 'separate') print '<th class="liste_titre thseparator"></th>';
25
-				else print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n";
26
-			}
27
-		}
28
-	}
15
+    if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label']))
16
+    {
17
+        foreach($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val)
18
+        {
19
+            if (! empty($arrayfields["ef.".$key]['checked']))
20
+            {
21
+                $align=$extrafields->getAlignFlag($key);
22
+                $sortonfield = "ef.".$key;
23
+                if (! empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) $sortonfield='';
24
+                if ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] == 'separate') print '<th class="liste_titre thseparator"></th>';
25
+                else print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n";
26
+            }
27
+        }
28
+    }
29 29
 }
30 30
\ No newline at end of file
Please login to merge, or discard this patch.