Completed
Push — master ( f50dd8...4e6d28 )
by
unknown
12s queued 11s
created
lib/subtotal.lib.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -25,25 +25,25 @@  discard block
 block discarded – undo
25 25
 
26 26
 function subtotalAdminPrepareHead()
27 27
 {
28
-    global $langs, $conf;
28
+	global $langs, $conf;
29 29
 
30
-    $langs->load("subtotal@subtotal");
30
+	$langs->load("subtotal@subtotal");
31 31
 
32
-    $h = 0;
33
-    $head = array();
32
+	$h = 0;
33
+	$head = array();
34 34
 
35
-    $head[$h][0] = dol_buildpath("/subtotal/admin/subtotal_setup.php", 1);
36
-    $head[$h][1] = $langs->trans("Parameters");
37
-    $head[$h][2] = 'settings';
38
-    $h++;
39
-    $head[$h][0] = dol_buildpath("/subtotal/admin/subtotal_about.php", 1);
40
-    $head[$h][1] = $langs->trans("About");
41
-    $head[$h][2] = 'about';
42
-    $h++;
35
+	$head[$h][0] = dol_buildpath("/subtotal/admin/subtotal_setup.php", 1);
36
+	$head[$h][1] = $langs->trans("Parameters");
37
+	$head[$h][2] = 'settings';
38
+	$h++;
39
+	$head[$h][0] = dol_buildpath("/subtotal/admin/subtotal_about.php", 1);
40
+	$head[$h][1] = $langs->trans("About");
41
+	$head[$h][2] = 'about';
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
-    return $head;
46
+	return $head;
47 47
 }
48 48
 
49 49
 function getHtmlSelectTitle(&$object, $showLabel=false)
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
 	$label = GETPOST('line-title');
131 131
 	$description = ($line->qty>90) ? '' : GETPOST('line-description');
132 132
 	$pagebreak = (int) GETPOST('line-pagebreak');
133
-    $showTotalHT = (int) GETPOST('line-showTotalHT');
134
-    $showReduc = (int) GETPOST('line-showReduc');
133
+	$showTotalHT = (int) GETPOST('line-showTotalHT');
134
+	$showReduc = (int) GETPOST('line-showReduc');
135 135
 
136 136
 	$level = GETPOST('subtotal_level', 'int');
137 137
 	if (!empty($level))
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
 		if ($line->qty > 90) $line->qty = 100 - $level; // Si on edit une ligne sous-total
140 140
 		else $line->qty = $level;
141 141
 	}
142
-    $line->array_options['options_show_total_ht'] = $showTotalHT;
143
-    $line->array_options['options_show_reduc'] = $showReduc;
142
+	$line->array_options['options_show_total_ht'] = $showTotalHT;
143
+	$line->array_options['options_show_reduc'] = $showReduc;
144 144
 	
145 145
 	$res = TSubtotal::doUpdateLine($object, $line->id, $description, 0, $line->qty, 0, '', '', 0, 9, 0, 0, 'HT', $pagebreak, 0, 1, null, 0, $label, TSubtotal::$module_number, $line->array_options);
146 146
 
@@ -246,17 +246,17 @@  discard block
 block discarded – undo
246 246
 			$classname = ucfirst($element);
247 247
 			
248 248
 			switch ($element) {
249
-			    case 'supplier_proposal':
250
-			        $classname = 'SupplierProposal';
251
-			        break;
249
+				case 'supplier_proposal':
250
+					$classname = 'SupplierProposal';
251
+					break;
252 252
 			        
253
-			    case 'order_supplier':
254
-			        $classname = 'CommandeFournisseur';
255
-			        break;
253
+				case 'order_supplier':
254
+					$classname = 'CommandeFournisseur';
255
+					break;
256 256
 			        
257
-			    case 'invoice_supplier':
258
-			        $classname = 'FactureFournisseur';
259
-			        break;
257
+				case 'invoice_supplier':
258
+					$classname = 'FactureFournisseur';
259
+					break;
260 260
 			}
261 261
 			
262 262
 			$object = new $classname($db); // Propal | Commande | Facture
@@ -329,14 +329,14 @@  discard block
 block discarded – undo
329 329
 		else $res = $line->update($user, $notrigger);
330 330
 	}
331 331
 	else {
332
-	    if(in_array($object->element, array('invoice_supplier', 'order_supplier', 'supplier_proposal'))) {
333
-	        if(empty($line->label)) $line->label = $line->description; // supplier lines don't have the field label
332
+		if(in_array($object->element, array('invoice_supplier', 'order_supplier', 'supplier_proposal'))) {
333
+			if(empty($line->label)) $line->label = $line->description; // supplier lines don't have the field label
334 334
 	        
335
-	        require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
336
-	        $extrafields=new ExtraFields($object->db);
337
-	        $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true);
338
-	        $line->fetch_optionals($line->id,$extralabels);
339
-	    }
335
+			require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
336
+			$extrafields=new ExtraFields($object->db);
337
+			$extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true);
338
+			$line->fetch_optionals($line->id,$extralabels);
339
+		}
340 340
 		$line->array_options['options_subtotal_nc'] = 0;
341 341
 		if($object->element == 'order_supplier') $line->update($user);
342 342
 		$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);
Please login to merge, or discard this patch.
core/modules/modSubtotal.class.php 1 patch
Indentation   +387 added lines, -387 removed lines patch added patch discarded remove patch
@@ -31,170 +31,170 @@  discard block
 block discarded – undo
31 31
 class modSubtotal extends DolibarrModules
