Passed
Push — master ( a56e33...222e44 )
by Alxarafe
36:56
created
dolibarr/htdocs/core/lib/ajax.lib.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
 
56 56
     // Input search_htmlname is original field
57 57
     // Input htmlname is a second input field used when using ajax autocomplete.
58
-	$script = '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="'.$selected.'" />';
58
+    $script = '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="'.$selected.'" />';
59 59
 
60
-	$script.= '<!-- Javascript code for autocomplete of field '.$htmlname.' -->'."\n";
61
-	$script.= '<script type="text/javascript">'."\n";
62
-	$script.= '$(document).ready(function() {
60
+    $script.= '<!-- Javascript code for autocomplete of field '.$htmlname.' -->'."\n";
61
+    $script.= '<script type="text/javascript">'."\n";
62
+    $script.= '$(document).ready(function() {
63 63
 					var autoselect = '.$autoselect.';
64 64
 					var options = '.json_encode($ajaxoptions).';
65 65
 
@@ -202,9 +202,9 @@  discard block
 block discarded – undo
202 202
 					};
203 203
 
204 204
   				});';
205
-	$script.= '</script>';
205
+    $script.= '</script>';
206 206
 
207
-	return $script;
207
+    return $script;
208 208
 }
209 209
 
210 210
 /**
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
  */
224 224
 function ajax_multiautocompleter($htmlname, $fields, $url, $option='', $minLength=2, $autoselect=0)
225 225
 {
226
-	$script = '<!-- Autocomplete -->'."\n";
227
-	$script.= '<script type="text/javascript">';
228
-	$script.= 'jQuery(document).ready(function() {
226
+    $script = '<!-- Autocomplete -->'."\n";
227
+    $script.= '<script type="text/javascript">';
228
+    $script.= 'jQuery(document).ready(function() {
229 229
 					var fields = '.json_encode($fields).';
230 230
 					var nboffields = fields.length;
231 231
 					var autoselect = '.$autoselect.';
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
     					}
315 315
 					});
316 316
   				});';
317
-	$script.= '</script>';
317
+    $script.= '</script>';
318 318
 
319
-	return $script;
319
+    return $script;
320 320
 }
321 321
 
322 322
 /**
@@ -330,12 +330,12 @@  discard block
 block discarded – undo
330 330
  */
331 331
 function ajax_dialog($title,$message,$w=350,$h=150)
332 332
 {
333
-	global $langs;
333
+    global $langs;
334 334
 
335
-	$newtitle=dol_textishtml($title)?dol_string_nohtmltag($title,1):$title;
336
-	$msg= '<div id="dialog-info" title="'.dol_escape_htmltag($newtitle).'">';
337
-	$msg.= $message;
338
-	$msg.= '</div>'."\n";
335
+    $newtitle=dol_textishtml($title)?dol_string_nohtmltag($title,1):$title;
336
+    $msg= '<div id="dialog-info" title="'.dol_escape_htmltag($newtitle).'">';
337
+    $msg.= $message;
338
+    $msg.= '</div>'."\n";
339 339
     $msg.= '<script type="text/javascript">
340 340
     jQuery(function() {
341 341
         jQuery("#dialog-info").dialog({
@@ -373,17 +373,17 @@  discard block
 block discarded – undo
373 373
  */
374 374
 function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve')
375 375
 {
376
-	global $conf;
376
+    global $conf;
377 377
 
378
-	// select2 disabled for smartphones with standard browser.
379
-	// TODO With select2 v4, it seems ok, except that responsive style on table become crazy when scrolling at end of array)
380
-	if (! empty($conf->browser->layout) && $conf->browser->layout == 'phone') return '';
378
+    // select2 disabled for smartphones with standard browser.
379
+    // TODO With select2 v4, it seems ok, except that responsive style on table become crazy when scrolling at end of array)
380
+    if (! empty($conf->browser->layout) && $conf->browser->layout == 'phone') return '';
381 381
 
382
-	if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return '';
383
-	if (empty($conf->use_javascript_ajax)) return '';
384
-	if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && ! defined('REQUIRE_JQUERY_MULTISELECT')) return '';
382
+    if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return '';
383
+    if (empty($conf->use_javascript_ajax)) return '';
384
+    if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && ! defined('REQUIRE_JQUERY_MULTISELECT')) return '';
385 385
 
386
-	if (empty($minLengthToAutocomplete)) $minLengthToAutocomplete=0;
386
+    if (empty($minLengthToAutocomplete)) $minLengthToAutocomplete=0;
387 387
 
388 388
     $tmpplugin='select2';
389 389
     $msg="\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id = '.$htmlname.' -->
@@ -410,12 +410,12 @@  discard block
 block discarded – undo
410 410
 					},
411 411
 					dropdownCssClass: \'ui-dialog\'
412 412
 				})';
413
-	if ($forcefocus) $msg.= '.select2(\'focus\')';
414
-	$msg.= ';'."\n";
413
+    if ($forcefocus) $msg.= '.select2(\'focus\')';
414
+    $msg.= ';'."\n";
415 415
 
416
-	if (is_array($events) && count($events))    // If an array of js events to do were provided.
417
-	{
418
-		$msg.= '
416
+    if (is_array($events) && count($events))    // If an array of js events to do were provided.
417
+    {
418
+        $msg.= '
419 419
 			jQuery("#'.$htmlname.'").change(function () {
420 420
 				var obj = '.json_encode($events).';
421 421
 		   		$.each(obj, function(key,values) {
@@ -462,9 +462,9 @@  discard block
 block discarded – undo
462 462
 						}
463 463
 				);
464 464
 			}';
465
-	}
465
+    }
466 466
 
467
-	$msg.= '});'."\n";
467
+    $msg.= '});'."\n";
468 468
     $msg.= "</script>\n";
469 469
 
470 470
     return $msg;
@@ -482,18 +482,18 @@  discard block
 block discarded – undo
482 482
  */
483 483
 function ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0)
484 484
 {
485
-	global $conf, $langs;
486
-
487
-	$entity = ((isset($entity) && is_numeric($entity) && $entity >= 0) ? $entity : $conf->entity);
488
-
489
-	if (empty($conf->use_javascript_ajax))
490
-	{
491
-		if (empty($conf->global->$code)) print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_'.$code.'&entity='.$entity.'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
492
-		else print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_'.$code.'&entity='.$entity.'">'.img_picto($langs->trans("Enabled"),'on').'</a>';
493
-	}
494
-	else
495
-	{
496
-		$out= "\n<!-- Ajax code to switch constant ".$code." -->".'
485
+    global $conf, $langs;
486
+
487
+    $entity = ((isset($entity) && is_numeric($entity) && $entity >= 0) ? $entity : $conf->entity);
488
+
489
+    if (empty($conf->use_javascript_ajax))
490
+    {
491
+        if (empty($conf->global->$code)) print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_'.$code.'&entity='.$entity.'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
492
+        else print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_'.$code.'&entity='.$entity.'">'.img_picto($langs->trans("Enabled"),'on').'</a>';
493
+    }
494
+    else
495
+    {
496
+        $out= "\n<!-- Ajax code to switch constant ".$code." -->".'
497 497
 		<script type="text/javascript">
498 498
 			$(document).ready(function() {
499 499
 				var input = '.json_encode($input).';
@@ -528,13 +528,13 @@  discard block
 block discarded – undo
528 528
 			});
529 529
 		</script>'."\n";
530 530
 
531
-		$out.= '<div id="confirm_'.$code.'" title="" style="display: none;"></div>';
532
-		$out.= '<span id="set_'.$code.'" class="linkobject '.(! empty($conf->global->$code)?'hideobject':'').'">'.($revertonoff?img_picto($langs->trans("Enabled"),'switch_on'):img_picto($langs->trans("Disabled"),'switch_off')).'</span>';
533
-		$out.= '<span id="del_'.$code.'" class="linkobject '.(! empty($conf->global->$code)?'':'hideobject').'">'.($revertonoff?img_picto($langs->trans("Disabled"),'switch_off'):img_picto($langs->trans("Enabled"),'switch_on')).'</span>';
534
-		$out.="\n";
535
-	}
531
+        $out.= '<div id="confirm_'.$code.'" title="" style="display: none;"></div>';
532
+        $out.= '<span id="set_'.$code.'" class="linkobject '.(! empty($conf->global->$code)?'hideobject':'').'">'.($revertonoff?img_picto($langs->trans("Enabled"),'switch_on'):img_picto($langs->trans("Disabled"),'switch_off')).'</span>';
533
+        $out.= '<span id="del_'.$code.'" class="linkobject '.(! empty($conf->global->$code)?'':'hideobject').'">'.($revertonoff?img_picto($langs->trans("Disabled"),'switch_off'):img_picto($langs->trans("Enabled"),'switch_on')).'</span>';
534
+        $out.="\n";
535
+    }
536 536
 
537
-	return $out;
537
+    return $out;
538 538
 }
539 539
 
540 540
 /**
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/invoice2.lib.php 1 patch
Indentation   +203 added lines, -203 removed lines patch added patch discarded remove patch
@@ -50,234 +50,234 @@
 block discarded – undo
50 50
  */
51 51
 function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filter, $dateafterdate, $datebeforedate, $paymentdateafter, $paymentdatebefore, $usestdout, $regenerate=0, $filesuffix='', $paymentbankid='', $thirdpartiesid='', $fileprefix='mergedpdf')
