@@ -31,182 +31,182 @@ discard block |
||
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.10'; |
|
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( |
|
100 | - 'invoicecard' |
|
101 | - ,'invoicesuppliercard' |
|
102 | - ,'propalcard' |
|
103 | - ,'supplier_proposalcard' |
|
104 | - ,'ordercard' |
|
105 | - ,'ordersuppliercard' |
|
106 | - ,'odtgeneration' |
|
107 | - ,'orderstoinvoice' |
|
108 | - ,'admin' |
|
109 | - ,'invoicereccard' |
|
110 | - ,'consumptionthirdparty' |
|
111 | - ) |
|
112 | - // Set here all workflow context managed by module |
|
113 | - //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')) |
|
114 | - ); |
|
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.10'; |
|
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( |
|
100 | + 'invoicecard' |
|
101 | + ,'invoicesuppliercard' |
|
102 | + ,'propalcard' |
|
103 | + ,'supplier_proposalcard' |
|
104 | + ,'ordercard' |
|
105 | + ,'ordersuppliercard' |
|
106 | + ,'odtgeneration' |
|
107 | + ,'orderstoinvoice' |
|
108 | + ,'admin' |
|
109 | + ,'invoicereccard' |
|
110 | + ,'consumptionthirdparty' |
|
111 | + ) |
|
112 | + // Set here all workflow context managed by module |
|
113 | + //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')) |
|
114 | + ); |
|
115 | 115 | |
116 | - // Data directories to create when module is enabled. |
|
117 | - // Example: this->dirs = array("/titre/temp"); |
|
118 | - $this->dirs = array(); |
|
116 | + // Data directories to create when module is enabled. |
|
117 | + // Example: this->dirs = array("/titre/temp"); |
|
118 | + $this->dirs = array(); |
|
119 | 119 | |
120 | - // Config pages. Put here list of php pages |
|
121 | - // stored into titre/admin directory, used to setup module. |
|
122 | - $this->config_page_url = array("subtotal_setup.php@subtotal"); |
|
120 | + // Config pages. Put here list of php pages |
|
121 | + // stored into titre/admin directory, used to setup module. |
|
122 | + $this->config_page_url = array("subtotal_setup.php@subtotal"); |
|
123 | 123 | |
124 | - // Dependencies |
|
125 | - // List of modules id that must be enabled if this module is enabled |
|
126 | - $this->depends = array(); |
|
124 | + // Dependencies |
|
125 | + // List of modules id that must be enabled if this module is enabled |
|
126 | + $this->depends = array(); |
|
127 | 127 | |
128 | 128 | $this->conflictwith=array('modMilestone'); |
129 | - // List of modules id to disable if this one is disabled |
|
130 | - $this->requiredby = array(); |
|
131 | - // Minimum version of PHP required by module |
|
132 | - $this->phpmin = array(5, 3); |
|
133 | - // Minimum version of Dolibarr required by module |
|
134 | - $this->need_dolibarr_version = array(3, 2); |
|
135 | - $this->langfiles = array("subtotal@subtotal"); // langfiles@titre |
|
136 | - // Constants |
|
137 | - // List of particular constants to add when module is enabled |
|
138 | - // (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
|
139 | - // Example: |
|
140 | - $this->const = array( |
|
141 | - 0=>array( |
|
142 | - 'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES', |
|
143 | - 'chaine', |
|
144 | - 'I', |
|
145 | - 'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché', |
|
146 | - 1 |
|
147 | - ) |
|
129 | + // List of modules id to disable if this one is disabled |
|
130 | + $this->requiredby = array(); |
|
131 | + // Minimum version of PHP required by module |
|
132 | + $this->phpmin = array(5, 3); |
|
133 | + // Minimum version of Dolibarr required by module |
|
134 | + $this->need_dolibarr_version = array(3, 2); |
|
135 | + $this->langfiles = array("subtotal@subtotal"); // langfiles@titre |
|
136 | + // Constants |
|
137 | + // List of particular constants to add when module is enabled |
|
138 | + // (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive) |
|
139 | + // Example: |
|
140 | + $this->const = array( |
|
141 | + 0=>array( |
|
142 | + 'SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES', |
|
143 | + 'chaine', |
|
144 | + 'I', |
|
145 | + 'Définit le style (B : gras, I : Italique, U : Souligné) des sous titres lorsque le détail des lignes et des ensembles est caché', |
|
146 | + 1 |
|
147 | + ) |
|
148 | 148 | ,1=>array('SUBTOTAL_ALLOW_ADD_BLOCK', 'chaine', '1', 'Permet l\'ajout de titres et sous-totaux') |
149 | 149 | ,2=>array('SUBTOTAL_ALLOW_EDIT_BLOCK', 'chaine', '1', 'Permet de modifier titres et sous-totaux') |
150 | 150 | ,3=>array('SUBTOTAL_ALLOW_REMOVE_BLOCK', 'chaine', '1', 'Permet de supprimer les titres et sous-totaux') |
151 | 151 | ,4=>array('SUBTOTAL_TITLE_STYLE', 'chaine', 'BU') |
152 | 152 | ,5=>array('SUBTOTAL_SUBTOTAL_STYLE', 'chaine', 'B') |
153 | - // 1=>array( |
|
154 | - // 'MYMODULE_MYNEWCONST2', |
|
155 | - // 'chaine', |
|
156 | - // 'myvalue', |
|
157 | - // 'This is another constant to add', |
|
158 | - // 0 |
|
159 | - // ) |
|
160 | - ); |
|
153 | + // 1=>array( |
|
154 | + // 'MYMODULE_MYNEWCONST2', |
|
155 | + // 'chaine', |
|
156 | + // 'myvalue', |
|
157 | + // 'This is another constant to add', |
|
158 | + // 0 |
|
159 | + // ) |
|
160 | + ); |
|
161 | 161 | |
162 | 162 | |
163 | 163 | |
164 | 164 | |
165 | - // Array to add new pages in new tabs |
|
166 | - // Example: |
|
167 | - $this->tabs = array( |
|
168 | - // // To add a new tab identified by code tabname1 |
|
169 | - // 'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__', |
|
170 | - // // To add another new tab identified by code tabname2 |
|
171 | - // 'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__', |
|
172 | - // // To remove an existing tab identified by code tabname |
|
173 | - // 'objecttype:-tabname' |
|
174 | - ); |
|
175 | - // where objecttype can be |
|
176 | - // 'thirdparty' to add a tab in third party view |
|
177 | - // 'intervention' to add a tab in intervention view |
|
178 | - // 'order_supplier' to add a tab in supplier order view |
|
179 | - // 'invoice_supplier' to add a tab in supplier invoice view |
|
180 | - // 'invoice' to add a tab in customer invoice view |
|
181 | - // 'order' to add a tab in customer order view |
|
182 | - // 'product' to add a tab in product view |
|
183 | - // 'stock' to add a tab in stock view |
|
184 | - // 'propal' to add a tab in propal view |
|
185 | - // 'member' to add a tab in fundation member view |
|
186 | - // 'contract' to add a tab in contract view |
|
187 | - // 'user' to add a tab in user view |
|
188 | - // 'group' to add a tab in group view |
|
189 | - // 'contact' to add a tab in contact view |
|
190 | - // 'categories_x' to add a tab in category view |
|
191 | - // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
|
192 | - // Dictionnaries |
|
193 | - if (! isset($conf->subtotal->enabled)) { |
|
194 | - $conf->subtotal=new stdClass(); |
|
195 | - $conf->subtotal->enabled = 0; |
|
196 | - } |
|
197 | - $this->dictionaries = array( |
|
165 | + // Array to add new pages in new tabs |
|
166 | + // Example: |
|
167 | + $this->tabs = array( |
|
168 | + // // To add a new tab identified by code tabname1 |
|
169 | + // 'objecttype:+tabname1:Title1:langfile@titre:$user->rights->titre->read:/titre/mynewtab1.php?id=__ID__', |
|
170 | + // // To add another new tab identified by code tabname2 |
|
171 | + // 'objecttype:+tabname2:Title2:langfile@titre:$user->rights->othermodule->read:/titre/mynewtab2.php?id=__ID__', |
|
172 | + // // To remove an existing tab identified by code tabname |
|
173 | + // 'objecttype:-tabname' |
|
174 | + ); |
|
175 | + // where objecttype can be |
|
176 | + // 'thirdparty' to add a tab in third party view |
|
177 | + // 'intervention' to add a tab in intervention view |
|
178 | + // 'order_supplier' to add a tab in supplier order view |
|
179 | + // 'invoice_supplier' to add a tab in supplier invoice view |
|
180 | + // 'invoice' to add a tab in customer invoice view |
|
181 | + // 'order' to add a tab in customer order view |
|
182 | + // 'product' to add a tab in product view |
|
183 | + // 'stock' to add a tab in stock view |
|
184 | + // 'propal' to add a tab in propal view |
|
185 | + // 'member' to add a tab in fundation member view |
|
186 | + // 'contract' to add a tab in contract view |
|
187 | + // 'user' to add a tab in user view |
|
188 | + // 'group' to add a tab in group view |
|
189 | + // 'contact' to add a tab in contact view |
|
190 | + // 'categories_x' to add a tab in category view |
|
191 | + // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
|
192 | + // Dictionnaries |
|
193 | + if (! isset($conf->subtotal->enabled)) { |
|
194 | + $conf->subtotal=new stdClass(); |
|
195 | + $conf->subtotal->enabled = 0; |
|
196 | + } |
|
197 | + $this->dictionaries = array( |
|
198 | 198 | 'langs'=>'subtotal@subtotal', |
199 | - 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
200 | - 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
201 | - '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 |
|
202 | - 'tabsqlsort'=>array('label ASC'), // Sort order |
|
203 | - 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
204 | - 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
205 | - 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
206 | - 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
207 | - 'tabcond'=>array($conf->subtotal->enabled) |
|
199 | + 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
200 | + 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
201 | + '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 |
|
202 | + 'tabsqlsort'=>array('label ASC'), // Sort order |
|
203 | + 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
204 | + 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
205 | + 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
206 | + 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
207 | + 'tabcond'=>array($conf->subtotal->enabled) |
|
208 | 208 | ); |
209 | - /* Example: |
|
209 | + /* Example: |
|
210 | 210 | // This is to avoid warnings |
211 | 211 | if (! isset($conf->titre->enabled)) $conf->titre->enabled=0; |
212 | 212 | $this->dictionnaries=array( |
@@ -247,223 +247,223 @@ discard block |
||
247 | 247 | ); |
248 | 248 | */ |
249 | 249 | |
250 | - // Boxes |
|
251 | - // Add here list of php file(s) stored in core/boxes that contains class to show a box. |
|
252 | - $this->boxes = array(); // Boxes list |
|
250 | + // Boxes |
|
251 | + // Add here list of php file(s) stored in core/boxes that contains class to show a box. |
|
252 | + $this->boxes = array(); // Boxes list |
|
253 | 253 | |
254 | - /* |
|
254 | + /* |
|
255 | 255 | $this->boxes[$r][1] = "myboxb.php"; |
256 | 256 | $r++; |
257 | 257 | */ |
258 | 258 | |
259 | - // Permissions |
|
260 | - $this->rights = array(); // Permission array used by this module |
|
261 | - $r = 0; |
|
259 | + // Permissions |
|
260 | + $this->rights = array(); // Permission array used by this module |
|
261 | + $r = 0; |
|
262 | 262 | |
263 | - // Add here list of permission defined by |
|
264 | - // an id, a label, a boolean and two constant strings. |
|
265 | - // Example: |
|
266 | - //// Permission id (must not be already used) |
|
267 | - //$this->rights[$r][0] = 2000; |
|
268 | - //// Permission label |
|
269 | - //$this->rights[$r][1] = 'Permision label'; |
|
270 | - //// Permission by default for new user (0/1) |
|
271 | - //$this->rights[$r][3] = 1; |
|
272 | - //// In php code, permission will be checked by test |
|
273 | - //// if ($user->rights->permkey->level1->level2) |
|
274 | - //$this->rights[$r][4] = 'level1'; |
|
275 | - //// In php code, permission will be checked by test |
|
276 | - //// if ($user->rights->permkey->level1->level2) |
|
277 | - //$this->rights[$r][5] = 'level2'; |
|
278 | - //$r++; |
|
279 | - // Main menu entries |
|
280 | - $this->menus = array(); // List of menus to add |
|
281 | - $r = 0; |
|
263 | + // Add here list of permission defined by |
|
264 | + // an id, a label, a boolean and two constant strings. |
|
265 | + // Example: |
|
266 | + //// Permission id (must not be already used) |
|
267 | + //$this->rights[$r][0] = 2000; |
|
268 | + //// Permission label |
|
269 | + //$this->rights[$r][1] = 'Permision label'; |
|
270 | + //// Permission by default for new user (0/1) |
|
271 | + //$this->rights[$r][3] = 1; |
|
272 | + //// In php code, permission will be checked by test |
|
273 | + //// if ($user->rights->permkey->level1->level2) |
|
274 | + //$this->rights[$r][4] = 'level1'; |
|
275 | + //// In php code, permission will be checked by test |
|
276 | + //// if ($user->rights->permkey->level1->level2) |
|
277 | + //$this->rights[$r][5] = 'level2'; |
|
278 | + //$r++; |
|
279 | + // Main menu entries |
|
280 | + $this->menus = array(); // List of menus to add |
|
281 | + $r = 0; |
|
282 | 282 | |
283 | - // Add here entries to declare new menus |
|
284 | - // |
|
285 | - // Example to declare a new Top Menu entry and its Left menu entry: |
|
286 | - //$this->menu[$r]=array( |
|
287 | - // // Put 0 if this is a top menu |
|
288 | - // 'fk_menu'=>0, |
|
289 | - // // This is a Top menu entry |
|
290 | - // 'type'=>'top', |
|
291 | - // 'titre'=>'titre top menu', |
|
292 | - // 'mainmenu'=>'titre', |
|
293 | - // 'leftmenu'=>'titre', |
|
294 | - // 'url'=>'/titre/pagetop.php', |
|
295 | - // // Lang file to use (without .lang) by module. |
|
296 | - // // File must be in langs/code_CODE/ directory. |
|
297 | - // 'langs'=>'mylangfile', |
|
298 | - // 'position'=>100, |
|
299 | - // // Define condition to show or hide menu entry. |
|
300 | - // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
301 | - // 'enabled'=>'$conf->titre->enabled', |
|
302 | - // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
303 | - // // if you want your menu with a permission rules |
|
304 | - // 'perms'=>'1', |
|
305 | - // 'target'=>'', |
|
306 | - // // 0=Menu for internal users, 1=external users, 2=both |
|
307 | - // 'user'=>2 |
|
308 | - //); |
|
309 | - //$r++; |
|
310 | - //$this->menu[$r]=array( |
|
311 | - // // Use r=value where r is index key used for the parent menu entry |
|
312 | - // // (higher parent must be a top menu entry) |
|
313 | - // 'fk_menu'=>'r=0', |
|
314 | - // // This is a Left menu entry |
|
315 | - // 'type'=>'left', |
|
316 | - // 'titre'=>'titre left menu', |
|
317 | - // 'mainmenu'=>'titre', |
|
318 | - // 'leftmenu'=>'titre', |
|
319 | - // 'url'=>'/titre/pagelevel1.php', |
|
320 | - // // Lang file to use (without .lang) by module. |
|
321 | - // // File must be in langs/code_CODE/ directory. |
|
322 | - // 'langs'=>'mylangfile', |
|
323 | - // 'position'=>100, |
|
324 | - // // Define condition to show or hide menu entry. |
|
325 | - // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
326 | - // 'enabled'=>'$conf->titre->enabled', |
|
327 | - // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
328 | - // // if you want your menu with a permission rules |
|
329 | - // 'perms'=>'1', |
|
330 | - // 'target'=>'', |
|
331 | - // // 0=Menu for internal users, 1=external users, 2=both |
|
332 | - // 'user'=>2 |
|
333 | - //); |
|
334 | - //$r++; |
|
335 | - // |
|
336 | - // Example to declare a Left Menu entry into an existing Top menu entry: |
|
337 | - //$this->menu[$r]=array( |
|
338 | - // // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' |
|
339 | - // 'fk_menu'=>'fk_mainmenu=mainmenucode', |
|
340 | - // // This is a Left menu entry |
|
341 | - // 'type'=>'left', |
|
342 | - // 'titre'=>'titre left menu', |
|
343 | - // 'mainmenu'=>'mainmenucode', |
|
344 | - // 'leftmenu'=>'titre', |
|
345 | - // 'url'=>'/titre/pagelevel2.php', |
|
346 | - // // Lang file to use (without .lang) by module. |
|
347 | - // // File must be in langs/code_CODE/ directory. |
|
348 | - // 'langs'=>'mylangfile', |
|
349 | - // 'position'=>100, |
|
350 | - // // Define condition to show or hide menu entry. |
|
351 | - // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
352 | - // // Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
353 | - // 'enabled'=>'$conf->titre->enabled', |
|
354 | - // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
355 | - // // if you want your menu with a permission rules |
|
356 | - // 'perms'=>'1', |
|
357 | - // 'target'=>'', |
|
358 | - // // 0=Menu for internal users, 1=external users, 2=both |
|
359 | - // 'user'=>2 |
|
360 | - //); |
|
361 | - //$r++; |
|
362 | - // Exports |
|
363 | - $r = 1; |
|
283 | + // Add here entries to declare new menus |
|
284 | + // |
|
285 | + // Example to declare a new Top Menu entry and its Left menu entry: |
|
286 | + //$this->menu[$r]=array( |
|
287 | + // // Put 0 if this is a top menu |
|
288 | + // 'fk_menu'=>0, |
|
289 | + // // This is a Top menu entry |
|
290 | + // 'type'=>'top', |
|
291 | + // 'titre'=>'titre top menu', |
|
292 | + // 'mainmenu'=>'titre', |
|
293 | + // 'leftmenu'=>'titre', |
|
294 | + // 'url'=>'/titre/pagetop.php', |
|
295 | + // // Lang file to use (without .lang) by module. |
|
296 | + // // File must be in langs/code_CODE/ directory. |
|
297 | + // 'langs'=>'mylangfile', |
|
298 | + // 'position'=>100, |
|
299 | + // // Define condition to show or hide menu entry. |
|
300 | + // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
301 | + // 'enabled'=>'$conf->titre->enabled', |
|
302 | + // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
303 | + // // if you want your menu with a permission rules |
|
304 | + // 'perms'=>'1', |
|
305 | + // 'target'=>'', |
|
306 | + // // 0=Menu for internal users, 1=external users, 2=both |
|
307 | + // 'user'=>2 |
|
308 | + //); |
|
309 | + //$r++; |
|
310 | + //$this->menu[$r]=array( |
|
311 | + // // Use r=value where r is index key used for the parent menu entry |
|
312 | + // // (higher parent must be a top menu entry) |
|
313 | + // 'fk_menu'=>'r=0', |
|
314 | + // // This is a Left menu entry |
|
315 | + // 'type'=>'left', |
|
316 | + // 'titre'=>'titre left menu', |
|
317 | + // 'mainmenu'=>'titre', |
|
318 | + // 'leftmenu'=>'titre', |
|
319 | + // 'url'=>'/titre/pagelevel1.php', |
|
320 | + // // Lang file to use (without .lang) by module. |
|
321 | + // // File must be in langs/code_CODE/ directory. |
|
322 | + // 'langs'=>'mylangfile', |
|
323 | + // 'position'=>100, |
|
324 | + // // Define condition to show or hide menu entry. |
|
325 | + // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
326 | + // 'enabled'=>'$conf->titre->enabled', |
|
327 | + // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
328 | + // // if you want your menu with a permission rules |
|
329 | + // 'perms'=>'1', |
|
330 | + // 'target'=>'', |
|
331 | + // // 0=Menu for internal users, 1=external users, 2=both |
|
332 | + // 'user'=>2 |
|
333 | + //); |
|
334 | + //$r++; |
|
335 | + // |
|
336 | + // Example to declare a Left Menu entry into an existing Top menu entry: |
|
337 | + //$this->menu[$r]=array( |
|
338 | + // // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' |
|
339 | + // 'fk_menu'=>'fk_mainmenu=mainmenucode', |
|
340 | + // // This is a Left menu entry |
|
341 | + // 'type'=>'left', |
|
342 | + // 'titre'=>'titre left menu', |
|
343 | + // 'mainmenu'=>'mainmenucode', |
|
344 | + // 'leftmenu'=>'titre', |
|
345 | + // 'url'=>'/titre/pagelevel2.php', |
|
346 | + // // Lang file to use (without .lang) by module. |
|
347 | + // // File must be in langs/code_CODE/ directory. |
|
348 | + // 'langs'=>'mylangfile', |
|
349 | + // 'position'=>100, |
|
350 | + // // Define condition to show or hide menu entry. |
|
351 | + // // Use '$conf->titre->enabled' if entry must be visible if module is enabled. |
|
352 | + // // Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
353 | + // 'enabled'=>'$conf->titre->enabled', |
|
354 | + // // Use 'perms'=>'$user->rights->titre->level1->level2' |
|
355 | + // // if you want your menu with a permission rules |
|
356 | + // 'perms'=>'1', |
|
357 | + // 'target'=>'', |
|
358 | + // // 0=Menu for internal users, 1=external users, 2=both |
|
359 | + // 'user'=>2 |
|
360 | + //); |
|
361 | + //$r++; |
|
362 | + // Exports |
|
363 | + $r = 1; |
|
364 | 364 | |
365 | - // Example: |
|
366 | - //$this->export_code[$r]=$this->rights_class.'_'.$r; |
|
367 | - //// Translation key (used only if key ExportDataset_xxx_z not found) |
|
368 | - //$this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; |
|
369 | - //// Condition to show export in list (ie: '$user->id==3'). |
|
370 | - //// Set to 1 to always show when module is enabled. |
|
371 | - //$this->export_enabled[$r]='1'; |
|
372 | - //$this->export_permission[$r]=array(array("facture","facture","export")); |
|
373 | - //$this->export_fields_array[$r]=array( |
|
374 | - // 's.rowid'=>"IdCompany", |
|
375 | - // 's.nom'=>'CompanyName', |
|
376 | - // 's.address'=>'Address', |
|
377 | - // 's.cp'=>'Zip', |
|
378 | - // 's.ville'=>'Town', |
|
379 | - // 's.fk_pays'=>'Country', |
|
380 | - // 's.tel'=>'Phone', |
|
381 | - // 's.siren'=>'ProfId1', |
|
382 | - // 's.siret'=>'ProfId2', |
|
383 | - // 's.ape'=>'ProfId3', |
|
384 | - // 's.idprof4'=>'ProfId4', |
|
385 | - // 's.code_compta'=>'CustomerAccountancyCode', |
|
386 | - // 's.code_compta_fournisseur'=>'SupplierAccountancyCode', |
|
387 | - // 'f.rowid'=>"InvoiceId", |
|
388 | - // 'f.facnumber'=>"InvoiceRef", |
|
389 | - // 'f.datec'=>"InvoiceDateCreation", |
|
390 | - // 'f.datef'=>"DateInvoice", |
|
391 | - // 'f.total'=>"TotalHT", |
|
392 | - // 'f.total_ttc'=>"TotalTTC", |
|
393 | - // 'f.tva'=>"TotalVAT", |
|
394 | - // 'f.paye'=>"InvoicePaid", |
|
395 | - // 'f.fk_statut'=>'InvoiceStatus', |
|
396 | - // 'f.note'=>"InvoiceNote", |
|
397 | - // 'fd.rowid'=>'LineId', |
|
398 | - // 'fd.description'=>"LineDescription", |
|
399 | - // 'fd.price'=>"LineUnitPrice", |
|
400 | - // 'fd.tva_tx'=>"LineVATRate", |
|
401 | - // 'fd.qty'=>"LineQty", |
|
402 | - // 'fd.total_ht'=>"LineTotalHT", |
|
403 | - // 'fd.total_tva'=>"LineTotalTVA", |
|
404 | - // 'fd.total_ttc'=>"LineTotalTTC", |
|
405 | - // 'fd.date_start'=>"DateStart", |
|
406 | - // 'fd.date_end'=>"DateEnd", |
|
407 | - // 'fd.fk_product'=>'ProductId', |
|
408 | - // 'p.ref'=>'ProductRef' |
|
409 | - //); |
|
410 | - //$this->export_entities_array[$r]=array('s.rowid'=>"company", |
|
411 | - // 's.nom'=>'company', |
|
412 | - // 's.address'=>'company', |
|
413 | - // 's.cp'=>'company', |
|
414 | - // 's.ville'=>'company', |
|
415 | - // 's.fk_pays'=>'company', |
|
416 | - // 's.tel'=>'company', |
|
417 | - // 's.siren'=>'company', |
|
418 | - // 's.siret'=>'company', |
|
419 | - // 's.ape'=>'company', |
|
420 | - // 's.idprof4'=>'company', |
|
421 | - // 's.code_compta'=>'company', |
|
422 | - // 's.code_compta_fournisseur'=>'company', |
|
423 | - // 'f.rowid'=>"invoice", |
|
424 | - // 'f.facnumber'=>"invoice", |
|
425 | - // 'f.datec'=>"invoice", |
|
426 | - // 'f.datef'=>"invoice", |
|
427 | - // 'f.total'=>"invoice", |
|
428 | - // 'f.total_ttc'=>"invoice", |
|
429 | - // 'f.tva'=>"invoice", |
|
430 | - // 'f.paye'=>"invoice", |
|
431 | - // 'f.fk_statut'=>'invoice', |
|
432 | - // 'f.note'=>"invoice", |
|
433 | - // 'fd.rowid'=>'invoice_line', |
|
434 | - // 'fd.description'=>"invoice_line", |
|
435 | - // 'fd.price'=>"invoice_line", |
|
436 | - // 'fd.total_ht'=>"invoice_line", |
|
437 | - // 'fd.total_tva'=>"invoice_line", |
|
438 | - // 'fd.total_ttc'=>"invoice_line", |
|
439 | - // 'fd.tva_tx'=>"invoice_line", |
|
440 | - // 'fd.qty'=>"invoice_line", |
|
441 | - // 'fd.date_start'=>"invoice_line", |
|
442 | - // 'fd.date_end'=>"invoice_line", |
|
443 | - // 'fd.fk_product'=>'product', |
|
444 | - // 'p.ref'=>'product' |
|
445 | - //); |
|
446 | - //$this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
447 | - //$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, ' |
|
448 | - // . MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)'; |
|
449 | - //$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX |
|
450 | - // . 'product as p on (fd.fk_product = p.rowid)'; |
|
451 | - //$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid ' |
|
452 | - // . 'AND f.rowid = fd.fk_facture'; |
|
453 | - //$r++; |
|
454 | - } |
|
365 | + // Example: |
|
366 | + //$this->export_code[$r]=$this->rights_class.'_'.$r; |
|
367 | + //// Translation key (used only if key ExportDataset_xxx_z not found) |
|
368 | + //$this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; |
|
369 | + //// Condition to show export in list (ie: '$user->id==3'). |
|
370 | + //// Set to 1 to always show when module is enabled. |
|
371 | + //$this->export_enabled[$r]='1'; |
|
372 | + //$this->export_permission[$r]=array(array("facture","facture","export")); |
|
373 | + //$this->export_fields_array[$r]=array( |
|
374 | + // 's.rowid'=>"IdCompany", |
|
375 | + // 's.nom'=>'CompanyName', |
|
376 | + // 's.address'=>'Address', |
|
377 | + // 's.cp'=>'Zip', |
|
378 | + // 's.ville'=>'Town', |
|
379 | + // 's.fk_pays'=>'Country', |
|
380 | + // 's.tel'=>'Phone', |
|
381 | + // 's.siren'=>'ProfId1', |
|
382 | + // 's.siret'=>'ProfId2', |
|
383 | + // 's.ape'=>'ProfId3', |
|
384 | + // 's.idprof4'=>'ProfId4', |
|
385 | + // 's.code_compta'=>'CustomerAccountancyCode', |
|
386 | + // 's.code_compta_fournisseur'=>'SupplierAccountancyCode', |
|
387 | + // 'f.rowid'=>"InvoiceId", |
|
388 | + // 'f.facnumber'=>"InvoiceRef", |
|
389 | + // 'f.datec'=>"InvoiceDateCreation", |
|
390 | + // 'f.datef'=>"DateInvoice", |
|
391 | + // 'f.total'=>"TotalHT", |
|
392 | + // 'f.total_ttc'=>"TotalTTC", |
|
393 | + // 'f.tva'=>"TotalVAT", |
|
394 | + // 'f.paye'=>"InvoicePaid", |
|
395 | + // 'f.fk_statut'=>'InvoiceStatus', |
|
396 | + // 'f.note'=>"InvoiceNote", |
|
397 | + // 'fd.rowid'=>'LineId', |
|
398 | + // 'fd.description'=>"LineDescription", |
|
399 | + // 'fd.price'=>"LineUnitPrice", |
|
400 | + // 'fd.tva_tx'=>"LineVATRate", |
|
401 | + // 'fd.qty'=>"LineQty", |
|
402 | + // 'fd.total_ht'=>"LineTotalHT", |
|
403 | + // 'fd.total_tva'=>"LineTotalTVA", |
|
404 | + // 'fd.total_ttc'=>"LineTotalTTC", |
|
405 | + // 'fd.date_start'=>"DateStart", |
|
406 | + // 'fd.date_end'=>"DateEnd", |
|
407 | + // 'fd.fk_product'=>'ProductId', |
|
408 | + // 'p.ref'=>'ProductRef' |
|
409 | + //); |
|
410 | + //$this->export_entities_array[$r]=array('s.rowid'=>"company", |
|
411 | + // 's.nom'=>'company', |
|
412 | + // 's.address'=>'company', |
|
413 | + // 's.cp'=>'company', |
|
414 | + // 's.ville'=>'company', |
|
415 | + // 's.fk_pays'=>'company', |
|
416 | + // 's.tel'=>'company', |
|
417 | + // 's.siren'=>'company', |
|
418 | + // 's.siret'=>'company', |
|
419 | + // 's.ape'=>'company', |
|
420 | + // 's.idprof4'=>'company', |
|
421 | + // 's.code_compta'=>'company', |
|
422 | + // 's.code_compta_fournisseur'=>'company', |
|
423 | + // 'f.rowid'=>"invoice", |
|
424 | + // 'f.facnumber'=>"invoice", |
|
425 | + // 'f.datec'=>"invoice", |
|
426 | + // 'f.datef'=>"invoice", |
|
427 | + // 'f.total'=>"invoice", |
|
428 | + // 'f.total_ttc'=>"invoice", |
|
429 | + // 'f.tva'=>"invoice", |
|
430 | + // 'f.paye'=>"invoice", |
|
431 | + // 'f.fk_statut'=>'invoice', |
|
432 | + // 'f.note'=>"invoice", |
|
433 | + // 'fd.rowid'=>'invoice_line', |
|
434 | + // 'fd.description'=>"invoice_line", |
|
435 | + // 'fd.price'=>"invoice_line", |
|
436 | + // 'fd.total_ht'=>"invoice_line", |
|
437 | + // 'fd.total_tva'=>"invoice_line", |
|
438 | + // 'fd.total_ttc'=>"invoice_line", |
|
439 | + // 'fd.tva_tx'=>"invoice_line", |
|
440 | + // 'fd.qty'=>"invoice_line", |
|
441 | + // 'fd.date_start'=>"invoice_line", |
|
442 | + // 'fd.date_end'=>"invoice_line", |
|
443 | + // 'fd.fk_product'=>'product', |
|
444 | + // 'p.ref'=>'product' |
|
445 | + //); |
|
446 | + //$this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
447 | + //$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, ' |
|
448 | + // . MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)'; |
|
449 | + //$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX |
|
450 | + // . 'product as p on (fd.fk_product = p.rowid)'; |
|
451 | + //$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid ' |
|
452 | + // . 'AND f.rowid = fd.fk_facture'; |
|
453 | + //$r++; |
|
454 | + } |
|
455 | 455 | |
456 | - /** |
|
457 | - * Function called when module is enabled. |
|
458 | - * The init function add constants, boxes, permissions and menus |
|
459 | - * (defined in constructor) into Dolibarr database. |
|
460 | - * It also creates data directories |
|
461 | - * |
|
462 | - * @param string $options Options when enabling module ('', 'noboxes') |
|
463 | - * @return int 1 if OK, 0 if KO |
|
464 | - */ |
|
465 | - public function init($options = '') |
|
466 | - { |
|
456 | + /** |
|
457 | + * Function called when module is enabled. |
|
458 | + * The init function add constants, boxes, permissions and menus |
|
459 | + * (defined in constructor) into Dolibarr database. |
|
460 | + * It also creates data directories |
|
461 | + * |
|
462 | + * @param string $options Options when enabling module ('', 'noboxes') |
|
463 | + * @return int 1 if OK, 0 if KO |
|
464 | + */ |
|
465 | + public function init($options = '') |
|
466 | + { |
|
467 | 467 | global $conf, $db; |
468 | 468 | |
469 | 469 | |
@@ -471,46 +471,46 @@ discard block |
||
471 | 471 | exit("Attention, ce module rentre ne conflit avec le module Jalon/Milestones. Merci de le désactiver auparavant."); |
472 | 472 | } |
473 | 473 | */ |
474 | - $sql = array(); |
|
474 | + $sql = array(); |
|
475 | 475 | |
476 | - $result = $this->loadTables(); |
|
477 | - dol_include_once('/core/class/extrafields.class.php'); |
|
476 | + $result = $this->loadTables(); |
|
477 | + dol_include_once('/core/class/extrafields.class.php'); |
|
478 | 478 | |
479 | - $extra = new ExtraFields($db); // propaldet, commandedet, facturedet |
|
480 | - $TElementType = array('propaldet', 'commandedet', 'facturedet', 'supplier_proposaldet', 'commande_fournisseurdet', 'facture_fourn_det'); |
|
481 | - foreach($TElementType as $element_type) { |
|
482 | - $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); |
|
483 | - $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); |
|
484 | - } |
|
479 | + $extra = new ExtraFields($db); // propaldet, commandedet, facturedet |
|
480 | + $TElementType = array('propaldet', 'commandedet', 'facturedet', 'supplier_proposaldet', 'commande_fournisseurdet', 'facture_fourn_det'); |
|
481 | + foreach($TElementType as $element_type) { |
|
482 | + $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); |
|
483 | + $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); |
|
484 | + } |
|
485 | 485 | |
486 | - return $this->_init($sql, $options); |
|
487 | - } |
|
486 | + return $this->_init($sql, $options); |
|
487 | + } |
|
488 | 488 | |
489 | - /** |
|
490 | - * Function called when module is disabled. |
|
491 | - * Remove from database constants, boxes and permissions from Dolibarr database. |
|
492 | - * Data directories are not deleted |
|
493 | - * |
|
494 | - * @param string $options Options when enabling module ('', 'noboxes') |
|
495 | - * @return int 1 if OK, 0 if KO |
|
496 | - */ |
|
497 | - public function remove($options = '') |
|
498 | - { |
|
499 | - $sql = array(); |
|
489 | + /** |
|
490 | + * Function called when module is disabled. |
|
491 | + * Remove from database constants, boxes and permissions from Dolibarr database. |
|
492 | + * Data directories are not deleted |
|
493 | + * |
|
494 | + * @param string $options Options when enabling module ('', 'noboxes') |
|
495 | + * @return int 1 if OK, 0 if KO |
|
496 | + */ |
|
497 | + public function remove($options = '') |
|
498 | + { |
|
499 | + $sql = array(); |
|
500 | 500 | |
501 | - return $this->_remove($sql, $options); |
|
502 | - } |
|
501 | + return $this->_remove($sql, $options); |
|
502 | + } |
|
503 | 503 | |
504 | - /** |
|
505 | - * Create tables, keys and data required by module |
|
506 | - * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys |
|
507 | - * and create data commands must be stored in directory /titre/sql/ |
|
508 | - * This function is called by this->init |
|
509 | - * |
|
510 | - * @return int <=0 if KO, >0 if OK |
|
511 | - */ |
|
512 | - private function loadTables() |
|
513 | - { |
|
514 | - return $this->_load_tables('/subtotal/sql/'); |
|
515 | - } |
|
504 | + /** |
|
505 | + * Create tables, keys and data required by module |
|
506 | + * Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys |
|
507 | + * and create data commands must be stored in directory /titre/sql/ |
|
508 | + * This function is called by this->init |
|
509 | + * |
|
510 | + * @return int <=0 if KO, >0 if OK |
|
511 | + */ |
|
512 | + private function loadTables() |
|
513 | + { |
|
514 | + return $this->_load_tables('/subtotal/sql/'); |
|
515 | + } |
|
516 | 516 | } |
@@ -101,11 +101,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -916,7 +916,7 @@ discard block |
||
916 | 916 | if(method_exists('Closure','bind')) { |
917 | 917 | $pageBreakOriginalValue = $pdf->AcceptPageBreak(); |
918 | 918 | $sweetsThief = function ($pdf) { |
919 | - return $pdf->bMargin ; |
|
919 | + return $pdf->bMargin ; |
|
920 | 920 | }; |
921 | 921 | $sweetsThief = Closure::bind($sweetsThief, null, $pdf); |
922 | 922 | |
@@ -984,7 +984,7 @@ discard block |
||
984 | 984 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
985 | 985 | $total_to_print = price($total); |
986 | 986 | |
987 | - $line->total_ht = $total; |
|
987 | + $line->total_ht = $total; |
|
988 | 988 | $line->total = $total; |
989 | 989 | $line->total_tva = $total_tva; |
990 | 990 | $line->total_ttc = $total_ttc; |
@@ -1133,7 +1133,7 @@ discard block |
||
1133 | 1133 | } |
1134 | 1134 | |
1135 | 1135 | function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
1136 | - global $conf, $hideprices, $hookmanager; |
|
1136 | + global $conf, $hideprices, $hookmanager; |
|
1137 | 1137 | |
1138 | 1138 | if(is_array($parameters)) $i = & $parameters['i']; |
1139 | 1139 | else $i = (int)$parameters; |
@@ -1172,7 +1172,7 @@ discard block |
||
1172 | 1172 | } |
1173 | 1173 | } |
1174 | 1174 | if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){ |
1175 | - $this->resprints = price($object->lines[$i]->total_ht); |
|
1175 | + $this->resprints = price($object->lines[$i]->total_ht); |
|
1176 | 1176 | } |
1177 | 1177 | |
1178 | 1178 | // Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché |
@@ -1301,7 +1301,7 @@ discard block |
||
1301 | 1301 | } |
1302 | 1302 | |
1303 | 1303 | function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') { |
1304 | - global $conf,$hideprices,$hookmanager; |
|
1304 | + global $conf,$hideprices,$hookmanager; |
|
1305 | 1305 | |
1306 | 1306 | if(is_array($parameters)) $i = & $parameters['i']; |
1307 | 1307 | else $i = (int)$parameters; |
@@ -1309,18 +1309,18 @@ discard block |
||
1309 | 1309 | if($this->isModSubtotalLine($parameters,$object) ) { |
1310 | 1310 | $this->resprints = ' '; |
1311 | 1311 | |
1312 | - $line = $object->lines[$i]; |
|
1312 | + $line = $object->lines[$i]; |
|
1313 | 1313 | |
1314 | - // On récupère les montants du bloc pour les afficher dans la ligne de sous-total |
|
1315 | - if(TSubtotal::isSubtotal($line)) { |
|
1316 | - $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
1314 | + // On récupère les montants du bloc pour les afficher dans la ligne de sous-total |
|
1315 | + if(TSubtotal::isSubtotal($line)) { |
|
1316 | + $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
1317 | 1317 | |
1318 | - if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
1319 | - if(! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
1320 | - $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
|
1321 | - $this->resprints = price($TTotal['total_subprice']); |
|
1322 | - } |
|
1323 | - } |
|
1318 | + if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
1319 | + if(! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
1320 | + $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
|
1321 | + $this->resprints = price($TTotal['total_subprice']); |
|
1322 | + } |
|
1323 | + } |
|
1324 | 1324 | |
1325 | 1325 | if((float)DOL_VERSION<=3.6) { |
1326 | 1326 | return ''; |
@@ -1336,58 +1336,58 @@ discard block |
||
1336 | 1336 | (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) |
1337 | 1337 | ) |
1338 | 1338 | { |
1339 | - // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
1340 | - if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
1341 | - { |
|
1342 | - $this->resprints = ' '; |
|
1339 | + // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
1340 | + if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
1341 | + { |
|
1342 | + $this->resprints = ' '; |
|
1343 | 1343 | |
1344 | - // currentcontext à modifier celon l'appel |
|
1345 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
1346 | - 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) |
|
1344 | + // currentcontext à modifier celon l'appel |
|
1345 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
1346 | + 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) |
|
1347 | 1347 | |
1348 | - } |
|
1348 | + } |
|
1349 | 1349 | } |
1350 | 1350 | // Cache le prix pour les lignes standards dolibarr qui sont dans un ensemble |
1351 | 1351 | else if (!empty($hideprices)) |
1352 | 1352 | { |
1353 | 1353 | |
1354 | - // Check if a title exist for this line && if the title have subtotal |
|
1355 | - $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
1356 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1357 | - { |
|
1354 | + // Check if a title exist for this line && if the title have subtotal |
|
1355 | + $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
1356 | + if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1357 | + { |
|
1358 | 1358 | |
1359 | - $this->resprints = ' '; |
|
1359 | + $this->resprints = ' '; |
|
1360 | 1360 | |
1361 | - // currentcontext à modifier celon l'appel |
|
1362 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
1363 | - 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) |
|
1364 | - } |
|
1361 | + // currentcontext à modifier celon l'appel |
|
1362 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlineupexcltax', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
1363 | + 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) |
|
1364 | + } |
|
1365 | 1365 | } |
1366 | 1366 | |
1367 | 1367 | return 0; |
1368 | 1368 | } |
1369 | 1369 | |
1370 | 1370 | function pdf_getlineremisepercent($parameters=array(), &$object, &$action='') { |
1371 | - global $conf,$hideprices,$hookmanager; |
|
1371 | + global $conf,$hideprices,$hookmanager; |
|
1372 | 1372 | |
1373 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1374 | - else $i = (int) $parameters; |
|
1373 | + if(is_array($parameters)) $i = & $parameters['i']; |
|
1374 | + else $i = (int) $parameters; |
|
1375 | 1375 | |
1376 | 1376 | if($this->isModSubtotalLine($parameters,$object) ) { |
1377 | 1377 | $this->resprints = ' '; |
1378 | 1378 | |
1379 | - $line = $object->lines[$i]; |
|
1379 | + $line = $object->lines[$i]; |
|
1380 | 1380 | |
1381 | - // Affichage de la remise |
|
1382 | - if(TSubtotal::isSubtotal($line)) { |
|
1383 | - $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
1381 | + // Affichage de la remise |
|
1382 | + if(TSubtotal::isSubtotal($line)) { |
|
1383 | + $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
1384 | 1384 | |
1385 | - if(empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
1386 | - if(! empty($parentTitle->array_options['options_show_reduc'])) { |
|
1387 | - $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
|
1388 | - $this->resprints = price((1-$TTotal['total_ht'] / $TTotal['total_subprice'])*100, 0, '', 1, 2, 2).'%'; |
|
1389 | - } |
|
1390 | - } |
|
1385 | + if(empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
1386 | + if(! empty($parentTitle->array_options['options_show_reduc'])) { |
|
1387 | + $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
|
1388 | + $this->resprints = price((1-$TTotal['total_ht'] / $TTotal['total_subprice'])*100, 0, '', 1, 2, 2).'%'; |
|
1389 | + } |
|
1390 | + } |
|
1391 | 1391 | |
1392 | 1392 | if((float)DOL_VERSION<=3.6) { |
1393 | 1393 | return ''; |
@@ -1397,15 +1397,15 @@ discard block |
||
1397 | 1397 | } |
1398 | 1398 | } |
1399 | 1399 | elseif (!empty($hideprices) |
1400 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1401 | - ) |
|
1402 | - { |
|
1403 | - if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
1404 | - { |
|
1405 | - $this->resprints = ' '; |
|
1406 | - return 1; |
|
1407 | - } |
|
1408 | - } |
|
1400 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1401 | + ) |
|
1402 | + { |
|
1403 | + if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
1404 | + { |
|
1405 | + $this->resprints = ' '; |
|
1406 | + return 1; |
|
1407 | + } |
|
1408 | + } |
|
1409 | 1409 | |
1410 | 1410 | return 0; |
1411 | 1411 | } |
@@ -1441,7 +1441,7 @@ discard block |
||
1441 | 1441 | } |
1442 | 1442 | |
1443 | 1443 | function pdf_getlinevatrate($parameters=array(), &$object, &$action='') { |
1444 | - global $conf,$hideprices,$hookmanager; |
|
1444 | + global $conf,$hideprices,$hookmanager; |
|
1445 | 1445 | |
1446 | 1446 | if($this->isModSubtotalLine($parameters,$object) ){ |
1447 | 1447 | $this->resprints = ' '; |
@@ -1466,31 +1466,31 @@ discard block |
||
1466 | 1466 | (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) |
1467 | 1467 | ) |
1468 | 1468 | { |
1469 | - // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
1470 | - if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
1471 | - { |
|
1472 | - $this->resprints = ' '; |
|
1469 | + // alors je dois vérifier si la méthode fait partie de la conf qui l'exclue |
|
1470 | + if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
|
1471 | + { |
|
1472 | + $this->resprints = ' '; |
|
1473 | 1473 | |
1474 | - // currentcontext à modifier celon l'appel |
|
1475 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
1476 | - 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) |
|
1477 | - } |
|
1474 | + // currentcontext à modifier celon l'appel |
|
1475 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hide_nc', 'i' => $i); |
|
1476 | + 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) |
|
1477 | + } |
|
1478 | 1478 | } |
1479 | 1479 | // Cache le prix pour les lignes standards dolibarr qui sont dans un ensemble |
1480 | 1480 | else if (!empty($hideprices)) |
1481 | 1481 | { |
1482 | 1482 | |
1483 | - // Check if a title exist for this line && if the title have subtotal |
|
1484 | - $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
1485 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1486 | - { |
|
1483 | + // Check if a title exist for this line && if the title have subtotal |
|
1484 | + $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
|
1485 | + if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1486 | + { |
|
1487 | 1487 | |
1488 | - $this->resprints = ' '; |
|
1488 | + $this->resprints = ' '; |
|
1489 | 1489 | |
1490 | - // currentcontext à modifier celon l'appel |
|
1491 | - $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
1492 | - 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) |
|
1493 | - } |
|
1490 | + // currentcontext à modifier celon l'appel |
|
1491 | + $params = array('parameters' => $parameters, 'currentmethod' => 'pdf_getlinevatrate', 'currentcontext'=>'subtotal_hideprices', 'i' => $i); |
|
1492 | + 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) |
|
1493 | + } |
|
1494 | 1494 | } |
1495 | 1495 | |
1496 | 1496 | return 0; |
@@ -1614,25 +1614,25 @@ discard block |
||
1614 | 1614 | |
1615 | 1615 | $this->add_numerotation($object); |
1616 | 1616 | |
1617 | - foreach($object->lines as $k => &$l) { |
|
1618 | - if(TSubtotal::isSubtotal($l)) { |
|
1619 | - $parentTitle = TSubtotal::getParentTitleOfLine($object, $k); |
|
1620 | - if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
1621 | - if(! empty($parentTitle->id) && ! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
1622 | - $l->remise_percent = 100; // Affichage de la réduction sur la ligne de sous-total |
|
1623 | - } |
|
1624 | - } |
|
1625 | - } |
|
1617 | + foreach($object->lines as $k => &$l) { |
|
1618 | + if(TSubtotal::isSubtotal($l)) { |
|
1619 | + $parentTitle = TSubtotal::getParentTitleOfLine($object, $k); |
|
1620 | + if(is_object($parentTitle) && empty($parentTitle->array_options)) $parentTitle->fetch_optionals(); |
|
1621 | + if(! empty($parentTitle->id) && ! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
1622 | + $l->remise_percent = 100; // Affichage de la réduction sur la ligne de sous-total |
|
1623 | + } |
|
1624 | + } |
|
1625 | + } |
|
1626 | 1626 | |
1627 | 1627 | $hideInnerLines = (int)GETPOST('hideInnerLines'); |
1628 | 1628 | $hidedetails = (int)GETPOST('hidedetails'); |
1629 | 1629 | |
1630 | 1630 | if ($hideInnerLines) { // si c une ligne de titre |
1631 | - $fk_parent_line=0; |
|
1631 | + $fk_parent_line=0; |
|
1632 | 1632 | $TLines =array(); |
1633 | 1633 | |
1634 | 1634 | $original_count=count($object->lines); |
1635 | - $TTvas = array(); // tableau de tva |
|
1635 | + $TTvas = array(); // tableau de tva |
|
1636 | 1636 | |
1637 | 1637 | foreach($object->lines as $k=>&$line) |
1638 | 1638 | { |
@@ -1671,48 +1671,48 @@ discard block |
||
1671 | 1671 | |
1672 | 1672 | if ($hideInnerLines) |
1673 | 1673 | { |
1674 | - if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1675 | - { |
|
1676 | - if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
1674 | + if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1675 | + { |
|
1676 | + if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
1677 | 1677 | |
1678 | - // on remplit le tableau de tva pour substituer les lignes cachées |
|
1679 | - $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
|
1680 | - $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
|
1681 | - $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
|
1682 | - } |
|
1683 | - if($line->product_type==9 && $line->rowid>0) |
|
1684 | - { |
|
1685 | - //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
|
1686 | - // génère des lignes d'affichage des montants HT soumis à tva |
|
1687 | - $nbtva = count($TTvas); |
|
1688 | - if(!empty($nbtva)){ |
|
1689 | - foreach ($TTvas as $tx =>$val){ |
|
1690 | - $l = clone $line; |
|
1691 | - $l->product_type = 1; |
|
1692 | - $l->special_code = ''; |
|
1693 | - $l->qty = 1; |
|
1694 | - $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
1695 | - $l->tva_tx = $tx; |
|
1696 | - $l->total_ht = $val['total_ht']; |
|
1697 | - $l->total_tva = $val['total_tva']; |
|
1698 | - $l->total = $line->total_ht; |
|
1699 | - $l->total_ttc = $val['total_ttc']; |
|
1700 | - $TLines[] = $l; |
|
1701 | - array_shift($TTvas); |
|
1702 | - } |
|
1703 | - } |
|
1678 | + // on remplit le tableau de tva pour substituer les lignes cachées |
|
1679 | + $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
|
1680 | + $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
|
1681 | + $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
|
1682 | + } |
|
1683 | + if($line->product_type==9 && $line->rowid>0) |
|
1684 | + { |
|
1685 | + //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
|
1686 | + // génère des lignes d'affichage des montants HT soumis à tva |
|
1687 | + $nbtva = count($TTvas); |
|
1688 | + if(!empty($nbtva)){ |
|
1689 | + foreach ($TTvas as $tx =>$val){ |
|
1690 | + $l = clone $line; |
|
1691 | + $l->product_type = 1; |
|
1692 | + $l->special_code = ''; |
|
1693 | + $l->qty = 1; |
|
1694 | + $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
1695 | + $l->tva_tx = $tx; |
|
1696 | + $l->total_ht = $val['total_ht']; |
|
1697 | + $l->total_tva = $val['total_tva']; |
|
1698 | + $l->total = $line->total_ht; |
|
1699 | + $l->total_ttc = $val['total_ttc']; |
|
1700 | + $TLines[] = $l; |
|
1701 | + array_shift($TTvas); |
|
1702 | + } |
|
1703 | + } |
|
1704 | 1704 | |
1705 | - // ajoute la ligne de sous-total |
|
1706 | - $TLines[] = $line; |
|
1707 | - } |
|
1708 | - } else { |
|
1705 | + // ajoute la ligne de sous-total |
|
1706 | + $TLines[] = $line; |
|
1707 | + } |
|
1708 | + } else { |
|
1709 | 1709 | |
1710 | - if($line->product_type==9 && $line->rowid>0) |
|
1711 | - { |
|
1712 | - // ajoute la ligne de sous-total |
|
1713 | - $TLines[] = $line; |
|
1714 | - } |
|
1715 | - } |
|
1710 | + if($line->product_type==9 && $line->rowid>0) |
|
1711 | + { |
|
1712 | + // ajoute la ligne de sous-total |
|
1713 | + $TLines[] = $line; |
|
1714 | + } |
|
1715 | + } |
|
1716 | 1716 | |
1717 | 1717 | |
1718 | 1718 | } |
@@ -1737,20 +1737,20 @@ discard block |
||
1737 | 1737 | $nbtva = count($TTvas); |
1738 | 1738 | if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
1739 | 1739 | { |
1740 | - foreach ($TTvas as $tx =>$val){ |
|
1741 | - $l = clone $line; |
|
1742 | - $l->product_type = 1; |
|
1743 | - $l->special_code = ''; |
|
1744 | - $l->qty = 1; |
|
1745 | - $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
1746 | - $l->tva_tx = $tx; |
|
1747 | - $l->total_ht = $val['total_ht']; |
|
1748 | - $l->total_tva = $val['total_tva']; |
|
1749 | - $l->total = $line->total_ht; |
|
1750 | - $l->total_ttc = $val['total_ttc']; |
|
1751 | - $TLines[] = $l; |
|
1752 | - array_shift($TTvas); |
|
1753 | - } |
|
1740 | + foreach ($TTvas as $tx =>$val){ |
|
1741 | + $l = clone $line; |
|
1742 | + $l->product_type = 1; |
|
1743 | + $l->special_code = ''; |
|
1744 | + $l->qty = 1; |
|
1745 | + $l->desc = $langs->trans('AmountBeforeTaxesSubjectToVATX%', $langs->transnoentitiesnoconv('VAT'), price($tx)); |
|
1746 | + $l->tva_tx = $tx; |
|
1747 | + $l->total_ht = $val['total_ht']; |
|
1748 | + $l->total_tva = $val['total_tva']; |
|
1749 | + $l->total = $line->total_ht; |
|
1750 | + $l->total_ttc = $val['total_ttc']; |
|
1751 | + $TLines[] = $l; |
|
1752 | + array_shift($TTvas); |
|
1753 | + } |
|
1754 | 1754 | } |
1755 | 1755 | |
1756 | 1756 | global $nblignes; |
@@ -1762,7 +1762,7 @@ discard block |
||
1762 | 1762 | $this->resprints = ''; |
1763 | 1763 | return 0; |
1764 | 1764 | } |
1765 | - } |
|
1765 | + } |
|
1766 | 1766 | |
1767 | 1767 | return 0; |
1768 | 1768 | } |
@@ -1925,18 +1925,18 @@ discard block |
||
1925 | 1925 | } |
1926 | 1926 | elseif($object->element == 'order_supplier' ) |
1927 | 1927 | { |
1928 | - $createRight = $user->rights->fournisseur->commande->creer; |
|
1928 | + $createRight = $user->rights->fournisseur->commande->creer; |
|
1929 | 1929 | } |
1930 | 1930 | elseif($object->element == 'invoice_supplier' ) |
1931 | 1931 | { |
1932 | - $createRight = $user->rights->fournisseur->facture->creer; |
|
1932 | + $createRight = $user->rights->fournisseur->facture->creer; |
|
1933 | 1933 | } |
1934 | 1934 | |
1935 | 1935 | if($line->special_code!=$this->module_number || $line->product_type!=9) { |
1936 | 1936 | null; |
1937 | 1937 | } |
1938 | 1938 | 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)) |
1939 | - { |
|
1939 | + { |
|
1940 | 1940 | if($object->element=='facture')$idvar = 'facid'; |
1941 | 1941 | else $idvar='id'; |
1942 | 1942 | |
@@ -1985,7 +1985,7 @@ discard block |
||
1985 | 1985 | //var_dump($line); |
1986 | 1986 | |
1987 | 1987 | // HTML 5 data for js |
1988 | - $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
|
1988 | + $data = $this->_getHtmlData($parameters, $object, $action, $hookmanager); |
|
1989 | 1989 | |
1990 | 1990 | |
1991 | 1991 | ?> |
@@ -2047,8 +2047,8 @@ discard block |
||
2047 | 2047 | } |
2048 | 2048 | |
2049 | 2049 | if ($object->element == 'order_supplier' || $object->element == 'invoice_supplier') { |
2050 | - $line->label = !empty($line->description) ? $line->description : $line->desc; |
|
2051 | - $line->description = ''; |
|
2050 | + $line->label = !empty($line->description) ? $line->description : $line->desc; |
|
2051 | + $line->description = ''; |
|
2052 | 2052 | } |
2053 | 2053 | $newlabel = $line->label; |
2054 | 2054 | if($line->label=='' && !$isFreeText) { |
@@ -2082,38 +2082,38 @@ discard block |
||
2082 | 2082 | |
2083 | 2083 | |
2084 | 2084 | echo '<div class="subtotal_underline" style="margin-left:24px; line-height: 25px;">'; |
2085 | - echo '<div>'; |
|
2086 | - echo '<input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' /> '; |
|
2087 | - echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label>'; |
|
2088 | - echo '</div>'; |
|
2089 | - |
|
2090 | - if (TSubtotal::isTitle($line)) |
|
2091 | - { |
|
2092 | - $form = new Form($db); |
|
2093 | - echo '<div>'; |
|
2094 | - echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>'; |
|
2095 | - echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>'; |
|
2096 | - if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
2097 | - echo '</select>'; |
|
2098 | - echo '</div>'; |
|
2099 | - |
|
2100 | - if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION) |
|
2101 | - { |
|
2102 | - echo '<div>'; |
|
2103 | - echo '<label for="subtotal_progress">'.$langs->trans('subtotal_apply_progress').'</label> <input id="subtotal_progress" name="subtotal_progress" value="" size="1" />%'; |
|
2104 | - echo '</div>'; |
|
2105 | - } |
|
2106 | - echo '<div>'; |
|
2107 | - 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"' : '') .' /> '; |
|
2108 | - echo '<label for="subtotal-showTotalHT">'.$langs->trans('ShowTotalHTOnSubtotalBlock').'</label>'; |
|
2109 | - echo '</div>'; |
|
2110 | - |
|
2111 | - echo '<div>'; |
|
2112 | - 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"' : '') .' /> '; |
|
2113 | - echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>'; |
|
2114 | - echo '</div>'; |
|
2115 | - } |
|
2116 | - else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
2085 | + echo '<div>'; |
|
2086 | + echo '<input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' /> '; |
|
2087 | + echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label>'; |
|
2088 | + echo '</div>'; |
|
2089 | + |
|
2090 | + if (TSubtotal::isTitle($line)) |
|
2091 | + { |
|
2092 | + $form = new Form($db); |
|
2093 | + echo '<div>'; |
|
2094 | + echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>'; |
|
2095 | + echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>'; |
|
2096 | + if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
2097 | + echo '</select>'; |
|
2098 | + echo '</div>'; |
|
2099 | + |
|
2100 | + if (!empty($conf->global->INVOICE_USE_SITUATION) && $object->element == 'facture' && $object->type == Facture::TYPE_SITUATION) |
|
2101 | + { |
|
2102 | + echo '<div>'; |
|
2103 | + echo '<label for="subtotal_progress">'.$langs->trans('subtotal_apply_progress').'</label> <input id="subtotal_progress" name="subtotal_progress" value="" size="1" />%'; |
|
2104 | + echo '</div>'; |
|
2105 | + } |
|
2106 | + echo '<div>'; |
|
2107 | + 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"' : '') .' /> '; |
|
2108 | + echo '<label for="subtotal-showTotalHT">'.$langs->trans('ShowTotalHTOnSubtotalBlock').'</label>'; |
|
2109 | + echo '</div>'; |
|
2110 | + |
|
2111 | + echo '<div>'; |
|
2112 | + 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"' : '') .' /> '; |
|
2113 | + echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>'; |
|
2114 | + echo '</div>'; |
|
2115 | + } |
|
2116 | + else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
2117 | 2117 | echo '</div>'; |
2118 | 2118 | |
2119 | 2119 | if($line->qty<10) { |
@@ -2381,17 +2381,17 @@ discard block |
||
2381 | 2381 | if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline') |
2382 | 2382 | { |
2383 | 2383 | |
2384 | - if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
2385 | - { |
|
2386 | - foreach ($object->lines as $line) |
|
2387 | - { |
|
2388 | - // fetch optionals attributes and labels |
|
2389 | - require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
|
2390 | - $extrafields=new ExtraFields($this->db); |
|
2391 | - $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
2392 | - $line->fetch_optionals($line->id,$extralabels); |
|
2393 | - } |
|
2394 | - } |
|
2384 | + if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
2385 | + { |
|
2386 | + foreach ($object->lines as $line) |
|
2387 | + { |
|
2388 | + // fetch optionals attributes and labels |
|
2389 | + require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
|
2390 | + $extrafields=new ExtraFields($this->db); |
|
2391 | + $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
2392 | + $line->fetch_optionals($line->id,$extralabels); |
|
2393 | + } |
|
2394 | + } |
|
2395 | 2395 | |
2396 | 2396 | $TSubNc = array(); |
2397 | 2397 | foreach ($object->lines as &$l) |
@@ -2482,80 +2482,80 @@ discard block |
||
2482 | 2482 | { |
2483 | 2483 | dol_include_once('/subtotal/class/subtotal.class.php'); |
2484 | 2484 | |
2485 | - $line = &$parameters['line']; |
|
2485 | + $line = &$parameters['line']; |
|
2486 | 2486 | |
2487 | - $ThtmlData['data-id'] = $line->id; |
|
2488 | - $ThtmlData['data-product_type'] = $line->product_type; |
|
2489 | - $ThtmlData['data-qty'] = 0; //$line->qty; |
|
2490 | - $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
|
2487 | + $ThtmlData['data-id'] = $line->id; |
|
2488 | + $ThtmlData['data-product_type'] = $line->product_type; |
|
2489 | + $ThtmlData['data-qty'] = 0; //$line->qty; |
|
2490 | + $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
|
2491 | 2491 | |
2492 | - if(TSubtotal::isTitle($line)){ |
|
2493 | - $ThtmlData['data-issubtotal'] = 'title'; |
|
2494 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
2495 | - $ThtmlData['data-issubtotal'] = 'subtotal'; |
|
2496 | - } |
|
2497 | - else{ |
|
2498 | - $ThtmlData['data-issubtotal'] = 'freetext'; |
|
2499 | - } |
|
2492 | + if(TSubtotal::isTitle($line)){ |
|
2493 | + $ThtmlData['data-issubtotal'] = 'title'; |
|
2494 | + }elseif(TSubtotal::isSubtotal($line)){ |
|
2495 | + $ThtmlData['data-issubtotal'] = 'subtotal'; |
|
2496 | + } |
|
2497 | + else{ |
|
2498 | + $ThtmlData['data-issubtotal'] = 'freetext'; |
|
2499 | + } |
|
2500 | 2500 | |
2501 | 2501 | |
2502 | - // Change or add data from hooks |
|
2503 | - $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
2502 | + // Change or add data from hooks |
|
2503 | + $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
2504 | 2504 | |
2505 | - // hook |
|
2506 | - $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
2507 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2508 | - if ($reshook>0) |
|
2509 | - { |
|
2510 | - $ThtmlData = $hookmanager->resArray; |
|
2511 | - } |
|
2512 | - |
|
2513 | - return $this->implodeHtmlData($ThtmlData); |
|
2505 | + // hook |
|
2506 | + $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
2507 | + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2508 | + if ($reshook>0) |
|
2509 | + { |
|
2510 | + $ThtmlData = $hookmanager->resArray; |
|
2511 | + } |
|
2512 | + |
|
2513 | + return $this->implodeHtmlData($ThtmlData); |
|
2514 | 2514 | |
2515 | 2515 | } |
2516 | 2516 | |
2517 | 2517 | |
2518 | 2518 | function implodeHtmlData($ThtmlData = array()) |
2519 | 2519 | { |
2520 | - $data = ''; |
|
2521 | - foreach($ThtmlData as $k => $h ) |
|
2522 | - { |
|
2523 | - if(is_array($h)) |
|
2524 | - { |
|
2525 | - $h = json_encode($h); |
|
2526 | - } |
|
2520 | + $data = ''; |
|
2521 | + foreach($ThtmlData as $k => $h ) |
|
2522 | + { |
|
2523 | + if(is_array($h)) |
|
2524 | + { |
|
2525 | + $h = json_encode($h); |
|
2526 | + } |
|
2527 | 2527 | |
2528 | - $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
2529 | - } |
|
2528 | + $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
2529 | + } |
|
2530 | 2530 | |
2531 | - return $data; |
|
2531 | + return $data; |
|
2532 | 2532 | } |
2533 | 2533 | |
2534 | 2534 | function _ajax_block_order_js($object) |
2535 | 2535 | { |
2536 | - global $conf,$tagidfortablednd,$filepath,$langs; |
|
2536 | + global $conf,$tagidfortablednd,$filepath,$langs; |
|
2537 | 2537 | |
2538 | - /* |
|
2538 | + /* |
|
2539 | 2539 | * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php |
2540 | 2540 | * for compatibility reasons we don't use tableDnD but jquery sortable |
2541 | 2541 | */ |
2542 | 2542 | |
2543 | - $id=$object->id; |
|
2544 | - $nboflines=(isset($object->lines)?count($object->lines):0); |
|
2545 | - $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
2543 | + $id=$object->id; |
|
2544 | + $nboflines=(isset($object->lines)?count($object->lines):0); |
|
2545 | + $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
2546 | 2546 | |
2547 | - $id=$object->id; |
|
2548 | - $fk_element=$object->fk_element; |
|
2549 | - $table_element_line=$object->table_element_line; |
|
2550 | - $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
2551 | - $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
2552 | - $filepath=(empty($filepath)?'':$filepath); |
|
2547 | + $id=$object->id; |
|
2548 | + $fk_element=$object->fk_element; |
|
2549 | + $table_element_line=$object->table_element_line; |
|
2550 | + $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
2551 | + $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
2552 | + $filepath=(empty($filepath)?'':$filepath); |
|
2553 | 2553 | |
2554 | 2554 | |
2555 | - if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
2556 | - { |
|
2555 | + if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
2556 | + { |
|
2557 | 2557 | |
2558 | - ?> |
|
2558 | + ?> |
|
2559 | 2559 | |
2560 | 2560 | |
2561 | 2561 | <script type="text/javascript"> |