32 32
 {
33 33
 
34
-    /**
35
-     * 	Constructor. Define names, constants, directories, boxes, permissions
36
-     *
37
-     * 	@param	DoliDB		$db	Database handler
38
-     */
34
+	/**
35
+	 * 	Constructor. Define names, constants, directories, boxes, permissions
36
+	 *
37
+	 * 	@param	DoliDB		$db	Database handler
38
+	 */
39 39
      
40
-    public function __construct($db)
41
-    {
42
-        global $langs, $conf;
40
+	public function __construct($db)
41
+	{
42
+		global $langs, $conf;
43 43
 
44
-        $this->db = $db;
44
+		$this->db = $db;
45 45
 
46 46
 		$this->editor_name = 'ATM-Consulting';
47
-        // Id for module (must be unique).
48
-        // Use a free id here
49
-        // (See in Home -> System information -> Dolibarr for list of used modules id).
50
-        $this->numero = 104777; // 104000 to 104999 for ATM CONSULTING
51
-        // Key text used to identify module (for permissions, menus, etc...)
52
-        $this->rights_class = 'subtotal';
47
+		// Id for module (must be unique).
48
+		// Use a free id here
49
+		// (See in Home -> System information -> Dolibarr for list of used modules id).
50
+		$this->numero = 104777; // 104000 to 104999 for ATM CONSULTING
51
+		// Key text used to identify module (for permissions, menus, etc...)
52
+		$this->rights_class = 'subtotal';
53 53
 
54
-        // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
55
-        // It is used to group modules in module setup page
56
-        $this->family = "technic";
57
-        // Module label (no space allowed)
58
-        // used if translation string 'ModuleXXXName' not found
59
-        // (where XXX is value of numeric property 'numero' of module)
60
-        $this->name = preg_replace('/^mod/i', '', get_class($this));
61
-        // Module description
62
-        // used if translation string 'ModuleXXXDesc' not found
63
-        // (where XXX is value of numeric property 'numero' of module)
64
-        $this->description = "Module permettant l'ajout de sous-totaux et sous-totaux intermédiaires et le déplacement d'une ligne aisée de l'un dans l'autre";
65
-        // Possible values for version are: 'development', 'experimental' or version
66
-        $this->version = '3.1.1';
67
-        // Key used in llx_const table to save module status enabled/disabled
68
-        // (where MYMODULE is value of property name of module in uppercase)
69
-        $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
70
-        // Where to store the module in setup page
71
-        // (0=common,1=interface,2=others,3=very specific)
72
-        $this->special = 2;
73
-        // Name of image file used for this module.
74
-        // If file is in theme/yourtheme/img directory under name object_pictovalue.png
75
-        // use this->picto='pictovalue'
76
-        // If file is in module/img directory under name object_pictovalue.png
77
-        // use this->picto='pictovalue@module'
78
-        $this->picto = 'subtotal@subtotal'; // mypicto@titre
79
-        // Defined all module parts (triggers, login, substitutions, menus, css, etc...)
80
-        // for default path (eg: /titre/core/xxxxx) (0=disable, 1=enable)
81
-        // for specific path of parts (eg: /titre/core/modules/barcode)
82
-        // for specific css file (eg: /titre/css/titre.css.php)
83
-        $this->module_parts = array(
84
-            // Set this to 1 if module has its own trigger directory
85
-            'triggers' => 1,
86
-            // Set this to 1 if module has its own login method directory
87
-            //'login' => 0,
88
-            // Set this to 1 if module has its own substitution function file
89
-            //'substitutions' => 0,
90
-            // Set this to 1 if module has its own menus handler directory
91
-            //'menus' => 0,
92
-            // Set this to 1 if module has its own barcode directory
93
-            //'barcode' => 0,
94
-            // Set this to 1 if module has its own models directory
95
-            'models' => 1,
96
-            // Set this to relative path of css if module has its own css file
97
-            //'css' => '/titre/css/mycss.css.php',
98
-            // Set here all hooks context managed by module
99
-            'hooks' => array('invoicecard', 'invoicesuppliercard','propalcard', 'supplier_proposalcard', 'ordercard', 'ordersuppliercard','odtgeneration','orderstoinvoice','admin','invoicereccard','consumptionthirdparty')
100
-            // Set here all workflow context managed by module
101
-            //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE'))
102
-        );
54
+		// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
55
+		// It is used to group modules in module setup page
56
+		$this->family = "technic";
57
+		// Module label (no space allowed)
58
+		// used if translation string 'ModuleXXXName' not found
59
+		// (where XXX is value of numeric property 'numero' of module)
60
+		$this->name = preg_replace('/^mod/i', '', get_class($this));
61
+		// Module description
62
+		// used if translation string 'ModuleXXXDesc' not found
63
+		// (where XXX is value of numeric property 'numero' of module)
64
+		$this->description = "Module permettant l'ajout de sous-totaux et sous-totaux intermédiaires et le déplacement d'une ligne aisée de l'un dans l'autre";
65
+		// Possible values for version are: 'development', 'experimental' or version
66
+		$this->version = '3.1.1';
67
+		// Key used in llx_const table to save module status enabled/disabled
68
+		// (where MYMODULE is value of property name of module in uppercase)
69
+		$this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
70
+		// Where to store the module in setup page
71
+		// (0=common,1=interface,2=others,3=very specific)
72
+		$this->special = 2;
73
+		// Name of image file used for this module.
74
+		// If file is in theme/yourtheme/img directory under name object_pictovalue.png
75
+		// use this->picto='pictovalue'
76
+		// If file is in module/img directory under name object_pictovalue.png
77
+		// use this->picto='pictovalue@module'
78
+		$this->picto = 'subtotal@subtotal'; // mypicto@titre
79
+		// Defined all module parts (triggers, login, substitutions, menus, css, etc...)
80
+		// for default path (eg: /titre/core/xxxxx) (0=disable, 1=enable)
81
+		// for specific path of parts (eg: /titre/core/modules/barcode)
82
+		// for specific css file (eg: /titre/css/titre.css.php)
83
+		$this->module_parts = array(
84
+			// Set this to 1 if module has its own trigger directory
85
+			'triggers' => 1,
86
+			// Set this to 1 if module has its own login method directory
87
+			//'login' => 0,
88
+			// Set this to 1 if module has its own substitution function file
89
+			//'substitutions' => 0,
90
+			// Set this to 1 if module has its own menus handler directory
91
+			//'menus' => 0,
92
+			// Set this to 1 if module has its own barcode directory
93
+			//'barcode' => 0,
94
+			// Set this to 1 if module has its own models directory
95
+			'models' => 1,
96
+			// Set this to relative path of css if module has its own css file
97
+			//'css' => '/titre/css/mycss.css.php',
98
+			// Set here all hooks context managed by module
99
+			'hooks' => array('invoicecard', 'invoicesuppliercard','propalcard', 'supplier_proposalcard', 'ordercard', 'ordersuppliercard','odtgeneration','orderstoinvoice','admin','invoicereccard','consumptionthirdparty')
100
+			// Set here all workflow context managed by module
101
+			//'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE'))
102
+		);
103 103
 
104
-        // Data directories to create when module is enabled.
105
-        // Example: this->dirs = array("/titre/temp");
106
-        $this->dirs = array();
104
+		// Data directories to create when module is enabled.
105
+		// Example: this->dirs = array("/titre/temp");
106
+		$this->dirs = array();
107 107
 
108
-        // Config pages. Put here list of php pages
109
-        // stored into titre/admin directory, used to setup module.
110
-        $this->config_page_url = array("subtotal_setup.php@subtotal");
108
+		// Config pages. Put here list of php pages
109
+		// stored into titre/admin directory, used to setup module.
110
+		$this->config_page_url = array("subtotal_setup.php@subtotal");
111 111
 
112
-        // Dependencies
113
-        // List of modules id that must be enabled if this module is enabled
114
-        $this->depends = array();
112
+		// Dependencies
113
+		// List of modules id that must be enabled if this module is enabled
114
+		$this->depends = array();
115 115
 
116 116
 		$this->conflictwith=array('modMilestone');
117
-        // List of modules id to disable if this one is disabled
118
-        $this->requiredby = array();
119
-        // Minimum version of PHP required by module
120
-        $this->phpmin = array(5, 3);
121
-        // Minimum version of Dolibarr required by module
122
-        $this->need_dolibarr_version = array(3, 2);
123
-        $this->langfiles = array("subtotal@subtotal"); // langfiles@titre
124
-        // Constants
125
-        // List of particular constants to add when module is enabled
126
-        // (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
127
-        // Example:
128
-        $this->const = array(
129
-            	0=>array(
130
-            		'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES',
131
-            		'chaine',
132
-            		'I',
133
-            		'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché',
134
-            		1
135
-            	)
117
+		// List of modules id to disable if this one is disabled
118
+		$this->requiredby = array();
119
+		// Minimum version of PHP required by module
120
+		$this->phpmin = array(5, 3);
121
+		// Minimum version of Dolibarr required by module
122
+		$this->need_dolibarr_version = array(3, 2);
123
+		$this->langfiles = array("subtotal@subtotal"); // langfiles@titre
124
+		// Constants
125
+		// List of particular constants to add when module is enabled
126
+		// (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
127
+		// Example:
128
+		$this->const = array(
129
+				0=>array(
130
+					'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES',
131
+					'chaine',
132
+					'I',
133
+					'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché',
134
+					1
135
+				)
136 136
 				,1=>array('SUBTOTAL_ALLOW_ADD_BLOCK', 'chaine', '1', 'Permet l\'ajout de titres et sous-totaux')
137 137
 				,2=>array('SUBTOTAL_ALLOW_EDIT_BLOCK', 'chaine', '1', 'Permet de modifier titres et sous-totaux')
138 138
 				,3=>array('SUBTOTAL_ALLOW_REMOVE_BLOCK', 'chaine', '1', 'Permet de supprimer les titres et sous-totaux')
139 139
 				,4=>array('SUBTOTAL_TITLE_STYLE', 'chaine', 'BU')
140 140
 				,5=>array('SUBTOTAL_SUBTOTAL_STYLE', 'chaine', 'B')
141
-            //	1=>array(
142
-            //		'MYMODULE_MYNEWCONST2',
143
-            //		'chaine',
144
-            //		'myvalue',
145
-            //		'This is another constant to add',
146
-            //		0
147
-            //	)
148
-        );
141
+			//	1=>array(
142
+			//		'MYMODULE_MYNEWCONST2',
143
+			//		'chaine',
144
+			//		'myvalue',
145
+			//		'This is another constant to add',
146
+			//		0
147
+			//	)
148
+		);
149 149
 		
150 150
 
151 151
 
152 152
 
153
-        // Array to add new pages in new tabs
154
-        // Example:
155
-        $this->tabs = array(
156
-            //	// To add a new tab identified by code tabname1
157
-            //	'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__',
158
-            //	// To add another new tab identified by code tabname2
159
-            //	'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__',
160
-            //	// To remove an existing tab identified by code tabname
161
-            //	'objecttype:-tabname'
162
-        );
163
-        // where objecttype can be
164
-        // 'thirdparty'			to add a tab in third party view
165
-        // 'intervention'		to add a tab in intervention view
166
-        // 'order_supplier'		to add a tab in supplier order view
167
-        // 'invoice_supplier'	to add a tab in supplier invoice view
168
-        // 'invoice'			to add a tab in customer invoice view
169
-        // 'order'				to add a tab in customer order view
170
-        // 'product'			to add a tab in product view
171
-        // 'stock'				to add a tab in stock view
172
-        // 'propal'				to add a tab in propal view
173
-        // 'member'				to add a tab in fundation member view
174
-        // 'contract'			to add a tab in contract view
175
-        // 'user'				to add a tab in user view
176
-        // 'group'				to add a tab in group view
177
-        // 'contact'			to add a tab in contact view
178
-        // 'categories_x'		to add a tab in category view
179
-        // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
180
-        // Dictionnaries
181
-        if (! isset($conf->subtotal->enabled)) {
182
-            $conf->subtotal=new stdClass();
183
-            $conf->subtotal->enabled = 0;
184
-        }
185
-        $this->dictionaries = array(
153
+		// Array to add new pages in new tabs
154
+		// Example:
155
+		$this->tabs = array(
156
+			//	// To add a new tab identified by code tabname1
157
+			//	'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__',
158
+			//	// To add another new tab identified by code tabname2
159
+			//	'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__',
160
+			//	// To remove an existing tab identified by code tabname
161
+			//	'objecttype:-tabname'
162
+		);
163
+		// where objecttype can be
164
+		// 'thirdparty'			to add a tab in third party view
165
+		// 'intervention'		to add a tab in intervention view
166
+		// 'order_supplier'		to add a tab in supplier order view
167
+		// 'invoice_supplier'	to add a tab in supplier invoice view
168
+		// 'invoice'			to add a tab in customer invoice view
169
+		// 'order'				to add a tab in customer order view
170
+		// 'product'			to add a tab in product view
171
+		// 'stock'				to add a tab in stock view
172
+		// 'propal'				to add a tab in propal view
173
+		// 'member'				to add a tab in fundation member view
174
+		// 'contract'			to add a tab in contract view
175
+		// 'user'				to add a tab in user view
176
+		// 'group'				to add a tab in group view
177
+		// 'contact'			to add a tab in contact view
178
+		// 'categories_x'		to add a tab in category view
179
+		// (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
180
+		// Dictionnaries
181
+		if (! isset($conf->subtotal->enabled)) {
182
+			$conf->subtotal=new stdClass();
183
+			$conf->subtotal->enabled = 0;
184
+		}
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')
195
-            'tabcond'=>array($conf->subtotal->enabled)	
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
+			'tabcond'=>array($conf->subtotal->enabled)	
196 196
 		);
197
-        /* Example:
197
+		/* Example:
198 198
           // This is to avoid warnings
199 199
           if (! isset($conf->titre->enabled)) $conf->titre->enabled=0;
200 200
           $this->dictionnaries=array(
@@ -235,223 +235,223 @@  discard block
 block discarded – undo
235 235
           );
236 236
          */
237 237
 
238
-        // Boxes
239
-        // Add here list of php file(s) stored in core/boxes that contains class to show a box.
240
-        $this->boxes = array(); // Boxes list
238
+		// Boxes
239
+		// Add here list of php file(s) stored in core/boxes that contains class to show a box.
240
+		$this->boxes = array(); // Boxes list
241 241
        
242
-        /*
242
+		/*
243 243
           $this->boxes[$r][1] = "myboxb.php";
244 244
           $r++;
245 245
          */
246 246
 
247
-        // Permissions
248
-        $this->rights = array(); // Permission array used by this module
249
-        $r = 0;
247
+		// Permissions
248
+		$this->rights = array(); // Permission array used by this module
249
+		$r = 0;
250 250
 
251
-        // Add here list of permission defined by
252
-        // an id, a label, a boolean and two constant strings.
253
-        // Example:
254
-        //// Permission id (must not be already used)
255
-        //$this->rights[$r][0] = 2000;
256
-        //// Permission label
257
-        //$this->rights[$r][1] = 'Permision label';
258
-        //// Permission by default for new user (0/1)
259
-        //$this->rights[$r][3] = 1;
260
-        //// In php code, permission will be checked by test
261
-        //// if ($user->rights->permkey->level1->level2)
262
-        //$this->rights[$r][4] = 'level1';
263
-        //// In php code, permission will be checked by test
264
-        //// if ($user->rights->permkey->level1->level2)
265
-        //$this->rights[$r][5] = 'level2';
266
-        //$r++;
267
-        // Main menu entries
268
-        $this->menus = array(); // List of menus to add
269
-        $r = 0;
251
+		// Add here list of permission defined by
252
+		// an id, a label, a boolean and two constant strings.
253
+		// Example:
254
+		//// Permission id (must not be already used)
255
+		//$this->rights[$r][0] = 2000;
256
+		//// Permission label
257
+		//$this->rights[$r][1] = 'Permision label';
258
+		//// Permission by default for new user (0/1)
259
+		//$this->rights[$r][3] = 1;
260
+		//// In php code, permission will be checked by test
261
+		//// if ($user->rights->permkey->level1->level2)
262
+		//$this->rights[$r][4] = 'level1';
263
+		//// In php code, permission will be checked by test
264
+		//// if ($user->rights->permkey->level1->level2)
265
+		//$this->rights[$r][5] = 'level2';
266
+		//$r++;
267
+		// Main menu entries
268
+		$this->menus = array(); // List of menus to add
269
+		$r = 0;
270 270
 
271
-        // Add here entries to declare new menus
272
-        //
273
-        // Example to declare a new Top Menu entry and its Left menu entry:
274
-        //$this->menu[$r]=array(
275
-        //	// Put 0 if this is a top menu
276
-        //	'fk_menu'=>0,
277
-        //	// This is a Top menu entry
278
-        //	'type'=>'top',
279
-        //	'titre'=>'titre top menu',
280
-        //	'mainmenu'=>'titre',
281
-        //	'leftmenu'=>'titre',
282
-        //	'url'=>'/titre/pagetop.php',
283
-        //	// Lang file to use (without .lang) by module.
284
-        //	// File must be in langs/code_CODE/ directory.
285
-        //	'langs'=>'mylangfile',
286
-        //	'position'=>100,
287
-        //	// Define condition to show or hide menu entry.
288
-        //	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
289
-        //	'enabled'=>'$conf->titre->enabled',
290
-        //	// Use 'perms'=>'$user->rights->titre->level1->level2'
291
-        //	// if you want your menu with a permission rules
292
-        //	'perms'=>'1',
293
-        //	'target'=>'',
294
-        //	// 0=Menu for internal users, 1=external users, 2=both
295
-        //	'user'=>2
296
-        //);
297
-        //$r++;
298
-        //$this->menu[$r]=array(
299
-        //	// Use r=value where r is index key used for the parent menu entry
300
-        //	// (higher parent must be a top menu entry)
301
-        //	'fk_menu'=>'r=0',
302
-        //	// This is a Left menu entry
303
-        //	'type'=>'left',
304
-        //	'titre'=>'titre left menu',
305
-        //	'mainmenu'=>'titre',
306
-        //	'leftmenu'=>'titre',
307
-        //	'url'=>'/titre/pagelevel1.php',
308
-        //	// Lang file to use (without .lang) by module.
309
-        //	// File must be in langs/code_CODE/ directory.
310
-        //	'langs'=>'mylangfile',
311
-        //	'position'=>100,
312
-        //	// Define condition to show or hide menu entry.
313
-        //	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
314
-        //	'enabled'=>'$conf->titre->enabled',
315
-        //	// Use 'perms'=>'$user->rights->titre->level1->level2'
316
-        //	// if you want your menu with a permission rules
317
-        //	'perms'=>'1',
318
-        //	'target'=>'',
319
-        //	// 0=Menu for internal users, 1=external users, 2=both
320
-        //	'user'=>2
321
-        //);
322
-        //$r++;
323
-        //
324
-        // Example to declare a Left Menu entry into an existing Top menu entry:
325
-        //$this->menu[$r]=array(
326
-        //	// Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy'
327
-        //	'fk_menu'=>'fk_mainmenu=mainmenucode',
328
-        //	// This is a Left menu entry
329
-        //	'type'=>'left',
330
-        //	'titre'=>'titre left menu',
331
-        //	'mainmenu'=>'mainmenucode',
332
-        //	'leftmenu'=>'titre',
333
-        //	'url'=>'/titre/pagelevel2.php',
334
-        //	// Lang file to use (without .lang) by module.
335
-        //	// File must be in langs/code_CODE/ directory.
336
-        //	'langs'=>'mylangfile',
337
-        //	'position'=>100,
338
-        //	// Define condition to show or hide menu entry.
339
-        //	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
340
-        //	// Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
341
-        //	'enabled'=>'$conf->titre->enabled',
342
-        //	// Use 'perms'=>'$user->rights->titre->level1->level2'
343
-        //	// if you want your menu with a permission rules
344
-        //	'perms'=>'1',
345
-        //	'target'=>'',
346
-        //	// 0=Menu for internal users, 1=external users, 2=both
347
-        //	'user'=>2
348
-        //);
349
-        //$r++;
350
-        // Exports
351
-        $r = 1;
271
+		// Add here entries to declare new menus
272
+		//
273
+		// Example to declare a new Top Menu entry and its Left menu entry:
274
+		//$this->menu[$r]=array(
275
+		//	// Put 0 if this is a top menu
276
+		//	'fk_menu'=>0,
277
+		//	// This is a Top menu entry
278
+		//	'type'=>'top',
279
+		//	'titre'=>'titre top menu',
280
+		//	'mainmenu'=>'titre',
281
+		//	'leftmenu'=>'titre',
282
+		//	'url'=>'/titre/pagetop.php',
283
+		//	// Lang file to use (without .lang) by module.
284
+		//	// File must be in langs/code_CODE/ directory.
285
+		//	'langs'=>'mylangfile',
286
+		//	'position'=>100,
287
+		//	// Define condition to show or hide menu entry.
288
+		//	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
289
+		//	'enabled'=>'$conf->titre->enabled',
290
+		//	// Use 'perms'=>'$user->rights->titre->level1->level2'
291
+		//	// if you want your menu with a permission rules
292
+		//	'perms'=>'1',
293
+		//	'target'=>'',
294
+		//	// 0=Menu for internal users, 1=external users, 2=both
295
+		//	'user'=>2
296
+		//);
297
+		//$r++;
298
+		//$this->menu[$r]=array(
299
+		//	// Use r=value where r is index key used for the parent menu entry
300
+		//	// (higher parent must be a top menu entry)
301
+		//	'fk_menu'=>'r=0',
302
+		//	// This is a Left menu entry
303
+		//	'type'=>'left',
304
+		//	'titre'=>'titre left menu',
305
+		//	'mainmenu'=>'titre',
306
+		//	'leftmenu'=>'titre',
307
+		//	'url'=>'/titre/pagelevel1.php',
308
+		//	// Lang file to use (without .lang) by module.
309
+		//	// File must be in langs/code_CODE/ directory.
310
+		//	'langs'=>'mylangfile',
311
+		//	'position'=>100,
312
+		//	// Define condition to show or hide menu entry.
313
+		//	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
314
+		//	'enabled'=>'$conf->titre->enabled',
315
+		//	// Use 'perms'=>'$user->rights->titre->level1->level2'
316
+		//	// if you want your menu with a permission rules
317
+		//	'perms'=>'1',
318
+		//	'target'=>'',
319
+		//	// 0=Menu for internal users, 1=external users, 2=both
320
+		//	'user'=>2
321
+		//);
322
+		//$r++;
323
+		//
324
+		// Example to declare a Left Menu entry into an existing Top menu entry:
325
+		//$this->menu[$r]=array(
326
+		//	// Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy'
327
+		//	'fk_menu'=>'fk_mainmenu=mainmenucode',
328
+		//	// This is a Left menu entry
329
+		//	'type'=>'left',
330
+		//	'titre'=>'titre left menu',
331
+		//	'mainmenu'=>'mainmenucode',
332
+		//	'leftmenu'=>'titre',
333
+		//	'url'=>'/titre/pagelevel2.php',
334
+		//	// Lang file to use (without .lang) by module.
335
+		//	// File must be in langs/code_CODE/ directory.
336
+		//	'langs'=>'mylangfile',
337
+		//	'position'=>100,
338
+		//	// Define condition to show or hide menu entry.
339
+		//	// Use '$conf->titre->enabled' if entry must be visible if module is enabled.
340
+		//	// Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
341
+		//	'enabled'=>'$conf->titre->enabled',
342
+		//	// Use 'perms'=>'$user->rights->titre->level1->level2'
343
+		//	// if you want your menu with a permission rules
344
+		//	'perms'=>'1',
345
+		//	'target'=>'',
346
+		//	// 0=Menu for internal users, 1=external users, 2=both
347
+		//	'user'=>2
348
+		//);
349
+		//$r++;
350
+		// Exports
351
+		$r = 1;
352 352
 
353
-        // Example:
354
-        //$this->export_code[$r]=$this->rights_class.'_'.$r;
355
-        //// Translation key (used only if key ExportDataset_xxx_z not found)
356
-        //$this->export_label[$r]='CustomersInvoicesAndInvoiceLines';
357
-        //// Condition to show export in list (ie: '$user->id==3').
358
-        //// Set to 1 to always show when module is enabled.
359
-        //$this->export_enabled[$r]='1';
360
-        //$this->export_permission[$r]=array(array("facture","facture","export"));
361
-        //$this->export_fields_array[$r]=array(
362
-        //	's.rowid'=>"IdCompany",
363
-        //	's.nom'=>'CompanyName',
364
-        //	's.address'=>'Address',
365
-        //	's.cp'=>'Zip',
366
-        //	's.ville'=>'Town',
367
-        //	's.fk_pays'=>'Country',
368
-        //	's.tel'=>'Phone',
369
-        //	's.siren'=>'ProfId1',
370
-        //	's.siret'=>'ProfId2',
371
-        //	's.ape'=>'ProfId3',
372
-        //	's.idprof4'=>'ProfId4',
373
-        //	's.code_compta'=>'CustomerAccountancyCode',
374
-        //	's.code_compta_fournisseur'=>'SupplierAccountancyCode',
375
-        //	'f.rowid'=>"InvoiceId",
376
-        //	'f.facnumber'=>"InvoiceRef",
377
-        //	'f.datec'=>"InvoiceDateCreation",
378
-        //	'f.datef'=>"DateInvoice",
379
-        //	'f.total'=>"TotalHT",
380
-        //	'f.total_ttc'=>"TotalTTC",
381
-        //	'f.tva'=>"TotalVAT",
382
-        //	'f.paye'=>"InvoicePaid",
383
-        //	'f.fk_statut'=>'InvoiceStatus',
384
-        //	'f.note'=>"InvoiceNote",
385
-        //	'fd.rowid'=>'LineId',
386
-        //	'fd.description'=>"LineDescription",
387
-        //	'fd.price'=>"LineUnitPrice",
388
-        //	'fd.tva_tx'=>"LineVATRate",
389
-        //	'fd.qty'=>"LineQty",
390
-        //	'fd.total_ht'=>"LineTotalHT",
391
-        //	'fd.total_tva'=>"LineTotalTVA",
392
-        //	'fd.total_ttc'=>"LineTotalTTC",
393
-        //	'fd.date_start'=>"DateStart",
394
-        //	'fd.date_end'=>"DateEnd",
395
-        //	'fd.fk_product'=>'ProductId',
396
-        //	'p.ref'=>'ProductRef'
397
-        //);
398
-        //$this->export_entities_array[$r]=array('s.rowid'=>"company",
399
-        //	's.nom'=>'company',
400
-        //	's.address'=>'company',
401
-        //	's.cp'=>'company',
402
-        //	's.ville'=>'company',
403
-        //	's.fk_pays'=>'company',
404
-        //	's.tel'=>'company',
405
-        //	's.siren'=>'company',
406
-        //	's.siret'=>'company',
407
-        //	's.ape'=>'company',
408
-        //	's.idprof4'=>'company',
409
-        //	's.code_compta'=>'company',
410
-        //	's.code_compta_fournisseur'=>'company',
411
-        //	'f.rowid'=>"invoice",
412
-        //	'f.facnumber'=>"invoice",
413
-        //	'f.datec'=>"invoice",
414
-        //	'f.datef'=>"invoice",
415
-        //	'f.total'=>"invoice",
416
-        //	'f.total_ttc'=>"invoice",
417
-        //	'f.tva'=>"invoice",
418
-        //	'f.paye'=>"invoice",
419
-        //	'f.fk_statut'=>'invoice',
420
-        //	'f.note'=>"invoice",
421
-        //	'fd.rowid'=>'invoice_line',
422
-        //	'fd.description'=>"invoice_line",
423
-        //	'fd.price'=>"invoice_line",
424
-        //	'fd.total_ht'=>"invoice_line",
425
-        //	'fd.total_tva'=>"invoice_line",
426
-        //	'fd.total_ttc'=>"invoice_line",
427
-        //	'fd.tva_tx'=>"invoice_line",
428
-        //	'fd.qty'=>"invoice_line",
429
-        //	'fd.date_start'=>"invoice_line",
430
-        //	'fd.date_end'=>"invoice_line",
431
-        //	'fd.fk_product'=>'product',
432
-        //	'p.ref'=>'product'
433
-        //);
434
-        //$this->export_sql_start[$r] = 'SELECT DISTINCT ';
435
-        //$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, '
436
-        //	. MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)';
437
-        //$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX
438
-        //	. 'product as p on (fd.fk_product = p.rowid)';
439
-        //$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid '
440
-        //	. 'AND f.rowid = fd.fk_facture';
441
-        //$r++;
442
-    }
353
+		// Example:
354
+		//$this->export_code[$r]=$this->rights_class.'_'.$r;
355
+		//// Translation key (used only if key ExportDataset_xxx_z not found)
356
+		//$this->export_label[$r]='CustomersInvoicesAndInvoiceLines';
357
+		//// Condition to show export in list (ie: '$user->id==3').
358
+		//// Set to 1 to always show when module is enabled.
359
+		//$this->export_enabled[$r]='1';
360
+		//$this->export_permission[$r]=array(array("facture","facture","export"));
361
+		//$this->export_fields_array[$r]=array(
362
+		//	's.rowid'=>"IdCompany",
363
+		//	's.nom'=>'CompanyName',
364
+		//	's.address'=>'Address',
365
+		//	's.cp'=>'Zip',
366
+		//	's.ville'=>'Town',
367
+		//	's.fk_pays'=>'Country',
368
+		//	's.tel'=>'Phone',
369
+		//	's.siren'=>'ProfId1',
370
+		//	's.siret'=>'ProfId2',
371
+		//	's.ape'=>'ProfId3',
372
+		//	's.idprof4'=>'ProfId4',
373
+		//	's.code_compta'=>'CustomerAccountancyCode',
374
+		//	's.code_compta_fournisseur'=>'SupplierAccountancyCode',
375
+		//	'f.rowid'=>"InvoiceId",
376
+		//	'f.facnumber'=>"InvoiceRef",
377
+		//	'f.datec'=>"InvoiceDateCreation",
378
+		//	'f.datef'=>"DateInvoice",
379
+		//	'f.total'=>"TotalHT",
380
+		//	'f.total_ttc'=>"TotalTTC",
381
+		//	'f.tva'=>"TotalVAT",
382
+		//	'f.paye'=>"InvoicePaid",
383
+		//	'f.fk_statut'=>'InvoiceStatus',
384
+		//	'f.note'=>"InvoiceNote",
385
+		//	'fd.rowid'=>'LineId',
386
+		//	'fd.description'=>"LineDescription",
387
+		//	'fd.price'=>"LineUnitPrice",
388
+		//	'fd.tva_tx'=>"LineVATRate",
389
+		//	'fd.qty'=>"LineQty",
390
+		//	'fd.total_ht'=>"LineTotalHT",
391
+		//	'fd.total_tva'=>"LineTotalTVA",
392
+		//	'fd.total_ttc'=>"LineTotalTTC",
393
+		//	'fd.date_start'=>"DateStart",
394
+		//	'fd.date_end'=>"DateEnd",
395
+		//	'fd.fk_product'=>'ProductId',
396
+		//	'p.ref'=>'ProductRef'
397
+		//);
398
+		//$this->export_entities_array[$r]=array('s.rowid'=>"company",
399
+		//	's.nom'=>'company',
400
+		//	's.address'=>'company',
401
+		//	's.cp'=>'company',
402
+		//	's.ville'=>'company',
403
+		//	's.fk_pays'=>'company',
404
+		//	's.tel'=>'company',
405
+		//	's.siren'=>'company',
406
+		//	's.siret'=>'company',
407
+		//	's.ape'=>'company',
408
+		//	's.idprof4'=>'company',
409
+		//	's.code_compta'=>'company',
410
+		//	's.code_compta_fournisseur'=>'company',
411
+		//	'f.rowid'=>"invoice",
412
+		//	'f.facnumber'=>"invoice",
413
+		//	'f.datec'=>"invoice",
414
+		//	'f.datef'=>"invoice",
415
+		//	'f.total'=>"invoice",
416
+		//	'f.total_ttc'=>"invoice",
417
+		//	'f.tva'=>"invoice",
418
+		//	'f.paye'=>"invoice",
419
+		//	'f.fk_statut'=>'invoice',
420
+		//	'f.note'=>"invoice",
421
+		//	'fd.rowid'=>'invoice_line',
422
+		//	'fd.description'=>"invoice_line",
423
+		//	'fd.price'=>"invoice_line",
424
+		//	'fd.total_ht'=>"invoice_line",
425
+		//	'fd.total_tva'=>"invoice_line",
426
+		//	'fd.total_ttc'=>"invoice_line",
427
+		//	'fd.tva_tx'=>"invoice_line",
428
+		//	'fd.qty'=>"invoice_line",
429
+		//	'fd.date_start'=>"invoice_line",
430
+		//	'fd.date_end'=>"invoice_line",
431
+		//	'fd.fk_product'=>'product',
432
+		//	'p.ref'=>'product'
433
+		//);
434
+		//$this->export_sql_start[$r] = 'SELECT DISTINCT ';
435
+		//$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, '
436
+		//	. MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)';
437
+		//$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX
438
+		//	. 'product as p on (fd.fk_product = p.rowid)';
439
+		//$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid '
440
+		//	. 'AND f.rowid = fd.fk_facture';
441
+		//$r++;
442
+	}
443 443
 
444
-    /**
445
-     * Function called when module is enabled.
446
-     * The init function add constants, boxes, permissions and menus
447
-     * (defined in constructor) into Dolibarr database.
448
-     * It also creates data directories
449
-     *
450
-     * 	@param		string	$options	Options when enabling module ('', 'noboxes')
451
-     * 	@return		int					1 if OK, 0 if KO
452
-     */
453
-    public function init($options = '')
454
-    {
444
+	/**
445
+	 * Function called when module is enabled.
446
+	 * The init function add constants, boxes, permissions and menus
447
+	 * (defined in constructor) into Dolibarr database.
448
+	 * It also creates data directories
449
+	 *
450
+	 * 	@param		string	$options	Options when enabling module ('', 'noboxes')
451
+	 * 	@return		int					1 if OK, 0 if KO
452
+	 */
453
+	public function init($options = '')
454
+	{
455 455
 	  	global $conf, $db;
456 456
 		
457 457
 		
@@ -459,46 +459,46 @@  discard block
 block discarded – undo
459 459
 			exit("Attention, ce module rentre ne conflit avec le module Jalon/Milestones. Merci de le désactiver auparavant.");
460 460
 		}
461 461
       */
462
-	    $sql = array();
462
+		$sql = array();
463 463
 
464
-        $result = $this->loadTables();
465
-        dol_include_once('/core/class/extrafields.class.php');
464
+		$result = $this->loadTables();
465
+		dol_include_once('/core/class/extrafields.class.php');
466 466
 	
467
-        $extra = new ExtraFields($db); // propaldet, commandedet, facturedet
468
-        $TElementType = array('propaldet', 'commandedet', 'facturedet', 'supplier_proposaldet', 'commande_fournisseurdet', 'facture_fourn_det');
469
-        foreach($TElementType as $element_type) {
470
-            $extra->addExtraField('show_total_ht', 'Afficher le Total HT sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1);
471
-            $extra->addExtraField('show_reduc', 'Afficher la réduction sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1);
472
-        }
467
+		$extra = new ExtraFields($db); // propaldet, commandedet, facturedet
468
+		$TElementType = array('propaldet', 'commandedet', 'facturedet', 'supplier_proposaldet', 'commande_fournisseurdet', 'facture_fourn_det');
469
+		foreach($TElementType as $element_type) {
470
+			$extra->addExtraField('show_total_ht', 'Afficher le Total HT sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1);
471
+			$extra->addExtraField('show_reduc', 'Afficher la réduction sur le sous-total', 'int', 0, 10, $element_type, 0, 0, '', unserialize('a:1:{s:7:"options";a:1:{s:0:"";N;}}'), 0, '', 0, 1);
472
+		}
473 473
 		
474
-        return $this->_init($sql, $options);
475
-    }
474
+		return $this->_init($sql, $options);
475
+	}
476 476
 
477
-    /**
478
-     * Function called when module is disabled.
479
-     * Remove from database constants, boxes and permissions from Dolibarr database.
480
-     * Data directories are not deleted
481
-     *
482
-     * 	@param		string	$options	Options when enabling module ('', 'noboxes')
483
-     * 	@return		int					1 if OK, 0 if KO
484
-     */
485
-    public function remove($options = '')
486
-    {
487
-        $sql = array();
477
+	/**
478
+	 * Function called when module is disabled.
479
+	 * Remove from database constants, boxes and permissions from Dolibarr database.
480
+	 * Data directories are not deleted
481
+	 *
482
+	 * 	@param		string	$options	Options when enabling module ('', 'noboxes')
483
+	 * 	@return		int					1 if OK, 0 if KO
484
+	 */
485
+	public function remove($options = '')
486
+	{
487
+		$sql = array();
488 488
 
489
-        return $this->_remove($sql, $options);
490
-    }
489
+		return $this->_remove($sql, $options);
490
+	}
491 491
 
492
-    /**
493
-     * Create tables, keys and data required by module
494
-     * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys
495
-     * and create data commands must be stored in directory /titre/sql/
496
-     * This function is called by this->init
497
-     *
498
-     * 	@return		int		<=0 if KO, >0 if OK
499
-     */
500
-    private function loadTables()
501
-    {
502
-        return $this->_load_tables('/subtotal/sql/');
503
-    }
492
+	/**
493
+	 * Create tables, keys and data required by module
494
+	 * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys
495
+	 * and create data commands must be stored in directory /titre/sql/
496
+	 * This function is called by this->init
497
+	 *
498
+	 * 	@return		int		<=0 if KO, >0 if OK
499
+	 */
500
+	private function loadTables()
501
+	{
502
+		return $this->_load_tables('/subtotal/sql/');
503
+	}
504 504
 }
Please login to merge, or discard this patch.
class/actions_subtotal.class.php 1 patch
Indentation   +287 added lines, -287 removed lines patch added patch discarded remove patch
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
 	 * @return     void
102 102
 	 */
103 103
     
104
-    var $module_number = 104777;
104
+	var $module_number = 104777;
105 105
     
106
-    function formObjectOptions($parameters, &$object, &$action, $hookmanager) 
107
-    {
108
-      	global $langs,$db,$user, $conf;
106
+	function formObjectOptions($parameters, &$object, &$action, $hookmanager) 
107
+	{
108
+	  	global $langs,$db,$user, $conf;
109 109
 		
110 110
 		$langs->load('subtotal@subtotal');
111 111
 		
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
120 120
 				$createRight = $user->rights->facture->creer;
121 121
 			} elseif($object->element == 'order_supplier' )
122 122
 			{
123
-			    $createRight = $user->rights->fournisseur->commande->creer;
123
+				$createRight = $user->rights->fournisseur->commande->creer;
124 124
 			} elseif($object->element == 'invoice_supplier' )
125 125
 			{
126
-			    $createRight = $user->rights->fournisseur->facture->creer;
126
+				$createRight = $user->rights->fournisseur->facture->creer;
127 127
 			}
128 128
 			
129 129
 			if ($object->statut == 0  && $createRight) {
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 					
174 174
 					if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty);
175 175
 					
176
-	    			TSubtotal::addSubTotalLine($object, $title, $qty);
176
+					TSubtotal::addSubTotalLine($object, $title, $qty);
177 177
 				}
178 178
 				else if($action==='ask_deleteallline') {
179 179
 						$form=new Form($db);
@@ -395,36 +395,36 @@  discard block
 block discarded – undo
395 395
 		$TContext = explode(':',$parameters['context']);
396 396
 		if (
397 397
 				in_array('invoicecard',$TContext)
398
-		        || in_array('invoicesuppliercard',$TContext)
398
+				|| in_array('invoicesuppliercard',$TContext)
399 399
 				|| in_array('propalcard',$TContext)
400 400
 				|| in_array('ordercard',$TContext)
401
-		        || in_array('ordersuppliercard',$TContext)
401
+				|| in_array('ordersuppliercard',$TContext)
402 402
 				|| in_array('invoicereccard',$TContext)
403 403
 			)
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;
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 407
 				$hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED)?$conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED:0;
408 408
 				$hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] ) ?  $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] : $hidepricesDefaultConf;