52 52
 {
53
-	$sql = "SELECT DISTINCT f.rowid, f.ref";
54
-	$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
55
-	$sqlwhere='';
56
-	$sqlorder='';
57
-	if (in_array('all',$filter))
58
-	{
59
-		$sqlorder = " ORDER BY f.ref ASC";
60
-	}
61
-	if (in_array('date',$filter))
62
-	{
63
-		if (empty($sqlwhere)) $sqlwhere=' WHERE ';
64
-		else $sqlwhere.=" AND";
65
-		$sqlwhere.= " f.fk_statut > 0";
66
-		$sqlwhere.= " AND f.datef >= '".$db->idate($dateafterdate)."'";
67
-		$sqlwhere.= " AND f.datef <= '".$db->idate($datebeforedate)."'";
68
-		$sqlorder = " ORDER BY f.datef ASC";
69
-	}
70
-	if (in_array('nopayment',$filter))
71
-	{
72
-		$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid = pf.fk_facture";
73
-		if (empty($sqlwhere)) $sqlwhere=' WHERE ';
74
-		else $sqlwhere.=" AND";
75
-		$sqlwhere.= " f.fk_statut > 0";
76
-		$sqlwhere.= " AND pf.fk_paiement IS NULL";
77
-	}
78
-	if (in_array('payments',$filter) || in_array('bank',$filter))
79
-	{
80
-		$sql.= ", ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p";
81
-		if (in_array('bank',$filter)) $sql.= ", ".MAIN_DB_PREFIX."bank as b";
82
-		if (empty($sqlwhere)) $sqlwhere=' WHERE ';
83
-		else $sqlwhere.=" AND";
84
-		$sqlwhere.= " f.fk_statut > 0";
85
-		$sqlwhere.= " AND f.rowid = pf.fk_facture";
86
-		$sqlwhere.= " AND pf.fk_paiement = p.rowid";
87
-		if (in_array('payments',$filter))
88
-		{
89
-			$sqlwhere.= " AND p.datep >= '".$db->idate($paymentdateafter)."'";
90
-			$sqlwhere.= " AND p.datep <= '".$db->idate($paymentdatebefore)."'";
91
-		}
92
-		if (in_array('bank',$filter))
93
-		{
94
-			$sqlwhere.= " AND p.fk_bank = b.rowid";
95
-			$sqlwhere.= " AND b.fk_account = ".$paymentbankid;
96
-		}
97
-		$sqlorder = " ORDER BY p.datep ASC";
98
-	}
99
-	if (in_array('nodeposit',$filter))
100
-	{
101
-	    if (empty($sqlwhere)) $sqlwhere=' WHERE ';
102
-	    else $sqlwhere.=" AND";
103
-	    $sqlwhere.=' type <> 3';
104
-	}
105
-	if (in_array('noreplacement',$filter))
106
-	{
107
-	    if (empty($sqlwhere)) $sqlwhere=' WHERE ';
108
-	    else $sqlwhere.=" AND";
109
-	    $sqlwhere.=' type <> 1';
110
-	}
111
-	if (in_array('nocreditnote',$filter))
112
-	{
113
-	    if (empty($sqlwhere)) $sqlwhere=' WHERE ';
114
-	    else $sqlwhere.=" AND";
115
-	    $sqlwhere.=' type <> 2';
116
-	}
117
-	if (in_array('excludethirdparties',$filter) && is_array($thirdpartiesid))
118
-	{
119
-	    if (empty($sqlwhere)) $sqlwhere=' WHERE ';
120
-	    else $sqlwhere.=" AND";
121
-	    $sqlwhere.=' f.fk_soc NOT IN ('.join(',',$thirdpartiesid).')';
122
-	}
123
-	if (in_array('onlythirdparties',$filter) && is_array($thirdpartiesid))
124
-	{
125
-	    if (empty($sqlwhere)) $sqlwhere=' WHERE ';
126
-	    else $sqlwhere.=" AND";
127
-	    $sqlwhere.=' f.fk_soc IN ('.join(',',$thirdpartiesid).')';
128
-	}
129
-	if ($sqlwhere) $sql.=$sqlwhere;
130
-	if ($sqlorder) $sql.=$sqlorder;
53
+    $sql = "SELECT DISTINCT f.rowid, f.ref";
54
+    $sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
55
+    $sqlwhere='';
56
+    $sqlorder='';
57
+    if (in_array('all',$filter))
58
+    {
59
+        $sqlorder = " ORDER BY f.ref ASC";
60
+    }
61
+    if (in_array('date',$filter))
62
+    {
63
+        if (empty($sqlwhere)) $sqlwhere=' WHERE ';
64
+        else $sqlwhere.=" AND";
65
+        $sqlwhere.= " f.fk_statut > 0";
66
+        $sqlwhere.= " AND f.datef >= '".$db->idate($dateafterdate)."'";
67
+        $sqlwhere.= " AND f.datef <= '".$db->idate($datebeforedate)."'";
68
+        $sqlorder = " ORDER BY f.datef ASC";
69
+    }
70
+    if (in_array('nopayment',$filter))
71
+    {
72
+        $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid = pf.fk_facture";
73
+        if (empty($sqlwhere)) $sqlwhere=' WHERE ';
74
+        else $sqlwhere.=" AND";
75
+        $sqlwhere.= " f.fk_statut > 0";
76
+        $sqlwhere.= " AND pf.fk_paiement IS NULL";
77
+    }
78
+    if (in_array('payments',$filter) || in_array('bank',$filter))
79
+    {
80
+        $sql.= ", ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p";
81
+        if (in_array('bank',$filter)) $sql.= ", ".MAIN_DB_PREFIX."bank as b";
82
+        if (empty($sqlwhere)) $sqlwhere=' WHERE ';
83
+        else $sqlwhere.=" AND";
84
+        $sqlwhere.= " f.fk_statut > 0";
85
+        $sqlwhere.= " AND f.rowid = pf.fk_facture";
86
+        $sqlwhere.= " AND pf.fk_paiement = p.rowid";
87
+        if (in_array('payments',$filter))
88
+        {
89
+            $sqlwhere.= " AND p.datep >= '".$db->idate($paymentdateafter)."'";
90
+            $sqlwhere.= " AND p.datep <= '".$db->idate($paymentdatebefore)."'";
91
+        }
92
+        if (in_array('bank',$filter))
93
+        {
94
+            $sqlwhere.= " AND p.fk_bank = b.rowid";
95
+            $sqlwhere.= " AND b.fk_account = ".$paymentbankid;
96
+        }
97
+        $sqlorder = " ORDER BY p.datep ASC";
98
+    }
99
+    if (in_array('nodeposit',$filter))
100
+    {
101
+        if (empty($sqlwhere)) $sqlwhere=' WHERE ';
102
+        else $sqlwhere.=" AND";
103
+        $sqlwhere.=' type <> 3';
104
+    }
105
+    if (in_array('noreplacement',$filter))
106
+    {
107
+        if (empty($sqlwhere)) $sqlwhere=' WHERE ';
108
+        else $sqlwhere.=" AND";
109
+        $sqlwhere.=' type <> 1';
110
+    }
111
+    if (in_array('nocreditnote',$filter))
112
+    {
113
+        if (empty($sqlwhere)) $sqlwhere=' WHERE ';
114
+        else $sqlwhere.=" AND";
115
+        $sqlwhere.=' type <> 2';
116
+    }
117
+    if (in_array('excludethirdparties',$filter) && is_array($thirdpartiesid))
118
+    {
119
+        if (empty($sqlwhere)) $sqlwhere=' WHERE ';
120
+        else $sqlwhere.=" AND";
121
+        $sqlwhere.=' f.fk_soc NOT IN ('.join(',',$thirdpartiesid).')';
122
+    }
123
+    if (in_array('onlythirdparties',$filter) && is_array($thirdpartiesid))
124
+    {
125
+        if (empty($sqlwhere)) $sqlwhere=' WHERE ';
126
+        else $sqlwhere.=" AND";
127
+        $sqlwhere.=' f.fk_soc IN ('.join(',',$thirdpartiesid).')';
128
+    }
129
+    if ($sqlwhere) $sql.=$sqlwhere;
130
+    if ($sqlorder) $sql.=$sqlorder;
131 131
 
132
-	//print $sql; exit;
133
-	dol_syslog("scripts/invoices/rebuild_merge.php:", LOG_DEBUG);
132
+    //print $sql; exit;
133
+    dol_syslog("scripts/invoices/rebuild_merge.php:", LOG_DEBUG);
134 134
 
135
-	if ($usestdout) print '--- start'."\n";
135
+    if ($usestdout) print '--- start'."\n";
136 136
 
137
-	// Start of transaction
138
-	//$db->begin();
137
+    // Start of transaction
138
+    //$db->begin();
139 139
 
140
-	$error = 0;
141
-	$result = 0;
142
-	$files = array() ;		// liste les fichiers
140
+    $error = 0;
141
+    $result = 0;
142
+    $files = array() ;		// liste les fichiers
143 143
 
144
-	dol_syslog("scripts/invoices/rebuild_merge.php", LOG_DEBUG);
145
-	if ( $resql=$db->query($sql) )
146
-	{
147
-	    $num = $db->num_rows($resql);
148
-	    $cpt = 0;
149
-	    $oldemail = '';
150
-	    $message = '';
151
-	    $total = '';
144
+    dol_syslog("scripts/invoices/rebuild_merge.php", LOG_DEBUG);
145
+    if ( $resql=$db->query($sql) )
146
+    {
147
+        $num = $db->num_rows($resql);
148
+        $cpt = 0;
149
+        $oldemail = '';
150
+        $message = '';
151
+        $total = '';
152 152
 
153
-	    if ($num)
154
-	    {
155
-	    	// First loop on each resultset to build PDF
156
-	    	// -----------------------------------------
153
+        if ($num)
154
+        {
155
+            // First loop on each resultset to build PDF
156
+            // -----------------------------------------
157 157
 
158
-	        while ($cpt < $num)
159
-	        {
160
-	            $obj = $db->fetch_object($resql);
158
+            while ($cpt < $num)
159
+            {
160
+                $obj = $db->fetch_object($resql);
161 161
 
162
-				$fac = new Facture($db);
163
-				$result=$fac->fetch($obj->rowid);
164
-				if ($result > 0)
165
-				{
166
-					$outputlangs = $langs;
167
-					if (! empty($newlangid))
168
-					{
169
-						if ($outputlangs->defaultlang != $newlangid)
170
-						{
171
-							$outputlangs = new Translate("",$conf);
172
-							$outputlangs->setDefaultLang($newlangid);
173
-						}
174
-					}
175
-					$filename=$conf->facture->dir_output.'/'.$fac->ref.'/'.$fac->ref.'.pdf';
176
-					if ($regenerate || ! dol_is_file($filename))
177
-					{
178
-	            	    if ($usestdout) print "Build PDF for invoice ".$obj->ref." - Lang = ".$outputlangs->defaultlang."\n";
179
-	    				$result= $fac->generateDocument($regenerate?$regenerate:$fac->modelpdf, $outputlangs);
180
-					}
181
-					else {
182
-					    if ($usestdout) print "PDF for invoice ".$obj->ref." already exists\n";
183
-					}
162
+                $fac = new Facture($db);
163
+                $result=$fac->fetch($obj->rowid);
164
+                if ($result > 0)
165
+                {
166
+                    $outputlangs = $langs;
167
+                    if (! empty($newlangid))
168
+                    {
169
+                        if ($outputlangs->defaultlang != $newlangid)
170
+                        {
171
+                            $outputlangs = new Translate("",$conf);
172
+                            $outputlangs->setDefaultLang($newlangid);
173
+                        }
174
+                    }
175
+                    $filename=$conf->facture->dir_output.'/'.$fac->ref.'/'.$fac->ref.'.pdf';
176
+                    if ($regenerate || ! dol_is_file($filename))
177
+                    {
178
+                        if ($usestdout) print "Build PDF for invoice ".$obj->ref." - Lang = ".$outputlangs->defaultlang."\n";
179
+                        $result= $fac->generateDocument($regenerate?$regenerate:$fac->modelpdf, $outputlangs);
180
+                    }
181
+                    else {
182
+                        if ($usestdout) print "PDF for invoice ".$obj->ref." already exists\n";
183
+                    }
184 184
 
185
-					// Add file into files array
186
-					$files[] = $filename;
187
-				}
185
+                    // Add file into files array
186
+                    $files[] = $filename;
187
+                }
188 188
 
189
-				if ($result <= 0)
190
-				{
191
-					$error++;
192
-					if ($usestdout) print "Error: Failed to build PDF for invoice ".($fac->ref?$fac->ref:' id '.$obj->rowid)."\n";
193
-					else dol_syslog("Failed to build PDF for invoice ".($fac->ref?$fac->ref:' id '.$obj->rowid), LOG_ERR);
194
-				}
189
+                if ($result <= 0)
190
+                {
191
+                    $error++;
192
+                    if ($usestdout) print "Error: Failed to build PDF for invoice ".($fac->ref?$fac->ref:' id '.$obj->rowid)."\n";
193
+                    else dol_syslog("Failed to build PDF for invoice ".($fac->ref?$fac->ref:' id '.$obj->rowid), LOG_ERR);
194
+                }
195 195
 
196
-	            $cpt++;
197
-	        }
196
+                $cpt++;
197
+            }
198 198
 
199 199
 
200
-	        // Define format of output PDF
201
-	        $formatarray=pdf_getFormat($langs);
202
-	        $page_largeur = $formatarray['width'];
203
-	        $page_hauteur = $formatarray['height'];
204
-	        $format = array($page_largeur,$page_hauteur);
200
+            // Define format of output PDF
201
+            $formatarray=pdf_getFormat($langs);
202
+            $page_largeur = $formatarray['width'];
203
+            $page_hauteur = $formatarray['height'];
204
+            $format = array($page_largeur,$page_hauteur);
205 205
 
206
-	        if ($usestdout) print "Using output PDF format ".join('x',$format)."\n";
207
-	        else dol_syslog("Using output PDF format ".join('x',$format), LOG_ERR);
206
+            if ($usestdout) print "Using output PDF format ".join('x',$format)."\n";
207
+            else dol_syslog("Using output PDF format ".join('x',$format), LOG_ERR);
208 208
 
209 209
 
210
-	        // Now, build a merged files with all files in $files array
211
-			//---------------------------------------------------------
210
+            // Now, build a merged files with all files in $files array
211
+            //---------------------------------------------------------
212 212
 
213
-	        // Create empty PDF
214
-	        $pdf=pdf_getInstance($format);
215
-	        if (class_exists('TCPDF'))
216
-	        {
217
-	            $pdf->setPrintHeader(false);
218
-	            $pdf->setPrintFooter(false);
219
-	        }
220
-	        $pdf->SetFont(pdf_getPDFFont($langs));
213
+            // Create empty PDF
214
+            $pdf=pdf_getInstance($format);
215
+            if (class_exists('TCPDF'))
216
+            {
217
+                $pdf->setPrintHeader(false);
218
+                $pdf->setPrintFooter(false);
219
+            }
220
+            $pdf->SetFont(pdf_getPDFFont($langs));
221 221
 
222
-	        if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
223
-			//$pdf->SetCompression(false);
222
+            if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
223
+            //$pdf->SetCompression(false);
224 224
 
225
-			// Add all others
226
-			foreach($files as $file)
227
-			{
228
-	            if ($usestdout) print "Merge PDF file for invoice ".$file."\n";
229
-	            else dol_syslog("Merge PDF file for invoice ".$file);
225
+            // Add all others
226
+            foreach($files as $file)
227
+            {
228
+                if ($usestdout) print "Merge PDF file for invoice ".$file."\n";
229
+                else dol_syslog("Merge PDF file for invoice ".$file);
230 230
 
231
-				// Charge un document PDF depuis un fichier.
232
-				$pagecount = $pdf->setSourceFile($file);
233
-				for ($i = 1; $i <= $pagecount; $i++)
234
-	            {
235
-	                 $tplidx = $pdf->importPage($i);
236
-	                 $s = $pdf->getTemplatesize($tplidx);
237
-	                 $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
238
-	                 $pdf->useTemplate($tplidx);
239
-	            }
240
-			}
231
+                // Charge un document PDF depuis un fichier.
232
+                $pagecount = $pdf->setSourceFile($file);
233
+                for ($i = 1; $i <= $pagecount; $i++)
234
+                {
235
+                        $tplidx = $pdf->importPage($i);
236
+                        $s = $pdf->getTemplatesize($tplidx);
237
+                        $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
238
+                        $pdf->useTemplate($tplidx);
239
+                }
240
+            }
241 241
 
242
-			// Create output dir if not exists
243
-			dol_mkdir($diroutputpdf);
242
+            // Create output dir if not exists
243
+            dol_mkdir($diroutputpdf);
244 244
 
245
-			// Save merged file
246
-			$filename=$fileprefix;
247
-			if (empty($filename)) $filename='mergedpdf';
248
-			if (! empty($filesuffix)) $filename.='_'.$filesuffix;
249
-			$file=$diroutputpdf.'/'.$filename.'.pdf';
245
+            // Save merged file
246
+            $filename=$fileprefix;
247
+            if (empty($filename)) $filename='mergedpdf';
248
+            if (! empty($filesuffix)) $filename.='_'.$filesuffix;
249
+            $file=$diroutputpdf.'/'.$filename.'.pdf';
250 250
 
251
-			if (! $error && $pagecount)
252
-			{
253
-				$pdf->Output($file,'F');
254
-				if (! empty($conf->global->MAIN_UMASK))
255
-					@chmod($file, octdec($conf->global->MAIN_UMASK));
256
-			}
251
+            if (! $error && $pagecount)
252
+            {
253
+                $pdf->Output($file,'F');
254
+                if (! empty($conf->global->MAIN_UMASK))
255
+                    @chmod($file, octdec($conf->global->MAIN_UMASK));
256
+            }
257 257
 
258
-			if ($usestdout)
259
-			{
260
-				if (! $error) print "Merged PDF has been built in ".$file."\n";
261
-				else print "Can't build PDF ".$file."\n";
262
-			}
258
+            if ($usestdout)
259
+            {
260
+                if (! $error) print "Merged PDF has been built in ".$file."\n";
261
+                else print "Can't build PDF ".$file."\n";
262
+            }
263 263
 
264
-			$result = 1;
265
-	    }
266
-	    else
267
-	    {
268
-	        if ($usestdout) print "No invoices found for criteria.\n";
269
-	        else dol_syslog("No invoices found for criteria");
270
-	        $result = 0;
271
-	    }
272
-	}
273
-	else
274
-	{
275
-	    dol_print_error($db);
276
-	    dol_syslog("scripts/invoices/rebuild_merge.php: Error");
277
-	    $error++;
278
-	}
264
+            $result = 1;
265
+        }
266
+        else
267
+        {
268
+            if ($usestdout) print "No invoices found for criteria.\n";
269
+            else dol_syslog("No invoices found for criteria");
270
+            $result = 0;
271
+        }
272
+    }
273
+    else
274
+    {
275
+        dol_print_error($db);
276
+        dol_syslog("scripts/invoices/rebuild_merge.php: Error");
277
+        $error++;
278
+    }
279 279
 
280
-	if ($error) return -1;
281
-	else return $result;
280
+    if ($error) return -1;
281
+    else return $result;
282 282
 }
