Passed
Push — master ( 17deb1...f50dd8 )
by
unknown
02:53
created
lib/subtotal.lib.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -41,21 +41,21 @@  discard block
 block discarded – undo
41 41
     $head[$h][2] = 'about';
42 42
     $h++;
43 43
 
44
-    complete_head_from_modules($conf, $langs, $object, $head, $h, 'subtotal', $showLabel=false);
44
+    complete_head_from_modules($conf, $langs, $object, $head, $h, 'subtotal', $showLabel = false);
45 45
 
46 46
     return $head;
47 47
 }
48 48
 
49
-function getHtmlSelectTitle(&$object, $showLabel=false)
49
+function getHtmlSelectTitle(&$object, $showLabel = false)
50 50
 {
51 51
 	global $langs;
52 52
 	
53
-	require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
53
+	require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
54 54
 	dol_include_once('/subtotal/class/subtotal.class.php');
55 55
 	$TTitle = TSubtotal::getAllTitleFromDocument($object);
56 56
 	$html = '';
57
-	if ($showLabel) $html.= '<label for="under_title">'.$langs->trans('subtotalLabelForUnderTitle').'</label>';
58
-	$html.= '<select onChange="$(\'select[name=under_title]\').val(this.value);" name="under_title" class="under_title minwidth200"><option value="-1"></option>';
57
+	if ($showLabel) $html .= '<label for="under_title">'.$langs->trans('subtotalLabelForUnderTitle').'</label>';
58
+	$html .= '<select onChange="$(\'select[name=under_title]\').val(this.value);" name="under_title" class="under_title minwidth200"><option value="-1"></option>';
59 59
 	
60 60
 	$nbsp = '&nbsp;';
61 61
 	foreach ($TTitle as &$line)
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
 function getTFreeText()
72 72
 {
73
-	global $db,$conf;
73
+	global $db, $conf;
74 74
 	
75 75
 	$TFreeText = array();
76 76
 	
@@ -88,19 +88,19 @@  discard block
 block discarded – undo
88 88
 	return $TFreeText;
89 89
 }
90 90
 
91
-function getHtmlSelectFreeText($withEmpty=true)
91
+function getHtmlSelectFreeText($withEmpty = true)
92 92
 {
93 93
 	global $langs;
94 94
 	
95 95
 	$TFreeText = getTFreeText();
96 96
 	$html = '<label for="free_text">'.$langs->trans('subtotalLabelForFreeText').'</label>';
97
-	$html.= '<select onChange="getTFreeText($(this));" name="free_text" class="minwidth200">';
98
-	if ($withEmpty) $html.= '<option value=""></option>';
97
+	$html .= '<select onChange="getTFreeText($(this));" name="free_text" class="minwidth200">';
98
+	if ($withEmpty) $html .= '<option value=""></option>';
99 99
 
100 100
 	$TFreeTextContents = array();
101 101
 	foreach ($TFreeText as $id => $tab)
102 102
 	{
103
-		$html.= '<option value="'.$id.'">'.$tab->label.'</option>';
103
+		$html .= '<option value="'.$id.'">'.$tab->label.'</option>';
104 104
 		$TFreeTextContents[$id] = $tab->content;
105 105
 	}
106 106
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 function _updateSubtotalLine(&$object, &$line)
129 129
 {
130 130
 	$label = GETPOST('line-title');
131
-	$description = ($line->qty>90) ? '' : GETPOST('line-description');
131
+	$description = ($line->qty > 90) ? '' : GETPOST('line-description');
132 132
 	$pagebreak = (int) GETPOST('line-pagebreak');
133 133
 
134 134
 	$level = GETPOST('subtotal_level', 'int');
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 
146 146
 function _updateSubtotalBloc($object, $line)
147 147
 {
148
-	global $conf,$langs;
148
+	global $conf, $langs;
149 149
 	
150 150
 	$subtotal_tva_tx = $subtotal_tva_tx_init = GETPOST('subtotal_tva_tx', 'int');
151 151
 	$subtotal_progress = $subtotal_progress_init = GETPOST('subtotal_progress', 'int');
@@ -224,9 +224,9 @@  discard block
 block discarded – undo
224 224
  * @param	$lineid			= title lineid
225 225
  * @param	$subtotal_nc	0 = "Compris" prise en compte des totaux des lignes; 1 = "Non compris" non prise en compte des totaux du bloc; null = update de toutes les lignes 
226 226
  */
227
-function _updateLineNC($element, $elementid, $lineid, $subtotal_nc=null, $notrigger = 0)
227
+function _updateLineNC($element, $elementid, $lineid, $subtotal_nc = null, $notrigger = 0)
228 228
 {
229
-	global $db,$langs,$tmp_object_nc;
229
+	global $db, $langs, $tmp_object_nc;
230 230
 	
231 231
 	$error = 0;
232 232
 	if (empty($element)) $error++;
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 	{
267 267
 		foreach ($object->lines as &$l)
268 268
 		{
269
-			if($l->id == $lineid) {
269
+			if ($l->id == $lineid) {
270 270
 				$line = $l;
271 271
 				break;
272 272
 			}
@@ -276,12 +276,12 @@  discard block
 block discarded – undo
276 276
 		{
277 277
 			$db->begin();
278 278
 			
279
-			if(TSubtotal::isModSubtotalLine($line))
279
+			if (TSubtotal::isModSubtotalLine($line))
280 280
 			{
281
-				if(TSubtotal::isTitle($line)) {
281
+				if (TSubtotal::isTitle($line)) {
282 282
 					// Update le contenu du titre (ainsi que le titre lui même)
283 283
 					$TTitleBlock = TSubtotal::getLinesFromTitleId($object, $lineid, true);
284
-					foreach($TTitleBlock as &$line_block)
284
+					foreach ($TTitleBlock as &$line_block)
285 285
 					{
286 286
 						$res = doUpdate($object, $line_block, $subtotal_nc, $notrigger);
287 287
 					}
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 	
316 316
 	if (TSubtotal::isFreeText($line) || TSubtotal::isSubtotal($line)) return 1;
317 317
 	// Update extrafield et total
318
-	if(! empty($subtotal_nc)) {
318
+	if (!empty($subtotal_nc)) {
319 319
 		$line->total_ht = $line->total_tva = $line->total_ttc = $line->total_localtax1 = $line->total_localtax2 = 
320 320
 			$line->multicurrency_total_ht = $line->multicurrency_total_tva = $line->multicurrency_total_ttc = 0;
321 321
 
@@ -325,16 +325,16 @@  discard block
 block discarded – undo
325 325
 		else $res = $line->update($user, $notrigger);
326 326
 	}
327 327
 	else {
328
-	    if(in_array($object->element, array('invoice_supplier', 'order_supplier', 'supplier_proposal'))) {
329
-	        if(empty($line->label)) $line->label = $line->description; // supplier lines don't have the field label
328
+	    if (in_array($object->element, array('invoice_supplier', 'order_supplier', 'supplier_proposal'))) {
329
+	        if (empty($line->label)) $line->label = $line->description; // supplier lines don't have the field label
330 330
 	        
331 331
 	        require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
332
-	        $extrafields=new ExtraFields($object->db);
333
-	        $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true);
334
-	        $line->fetch_optionals($line->id,$extralabels);
332
+	        $extrafields = new ExtraFields($object->db);
333
+	        $extralabels = $extrafields->fetch_name_optionals_label($object->table_element_line, true);
334
+	        $line->fetch_optionals($line->id, $extralabels);
335 335
 	    }
336 336
 		$line->array_options['options_subtotal_nc'] = 0;
337
-		if($object->element == 'order_supplier') $line->update($user);
337
+		if ($object->element == 'order_supplier') $line->update($user);
338 338
 		$res = TSubtotal::doUpdateLine($object, $line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->product_type, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit, $notrigger);
339 339
 	}
340 340
 	
Please login to merge, or discard this patch.
class/actions_subtotal.class.php 1 patch
Spacing   +392 added lines, -392 removed lines patch added patch discarded remove patch
@@ -16,17 +16,17 @@  discard block
 block discarded – undo
16 16
 		
17 17
 		global $type_element, $where;
18 18
 		
19
-		$contexts = explode(':',$parameters['context']);
19
+		$contexts = explode(':', $parameters['context']);
20 20
 		
21
-		if(in_array('consumptionthirdparty',$contexts) && in_array($type_element, array('propal', 'order', 'invoice', 'supplier_order', 'supplier_invoice', 'supplier_proposal'))) {
21
+		if (in_array('consumptionthirdparty', $contexts) && in_array($type_element, array('propal', 'order', 'invoice', 'supplier_order', 'supplier_invoice', 'supplier_proposal'))) {
22 22
 			$mod_num = TSubtotal::$module_number;
23 23
 			
24 24
 			// Not a title (can't use TSubtotal class methods in sql)
25
-			$where.= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty > 9)';
25
+			$where .= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty > 9)';
26 26
 			// Not a subtotal (can't use TSubtotal class methods in sql)
27
-			$where.= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty < 90)';
27
+			$where .= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty < 90)';
28 28
 			// Not a free line text (can't use TSubtotal class methods in sql)
29
-			$where.= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty != 50)';
29
+			$where .= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty != 50)';
30 30
 			
31 31
 		}
32 32
 		
@@ -105,43 +105,43 @@  discard block
 block discarded – undo
105 105
     
106 106
     function formObjectOptions($parameters, &$object, &$action, $hookmanager) 
107 107
     {
108
-      	global $langs,$db,$user, $conf;
108
+      	global $langs, $db, $user, $conf;
109 109
 		
110 110
 		$langs->load('subtotal@subtotal');
111 111
 		
112
-		$contexts = explode(':',$parameters['context']);
112
+		$contexts = explode(':', $parameters['context']);
113 113
 		
114
-		if(in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('invoicereccard',$contexts)) {
114
+		if (in_array('ordercard', $contexts) || in_array('ordersuppliercard', $contexts) || in_array('propalcard', $contexts) || in_array('supplier_proposalcard', $contexts) || in_array('invoicecard', $contexts) || in_array('invoicesuppliercard', $contexts) || in_array('invoicereccard', $contexts)) {
115 115
 			
116 116
 			$createRight = $user->rights->{$object->element}->creer;
117
-			if($object->element == 'facturerec' )
117
+			if ($object->element == 'facturerec')
118 118
 			{
119 119
 				$object->statut = 0; // hack for facture rec
120 120
 				$createRight = $user->rights->facture->creer;
121
-			} elseif($object->element == 'order_supplier' )
121
+			} elseif ($object->element == 'order_supplier')
122 122
 			{
123 123
 			    $createRight = $user->rights->fournisseur->commande->creer;
124
-			} elseif($object->element == 'invoice_supplier' )
124
+			} elseif ($object->element == 'invoice_supplier')
125 125
 			{
126 126
 			    $createRight = $user->rights->fournisseur->facture->creer;
127 127
 			}
128 128
 			
129
-			if ($object->statut == 0  && $createRight) {
129
+			if ($object->statut == 0 && $createRight) {
130 130
 			
131 131
 
132
-				if($object->element=='facture')$idvar = 'facid';
133
-				else $idvar='id';
132
+				if ($object->element == 'facture')$idvar = 'facid';
133
+				else $idvar = 'id';
134 134
 				
135
-				if(in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')) )
135
+				if (in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')))
136 136
 				{
137 137
 					$level = GETPOST('level', 'int'); //New avec SUBTOTAL_USE_NEW_FORMAT
138 138
 					
139
-					if($action=='add_title_line') {
139
+					if ($action == 'add_title_line') {
140 140
 						$title = GETPOST('title');
141
-						if(empty($title)) $title = $langs->trans('title');
142
-						$qty = $level<1 ? 1 : $level ;
141
+						if (empty($title)) $title = $langs->trans('title');
142
+						$qty = $level < 1 ? 1 : $level;
143 143
 					}
144
-					else if($action=='add_free_text') {
144
+					else if ($action == 'add_free_text') {
145 145
 						$title = GETPOST('title');
146 146
 
147 147
 						if (empty($title)) {
@@ -153,21 +153,21 @@  discard block
 block discarded – undo
153 153
 								}
154 154
 							}
155 155
 						}
156
-						if(empty($title)) $title = $langs->trans('subtotalAddLineDescription');
156
+						if (empty($title)) $title = $langs->trans('subtotalAddLineDescription');
157 157
 						$qty = 50;
158 158
 					}
159
-					else if($action=='add_subtitle_line') {
159
+					else if ($action == 'add_subtitle_line') {
160 160
 						$title = GETPOST('title');
161
-						if(empty($title)) $title = $langs->trans('subtitle');
161
+						if (empty($title)) $title = $langs->trans('subtitle');
162 162
 						$qty = 2;
163 163
 					}
164
-					else if($action=='add_subtotal_line') {
164
+					else if ($action == 'add_subtotal_line') {
165 165
 						$title = $langs->trans('SubSubTotal');
166 166
 						$qty = 98;
167 167
 					}
168 168
 					else {
169 169
 						$title = GETPOST('title') ? GETPOST('title') : $langs->trans('SubTotal');
170
-						$qty = $level ? 100-$level : 99;
170
+						$qty = $level ? 100 - $level : 99;
171 171
 					}
172 172
 					dol_include_once('/subtotal/class/subtotal.class.php');
173 173
 					
@@ -175,15 +175,15 @@  discard block
 block discarded – undo
175 175
 					
176 176
 	    			TSubtotal::addSubTotalLine($object, $title, $qty);
177 177
 				}
178
-				else if($action==='ask_deleteallline') {
179
-						$form=new Form($db);
178
+				else if ($action === 'ask_deleteallline') {
179
+						$form = new Form($db);
180 180
 						
181
-						$lineid = GETPOST('lineid','integer');
181
+						$lineid = GETPOST('lineid', 'integer');
182 182
 						$TIdForGroup = $this->getArrayOfLineForAGroup($object, $lineid);
183 183
 					
184 184
 						$nbLines = count($TIdForGroup);
185 185
 					
186
-						$formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('deleteWithAllLines'), $langs->trans('ConfirmDeleteAllThisLines',$nbLines), 'confirm_delete_all_lines','',0,1);
186
+						$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('deleteWithAllLines'), $langs->trans('ConfirmDeleteAllThisLines', $nbLines), 'confirm_delete_all_lines', '', 0, 1);
187 187
 						print $formconfirm;
188 188
 				}
189 189
 
@@ -193,13 +193,13 @@  discard block
 block discarded – undo
193 193
 				}
194 194
 
195 195
 				
196
-				if($action!='editline') {
196
+				if ($action != 'editline') {
197 197
 					// New format is for 3.8
198 198
 					$this->printNewFormat($object, $conf, $langs, $idvar);
199 199
 				}
200 200
 			}
201 201
 		}
202
-		elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts))
202
+		elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice', $contexts))
203 203
 		{
204 204
 			?>
205 205
 			<script type="text/javascript">
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 				$(document).ready(function() {
225 225
 					$('div.fiche div.tabsAction').append('<br />');
226 226
 					
227
-					$('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_title_line" rel="add_title_line" href="javascript:;" class="butAction"><?php echo  $langs->trans('AddTitle' )?></a></div>');
227
+					$('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_title_line" rel="add_title_line" href="javascript:;" class="butAction"><?php echo  $langs->trans('AddTitle')?></a></div>');
228 228
 					$('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_total_line" rel="add_total_line" href="javascript:;" class="butAction"><?php echo  $langs->trans('AddSubTotal')?></a></div>');
229 229
 					$('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_free_text" rel="add_free_text" href="javascript:;" class="butAction"><?php echo  $langs->trans('AddFreeText')?></a></div>');
230 230
 
@@ -275,9 +275,9 @@  discard block
 block discarded – undo
275 275
 						$('body').append(dialog_html);
276 276
 
277 277
 						<?php 
278
-						$editorTool = empty($conf->global->FCKEDITOR_EDITORNAME)?'ckeditor':$conf->global->FCKEDITOR_EDITORNAME;
279
-						$editorConf = empty($conf->global->FCKEDITOR_ENABLE_DETAILS)?false:$conf->global->FCKEDITOR_ENABLE_DETAILS;
280
-						if($editorConf && in_array($editorTool,array('textarea','ckeditor'))){ 
278
+						$editorTool = empty($conf->global->FCKEDITOR_EDITORNAME) ? 'ckeditor' : $conf->global->FCKEDITOR_EDITORNAME;
279
+						$editorConf = empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ?false:$conf->global->FCKEDITOR_ENABLE_DETAILS;
280
+						if ($editorConf && in_array($editorTool, array('textarea', 'ckeditor'))) { 
281 281
 						?>
282 282
 						if (action == 'addTitle' || action == 'addFreeTxt')
283 283
 						{
@@ -392,62 +392,62 @@  discard block
 block discarded – undo
392 392
 		global $conf, $langs, $bc;
393 393
 			
394 394
 		$action = GETPOST('action');	
395
-		$TContext = explode(':',$parameters['context']);
395
+		$TContext = explode(':', $parameters['context']);
396 396
 		if (
397
-				in_array('invoicecard',$TContext)
398
-		        || in_array('invoicesuppliercard',$TContext)
399
-				|| in_array('propalcard',$TContext)
400
-				|| in_array('ordercard',$TContext)
401
-		        || in_array('ordersuppliercard',$TContext)
402
-				|| in_array('invoicereccard',$TContext)
397
+				in_array('invoicecard', $TContext)
398
+		        || in_array('invoicesuppliercard', $TContext)
399
+				|| in_array('propalcard', $TContext)
400
+				|| in_array('ordercard', $TContext)
401
+		        || in_array('ordersuppliercard', $TContext)
402
+				|| in_array('invoicereccard', $TContext)
403 403
 			)
404 404
 	        {	
405
-	            $hideInnerLines	= isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] ) ?  $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0;
406
-	            $hidedetails	= isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] ) ?  $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0;
407
-				$hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED)?$conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED:0;
408
-				$hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] ) ?  $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] : $hidepricesDefaultConf;
405
+	            $hideInnerLines = isset($_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id]) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0;
406
+	            $hidedetails = isset($_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id]) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0;
407
+				$hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED) ? $conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED : 0;
408
+				$hideprices = isset($_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id]) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] : $hidepricesDefaultConf;
409 409
 				
410
-				$var=false;
411
-		     	$out.= '<tr '.$bc[$var].'>
410
+				$var = false;
411
+		     	$out .= '<tr '.$bc[$var].'>
412 412
 		     			<td colspan="4" align="right">
413 413
 		     				<label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label>
414
-		     				<input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\')  }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' />
414
+		     				<input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\')  }" id="hideInnerLines" name="hideInnerLines" value="1" '.(($hideInnerLines) ? 'checked="checked"' : '').' />
415 415
 		     			</td>
416 416
 		     			</tr>';
417 417
 				
418
-		     	$var=!$var;
419
-		     	$out.= '<tr '.$bc[$var].'>
418
+		     	$var = !$var;
419
+		     	$out .= '<tr '.$bc[$var].'>
420 420
 		     			<td colspan="4" align="right">
421 421
 		     				<label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label>
422
-		     				<input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' />
422
+		     				<input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(($hidedetails) ? 'checked="checked"' : '').' />
423 423
 		     			</td>
424 424
 		     			</tr>';
425 425
 		     	
426
-		     	$var=!$var;
427
-		     	$out.= '<tr '.$bc[$var].'>
426
+		     	$var = !$var;
427
+		     	$out .= '<tr '.$bc[$var].'>
428 428
 		     			<td colspan="4" align="right">
429 429
 		     				<label for="hideprices">'.$langs->trans('SubTotalhidePrice').'</label>
430
-		     				<input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' />
430
+		     				<input type="checkbox" id="hideprices" name="hideprices" value="1" '.(($hideprices) ? 'checked="checked"' : '').' />
431 431
 		     			</td>
432 432
 		     			</tr>';
433 433
 		     	
434 434
 		     	
435 435
 				 
436 436
 				if ( 
437
-					(in_array('propalcard',$TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP))
438
-					|| (in_array('ordercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
439
-				    || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
440
-					|| (in_array('invoicecard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
441
-				    || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
442
-					|| (in_array('invoicereccard',$TContext)  && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP ))
437
+					(in_array('propalcard', $TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP))
438
+					|| (in_array('ordercard', $TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
439
+				    || (in_array('ordersuppliercard', $TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
440
+					|| (in_array('invoicecard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
441
+				    || (in_array('invoicesuppliercard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
442
+					|| (in_array('invoicereccard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
443 443
 				)
444 444
 				{
445
-					$var=!$var;
446
-					$out.= '
445
+					$var = !$var;
446
+					$out .= '
447 447
 						<tr '.$bc[$var].'>
448 448
 							<td colspan="4" align="right">
449 449
 								<label for="subtotal_add_recap">'.$langs->trans('subtotal_add_recap').'</label>
450
-								<input type="checkbox" id="subtotal_add_recap" name="subtotal_add_recap" value="1" '.( GETPOST('subtotal_add_recap') ? 'checked="checked"' : '' ).' />
450
+								<input type="checkbox" id="subtotal_add_recap" name="subtotal_add_recap" value="1" '.(GETPOST('subtotal_add_recap') ? 'checked="checked"' : '').' />
451 451
 							</td>
452 452
 						</tr>';
453 453
 				}
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
     function formEditProductOptions($parameters, &$object, &$action, $hookmanager) 
464 464
     {
465 465
 		
466
-    	if (in_array('invoicecard',explode(':',$parameters['context'])))
466
+    	if (in_array('invoicecard', explode(':', $parameters['context'])))
467 467
         {
468 468
         	
469 469
         }
@@ -474,13 +474,13 @@  discard block
 block discarded – undo
474 474
 	function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) {
475 475
 		global $conf;
476 476
 		
477
-		if($action === 'builddoc') {
477
+		if ($action === 'builddoc') {
478 478
 			
479 479
 			$line = &$parameters['line'];
480 480
 			$object = &$parameters['object'];
481 481
 			$substitutionarray = &$parameters['substitutionarray'];
482 482
 			
483
-			if($line->product_type == 9 && $line->special_code == $this->module_number) {
483
+			if ($line->product_type == 9 && $line->special_code == $this->module_number) {
484 484
 				$substitutionarray['line_modsubtotal'] = 1;	
485 485
 				
486 486
 				$substitutionarray['line_price_ht']
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 					 = $substitutionarray['line_up'] 
492 492
 					 = '';
493 493
 				
494
-				if($line->qty>90) {
494
+				if ($line->qty > 90) {
495 495
 					$substitutionarray['line_modsubtotal_total'] = true;
496 496
 					
497 497
 					list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1);
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 				
506 506
 				
507 507
 			}	
508
-			else{
508
+			else {
509 509
 				$substitutionarray['line_not_modsubtotal'] = true;
510 510
 				$substitutionarray['line_modsubtotal'] = 0;
511 511
 			}
@@ -517,29 +517,29 @@  discard block
 block discarded – undo
517 517
 	function createFrom($parameters, &$object, $action, $hookmanager) {
518 518
 	
519 519
 		if (
520
-				in_array('invoicecard',explode(':',$parameters['context']))
521
-		        || in_array('invoicesuppliercard',explode(':',$parameters['context']))
522
-				|| in_array('propalcard',explode(':',$parameters['context']))
523
-		        || in_array('supplier_proposalcard',explode(':',$parameters['context']))
524
-				|| in_array('ordercard',explode(':',$parameters['context']))
525
-		        || in_array('ordersuppliercard',explode(':',$parameters['context']))
526
-				|| in_array('invoicereccard',explode(':',$parameters['context']))
520
+				in_array('invoicecard', explode(':', $parameters['context']))
521
+		        || in_array('invoicesuppliercard', explode(':', $parameters['context']))
522
+				|| in_array('propalcard', explode(':', $parameters['context']))
523
+		        || in_array('supplier_proposalcard', explode(':', $parameters['context']))
524
+				|| in_array('ordercard', explode(':', $parameters['context']))
525
+		        || in_array('ordersuppliercard', explode(':', $parameters['context']))
526
+				|| in_array('invoicereccard', explode(':', $parameters['context']))
527 527
 		) {
528 528
 			
529 529
 			global $db;
530 530
 			
531 531
 			$objFrom = $parameters['objFrom'];
532 532
 			
533
-			foreach($objFrom->lines as $k=> &$lineOld) {
533
+			foreach ($objFrom->lines as $k=> &$lineOld) {
534 534
 				
535
-					if($lineOld->product_type == 9 && $lineOld->info_bits > 0 ) {
535
+					if ($lineOld->product_type == 9 && $lineOld->info_bits > 0) {
536 536
 							
537 537
 							$line = & $object->lines[$k];
538 538
 				
539 539
 							$idLine = (int) ($line->id ? $line->id : $line->rowid); 
540 540
 				
541 541
 							$db->query("UPDATE ".MAIN_DB_PREFIX.$line->table_element."
542
-							SET info_bits=".(int)$lineOld->info_bits."
542
+							SET info_bits=".(int) $lineOld->info_bits."
543 543
 							WHERE rowid = ".$idLine."
544 544
 							");
545 545
 						
@@ -555,15 +555,15 @@  discard block
 block discarded – undo
555 555
 	
556 556
 	function doActions($parameters, &$object, $action, $hookmanager)
557 557
 	{
558
-		global $db, $conf, $langs,$user;
558
+		global $db, $conf, $langs, $user;
559 559
 		
560 560
 		dol_include_once('/subtotal/class/subtotal.class.php');
561 561
 		dol_include_once('/subtotal/lib/subtotal.lib.php');
562
-		require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
562
+		require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
563 563
 		
564 564
 		$showBlockExtrafields = GETPOST('showBlockExtrafields');
565 565
 		
566
-		if($object->element=='facture') $idvar = 'facid';
566
+		if ($object->element == 'facture') $idvar = 'facid';
567 567
 		else $idvar = 'id';
568 568
 			
569 569
 		if ($action == 'updateligne' || $action == 'updateline')
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 				if ($line->id == $lineid && TSubtotal::isModSubtotalLine($line))
577 577
 				{
578 578
 					$found = true;
579
-					if(TSubtotal::isTitle($line) && !empty($showBlockExtrafields)) {
579
+					if (TSubtotal::isTitle($line) && !empty($showBlockExtrafields)) {
580 580
 						$extrafieldsline = new ExtraFields($db);
581 581
 						$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
582 582
 						$extrafieldsline->setOptionalsFromPost($extralabelsline, $line);
@@ -595,43 +595,43 @@  discard block
 block discarded – undo
595 595
 				exit; // Surtout ne pas laisser Dolibarr faire du traitement sur le updateligne sinon ça plante les données de la ligne
596 596
 			}
597 597
 		}
598
-		else if($action === 'builddoc') {
598
+		else if ($action === 'builddoc') {
599 599
 			
600 600
 			if (
601
-				in_array('invoicecard',explode(':',$parameters['context']))
602
-				|| in_array('propalcard',explode(':',$parameters['context']))
603
-				|| in_array('ordercard',explode(':',$parameters['context']))
604
-			    || in_array('ordersuppliercard',explode(':',$parameters['context']))
605
-			    || in_array('invoicesuppliercard',explode(':',$parameters['context']))
606
-			    || in_array('supplier_proposalcard',explode(':',$parameters['context']))
601
+				in_array('invoicecard', explode(':', $parameters['context']))
602
+				|| in_array('propalcard', explode(':', $parameters['context']))
603
+				|| in_array('ordercard', explode(':', $parameters['context']))
604
+			    || in_array('ordersuppliercard', explode(':', $parameters['context']))
605
+			    || in_array('invoicesuppliercard', explode(':', $parameters['context']))
606
+			    || in_array('supplier_proposalcard', explode(':', $parameters['context']))
607 607
 			)
608 608
 	        {								
609
-				if(in_array('invoicecard',explode(':',$parameters['context']))) {
609
+				if (in_array('invoicecard', explode(':', $parameters['context']))) {
610 610
 					$sessname = 'subtotal_hideInnerLines_facture';	
611 611
 					$sessname2 = 'subtotal_hidedetails_facture';
612 612
 					$sessname3 = 'subtotal_hideprices_facture';
613 613
 				}
614
-				elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) {
614
+				elseif (in_array('invoicesuppliercard', explode(':', $parameters['context']))) {
615 615
 				    $sessname = 'subtotal_hideInnerLines_facture_fournisseur';
616 616
 				    $sessname2 = 'subtotal_hidedetails_facture_fournisseur';
617 617
 				    $sessname3 = 'subtotal_hideprices_facture_fournisseur';
618 618
 				}
619
-				elseif(in_array('propalcard',explode(':',$parameters['context']))) {
619
+				elseif (in_array('propalcard', explode(':', $parameters['context']))) {
620 620
 					$sessname = 'subtotal_hideInnerLines_propal';
621 621
 					$sessname2 = 'subtotal_hidedetails_propal';	
622 622
 					$sessname3 = 'subtotal_hideprices_propal';
623 623
 				}
624
-				elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) {
624
+				elseif (in_array('supplier_proposalcard', explode(':', $parameters['context']))) {
625 625
 				    $sessname = 'subtotal_hideInnerLines_supplier_proposal';
626 626
 				    $sessname2 = 'subtotal_hidedetails_supplier_proposal';
627 627
 				    $sessname3 = 'subtotal_hideprices_supplier_proposal';
628 628
 				}
629
-				elseif(in_array('ordercard',explode(':',$parameters['context']))) {
629
+				elseif (in_array('ordercard', explode(':', $parameters['context']))) {
630 630
 					$sessname = 'subtotal_hideInnerLines_commande';
631 631
 					$sessname2 = 'subtotal_hidedetails_commande';	
632 632
 					$sessname3 = 'subtotal_hideprices_commande';
633 633
 				}
634
-				elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) {
634
+				elseif (in_array('ordersuppliercard', explode(':', $parameters['context']))) {
635 635
 				    $sessname = 'subtotal_hideInnerLines_commande_fournisseur';
636 636
 				    $sessname2 = 'subtotal_hidedetails_commande_fournisseur';
637 637
 				    $sessname3 = 'subtotal_hideprices_commande_fournisseur';
@@ -644,25 +644,25 @@  discard block
 block discarded – undo
644 644
 					
645 645
 				global $hideprices;
646 646
 				
647
-				$hideInnerLines = (int)GETPOST('hideInnerLines');
648
-				if(!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id]) ) $_SESSION[$sessname] = array(); // prevent old system
647
+				$hideInnerLines = (int) GETPOST('hideInnerLines');
648
+				if (!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id])) $_SESSION[$sessname] = array(); // prevent old system
649 649
 				$_SESSION[$sessname][$object->id] = $hideInnerLines;		
650 650
 				
651
-				$hidedetails= (int)GETPOST('hidedetails');
652
-				if(!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id]) ) $_SESSION[$sessname2] = array(); // prevent old system
651
+				$hidedetails = (int) GETPOST('hidedetails');
652
+				if (!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id])) $_SESSION[$sessname2] = array(); // prevent old system
653 653
 				$_SESSION[$sessname2][$object->id] = $hidedetails;
654 654
 				
655
-				$hideprices= (int)GETPOST('hideprices');
656
-				if(!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id]) ) $_SESSION[$sessname3] = array(); // prevent old system
655
+				$hideprices = (int) GETPOST('hideprices');
656
+				if (!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id])) $_SESSION[$sessname3] = array(); // prevent old system
657 657
 				$_SESSION[$sessname3][$object->id] = $hideprices;
658 658
 				
659
-				foreach($object->lines as &$line) {
659
+				foreach ($object->lines as &$line) {
660 660
 					if ($line->product_type == 9 && $line->special_code == $this->module_number) {
661 661
 					    
662
-                        if($line->qty>=90) {
662
+                        if ($line->qty >= 90) {
663 663
                             $line->modsubtotal_total = 1;
664 664
                         }
665
-                        else{
665
+                        else {
666 666
                             $line->modsubtotal_title = 1;
667 667
                         }
668 668
                         
@@ -672,34 +672,34 @@  discard block
 block discarded – undo
672 672
 	        }
673 673
 			
674 674
 		}
675
-		else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') {
675
+		else if ($action === 'confirm_delete_all_lines' && GETPOST('confirm') == 'yes') {
676 676
 			
677 677
 			$Tab = $this->getArrayOfLineForAGroup($object, GETPOST('lineid'));
678 678
 			
679
-			foreach($Tab as $idLine) {
679
+			foreach ($Tab as $idLine) {
680 680
 				/**
681 681
 				 * @var $object Facture
682 682
 				 */
683
-				if($object->element=='facture') $object->deleteline($idLine);
683
+				if ($object->element == 'facture') $object->deleteline($idLine);
684 684
 				/**
685 685
 				 * @var $object Facture fournisseur
686 686
 				 */
687
-				else if($object->element=='invoice_supplier')
687
+				else if ($object->element == 'invoice_supplier')
688 688
 				{
689 689
 				    $object->deleteline($idLine);
690 690
 				}
691 691
 				/**
692 692
 				 * @var $object Propal
693 693
 				 */
694
-				else if($object->element=='propal') $object->deleteline($idLine);
694
+				else if ($object->element == 'propal') $object->deleteline($idLine);
695 695
 				/**
696 696
 				 * @var $object Propal Fournisseur
697 697
 				 */
698
-				else if($object->element=='supplier_proposal') $object->deleteline($idLine);
698
+				else if ($object->element == 'supplier_proposal') $object->deleteline($idLine);
699 699
 				/**
700 700
 				 * @var $object Commande
701 701
 				 */
702
-				else if($object->element=='commande') 
702
+				else if ($object->element == 'commande') 
703 703
 				{
704 704
 					if ((float) DOL_VERSION >= 5.0) $object->deleteline($user, $idLine);
705 705
 					else $object->deleteline($idLine);
@@ -707,14 +707,14 @@  discard block
 block discarded – undo
707 707
 				/**
708 708
 				 * @var $object Commande fournisseur
709 709
 				 */
710
-				else if($object->element=='order_supplier')
710
+				else if ($object->element == 'order_supplier')
711 711
 				{
712 712
 				    $object->deleteline($idLine);
713 713
 				}
714 714
 				/**
715 715
 				 * @var $object Facturerec
716 716
 				 */
717
-				else if($object->element=='facturerec') $object->deleteline($idLine);
717
+				else if ($object->element == 'facturerec') $object->deleteline($idLine);
718 718
 			}
719 719
 			
720 720
 			header('location:?id='.$object->id);
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 		return 0;
738 738
 	}
739 739
 	
740
-	function formAddObjectLine ($parameters, &$object, &$action, $hookmanager) {
740
+	function formAddObjectLine($parameters, &$object, &$action, $hookmanager) {
741 741
 		return 0;
742 742
 	}
743 743
 	
@@ -755,8 +755,8 @@  discard block
 block discarded – undo
755 755
 			if (!empty($parameters['fk_element']))
756 756
 			{
757 757
 				
758
-				if($obj->fetch($parameters['fk_element'])){
759
-					$obj->id= $obj->rowid;
758
+				if ($obj->fetch($parameters['fk_element'])) {
759
+					$obj->id = $obj->rowid;
760 760
 					if (empty($obj->array_options))
761 761
 						$obj->fetch_optionals();
762 762
 					if (!empty($obj->array_options['options_subtotal_nc']))
@@ -776,22 +776,22 @@  discard block
 block discarded – undo
776 776
 		
777 777
 		$found = false;
778 778
 
779
-		$Tab= array();
779
+		$Tab = array();
780 780
 		
781
-		foreach($object->lines as $l) {
781
+		foreach ($object->lines as $l) {
782 782
 		
783 783
 		    $lid = (!empty($l->rowid) ? $l->rowid : $l->id);
784
-			if($lid == $lineid) {
784
+			if ($lid == $lineid) {
785 785
 
786 786
 				$found = true;
787 787
 				$qty_line = $l->qty;
788 788
 			}
789 789
 			
790
-			if($found) {
790
+			if ($found) {
791 791
 				
792 792
 			    $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id);
793 793
 				
794
-				if($l->special_code==$this->module_number && (($l->qty==99 && $qty_line==1) || ($l->qty==98 && $qty_line==2))   ) {
794
+				if ($l->special_code == $this->module_number && (($l->qty == 99 && $qty_line == 1) || ($l->qty == 98 && $qty_line == 2))) {
795 795
 					break; // end of story
796 796
 				}
797 797
 			}
@@ -820,7 +820,7 @@  discard block
 block discarded – undo
820 820
 	 * 
821 821
 	 * @param	$use_level		isn't used anymore
822 822
 	 */
823
-	function getTotalLineFromObject(&$object, &$line, $use_level=false, $return_all=0) {
823
+	function getTotalLineFromObject(&$object, &$line, $use_level = false, $return_all = 0) {
824 824
 		
825 825
 		$rang = $line->rang;
826 826
 		$qty_line = $line->qty;
@@ -831,21 +831,21 @@  discard block
 block discarded – undo
831 831
 		$TTotal_tva = array();
832 832
 		
833 833
 		dol_include_once('/subtotal/class/subtotal.class.php');
834
-		foreach($object->lines as $l) {
834
+		foreach ($object->lines as $l) {
835 835
 			//print $l->rang.'>='.$rang.' '.$total.'<br/>';
836
-			if($l->rang>=$rang) {
836
+			if ($l->rang >= $rang) {
837 837
 				//echo 'return!<br>';
838 838
 				if (!$return_all) return $total;
839 839
 				else return array($total, $total_tva, $total_ttc, $TTotal_tva);
840 840
 			}
841
-			else if(TSubtotal::isTitle($l, 100 - $qty_line)) 
841
+			else if (TSubtotal::isTitle($l, 100 - $qty_line)) 
842 842
 		  	{
843 843
 				$total = 0;
844 844
 				$total_tva = 0;
845 845
 				$total_ttc = 0;
846 846
 				$TTotal_tva = array();
847 847
 			}
848
-			elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) {
848
+			elseif (!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) {
849 849
 				$total += $l->total_ht;
850 850
 				$total_tva += $l->total_tva;
851 851
 				$TTotal_tva[$l->tva_tx] += $l->total_tva;
@@ -864,18 +864,18 @@  discard block
 block discarded – undo
864 864
 		
865 865
 		$rang = $line->rang;
866 866
 		$total = 0;
867
-		foreach($object->lines as $l) {
868
-			if($l->rang>=$rang) {
867
+		foreach ($object->lines as $l) {
868
+			if ($l->rang >= $rang) {
869 869
 				return price($total);
870 870
 			}
871
-                        if (TSubtotal::isSubtotal($l)){
871
+                        if (TSubtotal::isSubtotal($l)) {
872 872
                             $total = 0;
873
-                        } else  if ($l->situation_percent > 0 ){
873
+                        } else  if ($l->situation_percent > 0) {
874 874
                            
875 875
         	
876 876
 		 	$prev_progress = $l->get_prev_progress($object->id);
877
-		 	$progress = ($l->situation_percent - $prev_progress) /100;
878
-                        $total += ($l->total_ht/($l->situation_percent/100)) * $progress;
877
+		 	$progress = ($l->situation_percent - $prev_progress) / 100;
878
+                        $total += ($l->total_ht / ($l->situation_percent / 100)) * $progress;
879 879
                         
880 880
                     }
881 881
                 }
@@ -894,10 +894,10 @@  discard block
 block discarded – undo
894 894
 	 * @param $w            float               width
895 895
 	 * @param $h            float               height
896 896
 	 */
897
-	function pdf_add_total(&$pdf,&$object, &$line, $label, $description,$posx, $posy, $w, $h) {
898
-		global $conf,$subtotal_last_title_posy;
897
+	function pdf_add_total(&$pdf, &$object, &$line, $label, $description, $posx, $posy, $w, $h) {
898
+		global $conf, $subtotal_last_title_posy;
899 899
 		
900
-		$hideInnerLines = (int)GETPOST('hideInnerLines');
900
+		$hideInnerLines = (int) GETPOST('hideInnerLines');
901 901
 		if (!empty($conf->global->SUBTOTAL_ONE_LINE_IF_HIDE_INNERLINES) && $hideInnerLines && !empty($subtotal_last_title_posy))
902 902
 		{
903 903
 			$posy = $subtotal_last_title_posy;
@@ -907,34 +907,34 @@  discard block
 block discarded – undo
907 907
 		$hidePriceOnSubtotalLines = (int) GETPOST('hide_price_on_subtotal_lines');
908 908
 		
909 909
 		$set_pagebreak_margin = false;
910
-		if(method_exists('Closure','bind')) {
910
+		if (method_exists('Closure', 'bind')) {
911 911
 			$pageBreakOriginalValue = $pdf->AcceptPageBreak();
912
-			$sweetsThief = function ($pdf) {
913
-		    		return $pdf->bMargin ;
912
+			$sweetsThief = function($pdf) {
913
+		    		return $pdf->bMargin;
914 914
 			};
915 915
 			$sweetsThief = Closure::bind($sweetsThief, null, $pdf);
916 916
 	
917
-			$bMargin  = $sweetsThief($pdf);
917
+			$bMargin = $sweetsThief($pdf);
918 918
 	
919
-			$pdf->SetAutoPageBreak( false );
919
+			$pdf->SetAutoPageBreak(false);
920 920
 
921 921
 			$set_pagebreak_margin = true;			
922 922
 		}
923 923
 		
924 924
 			
925
-		if($line->qty==99)
926
-			$pdf->SetFillColor(220,220,220);
927
-		elseif ($line->qty==98)
928
-			$pdf->SetFillColor(230,230,230);
925
+		if ($line->qty == 99)
926
+			$pdf->SetFillColor(220, 220, 220);
927
+		elseif ($line->qty == 98)
928
+			$pdf->SetFillColor(230, 230, 230);
929 929
 		else
930
-			$pdf->SetFillColor(240,240,240);
930
+			$pdf->SetFillColor(240, 240, 240);
931 931
 		
932 932
 		$style = 'B';
933 933
 		if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE;
934 934
 		
935 935
 		$pdf->SetFont('', $style, 9);
936 936
 		
937
-		$pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'R',true);
937
+		$pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'R', true);
938 938
 //		var_dump($bMargin);
939 939
 		$pageAfter = $pdf->getPage();
940 940
 		
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
 				}
960 960
 			}
961 961
 			
962
-			if($total_to_print !== '') {
962
+			if ($total_to_print !== '') {
963 963
 				
964 964
 				if (GETPOST('hideInnerLines'))
965 965
 				{
@@ -973,7 +973,7 @@  discard block
 block discarded – undo
973 973
 				else
974 974
 				{
975 975
 					list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1);
976
-                                        if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation
976
+                                        if (get_class($object) == 'Facture' && $object->type == Facture::TYPE_SITUATION) {//Facture de situation
977 977
                                                 $total_to_print = $this->getTotalToPrintSituation($object, $line);
978 978
                                         } else {
979 979
                                             	$total_to_print = price($total);
@@ -987,11 +987,11 @@  discard block
 block discarded – undo
987 987
 			}
988 988
 
989 989
 			$pdf->SetXY($pdf->postotalht, $posy);
990
-			if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin);
991
-			$pdf->MultiCell($pdf->page_largeur-$pdf->marge_droite-$pdf->postotalht, 3, $total_to_print, 0, 'R', 0);
990
+			if ($set_pagebreak_margin) $pdf->SetAutoPageBreak($pageBreakOriginalValue, $bMargin);
991
+			$pdf->MultiCell($pdf->page_largeur - $pdf->marge_droite - $pdf->postotalht, 3, $total_to_print, 0, 'R', 0);
992 992
 		}
993
-		else{
994
-			if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin);
993
+		else {
994
+			if ($set_pagebreak_margin) $pdf->SetAutoPageBreak($pageBreakOriginalValue, $bMargin);
995 995
 		}
996 996
 		
997 997
 		$posy = $posy + $cell_height;
@@ -1011,22 +1011,22 @@  discard block
 block discarded – undo
1011 1011
 	 * @param $w            float               width
1012 1012
 	 * @param $h            float               height
1013 1013
 	 */
1014
-	function pdf_add_title(&$pdf,&$object, &$line, $label, $description,$posx, $posy, $w, $h) {
1014
+	function pdf_add_title(&$pdf, &$object, &$line, $label, $description, $posx, $posy, $w, $h) {
1015 1015
 		
1016
-		global $db,$conf,$subtotal_last_title_posy;
1016
+		global $db, $conf, $subtotal_last_title_posy;
1017 1017
 		
1018 1018
 		$subtotal_last_title_posy = $posy;
1019
-		$pdf->SetXY ($posx, $posy);
1019
+		$pdf->SetXY($posx, $posy);
1020 1020
 		
1021
-		$hideInnerLines = (int)GETPOST('hideInnerLines');
1021
+		$hideInnerLines = (int) GETPOST('hideInnerLines');
1022 1022
 		
1023 1023
 		
1024 1024
  
1025
-		$style = ($line->qty==1) ? 'BU' : 'BUI';
1025
+		$style = ($line->qty == 1) ? 'BU' : 'BUI';
1026 1026
 		if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) $style = $conf->global->SUBTOTAL_TITLE_STYLE;
1027 1027
 		
1028
-		if($hideInnerLines) {
1029
-			if($line->qty==1)$pdf->SetFont('', $style, 9);
1028
+		if ($hideInnerLines) {
1029
+			if ($line->qty == 1)$pdf->SetFont('', $style, 9);
1030 1030
 			else 
1031 1031
 			{
1032 1032
 				if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES;
@@ -1035,43 +1035,43 @@  discard block
 block discarded – undo
1035 1035
 		}
1036 1036
 		else {
1037 1037
 
1038
-			if($line->qty==1)$pdf->SetFont('', $style, 9); //TODO if super utile
1038
+			if ($line->qty == 1)$pdf->SetFont('', $style, 9); //TODO if super utile
1039 1039
 			else $pdf->SetFont('', $style, 9);
1040 1040
 			
1041 1041
 		}
1042 1042
 		
1043 1043
 		if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) $pdf->MultiCell($w, $h, $label, 0, 'L'); // Pas de HTML dans la chaine
1044
-		else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); // et maintenant avec du HTML
1044
+		else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J', true); // et maintenant avec du HTML
1045 1045
 		
1046
-		if($description && !$hidedesc) {
1046
+		if ($description && !$hidedesc) {
1047 1047
 			$posy = $pdf->GetY();
1048 1048
 			
1049 1049
 			$pdf->SetFont('', '', 8);
1050 1050
 			
1051
-			$pdf->writeHTMLCell($w, $h, $posx, $posy, $description, 0, 1, false, true, 'J',true);
1051
+			$pdf->writeHTMLCell($w, $h, $posx, $posy, $description, 0, 1, false, true, 'J', true);
1052 1052
 
1053 1053
 		}
1054 1054
 		
1055 1055
 	}
1056 1056
 
1057
-	function pdf_writelinedesc_ref($parameters=array(), &$object, &$action='') {
1057
+	function pdf_writelinedesc_ref($parameters = array(), &$object, &$action = '') {
1058 1058
 	// ultimate PDF hook O_o
1059 1059
 		
1060
-		return $this->pdf_writelinedesc($parameters,$object,$action);
1060
+		return $this->pdf_writelinedesc($parameters, $object, $action);
1061 1061
 		
1062 1062
 	}
1063 1063
 
1064 1064
 	function isModSubtotalLine(&$parameters, &$object) {
1065 1065
 		
1066
-		if(is_array($parameters)) {
1066
+		if (is_array($parameters)) {
1067 1067
 			$i = & $parameters['i'];	
1068 1068
 		}
1069 1069
 		else {
1070
-			$i = (int)$parameters;
1070
+			$i = (int) $parameters;
1071 1071
 		}
1072 1072
 		
1073 1073
 		
1074
-		if($object->lines[$i]->special_code == $this->module_number && $object->lines[$i]->product_type == 9) {
1074
+		if ($object->lines[$i]->special_code == $this->module_number && $object->lines[$i]->product_type == 9) {
1075 1075
 			return true;
1076 1076
 		}
1077 1077
 		
@@ -1079,43 +1079,43 @@  discard block
 block discarded – undo
1079 1079
 		
1080 1080
 	}
1081 1081
 
1082
-	function pdf_getlineqty($parameters=array(), &$object, &$action='') {
1083
-		global $conf,$hideprices;
1082
+	function pdf_getlineqty($parameters = array(), &$object, &$action = '') {
1083
+		global $conf, $hideprices;
1084 1084
 		
1085
-		if($this->isModSubtotalLine($parameters,$object) ){
1085
+		if ($this->isModSubtotalLine($parameters, $object)) {
1086 1086
 			
1087 1087
 			$this->resprints = ' ';
1088 1088
 			
1089
-			if((float)DOL_VERSION<=3.6) {
1089
+			if ((float) DOL_VERSION <= 3.6) {
1090 1090
 				return '';
1091 1091
 			}
1092
-			else if((float)DOL_VERSION>=3.8) {
1092
+			else if ((float) DOL_VERSION >= 3.8) {
1093 1093
 				return 1;
1094 1094
 			}
1095 1095
 			
1096 1096
 		}
1097
-		elseif(!empty($hideprices)) {
1097
+		elseif (!empty($hideprices)) {
1098 1098
 			$this->resprints = $object->lines[$parameters['i']]->qty;
1099 1099
 			return 1;
1100 1100
 		}
1101 1101
 		elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY))
1102 1102
 		{
1103
-			$hideInnerLines = (int)GETPOST('hideInnerLines');
1104
-			$hidedetails = (int)GETPOST('hidedetails');
1103
+			$hideInnerLines = (int) GETPOST('hideInnerLines');
1104
+			$hidedetails = (int) GETPOST('hidedetails');
1105 1105
 			if (empty($hideInnerLines) && !empty($hidedetails))
1106 1106
 			{
1107 1107
 				$this->resprints = $object->lines[$parameters['i']]->qty;
1108 1108
 			}
1109 1109
 		}
1110 1110
 		
1111
-		if(is_array($parameters)) $i = & $parameters['i'];
1112
-		else $i = (int)$parameters;
1111
+		if (is_array($parameters)) $i = & $parameters['i'];
1112
+		else $i = (int) $parameters;
1113 1113
 
1114 1114
 		if (empty($object->lines[$i])) return 0; // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0)
1115 1115
 		
1116
-		if(empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals();
1116
+		if (empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals();
1117 1117
 
1118
-		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
1118
+		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])))
1119 1119
 		{
1120 1120
 			if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1121 1121
 			{
@@ -1127,20 +1127,20 @@  discard block
 block discarded – undo
1127 1127
 		return 0;
1128 1128
 	}
1129 1129
 	
1130
-	function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') {
1130
+	function pdf_getlinetotalexcltax($parameters = array(), &$object, &$action = '') {
1131 1131
 	    global $conf, $hideprices, $hookmanager;
1132 1132
 		
1133
-		if(is_array($parameters)) $i = & $parameters['i'];
1134
-		else $i = (int)$parameters;
1133
+		if (is_array($parameters)) $i = & $parameters['i'];
1134
+		else $i = (int) $parameters;
1135 1135
 			
1136
-		if($this->isModSubtotalLine($parameters,$object) ){
1136
+		if ($this->isModSubtotalLine($parameters, $object)) {
1137 1137
 			
1138 1138
 			$this->resprints = ' ';
1139 1139
 			
1140
-			if((float)DOL_VERSION<=3.6) {
1140
+			if ((float) DOL_VERSION <= 3.6) {
1141 1141
 				return '';
1142 1142
 			}
1143
-			else if((float)DOL_VERSION>=3.8) {
1143
+			else if ((float) DOL_VERSION >= 3.8) {
1144 1144
 				return 1;
1145 1145
 			}
1146 1146
 			
@@ -1166,7 +1166,7 @@  discard block
 block discarded – undo
1166 1166
 				}
1167 1167
 			}
1168 1168
 		}
1169
-		if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){
1169
+		if ((int) GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) {
1170 1170
 		    $this->resprints = price($object->lines[$i]->total_ht);
1171 1171
 		}
1172 1172
 		
@@ -1191,7 +1191,7 @@  discard block
 block discarded – undo
1191 1191
 		{
1192 1192
 			// Check if a title exist for this line && if the title have subtotal
1193 1193
 			$lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1194
-			if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1194
+			if (TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1195 1195
 			{
1196 1196
 
1197 1197
 				$this->resprints = ' ';
@@ -1211,7 +1211,7 @@  discard block
 block discarded – undo
1211 1211
 	 */
1212 1212
 	private function callHook(&$object, &$hookmanager, $action, $params, $defaultReturn = 1)
1213 1213
 	{
1214
-		$reshook=$hookmanager->executeHooks('subtotalHidePrices',$params, $object, $action);
1214
+		$reshook = $hookmanager->executeHooks('subtotalHidePrices', $params, $object, $action);
1215 1215
 		if ($reshook < 0)
1216 1216
 		{
1217 1217
 			$this->error = $hookmanager->error;
@@ -1227,7 +1227,7 @@  discard block
 block discarded – undo
1227 1227
 			$this->resprints = $hookmanager->resprints;
1228 1228
 
1229 1229
 			// override return (use  $this->results['overrideReturn'] or $this->resArray['overrideReturn'] in other module action_xxxx.class.php )
1230
-			if(isset($hookmanager->resArray['overrideReturn']))
1230
+			if (isset($hookmanager->resArray['overrideReturn']))
1231 1231
 			{
1232 1232
 				return $hookmanager->resArray['overrideReturn'];
1233 1233
 			}
@@ -1236,25 +1236,25 @@  discard block
 block discarded – undo
1236 1236
 		return $defaultReturn;
1237 1237
 	}
1238 1238
 	
1239
-	function pdf_getlinetotalwithtax($parameters=array(), &$object, &$action='') {
1239
+	function pdf_getlinetotalwithtax($parameters = array(), &$object, &$action = '') {
1240 1240
 		global $conf;
1241 1241
 		
1242
-		if($this->isModSubtotalLine($parameters,$object) ){
1242
+		if ($this->isModSubtotalLine($parameters, $object)) {
1243 1243
 			
1244 1244
 			$this->resprints = ' ';
1245 1245
 		
1246
-			if((float)DOL_VERSION<=3.6) {
1246
+			if ((float) DOL_VERSION <= 3.6) {
1247 1247
 				return '';
1248 1248
 			}
1249
-			else if((float)DOL_VERSION>=3.8) {
1249
+			else if ((float) DOL_VERSION >= 3.8) {
1250 1250
 				return 1;
1251 1251
 			}
1252 1252
 		}
1253 1253
 		
1254
-		if(is_array($parameters)) $i = & $parameters['i'];
1255
-		else $i = (int)$parameters;
1254
+		if (is_array($parameters)) $i = & $parameters['i'];
1255
+		else $i = (int) $parameters;
1256 1256
 		
1257
-		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) 
1257
+		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) 
1258 1258
 		{
1259 1259
 			if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1260 1260
 			{
@@ -1266,24 +1266,24 @@  discard block
 block discarded – undo
1266 1266
 		return 0;
1267 1267
 	}
1268 1268
 	
1269
-	function pdf_getlineunit($parameters=array(), &$object, &$action='') {
1269
+	function pdf_getlineunit($parameters = array(), &$object, &$action = '') {
1270 1270
 		global $conf;
1271 1271
 		
1272
-		if($this->isModSubtotalLine($parameters,$object) ){
1272
+		if ($this->isModSubtotalLine($parameters, $object)) {
1273 1273
 			$this->resprints = ' ';
1274 1274
 		
1275
-			if((float)DOL_VERSION<=3.6) {
1275
+			if ((float) DOL_VERSION <= 3.6) {
1276 1276
 				return '';
1277 1277
 			}
1278
-			else if((float)DOL_VERSION>=3.8) {
1278
+			else if ((float) DOL_VERSION >= 3.8) {
1279 1279
 				return 1;
1280 1280
 			}
1281 1281
 		}
1282 1282
 		
1283
-		if(is_array($parameters)) $i = & $parameters['i'];
1284
-		else $i = (int)$parameters;
1283
+		if (is_array($parameters)) $i = & $parameters['i'];
1284
+		else $i = (int) $parameters;
1285 1285
 			
1286
-		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
1286
+		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])))
1287 1287
 		{
1288 1288
 			if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1289 1289
 			{
@@ -1295,21 +1295,21 @@  discard block
 block discarded – undo
1295 1295
 		return 0;
1296 1296
 	}
1297 1297
 	
1298
-	function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') {
1299
-	    global $conf,$hideprices,$hookmanager;
1298
+	function pdf_getlineupexcltax($parameters = array(), &$object, &$action = '') {
1299
+	    global $conf, $hideprices, $hookmanager;
1300 1300
 
1301
-		if($this->isModSubtotalLine($parameters,$object) ){
1301
+		if ($this->isModSubtotalLine($parameters, $object)) {
1302 1302
 			$this->resprints = ' ';
1303 1303
 		
1304
-			if((float)DOL_VERSION<=3.6) {
1304
+			if ((float) DOL_VERSION <= 3.6) {
1305 1305
 				return '';
1306 1306
 			}
1307
-			else if((float)DOL_VERSION>=3.8) {
1307
+			else if ((float) DOL_VERSION >= 3.8) {
1308 1308
 				return 1;
1309 1309
 			}
1310 1310
 		}
1311
-		if(is_array($parameters)) $i = & $parameters['i'];
1312
-		else $i = (int)$parameters;
1311
+		if (is_array($parameters)) $i = & $parameters['i'];
1312
+		else $i = (int) $parameters;
1313 1313
 		
1314 1314
 		
1315 1315
 		// Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché
@@ -1335,7 +1335,7 @@  discard block
 block discarded – undo
1335 1335
 		    
1336 1336
 		    // Check if a title exist for this line && if the title have subtotal
1337 1337
 		    $lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1338
-		    if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1338
+		    if (TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1339 1339
 		    {
1340 1340
 		        
1341 1341
 		        $this->resprints = ' ';
@@ -1349,24 +1349,24 @@  discard block
 block discarded – undo
1349 1349
 		return 0;
1350 1350
 	}
1351 1351
 	
1352
-	function pdf_getlineupwithtax($parameters=array(), &$object, &$action='') {
1353
-		global $conf,$hideprices;
1352
+	function pdf_getlineupwithtax($parameters = array(), &$object, &$action = '') {
1353
+		global $conf, $hideprices;
1354 1354
 		
1355
-		if($this->isModSubtotalLine($parameters,$object) ){
1355
+		if ($this->isModSubtotalLine($parameters, $object)) {
1356 1356
 			$this->resprints = ' ';
1357
-			if((float)DOL_VERSION<=3.6) {
1357
+			if ((float) DOL_VERSION <= 3.6) {
1358 1358
 				return '';
1359 1359
 			}
1360
-			else if((float)DOL_VERSION>=3.8) {
1360
+			else if ((float) DOL_VERSION >= 3.8) {
1361 1361
 				return 1;
1362 1362
 			}
1363 1363
 		}
1364 1364
 		
1365
-		if(is_array($parameters)) $i = & $parameters['i'];
1366
-		else $i = (int)$parameters;
1365
+		if (is_array($parameters)) $i = & $parameters['i'];
1366
+		else $i = (int) $parameters;
1367 1367
 			
1368 1368
 		if (!empty($hideprices)
1369
-				|| (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
1369
+				|| (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])))
1370 1370
 		)
1371 1371
 		{
1372 1372
 			if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
@@ -1379,22 +1379,22 @@  discard block
 block discarded – undo
1379 1379
 		return 0;
1380 1380
 	}
1381 1381
 	
1382
-	function pdf_getlinevatrate($parameters=array(), &$object, &$action='') {
1383
-	    global $conf,$hideprices,$hookmanager;
1382
+	function pdf_getlinevatrate($parameters = array(), &$object, &$action = '') {
1383
+	    global $conf, $hideprices, $hookmanager;
1384 1384
 	    
1385
-		if($this->isModSubtotalLine($parameters,$object) ){
1385
+		if ($this->isModSubtotalLine($parameters, $object)) {
1386 1386
 			$this->resprints = ' ';
1387 1387
 			
1388
-			if((float)DOL_VERSION<=3.6) {
1388
+			if ((float) DOL_VERSION <= 3.6) {
1389 1389
 				return '';
1390 1390
 			}
1391
-			else if((float)DOL_VERSION>=3.8) {
1391
+			else if ((float) DOL_VERSION >= 3.8) {
1392 1392
 				return 1;
1393 1393
 			}
1394 1394
 		}
1395 1395
 		
1396
-		if(is_array($parameters)) $i = & $parameters['i'];
1397
-		else $i = (int)$parameters;
1396
+		if (is_array($parameters)) $i = & $parameters['i'];
1397
+		else $i = (int) $parameters;
1398 1398
 		
1399 1399
 		if (empty($object->lines[$i])) return 0; // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0)
1400 1400
 
@@ -1421,7 +1421,7 @@  discard block
 block discarded – undo
1421 1421
 		    
1422 1422
 		    // Check if a title exist for this line && if the title have subtotal
1423 1423
 		    $lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1424
-		    if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1424
+		    if (TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1425 1425
 		    {
1426 1426
 		        
1427 1427
 		        $this->resprints = ' ';
@@ -1435,23 +1435,23 @@  discard block
 block discarded – undo
1435 1435
 		return 0;
1436 1436
 	}
1437 1437
 		
1438
-	function pdf_getlineprogress($parameters=array(), &$object, &$action) {
1438
+	function pdf_getlineprogress($parameters = array(), &$object, &$action) {
1439 1439
 		global $conf;
1440 1440
 		
1441
-		if($this->isModSubtotalLine($parameters,$object) ){
1441
+		if ($this->isModSubtotalLine($parameters, $object)) {
1442 1442
 			$this->resprints = ' ';
1443
-			if((float)DOL_VERSION<=3.6) {
1443
+			if ((float) DOL_VERSION <= 3.6) {
1444 1444
 				return '';
1445 1445
 			}
1446
-			else if((float)DOL_VERSION>=3.8) {
1446
+			else if ((float) DOL_VERSION >= 3.8) {
1447 1447
 				return 1;
1448 1448
 			}
1449 1449
 		}
1450 1450
 		
1451
-		if(is_array($parameters)) $i = & $parameters['i'];
1452
-		else $i = (int)$parameters;
1451
+		if (is_array($parameters)) $i = & $parameters['i'];
1452
+		else $i = (int) $parameters;
1453 1453
 			
1454
-		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) )
1454
+		if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])))
1455 1455
 		{
1456 1456
 			if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1457 1457
 			{
@@ -1466,12 +1466,12 @@  discard block
 block discarded – undo
1466 1466
 	function add_numerotation(&$object) {
1467 1467
 		global $conf;
1468 1468
 		
1469
-		if(!empty($conf->global->SUBTOTAL_USE_NUMEROTATION)) {
1469
+		if (!empty($conf->global->SUBTOTAL_USE_NUMEROTATION)) {
1470 1470
 		
1471 1471
 			$TLevelTitre = array();
1472 1472
 			$prevlevel = 0;
1473 1473
 		
1474
-			foreach($object->lines as $k=>&$line) 
1474
+			foreach ($object->lines as $k=>&$line) 
1475 1475
 			{
1476 1476
 				if ($line->id > 0 && $this->isModSubtotalLine($k, $object) && $line->qty <= 10)
1477 1477
 				{
@@ -1485,12 +1485,12 @@  discard block
 block discarded – undo
1485 1485
 	}
1486 1486
 
1487 1487
 	// TODO ne gère pas encore la numération des lignes "Totaux"
1488
-	private function formatNumerotation(&$TLineTitle, $line_reference='', $level=1, $prefix_num=0)
1488
+	private function formatNumerotation(&$TLineTitle, $line_reference = '', $level = 1, $prefix_num = 0)
1489 1489
 	{
1490 1490
 		$TTitle = array();
1491 1491
 		
1492
-		$i=1;
1493
-		$j=0;
1492
+		$i = 1;
1493
+		$j = 0;
1494 1494
 		foreach ($TLineTitle as $k => &$line)
1495 1495
 		{
1496 1496
 			if (!empty($line_reference) && $line->rang <= $line_reference->rang) continue;
@@ -1500,7 +1500,7 @@  discard block
 block discarded – undo
1500 1500
 			{
1501 1501
 				$TTitle[$j]['numerotation'] = ($prefix_num == 0) ? $i : $prefix_num.'.'.$i;
1502 1502
 				//var_dump('Prefix == '.$prefix_num.' // '.$line->desc.' ==> numerotation == '.$TTitle[$j]['numerotation'].'   ###    '.$line->qty .'=='. $level);
1503
-				if (empty($line->label) && (float)DOL_VERSION < 6)
1503
+				if (empty($line->label) && (float) DOL_VERSION < 6)
1504 1504
 				{
1505 1505
 					$line->label = !empty($line->desc) ? $line->desc : $line->description;
1506 1506
 					$line->desc = $line->description = '';
@@ -1526,26 +1526,26 @@  discard block
 block discarded – undo
1526 1526
 	
1527 1527
 	function setDocTVA(&$pdf, &$object) {
1528 1528
 		
1529
-		$hidedetails = (int)GETPOST('hidedetails');
1529
+		$hidedetails = (int) GETPOST('hidedetails');
1530 1530
 		
1531
-		if(empty($hidedetails)) return false;
1531
+		if (empty($hidedetails)) return false;
1532 1532
 		
1533 1533
 		// TODO can't add VAT to document without lines... :-/
1534 1534
 		
1535 1535
 		return true;
1536 1536
 	}
1537 1537
 	
1538
-	function beforePDFCreation($parameters=array(), &$object, &$action)
1538
+	function beforePDFCreation($parameters = array(), &$object, &$action)
1539 1539
 	{
1540 1540
 		/**
1541 1541
 		 * @var $pdf    TCPDF
1542 1542
 		 */
1543
-		global $pdf,$conf, $langs;
1543
+		global $pdf, $conf, $langs;
1544 1544
 
1545 1545
 		// var_dump($object->lines);
1546 1546
 		dol_include_once('/subtotal/class/subtotal.class.php');
1547 1547
 
1548
-		foreach($parameters as $key=>$value) {
1548
+		foreach ($parameters as $key=>$value) {
1549 1549
 			${$key} = $value;
1550 1550
 		}
1551 1551
 		
@@ -1554,25 +1554,25 @@  discard block
 block discarded – undo
1554 1554
 		$this->add_numerotation($object);	
1555 1555
 		
1556 1556
 		
1557
-		$hideInnerLines = (int)GETPOST('hideInnerLines');
1558
-		$hidedetails = (int)GETPOST('hidedetails');
1557
+		$hideInnerLines = (int) GETPOST('hideInnerLines');
1558
+		$hidedetails = (int) GETPOST('hidedetails');
1559 1559
 		
1560 1560
 		if ($hideInnerLines) { // si c une ligne de titre
1561
-	    	$fk_parent_line=0;
1562
-			$TLines =array();
1561
+	    	$fk_parent_line = 0;
1562
+			$TLines = array();
1563 1563
 		
1564
-			$original_count=count($object->lines);
1564
+			$original_count = count($object->lines);
1565 1565
 		    $TTvas = array(); // tableau de tva
1566 1566
 		    
1567
-			foreach($object->lines as $k=>&$line) 
1567
+			foreach ($object->lines as $k=>&$line) 
1568 1568
 			{
1569 1569
 			    
1570
-				if($line->product_type==9 && $line->rowid>0) 
1570
+				if ($line->product_type == 9 && $line->rowid > 0) 
1571 1571
 				{
1572 1572
 					$fk_parent_line = $line->rowid;
1573 1573
 					
1574 1574
 					// Fix tk7201 - si on cache le détail, la TVA est renseigné au niveau du sous-total, l'erreur c'est s'il y a plusieurs sous-totaux pour les même lignes, ça va faire la somme
1575
-					if(TSubtotal::isSubtotal($line)) 
1575
+					if (TSubtotal::isSubtotal($line)) 
1576 1576
 					{
1577 1577
 						/*$total = $this->getTotalLineFromObject($object, $line, '');
1578 1578
 						
@@ -1592,22 +1592,22 @@  discard block
 block discarded – undo
1592 1592
 			
1593 1593
 				if ($hideInnerLines)
1594 1594
 				{
1595
-				    if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1595
+				    if (!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1596 1596
 				    {
1597
-				        if($line->tva_tx != '0.000' && $line->product_type!=9){
1597
+				        if ($line->tva_tx != '0.000' && $line->product_type != 9) {
1598 1598
 				            
1599 1599
     				        // on remplit le tableau de tva pour substituer les lignes cachées
1600 1600
     				        $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva;
1601 1601
     				        $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht;
1602 1602
     				        $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; 
1603 1603
     				    }
1604
-    					if($line->product_type==9 && $line->rowid>0)
1604
+    					if ($line->product_type == 9 && $line->rowid > 0)
1605 1605
     					{
1606 1606
     					    //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres
1607 1607
     					    // génère des lignes d'affichage des montants HT soumis à tva
1608 1608
     					    $nbtva = count($TTvas);
1609
-    					    if(!empty($nbtva)){
1610
-    					        foreach ($TTvas as $tx =>$val){
1609
+    					    if (!empty($nbtva)) {
1610
+    					        foreach ($TTvas as $tx =>$val) {
1611 1611
     					            $l = clone $line;
1612 1612
     					            $l->product_type = 1;
1613 1613
     					            $l->special_code = '';
@@ -1628,7 +1628,7 @@  discard block
 block discarded – undo
1628 1628
     					}
1629 1629
 				    } else {
1630 1630
 				        
1631
-				        if($line->product_type==9 && $line->rowid>0)
1631
+				        if ($line->product_type == 9 && $line->rowid > 0)
1632 1632
 				        {
1633 1633
 				            // ajoute la ligne de sous-total
1634 1634
 				            $TLines[] = $line; 
@@ -1656,9 +1656,9 @@  discard block
 block discarded – undo
1656 1656
 			
1657 1657
 			// cas incongru où il y aurait des produits en dessous du dernier sous-total
1658 1658
 			$nbtva = count($TTvas);
1659
-			if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1659
+			if (!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1660 1660
 			{
1661
-			    foreach ($TTvas as $tx =>$val){
1661
+			    foreach ($TTvas as $tx =>$val) {
1662 1662
 			        $l = clone $line;
1663 1663
 			        $l->product_type = 1;
1664 1664
 			        $l->special_code = '';
@@ -1675,11 +1675,11 @@  discard block
 block discarded – undo
1675 1675
 			}
1676 1676
 			
1677 1677
 			global $nblignes;
1678
-			$nblignes=count($TLines);
1678
+			$nblignes = count($TLines);
1679 1679
 
1680 1680
 			$object->lines = $TLines;
1681 1681
 			
1682
-			if($i>count($object->lines)) {
1682
+			if ($i > count($object->lines)) {
1683 1683
 				$this->resprints = '';
1684 1684
 				return 0;
1685 1685
 			}
@@ -1688,59 +1688,59 @@  discard block
 block discarded – undo
1688 1688
 		return 0;
1689 1689
 	}
1690 1690
 
1691
-	function pdf_writelinedesc($parameters=array(), &$object, &$action)
1691
+	function pdf_writelinedesc($parameters = array(), &$object, &$action)
1692 1692
 	{
1693 1693
 		/**
1694 1694
 		 * @var $pdf    TCPDF
1695 1695
 		 */
1696
-		global $pdf,$conf;
1696
+		global $pdf, $conf;
1697 1697
 
1698
-		foreach($parameters as $key=>$value) {
1698
+		foreach ($parameters as $key=>$value) {
1699 1699
 			${$key} = $value;
1700 1700
 		}
1701 1701
 		
1702
-		$hideInnerLines = (int)GETPOST('hideInnerLines');
1703
-		$hidedetails = (int)GETPOST('hidedetails');
1702
+		$hideInnerLines = (int) GETPOST('hideInnerLines');
1703
+		$hidedetails = (int) GETPOST('hidedetails');
1704 1704
 		
1705
-		if($this->isModSubtotalLine($parameters,$object) ){			
1705
+		if ($this->isModSubtotalLine($parameters, $object)) {			
1706 1706
 		
1707 1707
 				global $hideprices;
1708 1708
 				
1709
-				if(!empty($hideprices)) {
1710
-					foreach($object->lines as &$line) {
1711
-						if($line->fk_product_type!=9) $line->fk_parent_line = -1;	
1709
+				if (!empty($hideprices)) {
1710
+					foreach ($object->lines as &$line) {
1711
+						if ($line->fk_product_type != 9) $line->fk_parent_line = -1;	
1712 1712
 					}
1713 1713
 				}
1714 1714
 			
1715 1715
 				$line = &$object->lines[$i];
1716 1716
 				
1717
-				if($line->info_bits>0) { // PAGE BREAK
1717
+				if ($line->info_bits > 0) { // PAGE BREAK
1718 1718
 					$pdf->addPage();
1719 1719
 					$posy = $pdf->GetY();
1720 1720
 				}
1721 1721
 				
1722 1722
 				$label = $line->label;
1723
-				$description= !empty($line->desc) ? $outputlangs->convToOutputCharset($line->desc) : $outputlangs->convToOutputCharset($line->description);
1723
+				$description = !empty($line->desc) ? $outputlangs->convToOutputCharset($line->desc) : $outputlangs->convToOutputCharset($line->description);
1724 1724
 				
1725
-				if(empty($label)) {
1725
+				if (empty($label)) {
1726 1726
 					$label = $description;
1727
-					$description='';
1727
+					$description = '';
1728 1728
 				}
1729 1729
 				
1730
-				if($line->qty>90) {
1730
+				if ($line->qty > 90) {
1731 1731
 					
1732 1732
 					if ($conf->global->SUBTOTAL_USE_NEW_FORMAT)	$label .= ' '.$this->getTitle($object, $line);
1733 1733
 					
1734 1734
 					$pageBefore = $pdf->getPage();
1735
-					$this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h);
1735
+					$this->pdf_add_total($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h);
1736 1736
 					$pageAfter = $pdf->getPage();	
1737 1737
 
1738
-					if($pageAfter>$pageBefore) {
1738
+					if ($pageAfter > $pageBefore) {
1739 1739
 						//print "ST $pageAfter>$pageBefore<br>";
1740 1740
 						$pdf->rollbackTransaction(true);	
1741
-						$pdf->addPage('','', true);
1741
+						$pdf->addPage('', '', true);
1742 1742
 						$posy = $pdf->GetY();
1743
-						$this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h);
1743
+						$this->pdf_add_total($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h);
1744 1744
 						$posy = $pdf->GetY();
1745 1745
 						//print 'add ST'.$pdf->getPage().'<br />';
1746 1746
 					}
@@ -1751,7 +1751,7 @@  discard block
 block discarded – undo
1751 1751
 				else if ($line->qty < 10) {
1752 1752
 					$pageBefore = $pdf->getPage();
1753 1753
 
1754
-					$this->pdf_add_title($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); 
1754
+					$this->pdf_add_title($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); 
1755 1755
 					$pageAfter = $pdf->getPage();	
1756 1756
 
1757 1757
 					
@@ -1826,9 +1826,9 @@  discard block
 block discarded – undo
1826 1826
 	 * @param $hookmanager  HookManager
1827 1827
 	 * @return int
1828 1828
 	 */
1829
-	function printObjectLine ($parameters, &$object, &$action, $hookmanager){
1829
+	function printObjectLine($parameters, &$object, &$action, $hookmanager) {
1830 1830
 		
1831
-		global $conf,$langs,$user,$db,$bc;
1831
+		global $conf, $langs, $user, $db, $bc;
1832 1832
 		
1833 1833
 		$num = &$parameters['num'];
1834 1834
 		$line = &$parameters['line'];
@@ -1836,32 +1836,32 @@  discard block
 block discarded – undo
1836 1836
 		
1837 1837
 		$var = &$parameters['var'];
1838 1838
 
1839
-		$contexts = explode(':',$parameters['context']);
1839
+		$contexts = explode(':', $parameters['context']);
1840 1840
 
1841 1841
 		$createRight = $user->rights->{$object->element}->creer;
1842
-		if($object->element == 'facturerec' )
1842
+		if ($object->element == 'facturerec')
1843 1843
 		{
1844 1844
 			$object->statut = 0; // hack for facture rec
1845 1845
 			$createRight = $user->rights->facture->creer;
1846 1846
 		}
1847
-		elseif($object->element == 'order_supplier' )
1847
+		elseif ($object->element == 'order_supplier')
1848 1848
 		{
1849 1849
 		    $createRight = $user->rights->fournisseur->commande->creer;
1850 1850
 		}
1851
-		elseif($object->element == 'invoice_supplier' )
1851
+		elseif ($object->element == 'invoice_supplier')
1852 1852
 		{
1853 1853
 		    $createRight = $user->rights->fournisseur->facture->creer;
1854 1854
 		}
1855 1855
 		
1856
-		if($line->special_code!=$this->module_number || $line->product_type!=9) {
1856
+		if ($line->special_code != $this->module_number || $line->product_type != 9) {
1857 1857
 			null;
1858 1858
 		}	
1859
-		else if (in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('invoicereccard',$contexts)) 
1859
+		else if (in_array('invoicecard', $contexts) || in_array('invoicesuppliercard', $contexts) || in_array('propalcard', $contexts) || in_array('supplier_proposalcard', $contexts) || in_array('ordercard', $contexts) || in_array('ordersuppliercard', $contexts) || in_array('invoicereccard', $contexts)) 
1860 1860
         {
1861
-			if($object->element=='facture')$idvar = 'facid';
1862
-			else $idvar='id';
1861
+			if ($object->element == 'facture')$idvar = 'facid';
1862
+			else $idvar = 'id';
1863 1863
 			
1864
-			if((float)DOL_VERSION <= 3.4)
1864
+			if ((float) DOL_VERSION <= 3.4)
1865 1865
 			{
1866 1866
 				?>
1867 1867
 				<script type="text/javascript">
@@ -1885,20 +1885,20 @@  discard block
 block discarded – undo
1885 1885
 				<?php
1886 1886
 			}
1887 1887
 			
1888
-			if(empty($line->description)) $line->description = $line->desc;
1888
+			if (empty($line->description)) $line->description = $line->desc;
1889 1889
 			
1890 1890
 			$colspan = 5;
1891
-			if($object->element == 'facturerec' ) $colspan = 3;
1892
-			if($object->element == 'order_supplier') $colspan = 3;
1893
-			if($object->element == 'invoice_supplier') $colspan = 4;
1894
-			if($object->element == 'supplier_proposal') $colspan = 4;
1895
-			if(!empty($conf->multicurrency->enabled)) $colspan+=2;
1896
-			if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++;
1897
-			if(!empty($conf->margin->enabled)) $colspan++;
1898
-			if(!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
1899
-			if(!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
1900
-			if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++;
1901
-			if(!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++;
1891
+			if ($object->element == 'facturerec') $colspan = 3;
1892
+			if ($object->element == 'order_supplier') $colspan = 3;
1893
+			if ($object->element == 'invoice_supplier') $colspan = 4;
1894
+			if ($object->element == 'supplier_proposal') $colspan = 4;
1895
+			if (!empty($conf->multicurrency->enabled)) $colspan += 2;
1896
+			if ($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++;
1897
+			if (!empty($conf->margin->enabled)) $colspan++;
1898
+			if (!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++;
1899
+			if (!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++;
1900
+			if ($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++;
1901
+			if (!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++;
1902 1902
 					
1903 1903
 			/* Titre */
1904 1904
 			//var_dump($line);
@@ -1908,35 +1908,35 @@  discard block
 block discarded – undo
1908 1908
             
1909 1909
 			
1910 1910
 			?>
1911
-			<tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php
1911
+			<tr <?php echo $bc[$var]; $var = !$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php
1912 1912
 					if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT))
1913 1913
 					{
1914
-						if($line->qty==99) print 'background:#adadcf';
1915
-						else if($line->qty==98) print 'background:#ddddff;';
1916
-						else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;';
1917
-						else if($line->qty==1) print 'background:#adadcf;';
1918
-						else if($line->qty==2) print 'background:#ddddff;';
1919
-						else if($line->qty==50) print '';
1914
+						if ($line->qty == 99) print 'background:#adadcf';
1915
+						else if ($line->qty == 98) print 'background:#ddddff;';
1916
+						else if ($line->qty <= 97 && $line->qty >= 91) print 'background:#eeeeff;';
1917
+						else if ($line->qty == 1) print 'background:#adadcf;';
1918
+						else if ($line->qty == 2) print 'background:#ddddff;';
1919
+						else if ($line->qty == 50) print '';
1920 1920
 						else print 'background:#eeeeff;';
1921 1921
 
1922 1922
 						//A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9
1923 1923
 					}
1924 1924
 					else 
1925 1925
 					{
1926
-						if($line->qty==99) print 'background:#ddffdd';
1927
-						else if($line->qty==98) print 'background:#ddddff;';
1928
-						else if($line->qty==2) print 'background:#eeeeff; ';
1929
-						else if($line->qty==50) print '';
1930
-						else print 'background:#eeffee;' ;
1926
+						if ($line->qty == 99) print 'background:#ddffdd';
1927
+						else if ($line->qty == 98) print 'background:#ddddff;';
1928
+						else if ($line->qty == 2) print 'background:#eeeeff; ';
1929
+						else if ($line->qty == 50) print '';
1930
+						else print 'background:#eeffee;';
1931 1931
 					}
1932 1932
 
1933 1933
 			?>;">
1934 1934
 			
1935
-				<td colspan="<?php echo $colspan; ?>" style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?>  <?php echo ($line->qty>90)?'text-align:right':'' ?> "><?php
1936
-					if($action=='editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line) ) {
1935
+				<td colspan="<?php echo $colspan; ?>" style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?>  <?php echo ($line->qty > 90) ? 'text-align:right' : '' ?> "><?php
1936
+					if ($action == 'editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line)) {
1937 1937
 
1938
-						$params=array('line'=>$line);
1939
-						$reshook=$hookmanager->executeHooks('formEditProductOptions',$params,$object,$action);
1938
+						$params = array('line'=>$line);
1939
+						$reshook = $hookmanager->executeHooks('formEditProductOptions', $params, $object, $action);
1940 1940
 						
1941 1941
 						echo '<div id="line_'.$line->id.'"></div>'; // Imitation Dolibarr
1942 1942
 						echo '<input type="hidden" value="'.$line->id.'" name="lineid">';
@@ -1944,7 +1944,7 @@  discard block
 block discarded – undo
1944 1944
 						echo '<input id="product_id" type="hidden" value="'.$line->fk_product.'" name="type">';
1945 1945
 						echo '<input id="special_code" type="hidden" value="'.$line->special_code.'" name="type">';
1946 1946
 
1947
-						$isFreeText=false;
1947
+						$isFreeText = false;
1948 1948
 						if (TSubtotal::isTitle($line))
1949 1949
 						{
1950 1950
 							$qty_displayed = $line->qty;
@@ -1966,13 +1966,13 @@  discard block
 block discarded – undo
1966 1966
 						    $line->description = '';
1967 1967
 						}
1968 1968
 						$newlabel = $line->label;
1969
-						if($line->label=='' && !$isFreeText) {
1970
-							if(TSubtotal::isSubtotal($line)) {
1969
+						if ($line->label == '' && !$isFreeText) {
1970
+							if (TSubtotal::isSubtotal($line)) {
1971 1971
 								$newlabel = $line->description.' '.$this->getTitle($object, $line);
1972
-								$line->description='';
1973
-							} elseif( (float)DOL_VERSION < 6 ) {
1974
-								$newlabel= $line->description;
1975
-								$line->description='';
1972
+								$line->description = '';
1973
+							} elseif ((float) DOL_VERSION < 6) {
1974
+								$newlabel = $line->description;
1975
+								$line->description = '';
1976 1976
 							}
1977 1977
 						}
1978 1978
 
@@ -1981,10 +1981,10 @@  discard block
 block discarded – undo
1981 1981
 						
1982 1982
 						if (!$isFreeText) echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/>&nbsp;';
1983 1983
 						
1984
-						if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) )
1984
+						if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)))
1985 1985
 						{
1986 1986
 							$select = '<select name="subtotal_level">';
1987
-							for ($j=1; $j<10; $j++)
1987
+							for ($j = 1; $j < 10; $j++)
1988 1988
 							{
1989 1989
 								if (!empty($readonlyForSituation)) {
1990 1990
 									if ($qty_displayed == $j) $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>';
@@ -1997,7 +1997,7 @@  discard block
 block discarded – undo
1997 1997
 						
1998 1998
 
1999 1999
 						echo '<div class="subtotal_underline" style="margin-left:24px;">';
2000
-							echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label> <input style="vertical-align:sub;"  type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' />&nbsp;&nbsp;';
2000
+							echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label> <input style="vertical-align:sub;"  type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '').' />&nbsp;&nbsp;';
2001 2001
 
2002 2002
 							if (TSubtotal::isTitle($line))
2003 2003
 							{
@@ -2015,9 +2015,9 @@  discard block
 block discarded – undo
2015 2015
 							else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation);
2016 2016
 						echo '</div>';
2017 2017
 
2018
-						if($line->qty<10) {
2018
+						if ($line->qty < 10) {
2019 2019
 							// WYSIWYG editor
2020
-							require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
2020
+							require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
2021 2021
 							$nbrows = ROWS_2;
2022 2022
 							$cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0);
2023 2023
 							if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) {
@@ -2037,25 +2037,25 @@  discard block
 block discarded – undo
2037 2037
 
2038 2038
 						 if ($conf->global->SUBTOTAL_USE_NEW_FORMAT)
2039 2039
 						 {
2040
-							if(TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) 
2040
+							if (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) 
2041 2041
 							{
2042
-								echo str_repeat('&nbsp;&nbsp;&nbsp;', $line->qty-1);
2042
+								echo str_repeat('&nbsp;&nbsp;&nbsp;', $line->qty - 1);
2043 2043
 								
2044 2044
 								if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span>&nbsp;&nbsp;';
2045
-								else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span>&nbsp;&nbsp;';
2045
+								else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100 - $line->qty).'</span>&nbsp;&nbsp;';
2046 2046
 							}
2047 2047
 						 }
2048 2048
 						 else 
2049 2049
 						 {
2050
-							if($line->qty<=1) print img_picto('', 'subtotal@subtotal');
2051
-							else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; 
2050
+							if ($line->qty <= 1) print img_picto('', 'subtotal@subtotal');
2051
+							else if ($line->qty == 2) print img_picto('', 'subsubtotal@subtotal').'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; 
2052 2052
 						 }
2053 2053
 						 
2054 2054
 						 
2055 2055
 						 // Get display styles and apply them
2056 2056
 						 $titleStyleItalic = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'I') === false ? '' : ' font-style: italic;';
2057
-						 $titleStyleBold =  strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;';
2058
-						 $titleStyleUnderline =  strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;';
2057
+						 $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;';
2058
+						 $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;';
2059 2059
 						 
2060 2060
 						 if (empty($line->label)) {
2061 2061
 							if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print  $line->description.' '.$this->getTitle($object, $line);
@@ -2063,16 +2063,16 @@  discard block
 block discarded – undo
2063 2063
 						 } 
2064 2064
 						 else {
2065 2065
 
2066
-							if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) {
2066
+							if (!empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) {
2067 2067
 								print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>';
2068 2068
 							}
2069
-							else{
2069
+							else {
2070 2070
 								print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>';    
2071 2071
 							}
2072 2072
 
2073 2073
 						 } 
2074
-						if($line->qty>90) print ' : ';
2075
-						if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal');
2074
+						if ($line->qty > 90) print ' : ';
2075
+						if ($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal');
2076 2076
 
2077 2077
 						 
2078 2078
 
@@ -2081,7 +2081,7 @@  discard block
 block discarded – undo
2081 2081
 			?></td>
2082 2082
 					 
2083 2083
 			<?php
2084
-				if($line->qty>90) {
2084
+				if ($line->qty > 90) {
2085 2085
 					/* Total */
2086 2086
 					$total_line = $this->getTotalLineFromObject($object, $line, '');
2087 2087
 					echo '<td class="nowrap liencolht" align="right" style="font-weight:bold;" rel="subtotal_total">'.price($total_line).'</td>';
@@ -2094,7 +2094,7 @@  discard block
 block discarded – undo
2094 2094
 				<?php
2095 2095
 				if ($action != 'selectlines') {
2096 2096
 				
2097
-					if($action=='editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line) ) {
2097
+					if ($action == 'editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line)) {
2098 2098
 						?>
2099 2099
 						<input id="savelinebutton" class="button" type="submit" name="save" value="<?php echo $langs->trans('Save') ?>" />
2100 2100
 						<br />
@@ -2110,13 +2110,13 @@  discard block
 block discarded – undo
2110 2110
 						<?php
2111 2111
 						
2112 2112
 					}
2113
-					else{
2114
-						if ($object->statut == 0  && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier')
2113
+					else {
2114
+						if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier')
2115 2115
 						{
2116
-							if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>';
2116
+							if (TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref)) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'.img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>';
2117 2117
 						}
2118 2118
 
2119
-						if ($object->statut == 0  && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) 
2119
+						if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) 
2120 2120
 						{
2121 2121
 							echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=editline&lineid='.$line->id.'">'.img_edit().'</a>';
2122 2122
 						}								
@@ -2131,7 +2131,7 @@  discard block
 block discarded – undo
2131 2131
 				<?php
2132 2132
 
2133 2133
 				if ($action != 'editline' && $action != 'selectlines') {
2134
-						if ($object->statut == 0  && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK))
2134
+						if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK))
2135 2135
 						{
2136 2136
 
2137 2137
 							if ($object->situation_counter == 1 || !$object->situation_cycle_ref)
@@ -2139,7 +2139,7 @@  discard block
 block discarded – undo
2139 2139
 								echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=ask_deleteline&lineid='.$line->id.'">'.img_delete().'</a>';
2140 2140
 							}
2141 2141
 
2142
-							if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) )
2142
+							if (TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref))
2143 2143
 							{
2144 2144
 								$img_delete = ((float) DOL_VERSION >= 3.8) ? img_picto($langs->trans('deleteWithAllLines'), 'delete_all.3.8@subtotal') : img_picto($langs->trans('deleteWithAllLines'), 'delete_all@subtotal');
2145 2145
 								echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=ask_deleteallline&lineid='.$line->id.'">'.$img_delete.'</a>';
@@ -2150,7 +2150,7 @@  discard block
 block discarded – undo
2150 2150
 			</td>
2151 2151
 			
2152 2152
 			<?php 
2153
-			if ($object->statut == 0  && $createRight && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && TSubtotal::isTitle($line) && $action != 'editline')
2153
+			if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && TSubtotal::isTitle($line) && $action != 'editline')
2154 2154
 			{
2155 2155
 				echo '<td class="subtotal_nc">';
2156 2156
 				echo '<input id="subtotal_nc-'.$line->id.'" class="subtotal_nc_chkbx" data-lineid="'.$line->id.'" type="checkbox" name="subtotal_nc" value="1" '.(!empty($line->array_options['options_subtotal_nc']) ? 'checked="checked"' : '').' />';
@@ -2161,11 +2161,11 @@  discard block
 block discarded – undo
2161 2161
 			<td align="center" class="tdlineupdown">
2162 2162
 			</td>
2163 2163
 			<?php } else { ?>
2164
-			<td align="center"<?php echo ((empty($conf->browser->phone) && ($object->statut == 0  && $createRight ))?' class="tdlineupdown"':''); ?>></td>
2164
+			<td align="center"<?php echo ((empty($conf->browser->phone) && ($object->statut == 0 && $createRight)) ? ' class="tdlineupdown"' : ''); ?>></td>
2165 2165
 			<?php } ?>
2166 2166
 
2167
-			<?php  if($action == 'selectlines'){ // dolibarr 8 ?>
2168
-			<td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i+1; ?>]" value="<?php echo $line->id; ?>" ></td>
2167
+			<?php  if ($action == 'selectlines') { // dolibarr 8 ?>
2168
+			<td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i + 1; ?>]" value="<?php echo $line->id; ?>" ></td>
2169 2169
 			<?php } ?>
2170 2170
 
2171 2171
 			</tr>
@@ -2173,29 +2173,29 @@  discard block
 block discarded – undo
2173 2173
 			
2174 2174
 			
2175 2175
 			// Affichage des extrafields à la Dolibarr (car sinon non affiché sur les titres)
2176
-			if(TSubtotal::isTitle($line) && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE)) {
2176
+			if (TSubtotal::isTitle($line) && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE)) {
2177 2177
 				
2178
-				require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
2178
+				require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
2179 2179
 				
2180 2180
 				// Extrafields
2181 2181
 				$extrafieldsline = new ExtraFields($db);
2182 2182
 				$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
2183 2183
 				
2184
-				$colspan+=3; $mode = 'view';
2185
-				if($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit';
2184
+				$colspan += 3; $mode = 'view';
2185
+				if ($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit';
2186 2186
 				
2187 2187
 				$ex_element = $line->element;
2188 2188
 				$line->element = 'tr_extrafield_title '.$line->element; // Pour pouvoir manipuler ces tr
2189
-				print $line->showOptionals($extrafieldsline, $mode, array('style'=>' style="background:#eeffee;" ','colspan'=>$colspan));
2189
+				print $line->showOptionals($extrafieldsline, $mode, array('style'=>' style="background:#eeffee;" ', 'colspan'=>$colspan));
2190 2190
 				$isExtraSelected = false;
2191
-				foreach($line->array_options as $option) {
2192
-					if(!empty($option) && $option != "-1") {
2191
+				foreach ($line->array_options as $option) {
2192
+					if (!empty($option) && $option != "-1") {
2193 2193
 						$isExtraSelected = true;
2194 2194
 						break;
2195 2195
 					}
2196 2196
 				}
2197 2197
 				
2198
-				if($mode === 'edit') {
2198
+				if ($mode === 'edit') {
2199 2199
 					?>
2200 2200
 					<script>
2201 2201
 						$(document).ready(function(){
@@ -2203,7 +2203,7 @@  discard block
 block discarded – undo
2203 2203
 							var all_tr_extrafields = $("tr.tr_extrafield_title");
2204 2204
 							<?php 
2205 2205
 							// Si un extrafield est rempli alors on affiche directement les extrafields
2206
-							if(!$isExtraSelected) {
2206
+							if (!$isExtraSelected) {
2207 2207
 								echo 'all_tr_extrafields.hide();';
2208 2208
 								echo 'var trad = "'.$langs->trans('showExtrafields').'";';
2209 2209
 								echo 'var extra = 0;';
@@ -2249,20 +2249,20 @@  discard block
 block discarded – undo
2249 2249
 
2250 2250
 	
2251 2251
 	function addMoreActionsButtons($parameters, &$object, &$action, $hookmanager) {
2252
-		global $conf,$langs;
2252
+		global $conf, $langs;
2253 2253
 		 
2254 2254
 		if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline')
2255 2255
 		{
2256 2256
 		    
2257
-		    if($object->element == 'invoice_supplier' || $object->element == 'order_supplier')
2257
+		    if ($object->element == 'invoice_supplier' || $object->element == 'order_supplier')
2258 2258
 		    {
2259 2259
 		        foreach ($object->lines as $line)
2260 2260
 		        {
2261 2261
 		            // fetch optionals attributes and labels
2262 2262
 		            require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
2263
-		            $extrafields=new ExtraFields($this->db);
2264
-		            $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true);
2265
-		            $line->fetch_optionals($line->id,$extralabels);
2263
+		            $extrafields = new ExtraFields($this->db);
2264
+		            $extralabels = $extrafields->fetch_name_optionals_label($object->table_element_line, true);
2265
+		            $line->fetch_optionals($line->id, $extralabels);
2266 2266
 		        }
2267 2267
 		    }
2268 2268
 		    
@@ -2362,23 +2362,23 @@  discard block
 block discarded – undo
2362 2362
 	    $ThtmlData['data-qty']          = 0; //$line->qty;
2363 2363
 	    $ThtmlData['data-level']        = TSubtotal::getNiveau($line);
2364 2364
 	    
2365
-	    if(TSubtotal::isTitle($line)){
2365
+	    if (TSubtotal::isTitle($line)) {
2366 2366
 	        $ThtmlData['data-issubtotal'] = 'title';
2367
-	    }elseif(TSubtotal::isSubtotal($line)){
2367
+	    }elseif (TSubtotal::isSubtotal($line)) {
2368 2368
 	        $ThtmlData['data-issubtotal'] = 'subtotal';
2369 2369
 	    }
2370
-	    else{
2370
+	    else {
2371 2371
 	        $ThtmlData['data-issubtotal'] = 'freetext';
2372 2372
 	    }
2373 2373
 	    
2374 2374
 	    
2375 2375
 	    // Change or add data  from hooks
2376
-	    $parameters = array_replace($parameters , array(  'ThtmlData' => $ThtmlData )  );
2376
+	    $parameters = array_replace($parameters, array('ThtmlData' => $ThtmlData));
2377 2377
 	    
2378 2378
 	    // hook 
2379
-	    $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
2379
+	    $reshook = $hookmanager->executeHooks('subtotalLineHtmlData', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
2380 2380
 	    if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
2381
-	    if ($reshook>0)
2381
+	    if ($reshook > 0)
2382 2382
 	    {
2383 2383
 	        $ThtmlData = $hookmanager->resArray;
2384 2384
 	    }
@@ -2391,14 +2391,14 @@  discard block
 block discarded – undo
2391 2391
 	function implodeHtmlData($ThtmlData = array())
2392 2392
 	{
2393 2393
 	    $data = '';
2394
-	    foreach($ThtmlData as $k => $h )
2394
+	    foreach ($ThtmlData as $k => $h)
2395 2395
 	    {
2396
-	        if(is_array($h))
2396
+	        if (is_array($h))
2397 2397
 	        {
2398 2398
 	            $h = json_encode($h);
2399 2399
 	        }
2400 2400
 	        
2401
-	        $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" ';
2401
+	        $data .= $k.'="'.dol_htmlentities($h, ENT_QUOTES).'" ';
2402 2402
 	    }
2403 2403
 	    
2404 2404
 	    return $data;
@@ -2406,26 +2406,26 @@  discard block
 block discarded – undo
2406 2406
 	
2407 2407
 	function _ajax_block_order_js($object)
2408 2408
 	{
2409
-	    global $conf,$tagidfortablednd,$filepath,$langs;
2409
+	    global $conf, $tagidfortablednd, $filepath, $langs;
2410 2410
 	    
2411 2411
 	    /*
2412 2412
 	     * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php 
2413 2413
 	     * for compatibility reasons we don't use tableDnD but jquery sortable
2414 2414
 	     */
2415 2415
 	    
2416
-	    $id=$object->id;
2417
-	    $nboflines=(isset($object->lines)?count($object->lines):0);
2418
-	    $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1;
2416
+	    $id = $object->id;
2417
+	    $nboflines = (isset($object->lines) ?count($object->lines) : 0);
2418
+	    $forcereloadpage = empty($conf->global->MAIN_FORCE_RELOAD_PAGE) ? 0 : 1;
2419 2419
 	    
2420
-	    $id=$object->id;
2421
-	    $fk_element=$object->fk_element;
2422
-	    $table_element_line=$object->table_element_line;
2423
-	    $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines));
2424
-	    $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd);
2425
-	    $filepath=(empty($filepath)?'':$filepath);
2420
+	    $id = $object->id;
2421
+	    $fk_element = $object->fk_element;
2422
+	    $table_element_line = $object->table_element_line;
2423
+	    $nboflines = (isset($object->lines) ?count($object->lines) : (empty($nboflines) ? 0 : $nboflines));
2424
+	    $tagidfortablednd = (empty($tagidfortablednd) ? 'tablelines' : $tagidfortablednd);
2425
+	    $filepath = (empty($filepath) ? '' : $filepath);
2426 2426
 	    
2427 2427
 	    
2428
-	    if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1)
2428
+	    if (GETPOST('action', 'aZ09') != 'editline' && $nboflines > 1)
2429 2429
 	    {
2430 2430
 	        
2431 2431
 	        ?>
@@ -2443,7 +2443,7 @@  discard block
 block discarded – undo
2443 2443
 				moveBlockCol.disableSelection(); // prevent selection
2444 2444
 <?php if ($object->statut == 0) { ?>
2445 2445
 				// apply some graphical stuff
2446
-				moveBlockCol.css("background-image",'url(<?php echo dol_buildpath('subtotal/img/grip_all.png',2);  ?>)');
2446
+				moveBlockCol.css("background-image",'url(<?php echo dol_buildpath('subtotal/img/grip_all.png', 2); ?>)');
2447 2447
 				moveBlockCol.css("background-repeat","no-repeat");
2448 2448
 				moveBlockCol.css("background-position","center center");
2449 2449
 				moveBlockCol.css("cursor","move");
Please login to merge, or discard this patch.
class/subtotal.class.php 1 patch
Spacing   +191 added lines, -191 removed lines patch added patch discarded remove patch
@@ -5,28 +5,28 @@  discard block
 block discarded – undo
5 5
 	
6 6
 	static $module_number = 104777;
7 7
 	
8
-	static function addSubTotalLine(&$object, $label, $qty, $rang=-1) {
8
+	static function addSubTotalLine(&$object, $label, $qty, $rang = -1) {
9 9
 		
10 10
 		$res = 0;
11 11
 		
12
-		if( (float)DOL_VERSION <= 3.4 ) {
12
+		if ((float) DOL_VERSION <= 3.4) {
13 13
 			/**
14 14
 			 * @var $object Facture
15 15
 			 */
16
-			if($object->element=='facture') $res =  $object->addline($object->id, $label, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,-1, TSubtotal::$module_number);
16
+			if ($object->element == 'facture') $res = $object->addline($object->id, $label, 0, $qty, 0, 0, 0, 0, 0, '', '', 0, 0, '', 'HT', 0, 9, -1, TSubtotal::$module_number);
17 17
 			/**
18 18
 			 * @var $object Propal
19 19
 			 */
20
-			else if($object->element=='propal') $res =  $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,'HT',0,0,9,-1, TSubtotal::$module_number);
20
+			else if ($object->element == 'propal') $res = $object->addline($object->id, $label, 0, $qty, 0, 0, 0, 0, 0, 'HT', 0, 0, 9, -1, TSubtotal::$module_number);
21 21
 			/**
22 22
 			 * @var $object Commande
23 23
 			 */
24
-			else if($object->element=='commande') $res =  $object->addline($object->id,$label, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,-1, TSubtotal::$module_number);
24
+			else if ($object->element == 'commande') $res = $object->addline($object->id, $label, 0, $qty, 0, 0, 0, 0, 0, 0, 0, 'HT', 0, '', '', 9, -1, TSubtotal::$module_number);
25 25
 
26 26
 		}
27 27
 		else {
28 28
 			$desc = '';
29
-			if ((float) DOL_VERSION < 6  || $qty==50) {
29
+			if ((float) DOL_VERSION < 6 || $qty == 50) {
30 30
 				$desc = $label;
31 31
 				$label = '';
32 32
 			}
@@ -34,40 +34,40 @@  discard block
 block discarded – undo
34 34
 			/**
35 35
 			 * @var $object Facture
36 36
 			 */
37
-			if($object->element=='facture') $res =  $object->addline($desc, 0,$qty,0,0,0,0,0,'','',0,0,'','HT',0,9,$rang, TSubtotal::$module_number, '', 0, 0, null, 0, $label);
37
+			if ($object->element == 'facture') $res = $object->addline($desc, 0, $qty, 0, 0, 0, 0, 0, '', '', 0, 0, '', 'HT', 0, 9, $rang, TSubtotal::$module_number, '', 0, 0, null, 0, $label);
38 38
 			/**
39 39
 			 * @var $object Facture fournisseur
40 40
 			 */
41
-			else if($object->element=='invoice_supplier') {
41
+			else if ($object->element == 'invoice_supplier') {
42 42
 			    $object->special_code = TSubtotal::$module_number;
43 43
 			    $rang = $object->line_max() + 1;
44
-			    if($qty==50) $res = $object->addline($desc,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang);
45
-			    else $res = $object->addline($label,0,0,0,0,$qty,0,0,'','',0,0,'HT',9,$rang);
44
+			    if ($qty == 50) $res = $object->addline($desc, 0, 0, 0, 0, $qty, 0, 0, '', '', 0, 0, 'HT', 9, $rang);
45
+			    else $res = $object->addline($label, 0, 0, 0, 0, $qty, 0, 0, '', '', 0, 0, 'HT', 9, $rang);
46 46
 			}
47 47
 			/**
48 48
 			 * @var $object Propal
49 49
 			 */
50
-			else if($object->element=='propal') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label);
50
+			else if ($object->element == 'propal') $res = $object->addline($desc, 0, $qty, 0, 0, 0, 0, 0, 'HT', 0, 0, 9, $rang, TSubtotal::$module_number, 0, 0, 0, $label);
51 51
 			/**
52 52
 			 * @var $object Propal Fournisseur
53 53
 			 */
54
-			else if($object->element=='supplier_proposal') $res = $object->addline($desc, 0,$qty,0,0,0,0,0,'HT',0,0,9,$rang, TSubtotal::$module_number, 0, 0, 0, $label);
54
+			else if ($object->element == 'supplier_proposal') $res = $object->addline($desc, 0, $qty, 0, 0, 0, 0, 0, 'HT', 0, 0, 9, $rang, TSubtotal::$module_number, 0, 0, 0, $label);
55 55
 			
56 56
 			/**
57 57
 			 * @var $object Commande
58 58
 			 */
59
-			else if($object->element=='commande') $res =  $object->addline($desc, 0,$qty,0,0,0,0,0,0,0,'HT',0,'','',9,$rang, TSubtotal::$module_number, 0, null, 0, $label);
59
+			else if ($object->element == 'commande') $res = $object->addline($desc, 0, $qty, 0, 0, 0, 0, 0, 0, 0, 'HT', 0, '', '', 9, $rang, TSubtotal::$module_number, 0, null, 0, $label);
60 60
 			/**
61 61
 			 * @var $object Commande fournisseur
62 62
 			 */
63
-			else if($object->element=='order_supplier') {
63
+			else if ($object->element == 'order_supplier') {
64 64
 			    $object->special_code = TSubtotal::$module_number;
65
-			    $res = $object->addline($label, 0,$qty,0,0,0,0,0,'',0,'HT', 0, 9);
65
+			    $res = $object->addline($label, 0, $qty, 0, 0, 0, 0, 0, '', 0, 'HT', 0, 9);
66 66
 			}
67 67
 			/**
68 68
 			 * @var $object Facturerec
69 69
 			 */
70
-			else if($object->element=='facturerec') $res =  $object->addline($desc, 0,$qty, 0, 0, 0, 0, 0, 'HT', 0, '', 0, 9, $rang, TSubtotal::$module_number,$label); 
70
+			else if ($object->element == 'facturerec') $res = $object->addline($desc, 0, $qty, 0, 0, 0, 0, 0, 'HT', 0, '', 0, 9, $rang, TSubtotal::$module_number, $label); 
71 71
 			
72 72
 		}
73 73
 	
@@ -78,20 +78,20 @@  discard block
 block discarded – undo
78 78
 
79 79
 	public static function generateDoc(&$object)
80 80
 	{
81
-		global $conf,$langs,$db;
81
+		global $conf, $langs, $db;
82 82
 		
83 83
 		if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
84 84
 		{
85
-			$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
86
-			$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
87
-			$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
85
+			$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
86
+			$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
87
+			$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
88 88
 			
89 89
 			// Define output language
90 90
 			$outputlangs = $langs;
91 91
 			$newlang = GETPOST('lang_id', 'alpha');
92
-			if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang))
92
+			if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang))
93 93
 				$newlang = !empty($object->client) ? $object->client->default_lang : $object->thirdparty->default_lang;
94
-			if (! empty($newlang)) {
94
+			if (!empty($newlang)) {
95 95
 				$outputlangs = new Translate("", $conf);
96 96
 				$outputlangs->setDefaultLang($newlang);
97 97
 			}
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 			}
106 106
 			else
107 107
 			{
108
-				if ($object->element!= 'facturerec') $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
108
+				if ($object->element != 'facturerec') $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
109 109
 			}
110 110
 		}
111 111
 	}
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
 	 * @param type $rang_start
118 118
 	 * @param type $move_to
119 119
 	 */
120
-	public static function updateRang(&$object, $rang_start, $move_to=1)
120
+	public static function updateRang(&$object, $rang_start, $move_to = 1)
121 121
 	{
122 122
 		if (!class_exists('GenericObject')) require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
123 123
 		
124
-		$row=new GenericObject($object->db);
124
+		$row = new GenericObject($object->db);
125 125
 		$row->table_element_line = $object->table_element_line;
126 126
 		$row->fk_element = $object->fk_element;
127 127
 		$row->id = $object->id;
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 		{
131 131
 			if ($line->rang < $rang_start) continue;
132 132
 			
133
-			$row->updateRangOfLine($line->id, $line->rang+$move_to);
133
+			$row->updateRangOfLine($line->id, $line->rang + $move_to);
134 134
 		}
135 135
 	}
136 136
 	
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 			{
160 160
 				if ($rang_to_add != -1) self::updateRang($object, $rang_to_add);
161 161
 				
162
-				self::addSubTotalLine($object, $langs->trans('SubTotal'), 100-$title_niveau, $rang_to_add);
162
+				self::addSubTotalLine($object, $langs->trans('SubTotal'), 100 - $title_niveau, $rang_to_add);
163 163
 				
164 164
 				$object->lines[] = $object->line; // ajout de la ligne dans le tableau de ligne (Dolibarr ne le fait pas)
165 165
 				if ($rang_to_add != -1) 
@@ -171,14 +171,14 @@  discard block
 block discarded – undo
171 171
 		}
172 172
 	}
173 173
 	
174
-	public static function addTitle(&$object, $label, $level, $rang=-1)
174
+	public static function addTitle(&$object, $label, $level, $rang = -1)
175 175
 	{
176 176
 		self::addSubTotalLine($object, $label, $level, $rang);
177 177
 	}
178 178
 	
179
-	public static function addTotal(&$object, $label, $level, $rang=-1)
179
+	public static function addTotal(&$object, $label, $level, $rang = -1)
180 180
 	{
181
-		self::addSubTotalLine($object, $label, (100-$level), $rang);
181
+		self::addSubTotalLine($object, $label, (100 - $level), $rang);
182 182
 	}
183 183
 
184 184
 	/**
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	 * 
190 190
 	 * @return array
191 191
 	 */
192
-	public static function getAllTitleWithoutTotalFromDocument(&$object, $get_block_total=false)
192
+	public static function getAllTitleWithoutTotalFromDocument(&$object, $get_block_total = false)
193 193
 	{
194 194
 		$TTitle = self::getAllTitleFromDocument($object, $get_block_total);
195 195
 		
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	 * @param boolean								$return_rang_on_false	si true alors renvoi le rang où devrait ce trouver le sous-total
211 211
 	 * @return boolean
212 212
 	 */
213
-	public static function titleHasTotalLine(&$object, &$title_line, $strict_mode=false, $return_rang_on_false=false)
213
+	public static function titleHasTotalLine(&$object, &$title_line, $strict_mode = false, $return_rang_on_false = false)
214 214
 	{
215 215
 		if (empty($object->lines) || !is_array($object->lines)) return false;
216 216
 		
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 		return ($return_rang_on_false) ? -1 : false;
237 237
 	}
238 238
 	
239
-	public static function getAllTitleFromDocument(&$object, $get_block_total=false)
239
+	public static function getAllTitleFromDocument(&$object, $get_block_total = false)
240 240
 	{
241 241
 		$TRes = array();
242 242
 		if (!empty($object->lines))
@@ -356,10 +356,10 @@  discard block
 block discarded – undo
356 356
 		return false;
357 357
 	}
358 358
 	
359
-	public static function isTitle(&$line, $level=-1)
359
+	public static function isTitle(&$line, $level = -1)
360 360
 	{
361 361
 		$res = $line->special_code == self::$module_number && $line->product_type == 9 && $line->qty <= 9;
362
-		if($res && $level > -1) {
362
+		if ($res && $level > -1) {
363 363
 			return $line->qty == $level;
364 364
 		} else return $res;
365 365
 		
@@ -380,43 +380,43 @@  discard block
 block discarded – undo
380 380
 		return self::isTitle($line) || self::isSubtotal($line) || self::isFreeText($line);
381 381
 	}
382 382
 
383
-	public static function getFreeTextHtml(&$line, $readonly=0)
383
+	public static function getFreeTextHtml(&$line, $readonly = 0)
384 384
 	{
385 385
 		global $conf;
386 386
 		
387 387
 		// Copie du fichier "objectline_edit.tpl.php"
388 388
 		// editeur wysiwyg
389 389
 		require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
390
-		$nbrows=ROWS_2;
391
-		if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT;
392
-		$enable=(isset($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0);
393
-		$toolbarname='dolibarr_details';
394
-		if (! empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname='dolibarr_notes';
395
-		$text = !empty($line->description)?$line->description:$line->label;
396
-		$doleditor=new DolEditor('line-description',$text,'',164,$toolbarname,'',false,true,$enable,$nbrows,'98%', $readonly);
390
+		$nbrows = ROWS_2;
391
+		if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT;
392
+		$enable = (isset($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0);
393
+		$toolbarname = 'dolibarr_details';
394
+		if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS_FULL)) $toolbarname = 'dolibarr_notes';
395
+		$text = !empty($line->description) ? $line->description : $line->label;
396
+		$doleditor = new DolEditor('line-description', $text, '', 164, $toolbarname, '', false, true, $enable, $nbrows, '98%', $readonly);
397 397
 		return $doleditor->Create(1);
398 398
 	}
399 399
 	
400
-	public static function duplicateLines(&$object, $lineid, $withBlockLine=false)
400
+	public static function duplicateLines(&$object, $lineid, $withBlockLine = false)
401 401
 	{
402
-		global $db,$user,$conf;
402
+		global $db, $user, $conf;
403 403
 
404 404
 		$createRight = $user->rights->{$object->element}->creer;
405
-		if($object->element == 'facturerec' )
405
+		if ($object->element == 'facturerec')
406 406
 		{
407 407
 		    $object->statut = 0; // hack for facture rec
408 408
 		    $createRight = $user->rights->facture->creer;
409 409
 		}
410
-		elseif($object->element == 'order_supplier' )
410
+		elseif ($object->element == 'order_supplier')
411 411
 		{
412 412
 		    $createRight = $user->rights->fournisseur->commande->creer;
413 413
 		}
414
-		elseif($object->element == 'invoice_supplier' )
414
+		elseif ($object->element == 'invoice_supplier')
415 415
 		{
416 416
 		    $createRight = $user->rights->fournisseur->facture->creer;
417 417
 		}
418 418
 		
419
-		if ($object->statut == 0  && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK))
419
+		if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK))
420 420
 		{
421 421
 			dol_include_once('/subtotal/lib/subtotal.lib.php');
422 422
 			
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 						case 'order_supplier':
450 450
 						    $object->line = $line;
451 451
 						    $object->line->fk_commande = $object->id;
452
-						    $object->line->rang = $object->line_max() +1;
452
+						    $object->line->rang = $object->line_max() + 1;
453 453
 						    $res = $object->line->insert(1);
454 454
 							break;
455 455
 							
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 					{
490 490
 						$object->line_from = $line;
491 491
 						// Call trigger
492
-						$result=$object->call_trigger('LINE_DUPLICATE',$user); // $object->line
492
+						$result = $object->call_trigger('LINE_DUPLICATE', $user); // $object->line
493 493
 						if ($result < 0)
494 494
 						{
495 495
 							$object->db->rollback();
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
 		}
520 520
 	}
521 521
 	
522
-	public static function getLinesFromTitle(&$object, $key_trad, $level=1, $under_title='', $withBlockLine=false, $key_is_id=false)
522
+	public static function getLinesFromTitle(&$object, $key_trad, $level = 1, $under_title = '', $withBlockLine = false, $key_is_id = false)
523 523
 	{
524 524
 		global $langs;
525 525
 		
@@ -531,17 +531,17 @@  discard block
 block discarded – undo
531 531
 		
532 532
 		$TLine = array();
533 533
 		$add_line = false;
534
-		$under_title_found=false;
534
+		$under_title_found = false;
535 535
 		
536 536
 		foreach ($object->lines as $key => &$line)
537 537
 		{
538 538
 			if (!$under_title_found && !empty($TTitle_under_search))
539 539
 			{
540
-				if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search)) ) $under_title_found = true;
540
+				if ($line->product_type == 9 && (in_array($line->desc, $TTitle_under_search) || in_array($line->label, $TTitle_under_search))) $under_title_found = true;
541 541
 			}
542 542
 			else
543 543
 			{
544
-				if ( ($key_is_id && $line->id == $key_trad) || (!$key_is_id && $line->product_type == 9 && $line->qty == $level && (in_array($line->desc, $TTitle_search) || in_array($line->label, $TTitle_search) )))
544
+				if (($key_is_id && $line->id == $key_trad) || (!$key_is_id && $line->product_type == 9 && $line->qty == $level && (in_array($line->desc, $TTitle_search) || in_array($line->label, $TTitle_search))))
545 545
 				{
546 546
 					if ($key_is_id) $level = $line->qty;
547 547
 					
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 					if ($withBlockLine) $TLine[] = $line;
550 550
 					continue;
551 551
 				}
552
-				elseif ($add_line && $line->product_type == 9 && (100 - $line->qty == $level) ) // Si on tombe sur un sous-total, il faut que ce soit un du même niveau que le titre
552
+				elseif ($add_line && $line->product_type == 9 && (100 - $line->qty == $level)) // Si on tombe sur un sous-total, il faut que ce soit un du même niveau que le titre
553 553
 				{
554 554
 					if ($withBlockLine) $TLine[] = $line;
555 555
 					break;
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 				
558 558
 				if ($add_line)
559 559
 				{
560
-					if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line)) ) continue;
560
+					if (!$withBlockLine && (self::isTitle($line) || self::isSubtotal($line))) continue;
561 561
 					else $TLine[] = $line;
562 562
 				}
563 563
 			}
@@ -566,12 +566,12 @@  discard block
 block discarded – undo
566 566
 		return $TLine;
567 567
 	}
568 568
 	
569
-	public static function getLinesFromTitleId(&$object, $lineid, $withBlockLine=false)
569
+	public static function getLinesFromTitleId(&$object, $lineid, $withBlockLine = false)
570 570
 	{
571 571
 		return self::getLinesFromTitle($object, $lineid, '', '', $withBlockLine, true);
572 572
 	}
573 573
 	
574
-	public static function doUpdateLine(&$object, $rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $type, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $situation_percent=0, $fk_unit = null, $notrigger = 0)
574
+	public static function doUpdateLine(&$object, $rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $type, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $situation_percent = 0, $fk_unit = null, $notrigger = 0)
575 575
 	{
576 576
 		$res = 0;
577 577
 		$object->db->begin();
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
 		        break;
584 584
 		        
585 585
 		    case 'supplier_proposal':
586
-		        $res = $object->updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $desc, $price_base_type, $info_bits, $special_code, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $type, $array_options,'', $fk_unit);
586
+		        $res = $object->updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $desc, $price_base_type, $info_bits, $special_code, $fk_parent_line, $skip_update_total, $fk_fournprice, $pa_ht, $label, $type, $array_options, '', $fk_unit);
587 587
 		        break;
588 588
 		        
589 589
 			case 'commande':
@@ -612,9 +612,9 @@  discard block
 block discarded – undo
612 612
 				$factureRecLine->fetch($rowid);
613 613
 				$factureRecLine->array_options = $array_options;
614 614
 				$factureRecLine->insertExtraFields();
615
-				$rang=$factureRecLine->rang;
615
+				$rang = $factureRecLine->rang;
616 616
 				
617
-				$fk_product=0; $fk_remise_except=''; $pu_ttc=0;	
617
+				$fk_product = 0; $fk_remise_except = ''; $pu_ttc = 0;	
618 618
 				$res = $object->updateline($rowid, $desc, $pu, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $price_base_type, $info_bits, $fk_remise_except, $pu_ttc, $type, $rang, $special_code, $label, $fk_unit);
619 619
 				break;
620 620
 		}
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 		global $db, $object;
631 631
 		
632 632
 		$TTitle = array();
633
-		if(! empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {}
633
+		if (!empty($object->id) && in_array($object->element, array('propal', 'commande', 'facture'))) {}
634 634
 		else {
635 635
 			if ($origin_line->element == 'propaldet')
636 636
 			{
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
 	 */
711 711
 	public static function addRecapPage(&$parameters, &$origin_pdf)
712 712
 	{
713
-		global $user,$conf,$langs;
713
+		global $user, $conf, $langs;
714 714
 		
715 715
 		$origin_file = $parameters['file'];
716 716
 		$outputlangs = $parameters['outputlangs'];
@@ -726,21 +726,21 @@  discard block
 block discarded – undo
726 726
 		$objmarge->marge_droite = 10;
727 727
 		
728 728
 		$objectref = dol_sanitizeFileName($object->ref);
729
-		if ($object->element == 'propal') $dir = $conf->propal->dir_output . '/' . $objectref;
730
-		elseif ($object->element == 'commande') $dir = $conf->commande->dir_output . '/' . $objectref;
731
-		elseif ($object->element == 'facture') $dir = $conf->facture->dir_output . '/' . $objectref;
729
+		if ($object->element == 'propal') $dir = $conf->propal->dir_output.'/'.$objectref;
730
+		elseif ($object->element == 'commande') $dir = $conf->commande->dir_output.'/'.$objectref;
731
+		elseif ($object->element == 'facture') $dir = $conf->facture->dir_output.'/'.$objectref;
732 732
 		elseif ($object->element == 'facturerec') return; // no PDF for facturerec
733 733
 		else
734 734
 		{
735 735
 			setEventMessage($langs->trans('warning_subtotal_recap_object_element_unknown', $object->element), 'warnings');
736 736
 			return -1;
737 737
 		}
738
-		$file = $dir . '/' . $objectref . '_recap.pdf';
738
+		$file = $dir.'/'.$objectref.'_recap.pdf';
739 739
 
740 740
 //		$pdf=pdf_getInstance($origin_pdf->format);
741
-		$pdf=pdf_getInstance(array(210, 297)); // Format A4 Portrait
742
-		$default_font_size = pdf_getPDFFontSize($outputlangs);	// Must be after pdf_getInstance
743
-		$pdf->SetAutoPageBreak(1,0);
741
+		$pdf = pdf_getInstance(array(210, 297)); // Format A4 Portrait
742
+		$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
743
+		$pdf->SetAutoPageBreak(1, 0);
744 744
 	             
745 745
 		if (class_exists('TCPDF'))
746 746
 		{
@@ -749,49 +749,49 @@  discard block
 block discarded – undo
749 749
 		}
750 750
 		$pdf->SetFont(pdf_getPDFFont($outputlangs));
751 751
 		// Set path to the background PDF File
752
-		if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
752
+		if (empty($conf->global->MAIN_DISABLE_FPDI) && !empty($conf->global->MAIN_ADD_PDF_BACKGROUND))
753 753
 		{
754 754
 			$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND);
755 755
 			$tplidx = $pdf->importPage(1);
756 756
 		}
757 757
 
758 758
 		$pdf->Open();
759
-		$pagenb=0;
760
-		$pdf->SetDrawColor(128,128,128);
759
+		$pagenb = 0;
760
+		$pdf->SetDrawColor(128, 128, 128);
761 761
 
762 762
 		$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
763 763
 		$pdf->SetSubject($outputlangs->transnoentities("subtotalRecap"));
764 764
 		$pdf->SetCreator("Dolibarr ".DOL_VERSION);
765 765
 		$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
766 766
 		$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("subtotalRecap")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
767
-		if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
767
+		if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
768 768
 
769
-		$pdf->SetMargins($objmarge->marge_gauche, $objmarge->marge_haute, $objmarge->marge_droite);   // Left, Top, Right
769
+		$pdf->SetMargins($objmarge->marge_gauche, $objmarge->marge_haute, $objmarge->marge_droite); // Left, Top, Right
770 770
 
771
-		$pagenb=0;
772
-		$pdf->SetDrawColor(128,128,128);
771
+		$pagenb = 0;
772
+		$pdf->SetDrawColor(128, 128, 128);
773 773
 
774 774
 			
775 775
 		// New page
776 776
 		$pdf->AddPage();
777
-		if (! empty($tplidx)) $pdf->useTemplate($tplidx);
777
+		if (!empty($tplidx)) $pdf->useTemplate($tplidx);
778 778
 		$pagenb++;
779 779
 		
780 780
 		
781 781
 		self::pagehead($objmarge, $pdf, $object, 1, $outputlangs);
782
-		$pdf->SetFont('','', $default_font_size - 1);
783
-		$pdf->MultiCell(0, 3, '');		// Set interline to 3
784
-		$pdf->SetTextColor(0,0,0);
782
+		$pdf->SetFont('', '', $default_font_size - 1);
783
+		$pdf->MultiCell(0, 3, ''); // Set interline to 3
784
+		$pdf->SetTextColor(0, 0, 0);
785 785
 		
786
-		$heightforinfotot = 25;	// Height reserved to output the info and total part
787
-		$heightforfooter = $objmarge->marge_basse + 8;	// Height reserved to output the footer (value include bottom margin)
786
+		$heightforinfotot = 25; // Height reserved to output the info and total part
787
+		$heightforfooter = $objmarge->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
788 788
 		
789 789
 		$posx_designation = 25;
790 790
 		$posx_options = 150;
791 791
 		$posx_montant = 170;
792 792
 		
793 793
 		$tab_top = 72;
794
-		$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?72:20); // TODO à vérifier
794
+		$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 72 : 20); // TODO à vérifier
795 795
 		
796 796
 		$TTot = array('total_ht' => 0, 'total_ttc' => 0, 'TTotal_tva' => array());
797 797
 		
@@ -805,14 +805,14 @@  discard block
 block discarded – undo
805 805
 			$nexY = $tab_top + 10;
806 806
 			
807 807
 			$nblignes = count($TLine);
808
-			foreach($TLine as $i => &$line)
808
+			foreach ($TLine as $i => &$line)
809 809
 			{
810 810
 				$curY = $nexY;
811 811
 				
812 812
 				if (self::getNiveau($line) == 1) 
813 813
 				{
814
-					$pdf->SetFont('','B', $default_font_size - 1);   // Into loop to work with multipage
815
-					$curY+=2;
814
+					$pdf->SetFont('', 'B', $default_font_size - 1); // Into loop to work with multipage
815
+					$curY += 2;
816 816
 					
817 817
 					$TTot['total_ht'] += $line->total_ht;
818 818
 					$TTot['total_tva'] += $line->total_tva;
@@ -831,67 +831,67 @@  discard block
 block discarded – undo
831 831
 						$TTot['TTotal_tva_multicurrency'][$tx] += $amount;
832 832
 					}	
833 833
 				}
834
-				else $pdf->SetFont('','', $default_font_size - 1);   // Into loop to work with multipage
834
+				else $pdf->SetFont('', '', $default_font_size - 1); // Into loop to work with multipage
835 835
 				
836
-				$pdf->SetTextColor(0,0,0);
836
+				$pdf->SetTextColor(0, 0, 0);
837 837
 				
838 838
 				$pdf->setTopMargin($tab_top_newpage + 10);
839
-				$pdf->setPageOrientation('', 1, $heightforfooter+$heightforinfotot);	// The only function to edit the bottom margin of current page to set it.
840
-				$pageposbefore=$pdf->getPage();
839
+				$pdf->setPageOrientation('', 1, $heightforfooter + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
840
+				$pageposbefore = $pdf->getPage();
841 841
 				
842
-				$showpricebeforepagebreak=1;
842
+				$showpricebeforepagebreak = 1;
843 843
 				
844 844
 				$decalage = (self::getNiveau($line) - 1) * 2;
845 845
 				
846 846
 				// Print: Designation
847 847
 				$label = $line->label;
848
-				if( (float)DOL_VERSION < 6 ) {
848
+				if ((float) DOL_VERSION < 6) {
849 849
 					$label = !empty($line->label) ? $line->label : $line->desc;
850 850
 				}
851 851
 				
852 852
 				
853 853
 				$pdf->startTransaction();
854
-				$pdf->writeHTMLCell($posx_options-$posx_designation-$decalage, 3, $posx_designation+$decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J',true);
855
-				$pageposafter=$pdf->getPage();
854
+				$pdf->writeHTMLCell($posx_options - $posx_designation - $decalage, 3, $posx_designation + $decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J', true);
855
+				$pageposafter = $pdf->getPage();
856 856
 				if ($pageposafter > $pageposbefore)	// There is a pagebreak
857 857
 				{
858 858
 					$pdf->rollbackTransaction(true);
859
-					$pageposafter=$pageposbefore;
859
+					$pageposafter = $pageposbefore;
860 860
 					//print $pageposafter.'-'.$pageposbefore;exit;
861
-					$pdf->setPageOrientation('', 1, $heightforfooter);	// The only function to edit the bottom margin of current page to set it.
862
-					$pdf->writeHTMLCell($posx_options-$posx_designation-$decalage, 3, $posx_designation+$decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J',true);
861
+					$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
862
+					$pdf->writeHTMLCell($posx_options - $posx_designation - $decalage, 3, $posx_designation + $decalage, $curY, $outputlangs->convToOutputCharset($label), 0, 1, false, true, 'J', true);
863 863
 
864
-					$pageposafter=$pdf->getPage();
865
-					$posyafter=$pdf->GetY();
864
+					$pageposafter = $pdf->getPage();
865
+					$posyafter = $pdf->GetY();
866 866
 					//var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit;
867
-					if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter+$heightforinfotot)))	// There is no space left for total+free text
867
+					if ($posyafter > ($objmarge->page_hauteur - ($heightforfooter + $heightforinfotot)))	// There is no space left for total+free text
868 868
 					{
869
-						if ($i == ($nblignes-1))	// No more lines, and no space left to show total, so we create a new page
869
+						if ($i == ($nblignes - 1))	// No more lines, and no space left to show total, so we create a new page
870 870
 						{
871
-							$pdf->AddPage('','',true);
872
-							if (! empty($tplidx)) $pdf->useTemplate($tplidx);
871
+							$pdf->AddPage('', '', true);
872
+							if (!empty($tplidx)) $pdf->useTemplate($tplidx);
873 873
 							if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs);
874
-							$pdf->setPage($pageposafter+1);
874
+							$pdf->setPage($pageposafter + 1);
875 875
 						}
876 876
 					}
877 877
 					else
878 878
 					{
879 879
 						// We found a page break
880
-						$showpricebeforepagebreak=0;
880
+						$showpricebeforepagebreak = 0;
881 881
 					}
882 882
 				}
883 883
 				else	// No pagebreak
884 884
 				{
885 885
 					$pdf->commitTransaction();
886 886
 				}
887
-				$posYAfterDescription=$pdf->GetY();
887
+				$posYAfterDescription = $pdf->GetY();
888 888
 
889 889
 				$nexY = $pdf->GetY();
890
-				$pageposafter=$pdf->getPage();
890
+				$pageposafter = $pdf->getPage();
891 891
 
892 892
 				$pdf->setPage($pageposbefore);
893 893
 				$pdf->setTopMargin($objmarge->marge_haute);
894
-				$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
894
+				$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
895 895
 
896 896
 				// We suppose that a too long description or photo were moved completely on next page
897 897
 				if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
@@ -904,14 +904,14 @@  discard block
 block discarded – undo
904 904
 				if (!empty($line->total_options))
905 905
 				{
906 906
 					$pdf->SetXY($posx_options, $curY);
907
-					$pdf->MultiCell($posx_montant-$posx_options-0.8, 3, price($line->total_options, 0, $outputlangs), 0, 'R', 0);
907
+					$pdf->MultiCell($posx_montant - $posx_options - 0.8, 3, price($line->total_options, 0, $outputlangs), 0, 'R', 0);
908 908
 				}
909 909
 				
910 910
 				// Print: Montant
911 911
 				$pdf->SetXY($posx_montant, $curY);
912
-				$pdf->MultiCell($objmarge->page_largeur-$objmarge->marge_droite-$posx_montant-0.8, 3, price($line->total_ht, 0, $outputlangs), 0, 'R', 0);
912
+				$pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant - 0.8, 3, price($line->total_ht, 0, $outputlangs), 0, 'R', 0);
913 913
 				
914
-				$nexY+=2;    // Passe espace entre les lignes
914
+				$nexY += 2; // Passe espace entre les lignes
915 915
 
916 916
 				// Detect if some page were added automatically and output _tableau for past pages
917 917
 				while ($pagenb < $pageposafter)
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
 					
929 929
 					$pagenb++;
930 930
 					$pdf->setPage($pagenb);
931
-					$pdf->setPageOrientation('', 1, 0);	// The only function to edit the bottom margin of current page to set it.
931
+					$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
932 932
 					if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) self::pagehead($objmarge, $pdf, $object, 0, $outputlangs);
933 933
 				}
934 934
 			}
@@ -938,19 +938,19 @@  discard block
 block discarded – undo
938 938
 		if ($pagenb == 1)
939 939
 		{
940 940
 			self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $objmarge->page_hauteur - $tab_top - $heightforinfotot - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code);
941
-			$bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1;
941
+			$bottomlasttab = $objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1;
942 942
 		}
943 943
 		else
944 944
 		{
945 945
 			self::tableau($objmarge, $pdf, $posx_designation, $posx_options, $posx_montant, $tab_top_newpage, $objmarge->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code);
946
-			$bottomlasttab=$objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1;
946
+			$bottomlasttab = $objmarge->page_hauteur - $heightforinfotot - $heightforfooter + 1;
947 947
 		}
948 948
 		
949 949
 		// Affiche zone totaux
950
-		$posy=self::tableau_tot($objmarge, $pdf, $object, $bottomlasttab, $outputlangs, $TTot);
950
+		$posy = self::tableau_tot($objmarge, $pdf, $object, $bottomlasttab, $outputlangs, $TTot);
951 951
 		
952 952
 		$pdf->Close();
953
-		$pdf->Output($file,'F');
953
+		$pdf->Output($file, 'F');
954 954
 		
955 955
 		$pagecount = self::concat($outputlangs, array($origin_file, $file), $origin_file);
956 956
 		
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
 		$level = $line->qty; // TODO à améliorer
963 963
 		
964 964
 		$pdf->SetXY($objmarge->marge_gauche, $curY);
965
-		$pdf->MultiCell($posx_designation-$objmarge->marge_gauche-0.8, 5, $level, 0, 'L', 0);
965
+		$pdf->MultiCell($posx_designation - $objmarge->marge_gauche - 0.8, 5, $level, 0, 'L', 0);
966 966
 	}
967 967
 	
968 968
 	/**
@@ -976,50 +976,50 @@  discard block
 block discarded – undo
976 976
 	 */
977 977
 	private static function pagehead(&$objmarge, &$pdf, &$object, $showdetail, $outputlangs)
978 978
 	{
979
-		global $conf,$mysoc;
979
+		global $conf, $mysoc;
980 980
 
981 981
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
982 982
 
983
-		pdf_pagehead($pdf,$outputlangs,$objmarge->page_hauteur);
983
+		pdf_pagehead($pdf, $outputlangs, $objmarge->page_hauteur);
984 984
 
985
-		$pdf->SetTextColor(0,0,60);
986
-		$pdf->SetFont('','B', $default_font_size + 3);
985
+		$pdf->SetTextColor(0, 0, 60);
986
+		$pdf->SetFont('', 'B', $default_font_size + 3);
987 987
 
988
-		$posy=$objmarge->marge_haute;
989
-		$posx=$objmarge->page_largeur-$objmarge->marge_droite-100;
988
+		$posy = $objmarge->marge_haute;
989
+		$posx = $objmarge->page_largeur - $objmarge->marge_droite - 100;
990 990
 		
991
-		$pdf->SetXY($objmarge->marge_gauche,$posy);
991
+		$pdf->SetXY($objmarge->marge_gauche, $posy);
992 992
 
993
-		$logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
993
+		$logo = $conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
994 994
 		if ($mysoc->logo)
995 995
 		{
996 996
 			if (is_readable($logo))
997 997
 			{
998
-			    $height=pdf_getHeightForLogo($logo);
999
-			    $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height);	// width=0 (auto)
998
+			    $height = pdf_getHeightForLogo($logo);
999
+			    $pdf->Image($logo, $objmarge->marge_gauche, $posy, 0, $height); // width=0 (auto)
1000 1000
 			}
1001 1001
 			else
1002 1002
 			{
1003
-				$pdf->SetTextColor(200,0,0);
1004
-				$pdf->SetFont('','B',$default_font_size - 2);
1005
-				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
1003
+				$pdf->SetTextColor(200, 0, 0);
1004
+				$pdf->SetFont('', 'B', $default_font_size - 2);
1005
+				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
1006 1006
 				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
1007 1007
 			}
1008 1008
 			
1009
-			$posy+=35;
1009
+			$posy += 35;
1010 1010
 		}
1011 1011
 		else
1012 1012
 		{
1013
-			$text=$mysoc->name;
1013
+			$text = $mysoc->name;
1014 1014
 			$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
1015 1015
 			
1016
-			$posy+=15;
1016
+			$posy += 15;
1017 1017
 		}
1018 1018
 		
1019 1019
 		
1020
-		$pdf->SetTextColor(0,0,0);
1021
-		$pdf->SetFont('','B', $default_font_size + 2);
1022
-		$pdf->SetXY($objmarge->marge_gauche,$posy);
1020
+		$pdf->SetTextColor(0, 0, 0);
1021
+		$pdf->SetFont('', 'B', $default_font_size + 2);
1022
+		$pdf->SetXY($objmarge->marge_gauche, $posy);
1023 1023
 		
1024 1024
 		$key = 'subtotalPropalTitle';
1025 1025
 		if ($object->element == 'commande') $key = 'subtotalCommandeTitle';
@@ -1028,14 +1028,14 @@  discard block
 block discarded – undo
1028 1028
 		
1029 1029
 		$pdf->MultiCell(150, 4, $outputlangs->transnoentities($key, $object->ref, $object->thirdparty->name), '', 'L');
1030 1030
 		
1031
-		$pdf->SetFont('','', $default_font_size);
1032
-		$pdf->SetXY($objmarge->page_largeur-$objmarge->marge_droite-40,$posy);
1031
+		$pdf->SetFont('', '', $default_font_size);
1032
+		$pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - 40, $posy);
1033 1033
 		$pdf->MultiCell(40, 4, dol_print_date($object->date, 'daytext'), '', 'R');
1034 1034
 		
1035 1035
 		$posy += 8;
1036 1036
 			
1037
-		$pdf->SetFont('','B', $default_font_size + 2);
1038
-		$pdf->SetXY($objmarge->marge_gauche,$posy);
1037
+		$pdf->SetFont('', 'B', $default_font_size + 2);
1038
+		$pdf->SetXY($objmarge->marge_gauche, $posy);
1039 1039
 		$pdf->MultiCell(70, 4, $outputlangs->transnoentities('subtotalRecapLot'), '', 'L');
1040 1040
 		
1041 1041
 	}
@@ -1053,44 +1053,44 @@  discard block
 block discarded – undo
1053 1053
 	 *   @param		string		$currency		Currency code
1054 1054
 	 *   @return	void
1055 1055
 	 */
1056
-	private static function tableau(&$objmarge, &$pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='')
1056
+	private static function tableau(&$objmarge, &$pdf, $posx_designation, $posx_options, $posx_montant, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
1057 1057
 	{
1058 1058
 		global $conf;
1059 1059
 		
1060 1060
 		// Force to disable hidetop and hidebottom
1061
-		$hidebottom=0;
1062
-		if ($hidetop) $hidetop=-1;
1061
+		$hidebottom = 0;
1062
+		if ($hidetop) $hidetop = -1;
1063 1063
 
1064 1064
 		$currency = !empty($currency) ? $currency : $conf->currency;
1065 1065
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
1066 1066
 
1067 1067
 		// Amount in (at tab_top - 1)
1068
-		$pdf->SetTextColor(0,0,0);
1069
-		$pdf->SetFont('','',$default_font_size);
1068
+		$pdf->SetTextColor(0, 0, 0);
1069
+		$pdf->SetFont('', '', $default_font_size);
1070 1070
 
1071 1071
 		if (empty($hidetop))
1072 1072
 		{
1073
-			$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency));
1074
-			$pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4.5);
1073
+			$titre = $outputlangs->transnoentities("AmountInCurrency", $outputlangs->transnoentitiesnoconv("Currency".$currency));
1074
+			$pdf->SetXY($objmarge->page_largeur - $objmarge->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top - 4.5);
1075 1075
 			$pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre);
1076 1076
 			
1077
-			if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur-$objmarge->marge_droite-$objmarge->marge_gauche, 8, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
1077
+			if (!empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur - $objmarge->marge_droite - $objmarge->marge_gauche, 8, 'F', null, explode(',', $conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR));
1078 1078
 			
1079 1079
 			
1080
-			$pdf->line($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur-$objmarge->marge_droite, $tab_top);	// line prend une position y en 2eme param et 4eme param
1080
+			$pdf->line($objmarge->marge_gauche, $tab_top, $objmarge->page_largeur - $objmarge->marge_droite, $tab_top); // line prend une position y en 2eme param et 4eme param
1081 1081
 
1082
-			$pdf->SetXY($posx_designation, $tab_top+2);
1083
-			$pdf->MultiCell($posx_options - $posx_designation,2, $outputlangs->transnoentities("Designation"),'','L');
1084
-			$pdf->SetXY($posx_options, $tab_top+2);
1085
-			$pdf->MultiCell($posx_montant - $posx_options,2, $outputlangs->transnoentities("Options"),'','R');
1086
-			$pdf->SetXY($posx_montant, $tab_top+2);
1087
-			$pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant,2, $outputlangs->transnoentities("Amount"),'','R');
1082
+			$pdf->SetXY($posx_designation, $tab_top + 2);
1083
+			$pdf->MultiCell($posx_options - $posx_designation, 2, $outputlangs->transnoentities("Designation"), '', 'L');
1084
+			$pdf->SetXY($posx_options, $tab_top + 2);
1085
+			$pdf->MultiCell($posx_montant - $posx_options, 2, $outputlangs->transnoentities("Options"), '', 'R');
1086
+			$pdf->SetXY($posx_montant, $tab_top + 2);
1087
+			$pdf->MultiCell($objmarge->page_largeur - $objmarge->marge_droite - $posx_montant, 2, $outputlangs->transnoentities("Amount"), '', 'R');
1088 1088
 			
1089
-			$pdf->line($objmarge->marge_gauche, $tab_top+8, $objmarge->page_largeur-$objmarge->marge_droite, $tab_top+8);	// line prend une position y en 2eme param et 4eme param
1089
+			$pdf->line($objmarge->marge_gauche, $tab_top + 8, $objmarge->page_largeur - $objmarge->marge_droite, $tab_top + 8); // line prend une position y en 2eme param et 4eme param
1090 1090
 		}
1091 1091
 		else
1092 1092
 		{
1093
-			$pdf->line($objmarge->marge_gauche, $tab_top-2, $objmarge->page_largeur-$objmarge->marge_droite, $tab_top-2);	// line prend une position y en 2eme param et 4eme param
1093
+			$pdf->line($objmarge->marge_gauche, $tab_top - 2, $objmarge->page_largeur - $objmarge->marge_droite, $tab_top - 2); // line prend une position y en 2eme param et 4eme param
1094 1094
 		}
1095 1095
 		
1096 1096
 	}
@@ -1099,29 +1099,29 @@  discard block
 block discarded – undo
1099 1099
 	{
1100 1100
 		global $conf;
1101 1101
 		
1102
-		$pdf->line($objmarge->marge_gauche, $posy, $objmarge->page_largeur-$objmarge->marge_droite, $posy);	// line prend une position y en 2eme param et 4eme param
1102
+		$pdf->line($objmarge->marge_gauche, $posy, $objmarge->page_largeur - $objmarge->marge_droite, $posy); // line prend une position y en 2eme param et 4eme param
1103 1103
 		
1104 1104
 		$default_font_size = pdf_getPDFFontSize($outputlangs);
1105 1105
 		
1106
-		$tab2_top = $posy+2;
1106
+		$tab2_top = $posy + 2;
1107 1107
 		$tab2_hl = 4;
1108
-		$pdf->SetFont('','', $default_font_size - 1);
1108
+		$pdf->SetFont('', '', $default_font_size - 1);
1109 1109
 
1110 1110
 		// Tableau total
1111 1111
 		$col1x = 120; $col2x = 170;
1112 1112
 		if ($objmarge->page_largeur < 210) // To work with US executive format
1113 1113
 		{
1114
-			$col2x-=20;
1114
+			$col2x -= 20;
1115 1115
 		}
1116 1116
 		$largcol2 = ($objmarge->page_largeur - $objmarge->marge_droite - $col2x);
1117 1117
 
1118
-		$useborder=0;
1118
+		$useborder = 0;
1119 1119
 		$index = 0;
1120 1120
 
1121 1121
 		// Total HT
1122
-		$pdf->SetFillColor(255,255,255);
1122
+		$pdf->SetFillColor(255, 255, 255);
1123 1123
 		$pdf->SetXY($col1x, $tab2_top + 0);
1124
-		$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
1124
+		$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
1125 1125
 
1126 1126
 		// $total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1) ? $TTot['multicurrency_total_ht'] : $TTot['total_ht'];
1127 1127
 		$total_ht = $TTot['total_ht'];
@@ -1129,10 +1129,10 @@  discard block
 block discarded – undo
1129 1129
 		$pdf->MultiCell($largcol2, $tab2_hl, price($total_ht, 0, $outputlangs), 0, 'R', 1);
1130 1130
 
1131 1131
 		// Show VAT by rates and total
1132
-		$pdf->SetFillColor(248,248,248);
1132
+		$pdf->SetFillColor(248, 248, 248);
1133 1133
 		
1134
-		$atleastoneratenotnull=0;
1135
-		foreach($TTot['TTotal_tva'] as $tvakey => $tvaval)
1134
+		$atleastoneratenotnull = 0;
1135
+		foreach ($TTot['TTotal_tva'] as $tvakey => $tvaval)
1136 1136
 		{
1137 1137
 			if ($tvakey != 0)    // On affiche pas taux 0
1138 1138
 			{
@@ -1141,15 +1141,15 @@  discard block
 block discarded – undo
1141 1141
 				$index++;
1142 1142
 				$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1143 1143
 
1144
-				$tvacompl='';
1145
-				if (preg_match('/\*/',$tvakey))
1144
+				$tvacompl = '';
1145
+				if (preg_match('/\*/', $tvakey))
1146 1146
 				{
1147
-					$tvakey=str_replace('*','',$tvakey);
1147
+					$tvakey = str_replace('*', '', $tvakey);
1148 1148
 					$tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")";
1149 1149
 				}
1150
-				$totalvat =$outputlangs->transnoentities("TotalVAT").' ';
1151
-				$totalvat.=vatrate($tvakey,1).$tvacompl;
1152
-				$pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1150
+				$totalvat = $outputlangs->transnoentities("TotalVAT").' ';
1151
+				$totalvat .= vatrate($tvakey, 1).$tvacompl;
1152
+				$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
1153 1153
 
1154 1154
 				$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1155 1155
 				$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1);
@@ -1159,16 +1159,16 @@  discard block
 block discarded – undo
1159 1159
 		// Total TTC
1160 1160
 		$index++;
1161 1161
 		$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
1162
-		$pdf->SetTextColor(0,0,60);
1163
-		$pdf->SetFillColor(224,224,224);
1164
-		$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
1162
+		$pdf->SetTextColor(0, 0, 60);
1163
+		$pdf->SetFillColor(224, 224, 224);
1164
+		$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1);
1165 1165
 
1166 1166
 		// $total_ttc = ($conf->multicurrency->enabled && $object->multiccurency_tx != 1) ? $TTot['multicurrency_total_ttc'] : $TTot['total_ttc'];
1167 1167
 		$total_ttc = $TTot['total_ttc'];
1168 1168
 		$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
1169 1169
 		$pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc, 0, $outputlangs), $useborder, 'R', 1);
1170 1170
 
1171
-		$pdf->SetTextColor(0,0,0);
1171
+		$pdf->SetTextColor(0, 0, 0);
1172 1172
 				
1173 1173
 		$index++;
1174 1174
 		return ($tab2_top + ($tab2_hl * $index));
@@ -1187,22 +1187,22 @@  discard block
 block discarded – undo
1187 1187
 	 * @param	int		$hidebottom		Hide bottom
1188 1188
 	 * @return	void
1189 1189
 	 */
1190
-    private static function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
1190
+    private static function printRect($pdf, $x, $y, $l, $h, $hidetop = 0, $hidebottom = 0)
1191 1191
     {
1192
-	    if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y);
1193
-	    $pdf->line($x+$l, $y, $x+$l, $y+$h);
1194
-	    if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h);
1195
-	    $pdf->line($x, $y+$h, $x, $y);
1192
+	    if (empty($hidetop) || $hidetop == -1) $pdf->line($x, $y, $x + $l, $y);
1193
+	    $pdf->line($x + $l, $y, $x + $l, $y + $h);
1194
+	    if (empty($hidebottom)) $pdf->line($x + $l, $y + $h, $x, $y + $h);
1195
+	    $pdf->line($x, $y + $h, $x, $y);
1196 1196
     }
1197 1197
 	
1198 1198
 	
1199
-	public static function concat(&$outputlangs, $files, $fileoutput='')
1199
+	public static function concat(&$outputlangs, $files, $fileoutput = '')
1200 1200
 	{
1201 1201
 		global $conf;
1202 1202
 		
1203 1203
 		if (empty($fileoutput)) $fileoutput = $file[0];
1204 1204
 		
1205
-		$pdf=pdf_getInstance();
1205
+		$pdf = pdf_getInstance();
1206 1206
         if (class_exists('TCPDF'))
1207 1207
         {
1208 1208
             $pdf->setPrintHeader(false);
@@ -1210,10 +1210,10 @@  discard block
 block discarded – undo
1210 1210
         }
1211 1211
         $pdf->SetFont(pdf_getPDFFont($outputlangs));
1212 1212
 
1213
-        if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
1213
+        if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
1214 1214
 
1215 1215
 		
1216
-		foreach($files as $file)
1216
+		foreach ($files as $file)
1217 1217
 		{
1218 1218
 			$pagecount = $pdf->setSourceFile($file);
1219 1219
 			for ($i = 1; $i <= $pagecount; $i++)
@@ -1225,8 +1225,8 @@  discard block
 block discarded – undo
1225 1225
 			}
1226 1226
 		}
1227 1227
 		
1228
-		$pdf->Output($fileoutput,'F');
1229
-		if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK));
1228
+		$pdf->Output($fileoutput, 'F');
1229
+		if (!empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK));
1230 1230
 
1231 1231
 		return $pagecount;
1232 1232
 	}
@@ -1239,7 +1239,7 @@  discard block
 block discarded – undo
1239 1239
 	 */
1240 1240
 	public static function hasNcTitle(&$line)
1241 1241
 	{
1242
-		if(isset($line->has_nc_title)) return $line->has_nc_title;
1242
+		if (isset($line->has_nc_title)) return $line->has_nc_title;
1243 1243
 
1244 1244
 		$TTitle = self::getAllTitleFromLine($line);
1245 1245
 		foreach ($TTitle as &$line_title)
Please login to merge, or discard this patch.
script/maj_subtotal_nc.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,19 +13,19 @@
 block discarded – undo
13 13
 $sql = 'SELECT rowid';
14 14
 $sql .= ' FROM '.MAIN_DB_PREFIX.'propal';
15 15
 $sql .= ' WHERE total_ht + tva != total';
16
-if(! empty($limit)) $sql .= ' LIMIT '.$limit;
16
+if (!empty($limit)) $sql .= ' LIMIT '.$limit;
17 17
 
18 18
 $resql = $db->query($sql);
19
-if($resql) {
19
+if ($resql) {
20 20
 	$db->begin();
21
-	while($obj = $db->fetch_object($resql)) {
21
+	while ($obj = $db->fetch_object($resql)) {
22 22
 		$propal = new Propal($db);
23 23
 		var_dump($obj->rowid);
24 24
 		$propal->fetch($obj->rowid);
25 25
 
26
-		foreach($propal->lines as &$l) {
27
-			if(empty($l->array_options)) $l->fetch_optionals();
28
-			if(! empty($l->array_options['options_subtotal_nc']) && ! TSubtotal::isModSubtotalLine($l)) {
26
+		foreach ($propal->lines as &$l) {
27
+			if (empty($l->array_options)) $l->fetch_optionals();
28
+			if (!empty($l->array_options['options_subtotal_nc']) && !TSubtotal::isModSubtotalLine($l)) {
29 29
 				_updateLineNC($propal->element, $propal->id, $l->id, $l->array_options['options_subtotal_nc']);
30 30
 			}
31 31
 		}
Please login to merge, or discard this patch.
core/modules/modSubtotal.class.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  * 	\ingroup	titre
24 24
  * 	\brief		Description and activation file for module titre
25 25
  */
26
-include_once DOL_DOCUMENT_ROOT . "/core/modules/DolibarrModules.class.php";
26
+include_once DOL_DOCUMENT_ROOT."/core/modules/DolibarrModules.class.php";
27 27
 
28 28
 /**
29 29
  * Description and activation class for module titre
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         $this->version = '3.1.1';
67 67
         // Key used in llx_const table to save module status enabled/disabled
68 68
         // (where MYMODULE is value of property name of module in uppercase)
69
-        $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
69
+        $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
70 70
         // Where to store the module in setup page
71 71
         // (0=common,1=interface,2=others,3=very specific)
72 72
         $this->special = 2;
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
             // Set this to relative path of css if module has its own css file
97 97
             //'css' => '/titre/css/mycss.css.php',
98 98
             // Set here all hooks context managed by module
99
-            'hooks' => array('invoicecard', 'invoicesuppliercard','propalcard', 'supplier_proposalcard', 'ordercard', 'ordersuppliercard','odtgeneration','orderstoinvoice','admin','invoicereccard','consumptionthirdparty')
99
+            'hooks' => array('invoicecard', 'invoicesuppliercard', 'propalcard', 'supplier_proposalcard', 'ordercard', 'ordersuppliercard', 'odtgeneration', 'orderstoinvoice', 'admin', 'invoicereccard', 'consumptionthirdparty')
100 100
             // Set here all workflow context managed by module
101 101
             //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE'))
102 102
         );
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         // List of modules id that must be enabled if this module is enabled
114 114
         $this->depends = array();
115 115
 
116
-		$this->conflictwith=array('modMilestone');
116
+		$this->conflictwith = array('modMilestone');
117 117
         // List of modules id to disable if this one is disabled
118 118
         $this->requiredby = array();
119 119
         // Minimum version of PHP required by module
@@ -178,20 +178,20 @@  discard block
 block discarded – undo
178 178
         // 'categories_x'		to add a tab in category view
179 179
         // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
180 180
         // Dictionnaries
181
-        if (! isset($conf->subtotal->enabled)) {
182
-            $conf->subtotal=new stdClass();
181
+        if (!isset($conf->subtotal->enabled)) {
182
+            $conf->subtotal = new stdClass();
183 183
             $conf->subtotal->enabled = 0;
184 184
         }
185 185
         $this->dictionaries = array(
186 186
 			'langs'=>'subtotal@subtotal',
187
-            'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'),		// List of tables we want to see into dictonnary editor
188
-            'tablib'=>array($langs->trans('subtotalFreeLineDictionary')),													// Label of tables
189
-            'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity),	// Request to select fields
190
-            'tabsqlsort'=>array('label ASC'),																					// Sort order
191
-            'tabfield'=>array('label,content'),							// List of fields (result of select to show dictionary)
192
-            'tabfieldvalue'=>array('label,content'),						// List of fields (list of fields to edit a record)
193
-            'tabfieldinsert'=>array('label,content,entity'),					// List of fields (list of fields for insert)
194
-            'tabrowid'=>array('rowid'),											// Name of columns with primary key (try to always name it 'rowid')
187
+            'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor
188
+            'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables
189
+            'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity), // Request to select fields
190
+            'tabsqlsort'=>array('label ASC'), // Sort order
191
+            'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary)
192
+            'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record)
193
+            'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert)
194
+            'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid')
195 195
             'tabcond'=>array($conf->subtotal->enabled)	
196 196
 		);
197 197
         /* Example:
Please login to merge, or discard this patch.
core/triggers/interface_90_modSubtotal_subtotaltrigger.class.php 1 patch
Spacing   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
 			if ($object->id != $line->id && $line->rang > $rang)
108 108
 			{
109 109
 				// Update du rang de toutes les lignes suivant mon titre
110
-				$parent->updateRangOfLine($line->id, $line->rang+1);
110
+				$parent->updateRangOfLine($line->id, $line->rang + 1);
111 111
 			}
112 112
 		}
113 113
 		
114 114
 		// Update du rang de la ligne fraichement ajouté pour la déplacer sous mon titre
115
-		$parent->updateRangOfLine($object->id, $rang+1);
116
-		$object->rang = $rang+1;
115
+		$parent->updateRangOfLine($object->id, $rang + 1);
116
+		$object->rang = $rang + 1;
117 117
 	}
118 118
 	
119 119
 	public function addToEnd(&$parent, &$object, $rang)
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 			
137 137
 			if ($subtotal_line_found)
138 138
 			{
139
-				$parent->updateRangOfLine($line->id, $line->rang+1);
139
+				$parent->updateRangOfLine($line->id, $line->rang + 1);
140 140
 			}
141 141
 		}
142 142
 		
@@ -258,10 +258,10 @@  discard block
 block discarded – undo
258 258
 		{
259 259
 			$doli_action = GETPOST('action');
260 260
 			$set = GETPOST('set');
261
-			if ( (in_array($doli_action, array('updateligne', 'updateline', 'addline', 'add', 'create')) || $set == 'defaultTVA') && !TSubtotal::isTitle($object) && !TSubtotal::isSubtotal($object) && in_array($object->element, array('propaldet', 'commandedet', 'facturedet')))
261
+			if ((in_array($doli_action, array('updateligne', 'updateline', 'addline', 'add', 'create')) || $set == 'defaultTVA') && !TSubtotal::isTitle($object) && !TSubtotal::isSubtotal($object) && in_array($object->element, array('propaldet', 'commandedet', 'facturedet')))
262 262
 			{
263 263
 				 dol_syslog(
264
-					"[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". object=".$object->element." id=" . $object->id
264
+					"[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". object=".$object->element." id=".$object->id
265 265
 				);
266 266
 				 
267 267
 				$TTitle = TSubtotal::getAllTitleFromLine($object);
@@ -281,9 +281,9 @@  discard block
 block discarded – undo
281 281
 				}
282 282
 
283 283
 				// $object correspond à la ligne ajoutée
284
-				if(empty($object->array_options)) $object->fetch_optionals();
284
+				if (empty($object->array_options)) $object->fetch_optionals();
285 285
 
286
-				if(! empty($object->array_options['options_subtotal_nc'])) {
286
+				if (!empty($object->array_options['options_subtotal_nc'])) {
287 287
 					$object->total_ht = $object->total_tva = $object->total_ttc = $object->total_localtax1 = $object->total_localtax2 = 
288 288
 							$object->multicurrency_total_ht = $object->multicurrency_total_tva = $object->multicurrency_total_ttc = 0;
289 289
 
@@ -295,11 +295,11 @@  discard block
 block discarded – undo
295 295
 
296 296
 				// Correction d'un bug lors de la création d'une commande depuis une propale qui a, au moins, une ligne NC
297 297
 				$parent_element = '';
298
-				if($object->element == 'propaldet') $parent_element = 'propal';
299
-				if($object->element == 'commandedet') $parent_element = 'commande';
300
-				if($object->element == 'facturedet') $parent_element = 'facture';
298
+				if ($object->element == 'propaldet') $parent_element = 'propal';
299
+				if ($object->element == 'commandedet') $parent_element = 'commande';
300
+				if ($object->element == 'facturedet') $parent_element = 'facture';
301 301
 
302
-				if(! empty($parent_element) && ! empty($object->array_options['options_subtotal_nc'])) {
302
+				if (!empty($parent_element) && !empty($object->array_options['options_subtotal_nc'])) {
303 303
 					_updateLineNC($parent_element, $object->{'fk_'.$parent_element}, $object->id, $object->array_options['options_subtotal_nc'], 1);
304 304
 				}
305 305
 			}
@@ -307,12 +307,12 @@  discard block
 block discarded – undo
307 307
 		
308 308
 		// Les lignes libres (y compris les sous-totaux) créées à partir d'une facture modèle n'ont pas la TVA de la ligne du modèle mais la TVA par défaut
309 309
 		if ($action == 'BILL_CREATE' && $object->fac_rec > 0) {
310
-			dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id);
310
+			dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
311 311
 
312 312
 			$object->fetch_lines(); // Lignes pas rajoutées à $object->lines par les appels à addline();
313 313
 
314
-			foreach($object->lines as &$line) {
315
-				if(TSubtotal::isSubtotal($line) && ! empty($line->tva_tx)) {
314
+			foreach ($object->lines as &$line) {
315
+				if (TSubtotal::isSubtotal($line) && !empty($line->tva_tx)) {
316 316
 					$line->tva_tx = 0;
317 317
 					$line->update();
318 318
 				}
@@ -322,170 +322,170 @@  discard block
 block discarded – undo
322 322
         
323 323
         if ($action == 'USER_LOGIN') {
324 324
             dol_syslog(
325
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
325
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
326 326
             );
327 327
         } elseif ($action == 'USER_UPDATE_SESSION') {
328 328
             // Warning: To increase performances, this action is triggered only if
329 329
             // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1.
330 330
             dol_syslog(
331
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
331
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
332 332
             );
333 333
         } elseif ($action == 'USER_CREATE') {
334 334
             dol_syslog(
335
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
335
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
336 336
             );
337 337
         } elseif ($action == 'USER_CREATE_FROM_CONTACT') {
338 338
             dol_syslog(
339
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
339
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
340 340
             );
341 341
         } elseif ($action == 'USER_MODIFY') {
342 342
             dol_syslog(
343
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
343
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
344 344
             );
345 345
         } elseif ($action == 'USER_NEW_PASSWORD') {
346 346
             dol_syslog(
347
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
347
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
348 348
             );
349 349
         } elseif ($action == 'USER_ENABLEDISABLE') {
350 350
             dol_syslog(
351
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
351
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
352 352
             );
353 353
         } elseif ($action == 'USER_DELETE') {
354 354
             dol_syslog(
355
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
355
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
356 356
             );
357 357
         } elseif ($action == 'USER_LOGOUT') {
358 358
             dol_syslog(
359
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
359
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
360 360
             );
361 361
         } elseif ($action == 'USER_SETINGROUP') {
362 362
             dol_syslog(
363
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
363
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
364 364
             );
365 365
         } elseif ($action == 'USER_REMOVEFROMGROUP') {
366 366
             dol_syslog(
367
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
367
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
368 368
             );
369 369
         }
370 370
 
371 371
         // Groups
372 372
         elseif ($action == 'GROUP_CREATE') {
373 373
             dol_syslog(
374
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
374
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
375 375
             );
376 376
         } elseif ($action == 'GROUP_MODIFY') {
377 377
             dol_syslog(
378
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
378
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
379 379
             );
380 380
         } elseif ($action == 'GROUP_DELETE') {
381 381
             dol_syslog(
382
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
382
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
383 383
             );
384 384
         }
385 385
 
386 386
         // Companies
387 387
         elseif ($action == 'COMPANY_CREATE') {
388 388
             dol_syslog(
389
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
389
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
390 390
             );
391 391
         } elseif ($action == 'COMPANY_MODIFY') {
392 392
             dol_syslog(
393
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
393
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
394 394
             );
395 395
         } elseif ($action == 'COMPANY_DELETE') {
396 396
             dol_syslog(
397
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
397
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
398 398
             );
399 399
         }
400 400
 
401 401
         // Contacts
402 402
         elseif ($action == 'CONTACT_CREATE') {
403 403
             dol_syslog(
404
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
404
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
405 405
             );
406 406
         } elseif ($action == 'CONTACT_MODIFY') {
407 407
             dol_syslog(
408
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
408
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
409 409
             );
410 410
         } elseif ($action == 'CONTACT_DELETE') {
411 411
             dol_syslog(
412
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
412
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
413 413
             );
414 414
         }
415 415
 
416 416
         // Products
417 417
         elseif ($action == 'PRODUCT_CREATE') {
418 418
             dol_syslog(
419
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
419
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
420 420
             );
421 421
         } elseif ($action == 'PRODUCT_MODIFY') {
422 422
             dol_syslog(
423
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
423
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
424 424
             );
425 425
         } elseif ($action == 'PRODUCT_DELETE') {
426 426
             dol_syslog(
427
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
427
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
428 428
             );
429 429
         }
430 430
 
431 431
         // Customer orders
432 432
         elseif ($action == 'ORDER_CREATE') {
433 433
             dol_syslog(
434
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
434
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
435 435
             );
436 436
         } elseif ($action == 'ORDER_VALIDATE') {
437 437
             dol_syslog(
438
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
438
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
439 439
             );
440 440
         } elseif ($action == 'ORDER_DELETE') {
441 441
             dol_syslog(
442
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
442
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
443 443
             );
444 444
         } elseif ($action == 'ORDER_BUILDDOC') {
445 445
             dol_syslog(
446
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
446
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
447 447
             );
448 448
         } elseif ($action == 'ORDER_SENTBYMAIL') {
449 449
             dol_syslog(
450
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
450
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
451 451
             );
452 452
         } elseif ($action == 'LINEORDER_INSERT') {
453 453
             dol_syslog(
454
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
454
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
455 455
             );
456 456
         } elseif ($action == 'LINEORDER_DELETE') {
457 457
             dol_syslog(
458
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
458
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
459 459
             );
460 460
         }
461 461
 
462 462
         // Supplier orders
463 463
         elseif ($action == 'ORDER_SUPPLIER_CREATE') {
464 464
             dol_syslog(
465
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
465
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
466 466
             );
467 467
         } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') {
468 468
             dol_syslog(
469
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
469
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
470 470
             );
471 471
         } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') {
472 472
             dol_syslog(
473
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
473
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
474 474
             );
475 475
         } elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') {
476 476
             dol_syslog(
477
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
477
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
478 478
             );
479 479
         }
480 480
 
481 481
         // Proposals
482 482
         elseif ($action == 'PROPAL_CREATE') {
483 483
             dol_syslog(
484
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
484
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
485 485
             );
486 486
         } elseif (in_array($action, array('PROPAL_CLONE', 'ORDER_CLONE', 'BILL_CLONE'))) {
487 487
             dol_syslog(
488
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
488
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
489 489
             );
490 490
 			
491 491
 			$doli_action = GETPOST('action');
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 			if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && in_array($doli_action, array('confirm_clone')))
494 494
 			{
495 495
 				dol_syslog(
496
-					"[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". object=".$object->element." id=" . $object->id
496
+					"[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". object=".$object->element." id=".$object->id
497 497
 				);
498 498
 				
499 499
 				// En fonction de l'objet et de la version, les lignes conservent l'id de l'objet d'origine
@@ -521,272 +521,272 @@  discard block
 block discarded – undo
521 521
 			
522 522
         } elseif ($action == 'PROPAL_MODIFY') {
523 523
             dol_syslog(
524
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
524
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
525 525
             );
526 526
         } elseif ($action == 'PROPAL_VALIDATE') {
527 527
             dol_syslog(
528
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
528
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
529 529
             );
530 530
         } elseif ($action == 'PROPAL_BUILDDOC') {
531 531
             dol_syslog(
532
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
532
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
533 533
             );
534 534
         } elseif ($action == 'PROPAL_SENTBYMAIL') {
535 535
             dol_syslog(
536
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
536
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
537 537
             );
538 538
         } elseif ($action == 'PROPAL_CLOSE_SIGNED') {
539 539
             dol_syslog(
540
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
540
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
541 541
             );
542 542
         } elseif ($action == 'PROPAL_CLOSE_REFUSED') {
543 543
             dol_syslog(
544
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
544
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
545 545
             );
546 546
         } elseif ($action == 'PROPAL_DELETE') {
547 547
             dol_syslog(
548
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
548
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
549 549
             );
550 550
         } elseif ($action == 'LINEPROPAL_INSERT') {
551 551
             dol_syslog(
552
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
552
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
553 553
             );
554 554
         } elseif ($action == 'LINEPROPAL_MODIFY') {
555 555
             dol_syslog(
556
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
556
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
557 557
             );
558 558
         } elseif ($action == 'LINEPROPAL_DELETE') {
559 559
             dol_syslog(
560
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
560
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
561 561
             );
562 562
         }
563 563
 
564 564
         // Contracts
565 565
         elseif ($action == 'CONTRACT_CREATE') {
566 566
             dol_syslog(
567
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
567
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
568 568
             );
569 569
         } elseif ($action == 'CONTRACT_MODIFY') {
570 570
             dol_syslog(
571
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
571
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
572 572
             );
573 573
         } elseif ($action == 'CONTRACT_ACTIVATE') {
574 574
             dol_syslog(
575
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
575
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
576 576
             );
577 577
         } elseif ($action == 'CONTRACT_CANCEL') {
578 578
             dol_syslog(
579
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
579
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
580 580
             );
581 581
         } elseif ($action == 'CONTRACT_CLOSE') {
582 582
             dol_syslog(
583
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
583
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
584 584
             );
585 585
         } elseif ($action == 'CONTRACT_DELETE') {
586 586
             dol_syslog(
587
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
587
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
588 588
             );
589 589
         }
590 590
 
591 591
 		elseif ($action == 'BILL_MODIFY') {
592 592
             dol_syslog(
593
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
593
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
594 594
             );
595 595
         } elseif ($action == 'BILL_VALIDATE') {
596 596
             dol_syslog(
597
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
597
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
598 598
             );
599 599
         } elseif ($action == 'BILL_BUILDDOC') {
600 600
             dol_syslog(
601
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
601
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
602 602
             );
603 603
         } elseif ($action == 'BILL_SENTBYMAIL') {
604 604
             dol_syslog(
605
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
605
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
606 606
             );
607 607
         } elseif ($action == 'BILL_CANCEL') {
608 608
             dol_syslog(
609
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
609
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
610 610
             );
611 611
         } elseif ($action == 'BILL_DELETE') {
612 612
             dol_syslog(
613
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
613
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
614 614
             );
615 615
         } elseif ($action == 'LINEBILL_INSERT') {
616 616
 				
617 617
         	dol_syslog(
618
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
618
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
619 619
             );
620 620
         } elseif ($action == 'LINEBILL_DELETE') {
621 621
             dol_syslog(
622
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
622
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
623 623
             );
624 624
         }
625 625
 
626 626
         // Payments
627 627
         elseif ($action == 'PAYMENT_CUSTOMER_CREATE') {
628 628
             dol_syslog(
629
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
629
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
630 630
             );
631 631
         } elseif ($action == 'PAYMENT_SUPPLIER_CREATE') {
632 632
             dol_syslog(
633
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
633
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
634 634
             );
635 635
         } elseif ($action == 'PAYMENT_ADD_TO_BANK') {
636 636
             dol_syslog(
637
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
637
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
638 638
             );
639 639
         } elseif ($action == 'PAYMENT_DELETE') {
640 640
             dol_syslog(
641
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
641
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
642 642
             );
643 643
         }
644 644
 
645 645
         // Interventions
646 646
         elseif ($action == 'FICHEINTER_CREATE') {
647 647
             dol_syslog(
648
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
648
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
649 649
             );
650 650
         } elseif ($action == 'FICHEINTER_MODIFY') {
651 651
             dol_syslog(
652
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
652
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
653 653
             );
654 654
         } elseif ($action == 'FICHEINTER_VALIDATE') {
655 655
             dol_syslog(
656
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
656
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
657 657
             );
658 658
         } elseif ($action == 'FICHEINTER_DELETE') {
659 659
             dol_syslog(
660
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
660
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
661 661
             );
662 662
         }
663 663
 
664 664
         // Members
665 665
         elseif ($action == 'MEMBER_CREATE') {
666 666
             dol_syslog(
667
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
667
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
668 668
             );
669 669
         } elseif ($action == 'MEMBER_VALIDATE') {
670 670
             dol_syslog(
671
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
671
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
672 672
             );
673 673
         } elseif ($action == 'MEMBER_SUBSCRIPTION') {
674 674
             dol_syslog(
675
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
675
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
676 676
             );
677 677
         } elseif ($action == 'MEMBER_MODIFY') {
678 678
             dol_syslog(
679
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
679
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
680 680
             );
681 681
         } elseif ($action == 'MEMBER_NEW_PASSWORD') {
682 682
             dol_syslog(
683
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
683
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
684 684
             );
685 685
         } elseif ($action == 'MEMBER_RESILIATE') {
686 686
             dol_syslog(
687
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
687
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
688 688
             );
689 689
         } elseif ($action == 'MEMBER_DELETE') {
690 690
             dol_syslog(
691
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
691
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
692 692
             );
693 693
         }
694 694
 
695 695
         // Categories
696 696
         elseif ($action == 'CATEGORY_CREATE') {
697 697
             dol_syslog(
698
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
698
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
699 699
             );
700 700
         } elseif ($action == 'CATEGORY_MODIFY') {
701 701
             dol_syslog(
702
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
702
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
703 703
             );
704 704
         } elseif ($action == 'CATEGORY_DELETE') {
705 705
             dol_syslog(
706
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
706
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
707 707
             );
708 708
         }
709 709
 
710 710
         // Projects
711 711
         elseif ($action == 'PROJECT_CREATE') {
712 712
             dol_syslog(
713
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
713
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
714 714
             );
715 715
         } elseif ($action == 'PROJECT_MODIFY') {
716 716
             dol_syslog(
717
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
717
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
718 718
             );
719 719
         } elseif ($action == 'PROJECT_DELETE') {
720 720
             dol_syslog(
721
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
721
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
722 722
             );
723 723
         }
724 724
 
725 725
         // Project tasks
726 726
         elseif ($action == 'TASK_CREATE') {
727 727
             dol_syslog(
728
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
728
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
729 729
             );
730 730
         } elseif ($action == 'TASK_MODIFY') {
731 731
             dol_syslog(
732
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
732
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
733 733
             );
734 734
         } elseif ($action == 'TASK_DELETE') {
735 735
             dol_syslog(
736
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
736
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
737 737
             );
738 738
         }
739 739
 
740 740
         // Task time spent
741 741
         elseif ($action == 'TASK_TIMESPENT_CREATE') {
742 742
             dol_syslog(
743
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
743
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
744 744
             );
745 745
         } elseif ($action == 'TASK_TIMESPENT_MODIFY') {
746 746
             dol_syslog(
747
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
747
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
748 748
             );
749 749
         } elseif ($action == 'TASK_TIMESPENT_DELETE') {
750 750
             dol_syslog(
751
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
751
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
752 752
             );
753 753
         }
754 754
 
755 755
         // Shipping
756 756
         elseif ($action == 'SHIPPING_CREATE') {
757 757
             dol_syslog(
758
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
758
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
759 759
             );
760 760
         } elseif ($action == 'SHIPPING_MODIFY') {
761 761
             dol_syslog(
762
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
762
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
763 763
             );
764 764
         } elseif ($action == 'SHIPPING_VALIDATE') {
765 765
             dol_syslog(
766
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
766
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
767 767
             );
768 768
         } elseif ($action == 'SHIPPING_SENTBYMAIL') {
769 769
             dol_syslog(
770
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
770
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
771 771
             );
772 772
         } elseif ($action == 'SHIPPING_DELETE') {
773 773
             dol_syslog(
774
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
774
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
775 775
             );
776 776
         } elseif ($action == 'SHIPPING_BUILDDOC') {
777 777
             dol_syslog(
778
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
778
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
779 779
             );
780 780
         }
781 781
 
782 782
         // File
783 783
         elseif ($action == 'FILE_UPLOAD') {
784 784
             dol_syslog(
785
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
785
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
786 786
             );
787 787
         } elseif ($action == 'FILE_DELETE') {
788 788
             dol_syslog(
789
-                "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
789
+                "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
790 790
             );
791 791
         }
792 792
 
Please login to merge, or discard this patch.