409 409
 				
410 410
 				$var=false;
411
-		     	$out.= '<tr '.$bc[$var].'>
411
+			 	$out.= '<tr '.$bc[$var].'>
412 412
 		     			<td colspan="4" align="right">
413 413
 		     				<label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label>
414 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 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 430
 		     				<input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' />
@@ -436,9 +436,9 @@  discard block
 block discarded – undo
436 436
 				if ( 
437 437
 					(in_array('propalcard',$TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP))
438 438
 					|| (in_array('ordercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
439
-				    || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
439
+					|| (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP))
440 440
 					|| (in_array('invoicecard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
441
-				    || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
441
+					|| (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP))
442 442
 					|| (in_array('invoicereccard',$TContext)  && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP ))
443 443
 				)
444 444
 				{
@@ -457,19 +457,19 @@  discard block
 block discarded – undo
457 457
 			}
458 458
 			
459 459
 		
460
-        return 1;
460
+		return 1;
461 461
 	} 
462 462
 	 
463
-    function formEditProductOptions($parameters, &$object, &$action, $hookmanager) 
464
-    {
463
+	function formEditProductOptions($parameters, &$object, &$action, $hookmanager) 
464
+	{
465 465
 		
466
-    	if (in_array('invoicecard',explode(':',$parameters['context'])))
467
-        {
466
+		if (in_array('invoicecard',explode(':',$parameters['context'])))
467
+		{
468 468
         	
469
-        }
469
+		}
470 470
 		
471
-        return 0;
472
-    }
471
+		return 0;
472
+	}
473 473
 	