283 283
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/prelevement.lib.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -33,31 +33,31 @@  discard block
 block discarded – undo
33 33
  */
34 34
 function prelevement_prepare_head(BonPrelevement $object)
35 35
 {
36
-	global $langs, $conf, $user;
37
-	$langs->load("withdrawals");
36
+    global $langs, $conf, $user;
37
+    $langs->load("withdrawals");
38 38
 
39
-	$h = 0;
40
-	$head = array();
39
+    $h = 0;
40
+    $head = array();
41 41
 
42
-	$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$object->id;
43
-	$head[$h][1] = $langs->trans("Card");
44
-	$head[$h][2] = 'prelevement';
45
-	$h++;
42
+    $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$object->id;
43
+    $head[$h][1] = $langs->trans("Card");
44
+    $head[$h][2] = 'prelevement';
45
+    $h++;
46 46
 
47
-	$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$object->id;
48
-	$head[$h][1] = $langs->trans("Bills");
49
-	$head[$h][2] = 'invoices';
50
-	$h++;
47
+    $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$object->id;
48
+    $head[$h][1] = $langs->trans("Bills");
49
+    $head[$h][2] = 'invoices';
50
+    $h++;
51 51
 
52
-	$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$object->id;
53
-	$head[$h][1] = $langs->trans("Rejects");
54
-	$head[$h][2] = 'rejects';
55
-	$h++;
52
+    $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$object->id;
53
+    $head[$h][1] = $langs->trans("Rejects");
54
+    $head[$h][2] = 'rejects';
55
+    $h++;
56 56
 
57
-	$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$object->id;
58
-	$head[$h][1] = $langs->trans("Statistics");
59
-	$head[$h][2] = 'statistics';
60
-	$h++;
57
+    $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$object->id;
58
+    $head[$h][1] = $langs->trans("Statistics");
59
+    $head[$h][2] = 'statistics';
60
+    $h++;
61 61
 
62 62
     // Show more tabs from modules
63 63
     // Entries must be declared in modules descriptor with line
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
  */
78 78
 function prelevement_check_config()
79 79
 {
80
-	global $conf;
81
-	if(empty($conf->global->PRELEVEMENT_ID_BANKACCOUNT)) return -1;
82
-	if(empty($conf->global->PRELEVEMENT_ICS)) return -1;
80
+    global $conf;
81
+    if(empty($conf->global->PRELEVEMENT_ID_BANKACCOUNT)) return -1;
82
+    if(empty($conf->global->PRELEVEMENT_ICS)) return -1;
83 83
     if(empty($conf->global->PRELEVEMENT_USER)) return -1;
84
-	return 0;
84
+    return 0;
85 85
 }
86 86
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/barcode.lib.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
     return array(
227 227
         "error" => '',
228 228
         "encoding" => $encoding,
229
-		"bars" => $line,
230
-		"text" => $text
229
+        "bars" => $line,
230
+        "text" => $text
231 231
     );
232 232
 }
