@@ -31,170 +31,170 @@ 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.2'; |
|
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','propalcard','ordercard','odtgeneration','orderstoinvoice','admin','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.2'; |
|
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','propalcard','ordercard','odtgeneration','orderstoinvoice','admin','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 |
||
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 |
||
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 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * \ingroup titre |
24 | 24 | * \brief Description and activation file for module titre |
25 | 25 | */ |
26 | -include_once DOL_DOCUMENT_ROOT . "/core/modules/DolibarrModules.class.php"; |
|
26 | +include_once DOL_DOCUMENT_ROOT."/core/modules/DolibarrModules.class.php"; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Description and activation class for module titre |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $this->version = '3.1.2'; |
67 | 67 | // Key used in llx_const table to save module status enabled/disabled |
68 | 68 | // (where MYMODULE is value of property name of module in uppercase) |
69 | - $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); |
|
69 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
70 | 70 | // Where to store the module in setup page |
71 | 71 | // (0=common,1=interface,2=others,3=very specific) |
72 | 72 | $this->special = 2; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | // Set this to relative path of css if module has its own css file |
97 | 97 | //'css' => '/titre/css/mycss.css.php', |
98 | 98 | // Set here all hooks context managed by module |
99 | - 'hooks' => array('invoicecard','propalcard','ordercard','odtgeneration','orderstoinvoice','admin','consumptionthirdparty') |
|
99 | + 'hooks' => array('invoicecard', 'propalcard', 'ordercard', 'odtgeneration', 'orderstoinvoice', 'admin', 'consumptionthirdparty') |
|
100 | 100 | // Set here all workflow context managed by module |
101 | 101 | //'workflow' => array('order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')) |
102 | 102 | ); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | // List of modules id that must be enabled if this module is enabled |
114 | 114 | $this->depends = array(); |
115 | 115 | |
116 | - $this->conflictwith=array('modMilestone'); |
|
116 | + $this->conflictwith = array('modMilestone'); |
|
117 | 117 | // List of modules id to disable if this one is disabled |
118 | 118 | $this->requiredby = array(); |
119 | 119 | // Minimum version of PHP required by module |
@@ -178,20 +178,20 @@ discard block |
||
178 | 178 | // 'categories_x' to add a tab in category view |
179 | 179 | // (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) |
180 | 180 | // Dictionnaries |
181 | - if (! isset($conf->subtotal->enabled)) { |
|
182 | - $conf->subtotal=new stdClass(); |
|
181 | + if (!isset($conf->subtotal->enabled)) { |
|
182 | + $conf->subtotal = new stdClass(); |
|
183 | 183 | $conf->subtotal->enabled = 0; |
184 | 184 | } |
185 | 185 | $this->dictionaries = array( |
186 | 186 | 'langs'=>'subtotal@subtotal', |
187 | - 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
188 | - 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
189 | - 'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity), // Request to select fields |
|
190 | - 'tabsqlsort'=>array('label ASC'), // Sort order |
|
191 | - 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
192 | - 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
193 | - 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
194 | - 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
187 | + 'tabname'=>array(MAIN_DB_PREFIX.'c_subtotal_free_text'), // List of tables we want to see into dictonnary editor |
|
188 | + 'tablib'=>array($langs->trans('subtotalFreeLineDictionary')), // Label of tables |
|
189 | + 'tabsql'=>array('SELECT f.rowid as rowid, f.label, f.content, f.entity, f.active FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text as f WHERE f.entity='.$conf->entity), // Request to select fields |
|
190 | + 'tabsqlsort'=>array('label ASC'), // Sort order |
|
191 | + 'tabfield'=>array('label,content'), // List of fields (result of select to show dictionary) |
|
192 | + 'tabfieldvalue'=>array('label,content'), // List of fields (list of fields to edit a record) |
|
193 | + 'tabfieldinsert'=>array('label,content,entity'), // List of fields (list of fields for insert) |
|
194 | + 'tabrowid'=>array('rowid'), // Name of columns with primary key (try to always name it 'rowid') |
|
195 | 195 | 'tabcond'=>array($conf->subtotal->enabled) |
196 | 196 | ); |
197 | 197 | /* Example: |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | |
467 | 467 | $extra = new ExtraFields($db); // propaldet, commandedet, facturedet |
468 | 468 | $TElementType = array('propaldet', 'commandedet', 'facturedet', 'supplier_proposaldet', 'commande_fournisseurdet', 'facture_fourn_det'); |
469 | - foreach($TElementType as $element_type) { |
|
469 | + foreach ($TElementType as $element_type) { |
|
470 | 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 | 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 | 472 | } |
@@ -36,68 +36,68 @@ discard block |
||
36 | 36 | class Interfacesubtotaltrigger |
37 | 37 | { |
38 | 38 | |
39 | - private $db; |
|
40 | - |
|
41 | - /** |
|
42 | - * Constructor |
|
43 | - * |
|
44 | - * @param DoliDB $db Database handler |
|
45 | - */ |
|
46 | - public function __construct($db) |
|
47 | - { |
|
48 | - $this->db = $db; |
|
49 | - |
|
50 | - $this->name = preg_replace('/^Interface/i', '', get_class($this)); |
|
51 | - $this->family = "demo"; |
|
52 | - $this->description = "Triggers of this module are empty functions." |
|
53 | - . "They have no effect." |
|
54 | - . "They are provided for tutorial purpose only."; |
|
55 | - // 'development', 'experimental', 'dolibarr' or version |
|
56 | - $this->version = 'development'; |
|
57 | - $this->picto = 'titre@titre'; |
|
58 | - } |
|
59 | - |
|
60 | - /** |
|
61 | - * Trigger name |
|
62 | - * |
|
63 | - * @return string Name of trigger file |
|
64 | - */ |
|
65 | - public function getName() |
|
66 | - { |
|
67 | - return $this->name; |
|
68 | - } |
|
69 | - |
|
70 | - /** |
|
71 | - * Trigger description |
|
72 | - * |
|
73 | - * @return string Description of trigger file |
|
74 | - */ |
|
75 | - public function getDesc() |
|
76 | - { |
|
77 | - return $this->description; |
|
78 | - } |
|
79 | - |
|
80 | - /** |
|
81 | - * Trigger version |
|
82 | - * |
|
83 | - * @return string Version of trigger file |
|
84 | - */ |
|
85 | - public function getVersion() |
|
86 | - { |
|
87 | - global $langs; |
|
88 | - $langs->load("admin"); |
|
89 | - |
|
90 | - if ($this->version == 'development') { |
|
91 | - return $langs->trans("Development"); |
|
92 | - } elseif ($this->version == 'experimental') |
|
93 | - |
|
94 | - return $langs->trans("Experimental"); |
|
95 | - elseif ($this->version == 'dolibarr') return DOL_VERSION; |
|
96 | - elseif ($this->version) return $this->version; |
|
97 | - else { |
|
98 | - return $langs->trans("Unknown"); |
|
99 | - } |
|
100 | - } |
|
39 | + private $db; |
|
40 | + |
|
41 | + /** |
|
42 | + * Constructor |
|
43 | + * |
|
44 | + * @param DoliDB $db Database handler |
|
45 | + */ |
|
46 | + public function __construct($db) |
|
47 | + { |
|
48 | + $this->db = $db; |
|
49 | + |
|
50 | + $this->name = preg_replace('/^Interface/i', '', get_class($this)); |
|
51 | + $this->family = "demo"; |
|
52 | + $this->description = "Triggers of this module are empty functions." |
|
53 | + . "They have no effect." |
|
54 | + . "They are provided for tutorial purpose only."; |
|
55 | + // 'development', 'experimental', 'dolibarr' or version |
|
56 | + $this->version = 'development'; |
|
57 | + $this->picto = 'titre@titre'; |
|
58 | + } |
|
59 | + |
|
60 | + /** |
|
61 | + * Trigger name |
|
62 | + * |
|
63 | + * @return string Name of trigger file |
|
64 | + */ |
|
65 | + public function getName() |
|
66 | + { |
|
67 | + return $this->name; |
|
68 | + } |
|
69 | + |
|
70 | + /** |
|
71 | + * Trigger description |
|
72 | + * |
|
73 | + * @return string Description of trigger file |
|
74 | + */ |
|
75 | + public function getDesc() |
|
76 | + { |
|
77 | + return $this->description; |
|
78 | + } |
|
79 | + |
|
80 | + /** |
|
81 | + * Trigger version |
|
82 | + * |
|
83 | + * @return string Version of trigger file |
|
84 | + */ |
|
85 | + public function getVersion() |
|
86 | + { |
|
87 | + global $langs; |
|
88 | + $langs->load("admin"); |
|
89 | + |
|
90 | + if ($this->version == 'development') { |
|
91 | + return $langs->trans("Development"); |
|
92 | + } elseif ($this->version == 'experimental') |
|
93 | + |
|
94 | + return $langs->trans("Experimental"); |
|
95 | + elseif ($this->version == 'dolibarr') return DOL_VERSION; |
|
96 | + elseif ($this->version) return $this->version; |
|
97 | + else { |
|
98 | + return $langs->trans("Unknown"); |
|
99 | + } |
|
100 | + } |
|
101 | 101 | |
102 | 102 | public function addToBegin(&$parent, &$object, $rang) |
103 | 103 | { |
@@ -147,27 +147,27 @@ discard block |
||
147 | 147 | } |
148 | 148 | } |
149 | 149 | |
150 | - /** |
|
151 | - * Function called when a Dolibarrr business event is done. |
|
152 | - * All functions "run_trigger" are triggered if file |
|
153 | - * is inside directory core/triggers |
|
154 | - * |
|
155 | - * @param string $action Event action code |
|
156 | - * @param Object $object Object |
|
157 | - * @param User $user Object user |
|
158 | - * @param Translate $langs Object langs |
|
159 | - * @param conf $conf Object conf |
|
160 | - * @return int <0 if KO, 0 if no triggered ran, >0 if OK |
|
161 | - */ |
|
162 | - public function run_trigger($action, $object, $user, $langs, $conf) |
|
163 | - { |
|
164 | - // Put here code you want to execute when a Dolibarr business events occurs. |
|
165 | - // Data and type of action are stored into $object and $action |
|
166 | - // Users |
|
167 | - dol_include_once('/subtotal/class/subtotal.class.php'); |
|
168 | - $langs->load('subtotal@subtotal'); |
|
150 | + /** |
|
151 | + * Function called when a Dolibarrr business event is done. |
|
152 | + * All functions "run_trigger" are triggered if file |
|
153 | + * is inside directory core/triggers |
|
154 | + * |
|
155 | + * @param string $action Event action code |
|
156 | + * @param Object $object Object |
|
157 | + * @param User $user Object user |
|
158 | + * @param Translate $langs Object langs |
|
159 | + * @param conf $conf Object conf |
|
160 | + * @return int <0 if KO, 0 if no triggered ran, >0 if OK |
|
161 | + */ |
|
162 | + public function run_trigger($action, $object, $user, $langs, $conf) |
|
163 | + { |
|
164 | + // Put here code you want to execute when a Dolibarr business events occurs. |
|
165 | + // Data and type of action are stored into $object and $action |
|
166 | + // Users |
|
167 | + dol_include_once('/subtotal/class/subtotal.class.php'); |
|
168 | + $langs->load('subtotal@subtotal'); |
|
169 | 169 | |
170 | - if (!empty($conf->global->SUBTOTAL_ALLOW_ADD_LINE_UNDER_TITLE) && in_array($action, array('LINEPROPAL_INSERT', 'LINEORDER_INSERT', 'LINEBILL_INSERT'))) |
|
170 | + if (!empty($conf->global->SUBTOTAL_ALLOW_ADD_LINE_UNDER_TITLE) && in_array($action, array('LINEPROPAL_INSERT', 'LINEORDER_INSERT', 'LINEBILL_INSERT'))) |
|
171 | 171 | { |
172 | 172 | |
173 | 173 | $rang = GETPOST('under_title', 'int'); // Rang du titre |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | } |
200 | 200 | |
201 | 201 | |
202 | - if ($action == 'LINEBILL_INSERT' && $object->special_code != TSubtotal::$module_number) |
|
202 | + if ($action == 'LINEBILL_INSERT' && $object->special_code != TSubtotal::$module_number) |
|
203 | 203 | { |
204 | 204 | $subtotal_add_title_bloc_from_orderstoinvoice = GETPOST('subtotal_add_title_bloc_from_orderstoinvoice'); |
205 | 205 | if (!empty($subtotal_add_title_bloc_from_orderstoinvoice)) |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | |
256 | 256 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && in_array($action, array('LINEPROPAL_INSERT', 'LINEPROPAL_UPDATE', 'LINEORDER_INSERT', 'LINEORDER_UPDATE', 'LINEBILL_INSERT', 'LINEBILL_UPDATE'))) |
257 | 257 | { |
258 | - if(! function_exists('_updateLineNC')) dol_include_once('/subtotal/lib/subtotal.lib.php'); |
|
258 | + if(! function_exists('_updateLineNC')) dol_include_once('/subtotal/lib/subtotal.lib.php'); |
|
259 | 259 | |
260 | 260 | $doli_action = GETPOST('action'); |
261 | 261 | $set = GETPOST('set'); |
@@ -321,173 +321,173 @@ discard block |
||
321 | 321 | } |
322 | 322 | |
323 | 323 | |
324 | - if ($action == 'USER_LOGIN') { |
|
325 | - dol_syslog( |
|
326 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
327 | - ); |
|
328 | - } elseif ($action == 'USER_UPDATE_SESSION') { |
|
329 | - // Warning: To increase performances, this action is triggered only if |
|
330 | - // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1. |
|
331 | - dol_syslog( |
|
332 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
333 | - ); |
|
334 | - } elseif ($action == 'USER_CREATE') { |
|
335 | - dol_syslog( |
|
336 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
337 | - ); |
|
338 | - } elseif ($action == 'USER_CREATE_FROM_CONTACT') { |
|
339 | - dol_syslog( |
|
340 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
341 | - ); |
|
342 | - } elseif ($action == 'USER_MODIFY') { |
|
343 | - dol_syslog( |
|
344 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
345 | - ); |
|
346 | - } elseif ($action == 'USER_NEW_PASSWORD') { |
|
347 | - dol_syslog( |
|
348 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
349 | - ); |
|
350 | - } elseif ($action == 'USER_ENABLEDISABLE') { |
|
351 | - dol_syslog( |
|
352 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
353 | - ); |
|
354 | - } elseif ($action == 'USER_DELETE') { |
|
355 | - dol_syslog( |
|
356 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
357 | - ); |
|
358 | - } elseif ($action == 'USER_LOGOUT') { |
|
359 | - dol_syslog( |
|
360 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
361 | - ); |
|
362 | - } elseif ($action == 'USER_SETINGROUP') { |
|
363 | - dol_syslog( |
|
364 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
365 | - ); |
|
366 | - } elseif ($action == 'USER_REMOVEFROMGROUP') { |
|
367 | - dol_syslog( |
|
368 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
369 | - ); |
|
370 | - } |
|
371 | - |
|
372 | - // Groups |
|
373 | - elseif ($action == 'GROUP_CREATE') { |
|
374 | - dol_syslog( |
|
375 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
376 | - ); |
|
377 | - } elseif ($action == 'GROUP_MODIFY') { |
|
378 | - dol_syslog( |
|
379 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
380 | - ); |
|
381 | - } elseif ($action == 'GROUP_DELETE') { |
|
382 | - dol_syslog( |
|
383 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
384 | - ); |
|
385 | - } |
|
386 | - |
|
387 | - // Companies |
|
388 | - elseif ($action == 'COMPANY_CREATE') { |
|
389 | - dol_syslog( |
|
390 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
391 | - ); |
|
392 | - } elseif ($action == 'COMPANY_MODIFY') { |
|
393 | - dol_syslog( |
|
394 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
395 | - ); |
|
396 | - } elseif ($action == 'COMPANY_DELETE') { |
|
397 | - dol_syslog( |
|
398 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
399 | - ); |
|
400 | - } |
|
401 | - |
|
402 | - // Contacts |
|
403 | - elseif ($action == 'CONTACT_CREATE') { |
|
404 | - dol_syslog( |
|
405 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
406 | - ); |
|
407 | - } elseif ($action == 'CONTACT_MODIFY') { |
|
408 | - dol_syslog( |
|
409 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
410 | - ); |
|
411 | - } elseif ($action == 'CONTACT_DELETE') { |
|
412 | - dol_syslog( |
|
413 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
414 | - ); |
|
415 | - } |
|
416 | - |
|
417 | - // Products |
|
418 | - elseif ($action == 'PRODUCT_CREATE') { |
|
419 | - dol_syslog( |
|
420 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
421 | - ); |
|
422 | - } elseif ($action == 'PRODUCT_MODIFY') { |
|
423 | - dol_syslog( |
|
424 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
425 | - ); |
|
426 | - } elseif ($action == 'PRODUCT_DELETE') { |
|
427 | - dol_syslog( |
|
428 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
429 | - ); |
|
430 | - } |
|
431 | - |
|
432 | - // Customer orders |
|
433 | - elseif ($action == 'ORDER_CREATE') { |
|
434 | - dol_syslog( |
|
435 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
436 | - ); |
|
437 | - } elseif ($action == 'ORDER_VALIDATE') { |
|
438 | - dol_syslog( |
|
439 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
440 | - ); |
|
441 | - } elseif ($action == 'ORDER_DELETE') { |
|
442 | - dol_syslog( |
|
443 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
444 | - ); |
|
445 | - } elseif ($action == 'ORDER_BUILDDOC') { |
|
446 | - dol_syslog( |
|
447 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
448 | - ); |
|
449 | - } elseif ($action == 'ORDER_SENTBYMAIL') { |
|
450 | - dol_syslog( |
|
451 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
452 | - ); |
|
453 | - } elseif ($action == 'LINEORDER_INSERT') { |
|
454 | - dol_syslog( |
|
455 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
456 | - ); |
|
457 | - } elseif ($action == 'LINEORDER_DELETE') { |
|
458 | - dol_syslog( |
|
459 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
460 | - ); |
|
461 | - } |
|
462 | - |
|
463 | - // Supplier orders |
|
464 | - elseif ($action == 'ORDER_SUPPLIER_CREATE') { |
|
465 | - dol_syslog( |
|
466 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
467 | - ); |
|
468 | - } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') { |
|
469 | - dol_syslog( |
|
470 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
471 | - ); |
|
472 | - } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') { |
|
473 | - dol_syslog( |
|
474 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
475 | - ); |
|
476 | - } elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') { |
|
477 | - dol_syslog( |
|
478 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
479 | - ); |
|
480 | - } |
|
481 | - |
|
482 | - // Proposals |
|
483 | - elseif ($action == 'PROPAL_CREATE') { |
|
484 | - dol_syslog( |
|
485 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
486 | - ); |
|
487 | - } elseif (in_array($action, array('PROPAL_CLONE', 'ORDER_CLONE', 'BILL_CLONE'))) { |
|
488 | - dol_syslog( |
|
489 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
490 | - ); |
|
324 | + if ($action == 'USER_LOGIN') { |
|
325 | + dol_syslog( |
|
326 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
327 | + ); |
|
328 | + } elseif ($action == 'USER_UPDATE_SESSION') { |
|
329 | + // Warning: To increase performances, this action is triggered only if |
|
330 | + // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1. |
|
331 | + dol_syslog( |
|
332 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
333 | + ); |
|
334 | + } elseif ($action == 'USER_CREATE') { |
|
335 | + dol_syslog( |
|
336 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
337 | + ); |
|
338 | + } elseif ($action == 'USER_CREATE_FROM_CONTACT') { |
|
339 | + dol_syslog( |
|
340 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
341 | + ); |
|
342 | + } elseif ($action == 'USER_MODIFY') { |
|
343 | + dol_syslog( |
|
344 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
345 | + ); |
|
346 | + } elseif ($action == 'USER_NEW_PASSWORD') { |
|
347 | + dol_syslog( |
|
348 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
349 | + ); |
|
350 | + } elseif ($action == 'USER_ENABLEDISABLE') { |
|
351 | + dol_syslog( |
|
352 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
353 | + ); |
|
354 | + } elseif ($action == 'USER_DELETE') { |
|
355 | + dol_syslog( |
|
356 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
357 | + ); |
|
358 | + } elseif ($action == 'USER_LOGOUT') { |
|
359 | + dol_syslog( |
|
360 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
361 | + ); |
|
362 | + } elseif ($action == 'USER_SETINGROUP') { |
|
363 | + dol_syslog( |
|
364 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
365 | + ); |
|
366 | + } elseif ($action == 'USER_REMOVEFROMGROUP') { |
|
367 | + dol_syslog( |
|
368 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
369 | + ); |
|
370 | + } |
|
371 | + |
|
372 | + // Groups |
|
373 | + elseif ($action == 'GROUP_CREATE') { |
|
374 | + dol_syslog( |
|
375 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
376 | + ); |
|
377 | + } elseif ($action == 'GROUP_MODIFY') { |
|
378 | + dol_syslog( |
|
379 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
380 | + ); |
|
381 | + } elseif ($action == 'GROUP_DELETE') { |
|
382 | + dol_syslog( |
|
383 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
384 | + ); |
|
385 | + } |
|
386 | + |
|
387 | + // Companies |
|
388 | + elseif ($action == 'COMPANY_CREATE') { |
|
389 | + dol_syslog( |
|
390 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
391 | + ); |
|
392 | + } elseif ($action == 'COMPANY_MODIFY') { |
|
393 | + dol_syslog( |
|
394 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
395 | + ); |
|
396 | + } elseif ($action == 'COMPANY_DELETE') { |
|
397 | + dol_syslog( |
|
398 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
399 | + ); |
|
400 | + } |
|
401 | + |
|
402 | + // Contacts |
|
403 | + elseif ($action == 'CONTACT_CREATE') { |
|
404 | + dol_syslog( |
|
405 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
406 | + ); |
|
407 | + } elseif ($action == 'CONTACT_MODIFY') { |
|
408 | + dol_syslog( |
|
409 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
410 | + ); |
|
411 | + } elseif ($action == 'CONTACT_DELETE') { |
|
412 | + dol_syslog( |
|
413 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
414 | + ); |
|
415 | + } |
|
416 | + |
|
417 | + // Products |
|
418 | + elseif ($action == 'PRODUCT_CREATE') { |
|
419 | + dol_syslog( |
|
420 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
421 | + ); |
|
422 | + } elseif ($action == 'PRODUCT_MODIFY') { |
|
423 | + dol_syslog( |
|
424 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
425 | + ); |
|
426 | + } elseif ($action == 'PRODUCT_DELETE') { |
|
427 | + dol_syslog( |
|
428 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
429 | + ); |
|
430 | + } |
|
431 | + |
|
432 | + // Customer orders |
|
433 | + elseif ($action == 'ORDER_CREATE') { |
|
434 | + dol_syslog( |
|
435 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
436 | + ); |
|
437 | + } elseif ($action == 'ORDER_VALIDATE') { |
|
438 | + dol_syslog( |
|
439 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
440 | + ); |
|
441 | + } elseif ($action == 'ORDER_DELETE') { |
|
442 | + dol_syslog( |
|
443 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
444 | + ); |
|
445 | + } elseif ($action == 'ORDER_BUILDDOC') { |
|
446 | + dol_syslog( |
|
447 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
448 | + ); |
|
449 | + } elseif ($action == 'ORDER_SENTBYMAIL') { |
|
450 | + dol_syslog( |
|
451 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
452 | + ); |
|
453 | + } elseif ($action == 'LINEORDER_INSERT') { |
|
454 | + dol_syslog( |
|
455 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
456 | + ); |
|
457 | + } elseif ($action == 'LINEORDER_DELETE') { |
|
458 | + dol_syslog( |
|
459 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
460 | + ); |
|
461 | + } |
|
462 | + |
|
463 | + // Supplier orders |
|
464 | + elseif ($action == 'ORDER_SUPPLIER_CREATE') { |
|
465 | + dol_syslog( |
|
466 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
467 | + ); |
|
468 | + } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') { |
|
469 | + dol_syslog( |
|
470 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
471 | + ); |
|
472 | + } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') { |
|
473 | + dol_syslog( |
|
474 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
475 | + ); |
|
476 | + } elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') { |
|
477 | + dol_syslog( |
|
478 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
479 | + ); |
|
480 | + } |
|
481 | + |
|
482 | + // Proposals |
|
483 | + elseif ($action == 'PROPAL_CREATE') { |
|
484 | + dol_syslog( |
|
485 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
486 | + ); |
|
487 | + } elseif (in_array($action, array('PROPAL_CLONE', 'ORDER_CLONE', 'BILL_CLONE'))) { |
|
488 | + dol_syslog( |
|
489 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
490 | + ); |
|
491 | 491 | |
492 | 492 | $doli_action = GETPOST('action'); |
493 | 493 | |
@@ -520,277 +520,277 @@ discard block |
||
520 | 520 | if (!empty($line)) $object->update_price(1); |
521 | 521 | } |
522 | 522 | |
523 | - } elseif ($action == 'PROPAL_MODIFY') { |
|
524 | - dol_syslog( |
|
525 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
526 | - ); |
|
527 | - } elseif ($action == 'PROPAL_VALIDATE') { |
|
528 | - dol_syslog( |
|
529 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
530 | - ); |
|
531 | - } elseif ($action == 'PROPAL_BUILDDOC') { |
|
532 | - dol_syslog( |
|
533 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
534 | - ); |
|
535 | - } elseif ($action == 'PROPAL_SENTBYMAIL') { |
|
536 | - dol_syslog( |
|
537 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
538 | - ); |
|
539 | - } elseif ($action == 'PROPAL_CLOSE_SIGNED') { |
|
540 | - dol_syslog( |
|
541 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
542 | - ); |
|
543 | - } elseif ($action == 'PROPAL_CLOSE_REFUSED') { |
|
544 | - dol_syslog( |
|
545 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
546 | - ); |
|
547 | - } elseif ($action == 'PROPAL_DELETE') { |
|
548 | - dol_syslog( |
|
549 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
550 | - ); |
|
551 | - } elseif ($action == 'LINEPROPAL_INSERT') { |
|
552 | - dol_syslog( |
|
553 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
554 | - ); |
|
555 | - } elseif ($action == 'LINEPROPAL_MODIFY') { |
|
556 | - dol_syslog( |
|
557 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
558 | - ); |
|
559 | - } elseif ($action == 'LINEPROPAL_DELETE') { |
|
560 | - dol_syslog( |
|
561 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
562 | - ); |
|
563 | - } |
|
564 | - |
|
565 | - // Contracts |
|
566 | - elseif ($action == 'CONTRACT_CREATE') { |
|
567 | - dol_syslog( |
|
568 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
569 | - ); |
|
570 | - } elseif ($action == 'CONTRACT_MODIFY') { |
|
571 | - dol_syslog( |
|
572 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
573 | - ); |
|
574 | - } elseif ($action == 'CONTRACT_ACTIVATE') { |
|
575 | - dol_syslog( |
|
576 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
577 | - ); |
|
578 | - } elseif ($action == 'CONTRACT_CANCEL') { |
|
579 | - dol_syslog( |
|
580 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
581 | - ); |
|
582 | - } elseif ($action == 'CONTRACT_CLOSE') { |
|
583 | - dol_syslog( |
|
584 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
585 | - ); |
|
586 | - } elseif ($action == 'CONTRACT_DELETE') { |
|
587 | - dol_syslog( |
|
588 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
589 | - ); |
|
590 | - } |
|
523 | + } elseif ($action == 'PROPAL_MODIFY') { |
|
524 | + dol_syslog( |
|
525 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
526 | + ); |
|
527 | + } elseif ($action == 'PROPAL_VALIDATE') { |
|
528 | + dol_syslog( |
|
529 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
530 | + ); |
|
531 | + } elseif ($action == 'PROPAL_BUILDDOC') { |
|
532 | + dol_syslog( |
|
533 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
534 | + ); |
|
535 | + } elseif ($action == 'PROPAL_SENTBYMAIL') { |
|
536 | + dol_syslog( |
|
537 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
538 | + ); |
|
539 | + } elseif ($action == 'PROPAL_CLOSE_SIGNED') { |
|
540 | + dol_syslog( |
|
541 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
542 | + ); |
|
543 | + } elseif ($action == 'PROPAL_CLOSE_REFUSED') { |
|
544 | + dol_syslog( |
|
545 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
546 | + ); |
|
547 | + } elseif ($action == 'PROPAL_DELETE') { |
|
548 | + dol_syslog( |
|
549 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
550 | + ); |
|
551 | + } elseif ($action == 'LINEPROPAL_INSERT') { |
|
552 | + dol_syslog( |
|
553 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
554 | + ); |
|
555 | + } elseif ($action == 'LINEPROPAL_MODIFY') { |
|
556 | + dol_syslog( |
|
557 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
558 | + ); |
|
559 | + } elseif ($action == 'LINEPROPAL_DELETE') { |
|
560 | + dol_syslog( |
|
561 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
562 | + ); |
|
563 | + } |
|
564 | + |
|
565 | + // Contracts |
|
566 | + elseif ($action == 'CONTRACT_CREATE') { |
|
567 | + dol_syslog( |
|
568 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
569 | + ); |
|
570 | + } elseif ($action == 'CONTRACT_MODIFY') { |
|
571 | + dol_syslog( |
|
572 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
573 | + ); |
|
574 | + } elseif ($action == 'CONTRACT_ACTIVATE') { |
|
575 | + dol_syslog( |
|
576 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
577 | + ); |
|
578 | + } elseif ($action == 'CONTRACT_CANCEL') { |
|
579 | + dol_syslog( |
|
580 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
581 | + ); |
|
582 | + } elseif ($action == 'CONTRACT_CLOSE') { |
|
583 | + dol_syslog( |
|
584 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
585 | + ); |
|
586 | + } elseif ($action == 'CONTRACT_DELETE') { |
|
587 | + dol_syslog( |
|
588 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
589 | + ); |
|
590 | + } |
|
591 | 591 | |
592 | 592 | elseif ($action == 'BILL_MODIFY') { |
593 | - dol_syslog( |
|
594 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
595 | - ); |
|
596 | - } elseif ($action == 'BILL_VALIDATE') { |
|
597 | - dol_syslog( |
|
598 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
599 | - ); |
|
600 | - } elseif ($action == 'BILL_BUILDDOC') { |
|
601 | - dol_syslog( |
|
602 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
603 | - ); |
|
604 | - } elseif ($action == 'BILL_SENTBYMAIL') { |
|
605 | - dol_syslog( |
|
606 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
607 | - ); |
|
608 | - } elseif ($action == 'BILL_CANCEL') { |
|
609 | - dol_syslog( |
|
610 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
611 | - ); |
|
612 | - } elseif ($action == 'BILL_DELETE') { |
|
613 | - dol_syslog( |
|
614 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
615 | - ); |
|
616 | - } elseif ($action == 'LINEBILL_INSERT') { |
|
593 | + dol_syslog( |
|
594 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
595 | + ); |
|
596 | + } elseif ($action == 'BILL_VALIDATE') { |
|
597 | + dol_syslog( |
|
598 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
599 | + ); |
|
600 | + } elseif ($action == 'BILL_BUILDDOC') { |
|
601 | + dol_syslog( |
|
602 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
603 | + ); |
|
604 | + } elseif ($action == 'BILL_SENTBYMAIL') { |
|
605 | + dol_syslog( |
|
606 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
607 | + ); |
|
608 | + } elseif ($action == 'BILL_CANCEL') { |
|
609 | + dol_syslog( |
|
610 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
611 | + ); |
|
612 | + } elseif ($action == 'BILL_DELETE') { |
|
613 | + dol_syslog( |
|
614 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
615 | + ); |
|
616 | + } elseif ($action == 'LINEBILL_INSERT') { |
|
617 | 617 | |
618 | - dol_syslog( |
|
619 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
620 | - ); |
|
621 | - } elseif ($action == 'LINEBILL_DELETE') { |
|
622 | - dol_syslog( |
|
623 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
624 | - ); |
|
625 | - } |
|
626 | - |
|
627 | - // Payments |
|
628 | - elseif ($action == 'PAYMENT_CUSTOMER_CREATE') { |
|
629 | - dol_syslog( |
|
630 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
631 | - ); |
|
632 | - } elseif ($action == 'PAYMENT_SUPPLIER_CREATE') { |
|
633 | - dol_syslog( |
|
634 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
635 | - ); |
|
636 | - } elseif ($action == 'PAYMENT_ADD_TO_BANK') { |
|
637 | - dol_syslog( |
|
638 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
639 | - ); |
|
640 | - } elseif ($action == 'PAYMENT_DELETE') { |
|
641 | - dol_syslog( |
|
642 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
643 | - ); |
|
644 | - } |
|
645 | - |
|
646 | - // Interventions |
|
647 | - elseif ($action == 'FICHEINTER_CREATE') { |
|
648 | - dol_syslog( |
|
649 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
650 | - ); |
|
651 | - } elseif ($action == 'FICHEINTER_MODIFY') { |
|
652 | - dol_syslog( |
|
653 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
654 | - ); |
|
655 | - } elseif ($action == 'FICHEINTER_VALIDATE') { |
|
656 | - dol_syslog( |
|
657 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
658 | - ); |
|
659 | - } elseif ($action == 'FICHEINTER_DELETE') { |
|
660 | - dol_syslog( |
|
661 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
662 | - ); |
|
663 | - } |
|
664 | - |
|
665 | - // Members |
|
666 | - elseif ($action == 'MEMBER_CREATE') { |
|
667 | - dol_syslog( |
|
668 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
669 | - ); |
|
670 | - } elseif ($action == 'MEMBER_VALIDATE') { |
|
671 | - dol_syslog( |
|
672 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
673 | - ); |
|
674 | - } elseif ($action == 'MEMBER_SUBSCRIPTION') { |
|
675 | - dol_syslog( |
|
676 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
677 | - ); |
|
678 | - } elseif ($action == 'MEMBER_MODIFY') { |
|
679 | - dol_syslog( |
|
680 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
681 | - ); |
|
682 | - } elseif ($action == 'MEMBER_NEW_PASSWORD') { |
|
683 | - dol_syslog( |
|
684 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
685 | - ); |
|
686 | - } elseif ($action == 'MEMBER_RESILIATE') { |
|
687 | - dol_syslog( |
|
688 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
689 | - ); |
|
690 | - } elseif ($action == 'MEMBER_DELETE') { |
|
691 | - dol_syslog( |
|
692 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
693 | - ); |
|
694 | - } |
|
695 | - |
|
696 | - // Categories |
|
697 | - elseif ($action == 'CATEGORY_CREATE') { |
|
698 | - dol_syslog( |
|
699 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
700 | - ); |
|
701 | - } elseif ($action == 'CATEGORY_MODIFY') { |
|
702 | - dol_syslog( |
|
703 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
704 | - ); |
|
705 | - } elseif ($action == 'CATEGORY_DELETE') { |
|
706 | - dol_syslog( |
|
707 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
708 | - ); |
|
709 | - } |
|
710 | - |
|
711 | - // Projects |
|
712 | - elseif ($action == 'PROJECT_CREATE') { |
|
713 | - dol_syslog( |
|
714 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
715 | - ); |
|
716 | - } elseif ($action == 'PROJECT_MODIFY') { |
|
717 | - dol_syslog( |
|
718 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
719 | - ); |
|
720 | - } elseif ($action == 'PROJECT_DELETE') { |
|
721 | - dol_syslog( |
|
722 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
723 | - ); |
|
724 | - } |
|
725 | - |
|
726 | - // Project tasks |
|
727 | - elseif ($action == 'TASK_CREATE') { |
|
728 | - dol_syslog( |
|
729 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
730 | - ); |
|
731 | - } elseif ($action == 'TASK_MODIFY') { |
|
732 | - dol_syslog( |
|
733 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
734 | - ); |
|
735 | - } elseif ($action == 'TASK_DELETE') { |
|
736 | - dol_syslog( |
|
737 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
738 | - ); |
|
739 | - } |
|
740 | - |
|
741 | - // Task time spent |
|
742 | - elseif ($action == 'TASK_TIMESPENT_CREATE') { |
|
743 | - dol_syslog( |
|
744 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
745 | - ); |
|
746 | - } elseif ($action == 'TASK_TIMESPENT_MODIFY') { |
|
747 | - dol_syslog( |
|
748 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
749 | - ); |
|
750 | - } elseif ($action == 'TASK_TIMESPENT_DELETE') { |
|
751 | - dol_syslog( |
|
752 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
753 | - ); |
|
754 | - } |
|
755 | - |
|
756 | - // Shipping |
|
757 | - elseif ($action == 'SHIPPING_CREATE') { |
|
758 | - dol_syslog( |
|
759 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
760 | - ); |
|
761 | - } elseif ($action == 'SHIPPING_MODIFY') { |
|
762 | - dol_syslog( |
|
763 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
764 | - ); |
|
765 | - } elseif ($action == 'SHIPPING_VALIDATE') { |
|
766 | - dol_syslog( |
|
767 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
768 | - ); |
|
769 | - } elseif ($action == 'SHIPPING_SENTBYMAIL') { |
|
770 | - dol_syslog( |
|
771 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
772 | - ); |
|
773 | - } elseif ($action == 'SHIPPING_DELETE') { |
|
774 | - dol_syslog( |
|
775 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
776 | - ); |
|
777 | - } elseif ($action == 'SHIPPING_BUILDDOC') { |
|
778 | - dol_syslog( |
|
779 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
780 | - ); |
|
781 | - } |
|
782 | - |
|
783 | - // File |
|
784 | - elseif ($action == 'FILE_UPLOAD') { |
|
785 | - dol_syslog( |
|
786 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
787 | - ); |
|
788 | - } elseif ($action == 'FILE_DELETE') { |
|
789 | - dol_syslog( |
|
790 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
791 | - ); |
|
792 | - } |
|
793 | - |
|
794 | - return 0; |
|
795 | - } |
|
618 | + dol_syslog( |
|
619 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
620 | + ); |
|
621 | + } elseif ($action == 'LINEBILL_DELETE') { |
|
622 | + dol_syslog( |
|
623 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
624 | + ); |
|
625 | + } |
|
626 | + |
|
627 | + // Payments |
|
628 | + elseif ($action == 'PAYMENT_CUSTOMER_CREATE') { |
|
629 | + dol_syslog( |
|
630 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
631 | + ); |
|
632 | + } elseif ($action == 'PAYMENT_SUPPLIER_CREATE') { |
|
633 | + dol_syslog( |
|
634 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
635 | + ); |
|
636 | + } elseif ($action == 'PAYMENT_ADD_TO_BANK') { |
|
637 | + dol_syslog( |
|
638 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
639 | + ); |
|
640 | + } elseif ($action == 'PAYMENT_DELETE') { |
|
641 | + dol_syslog( |
|
642 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
643 | + ); |
|
644 | + } |
|
645 | + |
|
646 | + // Interventions |
|
647 | + elseif ($action == 'FICHEINTER_CREATE') { |
|
648 | + dol_syslog( |
|
649 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
650 | + ); |
|
651 | + } elseif ($action == 'FICHEINTER_MODIFY') { |
|
652 | + dol_syslog( |
|
653 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
654 | + ); |
|
655 | + } elseif ($action == 'FICHEINTER_VALIDATE') { |
|
656 | + dol_syslog( |
|
657 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
658 | + ); |
|
659 | + } elseif ($action == 'FICHEINTER_DELETE') { |
|
660 | + dol_syslog( |
|
661 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
662 | + ); |
|
663 | + } |
|
664 | + |
|
665 | + // Members |
|
666 | + elseif ($action == 'MEMBER_CREATE') { |
|
667 | + dol_syslog( |
|
668 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
669 | + ); |
|
670 | + } elseif ($action == 'MEMBER_VALIDATE') { |
|
671 | + dol_syslog( |
|
672 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
673 | + ); |
|
674 | + } elseif ($action == 'MEMBER_SUBSCRIPTION') { |
|
675 | + dol_syslog( |
|
676 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
677 | + ); |
|
678 | + } elseif ($action == 'MEMBER_MODIFY') { |
|
679 | + dol_syslog( |
|
680 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
681 | + ); |
|
682 | + } elseif ($action == 'MEMBER_NEW_PASSWORD') { |
|
683 | + dol_syslog( |
|
684 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
685 | + ); |
|
686 | + } elseif ($action == 'MEMBER_RESILIATE') { |
|
687 | + dol_syslog( |
|
688 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
689 | + ); |
|
690 | + } elseif ($action == 'MEMBER_DELETE') { |
|
691 | + dol_syslog( |
|
692 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
693 | + ); |
|
694 | + } |
|
695 | + |
|
696 | + // Categories |
|
697 | + elseif ($action == 'CATEGORY_CREATE') { |
|
698 | + dol_syslog( |
|
699 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
700 | + ); |
|
701 | + } elseif ($action == 'CATEGORY_MODIFY') { |
|
702 | + dol_syslog( |
|
703 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
704 | + ); |
|
705 | + } elseif ($action == 'CATEGORY_DELETE') { |
|
706 | + dol_syslog( |
|
707 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
708 | + ); |
|
709 | + } |
|
710 | + |
|
711 | + // Projects |
|
712 | + elseif ($action == 'PROJECT_CREATE') { |
|
713 | + dol_syslog( |
|
714 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
715 | + ); |
|
716 | + } elseif ($action == 'PROJECT_MODIFY') { |
|
717 | + dol_syslog( |
|
718 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
719 | + ); |
|
720 | + } elseif ($action == 'PROJECT_DELETE') { |
|
721 | + dol_syslog( |
|
722 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
723 | + ); |
|
724 | + } |
|
725 | + |
|
726 | + // Project tasks |
|
727 | + elseif ($action == 'TASK_CREATE') { |
|
728 | + dol_syslog( |
|
729 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
730 | + ); |
|
731 | + } elseif ($action == 'TASK_MODIFY') { |
|
732 | + dol_syslog( |
|
733 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
734 | + ); |
|
735 | + } elseif ($action == 'TASK_DELETE') { |
|
736 | + dol_syslog( |
|
737 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
738 | + ); |
|
739 | + } |
|
740 | + |
|
741 | + // Task time spent |
|
742 | + elseif ($action == 'TASK_TIMESPENT_CREATE') { |
|
743 | + dol_syslog( |
|
744 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
745 | + ); |
|
746 | + } elseif ($action == 'TASK_TIMESPENT_MODIFY') { |
|
747 | + dol_syslog( |
|
748 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
749 | + ); |
|
750 | + } elseif ($action == 'TASK_TIMESPENT_DELETE') { |
|
751 | + dol_syslog( |
|
752 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
753 | + ); |
|
754 | + } |
|
755 | + |
|
756 | + // Shipping |
|
757 | + elseif ($action == 'SHIPPING_CREATE') { |
|
758 | + dol_syslog( |
|
759 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
760 | + ); |
|
761 | + } elseif ($action == 'SHIPPING_MODIFY') { |
|
762 | + dol_syslog( |
|
763 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
764 | + ); |
|
765 | + } elseif ($action == 'SHIPPING_VALIDATE') { |
|
766 | + dol_syslog( |
|
767 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
768 | + ); |
|
769 | + } elseif ($action == 'SHIPPING_SENTBYMAIL') { |
|
770 | + dol_syslog( |
|
771 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
772 | + ); |
|
773 | + } elseif ($action == 'SHIPPING_DELETE') { |
|
774 | + dol_syslog( |
|
775 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
776 | + ); |
|
777 | + } elseif ($action == 'SHIPPING_BUILDDOC') { |
|
778 | + dol_syslog( |
|
779 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
780 | + ); |
|
781 | + } |
|
782 | + |
|
783 | + // File |
|
784 | + elseif ($action == 'FILE_UPLOAD') { |
|
785 | + dol_syslog( |
|
786 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
787 | + ); |
|
788 | + } elseif ($action == 'FILE_DELETE') { |
|
789 | + dol_syslog( |
|
790 | + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
791 | + ); |
|
792 | + } |
|
793 | + |
|
794 | + return 0; |
|
795 | + } |
|
796 | 796 | } |
797 | 797 | \ No newline at end of file |
@@ -107,13 +107,13 @@ discard block |
||
107 | 107 | if ($object->id != $line->id && $line->rang > $rang) |
108 | 108 | { |
109 | 109 | // Update du rang de toutes les lignes suivant mon titre |
110 | - $parent->updateRangOfLine($line->id, $line->rang+1); |
|
110 | + $parent->updateRangOfLine($line->id, $line->rang + 1); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | |
114 | 114 | // Update du rang de la ligne fraichement ajouté pour la déplacer sous mon titre |
115 | - $parent->updateRangOfLine($object->id, $rang+1); |
|
116 | - $object->rang = $rang+1; |
|
115 | + $parent->updateRangOfLine($object->id, $rang + 1); |
|
116 | + $object->rang = $rang + 1; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | public function addToEnd(&$parent, &$object, $rang) |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | if ($subtotal_line_found) |
138 | 138 | { |
139 | - $parent->updateRangOfLine($line->id, $line->rang+1); |
|
139 | + $parent->updateRangOfLine($line->id, $line->rang + 1); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | |
@@ -255,14 +255,14 @@ discard block |
||
255 | 255 | |
256 | 256 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && in_array($action, array('LINEPROPAL_INSERT', 'LINEPROPAL_UPDATE', 'LINEORDER_INSERT', 'LINEORDER_UPDATE', 'LINEBILL_INSERT', 'LINEBILL_UPDATE'))) |
257 | 257 | { |
258 | - if(! function_exists('_updateLineNC')) dol_include_once('/subtotal/lib/subtotal.lib.php'); |
|
258 | + if (!function_exists('_updateLineNC')) dol_include_once('/subtotal/lib/subtotal.lib.php'); |
|
259 | 259 | |
260 | 260 | $doli_action = GETPOST('action'); |
261 | 261 | $set = GETPOST('set'); |
262 | - if ( (in_array($doli_action, array('updateligne', 'updateline', 'addline', 'add', 'create')) || $set == 'defaultTVA') && !TSubtotal::isTitle($object) && !TSubtotal::isSubtotal($object) && in_array($object->element, array('propaldet', 'commandedet', 'facturedet'))) |
|
262 | + if ((in_array($doli_action, array('updateligne', 'updateline', 'addline', 'add', 'create')) || $set == 'defaultTVA') && !TSubtotal::isTitle($object) && !TSubtotal::isSubtotal($object) && in_array($object->element, array('propaldet', 'commandedet', 'facturedet'))) |
|
263 | 263 | { |
264 | 264 | dol_syslog( |
265 | - "[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". object=".$object->element." id=" . $object->id |
|
265 | + "[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". object=".$object->element." id=".$object->id |
|
266 | 266 | ); |
267 | 267 | |
268 | 268 | $TTitle = TSubtotal::getAllTitleFromLine($object); |
@@ -282,9 +282,9 @@ discard block |
||
282 | 282 | } |
283 | 283 | |
284 | 284 | // $object correspond à la ligne ajoutée |
285 | - if(empty($object->array_options)) $object->fetch_optionals(); |
|
285 | + if (empty($object->array_options)) $object->fetch_optionals(); |
|
286 | 286 | |
287 | - if(! empty($object->array_options['options_subtotal_nc'])) { |
|
287 | + if (!empty($object->array_options['options_subtotal_nc'])) { |
|
288 | 288 | $object->total_ht = $object->total_tva = $object->total_ttc = $object->total_localtax1 = $object->total_localtax2 = |
289 | 289 | $object->multicurrency_total_ht = $object->multicurrency_total_tva = $object->multicurrency_total_ttc = 0; |
290 | 290 | |
@@ -296,11 +296,11 @@ discard block |
||
296 | 296 | |
297 | 297 | // Correction d'un bug lors de la création d'une commande depuis une propale qui a, au moins, une ligne NC |
298 | 298 | $parent_element = ''; |
299 | - if($object->element == 'propaldet') $parent_element = 'propal'; |
|
300 | - if($object->element == 'commandedet') $parent_element = 'commande'; |
|
301 | - if($object->element == 'facturedet') $parent_element = 'facture'; |
|
299 | + if ($object->element == 'propaldet') $parent_element = 'propal'; |
|
300 | + if ($object->element == 'commandedet') $parent_element = 'commande'; |
|
301 | + if ($object->element == 'facturedet') $parent_element = 'facture'; |
|
302 | 302 | |
303 | - if(! empty($parent_element) && ! empty($object->array_options['options_subtotal_nc'])) { |
|
303 | + if (!empty($parent_element) && !empty($object->array_options['options_subtotal_nc'])) { |
|
304 | 304 | _updateLineNC($parent_element, $object->{'fk_'.$parent_element}, $object->id, $object->array_options['options_subtotal_nc'], 1); |
305 | 305 | } |
306 | 306 | } |
@@ -308,12 +308,12 @@ discard block |
||
308 | 308 | |
309 | 309 | // Les lignes libres (y compris les sous-totaux) créées à partir d'une facture modèle n'ont pas la TVA de la ligne du modèle mais la TVA par défaut |
310 | 310 | if ($action == 'BILL_CREATE' && $object->fac_rec > 0) { |
311 | - dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); |
|
311 | + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
|
312 | 312 | |
313 | 313 | $object->fetch_lines(); // Lignes pas rajoutées à $object->lines par les appels à addline(); |
314 | 314 | |
315 | - foreach($object->lines as &$line) { |
|
316 | - if(TSubtotal::isSubtotal($line) && ! empty($line->tva_tx)) { |
|
315 | + foreach ($object->lines as &$line) { |
|
316 | + if (TSubtotal::isSubtotal($line) && !empty($line->tva_tx)) { |
|
317 | 317 | $line->tva_tx = 0; |
318 | 318 | $line->update(); |
319 | 319 | } |
@@ -323,170 +323,170 @@ discard block |
||
323 | 323 | |
324 | 324 | if ($action == 'USER_LOGIN') { |
325 | 325 | dol_syslog( |
326 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
326 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
327 | 327 | ); |
328 | 328 | } elseif ($action == 'USER_UPDATE_SESSION') { |
329 | 329 | // Warning: To increase performances, this action is triggered only if |
330 | 330 | // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1. |
331 | 331 | dol_syslog( |
332 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
332 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
333 | 333 | ); |
334 | 334 | } elseif ($action == 'USER_CREATE') { |
335 | 335 | dol_syslog( |
336 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
336 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
337 | 337 | ); |
338 | 338 | } elseif ($action == 'USER_CREATE_FROM_CONTACT') { |
339 | 339 | dol_syslog( |
340 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
340 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
341 | 341 | ); |
342 | 342 | } elseif ($action == 'USER_MODIFY') { |
343 | 343 | dol_syslog( |
344 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
344 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
345 | 345 | ); |
346 | 346 | } elseif ($action == 'USER_NEW_PASSWORD') { |
347 | 347 | dol_syslog( |
348 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
348 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
349 | 349 | ); |
350 | 350 | } elseif ($action == 'USER_ENABLEDISABLE') { |
351 | 351 | dol_syslog( |
352 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
352 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
353 | 353 | ); |
354 | 354 | } elseif ($action == 'USER_DELETE') { |
355 | 355 | dol_syslog( |
356 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
356 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
357 | 357 | ); |
358 | 358 | } elseif ($action == 'USER_LOGOUT') { |
359 | 359 | dol_syslog( |
360 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
360 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
361 | 361 | ); |
362 | 362 | } elseif ($action == 'USER_SETINGROUP') { |
363 | 363 | dol_syslog( |
364 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
364 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
365 | 365 | ); |
366 | 366 | } elseif ($action == 'USER_REMOVEFROMGROUP') { |
367 | 367 | dol_syslog( |
368 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
368 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
369 | 369 | ); |
370 | 370 | } |
371 | 371 | |
372 | 372 | // Groups |
373 | 373 | elseif ($action == 'GROUP_CREATE') { |
374 | 374 | dol_syslog( |
375 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
375 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
376 | 376 | ); |
377 | 377 | } elseif ($action == 'GROUP_MODIFY') { |
378 | 378 | dol_syslog( |
379 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
379 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
380 | 380 | ); |
381 | 381 | } elseif ($action == 'GROUP_DELETE') { |
382 | 382 | dol_syslog( |
383 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
383 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
384 | 384 | ); |
385 | 385 | } |
386 | 386 | |
387 | 387 | // Companies |
388 | 388 | elseif ($action == 'COMPANY_CREATE') { |
389 | 389 | dol_syslog( |
390 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
390 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
391 | 391 | ); |
392 | 392 | } elseif ($action == 'COMPANY_MODIFY') { |
393 | 393 | dol_syslog( |
394 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
394 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
395 | 395 | ); |
396 | 396 | } elseif ($action == 'COMPANY_DELETE') { |
397 | 397 | dol_syslog( |
398 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
398 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
399 | 399 | ); |
400 | 400 | } |
401 | 401 | |
402 | 402 | // Contacts |
403 | 403 | elseif ($action == 'CONTACT_CREATE') { |
404 | 404 | dol_syslog( |
405 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
405 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
406 | 406 | ); |
407 | 407 | } elseif ($action == 'CONTACT_MODIFY') { |
408 | 408 | dol_syslog( |
409 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
409 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
410 | 410 | ); |
411 | 411 | } elseif ($action == 'CONTACT_DELETE') { |
412 | 412 | dol_syslog( |
413 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
413 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
414 | 414 | ); |
415 | 415 | } |
416 | 416 | |
417 | 417 | // Products |
418 | 418 | elseif ($action == 'PRODUCT_CREATE') { |
419 | 419 | dol_syslog( |
420 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
420 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
421 | 421 | ); |
422 | 422 | } elseif ($action == 'PRODUCT_MODIFY') { |
423 | 423 | dol_syslog( |
424 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
424 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
425 | 425 | ); |
426 | 426 | } elseif ($action == 'PRODUCT_DELETE') { |
427 | 427 | dol_syslog( |
428 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
428 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
429 | 429 | ); |
430 | 430 | } |
431 | 431 | |
432 | 432 | // Customer orders |
433 | 433 | elseif ($action == 'ORDER_CREATE') { |
434 | 434 | dol_syslog( |
435 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
435 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
436 | 436 | ); |
437 | 437 | } elseif ($action == 'ORDER_VALIDATE') { |
438 | 438 | dol_syslog( |
439 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
439 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
440 | 440 | ); |
441 | 441 | } elseif ($action == 'ORDER_DELETE') { |
442 | 442 | dol_syslog( |
443 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
443 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
444 | 444 | ); |
445 | 445 | } elseif ($action == 'ORDER_BUILDDOC') { |
446 | 446 | dol_syslog( |
447 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
447 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
448 | 448 | ); |
449 | 449 | } elseif ($action == 'ORDER_SENTBYMAIL') { |
450 | 450 | dol_syslog( |
451 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
451 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
452 | 452 | ); |
453 | 453 | } elseif ($action == 'LINEORDER_INSERT') { |
454 | 454 | dol_syslog( |
455 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
455 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
456 | 456 | ); |
457 | 457 | } elseif ($action == 'LINEORDER_DELETE') { |
458 | 458 | dol_syslog( |
459 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
459 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
460 | 460 | ); |
461 | 461 | } |
462 | 462 | |
463 | 463 | // Supplier orders |
464 | 464 | elseif ($action == 'ORDER_SUPPLIER_CREATE') { |
465 | 465 | dol_syslog( |
466 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
466 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
467 | 467 | ); |
468 | 468 | } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') { |
469 | 469 | dol_syslog( |
470 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
470 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
471 | 471 | ); |
472 | 472 | } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') { |
473 | 473 | dol_syslog( |
474 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
474 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
475 | 475 | ); |
476 | 476 | } elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') { |
477 | 477 | dol_syslog( |
478 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
478 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
479 | 479 | ); |
480 | 480 | } |
481 | 481 | |
482 | 482 | // Proposals |
483 | 483 | elseif ($action == 'PROPAL_CREATE') { |
484 | 484 | dol_syslog( |
485 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
485 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
486 | 486 | ); |
487 | 487 | } elseif (in_array($action, array('PROPAL_CLONE', 'ORDER_CLONE', 'BILL_CLONE'))) { |
488 | 488 | dol_syslog( |
489 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
489 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
490 | 490 | ); |
491 | 491 | |
492 | 492 | $doli_action = GETPOST('action'); |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && in_array($doli_action, array('confirm_clone'))) |
495 | 495 | { |
496 | 496 | dol_syslog( |
497 | - "[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". object=".$object->element." id=" . $object->id |
|
497 | + "[SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS] Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". object=".$object->element." id=".$object->id |
|
498 | 498 | ); |
499 | 499 | |
500 | 500 | // En fonction de l'objet et de la version, les lignes conservent l'id de l'objet d'origine |
@@ -522,272 +522,272 @@ discard block |
||
522 | 522 | |
523 | 523 | } elseif ($action == 'PROPAL_MODIFY') { |
524 | 524 | dol_syslog( |
525 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
525 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
526 | 526 | ); |
527 | 527 | } elseif ($action == 'PROPAL_VALIDATE') { |
528 | 528 | dol_syslog( |
529 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
529 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
530 | 530 | ); |
531 | 531 | } elseif ($action == 'PROPAL_BUILDDOC') { |
532 | 532 | dol_syslog( |
533 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
533 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
534 | 534 | ); |
535 | 535 | } elseif ($action == 'PROPAL_SENTBYMAIL') { |
536 | 536 | dol_syslog( |
537 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
537 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
538 | 538 | ); |
539 | 539 | } elseif ($action == 'PROPAL_CLOSE_SIGNED') { |
540 | 540 | dol_syslog( |
541 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
541 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
542 | 542 | ); |
543 | 543 | } elseif ($action == 'PROPAL_CLOSE_REFUSED') { |
544 | 544 | dol_syslog( |
545 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
545 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
546 | 546 | ); |
547 | 547 | } elseif ($action == 'PROPAL_DELETE') { |
548 | 548 | dol_syslog( |
549 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
549 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
550 | 550 | ); |
551 | 551 | } elseif ($action == 'LINEPROPAL_INSERT') { |
552 | 552 | dol_syslog( |
553 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
553 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
554 | 554 | ); |
555 | 555 | } elseif ($action == 'LINEPROPAL_MODIFY') { |
556 | 556 | dol_syslog( |
557 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
557 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
558 | 558 | ); |
559 | 559 | } elseif ($action == 'LINEPROPAL_DELETE') { |
560 | 560 | dol_syslog( |
561 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
561 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
562 | 562 | ); |
563 | 563 | } |
564 | 564 | |
565 | 565 | // Contracts |
566 | 566 | elseif ($action == 'CONTRACT_CREATE') { |
567 | 567 | dol_syslog( |
568 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
568 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
569 | 569 | ); |
570 | 570 | } elseif ($action == 'CONTRACT_MODIFY') { |
571 | 571 | dol_syslog( |
572 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
572 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
573 | 573 | ); |
574 | 574 | } elseif ($action == 'CONTRACT_ACTIVATE') { |
575 | 575 | dol_syslog( |
576 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
576 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
577 | 577 | ); |
578 | 578 | } elseif ($action == 'CONTRACT_CANCEL') { |
579 | 579 | dol_syslog( |
580 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
580 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
581 | 581 | ); |
582 | 582 | } elseif ($action == 'CONTRACT_CLOSE') { |
583 | 583 | dol_syslog( |
584 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
584 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
585 | 585 | ); |
586 | 586 | } elseif ($action == 'CONTRACT_DELETE') { |
587 | 587 | dol_syslog( |
588 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
588 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
589 | 589 | ); |
590 | 590 | } |
591 | 591 | |
592 | 592 | elseif ($action == 'BILL_MODIFY') { |
593 | 593 | dol_syslog( |
594 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
594 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
595 | 595 | ); |
596 | 596 | } elseif ($action == 'BILL_VALIDATE') { |
597 | 597 | dol_syslog( |
598 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
598 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
599 | 599 | ); |
600 | 600 | } elseif ($action == 'BILL_BUILDDOC') { |
601 | 601 | dol_syslog( |
602 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
602 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
603 | 603 | ); |
604 | 604 | } elseif ($action == 'BILL_SENTBYMAIL') { |
605 | 605 | dol_syslog( |
606 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
606 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
607 | 607 | ); |
608 | 608 | } elseif ($action == 'BILL_CANCEL') { |
609 | 609 | dol_syslog( |
610 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
610 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
611 | 611 | ); |
612 | 612 | } elseif ($action == 'BILL_DELETE') { |
613 | 613 | dol_syslog( |
614 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
614 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
615 | 615 | ); |
616 | 616 | } elseif ($action == 'LINEBILL_INSERT') { |
617 | 617 | |
618 | 618 | dol_syslog( |
619 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
619 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
620 | 620 | ); |
621 | 621 | } elseif ($action == 'LINEBILL_DELETE') { |
622 | 622 | dol_syslog( |
623 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
623 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
624 | 624 | ); |
625 | 625 | } |
626 | 626 | |
627 | 627 | // Payments |
628 | 628 | elseif ($action == 'PAYMENT_CUSTOMER_CREATE') { |
629 | 629 | dol_syslog( |
630 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
630 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
631 | 631 | ); |
632 | 632 | } elseif ($action == 'PAYMENT_SUPPLIER_CREATE') { |
633 | 633 | dol_syslog( |
634 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
634 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
635 | 635 | ); |
636 | 636 | } elseif ($action == 'PAYMENT_ADD_TO_BANK') { |
637 | 637 | dol_syslog( |
638 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
638 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
639 | 639 | ); |
640 | 640 | } elseif ($action == 'PAYMENT_DELETE') { |
641 | 641 | dol_syslog( |
642 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
642 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
643 | 643 | ); |
644 | 644 | } |
645 | 645 | |
646 | 646 | // Interventions |
647 | 647 | elseif ($action == 'FICHEINTER_CREATE') { |
648 | 648 | dol_syslog( |
649 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
649 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
650 | 650 | ); |
651 | 651 | } elseif ($action == 'FICHEINTER_MODIFY') { |
652 | 652 | dol_syslog( |
653 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
653 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
654 | 654 | ); |
655 | 655 | } elseif ($action == 'FICHEINTER_VALIDATE') { |
656 | 656 | dol_syslog( |
657 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
657 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
658 | 658 | ); |
659 | 659 | } elseif ($action == 'FICHEINTER_DELETE') { |
660 | 660 | dol_syslog( |
661 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
661 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
662 | 662 | ); |
663 | 663 | } |
664 | 664 | |
665 | 665 | // Members |
666 | 666 | elseif ($action == 'MEMBER_CREATE') { |
667 | 667 | dol_syslog( |
668 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
668 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
669 | 669 | ); |
670 | 670 | } elseif ($action == 'MEMBER_VALIDATE') { |
671 | 671 | dol_syslog( |
672 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
672 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
673 | 673 | ); |
674 | 674 | } elseif ($action == 'MEMBER_SUBSCRIPTION') { |
675 | 675 | dol_syslog( |
676 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
676 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
677 | 677 | ); |
678 | 678 | } elseif ($action == 'MEMBER_MODIFY') { |
679 | 679 | dol_syslog( |
680 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
680 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
681 | 681 | ); |
682 | 682 | } elseif ($action == 'MEMBER_NEW_PASSWORD') { |
683 | 683 | dol_syslog( |
684 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
684 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
685 | 685 | ); |
686 | 686 | } elseif ($action == 'MEMBER_RESILIATE') { |
687 | 687 | dol_syslog( |
688 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
688 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
689 | 689 | ); |
690 | 690 | } elseif ($action == 'MEMBER_DELETE') { |
691 | 691 | dol_syslog( |
692 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
692 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
693 | 693 | ); |
694 | 694 | } |
695 | 695 | |
696 | 696 | // Categories |
697 | 697 | elseif ($action == 'CATEGORY_CREATE') { |
698 | 698 | dol_syslog( |
699 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
699 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
700 | 700 | ); |
701 | 701 | } elseif ($action == 'CATEGORY_MODIFY') { |
702 | 702 | dol_syslog( |
703 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
703 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
704 | 704 | ); |
705 | 705 | } elseif ($action == 'CATEGORY_DELETE') { |
706 | 706 | dol_syslog( |
707 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
707 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
708 | 708 | ); |
709 | 709 | } |
710 | 710 | |
711 | 711 | // Projects |
712 | 712 | elseif ($action == 'PROJECT_CREATE') { |
713 | 713 | dol_syslog( |
714 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
714 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
715 | 715 | ); |
716 | 716 | } elseif ($action == 'PROJECT_MODIFY') { |
717 | 717 | dol_syslog( |
718 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
718 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
719 | 719 | ); |
720 | 720 | } elseif ($action == 'PROJECT_DELETE') { |
721 | 721 | dol_syslog( |
722 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
722 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
723 | 723 | ); |
724 | 724 | } |
725 | 725 | |
726 | 726 | // Project tasks |
727 | 727 | elseif ($action == 'TASK_CREATE') { |
728 | 728 | dol_syslog( |
729 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
729 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
730 | 730 | ); |
731 | 731 | } elseif ($action == 'TASK_MODIFY') { |
732 | 732 | dol_syslog( |
733 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
733 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
734 | 734 | ); |
735 | 735 | } elseif ($action == 'TASK_DELETE') { |
736 | 736 | dol_syslog( |
737 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
737 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
738 | 738 | ); |
739 | 739 | } |
740 | 740 | |
741 | 741 | // Task time spent |
742 | 742 | elseif ($action == 'TASK_TIMESPENT_CREATE') { |
743 | 743 | dol_syslog( |
744 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
744 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
745 | 745 | ); |
746 | 746 | } elseif ($action == 'TASK_TIMESPENT_MODIFY') { |
747 | 747 | dol_syslog( |
748 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
748 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
749 | 749 | ); |
750 | 750 | } elseif ($action == 'TASK_TIMESPENT_DELETE') { |
751 | 751 | dol_syslog( |
752 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
752 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
753 | 753 | ); |
754 | 754 | } |
755 | 755 | |
756 | 756 | // Shipping |
757 | 757 | elseif ($action == 'SHIPPING_CREATE') { |
758 | 758 | dol_syslog( |
759 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
759 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
760 | 760 | ); |
761 | 761 | } elseif ($action == 'SHIPPING_MODIFY') { |
762 | 762 | dol_syslog( |
763 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
763 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
764 | 764 | ); |
765 | 765 | } elseif ($action == 'SHIPPING_VALIDATE') { |
766 | 766 | dol_syslog( |
767 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
767 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
768 | 768 | ); |
769 | 769 | } elseif ($action == 'SHIPPING_SENTBYMAIL') { |
770 | 770 | dol_syslog( |
771 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
771 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
772 | 772 | ); |
773 | 773 | } elseif ($action == 'SHIPPING_DELETE') { |
774 | 774 | dol_syslog( |
775 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
775 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
776 | 776 | ); |
777 | 777 | } elseif ($action == 'SHIPPING_BUILDDOC') { |
778 | 778 | dol_syslog( |
779 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
779 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
780 | 780 | ); |
781 | 781 | } |
782 | 782 | |
783 | 783 | // File |
784 | 784 | elseif ($action == 'FILE_UPLOAD') { |
785 | 785 | dol_syslog( |
786 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
786 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
787 | 787 | ); |
788 | 788 | } elseif ($action == 'FILE_DELETE') { |
789 | 789 | dol_syslog( |
790 | - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
|
790 | + "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id |
|
791 | 791 | ); |
792 | 792 | } |
793 | 793 |
@@ -89,12 +89,14 @@ discard block |
||
89 | 89 | |
90 | 90 | if ($this->version == 'development') { |
91 | 91 | return $langs->trans("Development"); |
92 | - } elseif ($this->version == 'experimental') |
|
93 | - |
|
92 | + } elseif ($this->version == 'experimental') { |
|
93 | + |
|
94 | 94 | return $langs->trans("Experimental"); |
95 | - elseif ($this->version == 'dolibarr') return DOL_VERSION; |
|
96 | - elseif ($this->version) return $this->version; |
|
97 | - else { |
|
95 | + } elseif ($this->version == 'dolibarr') { |
|
96 | + return DOL_VERSION; |
|
97 | + } elseif ($this->version) { |
|
98 | + return $this->version; |
|
99 | + } else { |
|
98 | 100 | return $langs->trans("Unknown"); |
99 | 101 | } |
100 | 102 | } |
@@ -122,14 +124,18 @@ discard block |
||
122 | 124 | $subtotal_line_found = false; |
123 | 125 | foreach ($parent->lines as $k => &$line) |
124 | 126 | { |
125 | - if ($line->rang < $rang) continue; |
|
126 | - elseif ($line->rang == $rang) // Je suis sur la ligne de titre où je souhaite ajouter ma nouvelle ligne en fin de bloc |
|
127 | + if ($line->rang < $rang) { |
|
128 | + continue; |
|
129 | + } elseif ($line->rang == $rang) { |
|
130 | + // Je suis sur la ligne de titre où je souhaite ajouter ma nouvelle ligne en fin de bloc |
|
127 | 131 | { |
128 | 132 | $title_level = $line->qty; |
129 | 133 | } |
130 | - elseif (!$subtotal_line_found && $title_level > -1 && ($line->qty == 100 - $title_level)) // Le level de mon titre a été trouvé avant, donc maintenant je vais m'arrêter jusqu'à trouver un sous-total |
|
134 | + } elseif (!$subtotal_line_found && $title_level > -1 && ($line->qty == 100 - $title_level)) { |
|
135 | + // Le level de mon titre a été trouvé avant, donc maintenant je vais m'arrêter jusqu'à trouver un sous-total |
|
131 | 136 | { |
132 | 137 | $subtotal_line_found = true; |
138 | + } |
|
133 | 139 | $rang = $line->rang; |
134 | 140 | } |
135 | 141 | |
@@ -191,8 +197,11 @@ discard block |
||
191 | 197 | break; |
192 | 198 | } |
193 | 199 | |
194 | - if (!empty($conf->global->SUBTOTAL_ADD_LINE_UNDER_TITLE_AT_END_BLOCK)) $this->addToEnd($parent, $object, $rang); |
|
195 | - else $this->addToBegin($parent, $object, $rang); |
|
200 | + if (!empty($conf->global->SUBTOTAL_ADD_LINE_UNDER_TITLE_AT_END_BLOCK)) { |
|
201 | + $this->addToEnd($parent, $object, $rang); |
|
202 | + } else { |
|
203 | + $this->addToBegin($parent, $object, $rang); |
|
204 | + } |
|
196 | 205 | |
197 | 206 | } |
198 | 207 | |
@@ -220,7 +229,9 @@ discard block |
||
220 | 229 | $commande->fetch($current_fk_commande); |
221 | 230 | |
222 | 231 | $label = $conf->global->SUBTOTAL_TEXT_FOR_TITLE_ORDETSTOINVOICE; |
223 | - if (empty($label)) $label = 'Commande [__REFORDER__] - Référence client : [__REFCUSTOMER__]'; |
|
232 | + if (empty($label)) { |
|
233 | + $label = 'Commande [__REFORDER__] - Référence client : [__REFCUSTOMER__]'; |
|
234 | + } |
|
224 | 235 | $label = str_replace(array('__REFORDER__', '__REFCUSTOMER__'), array($commande->ref, $commande->ref_client), $label); |
225 | 236 | |
226 | 237 | TSubtotal::addTitle($facture, $label, 1, $rang); |
@@ -255,7 +266,9 @@ discard block |
||
255 | 266 | |
256 | 267 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && in_array($action, array('LINEPROPAL_INSERT', 'LINEPROPAL_UPDATE', 'LINEORDER_INSERT', 'LINEORDER_UPDATE', 'LINEBILL_INSERT', 'LINEBILL_UPDATE'))) |
257 | 268 | { |
258 | - if(! function_exists('_updateLineNC')) dol_include_once('/subtotal/lib/subtotal.lib.php'); |
|
269 | + if(! function_exists('_updateLineNC')) { |
|
270 | + dol_include_once('/subtotal/lib/subtotal.lib.php'); |
|
271 | + } |
|
259 | 272 | |
260 | 273 | $doli_action = GETPOST('action'); |
261 | 274 | $set = GETPOST('set'); |
@@ -273,32 +286,50 @@ discard block |
||
273 | 286 | $object->total_ht = $object->total_tva = $object->total_ttc = $object->total_localtax1 = $object->total_localtax2 = |
274 | 287 | $object->multicurrency_total_ht = $object->multicurrency_total_tva = $object->multicurrency_total_ttc = 0; |
275 | 288 | |
276 | - if ($object->element == 'propal') $res = $object->update(1); |
|
277 | - else $res = $object->update($user, 1); |
|
289 | + if ($object->element == 'propal') { |
|
290 | + $res = $object->update(1); |
|
291 | + } else { |
|
292 | + $res = $object->update($user, 1); |
|
293 | + } |
|
278 | 294 | |
279 | - if ($res > 0) setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
295 | + if ($res > 0) { |
|
296 | + setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
297 | + } |
|
280 | 298 | break; |
281 | 299 | } |
282 | 300 | } |
283 | 301 | |
284 | 302 | // $object correspond à la ligne ajoutée |
285 | - if(empty($object->array_options)) $object->fetch_optionals(); |
|
303 | + if(empty($object->array_options)) { |
|
304 | + $object->fetch_optionals(); |
|
305 | + } |
|
286 | 306 | |
287 | 307 | if(! empty($object->array_options['options_subtotal_nc'])) { |
288 | 308 | $object->total_ht = $object->total_tva = $object->total_ttc = $object->total_localtax1 = $object->total_localtax2 = |
289 | 309 | $object->multicurrency_total_ht = $object->multicurrency_total_tva = $object->multicurrency_total_ttc = 0; |
290 | 310 | |
291 | - if ($object->element == 'propaldet') $res = $object->update(1); |
|
292 | - else $res = $object->update($user, 1); |
|
311 | + if ($object->element == 'propaldet') { |
|
312 | + $res = $object->update(1); |
|
313 | + } else { |
|
314 | + $res = $object->update($user, 1); |
|
315 | + } |
|
293 | 316 | |
294 | - if ($res > 0) setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
317 | + if ($res > 0) { |
|
318 | + setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
319 | + } |
|
295 | 320 | } |
296 | 321 | |
297 | 322 | // Correction d'un bug lors de la création d'une commande depuis une propale qui a, au moins, une ligne NC |
298 | 323 | $parent_element = ''; |
299 | - if($object->element == 'propaldet') $parent_element = 'propal'; |
|
300 | - if($object->element == 'commandedet') $parent_element = 'commande'; |
|
301 | - if($object->element == 'facturedet') $parent_element = 'facture'; |
|
324 | + if($object->element == 'propaldet') { |
|
325 | + $parent_element = 'propal'; |
|
326 | + } |
|
327 | + if($object->element == 'commandedet') { |
|
328 | + $parent_element = 'commande'; |
|
329 | + } |
|
330 | + if($object->element == 'facturedet') { |
|
331 | + $parent_element = 'facture'; |
|
332 | + } |
|
302 | 333 | |
303 | 334 | if(! empty($parent_element) && ! empty($object->array_options['options_subtotal_nc'])) { |
304 | 335 | _updateLineNC($parent_element, $object->{'fk_'.$parent_element}, $object->id, $object->array_options['options_subtotal_nc'], 1); |
@@ -498,26 +529,38 @@ discard block |
||
498 | 529 | ); |
499 | 530 | |
500 | 531 | // En fonction de l'objet et de la version, les lignes conservent l'id de l'objet d'origine |
501 | - if (method_exists($object, 'fetch_lines')) $object->fetch_lines(); |
|
502 | - else $object->fetch($object->id); |
|
532 | + if (method_exists($object, 'fetch_lines')) { |
|
533 | + $object->fetch_lines(); |
|
534 | + } else { |
|
535 | + $object->fetch($object->id); |
|
536 | + } |
|
503 | 537 | |
504 | 538 | foreach ($object->lines as &$line) |
505 | 539 | { |
506 | - if (empty($line->array_options)) $line->fetch_optionals(); |
|
540 | + if (empty($line->array_options)) { |
|
541 | + $line->fetch_optionals(); |
|
542 | + } |
|
507 | 543 | |
508 | 544 | if (!TSubtotal::isModSubtotalLine($line) && !empty($line->array_options['options_subtotal_nc'])) |
509 | 545 | { |
510 | 546 | $line->total_ht = $line->total_tva = $line->total_ttc = $line->total_localtax1 = $line->total_localtax2 = |
511 | 547 | $line->multicurrency_total_ht = $line->multicurrency_total_tva = $line->multicurrency_total_ttc = 0; |
512 | 548 | |
513 | - if ($line->element == 'propaldet') $res = $line->update(1); |
|
514 | - else $res = $line->update($user, 1); |
|
549 | + if ($line->element == 'propaldet') { |
|
550 | + $res = $line->update(1); |
|
551 | + } else { |
|
552 | + $res = $line->update($user, 1); |
|
553 | + } |
|
515 | 554 | |
516 | - if ($res > 0) setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
555 | + if ($res > 0) { |
|
556 | + setEventMessage($langs->trans('subtotal_update_nc_success')); |
|
557 | + } |
|
517 | 558 | } |
518 | 559 | } |
519 | 560 | |
520 | - if (!empty($line)) $object->update_price(1); |
|
561 | + if (!empty($line)) { |
|
562 | + $object->update_price(1); |
|
563 | + } |
|
521 | 564 | } |
522 | 565 | |
523 | 566 | } elseif ($action == 'PROPAL_MODIFY') { |
@@ -587,9 +630,7 @@ discard block |
||
587 | 630 | dol_syslog( |
588 | 631 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
589 | 632 | ); |
590 | - } |
|
591 | - |
|
592 | - elseif ($action == 'BILL_MODIFY') { |
|
633 | + } elseif ($action == 'BILL_MODIFY') { |
|
593 | 634 | dol_syslog( |
594 | 635 | "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id |
595 | 636 | ); |
@@ -16,17 +16,17 @@ discard block |
||
16 | 16 | |
17 | 17 | global $type_element, $where; |
18 | 18 | |
19 | - $contexts = explode(':',$parameters['context']); |
|
19 | + $contexts = explode(':', $parameters['context']); |
|
20 | 20 | |
21 | - if(in_array('consumptionthirdparty',$contexts) && in_array($type_element, array('propal', 'order', 'invoice', 'supplier_order', 'supplier_invoice', 'supplier_proposal'))) { |
|
21 | + if (in_array('consumptionthirdparty', $contexts) && in_array($type_element, array('propal', 'order', 'invoice', 'supplier_order', 'supplier_invoice', 'supplier_proposal'))) { |
|
22 | 22 | $mod_num = TSubtotal::$module_number; |
23 | 23 | |
24 | 24 | // Not a title (can't use TSubtotal class methods in sql) |
25 | - $where.= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty > 9)'; |
|
25 | + $where .= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty > 9)'; |
|
26 | 26 | // Not a subtotal (can't use TSubtotal class methods in sql) |
27 | - $where.= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty < 90)'; |
|
27 | + $where .= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty < 90)'; |
|
28 | 28 | // Not a free line text (can't use TSubtotal class methods in sql) |
29 | - $where.= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty != 50)'; |
|
29 | + $where .= ' AND (d.special_code != '.$mod_num.' OR d.product_type != 9 OR d.qty != 50)'; |
|
30 | 30 | |
31 | 31 | } |
32 | 32 | |
@@ -105,43 +105,43 @@ discard block |
||
105 | 105 | |
106 | 106 | function formObjectOptions($parameters, &$object, &$action, $hookmanager) |
107 | 107 | { |
108 | - global $langs,$db,$user, $conf; |
|
108 | + global $langs, $db, $user, $conf; |
|
109 | 109 | |
110 | 110 | $langs->load('subtotal@subtotal'); |
111 | 111 | |
112 | - $contexts = explode(':',$parameters['context']); |
|
112 | + $contexts = explode(':', $parameters['context']); |
|
113 | 113 | |
114 | - if(in_array('ordercard',$contexts) || in_array('ordersuppliercard',$contexts) || in_array('propalcard',$contexts) || in_array('supplier_proposalcard',$contexts) || in_array('invoicecard',$contexts) || in_array('invoicesuppliercard',$contexts) || in_array('invoicereccard',$contexts)) { |
|
114 | + if (in_array('ordercard', $contexts) || in_array('ordersuppliercard', $contexts) || in_array('propalcard', $contexts) || in_array('supplier_proposalcard', $contexts) || in_array('invoicecard', $contexts) || in_array('invoicesuppliercard', $contexts) || in_array('invoicereccard', $contexts)) { |
|
115 | 115 | |
116 | 116 | $createRight = $user->rights->{$object->element}->creer; |
117 | - if($object->element == 'facturerec' ) |
|
117 | + if ($object->element == 'facturerec') |
|
118 | 118 | { |
119 | 119 | $object->statut = 0; // hack for facture rec |
120 | 120 | $createRight = $user->rights->facture->creer; |
121 | - } elseif($object->element == 'order_supplier' ) |
|
121 | + } elseif ($object->element == 'order_supplier') |
|
122 | 122 | { |
123 | 123 | $createRight = $user->rights->fournisseur->commande->creer; |
124 | - } elseif($object->element == 'invoice_supplier' ) |
|
124 | + } elseif ($object->element == 'invoice_supplier') |
|
125 | 125 | { |
126 | 126 | $createRight = $user->rights->fournisseur->facture->creer; |
127 | 127 | } |
128 | 128 | |
129 | - if ($object->statut == 0 && $createRight) { |
|
129 | + if ($object->statut == 0 && $createRight) { |
|
130 | 130 | |
131 | 131 | |
132 | - if($object->element=='facture')$idvar = 'facid'; |
|
133 | - else $idvar='id'; |
|
132 | + if ($object->element == 'facture')$idvar = 'facid'; |
|
133 | + else $idvar = 'id'; |
|
134 | 134 | |
135 | - if(in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')) ) |
|
135 | + if (in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text'))) |
|
136 | 136 | { |
137 | 137 | $level = GETPOST('level', 'int'); //New avec SUBTOTAL_USE_NEW_FORMAT |
138 | 138 | |
139 | - if($action=='add_title_line') { |
|
139 | + if ($action == 'add_title_line') { |
|
140 | 140 | $title = GETPOST('title'); |
141 | - if(empty($title)) $title = $langs->trans('title'); |
|
142 | - $qty = $level<1 ? 1 : $level ; |
|
141 | + if (empty($title)) $title = $langs->trans('title'); |
|
142 | + $qty = $level < 1 ? 1 : $level; |
|
143 | 143 | } |
144 | - else if($action=='add_free_text') { |
|
144 | + else if ($action == 'add_free_text') { |
|
145 | 145 | $title = GETPOST('title'); |
146 | 146 | |
147 | 147 | if (empty($title)) { |
@@ -153,21 +153,21 @@ discard block |
||
153 | 153 | } |
154 | 154 | } |
155 | 155 | } |
156 | - if(empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
156 | + if (empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
157 | 157 | $qty = 50; |
158 | 158 | } |
159 | - else if($action=='add_subtitle_line') { |
|
159 | + else if ($action == 'add_subtitle_line') { |
|
160 | 160 | $title = GETPOST('title'); |
161 | - if(empty($title)) $title = $langs->trans('subtitle'); |
|
161 | + if (empty($title)) $title = $langs->trans('subtitle'); |
|
162 | 162 | $qty = 2; |
163 | 163 | } |
164 | - else if($action=='add_subtotal_line') { |
|
164 | + else if ($action == 'add_subtotal_line') { |
|
165 | 165 | $title = $langs->trans('SubSubTotal'); |
166 | 166 | $qty = 98; |
167 | 167 | } |
168 | 168 | else { |
169 | 169 | $title = GETPOST('title') ? GETPOST('title') : $langs->trans('SubTotal'); |
170 | - $qty = $level ? 100-$level : 99; |
|
170 | + $qty = $level ? 100 - $level : 99; |
|
171 | 171 | } |
172 | 172 | dol_include_once('/subtotal/class/subtotal.class.php'); |
173 | 173 | |
@@ -175,15 +175,15 @@ discard block |
||
175 | 175 | |
176 | 176 | TSubtotal::addSubTotalLine($object, $title, $qty); |
177 | 177 | } |
178 | - else if($action==='ask_deleteallline') { |
|
179 | - $form=new Form($db); |
|
178 | + else if ($action === 'ask_deleteallline') { |
|
179 | + $form = new Form($db); |
|
180 | 180 | |
181 | - $lineid = GETPOST('lineid','integer'); |
|
181 | + $lineid = GETPOST('lineid', 'integer'); |
|
182 | 182 | $TIdForGroup = $this->getArrayOfLineForAGroup($object, $lineid); |
183 | 183 | |
184 | 184 | $nbLines = count($TIdForGroup); |
185 | 185 | |
186 | - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('deleteWithAllLines'), $langs->trans('ConfirmDeleteAllThisLines',$nbLines), 'confirm_delete_all_lines','',0,1); |
|
186 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('deleteWithAllLines'), $langs->trans('ConfirmDeleteAllThisLines', $nbLines), 'confirm_delete_all_lines', '', 0, 1); |
|
187 | 187 | print $formconfirm; |
188 | 188 | } |
189 | 189 | |
@@ -193,13 +193,13 @@ discard block |
||
193 | 193 | } |
194 | 194 | |
195 | 195 | |
196 | - if($action!='editline') { |
|
196 | + if ($action != 'editline') { |
|
197 | 197 | // New format is for 3.8 |
198 | 198 | $this->printNewFormat($object, $conf, $langs, $idvar); |
199 | 199 | } |
200 | 200 | } |
201 | 201 | } |
202 | - elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
202 | + elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice', $contexts)) |
|
203 | 203 | { |
204 | 204 | ?> |
205 | 205 | <script type="text/javascript"> |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | $(document).ready(function() { |
225 | 225 | $('div.fiche div.tabsAction').append('<br />'); |
226 | 226 | |
227 | - $('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_title_line" rel="add_title_line" href="javascript:;" class="butAction"><?php echo $langs->trans('AddTitle' )?></a></div>'); |
|
227 | + $('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_title_line" rel="add_title_line" href="javascript:;" class="butAction"><?php echo $langs->trans('AddTitle')?></a></div>'); |
|
228 | 228 | $('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_total_line" rel="add_total_line" href="javascript:;" class="butAction"><?php echo $langs->trans('AddSubTotal')?></a></div>'); |
229 | 229 | $('div.fiche div.tabsAction').append('<div class="inline-block divButAction"><a id="add_free_text" rel="add_free_text" href="javascript:;" class="butAction"><?php echo $langs->trans('AddFreeText')?></a></div>'); |
230 | 230 | |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | $('body').append(dialog_html); |
276 | 276 | |
277 | 277 | <?php |
278 | - $editorTool = empty($conf->global->FCKEDITOR_EDITORNAME)?'ckeditor':$conf->global->FCKEDITOR_EDITORNAME; |
|
279 | - $editorConf = empty($conf->global->FCKEDITOR_ENABLE_DETAILS)?false:$conf->global->FCKEDITOR_ENABLE_DETAILS; |
|
280 | - if($editorConf && in_array($editorTool,array('textarea','ckeditor'))){ |
|
278 | + $editorTool = empty($conf->global->FCKEDITOR_EDITORNAME) ? 'ckeditor' : $conf->global->FCKEDITOR_EDITORNAME; |
|
279 | + $editorConf = empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ?false:$conf->global->FCKEDITOR_ENABLE_DETAILS; |
|
280 | + if ($editorConf && in_array($editorTool, array('textarea', 'ckeditor'))) { |
|
281 | 281 | ?> |
282 | 282 | if (action == 'addTitle' || action == 'addFreeTxt') |
283 | 283 | { |
@@ -392,62 +392,62 @@ discard block |
||
392 | 392 | global $conf, $langs, $bc; |
393 | 393 | |
394 | 394 | $action = GETPOST('action'); |
395 | - $TContext = explode(':',$parameters['context']); |
|
395 | + $TContext = explode(':', $parameters['context']); |
|
396 | 396 | if ( |
397 | - in_array('invoicecard',$TContext) |
|
398 | - || in_array('invoicesuppliercard',$TContext) |
|
399 | - || in_array('propalcard',$TContext) |
|
400 | - || in_array('ordercard',$TContext) |
|
401 | - || in_array('ordersuppliercard',$TContext) |
|
402 | - || in_array('invoicereccard',$TContext) |
|
397 | + in_array('invoicecard', $TContext) |
|
398 | + || in_array('invoicesuppliercard', $TContext) |
|
399 | + || in_array('propalcard', $TContext) |
|
400 | + || in_array('ordercard', $TContext) |
|
401 | + || in_array('ordersuppliercard', $TContext) |
|
402 | + || in_array('invoicereccard', $TContext) |
|
403 | 403 | ) |
404 | 404 | { |
405 | - $hideInnerLines = isset( $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0; |
|
406 | - $hidedetails = isset( $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0; |
|
407 | - $hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED)?$conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED:0; |
|
408 | - $hideprices= isset( $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] ) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] : $hidepricesDefaultConf; |
|
405 | + $hideInnerLines = isset($_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id]) ? $_SESSION['subtotal_hideInnerLines_'.$parameters['modulepart']][$object->id] : 0; |
|
406 | + $hidedetails = isset($_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id]) ? $_SESSION['subtotal_hidedetails_'.$parameters['modulepart']][$object->id] : 0; |
|
407 | + $hidepricesDefaultConf = !empty($conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED) ? $conf->global->SUBTOTAL_HIDE_PRICE_DEFAULT_CHECKED : 0; |
|
408 | + $hideprices = isset($_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id]) ? $_SESSION['subtotal_hideprices_'.$parameters['modulepart']][$object->id] : $hidepricesDefaultConf; |
|
409 | 409 | |
410 | - $var=false; |
|
411 | - $out.= '<tr '.$bc[$var].'> |
|
410 | + $var = false; |
|
411 | + $out .= '<tr '.$bc[$var].'> |
|
412 | 412 | <td colspan="4" align="right"> |
413 | 413 | <label for="hideInnerLines">'.$langs->trans('HideInnerLines').'</label> |
414 | - <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(( $hideInnerLines ) ? 'checked="checked"' : '' ).' /> |
|
414 | + <input type="checkbox" onclick="if($(this).is(\':checked\')) { $(\'#hidedetails\').prop(\'checked\', \'checked\') }" id="hideInnerLines" name="hideInnerLines" value="1" '.(($hideInnerLines) ? 'checked="checked"' : '').' /> |
|
415 | 415 | </td> |
416 | 416 | </tr>'; |
417 | 417 | |
418 | - $var=!$var; |
|
419 | - $out.= '<tr '.$bc[$var].'> |
|
418 | + $var = !$var; |
|
419 | + $out .= '<tr '.$bc[$var].'> |
|
420 | 420 | <td colspan="4" align="right"> |
421 | 421 | <label for="hidedetails">'.$langs->trans('SubTotalhidedetails').'</label> |
422 | - <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(( $hidedetails ) ? 'checked="checked"' : '' ).' /> |
|
422 | + <input type="checkbox" id="hidedetails" name="hidedetails" value="1" '.(($hidedetails) ? 'checked="checked"' : '').' /> |
|
423 | 423 | </td> |
424 | 424 | </tr>'; |
425 | 425 | |
426 | - $var=!$var; |
|
427 | - $out.= '<tr '.$bc[$var].'> |
|
426 | + $var = !$var; |
|
427 | + $out .= '<tr '.$bc[$var].'> |
|
428 | 428 | <td colspan="4" align="right"> |
429 | 429 | <label for="hideprices">'.$langs->trans('SubTotalhidePrice').'</label> |
430 | - <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(( $hideprices ) ? 'checked="checked"' : '' ).' /> |
|
430 | + <input type="checkbox" id="hideprices" name="hideprices" value="1" '.(($hideprices) ? 'checked="checked"' : '').' /> |
|
431 | 431 | </td> |
432 | 432 | </tr>'; |
433 | 433 | |
434 | 434 | |
435 | 435 | |
436 | 436 | if ( |
437 | - (in_array('propalcard',$TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP)) |
|
438 | - || (in_array('ordercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
439 | - || (in_array('ordersuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
440 | - || (in_array('invoicecard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
441 | - || (in_array('invoicesuppliercard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
442 | - || (in_array('invoicereccard',$TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP )) |
|
437 | + (in_array('propalcard', $TContext) && !empty($conf->global->SUBTOTAL_PROPAL_ADD_RECAP)) |
|
438 | + || (in_array('ordercard', $TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
439 | + || (in_array('ordersuppliercard', $TContext) && !empty($conf->global->SUBTOTAL_COMMANDE_ADD_RECAP)) |
|
440 | + || (in_array('invoicecard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
441 | + || (in_array('invoicesuppliercard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
442 | + || (in_array('invoicereccard', $TContext) && !empty($conf->global->SUBTOTAL_INVOICE_ADD_RECAP)) |
|
443 | 443 | ) |
444 | 444 | { |
445 | - $var=!$var; |
|
446 | - $out.= ' |
|
445 | + $var = !$var; |
|
446 | + $out .= ' |
|
447 | 447 | <tr '.$bc[$var].'> |
448 | 448 | <td colspan="4" align="right"> |
449 | 449 | <label for="subtotal_add_recap">'.$langs->trans('subtotal_add_recap').'</label> |
450 | - <input type="checkbox" id="subtotal_add_recap" name="subtotal_add_recap" value="1" '.( GETPOST('subtotal_add_recap') ? 'checked="checked"' : '' ).' /> |
|
450 | + <input type="checkbox" id="subtotal_add_recap" name="subtotal_add_recap" value="1" '.(GETPOST('subtotal_add_recap') ? 'checked="checked"' : '').' /> |
|
451 | 451 | </td> |
452 | 452 | </tr>'; |
453 | 453 | } |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | function formEditProductOptions($parameters, &$object, &$action, $hookmanager) |
464 | 464 | { |
465 | 465 | |
466 | - if (in_array('invoicecard',explode(':',$parameters['context']))) |
|
466 | + if (in_array('invoicecard', explode(':', $parameters['context']))) |
|
467 | 467 | { |
468 | 468 | |
469 | 469 | } |
@@ -474,13 +474,13 @@ discard block |
||
474 | 474 | function ODTSubstitutionLine(&$parameters, &$object, $action, $hookmanager) { |
475 | 475 | global $conf; |
476 | 476 | |
477 | - if($action === 'builddoc') { |
|
477 | + if ($action === 'builddoc') { |
|
478 | 478 | |
479 | 479 | $line = &$parameters['line']; |
480 | 480 | $object = &$parameters['object']; |
481 | 481 | $substitutionarray = &$parameters['substitutionarray']; |
482 | 482 | |
483 | - if($line->product_type == 9 && $line->special_code == $this->module_number) { |
|
483 | + if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
|
484 | 484 | $substitutionarray['line_modsubtotal'] = 1; |
485 | 485 | |
486 | 486 | $substitutionarray['line_price_ht'] |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | = $substitutionarray['line_up'] |
492 | 492 | = ''; |
493 | 493 | |
494 | - if($line->qty>90) { |
|
494 | + if ($line->qty > 90) { |
|
495 | 495 | $substitutionarray['line_modsubtotal_total'] = true; |
496 | 496 | |
497 | 497 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | |
506 | 506 | |
507 | 507 | } |
508 | - else{ |
|
508 | + else { |
|
509 | 509 | $substitutionarray['line_not_modsubtotal'] = true; |
510 | 510 | $substitutionarray['line_modsubtotal'] = 0; |
511 | 511 | } |
@@ -517,29 +517,29 @@ discard block |
||
517 | 517 | function createFrom($parameters, &$object, $action, $hookmanager) { |
518 | 518 | |
519 | 519 | if ( |
520 | - in_array('invoicecard',explode(':',$parameters['context'])) |
|
521 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
522 | - || in_array('propalcard',explode(':',$parameters['context'])) |
|
523 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
524 | - || in_array('ordercard',explode(':',$parameters['context'])) |
|
525 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
526 | - || in_array('invoicereccard',explode(':',$parameters['context'])) |
|
520 | + in_array('invoicecard', explode(':', $parameters['context'])) |
|
521 | + || in_array('invoicesuppliercard', explode(':', $parameters['context'])) |
|
522 | + || in_array('propalcard', explode(':', $parameters['context'])) |
|
523 | + || in_array('supplier_proposalcard', explode(':', $parameters['context'])) |
|
524 | + || in_array('ordercard', explode(':', $parameters['context'])) |
|
525 | + || in_array('ordersuppliercard', explode(':', $parameters['context'])) |
|
526 | + || in_array('invoicereccard', explode(':', $parameters['context'])) |
|
527 | 527 | ) { |
528 | 528 | |
529 | 529 | global $db; |
530 | 530 | |
531 | 531 | $objFrom = $parameters['objFrom']; |
532 | 532 | |
533 | - foreach($objFrom->lines as $k=> &$lineOld) { |
|
533 | + foreach ($objFrom->lines as $k=> &$lineOld) { |
|
534 | 534 | |
535 | - if($lineOld->product_type == 9 && $lineOld->info_bits > 0 ) { |
|
535 | + if ($lineOld->product_type == 9 && $lineOld->info_bits > 0) { |
|
536 | 536 | |
537 | 537 | $line = & $object->lines[$k]; |
538 | 538 | |
539 | 539 | $idLine = (int) ($line->id ? $line->id : $line->rowid); |
540 | 540 | |
541 | 541 | $db->query("UPDATE ".MAIN_DB_PREFIX.$line->table_element." |
542 | - SET info_bits=".(int)$lineOld->info_bits." |
|
542 | + SET info_bits=".(int) $lineOld->info_bits." |
|
543 | 543 | WHERE rowid = ".$idLine." |
544 | 544 | "); |
545 | 545 | |
@@ -555,15 +555,15 @@ discard block |
||
555 | 555 | |
556 | 556 | function doActions($parameters, &$object, $action, $hookmanager) |
557 | 557 | { |
558 | - global $db, $conf, $langs,$user; |
|
558 | + global $db, $conf, $langs, $user; |
|
559 | 559 | |
560 | 560 | dol_include_once('/subtotal/class/subtotal.class.php'); |
561 | 561 | dol_include_once('/subtotal/lib/subtotal.lib.php'); |
562 | - require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
|
562 | + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
563 | 563 | |
564 | 564 | $showBlockExtrafields = GETPOST('showBlockExtrafields'); |
565 | 565 | |
566 | - if($object->element=='facture') $idvar = 'facid'; |
|
566 | + if ($object->element == 'facture') $idvar = 'facid'; |
|
567 | 567 | else $idvar = 'id'; |
568 | 568 | |
569 | 569 | if ($action == 'updateligne' || $action == 'updateline') |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | if ($line->id == $lineid && TSubtotal::isModSubtotalLine($line)) |
577 | 577 | { |
578 | 578 | $found = true; |
579 | - if(TSubtotal::isTitle($line) && !empty($showBlockExtrafields)) { |
|
579 | + if (TSubtotal::isTitle($line) && !empty($showBlockExtrafields)) { |
|
580 | 580 | $extrafieldsline = new ExtraFields($db); |
581 | 581 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
582 | 582 | $extrafieldsline->setOptionalsFromPost($extralabelsline, $line); |
@@ -595,43 +595,43 @@ discard block |
||
595 | 595 | exit; // Surtout ne pas laisser Dolibarr faire du traitement sur le updateligne sinon ça plante les données de la ligne |
596 | 596 | } |
597 | 597 | } |
598 | - else if($action === 'builddoc') { |
|
598 | + else if ($action === 'builddoc') { |
|
599 | 599 | |
600 | 600 | if ( |
601 | - in_array('invoicecard',explode(':',$parameters['context'])) |
|
602 | - || in_array('propalcard',explode(':',$parameters['context'])) |
|
603 | - || in_array('ordercard',explode(':',$parameters['context'])) |
|
604 | - || in_array('ordersuppliercard',explode(':',$parameters['context'])) |
|
605 | - || in_array('invoicesuppliercard',explode(':',$parameters['context'])) |
|
606 | - || in_array('supplier_proposalcard',explode(':',$parameters['context'])) |
|
601 | + in_array('invoicecard', explode(':', $parameters['context'])) |
|
602 | + || in_array('propalcard', explode(':', $parameters['context'])) |
|
603 | + || in_array('ordercard', explode(':', $parameters['context'])) |
|
604 | + || in_array('ordersuppliercard', explode(':', $parameters['context'])) |
|
605 | + || in_array('invoicesuppliercard', explode(':', $parameters['context'])) |
|
606 | + || in_array('supplier_proposalcard', explode(':', $parameters['context'])) |
|
607 | 607 | ) |
608 | 608 | { |
609 | - if(in_array('invoicecard',explode(':',$parameters['context']))) { |
|
609 | + if (in_array('invoicecard', explode(':', $parameters['context']))) { |
|
610 | 610 | $sessname = 'subtotal_hideInnerLines_facture'; |
611 | 611 | $sessname2 = 'subtotal_hidedetails_facture'; |
612 | 612 | $sessname3 = 'subtotal_hideprices_facture'; |
613 | 613 | } |
614 | - elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
614 | + elseif (in_array('invoicesuppliercard', explode(':', $parameters['context']))) { |
|
615 | 615 | $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
616 | 616 | $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
617 | 617 | $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
618 | 618 | } |
619 | - elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
619 | + elseif (in_array('propalcard', explode(':', $parameters['context']))) { |
|
620 | 620 | $sessname = 'subtotal_hideInnerLines_propal'; |
621 | 621 | $sessname2 = 'subtotal_hidedetails_propal'; |
622 | 622 | $sessname3 = 'subtotal_hideprices_propal'; |
623 | 623 | } |
624 | - elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
624 | + elseif (in_array('supplier_proposalcard', explode(':', $parameters['context']))) { |
|
625 | 625 | $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
626 | 626 | $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
627 | 627 | $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
628 | 628 | } |
629 | - elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
629 | + elseif (in_array('ordercard', explode(':', $parameters['context']))) { |
|
630 | 630 | $sessname = 'subtotal_hideInnerLines_commande'; |
631 | 631 | $sessname2 = 'subtotal_hidedetails_commande'; |
632 | 632 | $sessname3 = 'subtotal_hideprices_commande'; |
633 | 633 | } |
634 | - elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
634 | + elseif (in_array('ordersuppliercard', explode(':', $parameters['context']))) { |
|
635 | 635 | $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
636 | 636 | $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
637 | 637 | $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
@@ -644,25 +644,25 @@ discard block |
||
644 | 644 | |
645 | 645 | global $hideprices; |
646 | 646 | |
647 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
648 | - if(!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id]) ) $_SESSION[$sessname] = array(); // prevent old system |
|
647 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
648 | + if (!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id])) $_SESSION[$sessname] = array(); // prevent old system |
|
649 | 649 | $_SESSION[$sessname][$object->id] = $hideInnerLines; |
650 | 650 | |
651 | - $hidedetails= (int)GETPOST('hidedetails'); |
|
652 | - if(!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id]) ) $_SESSION[$sessname2] = array(); // prevent old system |
|
651 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
652 | + if (!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id])) $_SESSION[$sessname2] = array(); // prevent old system |
|
653 | 653 | $_SESSION[$sessname2][$object->id] = $hidedetails; |
654 | 654 | |
655 | - $hideprices= (int)GETPOST('hideprices'); |
|
656 | - if(!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id]) ) $_SESSION[$sessname3] = array(); // prevent old system |
|
655 | + $hideprices = (int) GETPOST('hideprices'); |
|
656 | + if (!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id])) $_SESSION[$sessname3] = array(); // prevent old system |
|
657 | 657 | $_SESSION[$sessname3][$object->id] = $hideprices; |
658 | 658 | |
659 | - foreach($object->lines as &$line) { |
|
659 | + foreach ($object->lines as &$line) { |
|
660 | 660 | if ($line->product_type == 9 && $line->special_code == $this->module_number) { |
661 | 661 | |
662 | - if($line->qty>=90) { |
|
662 | + if ($line->qty >= 90) { |
|
663 | 663 | $line->modsubtotal_total = 1; |
664 | 664 | } |
665 | - else{ |
|
665 | + else { |
|
666 | 666 | $line->modsubtotal_title = 1; |
667 | 667 | } |
668 | 668 | |
@@ -672,34 +672,34 @@ discard block |
||
672 | 672 | } |
673 | 673 | |
674 | 674 | } |
675 | - else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
675 | + else if ($action === 'confirm_delete_all_lines' && GETPOST('confirm') == 'yes') { |
|
676 | 676 | |
677 | 677 | $Tab = $this->getArrayOfLineForAGroup($object, GETPOST('lineid')); |
678 | 678 | |
679 | - foreach($Tab as $idLine) { |
|
679 | + foreach ($Tab as $idLine) { |
|
680 | 680 | /** |
681 | 681 | * @var $object Facture |
682 | 682 | */ |
683 | - if($object->element=='facture') $object->deleteline($idLine); |
|
683 | + if ($object->element == 'facture') $object->deleteline($idLine); |
|
684 | 684 | /** |
685 | 685 | * @var $object Facture fournisseur |
686 | 686 | */ |
687 | - else if($object->element=='invoice_supplier') |
|
687 | + else if ($object->element == 'invoice_supplier') |
|
688 | 688 | { |
689 | 689 | $object->deleteline($idLine); |
690 | 690 | } |
691 | 691 | /** |
692 | 692 | * @var $object Propal |
693 | 693 | */ |
694 | - else if($object->element=='propal') $object->deleteline($idLine); |
|
694 | + else if ($object->element == 'propal') $object->deleteline($idLine); |
|
695 | 695 | /** |
696 | 696 | * @var $object Propal Fournisseur |
697 | 697 | */ |
698 | - else if($object->element=='supplier_proposal') $object->deleteline($idLine); |
|
698 | + else if ($object->element == 'supplier_proposal') $object->deleteline($idLine); |
|
699 | 699 | /** |
700 | 700 | * @var $object Commande |
701 | 701 | */ |
702 | - else if($object->element=='commande') |
|
702 | + else if ($object->element == 'commande') |
|
703 | 703 | { |
704 | 704 | if ((float) DOL_VERSION >= 5.0) $object->deleteline($user, $idLine); |
705 | 705 | else $object->deleteline($idLine); |
@@ -707,14 +707,14 @@ discard block |
||
707 | 707 | /** |
708 | 708 | * @var $object Commande fournisseur |
709 | 709 | */ |
710 | - else if($object->element=='order_supplier') |
|
710 | + else if ($object->element == 'order_supplier') |
|
711 | 711 | { |
712 | 712 | $object->deleteline($idLine); |
713 | 713 | } |
714 | 714 | /** |
715 | 715 | * @var $object Facturerec |
716 | 716 | */ |
717 | - else if($object->element=='facturerec') $object->deleteline($idLine); |
|
717 | + else if ($object->element == 'facturerec') $object->deleteline($idLine); |
|
718 | 718 | } |
719 | 719 | |
720 | 720 | header('location:?id='.$object->id); |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | return 0; |
738 | 738 | } |
739 | 739 | |
740 | - function formAddObjectLine ($parameters, &$object, &$action, $hookmanager) { |
|
740 | + function formAddObjectLine($parameters, &$object, &$action, $hookmanager) { |
|
741 | 741 | return 0; |
742 | 742 | } |
743 | 743 | |
@@ -755,8 +755,8 @@ discard block |
||
755 | 755 | if (!empty($parameters['fk_element'])) |
756 | 756 | { |
757 | 757 | |
758 | - if($obj->fetch($parameters['fk_element'])){ |
|
759 | - $obj->id= $obj->rowid; |
|
758 | + if ($obj->fetch($parameters['fk_element'])) { |
|
759 | + $obj->id = $obj->rowid; |
|
760 | 760 | if (empty($obj->array_options)) |
761 | 761 | $obj->fetch_optionals(); |
762 | 762 | if (!empty($obj->array_options['options_subtotal_nc'])) |
@@ -776,22 +776,22 @@ discard block |
||
776 | 776 | |
777 | 777 | $found = false; |
778 | 778 | |
779 | - $Tab= array(); |
|
779 | + $Tab = array(); |
|
780 | 780 | |
781 | - foreach($object->lines as $l) { |
|
781 | + foreach ($object->lines as $l) { |
|
782 | 782 | |
783 | 783 | $lid = (!empty($l->rowid) ? $l->rowid : $l->id); |
784 | - if($lid == $lineid) { |
|
784 | + if ($lid == $lineid) { |
|
785 | 785 | |
786 | 786 | $found = true; |
787 | 787 | $qty_line = $l->qty; |
788 | 788 | } |
789 | 789 | |
790 | - if($found) { |
|
790 | + if ($found) { |
|
791 | 791 | |
792 | 792 | $Tab[] = (!empty($l->rowid) ? $l->rowid : $l->id); |
793 | 793 | |
794 | - if($l->special_code==$this->module_number && (($l->qty==99 && $qty_line==1) || ($l->qty==98 && $qty_line==2)) ) { |
|
794 | + if ($l->special_code == $this->module_number && (($l->qty == 99 && $qty_line == 1) || ($l->qty == 98 && $qty_line == 2))) { |
|
795 | 795 | break; // end of story |
796 | 796 | } |
797 | 797 | } |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | * |
821 | 821 | * @param $use_level isn't used anymore |
822 | 822 | */ |
823 | - function getTotalLineFromObject(&$object, &$line, $use_level=false, $return_all=0) { |
|
823 | + function getTotalLineFromObject(&$object, &$line, $use_level = false, $return_all = 0) { |
|
824 | 824 | |
825 | 825 | $rang = $line->rang; |
826 | 826 | $qty_line = $line->qty; |
@@ -831,21 +831,21 @@ discard block |
||
831 | 831 | $TTotal_tva = array(); |
832 | 832 | |
833 | 833 | dol_include_once('/subtotal/class/subtotal.class.php'); |
834 | - foreach($object->lines as $l) { |
|
834 | + foreach ($object->lines as $l) { |
|
835 | 835 | //print $l->rang.'>='.$rang.' '.$total.'<br/>'; |
836 | - if($l->rang>=$rang) { |
|
836 | + if ($l->rang >= $rang) { |
|
837 | 837 | //echo 'return!<br>'; |
838 | 838 | if (!$return_all) return $total; |
839 | 839 | else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
840 | 840 | } |
841 | - else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
841 | + else if (TSubtotal::isTitle($l, 100 - $qty_line)) |
|
842 | 842 | { |
843 | 843 | $total = 0; |
844 | 844 | $total_tva = 0; |
845 | 845 | $total_ttc = 0; |
846 | 846 | $TTotal_tva = array(); |
847 | 847 | } |
848 | - elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
848 | + elseif (!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
849 | 849 | $total += $l->total_ht; |
850 | 850 | $total_tva += $l->total_tva; |
851 | 851 | $TTotal_tva[$l->tva_tx] += $l->total_tva; |
@@ -864,18 +864,18 @@ discard block |
||
864 | 864 | |
865 | 865 | $rang = $line->rang; |
866 | 866 | $total = 0; |
867 | - foreach($object->lines as $l) { |
|
868 | - if($l->rang>=$rang) { |
|
867 | + foreach ($object->lines as $l) { |
|
868 | + if ($l->rang >= $rang) { |
|
869 | 869 | return price($total); |
870 | 870 | } |
871 | - if (TSubtotal::isSubtotal($l)){ |
|
871 | + if (TSubtotal::isSubtotal($l)) { |
|
872 | 872 | $total = 0; |
873 | - } else if ($l->situation_percent > 0 ){ |
|
873 | + } else if ($l->situation_percent > 0) { |
|
874 | 874 | |
875 | 875 | |
876 | 876 | $prev_progress = $l->get_prev_progress($object->id); |
877 | - $progress = ($l->situation_percent - $prev_progress) /100; |
|
878 | - $total += ($l->total_ht/($l->situation_percent/100)) * $progress; |
|
877 | + $progress = ($l->situation_percent - $prev_progress) / 100; |
|
878 | + $total += ($l->total_ht / ($l->situation_percent / 100)) * $progress; |
|
879 | 879 | |
880 | 880 | } |
881 | 881 | } |
@@ -894,10 +894,10 @@ discard block |
||
894 | 894 | * @param $w float width |
895 | 895 | * @param $h float height |
896 | 896 | */ |
897 | - function pdf_add_total(&$pdf,&$object, &$line, $label, $description,$posx, $posy, $w, $h) { |
|
898 | - global $conf,$subtotal_last_title_posy; |
|
897 | + function pdf_add_total(&$pdf, &$object, &$line, $label, $description, $posx, $posy, $w, $h) { |
|
898 | + global $conf, $subtotal_last_title_posy; |
|
899 | 899 | |
900 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
900 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
901 | 901 | if (!empty($conf->global->SUBTOTAL_ONE_LINE_IF_HIDE_INNERLINES) && $hideInnerLines && !empty($subtotal_last_title_posy)) |
902 | 902 | { |
903 | 903 | $posy = $subtotal_last_title_posy; |
@@ -907,34 +907,34 @@ discard block |
||
907 | 907 | $hidePriceOnSubtotalLines = (int) GETPOST('hide_price_on_subtotal_lines'); |
908 | 908 | |
909 | 909 | $set_pagebreak_margin = false; |
910 | - if(method_exists('Closure','bind')) { |
|
910 | + if (method_exists('Closure', 'bind')) { |
|
911 | 911 | $pageBreakOriginalValue = $pdf->AcceptPageBreak(); |
912 | - $sweetsThief = function ($pdf) { |
|
913 | - return $pdf->bMargin ; |
|
912 | + $sweetsThief = function($pdf) { |
|
913 | + return $pdf->bMargin; |
|
914 | 914 | }; |
915 | 915 | $sweetsThief = Closure::bind($sweetsThief, null, $pdf); |
916 | 916 | |
917 | - $bMargin = $sweetsThief($pdf); |
|
917 | + $bMargin = $sweetsThief($pdf); |
|
918 | 918 | |
919 | - $pdf->SetAutoPageBreak( false ); |
|
919 | + $pdf->SetAutoPageBreak(false); |
|
920 | 920 | |
921 | 921 | $set_pagebreak_margin = true; |
922 | 922 | } |
923 | 923 | |
924 | 924 | |
925 | - if($line->qty==99) |
|
926 | - $pdf->SetFillColor(220,220,220); |
|
927 | - elseif ($line->qty==98) |
|
928 | - $pdf->SetFillColor(230,230,230); |
|
925 | + if ($line->qty == 99) |
|
926 | + $pdf->SetFillColor(220, 220, 220); |
|
927 | + elseif ($line->qty == 98) |
|
928 | + $pdf->SetFillColor(230, 230, 230); |
|
929 | 929 | else |
930 | - $pdf->SetFillColor(240,240,240); |
|
930 | + $pdf->SetFillColor(240, 240, 240); |
|
931 | 931 | |
932 | 932 | $style = 'B'; |
933 | 933 | if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
934 | 934 | |
935 | 935 | $pdf->SetFont('', $style, 9); |
936 | 936 | |
937 | - $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'R',true); |
|
937 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'R', true); |
|
938 | 938 | // var_dump($bMargin); |
939 | 939 | $pageAfter = $pdf->getPage(); |
940 | 940 | |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | } |
960 | 960 | } |
961 | 961 | |
962 | - if($total_to_print !== '') { |
|
962 | + if ($total_to_print !== '') { |
|
963 | 963 | |
964 | 964 | if (GETPOST('hideInnerLines')) |
965 | 965 | { |
@@ -973,7 +973,7 @@ discard block |
||
973 | 973 | else |
974 | 974 | { |
975 | 975 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
976 | - if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
|
976 | + if (get_class($object) == 'Facture' && $object->type == Facture::TYPE_SITUATION) {//Facture de situation |
|
977 | 977 | $total_to_print = $this->getTotalToPrintSituation($object, $line); |
978 | 978 | } else { |
979 | 979 | $total_to_print = price($total); |
@@ -987,11 +987,11 @@ discard block |
||
987 | 987 | } |
988 | 988 | |
989 | 989 | $pdf->SetXY($pdf->postotalht, $posy); |
990 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
991 | - $pdf->MultiCell($pdf->page_largeur-$pdf->marge_droite-$pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
|
990 | + if ($set_pagebreak_margin) $pdf->SetAutoPageBreak($pageBreakOriginalValue, $bMargin); |
|
991 | + $pdf->MultiCell($pdf->page_largeur - $pdf->marge_droite - $pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
|
992 | 992 | } |
993 | - else{ |
|
994 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
993 | + else { |
|
994 | + if ($set_pagebreak_margin) $pdf->SetAutoPageBreak($pageBreakOriginalValue, $bMargin); |
|
995 | 995 | } |
996 | 996 | |
997 | 997 | $posy = $posy + $cell_height; |
@@ -1011,22 +1011,22 @@ discard block |
||
1011 | 1011 | * @param $w float width |
1012 | 1012 | * @param $h float height |
1013 | 1013 | */ |
1014 | - function pdf_add_title(&$pdf,&$object, &$line, $label, $description,$posx, $posy, $w, $h) { |
|
1014 | + function pdf_add_title(&$pdf, &$object, &$line, $label, $description, $posx, $posy, $w, $h) { |
|
1015 | 1015 | |
1016 | - global $db,$conf,$subtotal_last_title_posy; |
|
1016 | + global $db, $conf, $subtotal_last_title_posy; |
|
1017 | 1017 | |
1018 | 1018 | $subtotal_last_title_posy = $posy; |
1019 | - $pdf->SetXY ($posx, $posy); |
|
1019 | + $pdf->SetXY($posx, $posy); |
|
1020 | 1020 | |
1021 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
1021 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
1022 | 1022 | |
1023 | 1023 | |
1024 | 1024 | |
1025 | - $style = ($line->qty==1) ? 'BU' : 'BUI'; |
|
1025 | + $style = ($line->qty == 1) ? 'BU' : 'BUI'; |
|
1026 | 1026 | if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
1027 | 1027 | |
1028 | - if($hideInnerLines) { |
|
1029 | - if($line->qty==1)$pdf->SetFont('', $style, 9); |
|
1028 | + if ($hideInnerLines) { |
|
1029 | + if ($line->qty == 1)$pdf->SetFont('', $style, 9); |
|
1030 | 1030 | else |
1031 | 1031 | { |
1032 | 1032 | if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
@@ -1035,43 +1035,43 @@ discard block |
||
1035 | 1035 | } |
1036 | 1036 | else { |
1037 | 1037 | |
1038 | - if($line->qty==1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
1038 | + if ($line->qty == 1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
1039 | 1039 | else $pdf->SetFont('', $style, 9); |
1040 | 1040 | |
1041 | 1041 | } |
1042 | 1042 | |
1043 | 1043 | if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) $pdf->MultiCell($w, $h, $label, 0, 'L'); // Pas de HTML dans la chaine |
1044 | - else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); // et maintenant avec du HTML |
|
1044 | + else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J', true); // et maintenant avec du HTML |
|
1045 | 1045 | |
1046 | - if($description && !$hidedesc) { |
|
1046 | + if ($description && !$hidedesc) { |
|
1047 | 1047 | $posy = $pdf->GetY(); |
1048 | 1048 | |
1049 | 1049 | $pdf->SetFont('', '', 8); |
1050 | 1050 | |
1051 | - $pdf->writeHTMLCell($w, $h, $posx, $posy, $description, 0, 1, false, true, 'J',true); |
|
1051 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $description, 0, 1, false, true, 'J', true); |
|
1052 | 1052 | |
1053 | 1053 | } |
1054 | 1054 | |
1055 | 1055 | } |
1056 | 1056 | |
1057 | - function pdf_writelinedesc_ref($parameters=array(), &$object, &$action='') { |
|
1057 | + function pdf_writelinedesc_ref($parameters = array(), &$object, &$action = '') { |
|
1058 | 1058 | // ultimate PDF hook O_o |
1059 | 1059 | |
1060 | - return $this->pdf_writelinedesc($parameters,$object,$action); |
|
1060 | + return $this->pdf_writelinedesc($parameters, $object, $action); |
|
1061 | 1061 | |
1062 | 1062 | } |
1063 | 1063 | |
1064 | 1064 | function isModSubtotalLine(&$parameters, &$object) { |
1065 | 1065 | |
1066 | - if(is_array($parameters)) { |
|
1066 | + if (is_array($parameters)) { |
|
1067 | 1067 | $i = & $parameters['i']; |
1068 | 1068 | } |
1069 | 1069 | else { |
1070 | - $i = (int)$parameters; |
|
1070 | + $i = (int) $parameters; |
|
1071 | 1071 | } |
1072 | 1072 | |
1073 | 1073 | |
1074 | - if($object->lines[$i]->special_code == $this->module_number && $object->lines[$i]->product_type == 9) { |
|
1074 | + if ($object->lines[$i]->special_code == $this->module_number && $object->lines[$i]->product_type == 9) { |
|
1075 | 1075 | return true; |
1076 | 1076 | } |
1077 | 1077 | |
@@ -1079,43 +1079,43 @@ discard block |
||
1079 | 1079 | |
1080 | 1080 | } |
1081 | 1081 | |
1082 | - function pdf_getlineqty($parameters=array(), &$object, &$action='') { |
|
1083 | - global $conf,$hideprices; |
|
1082 | + function pdf_getlineqty($parameters = array(), &$object, &$action = '') { |
|
1083 | + global $conf, $hideprices; |
|
1084 | 1084 | |
1085 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1085 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1086 | 1086 | |
1087 | 1087 | $this->resprints = ' '; |
1088 | 1088 | |
1089 | - if((float)DOL_VERSION<=3.6) { |
|
1089 | + if ((float) DOL_VERSION <= 3.6) { |
|
1090 | 1090 | return ''; |
1091 | 1091 | } |
1092 | - else if((float)DOL_VERSION>=3.8) { |
|
1092 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1093 | 1093 | return 1; |
1094 | 1094 | } |
1095 | 1095 | |
1096 | 1096 | } |
1097 | - elseif(!empty($hideprices)) { |
|
1097 | + elseif (!empty($hideprices)) { |
|
1098 | 1098 | $this->resprints = $object->lines[$parameters['i']]->qty; |
1099 | 1099 | return 1; |
1100 | 1100 | } |
1101 | 1101 | elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
1102 | 1102 | { |
1103 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
1104 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
1103 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
1104 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
1105 | 1105 | if (empty($hideInnerLines) && !empty($hidedetails)) |
1106 | 1106 | { |
1107 | 1107 | $this->resprints = $object->lines[$parameters['i']]->qty; |
1108 | 1108 | } |
1109 | 1109 | } |
1110 | 1110 | |
1111 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1112 | - else $i = (int)$parameters; |
|
1111 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1112 | + else $i = (int) $parameters; |
|
1113 | 1113 | |
1114 | 1114 | if (empty($object->lines[$i])) return 0; // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
1115 | 1115 | |
1116 | - if(empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
1116 | + if (empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
1117 | 1117 | |
1118 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1118 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1119 | 1119 | { |
1120 | 1120 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1121 | 1121 | { |
@@ -1127,20 +1127,20 @@ discard block |
||
1127 | 1127 | return 0; |
1128 | 1128 | } |
1129 | 1129 | |
1130 | - function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
|
1130 | + function pdf_getlinetotalexcltax($parameters = array(), &$object, &$action = '') { |
|
1131 | 1131 | global $conf, $hideprices, $hookmanager; |
1132 | 1132 | |
1133 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1134 | - else $i = (int)$parameters; |
|
1133 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1134 | + else $i = (int) $parameters; |
|
1135 | 1135 | |
1136 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1136 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1137 | 1137 | |
1138 | 1138 | $this->resprints = ' '; |
1139 | 1139 | |
1140 | - if((float)DOL_VERSION<=3.6) { |
|
1140 | + if ((float) DOL_VERSION <= 3.6) { |
|
1141 | 1141 | return ''; |
1142 | 1142 | } |
1143 | - else if((float)DOL_VERSION>=3.8) { |
|
1143 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1144 | 1144 | return 1; |
1145 | 1145 | } |
1146 | 1146 | |
@@ -1166,7 +1166,7 @@ discard block |
||
1166 | 1166 | } |
1167 | 1167 | } |
1168 | 1168 | } |
1169 | - if ((int)GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)){ |
|
1169 | + if ((int) GETPOST('hideInnerLines') && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) { |
|
1170 | 1170 | $this->resprints = price($object->lines[$i]->total_ht); |
1171 | 1171 | } |
1172 | 1172 | |
@@ -1191,7 +1191,7 @@ discard block |
||
1191 | 1191 | { |
1192 | 1192 | // Check if a title exist for this line && if the title have subtotal |
1193 | 1193 | $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
1194 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1194 | + if (TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1195 | 1195 | { |
1196 | 1196 | |
1197 | 1197 | $this->resprints = ' '; |
@@ -1211,7 +1211,7 @@ discard block |
||
1211 | 1211 | */ |
1212 | 1212 | private function callHook(&$object, &$hookmanager, $action, $params, $defaultReturn = 1) |
1213 | 1213 | { |
1214 | - $reshook=$hookmanager->executeHooks('subtotalHidePrices',$params, $object, $action); |
|
1214 | + $reshook = $hookmanager->executeHooks('subtotalHidePrices', $params, $object, $action); |
|
1215 | 1215 | if ($reshook < 0) |
1216 | 1216 | { |
1217 | 1217 | $this->error = $hookmanager->error; |
@@ -1227,7 +1227,7 @@ discard block |
||
1227 | 1227 | $this->resprints = $hookmanager->resprints; |
1228 | 1228 | |
1229 | 1229 | // override return (use $this->results['overrideReturn'] or $this->resArray['overrideReturn'] in other module action_xxxx.class.php ) |
1230 | - if(isset($hookmanager->resArray['overrideReturn'])) |
|
1230 | + if (isset($hookmanager->resArray['overrideReturn'])) |
|
1231 | 1231 | { |
1232 | 1232 | return $hookmanager->resArray['overrideReturn']; |
1233 | 1233 | } |
@@ -1236,25 +1236,25 @@ discard block |
||
1236 | 1236 | return $defaultReturn; |
1237 | 1237 | } |
1238 | 1238 | |
1239 | - function pdf_getlinetotalwithtax($parameters=array(), &$object, &$action='') { |
|
1239 | + function pdf_getlinetotalwithtax($parameters = array(), &$object, &$action = '') { |
|
1240 | 1240 | global $conf; |
1241 | 1241 | |
1242 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1242 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1243 | 1243 | |
1244 | 1244 | $this->resprints = ' '; |
1245 | 1245 | |
1246 | - if((float)DOL_VERSION<=3.6) { |
|
1246 | + if ((float) DOL_VERSION <= 3.6) { |
|
1247 | 1247 | return ''; |
1248 | 1248 | } |
1249 | - else if((float)DOL_VERSION>=3.8) { |
|
1249 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1250 | 1250 | return 1; |
1251 | 1251 | } |
1252 | 1252 | } |
1253 | 1253 | |
1254 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1255 | - else $i = (int)$parameters; |
|
1254 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1255 | + else $i = (int) $parameters; |
|
1256 | 1256 | |
1257 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1257 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1258 | 1258 | { |
1259 | 1259 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1260 | 1260 | { |
@@ -1266,24 +1266,24 @@ discard block |
||
1266 | 1266 | return 0; |
1267 | 1267 | } |
1268 | 1268 | |
1269 | - function pdf_getlineunit($parameters=array(), &$object, &$action='') { |
|
1269 | + function pdf_getlineunit($parameters = array(), &$object, &$action = '') { |
|
1270 | 1270 | global $conf; |
1271 | 1271 | |
1272 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1272 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1273 | 1273 | $this->resprints = ' '; |
1274 | 1274 | |
1275 | - if((float)DOL_VERSION<=3.6) { |
|
1275 | + if ((float) DOL_VERSION <= 3.6) { |
|
1276 | 1276 | return ''; |
1277 | 1277 | } |
1278 | - else if((float)DOL_VERSION>=3.8) { |
|
1278 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1279 | 1279 | return 1; |
1280 | 1280 | } |
1281 | 1281 | } |
1282 | 1282 | |
1283 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1284 | - else $i = (int)$parameters; |
|
1283 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1284 | + else $i = (int) $parameters; |
|
1285 | 1285 | |
1286 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1286 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1287 | 1287 | { |
1288 | 1288 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1289 | 1289 | { |
@@ -1295,31 +1295,31 @@ discard block |
||
1295 | 1295 | return 0; |
1296 | 1296 | } |
1297 | 1297 | |
1298 | - function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') { |
|
1299 | - global $conf,$hideprices,$hookmanager; |
|
1298 | + function pdf_getlineupexcltax($parameters = array(), &$object, &$action = '') { |
|
1299 | + global $conf, $hideprices, $hookmanager; |
|
1300 | 1300 | |
1301 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1302 | - else $i = (int)$parameters; |
|
1301 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1302 | + else $i = (int) $parameters; |
|
1303 | 1303 | |
1304 | - if($this->isModSubtotalLine($parameters,$object) ) { |
|
1304 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1305 | 1305 | $this->resprints = ' '; |
1306 | 1306 | |
1307 | 1307 | $line = $object->lines[$i]; |
1308 | 1308 | |
1309 | 1309 | // On récupère les montants du bloc pour les afficher dans la ligne de sous-total |
1310 | - if(TSubtotal::isSubtotal($line)) { |
|
1310 | + if (TSubtotal::isSubtotal($line)) { |
|
1311 | 1311 | $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
1312 | 1312 | |
1313 | - if(! empty($parentTitle->array_options['options_show_total_ht'])) { |
|
1313 | + if (!empty($parentTitle->array_options['options_show_total_ht'])) { |
|
1314 | 1314 | $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
1315 | 1315 | $this->resprints = price($TTotal['total_subprice']); |
1316 | 1316 | } |
1317 | 1317 | } |
1318 | 1318 | |
1319 | - if((float)DOL_VERSION<=3.6) { |
|
1319 | + if ((float) DOL_VERSION <= 3.6) { |
|
1320 | 1320 | return ''; |
1321 | 1321 | } |
1322 | - else if((float)DOL_VERSION>=3.8) { |
|
1322 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1323 | 1323 | return 1; |
1324 | 1324 | } |
1325 | 1325 | } |
@@ -1347,7 +1347,7 @@ discard block |
||
1347 | 1347 | |
1348 | 1348 | // Check if a title exist for this line && if the title have subtotal |
1349 | 1349 | $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
1350 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1350 | + if (TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1351 | 1351 | { |
1352 | 1352 | |
1353 | 1353 | $this->resprints = ' '; |
@@ -1361,31 +1361,31 @@ discard block |
||
1361 | 1361 | return 0; |
1362 | 1362 | } |
1363 | 1363 | |
1364 | - function pdf_getlineremisepercent($parameters=array(), &$object, &$action='') { |
|
1365 | - global $conf,$hideprices,$hookmanager; |
|
1364 | + function pdf_getlineremisepercent($parameters = array(), &$object, &$action = '') { |
|
1365 | + global $conf, $hideprices, $hookmanager; |
|
1366 | 1366 | |
1367 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1367 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1368 | 1368 | else $i = (int) $parameters; |
1369 | 1369 | |
1370 | - if($this->isModSubtotalLine($parameters,$object) ) { |
|
1370 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1371 | 1371 | $this->resprints = ' '; |
1372 | 1372 | |
1373 | 1373 | $line = $object->lines[$i]; |
1374 | 1374 | |
1375 | 1375 | // Affichage de la remise |
1376 | - if(TSubtotal::isSubtotal($line)) { |
|
1376 | + if (TSubtotal::isSubtotal($line)) { |
|
1377 | 1377 | $parentTitle = TSubtotal::getParentTitleOfLine($object, $i); |
1378 | 1378 | |
1379 | - if(! empty($parentTitle->array_options['options_show_reduc'])) { |
|
1379 | + if (!empty($parentTitle->array_options['options_show_reduc'])) { |
|
1380 | 1380 | $TTotal = TSubtotal::getTotalBlockFromTitle($object, $parentTitle); |
1381 | - $this->resprints = price($TTotal['total_ht'] / $TTotal['total_subprice']*100, 0, '', 1, 2, 2).'%'; |
|
1381 | + $this->resprints = price($TTotal['total_ht'] / $TTotal['total_subprice'] * 100, 0, '', 1, 2, 2).'%'; |
|
1382 | 1382 | } |
1383 | 1383 | } |
1384 | 1384 | |
1385 | - if((float)DOL_VERSION<=3.6) { |
|
1385 | + if ((float) DOL_VERSION <= 3.6) { |
|
1386 | 1386 | return ''; |
1387 | 1387 | } |
1388 | - else if((float)DOL_VERSION>=3.8) { |
|
1388 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1389 | 1389 | return 1; |
1390 | 1390 | } |
1391 | 1391 | } |
@@ -1393,24 +1393,24 @@ discard block |
||
1393 | 1393 | return 0; |
1394 | 1394 | } |
1395 | 1395 | |
1396 | - function pdf_getlineupwithtax($parameters=array(), &$object, &$action='') { |
|
1397 | - global $conf,$hideprices; |
|
1396 | + function pdf_getlineupwithtax($parameters = array(), &$object, &$action = '') { |
|
1397 | + global $conf, $hideprices; |
|
1398 | 1398 | |
1399 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1399 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1400 | 1400 | $this->resprints = ' '; |
1401 | - if((float)DOL_VERSION<=3.6) { |
|
1401 | + if ((float) DOL_VERSION <= 3.6) { |
|
1402 | 1402 | return ''; |
1403 | 1403 | } |
1404 | - else if((float)DOL_VERSION>=3.8) { |
|
1404 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1405 | 1405 | return 1; |
1406 | 1406 | } |
1407 | 1407 | } |
1408 | 1408 | |
1409 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1410 | - else $i = (int)$parameters; |
|
1409 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1410 | + else $i = (int) $parameters; |
|
1411 | 1411 | |
1412 | 1412 | if (!empty($hideprices) |
1413 | - || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1413 | + || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1414 | 1414 | ) |
1415 | 1415 | { |
1416 | 1416 | if (!empty($hideprices) || !in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
@@ -1423,22 +1423,22 @@ discard block |
||
1423 | 1423 | return 0; |
1424 | 1424 | } |
1425 | 1425 | |
1426 | - function pdf_getlinevatrate($parameters=array(), &$object, &$action='') { |
|
1427 | - global $conf,$hideprices,$hookmanager; |
|
1426 | + function pdf_getlinevatrate($parameters = array(), &$object, &$action = '') { |
|
1427 | + global $conf, $hideprices, $hookmanager; |
|
1428 | 1428 | |
1429 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1429 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1430 | 1430 | $this->resprints = ' '; |
1431 | 1431 | |
1432 | - if((float)DOL_VERSION<=3.6) { |
|
1432 | + if ((float) DOL_VERSION <= 3.6) { |
|
1433 | 1433 | return ''; |
1434 | 1434 | } |
1435 | - else if((float)DOL_VERSION>=3.8) { |
|
1435 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1436 | 1436 | return 1; |
1437 | 1437 | } |
1438 | 1438 | } |
1439 | 1439 | |
1440 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1441 | - else $i = (int)$parameters; |
|
1440 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1441 | + else $i = (int) $parameters; |
|
1442 | 1442 | |
1443 | 1443 | if (empty($object->lines[$i])) return 0; // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
1444 | 1444 | |
@@ -1465,7 +1465,7 @@ discard block |
||
1465 | 1465 | |
1466 | 1466 | // Check if a title exist for this line && if the title have subtotal |
1467 | 1467 | $lineTitle = TSubtotal::getParentTitleOfLine($object, $i); |
1468 | - if(TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1468 | + if (TSubtotal::getParentTitleOfLine($object, $i) && TSubtotal::titleHasTotalLine($object, $lineTitle, true)) |
|
1469 | 1469 | { |
1470 | 1470 | |
1471 | 1471 | $this->resprints = ' '; |
@@ -1479,23 +1479,23 @@ discard block |
||
1479 | 1479 | return 0; |
1480 | 1480 | } |
1481 | 1481 | |
1482 | - function pdf_getlineprogress($parameters=array(), &$object, &$action) { |
|
1482 | + function pdf_getlineprogress($parameters = array(), &$object, &$action) { |
|
1483 | 1483 | global $conf; |
1484 | 1484 | |
1485 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1485 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1486 | 1486 | $this->resprints = ' '; |
1487 | - if((float)DOL_VERSION<=3.6) { |
|
1487 | + if ((float) DOL_VERSION <= 3.6) { |
|
1488 | 1488 | return ''; |
1489 | 1489 | } |
1490 | - else if((float)DOL_VERSION>=3.8) { |
|
1490 | + else if ((float) DOL_VERSION >= 3.8) { |
|
1491 | 1491 | return 1; |
1492 | 1492 | } |
1493 | 1493 | } |
1494 | 1494 | |
1495 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1496 | - else $i = (int)$parameters; |
|
1495 | + if (is_array($parameters)) $i = & $parameters['i']; |
|
1496 | + else $i = (int) $parameters; |
|
1497 | 1497 | |
1498 | - if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
|
1498 | + if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i]))) |
|
1499 | 1499 | { |
1500 | 1500 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1501 | 1501 | { |
@@ -1510,12 +1510,12 @@ discard block |
||
1510 | 1510 | function add_numerotation(&$object) { |
1511 | 1511 | global $conf; |
1512 | 1512 | |
1513 | - if(!empty($conf->global->SUBTOTAL_USE_NUMEROTATION)) { |
|
1513 | + if (!empty($conf->global->SUBTOTAL_USE_NUMEROTATION)) { |
|
1514 | 1514 | |
1515 | 1515 | $TLevelTitre = array(); |
1516 | 1516 | $prevlevel = 0; |
1517 | 1517 | |
1518 | - foreach($object->lines as $k=>&$line) |
|
1518 | + foreach ($object->lines as $k=>&$line) |
|
1519 | 1519 | { |
1520 | 1520 | if ($line->id > 0 && $this->isModSubtotalLine($k, $object) && $line->qty <= 10) |
1521 | 1521 | { |
@@ -1529,12 +1529,12 @@ discard block |
||
1529 | 1529 | } |
1530 | 1530 | |
1531 | 1531 | // TODO ne gère pas encore la numération des lignes "Totaux" |
1532 | - private function formatNumerotation(&$TLineTitle, $line_reference='', $level=1, $prefix_num=0) |
|
1532 | + private function formatNumerotation(&$TLineTitle, $line_reference = '', $level = 1, $prefix_num = 0) |
|
1533 | 1533 | { |
1534 | 1534 | $TTitle = array(); |
1535 | 1535 | |
1536 | - $i=1; |
|
1537 | - $j=0; |
|
1536 | + $i = 1; |
|
1537 | + $j = 0; |
|
1538 | 1538 | foreach ($TLineTitle as $k => &$line) |
1539 | 1539 | { |
1540 | 1540 | if (!empty($line_reference) && $line->rang <= $line_reference->rang) continue; |
@@ -1544,7 +1544,7 @@ discard block |
||
1544 | 1544 | { |
1545 | 1545 | $TTitle[$j]['numerotation'] = ($prefix_num == 0) ? $i : $prefix_num.'.'.$i; |
1546 | 1546 | //var_dump('Prefix == '.$prefix_num.' // '.$line->desc.' ==> numerotation == '.$TTitle[$j]['numerotation'].' ### '.$line->qty .'=='. $level); |
1547 | - if (empty($line->label) && (float)DOL_VERSION < 6) |
|
1547 | + if (empty($line->label) && (float) DOL_VERSION < 6) |
|
1548 | 1548 | { |
1549 | 1549 | $line->label = !empty($line->desc) ? $line->desc : $line->description; |
1550 | 1550 | $line->desc = $line->description = ''; |
@@ -1570,26 +1570,26 @@ discard block |
||
1570 | 1570 | |
1571 | 1571 | function setDocTVA(&$pdf, &$object) { |
1572 | 1572 | |
1573 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
1573 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
1574 | 1574 | |
1575 | - if(empty($hidedetails)) return false; |
|
1575 | + if (empty($hidedetails)) return false; |
|
1576 | 1576 | |
1577 | 1577 | // TODO can't add VAT to document without lines... :-/ |
1578 | 1578 | |
1579 | 1579 | return true; |
1580 | 1580 | } |
1581 | 1581 | |
1582 | - function beforePDFCreation($parameters=array(), &$object, &$action) |
|
1582 | + function beforePDFCreation($parameters = array(), &$object, &$action) |
|
1583 | 1583 | { |
1584 | 1584 | /** |
1585 | 1585 | * @var $pdf TCPDF |
1586 | 1586 | */ |
1587 | - global $pdf,$conf, $langs; |
|
1587 | + global $pdf, $conf, $langs; |
|
1588 | 1588 | |
1589 | 1589 | // var_dump($object->lines); |
1590 | 1590 | dol_include_once('/subtotal/class/subtotal.class.php'); |
1591 | 1591 | |
1592 | - foreach($parameters as $key=>$value) { |
|
1592 | + foreach ($parameters as $key=>$value) { |
|
1593 | 1593 | ${$key} = $value; |
1594 | 1594 | } |
1595 | 1595 | |
@@ -1597,34 +1597,34 @@ discard block |
||
1597 | 1597 | |
1598 | 1598 | $this->add_numerotation($object); |
1599 | 1599 | |
1600 | - foreach($object->lines as $k => &$l) { |
|
1601 | - if(TSubtotal::isSubtotal($l)) { |
|
1600 | + foreach ($object->lines as $k => &$l) { |
|
1601 | + if (TSubtotal::isSubtotal($l)) { |
|
1602 | 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 |
|
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 | 1605 | } |
1606 | 1606 | } |
1607 | 1607 | } |
1608 | 1608 | |
1609 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
1610 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
1609 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
1610 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
1611 | 1611 | |
1612 | 1612 | if ($hideInnerLines) { // si c une ligne de titre |
1613 | - $fk_parent_line=0; |
|
1614 | - $TLines =array(); |
|
1613 | + $fk_parent_line = 0; |
|
1614 | + $TLines = array(); |
|
1615 | 1615 | |
1616 | - $original_count=count($object->lines); |
|
1616 | + $original_count = count($object->lines); |
|
1617 | 1617 | $TTvas = array(); // tableau de tva |
1618 | 1618 | |
1619 | - foreach($object->lines as $k=>&$line) |
|
1619 | + foreach ($object->lines as $k=>&$line) |
|
1620 | 1620 | { |
1621 | 1621 | |
1622 | - if($line->product_type==9 && $line->rowid>0) |
|
1622 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
1623 | 1623 | { |
1624 | 1624 | $fk_parent_line = $line->rowid; |
1625 | 1625 | |
1626 | 1626 | // Fix tk7201 - si on cache le détail, la TVA est renseigné au niveau du sous-total, l'erreur c'est s'il y a plusieurs sous-totaux pour les même lignes, ça va faire la somme |
1627 | - if(TSubtotal::isSubtotal($line)) |
|
1627 | + if (TSubtotal::isSubtotal($line)) |
|
1628 | 1628 | { |
1629 | 1629 | /*$total = $this->getTotalLineFromObject($object, $line, ''); |
1630 | 1630 | |
@@ -1653,22 +1653,22 @@ discard block |
||
1653 | 1653 | |
1654 | 1654 | if ($hideInnerLines) |
1655 | 1655 | { |
1656 | - if(!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1656 | + if (!empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1657 | 1657 | { |
1658 | - if($line->tva_tx != '0.000' && $line->product_type!=9){ |
|
1658 | + if ($line->tva_tx != '0.000' && $line->product_type != 9) { |
|
1659 | 1659 | |
1660 | 1660 | // on remplit le tableau de tva pour substituer les lignes cachées |
1661 | 1661 | $TTvas[$line->tva_tx]['total_tva'] += $line->total_tva; |
1662 | 1662 | $TTvas[$line->tva_tx]['total_ht'] += $line->total_ht; |
1663 | 1663 | $TTvas[$line->tva_tx]['total_ttc'] += $line->total_ttc; |
1664 | 1664 | } |
1665 | - if($line->product_type==9 && $line->rowid>0) |
|
1665 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
1666 | 1666 | { |
1667 | 1667 | //Cas où je doit cacher les produits et afficher uniquement les sous-totaux avec les titres |
1668 | 1668 | // génère des lignes d'affichage des montants HT soumis à tva |
1669 | 1669 | $nbtva = count($TTvas); |
1670 | - if(!empty($nbtva)){ |
|
1671 | - foreach ($TTvas as $tx =>$val){ |
|
1670 | + if (!empty($nbtva)) { |
|
1671 | + foreach ($TTvas as $tx =>$val) { |
|
1672 | 1672 | $l = clone $line; |
1673 | 1673 | $l->product_type = 1; |
1674 | 1674 | $l->special_code = ''; |
@@ -1689,7 +1689,7 @@ discard block |
||
1689 | 1689 | } |
1690 | 1690 | } else { |
1691 | 1691 | |
1692 | - if($line->product_type==9 && $line->rowid>0) |
|
1692 | + if ($line->product_type == 9 && $line->rowid > 0) |
|
1693 | 1693 | { |
1694 | 1694 | // ajoute la ligne de sous-total |
1695 | 1695 | $TLines[] = $line; |
@@ -1717,9 +1717,9 @@ discard block |
||
1717 | 1717 | |
1718 | 1718 | // cas incongru où il y aurait des produits en dessous du dernier sous-total |
1719 | 1719 | $nbtva = count($TTvas); |
1720 | - if(!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1720 | + if (!empty($nbtva) && $hideInnerLines && !empty($conf->global->SUBTOTAL_REPLACE_WITH_VAT_IF_HIDE_INNERLINES)) |
|
1721 | 1721 | { |
1722 | - foreach ($TTvas as $tx =>$val){ |
|
1722 | + foreach ($TTvas as $tx =>$val) { |
|
1723 | 1723 | $l = clone $line; |
1724 | 1724 | $l->product_type = 1; |
1725 | 1725 | $l->special_code = ''; |
@@ -1736,11 +1736,11 @@ discard block |
||
1736 | 1736 | } |
1737 | 1737 | |
1738 | 1738 | global $nblignes; |
1739 | - $nblignes=count($TLines); |
|
1739 | + $nblignes = count($TLines); |
|
1740 | 1740 | |
1741 | 1741 | $object->lines = $TLines; |
1742 | 1742 | |
1743 | - if($i>count($object->lines)) { |
|
1743 | + if ($i > count($object->lines)) { |
|
1744 | 1744 | $this->resprints = ''; |
1745 | 1745 | return 0; |
1746 | 1746 | } |
@@ -1749,59 +1749,59 @@ discard block |
||
1749 | 1749 | return 0; |
1750 | 1750 | } |
1751 | 1751 | |
1752 | - function pdf_writelinedesc($parameters=array(), &$object, &$action) |
|
1752 | + function pdf_writelinedesc($parameters = array(), &$object, &$action) |
|
1753 | 1753 | { |
1754 | 1754 | /** |
1755 | 1755 | * @var $pdf TCPDF |
1756 | 1756 | */ |
1757 | - global $pdf,$conf; |
|
1757 | + global $pdf, $conf; |
|
1758 | 1758 | |
1759 | - foreach($parameters as $key=>$value) { |
|
1759 | + foreach ($parameters as $key=>$value) { |
|
1760 | 1760 | ${$key} = $value; |
1761 | 1761 | } |
1762 | 1762 | |
1763 | - $hideInnerLines = (int)GETPOST('hideInnerLines'); |
|
1764 | - $hidedetails = (int)GETPOST('hidedetails'); |
|
1763 | + $hideInnerLines = (int) GETPOST('hideInnerLines'); |
|
1764 | + $hidedetails = (int) GETPOST('hidedetails'); |
|
1765 | 1765 | |
1766 | - if($this->isModSubtotalLine($parameters,$object) ){ |
|
1766 | + if ($this->isModSubtotalLine($parameters, $object)) { |
|
1767 | 1767 | |
1768 | 1768 | global $hideprices; |
1769 | 1769 | |
1770 | - if(!empty($hideprices)) { |
|
1771 | - foreach($object->lines as &$line) { |
|
1772 | - if($line->fk_product_type!=9) $line->fk_parent_line = -1; |
|
1770 | + if (!empty($hideprices)) { |
|
1771 | + foreach ($object->lines as &$line) { |
|
1772 | + if ($line->fk_product_type != 9) $line->fk_parent_line = -1; |
|
1773 | 1773 | } |
1774 | 1774 | } |
1775 | 1775 | |
1776 | 1776 | $line = &$object->lines[$i]; |
1777 | 1777 | |
1778 | - if($line->info_bits>0) { // PAGE BREAK |
|
1778 | + if ($line->info_bits > 0) { // PAGE BREAK |
|
1779 | 1779 | $pdf->addPage(); |
1780 | 1780 | $posy = $pdf->GetY(); |
1781 | 1781 | } |
1782 | 1782 | |
1783 | 1783 | $label = $line->label; |
1784 | - $description= !empty($line->desc) ? $outputlangs->convToOutputCharset($line->desc) : $outputlangs->convToOutputCharset($line->description); |
|
1784 | + $description = !empty($line->desc) ? $outputlangs->convToOutputCharset($line->desc) : $outputlangs->convToOutputCharset($line->description); |
|
1785 | 1785 | |
1786 | - if(empty($label)) { |
|
1786 | + if (empty($label)) { |
|
1787 | 1787 | $label = $description; |
1788 | - $description=''; |
|
1788 | + $description = ''; |
|
1789 | 1789 | } |
1790 | 1790 | |
1791 | - if($line->qty>90) { |
|
1791 | + if ($line->qty > 90) { |
|
1792 | 1792 | |
1793 | 1793 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) $label .= ' '.$this->getTitle($object, $line); |
1794 | 1794 | |
1795 | 1795 | $pageBefore = $pdf->getPage(); |
1796 | - $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
|
1796 | + $this->pdf_add_total($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); |
|
1797 | 1797 | $pageAfter = $pdf->getPage(); |
1798 | 1798 | |
1799 | - if($pageAfter>$pageBefore) { |
|
1799 | + if ($pageAfter > $pageBefore) { |
|
1800 | 1800 | //print "ST $pageAfter>$pageBefore<br>"; |
1801 | 1801 | $pdf->rollbackTransaction(true); |
1802 | - $pdf->addPage('','', true); |
|
1802 | + $pdf->addPage('', '', true); |
|
1803 | 1803 | $posy = $pdf->GetY(); |
1804 | - $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
|
1804 | + $this->pdf_add_total($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); |
|
1805 | 1805 | $posy = $pdf->GetY(); |
1806 | 1806 | //print 'add ST'.$pdf->getPage().'<br />'; |
1807 | 1807 | } |
@@ -1812,7 +1812,7 @@ discard block |
||
1812 | 1812 | else if ($line->qty < 10) { |
1813 | 1813 | $pageBefore = $pdf->getPage(); |
1814 | 1814 | |
1815 | - $this->pdf_add_title($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
|
1815 | + $this->pdf_add_title($pdf, $object, $line, $label, $description, $posx, $posy, $w, $h); |
|
1816 | 1816 | $pageAfter = $pdf->getPage(); |
1817 | 1817 | |
1818 | 1818 | |
@@ -1887,9 +1887,9 @@ discard block |
||
1887 | 1887 | * @param $hookmanager HookManager |
1888 | 1888 | * @return int |
1889 | 1889 | */ |
1890 | - function printObjectLine ($parameters, &$object, &$action, $hookmanager){ |
|
1890 | + function printObjectLine($parameters, &$object, &$action, $hookmanager) { |
|
1891 | 1891 | |
1892 | - global $conf,$langs,$user,$db,$bc; |
|
1892 | + global $conf, $langs, $user, $db, $bc; |
|
1893 | 1893 | |
1894 | 1894 | $num = &$parameters['num']; |
1895 | 1895 | $line = &$parameters['line']; |
@@ -1897,32 +1897,32 @@ discard block |
||
1897 | 1897 | |
1898 | 1898 | $var = &$parameters['var']; |
1899 | 1899 | |
1900 | - $contexts = explode(':',$parameters['context']); |
|
1900 | + $contexts = explode(':', $parameters['context']); |
|
1901 | 1901 | |
1902 | 1902 | $createRight = $user->rights->{$object->element}->creer; |
1903 | - if($object->element == 'facturerec' ) |
|
1903 | + if ($object->element == 'facturerec') |
|
1904 | 1904 | { |
1905 | 1905 | $object->statut = 0; // hack for facture rec |
1906 | 1906 | $createRight = $user->rights->facture->creer; |
1907 | 1907 | } |
1908 | - elseif($object->element == 'order_supplier' ) |
|
1908 | + elseif ($object->element == 'order_supplier') |
|
1909 | 1909 | { |
1910 | 1910 | $createRight = $user->rights->fournisseur->commande->creer; |
1911 | 1911 | } |
1912 | - elseif($object->element == 'invoice_supplier' ) |
|
1912 | + elseif ($object->element == 'invoice_supplier') |
|
1913 | 1913 | { |
1914 | 1914 | $createRight = $user->rights->fournisseur->facture->creer; |
1915 | 1915 | } |
1916 | 1916 | |
1917 | - if($line->special_code!=$this->module_number || $line->product_type!=9) { |
|
1917 | + if ($line->special_code != $this->module_number || $line->product_type != 9) { |
|
1918 | 1918 | null; |
1919 | 1919 | } |
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)) |
|
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 | - if($object->element=='facture')$idvar = 'facid'; |
|
1923 | - else $idvar='id'; |
|
1922 | + if ($object->element == 'facture')$idvar = 'facid'; |
|
1923 | + else $idvar = 'id'; |
|
1924 | 1924 | |
1925 | - if((float)DOL_VERSION <= 3.4) |
|
1925 | + if ((float) DOL_VERSION <= 3.4) |
|
1926 | 1926 | { |
1927 | 1927 | ?> |
1928 | 1928 | <script type="text/javascript"> |
@@ -1946,22 +1946,22 @@ discard block |
||
1946 | 1946 | <?php |
1947 | 1947 | } |
1948 | 1948 | |
1949 | - if(empty($line->description)) $line->description = $line->desc; |
|
1949 | + if (empty($line->description)) $line->description = $line->desc; |
|
1950 | 1950 | |
1951 | 1951 | $colspan = 5; |
1952 | - if($object->element == 'facturerec' ) $colspan = 3; |
|
1953 | - if($object->element == 'order_supplier') $colspan = 3; |
|
1954 | - if($object->element == 'invoice_supplier') $colspan = 4; |
|
1955 | - if($object->element == 'supplier_proposal') $colspan = 4; |
|
1956 | - if(!empty($conf->multicurrency->enabled) && ((float) DOL_VERSION < 8.0 || $object->multicurrency_code != $conf->currency)) { |
|
1952 | + if ($object->element == 'facturerec') $colspan = 3; |
|
1953 | + if ($object->element == 'order_supplier') $colspan = 3; |
|
1954 | + if ($object->element == 'invoice_supplier') $colspan = 4; |
|
1955 | + if ($object->element == 'supplier_proposal') $colspan = 4; |
|
1956 | + if (!empty($conf->multicurrency->enabled) && ((float) DOL_VERSION < 8.0 || $object->multicurrency_code != $conf->currency)) { |
|
1957 | 1957 | $colspan++; // Colonne PU Devise |
1958 | 1958 | } |
1959 | - if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
1960 | - if(!empty($conf->margin->enabled)) $colspan++; |
|
1961 | - if(!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
1962 | - if(!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
1963 | - if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
1964 | - if(!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
1959 | + if ($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
1960 | + if (!empty($conf->margin->enabled)) $colspan++; |
|
1961 | + if (!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
1962 | + if (!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
1963 | + if ($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
1964 | + if (!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
1965 | 1965 | |
1966 | 1966 | /* Titre */ |
1967 | 1967 | //var_dump($line); |
@@ -1971,39 +1971,39 @@ discard block |
||
1971 | 1971 | |
1972 | 1972 | |
1973 | 1973 | ?> |
1974 | - <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
1974 | + <tr <?php echo $bc[$var]; $var = !$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
|
1975 | 1975 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
1976 | 1976 | { |
1977 | - if($line->qty==99) print 'background:#adadcf'; |
|
1978 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
1979 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
1980 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
1981 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
1982 | - else if($line->qty==50) print ''; |
|
1977 | + if ($line->qty == 99) print 'background:#adadcf'; |
|
1978 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
1979 | + else if ($line->qty <= 97 && $line->qty >= 91) print 'background:#eeeeff;'; |
|
1980 | + else if ($line->qty == 1) print 'background:#adadcf;'; |
|
1981 | + else if ($line->qty == 2) print 'background:#ddddff;'; |
|
1982 | + else if ($line->qty == 50) print ''; |
|
1983 | 1983 | else print 'background:#eeeeff;'; |
1984 | 1984 | |
1985 | 1985 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
1986 | 1986 | } |
1987 | 1987 | else |
1988 | 1988 | { |
1989 | - if($line->qty==99) print 'background:#ddffdd'; |
|
1990 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
1991 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
1992 | - else if($line->qty==50) print ''; |
|
1993 | - else print 'background:#eeffee;' ; |
|
1989 | + if ($line->qty == 99) print 'background:#ddffdd'; |
|
1990 | + else if ($line->qty == 98) print 'background:#ddddff;'; |
|
1991 | + else if ($line->qty == 2) print 'background:#eeeeff; '; |
|
1992 | + else if ($line->qty == 50) print ''; |
|
1993 | + else print 'background:#eeffee;'; |
|
1994 | 1994 | } |
1995 | 1995 | |
1996 | 1996 | ?>;"> |
1997 | 1997 | |
1998 | - <?php if(! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?> |
|
1998 | + <?php if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?> |
|
1999 | 1999 | <td class="linecolnum"><?php echo $i + 1; ?></td> |
2000 | 2000 | <?php } ?> |
2001 | 2001 | |
2002 | - <td colspan="<?php echo $colspan; ?>" style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty>90)?'text-align:right':'' ?> "><?php |
|
2003 | - if($action=='editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line) ) { |
|
2002 | + <td colspan="<?php echo $colspan; ?>" style="<?php TSubtotal::isFreeText($line) ? '' : 'font-weight:bold;'; ?> <?php echo ($line->qty > 90) ? 'text-align:right' : '' ?> "><?php |
|
2003 | + if ($action == 'editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line)) { |
|
2004 | 2004 | |
2005 | - $params=array('line'=>$line); |
|
2006 | - $reshook=$hookmanager->executeHooks('formEditProductOptions',$params,$object,$action); |
|
2005 | + $params = array('line'=>$line); |
|
2006 | + $reshook = $hookmanager->executeHooks('formEditProductOptions', $params, $object, $action); |
|
2007 | 2007 | |
2008 | 2008 | echo '<div id="line_'.$line->id.'"></div>'; // Imitation Dolibarr |
2009 | 2009 | echo '<input type="hidden" value="'.$line->id.'" name="lineid">'; |
@@ -2011,7 +2011,7 @@ discard block |
||
2011 | 2011 | echo '<input id="product_id" type="hidden" value="'.$line->fk_product.'" name="type">'; |
2012 | 2012 | echo '<input id="special_code" type="hidden" value="'.$line->special_code.'" name="type">'; |
2013 | 2013 | |
2014 | - $isFreeText=false; |
|
2014 | + $isFreeText = false; |
|
2015 | 2015 | if (TSubtotal::isTitle($line)) |
2016 | 2016 | { |
2017 | 2017 | $qty_displayed = $line->qty; |
@@ -2033,13 +2033,13 @@ discard block |
||
2033 | 2033 | $line->description = ''; |
2034 | 2034 | } |
2035 | 2035 | $newlabel = $line->label; |
2036 | - if($line->label=='' && !$isFreeText) { |
|
2037 | - if(TSubtotal::isSubtotal($line)) { |
|
2036 | + if ($line->label == '' && !$isFreeText) { |
|
2037 | + if (TSubtotal::isSubtotal($line)) { |
|
2038 | 2038 | $newlabel = $line->description.' '.$this->getTitle($object, $line); |
2039 | - $line->description=''; |
|
2040 | - } elseif( (float)DOL_VERSION < 6 ) { |
|
2041 | - $newlabel= $line->description; |
|
2042 | - $line->description=''; |
|
2039 | + $line->description = ''; |
|
2040 | + } elseif ((float) DOL_VERSION < 6) { |
|
2041 | + $newlabel = $line->description; |
|
2042 | + $line->description = ''; |
|
2043 | 2043 | } |
2044 | 2044 | } |
2045 | 2045 | |
@@ -2048,10 +2048,10 @@ discard block |
||
2048 | 2048 | |
2049 | 2049 | if (!$isFreeText) echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
2050 | 2050 | |
2051 | - if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) ) |
|
2051 | + if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line))) |
|
2052 | 2052 | { |
2053 | 2053 | $select = '<select name="subtotal_level">'; |
2054 | - for ($j=1; $j<10; $j++) |
|
2054 | + for ($j = 1; $j < 10; $j++) |
|
2055 | 2055 | { |
2056 | 2056 | if (!empty($readonlyForSituation)) { |
2057 | 2057 | if ($qty_displayed == $j) $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
@@ -2065,7 +2065,7 @@ discard block |
||
2065 | 2065 | |
2066 | 2066 | echo '<div class="subtotal_underline" style="margin-left:24px; line-height: 25px;">'; |
2067 | 2067 | echo '<div>'; |
2068 | - echo '<input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '') .' /> '; |
|
2068 | + echo '<input style="vertical-align:sub;" type="checkbox" name="line-pagebreak" id="subtotal-pagebreak" value="8" '.(($line->info_bits > 0) ? 'checked="checked"' : '').' /> '; |
|
2069 | 2069 | echo '<label for="subtotal-pagebreak">'.$langs->trans('AddBreakPageBefore').'</label>'; |
2070 | 2070 | echo '</div>'; |
2071 | 2071 | |
@@ -2086,21 +2086,21 @@ discard block |
||
2086 | 2086 | echo '</div>'; |
2087 | 2087 | } |
2088 | 2088 | echo '<div>'; |
2089 | - 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"' : '') .' /> '; |
|
2089 | + 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"' : '').' /> '; |
|
2090 | 2090 | echo '<label for="subtotal-showTotalHT">'.$langs->trans('ShowTotalHTOnSubtotalBlock').'</label>'; |
2091 | 2091 | echo '</div>'; |
2092 | 2092 | |
2093 | 2093 | echo '<div>'; |
2094 | - 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"' : '') .' /> '; |
|
2094 | + 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"' : '').' /> '; |
|
2095 | 2095 | echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>'; |
2096 | 2096 | echo '</div>'; |
2097 | 2097 | } |
2098 | 2098 | else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
2099 | 2099 | echo '</div>'; |
2100 | 2100 | |
2101 | - if($line->qty<10) { |
|
2101 | + if ($line->qty < 10) { |
|
2102 | 2102 | // WYSIWYG editor |
2103 | - require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; |
|
2103 | + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; |
|
2104 | 2104 | $nbrows = ROWS_2; |
2105 | 2105 | $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS) ? $conf->global->FCKEDITOR_ENABLE_DETAILS : 0); |
2106 | 2106 | if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { |
@@ -2120,25 +2120,25 @@ discard block |
||
2120 | 2120 | |
2121 | 2121 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) |
2122 | 2122 | { |
2123 | - if(TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
2123 | + if (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) |
|
2124 | 2124 | { |
2125 | - echo str_repeat(' ', $line->qty-1); |
|
2125 | + echo str_repeat(' ', $line->qty - 1); |
|
2126 | 2126 | |
2127 | 2127 | if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
2128 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
2128 | + else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100 - $line->qty).'</span> '; |
|
2129 | 2129 | } |
2130 | 2130 | } |
2131 | 2131 | else |
2132 | 2132 | { |
2133 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
2134 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
2133 | + if ($line->qty <= 1) print img_picto('', 'subtotal@subtotal'); |
|
2134 | + else if ($line->qty == 2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
2135 | 2135 | } |
2136 | 2136 | |
2137 | 2137 | |
2138 | 2138 | // Get display styles and apply them |
2139 | 2139 | $titleStyleItalic = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'I') === false ? '' : ' font-style: italic;'; |
2140 | - $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
2141 | - $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
2140 | + $titleStyleBold = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'B') === false ? '' : ' font-weight:bold;'; |
|
2141 | + $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
|
2142 | 2142 | |
2143 | 2143 | if (empty($line->label)) { |
2144 | 2144 | if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
@@ -2146,16 +2146,16 @@ discard block |
||
2146 | 2146 | } |
2147 | 2147 | else { |
2148 | 2148 | |
2149 | - if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
2149 | + if (!empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
|
2150 | 2150 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
2151 | 2151 | } |
2152 | - else{ |
|
2152 | + else { |
|
2153 | 2153 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
2154 | 2154 | } |
2155 | 2155 | |
2156 | 2156 | } |
2157 | - if($line->qty>90) print ' : '; |
|
2158 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
2157 | + if ($line->qty > 90) print ' : '; |
|
2158 | + if ($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
2159 | 2159 | |
2160 | 2160 | |
2161 | 2161 | |
@@ -2164,7 +2164,7 @@ discard block |
||
2164 | 2164 | ?></td> |
2165 | 2165 | |
2166 | 2166 | <?php |
2167 | - if($line->qty>90) { |
|
2167 | + if ($line->qty > 90) { |
|
2168 | 2168 | /* Total */ |
2169 | 2169 | $total_line = $this->getTotalLineFromObject($object, $line, ''); |
2170 | 2170 | echo '<td class="linecolht nowrap" align="right" style="font-weight:bold;" rel="subtotal_total">'.price($total_line).'</td>'; |
@@ -2183,7 +2183,7 @@ discard block |
||
2183 | 2183 | <?php |
2184 | 2184 | if ($action != 'selectlines') { |
2185 | 2185 | |
2186 | - if($action=='editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line) ) { |
|
2186 | + if ($action == 'editline' && GETPOST('lineid') == $line->id && TSubtotal::isModSubtotalLine($line)) { |
|
2187 | 2187 | ?> |
2188 | 2188 | <input id="savelinebutton" class="button" type="submit" name="save" value="<?php echo $langs->trans('Save') ?>" /> |
2189 | 2189 | <br /> |
@@ -2199,13 +2199,13 @@ discard block |
||
2199 | 2199 | <?php |
2200 | 2200 | |
2201 | 2201 | } |
2202 | - else{ |
|
2203 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
|
2202 | + else { |
|
2203 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
|
2204 | 2204 | { |
2205 | - if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
2205 | + if (TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref)) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'.img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
2206 | 2206 | } |
2207 | 2207 | |
2208 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
|
2208 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
|
2209 | 2209 | { |
2210 | 2210 | echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=editline&lineid='.$line->id.'">'.img_edit().'</a>'; |
2211 | 2211 | } |
@@ -2220,7 +2220,7 @@ discard block |
||
2220 | 2220 | <?php |
2221 | 2221 | |
2222 | 2222 | if ($action != 'editline' && $action != 'selectlines') { |
2223 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) |
|
2223 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_REMOVE_BLOCK)) |
|
2224 | 2224 | { |
2225 | 2225 | |
2226 | 2226 | if ($object->situation_counter == 1 || !$object->situation_cycle_ref) |
@@ -2228,12 +2228,12 @@ discard block |
||
2228 | 2228 | echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=ask_deleteline&lineid='.$line->id.'">'.img_delete().'</a>'; |
2229 | 2229 | } |
2230 | 2230 | |
2231 | - if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) |
|
2231 | + if (TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref)) |
|
2232 | 2232 | { |
2233 | 2233 | if ((float) DOL_VERSION >= 8.0) { |
2234 | 2234 | $img_delete = img_delete($langs->trans('deleteWithAllLines'), ' class="pictodelete pictodeleteallline"'); |
2235 | 2235 | } elseif ((float) DOL_VERSION >= 3.8) { |
2236 | - $img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all.3.8@subtotal',' class="pictodelete" '); |
|
2236 | + $img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all.3.8@subtotal', ' class="pictodelete" '); |
|
2237 | 2237 | } else { |
2238 | 2238 | $img_delete = img_picto($langs->trans('deleteWithAllLines'), 'delete_all@subtotal'); |
2239 | 2239 | } |
@@ -2243,7 +2243,7 @@ discard block |
||
2243 | 2243 | /* Depuis la 8.0, les icônes "standard" utilisent FontAwesome et sont préconfigurées selon la clé de l'image |
2244 | 2244 | * Impossible d'en customiser par exemple la couleur, même en utilisant img_picto() directement |
2245 | 2245 | */ |
2246 | - if((float) DOL_VERSION >= 8.0) { |
|
2246 | + if ((float) DOL_VERSION >= 8.0) { |
|
2247 | 2247 | ?> |
2248 | 2248 | <script> |
2249 | 2249 | $(document).ready(function () { |
@@ -2259,7 +2259,7 @@ discard block |
||
2259 | 2259 | </td> |
2260 | 2260 | |
2261 | 2261 | <?php |
2262 | - if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && TSubtotal::isTitle($line) && $action != 'editline') |
|
2262 | + if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && TSubtotal::isTitle($line) && $action != 'editline') |
|
2263 | 2263 | { |
2264 | 2264 | echo '<td class="subtotal_nc">'; |
2265 | 2265 | echo '<input id="subtotal_nc-'.$line->id.'" class="subtotal_nc_chkbx" data-lineid="'.$line->id.'" type="checkbox" name="subtotal_nc" value="1" '.(!empty($line->array_options['options_subtotal_nc']) ? 'checked="checked"' : '').' />'; |
@@ -2270,11 +2270,11 @@ discard block |
||
2270 | 2270 | <td align="center" class="linecolmove tdlineupdown"> |
2271 | 2271 | </td> |
2272 | 2272 | <?php } else { ?> |
2273 | - <td align="center"<?php echo ((empty($conf->browser->phone) && ($object->statut == 0 && $createRight ))?' class="tdlineupdown"':''); ?>></td> |
|
2273 | + <td align="center"<?php echo ((empty($conf->browser->phone) && ($object->statut == 0 && $createRight)) ? ' class="tdlineupdown"' : ''); ?>></td> |
|
2274 | 2274 | <?php } ?> |
2275 | 2275 | |
2276 | - <?php if($action == 'selectlines'){ // dolibarr 8 ?> |
|
2277 | - <td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i+1; ?>]" value="<?php echo $line->id; ?>" ></td> |
|
2276 | + <?php if ($action == 'selectlines') { // dolibarr 8 ?> |
|
2277 | + <td class="linecolcheck" align="center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i + 1; ?>]" value="<?php echo $line->id; ?>" ></td> |
|
2278 | 2278 | <?php } ?> |
2279 | 2279 | |
2280 | 2280 | </tr> |
@@ -2282,29 +2282,29 @@ discard block |
||
2282 | 2282 | |
2283 | 2283 | |
2284 | 2284 | // Affichage des extrafields à la Dolibarr (car sinon non affiché sur les titres) |
2285 | - if(TSubtotal::isTitle($line) && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE)) { |
|
2285 | + if (TSubtotal::isTitle($line) && !empty($conf->global->SUBTOTAL_ALLOW_EXTRAFIELDS_ON_TITLE)) { |
|
2286 | 2286 | |
2287 | - require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; |
|
2287 | + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; |
|
2288 | 2288 | |
2289 | 2289 | // Extrafields |
2290 | 2290 | $extrafieldsline = new ExtraFields($db); |
2291 | 2291 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
2292 | 2292 | |
2293 | - $colspan+=3; $mode = 'view'; |
|
2294 | - if($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
2293 | + $colspan += 3; $mode = 'view'; |
|
2294 | + if ($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
2295 | 2295 | |
2296 | 2296 | $ex_element = $line->element; |
2297 | 2297 | $line->element = 'tr_extrafield_title '.$line->element; // Pour pouvoir manipuler ces tr |
2298 | - print $line->showOptionals($extrafieldsline, $mode, array('style'=>' style="background:#eeffee;" ','colspan'=>$colspan)); |
|
2298 | + print $line->showOptionals($extrafieldsline, $mode, array('style'=>' style="background:#eeffee;" ', 'colspan'=>$colspan)); |
|
2299 | 2299 | $isExtraSelected = false; |
2300 | - foreach($line->array_options as $option) { |
|
2301 | - if(!empty($option) && $option != "-1") { |
|
2300 | + foreach ($line->array_options as $option) { |
|
2301 | + if (!empty($option) && $option != "-1") { |
|
2302 | 2302 | $isExtraSelected = true; |
2303 | 2303 | break; |
2304 | 2304 | } |
2305 | 2305 | } |
2306 | 2306 | |
2307 | - if($mode === 'edit') { |
|
2307 | + if ($mode === 'edit') { |
|
2308 | 2308 | ?> |
2309 | 2309 | <script> |
2310 | 2310 | $(document).ready(function(){ |
@@ -2312,7 +2312,7 @@ discard block |
||
2312 | 2312 | var all_tr_extrafields = $("tr.tr_extrafield_title"); |
2313 | 2313 | <?php |
2314 | 2314 | // Si un extrafield est rempli alors on affiche directement les extrafields |
2315 | - if(!$isExtraSelected) { |
|
2315 | + if (!$isExtraSelected) { |
|
2316 | 2316 | echo 'all_tr_extrafields.hide();'; |
2317 | 2317 | echo 'var trad = "'.$langs->trans('showExtrafields').'";'; |
2318 | 2318 | echo 'var extra = 0;'; |
@@ -2358,20 +2358,20 @@ discard block |
||
2358 | 2358 | |
2359 | 2359 | |
2360 | 2360 | function addMoreActionsButtons($parameters, &$object, &$action, $hookmanager) { |
2361 | - global $conf,$langs; |
|
2361 | + global $conf, $langs; |
|
2362 | 2362 | |
2363 | 2363 | if ($object->statut == 0 && !empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && $action != 'editline') |
2364 | 2364 | { |
2365 | 2365 | |
2366 | - if($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
2366 | + if ($object->element == 'invoice_supplier' || $object->element == 'order_supplier') |
|
2367 | 2367 | { |
2368 | 2368 | foreach ($object->lines as $line) |
2369 | 2369 | { |
2370 | 2370 | // fetch optionals attributes and labels |
2371 | 2371 | require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); |
2372 | - $extrafields=new ExtraFields($this->db); |
|
2373 | - $extralabels=$extrafields->fetch_name_optionals_label($object->table_element_line,true); |
|
2374 | - $line->fetch_optionals($line->id,$extralabels); |
|
2372 | + $extrafields = new ExtraFields($this->db); |
|
2373 | + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element_line, true); |
|
2374 | + $line->fetch_optionals($line->id, $extralabels); |
|
2375 | 2375 | } |
2376 | 2376 | } |
2377 | 2377 | |
@@ -2471,23 +2471,23 @@ discard block |
||
2471 | 2471 | $ThtmlData['data-qty'] = 0; //$line->qty; |
2472 | 2472 | $ThtmlData['data-level'] = TSubtotal::getNiveau($line); |
2473 | 2473 | |
2474 | - if(TSubtotal::isTitle($line)){ |
|
2474 | + if (TSubtotal::isTitle($line)) { |
|
2475 | 2475 | $ThtmlData['data-issubtotal'] = 'title'; |
2476 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
2476 | + }elseif (TSubtotal::isSubtotal($line)) { |
|
2477 | 2477 | $ThtmlData['data-issubtotal'] = 'subtotal'; |
2478 | 2478 | } |
2479 | - else{ |
|
2479 | + else { |
|
2480 | 2480 | $ThtmlData['data-issubtotal'] = 'freetext'; |
2481 | 2481 | } |
2482 | 2482 | |
2483 | 2483 | |
2484 | 2484 | // Change or add data from hooks |
2485 | - $parameters = array_replace($parameters , array( 'ThtmlData' => $ThtmlData ) ); |
|
2485 | + $parameters = array_replace($parameters, array('ThtmlData' => $ThtmlData)); |
|
2486 | 2486 | |
2487 | 2487 | // hook |
2488 | - $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
|
2488 | + $reshook = $hookmanager->executeHooks('subtotalLineHtmlData', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
2489 | 2489 | if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
2490 | - if ($reshook>0) |
|
2490 | + if ($reshook > 0) |
|
2491 | 2491 | { |
2492 | 2492 | $ThtmlData = $hookmanager->resArray; |
2493 | 2493 | } |
@@ -2500,14 +2500,14 @@ discard block |
||
2500 | 2500 | function implodeHtmlData($ThtmlData = array()) |
2501 | 2501 | { |
2502 | 2502 | $data = ''; |
2503 | - foreach($ThtmlData as $k => $h ) |
|
2503 | + foreach ($ThtmlData as $k => $h) |
|
2504 | 2504 | { |
2505 | - if(is_array($h)) |
|
2505 | + if (is_array($h)) |
|
2506 | 2506 | { |
2507 | 2507 | $h = json_encode($h); |
2508 | 2508 | } |
2509 | 2509 | |
2510 | - $data .= $k . '="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
2510 | + $data .= $k.'="'.dol_htmlentities($h, ENT_QUOTES).'" '; |
|
2511 | 2511 | } |
2512 | 2512 | |
2513 | 2513 | return $data; |
@@ -2515,26 +2515,26 @@ discard block |
||
2515 | 2515 | |
2516 | 2516 | function _ajax_block_order_js($object) |
2517 | 2517 | { |
2518 | - global $conf,$tagidfortablednd,$filepath,$langs; |
|
2518 | + global $conf, $tagidfortablednd, $filepath, $langs; |
|
2519 | 2519 | |
2520 | 2520 | /* |
2521 | 2521 | * this part of js is base on dolibarr htdocs/core/tpl/ajaxrow.tpl.php |
2522 | 2522 | * for compatibility reasons we don't use tableDnD but jquery sortable |
2523 | 2523 | */ |
2524 | 2524 | |
2525 | - $id=$object->id; |
|
2526 | - $nboflines=(isset($object->lines)?count($object->lines):0); |
|
2527 | - $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1; |
|
2525 | + $id = $object->id; |
|
2526 | + $nboflines = (isset($object->lines) ?count($object->lines) : 0); |
|
2527 | + $forcereloadpage = empty($conf->global->MAIN_FORCE_RELOAD_PAGE) ? 0 : 1; |
|
2528 | 2528 | |
2529 | - $id=$object->id; |
|
2530 | - $fk_element=$object->fk_element; |
|
2531 | - $table_element_line=$object->table_element_line; |
|
2532 | - $nboflines=(isset($object->lines)?count($object->lines):(empty($nboflines)?0:$nboflines)); |
|
2533 | - $tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd); |
|
2534 | - $filepath=(empty($filepath)?'':$filepath); |
|
2529 | + $id = $object->id; |
|
2530 | + $fk_element = $object->fk_element; |
|
2531 | + $table_element_line = $object->table_element_line; |
|
2532 | + $nboflines = (isset($object->lines) ?count($object->lines) : (empty($nboflines) ? 0 : $nboflines)); |
|
2533 | + $tagidfortablednd = (empty($tagidfortablednd) ? 'tablelines' : $tagidfortablednd); |
|
2534 | + $filepath = (empty($filepath) ? '' : $filepath); |
|
2535 | 2535 | |
2536 | 2536 | |
2537 | - if (GETPOST('action','aZ09') != 'editline' && $nboflines > 1) |
|
2537 | + if (GETPOST('action', 'aZ09') != 'editline' && $nboflines > 1) |
|
2538 | 2538 | { |
2539 | 2539 | |
2540 | 2540 | ?> |
@@ -2552,7 +2552,7 @@ discard block |
||
2552 | 2552 | moveBlockCol.disableSelection(); // prevent selection |
2553 | 2553 | <?php if ($object->statut == 0) { ?> |
2554 | 2554 | // apply some graphical stuff |
2555 | - moveBlockCol.css("background-image",'url(<?php echo dol_buildpath('subtotal/img/grip_all.png',2); ?>)'); |
|
2555 | + moveBlockCol.css("background-image",'url(<?php echo dol_buildpath('subtotal/img/grip_all.png', 2); ?>)'); |
|
2556 | 2556 | moveBlockCol.css("background-repeat","no-repeat"); |
2557 | 2557 | moveBlockCol.css("background-position","center center"); |
2558 | 2558 | moveBlockCol.css("cursor","move"); |
@@ -45,7 +45,9 @@ discard block |
||
45 | 45 | $value = ''; |
46 | 46 | $sql = 'SELECT content FROM '.MAIN_DB_PREFIX.'c_subtotal_free_text WHERE rowid = '.GETPOST('rowid'); |
47 | 47 | $resql = $this->db->query($sql); |
48 | - if ($resql && ($obj = $this->db->fetch_object($resql))) $value = $obj->content; |
|
48 | + if ($resql && ($obj = $this->db->fetch_object($resql))) { |
|
49 | + $value = $obj->content; |
|
50 | + } |
|
49 | 51 | } |
50 | 52 | |
51 | 53 | ?> |
@@ -129,8 +131,11 @@ discard block |
||
129 | 131 | if ($object->statut == 0 && $createRight) { |
130 | 132 | |
131 | 133 | |
132 | - if($object->element=='facture')$idvar = 'facid'; |
|
133 | - else $idvar='id'; |
|
134 | + if($object->element=='facture') { |
|
135 | + $idvar = 'facid'; |
|
136 | + } else { |
|
137 | + $idvar='id'; |
|
138 | + } |
|
134 | 139 | |
135 | 140 | if(in_array($action, array('add_title_line', 'add_total_line', 'add_subtitle_line', 'add_subtotal_line', 'add_free_text')) ) |
136 | 141 | { |
@@ -138,10 +143,11 @@ discard block |
||
138 | 143 | |
139 | 144 | if($action=='add_title_line') { |
140 | 145 | $title = GETPOST('title'); |
141 | - if(empty($title)) $title = $langs->trans('title'); |
|
146 | + if(empty($title)) { |
|
147 | + $title = $langs->trans('title'); |
|
148 | + } |
|
142 | 149 | $qty = $level<1 ? 1 : $level ; |
143 | - } |
|
144 | - else if($action=='add_free_text') { |
|
150 | + } else if($action=='add_free_text') { |
|
145 | 151 | $title = GETPOST('title'); |
146 | 152 | |
147 | 153 | if (empty($title)) { |
@@ -153,29 +159,31 @@ discard block |
||
153 | 159 | } |
154 | 160 | } |
155 | 161 | } |
156 | - if(empty($title)) $title = $langs->trans('subtotalAddLineDescription'); |
|
162 | + if(empty($title)) { |
|
163 | + $title = $langs->trans('subtotalAddLineDescription'); |
|
164 | + } |
|
157 | 165 | $qty = 50; |
158 | - } |
|
159 | - else if($action=='add_subtitle_line') { |
|
166 | + } else if($action=='add_subtitle_line') { |
|
160 | 167 | $title = GETPOST('title'); |
161 | - if(empty($title)) $title = $langs->trans('subtitle'); |
|
168 | + if(empty($title)) { |
|
169 | + $title = $langs->trans('subtitle'); |
|
170 | + } |
|
162 | 171 | $qty = 2; |
163 | - } |
|
164 | - else if($action=='add_subtotal_line') { |
|
172 | + } else if($action=='add_subtotal_line') { |
|
165 | 173 | $title = $langs->trans('SubSubTotal'); |
166 | 174 | $qty = 98; |
167 | - } |
|
168 | - else { |
|
175 | + } else { |
|
169 | 176 | $title = GETPOST('title') ? GETPOST('title') : $langs->trans('SubTotal'); |
170 | 177 | $qty = $level ? 100-$level : 99; |
171 | 178 | } |
172 | 179 | dol_include_once('/subtotal/class/subtotal.class.php'); |
173 | 180 | |
174 | - if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) TSubtotal::addSubtotalMissing($object, $qty); |
|
181 | + if (!empty($conf->global->SUBTOTAL_AUTO_ADD_SUBTOTAL_ON_ADDING_NEW_TITLE) && $qty < 10) { |
|
182 | + TSubtotal::addSubtotalMissing($object, $qty); |
|
183 | + } |
|
175 | 184 | |
176 | 185 | TSubtotal::addSubTotalLine($object, $title, $qty); |
177 | - } |
|
178 | - else if($action==='ask_deleteallline') { |
|
186 | + } else if($action==='ask_deleteallline') { |
|
179 | 187 | $form=new Form($db); |
180 | 188 | |
181 | 189 | $lineid = GETPOST('lineid','integer'); |
@@ -198,8 +206,7 @@ discard block |
||
198 | 206 | $this->printNewFormat($object, $conf, $langs, $idvar); |
199 | 207 | } |
200 | 208 | } |
201 | - } |
|
202 | - elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
209 | + } elseif ((!empty($parameters['currentcontext']) && $parameters['currentcontext'] == 'orderstoinvoice') || in_array('orderstoinvoice',$contexts)) |
|
203 | 210 | { |
204 | 211 | ?> |
205 | 212 | <script type="text/javascript"> |
@@ -217,8 +224,13 @@ discard block |
||
217 | 224 | |
218 | 225 | function printNewFormat(&$object, &$conf, &$langs, $idvar) |
219 | 226 | { |
220 | - if (empty($conf->global->SUBTOTAL_ALLOW_ADD_BLOCK)) return false; |
|
221 | - if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) return false; // Si facture de situation |
|
227 | + if (empty($conf->global->SUBTOTAL_ALLOW_ADD_BLOCK)) { |
|
228 | + return false; |
|
229 | + } |
|
230 | + if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) { |
|
231 | + return false; |
|
232 | + } |
|
233 | + // Si facture de situation |
|
222 | 234 | ?> |
223 | 235 | <script type="text/javascript"> |
224 | 236 | $(document).ready(function() { |
@@ -504,8 +516,7 @@ discard block |
||
504 | 516 | } |
505 | 517 | |
506 | 518 | |
507 | - } |
|
508 | - else{ |
|
519 | + } else{ |
|
509 | 520 | $substitutionarray['line_not_modsubtotal'] = true; |
510 | 521 | $substitutionarray['line_modsubtotal'] = 0; |
511 | 522 | } |
@@ -563,8 +574,11 @@ discard block |
||
563 | 574 | |
564 | 575 | $showBlockExtrafields = GETPOST('showBlockExtrafields'); |
565 | 576 | |
566 | - if($object->element=='facture') $idvar = 'facid'; |
|
567 | - else $idvar = 'id'; |
|
577 | + if($object->element=='facture') { |
|
578 | + $idvar = 'facid'; |
|
579 | + } else { |
|
580 | + $idvar = 'id'; |
|
581 | + } |
|
568 | 582 | |
569 | 583 | if ($action == 'updateligne' || $action == 'updateline') |
570 | 584 | { |
@@ -594,8 +608,7 @@ discard block |
||
594 | 608 | header('Location: '.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id); |
595 | 609 | exit; // Surtout ne pas laisser Dolibarr faire du traitement sur le updateligne sinon ça plante les données de la ligne |
596 | 610 | } |
597 | - } |
|
598 | - else if($action === 'builddoc') { |
|
611 | + } else if($action === 'builddoc') { |
|
599 | 612 | |
600 | 613 | if ( |
601 | 614 | in_array('invoicecard',explode(':',$parameters['context'])) |
@@ -610,33 +623,27 @@ discard block |
||
610 | 623 | $sessname = 'subtotal_hideInnerLines_facture'; |
611 | 624 | $sessname2 = 'subtotal_hidedetails_facture'; |
612 | 625 | $sessname3 = 'subtotal_hideprices_facture'; |
613 | - } |
|
614 | - elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
626 | + } elseif(in_array('invoicesuppliercard',explode(':',$parameters['context']))) { |
|
615 | 627 | $sessname = 'subtotal_hideInnerLines_facture_fournisseur'; |
616 | 628 | $sessname2 = 'subtotal_hidedetails_facture_fournisseur'; |
617 | 629 | $sessname3 = 'subtotal_hideprices_facture_fournisseur'; |
618 | - } |
|
619 | - elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
630 | + } elseif(in_array('propalcard',explode(':',$parameters['context']))) { |
|
620 | 631 | $sessname = 'subtotal_hideInnerLines_propal'; |
621 | 632 | $sessname2 = 'subtotal_hidedetails_propal'; |
622 | 633 | $sessname3 = 'subtotal_hideprices_propal'; |
623 | - } |
|
624 | - elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
634 | + } elseif(in_array('supplier_proposalcard',explode(':',$parameters['context']))) { |
|
625 | 635 | $sessname = 'subtotal_hideInnerLines_supplier_proposal'; |
626 | 636 | $sessname2 = 'subtotal_hidedetails_supplier_proposal'; |
627 | 637 | $sessname3 = 'subtotal_hideprices_supplier_proposal'; |
628 | - } |
|
629 | - elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
638 | + } elseif(in_array('ordercard',explode(':',$parameters['context']))) { |
|
630 | 639 | $sessname = 'subtotal_hideInnerLines_commande'; |
631 | 640 | $sessname2 = 'subtotal_hidedetails_commande'; |
632 | 641 | $sessname3 = 'subtotal_hideprices_commande'; |
633 | - } |
|
634 | - elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
642 | + } elseif(in_array('ordersuppliercard',explode(':',$parameters['context']))) { |
|
635 | 643 | $sessname = 'subtotal_hideInnerLines_commande_fournisseur'; |
636 | 644 | $sessname2 = 'subtotal_hidedetails_commande_fournisseur'; |
637 | 645 | $sessname3 = 'subtotal_hideprices_commande_fournisseur'; |
638 | - } |
|
639 | - else { |
|
646 | + } else { |
|
640 | 647 | $sessname = 'subtotal_hideInnerLines_unknown'; |
641 | 648 | $sessname2 = 'subtotal_hidedetails_unknown'; |
642 | 649 | $sessname3 = 'subtotal_hideprices_unknown'; |
@@ -645,15 +652,24 @@ discard block |
||
645 | 652 | global $hideprices; |
646 | 653 | |
647 | 654 | $hideInnerLines = (int)GETPOST('hideInnerLines'); |
648 | - if(!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id]) ) $_SESSION[$sessname] = array(); // prevent old system |
|
655 | + if(!empty($_SESSION[$sessname]) && !is_array($_SESSION[$sessname][$object->id]) ) { |
|
656 | + $_SESSION[$sessname] = array(); |
|
657 | + } |
|
658 | + // prevent old system |
|
649 | 659 | $_SESSION[$sessname][$object->id] = $hideInnerLines; |
650 | 660 | |
651 | 661 | $hidedetails= (int)GETPOST('hidedetails'); |
652 | - if(!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id]) ) $_SESSION[$sessname2] = array(); // prevent old system |
|
662 | + if(!empty($_SESSION[$sessname2]) && !is_array($_SESSION[$sessname2][$object->id]) ) { |
|
663 | + $_SESSION[$sessname2] = array(); |
|
664 | + } |
|
665 | + // prevent old system |
|
653 | 666 | $_SESSION[$sessname2][$object->id] = $hidedetails; |
654 | 667 | |
655 | 668 | $hideprices= (int)GETPOST('hideprices'); |
656 | - if(!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id]) ) $_SESSION[$sessname3] = array(); // prevent old system |
|
669 | + if(!empty($_SESSION[$sessname3]) && !is_array($_SESSION[$sessname3][$object->id]) ) { |
|
670 | + $_SESSION[$sessname3] = array(); |
|
671 | + } |
|
672 | + // prevent old system |
|
657 | 673 | $_SESSION[$sessname3][$object->id] = $hideprices; |
658 | 674 | |
659 | 675 | foreach($object->lines as &$line) { |
@@ -661,8 +677,7 @@ discard block |
||
661 | 677 | |
662 | 678 | if($line->qty>=90) { |
663 | 679 | $line->modsubtotal_total = 1; |
664 | - } |
|
665 | - else{ |
|
680 | + } else{ |
|
666 | 681 | $line->modsubtotal_title = 1; |
667 | 682 | } |
668 | 683 | |
@@ -671,8 +686,7 @@ discard block |
||
671 | 686 | } |
672 | 687 | } |
673 | 688 | |
674 | - } |
|
675 | - else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
689 | + } else if($action === 'confirm_delete_all_lines' && GETPOST('confirm')=='yes') { |
|
676 | 690 | |
677 | 691 | $Tab = $this->getArrayOfLineForAGroup($object, GETPOST('lineid')); |
678 | 692 | |
@@ -680,7 +694,9 @@ discard block |
||
680 | 694 | /** |
681 | 695 | * @var $object Facture |
682 | 696 | */ |
683 | - if($object->element=='facture') $object->deleteline($idLine); |
|
697 | + if($object->element=='facture') { |
|
698 | + $object->deleteline($idLine); |
|
699 | + } |
|
684 | 700 | /** |
685 | 701 | * @var $object Facture fournisseur |
686 | 702 | */ |
@@ -691,18 +707,25 @@ discard block |
||
691 | 707 | /** |
692 | 708 | * @var $object Propal |
693 | 709 | */ |
694 | - else if($object->element=='propal') $object->deleteline($idLine); |
|
710 | + else if($object->element=='propal') { |
|
711 | + $object->deleteline($idLine); |
|
712 | + } |
|
695 | 713 | /** |
696 | 714 | * @var $object Propal Fournisseur |
697 | 715 | */ |
698 | - else if($object->element=='supplier_proposal') $object->deleteline($idLine); |
|
716 | + else if($object->element=='supplier_proposal') { |
|
717 | + $object->deleteline($idLine); |
|
718 | + } |
|
699 | 719 | /** |
700 | 720 | * @var $object Commande |
701 | 721 | */ |
702 | 722 | else if($object->element=='commande') |
703 | 723 | { |
704 | - if ((float) DOL_VERSION >= 5.0) $object->deleteline($user, $idLine); |
|
705 | - else $object->deleteline($idLine); |
|
724 | + if ((float) DOL_VERSION >= 5.0) { |
|
725 | + $object->deleteline($user, $idLine); |
|
726 | + } else { |
|
727 | + $object->deleteline($idLine); |
|
728 | + } |
|
706 | 729 | } |
707 | 730 | /** |
708 | 731 | * @var $object Commande fournisseur |
@@ -714,21 +737,26 @@ discard block |
||
714 | 737 | /** |
715 | 738 | * @var $object Facturerec |
716 | 739 | */ |
717 | - else if($object->element=='facturerec') $object->deleteline($idLine); |
|
740 | + else if($object->element=='facturerec') { |
|
741 | + $object->deleteline($idLine); |
|
742 | + } |
|
718 | 743 | } |
719 | 744 | |
720 | 745 | header('location:?id='.$object->id); |
721 | 746 | exit; |
722 | 747 | |
723 | - } |
|
724 | - else if ($action == 'duplicate') |
|
748 | + } else if ($action == 'duplicate') |
|
725 | 749 | { |
726 | 750 | $lineid = GETPOST('lineid', 'int'); |
727 | 751 | $nbDuplicate = TSubtotal::duplicateLines($object, $lineid, true); |
728 | 752 | |
729 | - if ($nbDuplicate > 0) setEventMessage($langs->trans('subtotal_duplicate_success', $nbDuplicate)); |
|
730 | - elseif ($nbDuplicate == 0) setEventMessage($langs->trans('subtotal_duplicate_lineid_not_found'), 'warnings'); |
|
731 | - else setEventMessage($langs->trans('subtotal_duplicate_error'), 'errors'); |
|
753 | + if ($nbDuplicate > 0) { |
|
754 | + setEventMessage($langs->trans('subtotal_duplicate_success', $nbDuplicate)); |
|
755 | + } elseif ($nbDuplicate == 0) { |
|
756 | + setEventMessage($langs->trans('subtotal_duplicate_lineid_not_found'), 'warnings'); |
|
757 | + } else { |
|
758 | + setEventMessage($langs->trans('subtotal_duplicate_error'), 'errors'); |
|
759 | + } |
|
732 | 760 | |
733 | 761 | header('Location: ?id='.$object->id); |
734 | 762 | exit; |
@@ -746,21 +774,26 @@ discard block |
||
746 | 774 | global $conf; |
747 | 775 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && !empty($object->table_element_line) && in_array($object->element, array('commande', 'facture', 'propal'))) |
748 | 776 | { |
749 | - if ($object->element == 'commande') |
|
750 | - $obj = new OrderLine($object->db); |
|
751 | - if ($object->element == 'propal') |
|
752 | - $obj = new PropaleLigne($object->db); |
|
753 | - if ($object->element == 'facture') |
|
754 | - $obj = new FactureLigne($object->db); |
|
777 | + if ($object->element == 'commande') { |
|
778 | + $obj = new OrderLine($object->db); |
|
779 | + } |
|
780 | + if ($object->element == 'propal') { |
|
781 | + $obj = new PropaleLigne($object->db); |
|
782 | + } |
|
783 | + if ($object->element == 'facture') { |
|
784 | + $obj = new FactureLigne($object->db); |
|
785 | + } |
|
755 | 786 | if (!empty($parameters['fk_element'])) |
756 | 787 | { |
757 | 788 | |
758 | 789 | if($obj->fetch($parameters['fk_element'])){ |
759 | 790 | $obj->id= $obj->rowid; |
760 | - if (empty($obj->array_options)) |
|
761 | - $obj->fetch_optionals(); |
|
762 | - if (!empty($obj->array_options['options_subtotal_nc'])) |
|
763 | - return 1; |
|
791 | + if (empty($obj->array_options)) { |
|
792 | + $obj->fetch_optionals(); |
|
793 | + } |
|
794 | + if (!empty($obj->array_options['options_subtotal_nc'])) { |
|
795 | + return 1; |
|
796 | + } |
|
764 | 797 | } |
765 | 798 | } |
766 | 799 | } |
@@ -835,17 +868,18 @@ discard block |
||
835 | 868 | //print $l->rang.'>='.$rang.' '.$total.'<br/>'; |
836 | 869 | if($l->rang>=$rang) { |
837 | 870 | //echo 'return!<br>'; |
838 | - if (!$return_all) return $total; |
|
839 | - else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
840 | - } |
|
841 | - else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
871 | + if (!$return_all) { |
|
872 | + return $total; |
|
873 | + } else { |
|
874 | + return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
875 | + } |
|
876 | + } else if(TSubtotal::isTitle($l, 100 - $qty_line)) |
|
842 | 877 | { |
843 | 878 | $total = 0; |
844 | 879 | $total_tva = 0; |
845 | 880 | $total_ttc = 0; |
846 | 881 | $TTotal_tva = array(); |
847 | - } |
|
848 | - elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
882 | + } elseif(!TSubtotal::isTitle($l) && !TSubtotal::isSubtotal($l)) { |
|
849 | 883 | $total += $l->total_ht; |
850 | 884 | $total_tva += $l->total_tva; |
851 | 885 | $TTotal_tva[$l->tva_tx] += $l->total_tva; |
@@ -853,8 +887,11 @@ discard block |
||
853 | 887 | } |
854 | 888 | |
855 | 889 | } |
856 | - if (!$return_all) return $total; |
|
857 | - else return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
890 | + if (!$return_all) { |
|
891 | + return $total; |
|
892 | + } else { |
|
893 | + return array($total, $total_tva, $total_ttc, $TTotal_tva); |
|
894 | + } |
|
858 | 895 | } |
859 | 896 | |
860 | 897 | /* |
@@ -922,15 +959,18 @@ discard block |
||
922 | 959 | } |
923 | 960 | |
924 | 961 | |
925 | - if($line->qty==99) |
|
926 | - $pdf->SetFillColor(220,220,220); |
|
927 | - elseif ($line->qty==98) |
|
928 | - $pdf->SetFillColor(230,230,230); |
|
929 | - else |
|
930 | - $pdf->SetFillColor(240,240,240); |
|
962 | + if($line->qty==99) { |
|
963 | + $pdf->SetFillColor(220,220,220); |
|
964 | + } elseif ($line->qty==98) { |
|
965 | + $pdf->SetFillColor(230,230,230); |
|
966 | + } else { |
|
967 | + $pdf->SetFillColor(240,240,240); |
|
968 | + } |
|
931 | 969 | |
932 | 970 | $style = 'B'; |
933 | - if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
|
971 | + if (!empty($conf->global->SUBTOTAL_SUBTOTAL_STYLE)) { |
|
972 | + $style = $conf->global->SUBTOTAL_SUBTOTAL_STYLE; |
|
973 | + } |
|
934 | 974 | |
935 | 975 | $pdf->SetFont('', $style, 9); |
936 | 976 | |
@@ -969,8 +1009,7 @@ discard block |
||
969 | 1009 | // $line->total_tva |
970 | 1010 | // $line->total |
971 | 1011 | // $line->total_ttc |
972 | - } |
|
973 | - else |
|
1012 | + } else |
|
974 | 1013 | { |
975 | 1014 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
976 | 1015 | if(get_class($object) == 'Facture' && $object->type==Facture::TYPE_SITUATION){//Facture de situation |
@@ -987,11 +1026,14 @@ discard block |
||
987 | 1026 | } |
988 | 1027 | |
989 | 1028 | $pdf->SetXY($pdf->postotalht, $posy); |
990 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
1029 | + if($set_pagebreak_margin) { |
|
1030 | + $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
1031 | + } |
|
991 | 1032 | $pdf->MultiCell($pdf->page_largeur-$pdf->marge_droite-$pdf->postotalht, 3, $total_to_print, 0, 'R', 0); |
992 | - } |
|
993 | - else{ |
|
994 | - if($set_pagebreak_margin) $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
1033 | + } else{ |
|
1034 | + if($set_pagebreak_margin) { |
|
1035 | + $pdf->SetAutoPageBreak( $pageBreakOriginalValue , $bMargin); |
|
1036 | + } |
|
995 | 1037 | } |
996 | 1038 | |
997 | 1039 | $posy = $posy + $cell_height; |
@@ -1023,25 +1065,40 @@ discard block |
||
1023 | 1065 | |
1024 | 1066 | |
1025 | 1067 | $style = ($line->qty==1) ? 'BU' : 'BUI'; |
1026 | - if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
|
1068 | + if (!empty($conf->global->SUBTOTAL_TITLE_STYLE)) { |
|
1069 | + $style = $conf->global->SUBTOTAL_TITLE_STYLE; |
|
1070 | + } |
|
1027 | 1071 | |
1028 | 1072 | if($hideInnerLines) { |
1029 | - if($line->qty==1)$pdf->SetFont('', $style, 9); |
|
1030 | - else |
|
1073 | + if($line->qty==1) { |
|
1074 | + $pdf->SetFont('', $style, 9); |
|
1075 | + } else |
|
1031 | 1076 | { |
1032 | - if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
|
1077 | + if (!empty($conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES)) { |
|
1078 | + $style = $conf->global->SUBTOTAL_STYLE_TITRES_SI_LIGNES_CACHEES; |
|
1079 | + } |
|
1033 | 1080 | $pdf->SetFont('', $style, 9); |
1034 | 1081 | } |
1035 | - } |
|
1036 | - else { |
|
1082 | + } else { |
|
1037 | 1083 | |
1038 | - if($line->qty==1)$pdf->SetFont('', $style, 9); //TODO if super utile |
|
1039 | - else $pdf->SetFont('', $style, 9); |
|
1084 | + if($line->qty==1) { |
|
1085 | + $pdf->SetFont('', $style, 9); |
|
1086 | + } |
|
1087 | + //TODO if super utile |
|
1088 | + else { |
|
1089 | + $pdf->SetFont('', $style, 9); |
|
1090 | + } |
|
1040 | 1091 | |
1041 | 1092 | } |
1042 | 1093 | |
1043 | - if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) $pdf->MultiCell($w, $h, $label, 0, 'L'); // Pas de HTML dans la chaine |
|
1044 | - else $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); // et maintenant avec du HTML |
|
1094 | + if ($label === strip_tags($label) && $label === dol_html_entity_decode($label, ENT_QUOTES)) { |
|
1095 | + $pdf->MultiCell($w, $h, $label, 0, 'L'); |
|
1096 | + } |
|
1097 | + // Pas de HTML dans la chaine |
|
1098 | + else { |
|
1099 | + $pdf->writeHTMLCell($w, $h, $posx, $posy, $label, 0, 1, false, true, 'J',true); |
|
1100 | + } |
|
1101 | + // et maintenant avec du HTML |
|
1045 | 1102 | |
1046 | 1103 | if($description && !$hidedesc) { |
1047 | 1104 | $posy = $pdf->GetY(); |
@@ -1065,8 +1122,7 @@ discard block |
||
1065 | 1122 | |
1066 | 1123 | if(is_array($parameters)) { |
1067 | 1124 | $i = & $parameters['i']; |
1068 | - } |
|
1069 | - else { |
|
1125 | + } else { |
|
1070 | 1126 | $i = (int)$parameters; |
1071 | 1127 | } |
1072 | 1128 | |
@@ -1088,17 +1144,14 @@ discard block |
||
1088 | 1144 | |
1089 | 1145 | if((float)DOL_VERSION<=3.6) { |
1090 | 1146 | return ''; |
1091 | - } |
|
1092 | - else if((float)DOL_VERSION>=3.8) { |
|
1147 | + } else if((float)DOL_VERSION>=3.8) { |
|
1093 | 1148 | return 1; |
1094 | 1149 | } |
1095 | 1150 | |
1096 | - } |
|
1097 | - elseif(!empty($hideprices)) { |
|
1151 | + } elseif(!empty($hideprices)) { |
|
1098 | 1152 | $this->resprints = $object->lines[$parameters['i']]->qty; |
1099 | 1153 | return 1; |
1100 | - } |
|
1101 | - elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
|
1154 | + } elseif (!empty($conf->global->SUBTOTAL_IF_HIDE_PRICES_SHOW_QTY)) |
|
1102 | 1155 | { |
1103 | 1156 | $hideInnerLines = (int)GETPOST('hideInnerLines'); |
1104 | 1157 | $hidedetails = (int)GETPOST('hidedetails'); |
@@ -1108,12 +1161,20 @@ discard block |
||
1108 | 1161 | } |
1109 | 1162 | } |
1110 | 1163 | |
1111 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1112 | - else $i = (int)$parameters; |
|
1164 | + if(is_array($parameters)) { |
|
1165 | + $i = & $parameters['i']; |
|
1166 | + } else { |
|
1167 | + $i = (int)$parameters; |
|
1168 | + } |
|
1113 | 1169 | |
1114 | - if (empty($object->lines[$i])) return 0; // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
|
1170 | + if (empty($object->lines[$i])) { |
|
1171 | + return 0; |
|
1172 | + } |
|
1173 | + // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
|
1115 | 1174 | |
1116 | - if(empty($object->lines[$i]->array_options)) $object->lines[$i]->fetch_optionals(); |
|
1175 | + if(empty($object->lines[$i]->array_options)) { |
|
1176 | + $object->lines[$i]->fetch_optionals(); |
|
1177 | + } |
|
1117 | 1178 | |
1118 | 1179 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
1119 | 1180 | { |
@@ -1130,8 +1191,11 @@ discard block |
||
1130 | 1191 | function pdf_getlinetotalexcltax($parameters=array(), &$object, &$action='') { |
1131 | 1192 | global $conf, $hideprices, $hookmanager; |
1132 | 1193 | |
1133 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1134 | - else $i = (int)$parameters; |
|
1194 | + if(is_array($parameters)) { |
|
1195 | + $i = & $parameters['i']; |
|
1196 | + } else { |
|
1197 | + $i = (int)$parameters; |
|
1198 | + } |
|
1135 | 1199 | |
1136 | 1200 | if($this->isModSubtotalLine($parameters,$object) ){ |
1137 | 1201 | |
@@ -1139,13 +1203,11 @@ discard block |
||
1139 | 1203 | |
1140 | 1204 | if((float)DOL_VERSION<=3.6) { |
1141 | 1205 | return ''; |
1142 | - } |
|
1143 | - else if((float)DOL_VERSION>=3.8) { |
|
1206 | + } else if((float)DOL_VERSION>=3.8) { |
|
1144 | 1207 | return 1; |
1145 | 1208 | } |
1146 | 1209 | |
1147 | - } |
|
1148 | - elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) |
|
1210 | + } elseif (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS)) |
|
1149 | 1211 | { |
1150 | 1212 | if (!in_array(__FUNCTION__, explode(',', $conf->global->SUBTOTAL_TFIELD_TO_KEEP_WITH_NC))) |
1151 | 1213 | { |
@@ -1217,12 +1279,10 @@ discard block |
||
1217 | 1279 | $this->error = $hookmanager->error; |
1218 | 1280 | $this->errors = $hookmanager->errors; |
1219 | 1281 | return -1; |
1220 | - } |
|
1221 | - elseif (empty($reshook)) |
|
1282 | + } elseif (empty($reshook)) |
|
1222 | 1283 | { |
1223 | 1284 | $this->resprints .= $hookmanager->resprints; |
1224 | - } |
|
1225 | - else |
|
1285 | + } else |
|
1226 | 1286 | { |
1227 | 1287 | $this->resprints = $hookmanager->resprints; |
1228 | 1288 | |
@@ -1245,14 +1305,16 @@ discard block |
||
1245 | 1305 | |
1246 | 1306 | if((float)DOL_VERSION<=3.6) { |
1247 | 1307 | return ''; |
1248 | - } |
|
1249 | - else if((float)DOL_VERSION>=3.8) { |
|
1308 | + } else if((float)DOL_VERSION>=3.8) { |
|
1250 | 1309 | return 1; |
1251 | 1310 | } |
1252 | 1311 | } |
1253 | 1312 | |
1254 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1255 | - else $i = (int)$parameters; |
|
1313 | + if(is_array($parameters)) { |
|
1314 | + $i = & $parameters['i']; |
|
1315 | + } else { |
|
1316 | + $i = (int)$parameters; |
|
1317 | + } |
|
1256 | 1318 | |
1257 | 1319 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
1258 | 1320 | { |
@@ -1274,14 +1336,16 @@ discard block |
||
1274 | 1336 | |
1275 | 1337 | if((float)DOL_VERSION<=3.6) { |
1276 | 1338 | return ''; |
1277 | - } |
|
1278 | - else if((float)DOL_VERSION>=3.8) { |
|
1339 | + } else if((float)DOL_VERSION>=3.8) { |
|
1279 | 1340 | return 1; |
1280 | 1341 | } |
1281 | 1342 | } |
1282 | 1343 | |
1283 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1284 | - else $i = (int)$parameters; |
|
1344 | + if(is_array($parameters)) { |
|
1345 | + $i = & $parameters['i']; |
|
1346 | + } else { |
|
1347 | + $i = (int)$parameters; |
|
1348 | + } |
|
1285 | 1349 | |
1286 | 1350 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
1287 | 1351 | { |
@@ -1298,8 +1362,11 @@ discard block |
||
1298 | 1362 | function pdf_getlineupexcltax($parameters=array(), &$object, &$action='') { |
1299 | 1363 | global $conf,$hideprices,$hookmanager; |
1300 | 1364 | |
1301 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1302 | - else $i = (int)$parameters; |
|
1365 | + if(is_array($parameters)) { |
|
1366 | + $i = & $parameters['i']; |
|
1367 | + } else { |
|
1368 | + $i = (int)$parameters; |
|
1369 | + } |
|
1303 | 1370 | |
1304 | 1371 | if($this->isModSubtotalLine($parameters,$object) ) { |
1305 | 1372 | $this->resprints = ' '; |
@@ -1318,8 +1385,7 @@ discard block |
||
1318 | 1385 | |
1319 | 1386 | if((float)DOL_VERSION<=3.6) { |
1320 | 1387 | return ''; |
1321 | - } |
|
1322 | - else if((float)DOL_VERSION>=3.8) { |
|
1388 | + } else if((float)DOL_VERSION>=3.8) { |
|
1323 | 1389 | return 1; |
1324 | 1390 | } |
1325 | 1391 | } |
@@ -1364,8 +1430,11 @@ discard block |
||
1364 | 1430 | function pdf_getlineremisepercent($parameters=array(), &$object, &$action='') { |
1365 | 1431 | global $conf,$hideprices,$hookmanager; |
1366 | 1432 | |
1367 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1368 | - else $i = (int) $parameters; |
|
1433 | + if(is_array($parameters)) { |
|
1434 | + $i = & $parameters['i']; |
|
1435 | + } else { |
|
1436 | + $i = (int) $parameters; |
|
1437 | + } |
|
1369 | 1438 | |
1370 | 1439 | if($this->isModSubtotalLine($parameters,$object) ) { |
1371 | 1440 | $this->resprints = ' '; |
@@ -1384,8 +1453,7 @@ discard block |
||
1384 | 1453 | |
1385 | 1454 | if((float)DOL_VERSION<=3.6) { |
1386 | 1455 | return ''; |
1387 | - } |
|
1388 | - else if((float)DOL_VERSION>=3.8) { |
|
1456 | + } else if((float)DOL_VERSION>=3.8) { |
|
1389 | 1457 | return 1; |
1390 | 1458 | } |
1391 | 1459 | } |
@@ -1400,14 +1468,16 @@ discard block |
||
1400 | 1468 | $this->resprints = ' '; |
1401 | 1469 | if((float)DOL_VERSION<=3.6) { |
1402 | 1470 | return ''; |
1403 | - } |
|
1404 | - else if((float)DOL_VERSION>=3.8) { |
|
1471 | + } else if((float)DOL_VERSION>=3.8) { |
|
1405 | 1472 | return 1; |
1406 | 1473 | } |
1407 | 1474 | } |
1408 | 1475 | |
1409 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1410 | - else $i = (int)$parameters; |
|
1476 | + if(is_array($parameters)) { |
|
1477 | + $i = & $parameters['i']; |
|
1478 | + } else { |
|
1479 | + $i = (int)$parameters; |
|
1480 | + } |
|
1411 | 1481 | |
1412 | 1482 | if (!empty($hideprices) |
1413 | 1483 | || (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
@@ -1431,16 +1501,21 @@ discard block |
||
1431 | 1501 | |
1432 | 1502 | if((float)DOL_VERSION<=3.6) { |
1433 | 1503 | return ''; |
1434 | - } |
|
1435 | - else if((float)DOL_VERSION>=3.8) { |
|
1504 | + } else if((float)DOL_VERSION>=3.8) { |
|
1436 | 1505 | return 1; |
1437 | 1506 | } |
1438 | 1507 | } |
1439 | 1508 | |
1440 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1441 | - else $i = (int)$parameters; |
|
1509 | + if(is_array($parameters)) { |
|
1510 | + $i = & $parameters['i']; |
|
1511 | + } else { |
|
1512 | + $i = (int)$parameters; |
|
1513 | + } |
|
1442 | 1514 | |
1443 | - if (empty($object->lines[$i])) return 0; // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
|
1515 | + if (empty($object->lines[$i])) { |
|
1516 | + return 0; |
|
1517 | + } |
|
1518 | + // hideInnerLines => override $object->lines et Dolibarr ne nous permet pas de mettre à jour la variable qui conditionne la boucle sur les lignes (PR faite pour 6.0) |
|
1444 | 1519 | |
1445 | 1520 | $object->lines[$i]->fetch_optionals(); |
1446 | 1521 | // Si la gestion C/NC est active et que je suis sur un ligne dont l'extrafield est coché |
@@ -1486,14 +1561,16 @@ discard block |
||
1486 | 1561 | $this->resprints = ' '; |
1487 | 1562 | if((float)DOL_VERSION<=3.6) { |
1488 | 1563 | return ''; |
1489 | - } |
|
1490 | - else if((float)DOL_VERSION>=3.8) { |
|
1564 | + } else if((float)DOL_VERSION>=3.8) { |
|
1491 | 1565 | return 1; |
1492 | 1566 | } |
1493 | 1567 | } |
1494 | 1568 | |
1495 | - if(is_array($parameters)) $i = & $parameters['i']; |
|
1496 | - else $i = (int)$parameters; |
|
1569 | + if(is_array($parameters)) { |
|
1570 | + $i = & $parameters['i']; |
|
1571 | + } else { |
|
1572 | + $i = (int)$parameters; |
|
1573 | + } |
|
1497 | 1574 | |
1498 | 1575 | if (!empty($conf->global->SUBTOTAL_MANAGE_COMPRIS_NONCOMPRIS) && (!empty($object->lines[$i]->array_options['options_subtotal_nc']) || TSubtotal::hasNcTitle($object->lines[$i])) ) |
1499 | 1576 | { |
@@ -1523,7 +1600,9 @@ discard block |
||
1523 | 1600 | } |
1524 | 1601 | } |
1525 | 1602 | |
1526 | - if (!empty($TLineTitle)) $TTitleNumeroted = $this->formatNumerotation($TLineTitle); |
|
1603 | + if (!empty($TLineTitle)) { |
|
1604 | + $TTitleNumeroted = $this->formatNumerotation($TLineTitle); |
|
1605 | + } |
|
1527 | 1606 | } |
1528 | 1607 | |
1529 | 1608 | } |
@@ -1537,8 +1616,12 @@ discard block |
||
1537 | 1616 | $j=0; |
1538 | 1617 | foreach ($TLineTitle as $k => &$line) |
1539 | 1618 | { |
1540 | - if (!empty($line_reference) && $line->rang <= $line_reference->rang) continue; |
|
1541 | - if (!empty($line_reference) && $line->qty <= $line_reference->qty) break; |
|
1619 | + if (!empty($line_reference) && $line->rang <= $line_reference->rang) { |
|
1620 | + continue; |
|
1621 | + } |
|
1622 | + if (!empty($line_reference) && $line->qty <= $line_reference->qty) { |
|
1623 | + break; |
|
1624 | + } |
|
1542 | 1625 | |
1543 | 1626 | if ($line->qty == $level) |
1544 | 1627 | { |
@@ -1572,7 +1655,9 @@ discard block |
||
1572 | 1655 | |
1573 | 1656 | $hidedetails = (int)GETPOST('hidedetails'); |
1574 | 1657 | |
1575 | - if(empty($hidedetails)) return false; |
|
1658 | + if(empty($hidedetails)) { |
|
1659 | + return false; |
|
1660 | + } |
|
1576 | 1661 | |
1577 | 1662 | // TODO can't add VAT to document without lines... :-/ |
1578 | 1663 | |
@@ -1633,7 +1718,9 @@ discard block |
||
1633 | 1718 | */ |
1634 | 1719 | list($total, $total_tva, $total_ttc, $TTotal_tva) = $this->getTotalLineFromObject($object, $line, '', 1); |
1635 | 1720 | |
1636 | - if (TSubtotal::getNiveau($line) == 1) $line->TTotal_tva = $TTotal_tva; |
|
1721 | + if (TSubtotal::getNiveau($line) == 1) { |
|
1722 | + $line->TTotal_tva = $TTotal_tva; |
|
1723 | + } |
|
1637 | 1724 | $line->total_ht = $total; |
1638 | 1725 | $line->total_tva = $total_tva; |
1639 | 1726 | $line->total = $line->total_ht; |
@@ -1697,8 +1784,7 @@ discard block |
||
1697 | 1784 | } |
1698 | 1785 | |
1699 | 1786 | |
1700 | - } |
|
1701 | - elseif ($hidedetails) |
|
1787 | + } elseif ($hidedetails) |
|
1702 | 1788 | { |
1703 | 1789 | $TLines[] = $line; //Cas où je cache uniquement les prix des produits |
1704 | 1790 | } |
@@ -1769,7 +1855,9 @@ discard block |
||
1769 | 1855 | |
1770 | 1856 | if(!empty($hideprices)) { |
1771 | 1857 | foreach($object->lines as &$line) { |
1772 | - if($line->fk_product_type!=9) $line->fk_parent_line = -1; |
|
1858 | + if($line->fk_product_type!=9) { |
|
1859 | + $line->fk_parent_line = -1; |
|
1860 | + } |
|
1773 | 1861 | } |
1774 | 1862 | } |
1775 | 1863 | |
@@ -1790,7 +1878,9 @@ discard block |
||
1790 | 1878 | |
1791 | 1879 | if($line->qty>90) { |
1792 | 1880 | |
1793 | - if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) $label .= ' '.$this->getTitle($object, $line); |
|
1881 | + if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
1882 | + $label .= ' '.$this->getTitle($object, $line); |
|
1883 | + } |
|
1794 | 1884 | |
1795 | 1885 | $pageBefore = $pdf->getPage(); |
1796 | 1886 | $this->pdf_add_total($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
@@ -1808,8 +1898,7 @@ discard block |
||
1808 | 1898 | |
1809 | 1899 | $posy = $pdf->GetY(); |
1810 | 1900 | return 1; |
1811 | - } |
|
1812 | - else if ($line->qty < 10) { |
|
1901 | + } else if ($line->qty < 10) { |
|
1813 | 1902 | $pageBefore = $pdf->getPage(); |
1814 | 1903 | |
1815 | 1904 | $this->pdf_add_title($pdf,$object, $line, $label, $description,$posx, $posy, $w, $h); |
@@ -1833,8 +1922,7 @@ discard block |
||
1833 | 1922 | // if($line->rowid==47) exit; |
1834 | 1923 | |
1835 | 1924 | return 0; |
1836 | - } |
|
1837 | - elseif (empty($object->lines[$parameters['i']])) |
|
1925 | + } elseif (empty($object->lines[$parameters['i']])) |
|
1838 | 1926 | { |
1839 | 1927 | $this->resprints = -1; |
1840 | 1928 | } |
@@ -1867,7 +1955,9 @@ discard block |
||
1867 | 1955 | |
1868 | 1956 | foreach ($object->lines as $line) |
1869 | 1957 | { |
1870 | - if ($line->id == $currentLine->id) break; |
|
1958 | + if ($line->id == $currentLine->id) { |
|
1959 | + break; |
|
1960 | + } |
|
1871 | 1961 | |
1872 | 1962 | $qty_search = 100 - $currentLine->qty; |
1873 | 1963 | |
@@ -1904,23 +1994,23 @@ discard block |
||
1904 | 1994 | { |
1905 | 1995 | $object->statut = 0; // hack for facture rec |
1906 | 1996 | $createRight = $user->rights->facture->creer; |
1907 | - } |
|
1908 | - elseif($object->element == 'order_supplier' ) |
|
1997 | + } elseif($object->element == 'order_supplier' ) |
|
1909 | 1998 | { |
1910 | 1999 | $createRight = $user->rights->fournisseur->commande->creer; |
1911 | - } |
|
1912 | - elseif($object->element == 'invoice_supplier' ) |
|
2000 | + } elseif($object->element == 'invoice_supplier' ) |
|
1913 | 2001 | { |
1914 | 2002 | $createRight = $user->rights->fournisseur->facture->creer; |
1915 | 2003 | } |
1916 | 2004 | |
1917 | 2005 | if($line->special_code!=$this->module_number || $line->product_type!=9) { |
1918 | 2006 | null; |
1919 | - } |
|
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)) |
|
2007 | + } 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 | 2008 | { |
1922 | - if($object->element=='facture')$idvar = 'facid'; |
|
1923 | - else $idvar='id'; |
|
2009 | + if($object->element=='facture') { |
|
2010 | + $idvar = 'facid'; |
|
2011 | + } else { |
|
2012 | + $idvar='id'; |
|
2013 | + } |
|
1924 | 2014 | |
1925 | 2015 | if((float)DOL_VERSION <= 3.4) |
1926 | 2016 | { |
@@ -1946,22 +2036,44 @@ discard block |
||
1946 | 2036 | <?php |
1947 | 2037 | } |
1948 | 2038 | |
1949 | - if(empty($line->description)) $line->description = $line->desc; |
|
2039 | + if(empty($line->description)) { |
|
2040 | + $line->description = $line->desc; |
|
2041 | + } |
|
1950 | 2042 | |
1951 | 2043 | $colspan = 5; |
1952 | - if($object->element == 'facturerec' ) $colspan = 3; |
|
1953 | - if($object->element == 'order_supplier') $colspan = 3; |
|
1954 | - if($object->element == 'invoice_supplier') $colspan = 4; |
|
1955 | - if($object->element == 'supplier_proposal') $colspan = 4; |
|
2044 | + if($object->element == 'facturerec' ) { |
|
2045 | + $colspan = 3; |
|
2046 | + } |
|
2047 | + if($object->element == 'order_supplier') { |
|
2048 | + $colspan = 3; |
|
2049 | + } |
|
2050 | + if($object->element == 'invoice_supplier') { |
|
2051 | + $colspan = 4; |
|
2052 | + } |
|
2053 | + if($object->element == 'supplier_proposal') { |
|
2054 | + $colspan = 4; |
|
2055 | + } |
|
1956 | 2056 | if(!empty($conf->multicurrency->enabled) && ((float) DOL_VERSION < 8.0 || $object->multicurrency_code != $conf->currency)) { |
1957 | 2057 | $colspan++; // Colonne PU Devise |
1958 | 2058 | } |
1959 | - if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) $colspan++; |
|
1960 | - if(!empty($conf->margin->enabled)) $colspan++; |
|
1961 | - if(!empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; |
|
1962 | - if(!empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; |
|
1963 | - if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) $colspan++; |
|
1964 | - if(!empty($conf->global->PRODUCT_USE_UNITS)) $colspan++; |
|
2059 | + if($object->element == 'commande' && $object->statut < 3 && !empty($conf->shippableorder->enabled)) { |
|
2060 | + $colspan++; |
|
2061 | + } |
|
2062 | + if(!empty($conf->margin->enabled)) { |
|
2063 | + $colspan++; |
|
2064 | + } |
|
2065 | + if(!empty($conf->global->DISPLAY_MARGIN_RATES)) { |
|
2066 | + $colspan++; |
|
2067 | + } |
|
2068 | + if(!empty($conf->global->DISPLAY_MARK_RATES)) { |
|
2069 | + $colspan++; |
|
2070 | + } |
|
2071 | + if($object->element == 'facture' && !empty($conf->global->INVOICE_USE_SITUATION) && $object->type == Facture::TYPE_SITUATION) { |
|
2072 | + $colspan++; |
|
2073 | + } |
|
2074 | + if(!empty($conf->global->PRODUCT_USE_UNITS)) { |
|
2075 | + $colspan++; |
|
2076 | + } |
|
1965 | 2077 | |
1966 | 2078 | /* Titre */ |
1967 | 2079 | //var_dump($line); |
@@ -1974,23 +2086,36 @@ discard block |
||
1974 | 2086 | <tr <?php echo $bc[$var]; $var=!$var; echo $data; ?> rel="subtotal" id="row-<?php echo $line->id ?>" style="<?php |
1975 | 2087 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT)) |
1976 | 2088 | { |
1977 | - if($line->qty==99) print 'background:#adadcf'; |
|
1978 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
1979 | - else if($line->qty<=97 && $line->qty>=91) print 'background:#eeeeff;'; |
|
1980 | - else if($line->qty==1) print 'background:#adadcf;'; |
|
1981 | - else if($line->qty==2) print 'background:#ddddff;'; |
|
1982 | - else if($line->qty==50) print ''; |
|
1983 | - else print 'background:#eeeeff;'; |
|
2089 | + if($line->qty==99) { |
|
2090 | + print 'background:#adadcf'; |
|
2091 | + } else if($line->qty==98) { |
|
2092 | + print 'background:#ddddff;'; |
|
2093 | + } else if($line->qty<=97 && $line->qty>=91) { |
|
2094 | + print 'background:#eeeeff;'; |
|
2095 | + } else if($line->qty==1) { |
|
2096 | + print 'background:#adadcf;'; |
|
2097 | + } else if($line->qty==2) { |
|
2098 | + print 'background:#ddddff;'; |
|
2099 | + } else if($line->qty==50) { |
|
2100 | + print ''; |
|
2101 | + } else { |
|
2102 | + print 'background:#eeeeff;'; |
|
2103 | + } |
|
1984 | 2104 | |
1985 | 2105 | //A compléter si on veux plus de nuances de couleurs avec les niveau 4,5,6,7,8 et 9 |
1986 | - } |
|
1987 | - else |
|
2106 | + } else |
|
1988 | 2107 | { |
1989 | - if($line->qty==99) print 'background:#ddffdd'; |
|
1990 | - else if($line->qty==98) print 'background:#ddddff;'; |
|
1991 | - else if($line->qty==2) print 'background:#eeeeff; '; |
|
1992 | - else if($line->qty==50) print ''; |
|
1993 | - else print 'background:#eeffee;' ; |
|
2108 | + if($line->qty==99) { |
|
2109 | + print 'background:#ddffdd'; |
|
2110 | + } else if($line->qty==98) { |
|
2111 | + print 'background:#ddddff;'; |
|
2112 | + } else if($line->qty==2) { |
|
2113 | + print 'background:#eeeeff; '; |
|
2114 | + } else if($line->qty==50) { |
|
2115 | + print ''; |
|
2116 | + } else { |
|
2117 | + print 'background:#eeffee;' ; |
|
2118 | + } |
|
1994 | 2119 | } |
1995 | 2120 | |
1996 | 2121 | ?>;"> |
@@ -2017,13 +2142,11 @@ discard block |
||
2017 | 2142 | $qty_displayed = $line->qty; |
2018 | 2143 | print img_picto('', 'subsubtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;color:#0075DE;">'.$qty_displayed.'</span> '; |
2019 | 2144 | |
2020 | - } |
|
2021 | - else if (TSubtotal::isSubtotal($line)) |
|
2145 | + } else if (TSubtotal::isSubtotal($line)) |
|
2022 | 2146 | { |
2023 | 2147 | $qty_displayed = 100 - $line->qty; |
2024 | 2148 | print img_picto('', 'subsubtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;color:#0075DE;">'.$qty_displayed.'</span> '; |
2025 | - } |
|
2026 | - else |
|
2149 | + } else |
|
2027 | 2150 | { |
2028 | 2151 | $isFreeText = true; |
2029 | 2152 | } |
@@ -2044,9 +2167,13 @@ discard block |
||
2044 | 2167 | } |
2045 | 2168 | |
2046 | 2169 | $readonlyForSituation = ''; |
2047 | - if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) $readonlyForSituation = 'readonly'; |
|
2170 | + if (!empty($object->situation_cycle_ref) && $object->situation_counter > 1) { |
|
2171 | + $readonlyForSituation = 'readonly'; |
|
2172 | + } |
|
2048 | 2173 | |
2049 | - if (!$isFreeText) echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
|
2174 | + if (!$isFreeText) { |
|
2175 | + echo '<input type="text" name="line-title" id-line="'.$line->id.'" value="'.$newlabel.'" size="80" '.$readonlyForSituation.'/> '; |
|
2176 | + } |
|
2050 | 2177 | |
2051 | 2178 | if (!empty($conf->global->SUBTOTAL_USE_NEW_FORMAT) && (TSubtotal::isTitle($line) || TSubtotal::isSubtotal($line)) ) |
2052 | 2179 | { |
@@ -2054,8 +2181,12 @@ discard block |
||
2054 | 2181 | for ($j=1; $j<10; $j++) |
2055 | 2182 | { |
2056 | 2183 | if (!empty($readonlyForSituation)) { |
2057 | - if ($qty_displayed == $j) $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
2058 | - } else $select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
2184 | + if ($qty_displayed == $j) { |
|
2185 | + $select .= '<option selected="selected" value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
2186 | + } |
|
2187 | + } else { |
|
2188 | + $select .= '<option '.($qty_displayed == $j ? 'selected="selected"' : '').' value="'.$j.'">'.$langs->trans('Level').' '.$j.'</option>'; |
|
2189 | + } |
|
2059 | 2190 | } |
2060 | 2191 | $select .= '</select> '; |
2061 | 2192 | |
@@ -2075,7 +2206,9 @@ discard block |
||
2075 | 2206 | echo '<div>'; |
2076 | 2207 | echo '<label for="subtotal_tva_tx">'.$form->textwithpicto($langs->trans('subtotal_apply_default_tva'), $langs->trans('subtotal_apply_default_tva_help')).'</label>'; |
2077 | 2208 | echo '<select id="subtotal_tva_tx" name="subtotal_tva_tx" class="flat"><option selected="selected" value="">-</option>'; |
2078 | - if (empty($readonlyForSituation)) echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
2209 | + if (empty($readonlyForSituation)) { |
|
2210 | + echo str_replace('selected', '', $form->load_tva('subtotal_tva_tx', '', $parameters['seller'], $parameters['buyer'], 0, 0, '', true)); |
|
2211 | + } |
|
2079 | 2212 | echo '</select>'; |
2080 | 2213 | echo '</div>'; |
2081 | 2214 | |
@@ -2094,8 +2227,9 @@ discard block |
||
2094 | 2227 | 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"' : '') .' /> '; |
2095 | 2228 | echo '<label for="subtotal-showReduc">'.$langs->trans('ShowReducOnSubtotalBlock').'</label>'; |
2096 | 2229 | echo '</div>'; |
2230 | + } else if ($isFreeText) { |
|
2231 | + echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
2097 | 2232 | } |
2098 | - else if ($isFreeText) echo TSubtotal::getFreeTextHtml($line, (bool) $readonlyForSituation); |
|
2099 | 2233 | echo '</div>'; |
2100 | 2234 | |
2101 | 2235 | if($line->qty<10) { |
@@ -2115,8 +2249,7 @@ discard block |
||
2115 | 2249 | $doleditor->Create(); |
2116 | 2250 | } |
2117 | 2251 | |
2118 | - } |
|
2119 | - else { |
|
2252 | + } else { |
|
2120 | 2253 | |
2121 | 2254 | if ($conf->global->SUBTOTAL_USE_NEW_FORMAT) |
2122 | 2255 | { |
@@ -2124,14 +2257,19 @@ discard block |
||
2124 | 2257 | { |
2125 | 2258 | echo str_repeat(' ', $line->qty-1); |
2126 | 2259 | |
2127 | - if (TSubtotal::isTitle($line)) print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
2128 | - else print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
2260 | + if (TSubtotal::isTitle($line)) { |
|
2261 | + print img_picto('', 'subtotal@subtotal').'<span style="font-size:9px;margin-left:-3px;">'.$line->qty.'</span> '; |
|
2262 | + } else { |
|
2263 | + print img_picto('', 'subtotal2@subtotal').'<span style="font-size:9px;margin-left:-1px;">'.(100-$line->qty).'</span> '; |
|
2264 | + } |
|
2129 | 2265 | } |
2130 | - } |
|
2131 | - else |
|
2266 | + } else |
|
2132 | 2267 | { |
2133 | - if($line->qty<=1) print img_picto('', 'subtotal@subtotal'); |
|
2134 | - else if($line->qty==2) print img_picto('', 'subsubtotal@subtotal').' '; |
|
2268 | + if($line->qty<=1) { |
|
2269 | + print img_picto('', 'subtotal@subtotal'); |
|
2270 | + } else if($line->qty==2) { |
|
2271 | + print img_picto('', 'subsubtotal@subtotal').' '; |
|
2272 | + } |
|
2135 | 2273 | } |
2136 | 2274 | |
2137 | 2275 | |
@@ -2141,21 +2279,26 @@ discard block |
||
2141 | 2279 | $titleStyleUnderline = strpos($conf->global->SUBTOTAL_TITLE_STYLE, 'U') === false ? '' : ' text-decoration: underline;'; |
2142 | 2280 | |
2143 | 2281 | if (empty($line->label)) { |
2144 | - if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) print $line->description.' '.$this->getTitle($object, $line); |
|
2145 | - else print $line->description; |
|
2146 | - } |
|
2147 | - else { |
|
2282 | + if ($line->qty >= 91 && $line->qty <= 99 && $conf->global->SUBTOTAL_USE_NEW_FORMAT) { |
|
2283 | + print $line->description.' '.$this->getTitle($object, $line); |
|
2284 | + } else { |
|
2285 | + print $line->description; |
|
2286 | + } |
|
2287 | + } else { |
|
2148 | 2288 | |
2149 | 2289 | if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($line->description)) { |
2150 | 2290 | print '<span class="subtotal_label" style="'.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" >'.$line->label.'</span><br><div class="subtotal_desc">'.dol_htmlentitiesbr($line->description).'</div>'; |
2151 | - } |
|
2152 | - else{ |
|
2291 | + } else{ |
|
2153 | 2292 | print '<span class="subtotal_label classfortooltip '.$titleStyleItalic.$titleStyleBold.$titleStyleUnderline.'" title="'.$line->description.'">'.$line->label.'</span>'; |
2154 | 2293 | } |
2155 | 2294 | |
2156 | 2295 | } |
2157 | - if($line->qty>90) print ' : '; |
|
2158 | - if($line->info_bits > 0) echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
2296 | + if($line->qty>90) { |
|
2297 | + print ' : '; |
|
2298 | + } |
|
2299 | + if($line->info_bits > 0) { |
|
2300 | + echo img_picto($langs->trans('Pagebreak'), 'pagebreak@subtotal'); |
|
2301 | + } |
|
2159 | 2302 | |
2160 | 2303 | |
2161 | 2304 | |
@@ -2198,11 +2341,12 @@ discard block |
||
2198 | 2341 | </script> |
2199 | 2342 | <?php |
2200 | 2343 | |
2201 | - } |
|
2202 | - else{ |
|
2344 | + } else{ |
|
2203 | 2345 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_DUPLICATE_BLOCK) && $object->element !== 'invoice_supplier') |
2204 | 2346 | { |
2205 | - if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
2347 | + if(TSubtotal::isTitle($line) && ($object->situation_counter == 1 || !$object->situation_cycle_ref) ) { |
|
2348 | + echo '<a href="'.$_SERVER['PHP_SELF'].'?'.$idvar.'='.$object->id.'&action=duplicate&lineid='.$line->id.'">'. img_picto($langs->trans('Duplicate'), 'duplicate@subtotal').'</a>'; |
|
2349 | + } |
|
2206 | 2350 | } |
2207 | 2351 | |
2208 | 2352 | if ($object->statut == 0 && $createRight && !empty($conf->global->SUBTOTAL_ALLOW_EDIT_BLOCK)) |
@@ -2291,7 +2435,9 @@ discard block |
||
2291 | 2435 | $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); |
2292 | 2436 | |
2293 | 2437 | $colspan+=3; $mode = 'view'; |
2294 | - if($action === 'editline' && $line->rowid == GETPOST('lineid')) $mode = 'edit'; |
|
2438 | + if($action === 'editline' && $line->rowid == GETPOST('lineid')) { |
|
2439 | + $mode = 'edit'; |
|
2440 | + } |
|
2295 | 2441 | |
2296 | 2442 | $ex_element = $line->element; |
2297 | 2443 | $line->element = 'tr_extrafield_title '.$line->element; // Pour pouvoir manipuler ces tr |
@@ -2473,10 +2619,9 @@ discard block |
||
2473 | 2619 | |
2474 | 2620 | if(TSubtotal::isTitle($line)){ |
2475 | 2621 | $ThtmlData['data-issubtotal'] = 'title'; |
2476 | - }elseif(TSubtotal::isSubtotal($line)){ |
|
2622 | + } elseif(TSubtotal::isSubtotal($line)){ |
|
2477 | 2623 | $ThtmlData['data-issubtotal'] = 'subtotal'; |
2478 | - } |
|
2479 | - else{ |
|
2624 | + } else{ |
|
2480 | 2625 | $ThtmlData['data-issubtotal'] = 'freetext'; |
2481 | 2626 | } |
2482 | 2627 | |
@@ -2486,7 +2631,9 @@ discard block |
||
2486 | 2631 | |
2487 | 2632 | // hook |
2488 | 2633 | $reshook = $hookmanager->executeHooks('subtotalLineHtmlData',$parameters,$object,$action); // Note that $action and $object may have been modified by hook |
2489 | - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2634 | + if ($reshook < 0) { |
|
2635 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
2636 | + } |
|
2490 | 2637 | if ($reshook>0) |
2491 | 2638 | { |
2492 | 2639 | $ThtmlData = $hookmanager->resArray; |