474 474
 	function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) {
475 475
 		global $conf;
@@ -518,11 +518,11 @@  discard block
 block discarded – undo
518 518
 	
519 519
 		if (
520 520
 				in_array('invoicecard',explode(':',$parameters['context']))
521
-		        || in_array('invoicesuppliercard',explode(':',$parameters['context']))
521
+				|| in_array('invoicesuppliercard',explode(':',$parameters['context']))
522 522
 				|| in_array('propalcard',explode(':',$parameters['context']))
523
-		        || in_array('supplier_proposalcard',explode(':',$parameters['context']))
523
+				|| in_array('supplier_proposalcard',explode(':',$parameters['context']))
524 524
 				|| in_array('ordercard',explode(':',$parameters['context']))
525
-		        || in_array('ordersuppliercard',explode(':',$parameters['context']))
525
+				|| in_array('ordersuppliercard',explode(':',$parameters['context']))
526 526
 				|| in_array('invoicereccard',explode(':',$parameters['context']))
527 527
 		) {
528 528
 			
@@ -601,20 +601,20 @@  discard block
 block discarded – undo
601 601
 				in_array('invoicecard',explode(':',$parameters['context']))
602 602
 				|| in_array('propalcard',explode(':',$parameters['context']))
603 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']))
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 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 614
 				elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) {
615
-				    $sessname = 'subtotal_hideInnerLines_facture_fournisseur';
616
-				    $sessname2 = 'subtotal_hidedetails_facture_fournisseur';
617
-				    $sessname3 = 'subtotal_hideprices_facture_fournisseur';
615
+					$sessname = 'subtotal_hideInnerLines_facture_fournisseur';
616
+					$sessname2 = 'subtotal_hidedetails_facture_fournisseur';
617
+					$sessname3 = 'subtotal_hideprices_facture_fournisseur';
618 618
 				}
619 619
 				elseif(in_array('propalcard',explode(':',$parameters['context']))) {
620 620
 					$sessname = 'subtotal_hideInnerLines_propal';
@@ -622,9 +622,9 @@  discard block
 block discarded – undo
622 622
 					$sessname3 = 'subtotal_hideprices_propal';
623 623
 				}
624 624
 				elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) {
625
-				    $sessname = 'subtotal_hideInnerLines_supplier_proposal';
626
-				    $sessname2 = 'subtotal_hidedetails_supplier_proposal';
627
-				    $sessname3 = 'subtotal_hideprices_supplier_proposal';
625
+					$sessname = 'subtotal_hideInnerLines_supplier_proposal';
626
+					$sessname2 = 'subtotal_hidedetails_supplier_proposal';
627
+					$sessname3 = 'subtotal_hideprices_supplier_proposal';
628 628
 				}