233 233
 
@@ -271,16 +271,16 @@  discard block
 block discarded – undo
271 271
     }
272 272
     //var_dump($bars);
273 273
     $ret=array(
274
-		"bars" => trim($bars),
275
-		"text" => trim($text),
276
-		"encoding" => trim($encoding),
277
-    	"error" => ""
274
+        "bars" => trim($bars),
275
+        "text" => trim($text),
276
+        "encoding" => trim($encoding),
277
+        "error" => ""
278 278
     );
279 279
     //var_dump($ret);
280 280
     if (preg_match('/permission denied/i',$ret['bars']))
281 281
     {
282
-    	$ret['error']=$ret['bars']; $ret['bars']='';
283
-    	return $ret;
282
+        $ret['error']=$ret['bars']; $ret['bars']='';
283
+        return $ret;
284 284
     }
285 285
     if (!$ret['bars']) return false;
286 286
     if (!$ret['text']) return false;
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/accounting.lib.php 1 patch
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -31,25 +31,25 @@  discard block
 block discarded – undo
31 31
  */
32 32
 function accounting_prepare_head(AccountingAccount $object)
33 33
 {
34
-	global $langs, $conf;
34
+    global $langs, $conf;
35 35
 
36
-	$h = 0;
37
-	$head = array ();
36
+    $h = 0;
37
+    $head = array ();
38 38
 
39
-	$head[$h][0] = DOL_URL_ROOT.'/accountancy/admin/card.php?id=' . $object->id;
40
-	$head[$h][1] = $langs->trans("Card");
41
-	$head[$h][2] = 'card';
42
-	$h ++;
39
+    $head[$h][0] = DOL_URL_ROOT.'/accountancy/admin/card.php?id=' . $object->id;
40
+    $head[$h][1] = $langs->trans("Card");
41
+    $head[$h][2] = 'card';
42
+    $h ++;
43 43
 
44
-	// Show more tabs from modules
45
-	// Entries must be declared in modules descriptor with line
46
-	// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
47
-	// $this->tabs = array('entity:-tabname); to remove a tab
48
-	complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_account');
44
+    // Show more tabs from modules
45
+    // Entries must be declared in modules descriptor with line
46
+    // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
47
+    // $this->tabs = array('entity:-tabname); to remove a tab
48
+    complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_account');
49 49
 
50
-	complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_account', 'remove');
50
+    complete_head_from_modules($conf, $langs, $object, $head, $h, 'accounting_account', 'remove');
51 51
 
52
-	return $head;
52
+    return $head;
53 53
 }