629 629
 				elseif(in_array('ordercard',explode(':',$parameters['context']))) {
630 630
 					$sessname = 'subtotal_hideInnerLines_commande';
@@ -632,9 +632,9 @@  discard block
 block discarded – undo
632 632
 					$sessname3 = 'subtotal_hideprices_commande';
633 633
 				}
634 634
 				elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) {
635
-				    $sessname = 'subtotal_hideInnerLines_commande_fournisseur';
636
-				    $sessname2 = 'subtotal_hidedetails_commande_fournisseur';
637
-				    $sessname3 = 'subtotal_hideprices_commande_fournisseur';
635
+					$sessname = 'subtotal_hideInnerLines_commande_fournisseur';
636
+					$sessname2 = 'subtotal_hidedetails_commande_fournisseur';
637
+					$sessname3 = 'subtotal_hideprices_commande_fournisseur';
638 638
 				}
639 639
 				else {
640 640
 					$sessname = 'subtotal_hideInnerLines_unknown';
@@ -659,17 +659,17 @@  discard block
 block discarded – undo
659 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) {
663
-                            $line->modsubtotal_total = 1;
664
-                        }
665
-                        else{
666
-                            $line->modsubtotal_title = 1;
667
-                        }
662
+						if($line->qty>=90) {
663
+							$line->modsubtotal_total = 1;
664
+						}
665
+						else{
666
+							$line->modsubtotal_title = 1;
667
+						}
668 668
                         