54 54
 
55 55
 /**
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
  */
61 61
 function clean_account($account)
62 62
 {
63
-	$account = rtrim($account,"0");
63
+    $account = rtrim($account,"0");
64 64
 
65
-	return $account;
65
+    return $account;
66 66
 }
67 67
 
68 68
 /**
@@ -73,31 +73,31 @@  discard block
 block discarded – undo
73 73
  */
74 74
 function length_accountg($account)
75 75
 {
76
-	global $conf;
76
+    global $conf;
77 77
 
78
-	if ($account < 0 || empty($account)) return '';
78
+    if ($account < 0 || empty($account)) return '';
79 79
 
80
-	if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $account;
80
+    if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $account;
81 81
 
82
-	$g = $conf->global->ACCOUNTING_LENGTH_GACCOUNT;
83
-	if (! empty($g)) {
84
-		// Clean parameters
85
-		$i = strlen($account);
82
+    $g = $conf->global->ACCOUNTING_LENGTH_GACCOUNT;
83
+    if (! empty($g)) {
84
+        // Clean parameters
85
+        $i = strlen($account);
86 86
 
87
-		if ($i >= 1) {
88
-			while ( $i < $g ) {
89
-				$account .= '0';
87
+        if ($i >= 1) {
88
+            while ( $i < $g ) {
89
+                $account .= '0';
90 90
 
91
-				$i ++;
92
-			}
91
+                $i ++;
92
+            }
93 93
 
94
-			return $account;
95
-		} else {
96
-			return $account;
97
-		}
98
-	} else {
99
-		return $account;
100
-	}
94
+            return $account;
95
+        } else {
96
+            return $account;
97
+        }
98
+    } else {
99
+        return $account;
100
+    }
101 101
 }
102 102
 
103 103
 /**
@@ -108,31 +108,31 @@  discard block
 block discarded – undo
108 108
  */
109 109
 function length_accounta($accounta)
110 110
 {
111
-	global $conf, $langs;
111
+    global $conf, $langs;
112 112
 
113
-	if ($accounta < 0 || empty($accounta)) return '';
113
+    if ($accounta < 0 || empty($accounta)) return '';
114 114
 
115
-	if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $accounta;
115
+    if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $accounta;
116 116
 
117
-	$a = $conf->global->ACCOUNTING_LENGTH_AACCOUNT;
118
-	if (! empty($a)) {
119
-		// Clean parameters
120
-		$i = strlen($accounta);
117
+    $a = $conf->global->ACCOUNTING_LENGTH_AACCOUNT;
118
+    if (! empty($a)) {
119
+        // Clean parameters
120
+        $i = strlen($accounta);
121 121
 
122
-		if ($i >= 1) {
123
-			while ( $i < $a ) {
124
-				$accounta .= '0';
122
+        if ($i >= 1) {
123
+            while ( $i < $a ) {
124
+                $accounta .= '0';
125 125
 
126
-				$i ++;
127
-			}
126
+                $i ++;
127
+            }
128 128
 
129
-			return $accounta;
130
-		} else {
131
-			return $accounta;
132
-		}
133
-	} else {
134
-		return $accounta;
135
-	}
129
+            return $accounta;
130
+        } else {
131
+            return $accounta;
132
+        }
133
+    } else {
134
+        return $accounta;
135
+    }
136 136
 }
137 137
 
138 138
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/resource.lib.php 1 patch
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -31,70 +31,70 @@  discard block
 block discarded – undo
31 31
  */
32 32
 function resource_prepare_head($object)