669 669
 						$line->total_ht = $this->getTotalLineFromObject($object, $line, '');
670 670
 					}
671
-	        	}
672
-	        }
671
+				}
672
+			}
673 673
 			
674 674
 		}
675 675
 		else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') {
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 				 */
687 687
 				else if($object->element=='invoice_supplier')
688 688
 				{
689
-				    $object->deleteline($idLine);
689
+					$object->deleteline($idLine);
690 690
 				}
691 691
 				/**
692 692
 				 * @var $object Propal
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 				 */
710 710
 				else if($object->element=='order_supplier')
711 711
 				{
712
-				    $object->deleteline($idLine);
712
+					$object->deleteline($idLine);
713 713
 				}
714 714
 				/**
715 715
 				 * @var $object Facturerec
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 		
781 781
 		foreach($object->lines as $l) {
782 782
 		
783
-		    $lid = (!empty($l->rowid) ? $l->rowid : $l->id);
783
+			$lid = (!empty($l->rowid) ? $l->rowid : $l->id);
784 784
 			if($lid == $lineid) {
785 785
 
786 786
 				$found = true;
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 			
790 790
 			if($found) {
791 791
 				
792
-			    $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id);
792
+				$Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id);
793 793
 				
794 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
@@ -868,17 +868,17 @@  discard block
 block discarded – undo
868 868
 			if($l->rang>=$rang) {
869 869
 				return price($total);
870 870
 			}
871
-                        if (TSubtotal::isSubtotal($l)){
872
-                            $total = 0;
873
-                        } else  if ($l->situation_percent > 0 ){
871
+						if (TSubtotal::isSubtotal($l)){
872
+							$total = 0;
873
+						} else  if ($l->situation_percent > 0 ){
874 874
                            
875 875
         	
876 876
 		 	$prev_progress = $l->get_prev_progress($object->id);
877 877
 		 	$progress = ($l->situation_percent - $prev_progress) /100;
878
-                        $total += ($l->total_ht/($l->situation_percent/100)) * $progress;
878
+						$total += ($l->total_ht/($l->situation_percent/100)) * $progress;
879 879
                         
880
-                    }
881
-                }
880
+					}
881
+				}
882 882
                 
883 883
 		return price($total);
884 884
 	}
@@ -910,7 +910,7 @@  discard block
 block discarded – undo
910 910
 		if(method_exists('Closure','bind')) {
911 911
 			$pageBreakOriginalValue = $pdf->AcceptPageBreak();
912 912
 			$sweetsThief = function ($pdf) {
913
-		    		return $pdf->bMargin ;
913
+					return $pdf->bMargin ;
914 914
 			};
915 915
 			$sweetsThief = Closure::bind($sweetsThief, null, $pdf);
916 916
 	
@@ -973,11 +973,11 @@  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
977
-                                                $total_to_print = $this->getTotalToPrintSituation($object, $line);
978
-                                        } else {
979
-                                            	$total_to_print = price($total);
980
-                                        }
976
+										if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation
977
+												$total_to_print = $this->getTotalToPrintSituation($object, $line);
978
+										} else {
979
+												$total_to_print = price($total);
980
+										}
981 981
                                             
982 982
 					$line->total_ht = $total;
983 983
 					$line->total = $total;
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
 	}
1129 1129
 	
1130 1130
 	function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') {
1131
-	    global $conf, $hideprices, $hookmanager;
1131
+		global $conf, $hideprices, $hookmanager;
1132 1132
 		
1133 1133
 		if(is_array($parameters)) $i = & $parameters['i'];
1134 1134
 		else $i = (int)$parameters;
@@ -1167,7 +1167,7 @@  discard block
 block discarded – undo
1167 1167
 			}
1168 1168
 		}
1169 1169
 		if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){
1170
-		    $this->resprints = price($object->lines[$i]->total_ht);
1170
+			$this->resprints = price($object->lines[$i]->total_ht);
1171 1171
 		}
1172 1172
 		
1173 1173
 		// Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché
@@ -1296,7 +1296,7 @@  discard block
 block discarded – undo
1296 1296
 	}
1297 1297
 	
1298 1298
 	function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') {
1299
-	    global $conf,$hideprices,$hookmanager;
1299
+		global $conf,$hideprices,$hookmanager;
1300 1300
 
1301 1301
 		if(is_array($parameters)) $i = & $parameters['i'];
1302 1302
 		else $i = (int)$parameters;
@@ -1304,17 +1304,17 @@  discard block
 block discarded – undo
1304 1304
 		if($this->isModSubtotalLine($parameters,$object) ) {
1305 1305
 			$this->resprints = ' ';
1306 1306
 
1307
-            $line = $object->lines[$i];
1307
+			$line = $object->lines[$i];
1308 1308
 
1309
-            // On récupère les montants du bloc pour les afficher dans la ligne de sous-total
1310
-            if(TSubtotal::isSubtotal($line)) {
1311
-                $parentTitle = TSubtotal::getParentTitleOfLine($object, $i);
1309
+			// On récupère les montants du bloc pour les afficher dans la ligne de sous-total
1310
+			if(TSubtotal::isSubtotal($line)) {
1311
+				$parentTitle = TSubtotal::getParentTitleOfLine($object, $i);
1312 1312
 
1313
-                if(! empty($parentTitle->array_options['options_show_total_ht'])) {
1314
-                    $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle);
1315
-                    $this->resprints = price($TTotal['total_subprice']);
1316
-                }
1317
-            }
1313
+				if(! empty($parentTitle->array_options['options_show_total_ht'])) {
1314
+					$TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle);
1315
+					$this->resprints = price($TTotal['total_subprice']);
1316
+				}
1317
+			}
1318 1318
 		
1319 1319
 			if((float)DOL_VERSION<=3.6) {
1320 1320
 				return '';
@@ -1330,57 +1330,57 @@  discard block
 block discarded – undo
1330 1330
 		(!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))
1331 1331
 		)
1332 1332
 		{
1333
-		    // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue
1334
-		    if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1335
-		    {
1336
-		        $this->resprints = ' ';
1333
+			// alors je dois vérifier si la méthode fait partie de la conf qui l'exclue
1334
+			if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1335
+			{
1336
+				$this->resprints = ' ';
1337 1337
 		        
1338
-		        // currentcontext à modifier celon l'appel
1339
-		        $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i);
1340
-		        return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1)
1338
+				// currentcontext à modifier celon l'appel
1339
+				$params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i);
1340
+				return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1)
1341 1341
 		        
1342
-		    }
1342
+			}
1343 1343
 		}
1344 1344
 		// Cache le prix pour les lignes standards dolibarr qui sont dans un ensemble
1345 1345
 		else if (!empty($hideprices))
1346 1346
 		{
1347 1347
 		    
1348
-		    // Check if a title exist for this line && if the title have subtotal
1349
-		    $lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1350
-		    if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1351
-		    {
1348
+			// Check if a title exist for this line && if the title have subtotal
1349
+			$lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1350
+			if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1351
+			{
1352 1352
 		        
1353
-		        $this->resprints = ' ';
1353
+				$this->resprints = ' ';
1354 1354
 		        
1355
-		        // currentcontext à modifier celon l'appel
1356
-		        $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hideprices', 'i' => $i);
1357
-		        return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1)
1358
-		    }
1355
+				// currentcontext à modifier celon l'appel
1356
+				$params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hideprices', 'i' => $i);
1357
+				return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1)
1358
+			}
1359 1359
 		}
1360 1360
 		
1361 1361
 		return 0;
1362 1362
 	}
1363 1363
 	
1364 1364
 	function pdf_getlineremisepercent($parameters=array(), &$object, &$action='') {
1365
-	    global $conf,$hideprices,$hookmanager;
1365
+		global $conf,$hideprices,$hookmanager;
1366 1366
 
1367
-        if(is_array($parameters)) $i = & $parameters['i'];
1368
-        else $i = (int) $parameters;
1367
+		if(is_array($parameters)) $i = & $parameters['i'];
1368
+		else $i = (int) $parameters;
1369 1369
 
1370 1370
 		if($this->isModSubtotalLine($parameters,$object) ) {
1371 1371
 			$this->resprints = ' ';
1372 1372
 
1373
-            $line = $object->lines[$i];
1373
+			$line = $object->lines[$i];
1374 1374
 
1375
-            // Affichage de la remise 
1376
-            if(TSubtotal::isSubtotal($line)) {
1377
-                $parentTitle = TSubtotal::getParentTitleOfLine($object, $i);
1375
+			// Affichage de la remise 
1376
+			if(TSubtotal::isSubtotal($line)) {
1377
+				$parentTitle = TSubtotal::getParentTitleOfLine($object, $i);
1378 1378
 
1379
-                if(! empty($parentTitle->array_options['options_show_reduc'])) {
1380
-                    $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle);
1381
-                    $this->resprints = price($TTotal['total_ht'] / $TTotal['total_subprice']*100, 0, '', 1, 2, 2).'%';
1382
-                }
1383
-            }
1379
+				if(! empty($parentTitle->array_options['options_show_reduc'])) {
1380
+					$TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle);
1381
+					$this->resprints = price($TTotal['total_ht'] / $TTotal['total_subprice']*100, 0, '', 1, 2, 2).'%';
1382
+				}
1383
+			}
1384 1384
 		
1385 1385
 			if((float)DOL_VERSION<=3.6) {
1386 1386
 				return '';
@@ -1424,7 +1424,7 @@  discard block
 block discarded – undo
1424 1424
 	}
1425 1425
 	
1426 1426
 	function pdf_getlinevatrate($parameters=array(), &$object, &$action='') {
1427
-	    global $conf,$hideprices,$hookmanager;
1427
+		global $conf,$hideprices,$hookmanager;
1428 1428
 	    
1429 1429
 		if($this->isModSubtotalLine($parameters,$object) ){
1430 1430
 			$this->resprints = ' ';
@@ -1449,31 +1449,31 @@  discard block
 block discarded – undo
1449 1449
 		(!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))
1450 1450
 		)
1451 1451
 		{
1452
-		    // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue
1453
-		    if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1454
-		    {
1455
-		        $this->resprints = ' ';
1452
+			// alors je dois vérifier si la méthode fait partie de la conf qui l'exclue
1453
+			if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC)))
1454
+			{
1455
+				$this->resprints = ' ';
1456 1456
 		        
1457
-		        // currentcontext à modifier celon l'appel
1458
-		        $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i);
1459
-		        return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1)
1460
-		    }
1457
+				// currentcontext à modifier celon l'appel
1458
+				$params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i);
1459
+				return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1)
1460
+			}
1461 1461
 		}
1462 1462
 		// Cache le prix pour les lignes standards dolibarr qui sont dans un ensemble
1463 1463
 		else if (!empty($hideprices))
1464 1464
 		{
1465 1465
 		    
1466
-		    // Check if a title exist for this line && if the title have subtotal
1467
-		    $lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1468
-		    if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1469
-		    {
1466
+			// Check if a title exist for this line && if the title have subtotal
1467
+			$lineTitle = TSubtotal::getParentTitleOfLine($object, $i);
1468
+			if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true))
1469
+			{
1470 1470
 		        
1471
-		        $this->resprints = ' ';
1471
+				$this->resprints = ' ';
1472 1472
 		        
1473
-		        // currentcontext à modifier celon l'appel
1474
-		        $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hideprices', 'i' => $i);
1475
-		        return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1)
1476
-		    }
1473
+				// currentcontext à modifier celon l'appel
1474
+				$params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hideprices', 'i' => $i);
1475
+				return $this->callHook($object, $hookmanager, $action, $params); // return 1 (qui est la valeur par défaut) OU -1 si erreur OU overrideReturn (contient -1 ou 0 ou 1)
1476
+			}
1477 1477
 		}
1478 1478
 		
1479 1479
 		return 0;
@@ -1597,24 +1597,24 @@  discard block
 block discarded – undo
1597 1597
 		
1598 1598
 		$this->add_numerotation($object);	
1599 1599
 		
1600
-        foreach($object->lines as $k => &$l) {
1601
-            if(TSubtotal::isSubtotal($l)) {
1602
-                $parentTitle = TSubtotal::getParentTitleOfLine($object, $k);
1603
-                if(! empty($parentTitle->id) && ! empty($parentTitle->array_options['options_show_total_ht'])) {
1604
-                    $l->remise_percent = 100;    // Affichage de la réduction sur la ligne de sous-total
1605
-                }
1606
-            }
1607
-        }
1600
+		foreach($object->lines as $k => &$l) {
1601
+			if(TSubtotal::isSubtotal($l)) {
1602
+				$parentTitle = TSubtotal::getParentTitleOfLine($object, $k);
1603
+				if(! empty($parentTitle->id) && ! empty($parentTitle->array_options['options_show_total_ht'])) {
1604
+					$l->remise_percent = 100;    // Affichage de la réduction sur la ligne de sous-total
1605
+				}
1606
+			}
1607
+		}
1608 1608
 
1609 1609
 		$hideInnerLines = (int)GETPOST('hideInnerLines');
1610 1610
 		$hidedetails = (int)GETPOST('hidedetails');
1611 1611
 
1612 1612
 		if ($hideInnerLines) { // si c une ligne de titre
1613
-	    	$fk_parent_line=0;
1613
+			$fk_parent_line=0;
1614 1614
 			$TLines =array();
1615 1615
 		
1616 1616
 			$original_count=count($object->lines);
1617
-		    $TTvas = array(); // tableau de tva
1617
+			$TTvas = array(); // tableau de tva
1618 1618
 		    
1619 1619
 			foreach($object->lines as $k=>&$line) 
1620 1620
 			{
@@ -1653,48 +1653,48 @@  discard block
 block discarded – undo
1653 1653
 			
1654 1654
 				if ($hideInnerLines)
1655 1655
 				{
1656
-				    if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1657
-				    {
1658
-				        if($line->tva_tx != '0.000' && $line->product_type!=9){
1656
+					if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1657
+					{
1658
+						if($line->tva_tx != '0.000' && $line->product_type!=9){
1659 1659
 				            
1660
-    				        // on remplit le tableau de tva pour substituer les lignes cachées
1661
-    				        $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva;
1662
-    				        $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht;
1663
-    				        $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; 
1664
-    				    }
1665
-    					if($line->product_type==9 && $line->rowid>0)
1666
-    					{
1667
-    					    //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres
1668
-    					    // génère des lignes d'affichage des montants HT soumis à tva
1669
-    					    $nbtva = count($TTvas);
1670
-    					    if(!empty($nbtva)){
1671
-    					        foreach ($TTvas as $tx =>$val){
1672
-    					            $l = clone $line;
1673
-    					            $l->product_type = 1;
1674
-    					            $l->special_code = '';
1675
-    					            $l->qty = 1;
1676
-    					            $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx));
1677
-    					            $l->tva_tx = $tx;
1678
-    					            $l->total_ht = $val['total_ht'];
1679
-    					            $l->total_tva = $val['total_tva'];
1680
-    					            $l->total = $line->total_ht;
1681
-    					            $l->total_ttc = $val['total_ttc'];
1682
-    					            $TLines[] = $l;
1683
-    					            array_shift($TTvas);
1684
-    					       }
1685
-    					    }
1660
+							// on remplit le tableau de tva pour substituer les lignes cachées
1661
+							$TTvas[$line->tva_tx]['total_tva'] += $line->total_tva;
1662
+							$TTvas[$line->tva_tx]['total_ht'] += $line->total_ht;
1663
+							$TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; 
1664
+						}
1665
+						if($line->product_type==9 && $line->rowid>0)
1666
+						{
1667
+							//Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres
1668
+							// génère des lignes d'affichage des montants HT soumis à tva
1669
+							$nbtva = count($TTvas);
1670
+							if(!empty($nbtva)){
1671
+								foreach ($TTvas as $tx =>$val){
1672
+									$l = clone $line;
1673
+									$l->product_type = 1;
1674
+									$l->special_code = '';
1675
+									$l->qty = 1;
1676
+									$l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx));
1677
+									$l->tva_tx = $tx;
1678
+									$l->total_ht = $val['total_ht'];
1679
+									$l->total_tva = $val['total_tva'];
1680
+									$l->total = $line->total_ht;
1681
+									$l->total_ttc = $val['total_ttc'];
1682
+									$TLines[] = $l;
1683
+									array_shift($TTvas);
1684
+							   }
1685
+							}
1686 1686
     					    
1687
-    					    // ajoute la ligne de sous-total
1688
-    					    $TLines[] = $line; 
1689
-    					}
1690
-				    } else {
1687
+							// ajoute la ligne de sous-total
1688
+							$TLines[] = $line; 
1689
+						}
1690
+					} else {
1691 1691
 				        
1692
-				        if($line->product_type==9 && $line->rowid>0)
1693
-				        {
1694
-				            // ajoute la ligne de sous-total
1695
-				            $TLines[] = $line; 
1696
-				        }
1697
-				    }
1692
+						if($line->product_type==9 && $line->rowid>0)
1693
+						{
1694
+							// ajoute la ligne de sous-total
1695
+							$TLines[] = $line; 
1696
+						}
1697
+					}
1698 1698
 				    
1699 1699
 					
1700 1700
 				}
@@ -1719,20 +1719,20 @@  discard block
 block discarded – undo
1719 1719
 			$nbtva = count($TTvas);
1720 1720
 			if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES))
1721 1721
 			{
1722
-			    foreach ($TTvas as $tx =>$val){
1723
-			        $l = clone $line;
1724
-			        $l->product_type = 1;
1725
-			        $l->special_code = '';
1726
-			        $l->qty = 1;
1727
-			        $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx));
1728
-			        $l->tva_tx = $tx;
1729
-			        $l->total_ht = $val['total_ht'];
1730
-			        $l->total_tva = $val['total_tva'];
1731
-			        $l->total = $line->total_ht;
1732
-			        $l->total_ttc = $val['total_ttc'];
1733
-			        $TLines[] = $l;
1734
-			        array_shift($TTvas);
1735
-			    }
1722
+				foreach ($TTvas as $tx =>$val){
1723
+					$l = clone $line;
1724
+					$l->product_type = 1;
1725
+					$l->special_code = '';
1726
+					$l->qty = 1;
1727
+					$l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx));
1728
+					$l->tva_tx = $tx;
1729
+					$l->total_ht = $val['total_ht'];
1730
+					$l->total_tva = $val['total_tva'];
1731
+					$l->total = $line->total_ht;
1732
+					$l->total_ttc = $val['total_ttc'];
1733
+					$TLines[] = $l;
1734
+					array_shift($TTvas);
1735
+				}
1736 1736
 			}
1737 1737
 			
1738 1738
 			global $nblignes;
@@ -1744,7 +1744,7 @@  discard block
 block discarded – undo
1744 1744
 				$this->resprints = '';
1745 1745
 				return 0;
1746 1746
 			}
1747
-	    }
1747
+		}
1748 1748
 		
1749 1749
 		return 0;
1750 1750
 	}
@@ -1907,18 +1907,18 @@  discard block
 block discarded – undo
1907 1907
 		}
1908 1908
 		elseif($object->element == 'order_supplier' )
1909 1909
 		{
1910
-		    $createRight = $user->rights->fournisseur->commande->creer;
1910
+			$createRight = $user->rights->fournisseur->commande->creer;
1911 1911
 		}
1912 1912
 		elseif($object->element == 'invoice_supplier' )
1913 1913
 		{
1914
-		    $createRight = $user->rights->fournisseur->facture->creer;
1914
+			$createRight = $user->rights->fournisseur->facture->creer;
1915 1915
 		}
1916 1916
 		
1917 1917
 		if($line->special_code!=$this->module_number || $line->product_type!=9) {
1918 1918
 			null;
1919 1919
 		}	
1920 1920
 		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)) 
1921
-        {
1921
+		{
1922 1922
 			if($object->element=='facture')$idvar = 'facid';
1923 1923
 			else $idvar='id';
1924 1924
 			
@@ -1965,7 +1965,7 @@  discard block
 block discarded – undo
1965 1965
 			//var_dump($line);
1966 1966
             
1967 1967
 			// HTML 5 data for js
1968
-            $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager);
1968
+			$data = $this->_getHtmlData($parameters, $object, $action, $hookmanager);
1969 1969
             
1970 1970
 			
1971 1971
 			?>
@@ -2023,8 +2023,8 @@  discard block
 block discarded – undo
2023 2023
 						}
2024 2024
 						
2025 2025
 						if ($object->element == 'order_supplier' || $object->element == 'invoice_supplier') {
2026
-						    $line->label = !empty($line->description) ? $line->description : $line->desc;
2027
-						    $line->description = '';
2026
+							$line->label = !empty($line->description) ? $line->description : $line->desc;
2027
+							$line->description = '';
2028 2028
 						}
2029 2029
 						$newlabel = $line->label;
2030 2030
 						if($line->label=='' && !$isFreeText) {
@@ -2058,38 +2058,38 @@  discard block
 block discarded – undo
2058 2058
 						
2059 2059
 
2060 2060
 						echo '<div class="subtotal_underline" style="margin-left:24px; line-height: 25px;">';
2061
-                        echo '<div>';
2062
-                        echo '<input style="vertical-align:sub;"  type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' />&nbsp;';
2063
-                        echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label>';
2064
-                        echo '</div>';
2065
-
2066
-                        if (TSubtotal::isTitle($line))
2067
-                        {
2068
-                            $form = new Form($db);
2069
-                            echo '<div>';
2070
-                            echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>';
2071
-                            echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>';
2072
-                            if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true));
2073
-                            echo '</select>';
2074
-                            echo '</div>';
2075
-
2076
-                            if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION)
2077
-                            {
2078
-                                echo '<div>';
2079
-                                echo '<label for="subtotal_progress">'.$langs->trans('subtotal_apply_progress').'</label> <input id="subtotal_progress" name="subtotal_progress" value="" size="1" />%';
2080
-                                echo '</div>';
2081
-                            }
2082
-                            echo '<div>';
2083
-                            echo '<input style="vertical-align:sub;"  type="checkbox" name="line-showTotalHT" id="subtotal-showTotalHT" value="9" '.(($line->array_options['options_show_total_ht'] > 0) ? 'checked="checked"' : '') .' />&nbsp;';
2084
-                            echo '<label for="subtotal-showTotalHT">'.$langs->trans('ShowTotalHTOnSubtotalBlock').'</label>';
2085
-                            echo '</div>';
2086
-
2087
-                            echo '<div>';
2088
-                            echo '<input style="vertical-align:sub;"  type="checkbox" name="line-showReduc" id="subtotal-showReduc" value="1" '.(($line->array_options['options_show_reduc'] > 0) ? 'checked="checked"' : '') .' />&nbsp;';
2089
-                            echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>';
2090
-                            echo '</div>';
2091
-                        }
2092
-                        else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation);
2061
+						echo '<div>';
2062
+						echo '<input style="vertical-align:sub;"  type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' />&nbsp;';
2063
+						echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label>';
2064
+						echo '</div>';
2065
+
2066
+						if (TSubtotal::isTitle($line))
2067
+						{
2068
+							$form = new Form($db);
2069
+							echo '<div>';
2070
+							echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>';
2071
+							echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>';
2072
+							if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true));
2073
+							echo '</select>';
2074
+							echo '</div>';
2075
+
2076
+							if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION)
2077
+							{
2078
+								echo '<div>';
2079
+								echo '<label for="subtotal_progress">'.$langs->trans('subtotal_apply_progress').'</label> <input id="subtotal_progress" name="subtotal_progress" value="" size="1" />%';
2080
+								echo '</div>';
2081
+							}
2082
+							echo '<div>';
2083
+							echo '<input style="vertical-align:sub;"  type="checkbox" name="line-showTotalHT" id="subtotal-showTotalHT" value="9" '.(($line->array_options['options_show_total_ht'] > 0) ? 'checked="checked"' : '') .' />&nbsp;';
2084
+							echo '<label for="subtotal-showTotalHT">'.$langs->trans('ShowTotalHTOnSubtotalBlock').'</label>';
2085
+							echo '</div>';
2086
+
2087
+							echo '<div>';
2088
+							echo '<input style="vertical-align:sub;"  type="checkbox" name="line-showReduc" id="subtotal-showReduc" value="1" '.(($line->array_options['options_show_reduc'] > 0) ? 'checked="checked"' : '') .' />&nbsp;';
2089
+							echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>';
2090
+							echo '</div>';
2091
+						}
2092
+						else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation);
2093 2093
 						echo '</div>';
2094 2094
 
2095 2095
 						if($line->qty<10) {
@@ -2331,17 +2331,17 @@  discard block
 block discarded – undo
2331 2331
 		if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline')
2332 2332
 		{
2333 2333
 		    
2334
-		    if($object->element == 'invoice_supplier' || $object->element == 'order_supplier')
2335
-		    {
2336
-		        foreach ($object->lines as $line)
2337
-		        {
2338
-		            // fetch optionals attributes and labels
2339
-		            require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
2340
-		            $extrafields=new ExtraFields($this->db);
2341
-		            $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true);
2342
-		            $line->fetch_optionals($line->id,$extralabels);
2343
-		        }
2344
-		    }
2334
+			if($object->element == 'invoice_supplier' || $object->element == 'order_supplier')
2335
+			{
2336
+				foreach ($object->lines as $line)
2337
+				{
2338
+					// fetch optionals attributes and labels
2339
+					require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
2340
+					$extrafields=new ExtraFields($this->db);
2341
+					$extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true);
2342
+					$line->fetch_optionals($line->id,$extralabels);
2343
+				}
2344
+			}
2345 2345
 		    
2346 2346
 			$TSubNc = array();
2347 2347
 			foreach ($object->lines as &$l)
@@ -2432,80 +2432,80 @@  discard block
 block discarded – undo
2432 2432
 	{
2433 2433
 		dol_include_once('/subtotal/class/subtotal.class.php');
2434 2434
 
2435
-	    $line = &$parameters['line'];
2435
+		$line = &$parameters['line'];
2436 2436
 	    
2437
-	    $ThtmlData['data-id']           = $line->id;
2438
-	    $ThtmlData['data-product_type'] = $line->product_type;
2439
-	    $ThtmlData['data-qty']          = 0; //$line->qty;
2440
-	    $ThtmlData['data-level']        = TSubtotal::getNiveau($line);
2437
+		$ThtmlData['data-id']           = $line->id;
2438
+		$ThtmlData['data-product_type'] = $line->product_type;
2439
+		$ThtmlData['data-qty']          = 0; //$line->qty;
2440
+		$ThtmlData['data-level']        = TSubtotal::getNiveau($line);
2441 2441
 	    
2442
-	    if(TSubtotal::isTitle($line)){
2443
-	        $ThtmlData['data-issubtotal'] = 'title';
2444
-	    }elseif(TSubtotal::isSubtotal($line)){
2445
-	        $ThtmlData['data-issubtotal'] = 'subtotal';
2446
-	    }
2447
-	    else{
2448
-	        $ThtmlData['data-issubtotal'] = 'freetext';
2449
-	    }
2442
+		if(TSubtotal::isTitle($line)){
2443
+			$ThtmlData['data-issubtotal'] = 'title';
2444
+		}elseif(TSubtotal::isSubtotal($line)){
2445
+			$ThtmlData['data-issubtotal'] = 'subtotal';
2446
+		}
2447
+		else{
2448
+			$ThtmlData['data-issubtotal'] = 'freetext';
2449
+		}
2450 2450
 	    
2451 2451
 	    
2452
-	    // Change or add data  from hooks
2453
-	    $parameters = array_replace($parameters , array(  'ThtmlData' => $ThtmlData )  );
2452
+		// Change or add data  from hooks
2453
+		$parameters = array_replace($parameters , array(  'ThtmlData' => $ThtmlData )  );
2454 2454
 	    
2455
-	    // hook 
2456
-	    $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
2457
-	    if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
2458
-	    if ($reshook>0)
2459
-	    {
2460
-	        $ThtmlData = $hookmanager->resArray;
2461
-	    }
2462
-
2463
-	    return $this->implodeHtmlData($ThtmlData);
2455
+		// hook 
2456
+		$reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
2457
+		if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
2458
+		if ($reshook>0)
2459
+		{
2460
+			$ThtmlData = $hookmanager->resArray;
2461
+		}
2462
+
2463
+		return $this->implodeHtmlData($ThtmlData);
2464 2464
 	
2465 2465
 	}
2466 2466
 	
2467 2467
 	
2468 2468
 	function implodeHtmlData($ThtmlData = array())
2469 2469
 	{
2470
-	    $data = '';
2471
-	    foreach($ThtmlData as $k => $h )
2472
-	    {
2473
-	        if(is_array($h))
2474
-	        {
2475
-	            $h = json_encode($h);
2476
-	        }
2470
+		$data = '';
2471
+		foreach($ThtmlData as $k => $h )
2472
+		{
2473
+			if(is_array($h))
2474
+			{
2475
+				$h = json_encode($h);
2476
+			}
2477 2477
 	        
2478
-	        $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" ';
2479
-	    }
2478
+			$data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" ';
2479
+		}
2480 2480
 	    
2481
-	    return $data;
2481
+		return $data;
2482 2482
 	}
2483 2483
 	
2484 2484
 	function _ajax_block_order_js($object)
2485 2485
 	{
2486
-	    global $conf,$tagidfortablednd,$filepath,$langs;
2486
+		global $conf,$tagidfortablednd,$filepath,$langs;
2487 2487
 	    
2488
-	    /*
2488
+		/*
2489 2489
 	     * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php 
2490 2490
 	     * for compatibility reasons we don't use tableDnD but jquery sortable
2491 2491
 	     */
2492 2492
 	    
2493
-	    $id=$object->id;
2494
-	    $nboflines=(isset($object->lines)?count($object->lines):0);
2495
-	    $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1;
2493
+		$id=$object->id;
2494
+		$nboflines=(isset($object->lines)?count($object->lines):0);
2495
+		$forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1;
2496 2496
 	    
2497
-	    $id=$object->id;
2498
-	    $fk_element=$object->fk_element;
2499
-	    $table_element_line=$object->table_element_line;
2500
-	    $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines));
2501
-	    $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd);
2502
-	    $filepath=(empty($filepath)?'':$filepath);
2497
+		$id=$object->id;
2498
+		$fk_element=$object->fk_element;
2499
+		$table_element_line=$object->table_element_line;
2500
+		$nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines));
2501
+		$tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd);
2502
+		$filepath=(empty($filepath)?'':$filepath);
2503 2503
 	    
2504 2504
 	    
2505
-	    if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1)
2506
-	    {
2505
+		if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1)
2506
+		{
2507 2507
 	        
2508
-	        ?>
2508
+			?>
2509 2509
 		
2510 2510
 		
2511 2511
 			<script type="text/javascript">
Please login to merge, or discard this patch.