33 33
 {
34
-	global $langs, $conf, $user;
35
-	$h = 0;
36
-	$head = array();
37
-
38
-	$head[$h][0] = dol_buildpath('/resource/card.php',1).'?id='.$object->id;
39
-	$head[$h][1] = $langs->trans("ResourceCard");
40
-    	$head[$h][2] = 'resource';
41
-	$h++;
42
-
43
-	if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && (empty($conf->global->RESOURCE_HIDE_ADD_CONTACT_USER) || empty($conf->global->RESOURCE_HIDE_ADD_CONTACT_THIPARTY)))
44
-	{
45
-	    $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
46
-	    $head[$h][0] = DOL_URL_ROOT.'/resource/contact.php?id='.$object->id;
47
-		$head[$h][1] = $langs->trans('ContactsAddresses');
48
-		if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
49
-		$head[$h][2] = 'contact';
50
-		$h++;
51
-	}
52
-
53
-	// Show more tabs from modules
54
-	// Entries must be declared in modules descriptor with line
55
-	// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
56
-	// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to remove a tab
57
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'resource');
58
-
59
-	if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
60
-	{
61
-		$nbNote = 0;
62
-		if(!empty($object->note_private)) $nbNote++;
63
-		if(!empty($object->note_public)) $nbNote++;
64
-		$head[$h][0] = DOL_URL_ROOT.'/resource/note.php?id='.$object->id;
65
-		$head[$h][1] = $langs->trans('Notes');
66
-		if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
67
-		$head[$h][2] = 'note';
68
-		$h++;
69
-	}
70
-
71
-	require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
72
-	$upload_dir = $conf->resource->dir_output . "/" . dol_sanitizeFileName($object->ref);
73
-	$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
74
-	$head[$h][0] = DOL_URL_ROOT.'/resource/document.php?id='.$object->id;
75
-	$head[$h][1] = $langs->trans("Documents");
76
-	if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
77
-	$head[$h][2] = 'documents';
78
-	$h++;
79
-
80
-	$head[$h][0] = DOL_URL_ROOT.'/resource/agenda.php?id='.$object->id;
81
-	$head[$h][1] = $langs->trans("Events");
82
-	if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
83
-	{
84
-		$head[$h][1].= '/';
85
-		$head[$h][1].= $langs->trans("Agenda");
86
-	}
87
-	$head[$h][2] = 'agenda';
88
-	$h++;
89
-
90
-	/*$head[$h][0] = DOL_URL_ROOT.'/resource/info.php?id='.$object->id;
34
+    global $langs, $conf, $user;
35
+    $h = 0;
36
+    $head = array();
37
+
38
+    $head[$h][0] = dol_buildpath('/resource/card.php',1).'?id='.$object->id;
39
+    $head[$h][1] = $langs->trans("ResourceCard");
40
+        $head[$h][2] = 'resource';
41
+    $h++;
42
+
43
+    if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && (empty($conf->global->RESOURCE_HIDE_ADD_CONTACT_USER) || empty($conf->global->RESOURCE_HIDE_ADD_CONTACT_THIPARTY)))
44
+    {
45
+        $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
46
+        $head[$h][0] = DOL_URL_ROOT.'/resource/contact.php?id='.$object->id;
47
+        $head[$h][1] = $langs->trans('ContactsAddresses');
48
+        if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
49
+        $head[$h][2] = 'contact';
50
+        $h++;
51
+    }
52
+
53
+    // Show more tabs from modules
54
+    // Entries must be declared in modules descriptor with line
55
+    // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
56
+    // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to remove a tab
57
+    complete_head_from_modules($conf,$langs,$object,$head,$h,'resource');
58
+
59
+    if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
60
+    {
61
+        $nbNote = 0;
62
+        if(!empty($object->note_private)) $nbNote++;
63
+        if(!empty($object->note_public)) $nbNote++;
64
+        $head[$h][0] = DOL_URL_ROOT.'/resource/note.php?id='.$object->id;
65
+        $head[$h][1] = $langs->trans('Notes');
66
+        if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
67
+        $head[$h][2] = 'note';
68
+        $h++;
69
+    }
70
+
71
+    require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
72
+    $upload_dir = $conf->resource->dir_output . "/" . dol_sanitizeFileName($object->ref);
73
+    $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
74
+    $head[$h][0] = DOL_URL_ROOT.'/resource/document.php?id='.$object->id;
75
+    $head[$h][1] = $langs->trans("Documents");
76
+    if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
77
+    $head[$h][2] = 'documents';
78
+    $h++;
79
+
80
+    $head[$h][0] = DOL_URL_ROOT.'/resource/agenda.php?id='.$object->id;
81
+    $head[$h][1] = $langs->trans("Events");
82
+    if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
83
+    {
84
+        $head[$h][1].= '/';
85
+        $head[$h][1].= $langs->trans("Agenda");
86
+    }
87
+    $head[$h][2] = 'agenda';
88
+    $h++;
89
+
90
+    /*$head[$h][0] = DOL_URL_ROOT.'/resource/info.php?id='.$object->id;
91 91
 	$head[$h][1] = $langs->trans('Info');
92 92
 	$head[$h][2] = 'info';
93 93
 	$h++;*/
94 94
 
95
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'resource', 'remove');
95
+    complete_head_from_modules($conf,$langs,$object,$head,$h,'resource', 'remove');
96 96
 
97
-	return $head;
97
+    return $head;
98 98
 }
99 99
 
100 100
 /**
@@ -105,28 +105,28 @@  discard block
 block discarded – undo
105 105
 function resource_admin_prepare_head()
106 106
 {
107 107
 
108
-	global $langs, $conf, $user;
108
+    global $langs, $conf, $user;
109 109
 
110
-	$h = 0;
111
-	$head = array();
110
+    $h = 0;
111
+    $head = array();
112 112
 
113
-	$head[$h][0] = DOL_URL_ROOT.'/admin/resource.php';
114
-	$head[$h][1] = $langs->trans("ResourceSetup");
115
-	$head[$h][2] = 'general';
116
-	$h++;
113
+    $head[$h][0] = DOL_URL_ROOT.'/admin/resource.php';
114
+    $head[$h][1] = $langs->trans("ResourceSetup");
115
+    $head[$h][2] = 'general';
116
+    $h++;
117 117
 
118
-	// Show more tabs from modules
119
-	// Entries must be declared in modules descriptor with line
120
-	// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
121
-	// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to remove a tab
122
-	complete_head_from_modules($conf,$langs,null,$head,$h,'resource_admin');
118
+    // Show more tabs from modules
119
+    // Entries must be declared in modules descriptor with line
120
+    // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
121
+    // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to remove a tab
122
+    complete_head_from_modules($conf,$langs,null,$head,$h,'resource_admin');
123 123
 
124
-	$head[$h][0] = DOL_URL_ROOT.'/admin/resource_extrafields.php';
125
-	$head[$h][1] = $langs->trans("ExtraFields");
126
-	$head[$h][2] = 'attributes';
127
-	$h++;
124
+    $head[$h][0] = DOL_URL_ROOT.'/admin/resource_extrafields.php';
125
+    $head[$h][1] = $langs->trans("ExtraFields");
126
+    $head[$h][2] = 'attributes';
127
+    $h++;
128 128
 
129
-	complete_head_from_modules($conf,$langs,null,$head,$h,'resource_admin','remove');
129
+    complete_head_from_modules($conf,$langs,null,$head,$h,'resource_admin','remove');
130 130
 
131
-	return $head;
131
+    return $head;
132 132
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/ws.lib.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -65,32 +65,32 @@
 block discarded – undo
65 65
             $errorcode='BAD_CREDENTIALS'; $errorlabel='Bad value for login or password';
66 66
         }
67 67
 
68
-		if (! $error && $fuser->statut == 0)
69
-		{
70
-			$error++;
71
-			$errorcode='ERROR_USER_DISABLED'; $errorlabel='This user has been locked or disabled';
72
-		}
68
+        if (! $error && $fuser->statut == 0)
69
+        {
70
+            $error++;
71
+            $errorcode='ERROR_USER_DISABLED'; $errorlabel='This user has been locked or disabled';
72
+        }
73 73
 
74
-    	// Validation of login
75
-		if (! $error)
76
-		{
77
-			$fuser->getrights();	// Load permission of user
74
+        // Validation of login
75
+        if (! $error)
76
+        {
77
+            $fuser->getrights();	// Load permission of user
78 78
 
79
-        	// Authentication mode
80
-        	if (empty($dolibarr_main_authentication)) $dolibarr_main_authentication='http,dolibarr';
81
-        	// Authentication mode: forceuser
82
-        	if ($dolibarr_main_authentication == 'forceuser' && empty($dolibarr_auto_user)) $dolibarr_auto_user='auto';
83
-        	// Set authmode
84
-        	$authmode=explode(',',$dolibarr_main_authentication);
79
+            // Authentication mode
80
+            if (empty($dolibarr_main_authentication)) $dolibarr_main_authentication='http,dolibarr';
81
+            // Authentication mode: forceuser
82
+            if ($dolibarr_main_authentication == 'forceuser' && empty($dolibarr_auto_user)) $dolibarr_auto_user='auto';
83
+            // Set authmode
84
+            $authmode=explode(',',$dolibarr_main_authentication);
85 85
 
86 86
             include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
87
-        	$login = checkLoginPassEntity($authentication['login'],$authentication['password'],$authentication['entity'],$authmode);
88
-			if (empty($login))
89
-			{
90
-			    $error++;
87
+            $login = checkLoginPassEntity($authentication['login'],$authentication['password'],$authentication['entity'],$authmode);
88
+            if (empty($login))
89
+            {
90
+                $error++;
91 91
                 $errorcode='BAD_CREDENTIALS'; $errorlabel='Bad value for login or password';
92
-			}
93
-		}
92
+            }
93
+        }
94 94
     }
95 95
 
96 96
     return $fuser;
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/fichinter.lib.php 1 patch
Indentation   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -35,26 +35,26 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function fichinter_prepare_head($object)
37 37
 {
38
-	global $db, $langs, $conf, $user;
39
-	$langs->load("fichinter");
40
-
41
-	$h = 0;
42
-	$head = array();
43
-
44
-	$head[$h][0] = DOL_URL_ROOT.'/fichinter/card.php?id='.$object->id;
45
-	$head[$h][1] = $langs->trans("Card");
46
-	$head[$h][2] = 'card';
47
-	$h++;
48
-
49
-	if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
50
-	{
51
-	    $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
52
-	    $head[$h][0] = DOL_URL_ROOT.'/fichinter/contact.php?id='.$object->id;
53
-		$head[$h][1] = $langs->trans('InterventionContact');
54
-		if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
55
-		$head[$h][2] = 'contact';
56
-		$h++;
57
-	}
38
+    global $db, $langs, $conf, $user;
39
+    $langs->load("fichinter");
40
+
41
+    $h = 0;
42
+    $head = array();
43
+
44
+    $head[$h][0] = DOL_URL_ROOT.'/fichinter/card.php?id='.$object->id;
45
+    $head[$h][1] = $langs->trans("Card");
46
+    $head[$h][2] = 'card';
47
+    $h++;
48
+
49
+    if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
50
+    {
51
+        $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
52
+        $head[$h][0] = DOL_URL_ROOT.'/fichinter/contact.php?id='.$object->id;
53
+        $head[$h][1] = $langs->trans('InterventionContact');
54
+        if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
55
+        $head[$h][2] = 'contact';
56
+        $h++;
57
+    }
58 58
 
59 59
     // Show more tabs from modules
60 60
     // Entries must be declared in modules descriptor with line
@@ -62,58 +62,58 @@  discard block
 block discarded – undo
62 62
     // $this->tabs = array('entity:-tabname);   												to remove a tab
63 63
     complete_head_from_modules($conf,$langs,$object,$head,$h,'intervention');
64 64
 
65
-	// Tab to link resources
66
-	if ($conf->resource->enabled)
67
-	{
68
-		require_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php';
69
- 		$nbResource = 0;
70
-		$objectres=new Dolresource($db);
71
-		if (is_array($objectres->available_resources))
72
-		{
73
-	 		foreach ($objectres->available_resources as $modresources => $resources)
74
-			{
75
-				$resources=(array) $resources;  // To be sure $resources is an array
76
-				foreach($resources as $resource_obj)
77
-				{
78
-					$linked_resources = $object->getElementResources('fichinter',$object->id,$resource_obj);
79
-				}
80
-			}
81
-		}
82
-
83
-   		$head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=fichinter&element_id='.$object->id;
84
-		$head[$h][1] = $langs->trans("Resources");
85
-		if ($nbResource > 0) $head[$h][1].= ' <span class="badge">'.$nbResource.'</span>';
86
-		$head[$h][2] = 'resource';
87
-		$h++;
88
-	}
65
+    // Tab to link resources
66
+    if ($conf->resource->enabled)
67
+    {
68
+        require_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php';
69
+            $nbResource = 0;
70
+        $objectres=new Dolresource($db);
71
+        if (is_array($objectres->available_resources))
72
+        {
73
+                foreach ($objectres->available_resources as $modresources => $resources)
74
+            {
75
+                $resources=(array) $resources;  // To be sure $resources is an array
76
+                foreach($resources as $resource_obj)
77
+                {
78
+                    $linked_resources = $object->getElementResources('fichinter',$object->id,$resource_obj);
79
+                }
80
+            }
81
+        }
82
+
83
+            $head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=fichinter&element_id='.$object->id;
84
+        $head[$h][1] = $langs->trans("Resources");
85
+        if ($nbResource > 0) $head[$h][1].= ' <span class="badge">'.$nbResource.'</span>';
86
+        $head[$h][2] = 'resource';
87
+        $h++;
88
+    }
89 89
 
90 90
     if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
91 91
     {
92
-    	$nbNote = 0;
92
+        $nbNote = 0;
93 93
         if(!empty($object->note_private)) $nbNote++;
94
-		if(!empty($object->note_public)) $nbNote++;
95
-    	$head[$h][0] = DOL_URL_ROOT.'/fichinter/note.php?id='.$object->id;
96
-    	$head[$h][1] = $langs->trans('Notes');
97
-		if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
98
-    	$head[$h][2] = 'note';
99
-    	$h++;
94
+        if(!empty($object->note_public)) $nbNote++;
95
+        $head[$h][0] = DOL_URL_ROOT.'/fichinter/note.php?id='.$object->id;
96
+        $head[$h][1] = $langs->trans('Notes');
97
+        if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
98
+        $head[$h][2] = 'note';
99
+        $h++;
100 100
     }
101 101
 
102
-	require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
102
+    require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
103 103
     require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
104
-	$upload_dir = $conf->ficheinter->dir_output . "/" . dol_sanitizeFileName($object->ref);
105
-	$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
104
+    $upload_dir = $conf->ficheinter->dir_output . "/" . dol_sanitizeFileName($object->ref);
105
+    $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
106 106
     $nbLinks=Link::count($db, $object->element, $object->id);
107
-	$head[$h][0] = DOL_URL_ROOT.'/fichinter/document.php?id='.$object->id;
108
-	$head[$h][1] = $langs->trans("Documents");
109
-	if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
110
-	$head[$h][2] = 'documents';
111
-	$h++;
107
+    $head[$h][0] = DOL_URL_ROOT.'/fichinter/document.php?id='.$object->id;
108
+    $head[$h][1] = $langs->trans("Documents");
109
+    if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
110
+    $head[$h][2] = 'documents';
111
+    $h++;
112 112
 
113 113
     $head[$h][0] = DOL_URL_ROOT.'/fichinter/info.php?id='.$object->id;
114
-	$head[$h][1] = $langs->trans('Info');
115
-	$head[$h][2] = 'info';
116
-	$h++;
114
+    $head[$h][1] = $langs->trans('Info');
115
+    $head[$h][2] = 'info';
116
+    $h++;
117 117
 
118 118
     complete_head_from_modules($conf,$langs,$object,$head,$h,'intervention','remove');
119 119
 
@@ -127,39 +127,39 @@  discard block
 block discarded – undo
127 127
  */
128 128
 function fichinter_admin_prepare_head()
129 129
 {
130
-	global $langs, $conf, $user;
130
+    global $langs, $conf, $user;
131 131
 
132
-	$h = 0;
133
-	$head = array();
132
+    $h = 0;
133
+    $head = array();
134 134
 
135
-	$h = 0;
135
+    $h = 0;
136 136
 
137
-	$head[$h][0] = DOL_URL_ROOT."/admin/fichinter.php";
138
-	$head[$h][1] = $langs->trans("Interventions");
139
-	$head[$h][2] = 'ficheinter';
140
-	$h++;
137
+    $head[$h][0] = DOL_URL_ROOT."/admin/fichinter.php";
138
+    $head[$h][1] = $langs->trans("Interventions");
139
+    $head[$h][2] = 'ficheinter';
140
+    $h++;
141 141
 
142
-	// Show more tabs from modules
143
-	// Entries must be declared in modules descriptor with line
144
-	// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
145
-	// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to remove a tab
146
-	complete_head_from_modules($conf,$langs,null,$head,$h,'fichinter_admin');
142
+    // Show more tabs from modules
143
+    // Entries must be declared in modules descriptor with line
144
+    // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to add new tab
145
+    // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__');   to remove a tab
146
+    complete_head_from_modules($conf,$langs,null,$head,$h,'fichinter_admin');
147 147
 
148
-	$head[$h][0] = DOL_URL_ROOT.'/fichinter/admin/fichinter_extrafields.php';
149
-	$head[$h][1] = $langs->trans("ExtraFields");
148
+    $head[$h][0] = DOL_URL_ROOT.'/fichinter/admin/fichinter_extrafields.php';
149
+    $head[$h][1] = $langs->trans("ExtraFields");
150 150
     $head[$h][2] = 'attributes';
151 151
     $h++;
152 152
 
153
-	$head[$h][0] = DOL_URL_ROOT.'/fichinter/admin/fichinterdet_extrafields.php';
154
-	$head[$h][1] = $langs->trans("ExtraFieldsLines");
153
+    $head[$h][0] = DOL_URL_ROOT.'/fichinter/admin/fichinterdet_extrafields.php';
154
+    $head[$h][1] = $langs->trans("ExtraFieldsLines");
155 155
     $head[$h][2] = 'attributesdet';
156 156
     $h++;
157 157
 
158 158
 
159 159
 
160
-	complete_head_from_modules($conf,$langs,null,$head,$h,'fichinter_admin','remove');
160
+    complete_head_from_modules($conf,$langs,null,$head,$h,'fichinter_admin','remove');
161 161
 
162
-		return $head;
162
+        return $head;
163 163
 }
164 164
 
165 165
 /**
@@ -170,20 +170,20 @@  discard block
 block discarded – undo
170 170
  */
171 171
 function fichinter_rec_prepare_head($object)
172 172
 {
173
-	global $langs, $conf; //, $user;
173
+    global $langs, $conf; //, $user;
174 174
 
175
-	$h = 0;
176
-	$head = array();
175
+    $h = 0;
176
+    $head = array();
177 177
 
178
-	$head[$h][0] = DOL_URL_ROOT.'/fichinter/card-rec.php?id='.$object->id;
179
-	$head[$h][1] = $langs->trans("CardFichinter");
180
-	$head[$h][2] = 'card';
181
-	$h++;
178
+    $head[$h][0] = DOL_URL_ROOT.'/fichinter/card-rec.php?id='.$object->id;
179
+    $head[$h][1] = $langs->trans("CardFichinter");
180
+    $head[$h][2] = 'card';
181
+    $h++;
182 182
 
183
-	complete_head_from_modules($conf, $langs, $object, $head, $h, 'intervention-rec');
183
+    complete_head_from_modules($conf, $langs, $object, $head, $h, 'intervention-rec');
184 184
 
185
-	complete_head_from_modules($conf, $langs, $object, $head, $h,'intervention-rec','remove');
185
+    complete_head_from_modules($conf, $langs, $object, $head, $h,'intervention-rec','remove');
186 186
 
187 187
 
188
-	return $head;
188
+    return $head;
189 189
 }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/emailing.lib.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -29,42 +29,42 @@
 block discarded – undo
29 29
  */
30 30
 function emailing_prepare_head(Mailing $object)
31 31
 {
32
-	global $user, $langs, $conf;
32
+    global $user, $langs, $conf;
33 33
 
34
-	$h = 0;
35
-	$head = array();
34
+    $h = 0;
35
+    $head = array();
36 36
 
37
-	$head[$h][0] = DOL_URL_ROOT."/comm/mailing/card.php?id=".$object->id;
38
-	$head[$h][1] = $langs->trans("MailCard");
39
-	$head[$h][2] = 'card';
40
-	$h++;
37
+    $head[$h][0] = DOL_URL_ROOT."/comm/mailing/card.php?id=".$object->id;
38
+    $head[$h][1] = $langs->trans("MailCard");
39
+    $head[$h][2] = 'card';
40
+    $h++;
41 41
 
42
-	if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->mailing->mailing_advance->recipient))
43
-	{
44
-    	$head[$h][0] = DOL_URL_ROOT."/comm/mailing/cibles.php?id=".$object->id;
45
-    	$head[$h][1] = $langs->trans("MailRecipients");
46
-		if ($object->nbemail > 0) $head[$h][1].= ' <span class="badge">'.$object->nbemail.'</span>';
47
-    	$head[$h][2] = 'targets';
48
-    	$h++;
49
-	}
42
+    if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->mailing->mailing_advance->recipient))
43
+    {
44
+        $head[$h][0] = DOL_URL_ROOT."/comm/mailing/cibles.php?id=".$object->id;
45
+        $head[$h][1] = $langs->trans("MailRecipients");
46
+        if ($object->nbemail > 0) $head[$h][1].= ' <span class="badge">'.$object->nbemail.'</span>';
47
+        $head[$h][2] = 'targets';
48
+        $h++;
49
+    }
50 50
 
51
-	if (! empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR))
52
-	{
53
-		$head[$h][0] = DOL_URL_ROOT."/comm/mailing/advtargetemailing.php?id=".$object->id;
54
-		$head[$h][1] = $langs->trans("MailAdvTargetRecipients");
55
-		$head[$h][2] = 'advtargets';
56
-		$h++;
57
-	}
51
+    if (! empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR))
52
+    {
53
+        $head[$h][0] = DOL_URL_ROOT."/comm/mailing/advtargetemailing.php?id=".$object->id;
54
+        $head[$h][1] = $langs->trans("MailAdvTargetRecipients");
55
+        $head[$h][2] = 'advtargets';
56
+        $h++;
57
+    }
58 58
 
59
-	$head[$h][0] = DOL_URL_ROOT."/comm/mailing/info.php?id=".$object->id;
60
-	$head[$h][1] = $langs->trans("Info");
61
-	$head[$h][2] = 'info';
62
-	$h++;
59
+    $head[$h][0] = DOL_URL_ROOT."/comm/mailing/info.php?id=".$object->id;
60
+    $head[$h][1] = $langs->trans("Info");
61
+    $head[$h][2] = 'info';
62
+    $h++;
63 63
 
64
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'emailing');
64
+    complete_head_from_modules($conf,$langs,$object,$head,$h,'emailing');
65 65
 
66
-	complete_head_from_modules($conf,$langs,$object,$head,$h,'emailing','remove');
66
+    complete_head_from_modules($conf,$langs,$object,$head,$h,'emailing','remove');
67 67
 
68
-	return $head;
68
+    return $head;
69 69
 }
70 70
 
Please login to merge, or discard this patch.