Test Failed
Push — master ( 9d1fea...db7d4f )
by Alxarafe
49:25
created
dolibarr/htdocs/admin/dict.php 2 patches
Spacing   +263 added lines, -263 removed lines patch added patch discarded remove patch
@@ -26,24 +26,24 @@  discard block
 block discarded – undo
26 26
  * You should have received a copy of the GNU General Public License
27 27
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
28 28
  */
29
-require_once DOL_BASE_PATH . '/core/lib/functions2.lib.php';
29
+require_once DOL_BASE_PATH.'/core/lib/functions2.lib.php';
30 30
 
31 31
 /**
32 32
  * 	    \file       htdocs/admin/dict.php
33 33
  * 		\ingroup    setup
34 34
  * 		\brief      Page to administer data tables
35 35
  */
36
-require DOL_BASE_PATH . '/main.inc.php';
36
+require DOL_BASE_PATH.'/main.inc.php';
37 37
 
38
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formadmin.class.php';
39
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
40
-require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
41
-require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
42
-require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
43
-require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
38
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
39
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
40
+require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
41
+require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
42
+require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
43
+require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
44 44
 
45 45
 if (!empty($conf->accounting->enabled)) {
46
-    require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
46
+    require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
47 47
 }
48 48
 
49 49
 // Load translation files required by the page
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
 
59 59
 $allowed = $user->admin;
60 60
 if ($id == 7 && !empty($user->rights->accounting->chartofaccount)) {
61
-    $allowed = 1;     // Tax page allowed to manager of chart account
61
+    $allowed = 1; // Tax page allowed to manager of chart account
62 62
 }if ($id == 10 && !empty($user->rights->accounting->chartofaccount)) {
63
-    $allowed = 1;    // Vat page allowed to manager of chart account
63
+    $allowed = 1; // Vat page allowed to manager of chart account
64 64
 }if ($id == 17 && !empty($user->rights->accounting->chartofaccount)) {
65
-    $allowed = 1;    // Dictionary with type of expense report and accounting account allowed to manager of chart account
65
+    $allowed = 1; // Dictionary with type of expense report and accounting account allowed to manager of chart account
66 66
 }if (!$allowed) {
67 67
     accessforbidden();
68 68
 }
@@ -102,42 +102,42 @@  discard block
 block discarded – undo
102 102
 
103 103
 // Name of SQL tables of dictionaries
104 104
 $tabname = array();
105
-$tabname[1] = MAIN_DB_PREFIX . "c_forme_juridique";
106
-$tabname[2] = MAIN_DB_PREFIX . "c_departements";
107
-$tabname[3] = MAIN_DB_PREFIX . "c_regions";
108
-$tabname[4] = MAIN_DB_PREFIX . "c_country";
109
-$tabname[5] = MAIN_DB_PREFIX . "c_civility";
110
-$tabname[6] = MAIN_DB_PREFIX . "c_actioncomm";
111
-$tabname[7] = MAIN_DB_PREFIX . "c_chargesociales";
112
-$tabname[8] = MAIN_DB_PREFIX . "c_typent";
113
-$tabname[9] = MAIN_DB_PREFIX . "c_currencies";
114
-$tabname[10] = MAIN_DB_PREFIX . "c_tva";
115
-$tabname[11] = MAIN_DB_PREFIX . "c_type_contact";
116
-$tabname[12] = MAIN_DB_PREFIX . "c_payment_term";
117
-$tabname[13] = MAIN_DB_PREFIX . "c_paiement";
118
-$tabname[14] = MAIN_DB_PREFIX . "c_ecotaxe";
119
-$tabname[15] = MAIN_DB_PREFIX . "c_paper_format";
120
-$tabname[16] = MAIN_DB_PREFIX . "c_prospectlevel";
121
-$tabname[17] = MAIN_DB_PREFIX . "c_type_fees";
122
-$tabname[18] = MAIN_DB_PREFIX . "c_shipment_mode";
123
-$tabname[19] = MAIN_DB_PREFIX . "c_effectif";
124
-$tabname[20] = MAIN_DB_PREFIX . "c_input_method";
125
-$tabname[21] = MAIN_DB_PREFIX . "c_availability";
126
-$tabname[22] = MAIN_DB_PREFIX . "c_input_reason";
127
-$tabname[23] = MAIN_DB_PREFIX . "c_revenuestamp";
128
-$tabname[24] = MAIN_DB_PREFIX . "c_type_resource";
129
-$tabname[25] = MAIN_DB_PREFIX . "c_type_container";
130
-$tabname[26] = MAIN_DB_PREFIX . "c_units";
131
-$tabname[27] = MAIN_DB_PREFIX . "c_stcomm";
132
-$tabname[28] = MAIN_DB_PREFIX . "c_holiday_types";
133
-$tabname[29] = MAIN_DB_PREFIX . "c_lead_status";
134
-$tabname[30] = MAIN_DB_PREFIX . "c_format_cards";
105
+$tabname[1] = MAIN_DB_PREFIX."c_forme_juridique";
106
+$tabname[2] = MAIN_DB_PREFIX."c_departements";
107
+$tabname[3] = MAIN_DB_PREFIX."c_regions";
108
+$tabname[4] = MAIN_DB_PREFIX."c_country";
109
+$tabname[5] = MAIN_DB_PREFIX."c_civility";
110
+$tabname[6] = MAIN_DB_PREFIX."c_actioncomm";
111
+$tabname[7] = MAIN_DB_PREFIX."c_chargesociales";
112
+$tabname[8] = MAIN_DB_PREFIX."c_typent";
113
+$tabname[9] = MAIN_DB_PREFIX."c_currencies";
114
+$tabname[10] = MAIN_DB_PREFIX."c_tva";
115
+$tabname[11] = MAIN_DB_PREFIX."c_type_contact";
116
+$tabname[12] = MAIN_DB_PREFIX."c_payment_term";
117
+$tabname[13] = MAIN_DB_PREFIX."c_paiement";
118
+$tabname[14] = MAIN_DB_PREFIX."c_ecotaxe";
119
+$tabname[15] = MAIN_DB_PREFIX."c_paper_format";
120
+$tabname[16] = MAIN_DB_PREFIX."c_prospectlevel";
121
+$tabname[17] = MAIN_DB_PREFIX."c_type_fees";
122
+$tabname[18] = MAIN_DB_PREFIX."c_shipment_mode";
123
+$tabname[19] = MAIN_DB_PREFIX."c_effectif";
124
+$tabname[20] = MAIN_DB_PREFIX."c_input_method";
125
+$tabname[21] = MAIN_DB_PREFIX."c_availability";
126
+$tabname[22] = MAIN_DB_PREFIX."c_input_reason";
127
+$tabname[23] = MAIN_DB_PREFIX."c_revenuestamp";
128
+$tabname[24] = MAIN_DB_PREFIX."c_type_resource";
129
+$tabname[25] = MAIN_DB_PREFIX."c_type_container";
130
+$tabname[26] = MAIN_DB_PREFIX."c_units";
131
+$tabname[27] = MAIN_DB_PREFIX."c_stcomm";
132
+$tabname[28] = MAIN_DB_PREFIX."c_holiday_types";
133
+$tabname[29] = MAIN_DB_PREFIX."c_lead_status";
134
+$tabname[30] = MAIN_DB_PREFIX."c_format_cards";
135 135
 //$tabname[31]= MAIN_DB_PREFIX."accounting_system";
136 136
 //$tabname[32]= MAIN_DB_PREFIX."c_accounting_category";
137
-$tabname[33] = MAIN_DB_PREFIX . "c_hrm_department";
138
-$tabname[34] = MAIN_DB_PREFIX . "c_hrm_function";
139
-$tabname[35] = MAIN_DB_PREFIX . "c_exp_tax_cat";
140
-$tabname[36] = MAIN_DB_PREFIX . "c_exp_tax_range";
137
+$tabname[33] = MAIN_DB_PREFIX."c_hrm_department";
138
+$tabname[34] = MAIN_DB_PREFIX."c_hrm_function";
139
+$tabname[35] = MAIN_DB_PREFIX."c_exp_tax_cat";
140
+$tabname[36] = MAIN_DB_PREFIX."c_exp_tax_range";
141 141
 
142 142
 // Dictionary labels
143 143
 $tablib = array();
@@ -180,42 +180,42 @@  discard block
 block discarded – undo
180 180
 
181 181
 // Requests to extract data
182 182
 $tabsql = array();
183
-$tabsql[1] = "SELECT f.rowid as rowid, f.code, f.libelle, c.code as country_code, c.label as country, f.active FROM " . MAIN_DB_PREFIX . "c_forme_juridique as f, " . MAIN_DB_PREFIX . "c_country as c WHERE f.fk_pays=c.rowid";
184
-$tabsql[2] = "SELECT d.rowid as rowid, d.code_departement as code, d.nom as libelle, d.fk_region as region_id, r.nom as region, c.code as country_code, c.label as country, d.active FROM " . MAIN_DB_PREFIX . "c_departements as d, " . MAIN_DB_PREFIX . "c_regions as r, " . MAIN_DB_PREFIX . "c_country as c WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid and r.active=1 and c.active=1";
185
-$tabsql[3] = "SELECT r.rowid as rowid, r.code_region as code, r.nom as libelle, r.fk_pays as country_id, c.code as country_code, c.label as country, r.active FROM " . MAIN_DB_PREFIX . "c_regions as r, " . MAIN_DB_PREFIX . "c_country as c WHERE r.fk_pays=c.rowid and c.active=1";
186
-$tabsql[4] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.favorite FROM " . MAIN_DB_PREFIX . "c_country AS c";
187
-$tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM " . MAIN_DB_PREFIX . "c_civility AS c";
188
-$tabsql[6] = "SELECT a.id    as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM " . MAIN_DB_PREFIX . "c_actioncomm AS a";
189
-$tabsql[7] = "SELECT a.id    as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, a.deductible, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM " . MAIN_DB_PREFIX . "c_chargesociales AS a, " . MAIN_DB_PREFIX . "c_country as c WHERE a.fk_pays=c.rowid and c.active=1";
190
-$tabsql[8] = "SELECT t.id	 as rowid, t.code as code, t.libelle, t.fk_country as country_id, c.code as country_code, c.label as country, t.position, t.active FROM " . MAIN_DB_PREFIX . "c_typent as t LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON t.fk_country=c.rowid";
191
-$tabsql[9] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM " . MAIN_DB_PREFIX . "c_currencies AS c";
192
-$tabsql[10] = "SELECT t.rowid, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM " . MAIN_DB_PREFIX . "c_tva as t, " . MAIN_DB_PREFIX . "c_country as c WHERE t.fk_pays=c.rowid";
193
-$tabsql[11] = "SELECT t.rowid as rowid, t.element, t.source, t.code, t.libelle, t.position, t.active FROM " . MAIN_DB_PREFIX . "c_type_contact AS t";
194
-$tabsql[12] = "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder, c.entity FROM " . MAIN_DB_PREFIX . "c_payment_term AS c WHERE c.entity = " . getEntity($tabname[12]);
195
-$tabsql[13] = "SELECT c.id    as rowid, c.code, c.libelle, c.type, c.active, c.entity FROM " . MAIN_DB_PREFIX . "c_paiement AS c WHERE c.entity = " . getEntity($tabname[13]);
196
-$tabsql[14] = "SELECT e.rowid as rowid, e.code as code, e.label, e.price, e.organization, e.fk_pays as country_id, c.code as country_code, c.label as country, e.active FROM " . MAIN_DB_PREFIX . "c_ecotaxe AS e, " . MAIN_DB_PREFIX . "c_country as c WHERE e.fk_pays=c.rowid and c.active=1";
197
-$tabsql[15] = "SELECT rowid   as rowid, code, label as libelle, width, height, unit, active FROM " . MAIN_DB_PREFIX . "c_paper_format";
198
-$tabsql[16] = "SELECT code, label as libelle, sortorder, active FROM " . MAIN_DB_PREFIX . "c_prospectlevel";
199
-$tabsql[17] = "SELECT id      as rowid, code, label, accountancy_code, active FROM " . MAIN_DB_PREFIX . "c_type_fees";
200
-$tabsql[18] = "SELECT rowid   as rowid, code, libelle, tracking, active FROM " . MAIN_DB_PREFIX . "c_shipment_mode";
201
-$tabsql[19] = "SELECT id      as rowid, code, libelle, active FROM " . MAIN_DB_PREFIX . "c_effectif";
202
-$tabsql[20] = "SELECT rowid   as rowid, code, libelle, active FROM " . MAIN_DB_PREFIX . "c_input_method";
203
-$tabsql[21] = "SELECT c.rowid as rowid, code, label, active FROM " . MAIN_DB_PREFIX . "c_availability AS c";
204
-$tabsql[22] = "SELECT rowid   as rowid, code, label, active FROM " . MAIN_DB_PREFIX . "c_input_reason";
205
-$tabsql[23] = "SELECT t.rowid as rowid, t.taux, t.revenuestamp_type, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM " . MAIN_DB_PREFIX . "c_revenuestamp as t, " . MAIN_DB_PREFIX . "c_country as c WHERE t.fk_pays=c.rowid";
206
-$tabsql[24] = "SELECT rowid   as rowid, code, label, active FROM " . MAIN_DB_PREFIX . "c_type_resource";
207
-$tabsql[25] = "SELECT rowid   as rowid, code, label, active, module FROM " . MAIN_DB_PREFIX . "c_type_container as t WHERE t.entity IN (" . getEntity('c_type_container') . ")";
208
-$tabsql[26] = "SELECT rowid   as rowid, code, label, short_label, active FROM " . MAIN_DB_PREFIX . "c_units";
209
-$tabsql[27] = "SELECT id      as rowid, code, libelle, active FROM " . MAIN_DB_PREFIX . "c_stcomm";
210
-$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM " . MAIN_DB_PREFIX . "c_holiday_types as h LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON h.fk_country=c.rowid";
211
-$tabsql[29] = "SELECT rowid   as rowid, code, label, percent, position, active FROM " . MAIN_DB_PREFIX . "c_lead_status";
212
-$tabsql[30] = "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM " . MAIN_DB_PREFIX . "c_format_cards";
183
+$tabsql[1] = "SELECT f.rowid as rowid, f.code, f.libelle, c.code as country_code, c.label as country, f.active FROM ".MAIN_DB_PREFIX."c_forme_juridique as f, ".MAIN_DB_PREFIX."c_country as c WHERE f.fk_pays=c.rowid";
184
+$tabsql[2] = "SELECT d.rowid as rowid, d.code_departement as code, d.nom as libelle, d.fk_region as region_id, r.nom as region, c.code as country_code, c.label as country, d.active FROM ".MAIN_DB_PREFIX."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid and r.active=1 and c.active=1";
185
+$tabsql[3] = "SELECT r.rowid as rowid, r.code_region as code, r.nom as libelle, r.fk_pays as country_id, c.code as country_code, c.label as country, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE r.fk_pays=c.rowid and c.active=1";
186
+$tabsql[4] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.favorite FROM ".MAIN_DB_PREFIX."c_country AS c";
187
+$tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility AS c";
188
+$tabsql[6] = "SELECT a.id    as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a";
189
+$tabsql[7] = "SELECT a.id    as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, a.deductible, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays=c.rowid and c.active=1";
190
+$tabsql[8] = "SELECT t.id	 as rowid, t.code as code, t.libelle, t.fk_country as country_id, c.code as country_code, c.label as country, t.position, t.active FROM ".MAIN_DB_PREFIX."c_typent as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON t.fk_country=c.rowid";
191
+$tabsql[9] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX."c_currencies AS c";
192
+$tabsql[10] = "SELECT t.rowid, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
193
+$tabsql[11] = "SELECT t.rowid as rowid, t.element, t.source, t.code, t.libelle, t.position, t.active FROM ".MAIN_DB_PREFIX."c_type_contact AS t";
194
+$tabsql[12] = "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder, c.entity FROM ".MAIN_DB_PREFIX."c_payment_term AS c WHERE c.entity = ".getEntity($tabname[12]);
195
+$tabsql[13] = "SELECT c.id    as rowid, c.code, c.libelle, c.type, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_paiement AS c WHERE c.entity = ".getEntity($tabname[13]);
196
+$tabsql[14] = "SELECT e.rowid as rowid, e.code as code, e.label, e.price, e.organization, e.fk_pays as country_id, c.code as country_code, c.label as country, e.active FROM ".MAIN_DB_PREFIX."c_ecotaxe AS e, ".MAIN_DB_PREFIX."c_country as c WHERE e.fk_pays=c.rowid and c.active=1";
197
+$tabsql[15] = "SELECT rowid   as rowid, code, label as libelle, width, height, unit, active FROM ".MAIN_DB_PREFIX."c_paper_format";
198
+$tabsql[16] = "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectlevel";
199
+$tabsql[17] = "SELECT id      as rowid, code, label, accountancy_code, active FROM ".MAIN_DB_PREFIX."c_type_fees";
200
+$tabsql[18] = "SELECT rowid   as rowid, code, libelle, tracking, active FROM ".MAIN_DB_PREFIX."c_shipment_mode";
201
+$tabsql[19] = "SELECT id      as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_effectif";
202
+$tabsql[20] = "SELECT rowid   as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_input_method";
203
+$tabsql[21] = "SELECT c.rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_availability AS c";
204
+$tabsql[22] = "SELECT rowid   as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason";
205
+$tabsql[23] = "SELECT t.rowid as rowid, t.taux, t.revenuestamp_type, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
206
+$tabsql[24] = "SELECT rowid   as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource";
207
+$tabsql[25] = "SELECT rowid   as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity IN (".getEntity('c_type_container').")";
208
+$tabsql[26] = "SELECT rowid   as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
209
+$tabsql[27] = "SELECT id      as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_stcomm";
210
+$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
211
+$tabsql[29] = "SELECT rowid   as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status";
212
+$tabsql[30] = "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards";
213 213
 //$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s";
214 214
 //$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.sens, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
215
-$tabsql[33] = "SELECT rowid, pos, code, label, active FROM " . MAIN_DB_PREFIX . "c_hrm_department";
216
-$tabsql[34] = "SELECT rowid, pos, code, label, c_level, active FROM " . MAIN_DB_PREFIX . "c_hrm_function";
217
-$tabsql[35] = "SELECT c.rowid, c.label, c.active, c.entity FROM " . MAIN_DB_PREFIX . "c_exp_tax_cat c";
218
-$tabsql[36] = "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM " . MAIN_DB_PREFIX . "c_exp_tax_range r";
215
+$tabsql[33] = "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_hrm_department";
216
+$tabsql[34] = "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function";
217
+$tabsql[35] = "SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_cat c";
218
+$tabsql[36] = "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_range r";
219 219
 
220 220
 // Criteria to sort dictionaries
221 221
 $tabsqlsort = array();
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 $tabsqlsort[5] = "label ASC";
227 227
 $tabsqlsort[6] = "a.type ASC, a.module ASC, a.position ASC, a.code ASC";
228 228
 $tabsqlsort[7] = "country ASC, code ASC, a.libelle ASC";
229
-$tabsqlsort[8] = "country DESC," . (!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ' t.position ASC,' : '') . " libelle ASC";
229
+$tabsqlsort[8] = "country DESC,".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ' t.position ASC,' : '')." libelle ASC";
230 230
 $tabsqlsort[9] = "label ASC";
231 231
 $tabsqlsort[10] = "country ASC, code ASC, taux ASC, recuperableonly ASC, localtax1 ASC, localtax2 ASC";
232 232
 $tabsqlsort[11] = "t.element ASC, t.source ASC, t.position ASC, t.code ASC";
@@ -259,13 +259,13 @@  discard block
 block discarded – undo
259 259
 // Nom des champs en resultat de select pour affichage du dictionnaire
260 260
 $tabfield = array();
261 261
 $tabfield[1] = "code,libelle,country";
262
-$tabfield[2] = "code,libelle,region_id,region,country";   // "code,libelle,region,country_code-country"
262
+$tabfield[2] = "code,libelle,region_id,region,country"; // "code,libelle,region,country_code-country"
263 263
 $tabfield[3] = "code,libelle,country_id,country";
264 264
 $tabfield[4] = "code,label";
265 265
 $tabfield[5] = "code,label";
266 266
 $tabfield[6] = "code,libelle,type,color,position";
267 267
 $tabfield[7] = "code,libelle,country,accountancy_code,deductible";
268
-$tabfield[8] = "code,libelle,country_id,country" . (!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ',position' : '');
268
+$tabfield[8] = "code,libelle,country_id,country".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ',position' : '');
269 269
 $tabfield[9] = "code,label,unicode";
270 270
 $tabfield[10] = "country_id,country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
271 271
 $tabfield[11] = "element,source,code,libelle,position";
@@ -298,13 +298,13 @@  discard block
 block discarded – undo
298 298
 // Nom des champs d'edition pour modification d'un enregistrement
299 299
 $tabfieldvalue = array();
300 300
 $tabfieldvalue[1] = "code,libelle,country";
301
-$tabfieldvalue[2] = "code,libelle,region";   // "code,libelle,region"
301
+$tabfieldvalue[2] = "code,libelle,region"; // "code,libelle,region"
302 302
 $tabfieldvalue[3] = "code,libelle,country";
303 303
 $tabfieldvalue[4] = "code,label";
304 304
 $tabfieldvalue[5] = "code,label";
305 305
 $tabfieldvalue[6] = "code,libelle,type,color,position";
306 306
 $tabfieldvalue[7] = "code,libelle,country,accountancy_code,deductible";
307
-$tabfieldvalue[8] = "code,libelle,country" . (!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ',position' : '');
307
+$tabfieldvalue[8] = "code,libelle,country".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ',position' : '');
308 308
 $tabfieldvalue[9] = "code,label,unicode";
309 309
 $tabfieldvalue[10] = "country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
310 310
 $tabfieldvalue[11] = "element,source,code,libelle,position";
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 $tabfieldinsert[5] = "code,label";
344 344
 $tabfieldinsert[6] = "code,libelle,type,color,position";
345 345
 $tabfieldinsert[7] = "code,libelle,fk_pays,accountancy_code,deductible";
346
-$tabfieldinsert[8] = "code,libelle,fk_country" . (!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ',position' : '');
346
+$tabfieldinsert[8] = "code,libelle,fk_country".(!empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? ',position' : '');
347 347
 $tabfieldinsert[9] = "code_iso,label,unicode";
348 348
 $tabfieldinsert[10] = "fk_pays,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
349 349
 $tabfieldinsert[11] = "element,source,code,libelle,position";
@@ -585,12 +585,12 @@  discard block
 block discarded – undo
585 585
 if ($id == 10) {
586 586
     $localtax_typeList = array(
587 587
         "0" => $langs->trans("No"),
588
-        "1" => $langs->trans("Yes") . ' (' . $langs->trans("Type") . " 1)", //$langs->trans("%ageOnAllWithoutVAT"),
589
-        "2" => $langs->trans("Yes") . ' (' . $langs->trans("Type") . " 2)", //$langs->trans("%ageOnAllBeforeVAT"),
590
-        "3" => $langs->trans("Yes") . ' (' . $langs->trans("Type") . " 3)", //$langs->trans("%ageOnProductsWithoutVAT"),
591
-        "4" => $langs->trans("Yes") . ' (' . $langs->trans("Type") . " 4)", //$langs->trans("%ageOnProductsBeforeVAT"),
592
-        "5" => $langs->trans("Yes") . ' (' . $langs->trans("Type") . " 5)", //$langs->trans("%ageOnServiceWithoutVAT"),
593
-        "6" => $langs->trans("Yes") . ' (' . $langs->trans("Type") . " 6)" //$langs->trans("%ageOnServiceBeforeVAT"),
588
+        "1" => $langs->trans("Yes").' ('.$langs->trans("Type")." 1)", //$langs->trans("%ageOnAllWithoutVAT"),
589
+        "2" => $langs->trans("Yes").' ('.$langs->trans("Type")." 2)", //$langs->trans("%ageOnAllBeforeVAT"),
590
+        "3" => $langs->trans("Yes").' ('.$langs->trans("Type")." 3)", //$langs->trans("%ageOnProductsWithoutVAT"),
591
+        "4" => $langs->trans("Yes").' ('.$langs->trans("Type")." 4)", //$langs->trans("%ageOnProductsBeforeVAT"),
592
+        "5" => $langs->trans("Yes").' ('.$langs->trans("Type")." 5)", //$langs->trans("%ageOnServiceWithoutVAT"),
593
+        "6" => $langs->trans("Yes").' ('.$langs->trans("Type")." 6)" //$langs->trans("%ageOnServiceBeforeVAT"),
594 594
     );
595 595
 }
596 596
 
@@ -616,9 +616,9 @@  discard block
 block discarded – undo
616 616
     $ok = 1;
617 617
     foreach ($listfield as $f => $value) {
618 618
         if ($value == 'country_id' && in_array($tablib[$id], array('DictionaryVAT', 'DictionaryRegion', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp', 'DictionaryAccountancysystem', 'DictionaryAccountancyCategory')))
619
-            continue;  // For some pages, country is not mandatory
619
+            continue; // For some pages, country is not mandatory
620 620
         if ($value == 'country' && in_array($tablib[$id], array('DictionaryCanton', 'DictionaryCompanyType', 'DictionaryRevenueStamp')))
621
-            continue;  // For some pages, country is not mandatory
621
+            continue; // For some pages, country is not mandatory
622 622
         if ($value == 'localtax1' && empty($_POST['localtax1_type']))
623 623
             continue;
624 624
         if ($value == 'localtax2' && empty($_POST['localtax2_type']))
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
         if ($value == 'formula' && empty($_POST['formula']))
629 629
             continue;
630 630
         if ($value == 'sortorder')
631
-            continue;  // For a column name 'sortorder', we use the field name 'position'
631
+            continue; // For a column name 'sortorder', we use the field name 'position'
632 632
         if ((!isset($_POST[$value]) || $_POST[$value] == '') && (!in_array($listfield[$f], array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking'))  // Fields that are not mandatory
633 633
             && (!($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10
634 634
             )
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
         }
672 672
     }
673 673
     // Other checks
674
-    if (GETPOST('actionadd') && $tabname[$id] == MAIN_DB_PREFIX . "c_actioncomm" && isset($_POST["type"]) && in_array($_POST["type"], array('system', 'systemauto'))) {
674
+    if (GETPOST('actionadd') && $tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && isset($_POST["type"]) && in_array($_POST["type"], array('system', 'systemauto'))) {
675 675
         $ok = 0;
676 676
         setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors');
677 677
     }
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
         if ($tabrowid[$id]) {
720 720
             // Recupere id libre pour insertion
721 721
             $newid = 0;
722
-            $sql = "SELECT max(" . $tabrowid[$id] . ") newid from " . $tabname[$id];
722
+            $sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id];
723 723
             $result = $db->query($sql);
724 724
             if ($result) {
725 725
                 $obj = $db->fetch_object($result);
@@ -730,17 +730,17 @@  discard block
 block discarded – undo
730 730
         }
731 731
 
732 732
         // Add new entry
733
-        $sql = "INSERT INTO " . $tabname[$id] . " (";
733
+        $sql = "INSERT INTO ".$tabname[$id]." (";
734 734
         // List of fields
735 735
         if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert))
736
-            $sql .= $tabrowid[$id] . ",";
736
+            $sql .= $tabrowid[$id].",";
737 737
         $sql .= $tabfieldinsert[$id];
738 738
         $sql .= ",active)";
739 739
         $sql .= " VALUES(";
740 740
 
741 741
         // List of values
742 742
         if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert))
743
-            $sql .= $newid . ",";
743
+            $sql .= $newid.",";
744 744
         $i = 0;
745 745
         foreach ($listfieldinsert as $f => $value) {
746 746
             if ($value == 'price' || preg_match('/^amount/i', $value) || $value == 'taux') {
@@ -751,11 +751,11 @@  discard block
 block discarded – undo
751 751
             if ($i)
752 752
                 $sql .= ",";
753 753
             if ($listfieldvalue[$i] == 'sortorder') {  // For column name 'sortorder', we use the field name 'position'
754
-                $sql .= "'" . (int) $db->escape($_POST['position']) . "'";
754
+                $sql .= "'".(int) $db->escape($_POST['position'])."'";
755 755
             } elseif ($_POST[$listfieldvalue[$i]] == '' && !($listfieldvalue[$i] == 'code' && $id == 10))
756
-                $sql .= "null";  // For vat, we want/accept code = ''
756
+                $sql .= "null"; // For vat, we want/accept code = ''
757 757
             else
758
-                $sql .= "'" . $db->escape($_POST[$listfieldvalue[$i]]) . "'";
758
+                $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'";
759 759
             $i++;
760 760
         }
761 761
         $sql .= ",1)";
@@ -783,11 +783,11 @@  discard block
 block discarded – undo
783 783
         }
784 784
 
785 785
         // Modify entry
786
-        $sql = "UPDATE " . $tabname[$id] . " SET ";
786
+        $sql = "UPDATE ".$tabname[$id]." SET ";
787 787
         // Modifie valeur des champs
788 788
         if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldmodify)) {
789
-            $sql .= $tabrowid[$id] . "=";
790
-            $sql .= "'" . $db->escape($rowid) . "', ";
789
+            $sql .= $tabrowid[$id]."=";
790
+            $sql .= "'".$db->escape($rowid)."', ";
791 791
         }
792 792
         $i = 0;
793 793
         foreach ($listfieldmodify as $field) {
@@ -798,18 +798,18 @@  discard block
 block discarded – undo
798 798
             }
799 799
             if ($i)
800 800
                 $sql .= ",";
801
-            $sql .= $field . "=";
801
+            $sql .= $field."=";
802 802
             if ($listfieldvalue[$i] == 'sortorder') {  // For column name 'sortorder', we use the field name 'position'
803
-                $sql .= "'" . (int) $db->escape($_POST['position']) . "'";
803
+                $sql .= "'".(int) $db->escape($_POST['position'])."'";
804 804
             } elseif ($_POST[$listfieldvalue[$i]] == '' && !($listfieldvalue[$i] == 'code' && $id == 10))
805
-                $sql .= "null";  // For vat, we want/accept code = ''
805
+                $sql .= "null"; // For vat, we want/accept code = ''
806 806
             else
807
-                $sql .= "'" . $db->escape($_POST[$listfieldvalue[$i]]) . "'";
807
+                $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'";
808 808
             $i++;
809 809
         }
810
-        $sql .= " WHERE " . $rowidcol . " = '" . $rowid . "'";
810
+        $sql .= " WHERE ".$rowidcol." = '".$rowid."'";
811 811
         if (in_array('entity', $listfieldmodify))
812
-            $sql .= " AND entity = '" . getEntity($tabname[$id]) . "'";
812
+            $sql .= " AND entity = '".getEntity($tabname[$id])."'";
813 813
 
814 814
         dol_syslog("actionmodify", LOG_DEBUG);
815 815
         //print $sql;
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
         $rowidcol = "rowid";
833 833
     }
834 834
 
835
-    $sql = "DELETE FROM " . $tabname[$id] . " WHERE " . $rowidcol . "='" . $rowid . "'" . ($entity != '' ? " AND entity = " . (int) $entity : '');
835
+    $sql = "DELETE FROM ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = ".(int) $entity : '');
836 836
 
837 837
     dol_syslog("delete", LOG_DEBUG);
838 838
     $result = $db->query($sql);
@@ -854,9 +854,9 @@  discard block
 block discarded – undo
854 854
     }
855 855
 
856 856
     if ($rowid) {
857
-        $sql = "UPDATE " . $tabname[$id] . " SET active = 1 WHERE " . $rowidcol . "='" . $rowid . "'" . ($entity != '' ? " AND entity = " . (int) $entity : '');
857
+        $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = ".(int) $entity : '');
858 858
     } elseif ($code) {
859
-        $sql = "UPDATE " . $tabname[$id] . " SET active = 1 WHERE code='" . dol_escape_htmltag($code) . "'" . ($entity != '' ? " AND entity = " . (int) $entity : '');
859
+        $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
860 860
     }
861 861
 
862 862
     $result = $db->query($sql);
@@ -874,9 +874,9 @@  discard block
 block discarded – undo
874 874
     }
875 875
 
876 876
     if ($rowid) {
877
-        $sql = "UPDATE " . $tabname[$id] . " SET active = 0 WHERE " . $rowidcol . "='" . $rowid . "'" . ($entity != '' ? " AND entity = " . (int) $entity : '');
877
+        $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = ".(int) $entity : '');
878 878
     } elseif ($code) {
879
-        $sql = "UPDATE " . $tabname[$id] . " SET active = 0 WHERE code='" . dol_escape_htmltag($code) . "'" . ($entity != '' ? " AND entity = " . (int) $entity : '');
879
+        $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
880 880
     }
881 881
 
882 882
     $result = $db->query($sql);
@@ -894,9 +894,9 @@  discard block
 block discarded – undo
894 894
     }
895 895
 
896 896
     if ($rowid) {
897
-        $sql = "UPDATE " . $tabname[$id] . " SET favorite = 1 WHERE " . $rowidcol . "='" . $rowid . "'" . ($entity != '' ? " AND entity = " . (int) $entity : '');
897
+        $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = ".(int) $entity : '');
898 898
     } elseif ($code) {
899
-        $sql = "UPDATE " . $tabname[$id] . " SET favorite = 1 WHERE code='" . dol_escape_htmltag($code) . "'" . ($entity != '' ? " AND entity = " . (int) $entity : '');
899
+        $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
900 900
     }
901 901
 
902 902
     $result = $db->query($sql);
@@ -914,9 +914,9 @@  discard block
 block discarded – undo
914 914
     }
915 915
 
916 916
     if ($rowid) {
917
-        $sql = "UPDATE " . $tabname[$id] . " SET favorite = 0 WHERE " . $rowidcol . "='" . $rowid . "'" . ($entity != '' ? " AND entity = " . (int) $entity : '');
917
+        $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$rowid."'".($entity != '' ? " AND entity = ".(int) $entity : '');
918 918
     } elseif ($code) {
919
-        $sql = "UPDATE " . $tabname[$id] . " SET favorite = 0 WHERE code='" . dol_escape_htmltag($code) . "'" . ($entity != '' ? " AND entity = " . (int) $entity : '');
919
+        $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
920 920
     }
921 921
 
922 922
     $result = $db->query($sql);
@@ -938,8 +938,8 @@  discard block
 block discarded – undo
938 938
 $titre = $langs->trans("DictionarySetup");
939 939
 $linkback = '';
940 940
 if ($id) {
941
-    $titre .= ' - ' . $langs->trans($tablib[$id]);
942
-    $linkback = '<a href="' . $_SERVER['PHP_SELF'] . '">' . $langs->trans("BackToDictionaryList") . '</a>';
941
+    $titre .= ' - '.$langs->trans($tablib[$id]);
942
+    $linkback = '<a href="'.$_SERVER['PHP_SELF'].'">'.$langs->trans("BackToDictionaryList").'</a>';
943 943
 }
944 944
 $titlepicto = 'title_setup';
945 945
 if ($id == 10 && GETPOST('from') == 'accountancy') {
@@ -955,30 +955,30 @@  discard block
 block discarded – undo
955 955
 
956 956
 if (empty($id)) {
957 957
     print $langs->trans("DictionaryDesc");
958
-    print " " . $langs->trans("OnlyActiveElementsAreShown") . "<br>\n";
958
+    print " ".$langs->trans("OnlyActiveElementsAreShown")."<br>\n";
959 959
     print '<br>';
960 960
 }
961 961
 
962 962
 
963
-$param = '&id=' . urlencode($id);
963
+$param = '&id='.urlencode($id);
964 964
 if ($search_country_id > 0)
965
-    $param .= '&search_country_id=' . urlencode($search_country_id);
965
+    $param .= '&search_country_id='.urlencode($search_country_id);
966 966
 if ($search_code != '')
967
-    $param .= '&search_code=' . urlencode($search_country_id);
967
+    $param .= '&search_code='.urlencode($search_country_id);
968 968
 if ($entity != '')
969
-    $param .= '&entity=' . (int) $entity;
969
+    $param .= '&entity='.(int) $entity;
970 970
 $paramwithsearch = $param;
971 971
 if ($sortorder)
972
-    $paramwithsearch .= '&sortorder=' . urlencode($sortorder);
972
+    $paramwithsearch .= '&sortorder='.urlencode($sortorder);
973 973
 if ($sortfield)
974
-    $paramwithsearch .= '&sortfield=' . urlencode($sortfield);
974
+    $paramwithsearch .= '&sortfield='.urlencode($sortfield);
975 975
 if (GETPOST('from'))
976
-    $paramwithsearch .= '&from=' . urlencode(GETPOST('from', 'alpha'));
976
+    $paramwithsearch .= '&from='.urlencode(GETPOST('from', 'alpha'));
977 977
 
978 978
 
979 979
 // Confirmation de la suppression de la ligne
980 980
 if ($action == 'delete') {
981
-    print $form->formconfirm($_SERVER["PHP_SELF"] . '?' . ($page ? 'page=' . $page . '&' : '') . 'rowid=' . $rowid . '&code=' . urlencode($code) . $paramwithsearch, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
981
+    print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'rowid='.$rowid.'&code='.urlencode($code).$paramwithsearch, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
982 982
 }
983 983
 //var_dump($elementList);
984 984
 
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
     if (!preg_match('/ WHERE /', $sql))
993 993
         $sql .= " WHERE 1 = 1";
994 994
     if ($search_country_id > 0)
995
-        $sql .= " AND c.rowid = " . $search_country_id;
995
+        $sql .= " AND c.rowid = ".$search_country_id;
996 996
     if ($search_code != '' && $id != 9)
997 997
         $sql .= natural_search("code", $search_code);
998 998
     if ($search_code != '' && $id == 9)
@@ -1002,14 +1002,14 @@  discard block
 block discarded – undo
1002 1002
         // If sort order is "country", we use country_code instead
1003 1003
         if ($sortfield == 'country')
1004 1004
             $sortfield = 'country_code';
1005
-        $sql .= " ORDER BY " . $db->escape($sortfield);
1005
+        $sql .= " ORDER BY ".$db->escape($sortfield);
1006 1006
         if ($sortorder) {
1007
-            $sql .= " " . strtoupper($db->escape($sortorder));
1007
+            $sql .= " ".strtoupper($db->escape($sortorder));
1008 1008
         }
1009 1009
         $sql .= ", ";
1010 1010
         // Clear the required sort criteria for the tabsqlsort to be able to force it with selected value
1011
-        $tabsqlsort[$id] = preg_replace('/([a-z]+\.)?' . $sortfield . ' ' . $sortorder . ',/i', '', $tabsqlsort[$id]);
1012
-        $tabsqlsort[$id] = preg_replace('/([a-z]+\.)?' . $sortfield . ',/i', '', $tabsqlsort[$id]);
1011
+        $tabsqlsort[$id] = preg_replace('/([a-z]+\.)?'.$sortfield.' '.$sortorder.',/i', '', $tabsqlsort[$id]);
1012
+        $tabsqlsort[$id] = preg_replace('/([a-z]+\.)?'.$sortfield.',/i', '', $tabsqlsort[$id]);
1013 1013
     } else {
1014 1014
         $sql .= " ORDER BY ";
1015 1015
     }
@@ -1018,15 +1018,15 @@  discard block
 block discarded – undo
1018 1018
     //print $sql;
1019 1019
 
1020 1020
     if (empty($tabfield[$id])) {
1021
-        dol_print_error($db, 'The table with id ' . $id . ' has no array tabfield defined');
1021
+        dol_print_error($db, 'The table with id '.$id.' has no array tabfield defined');
1022 1022
         exit;
1023 1023
     }
1024 1024
     $fieldlist = explode(',', $tabfield[$id]);
1025 1025
 
1026 1026
     // print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
1027
-    print '<form href="' . BASE_URI . '?controller=admin&method=dict&id=' . $id . '" method="POST">';
1028
-    print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
1029
-    print '<input type="hidden" name="from" value="' . dol_escape_htmltag(GETPOST('from', 'alpha')) . '">';
1027
+    print '<form href="'.BASE_URI.'?controller=admin&method=dict&id='.$id.'" method="POST">';
1028
+    print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
1029
+    print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from', 'alpha')).'">';
1030 1030
 
1031 1031
     if ($id == 10 && empty($conf->global->FACTURE_TVAOPTION)) {
1032 1032
         print info_admin($langs->trans("VATIsUsedIsOff", $langs->transnoentities("Setup"), $langs->transnoentities("CompanyFoundation")));
@@ -1054,8 +1054,8 @@  discard block
 block discarded – undo
1054 1054
 
1055 1055
             // Determine le nom du champ par rapport aux noms possibles
1056 1056
             // dans les dictionnaires de donnees
1057
-            $valuetoshow = ucfirst($fieldlist[$field]);   // Par defaut
1058
-            $valuetoshow = $langs->trans($valuetoshow);   // try to translate
1057
+            $valuetoshow = ucfirst($fieldlist[$field]); // Par defaut
1058
+            $valuetoshow = $langs->trans($valuetoshow); // try to translate
1059 1059
             $class = '';
1060 1060
             if ($fieldlist[$field] == 'source') {
1061 1061
                 $valuetoshow = $langs->trans("Contact");
@@ -1064,28 +1064,28 @@  discard block
 block discarded – undo
1064 1064
                 $valuetoshow = $langs->trans("PriceUHT");
1065 1065
             }
1066 1066
             if ($fieldlist[$field] == 'taux') {
1067
-                if ($tabname[$id] != MAIN_DB_PREFIX . "c_revenuestamp")
1067
+                if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp")
1068 1068
                     $valuetoshow = $langs->trans("Rate");
1069 1069
                 else
1070 1070
                     $valuetoshow = $langs->trans("Amount");
1071 1071
                 $class = 'center';
1072 1072
             }
1073 1073
             if ($fieldlist[$field] == 'localtax1_type') {
1074
-                $valuetoshow = $langs->trans("UseLocalTax") . " 2";
1074
+                $valuetoshow = $langs->trans("UseLocalTax")." 2";
1075 1075
                 $class = "center";
1076 1076
                 $sortable = 0;
1077 1077
             }
1078 1078
             if ($fieldlist[$field] == 'localtax1') {
1079
-                $valuetoshow = $langs->trans("Rate") . " 2";
1079
+                $valuetoshow = $langs->trans("Rate")." 2";
1080 1080
                 $class = "center";
1081 1081
             }
1082 1082
             if ($fieldlist[$field] == 'localtax2_type') {
1083
-                $valuetoshow = $langs->trans("UseLocalTax") . " 3";
1083
+                $valuetoshow = $langs->trans("UseLocalTax")." 3";
1084 1084
                 $class = "center";
1085 1085
                 $sortable = 0;
1086 1086
             }
1087 1087
             if ($fieldlist[$field] == 'localtax2') {
1088
-                $valuetoshow = $langs->trans("Rate") . " 3";
1088
+                $valuetoshow = $langs->trans("Rate")." 3";
1089 1089
                 $class = "center";
1090 1090
             }
1091 1091
             if ($fieldlist[$field] == 'organization') {
@@ -1095,7 +1095,7 @@  discard block
 block discarded – undo
1095 1095
                 $valuetoshow = $langs->trans("Language");
1096 1096
             }
1097 1097
             if ($fieldlist[$field] == 'type') {
1098
-                if ($tabname[$id] == MAIN_DB_PREFIX . "c_paiement")
1098
+                if ($tabname[$id] == MAIN_DB_PREFIX."c_paiement")
1099 1099
                     $valuetoshow = $form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, ''));
1100 1100
                 else
1101 1101
                     $valuetoshow = $langs->trans("Type");
@@ -1240,15 +1240,15 @@  discard block
 block discarded – undo
1240 1240
                     $showfield = 1;
1241 1241
                 }
1242 1242
                 if ($fieldlist[$field] == 'region') {
1243
-                    $valuetoshow = $langs->trans("Country") . '/' . $langs->trans("Region");
1243
+                    $valuetoshow = $langs->trans("Country").'/'.$langs->trans("Region");
1244 1244
                     $showfield = 1;
1245 1245
                 }
1246 1246
             }
1247 1247
 
1248 1248
             if ($valuetoshow != '') {
1249
-                print '<td' . ($class ? ' class="' . $class . '"' : '') . '>';
1249
+                print '<td'.($class ? ' class="'.$class.'"' : '').'>';
1250 1250
                 if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value]))
1251
-                    print '<a href="' . $tabhelp[$id][$value] . '" target="_blank">' . $valuetoshow . ' ' . img_help(1, $valuetoshow) . '</a>';
1251
+                    print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
1252 1252
                 else if (!empty($tabhelp[$id][$value]))
1253 1253
                     print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
1254 1254
                 else
@@ -1262,9 +1262,9 @@  discard block
 block discarded – undo
1262 1262
         if ($id == 4)
1263 1263
             print '<td></td>';
1264 1264
         print '<td>';
1265
-        print '<input type="hidden" name="id" value="' . $id . '">';
1265
+        print '<input type="hidden" name="id" value="'.$id.'">';
1266 1266
         if (!is_null($withentity))
1267
-            print '<input type="hidden" name="entity" value="' . $withentity . '">';
1267
+            print '<input type="hidden" name="entity" value="'.$withentity.'">';
1268 1268
         print '</td>';
1269 1269
         print '<td style="min-width: 26px;"></td>';
1270 1270
         print '<td style="min-width: 26px;"></td>';
@@ -1284,7 +1284,7 @@  discard block
 block discarded – undo
1284 1284
 
1285 1285
         $tmpaction = 'create';
1286 1286
         $parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[$id]);
1287
-        $reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction);    // Note that $action and $object may have been modified by some hooks
1287
+        $reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
1288 1288
         $error = $hookmanager->error;
1289 1289
         $errors = $hookmanager->errors;
1290 1290
 
@@ -1299,7 +1299,7 @@  discard block
 block discarded – undo
1299 1299
             print '<td></td>';
1300 1300
         print '<td colspan="3" align="center">';
1301 1301
         if ($action != 'edit') {
1302
-            print '<input type="submit" class="button" name="actionadd" value="' . $langs->trans("Add") . '">';
1302
+            print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
1303 1303
         }
1304 1304
         print '</td>';
1305 1305
         print "</tr>";
@@ -1317,9 +1317,9 @@  discard block
 block discarded – undo
1317 1317
     print '<br>';
1318 1318
 
1319 1319
     // print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
1320
-    print '<form href="' . BASE_URI . '?controller=admin&method=dict&id=' . $id . '" method="POST">';
1321
-    print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
1322
-    print '<input type="hidden" name="from" value="' . dol_escape_htmltag(GETPOST('from', 'alpha')) . '">';
1320
+    print '<form href="'.BASE_URI.'?controller=admin&method=dict&id='.$id.'" method="POST">';
1321
+    print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
1322
+    print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from', 'alpha')).'">';
1323 1323
 
1324 1324
     // List of available record in database
1325 1325
     dol_syslog("htdocs/admin/dict", LOG_DEBUG);
@@ -1330,7 +1330,7 @@  discard block
 block discarded – undo
1330 1330
 
1331 1331
         // There is several pages
1332 1332
         if ($num > $listlimit || $page) {
1333
-            print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>' . $langs->trans("Page") . ' ' . ($page + 1) . '</span></li>');
1333
+            print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page + 1).'</span></li>');
1334 1334
             print '<div class="clearboth"></div>';
1335 1335
         }
1336 1336
 
@@ -1358,7 +1358,7 @@  discard block
 block discarded – undo
1358 1358
                     $filterfound++;
1359 1359
                 } elseif ($value == 'code') {
1360 1360
                     print '<td class="liste_titre">';
1361
-                    print '<input type="text" class="maxwidth100" name="search_code" value="' . dol_escape_htmltag($search_code) . '">';
1361
+                    print '<input type="text" class="maxwidth100" name="search_code" value="'.dol_escape_htmltag($search_code).'">';
1362 1362
                     print '</td>';
1363 1363
                     $filterfound++;
1364 1364
                 } else {
@@ -1386,7 +1386,7 @@  discard block
 block discarded – undo
1386 1386
 
1387 1387
             // Determine le nom du champ par rapport aux noms possibles
1388 1388
             // dans les dictionnaires de donnees
1389
-            $showfield = 1;          // By defaut
1389
+            $showfield = 1; // By defaut
1390 1390
             $align = "left";
1391 1391
             $sortable = 1;
1392 1392
             $valuetoshow = '';
@@ -1397,8 +1397,8 @@  discard block
 block discarded – undo
1397 1397
               $align=$tmp['align'];
1398 1398
               $sortable=$tmp['sortable'];
1399 1399
              */
1400
-            $valuetoshow = ucfirst($fieldlist[$field]);   // By defaut
1401
-            $valuetoshow = $langs->trans($valuetoshow);   // try to translate
1400
+            $valuetoshow = ucfirst($fieldlist[$field]); // By defaut
1401
+            $valuetoshow = $langs->trans($valuetoshow); // try to translate
1402 1402
             if ($fieldlist[$field] == 'source') {
1403 1403
                 $valuetoshow = $langs->trans("Contact");
1404 1404
             }
@@ -1406,29 +1406,29 @@  discard block
 block discarded – undo
1406 1406
                 $valuetoshow = $langs->trans("PriceUHT");
1407 1407
             }
1408 1408
             if ($fieldlist[$field] == 'taux') {
1409
-                if ($tabname[$id] != MAIN_DB_PREFIX . "c_revenuestamp")
1409
+                if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp")
1410 1410
                     $valuetoshow = $langs->trans("Rate");
1411 1411
                 else
1412 1412
                     $valuetoshow = $langs->trans("Amount");
1413 1413
                 $align = 'center';
1414 1414
             }
1415 1415
             if ($fieldlist[$field] == 'localtax1_type') {
1416
-                $valuetoshow = $langs->trans("UseLocalTax") . " 2";
1416
+                $valuetoshow = $langs->trans("UseLocalTax")." 2";
1417 1417
                 $align = "center";
1418 1418
                 $sortable = 0;
1419 1419
             }
1420 1420
             if ($fieldlist[$field] == 'localtax1') {
1421
-                $valuetoshow = $langs->trans("Rate") . " 2";
1421
+                $valuetoshow = $langs->trans("Rate")." 2";
1422 1422
                 $align = "center";
1423 1423
                 $sortable = 0;
1424 1424
             }
1425 1425
             if ($fieldlist[$field] == 'localtax2_type') {
1426
-                $valuetoshow = $langs->trans("UseLocalTax") . " 3";
1426
+                $valuetoshow = $langs->trans("UseLocalTax")." 3";
1427 1427
                 $align = "center";
1428 1428
                 $sortable = 0;
1429 1429
             }
1430 1430
             if ($fieldlist[$field] == 'localtax2') {
1431
-                $valuetoshow = $langs->trans("Rate") . " 3";
1431
+                $valuetoshow = $langs->trans("Rate")." 3";
1432 1432
                 $align = "center";
1433 1433
                 $sortable = 0;
1434 1434
             }
@@ -1578,14 +1578,14 @@  discard block
 block discarded – undo
1578 1578
 
1579 1579
             // Affiche nom du champ
1580 1580
             if ($showfield) {
1581
-                print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page=' . $page . '&' : ''), $param, "align=" . $align, $sortfield, $sortorder);
1581
+                print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, "align=".$align, $sortfield, $sortorder);
1582 1582
             }
1583 1583
         }
1584 1584
         // Favorite - Only activated on country dictionary
1585 1585
         if ($id == 4)
1586
-            print getTitleFieldOfList($langs->trans("Favorite"), 0, $_SERVER["PHP_SELF"], "favorite", ($page ? 'page=' . $page . '&' : ''), $param, 'align="center"', $sortfield, $sortorder);
1586
+            print getTitleFieldOfList($langs->trans("Favorite"), 0, $_SERVER["PHP_SELF"], "favorite", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder);
1587 1587
 
1588
-        print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page=' . $page . '&' : ''), $param, 'align="center"', $sortfield, $sortorder);
1588
+        print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder);
1589 1589
         print getTitleFieldOfList('');
1590 1590
         print getTitleFieldOfList('');
1591 1591
         print '</tr>';
@@ -1595,11 +1595,11 @@  discard block
 block discarded – undo
1595 1595
             while ($i < $num) {
1596 1596
                 $obj = $db->fetch_object($resql);
1597 1597
                 //print_r($obj);
1598
-                print '<tr class="oddeven" id="rowid-' . $obj->rowid . '">';
1598
+                print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
1599 1599
                 if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) {
1600 1600
                     $tmpaction = 'edit';
1601 1601
                     $parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[$id]);
1602
-                    $reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction);    // Note that $action and $object may have been modified by some hooks
1602
+                    $reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
1603 1603
                     $error = $hookmanager->error;
1604 1604
                     $errors = $hookmanager->errors;
1605 1605
 
@@ -1609,19 +1609,19 @@  discard block
 block discarded – undo
1609 1609
                     }
1610 1610
 
1611 1611
                     print '<td colspan="3" align="center">';
1612
-                    print '<div name="' . (!empty($obj->rowid) ? $obj->rowid : $obj->code) . '"></div>';
1613
-                    print '<input type="hidden" name="page" value="' . $page . '">';
1614
-                    print '<input type="hidden" name="rowid" value="' . $rowid . '">';
1612
+                    print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
1613
+                    print '<input type="hidden" name="page" value="'.$page.'">';
1614
+                    print '<input type="hidden" name="rowid" value="'.$rowid.'">';
1615 1615
                     if (!is_null($withentity))
1616
-                        print '<input type="hidden" name="entity" value="' . $withentity . '">';
1617
-                    print '<input type="submit" class="button" name="actionmodify" value="' . $langs->trans("Modify") . '">';
1618
-                    print '<input type="submit" class="button" name="actioncancel" value="' . $langs->trans("Cancel") . '">';
1616
+                        print '<input type="hidden" name="entity" value="'.$withentity.'">';
1617
+                    print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
1618
+                    print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
1619 1619
                     print '</td>';
1620 1620
                 }
1621 1621
                 else {
1622 1622
                     $tmpaction = 'view';
1623 1623
                     $parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[$id]);
1624
-                    $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction);    // Note that $action and $object may have been modified by some hooks
1624
+                    $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
1625 1625
 
1626 1626
                     $error = $hookmanager->error;
1627 1627
                     $errors = $hookmanager->errors;
@@ -1650,8 +1650,8 @@  discard block
 block discarded – undo
1650 1650
                                 if (empty($obj->country_code)) {
1651 1651
                                     $valuetoshow = '-';
1652 1652
                                 } else {
1653
-                                    $key = $langs->trans("Country" . strtoupper($obj->country_code));
1654
-                                    $valuetoshow = ($key != "Country" . strtoupper($obj->country_code) ? $obj->country_code . " - " . $key : $obj->country);
1653
+                                    $key = $langs->trans("Country".strtoupper($obj->country_code));
1654
+                                    $valuetoshow = ($key != "Country".strtoupper($obj->country_code) ? $obj->country_code." - ".$key : $obj->country);
1655 1655
                                 }
1656 1656
                             } else if ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
1657 1657
                                 $valuetoshow = yn($valuetoshow);
@@ -1672,58 +1672,58 @@  discard block
 block discarded – undo
1672 1672
                                 $valuetoshow = yn($elementList[$valuetoshow]);
1673 1673
                             } else if ($fieldlist[$field] == 'libelle_facture') {
1674 1674
                                 $langs->load("bills");
1675
-                                $key = $langs->trans("PaymentCondition" . strtoupper($obj->code));
1676
-                                $valuetoshow = ($obj->code && $key != "PaymentCondition" . strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1675
+                                $key = $langs->trans("PaymentCondition".strtoupper($obj->code));
1676
+                                $valuetoshow = ($obj->code && $key != "PaymentCondition".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1677 1677
                                 $valuetoshow = nl2br($valuetoshow);
1678
-                            } else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX . 'c_country') {
1679
-                                $key = $langs->trans("Country" . strtoupper($obj->code));
1680
-                                $valuetoshow = ($obj->code && $key != "Country" . strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1681
-                            } else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX . 'c_availability') {
1678
+                            } else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_country') {
1679
+                                $key = $langs->trans("Country".strtoupper($obj->code));
1680
+                                $valuetoshow = ($obj->code && $key != "Country".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1681
+                            } else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_availability') {
1682 1682
                                 $langs->load("propal");
1683
-                                $key = $langs->trans("AvailabilityType" . strtoupper($obj->code));
1684
-                                $valuetoshow = ($obj->code && $key != "AvailabilityType" . strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1685
-                            } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX . 'c_actioncomm') {
1686
-                                $key = $langs->trans("Action" . strtoupper($obj->code));
1687
-                                $valuetoshow = ($obj->code && $key != "Action" . strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1688
-                            } else if (!empty($obj->code_iso) && $fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX . 'c_currencies') {
1689
-                                $key = $langs->trans("Currency" . strtoupper($obj->code_iso));
1690
-                                $valuetoshow = ($obj->code_iso && $key != "Currency" . strtoupper($obj->code_iso) ? $key : $obj->{$fieldlist[$field]});
1691
-                            } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX . 'c_typent') {
1683
+                                $key = $langs->trans("AvailabilityType".strtoupper($obj->code));
1684
+                                $valuetoshow = ($obj->code && $key != "AvailabilityType".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1685
+                            } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_actioncomm') {
1686
+                                $key = $langs->trans("Action".strtoupper($obj->code));
1687
+                                $valuetoshow = ($obj->code && $key != "Action".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1688
+                            } else if (!empty($obj->code_iso) && $fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_currencies') {
1689
+                                $key = $langs->trans("Currency".strtoupper($obj->code_iso));
1690
+                                $valuetoshow = ($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso) ? $key : $obj->{$fieldlist[$field]});
1691
+                            } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_typent') {
1692 1692
                                 $key = $langs->trans(strtoupper($obj->code));
1693 1693
                                 $valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1694
-                            } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX . 'c_prospectlevel') {
1694
+                            } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_prospectlevel') {
1695 1695
                                 $key = $langs->trans(strtoupper($obj->code));
1696 1696
                                 $valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1697
-                            } else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX . 'c_civility') {
1698
-                                $key = $langs->trans("Civility" . strtoupper($obj->code));
1699
-                                $valuetoshow = ($obj->code && $key != "Civility" . strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1700
-                            } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX . 'c_type_contact') {
1697
+                            } else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_civility') {
1698
+                                $key = $langs->trans("Civility".strtoupper($obj->code));
1699
+                                $valuetoshow = ($obj->code && $key != "Civility".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1700
+                            } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_type_contact') {
1701 1701
                                 $langs->load('agenda');
1702
-                                $key = $langs->trans("TypeContact_" . $obj->element . "_" . $obj->source . "_" . strtoupper($obj->code));
1703
-                                $valuetoshow = ($obj->code && $key != "TypeContact_" . $obj->element . "_" . $obj->source . "_" . strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1704
-                            } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX . 'c_payment_term') {
1702
+                                $key = $langs->trans("TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code));
1703
+                                $valuetoshow = ($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1704
+                            } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_payment_term') {
1705 1705
                                 $langs->load("bills");
1706
-                                $key = $langs->trans("PaymentConditionShort" . strtoupper($obj->code));
1707
-                                $valuetoshow = ($obj->code && $key != "PaymentConditionShort" . strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1708
-                            } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX . 'c_paiement') {
1706
+                                $key = $langs->trans("PaymentConditionShort".strtoupper($obj->code));
1707
+                                $valuetoshow = ($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1708
+                            } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_paiement') {
1709 1709
                                 $langs->load("bills");
1710
-                                $key = $langs->trans("PaymentType" . strtoupper($obj->code));
1711
-                                $valuetoshow = ($obj->code && $key != "PaymentType" . strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1712
-                            } else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX . 'c_input_reason') {
1713
-                                $key = $langs->trans("DemandReasonType" . strtoupper($obj->code));
1714
-                                $valuetoshow = ($obj->code && $key != "DemandReasonType" . strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1715
-                            } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX . 'c_input_method') {
1710
+                                $key = $langs->trans("PaymentType".strtoupper($obj->code));
1711
+                                $valuetoshow = ($obj->code && $key != "PaymentType".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1712
+                            } else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_input_reason') {
1713
+                                $key = $langs->trans("DemandReasonType".strtoupper($obj->code));
1714
+                                $valuetoshow = ($obj->code && $key != "DemandReasonType".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1715
+                            } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_input_method') {
1716 1716
                                 $langs->load("orders");
1717 1717
                                 $key = $langs->trans($obj->code);
1718 1718
                                 $valuetoshow = ($obj->code && $key != $obj->code) ? $key : $obj->{$fieldlist[$field]};
1719
-                            } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX . 'c_shipment_mode') {
1719
+                            } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_shipment_mode') {
1720 1720
                                 $langs->load("sendings");
1721
-                                $key = $langs->trans("SendingMethod" . strtoupper($obj->code));
1722
-                                $valuetoshow = ($obj->code && $key != "SendingMethod" . strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1723
-                            } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX . 'c_paper_format') {
1724
-                                $key = $langs->trans('PaperFormat' . strtoupper($obj->code));
1725
-                                $valuetoshow = ($obj->code && $key != 'PaperFormat' . strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1726
-                            } else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX . 'c_type_fees') {
1721
+                                $key = $langs->trans("SendingMethod".strtoupper($obj->code));
1722
+                                $valuetoshow = ($obj->code && $key != "SendingMethod".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1723
+                            } else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_paper_format') {
1724
+                                $key = $langs->trans('PaperFormat'.strtoupper($obj->code));
1725
+                                $valuetoshow = ($obj->code && $key != 'PaperFormat'.strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
1726
+                            } else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_type_fees') {
1727 1727
                                 $langs->load('trips');
1728 1728
                                 $key = $langs->trans(strtoupper($obj->code));
1729 1729
                                 $valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
@@ -1731,15 +1731,15 @@  discard block
 block discarded – undo
1731 1731
                                 $showfield = 0;
1732 1732
                             } else if ($fieldlist[$field] == 'unicode') {
1733 1733
                                 $valuetoshow = $langs->getCurrencySymbol($obj->code, 1);
1734
-                            } else if ($fieldlist[$field] == 'label' && $tabname[$_GET["id"]] == MAIN_DB_PREFIX . 'c_units') {
1734
+                            } else if ($fieldlist[$field] == 'label' && $tabname[$_GET["id"]] == MAIN_DB_PREFIX.'c_units') {
1735 1735
                                 $langs->load("products");
1736 1736
                                 $valuetoshow = $langs->trans($obj->{$fieldlist[$field]});
1737
-                            } else if ($fieldlist[$field] == 'short_label' && $tabname[$_GET["id"]] == MAIN_DB_PREFIX . 'c_units') {
1737
+                            } else if ($fieldlist[$field] == 'short_label' && $tabname[$_GET["id"]] == MAIN_DB_PREFIX.'c_units') {
1738 1738
                                 $langs->load("products");
1739 1739
                                 $valuetoshow = $langs->trans($obj->{$fieldlist[$field]});
1740
-                            } else if (($fieldlist[$field] == 'unit') && ($tabname[$id] == MAIN_DB_PREFIX . 'c_paper_format')) {
1741
-                                $key = $langs->trans('SizeUnit' . strtolower($obj->unit));
1742
-                                $valuetoshow = ($obj->code && $key != 'SizeUnit' . strtolower($obj->unit) ? $key : $obj->{$fieldlist[$field]});
1740
+                            } else if (($fieldlist[$field] == 'unit') && ($tabname[$id] == MAIN_DB_PREFIX.'c_paper_format')) {
1741
+                                $key = $langs->trans('SizeUnit'.strtolower($obj->unit));
1742
+                                $valuetoshow = ($obj->code && $key != 'SizeUnit'.strtolower($obj->unit) ? $key : $obj->{$fieldlist[$field]});
1743 1743
                             } else if ($fieldlist[$field] == 'localtax1' || $fieldlist[$field] == 'localtax2') {
1744 1744
                                 $align = "center";
1745 1745
                             } else if ($fieldlist[$field] == 'localtax1_type') {
@@ -1771,9 +1771,9 @@  discard block
 block discarded – undo
1771 1771
                                     }
1772 1772
                                 }
1773 1773
                             } elseif ($fieldlist[$field] == 'fk_c_exp_tax_cat') {
1774
-                                $valuetoshow = getDictvalue(MAIN_DB_PREFIX . 'c_exp_tax_cat', 'label', $valuetoshow);
1774
+                                $valuetoshow = getDictvalue(MAIN_DB_PREFIX.'c_exp_tax_cat', 'label', $valuetoshow);
1775 1775
                                 $valuetoshow = $langs->trans($valuetoshow);
1776
-                            } elseif ($tabname[$id] == MAIN_DB_PREFIX . 'c_exp_tax_cat') {
1776
+                            } elseif ($tabname[$id] == MAIN_DB_PREFIX.'c_exp_tax_cat') {
1777 1777
                                 $valuetoshow = $langs->trans($valuetoshow);
1778 1778
                             }
1779 1779
 
@@ -1792,7 +1792,7 @@  discard block
 block discarded – undo
1792 1792
                                 $class .= ' nowrap';
1793 1793
                             // Show value for field
1794 1794
                             if ($showfield)
1795
-                                print '<!-- ' . $fieldlist[$field] . ' --><td align="' . $align . '" class="' . $class . '">' . $valuetoshow . '</td>';
1795
+                                print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
1796 1796
                         }
1797 1797
                     }
1798 1798
 
@@ -1823,7 +1823,7 @@  discard block
 block discarded – undo
1823 1823
                     $canbemodified = $iserasable;
1824 1824
                     if ($obj->code == 'RECEP')
1825 1825
                         $canbemodified = 1;
1826
-                    if ($tabname[$id] == MAIN_DB_PREFIX . "c_actioncomm")
1826
+                    if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm")
1827 1827
                         $canbemodified = 1;
1828 1828
 
1829 1829
                     // Url
@@ -1831,11 +1831,11 @@  discard block
 block discarded – undo
1831 1831
                     // If rowidcol not defined
1832 1832
                     if (empty($rowidcol) || in_array($id, array(6, 7, 8, 13, 17, 19, 27)))
1833 1833
                         $rowidcol = 'rowid';
1834
-                    $url = $_SERVER["PHP_SELF"] . '?' . ($page ? 'page=' . $page . '&' : '') . 'sortfield=' . $sortfield . '&sortorder=' . $sortorder . '&rowid=' . ((!empty($obj->{$rowidcol}) || $obj->{$rowidcol} == '0') ? $obj->{$rowidcol} : (!empty($obj->code) ? urlencode($obj->code) : '')) . '&code=' . (!empty($obj->code) ? urlencode($obj->code) : '');
1834
+                    $url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.((!empty($obj->{$rowidcol}) || $obj->{$rowidcol} == '0') ? $obj->{$rowidcol} : (!empty($obj->code) ? urlencode($obj->code) : '')).'&code='.(!empty($obj->code) ? urlencode($obj->code) : '');
1835 1835
                     if (!empty($param))
1836
-                        $url .= '&' . $param;
1836
+                        $url .= '&'.$param;
1837 1837
                     if (!is_null($withentity))
1838
-                        $url .= '&entity=' . $withentity;
1838
+                        $url .= '&entity='.$withentity;
1839 1839
                     $url .= '&';
1840 1840
 
1841 1841
                     // Favorite
@@ -1843,7 +1843,7 @@  discard block
 block discarded – undo
1843 1843
                     if ($id == 4) {
1844 1844
                         print '<td align="center" class="nowrap">';
1845 1845
                         if ($iserasable)
1846
-                            print '<a href="' . $url . 'action=' . $acts[$obj->favorite] . '_favorite">' . $actl[$obj->favorite] . '</a>';
1846
+                            print '<a href="'.$url.'action='.$acts[$obj->favorite].'_favorite">'.$actl[$obj->favorite].'</a>';
1847 1847
                         else
1848 1848
                             print $langs->trans("AlwaysActive");
1849 1849
                         print '</td>';
@@ -1852,7 +1852,7 @@  discard block
 block discarded – undo
1852 1852
                     // Active
1853 1853
                     print '<td align="center" class="nowrap">';
1854 1854
                     if ($canbedisabled)
1855
-                        print '<a href="' . $url . 'action=' . $acts[$obj->active] . '">' . $actl[$obj->active] . '</a>';
1855
+                        print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
1856 1856
                     else {
1857 1857
                         if (in_array($obj->code, array('AC_OTH', 'AC_OTH_AUTO')))
1858 1858
                             print $langs->trans("AlwaysActive");
@@ -1867,7 +1867,7 @@  discard block
 block discarded – undo
1867 1867
 
1868 1868
                     // Modify link
1869 1869
                     if ($canbemodified)
1870
-                        print '<td align="center"><a class="reposition" href="' . $url . 'action=edit">' . img_edit() . '</a></td>';
1870
+                        print '<td align="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>';
1871 1871
                     else
1872 1872
                         print '<td>&nbsp;</td>';
1873 1873
 
@@ -1875,7 +1875,7 @@  discard block
 block discarded – undo
1875 1875
                     if ($iserasable) {
1876 1876
                         print '<td align="center">';
1877 1877
                         if ($user->admin)
1878
-                            print '<a href="' . $url . 'action=delete">' . img_delete() . '</a>';
1878
+                            print '<a href="'.$url.'action=delete">'.img_delete().'</a>';
1879 1879
                         //else print '<a href="#">'.img_delete().'</a>';    // Some dictionary can be edited by other profile than admin
1880 1880
                         print '</td>';
1881 1881
                     } else
@@ -1907,8 +1907,8 @@  discard block
 block discarded – undo
1907 1907
     print '<table class="noborder" width="100%">';
1908 1908
     print '<tr class="liste_titre">';
1909 1909
     //print '<td>'.$langs->trans("Module").'</td>';
1910
-    print '<td colspan="2">' . $langs->trans("Dictionary") . '</td>';
1911
-    print '<td>' . $langs->trans("Table") . '</td>';
1910
+    print '<td colspan="2">'.$langs->trans("Dictionary").'</td>';
1911
+    print '<td>'.$langs->trans("Table").'</td>';
1912 1912
     print '</tr>';
1913 1913
 
1914 1914
     $showemptyline = '';
@@ -1927,7 +1927,7 @@  discard block
 block discarded – undo
1927 1927
             $value = $tabname[$i];
1928 1928
             print '<tr class="oddeven"><td width="50%">';
1929 1929
             if (!empty($tabcond[$i])) {
1930
-                print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $i . '">' . $langs->trans($tablib[$i]) . '</a>';
1930
+                print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$i.'">'.$langs->trans($tablib[$i]).'</a>';
1931 1931
             } else {
1932 1932
                 print $langs->trans($tablib[$i]);
1933 1933
             }
@@ -1938,7 +1938,7 @@  discard block
 block discarded – undo
1938 1938
               print info_admin($langs->trans("DictionaryDisabledSinceNoModuleNeedIt"),1);
1939 1939
               } */
1940 1940
             print '</td>';
1941
-            print '<td>' . $tabname[$i] . '</td></tr>';
1941
+            print '<td>'.$tabname[$i].'</td></tr>';
1942 1942
             $lastlineisempty = false;
1943 1943
         } else {
1944 1944
             if (!$lastlineisempty) {
@@ -1987,10 +1987,10 @@  discard block
 block discarded – undo
1987 1987
             continue;
1988 1988
         }
1989 1989
 
1990
-        if (in_array($fieldlist[$field], array('code', 'libelle', 'type')) && $tabname == MAIN_DB_PREFIX . "c_actioncomm" && in_array($obj->type, array('system', 'systemauto'))) {
1990
+        if (in_array($fieldlist[$field], array('code', 'libelle', 'type')) && $tabname == MAIN_DB_PREFIX."c_actioncomm" && in_array($obj->type, array('system', 'systemauto'))) {
1991 1991
             $hidden = (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '');
1992 1992
             print '<td>';
1993
-            print '<input type="hidden" name="' . $fieldlist[$field] . '" value="' . $hidden . '">';
1993
+            print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$hidden.'">';
1994 1994
             print $langs->trans($hidden);
1995 1995
             print '</td>';
1996 1996
         } elseif ($fieldlist[$field] == 'country') {
@@ -2008,7 +2008,7 @@  discard block
 block discarded – undo
2008 2008
             if (!in_array('country', $fieldlist)) { // If there is already a field country, we don't show country_id (avoid duplicate)
2009 2009
                 $country_id = (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : 0);
2010 2010
                 print '<td class="tdoverflowmax100">';
2011
-                print '<input type="hidden" name="' . $fieldlist[$field] . '" value="' . $country_id . '">';
2011
+                print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$country_id.'">';
2012 2012
                 print '</td>';
2013 2013
             }
2014 2014
         } elseif ($fieldlist[$field] == 'region') {
@@ -2018,7 +2018,7 @@  discard block
 block discarded – undo
2018 2018
         } elseif ($fieldlist[$field] == 'region_id') {
2019 2019
             $region_id = (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : 0);
2020 2020
             print '<td>';
2021
-            print '<input type="hidden" name="' . $fieldlist[$field] . '" value="' . $region_id . '">';
2021
+            print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$region_id.'">';
2022 2022
             print '</td>';
2023 2023
         } elseif ($fieldlist[$field] == 'lang') {
2024 2024
             print '<td>';
@@ -2040,10 +2040,10 @@  discard block
 block discarded – undo
2040 2040
             print '<td>';
2041 2041
             print $form->selectyesno("private", (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : ''));
2042 2042
             print '</td>';
2043
-        } elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX . "c_actioncomm") {
2043
+        } elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX."c_actioncomm") {
2044 2044
             $type = (!empty($obj->type) ? $obj->type : 'user'); // Check if type is different of 'user' (external module)
2045 2045
             print '<td>';
2046
-            print $type . '<input type="hidden" name="type" value="' . $type . '">';
2046
+            print $type.'<input type="hidden" name="type" value="'.$type.'">';
2047 2047
             print '</td>';
2048 2048
         } elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'type_cdr' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
2049 2049
             if ($fieldlist[$field] == 'type_cdr')
@@ -2060,30 +2060,30 @@  discard block
 block discarded – undo
2060 2060
             $align = "left";
2061 2061
             if (in_array($fieldlist[$field], array('taux', 'localtax1', 'localtax2')))
2062 2062
                 $align = "center"; // Fields aligned on right
2063
-            print '<td align="' . $align . '">';
2064
-            print '<input type="text" class="flat" value="' . (isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '') . '" size="3" name="' . $fieldlist[$field] . '">';
2063
+            print '<td align="'.$align.'">';
2064
+            print '<input type="text" class="flat" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" size="3" name="'.$fieldlist[$field].'">';
2065 2065
             print '</td>';
2066 2066
         }
2067 2067
         elseif (in_array($fieldlist[$field], array('libelle_facture'))) {
2068 2068
             print '<td>';
2069 2069
             $transfound = 0;
2070 2070
             // Special case for labels
2071
-            if ($tabname == MAIN_DB_PREFIX . 'c_payment_term') {
2071
+            if ($tabname == MAIN_DB_PREFIX.'c_payment_term') {
2072 2072
                 $langs->load("bills");
2073
-                $transkey = "PaymentCondition" . strtoupper($obj->code);
2073
+                $transkey = "PaymentCondition".strtoupper($obj->code);
2074 2074
                 if ($langs->trans($transkey) != $transkey) {
2075 2075
                     $transfound = 1;
2076 2076
                     print $form->textwithpicto($langs->trans($transkey), $langs->trans("GoIntoTranslationMenuToChangeThis"));
2077 2077
                 }
2078 2078
             }
2079 2079
             if (!$transfound) {
2080
-                print '<textarea cols="30" rows="' . ROWS_2 . '" class="flat" name="' . $fieldlist[$field] . '">' . (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '') . '</textarea>';
2080
+                print '<textarea cols="30" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'</textarea>';
2081 2081
             }
2082 2082
             print '</td>';
2083 2083
         } elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i', $fieldlist[$field])) {
2084
-            print '<td><input type="text" class="flat minwidth75" value="' . price((!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '')) . '" name="' . $fieldlist[$field] . '"></td>';
2084
+            print '<td><input type="text" class="flat minwidth75" value="'.price((!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '')).'" name="'.$fieldlist[$field].'"></td>';
2085 2085
         } elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
2086
-            print '<td class="maxxxx"><input type="text" class="flat minwidth75" value="' . (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '') . '" name="' . $fieldlist[$field] . '"></td>';
2086
+            print '<td class="maxxxx"><input type="text" class="flat minwidth75" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" name="'.$fieldlist[$field].'"></td>';
2087 2087
         } elseif ($fieldlist[$field] == 'unit') {
2088 2088
             print '<td>';
2089 2089
             $units = array(
@@ -2105,10 +2105,10 @@  discard block
 block discarded – undo
2105 2105
             if (!empty($conf->accounting->enabled)) {
2106 2106
                 $fieldname = $fieldlist[$field];
2107 2107
                 $accountancy_account = (!empty($obj->$fieldname) ? $obj->$fieldname : 0);
2108
-                print $formaccounting->select_account($accountancy_account, '.' . $fieldlist[$field], 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone');
2108
+                print $formaccounting->select_account($accountancy_account, '.'.$fieldlist[$field], 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone');
2109 2109
             } else {
2110 2110
                 $fieldname = $fieldlist[$field];
2111
-                print '<input type="text" size="10" class="flat" value="' . (isset($obj->$fieldname) ? $obj->$fieldname : '') . '" name="' . $fieldlist[$field] . '">';
2111
+                print '<input type="text" size="10" class="flat" value="'.(isset($obj->$fieldname) ? $obj->$fieldname : '').'" name="'.$fieldlist[$field].'">';
2112 2112
             }
2113 2113
             print '</td>';
2114 2114
         } elseif ($fieldlist[$field] == 'fk_tva') {
@@ -2143,17 +2143,17 @@  discard block
 block discarded – undo
2143 2143
                 $class = 'quatrevingtpercent';
2144 2144
             if ($fieldlist[$field] == 'sortorder' || $fieldlist[$field] == 'sens' || $fieldlist[$field] == 'category_type')
2145 2145
                 $class = 'maxwidth50';
2146
-            print '<td class="' . $classtd . '">';
2146
+            print '<td class="'.$classtd.'">';
2147 2147
             $transfound = 0;
2148 2148
             if (in_array($fieldlist[$field], array('label', 'libelle'))) {
2149 2149
                 $transkey = '';
2150 2150
                 // Special case for labels
2151
-                if ($tabname == MAIN_DB_PREFIX . 'c_civility') {
2152
-                    $transkey = "Civility" . strtoupper($obj->code);
2151
+                if ($tabname == MAIN_DB_PREFIX.'c_civility') {
2152
+                    $transkey = "Civility".strtoupper($obj->code);
2153 2153
                 }
2154
-                if ($tabname == MAIN_DB_PREFIX . 'c_payment_term') {
2154
+                if ($tabname == MAIN_DB_PREFIX.'c_payment_term') {
2155 2155
                     $langs->load("bills");
2156
-                    $transkey = "PaymentCondition" . strtoupper($obj->code);
2156
+                    $transkey = "PaymentCondition".strtoupper($obj->code);
2157 2157
                 }
2158 2158
                 if ($transkey && $langs->trans($transkey) != $transkey) {
2159 2159
                     $transfound = 1;
@@ -2161,7 +2161,7 @@  discard block
 block discarded – undo
2161 2161
                 }
2162 2162
             }
2163 2163
             if (!$transfound) {
2164
-                print '<input type="text" class="flat' . ($class ? ' ' . $class : '') . '" value="' . (isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '') . '" name="' . $fieldlist[$field] . '">';
2164
+                print '<input type="text" class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" name="'.$fieldlist[$field].'">';
2165 2165
             }
2166 2166
             print '</td>';
2167 2167
         }
Please login to merge, or discard this patch.
Braces   +333 added lines, -231 removed lines patch added patch discarded remove patch
@@ -568,8 +568,9 @@  discard block
 block discarded – undo
568 568
         'fichinter' => $langs->trans('InterventionCard'),
569 569
         'contrat' => $langs->trans('Contract')
570 570
     );
571
-    if (!empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES))
572
-        $elementList["societe"] = $langs->trans('ThirdParty');
571
+    if (!empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) {
572
+            $elementList["societe"] = $langs->trans('ThirdParty');
573
+    }
573 574
 
574 575
     complete_elementList_with_modules($elementList);
575 576
 
@@ -615,20 +616,30 @@  discard block
 block discarded – undo
615 616
     // Check that all fields are filled
616 617
     $ok = 1;
617 618
     foreach ($listfield as $f => $value) {
618
-        if ($value == 'country_id' && in_array($tablib[$id], array('DictionaryVAT', 'DictionaryRegion', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp', 'DictionaryAccountancysystem', 'DictionaryAccountancyCategory')))
619
-            continue;  // For some pages, country is not mandatory
620
-        if ($value == 'country' && in_array($tablib[$id], array('DictionaryCanton', 'DictionaryCompanyType', 'DictionaryRevenueStamp')))
621
-            continue;  // For some pages, country is not mandatory
622
-        if ($value == 'localtax1' && empty($_POST['localtax1_type']))
623
-            continue;
624
-        if ($value == 'localtax2' && empty($_POST['localtax2_type']))
625
-            continue;
626
-        if ($value == 'color' && empty($_POST['color']))
627
-            continue;
628
-        if ($value == 'formula' && empty($_POST['formula']))
629
-            continue;
630
-        if ($value == 'sortorder')
631
-            continue;  // For a column name 'sortorder', we use the field name 'position'
619
+        if ($value == 'country_id' && in_array($tablib[$id], array('DictionaryVAT', 'DictionaryRegion', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp', 'DictionaryAccountancysystem', 'DictionaryAccountancyCategory'))) {
620
+                    continue;
621
+        }
622
+        // For some pages, country is not mandatory
623
+        if ($value == 'country' && in_array($tablib[$id], array('DictionaryCanton', 'DictionaryCompanyType', 'DictionaryRevenueStamp'))) {
624
+                    continue;
625
+        }
626
+        // For some pages, country is not mandatory
627
+        if ($value == 'localtax1' && empty($_POST['localtax1_type'])) {
628
+                    continue;
629
+        }
630
+        if ($value == 'localtax2' && empty($_POST['localtax2_type'])) {
631
+                    continue;
632
+        }
633
+        if ($value == 'color' && empty($_POST['color'])) {
634
+                    continue;
635
+        }
636
+        if ($value == 'formula' && empty($_POST['formula'])) {
637
+                    continue;
638
+        }
639
+        if ($value == 'sortorder') {
640
+                    continue;
641
+        }
642
+        // For a column name 'sortorder', we use the field name 'position'
632 643
         if ((!isset($_POST[$value]) || $_POST[$value] == '') && (!in_array($listfield[$f], array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking'))  // Fields that are not mandatory
633 644
             && (!($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10
634 645
             )
@@ -636,36 +647,51 @@  discard block
 block discarded – undo
636 647
             $ok = 0;
637 648
             $fieldnamekey = $listfield[$f];
638 649
             // We take translate key of field
639
-            if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label'))
640
-                $fieldnamekey = 'Label';
641
-            if ($fieldnamekey == 'libelle_facture')
642
-                $fieldnamekey = 'LabelOnDocuments';
643
-            if ($fieldnamekey == 'nbjour')
644
-                $fieldnamekey = 'NbOfDays';
645
-            if ($fieldnamekey == 'decalage')
646
-                $fieldnamekey = 'Offset';
647
-            if ($fieldnamekey == 'module')
648
-                $fieldnamekey = 'Module';
649
-            if ($fieldnamekey == 'code')
650
-                $fieldnamekey = 'Code';
651
-            if ($fieldnamekey == 'note')
652
-                $fieldnamekey = 'Note';
653
-            if ($fieldnamekey == 'taux')
654
-                $fieldnamekey = 'Rate';
655
-            if ($fieldnamekey == 'type')
656
-                $fieldnamekey = 'Type';
657
-            if ($fieldnamekey == 'position')
658
-                $fieldnamekey = 'Position';
659
-            if ($fieldnamekey == 'unicode')
660
-                $fieldnamekey = 'Unicode';
661
-            if ($fieldnamekey == 'deductible')
662
-                $fieldnamekey = 'Deductible';
663
-            if ($fieldnamekey == 'sortorder')
664
-                $fieldnamekey = 'SortOrder';
665
-            if ($fieldnamekey == 'category_type')
666
-                $fieldnamekey = 'Calculated';
667
-            if ($fieldnamekey == 'revenuestamp_type')
668
-                $fieldnamekey = 'TypeOfRevenueStamp';
650
+            if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) {
651
+                            $fieldnamekey = 'Label';
652
+            }
653
+            if ($fieldnamekey == 'libelle_facture') {
654
+                            $fieldnamekey = 'LabelOnDocuments';
655
+            }
656
+            if ($fieldnamekey == 'nbjour') {
657
+                            $fieldnamekey = 'NbOfDays';
658
+            }
659
+            if ($fieldnamekey == 'decalage') {
660
+                            $fieldnamekey = 'Offset';
661
+            }
662
+            if ($fieldnamekey == 'module') {
663
+                            $fieldnamekey = 'Module';
664
+            }
665
+            if ($fieldnamekey == 'code') {
666
+                            $fieldnamekey = 'Code';
667
+            }
668
+            if ($fieldnamekey == 'note') {
669
+                            $fieldnamekey = 'Note';
670
+            }
671
+            if ($fieldnamekey == 'taux') {
672
+                            $fieldnamekey = 'Rate';
673
+            }
674
+            if ($fieldnamekey == 'type') {
675
+                            $fieldnamekey = 'Type';
676
+            }
677
+            if ($fieldnamekey == 'position') {
678
+                            $fieldnamekey = 'Position';
679
+            }
680
+            if ($fieldnamekey == 'unicode') {
681
+                            $fieldnamekey = 'Unicode';
682
+            }
683
+            if ($fieldnamekey == 'deductible') {
684
+                            $fieldnamekey = 'Deductible';
685
+            }
686
+            if ($fieldnamekey == 'sortorder') {
687
+                            $fieldnamekey = 'SortOrder';
688
+            }
689
+            if ($fieldnamekey == 'category_type') {
690
+                            $fieldnamekey = 'Calculated';
691
+            }
692
+            if ($fieldnamekey == 'revenuestamp_type') {
693
+                            $fieldnamekey = 'TypeOfRevenueStamp';
694
+            }
669 695
 
670 696
             setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
671 697
         }
@@ -700,16 +726,26 @@  discard block
 block discarded – undo
700 726
     }
701 727
 
702 728
     // Clean some parameters
703
-    if ((!empty($_POST["localtax1_type"]) || ($_POST['localtax1_type'] == '0')) && empty($_POST["localtax1"]))
704
-        $_POST["localtax1"] = '0'; // If empty, we force to 0
705
-    if ((!empty($_POST["localtax2_type"]) || ($_POST['localtax2_type'] == '0')) && empty($_POST["localtax2"]))
706
-        $_POST["localtax2"] = '0'; // If empty, we force to 0
707
-    if ($_POST["accountancy_code"] <= 0)
708
-        $_POST["accountancy_code"] = ''; // If empty, we force to null
709
-    if ($_POST["accountancy_code_sell"] <= 0)
710
-        $_POST["accountancy_code_sell"] = ''; // If empty, we force to null
711
-    if ($_POST["accountancy_code_buy"] <= 0)
712
-        $_POST["accountancy_code_buy"] = ''; // If empty, we force to null
729
+    if ((!empty($_POST["localtax1_type"]) || ($_POST['localtax1_type'] == '0')) && empty($_POST["localtax1"])) {
730
+            $_POST["localtax1"] = '0';
731
+    }
732
+    // If empty, we force to 0
733
+    if ((!empty($_POST["localtax2_type"]) || ($_POST['localtax2_type'] == '0')) && empty($_POST["localtax2"])) {
734
+            $_POST["localtax2"] = '0';
735
+    }
736
+    // If empty, we force to 0
737
+    if ($_POST["accountancy_code"] <= 0) {
738
+            $_POST["accountancy_code"] = '';
739
+    }
740
+    // If empty, we force to null
741
+    if ($_POST["accountancy_code_sell"] <= 0) {
742
+            $_POST["accountancy_code_sell"] = '';
743
+    }
744
+    // If empty, we force to null
745
+    if ($_POST["accountancy_code_buy"] <= 0) {
746
+            $_POST["accountancy_code_buy"] = '';
747
+    }
748
+    // If empty, we force to null
713 749
     if ($id == 10 && isset($_POST["code"])) {  // Spaces are not allowed into code
714 750
         $_POST["code"] = preg_replace('/\s/', '', $_POST["code"]);
715 751
     }
@@ -732,15 +768,17 @@  discard block
 block discarded – undo
732 768
         // Add new entry
733 769
         $sql = "INSERT INTO " . $tabname[$id] . " (";
734 770
         // List of fields
735
-        if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert))
736
-            $sql .= $tabrowid[$id] . ",";
771
+        if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) {
772
+                    $sql .= $tabrowid[$id] . ",";
773
+        }
737 774
         $sql .= $tabfieldinsert[$id];
738 775
         $sql .= ",active)";
739 776
         $sql .= " VALUES(";
740 777
 
741 778
         // List of values
742
-        if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert))
743
-            $sql .= $newid . ",";
779
+        if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert)) {
780
+                    $sql .= $newid . ",";
781
+        }
744 782
         $i = 0;
745 783
         foreach ($listfieldinsert as $f => $value) {
746 784
             if ($value == 'price' || preg_match('/^amount/i', $value) || $value == 'taux') {
@@ -748,14 +786,18 @@  discard block
 block discarded – undo
748 786
             } else if ($value == 'entity') {
749 787
                 $_POST[$listfieldvalue[$i]] = getEntity($tabname[$id]);
750 788
             }
751
-            if ($i)
752
-                $sql .= ",";
789
+            if ($i) {
790
+                            $sql .= ",";
791
+            }
753 792
             if ($listfieldvalue[$i] == 'sortorder') {  // For column name 'sortorder', we use the field name 'position'
754 793
                 $sql .= "'" . (int) $db->escape($_POST['position']) . "'";
755
-            } elseif ($_POST[$listfieldvalue[$i]] == '' && !($listfieldvalue[$i] == 'code' && $id == 10))
756
-                $sql .= "null";  // For vat, we want/accept code = ''
757
-            else
758
-                $sql .= "'" . $db->escape($_POST[$listfieldvalue[$i]]) . "'";
794
+            } elseif ($_POST[$listfieldvalue[$i]] == '' && !($listfieldvalue[$i] == 'code' && $id == 10)) {
795
+                            $sql .= "null";
796
+            }
797
+            // For vat, we want/accept code = ''
798
+            else {
799
+                            $sql .= "'" . $db->escape($_POST[$listfieldvalue[$i]]) . "'";
800
+            }
759 801
             $i++;
760 802
         }
761 803
         $sql .= ",1)";
@@ -796,20 +838,25 @@  discard block
 block discarded – undo
796 838
             } else if ($field == 'entity') {
797 839
                 $_POST[$listfieldvalue[$i]] = getEntity($tabname[$id]);
798 840
             }
799
-            if ($i)
800
-                $sql .= ",";
841
+            if ($i) {
842
+                            $sql .= ",";
843
+            }
801 844
             $sql .= $field . "=";
802 845
             if ($listfieldvalue[$i] == 'sortorder') {  // For column name 'sortorder', we use the field name 'position'
803 846
                 $sql .= "'" . (int) $db->escape($_POST['position']) . "'";
804
-            } elseif ($_POST[$listfieldvalue[$i]] == '' && !($listfieldvalue[$i] == 'code' && $id == 10))
805
-                $sql .= "null";  // For vat, we want/accept code = ''
806
-            else
807
-                $sql .= "'" . $db->escape($_POST[$listfieldvalue[$i]]) . "'";
847
+            } elseif ($_POST[$listfieldvalue[$i]] == '' && !($listfieldvalue[$i] == 'code' && $id == 10)) {
848
+                            $sql .= "null";
849
+            }
850
+            // For vat, we want/accept code = ''
851
+            else {
852
+                            $sql .= "'" . $db->escape($_POST[$listfieldvalue[$i]]) . "'";
853
+            }
808 854
             $i++;
809 855
         }
810 856
         $sql .= " WHERE " . $rowidcol . " = '" . $rowid . "'";
811
-        if (in_array('entity', $listfieldmodify))
812
-            $sql .= " AND entity = '" . getEntity($tabname[$id]) . "'";
857
+        if (in_array('entity', $listfieldmodify)) {
858
+                    $sql .= " AND entity = '" . getEntity($tabname[$id]) . "'";
859
+        }
813 860
 
814 861
         dol_syslog("actionmodify", LOG_DEBUG);
815 862
         //print $sql;
@@ -961,19 +1008,25 @@  discard block
 block discarded – undo
961 1008
 
962 1009
 
963 1010
 $param = '&id=' . urlencode($id);
964
-if ($search_country_id > 0)
1011
+if ($search_country_id > 0) {
965 1012
     $param .= '&search_country_id=' . urlencode($search_country_id);
966
-if ($search_code != '')
1013
+}
1014
+if ($search_code != '') {
967 1015
     $param .= '&search_code=' . urlencode($search_country_id);
968
-if ($entity != '')
1016
+}
1017
+if ($entity != '') {
969 1018
     $param .= '&entity=' . (int) $entity;
1019
+}
970 1020
 $paramwithsearch = $param;
971
-if ($sortorder)
1021
+if ($sortorder) {
972 1022
     $paramwithsearch .= '&sortorder=' . urlencode($sortorder);
973
-if ($sortfield)
1023
+}
1024
+if ($sortfield) {
974 1025
     $paramwithsearch .= '&sortfield=' . urlencode($sortfield);
975
-if (GETPOST('from'))
1026
+}
1027
+if (GETPOST('from')) {
976 1028
     $paramwithsearch .= '&from=' . urlencode(GETPOST('from', 'alpha'));
1029
+}
977 1030
 
978 1031
 
979 1032
 // Confirmation de la suppression de la ligne
@@ -989,19 +1042,24 @@  discard block
 block discarded – undo
989 1042
     // Complete requete recherche valeurs avec critere de tri
990 1043
     $sql = $tabsql[$id];
991 1044
 
992
-    if (!preg_match('/ WHERE /', $sql))
993
-        $sql .= " WHERE 1 = 1";
994
-    if ($search_country_id > 0)
995
-        $sql .= " AND c.rowid = " . $search_country_id;
996
-    if ($search_code != '' && $id != 9)
997
-        $sql .= natural_search("code", $search_code);
998
-    if ($search_code != '' && $id == 9)
999
-        $sql .= natural_search("code_iso", $search_code);
1045
+    if (!preg_match('/ WHERE /', $sql)) {
1046
+            $sql .= " WHERE 1 = 1";
1047
+    }
1048
+    if ($search_country_id > 0) {
1049
+            $sql .= " AND c.rowid = " . $search_country_id;
1050
+    }
1051
+    if ($search_code != '' && $id != 9) {
1052
+            $sql .= natural_search("code", $search_code);
1053
+    }
1054
+    if ($search_code != '' && $id == 9) {
1055
+            $sql .= natural_search("code_iso", $search_code);
1056
+    }
1000 1057
 
1001 1058
     if ($sortfield) {
1002 1059
         // If sort order is "country", we use country_code instead
1003
-        if ($sortfield == 'country')
1004
-            $sortfield = 'country_code';
1060
+        if ($sortfield == 'country') {
1061
+                    $sortfield = 'country_code';
1062
+        }
1005 1063
         $sql .= " ORDER BY " . $db->escape($sortfield);
1006 1064
         if ($sortorder) {
1007 1065
             $sql .= " " . strtoupper($db->escape($sortorder));
@@ -1064,10 +1122,11 @@  discard block
 block discarded – undo
1064 1122
                 $valuetoshow = $langs->trans("PriceUHT");
1065 1123
             }
1066 1124
             if ($fieldlist[$field] == 'taux') {
1067
-                if ($tabname[$id] != MAIN_DB_PREFIX . "c_revenuestamp")
1068
-                    $valuetoshow = $langs->trans("Rate");
1069
-                else
1070
-                    $valuetoshow = $langs->trans("Amount");
1125
+                if ($tabname[$id] != MAIN_DB_PREFIX . "c_revenuestamp") {
1126
+                                    $valuetoshow = $langs->trans("Rate");
1127
+                } else {
1128
+                                    $valuetoshow = $langs->trans("Amount");
1129
+                }
1071 1130
                 $class = 'center';
1072 1131
             }
1073 1132
             if ($fieldlist[$field] == 'localtax1_type') {
@@ -1095,10 +1154,11 @@  discard block
 block discarded – undo
1095 1154
                 $valuetoshow = $langs->trans("Language");
1096 1155
             }
1097 1156
             if ($fieldlist[$field] == 'type') {
1098
-                if ($tabname[$id] == MAIN_DB_PREFIX . "c_paiement")
1099
-                    $valuetoshow = $form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, ''));
1100
-                else
1101
-                    $valuetoshow = $langs->trans("Type");
1157
+                if ($tabname[$id] == MAIN_DB_PREFIX . "c_paiement") {
1158
+                                    $valuetoshow = $form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, ''));
1159
+                } else {
1160
+                                    $valuetoshow = $langs->trans("Type");
1161
+                }
1102 1162
             }
1103 1163
             if ($fieldlist[$field] == 'code') {
1104 1164
                 $valuetoshow = $langs->trans("Code");
@@ -1247,24 +1307,28 @@  discard block
 block discarded – undo
1247 1307
 
1248 1308
             if ($valuetoshow != '') {
1249 1309
                 print '<td' . ($class ? ' class="' . $class . '"' : '') . '>';
1250
-                if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value]))
1251
-                    print '<a href="' . $tabhelp[$id][$value] . '" target="_blank">' . $valuetoshow . ' ' . img_help(1, $valuetoshow) . '</a>';
1252
-                else if (!empty($tabhelp[$id][$value]))
1253
-                    print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
1254
-                else
1255
-                    print $valuetoshow;
1310
+                if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
1311
+                                    print '<a href="' . $tabhelp[$id][$value] . '" target="_blank">' . $valuetoshow . ' ' . img_help(1, $valuetoshow) . '</a>';
1312
+                } else if (!empty($tabhelp[$id][$value])) {
1313
+                                    print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
1314
+                } else {
1315
+                                    print $valuetoshow;
1316
+                }
1256 1317
                 print '</td>';
1257 1318
             }
1258
-            if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label')
1259
-                $alabelisused = 1;
1319
+            if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
1320
+                            $alabelisused = 1;
1321
+            }
1260 1322
         }
1261 1323
 
1262
-        if ($id == 4)
1263
-            print '<td></td>';
1324
+        if ($id == 4) {
1325
+                    print '<td></td>';
1326
+        }
1264 1327
         print '<td>';
1265 1328
         print '<input type="hidden" name="id" value="' . $id . '">';
1266
-        if (!is_null($withentity))
1267
-            print '<input type="hidden" name="entity" value="' . $withentity . '">';
1329
+        if (!is_null($withentity)) {
1330
+                    print '<input type="hidden" name="entity" value="' . $withentity . '">';
1331
+        }
1268 1332
         print '</td>';
1269 1333
         print '<td style="min-width: 26px;"></td>';
1270 1334
         print '<td style="min-width: 26px;"></td>';
@@ -1277,8 +1341,9 @@  discard block
 block discarded – undo
1277 1341
         // If data was already input, we define them in obj to populate input fields.
1278 1342
         if (GETPOST('actionadd')) {
1279 1343
             foreach ($fieldlist as $key => $val) {
1280
-                if (GETPOST($val) != '')
1281
-                    $obj->$val = GETPOST($val);
1344
+                if (GETPOST($val) != '') {
1345
+                                    $obj->$val = GETPOST($val);
1346
+                }
1282 1347
             }
1283 1348
         }
1284 1349
 
@@ -1288,15 +1353,18 @@  discard block
 block discarded – undo
1288 1353
         $error = $hookmanager->error;
1289 1354
         $errors = $hookmanager->errors;
1290 1355
 
1291
-        if ($id == 3)
1292
-            unset($fieldlist[2]); // Remove field ??? if dictionary Regions
1356
+        if ($id == 3) {
1357
+                    unset($fieldlist[2]);
1358
+        }
1359
+        // Remove field ??? if dictionary Regions
1293 1360
 
1294 1361
         if (empty($reshook)) {
1295 1362
             fieldList($fieldlist, $obj, $tabname[$id], 'add');
1296 1363
         }
1297 1364
 
1298
-        if ($id == 4)
1299
-            print '<td></td>';
1365
+        if ($id == 4) {
1366
+                    print '<td></td>';
1367
+        }
1300 1368
         print '<td colspan="3" align="center">';
1301 1369
         if ($action != 'edit') {
1302 1370
             print '<input type="submit" class="button" name="actionadd" value="' . $langs->trans("Add") . '">';
@@ -1305,8 +1373,9 @@  discard block
 block discarded – undo
1305 1373
         print "</tr>";
1306 1374
 
1307 1375
         $colspan = count($fieldlist) + 3;
1308
-        if ($id == 4)
1309
-            $colspan++;
1376
+        if ($id == 4) {
1377
+                    $colspan++;
1378
+        }
1310 1379
 
1311 1380
         print '</table>';
1312 1381
         print '</div>';
@@ -1341,8 +1410,9 @@  discard block
 block discarded – undo
1341 1410
         print '<tr class="liste_titre_filter">';
1342 1411
         $filterfound = 0;
1343 1412
         foreach ($fieldlist as $field => $value) {
1344
-            if ($fieldlist[$field] == 'entity')
1345
-                continue;
1413
+            if ($fieldlist[$field] == 'entity') {
1414
+                            continue;
1415
+            }
1346 1416
 
1347 1417
             $showfield = 1; // By default
1348 1418
 
@@ -1367,8 +1437,9 @@  discard block
 block discarded – undo
1367 1437
                 }
1368 1438
             }
1369 1439
         }
1370
-        if ($id == 4)
1371
-            print '<td></td>';
1440
+        if ($id == 4) {
1441
+                    print '<td></td>';
1442
+        }
1372 1443
         print '<td class="liste_titre"></td>';
1373 1444
         print '<td class="liste_titre" colspan="2" align="right">';
1374 1445
         if ($filterfound) {
@@ -1381,8 +1452,9 @@  discard block
 block discarded – undo
1381 1452
         // Title of lines
1382 1453
         print '<tr class="liste_titre">';
1383 1454
         foreach ($fieldlist as $field => $value) {
1384
-            if ($fieldlist[$field] == 'entity')
1385
-                continue;
1455
+            if ($fieldlist[$field] == 'entity') {
1456
+                            continue;
1457
+            }
1386 1458
 
1387 1459
             // Determine le nom du champ par rapport aux noms possibles
1388 1460
             // dans les dictionnaires de donnees
@@ -1406,10 +1478,11 @@  discard block
 block discarded – undo
1406 1478
                 $valuetoshow = $langs->trans("PriceUHT");
1407 1479
             }
1408 1480
             if ($fieldlist[$field] == 'taux') {
1409
-                if ($tabname[$id] != MAIN_DB_PREFIX . "c_revenuestamp")
1410
-                    $valuetoshow = $langs->trans("Rate");
1411
-                else
1412
-                    $valuetoshow = $langs->trans("Amount");
1481
+                if ($tabname[$id] != MAIN_DB_PREFIX . "c_revenuestamp") {
1482
+                                    $valuetoshow = $langs->trans("Rate");
1483
+                } else {
1484
+                                    $valuetoshow = $langs->trans("Amount");
1485
+                }
1413 1486
                 $align = 'center';
1414 1487
             }
1415 1488
             if ($fieldlist[$field] == 'localtax1_type') {
@@ -1582,8 +1655,9 @@  discard block
 block discarded – undo
1582 1655
             }
1583 1656
         }
1584 1657
         // Favorite - Only activated on country dictionary
1585
-        if ($id == 4)
1586
-            print getTitleFieldOfList($langs->trans("Favorite"), 0, $_SERVER["PHP_SELF"], "favorite", ($page ? 'page=' . $page . '&' : ''), $param, 'align="center"', $sortfield, $sortorder);
1658
+        if ($id == 4) {
1659
+                    print getTitleFieldOfList($langs->trans("Favorite"), 0, $_SERVER["PHP_SELF"], "favorite", ($page ? 'page=' . $page . '&' : ''), $param, 'align="center"', $sortfield, $sortorder);
1660
+        }
1587 1661
 
1588 1662
         print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page=' . $page . '&' : ''), $param, 'align="center"', $sortfield, $sortorder);
1589 1663
         print getTitleFieldOfList('');
@@ -1612,13 +1686,13 @@  discard block
 block discarded – undo
1612 1686
                     print '<div name="' . (!empty($obj->rowid) ? $obj->rowid : $obj->code) . '"></div>';
1613 1687
                     print '<input type="hidden" name="page" value="' . $page . '">';
1614 1688
                     print '<input type="hidden" name="rowid" value="' . $rowid . '">';
1615
-                    if (!is_null($withentity))
1616
-                        print '<input type="hidden" name="entity" value="' . $withentity . '">';
1689
+                    if (!is_null($withentity)) {
1690
+                                            print '<input type="hidden" name="entity" value="' . $withentity . '">';
1691
+                    }
1617 1692
                     print '<input type="submit" class="button" name="actionmodify" value="' . $langs->trans("Modify") . '">';
1618 1693
                     print '<input type="submit" class="button" name="actioncancel" value="' . $langs->trans("Cancel") . '">';
1619 1694
                     print '</td>';
1620
-                }
1621
-                else {
1695
+                } else {
1622 1696
                     $tmpaction = 'view';
1623 1697
                     $parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[$id]);
1624 1698
                     $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction);    // Note that $action and $object may have been modified by some hooks
@@ -1657,15 +1731,15 @@  discard block
 block discarded – undo
1657 1731
                                 $valuetoshow = yn($valuetoshow);
1658 1732
                                 $align = "center";
1659 1733
                             } else if ($fieldlist[$field] == 'type_cdr') {
1660
-                                if (empty($valuetoshow))
1661
-                                    $valuetoshow = $langs->trans('None');
1662
-                                elseif ($valuetoshow == 1)
1663
-                                    $valuetoshow = $langs->trans('AtEndOfMonth');
1664
-                                elseif ($valuetoshow == 2)
1665
-                                    $valuetoshow = $langs->trans('CurrentNext');
1734
+                                if (empty($valuetoshow)) {
1735
+                                                                    $valuetoshow = $langs->trans('None');
1736
+                                } elseif ($valuetoshow == 1) {
1737
+                                                                    $valuetoshow = $langs->trans('AtEndOfMonth');
1738
+                                } elseif ($valuetoshow == 2) {
1739
+                                                                    $valuetoshow = $langs->trans('CurrentNext');
1740
+                                }
1666 1741
                                 $align = "center";
1667
-                            }
1668
-                            else if ($fieldlist[$field] == 'price' || preg_match('/^amount/i', $fieldlist[$field])) {
1742
+                            } else if ($fieldlist[$field] == 'price' || preg_match('/^amount/i', $fieldlist[$field])) {
1669 1743
                                 $valuetoshow = price($valuetoshow);
1670 1744
                             }
1671 1745
                             if ($value == 'private') {
@@ -1743,20 +1817,20 @@  discard block
 block discarded – undo
1743 1817
                             } else if ($fieldlist[$field] == 'localtax1' || $fieldlist[$field] == 'localtax2') {
1744 1818
                                 $align = "center";
1745 1819
                             } else if ($fieldlist[$field] == 'localtax1_type') {
1746
-                                if ($obj->localtax1 != 0)
1747
-                                    $valuetoshow = $localtax_typeList[$valuetoshow];
1748
-                                else
1749
-                                    $valuetoshow = '';
1820
+                                if ($obj->localtax1 != 0) {
1821
+                                                                    $valuetoshow = $localtax_typeList[$valuetoshow];
1822
+                                } else {
1823
+                                                                    $valuetoshow = '';
1824
+                                }
1750 1825
                                 $align = "center";
1751
-                            }
1752
-                            else if ($fieldlist[$field] == 'localtax2_type') {
1753
-                                if ($obj->localtax2 != 0)
1754
-                                    $valuetoshow = $localtax_typeList[$valuetoshow];
1755
-                                else
1756
-                                    $valuetoshow = '';
1826
+                            } else if ($fieldlist[$field] == 'localtax2_type') {
1827
+                                if ($obj->localtax2 != 0) {
1828
+                                                                    $valuetoshow = $localtax_typeList[$valuetoshow];
1829
+                                } else {
1830
+                                                                    $valuetoshow = '';
1831
+                                }
1757 1832
                                 $align = "center";
1758
-                            }
1759
-                            else if ($fieldlist[$field] == 'taux') {
1833
+                            } else if ($fieldlist[$field] == 'taux') {
1760 1834
                                 $valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
1761 1835
                                 $align = "center";
1762 1836
                             } else if (in_array($fieldlist[$field], array('recuperableonly'))) {
@@ -1778,21 +1852,28 @@  discard block
 block discarded – undo
1778 1852
                             }
1779 1853
 
1780 1854
                             $class = 'tddict';
1781
-                            if ($fieldlist[$field] == 'note' && $id == 10)
1782
-                                $class .= ' tdoverflowmax200';
1783
-                            if ($fieldlist[$field] == 'tracking')
1784
-                                $class .= ' tdoverflowauto';
1785
-                            if ($fieldlist[$field] == 'code')
1786
-                                $class .= ' width100';
1787
-                            if ($fieldlist[$field] == 'position')
1788
-                                $class .= ' right';
1789
-                            if ($fieldlist[$field] == 'localtax1_type')
1790
-                                $class .= ' nowrap';
1791
-                            if ($fieldlist[$field] == 'localtax2_type')
1792
-                                $class .= ' nowrap';
1855
+                            if ($fieldlist[$field] == 'note' && $id == 10) {
1856
+                                                            $class .= ' tdoverflowmax200';
1857
+                            }
1858
+                            if ($fieldlist[$field] == 'tracking') {
1859
+                                                            $class .= ' tdoverflowauto';
1860
+                            }
1861
+                            if ($fieldlist[$field] == 'code') {
1862
+                                                            $class .= ' width100';
1863
+                            }
1864
+                            if ($fieldlist[$field] == 'position') {
1865
+                                                            $class .= ' right';
1866
+                            }
1867
+                            if ($fieldlist[$field] == 'localtax1_type') {
1868
+                                                            $class .= ' nowrap';
1869
+                            }
1870
+                            if ($fieldlist[$field] == 'localtax2_type') {
1871
+                                                            $class .= ' nowrap';
1872
+                            }
1793 1873
                             // Show value for field
1794
-                            if ($showfield)
1795
-                                print '<!-- ' . $fieldlist[$field] . ' --><td align="' . $align . '" class="' . $class . '">' . $valuetoshow . '</td>';
1874
+                            if ($showfield) {
1875
+                                                            print '<!-- ' . $fieldlist[$field] . ' --><td align="' . $align . '" class="' . $class . '">' . $valuetoshow . '</td>';
1876
+                            }
1796 1877
                         }
1797 1878
                     }
1798 1879
 
@@ -1821,65 +1902,75 @@  discard block
 block discarded – undo
1821 1902
                         $canbedisabled = 0;
1822 1903
                     }
1823 1904
                     $canbemodified = $iserasable;
1824
-                    if ($obj->code == 'RECEP')
1825
-                        $canbemodified = 1;
1826
-                    if ($tabname[$id] == MAIN_DB_PREFIX . "c_actioncomm")
1827
-                        $canbemodified = 1;
1905
+                    if ($obj->code == 'RECEP') {
1906
+                                            $canbemodified = 1;
1907
+                    }
1908
+                    if ($tabname[$id] == MAIN_DB_PREFIX . "c_actioncomm") {
1909
+                                            $canbemodified = 1;
1910
+                    }
1828 1911
 
1829 1912
                     // Url
1830 1913
                     $rowidcol = $tabrowid[$id];
1831 1914
                     // If rowidcol not defined
1832
-                    if (empty($rowidcol) || in_array($id, array(6, 7, 8, 13, 17, 19, 27)))
1833
-                        $rowidcol = 'rowid';
1915
+                    if (empty($rowidcol) || in_array($id, array(6, 7, 8, 13, 17, 19, 27))) {
1916
+                                            $rowidcol = 'rowid';
1917
+                    }
1834 1918
                     $url = $_SERVER["PHP_SELF"] . '?' . ($page ? 'page=' . $page . '&' : '') . 'sortfield=' . $sortfield . '&sortorder=' . $sortorder . '&rowid=' . ((!empty($obj->{$rowidcol}) || $obj->{$rowidcol} == '0') ? $obj->{$rowidcol} : (!empty($obj->code) ? urlencode($obj->code) : '')) . '&code=' . (!empty($obj->code) ? urlencode($obj->code) : '');
1835
-                    if (!empty($param))
1836
-                        $url .= '&' . $param;
1837
-                    if (!is_null($withentity))
1838
-                        $url .= '&entity=' . $withentity;
1919
+                    if (!empty($param)) {
1920
+                                            $url .= '&' . $param;
1921
+                    }
1922
+                    if (!is_null($withentity)) {
1923
+                                            $url .= '&entity=' . $withentity;
1924
+                    }
1839 1925
                     $url .= '&';
1840 1926
 
1841 1927
                     // Favorite
1842 1928
                     // Only activated on country dictionary
1843 1929
                     if ($id == 4) {
1844 1930
                         print '<td align="center" class="nowrap">';
1845
-                        if ($iserasable)
1846
-                            print '<a href="' . $url . 'action=' . $acts[$obj->favorite] . '_favorite">' . $actl[$obj->favorite] . '</a>';
1847
-                        else
1848
-                            print $langs->trans("AlwaysActive");
1931
+                        if ($iserasable) {
1932
+                                                    print '<a href="' . $url . 'action=' . $acts[$obj->favorite] . '_favorite">' . $actl[$obj->favorite] . '</a>';
1933
+                        } else {
1934
+                                                    print $langs->trans("AlwaysActive");
1935
+                        }
1849 1936
                         print '</td>';
1850 1937
                     }
1851 1938
 
1852 1939
                     // Active
1853 1940
                     print '<td align="center" class="nowrap">';
1854
-                    if ($canbedisabled)
1855
-                        print '<a href="' . $url . 'action=' . $acts[$obj->active] . '">' . $actl[$obj->active] . '</a>';
1856
-                    else {
1857
-                        if (in_array($obj->code, array('AC_OTH', 'AC_OTH_AUTO')))
1858
-                            print $langs->trans("AlwaysActive");
1859
-                        else if (isset($obj->type) && in_array($obj->type, array('systemauto')) && empty($obj->active))
1860
-                            print $langs->trans("Deprecated");
1861
-                        else if (isset($obj->type) && in_array($obj->type, array('system')) && !empty($obj->active) && $obj->code != 'AC_OTH')
1862
-                            print $langs->trans("UsedOnlyWithTypeOption");
1863
-                        else
1864
-                            print $langs->trans("AlwaysActive");
1941
+                    if ($canbedisabled) {
1942
+                                            print '<a href="' . $url . 'action=' . $acts[$obj->active] . '">' . $actl[$obj->active] . '</a>';
1943
+                    } else {
1944
+                        if (in_array($obj->code, array('AC_OTH', 'AC_OTH_AUTO'))) {
1945
+                                                    print $langs->trans("AlwaysActive");
1946
+                        } else if (isset($obj->type) && in_array($obj->type, array('systemauto')) && empty($obj->active)) {
1947
+                                                    print $langs->trans("Deprecated");
1948
+                        } else if (isset($obj->type) && in_array($obj->type, array('system')) && !empty($obj->active) && $obj->code != 'AC_OTH') {
1949
+                                                    print $langs->trans("UsedOnlyWithTypeOption");
1950
+                        } else {
1951
+                                                    print $langs->trans("AlwaysActive");
1952
+                        }
1865 1953
                     }
1866 1954
                     print "</td>";
1867 1955
 
1868 1956
                     // Modify link
1869
-                    if ($canbemodified)
1870
-                        print '<td align="center"><a class="reposition" href="' . $url . 'action=edit">' . img_edit() . '</a></td>';
1871
-                    else
1872
-                        print '<td>&nbsp;</td>';
1957
+                    if ($canbemodified) {
1958
+                                            print '<td align="center"><a class="reposition" href="' . $url . 'action=edit">' . img_edit() . '</a></td>';
1959
+                    } else {
1960
+                                            print '<td>&nbsp;</td>';
1961
+                    }
1873 1962
 
1874 1963
                     // Delete link
1875 1964
                     if ($iserasable) {
1876 1965
                         print '<td align="center">';
1877
-                        if ($user->admin)
1878
-                            print '<a href="' . $url . 'action=delete">' . img_delete() . '</a>';
1966
+                        if ($user->admin) {
1967
+                                                    print '<a href="' . $url . 'action=delete">' . img_delete() . '</a>';
1968
+                        }
1879 1969
                         //else print '<a href="#">'.img_delete().'</a>';    // Some dictionary can be edited by other profile than admin
1880 1970
                         print '</td>';
1881
-                    } else
1882
-                        print '<td>&nbsp;</td>';
1971
+                    } else {
1972
+                                            print '<td>&nbsp;</td>';
1973
+                    }
1883 1974
 
1884 1975
                     print "</tr>\n";
1885 1976
                 }
@@ -1889,8 +1980,7 @@  discard block
 block discarded – undo
1889 1980
 
1890 1981
         print '</table>';
1891 1982
         print '</div>';
1892
-    }
1893
-    else {
1983
+    } else {
1894 1984
         dol_print_error($db);
1895 1985
     }
1896 1986
 
@@ -1913,8 +2003,9 @@  discard block
 block discarded – undo
1913 2003
 
1914 2004
     $showemptyline = '';
1915 2005
     foreach ($taborder as $i) {
1916
-        if (isset($tabname[$i]) && empty($tabcond[$i]))
1917
-            continue;
2006
+        if (isset($tabname[$i]) && empty($tabcond[$i])) {
2007
+                    continue;
2008
+        }
1918 2009
 
1919 2010
         if ($i) {
1920 2011
             if ($showemptyline) {
@@ -1976,8 +2067,9 @@  discard block
 block discarded – undo
1976 2067
 
1977 2068
     $formadmin = new FormAdmin($db);
1978 2069
     $formcompany = new FormCompany($db);
1979
-    if (!empty($conf->accounting->enabled))
1980
-        $formaccounting = new FormAccounting($db);
2070
+    if (!empty($conf->accounting->enabled)) {
2071
+            $formaccounting = new FormAccounting($db);
2072
+    }
1981 2073
 
1982 2074
     $withentity = '';
1983 2075
 
@@ -2046,10 +2138,11 @@  discard block
 block discarded – undo
2046 2138
             print $type . '<input type="hidden" name="type" value="' . $type . '">';
2047 2139
             print '</td>';
2048 2140
         } elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'type_cdr' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
2049
-            if ($fieldlist[$field] == 'type_cdr')
2050
-                print '<td align="center">';
2051
-            else
2052
-                print '<td>';
2141
+            if ($fieldlist[$field] == 'type_cdr') {
2142
+                            print '<td align="center">';
2143
+            } else {
2144
+                            print '<td>';
2145
+            }
2053 2146
             if ($fieldlist[$field] == 'type_cdr') {
2054 2147
                 print $form->selectarray($fieldlist[$field], array(0 => $langs->trans('None'), 1 => $langs->trans('AtEndOfMonth'), 2 => $langs->trans('CurrentNext')), (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : ''));
2055 2148
             } else {
@@ -2058,13 +2151,14 @@  discard block
 block discarded – undo
2058 2151
             print '</td>';
2059 2152
         } elseif (in_array($fieldlist[$field], array('nbjour', 'decalage', 'taux', 'localtax1', 'localtax2'))) {
2060 2153
             $align = "left";
2061
-            if (in_array($fieldlist[$field], array('taux', 'localtax1', 'localtax2')))
2062
-                $align = "center"; // Fields aligned on right
2154
+            if (in_array($fieldlist[$field], array('taux', 'localtax1', 'localtax2'))) {
2155
+                            $align = "center";
2156
+            }
2157
+            // Fields aligned on right
2063 2158
             print '<td align="' . $align . '">';
2064 2159
             print '<input type="text" class="flat" value="' . (isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '') . '" size="3" name="' . $fieldlist[$field] . '">';
2065 2160
             print '</td>';
2066
-        }
2067
-        elseif (in_array($fieldlist[$field], array('libelle_facture'))) {
2161
+        } elseif (in_array($fieldlist[$field], array('libelle_facture'))) {
2068 2162
             print '<td>';
2069 2163
             $transfound = 0;
2070 2164
             // Special case for labels
@@ -2124,25 +2218,33 @@  discard block
 block discarded – undo
2124 2218
             print $form->selectExpenseRanges($obj->fk_range);
2125 2219
             print '</td>';
2126 2220
         } else {
2127
-            if ($fieldlist[$field] == 'sortorder')
2128
-                $fieldlist[$field] = 'position';
2221
+            if ($fieldlist[$field] == 'sortorder') {
2222
+                            $fieldlist[$field] = 'position';
2223
+            }
2129 2224
 
2130 2225
             $classtd = '';
2131 2226
             $class = '';
2132
-            if ($fieldlist[$field] == 'code')
2133
-                $classtd = 'width100';
2134
-            if ($fieldlist[$field] == 'affect')
2135
-                $class = 'maxwidth50';
2136
-            if ($fieldlist[$field] == 'delay')
2137
-                $class = 'maxwidth50';
2138
-            if ($fieldlist[$field] == 'position')
2139
-                $class = 'maxwidth50';
2140
-            if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label')
2141
-                $class = 'quatrevingtpercent';
2142
-            if ($fieldlist[$field] == 'tracking')
2143
-                $class = 'quatrevingtpercent';
2144
-            if ($fieldlist[$field] == 'sortorder' || $fieldlist[$field] == 'sens' || $fieldlist[$field] == 'category_type')
2145
-                $class = 'maxwidth50';
2227
+            if ($fieldlist[$field] == 'code') {
2228
+                            $classtd = 'width100';
2229
+            }
2230
+            if ($fieldlist[$field] == 'affect') {
2231
+                            $class = 'maxwidth50';
2232
+            }
2233
+            if ($fieldlist[$field] == 'delay') {
2234
+                            $class = 'maxwidth50';
2235
+            }
2236
+            if ($fieldlist[$field] == 'position') {
2237
+                            $class = 'maxwidth50';
2238
+            }
2239
+            if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
2240
+                            $class = 'quatrevingtpercent';
2241
+            }
2242
+            if ($fieldlist[$field] == 'tracking') {
2243
+                            $class = 'quatrevingtpercent';
2244
+            }
2245
+            if ($fieldlist[$field] == 'sortorder' || $fieldlist[$field] == 'sens' || $fieldlist[$field] == 'category_type') {
2246
+                            $class = 'maxwidth50';
2247
+            }
2146 2248
             print '<td class="' . $classtd . '">';
2147 2249
             $transfound = 0;
2148 2250
             if (in_array($fieldlist[$field], array('label', 'libelle'))) {
Please login to merge, or discard this patch.
dolibarr/htdocs/comm/index.php 1 patch
Spacing   +234 added lines, -234 removed lines patch added patch discarded remove patch
@@ -26,36 +26,36 @@  discard block
 block discarded – undo
26 26
  *	\brief      Home page of commercial area
27 27
  */
28 28
 
29
-require DOL_BASE_PATH . '/main.inc.php';
29
+require DOL_BASE_PATH.'/main.inc.php';
30 30
 
31 31
 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
32 32
 require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
33 33
 require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
34 34
 require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
35
-if (! empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
36
-if (! empty($conf->propal->enabled))  require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
37
-if (! empty($conf->supplier_proposal->enabled))  require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
38
-if (! empty($conf->commande->enabled))  require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
39
-if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
35
+if (!empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
36
+if (!empty($conf->propal->enabled))  require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
37
+if (!empty($conf->supplier_proposal->enabled))  require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
38
+if (!empty($conf->commande->enabled))  require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
39
+if (!empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
40 40
 
41
-if (! $user->rights->societe->lire) accessforbidden();
41
+if (!$user->rights->societe->lire) accessforbidden();
42 42
 
43 43
 // Load translation files required by the page
44 44
 $langs->loadLangs(array("commercial", "propal"));
45 45
 
46
-$action=GETPOST('action', 'alpha');
47
-$bid=GETPOST('bid', 'int');
46
+$action = GETPOST('action', 'alpha');
47
+$bid = GETPOST('bid', 'int');
48 48
 
49 49
 // Securite acces client
50
-$socid=GETPOST('socid','int');
50
+$socid = GETPOST('socid', 'int');
51 51
 if (isset($user->societe_id) && $user->societe_id > 0)
52 52
 {
53 53
 	$action = '';
54 54
 	$socid = $user->societe_id;
55 55
 }
56 56
 
57
-$max=5;
58
-$now=dol_now();
57
+$max = 5;
58
+$now = dol_now();
59 59
 
60 60
 /*
61 61
  * Actions
@@ -68,49 +68,49 @@  discard block
 block discarded – undo
68 68
 
69 69
 $form = new Form($db);
70 70
 $formfile = new FormFile($db);
71
-$companystatic=new Societe($db);
72
-if (! empty($conf->propal->enabled)) $propalstatic=new Propal($db);
73
-if (! empty($conf->supplier_proposal->enabled)) $supplierproposalstatic=new SupplierProposal($db);
74
-if (! empty($conf->commande->enabled)) $orderstatic=new Commande($db);
75
-if (! empty($conf->fournisseur->enabled)) $supplierorderstatic=new CommandeFournisseur($db);
71
+$companystatic = new Societe($db);
72
+if (!empty($conf->propal->enabled)) $propalstatic = new Propal($db);
73
+if (!empty($conf->supplier_proposal->enabled)) $supplierproposalstatic = new SupplierProposal($db);
74
+if (!empty($conf->commande->enabled)) $orderstatic = new Commande($db);
75
+if (!empty($conf->fournisseur->enabled)) $supplierorderstatic = new CommandeFournisseur($db);
76 76
 
77
-llxHeader("",$langs->trans("CommercialArea"));
77
+llxHeader("", $langs->trans("CommercialArea"));
78 78
 
79
-print load_fiche_titre($langs->trans("CommercialArea"),'','title_commercial.png');
79
+print load_fiche_titre($langs->trans("CommercialArea"), '', 'title_commercial.png');
80 80
 
81 81
 print '<div class="fichecenter"><div class="fichethirdleft">';
82 82
 
83
-if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS))     // This is useless due to the global search combo
83
+if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS))     // This is useless due to the global search combo
84 84
 {
85 85
     // Search proposal
86
-    if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
86
+    if (!empty($conf->propal->enabled) && $user->rights->propal->lire)
87 87
     {
88
-    	$listofsearchfields['search_proposal']=array('text'=>'Proposal');
88
+    	$listofsearchfields['search_proposal'] = array('text'=>'Proposal');
89 89
     }
90 90
     // Search customer order
91
-    if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
91
+    if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
92 92
     {
93
-    	$listofsearchfields['search_customer_order']=array('text'=>'CustomerOrder');
93
+    	$listofsearchfields['search_customer_order'] = array('text'=>'CustomerOrder');
94 94
     }
95 95
     // Search supplier proposal
96
-    if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire)
96
+    if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire)
97 97
     {
98
-        $listofsearchfields['search_supplier_proposal']=array('text'=>'SupplierProposalShort');
98
+        $listofsearchfields['search_supplier_proposal'] = array('text'=>'SupplierProposalShort');
99 99
     }
100 100
     // Search supplier order
101
-    if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire)
101
+    if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire)
102 102
     {
103
-    	$listofsearchfields['search_supplier_order']=array('text'=>'SupplierOrder');
103
+    	$listofsearchfields['search_supplier_order'] = array('text'=>'SupplierOrder');
104 104
     }
105 105
     // Search intervention
106
-    if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire)
106
+    if (!empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire)
107 107
     {
108
-    	$listofsearchfields['search_intervention']=array('text'=>'Intervention');
108
+    	$listofsearchfields['search_intervention'] = array('text'=>'Intervention');
109 109
     }
110 110
     // Search contract
111
-    if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
111
+    if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire)
112 112
     {
113
-        $listofsearchfields['search_contract']=array('text'=>'Contract');
113
+        $listofsearchfields['search_contract'] = array('text'=>'Contract');
114 114
     }
115 115
 
116 116
     if (count($listofsearchfields))
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
     	print '<form method="post" action="'.BASE_URI.'?controller=core&method=search">';
119 119
     	print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
120 120
     	print '<table class="noborder nohover centpercent">';
121
-    	$i=0;
122
-    	foreach($listofsearchfields as $key => $value)
121
+    	$i = 0;
122
+    	foreach ($listofsearchfields as $key => $value)
123 123
     	{
124 124
     		if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
125 125
     		print '<tr '.$bc[false].'>';
@@ -138,22 +138,22 @@  discard block
 block discarded – undo
138 138
 /*
139 139
  * Draft proposals
140 140
  */
141
-if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
141
+if (!empty($conf->propal->enabled) && $user->rights->propal->lire)
142 142
 {
143 143
 	$langs->load("propal");
144 144
 
145 145
 	$sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.tva as total_tva, p.total as total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
146
-    $sql.= ", s.code_client";
147
-	$sql.= " FROM ".MAIN_DB_PREFIX."propal as p";
148
-	$sql.= ", ".MAIN_DB_PREFIX."societe as s";
149
-	if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
150
-	$sql.= " WHERE p.fk_statut = 0";
151
-	$sql.= " AND p.fk_soc = s.rowid";
152
-	$sql.= " AND p.entity IN (".getEntity('propal').")";
153
-	if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
154
-	if ($socid)	$sql.= " AND s.rowid = ".$socid;
155
-
156
-	$resql=$db->query($sql);
146
+    $sql .= ", s.code_client";
147
+	$sql .= " FROM ".MAIN_DB_PREFIX."propal as p";
148
+	$sql .= ", ".MAIN_DB_PREFIX."societe as s";
149
+	if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
150
+	$sql .= " WHERE p.fk_statut = 0";
151
+	$sql .= " AND p.fk_soc = s.rowid";
152
+	$sql .= " AND p.entity IN (".getEntity('propal').")";
153
+	if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
154
+	if ($socid)	$sql .= " AND s.rowid = ".$socid;
155
+
156
+	$resql = $db->query($sql);
157 157
 	if ($resql)
158 158
 	{
159 159
 		$total = 0;
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 		print '<div class="div-table-responsive-no-min">';
163 163
 		print '<table class="noborder" width="100%">';
164 164
 		print '<tr class="liste_titre">';
165
-		print '<th colspan="3">'.$langs->trans("ProposalsDraft").($num?' <span class="badge">'.$num.'</span>':'').'</th></tr>';
165
+		print '<th colspan="3">'.$langs->trans("ProposalsDraft").($num ? ' <span class="badge">'.$num.'</span>' : '').'</th></tr>';
166 166
 
167 167
 		if ($num > 0)
168 168
 		{
@@ -172,28 +172,28 @@  discard block
 block discarded – undo
172 172
 				$obj = $db->fetch_object($resql);
173 173
 
174 174
 				print '<tr class="oddeven"><td  class="nowrap">';
175
-				$propalstatic->id=$obj->rowid;
176
-				$propalstatic->ref=$obj->ref;
177
-                $propalstatic->ref_client=$obj->ref_client;
175
+				$propalstatic->id = $obj->rowid;
176
+				$propalstatic->ref = $obj->ref;
177
+                $propalstatic->ref_client = $obj->ref_client;
178 178
                 $propalstatic->total_ht = $obj->total_ht;
179 179
                 $propalstatic->total_tva = $obj->total_tva;
180 180
                 $propalstatic->total_ttc = $obj->total_ttc;
181 181
 				print $propalstatic->getNomUrl(1);
182 182
 				print '</td>';
183 183
 				print '<td class="nowrap">';
184
-				$companystatic->id=$obj->socid;
185
-				$companystatic->name=$obj->name;
186
-				$companystatic->client=$obj->client;
184
+				$companystatic->id = $obj->socid;
185
+				$companystatic->name = $obj->name;
186
+				$companystatic->client = $obj->client;
187 187
                 $companystatic->code_client = $obj->code_client;
188 188
                 $companystatic->code_fournisseur = $obj->code_fournisseur;
189
-				$companystatic->canvas=$obj->canvas;
190
-				print $companystatic->getNomUrl(1,'customer',16);
189
+				$companystatic->canvas = $obj->canvas;
190
+				print $companystatic->getNomUrl(1, 'customer', 16);
191 191
 				print '</td>';
192 192
 				print '<td align="right" class="nowrap">'.price($obj->total_ht).'</td></tr>';
193 193
 				$i++;
194 194
 				$total += $obj->total_ht;
195 195
 			}
196
-			if ($total>0)
196
+			if ($total > 0)
197 197
 			{
198 198
 
199 199
 				print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>";
@@ -219,22 +219,22 @@  discard block
 block discarded – undo
219 219
 /*
220 220
  * Draft supplier proposals
221 221
  */
222
-if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire)
222
+if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire)
223 223
 {
224 224
     $langs->load("supplier_proposal");
225 225
 
226 226
     $sql = "SELECT p.rowid, p.ref, p.total_ht, p.tva as total_tva, p.total as total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
227
-    $sql.= ", s.code_client";
228
-    $sql.= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p";
229
-    $sql.= ", ".MAIN_DB_PREFIX."societe as s";
230
-    if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
231
-    $sql.= " WHERE p.fk_statut = 0";
232
-    $sql.= " AND p.fk_soc = s.rowid";
233
-    $sql.= " AND p.entity IN (".getEntity('supplier_proposal').")";
234
-    if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
235
-    if ($socid)	$sql.= " AND s.rowid = ".$socid;
236
-
237
-    $resql=$db->query($sql);
227
+    $sql .= ", s.code_client";
228
+    $sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p";
229
+    $sql .= ", ".MAIN_DB_PREFIX."societe as s";
230
+    if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
231
+    $sql .= " WHERE p.fk_statut = 0";
232
+    $sql .= " AND p.fk_soc = s.rowid";
233
+    $sql .= " AND p.entity IN (".getEntity('supplier_proposal').")";
234
+    if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
235
+    if ($socid)	$sql .= " AND s.rowid = ".$socid;
236
+
237
+    $resql = $db->query($sql);
238 238
     if ($resql)
239 239
     {
240 240
         $total = 0;
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
         print '<div class="div-table-responsive-no-min">';
244 244
         print '<table class="noborder" width="100%">';
245 245
         print '<tr class="liste_titre">';
246
-        print '<th colspan="3">'.$langs->trans("SupplierProposalsDraft").($num?' <span class="badge">'.$num.'</span>':'').'</th></tr>';
246
+        print '<th colspan="3">'.$langs->trans("SupplierProposalsDraft").($num ? ' <span class="badge">'.$num.'</span>' : '').'</th></tr>';
247 247
 
248 248
         if ($num > 0)
249 249
         {
@@ -253,27 +253,27 @@  discard block
 block discarded – undo
253 253
                 $obj = $db->fetch_object($resql);
254 254
 
255 255
                 print '<tr class="oddeven"><td  class="nowrap">';
256
-                $supplierproposalstatic->id=$obj->rowid;
257
-                $supplierproposalstatic->ref=$obj->ref;
256
+                $supplierproposalstatic->id = $obj->rowid;
257
+                $supplierproposalstatic->ref = $obj->ref;
258 258
                 $supplierproposalstatic->total_ht = $obj->total_ht;
259 259
                 $supplierproposalstatic->total_tva = $obj->total_tva;
260 260
                 $supplierproposalstatic->total_ttc = $obj->total_ttc;
261 261
                 print $supplierproposalstatic->getNomUrl(1);
262 262
                 print '</td>';
263 263
                 print '<td class="nowrap">';
264
-                $companystatic->id=$obj->socid;
265
-                $companystatic->name=$obj->name;
266
-                $companystatic->client=$obj->client;
264
+                $companystatic->id = $obj->socid;
265
+                $companystatic->name = $obj->name;
266
+                $companystatic->client = $obj->client;
267 267
                 $companystatic->code_client = $obj->code_client;
268 268
                 $companystatic->code_fournisseur = $obj->code_fournisseur;
269
-                $companystatic->canvas=$obj->canvas;
270
-                print $companystatic->getNomUrl(1,'supplier',16);
269
+                $companystatic->canvas = $obj->canvas;
270
+                print $companystatic->getNomUrl(1, 'supplier', 16);
271 271
                 print '</td>';
272 272
                 print '<td align="right" class="nowrap">'.price($obj->total_ht).'</td></tr>';
273 273
                 $i++;
274 274
                 $total += $obj->total_ht;
275 275
             }
276
-            if ($total>0)
276
+            if ($total > 0)
277 277
             {
278 278
                 print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>";
279 279
             }
@@ -296,20 +296,20 @@  discard block
 block discarded – undo
296 296
 /*
297 297
  * Draft orders
298 298
  */
299
-if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
299
+if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
300 300
 {
301 301
 	$langs->load("orders");
302 302
 
303 303
 	$sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.tva as total_tva, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
304
-    $sql.= ", s.code_client";
305
-	$sql.= " FROM ".MAIN_DB_PREFIX."commande as c";
306
-	$sql.= ", ".MAIN_DB_PREFIX."societe as s";
307
-	if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
308
-	$sql.= " WHERE c.fk_soc = s.rowid";
309
-	$sql.= " AND c.fk_statut = 0";
310
-	$sql.= " AND c.entity IN (".getEntity('commande').")";
311
-	if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
312
-	if ($socid)	$sql.= " AND c.fk_soc = ".$socid;
304
+    $sql .= ", s.code_client";
305
+	$sql .= " FROM ".MAIN_DB_PREFIX."commande as c";
306
+	$sql .= ", ".MAIN_DB_PREFIX."societe as s";
307
+	if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
308
+	$sql .= " WHERE c.fk_soc = s.rowid";
309
+	$sql .= " AND c.fk_statut = 0";
310
+	$sql .= " AND c.entity IN (".getEntity('commande').")";
311
+	if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
312
+	if ($socid)	$sql .= " AND c.fk_soc = ".$socid;
313 313
 
314 314
 	$resql = $db->query($sql);
315 315
 	if ($resql)
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 		print '<div class="div-table-responsive-no-min">';
321 321
 		print '<table class="noborder" width="100%">';
322 322
 		print '<tr class="liste_titre">';
323
-		print '<th colspan="3">'.$langs->trans("DraftOrders").($num?' <span class="badge">'.$num.'</span>':'').'</th></tr>';
323
+		print '<th colspan="3">'.$langs->trans("DraftOrders").($num ? ' <span class="badge">'.$num.'</span>' : '').'</th></tr>';
324 324
 
325 325
 		if ($num > 0)
326 326
 		{
@@ -330,24 +330,24 @@  discard block
 block discarded – undo
330 330
 
331 331
 				$obj = $db->fetch_object($resql);
332 332
 				print '<tr class="oddeven"><td class="nowrap">';
333
-                $orderstatic->id=$obj->rowid;
334
-                $orderstatic->ref=$obj->ref;
335
-                $orderstatic->ref_client=$obj->ref_client;
333
+                $orderstatic->id = $obj->rowid;
334
+                $orderstatic->ref = $obj->ref;
335
+                $orderstatic->ref_client = $obj->ref_client;
336 336
                 $orderstatic->total_ht = $obj->total_ht;
337 337
                 $orderstatic->total_tva = $obj->total_tva;
338 338
                 $orderstatic->total_ttc = $obj->total_ttc;
339 339
                 print $orderstatic->getNomUrl(1);
340 340
                 print '</td>';
341 341
 				print '<td class="nowrap">';
342
-				$companystatic->id=$obj->socid;
343
-				$companystatic->name=$obj->name;
344
-				$companystatic->client=$obj->client;
342
+				$companystatic->id = $obj->socid;
343
+				$companystatic->name = $obj->name;
344
+				$companystatic->client = $obj->client;
345 345
                 $companystatic->code_client = $obj->code_client;
346 346
                 $companystatic->code_fournisseur = $obj->code_fournisseur;
347
-                $companystatic->canvas=$obj->canvas;
348
-				print $companystatic->getNomUrl(1,'customer',16);
347
+                $companystatic->canvas = $obj->canvas;
348
+				print $companystatic->getNomUrl(1, 'customer', 16);
349 349
 				print '</td>';
350
-				if(! empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) {
350
+				if (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) {
351 351
 					print '<td align="right" class="nowrap">'.price($obj->total_ht).'</td></tr>';
352 352
 				}
353 353
 				else {
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 				$i++;
357 357
 				$total += $obj->total_ttc;
358 358
 			}
359
-			if ($total>0)
359
+			if ($total > 0)
360 360
 			{
361 361
 
362 362
 				print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>";
@@ -382,21 +382,21 @@  discard block
 block discarded – undo
382 382
 /*
383 383
  * Draft suppliers orders
384 384
  */
385
-if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire)
385
+if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire)
386 386
 {
387 387
     $langs->load("orders");
388 388
 
389 389
     $sql = "SELECT cf.rowid, cf.ref, cf.ref_supplier, cf.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
390
-    $sql.= ", s.code_client";
391
-    $sql.= ", s.code_fournisseur";
392
-    $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf";
393
-    $sql.= ", ".MAIN_DB_PREFIX."societe as s";
394
-    if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
395
-    $sql.= " WHERE cf.fk_soc = s.rowid";
396
-    $sql.= " AND cf.fk_statut = 0";
397
-    $sql.= " AND cf.entity IN (".getEntity('supplier_order').")";
398
-    if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
399
-    if ($socid)	$sql.= " AND cf.fk_soc = ".$socid;
390
+    $sql .= ", s.code_client";
391
+    $sql .= ", s.code_fournisseur";
392
+    $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf";
393
+    $sql .= ", ".MAIN_DB_PREFIX."societe as s";
394
+    if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
395
+    $sql .= " WHERE cf.fk_soc = s.rowid";
396
+    $sql .= " AND cf.fk_statut = 0";
397
+    $sql .= " AND cf.entity IN (".getEntity('supplier_order').")";
398
+    if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
399
+    if ($socid)	$sql .= " AND cf.fk_soc = ".$socid;
400 400
 
401 401
     $resql = $db->query($sql);
402 402
     if ($resql)
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
         print '<div class="div-table-responsive-no-min">';
408 408
         print '<table class="noborder" width="100%">';
409 409
         print '<tr class="liste_titre">';
410
-        print '<th colspan="3">'.$langs->trans("DraftSuppliersOrders").($num?' <span class="badge">'.$num.'</span>':'').'</th></tr>';
410
+        print '<th colspan="3">'.$langs->trans("DraftSuppliersOrders").($num ? ' <span class="badge">'.$num.'</span>' : '').'</th></tr>';
411 411
 
412 412
         if ($num > 0)
413 413
         {
@@ -417,24 +417,24 @@  discard block
 block discarded – undo
417 417
 
418 418
                 $obj = $db->fetch_object($resql);
419 419
                 print '<tr class="oddeven"><td class="nowrap">';
420
-                $supplierorderstatic->id=$obj->rowid;
421
-                $supplierorderstatic->ref=$obj->ref;
422
-                $supplierorderstatic->ref_supplier=$obj->ref_suppliert;
420
+                $supplierorderstatic->id = $obj->rowid;
421
+                $supplierorderstatic->ref = $obj->ref;
422
+                $supplierorderstatic->ref_supplier = $obj->ref_suppliert;
423 423
                 $supplierorderstatic->total_ht = $obj->total_ht;
424 424
                 $supplierorderstatic->total_tva = $obj->total_tva;
425 425
                 $supplierorderstatic->total_ttc = $obj->total_ttc;
426 426
                 print $supplierorderstatic->getNomUrl(1);
427 427
                 print '</td>';
428 428
                 print '<td class="nowrap">';
429
-                $companystatic->id=$obj->socid;
430
-                $companystatic->name=$obj->name;
431
-                $companystatic->client=$obj->client;
429
+                $companystatic->id = $obj->socid;
430
+                $companystatic->name = $obj->name;
431
+                $companystatic->client = $obj->client;
432 432
                 $companystatic->code_client = $obj->code_client;
433 433
                 $companystatic->code_fournisseur = $obj->code_fournisseur;
434
-                $companystatic->canvas=$obj->canvas;
435
-                print $companystatic->getNomUrl(1,'supplier',16);
434
+                $companystatic->canvas = $obj->canvas;
435
+                print $companystatic->getNomUrl(1, 'supplier', 16);
436 436
                 print '</td>';
437
-				if(! empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) {
437
+				if (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) {
438 438
 					print '<td align="right" class="nowrap">'.price($obj->total_ht).'</td></tr>';
439 439
 				}
440 440
 				else {
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
                 $i++;
444 444
                 $total += $obj->total_ttc;
445 445
             }
446
-            if ($total>0)
446
+            if ($total > 0)
447 447
             {
448 448
 
449 449
                 print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>";
@@ -467,25 +467,25 @@  discard block
 block discarded – undo
467 467
 print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
468 468
 
469 469
 
470
-$NBMAX=3;
471
-$max=3;
470
+$NBMAX = 3;
471
+$max = 3;
472 472
 
473 473
 
474 474
 /*
475 475
  * Last modified customers or prospects
476 476
  */
477
-if (! empty($conf->societe->enabled) && $user->rights->societe->lire)
477
+if (!empty($conf->societe->enabled) && $user->rights->societe->lire)
478 478
 {
479 479
 	$langs->load("boxes");
480 480
 
481 481
 	$sql = "SELECT s.rowid, s.nom as name, s.client, s.datec, s.tms, s.canvas";
482
-    $sql.= ", s.code_client";
483
-	$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
484
-	if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
485
-	$sql.= " WHERE s.client IN (1, 2, 3)";
486
-	$sql.= " AND s.entity IN (".getEntity($companystatic->element).")";
487
-	if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
488
-	if ($socid)	$sql.= " AND s.rowid = $socid";
482
+    $sql .= ", s.code_client";
483
+	$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
484
+	if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
485
+	$sql .= " WHERE s.client IN (1, 2, 3)";
486
+	$sql .= " AND s.entity IN (".getEntity($companystatic->element).")";
487
+	if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
488
+	if ($socid)	$sql .= " AND s.rowid = $socid";
489 489
 	$sql .= " ORDER BY s.tms DESC";
490 490
 	$sql .= $db->plimit($max, 0);
491 491
 
@@ -499,9 +499,9 @@  discard block
 block discarded – undo
499 499
 		print '<table class="noborder" width="100%">';
500 500
 		print '<tr class="liste_titre">';
501 501
 		print '<th colspan="2">';
502
-		if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastCustomersOrProspects",$max);
503
-        else if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastModifiedProspects",$max);
504
-		else print $langs->trans("BoxTitleLastModifiedCustomers",$max);
502
+		if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastCustomersOrProspects", $max);
503
+        else if (!empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastModifiedProspects", $max);
504
+		else print $langs->trans("BoxTitleLastModifiedCustomers", $max);
505 505
 		print '</th>';
506 506
 		print '<th align="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/societe/list.php?type=p,c">'.$langs->trans("FullList").'</a></th>';
507 507
 		print '</tr>';
@@ -510,18 +510,18 @@  discard block
 block discarded – undo
510 510
 			while ($i < $num)
511 511
 			{
512 512
 				$objp = $db->fetch_object($resql);
513
-				$companystatic->id=$objp->rowid;
514
-				$companystatic->name=$objp->name;
515
-				$companystatic->client=$objp->client;
513
+				$companystatic->id = $objp->rowid;
514
+				$companystatic->name = $objp->name;
515
+				$companystatic->client = $objp->client;
516 516
                 $companystatic->code_client = $objp->code_client;
517 517
                 $companystatic->code_fournisseur = $objp->code_fournisseur;
518
-                $companystatic->canvas=$objp->canvas;
518
+                $companystatic->canvas = $objp->canvas;
519 519
 				print '<tr class="oddeven">';
520
-				print '<td class="nowrap">'.$companystatic->getNomUrl(1,'customer',48).'</td>';
520
+				print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'customer', 48).'</td>';
521 521
 				print '<td align="right" nowrap>';
522 522
 				print $companystatic->getLibCustProspStatut();
523 523
 				print "</td>";
524
-				print '<td align="right" nowrap>'.dol_print_date($db->jdate($objp->tms),'day')."</td>";
524
+				print '<td align="right" nowrap>'.dol_print_date($db->jdate($objp->tms), 'day')."</td>";
525 525
 				print '</tr>';
526 526
 				$i++;
527 527
 			}
@@ -538,20 +538,20 @@  discard block
 block discarded – undo
538 538
 }
539 539
 
540 540
 // Last suppliers
541
-if (! empty($conf->fournisseur->enabled) && $user->rights->societe->lire)
541
+if (!empty($conf->fournisseur->enabled) && $user->rights->societe->lire)
542 542
 {
543 543
 	$langs->load("boxes");
544 544
 
545 545
 	$sql = "SELECT s.nom as name, s.rowid, s.datec as dc, s.canvas, s.tms as dm";
546
-    $sql.= ", s.code_fournisseur";
547
-	$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
548
-	if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
549
-	$sql.= " WHERE s.fournisseur = 1";
550
-	$sql.= " AND s.entity IN (".getEntity($companystatic->element).")";
551
-	if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
552
-	if ($socid)	$sql.= " AND s.rowid = ".$socid;
553
-	$sql.= " ORDER BY s.datec DESC";
554
-	$sql.= $db->plimit($max, 0);
546
+    $sql .= ", s.code_fournisseur";
547
+	$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
548
+	if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
549
+	$sql .= " WHERE s.fournisseur = 1";
550
+	$sql .= " AND s.entity IN (".getEntity($companystatic->element).")";
551
+	if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
552
+	if ($socid)	$sql .= " AND s.rowid = ".$socid;
553
+	$sql .= " ORDER BY s.datec DESC";
554
+	$sql .= $db->plimit($max, 0);
555 555
 
556 556
 	$result = $db->query($sql);
557 557
 	if ($result)
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 		print '<div class="div-table-responsive-no-min">';
563 563
 		print '<table class="noborder" width="100%">';
564 564
 		print '<tr class="liste_titre">';
565
-		print '<th>'.$langs->trans("BoxTitleLastModifiedSuppliers",min($max,$num)).'</th>';
565
+		print '<th>'.$langs->trans("BoxTitleLastModifiedSuppliers", min($max, $num)).'</th>';
566 566
 		print '<th align="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/societe/list.php?type=f">'.$langs->trans("FullList").'</a></th>';
567 567
 		print '</tr>';
568 568
 		if ($num)
@@ -570,14 +570,14 @@  discard block
 block discarded – undo
570 570
 			while ($i < $num && $i < $max)
571 571
 			{
572 572
 				$objp = $db->fetch_object($result);
573
-				$companystatic->id=$objp->rowid;
574
-                $companystatic->name=$objp->name;
573
+				$companystatic->id = $objp->rowid;
574
+                $companystatic->name = $objp->name;
575 575
                 $companystatic->code_client = $objp->code_client;
576 576
                 $companystatic->code_fournisseur = $objp->code_fournisseur;
577
-                $companystatic->canvas=$objp->canvas;
577
+                $companystatic->canvas = $objp->canvas;
578 578
                 print '<tr class="oddeven">';
579
-				print '<td class="nowrap">'.$companystatic->getNomUrl(1,'supplier',44).'</td>';
580
-				print '<td align="right">'.dol_print_date($db->jdate($objp->dm),'day').'</td>';
579
+				print '<td class="nowrap">'.$companystatic->getNomUrl(1, 'supplier', 44).'</td>';
580
+				print '<td align="right">'.dol_print_date($db->jdate($objp->dm), 'day').'</td>';
581 581
 				print '</tr>';
582 582
 
583 583
 				$i++;
@@ -614,26 +614,26 @@  discard block
 block discarded – undo
614 614
 /*
615 615
  * Last contracts
616 616
  */
617
-if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TODO A REFAIRE DEPUIS NOUVEAU CONTRAT
617
+if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TODO A REFAIRE DEPUIS NOUVEAU CONTRAT
618 618
 {
619 619
 	$langs->load("contracts");
620 620
 
621 621
 	$sql = "SELECT s.nom as name, s.rowid, s.canvas, ";
622
-    $sql.= ", s.code_client";
623
-	$sql.= " c.statut, c.rowid as contratid, p.ref, c.mise_en_service as datemes, c.fin_validite as datefin, c.date_cloture as dateclo";
624
-	$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
625
-	$sql.= ", ".MAIN_DB_PREFIX."contrat as c";
626
-	$sql.= ", ".MAIN_DB_PREFIX."product as p";
627
-	if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
628
-	$sql.= " WHERE c.fk_soc = s.rowid";
629
-	$sql.= " AND c.entity IN (".getEntity('contract').")";
630
-	$sql.= " AND c.fk_product = p.rowid";
631
-	if (! $user->rights->societe->client->voir && ! $socid)	$sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
632
-	if ($socid) $sql.= " AND s.rowid = ".$socid;
633
-	$sql.= " ORDER BY c.tms DESC";
634
-	$sql.= $db->plimit(5, 0);
635
-
636
-	$resql=$db->query($sql);
622
+    $sql .= ", s.code_client";
623
+	$sql .= " c.statut, c.rowid as contratid, p.ref, c.mise_en_service as datemes, c.fin_validite as datefin, c.date_cloture as dateclo";
624
+	$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
625
+	$sql .= ", ".MAIN_DB_PREFIX."contrat as c";
626
+	$sql .= ", ".MAIN_DB_PREFIX."product as p";
627
+	if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
628
+	$sql .= " WHERE c.fk_soc = s.rowid";
629
+	$sql .= " AND c.entity IN (".getEntity('contract').")";
630
+	$sql .= " AND c.fk_product = p.rowid";
631
+	if (!$user->rights->societe->client->voir && !$socid)	$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
632
+	if ($socid) $sql .= " AND s.rowid = ".$socid;
633
+	$sql .= " ORDER BY c.tms DESC";
634
+	$sql .= $db->plimit(5, 0);
635
+
636
+	$resql = $db->query($sql);
637 637
 	if ($resql)
638 638
 	{
639 639
 		$num = $db->num_rows($resql);
@@ -642,24 +642,24 @@  discard block
 block discarded – undo
642 642
 		{
643 643
 			print '<div class="div-table-responsive-no-min">';
644 644
 			print '<table class="noborder" width="100%">';
645
-			print '<tr class="liste_titre"><th colspan="3">'.$langs->trans("LastContracts",5).'</th></tr>';
645
+			print '<tr class="liste_titre"><th colspan="3">'.$langs->trans("LastContracts", 5).'</th></tr>';
646 646
 			$i = 0;
647 647
 
648
-			$staticcontrat=new Contrat($db);
648
+			$staticcontrat = new Contrat($db);
649 649
 
650 650
 			while ($i < $num)
651 651
 			{
652 652
 				$obj = $db->fetch_object($resql);
653 653
 				print '<tr class="oddeven"><td><a href=\"../contrat/card.php?id=".$obj->contratid."\">".img_object($langs->trans("ShowContract","contract"), "contract")." ".$obj->ref."</a></td>';
654 654
 				print '<td>';
655
-                $companystatic->id=$objp->rowid;
656
-                $companystatic->name=$objp->name;
655
+                $companystatic->id = $objp->rowid;
656
+                $companystatic->name = $objp->name;
657 657
                 $companystatic->code_client = $objp->code_client;
658 658
                 $companystatic->code_fournisseur = $objp->code_fournisseur;
659
-                $companystatic->canvas=$objp->canvas;
660
-                print $companystatic->getNomUrl(1,'customer',44);
659
+                $companystatic->canvas = $objp->canvas;
660
+                print $companystatic->getNomUrl(1, 'customer', 44);
661 661
 				print '</td>'."\n";
662
-				print "<td align=\"right\">".$staticcontrat->LibStatut($obj->statut,3)."</td></tr>\n";
662
+				print "<td align=\"right\">".$staticcontrat->LibStatut($obj->statut, 3)."</td></tr>\n";
663 663
 
664 664
 				$i++;
665 665
 			}
@@ -676,23 +676,23 @@  discard block
 block discarded – undo
676 676
 /*
677 677
  * Opened proposals
678 678
  */
679
-if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
679
+if (!empty($conf->propal->enabled) && $user->rights->propal->lire)
680 680
 {
681 681
 	$langs->load("propal");
682 682
 
683 683
 	$sql = "SELECT s.nom as name, s.rowid, s.code_client";
684
-	$sql.= ", p.rowid as propalid, p.entity, p.total as total_ttc, p.total_ht, p.tva as total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
685
-	$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
686
-	$sql.= ", ".MAIN_DB_PREFIX."propal as p";
687
-	if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
688
-	$sql.= " WHERE p.fk_soc = s.rowid";
689
-	$sql.= " AND p.entity IN (".getEntity('propal').")";
690
-	$sql.= " AND p.fk_statut = 1";
691
-	if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
692
-	if ($socid) $sql.= " AND s.rowid = ".$socid;
693
-	$sql.= " ORDER BY p.rowid DESC";
694
-
695
-	$result=$db->query($sql);
684
+	$sql .= ", p.rowid as propalid, p.entity, p.total as total_ttc, p.total_ht, p.tva as total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
685
+	$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
686
+	$sql .= ", ".MAIN_DB_PREFIX."propal as p";
687
+	if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
688
+	$sql .= " WHERE p.fk_soc = s.rowid";
689
+	$sql .= " AND p.entity IN (".getEntity('propal').")";
690
+	$sql .= " AND p.fk_statut = 1";
691
+	if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
692
+	if ($socid) $sql .= " AND s.rowid = ".$socid;
693
+	$sql .= " ORDER BY p.rowid DESC";
694
+
695
+	$result = $db->query($sql);
696 696
 	if ($result)
697 697
 	{
698 698
 		$total = 0;
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
 			print '<table class="noborder" width="100%">';
705 705
 			print '<tr class="liste_titre"><th colspan="5">'.$langs->trans("ProposalsOpened").' <a href="'.DOL_URL_ROOT.'/comm/propal/list.php?viewstatut=1"><span class="badge">'.$num.'</span></th></tr>';
706 706
 
707
-			$nbofloop=min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD)?500:$conf->global->MAIN_MAXLIST_OVERLOAD));
707
+			$nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
708 708
 			while ($i < $nbofloop)
709 709
 			{
710 710
 				$obj = $db->fetch_object($result);
@@ -714,9 +714,9 @@  discard block
 block discarded – undo
714 714
 				// Ref
715 715
 				print '<td class="nowrap" width="140">';
716 716
 
717
-				$propalstatic->id=$obj->propalid;
718
-				$propalstatic->ref=$obj->ref;
719
-                $propalstatic->ref_client=$obj->ref_client;
717
+				$propalstatic->id = $obj->propalid;
718
+				$propalstatic->ref = $obj->ref;
719
+                $propalstatic->ref_client = $obj->ref_client;
720 720
                 $propalstatic->total_ht = $obj->total_ht;
721 721
                 $propalstatic->total_tva = $obj->total_tva;
722 722
                 $propalstatic->total_ttc = $obj->total_ttc;
@@ -729,32 +729,32 @@  discard block
 block discarded – undo
729 729
 				if ($db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
730 730
 				print '</td>';
731 731
 				print '<td width="16" align="center" class="nobordernopadding">';
732
-				$filename=dol_sanitizeFileName($obj->ref);
733
-				$filedir=$conf->propal->multidir_output[$obj->entity] . '/' . dol_sanitizeFileName($obj->ref);
734
-				$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->propalid;
732
+				$filename = dol_sanitizeFileName($obj->ref);
733
+				$filedir = $conf->propal->multidir_output[$obj->entity].'/'.dol_sanitizeFileName($obj->ref);
734
+				$urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->propalid;
735 735
 				print $formfile->getDocumentsLink($propalstatic->element, $filename, $filedir);
736 736
 				print '</td></tr></table>';
737 737
 
738 738
 				print "</td>";
739 739
 
740 740
                 print '<td class="nowrap">';
741
-                $companystatic->id=$obj->rowid;
742
-                $companystatic->name=$obj->name;
743
-                $companystatic->client=$obj->client;
741
+                $companystatic->id = $obj->rowid;
742
+                $companystatic->name = $obj->name;
743
+                $companystatic->client = $obj->client;
744 744
                 $companystatic->code_client = $obj->code_client;
745 745
                 $companystatic->code_fournisseur = $obj->code_fournisseur;
746
-                $companystatic->canvas=$obj->canvas;
746
+                $companystatic->canvas = $obj->canvas;
747 747
                 print $companystatic->getNomUrl(1, 'customer', 44);
748 748
                 print '</td>';
749 749
 				print '<td align="right">';
750
-				print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n";
751
-				if(! empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) {
750
+				print dol_print_date($db->jdate($obj->dp), 'day').'</td>'."\n";
751
+				if (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) {
752 752
 					print '<td align="right">'.price($obj->total_ht).'</td>';
753 753
 				}
754 754
 				else {
755 755
 					print '<td align="right">'.price($obj->total_ttc).'</td>';
756 756
 				}
757
-				print '<td align="center" width="14">'.$propalstatic->LibStatut($obj->fk_statut,3).'</td>'."\n";
757
+				print '<td align="center" width="14">'.$propalstatic->LibStatut($obj->fk_statut, 3).'</td>'."\n";
758 758
 				print '</tr>'."\n";
759 759
 				$i++;
760 760
 				$total += $obj->total_ttc;
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
 			{
764 764
 				print '<tr class="liste_total"><td colspan="5">'.$langs->trans("XMoreLines", ($num - $nbofloop))."</td></tr>";
765 765
 			}
766
-			else if ($total>0)
766
+			else if ($total > 0)
767 767
 			{
768 768
 				print '<tr class="liste_total"><td colspan="3">'.$langs->trans("Total")."</td><td align=\"right\">".price($total)."</td><td>&nbsp;</td></tr>";
769 769
 			}
@@ -780,23 +780,23 @@  discard block
 block discarded – undo
780 780
 /*
781 781
  * Opened Order
782 782
  */
783
-if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
783
+if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
784 784
 {
785 785
 	$langs->load("orders");
786 786
 
787 787
 	$sql = "SELECT s.nom as name, s.rowid, c.rowid as commandeid, c.total_ttc, c.total_ht, c.tva as total_tva, c.ref, c.ref_client, c.fk_statut, c.date_valid as dv, c.facture as billed";
788
-    $sql.= ", s.code_client";
789
-	$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
790
-	$sql.= ", ".MAIN_DB_PREFIX."commande as c";
791
-	if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
792
-	$sql.= " WHERE c.fk_soc = s.rowid";
793
-	$sql.= " AND c.entity IN (".getEntity('commande').")";
794
-	$sql.= " AND (c.fk_statut = ".Commande::STATUS_VALIDATED." or c.fk_statut = ".Commande::STATUS_SHIPMENTONPROCESS.")";
795
-	if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
796
-	if ($socid) $sql.= " AND s.rowid = ".$socid;
797
-	$sql.= " ORDER BY c.rowid DESC";
798
-
799
-	$result=$db->query($sql);
788
+    $sql .= ", s.code_client";
789
+	$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
790
+	$sql .= ", ".MAIN_DB_PREFIX."commande as c";
791
+	if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
792
+	$sql .= " WHERE c.fk_soc = s.rowid";
793
+	$sql .= " AND c.entity IN (".getEntity('commande').")";
794
+	$sql .= " AND (c.fk_statut = ".Commande::STATUS_VALIDATED." or c.fk_statut = ".Commande::STATUS_SHIPMENTONPROCESS.")";
795
+	if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
796
+	if ($socid) $sql .= " AND s.rowid = ".$socid;
797
+	$sql .= " ORDER BY c.rowid DESC";
798
+
799
+	$result = $db->query($sql);
800 800
 	if ($result)
801 801
 	{
802 802
 		$total = 0;
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
 			print '<table class="noborder" width="100%">';
809 809
 			print '<tr class="liste_titre"><th class="liste_titre" colspan="5">'.$langs->trans("OrdersOpened").' <a href="'.DOL_URL_ROOT.'/commande/list.php?viewstatut=1"><span class="badge">'.$num.'</span></th></tr>';
810 810
 
811
-			$nbofloop=min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD)?500:$conf->global->MAIN_MAXLIST_OVERLOAD));
811
+			$nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
812 812
 			while ($i < $nbofloop)
813 813
 			{
814 814
 				$obj = $db->fetch_object($result);
@@ -818,9 +818,9 @@  discard block
 block discarded – undo
818 818
 				// Ref
819 819
 				print '<td class="nowrap" width="140">';
820 820
 
821
-				$orderstatic->id=$obj->commandeid;
822
-				$orderstatic->ref=$obj->ref;
823
-                $orderstatic->ref_client=$obj->ref_client;
821
+				$orderstatic->id = $obj->commandeid;
822
+				$orderstatic->ref = $obj->ref;
823
+                $orderstatic->ref_client = $obj->ref_client;
824 824
                 $orderstatic->total_ht = $obj->total_ht;
825 825
                 $orderstatic->total_tva = $obj->total_tva;
826 826
                 $orderstatic->total_ttc = $obj->total_ttc;
@@ -833,32 +833,32 @@  discard block
 block discarded – undo
833 833
 				//if ($db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
834 834
 				print '</td>';
835 835
 				print '<td width="16" align="center" class="nobordernopadding">';
836
-				$filename=dol_sanitizeFileName($obj->ref);
837
-				$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
838
-				$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->propalid;
836
+				$filename = dol_sanitizeFileName($obj->ref);
837
+				$filedir = $conf->commande->dir_output.'/'.dol_sanitizeFileName($obj->ref);
838
+				$urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->propalid;
839 839
 				print $formfile->getDocumentsLink($orderstatic->element, $filename, $filedir);
840 840
 				print '</td></tr></table>';
841 841
 
842 842
 				print "</td>";
843 843
 
844 844
                 print '<td class="nowrap">';
845
-                $companystatic->id=$obj->rowid;
846
-                $companystatic->name=$obj->name;
847
-                $companystatic->client=$obj->client;
845
+                $companystatic->id = $obj->rowid;
846
+                $companystatic->name = $obj->name;
847
+                $companystatic->client = $obj->client;
848 848
                 $companystatic->code_client = $obj->code_client;
849 849
                 $companystatic->code_fournisseur = $obj->code_fournisseur;
850
-                $companystatic->canvas=$obj->canvas;
850
+                $companystatic->canvas = $obj->canvas;
851 851
                 print $companystatic->getNomUrl(1, 'customer', 44);
852 852
                 print '</td>';
853 853
 				print '<td align="right">';
854
-				print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n";
855
-				if(! empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) {
854
+				print dol_print_date($db->jdate($obj->dp), 'day').'</td>'."\n";
855
+				if (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) {
856 856
 					print '<td align="right">'.price($obj->total_ht).'</td>';
857 857
 				}
858 858
 				else {
859 859
 					print '<td align="right">'.price($obj->total_ttc).'</td>';
860 860
 				}
861
-				print '<td align="center" width="14">'.$orderstatic->LibStatut($obj->fk_statut,$obj->billed,3).'</td>'."\n";
861
+				print '<td align="center" width="14">'.$orderstatic->LibStatut($obj->fk_statut, $obj->billed, 3).'</td>'."\n";
862 862
 				print '</tr>'."\n";
863 863
 				$i++;
864 864
 				$total += $obj->total_ttc;
@@ -867,7 +867,7 @@  discard block
 block discarded – undo
867 867
 			{
868 868
 				print '<tr class="liste_total"><td colspan="5">'.$langs->trans("XMoreLines", ($num - $nbofloop))."</td></tr>";
869 869
 			}
870
-			else if ($total>0)
870
+			else if ($total > 0)
871 871
 			{
872 872
 				print '<tr class="liste_total"><td colspan="3">'.$langs->trans("Total")."</td><td align=\"right\">".price($total)."</td><td>&nbsp;</td></tr>";
873 873
 			}
Please login to merge, or discard this patch.
dolibarr/htdocs/comm/card.php 1 patch
Spacing   +149 added lines, -149 removed lines patch added patch discarded remove patch
@@ -30,30 +30,30 @@  discard block
 block discarded – undo
30 30
  *       \brief      Page to show customer card of a third party
31 31
  */
32 32
 
33
-require DOL_BASE_PATH . '/main.inc.php';
34
-
35
-require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
36
-require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
37
-require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php';
38
-require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
39
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
40
-require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
33
+require DOL_BASE_PATH.'/main.inc.php';
34
+
35
+require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
36
+require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
37
+require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
38
+require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
39
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
40
+require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
41 41
 if (!empty($conf->facture->enabled))
42
-    require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
42
+    require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
43 43
 if (!empty($conf->facture->enabled))
44
-    require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture-rec.class.php';
44
+    require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php';
45 45
 if (!empty($conf->propal->enabled))
46
-    require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
46
+    require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
47 47
 if (!empty($conf->commande->enabled))
48
-    require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
48
+    require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
49 49
 if (!empty($conf->expedition->enabled))
50
-    require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';
50
+    require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
51 51
 if (!empty($conf->contrat->enabled))
52
-    require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
52
+    require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
53 53
 if (!empty($conf->adherent->enabled))
54
-    require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
54
+    require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
55 55
 if (!empty($conf->ficheinter->enabled))
56
-    require_once DOL_DOCUMENT_ROOT . '/fichinter/class/fichinter.class.php';
56
+    require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
57 57
 
58 58
 // Load translation files required by the page
59 59
 $langs->loadLangs(array('companies', 'banks'));
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 
259 259
     dol_fiche_head($head, 'customer', $langs->trans("ThirdParty"), -1, 'company');
260 260
 
261
-    $linkback = '<a href="' . DOL_URL_ROOT . '/societe/list.php">' . $langs->trans("BackToList") . '</a>';
261
+    $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php">'.$langs->trans("BackToList").'</a>';
262 262
 
263 263
     dol_banner_tab($object, 'socid', $linkback, ($user->societe_id ? 0 : 1), 'rowid', 'nom');
264 264
 
@@ -268,13 +268,13 @@  discard block
 block discarded – undo
268 268
     print '<table class="border" width="100%">';
269 269
 
270 270
     // Prospect/Customer
271
-    print '<tr><td class="titlefield">' . $langs->trans('ProspectCustomer') . '</td><td>';
271
+    print '<tr><td class="titlefield">'.$langs->trans('ProspectCustomer').'</td><td>';
272 272
     print $object->getLibCustProspStatut();
273 273
     print '</td></tr>';
274 274
 
275 275
     // Prefix
276 276
     if (!empty($conf->global->SOCIETE_USEPREFIX)) {  // Old not used prefix field
277
-        print '<tr><td>' . $langs->trans("Prefix") . '</td><td>';
277
+        print '<tr><td>'.$langs->trans("Prefix").'</td><td>';
278 278
         print ($object->prefix_comm ? $object->prefix_comm : '&nbsp;');
279 279
         print '</td></tr>';
280 280
     }
@@ -283,10 +283,10 @@  discard block
 block discarded – undo
283 283
         $langs->load("compta");
284 284
 
285 285
         print '<tr><td>';
286
-        print $langs->trans('CustomerCode') . '</td><td>';
286
+        print $langs->trans('CustomerCode').'</td><td>';
287 287
         print $object->code_client;
288 288
         if ($object->check_codeclient() <> 0)
289
-            print ' <font class="error">(' . $langs->trans("WrongCustomerCode") . ')</font>';
289
+            print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
290 290
         print '</td></tr>';
291 291
 
292 292
         print '<tr>';
@@ -316,19 +316,19 @@  discard block
 block discarded – undo
316 316
     if ($mysoc->country_code == 'ES') {
317 317
         // Local Taxes
318 318
         if ($mysoc->localtax1_assuj == "1") {
319
-            print '<tr><td class="nowrap">' . $langs->transcountry("LocalTax1IsUsed", $mysoc->country_code) . '</td><td>';
319
+            print '<tr><td class="nowrap">'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).'</td><td>';
320 320
             print yn($object->localtax1_assuj);
321 321
             print '</td></tr>';
322 322
         }
323 323
         if ($mysoc->localtax1_assuj == "1") {
324
-            print '<tr><td class="nowrap">' . $langs->transcountry("LocalTax2IsUsed", $mysoc->country_code) . '</td><td>';
324
+            print '<tr><td class="nowrap">'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).'</td><td>';
325 325
             print yn($object->localtax2_assuj);
326 326
             print '</td></tr>';
327 327
         }
328 328
     }
329 329
 
330 330
     // TVA Intra
331
-    print '<tr><td class="nowrap">' . $langs->trans('VATIntra') . '</td><td>';
331
+    print '<tr><td class="nowrap">'.$langs->trans('VATIntra').'</td><td>';
332 332
     print $object->tva_intra;
333 333
     print '</td></tr>';
334 334
 
@@ -339,15 +339,15 @@  discard block
 block discarded – undo
339 339
     print $langs->trans('PaymentConditions');
340 340
     print '<td>';
341 341
     if (($action != 'editconditions') && $user->rights->societe->creer)
342
-        print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editconditions&amp;socid=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>';
342
+        print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;socid='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>';
343 343
     print '</tr></table>';
344 344
     print '</td><td>';
345 345
     if ($action == 'editconditions') {
346 346
         // $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id',1);
347
-        $form->form_conditions_reglement($_SERVER['PHP_SELF'] . '&socid=' . $object->id, $object->cond_reglement_id, 'cond_reglement_id', 1);
347
+        $form->form_conditions_reglement($_SERVER['PHP_SELF'].'&socid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id', 1);
348 348
     } else {
349 349
         // $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_id, 'none');
350
-        $form->form_conditions_reglement($_SERVER['PHP_SELF'] . '&socid=' . $object->id, $object->cond_reglement_id, 'none');
350
+        $form->form_conditions_reglement($_SERVER['PHP_SELF'].'&socid='.$object->id, $object->cond_reglement_id, 'none');
351 351
     }
352 352
     print "</td>";
353 353
     print '</tr>';
@@ -358,15 +358,15 @@  discard block
 block discarded – undo
358 358
     print $langs->trans('PaymentMode');
359 359
     print '<td>';
360 360
     if (($action != 'editmode') && $user->rights->societe->creer)
361
-        print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmode&amp;socid=' . $object->id . '">' . img_edit($langs->trans('SetMode'), 1) . '</a></td>';
361
+        print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
362 362
     print '</tr></table>';
363 363
     print '</td><td>';
364 364
     if ($action == 'editmode') {
365 365
         // $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->mode_reglement_id,'mode_reglement_id', 'CRDT');
366
-        $form->form_modes_reglement($_SERVER['PHP_SELF'] . '&socid=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT');
366
+        $form->form_modes_reglement($_SERVER['PHP_SELF'].'&socid='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT');
367 367
     } else {
368 368
         // $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->mode_reglement_id,'none');
369
-        $form->form_modes_reglement($_SERVER['PHP_SELF'] . '&socid=' . $object->id, $object->mode_reglement_id, 'none');
369
+        $form->form_modes_reglement($_SERVER['PHP_SELF'].'&socid='.$object->id, $object->mode_reglement_id, 'none');
370 370
     }
371 371
     print "</td>";
372 372
     print '</tr>';
@@ -378,15 +378,15 @@  discard block
 block discarded – undo
378 378
         print $langs->trans('PaymentBankAccount');
379 379
         print '<td>';
380 380
         if (($action != 'editbankaccount') && $user->rights->societe->creer)
381
-            print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editbankaccount&amp;socid=' . $object->id . '">' . img_edit($langs->trans('SetBankAccount'), 1) . '</a></td>';
381
+            print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;socid='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
382 382
         print '</tr></table>';
383 383
         print '</td><td>';
384 384
         if ($action == 'editbankaccount') {
385 385
             // $form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_account,'fk_account',1);
386
-            $form->formSelectAccount($_SERVER['PHP_SELF'] . '&socid=' . $object->id, $object->fk_account, 'fk_account', 1);
386
+            $form->formSelectAccount($_SERVER['PHP_SELF'].'&socid='.$object->id, $object->fk_account, 'fk_account', 1);
387 387
         } else {
388 388
             // $form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_account,'none');
389
-            $form->formSelectAccount($_SERVER['PHP_SELF'] . '&socid=' . $object->id, $object->fk_account, 'none');
389
+            $form->formSelectAccount($_SERVER['PHP_SELF'].'&socid='.$object->id, $object->fk_account, 'none');
390 390
         }
391 391
         print "</td>";
392 392
         print '</tr>';
@@ -398,10 +398,10 @@  discard block
 block discarded – undo
398 398
     print $langs->trans("CustomerRelativeDiscountShort");
399 399
     print '<td><td align="right">';
400 400
     if ($user->rights->societe->creer && !$user->societe_id > 0) {
401
-        print '<a href="' . DOL_URL_ROOT . '/comm/remise.php?id=' . $object->id . '">' . img_edit($langs->trans("Modify")) . '</a>';
401
+        print '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.img_edit($langs->trans("Modify")).'</a>';
402 402
     }
403 403
     print '</td></tr></table>';
404
-    print '</td><td>' . ($object->remise_percent ? '<a href="' . DOL_URL_ROOT . '/comm/remise.php?id=' . $object->id . '">' . $object->remise_percent . '%</a>' : '') . '</td>';
404
+    print '</td><td>'.($object->remise_percent ? '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.$object->remise_percent.'%</a>' : '').'</td>';
405 405
     print '</tr>';
406 406
 
407 407
     // Absolute discounts (Discounts-Drawbacks-Rebates)
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
     print '<td><td align="right">';
413 413
     if ($user->rights->societe->creer && !$user->societe_id > 0) {
414 414
         // print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'">'.img_edit($langs->trans("Modify")).'</a>';
415
-        print '<a href="' . BASE_URI . '?controller=comm&method=remx&id=' . $object->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '&socid=' . $object->id) . '">' . img_edit($langs->trans("Modify")) . '</a>';
415
+        print '<a href="'.BASE_URI.'?controller=comm&method=remx&id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'&socid='.$object->id).'">'.img_edit($langs->trans("Modify")).'</a>';
416 416
     }
417 417
     print '</td></tr></table>';
418 418
     print '</td>';
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
     }
424 424
     if ($amount_discount > 0) {
425 425
         // print '<a href="' . DOL_URL_ROOT . '/comm/remx.php?id=' . $object->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?socid=' . $object->id) . '">' . price($amount_discount, 1, $langs, 1, -1, -1, $conf->currency) . '</a>';
426
-        print '<a href="' . BASE_URI . '?controller=comm&method=remx&id=' . $object->id . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '&socid=' . $object->id) . '">' . price($amount_discount, 1, $langs, 1, -1, -1, $conf->currency) . '</a>';
426
+        print '<a href="'.BASE_URI.'?controller=comm&method=remx&id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'&socid='.$object->id).'">'.price($amount_discount, 1, $langs, 1, -1, -1, $conf->currency).'</a>';
427 427
     }
428 428
     //else print $langs->trans("DiscountNone");
429 429
     print '</td>';
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 
446 446
     if ($object->client) {
447 447
         if (!empty($conf->commande->enabled) && !empty($conf->global->ORDER_MANAGE_MIN_AMOUNT)) {
448
-            print '<!-- Minimim amount for orders -->' . "\n";
448
+            print '<!-- Minimim amount for orders -->'."\n";
449 449
             print '<tr class="nowrap">';
450 450
             print '<td>';
451 451
             print $form->editfieldkey("OrderMinAmount", 'order_min_amount', $object->order_min_amount, $object, $user->rights->societe->creer);
@@ -464,14 +464,14 @@  discard block
 block discarded – undo
464 464
         print $langs->trans("PriceLevel");
465 465
         print '<td><td align="right">';
466 466
         if ($user->rights->societe->creer) {
467
-            print '<a href="' . DOL_URL_ROOT . '/comm/multiprix.php?id=' . $object->id . '">' . img_edit($langs->trans("Modify")) . '</a>';
467
+            print '<a href="'.DOL_URL_ROOT.'/comm/multiprix.php?id='.$object->id.'">'.img_edit($langs->trans("Modify")).'</a>';
468 468
         }
469 469
         print '</td></tr></table>';
470 470
         print '</td><td>';
471 471
         print $object->price_level;
472
-        $keyforlabel = 'PRODUIT_MULTIPRICES_LABEL' . $object->price_level;
472
+        $keyforlabel = 'PRODUIT_MULTIPRICES_LABEL'.$object->price_level;
473 473
         if (!empty($conf->global->$keyforlabel))
474
-            print ' - ' . $langs->trans($conf->global->$keyforlabel);
474
+            print ' - '.$langs->trans($conf->global->$keyforlabel);
475 475
         print "</td>";
476 476
         print '</tr>';
477 477
     }
@@ -483,15 +483,15 @@  discard block
 block discarded – undo
483 483
         print $langs->trans('SendingMethod');
484 484
         print '<td>';
485 485
         if (($action != 'editshipping') && $user->rights->societe->creer)
486
-            print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editshipping&amp;socid=' . $object->id . '">' . img_edit($langs->trans('SetMode'), 1) . '</a></td>';
486
+            print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editshipping&amp;socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
487 487
         print '</tr></table>';
488 488
         print '</td><td>';
489 489
         if ($action == 'editshipping') {
490 490
             // $form->formSelectShippingMethod($_SERVER['PHP_SELF'] . '?socid=' . $object->id, $object->shipping_method_id, 'shipping_method_id');
491
-            $form->formSelectShippingMethod($_SERVER['PHP_SELF'] . '&socid=' . $object->id, $object->shipping_method_id, 'shipping_method_id');
491
+            $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'&socid='.$object->id, $object->shipping_method_id, 'shipping_method_id');
492 492
         } else {
493 493
             // $form->formSelectShippingMethod($_SERVER['PHP_SELF'] . '?socid=' . $object->id, $object->shipping_method_id, 'none');
494
-            $form->formSelectShippingMethod($_SERVER['PHP_SELF'] . '&socid=' . $object->id, $object->shipping_method_id, 'none');
494
+            $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'&socid='.$object->id, $object->shipping_method_id, 'none');
495 495
         }
496 496
         print "</td>";
497 497
         print '</tr>';
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
     // Categories
501 501
     if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
502 502
         $langs->load("categories");
503
-        print '<tr><td>' . $langs->trans("CustomersCategoriesShort") . '</td>';
503
+        print '<tr><td>'.$langs->trans("CustomersCategoriesShort").'</td>';
504 504
         print '<td>';
505 505
         print $form->showCategories($object->id, 'customer', 1);
506 506
         print "</td></tr>";
@@ -508,17 +508,17 @@  discard block
 block discarded – undo
508 508
 
509 509
     // Other attributes
510 510
     $parameters = array('socid' => $object->id);
511
-    include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
511
+    include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
512 512
 
513 513
     // Sales representative
514
-    include DOL_DOCUMENT_ROOT . '/societe/tpl/linesalesrepresentative.tpl.php';
514
+    include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php';
515 515
 
516 516
     // Module Adherent
517 517
     if (!empty($conf->adherent->enabled)) {
518 518
         $langs->load("members");
519 519
         $langs->load("users");
520 520
 
521
-        print '<tr><td class="titlefield">' . $langs->trans("LinkedToDolibarrMember") . '</td>';
521
+        print '<tr><td class="titlefield">'.$langs->trans("LinkedToDolibarrMember").'</td>';
522 522
         print '<td>';
523 523
         $adh = new Adherent($db);
524 524
         $result = $adh->fetch('', '', $object->id);
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
             $adh->ref = $adh->getFullName($langs);
527 527
             print $adh->getNomUrl(1);
528 528
         } else {
529
-            print '<span class="opacitymedium">' . $langs->trans("ThirdpartyNotLinkedToMember") . '</span>';
529
+            print '<span class="opacitymedium">'.$langs->trans("ThirdpartyNotLinkedToMember").'</span>';
530 530
         }
531 531
         print '</td>';
532 532
         print "</tr>\n";
@@ -546,12 +546,12 @@  discard block
 block discarded – undo
546 546
         print $langs->trans('ProspectLevel');
547 547
         print '<td>';
548 548
         if ($action != 'editlevel' && $user->rights->societe->creer)
549
-            print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editlevel&amp;socid=' . $object->id . '">' . img_edit($langs->trans('Modify'), 1) . '</a></td>';
549
+            print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editlevel&amp;socid='.$object->id.'">'.img_edit($langs->trans('Modify'), 1).'</a></td>';
550 550
         print '</tr></table>';
551 551
         print '</td><td>';
552 552
         if ($action == 'editlevel') {
553 553
             // $formcompany->form_prospect_level($_SERVER['PHP_SELF'] . '?socid=' . $object->id, $object->fk_prospectlevel, 'prospect_level_id', 1);
554
-            $formcompany->form_prospect_level($_SERVER['PHP_SELF'] . '&socid=' . $object->id, $object->fk_prospectlevel, 'prospect_level_id', 1);
554
+            $formcompany->form_prospect_level($_SERVER['PHP_SELF'].'&socid='.$object->id, $object->fk_prospectlevel, 'prospect_level_id', 1);
555 555
         } else {
556 556
             print $object->getLibProspLevel();
557 557
         }
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 
561 561
         // Status
562 562
         $object->loadCacheOfProspStatus();
563
-        print '<tr><td>' . $langs->trans("StatusProsp") . '</td><td>' . $object->getLibProspCommStatut(4, $object->cacheprospectstatus[$object->stcomm_id]['label']);
563
+        print '<tr><td>'.$langs->trans("StatusProsp").'</td><td>'.$object->getLibProspCommStatut(4, $object->cacheprospectstatus[$object->stcomm_id]['label']);
564 564
         print ' &nbsp; &nbsp; ';
565 565
         print '<div class="floatright">';
566 566
         foreach ($object->cacheprospectstatus as $key => $val) {
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
                 $titlealt = $val['label'];
570 570
             if ($object->stcomm_id != $val['id'])
571 571
             // print '<a class="pictosubstatus" href="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '&stcomm=' . $val['code'] . '&action=setstcomm">' . img_action($titlealt, $val['code']) . '</a>';
572
-                print '<a class="pictosubstatus" href="' . $_SERVER["PHP_SELF"] . '&socid=' . $object->id . '&stcomm=' . $val['code'] . '&action=setstcomm">' . img_action($titlealt, $val['code']) . '</a>';
572
+                print '<a class="pictosubstatus" href="'.$_SERVER["PHP_SELF"].'&socid='.$object->id.'&stcomm='.$val['code'].'&action=setstcomm">'.img_action($titlealt, $val['code']).'</a>';
573 573
         }
574 574
         print '</div></td></tr>';
575 575
         print "</table>";
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
 
586 586
     // Lien recap
587 587
     $boxstat .= '<div class="box">';
588
-    $boxstat .= '<table summary="' . dol_escape_htmltag($langs->trans("DolibarrStateBoard")) . '" class="border boxtable boxtablenobottom boxtablenotop" width="100%">';
588
+    $boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="border boxtable boxtablenobottom boxtablenotop" width="100%">';
589 589
     $boxstat .= '<tr class="impair"><td colspan="2" class="tdboxstats nohover">';
590 590
 
591 591
     if (!empty($conf->propal->enabled)) {
@@ -596,14 +596,14 @@  discard block
 block discarded – undo
596 596
         $outstandingTotalIncTax = $tmp['total_ttc'];
597 597
         $text = $langs->trans("OverAllProposals");
598 598
         // $link = DOL_URL_ROOT . '/comm/propal/list.php?socid=' . $object->id;
599
-        $link = BASE_URI . '?controller=comm/propal&method=list&socid=' . $object->id;
599
+        $link = BASE_URI.'?controller=comm/propal&method=list&socid='.$object->id;
600 600
         $icon = 'bill';
601 601
         if ($link) {
602
-            $boxstat .= '<a href="' . $link . '" class="boxstatsindicator thumbstat nobold nounderline">';
602
+            $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
603 603
         }
604
-        $boxstat .= '<div class="boxstats" title="' . dol_escape_htmltag($text) . '">';
605
-        $boxstat .= '<span class="boxstatstext">' . img_object("", $icon) . ' ' . $text . '</span><br>';
606
-        $boxstat .= '<span class="boxstatsindicator">' . price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency) . '</span>';
604
+        $boxstat .= '<div class="boxstats" title="'.dol_escape_htmltag($text).'">';
605
+        $boxstat .= '<span class="boxstatstext">'.img_object("", $icon).' '.$text.'</span><br>';
606
+        $boxstat .= '<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
607 607
         $boxstat .= '</div>';
608 608
         if ($link)
609 609
             $boxstat .= '</a>';
@@ -616,13 +616,13 @@  discard block
 block discarded – undo
616 616
         $outstandingTotal = $tmp['total_ht'];
617 617
         $outstandingTotalIncTax = $tmp['total_ttc'];
618 618
         $text = $langs->trans("OverAllOrders");
619
-        $link = DOL_URL_ROOT . '/commande/list.php?socid=' . $object->id;
619
+        $link = DOL_URL_ROOT.'/commande/list.php?socid='.$object->id;
620 620
         $icon = 'bill';
621 621
         if ($link)
622
-            $boxstat .= '<a href="' . $link . '" class="boxstatsindicator thumbstat nobold nounderline">';
623
-        $boxstat .= '<div class="boxstats" title="' . dol_escape_htmltag($text) . '">';
624
-        $boxstat .= '<span class="boxstatstext">' . img_object("", $icon) . ' ' . $text . '</span><br>';
625
-        $boxstat .= '<span class="boxstatsindicator">' . price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency) . '</span>';
622
+            $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
623
+        $boxstat .= '<div class="boxstats" title="'.dol_escape_htmltag($text).'">';
624
+        $boxstat .= '<span class="boxstatstext">'.img_object("", $icon).' '.$text.'</span><br>';
625
+        $boxstat .= '<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
626 626
         $boxstat .= '</div>';
627 627
         if ($link)
628 628
             $boxstat .= '</a>';
@@ -635,13 +635,13 @@  discard block
 block discarded – undo
635 635
         $outstandingTotal = $tmp['total_ht'];
636 636
         $outstandingTotalIncTax = $tmp['total_ttc'];
637 637
         $text = $langs->trans("OverAllInvoices");
638
-        $link = DOL_URL_ROOT . '/compta/facture/list.php?socid=' . $object->id;
638
+        $link = DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id;
639 639
         $icon = 'bill';
640 640
         if ($link)
641
-            $boxstat .= '<a href="' . $link . '" class="boxstatsindicator thumbstat nobold nounderline">';
642
-        $boxstat .= '<div class="boxstats" title="' . dol_escape_htmltag($text) . '">';
643
-        $boxstat .= '<span class="boxstatstext">' . img_object("", $icon) . ' ' . $text . '</span><br>';
644
-        $boxstat .= '<span class="boxstatsindicator">' . price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency) . '</span>';
641
+            $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
642
+        $boxstat .= '<div class="boxstats" title="'.dol_escape_htmltag($text).'">';
643
+        $boxstat .= '<span class="boxstatstext">'.img_object("", $icon).' '.$text.'</span><br>';
644
+        $boxstat .= '<span class="boxstatsindicator">'.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).'</span>';
645 645
         $boxstat .= '</div>';
646 646
         if ($link)
647 647
             $boxstat .= '</a>';
@@ -649,16 +649,16 @@  discard block
 block discarded – undo
649 649
         // Box outstanding bill
650 650
         $warn = '';
651 651
         if ($object->outstanding_limit != '' && $object->outstanding_limit < $outstandingOpened) {
652
-            $warn = ' ' . img_warning($langs->trans("OutstandingBillReached"));
652
+            $warn = ' '.img_warning($langs->trans("OutstandingBillReached"));
653 653
         }
654 654
         $text = $langs->trans("CurrentOutstandingBill");
655
-        $link = DOL_URL_ROOT . '/compta/recap-compta.php?socid=' . $object->id;
655
+        $link = DOL_URL_ROOT.'/compta/recap-compta.php?socid='.$object->id;
656 656
         $icon = 'bill';
657 657
         if ($link)
658
-            $boxstat .= '<a href="' . $link . '" class="boxstatsindicator thumbstat nobold nounderline">';
659
-        $boxstat .= '<div class="boxstats" title="' . dol_escape_htmltag($text) . '">';
660
-        $boxstat .= '<span class="boxstatstext">' . img_object("", $icon) . ' ' . $text . '</span><br>';
661
-        $boxstat .= '<span class="boxstatsindicator' . ($outstandingOpened > 0 ? ' amountremaintopay' : '') . '">' . price($outstandingOpened, 1, $langs, 1, -1, -1, $conf->currency) . $warn . '</span>';
658
+            $boxstat .= '<a href="'.$link.'" class="boxstatsindicator thumbstat nobold nounderline">';
659
+        $boxstat .= '<div class="boxstats" title="'.dol_escape_htmltag($text).'">';
660
+        $boxstat .= '<span class="boxstatstext">'.img_object("", $icon).' '.$text.'</span><br>';
661
+        $boxstat .= '<span class="boxstatsindicator'.($outstandingOpened > 0 ? ' amountremaintopay' : '').'">'.price($outstandingOpened, 1, $langs, 1, -1, -1, $conf->currency).$warn.'</span>';
662 662
         $boxstat .= '</div>';
663 663
         if ($link)
664 664
             $boxstat .= '</a>';
@@ -689,10 +689,10 @@  discard block
 block discarded – undo
689 689
         $sql .= ", p.total as total_ttc";
690 690
         $sql .= ", p.ref, p.ref_client, p.remise";
691 691
         $sql .= ", p.datep as dp, p.fin_validite as datelimite";
692
-        $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "propal as p, " . MAIN_DB_PREFIX . "c_propalst as c";
692
+        $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c";
693 693
         $sql .= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id";
694
-        $sql .= " AND s.rowid = " . $object->id;
695
-        $sql .= " AND p.entity IN (" . getEntity('propal') . ")";
694
+        $sql .= " AND s.rowid = ".$object->id;
695
+        $sql .= " AND p.entity IN (".getEntity('propal').")";
696 696
         $sql .= " ORDER BY p.datep DESC";
697 697
 
698 698
         $resql = $db->query($sql);
@@ -705,8 +705,8 @@  discard block
 block discarded – undo
705 705
                 print '<table class="noborder" width="100%">';
706 706
 
707 707
                 print '<tr class="liste_titre">';
708
-                print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>' . $langs->trans("LastPropals", ($num <= $MAXLIST ? "" : $MAXLIST)) . '</td><td align="right"><a class="notasortlink" href="' . DOL_URL_ROOT . '/comm/propal/list.php?socid=' . $object->id . '">' . $langs->trans("AllPropals") . ' <span class="badge">' . $num . '</span></a></td>';
709
-                print '<td width="20px" align="right"><a href="' . DOL_URL_ROOT . '/comm/propal/stats/index.php?socid=' . $object->id . '">' . img_picto($langs->trans("Statistics"), 'stats') . '</a></td>';
708
+                print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastPropals", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td align="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->id.'">'.$langs->trans("AllPropals").' <span class="badge">'.$num.'</span></a></td>';
709
+                print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
710 710
                 print '</tr></table></td>';
711 711
                 print '</tr>';
712 712
             }
@@ -725,11 +725,11 @@  discard block
 block discarded – undo
725 725
                 $propal_static->total_ttc = $objp->total_ttc;
726 726
                 print $propal_static->getNomUrl(1);
727 727
                 if (($db->jdate($objp->datelimite) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == 1) {
728
-                    print " " . img_warning();
728
+                    print " ".img_warning();
729 729
                 }
730
-                print '</td><td align="right" width="80px">' . dol_print_date($db->jdate($objp->dp), 'day') . "</td>\n";
731
-                print '<td align="right" style="min-width: 60px">' . price($objp->total_ht) . '</td>';
732
-                print '<td align="right" style="min-width: 60px" class="nowrap">' . $propal_static->LibStatut($objp->fk_statut, 5) . '</td></tr>';
730
+                print '</td><td align="right" width="80px">'.dol_print_date($db->jdate($objp->dp), 'day')."</td>\n";
731
+                print '<td align="right" style="min-width: 60px">'.price($objp->total_ht).'</td>';
732
+                print '<td align="right" style="min-width: 60px" class="nowrap">'.$propal_static->LibStatut($objp->fk_statut, 5).'</td></tr>';
733 733
                 $i++;
734 734
             }
735 735
             $db->free($resql);
@@ -753,10 +753,10 @@  discard block
 block discarded – undo
753 753
         $sql .= ", c.total_ttc";
754 754
         $sql .= ", c.ref, c.ref_client, c.fk_statut, c.facture";
755 755
         $sql .= ", c.date_commande as dc";
756
-        $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "commande as c";
756
+        $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
757 757
         $sql .= " WHERE c.fk_soc = s.rowid ";
758
-        $sql .= " AND s.rowid = " . $object->id;
759
-        $sql .= " AND c.entity = " . $conf->entity;
758
+        $sql .= " AND s.rowid = ".$object->id;
759
+        $sql .= " AND c.entity = ".$conf->entity;
760 760
         $sql .= " ORDER BY c.date_commande DESC";
761 761
 
762 762
         $resql = $db->query($sql);
@@ -768,10 +768,10 @@  discard block
 block discarded – undo
768 768
                 // Check if there are orders billable
769 769
                 $sql2 = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_client,';
770 770
                 $sql2 .= ' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut, c.facture as billed';
771
-                $sql2 .= ' FROM ' . MAIN_DB_PREFIX . 'societe as s';
772
-                $sql2 .= ', ' . MAIN_DB_PREFIX . 'commande as c';
771
+                $sql2 .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
772
+                $sql2 .= ', '.MAIN_DB_PREFIX.'commande as c';
773 773
                 $sql2 .= ' WHERE c.fk_soc = s.rowid';
774
-                $sql2 .= ' AND s.rowid = ' . $object->id;
774
+                $sql2 .= ' AND s.rowid = '.$object->id;
775 775
                 // Show orders with status validated, shipping started and delivered (well any order we can bill)
776 776
                 $sql2 .= " AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))";
777 777
 
@@ -783,8 +783,8 @@  discard block
 block discarded – undo
783 783
                 print '<table class="noborder" width="100%">';
784 784
 
785 785
                 print '<tr class="liste_titre">';
786
-                print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>' . $langs->trans("LastCustomerOrders", ($num <= $MAXLIST ? "" : $MAXLIST)) . '</td><td align="right"><a class="notasortlink" href="' . DOL_URL_ROOT . '/commande/list.php?socid=' . $object->id . '">' . $langs->trans("AllOrders") . ' <span class="badge">' . $num . '</span></a></td>';
787
-                print '<td width="20px" align="right"><a href="' . DOL_URL_ROOT . '/commande/stats/index.php?socid=' . $object->id . '">' . img_picto($langs->trans("Statistics"), 'stats') . '</a></td>';
786
+                print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastCustomerOrders", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td align="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->id.'">'.$langs->trans("AllOrders").' <span class="badge">'.$num.'</span></a></td>';
787
+                print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/commande/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
788 788
                 //if($num2 > 0) print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/commande/orderstoinvoice.php?socid='.$object->id.'">'.img_picto($langs->trans("CreateInvoiceForThisCustomer"),'object_bill').'</a></td>';
789 789
                 //else print '<td width="20px" align="right"><a href="#">'.img_picto($langs->trans("NoOrdersToInvoice"),'object_bill').'</a></td>';
790 790
                 print '</tr></table></td>';
@@ -806,9 +806,9 @@  discard block
 block discarded – undo
806 806
                 print '<tr class="oddeven">';
807 807
                 print '<td class="nowrap">';
808 808
                 print $commande_static->getNomUrl(1);
809
-                print '</td><td align="right" width="80px">' . dol_print_date($db->jdate($objp->dc), 'day') . "</td>\n";
810
-                print '<td align="right" style="min-width: 60px">' . price($objp->total_ht) . '</td>';
811
-                print '<td align="right" style="min-width: 60px" class="nowrap">' . $commande_static->LibStatut($objp->fk_statut, $objp->facture, 5) . '</td></tr>';
809
+                print '</td><td align="right" width="80px">'.dol_print_date($db->jdate($objp->dc), 'day')."</td>\n";
810
+                print '<td align="right" style="min-width: 60px">'.price($objp->total_ht).'</td>';
811
+                print '<td align="right" style="min-width: 60px" class="nowrap">'.$commande_static->LibStatut($objp->fk_statut, $objp->facture, 5).'</td></tr>';
812 812
                 $i++;
813 813
             }
814 814
             $db->free($resql);
@@ -832,9 +832,9 @@  discard block
 block discarded – undo
832 832
         $sql .= ', e.fk_statut as statut';
833 833
         $sql .= ', s.nom';
834 834
         $sql .= ', s.rowid as socid';
835
-        $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "expedition as e";
836
-        $sql .= " WHERE e.fk_soc = s.rowid AND s.rowid = " . $object->id;
837
-        $sql .= " AND e.entity IN (" . getEntity('expedition') . ")";
835
+        $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."expedition as e";
836
+        $sql .= " WHERE e.fk_soc = s.rowid AND s.rowid = ".$object->id;
837
+        $sql .= " AND e.entity IN (".getEntity('expedition').")";
838 838
         $sql .= ' GROUP BY e.rowid';
839 839
         $sql .= ', e.ref';
840 840
         $sql .= ', e.date_creation';
@@ -853,8 +853,8 @@  discard block
 block discarded – undo
853 853
                 print '<table class="noborder" width="100%">';
854 854
 
855 855
                 print '<tr class="liste_titre">';
856
-                print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>' . $langs->trans("LastSendings", ($num <= $MAXLIST ? "" : $MAXLIST)) . '</td><td align="right"><a class="notasortlink" href="' . DOL_URL_ROOT . '/expedition/list.php?socid=' . $object->id . '">' . $langs->trans("AllSendings") . ' <span class="badge">' . $num . '</span></a></td>';
857
-                print '<td width="20px" align="right"><a href="' . DOL_URL_ROOT . '/expedition/stats/index.php?socid=' . $object->id . '">' . img_picto($langs->trans("Statistics"), 'stats') . '</a></td>';
856
+                print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastSendings", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td align="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/expedition/list.php?socid='.$object->id.'">'.$langs->trans("AllSendings").' <span class="badge">'.$num.'</span></a></td>';
857
+                print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/expedition/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
858 858
                 print '</tr></table></td>';
859 859
                 print '</tr>';
860 860
             }
@@ -871,12 +871,12 @@  discard block
 block discarded – undo
871 871
                 print $sendingstatic->getNomUrl(1);
872 872
                 print '</td>';
873 873
                 if ($objp->date_creation > 0) {
874
-                    print '<td align="right" width="80px">' . dol_print_date($db->jdate($objp->date_creation), 'day') . '</td>';
874
+                    print '<td align="right" width="80px">'.dol_print_date($db->jdate($objp->date_creation), 'day').'</td>';
875 875
                 } else {
876 876
                     print '<td align="right"><b>!!!</b></td>';
877 877
                 }
878 878
 
879
-                print '<td align="right" class="nowrap" width="100" >' . $sendingstatic->LibStatut($objp->statut, 5) . '</td>';
879
+                print '<td align="right" class="nowrap" width="100" >'.$sendingstatic->LibStatut($objp->statut, 5).'</td>';
880 880
                 print "</tr>\n";
881 881
                 $i++;
882 882
             }
@@ -896,10 +896,10 @@  discard block
 block discarded – undo
896 896
      */
897 897
     if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
898 898
         $sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut, c.datec as dc, c.date_contrat as dcon, c.ref_customer as refcus, c.ref_supplier as refsup";
899
-        $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "contrat as c";
899
+        $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c";
900 900
         $sql .= " WHERE c.fk_soc = s.rowid ";
901
-        $sql .= " AND s.rowid = " . $object->id;
902
-        $sql .= " AND c.entity = " . $conf->entity;
901
+        $sql .= " AND s.rowid = ".$object->id;
902
+        $sql .= " AND c.entity = ".$conf->entity;
903 903
         $sql .= " ORDER BY c.datec DESC";
904 904
 
905 905
         $resql = $db->query($sql);
@@ -912,8 +912,8 @@  discard block
 block discarded – undo
912 912
                 print '<table class="noborder" width="100%">';
913 913
 
914 914
                 print '<tr class="liste_titre">';
915
-                print '<td colspan="6"><table width="100%" class="nobordernopadding"><tr><td>' . $langs->trans("LastContracts", ($num <= $MAXLIST ? "" : $MAXLIST)) . '</td>';
916
-                print '<td align="right"><a class="notasortlink" href="' . DOL_URL_ROOT . '/contrat/list.php?socid=' . $object->id . '">' . $langs->trans("AllContracts") . ' <span class="badge">' . $num . '</span></a></td>';
915
+                print '<td colspan="6"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastContracts", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td>';
916
+                print '<td align="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->id.'">'.$langs->trans("AllContracts").' <span class="badge">'.$num.'</span></a></td>';
917 917
                 //print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/contract/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
918 918
                 print '</tr></table></td>';
919 919
                 print '</tr>';
@@ -933,9 +933,9 @@  discard block
 block discarded – undo
933 933
                 print '<td class="nowrap">';
934 934
                 print $contrat->getNomUrl(1, 12);
935 935
                 print "</td>\n";
936
-                print '<td class="nowrap">' . dol_trunc($objp->refsup, 12) . "</td>\n";
937
-                print '<td align="right" width="80px">' . dol_print_date($db->jdate($objp->dc), 'day') . "</td>\n";
938
-                print '<td align="right" width="80px">' . dol_print_date($db->jdate($objp->dcon), 'day') . "</td>\n";
936
+                print '<td class="nowrap">'.dol_trunc($objp->refsup, 12)."</td>\n";
937
+                print '<td align="right" width="80px">'.dol_print_date($db->jdate($objp->dc), 'day')."</td>\n";
938
+                print '<td align="right" width="80px">'.dol_print_date($db->jdate($objp->dcon), 'day')."</td>\n";
939 939
                 print '<td width="20">&nbsp;</td>';
940 940
                 print '<td align="right" class="nowraponall">';
941 941
                 print $contrat->getLibStatut(4);
@@ -959,10 +959,10 @@  discard block
 block discarded – undo
959 959
      */
960 960
     if (!empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire) {
961 961
         $sql = "SELECT s.nom, s.rowid, f.rowid as id, f.ref, f.fk_statut, f.duree as duration, f.datei as startdate";
962
-        $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "fichinter as f";
962
+        $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as f";
963 963
         $sql .= " WHERE f.fk_soc = s.rowid";
964
-        $sql .= " AND s.rowid = " . $object->id;
965
-        $sql .= " AND f.entity = " . $conf->entity;
964
+        $sql .= " AND s.rowid = ".$object->id;
965
+        $sql .= " AND f.entity = ".$conf->entity;
966 966
         $sql .= " ORDER BY f.tms DESC";
967 967
 
968 968
         $resql = $db->query($sql);
@@ -975,8 +975,8 @@  discard block
 block discarded – undo
975 975
                 print '<table class="noborder" width="100%">';
976 976
 
977 977
                 print '<tr class="liste_titre">';
978
-                print '<td colspan="3"><table width="100%" class="nobordernopadding"><tr><td>' . $langs->trans("LastInterventions", ($num <= $MAXLIST ? "" : $MAXLIST)) . '</td><td align="right"><a class="notasortlink" href="' . DOL_URL_ROOT . '/fichinter/list.php?socid=' . $object->id . '">' . $langs->trans("AllInterventions") . ' <span class="badge">' . $num . '</span></td>';
979
-                print '<td width="20px" align="right"><a href="' . DOL_URL_ROOT . '/fichinter/stats/index.php?socid=' . $object->id . '">' . img_picto($langs->trans("Statistics"), 'stats') . '</a></td>';
978
+                print '<td colspan="3"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastInterventions", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td align="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/fichinter/list.php?socid='.$object->id.'">'.$langs->trans("AllInterventions").' <span class="badge">'.$num.'</span></td>';
979
+                print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/fichinter/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
980 980
                 print '</tr></table></td>';
981 981
                 print '</tr>';
982 982
             }
@@ -989,10 +989,10 @@  discard block
 block discarded – undo
989 989
                 $fichinter_static->statut = $objp->fk_statut;
990 990
 
991 991
                 print '<tr class="oddeven">';
992
-                print '<td class="nowrap"><a href="' . DOL_URL_ROOT . '/fichinter/card.php?id=' . $objp->id . '">' . img_object($langs->trans("ShowPropal"), "propal") . ' ' . $objp->ref . '</a></td>' . "\n";
992
+                print '<td class="nowrap"><a href="'.DOL_URL_ROOT.'/fichinter/card.php?id='.$objp->id.'">'.img_object($langs->trans("ShowPropal"), "propal").' '.$objp->ref.'</a></td>'."\n";
993 993
                 //print '<td align="right" width="80px">'.dol_print_date($db->jdate($objp->startdate)).'</td>'."\n";
994
-                print '<td align="right" style="min-width: 60px">' . convertSecondToTime($objp->duration) . '</td>' . "\n";
995
-                print '<td align="right" class="nowrap" style="min-width: 60px">' . $fichinter_static->getLibStatut(5) . '</td>' . "\n";
994
+                print '<td align="right" style="min-width: 60px">'.convertSecondToTime($objp->duration).'</td>'."\n";
995
+                print '<td align="right" class="nowrap" style="min-width: 60px">'.$fichinter_static->getLibStatut(5).'</td>'."\n";
996 996
                 print '</tr>';
997 997
 
998 998
                 $i++;
@@ -1022,9 +1022,9 @@  discard block
 block discarded – undo
1022 1022
         $sql .= ', f.unit_frequency';
1023 1023
         $sql .= ', f.suspended as suspended';
1024 1024
         $sql .= ', s.nom, s.rowid as socid';
1025
-        $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s," . MAIN_DB_PREFIX . "facture_rec as f";
1026
-        $sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = " . $object->id;
1027
-        $sql .= " AND f.entity = " . $conf->entity;
1025
+        $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f";
1026
+        $sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id;
1027
+        $sql .= " AND f.entity = ".$conf->entity;
1028 1028
         $sql .= ' GROUP BY f.rowid, f.titre, f.amount, f.total, f.tva, f.total_ttc,';
1029 1029
         $sql .= ' f.date_last_gen, f.datec, f.frequency, f.unit_frequency,';
1030 1030
         $sql .= ' f.suspended,';
@@ -1041,7 +1041,7 @@  discard block
 block discarded – undo
1041 1041
                 print '<table class="noborder" width="100%">';
1042 1042
 
1043 1043
                 print '<tr class="liste_titre">';
1044
-                print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>' . $langs->trans("LatestCustomerTemplateInvoices", ($num <= $MAXLIST ? "" : $MAXLIST)) . '</td><td align="right"><a class="notasortlink" href="' . DOL_URL_ROOT . '/compta/facture/list.php?socid=' . $object->id . '">' . $langs->trans("AllCustomerTemplateInvoices") . ' <span class="badge">' . $num . '</span></a></td>';
1044
+                print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LatestCustomerTemplateInvoices", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td align="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'">'.$langs->trans("AllCustomerTemplateInvoices").' <span class="badge">'.$num.'</span></a></td>';
1045 1045
                 print '</tr></table></td>';
1046 1046
                 print '</tr>';
1047 1047
             }
@@ -1066,10 +1066,10 @@  discard block
 block discarded – undo
1066 1066
                 print $invoicetemplate->getNomUrl(1);
1067 1067
                 print '</td>';
1068 1068
                 if ($objp->frequency && $objp->date_last_gen > 0) {
1069
-                    print '<td align="right" width="80px">' . dol_print_date($db->jdate($objp->date_last_gen), 'day') . '</td>';
1069
+                    print '<td align="right" width="80px">'.dol_print_date($db->jdate($objp->date_last_gen), 'day').'</td>';
1070 1070
                 } else {
1071 1071
                     if ($objp->dc > 0) {
1072
-                        print '<td align="right" width="80px">' . dol_print_date($db->jdate($objp->dc), 'day') . '</td>';
1072
+                        print '<td align="right" width="80px">'.dol_print_date($db->jdate($objp->dc), 'day').'</td>';
1073 1073
                     } else {
1074 1074
                         print '<td align="right"><b>!!!</b></td>';
1075 1075
                     }
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
                 }
1086 1086
 
1087 1087
                 print '<td align="right" class="nowrap" style="min-width: 60px">';
1088
-                print $langs->trans('FrequencyPer_' . $invoicetemplate->unit_frequency, $invoicetemplate->frequency) . ' - ';
1088
+                print $langs->trans('FrequencyPer_'.$invoicetemplate->unit_frequency, $invoicetemplate->frequency).' - ';
1089 1089
                 print ($invoicetemplate->LibStatut($invoicetemplate->frequency, $invoicetemplate->suspended, 5, 0));
1090 1090
                 print '</td>';
1091 1091
                 print "</tr>\n";
@@ -1113,10 +1113,10 @@  discard block
 block discarded – undo
1113 1113
         $sql .= ', f.datef as df, f.datec as dc, f.paye as paye, f.fk_statut as statut';
1114 1114
         $sql .= ', s.nom, s.rowid as socid';
1115 1115
         $sql .= ', SUM(pf.amount) as am';
1116
-        $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s," . MAIN_DB_PREFIX . "facture as f";
1117
-        $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'paiement_facture as pf ON f.rowid=pf.fk_facture';
1118
-        $sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = " . $object->id;
1119
-        $sql .= " AND f.entity = " . $conf->entity;
1116
+        $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
1117
+        $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON f.rowid=pf.fk_facture';
1118
+        $sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id;
1119
+        $sql .= " AND f.entity = ".$conf->entity;
1120 1120
         $sql .= ' GROUP BY f.rowid, f.ref, f.type, f.amount, f.total, f.tva, f.total_ttc,';
1121 1121
         $sql .= ' f.datef, f.datec, f.paye, f.fk_statut,';
1122 1122
         $sql .= ' s.nom, s.rowid';
@@ -1132,8 +1132,8 @@  discard block
 block discarded – undo
1132 1132
                 print '<table class="noborder" width="100%">';
1133 1133
 
1134 1134
                 print '<tr class="liste_titre">';
1135
-                print '<td colspan="5"><table width="100%" class="nobordernopadding"><tr><td>' . $langs->trans("LastCustomersBills", ($num <= $MAXLIST ? "" : $MAXLIST)) . '</td><td align="right"><a class="notasortlink" href="' . DOL_URL_ROOT . '/compta/facture/list.php?socid=' . $object->id . '">' . $langs->trans("AllBills") . ' <span class="badge">' . $num . '</span></a></td>';
1136
-                print '<td width="20px" align="right"><a href="' . DOL_URL_ROOT . '/compta/facture/stats/index.php?socid=' . $object->id . '">' . img_picto($langs->trans("Statistics"), 'stats') . '</a></td>';
1135
+                print '<td colspan="5"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastCustomersBills", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td align="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'">'.$langs->trans("AllBills").' <span class="badge">'.$num.'</span></a></td>';
1136
+                print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
1137 1137
                 print '</tr></table></td>';
1138 1138
                 print '</tr>';
1139 1139
             }
@@ -1154,7 +1154,7 @@  discard block
 block discarded – undo
1154 1154
                 print $facturestatic->getNomUrl(1);
1155 1155
                 print '</td>';
1156 1156
                 if ($objp->df > 0) {
1157
-                    print '<td align="right" width="80px">' . dol_print_date($db->jdate($objp->df), 'day') . '</td>';
1157
+                    print '<td align="right" width="80px">'.dol_print_date($db->jdate($objp->df), 'day').'</td>';
1158 1158
                 } else {
1159 1159
                     print '<td align="right"><b>!!!</b></td>';
1160 1160
                 }
@@ -1168,7 +1168,7 @@  discard block
 block discarded – undo
1168 1168
                     print '</td>';
1169 1169
                 }
1170 1170
 
1171
-                print '<td align="right" class="nowrap" style="min-width: 60px">' . ($facturestatic->LibStatut($objp->paye, $objp->statut, 5, $objp->am)) . '</td>';
1171
+                print '<td align="right" class="nowrap" style="min-width: 60px">'.($facturestatic->LibStatut($objp->paye, $objp->statut, 5, $objp->am)).'</td>';
1172 1172
                 print "</tr>\n";
1173 1173
                 $i++;
1174 1174
             }
@@ -1200,29 +1200,29 @@  discard block
 block discarded – undo
1200 1200
 
1201 1201
     if (empty($reshook)) {
1202 1202
         if ($object->status != 1) {
1203
-            print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="' . dol_escape_js($langs->trans("ThirdPartyIsClosed")) . '" href="#">' . $langs->trans("ThirdPartyIsClosed") . '</a></div>';
1203
+            print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyIsClosed")).'" href="#">'.$langs->trans("ThirdPartyIsClosed").'</a></div>';
1204 1204
         }
1205 1205
 
1206 1206
         if (!empty($conf->propal->enabled) && $user->rights->propal->creer && $object->status == 1) {
1207 1207
             $langs->load("propal");
1208
-            print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/comm/propal/card.php?socid=' . $object->id . '&amp;action=create">' . $langs->trans("AddProp") . '</a></div>';
1208
+            print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal/card.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddProp").'</a></div>';
1209 1209
         }
1210 1210
 
1211 1211
         if (!empty($conf->commande->enabled) && $user->rights->commande->creer && $object->status == 1) {
1212 1212
             $langs->load("orders");
1213
-            print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/commande/card.php?socid=' . $object->id . '&amp;action=create">' . $langs->trans("AddOrder") . '</a></div>';
1213
+            print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddOrder").'</a></div>';
1214 1214
         }
1215 1215
 
1216 1216
         if ($user->rights->contrat->creer && $object->status == 1) {
1217 1217
             $langs->load("contracts");
1218 1218
             // print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/contrat/card.php?socid=' . $object->id . '&amp;action=create">' . $langs->trans("AddContract") . '</a></div>';
1219
-            print '<div class="inline-block divButAction"><a class="butAction" href="' . BASE_URI . '?controller=contrat&method=card&socid=' . $object->id . '&amp;action=create">' . $langs->trans("AddContract") . '</a></div>';
1219
+            print '<div class="inline-block divButAction"><a class="butAction" href="'.BASE_URI.'?controller=contrat&method=card&socid='.$object->id.'&amp;action=create">'.$langs->trans("AddContract").'</a></div>';
1220 1220
         }
1221 1221
 
1222 1222
         if (!empty($conf->ficheinter->enabled) && $user->rights->ficheinter->creer && $object->status == 1) {
1223 1223
             $langs->load("fichinter");
1224 1224
             // print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/fichinter/card.php?socid=' . $object->id . '&amp;action=create">' . $langs->trans("AddIntervention") . '</a></div>';
1225
-            print '<div class="inline-block divButAction"><a class="butAction" href="' . BASE_URI . '?controller=fichinter&method=card&socid=' . $object->id . '&amp;action=create">' . $langs->trans("AddIntervention") . '</a></div>';
1225
+            print '<div class="inline-block divButAction"><a class="butAction" href="'.BASE_URI.'?controller=fichinter&method=card&socid='.$object->id.'&amp;action=create">'.$langs->trans("AddIntervention").'</a></div>';
1226 1226
         }
1227 1227
 
1228 1228
         // Add invoice
@@ -1230,12 +1230,12 @@  discard block
 block discarded – undo
1230 1230
             if (!empty($conf->deplacement->enabled) && $object->status == 1) {
1231 1231
                 $langs->load("trips");
1232 1232
                 // print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/compta/deplacement/card.php?socid=' . $object->id . '&amp;action=create">' . $langs->trans("AddTrip") . '</a></div>';
1233
-                print '<div class="inline-block divButAction"><a class="butAction" href="' . BASE_URI . '?controller=compta/deplacement&method=card&socid=' . $object->id . '&amp;action=create">' . $langs->trans("AddTrip") . '</a></div>';
1233
+                print '<div class="inline-block divButAction"><a class="butAction" href="'.BASE_URI.'?controller=compta/deplacement&method=card&socid='.$object->id.'&amp;action=create">'.$langs->trans("AddTrip").'</a></div>';
1234 1234
             }
1235 1235
 
1236 1236
             if (!empty($conf->facture->enabled) && $object->status == 1) {
1237 1237
                 if (empty($user->rights->facture->creer)) {
1238
-                    print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="' . dol_escape_js($langs->trans("NotAllowed")) . '" href="#">' . $langs->trans("AddBill") . '</a></div>';
1238
+                    print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
1239 1239
                 } else {
1240 1240
                     $langs->load("bills");
1241 1241
                     $langs->load("orders");
@@ -1244,20 +1244,20 @@  discard block
 block discarded – undo
1244 1244
                         if ($object->client != 0 && $object->client != 2) {
1245 1245
                             if (!empty($orders2invoice) && $orders2invoice > 0) {
1246 1246
                                 // print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/commande/orderstoinvoice.php?socid=' . $object->id . '">' . $langs->trans("CreateInvoiceForThisCustomer") . '</a></div>';
1247
-                                print '<div class="inline-block divButAction"><a class="butAction" href="' . BASE_URI . '?controller=commande&method=orderstoinvoice&socid=' . $object->id . '">' . $langs->trans("CreateInvoiceForThisCustomer") . '</a></div>';
1247
+                                print '<div class="inline-block divButAction"><a class="butAction" href="'.BASE_URI.'?controller=commande&method=orderstoinvoice&socid='.$object->id.'">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
1248 1248
                             } else {
1249
-                                print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="' . dol_escape_js($langs->trans("NoOrdersToInvoice")) . '" href="#">' . $langs->trans("CreateInvoiceForThisCustomer") . '</a></div>';
1249
+                                print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("NoOrdersToInvoice")).'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
1250 1250
                             }
1251 1251
                         } else {
1252
-                            print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="' . dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")) . '" href="#">' . $langs->trans("AddBill") . '</a></div>';
1252
+                            print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
1253 1253
                         }
1254 1254
                     }
1255 1255
 
1256 1256
                     if ($object->client != 0 && $object->client != 2) {
1257 1257
                         // print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/compta/facture/card.php?action=create&socid=' . $object->id . '">' . $langs->trans("AddBill") . '</a></div>';
1258
-                        print '<div class="inline-block divButAction"><a class="butAction" href="' . BASE_URI . '?controller=compta/facture&method=card&action=create&socid=' . $object->id . '">' . $langs->trans("AddBill") . '</a></div>';
1258
+                        print '<div class="inline-block divButAction"><a class="butAction" href="'.BASE_URI.'?controller=compta/facture&method=card&action=create&socid='.$object->id.'">'.$langs->trans("AddBill").'</a></div>';
1259 1259
                     } else {
1260
-                        print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="' . dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")) . '" href="#">' . $langs->trans("AddBill") . '</a></div>';
1260
+                        print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
1261 1261
                     }
1262 1262
                 }
1263 1263
             }
@@ -1266,9 +1266,9 @@  discard block
 block discarded – undo
1266 1266
         // Add action
1267 1267
         if (!empty($conf->agenda->enabled) && !empty($conf->global->MAIN_REPEATTASKONEACHTAB) && $object->status == 1) {
1268 1268
             if ($user->rights->agenda->myactions->create) {
1269
-                print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&socid=' . $object->id . '">' . $langs->trans("AddAction") . '</a></div>';
1269
+                print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddAction").'</a></div>';
1270 1270
             } else {
1271
-                print '<div class="inline-block divButAction"><a class="butAction" title="' . dol_escape_js($langs->trans("NotAllowed")) . '" href="#">' . $langs->trans("AddAction") . '</a></div>';
1271
+                print '<div class="inline-block divButAction"><a class="butAction" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddAction").'</a></div>';
1272 1272
             }
1273 1273
         }
1274 1274
     }
@@ -1278,13 +1278,13 @@  discard block
 block discarded – undo
1278 1278
     if (!empty($conf->global->MAIN_DUPLICATE_CONTACTS_TAB_ON_CUSTOMER_CARD)) {
1279 1279
         // List of contacts
1280 1280
         // show_contacts($conf, $langs, $db, $object, $_SERVER["PHP_SELF"] . '?socid=' . $object->id);
1281
-        show_contacts($conf, $langs, $db, $object, $_SERVER["PHP_SELF"] . '&socid=' . $object->id);
1281
+        show_contacts($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'&socid='.$object->id);
1282 1282
     }
1283 1283
 
1284 1284
     // Addresses list
1285 1285
     if (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) && !empty($conf->global->MAIN_REPEATADDRESSONEACHTAB)) {
1286 1286
         // show_addresses($conf, $langs, $db, $object, $_SERVER["PHP_SELF"] . '?socid=' . $object->id);
1287
-        show_addresses($conf, $langs, $db, $object, $_SERVER["PHP_SELF"] . '&socid=' . $object->id);
1287
+        show_addresses($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'&socid='.$object->id);
1288 1288
     }
1289 1289
 
1290 1290
     if (!empty($conf->global->MAIN_REPEATTASKONEACHTAB)) {
Please login to merge, or discard this patch.
dolibarr/htdocs/comm/propal/card.php 2 patches
Spacing   +238 added lines, -238 removed lines patch added patch discarded remove patch
@@ -35,27 +35,27 @@  discard block
 block discarded – undo
35 35
  * \ingroup 	propale
36 36
  * \brief 		Page of commercial proposals card and list
37 37
  */
38
-require DOL_BASE_PATH . '/main.inc.php';
39
-
40
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
41
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
42
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formpropal.class.php';
43
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formmargin.class.php';
44
-require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
45
-require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php';
46
-require_once DOL_DOCUMENT_ROOT . '/core/modules/propale/modules_propale.php';
47
-require_once DOL_DOCUMENT_ROOT . '/core/lib/propal.lib.php';
48
-require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
49
-require_once DOL_DOCUMENT_ROOT . '/core/lib/signature.lib.php';
50
-require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
51
-require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
38
+require DOL_BASE_PATH.'/main.inc.php';
39
+
40
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
41
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
42
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formpropal.class.php';
43
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php';
44
+require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
45
+require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
46
+require_once DOL_DOCUMENT_ROOT.'/core/modules/propale/modules_propale.php';
47
+require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
48
+require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
49
+require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php';
50
+require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
51
+require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
52 52
 if (!empty($conf->projet->enabled)) {
53
-    require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
54
-    require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
53
+    require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
54
+    require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
55 55
 }
56 56
 
57 57
 if (!empty($conf->variants->enabled)) {
58
-    require_once DOL_DOCUMENT_ROOT . '/variants/class/ProductCombination.class.php';
58
+    require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
59 59
 }
60 60
 
61 61
 // Load translation files required by the page
@@ -144,17 +144,17 @@  discard block
 block discarded – undo
144 144
 if (empty($reshook)) {
145 145
     if ($cancel) {
146 146
         if (!empty($backtopage)) {
147
-            header("Location: " . $backtopage);
147
+            header("Location: ".$backtopage);
148 148
             exit;
149 149
         }
150 150
         $action = '';
151 151
     }
152 152
 
153
-    include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
153
+    include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
154 154
 
155
-    include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php';  // Must be include, not include_once
155
+    include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
156 156
 
157
-    include DOL_DOCUMENT_ROOT . '/core/actions_lineupdown.inc.php'; // Must be include, not include_once
157
+    include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
158 158
     // Action clone object
159 159
     if ($action == 'confirm_clone' && $confirm == 'yes' && $usercancreate) {
160 160
         if (!GETPOST('socid', 3)) {
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 
186 186
                 $result = $object->createFromClone($socid);
187 187
                 if ($result > 0) {
188
-                    header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
188
+                    header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
189 189
                     exit();
190 190
                 } else {
191 191
                     if (count($object->errors) > 0) {
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
     else if ($action == 'confirm_delete' && $confirm == 'yes' && $usercandelete) {
202 202
         $result = $object->delete($user);
203 203
         if ($result > 0) {
204
-            header('Location: ' . DOL_URL_ROOT . '/comm/propal/list.php?restore_lastsearch_values=1');
204
+            header('Location: '.DOL_URL_ROOT.'/comm/propal/list.php?restore_lastsearch_values=1');
205 205
             exit();
206 206
         } else {
207 207
             $langs->load("errors");
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
             $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
230 230
         }
231 231
 
232
-        header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
232
+        header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
233 233
         exit();
234 234
     }
235 235
 
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
         $datep = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
268 268
 
269 269
         if (empty($datep)) {
270
-            $error ++;
270
+            $error++;
271 271
             setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
272 272
         }
273 273
 
@@ -314,19 +314,19 @@  discard block
 block discarded – undo
314 314
         if (empty($datep)) {
315 315
             setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
316 316
             $action = 'create';
317
-            $error ++;
317
+            $error++;
318 318
         }
319 319
         if (empty($duration)) {
320 320
             setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ValidityDuration")), null, 'errors');
321 321
             $action = 'create';
322
-            $error ++;
322
+            $error++;
323 323
         }
324 324
 
325 325
         if ($socid < 1) {
326 326
             setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), null, 'errors');
327 327
 
328 328
             $action = 'create';
329
-            $error ++;
329
+            $error++;
330 330
         }
331 331
 
332 332
         if (!$error) {
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
                 // Fill array 'array_options' with data from add form
399 399
                 $ret = $extrafields->setOptionalsFromPost($extralabels, $object);
400 400
                 if ($ret < 0) {
401
-                    $error ++;
401
+                    $error++;
402 402
                     $action = 'create';
403 403
                 }
404 404
             }
@@ -441,12 +441,12 @@  discard block
 block discarded – undo
441 441
 
442 442
                     $id = $object->create($user);
443 443
                     if ($id > 0) {
444
-                        dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
444
+                        dol_include_once('/'.$element.'/class/'.$subelement.'.class.php');
445 445
 
446 446
                         $classname = ucfirst($subelement);
447 447
                         $srcobject = new $classname($db);
448 448
 
449
-                        dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines");
449
+                        dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines");
450 450
                         $result = $srcobject->fetch($object->origin_id);
451 451
 
452 452
                         if ($result > 0) {
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 
503 503
                                 $tva_tx = $lines[$i]->tva_tx;
504 504
                                 if (!empty($lines[$i]->vat_src_code) && !preg_match('/\(/', $tva_tx))
505
-                                    $tva_tx .= ' (' . $lines[$i]->vat_src_code . ')';
505
+                                    $tva_tx .= ' ('.$lines[$i]->vat_src_code.')';
506 506
 
507 507
                                 $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $date_start, $date_end, $array_options, $lines[$i]->fk_unit);
508 508
 
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
                                     $lineid = $result;
511 511
                                 } else {
512 512
                                     $lineid = 0;
513
-                                    $error ++;
513
+                                    $error++;
514 514
                                     break;
515 515
                                 }
516 516
 
@@ -525,15 +525,15 @@  discard block
 block discarded – undo
525 525
                             $reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
526 526
                             // modified by hook
527 527
                             if ($reshook < 0) {
528
-                                $error ++;
528
+                                $error++;
529 529
                             }
530 530
                         } else {
531 531
                             setEventMessages($srcobject->error, $srcobject->errors, 'errors');
532
-                            $error ++;
532
+                            $error++;
533 533
                         }
534 534
                     } else {
535 535
                         setEventMessages($object->error, $object->errors, 'errors');
536
-                        $error ++;
536
+                        $error++;
537 537
                     }
538 538
                 }    // Standard creation
539 539
                 else {
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
                                 dol_print_error($db, $result);
582 582
                         }
583 583
 
584
-                        header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);
584
+                        header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
585 585
                         exit();
586 586
                     }
587 587
                     else {
@@ -668,10 +668,10 @@  discard block
 block discarded – undo
668 668
 
669 669
         if (!empty($importLines) && is_array($importLines) && !empty($fromElement) && ctype_alpha($fromElement) && !empty($fromElementid)) {
670 670
             if ($fromElement == 'commande') {
671
-                dol_include_once('/' . $fromElement . '/class/' . $fromElement . '.class.php');
671
+                dol_include_once('/'.$fromElement.'/class/'.$fromElement.'.class.php');
672 672
                 $lineClassName = 'OrderLine';
673 673
             } elseif ($fromElement == 'propal') {
674
-                dol_include_once('/comm/' . $fromElement . '/class/' . $fromElement . '.class.php');
674
+                dol_include_once('/comm/'.$fromElement.'/class/'.$fromElement.'.class.php');
675 675
                 $lineClassName = 'PropaleLigne';
676 676
             }
677 677
             $nextRang = count($object->lines) + 1;
@@ -730,14 +730,14 @@  discard block
 block discarded – undo
730 730
         }
731 731
     }
732 732
 
733
-    include DOL_DOCUMENT_ROOT . '/core/actions_printing.inc.php';
733
+    include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
734 734
 
735 735
     // Actions to send emails
736 736
     $actiontypecode = 'AC_OTH_AUTO';
737 737
     $trigger_name = 'PROPAL_SENTBYMAIL';
738 738
     $autocopy = 'MAIN_MAIL_AUTOCOPY_PROPOSAL_TO';
739
-    $trackid = 'pro' . $object->id;
740
-    include DOL_DOCUMENT_ROOT . '/core/actions_sendmails.inc.php';
739
+    $trackid = 'pro'.$object->id;
740
+    include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
741 741
 
742 742
 
743 743
     // Go back to draft
@@ -783,8 +783,8 @@  discard block
 block discarded – undo
783 783
             $tva_tx = '';
784 784
         }
785 785
 
786
-        $qty = GETPOST('qty' . $predef);
787
-        $remise_percent = GETPOST('remise_percent' . $predef);
786
+        $qty = GETPOST('qty'.$predef);
787
+        $remise_percent = GETPOST('remise_percent'.$predef);
788 788
 
789 789
         // Extrafields
790 790
         $extrafieldsline = new ExtraFields($db);
@@ -794,22 +794,22 @@  discard block
 block discarded – undo
794 794
         if (is_array($extralabelsline)) {
795 795
             // Get extra fields
796 796
             foreach ($extralabelsline as $key => $value) {
797
-                unset($_POST["options_" . $key]);
797
+                unset($_POST["options_".$key]);
798 798
             }
799 799
         }
800 800
 
801 801
         if ($prod_entry_mode == 'free' && empty($idprod) && GETPOST('type') < 0) {
802 802
             setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
803
-            $error ++;
803
+            $error++;
804 804
         }
805 805
 
806 806
         if ($prod_entry_mode == 'free' && empty($idprod) && $price_ht == '' && $price_ht_devise == '') {  // Unit price can be 0 but not ''. Also price can be negative for proposal.
807 807
             setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
808
-            $error ++;
808
+            $error++;
809 809
         }
810 810
         if ($prod_entry_mode == 'free' && empty($idprod) && empty($product_desc)) {
811 811
             setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")), null, 'errors');
812
-            $error ++;
812
+            $error++;
813 813
         }
814 814
 
815 815
         if (!$error && !empty($conf->variants->enabled) && $prod_entry_mode != 'free') {
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
                     $idprod = $res->fk_product_child;
822 822
                 } else {
823 823
                     setEventMessages($langs->trans('ErrorProductCombinationNotFound'), null, 'errors');
824
-                    $error ++;
824
+                    $error++;
825 825
                 }
826 826
             }
827 827
         }
@@ -872,7 +872,7 @@  discard block
 block discarded – undo
872 872
                 }
873 873
                 // If price per customer
874 874
                 elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
875
-                    require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
875
+                    require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php';
876 876
 
877 877
                     $prodcustprice = new Productcustomerprice($db);
878 878
 
@@ -885,9 +885,9 @@  discard block
 block discarded – undo
885 885
                             $pu_ht = price($prodcustprice->lines[0]->price);
886 886
                             $pu_ttc = price($prodcustprice->lines[0]->price_ttc);
887 887
                             $price_base_type = $prodcustprice->lines[0]->price_base_type;
888
-                            $tva_tx = ($prodcustprice->lines[0]->default_vat_code ? $prodcustprice->lines[0]->tva_tx . ' (' . $prodcustprice->lines[0]->default_vat_code . ' )' : $prodcustprice->lines[0]->tva_tx);
888
+                            $tva_tx = ($prodcustprice->lines[0]->default_vat_code ? $prodcustprice->lines[0]->tva_tx.' ('.$prodcustprice->lines[0]->default_vat_code.' )' : $prodcustprice->lines[0]->tva_tx);
889 889
                             if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx))
890
-                                $tva_tx .= ' (' . $prodcustprice->lines[0]->default_vat_code . ')';
890
+                                $tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')';
891 891
                             $tva_npr = $prodcustprice->lines[0]->recuperableonly;
892 892
                             if (empty($tva_tx))
893 893
                                 $tva_npr = 0;
@@ -1008,23 +1008,23 @@  discard block
 block discarded – undo
1008 1008
                             $outputlangs->load('products');
1009 1009
                         }
1010 1010
                         if (!empty($prod->customcode)) {
1011
-                            $tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
1011
+                            $tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode;
1012 1012
                         }
1013 1013
                         if (!empty($prod->customcode) && !empty($prod->country_code)) {
1014 1014
                             $tmptxt .= ' - ';
1015 1015
                         }
1016 1016
                         if (!empty($prod->country_code)) {
1017
-                            $tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $outputlangs, 0);
1017
+                            $tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code, 0, $db, $outputlangs, 0);
1018 1018
                         }
1019 1019
                     } else {
1020 1020
                         if (!empty($prod->customcode)) {
1021
-                            $tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
1021
+                            $tmptxt .= $langs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode;
1022 1022
                         }
1023 1023
                         if (!empty($prod->customcode) && !empty($prod->country_code)) {
1024 1024
                             $tmptxt .= ' - ';
1025 1025
                         }
1026 1026
                         if (!empty($prod->country_code)) {
1027
-                            $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0);
1027
+                            $tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code, 0, $db, $langs, 0);
1028 1028
                         }
1029 1029
                     }
1030 1030
                     $tmptxt .= ')';
@@ -1047,11 +1047,11 @@  discard block
 block discarded – undo
1047 1047
             }
1048 1048
 
1049 1049
             // Margin
1050
-            $fournprice = price2num(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : '');
1051
-            $buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : '');    // If buying_price is '0', we muste keep this value
1050
+            $fournprice = price2num(GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : '');
1051
+            $buyingprice = price2num(GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''); // If buying_price is '0', we muste keep this value
1052 1052
 
1053
-            $date_start = dol_mktime(GETPOST('date_start' . $predef . 'hour'), GETPOST('date_start' . $predef . 'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start' . $predef . 'month'), GETPOST('date_start' . $predef . 'day'), GETPOST('date_start' . $predef . 'year'));
1054
-            $date_end = dol_mktime(GETPOST('date_end' . $predef . 'hour'), GETPOST('date_end' . $predef . 'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end' . $predef . 'month'), GETPOST('date_end' . $predef . 'day'), GETPOST('date_end' . $predef . 'year'));
1053
+            $date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
1054
+            $date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year'));
1055 1055
 
1056 1056
             // Local Taxes
1057 1057
             $localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $tva_npr);
@@ -1062,7 +1062,7 @@  discard block
 block discarded – undo
1062 1062
                 $info_bits |= 0x01;
1063 1063
             }
1064 1064
 
1065
-            if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS) ) && (!empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))) {
1065
+            if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && (!empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))) {
1066 1066
                 $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency));
1067 1067
                 setEventMessages($mesg, null, 'errors');
1068 1068
             } else {
@@ -1145,7 +1145,7 @@  discard block
 block discarded – undo
1145 1145
 
1146 1146
         // Add buying price
1147 1147
         $fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
1148
-        $buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : '');    // If buying_price is '0', we muste keep this value
1148
+        $buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
1149 1149
 
1150 1150
         $pu_ht_devise = GETPOST('multicurrency_subprice');
1151 1151
 
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
         if (is_array($extralabelsline)) {
1161 1161
             // Get extra fields
1162 1162
             foreach ($extralabelsline as $key => $value) {
1163
-                unset($_POST["options_" . $key]);
1163
+                unset($_POST["options_".$key]);
1164 1164
             }
1165 1165
         }
1166 1166
 
@@ -1183,9 +1183,9 @@  discard block
 block discarded – undo
1183 1183
                 $price_min = $product->multiprices_min [$object->thirdparty->price_level];
1184 1184
             }
1185 1185
             $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
1186
-            if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS) ) && ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min)))) {
1186
+            if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min)))) {
1187 1187
                 setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
1188
-                $error ++;
1188
+                $error++;
1189 1189
             }
1190 1190
         } else {
1191 1191
             $type = GETPOST('type');
@@ -1194,7 +1194,7 @@  discard block
 block discarded – undo
1194 1194
             // Check parameters
1195 1195
             if (GETPOST('type') < 0) {
1196 1196
                 setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
1197
-                $error ++;
1197
+                $error++;
1198 1198
             }
1199 1199
         }
1200 1200
 
@@ -1260,7 +1260,7 @@  discard block
 block discarded – undo
1260 1260
             }
1261 1261
         }
1262 1262
     } else if ($action == 'updateline' && $usercancreate && GETPOST('cancel', 'alpha')) {
1263
-        header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition
1263
+        header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); // Pour reaffichage de la fiche en cours d'edition
1264 1264
         exit();
1265 1265
     }
1266 1266
 
@@ -1339,7 +1339,7 @@  discard block
 block discarded – undo
1339 1339
             }
1340 1340
 
1341 1341
             if ($result >= 0) {
1342
-                header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
1342
+                header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
1343 1343
                 exit();
1344 1344
             } else {
1345 1345
                 if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
@@ -1366,7 +1366,7 @@  discard block
 block discarded – undo
1366 1366
             $result = $object->delete_contact($lineid);
1367 1367
 
1368 1368
             if ($result >= 0) {
1369
-                header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
1369
+                header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
1370 1370
                 exit();
1371 1371
             } else {
1372 1372
                 dol_print_error($db);
@@ -1377,7 +1377,7 @@  discard block
 block discarded – undo
1377 1377
     // Actions to build doc
1378 1378
     $upload_dir = $conf->propal->multidir_output[$object->entity];
1379 1379
     $permissioncreate = $usercancreate;
1380
-    include DOL_DOCUMENT_ROOT . '/core/actions_builddoc.inc.php';
1380
+    include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
1381 1381
 }
1382 1382
 
1383 1383
 
@@ -1436,7 +1436,7 @@  discard block
 block discarded – undo
1436 1436
                 $element = $subelement = 'expedition';
1437 1437
             }
1438 1438
 
1439
-            dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
1439
+            dol_include_once('/'.$element.'/class/'.$subelement.'.class.php');
1440 1440
 
1441 1441
             $classname = ucfirst($subelement);
1442 1442
             $objectsrc = new $classname($db);
@@ -1478,14 +1478,14 @@  discard block
 block discarded – undo
1478 1478
     $object = new Propal($db);
1479 1479
 
1480 1480
     // print '<form name="addprop" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
1481
-    print '<form name="addprop" href="' . BASE_PATH . '?controller=comm/propal&method=card" method="POST">';
1482
-    print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
1481
+    print '<form name="addprop" href="'.BASE_PATH.'?controller=comm/propal&method=card" method="POST">';
1482
+    print '<input type="hidden" name="token" value="'.$_SESSION ['newtoken'].'">';
1483 1483
     print '<input type="hidden" name="action" value="add">';
1484 1484
     if ($origin != 'project' && $originid) {
1485
-        print '<input type="hidden" name="origin" value="' . $origin . '">';
1486
-        print '<input type="hidden" name="originid" value="' . $originid . '">';
1485
+        print '<input type="hidden" name="origin" value="'.$origin.'">';
1486
+        print '<input type="hidden" name="originid" value="'.$originid.'">';
1487 1487
     } elseif ($origin == 'project' && !empty($projectid)) {
1488
-        print '<input type="hidden" name="projectid" value="' . $projectid . '">';
1488
+        print '<input type="hidden" name="projectid" value="'.$projectid.'">';
1489 1489
     }
1490 1490
 
1491 1491
     dol_fiche_head();
@@ -1493,20 +1493,20 @@  discard block
 block discarded – undo
1493 1493
     print '<table class="border" width="100%">';
1494 1494
 
1495 1495
     // Reference
1496
-    print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans('Ref') . '</td><td>' . $langs->trans("Draft") . '</td></tr>';
1496
+    print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans('Ref').'</td><td>'.$langs->trans("Draft").'</td></tr>';
1497 1497
 
1498 1498
     // Ref customer
1499
-    print '<tr><td>' . $langs->trans('RefCustomer') . '</td><td>';
1500
-    print '<input type="text" name="ref_client" value="' . GETPOST('ref_client') . '"></td>';
1499
+    print '<tr><td>'.$langs->trans('RefCustomer').'</td><td>';
1500
+    print '<input type="text" name="ref_client" value="'.GETPOST('ref_client').'"></td>';
1501 1501
     print '</tr>';
1502 1502
 
1503 1503
     // Third party
1504 1504
     print '<tr>';
1505
-    print '<td class="fieldrequired">' . $langs->trans('Customer') . '</td>';
1505
+    print '<td class="fieldrequired">'.$langs->trans('Customer').'</td>';
1506 1506
     if ($socid > 0) {
1507 1507
         print '<td>';
1508 1508
         print $soc->getNomUrl(1);
1509
-        print '<input type="hidden" name="socid" value="' . $soc->id . '">';
1509
+        print '<input type="hidden" name="socid" value="'.$soc->id.'">';
1510 1510
         print '</td>';
1511 1511
         if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD) && !empty($soc->shipping_method_id)) {
1512 1512
             $shipping_method_id = $soc->shipping_method_id;
@@ -1521,86 +1521,86 @@  discard block
 block discarded – undo
1521 1521
 				$("#socid").change(function() {
1522 1522
 					var socid = $(this).val();
1523 1523
 					// reload page
1524
-					window.location.href = "' . BASE_URI . '?controller=comm/propal&method=card&action=create&socid="+socid+"&ref_client="+$("input[name=ref_client]").val();
1524
+					window.location.href = "' . BASE_URI.'?controller=comm/propal&method=card&action=create&socid="+socid+"&ref_client="+$("input[name=ref_client]").val();
1525 1525
 				});
1526 1526
 			});
1527 1527
 			</script>';
1528 1528
         }
1529 1529
         // print ' <a href="' . DOL_URL_ROOT . '/societe/card.php?action=create&client=3&fournisseur=0&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?action=create') . '">' . $langs->trans("AddThirdParty") . '</a>';
1530
-        print ' <a href = "' . BASE_URI . '?controller=societe&method=card&action=create&client=3&fournisseur=0&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?action=create') . '">' . $langs->trans("AddThirdParty") . '</a>';
1530
+        print ' <a href = "'.BASE_URI.'?controller=societe&method=card&action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'">'.$langs->trans("AddThirdParty").'</a>';
1531 1531
         print '</td>';
1532 1532
     }
1533
-    print '</tr>' . "\n";
1533
+    print '</tr>'."\n";
1534 1534
 
1535 1535
     if ($socid > 0) {
1536 1536
         // Contacts (ask contact only if thirdparty already defined). TODO do this also into order and invoice.
1537
-        print "<tr><td>" . $langs->trans("DefaultContact") . '</td><td>';
1537
+        print "<tr><td>".$langs->trans("DefaultContact").'</td><td>';
1538 1538
         $form->select_contacts($soc->id, $contactid, 'contactid', 1, $srccontactslist);
1539 1539
         print '</td></tr>';
1540 1540
 
1541 1541
         // Ligne info remises tiers
1542
-        print '<tr><td>' . $langs->trans('Discounts') . '</td><td>';
1542
+        print '<tr><td>'.$langs->trans('Discounts').'</td><td>';
1543 1543
 
1544 1544
         $absolute_discount = $soc->getAvailableDiscounts();
1545 1545
 
1546 1546
         $thirdparty = $soc;
1547 1547
         $discount_type = 0;
1548
-        $backtopage = urlencode($_SERVER["PHP_SELF"] . '?socid=' . $thirdparty->id . '&action=' . $action . '&origin=' . GETPOST('origin') . '&originid=' . GETPOST('originid'));
1549
-        include DOL_DOCUMENT_ROOT . '/core/tpl/object_discounts.tpl.php';
1548
+        $backtopage = urlencode($_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid'));
1549
+        include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php';
1550 1550
         print '</td></tr>';
1551 1551
     }
1552 1552
 
1553 1553
     // Date
1554
-    print '<tr><td class="fieldrequired">' . $langs->trans('Date') . '</td><td>';
1554
+    print '<tr><td class="fieldrequired">'.$langs->trans('Date').'</td><td>';
1555 1555
     print $form->selectDate('', '', '', '', '', "addprop", 1, 1);
1556 1556
     print '</td></tr>';
1557 1557
 
1558 1558
     // Validaty duration
1559
-    print '<tr><td class="fieldrequired">' . $langs->trans("ValidityDuration") . '</td><td><input name="duree_validite" size="5" value="' . $conf->global->PROPALE_VALIDITY_DURATION . '"> ' . $langs->trans("days") . '</td></tr>';
1559
+    print '<tr><td class="fieldrequired">'.$langs->trans("ValidityDuration").'</td><td><input name="duree_validite" size="5" value="'.$conf->global->PROPALE_VALIDITY_DURATION.'"> '.$langs->trans("days").'</td></tr>';
1560 1560
 
1561 1561
     // Terms of payment
1562
-    print '<tr><td class="nowrap fieldrequired">' . $langs->trans('PaymentConditionsShort') . '</td><td>';
1562
+    print '<tr><td class="nowrap fieldrequired">'.$langs->trans('PaymentConditionsShort').'</td><td>';
1563 1563
     $form->select_conditions_paiements($soc->cond_reglement_id, 'cond_reglement_id');
1564 1564
     print '</td></tr>';
1565 1565
 
1566 1566
     // Mode of payment
1567
-    print '<tr><td>' . $langs->trans('PaymentMode') . '</td><td>';
1567
+    print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>';
1568 1568
     $form->select_types_paiements($soc->mode_reglement_id, 'mode_reglement_id');
1569 1569
     print '</td></tr>';
1570 1570
 
1571 1571
     // Bank Account
1572 1572
     if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && !empty($conf->banque->enabled)) {
1573
-        print '<tr><td>' . $langs->trans('BankAccount') . '</td><td>';
1573
+        print '<tr><td>'.$langs->trans('BankAccount').'</td><td>';
1574 1574
         $form->select_comptes($soc->fk_account, 'fk_account', 0, '', 1);
1575 1575
         print '</td></tr>';
1576 1576
     }
1577 1577
 
1578 1578
     // What trigger creation
1579
-    print '<tr><td>' . $langs->trans('Source') . '</td><td>';
1579
+    print '<tr><td>'.$langs->trans('Source').'</td><td>';
1580 1580
     $form->selectInputReason('', 'demand_reason_id', "SRC_PROP", 1);
1581 1581
     print '</td></tr>';
1582 1582
 
1583 1583
     // Delivery delay
1584
-    print '<tr class="fielddeliverydelay"><td>' . $langs->trans('AvailabilityPeriod') . '</td><td>';
1584
+    print '<tr class="fielddeliverydelay"><td>'.$langs->trans('AvailabilityPeriod').'</td><td>';
1585 1585
     $form->selectAvailabilityDelay('', 'availability_id', '', 1);
1586 1586
     print '</td></tr>';
1587 1587
 
1588 1588
     // Shipping Method
1589 1589
     if (!empty($conf->expedition->enabled)) {
1590
-        print '<tr><td>' . $langs->trans('SendingMethod') . '</td><td>';
1590
+        print '<tr><td>'.$langs->trans('SendingMethod').'</td><td>';
1591 1591
         print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1);
1592 1592
         print '</td></tr>';
1593 1593
     }
1594 1594
 
1595 1595
     // Delivery date (or manufacturing)
1596
-    print '<tr><td>' . $langs->trans("DeliveryDate") . '</td>';
1596
+    print '<tr><td>'.$langs->trans("DeliveryDate").'</td>';
1597 1597
     print '<td>';
1598 1598
     if ($conf->global->DATE_LIVRAISON_WEEK_DELAY != "") {
1599 1599
         $tmpdte = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60);
1600 1600
         $syear = date("Y", $tmpdte);
1601 1601
         $smonth = date("m", $tmpdte);
1602 1602
         $sday = date("d", $tmpdte);
1603
-        print $form->selectDate($syear . "-" . $smonth . "-" . $sday, 'date_livraison', '', '', '', "addprop");
1603
+        print $form->selectDate($syear."-".$smonth."-".$sday, 'date_livraison', '', '', '', "addprop");
1604 1604
     } else {
1605 1605
         print $form->selectDate(-1, 'date_livraison', '', '', '', "addprop", 1, 1);
1606 1606
     }
@@ -1610,10 +1610,10 @@  discard block
 block discarded – undo
1610 1610
     if (!empty($conf->projet->enabled)) {
1611 1611
         $langs->load("projects");
1612 1612
         print '<tr>';
1613
-        print '<td>' . $langs->trans("Project") . '</td><td>';
1613
+        print '<td>'.$langs->trans("Project").'</td><td>';
1614 1614
         $numprojet = $formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1);
1615 1615
         // print ' &nbsp; <a href="' . DOL_URL_ROOT . '/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?action=create&socid=' . $soc->id) . '">' . $langs->trans("AddProject") . '</a>';
1616
-        print ' &nbsp; <a href = "' . BASE_URI . '?controller=projet&method=card&socid=' . $soc->id . '&action=create&status=1&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?action=create&socid=' . $soc->id) . '">' . $langs->trans("AddProject") . '</a>';
1616
+        print ' &nbsp; <a href = "'.BASE_URI.'?controller=projet&method=card&socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">'.$langs->trans("AddProject").'</a>';
1617 1617
         print '</td>';
1618 1618
         print '</tr>';
1619 1619
     }
@@ -1621,7 +1621,7 @@  discard block
 block discarded – undo
1621 1621
     // Incoterms
1622 1622
     if (!empty($conf->incoterm->enabled)) {
1623 1623
         print '<tr>';
1624
-        print '<td><label for="incoterm_id">' . $form->textwithpicto($langs->trans("IncotermLabel"), $soc->libelle_incoterms, 1) . '</label></td>';
1624
+        print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $soc->libelle_incoterms, 1).'</label></td>';
1625 1625
         print '<td class="maxwidthonsmartphone">';
1626 1626
         print $form->select_incoterms((!empty($soc->fk_incoterms) ? $soc->fk_incoterms : ''), (!empty($soc->location_incoterms) ? $soc->location_incoterms : ''));
1627 1627
         print '</td></tr>';
@@ -1629,7 +1629,7 @@  discard block
 block discarded – undo
1629 1629
 
1630 1630
     // Template to use by default
1631 1631
     print '<tr>';
1632
-    print '<td>' . $langs->trans("DefaultModel") . '</td>';
1632
+    print '<td>'.$langs->trans("DefaultModel").'</td>';
1633 1633
     print '<td>';
1634 1634
     $liste = ModelePDFPropales::liste_modeles($db);
1635 1635
     print $form->selectarray('model', $liste, ($conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT ? $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT : $conf->global->PROPALE_ADDON_PDF));
@@ -1638,7 +1638,7 @@  discard block
 block discarded – undo
1638 1638
     // Multicurrency
1639 1639
     if (!empty($conf->multicurrency->enabled)) {
1640 1640
         print '<tr>';
1641
-        print '<td>' . $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0) . '</td>';
1641
+        print '<td>'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).'</td>';
1642 1642
         print '<td class="maxwidthonsmartphone">';
1643 1643
         print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 0);
1644 1644
         print '</td></tr>';
@@ -1646,7 +1646,7 @@  discard block
 block discarded – undo
1646 1646
 
1647 1647
     // Public note
1648 1648
     print '<tr>';
1649
-    print '<td class="tdtop">' . $langs->trans('NotePublic') . '</td>';
1649
+    print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
1650 1650
     print '<td valign="top">';
1651 1651
     $note_public = $object->getDefaultCreateValueFor('note_public', (is_object($objectsrc) ? $objectsrc->note_public : null));
1652 1652
     $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
@@ -1655,7 +1655,7 @@  discard block
 block discarded – undo
1655 1655
     // Private note
1656 1656
     if (empty($user->societe_id)) {
1657 1657
         print '<tr>';
1658
-        print '<td class="tdtop">' . $langs->trans('NotePrivate') . '</td>';
1658
+        print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
1659 1659
         print '<td valign="top">';
1660 1660
         $note_private = $object->getDefaultCreateValueFor('note_private', ((!empty($origin) && !empty($originid) && is_object($objectsrc)) ? $objectsrc->note_private : null));
1661 1661
         $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
@@ -1665,7 +1665,7 @@  discard block
 block discarded – undo
1665 1665
     }
1666 1666
 
1667 1667
     // Other attributes
1668
-    include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php';
1668
+    include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
1669 1669
 
1670 1670
     // Lines from source
1671 1671
     if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
@@ -1677,13 +1677,13 @@  discard block
 block discarded – undo
1677 1677
             $objectsrc->update_price(1, - 1, 1);
1678 1678
         }
1679 1679
 
1680
-        print "\n<!-- " . $classname . " info -->";
1680
+        print "\n<!-- ".$classname." info -->";
1681 1681
         print "\n";
1682
-        print '<input type="hidden" name="amount"         value="' . $objectsrc->total_ht . '">' . "\n";
1683
-        print '<input type="hidden" name="total"          value="' . $objectsrc->total_ttc . '">' . "\n";
1684
-        print '<input type="hidden" name="tva"            value="' . $objectsrc->total_tva . '">' . "\n";
1685
-        print '<input type="hidden" name="origin"         value="' . $objectsrc->element . '">';
1686
-        print '<input type="hidden" name="originid"       value="' . $objectsrc->id . '">';
1682
+        print '<input type="hidden" name="amount"         value="'.$objectsrc->total_ht.'">'."\n";
1683
+        print '<input type="hidden" name="total"          value="'.$objectsrc->total_ttc.'">'."\n";
1684
+        print '<input type="hidden" name="tva"            value="'.$objectsrc->total_tva.'">'."\n";
1685
+        print '<input type="hidden" name="origin"         value="'.$objectsrc->element.'">';
1686
+        print '<input type="hidden" name="originid"       value="'.$objectsrc->id.'">';
1687 1687
 
1688 1688
         $newclassname = $classname;
1689 1689
         if ($newclassname == 'Propal')
@@ -1695,17 +1695,17 @@  discard block
 block discarded – undo
1695 1695
         elseif ($newclassname == 'Fichinter')
1696 1696
             $newclassname = 'Intervention';
1697 1697
 
1698
-        print '<tr><td>' . $langs->trans($newclassname) . '</td><td>' . $objectsrc->getNomUrl(1) . '</td></tr>';
1699
-        print '<tr><td>' . $langs->trans('TotalHT') . '</td><td>' . price($objectsrc->total_ht, 0, $langs, 1, -1, -1, $conf->currency) . '</td></tr>';
1700
-        print '<tr><td>' . $langs->trans('TotalVAT') . '</td><td>' . price($objectsrc->total_tva, 0, $langs, 1, -1, -1, $conf->currency) . "</td></tr>";
1698
+        print '<tr><td>'.$langs->trans($newclassname).'</td><td>'.$objectsrc->getNomUrl(1).'</td></tr>';
1699
+        print '<tr><td>'.$langs->trans('TotalHT').'</td><td>'.price($objectsrc->total_ht, 0, $langs, 1, -1, -1, $conf->currency).'</td></tr>';
1700
+        print '<tr><td>'.$langs->trans('TotalVAT').'</td><td>'.price($objectsrc->total_tva, 0, $langs, 1, -1, -1, $conf->currency)."</td></tr>";
1701 1701
         if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) {   // Localtax1
1702
-            print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td><td>' . price($objectsrc->total_localtax1, 0, $langs, 1, -1, -1, $conf->currency) . "</td></tr>";
1702
+            print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td><td>'.price($objectsrc->total_localtax1, 0, $langs, 1, -1, -1, $conf->currency)."</td></tr>";
1703 1703
         }
1704 1704
 
1705 1705
         if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) {   // Localtax2
1706
-            print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td><td>' . price($objectsrc->total_localtax2, 0, $langs, 1, -1, -1, $conf->currency) . "</td></tr>";
1706
+            print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td><td>'.price($objectsrc->total_localtax2, 0, $langs, 1, -1, -1, $conf->currency)."</td></tr>";
1707 1707
         }
1708
-        print '<tr><td>' . $langs->trans('TotalTTC') . '</td><td>' . price($objectsrc->total_ttc, 0, $langs, 1, -1, -1, $conf->currency) . "</td></tr>";
1708
+        print '<tr><td>'.$langs->trans('TotalTTC').'</td><td>'.price($objectsrc->total_ttc, 0, $langs, 1, -1, -1, $conf->currency)."</td></tr>";
1709 1709
     }
1710 1710
 
1711 1711
     print "</table>\n";
@@ -1724,16 +1724,16 @@  discard block
 block discarded – undo
1724 1724
         // For backward compatibility
1725 1725
         print '<tr>';
1726 1726
         print '<td><input type="radio" name="createmode" value="copy"></td>';
1727
-        print '<td>' . $langs->trans("CopyPropalFrom") . ' </td>';
1727
+        print '<td>'.$langs->trans("CopyPropalFrom").' </td>';
1728 1728
         print '<td>';
1729 1729
         $liste_propal = array();
1730 1730
         $liste_propal [0] = '';
1731 1731
 
1732 1732
         $sql = "SELECT p.rowid as id, p.ref, s.nom";
1733
-        $sql .= " FROM " . MAIN_DB_PREFIX . "propal p";
1734
-        $sql .= ", " . MAIN_DB_PREFIX . "societe s";
1733
+        $sql .= " FROM ".MAIN_DB_PREFIX."propal p";
1734
+        $sql .= ", ".MAIN_DB_PREFIX."societe s";
1735 1735
         $sql .= " WHERE s.rowid = p.fk_soc";
1736
-        $sql .= " AND p.entity IN (" . getEntity('propal') . ")";
1736
+        $sql .= " AND p.entity IN (".getEntity('propal').")";
1737 1737
         $sql .= " AND p.fk_statut <> 0";
1738 1738
         $sql .= " ORDER BY Id";
1739 1739
 
@@ -1743,9 +1743,9 @@  discard block
 block discarded – undo
1743 1743
             $i = 0;
1744 1744
             while ($i < $num) {
1745 1745
                 $row = $db->fetch_row($resql);
1746
-                $propalRefAndSocName = $row [1] . " - " . $row [2];
1746
+                $propalRefAndSocName = $row [1]." - ".$row [2];
1747 1747
                 $liste_propal [$row [0]] = $propalRefAndSocName;
1748
-                $i ++;
1748
+                $i++;
1749 1749
             }
1750 1750
             print $form->selectarray("copie_propal", $liste_propal, 0);
1751 1751
         } else {
@@ -1754,7 +1754,7 @@  discard block
 block discarded – undo
1754 1754
         print '</td></tr>';
1755 1755
 
1756 1756
         print '<tr><td class="tdtop"><input type="radio" name="createmode" value="empty" checked></td>';
1757
-        print '<td valign="top" colspan="2">' . $langs->trans("CreateEmptyPropal") . '</td></tr>';
1757
+        print '<td valign="top" colspan="2">'.$langs->trans("CreateEmptyPropal").'</td></tr>';
1758 1758
     }
1759 1759
 
1760 1760
     if (!empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE))
@@ -1764,9 +1764,9 @@  discard block
 block discarded – undo
1764 1764
 
1765 1765
     $langs->load("bills");
1766 1766
     print '<div class="center">';
1767
-    print '<input type="submit" class="button" value="' . $langs->trans("CreateDraft") . '">';
1767
+    print '<input type="submit" class="button" value="'.$langs->trans("CreateDraft").'">';
1768 1768
     print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
1769
-    print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
1769
+    print '<input type="button" class="button" value="'.$langs->trans("Cancel").'" onClick="javascript:history.go(-1)">';
1770 1770
     print '</div>';
1771 1771
 
1772 1772
     print "</form>";
@@ -1811,7 +1811,7 @@  discard block
 block discarded – undo
1811 1811
             $formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->date_livraison);
1812 1812
         }
1813 1813
         // Paiement incomplet. On demande si motif = escompte ou autre
1814
-        $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ClonePropal'), $langs->trans('ConfirmClonePropal', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
1814
+        $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ClonePropal'), $langs->trans('ConfirmClonePropal', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
1815 1815
     }
1816 1816
 
1817 1817
     if ($action == 'statut') {
@@ -1822,29 +1822,29 @@  discard block
 block discarded – undo
1822 1822
         );
1823 1823
 
1824 1824
         if (!empty($conf->notification->enabled)) {
1825
-            require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
1825
+            require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
1826 1826
             $notify = new Notify($db);
1827 1827
             $formquestion = array_merge($formquestion, array(
1828 1828
                 array('type' => 'onecolumn', 'value' => $notify->confirmMessage('PROPAL_CLOSE_SIGNED', $object->socid, $object)),
1829 1829
             ));
1830 1830
         }
1831 1831
 
1832
-        $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('SetAcceptedRefused'), $text, 'setstatut', $formquestion, '', 1, 250);
1832
+        $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetAcceptedRefused'), $text, 'setstatut', $formquestion, '', 1, 250);
1833 1833
     }
1834 1834
 
1835 1835
     // Confirm delete
1836 1836
     else if ($action == 'delete') {
1837
-        $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp', $object->ref), 'confirm_delete', '', 0, 1);
1837
+        $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp', $object->ref), 'confirm_delete', '', 0, 1);
1838 1838
     }
1839 1839
 
1840 1840
     // Confirm reopen
1841 1841
     else if ($action == 'reopen') {
1842
-        $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ReOpen'), $langs->trans('ConfirmReOpenProp', $object->ref), 'confirm_reopen', '', 0, 1);
1842
+        $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ReOpen'), $langs->trans('ConfirmReOpenProp', $object->ref), 'confirm_reopen', '', 0, 1);
1843 1843
     }
1844 1844
 
1845 1845
     // Confirmation delete product/service line
1846 1846
     else if ($action == 'ask_deleteline') {
1847
-        $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1);
1847
+        $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1);
1848 1848
     }
1849 1849
 
1850 1850
     // Confirm validate proposal
@@ -1856,7 +1856,7 @@  discard block
 block discarded – undo
1856 1856
         if ($ref == 'PROV') {
1857 1857
             $numref = $object->getNextNumRef($soc);
1858 1858
             if (empty($numref)) {
1859
-                $error ++;
1859
+                $error++;
1860 1860
                 setEventMessages($object->error, $object->errors, 'errors');
1861 1861
             }
1862 1862
         } else {
@@ -1865,14 +1865,14 @@  discard block
 block discarded – undo
1865 1865
 
1866 1866
         $text = $langs->trans('ConfirmValidateProp', $numref);
1867 1867
         if (!empty($conf->notification->enabled)) {
1868
-            require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
1868
+            require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
1869 1869
             $notify = new Notify($db);
1870 1870
             $text .= '<br>';
1871 1871
             $text .= $notify->confirmMessage('PROPAL_VALIDATE', $object->socid, $object);
1872 1872
         }
1873 1873
 
1874 1874
         if (!$error)
1875
-            $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate', '', 0, 1);
1875
+            $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate', '', 0, 1);
1876 1876
     }
1877 1877
 
1878 1878
     // Call Hook formConfirm
@@ -1889,44 +1889,44 @@  discard block
 block discarded – undo
1889 1889
 
1890 1890
     // Proposal card
1891 1891
 
1892
-    $linkback = '<a href="' . DOL_URL_ROOT . '/comm/propal/list.php?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
1892
+    $linkback = '<a href="'.DOL_URL_ROOT.'/comm/propal/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
1893 1893
 
1894 1894
     $morehtmlref = '<div class="refidno">';
1895 1895
     // Ref customer
1896 1896
     $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1);
1897 1897
     $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', null, null, '', 1);
1898 1898
     // Thirdparty
1899
-    $morehtmlref .= '<br>' . $langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'customer');
1899
+    $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer');
1900 1900
     if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0)
1901 1901
         // $morehtmlref .= ' (<a href="' . DOL_URL_ROOT . '/comm/propal/list.php?socid=' . $object->thirdparty->id . '&search_societe=' . urlencode($object->thirdparty->name) . '">' . $langs->trans("OtherProposals") . '</a>)';
1902
-        $morehtmlref .= ' (<a href = "' . BASE_URI . '?controller=comm/propal&method=list&socid=' . $object->thirdparty->id . '&search_societe=' . urlencode($object->thirdparty->name) . '">' . $langs->trans("OtherProposals") . '</a>)';
1902
+        $morehtmlref .= ' (<a href = "'.BASE_URI.'?controller=comm/propal&method=list&socid='.$object->thirdparty->id.'&search_societe='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherProposals").'</a>)';
1903 1903
     // Project
1904 1904
     if (!empty($conf->projet->enabled)) {
1905 1905
         $langs->load("projects");
1906
-        $morehtmlref .= '<br>' . $langs->trans('Project') . ' ';
1906
+        $morehtmlref .= '<br>'.$langs->trans('Project').' ';
1907 1907
         if ($usercancreate) {
1908 1908
             if ($action != 'classify') {
1909 1909
                 // $morehtmlref .= '<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
1910
-                $morehtmlref .= '<a href = "' . BASE_URI . '?controller=comm/propal&method=card&action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
1910
+                $morehtmlref .= '<a href = "'.BASE_URI.'?controller=comm/propal&method=card&action=classify&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
1911 1911
             }
1912 1912
             if ($action == 'classify') {
1913 1913
                 //$morehtmlref.=$form->form_project(BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
1914 1914
                 //$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
1915
-                $morehtmlref .= '<form method="post" href="' . BASE_PATH . '?controller=comm/propal&method=card&id=' . $object->id . '">';
1915
+                $morehtmlref .= '<form method="post" href="'.BASE_PATH.'?controller=comm/propal&method=card&id='.$object->id.'">';
1916 1916
                 $morehtmlref .= '<input type="hidden" name="action" value="classin">';
1917
-                $morehtmlref .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
1917
+                $morehtmlref .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
1918 1918
                 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
1919
-                $morehtmlref .= '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
1919
+                $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
1920 1920
                 $morehtmlref .= '</form>';
1921 1921
             } else {
1922
-                $morehtmlref .= $form->form_project(BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
1922
+                $morehtmlref .= $form->form_project(BASE_URI.'?controller=comm/propal&method=card&id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
1923 1923
             }
1924 1924
         } else {
1925 1925
             if (!empty($object->fk_project)) {
1926 1926
                 $proj = new Project($db);
1927 1927
                 $proj->fetch($object->fk_project);
1928 1928
                 // $morehtmlref .= '<a href="' . DOL_URL_ROOT . '/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
1929
-                $morehtmlref .= '<a href = "' . BASE_URI . '?controller=projet&method=card&id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
1929
+                $morehtmlref .= '<a href = "'.BASE_URI.'?controller=projet&method=card&id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
1930 1930
                 $morehtmlref .= $proj->ref;
1931 1931
                 $morehtmlref .= '</a>';
1932 1932
             } else {
@@ -1955,7 +1955,7 @@  discard block
 block discarded – undo
1955 1955
         $filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')";
1956 1956
     }
1957 1957
 
1958
-    print '<tr><td class="titlefield">' . $langs->trans('Discounts') . '</td><td>';
1958
+    print '<tr><td class="titlefield">'.$langs->trans('Discounts').'</td><td>';
1959 1959
 
1960 1960
     $absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount);
1961 1961
     $absolute_creditnote = $soc->getAvailableDiscounts('', $filtercreditnote);
@@ -1964,8 +1964,8 @@  discard block
 block discarded – undo
1964 1964
 
1965 1965
     $thirdparty = $soc;
1966 1966
     $discount_type = 0;
1967
-    $backtopage = urlencode($_SERVER["PHP_SELF"] . '?id=' . $object->id);
1968
-    include DOL_DOCUMENT_ROOT . '/core/tpl/object_discounts.tpl.php';
1967
+    $backtopage = urlencode($_SERVER["PHP_SELF"].'?id='.$object->id);
1968
+    include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php';
1969 1969
 
1970 1970
     print '</td></tr>';
1971 1971
 
@@ -1977,15 +1977,15 @@  discard block
 block discarded – undo
1977 1977
     print '</td>';
1978 1978
     if ($action != 'editdate' && !empty($object->brouillon) && $usercancreate)
1979 1979
         // print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdate&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetDate'), 1) . '</a></td>';
1980
-        print '<td align="right"><a href = "' . BASE_URI . '?controller=comm/propal&method=card&action=editdate&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetDate'), 1) . '</a></td>';
1980
+        print '<td align="right"><a href = "'.BASE_URI.'?controller=comm/propal&method=card&action=editdate&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
1981 1981
     print '</tr></table>';
1982 1982
     print '</td><td>';
1983 1983
     if (!empty($object->brouillon) && $action == 'editdate' && $usercancreate) {
1984
-        print '<form name="editdate" href="' . BASE_PATH . '?controller=comm/propal&method=card&id=' . $object->id . '" method="post">';
1985
-        print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
1984
+        print '<form name="editdate" href="'.BASE_PATH.'?controller=comm/propal&method=card&id='.$object->id.'" method="post">';
1985
+        print '<input type="hidden" name="token" value="'.$_SESSION ['newtoken'].'">';
1986 1986
         print '<input type="hidden" name="action" value="setdate">';
1987 1987
         print $form->selectDate($object->date, 're', '', '', 0, "editdate");
1988
-        print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
1988
+        print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
1989 1989
         print '</form>';
1990 1990
     } else {
1991 1991
         if ($object->date) {
@@ -2004,16 +2004,16 @@  discard block
 block discarded – undo
2004 2004
     print '</td>';
2005 2005
     if ($action != 'editecheance' && !empty($object->brouillon) && $usercancreate)
2006 2006
         // print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editecheance&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>';
2007
-        print '<td align="right"><a href = "' . BASE_URI . '?controller=comm/propal&method=card&action=editecheance&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>';
2007
+        print '<td align="right"><a href = "'.BASE_URI.'?controller=comm/propal&method=card&action=editecheance&amp;id='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>';
2008 2008
     print '</tr></table>';
2009 2009
     print '</td><td>';
2010 2010
     if (!empty($object->brouillon) && $action == 'editecheance' && $usercancreate) {
2011 2011
         //print '<form name="editecheance" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="post">';
2012
-        print '<form name="editecheance" href="' . BASE_PATH . '?controller=comm/propal&method=card&id=' . $object->id . '" method="post">';
2013
-        print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
2012
+        print '<form name="editecheance" href="'.BASE_PATH.'?controller=comm/propal&method=card&id='.$object->id.'" method="post">';
2013
+        print '<input type="hidden" name="token" value="'.$_SESSION ['newtoken'].'">';
2014 2014
         print '<input type="hidden" name="action" value="setecheance">';
2015 2015
         print $form->selectDate($object->fin_validite, 'ech', '', '', '', "editecheance");
2016
-        print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
2016
+        print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
2017 2017
         print '</form>';
2018 2018
     } else {
2019 2019
         if (!empty($object->fin_validite)) {
@@ -2034,13 +2034,13 @@  discard block
 block discarded – undo
2034 2034
     print '</td>';
2035 2035
     if ($action != 'editconditions' && !empty($object->brouillon) && $usercancreate)
2036 2036
         // print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editconditions&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetConditions'), 1) . '</a></td>';
2037
-        print '<td align="right"><a href = "' . BASE_URI . '?controller=comm/propal&method=card&action=editconditions&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetConditions'), 1) . '</a></td>';
2037
+        print '<td align="right"><a href = "'.BASE_URI.'?controller=comm/propal&method=card&action=editconditions&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'), 1).'</a></td>';
2038 2038
     print '</tr></table>';
2039 2039
     print '</td><td>';
2040 2040
     if (!empty($object->brouillon) && $action == 'editconditions' && $usercancreate) {
2041
-        $form->form_conditions_reglement(BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id, $object->cond_reglement_id, 'cond_reglement_id');
2041
+        $form->form_conditions_reglement(BASE_URI.'?controller=comm/propal&method=card&id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id');
2042 2042
     } else {
2043
-        $form->form_conditions_reglement(BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id, $object->cond_reglement_id, 'none');
2043
+        $form->form_conditions_reglement(BASE_URI.'?controller=comm/propal&method=card&id='.$object->id, $object->cond_reglement_id, 'none');
2044 2044
     }
2045 2045
     print '</td>';
2046 2046
     print '</tr>';
@@ -2059,19 +2059,19 @@  discard block
 block discarded – undo
2059 2059
     print '<table class="nobordernopadding" width="100%"><tr><td>';
2060 2060
     print $langs->trans('AvailabilityPeriod');
2061 2061
     if (!empty($conf->commande->enabled))
2062
-        print ' (' . $langs->trans('AfterOrder') . ')';
2062
+        print ' ('.$langs->trans('AfterOrder').')';
2063 2063
     print '</td>';
2064 2064
     if ($action != 'editavailability' && !empty($object->brouillon) && $usercancreate)
2065 2065
         // print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editavailability&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1) . '</a></td>';
2066
-        print '<td align="right"><a href = "' . BASE_URI . '?controller=comm/propal&method=card&action=editavailability&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1) . '</a></td>';
2066
+        print '<td align="right"><a href = "'.BASE_URI.'?controller=comm/propal&method=card&action=editavailability&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1).'</a></td>';
2067 2067
     print '</tr></table>';
2068 2068
     print '</td><td>';
2069 2069
     if (!empty($object->brouillon) && $action == 'editavailability' && $usercancreate) {
2070 2070
         // $form->form_availability(BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id, $object->availability_id, 'availability_id', 1);
2071
-        $form->form_availability(BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id, $object->availability_id, 'availability_id', 1);
2071
+        $form->form_availability(BASE_URI.'?controller=comm/propal&method=card&id='.$object->id, $object->availability_id, 'availability_id', 1);
2072 2072
     } else {
2073 2073
         // $form->form_availability(BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id, $object->availability_id, 'none', 1);
2074
-        $form->form_availability(BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id, $object->availability_id, 'none', 1);
2074
+        $form->form_availability(BASE_URI.'?controller=comm/propal&method=card&id='.$object->id, $object->availability_id, 'none', 1);
2075 2075
     }
2076 2076
 
2077 2077
     print '</td>';
@@ -2085,14 +2085,14 @@  discard block
 block discarded – undo
2085 2085
         print '</td>';
2086 2086
         if ($action != 'editshippingmethod' && $usercancreate) {
2087 2087
             // print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editshippingmethod&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetShippingMode'), 1) . '</a></td>';
2088
-            print '<td align="right"><a href = "' . BASE_URI . '?controller=comm/propal&method=card&action=editshippingmethod&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetShippingMode'), 1) . '</a></td>';
2088
+            print '<td align="right"><a href = "'.BASE_URI.'?controller=comm/propal&method=card&action=editshippingmethod&amp;id='.$object->id.'">'.img_edit($langs->trans('SetShippingMode'), 1).'</a></td>';
2089 2089
         }
2090 2090
         print '</tr></table>';
2091 2091
         print '</td><td>';
2092 2092
         if ($action == 'editshippingmethod' && $usercancreate) {
2093
-            $form->formSelectShippingMethod(BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id, $object->shipping_method_id, 'shipping_method_id', 1);
2093
+            $form->formSelectShippingMethod(BASE_URI.'?controller=comm/propal&method=card&id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1);
2094 2094
         } else {
2095
-            $form->formSelectShippingMethod(BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id, $object->shipping_method_id, 'none');
2095
+            $form->formSelectShippingMethod(BASE_URI.'?controller=comm/propal&method=card&id='.$object->id, $object->shipping_method_id, 'none');
2096 2096
         }
2097 2097
         print '</td>';
2098 2098
         print '</tr>';
@@ -2105,14 +2105,14 @@  discard block
 block discarded – undo
2105 2105
     print '</td>';
2106 2106
     if ($action != 'editdemandreason' && !empty($object->brouillon) && $usercancreate) {
2107 2107
         // print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdemandreason&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetDemandReason'), 1) . '</a></td>';
2108
-        print '<td align="right"><a href = "' . BASE_URI . '?controller=comm/propal&method=card&action=editdemandreason&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetDemandReason'), 1) . '</a></td>';
2108
+        print '<td align="right"><a href = "'.BASE_URI.'?controller=comm/propal&method=card&action=editdemandreason&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDemandReason'), 1).'</a></td>';
2109 2109
     }
2110 2110
     print '</tr></table>';
2111 2111
     print '</td><td>';
2112 2112
     if (!empty($object->brouillon) && $action == 'editdemandreason' && $usercancreate) {
2113
-        $form->formInputReason(BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id, $object->demand_reason_id, 'demand_reason_id', 1);
2113
+        $form->formInputReason(BASE_URI.'?controller=comm/propal&method=card&id='.$object->id, $object->demand_reason_id, 'demand_reason_id', 1);
2114 2114
     } else {
2115
-        $form->formInputReason(BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id, $object->demand_reason_id, 'none');
2115
+        $form->formInputReason(BASE_URI.'?controller=comm/propal&method=card&id='.$object->id, $object->demand_reason_id, 'none');
2116 2116
     }
2117 2117
     print '</td>';
2118 2118
     print '</tr>';
@@ -2125,14 +2125,14 @@  discard block
 block discarded – undo
2125 2125
     print '</td>';
2126 2126
     if ($action != 'editmode' && !empty($object->brouillon) && $usercancreate) {
2127 2127
         // print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmode&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMode'), 1) . '</a></td>';
2128
-        print '<td align="right"><a href = "' . BASE_URI . '?controller=comm/propal&method=card&action=editmode&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMode'), 1) . '</a></td>';
2128
+        print '<td align="right"><a href = "'.BASE_URI.'?controller=comm/propal&method=card&action=editmode&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).'</a></td>';
2129 2129
     }
2130 2130
     print '</tr></table>';
2131 2131
     print '</td><td>';
2132 2132
     if (!empty($object->brouillon) && $action == 'editmode' && $usercancreate) {
2133
-        $form->form_modes_reglement(BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT');
2133
+        $form->form_modes_reglement(BASE_URI.'?controller=comm/propal&method=card&id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT');
2134 2134
     } else {
2135
-        $form->form_modes_reglement(BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id, $object->mode_reglement_id, 'none');
2135
+        $form->form_modes_reglement(BASE_URI.'?controller=comm/propal&method=card&id='.$object->id, $object->mode_reglement_id, 'none');
2136 2136
     }
2137 2137
     print '</td></tr>';
2138 2138
 
@@ -2146,14 +2146,14 @@  discard block
 block discarded – undo
2146 2146
         print '</td>';
2147 2147
         if ($action != 'editmulticurrencycode' && !empty($object->brouillon) && $usercancreate) {
2148 2148
             // print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencycode&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
2149
-            print '<td align="right"><a href = "' . BASE_URI . '?controller=comm/propal&method=card&action=editmulticurrencycode&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
2149
+            print '<td align="right"><a href = "'.BASE_URI.'?controller=comm/propal&method=card&action=editmulticurrencycode&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'</a></td>';
2150 2150
         }
2151 2151
         print '</tr></table>';
2152 2152
         print '</td><td>';
2153 2153
         if (!empty($object->brouillon) && $action == 'editmulticurrencycode' && $usercancreate) {
2154
-            $form->form_multicurrency_code(BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id, $object->multicurrency_code, 'multicurrency_code');
2154
+            $form->form_multicurrency_code(BASE_URI.'?controller=comm/propal&method=card&id='.$object->id, $object->multicurrency_code, 'multicurrency_code');
2155 2155
         } else {
2156
-            $form->form_multicurrency_code(BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id, $object->multicurrency_code, 'none');
2156
+            $form->form_multicurrency_code(BASE_URI.'?controller=comm/propal&method=card&id='.$object->id, $object->multicurrency_code, 'none');
2157 2157
         }
2158 2158
         print '</td></tr>';
2159 2159
 
@@ -2165,7 +2165,7 @@  discard block
 block discarded – undo
2165 2165
         print '</td>';
2166 2166
         if ($action != 'editmulticurrencyrate' && !empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $usercancreate) {
2167 2167
             // print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencyrate&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
2168
-            print '<td align="right"><a href = "' . BASE_URI . '?controller=comm/propal&method=card&action=editmulticurrencyrate&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
2168
+            print '<td align="right"><a href = "'.BASE_URI.'?controller=comm/propal&method=card&action=editmulticurrencyrate&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'</a></td>';
2169 2169
         }
2170 2170
         print '</tr></table>';
2171 2171
         print '</td><td>';
@@ -2173,13 +2173,13 @@  discard block
 block discarded – undo
2173 2173
             if ($action == 'actualizemulticurrencyrate') {
2174 2174
                 list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
2175 2175
             }
2176
-            $form->form_multicurrency_rate(BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
2176
+            $form->form_multicurrency_rate(BASE_URI.'?controller=comm/propal&method=card&id='.$object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
2177 2177
         } else {
2178
-            $form->form_multicurrency_rate(BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
2178
+            $form->form_multicurrency_rate(BASE_URI.'?controller=comm/propal&method=card&id='.$object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
2179 2179
             if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
2180 2180
                 print '<div class="inline-block"> &nbsp; &nbsp; &nbsp; &nbsp; ';
2181 2181
                 // print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=actualizemulticurrencyrate">' . $langs->trans("ActualizeCurrency") . '</a>';
2182
-                print '<a href = "' . BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id . '&action=actualizemulticurrencyrate">' . $langs->trans("ActualizeCurrency") . '</a>';
2182
+                print '<a href = "'.BASE_URI.'?controller=comm/propal&method=card&id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>';
2183 2183
                 print '</div>';
2184 2184
             }
2185 2185
         }
@@ -2191,7 +2191,7 @@  discard block
 block discarded – undo
2191 2191
         print '<tr><td>';
2192 2192
         print $langs->trans('OutstandingBill');
2193 2193
         print '</td><td align="right">';
2194
-        print price($soc->get_OutstandingBill()) . ' / ';
2194
+        print price($soc->get_OutstandingBill()).' / ';
2195 2195
         print price($soc->outstanding_limit, 0, $langs, 1, - 1, - 1, $conf->currency);
2196 2196
         print '</td>';
2197 2197
         print '</tr>';
@@ -2205,14 +2205,14 @@  discard block
 block discarded – undo
2205 2205
         print '</td>';
2206 2206
         if ($action != 'editbankaccount' && $usercancreate) {
2207 2207
             // print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editbankaccount&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetBankAccount'), 1) . '</a></td>';
2208
-            print '<td align="right"><a href = "' . BASE_URI . '?controller=comm/propal&method=card&action=editbankaccount&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetBankAccount'), 1) . '</a></td>';
2208
+            print '<td align="right"><a href = "'.BASE_URI.'?controller=comm/propal&method=card&action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
2209 2209
         }
2210 2210
         print '</tr></table>';
2211 2211
         print '</td><td>';
2212 2212
         if ($action == 'editbankaccount') {
2213
-            $form->formSelectAccount(BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id, $object->fk_account, 'fk_account', 1);
2213
+            $form->formSelectAccount(BASE_URI.'?controller=comm/propal&method=card&id='.$object->id, $object->fk_account, 'fk_account', 1);
2214 2214
         } else {
2215
-            $form->formSelectAccount(BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id, $object->fk_account, 'none');
2215
+            $form->formSelectAccount(BASE_URI.'?controller=comm/propal&method=card&id='.$object->id, $object->fk_account, 'none');
2216 2216
         }
2217 2217
         print '</td>';
2218 2218
         print '</tr>';
@@ -2222,13 +2222,13 @@  discard block
 block discarded – undo
2222 2222
     $totalWeight = $tmparray['weight'];
2223 2223
     $totalVolume = $tmparray['volume'];
2224 2224
     if ($totalWeight) {
2225
-        print '<tr><td>' . $langs->trans("CalculatedWeight") . '</td>';
2225
+        print '<tr><td>'.$langs->trans("CalculatedWeight").'</td>';
2226 2226
         print '<td>';
2227 2227
         print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND) ? $conf->global->MAIN_WEIGHT_DEFAULT_ROUND : -1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? $conf->global->MAIN_WEIGHT_DEFAULT_UNIT : 'no');
2228 2228
         print '</td></tr>';
2229 2229
     }
2230 2230
     if ($totalVolume) {
2231
-        print '<tr><td>' . $langs->trans("CalculatedVolume") . '</td>';
2231
+        print '<tr><td>'.$langs->trans("CalculatedVolume").'</td>';
2232 2232
         print '<td>';
2233 2233
         print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT : 'no');
2234 2234
         print '</td></tr>';
@@ -2241,7 +2241,7 @@  discard block
 block discarded – undo
2241 2241
         print $langs->trans('IncotermLabel');
2242 2242
         print '<td><td align="right">';
2243 2243
         if ($usercancreate) {
2244
-            print '<a href = "' . BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id . '&action=editincoterm">' . img_edit() . '</a>';
2244
+            print '<a href = "'.BASE_URI.'?controller=comm/propal&method=card&id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
2245 2245
         } else {
2246 2246
             print '&nbsp;';
2247 2247
         }
@@ -2251,13 +2251,13 @@  discard block
 block discarded – undo
2251 2251
         if ($action != 'editincoterm') {
2252 2252
             print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1);
2253 2253
         } else {
2254
-            print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'] . '?id=' . $object->id);
2254
+            print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id);
2255 2255
         }
2256 2256
         print '</td></tr>';
2257 2257
     }
2258 2258
 
2259 2259
     // Other attributes
2260
-    include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
2260
+    include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
2261 2261
 
2262 2262
     print '</table>';
2263 2263
 
@@ -2270,46 +2270,46 @@  discard block
 block discarded – undo
2270 2270
 
2271 2271
     if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) {
2272 2272
         // Multicurrency Amount HT
2273
-        print '<tr><td class="titlefieldmiddle">' . $form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0) . '</td>';
2274
-        print '<td class="nowrap">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
2273
+        print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>';
2274
+        print '<td class="nowrap">'.price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
2275 2275
         print '</tr>';
2276 2276
 
2277 2277
         // Multicurrency Amount VAT
2278
-        print '<tr><td>' . $form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0) . '</td>';
2279
-        print '<td class="nowrap">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
2278
+        print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).'</td>';
2279
+        print '<td class="nowrap">'.price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
2280 2280
         print '</tr>';
2281 2281
 
2282 2282
         // Multicurrency Amount TTC
2283
-        print '<tr><td>' . $form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0) . '</td>';
2284
-        print '<td class="nowrap">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
2283
+        print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).'</td>';
2284
+        print '<td class="nowrap">'.price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
2285 2285
         print '</tr>';
2286 2286
     }
2287 2287
 
2288 2288
     // Amount HT
2289
-    print '<tr><td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>';
2290
-    print '<td class="nowrap">' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
2289
+    print '<tr><td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>';
2290
+    print '<td class="nowrap">'.price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency).'</td>';
2291 2291
     print '</tr>';
2292 2292
 
2293 2293
     // Amount VAT
2294
-    print '<tr><td>' . $langs->trans('AmountVAT') . '</td>';
2295
-    print '<td class="nowrap">' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
2294
+    print '<tr><td>'.$langs->trans('AmountVAT').'</td>';
2295
+    print '<td class="nowrap">'.price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency).'</td>';
2296 2296
     print '</tr>';
2297 2297
 
2298 2298
     // Amount Local Taxes
2299 2299
     if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) {  // Localtax1
2300
-        print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
2301
-        print '<td class="nowrap">' . price($object->total_localtax1, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
2300
+        print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
2301
+        print '<td class="nowrap">'.price($object->total_localtax1, '', $langs, 0, - 1, - 1, $conf->currency).'</td>';
2302 2302
         print '</tr>';
2303 2303
     }
2304 2304
     if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) {  // Localtax2
2305
-        print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
2306
-        print '<td class="nowrap">' . price($object->total_localtax2, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
2305
+        print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
2306
+        print '<td class="nowrap">'.price($object->total_localtax2, '', $langs, 0, - 1, - 1, $conf->currency).'</td>';
2307 2307
         print '</tr>';
2308 2308
     }
2309 2309
 
2310 2310
     // Amount TTC
2311
-    print '<tr><td>' . $langs->trans('AmountTTC') . '</td>';
2312
-    print '<td class="nowrap">' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
2311
+    print '<tr><td>'.$langs->trans('AmountTTC').'</td>';
2312
+    print '<td class="nowrap">'.price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency).'</td>';
2313 2313
     print '</tr>';
2314 2314
 
2315 2315
     // Statut
@@ -2331,13 +2331,13 @@  discard block
 block discarded – undo
2331 2331
     if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
2332 2332
         $blocname = 'contacts';
2333 2333
         $title = $langs->trans('ContactsAddresses');
2334
-        include DOL_DOCUMENT_ROOT . '/core/tpl/bloc_showhide.tpl.php';
2334
+        include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php';
2335 2335
     }
2336 2336
 
2337 2337
     if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
2338 2338
         $blocname = 'notes';
2339 2339
         $title = $langs->trans('Notes');
2340
-        include DOL_DOCUMENT_ROOT . '/core/tpl/bloc_showhide.tpl.php';
2340
+        include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php';
2341 2341
     }
2342 2342
 
2343 2343
     /*
@@ -2348,15 +2348,15 @@  discard block
 block discarded – undo
2348 2348
     $result = $object->getLinesArray();
2349 2349
 
2350 2350
     // print '	<form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '#addline' : '#line_' . GETPOST('lineid')) . '" method="POST">
2351
-    print '	<form name="addproduct" id="addproduct" href="' . BASE_PATH . '?controller=comm/propal&method=card&id=' . $object->id . (($action != 'editline') ? '#addline' : '#line_' . GETPOST('lineid')) . '" method="POST">
2352
-	<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">
2353
-	<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">
2351
+    print '	<form name="addproduct" id="addproduct" href="'.BASE_PATH.'?controller=comm/propal&method=card&id='.$object->id.(($action != 'editline') ? '#addline' : '#line_'.GETPOST('lineid')).'" method="POST">
2352
+	<input type="hidden" name="token" value="' . $_SESSION ['newtoken'].'">
2353
+	<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
2354 2354
 	<input type="hidden" name="mode" value="">
2355
-	<input type="hidden" name="id" value="' . $object->id . '">
2355
+	<input type="hidden" name="id" value="' . $object->id.'">
2356 2356
 	';
2357 2357
 
2358 2358
     if (!empty($conf->use_javascript_ajax) && $object->statut == Propal::STATUS_DRAFT) {
2359
-        include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
2359
+        include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
2360 2360
     }
2361 2361
 
2362 2362
     print '<div class="div-table-responsive-no-min">';
@@ -2398,9 +2398,9 @@  discard block
 block discarded – undo
2398 2398
                 if ($object->statut == Propal::STATUS_DRAFT && $object->total_ttc >= 0 && count($object->lines) > 0) {
2399 2399
                     if ($usercanvalidate) {
2400 2400
                         // print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=validate">' . $langs->trans('Validate') . '</a></div>';
2401
-                        print '<div class="inline-block divButAction"><a class="butAction" href = "' . BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id . '&amp;action=validate">' . $langs->trans('Validate') . '</a></div>';
2401
+                        print '<div class="inline-block divButAction"><a class="butAction" href = "'.BASE_URI.'?controller=comm/propal&method=card&id='.$object->id.'&amp;action=validate">'.$langs->trans('Validate').'</a></div>';
2402 2402
                     } else
2403
-                        print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans('Validate') . '</a></div>';
2403
+                        print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans('Validate').'</a></div>';
2404 2404
                 }
2405 2405
                 // Create event
2406 2406
                 /* if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) 	// Add hidden condition because this is not a "workflow" action so should appears somewhere else on page.
@@ -2410,30 +2410,30 @@  discard block
 block discarded – undo
2410 2410
                 // Edit
2411 2411
                 if ($object->statut == Propal::STATUS_VALIDATED && $usercancreate) {
2412 2412
                     // print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=modif">' . $langs->trans('Modify') . '</a></div>';
2413
-                    print '<div class="inline-block divButAction"><a class="butAction" href = "' . BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id . '&amp;action=modif">' . $langs->trans('Modify') . '</a></div>';
2413
+                    print '<div class="inline-block divButAction"><a class="butAction" href = "'.BASE_URI.'?controller=comm/propal&method=card&id='.$object->id.'&amp;action=modif">'.$langs->trans('Modify').'</a></div>';
2414 2414
                 }
2415 2415
 
2416 2416
                 // ReOpen
2417 2417
                 if (($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) && $usercanclose) {
2418 2418
                     // print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=reopen' . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#reopen') . '"';
2419
-                    print '<div class="inline-block divButAction"><a class="butAction" href = "' . BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id . '&amp;action=reopen' . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#reopen') . '"';
2420
-                    print '>' . $langs->trans('ReOpen') . '</a></div>';
2419
+                    print '<div class="inline-block divButAction"><a class="butAction" href = "'.BASE_URI.'?controller=comm/propal&method=card&id='.$object->id.'&amp;action=reopen'.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#reopen').'"';
2420
+                    print '>'.$langs->trans('ReOpen').'</a></div>';
2421 2421
                 }
2422 2422
 
2423 2423
                 // Send
2424 2424
                 if ($object->statut == Propal::STATUS_VALIDATED || $object->statut == Propal::STATUS_SIGNED) {
2425 2425
                     if ($usercansend) {
2426 2426
                         // print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a></div>';
2427
-                        print '<div class="inline-block divButAction"><a class="butAction" href = "' . BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a></div>';
2427
+                        print '<div class="inline-block divButAction"><a class="butAction" href = "'.BASE_URI.'?controller=comm/propal&method=card&id='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a></div>';
2428 2428
                     } else
2429
-                        print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans('SendMail') . '</a></div>';
2429
+                        print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans('SendMail').'</a></div>';
2430 2430
                 }
2431 2431
 
2432 2432
                 // Create an order
2433 2433
                 if (!empty($conf->commande->enabled) && $object->statut == Propal::STATUS_SIGNED) {
2434 2434
                     if ($usercancreateorder) {
2435 2435
                         // print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/commande/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddOrder") . '</a></div>';
2436
-                        print '<div class="inline-block divButAction"><a class="butAction" href = "' . BASE_URI . '?controller=commande&method=card&action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddOrder") . '</a></div>';
2436
+                        print '<div class="inline-block divButAction"><a class="butAction" href = "'.BASE_URI.'?controller=commande&method=card&action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("AddOrder").'</a></div>';
2437 2437
                     }
2438 2438
                 }
2439 2439
 
@@ -2442,7 +2442,7 @@  discard block
 block discarded – undo
2442 2442
                     if ($usercancreateintervention) {
2443 2443
                         $langs->load("interventions");
2444 2444
                         // print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/fichinter/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddIntervention") . '</a></div>';
2445
-                        print '<div class="inline-block divButAction"><a class="butAction" href = "' . BASE_URI . '?controller=fichinter&method=card&action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddIntervention") . '</a></div>';
2445
+                        print '<div class="inline-block divButAction"><a class="butAction" href = "'.BASE_URI.'?controller=fichinter&method=card&action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("AddIntervention").'</a></div>';
2446 2446
                     }
2447 2447
                 }
2448 2448
 
@@ -2452,7 +2452,7 @@  discard block
 block discarded – undo
2452 2452
 
2453 2453
                     if ($usercancreatecontract) {
2454 2454
                         // print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/contrat/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans('AddContract') . '</a></div>';
2455
-                        print '<div class="inline-block divButAction"><a class="butAction" href = "' . BASE_URI . '?controller=contrat&method=card&action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans('AddContract') . '</a></div>';
2455
+                        print '<div class="inline-block divButAction"><a class="butAction" href = "'.BASE_URI.'?controller=contrat&method=card&action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans('AddContract').'</a></div>';
2456 2456
                     }
2457 2457
                 }
2458 2458
 
@@ -2460,34 +2460,34 @@  discard block
 block discarded – undo
2460 2460
                 if ($object->statut == Propal::STATUS_SIGNED) {
2461 2461
                     if (!empty($conf->facture->enabled) && $usercancreateinvoice) {
2462 2462
                         // print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/compta/facture/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddBill") . '</a></div>';
2463
-                        print '<div class="inline-block divButAction"><a class="butAction" href = "' . BASE_URI . '?controller=compta/facture&method=card&action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddBill") . '</a></div>';
2463
+                        print '<div class="inline-block divButAction"><a class="butAction" href = "'.BASE_URI.'?controller=compta/facture&method=card&action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("AddBill").'</a></div>';
2464 2464
                     }
2465 2465
 
2466 2466
                     $arrayofinvoiceforpropal = $object->getInvoiceArrayList();
2467 2467
                     if ((is_array($arrayofinvoiceforpropal) && count($arrayofinvoiceforpropal) > 0) || empty($conf->global->WORKFLOW_PROPAL_NEED_INVOICE_TO_BE_CLASSIFIED_BILLED)) {
2468 2468
                         // print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=classifybilled&amp;socid=' . $object->socid . '">' . $langs->trans("ClassifyBilled") . '</a></div>';
2469
-                        print '<div class="inline-block divButAction"><a class="butAction" href = "' . BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id . '&amp;action=classifybilled&amp;socid=' . $object->socid . '">' . $langs->trans("ClassifyBilled") . '</a></div>';
2469
+                        print '<div class="inline-block divButAction"><a class="butAction" href = "'.BASE_URI.'?controller=comm/propal&method=card&id='.$object->id.'&amp;action=classifybilled&amp;socid='.$object->socid.'">'.$langs->trans("ClassifyBilled").'</a></div>';
2470 2470
                     }
2471 2471
                 }
2472 2472
 
2473 2473
                 // Set accepted/refused
2474 2474
                 if ($object->statut == Propal::STATUS_VALIDATED && $usercanclose) {
2475 2475
                     // print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=statut' . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#close') . '"';
2476
-                    print '<div class="inline-block divButAction"><a class="butAction" href = "' . BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id . '&amp;action=statut' . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#close') . '"';
2477
-                    print '>' . $langs->trans('SetAcceptedRefused') . '</a></div>';
2476
+                    print '<div class="inline-block divButAction"><a class="butAction" href = "'.BASE_URI.'?controller=comm/propal&method=card&id='.$object->id.'&amp;action=statut'.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#close').'"';
2477
+                    print '>'.$langs->trans('SetAcceptedRefused').'</a></div>';
2478 2478
                 }
2479 2479
 
2480 2480
                 // Clone
2481 2481
                 if ($usercancreate) {
2482 2482
                     // print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&amp;socid=' . $object->socid . '&amp;action=clone&amp;object=' . $object->element . '">' . $langs->trans("ToClone") . '</a></div>';
2483
-                    print '<div class="inline-block divButAction"><a class="butAction" href = "' . BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id . '&amp;socid=' . $object->socid . '&amp;action=clone&amp;object=' . $object->element . '">' . $langs->trans("ToClone") . '</a></div>';
2483
+                    print '<div class="inline-block divButAction"><a class="butAction" href = "'.BASE_URI.'?controller=comm/propal&method=card&id='.$object->id.'&amp;socid='.$object->socid.'&amp;action=clone&amp;object='.$object->element.'">'.$langs->trans("ToClone").'</a></div>';
2484 2484
                 }
2485 2485
 
2486 2486
                 // Delete
2487 2487
                 if ($usercandelete) {
2488 2488
                     // print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=delete"';
2489
-                    print '<div class="inline-block divButAction"><a class="butActionDelete" href = "' . BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id . '&amp;action=delete"';
2490
-                    print '>' . $langs->trans('Delete') . '</a></div>';
2489
+                    print '<div class="inline-block divButAction"><a class="butActionDelete" href = "'.BASE_URI.'?controller=comm/propal&method=card&id='.$object->id.'&amp;action=delete"';
2490
+                    print '>'.$langs->trans('Delete').'</a></div>';
2491 2491
                 }
2492 2492
             }
2493 2493
         }
@@ -2506,8 +2506,8 @@  discard block
 block discarded – undo
2506 2506
          * Documents generes
2507 2507
          */
2508 2508
         $filename = dol_sanitizeFileName($object->ref);
2509
-        $filedir = $conf->propal->multidir_output[$object->entity] . "/" . dol_sanitizeFileName($object->ref);
2510
-        $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
2509
+        $filedir = $conf->propal->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->ref);
2510
+        $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
2511 2511
         $genallowed = $usercanread;
2512 2512
         $delallowed = $usercancreate;
2513 2513
 
@@ -2527,20 +2527,20 @@  discard block
 block discarded – undo
2527 2527
 
2528 2528
         if ($object->statut != Propal::STATUS_DRAFT && $useonlinesignature) {
2529 2529
             print '<br><!-- Link to sign -->';
2530
-            require_once DOL_DOCUMENT_ROOT . '/core/lib/payments.lib.php';
2531
-            print showOnlineSignatureUrl('proposal', $object->ref) . '<br>';
2530
+            require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
2531
+            print showOnlineSignatureUrl('proposal', $object->ref).'<br>';
2532 2532
         }
2533 2533
 
2534 2534
         // Show direct download link
2535 2535
         if ($object->statut != Propal::STATUS_DRAFT && !empty($conf->global->PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD)) {
2536
-            print '<br><!-- Link to download main doc -->' . "\n";
2537
-            print showDirectDownloadLink($object) . '<br>';
2536
+            print '<br><!-- Link to download main doc -->'."\n";
2537
+            print showDirectDownloadLink($object).'<br>';
2538 2538
         }
2539 2539
 
2540 2540
         print '</div><div class="fichehalfright"><div class="ficheaddleft">';
2541 2541
 
2542 2542
         // List of actions on element
2543
-        include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
2543
+        include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
2544 2544
         $formactions = new FormActions($db);
2545 2545
         $somethingshown = $formactions->showactions($object, 'propal', $socid, 1);
2546 2546
 
@@ -2551,9 +2551,9 @@  discard block
 block discarded – undo
2551 2551
     $modelmail = 'propal_send';
2552 2552
     $defaulttopic = 'SendPropalRef';
2553 2553
     $diroutput = $conf->propal->multidir_output[$object->entity];
2554
-    $trackid = 'pro' . $object->id;
2554
+    $trackid = 'pro'.$object->id;
2555 2555
 
2556
-    include DOL_DOCUMENT_ROOT . '/core/tpl/card_presend.tpl.php';
2556
+    include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
2557 2557
 }
2558 2558
 
2559 2559
 // End of page
Please login to merge, or discard this patch.
Braces   +126 added lines, -90 removed lines patch added patch discarded remove patch
@@ -60,10 +60,12 @@  discard block
 block discarded – undo
60 60
 
61 61
 // Load translation files required by the page
62 62
 $langs->loadLangs(array('companies', 'propal', 'compta', 'bills', 'orders', 'products', 'deliveries', 'sendings'));
63
-if (!empty($conf->incoterm->enabled))
63
+if (!empty($conf->incoterm->enabled)) {
64 64
     $langs->load('incoterm');
65
-if (!empty($conf->margin->enabled))
65
+}
66
+if (!empty($conf->margin->enabled)) {
66 67
     $langs->load('margins');
68
+}
67 69
 
68 70
 $error = 0;
69 71
 
@@ -174,10 +176,12 @@  discard block
 block discarded – undo
174 176
                         if ($difference != 0) {
175 177
                             $object->date_livraison = $date_delivery;
176 178
                             foreach ($object->lines as $line) {
177
-                                if (isset($line->date_start))
178
-                                    $line->date_start = $line->date_start + $difference;
179
-                                if (isset($line->date_end))
180
-                                    $line->date_end = $line->date_end + $difference;
179
+                                if (isset($line->date_start)) {
180
+                                                                    $line->date_start = $line->date_start + $difference;
181
+                                }
182
+                                if (isset($line->date_end)) {
183
+                                                                    $line->date_end = $line->date_end + $difference;
184
+                                }
181 185
                             }
182 186
                         }
183 187
                     }
@@ -273,11 +277,11 @@  discard block
 block discarded – undo
273 277
 
274 278
         if (!$error) {
275 279
             $result = $object->set_date($user, $datep);
276
-            if ($result < 0)
277
-                dol_print_error($db, $object->error);
280
+            if ($result < 0) {
281
+                            dol_print_error($db, $object->error);
282
+            }
278 283
         }
279
-    }
280
-    else if ($action == 'setecheance' && $usercancreate) {
284
+    } else if ($action == 'setecheance' && $usercancreate) {
281 285
         $result = $object->set_echeance($user, dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']));
282 286
         if ($result < 0) {
283 287
             dol_print_error($db, $object->error);
@@ -501,8 +505,9 @@  discard block
 block discarded – undo
501 505
                                 }
502 506
 
503 507
                                 $tva_tx = $lines[$i]->tva_tx;
504
-                                if (!empty($lines[$i]->vat_src_code) && !preg_match('/\(/', $tva_tx))
505
-                                    $tva_tx .= ' (' . $lines[$i]->vat_src_code . ')';
508
+                                if (!empty($lines[$i]->vat_src_code) && !preg_match('/\(/', $tva_tx)) {
509
+                                                                    $tva_tx .= ' (' . $lines[$i]->vat_src_code . ')';
510
+                                }
506 511
 
507 512
                                 $result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $date_start, $date_end, $array_options, $lines[$i]->fk_unit);
508 513
 
@@ -565,10 +570,12 @@  discard block
 block discarded – undo
565 570
                         if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
566 571
                             $outputlangs = $langs;
567 572
                             $newlang = '';
568
-                            if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09'))
569
-                                $newlang = GETPOST('lang_id', 'aZ09');
570
-                            if ($conf->global->MAIN_MULTILANGS && empty($newlang))
571
-                                $newlang = $object->thirdparty->default_lang;
573
+                            if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
574
+                                                            $newlang = GETPOST('lang_id', 'aZ09');
575
+                            }
576
+                            if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
577
+                                                            $newlang = $object->thirdparty->default_lang;
578
+                            }
572 579
                             if (!empty($newlang)) {
573 580
                                 $outputlangs = new Translate("", $conf);
574 581
                                 $outputlangs->setDefaultLang($newlang);
@@ -577,14 +584,14 @@  discard block
 block discarded – undo
577 584
 
578 585
                             $ret = $object->fetch($id); // Reload to get new records
579 586
                             $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
580
-                            if ($result < 0)
581
-                                dol_print_error($db, $result);
587
+                            if ($result < 0) {
588
+                                                            dol_print_error($db, $result);
589
+                            }
582 590
                         }
583 591
 
584 592
                         header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id);
585 593
                         exit();
586
-                    }
587
-                    else {
594
+                    } else {
588 595
                         $db->rollback();
589 596
                         $action = 'create';
590 597
                     }
@@ -848,8 +855,9 @@  discard block
 block discarded – undo
848 855
                 // Update if prices fields are defined
849 856
                 $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id);
850 857
                 $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id);
851
-                if (empty($tva_tx))
852
-                    $tva_npr = 0;
858
+                if (empty($tva_tx)) {
859
+                                    $tva_npr = 0;
860
+                }
853 861
 
854 862
                 // Price unique per product
855 863
                 $pu_ht = $prod->price;
@@ -864,10 +872,12 @@  discard block
 block discarded – undo
864 872
                     $price_min = $prod->multiprices_min[$object->thirdparty->price_level];
865 873
                     $price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level];
866 874
                     if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) {  // using this option is a bug. kept for backward compatibility
867
-                        if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level]))
868
-                            $tva_tx = $prod->multiprices_tva_tx[$object->thirdparty->price_level];
869
-                        if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level]))
870
-                            $tva_npr = $prod->multiprices_recuperableonly[$object->thirdparty->price_level];
875
+                        if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) {
876
+                                                    $tva_tx = $prod->multiprices_tva_tx[$object->thirdparty->price_level];
877
+                        }
878
+                        if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) {
879
+                                                    $tva_npr = $prod->multiprices_recuperableonly[$object->thirdparty->price_level];
880
+                        }
871 881
                     }
872 882
                 }
873 883
                 // If price per customer
@@ -886,11 +896,13 @@  discard block
 block discarded – undo
886 896
                             $pu_ttc = price($prodcustprice->lines[0]->price_ttc);
887 897
                             $price_base_type = $prodcustprice->lines[0]->price_base_type;
888 898
                             $tva_tx = ($prodcustprice->lines[0]->default_vat_code ? $prodcustprice->lines[0]->tva_tx . ' (' . $prodcustprice->lines[0]->default_vat_code . ' )' : $prodcustprice->lines[0]->tva_tx);
889
-                            if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx))
890
-                                $tva_tx .= ' (' . $prodcustprice->lines[0]->default_vat_code . ')';
899
+                            if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) {
900
+                                                            $tva_tx .= ' (' . $prodcustprice->lines[0]->default_vat_code . ')';
901
+                            }
891 902
                             $tva_npr = $prodcustprice->lines[0]->recuperableonly;
892
-                            if (empty($tva_tx))
893
-                                $tva_npr = 0;
903
+                            if (empty($tva_tx)) {
904
+                                                            $tva_npr = 0;
905
+                            }
894 906
                         }
895 907
                     }
896 908
                 }
@@ -902,8 +914,9 @@  discard block
 block discarded – undo
902 914
 
903 915
                         // Search price into product_price_by_qty from $prod->id
904 916
                         foreach ($prod->prices_by_qty_list[0] as $priceforthequantityarray) {
905
-                            if ($priceforthequantityarray['rowid'] != $pqp)
906
-                                continue;
917
+                            if ($priceforthequantityarray['rowid'] != $pqp) {
918
+                                                            continue;
919
+                            }
907 920
                             // We found the price
908 921
                             if ($priceforthequantityarray['price_base_type'] == 'HT') {
909 922
                                 $pu_ht = $priceforthequantityarray['unitprice'];
@@ -923,8 +936,9 @@  discard block
 block discarded – undo
923 936
 
924 937
                         // Search price into product_price_by_qty from $prod->id
925 938
                         foreach ($prod->prices_by_qty_list[$object->thirdparty->price_level] as $priceforthequantityarray) {
926
-                            if ($priceforthequantityarray['rowid'] != $pqp)
927
-                                continue;
939
+                            if ($priceforthequantityarray['rowid'] != $pqp) {
940
+                                                            continue;
941
+                            }
928 942
                             // We found the price
929 943
                             if ($priceforthequantityarray['price_base_type'] == 'HT') {
930 944
                                 $pu_ht = $priceforthequantityarray['unitprice'];
@@ -961,10 +975,12 @@  discard block
 block discarded – undo
961 975
                 if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
962 976
                     $outputlangs = $langs;
963 977
                     $newlang = '';
964
-                    if (empty($newlang) && GETPOST('lang_id', 'aZ09'))
965
-                        $newlang = GETPOST('lang_id', 'aZ09');
966
-                    if (empty($newlang))
967
-                        $newlang = $object->thirdparty->default_lang;
978
+                    if (empty($newlang) && GETPOST('lang_id', 'aZ09')) {
979
+                                            $newlang = GETPOST('lang_id', 'aZ09');
980
+                    }
981
+                    if (empty($newlang)) {
982
+                                            $newlang = $object->thirdparty->default_lang;
983
+                    }
968 984
                     if (!empty($newlang)) {
969 985
                         $outputlangs = new Translate("", $conf);
970 986
                         $outputlangs->setDefaultLang($newlang);
@@ -1327,8 +1343,9 @@  discard block
 block discarded – undo
1327 1343
                 $error++;
1328 1344
             }
1329 1345
         }
1330
-        if ($error)
1331
-            $action = 'edit_extras';
1346
+        if ($error) {
1347
+                    $action = 'edit_extras';
1348
+        }
1332 1349
     }
1333 1350
 
1334 1351
     if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $usercancreate) {
@@ -1406,8 +1423,9 @@  discard block
 block discarded – undo
1406 1423
     print load_fiche_titre($langs->trans("NewProp"));
1407 1424
 
1408 1425
     $soc = new Societe($db);
1409
-    if ($socid > 0)
1410
-        $res = $soc->fetch($socid);
1426
+    if ($socid > 0) {
1427
+            $res = $soc->fetch($socid);
1428
+    }
1411 1429
 
1412 1430
     // Load objectsrc
1413 1431
     if (!empty($origin) && !empty($originid)) {
@@ -1463,16 +1481,18 @@  discard block
 block discarded – undo
1463 1481
             $object->array_options = $objectsrc->array_options;
1464 1482
 
1465 1483
             if (!empty($conf->multicurrency->enabled)) {
1466
-                if (!empty($objectsrc->multicurrency_code))
1467
-                    $currency_code = $objectsrc->multicurrency_code;
1468
-                if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx))
1469
-                    $currency_tx = $objectsrc->multicurrency_tx;
1484
+                if (!empty($objectsrc->multicurrency_code)) {
1485
+                                    $currency_code = $objectsrc->multicurrency_code;
1486
+                }
1487
+                if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) {
1488
+                                    $currency_tx = $objectsrc->multicurrency_tx;
1489
+                }
1470 1490
             }
1471 1491
         }
1472
-    }
1473
-    else {
1474
-        if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code))
1475
-            $currency_code = $soc->multicurrency_code;
1492
+    } else {
1493
+        if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) {
1494
+                    $currency_code = $soc->multicurrency_code;
1495
+        }
1476 1496
     }
1477 1497
 
1478 1498
     $object = new Propal($db);
@@ -1686,14 +1706,15 @@  discard block
 block discarded – undo
1686 1706
         print '<input type="hidden" name="originid"       value="' . $objectsrc->id . '">';
1687 1707
 
1688 1708
         $newclassname = $classname;
1689
-        if ($newclassname == 'Propal')
1690
-            $newclassname = 'CommercialProposal';
1691
-        elseif ($newclassname == 'Commande')
1692
-            $newclassname = 'Order';
1693
-        elseif ($newclassname == 'Expedition')
1694
-            $newclassname = 'Sending';
1695
-        elseif ($newclassname == 'Fichinter')
1696
-            $newclassname = 'Intervention';
1709
+        if ($newclassname == 'Propal') {
1710
+                    $newclassname = 'CommercialProposal';
1711
+        } elseif ($newclassname == 'Commande') {
1712
+                    $newclassname = 'Order';
1713
+        } elseif ($newclassname == 'Expedition') {
1714
+                    $newclassname = 'Sending';
1715
+        } elseif ($newclassname == 'Fichinter') {
1716
+                    $newclassname = 'Intervention';
1717
+        }
1697 1718
 
1698 1719
         print '<tr><td>' . $langs->trans($newclassname) . '</td><td>' . $objectsrc->getNomUrl(1) . '</td></tr>';
1699 1720
         print '<tr><td>' . $langs->trans('TotalHT') . '</td><td>' . price($objectsrc->total_ht, 0, $langs, 1, -1, -1, $conf->currency) . '</td></tr>';
@@ -1715,8 +1736,9 @@  discard block
 block discarded – undo
1715 1736
      * Combobox pour la fonction de copie
1716 1737
      */
1717 1738
 
1718
-    if (empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE))
1719
-        print '<input type="hidden" name="createmode" value="empty">';
1739
+    if (empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) {
1740
+            print '<input type="hidden" name="createmode" value="empty">';
1741
+    }
1720 1742
 
1721 1743
     if (!empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) {
1722 1744
         print '<br><table>';
@@ -1757,8 +1779,9 @@  discard block
 block discarded – undo
1757 1779
         print '<td valign="top" colspan="2">' . $langs->trans("CreateEmptyPropal") . '</td></tr>';
1758 1780
     }
1759 1781
 
1760
-    if (!empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE))
1761
-        print '</table>';
1782
+    if (!empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) {
1783
+            print '</table>';
1784
+    }
1762 1785
 
1763 1786
     dol_fiche_end();
1764 1787
 
@@ -1871,17 +1894,19 @@  discard block
 block discarded – undo
1871 1894
             $text .= $notify->confirmMessage('PROPAL_VALIDATE', $object->socid, $object);
1872 1895
         }
1873 1896
 
1874
-        if (!$error)
1875
-            $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate', '', 0, 1);
1897
+        if (!$error) {
1898
+                    $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate', '', 0, 1);
1899
+        }
1876 1900
     }
1877 1901
 
1878 1902
     // Call Hook formConfirm
1879 1903
     $parameters = array('lineid' => $lineid);
1880 1904
     $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1881
-    if (empty($reshook))
1882
-        $formconfirm .= $hookmanager->resPrint;
1883
-    elseif ($reshook > 0)
1884
-        $formconfirm = $hookmanager->resPrint;
1905
+    if (empty($reshook)) {
1906
+            $formconfirm .= $hookmanager->resPrint;
1907
+    } elseif ($reshook > 0) {
1908
+            $formconfirm = $hookmanager->resPrint;
1909
+    }
1885 1910
 
1886 1911
     // Print form confirm
1887 1912
     print $formconfirm;
@@ -1897,9 +1922,10 @@  discard block
 block discarded – undo
1897 1922
     $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', null, null, '', 1);
1898 1923
     // Thirdparty
1899 1924
     $morehtmlref .= '<br>' . $langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'customer');
1900
-    if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0)
1901
-        // $morehtmlref .= ' (<a href="' . DOL_URL_ROOT . '/comm/propal/list.php?socid=' . $object->thirdparty->id . '&search_societe=' . urlencode($object->thirdparty->name) . '">' . $langs->trans("OtherProposals") . '</a>)';
1925
+    if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) {
1926
+            // $morehtmlref .= ' (<a href="' . DOL_URL_ROOT . '/comm/propal/list.php?socid=' . $object->thirdparty->id . '&search_societe=' . urlencode($object->thirdparty->name) . '">' . $langs->trans("OtherProposals") . '</a>)';
1902 1927
         $morehtmlref .= ' (<a href = "' . BASE_URI . '?controller=comm/propal&method=list&socid=' . $object->thirdparty->id . '&search_societe=' . urlencode($object->thirdparty->name) . '">' . $langs->trans("OtherProposals") . '</a>)';
1928
+    }
1903 1929
     // Project
1904 1930
     if (!empty($conf->projet->enabled)) {
1905 1931
         $langs->load("projects");
@@ -1975,9 +2001,10 @@  discard block
 block discarded – undo
1975 2001
     print '<table class="nobordernopadding" width="100%"><tr><td>';
1976 2002
     print $langs->trans('Date');
1977 2003
     print '</td>';
1978
-    if ($action != 'editdate' && !empty($object->brouillon) && $usercancreate)
1979
-        // print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdate&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetDate'), 1) . '</a></td>';
2004
+    if ($action != 'editdate' && !empty($object->brouillon) && $usercancreate) {
2005
+            // print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdate&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetDate'), 1) . '</a></td>';
1980 2006
         print '<td align="right"><a href = "' . BASE_URI . '?controller=comm/propal&method=card&action=editdate&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetDate'), 1) . '</a></td>';
2007
+    }
1981 2008
     print '</tr></table>';
1982 2009
     print '</td><td>';
1983 2010
     if (!empty($object->brouillon) && $action == 'editdate' && $usercancreate) {
@@ -2002,9 +2029,10 @@  discard block
 block discarded – undo
2002 2029
     print '<table class="nobordernopadding" width="100%"><tr><td>';
2003 2030
     print $langs->trans('DateEndPropal');
2004 2031
     print '</td>';
2005
-    if ($action != 'editecheance' && !empty($object->brouillon) && $usercancreate)
2006
-        // print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editecheance&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>';
2032
+    if ($action != 'editecheance' && !empty($object->brouillon) && $usercancreate) {
2033
+            // print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editecheance&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>';
2007 2034
         print '<td align="right"><a href = "' . BASE_URI . '?controller=comm/propal&method=card&action=editecheance&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>';
2035
+    }
2008 2036
     print '</tr></table>';
2009 2037
     print '</td><td>';
2010 2038
     if (!empty($object->brouillon) && $action == 'editecheance' && $usercancreate) {
@@ -2018,8 +2046,9 @@  discard block
 block discarded – undo
2018 2046
     } else {
2019 2047
         if (!empty($object->fin_validite)) {
2020 2048
             print dol_print_date($object->fin_validite, 'day');
2021
-            if ($object->statut == Propal::STATUS_VALIDATED && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay))
2022
-                print img_warning($langs->trans("Late"));
2049
+            if ($object->statut == Propal::STATUS_VALIDATED && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) {
2050
+                            print img_warning($langs->trans("Late"));
2051
+            }
2023 2052
         } else {
2024 2053
             print '&nbsp;';
2025 2054
         }
@@ -2032,9 +2061,10 @@  discard block
 block discarded – undo
2032 2061
     print '<table class="nobordernopadding" width="100%"><tr><td>';
2033 2062
     print $langs->trans('PaymentConditionsShort');
2034 2063
     print '</td>';
2035
-    if ($action != 'editconditions' && !empty($object->brouillon) && $usercancreate)
2036
-        // print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editconditions&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetConditions'), 1) . '</a></td>';
2064
+    if ($action != 'editconditions' && !empty($object->brouillon) && $usercancreate) {
2065
+            // print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editconditions&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetConditions'), 1) . '</a></td>';
2037 2066
         print '<td align="right"><a href = "' . BASE_URI . '?controller=comm/propal&method=card&action=editconditions&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetConditions'), 1) . '</a></td>';
2067
+    }
2038 2068
     print '</tr></table>';
2039 2069
     print '</td><td>';
2040 2070
     if (!empty($object->brouillon) && $action == 'editconditions' && $usercancreate) {
@@ -2058,12 +2088,14 @@  discard block
 block discarded – undo
2058 2088
     print '<tr class="fielddeliverydelay"><td>';
2059 2089
     print '<table class="nobordernopadding" width="100%"><tr><td>';
2060 2090
     print $langs->trans('AvailabilityPeriod');
2061
-    if (!empty($conf->commande->enabled))
2062
-        print ' (' . $langs->trans('AfterOrder') . ')';
2091
+    if (!empty($conf->commande->enabled)) {
2092
+            print ' (' . $langs->trans('AfterOrder') . ')';
2093
+    }
2063 2094
     print '</td>';
2064
-    if ($action != 'editavailability' && !empty($object->brouillon) && $usercancreate)
2065
-        // print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editavailability&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1) . '</a></td>';
2095
+    if ($action != 'editavailability' && !empty($object->brouillon) && $usercancreate) {
2096
+            // print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editavailability&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1) . '</a></td>';
2066 2097
         print '<td align="right"><a href = "' . BASE_URI . '?controller=comm/propal&method=card&action=editavailability&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1) . '</a></td>';
2098
+    }
2067 2099
     print '</tr></table>';
2068 2100
     print '</td><td>';
2069 2101
     if (!empty($object->brouillon) && $action == 'editavailability' && $usercancreate) {
@@ -2362,8 +2394,9 @@  discard block
 block discarded – undo
2362 2394
     print '<div class="div-table-responsive-no-min">';
2363 2395
     print '<table id="tablelines" class="noborder noshadow" width="100%">';
2364 2396
 
2365
-    if (!empty($object->lines))
2366
-        $ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1);
2397
+    if (!empty($object->lines)) {
2398
+            $ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1);
2399
+    }
2367 2400
 
2368 2401
     // Form to add new line
2369 2402
     if ($object->statut == Propal::STATUS_DRAFT && $usercancreate && $action != 'selectlines') {
@@ -2399,8 +2432,9 @@  discard block
 block discarded – undo
2399 2432
                     if ($usercanvalidate) {
2400 2433
                         // print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=validate">' . $langs->trans('Validate') . '</a></div>';
2401 2434
                         print '<div class="inline-block divButAction"><a class="butAction" href = "' . BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id . '&amp;action=validate">' . $langs->trans('Validate') . '</a></div>';
2402
-                    } else
2403
-                        print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans('Validate') . '</a></div>';
2435
+                    } else {
2436
+                                            print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans('Validate') . '</a></div>';
2437
+                    }
2404 2438
                 }
2405 2439
                 // Create event
2406 2440
                 /* if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) 	// Add hidden condition because this is not a "workflow" action so should appears somewhere else on page.
@@ -2425,8 +2459,9 @@  discard block
 block discarded – undo
2425 2459
                     if ($usercansend) {
2426 2460
                         // print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a></div>';
2427 2461
                         print '<div class="inline-block divButAction"><a class="butAction" href = "' . BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a></div>';
2428
-                    } else
2429
-                        print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans('SendMail') . '</a></div>';
2462
+                    } else {
2463
+                                            print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans('SendMail') . '</a></div>';
2464
+                    }
2430 2465
                 }
2431 2466
 
2432 2467
                 // Create an order
@@ -2496,8 +2531,9 @@  discard block
 block discarded – undo
2496 2531
     }
2497 2532
 
2498 2533
     //Select mail models is same action as presend
2499
-    if (GETPOST('modelselected'))
2500
-        $action = 'presend';
2534
+    if (GETPOST('modelselected')) {
2535
+            $action = 'presend';
2536
+    }
2501 2537
 
2502 2538
     if ($action != 'presend') {
2503 2539
         print '<div class="fichecenter"><div class="fichehalfleft">';
Please login to merge, or discard this patch.
dolibarr/htdocs/comm/propal/class/propal.class.php 2 patches
Spacing   +377 added lines, -377 removed lines patch added patch discarded remove patch
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
  * 	\file       htdocs/comm/propal/class/propal.class.php
37 37
  * 	\brief      File of class to manage proposals
38 38
  */
39
-require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
40
-require_once DOL_DOCUMENT_ROOT . "/core/class/commonobjectline.class.php";
41
-require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
42
-require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
43
-require_once DOL_DOCUMENT_ROOT . '/margin/lib/margins.lib.php';
44
-require_once DOL_DOCUMENT_ROOT . '/multicurrency/class/multicurrency.class.php';
39
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
40
+require_once DOL_DOCUMENT_ROOT."/core/class/commonobjectline.class.php";
41
+require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
42
+require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
43
+require_once DOL_DOCUMENT_ROOT.'/margin/lib/margins.lib.php';
44
+require_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php';
45 45
 
46 46
 /**
47 47
  * 	Class to manage proposals
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
     /**
228 228
      * Billed or processed quote
229 229
      */
230
-    const STATUS_BILLED = 4;   // Todo rename into STATUS_CLOSE
230
+    const STATUS_BILLED = 4; // Todo rename into STATUS_CLOSE
231 231
 
232 232
 
233 233
     /**
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
         if (!$qty)
273 273
             $qty = 1;
274 274
 
275
-        dol_syslog(get_class($this) . "::add_product $idproduct, $qty, $remise_percent");
275
+        dol_syslog(get_class($this)."::add_product $idproduct, $qty, $remise_percent");
276 276
         if ($idproduct > 0) {
277 277
             $prod = new Product($this->db);
278 278
             $prod->fetch($idproduct);
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
             $tva_npr = get_default_npr($mysoc, $this->thirdparty, $prod->id);
284 284
             if (empty($tva_tx))
285 285
                 $tva_npr = 0;
286
-            $vat_src_code = '';     // May be defined into tva_tx
286
+            $vat_src_code = ''; // May be defined into tva_tx
287 287
 
288 288
             $localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $this->thirdparty, $tva_npr);
289 289
             $localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $this->thirdparty, $tva_npr);
@@ -324,8 +324,8 @@  discard block
 block discarded – undo
324 324
         // phpcs:enable
325 325
         global $langs;
326 326
 
327
-        include_once DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php';
328
-        include_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php';
327
+        include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
328
+        include_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
329 329
 
330 330
         $this->db->begin();
331 331
 
@@ -345,11 +345,11 @@  discard block
 block discarded – undo
345 345
 
346 346
             $line->fk_propal = $this->id;
347 347
             $line->fk_remise_except = $remise->id;
348
-            $line->desc = $remise->description;    // Description ligne
348
+            $line->desc = $remise->description; // Description ligne
349 349
             $line->vat_src_code = $remise->vat_src_code;
350 350
             $line->tva_tx = $remise->tva_tx;
351 351
             $line->subprice = -$remise->amount_ht;
352
-            $line->fk_product = 0;     // Id produit predefined
352
+            $line->fk_product = 0; // Id produit predefined
353 353
             $line->qty = 1;
354 354
             $line->remise = 0;
355 355
             $line->remise_percent = 0;
@@ -424,9 +424,9 @@  discard block
 block discarded – undo
424 424
     {
425 425
         global $mysoc, $conf, $langs;
426 426
 
427
-        dol_syslog(get_class($this) . "::addline propalid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_except=$remise_percent, price_base_type=$price_base_type, pu_ttc=$pu_ttc, info_bits=$info_bits, type=$type, fk_remise_except=" . $fk_remise_except);
427
+        dol_syslog(get_class($this)."::addline propalid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_except=$remise_percent, price_base_type=$price_base_type, pu_ttc=$pu_ttc, info_bits=$info_bits, type=$type, fk_remise_except=".$fk_remise_except);
428 428
         if ($this->statut == self::STATUS_DRAFT) {
429
-            include_once DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php';
429
+            include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
430 430
 
431 431
             // Clean parameters
432 432
             if (empty($remise_percent))
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
             $pu_ht_devise = price2num($pu_ht_devise);
447 447
             $pu_ttc = price2num($pu_ttc);
448 448
             if (!preg_match('/\((.*)\)/', $txtva)) {
449
-                $txtva = price2num($txtva);               // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1'
449
+                $txtva = price2num($txtva); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1'
450 450
             }
451 451
             $txlocaltax1 = price2num($txlocaltax1);
452 452
             $txlocaltax2 = price2num($txlocaltax2);
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
             $vat_src_code = '';
489 489
             if (preg_match('/\((.*)\)/', $txtva, $reg)) {
490 490
                 $vat_src_code = $reg[1];
491
-                $txtva = preg_replace('/\s*\(.*\)/', '', $txtva);    // Remove code into vatrate.
491
+                $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
492 492
             }
493 493
 
494 494
             $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise);
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
                 return -2;
608 608
             }
609 609
         } else {
610
-            dol_syslog(get_class($this) . "::addline status of order must be Draft to allow use of ->addline()", LOG_ERR);
610
+            dol_syslog(get_class($this)."::addline status of order must be Draft to allow use of ->addline()", LOG_ERR);
611 611
             return -3;
612 612
         }
613 613
     }
@@ -644,9 +644,9 @@  discard block
 block discarded – undo
644 644
     {
645 645
         global $mysoc;
646 646
 
647
-        dol_syslog(get_class($this) . "::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise_percent=$remise_percent,
647
+        dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise_percent=$remise_percent,
648 648
         txtva=$txtva, desc=$desc, price_base_type=$price_base_type, info_bits=$info_bits, special_code=$special_code, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, type=$type, date_start=$date_start, date_end=$date_end");
649
-        include_once DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php';
649
+        include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
650 650
 
651 651
         // Clean parameters
652 652
         $remise_percent = price2num($remise_percent);
@@ -658,9 +658,9 @@  discard block
 block discarded – undo
658 658
         $txlocaltax2 = price2num($txlocaltax2);
659 659
         $pa_ht = price2num($pa_ht);
660 660
         if (empty($qty) && empty($special_code))
661
-            $special_code = 3;    // Set option tag
661
+            $special_code = 3; // Set option tag
662 662
         if (!empty($qty) && $special_code == 3)
663
-            $special_code = 0;    // Remove option tag
663
+            $special_code = 0; // Remove option tag
664 664
         if (empty($type))
665 665
             $type = 0;
666 666
 
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
             $vat_src_code = '';
679 679
             if (preg_match('/\((.*)\)/', $txtva, $reg)) {
680 680
                 $vat_src_code = $reg[1];
681
-                $txtva = preg_replace('/\s*\(.*\)/', '', $txtva);    // Remove code into vatrate.
681
+                $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
682 682
             }
683 683
 
684 684
             $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise);
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
                 return -1;
789 789
             }
790 790
         } else {
791
-            dol_syslog(get_class($this) . "::updateline Erreur -2 Propal en mode incompatible pour cette action");
791
+            dol_syslog(get_class($this)."::updateline Erreur -2 Propal en mode incompatible pour cette action");
792 792
             return -2;
793 793
         }
794 794
     }
@@ -863,13 +863,13 @@  discard block
 block discarded – undo
863 863
             $this->multicurrency_tx = 1;
864 864
         }
865 865
 
866
-        dol_syslog(get_class($this) . "::create");
866
+        dol_syslog(get_class($this)."::create");
867 867
 
868 868
         // Check parameters
869 869
         $result = $this->fetch_thirdparty();
870 870
         if ($result < 0) {
871 871
             $this->error = "Failed to fetch company";
872
-            dol_syslog(get_class($this) . "::create " . $this->error, LOG_ERR);
872
+            dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
873 873
             return -3;
874 874
         }
875 875
 
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
             $result = self::isExistingObject($this->element, 0, $this->ref); // Check ref is not yet used
879 879
             if ($result > 0) {
880 880
                 $this->error = 'ErrorRefAlreadyExists';
881
-                dol_syslog(get_class($this) . "::create " . $this->error, LOG_WARNING);
881
+                dol_syslog(get_class($this)."::create ".$this->error, LOG_WARNING);
882 882
                 $this->db->rollback();
883 883
                 return -1;
884 884
             }
@@ -886,7 +886,7 @@  discard block
 block discarded – undo
886 886
 
887 887
         if (empty($this->date)) {
888 888
             $this->error = "Date of proposal is required";
889
-            dol_syslog(get_class($this) . "::create " . $this->error, LOG_ERR);
889
+            dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
890 890
             return -4;
891 891
         }
892 892
 
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
         $this->db->begin();
895 895
 
896 896
         // Insert into database
897
-        $sql = "INSERT INTO " . MAIN_DB_PREFIX . "propal (";
897
+        $sql = "INSERT INTO ".MAIN_DB_PREFIX."propal (";
898 898
         $sql .= "fk_soc";
899 899
         $sql .= ", price";
900 900
         $sql .= ", remise";
@@ -929,46 +929,46 @@  discard block
 block discarded – undo
929 929
         $sql .= " VALUES (";
930 930
         $sql .= $this->socid;
931 931
         $sql .= ", 0";
932
-        $sql .= ", " . $this->remise;
933
-        $sql .= ", " . ($this->remise_percent ? $this->db->escape($this->remise_percent) : 'NULL');
934
-        $sql .= ", " . ($this->remise_absolue ? $this->db->escape($this->remise_absolue) : 'NULL');
932
+        $sql .= ", ".$this->remise;
933
+        $sql .= ", ".($this->remise_percent ? $this->db->escape($this->remise_percent) : 'NULL');
934
+        $sql .= ", ".($this->remise_absolue ? $this->db->escape($this->remise_absolue) : 'NULL');
935 935
         $sql .= ", 0";
936 936
         $sql .= ", 0";
937
-        $sql .= ", '" . $this->db->idate($this->date) . "'";
938
-        $sql .= ", '" . $this->db->idate($now) . "'";
937
+        $sql .= ", '".$this->db->idate($this->date)."'";
938
+        $sql .= ", '".$this->db->idate($now)."'";
939 939
         $sql .= ", '(PROV)'";
940
-        $sql .= ", " . ($user->id > 0 ? "'" . $user->id . "'" : "NULL");
941
-        $sql .= ", '" . $this->db->escape($this->note_private) . "'";
942
-        $sql .= ", '" . $this->db->escape($this->note_public) . "'";
943
-        $sql .= ", '" . $this->db->escape($this->modelpdf) . "'";
944
-        $sql .= ", " . ($this->fin_validite != '' ? "'" . $this->db->idate($this->fin_validite) . "'" : "NULL");
945
-        $sql .= ", " . ($this->cond_reglement_id > 0 ? $this->cond_reglement_id : 'NULL');
946
-        $sql .= ", " . ($this->mode_reglement_id > 0 ? $this->mode_reglement_id : 'NULL');
947
-        $sql .= ", " . ($this->fk_account > 0 ? $this->fk_account : 'NULL');
948
-        $sql .= ", '" . $this->db->escape($this->ref_client) . "'";
949
-        $sql .= ", " . ($this->date_livraison != '' ? "'" . $this->db->idate($this->date_livraison) . "'" : "NULL");
950
-        $sql .= ", " . ($this->shipping_method_id > 0 ? $this->shipping_method_id : 'NULL');
951
-        $sql .= ", " . $this->availability_id;
952
-        $sql .= ", " . $this->demand_reason_id;
953
-        $sql .= ", " . ($this->fk_project ? $this->fk_project : "null");
954
-        $sql .= ", " . (int) $this->fk_incoterms;
955
-        $sql .= ", '" . $this->db->escape($this->location_incoterms) . "'";
956
-        $sql .= ", " . $this->entity;
957
-        $sql .= ", " . (int) $this->fk_multicurrency;
958
-        $sql .= ", '" . $this->db->escape($this->multicurrency_code) . "'";
959
-        $sql .= ", " . (double) $this->multicurrency_tx;
940
+        $sql .= ", ".($user->id > 0 ? "'".$user->id."'" : "NULL");
941
+        $sql .= ", '".$this->db->escape($this->note_private)."'";
942
+        $sql .= ", '".$this->db->escape($this->note_public)."'";
943
+        $sql .= ", '".$this->db->escape($this->modelpdf)."'";
944
+        $sql .= ", ".($this->fin_validite != '' ? "'".$this->db->idate($this->fin_validite)."'" : "NULL");
945
+        $sql .= ", ".($this->cond_reglement_id > 0 ? $this->cond_reglement_id : 'NULL');
946
+        $sql .= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : 'NULL');
947
+        $sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL');
948
+        $sql .= ", '".$this->db->escape($this->ref_client)."'";
949
+        $sql .= ", ".($this->date_livraison != '' ? "'".$this->db->idate($this->date_livraison)."'" : "NULL");
950
+        $sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : 'NULL');
951
+        $sql .= ", ".$this->availability_id;
952
+        $sql .= ", ".$this->demand_reason_id;
953
+        $sql .= ", ".($this->fk_project ? $this->fk_project : "null");
954
+        $sql .= ", ".(int) $this->fk_incoterms;
955
+        $sql .= ", '".$this->db->escape($this->location_incoterms)."'";
956
+        $sql .= ", ".$this->entity;
957
+        $sql .= ", ".(int) $this->fk_multicurrency;
958
+        $sql .= ", '".$this->db->escape($this->multicurrency_code)."'";
959
+        $sql .= ", ".(double) $this->multicurrency_tx;
960 960
         $sql .= ")";
961 961
 
962
-        dol_syslog(get_class($this) . "::create", LOG_DEBUG);
962
+        dol_syslog(get_class($this)."::create", LOG_DEBUG);
963 963
         $resql = $this->db->query($sql);
964 964
         if ($resql) {
965
-            $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "propal");
965
+            $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."propal");
966 966
 
967 967
             if ($this->id) {
968
-                $this->ref = '(PROV' . $this->id . ')';
969
-                $sql = 'UPDATE ' . MAIN_DB_PREFIX . "propal SET ref='" . $this->db->escape($this->ref) . "' WHERE rowid=" . $this->id;
968
+                $this->ref = '(PROV'.$this->id.')';
969
+                $sql = 'UPDATE '.MAIN_DB_PREFIX."propal SET ref='".$this->db->escape($this->ref)."' WHERE rowid=".$this->id;
970 970
 
971
-                dol_syslog(get_class($this) . "::create", LOG_DEBUG);
971
+                dol_syslog(get_class($this)."::create", LOG_DEBUG);
972 972
                 $resql = $this->db->query($sql);
973 973
                 if (!$resql)
974 974
                     $error++;
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
                         // Complete vat rate with code
1029 1029
                         $vatrate = $line->tva_tx;
1030 1030
                         if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate))
1031
-                            $vatrate .= ' (' . $line->vat_src_code . ')';
1031
+                            $vatrate .= ' ('.$line->vat_src_code.')';
1032 1032
 
1033 1033
                         $result = $this->addline(
1034 1034
                             $line->desc, $line->subprice, $line->qty, $vatrate, $line->localtax1_tx, $line->localtax2_tx, $line->fk_product, $line->remise_percent, 'HT', 0, $line->info_bits, $line->product_type, $line->rang, $line->special_code, $fk_parent_line, $line->fk_fournprice, $line->pa_ht, $line->label, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $this->element, $line->id
@@ -1049,10 +1049,10 @@  discard block
 block discarded – undo
1049 1049
 
1050 1050
                 // Set delivery address
1051 1051
                 if (!$error && $this->fk_delivery_address) {
1052
-                    $sql = "UPDATE " . MAIN_DB_PREFIX . "propal";
1053
-                    $sql .= " SET fk_delivery_address = " . $this->fk_delivery_address;
1054
-                    $sql .= " WHERE ref = '" . $this->db->escape($this->ref) . "'";
1055
-                    $sql .= " AND entity = " . $conf->entity;
1052
+                    $sql = "UPDATE ".MAIN_DB_PREFIX."propal";
1053
+                    $sql .= " SET fk_delivery_address = ".$this->fk_delivery_address;
1054
+                    $sql .= " WHERE ref = '".$this->db->escape($this->ref)."'";
1055
+                    $sql .= " AND entity = ".$conf->entity;
1056 1056
 
1057 1057
                     $result = $this->db->query($sql);
1058 1058
                 }
@@ -1093,7 +1093,7 @@  discard block
 block discarded – undo
1093 1093
 
1094 1094
             if (!$error) {
1095 1095
                 $this->db->commit();
1096
-                dol_syslog(get_class($this) . "::create done id=" . $this->id);
1096
+                dol_syslog(get_class($this)."::create done id=".$this->id);
1097 1097
                 return $this->id;
1098 1098
             } else {
1099 1099
                 $this->db->rollback();
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
                   $clonedObj->fk_project = '';
1170 1170
                   }
1171 1171
                   } */
1172
-                $clonedObj->fk_project = '';    // A cloned proposal is set by default to no project.
1172
+                $clonedObj->fk_project = ''; // A cloned proposal is set by default to no project.
1173 1173
             }
1174 1174
 
1175 1175
             // reset ref_client
@@ -1188,7 +1188,7 @@  discard block
 block discarded – undo
1188 1188
         $clonedObj->user_author = $user->id;
1189 1189
         $clonedObj->user_valid = '';
1190 1190
         $clonedObj->date = $now;
1191
-        $clonedObj->datep = $now;    // deprecated
1191
+        $clonedObj->datep = $now; // deprecated
1192 1192
         $clonedObj->fin_validite = $clonedObj->date + ($clonedObj->duree_validite * 24 * 3600);
1193 1193
         if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING))
1194 1194
             $clonedObj->ref_client = '';
@@ -1214,7 +1214,7 @@  discard block
 block discarded – undo
1214 1214
             if (is_object($hookmanager)) {
1215 1215
                 $parameters = array('objFrom' => $this, 'clonedObj' => $clonedObj);
1216 1216
                 $action = '';
1217
-                $reshook = $hookmanager->executeHooks('createFrom', $parameters, $clonedObj, $action);    // Note that $action and $object may have been modified by some hooks
1217
+                $reshook = $hookmanager->executeHooks('createFrom', $parameters, $clonedObj, $action); // Note that $action and $object may have been modified by some hooks
1218 1218
                 if ($reshook < 0)
1219 1219
                     $error++;
1220 1220
             }
@@ -1269,21 +1269,21 @@  discard block
 block discarded – undo
1269 1269
         $sql .= ", dr.code as demand_reason_code, dr.label as demand_reason";
1270 1270
         $sql .= ", cr.code as cond_reglement_code, cr.libelle as cond_reglement, cr.libelle_facture as cond_reglement_libelle_doc";
1271 1271
         $sql .= ", cp.code as mode_reglement_code, cp.libelle as mode_reglement";
1272
-        $sql .= " FROM " . MAIN_DB_PREFIX . "propal as p";
1273
-        $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_propalst as c ON p.fk_statut = c.id';
1274
-        $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_paiement as cp ON p.fk_mode_reglement = cp.id AND cp.entity IN (' . getEntity('c_paiement') . ')';
1275
-        $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_payment_term as cr ON p.fk_cond_reglement = cr.rowid AND cr.entity IN (' . getEntity('c_payment_term') . ')';
1276
-        $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_availability as ca ON p.fk_availability = ca.rowid';
1277
-        $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_input_reason as dr ON p.fk_input_reason = dr.rowid';
1278
-        $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_incoterms as i ON p.fk_incoterms = i.rowid';
1272
+        $sql .= " FROM ".MAIN_DB_PREFIX."propal as p";
1273
+        $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_propalst as c ON p.fk_statut = c.id';
1274
+        $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_mode_reglement = cp.id AND cp.entity IN ('.getEntity('c_paiement').')';
1275
+        $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON p.fk_cond_reglement = cr.rowid AND cr.entity IN ('.getEntity('c_payment_term').')';
1276
+        $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON p.fk_availability = ca.rowid';
1277
+        $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON p.fk_input_reason = dr.rowid';
1278
+        $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON p.fk_incoterms = i.rowid';
1279 1279
 
1280 1280
         if ($ref) {
1281
-            $sql .= " WHERE p.entity IN (" . getEntity('propal') . ")"; // Dont't use entity if you use rowid
1282
-            $sql .= " AND p.ref='" . $this->db->escape($ref) . "'";
1281
+            $sql .= " WHERE p.entity IN (".getEntity('propal').")"; // Dont't use entity if you use rowid
1282
+            $sql .= " AND p.ref='".$this->db->escape($ref)."'";
1283 1283
         } else
1284
-            $sql .= " WHERE p.rowid=" . $rowid;
1284
+            $sql .= " WHERE p.rowid=".$rowid;
1285 1285
 
1286
-        dol_syslog(get_class($this) . "::fetch", LOG_DEBUG);
1286
+        dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
1287 1287
         $resql = $this->db->query($sql);
1288 1288
         if ($resql) {
1289 1289
             if ($this->db->num_rows($resql)) {
@@ -1319,7 +1319,7 @@  discard block
 block discarded – undo
1319 1319
                 $this->date_validation = $this->db->jdate($obj->datev); //Validation date
1320 1320
                 $this->date_modification = $this->db->jdate($obj->date_modification); // tms
1321 1321
                 $this->date = $this->db->jdate($obj->dp); // Proposal date
1322
-                $this->datep = $this->db->jdate($obj->dp);    // deprecated
1322
+                $this->datep = $this->db->jdate($obj->dp); // deprecated
1323 1323
                 $this->fin_validite = $this->db->jdate($obj->dfv);
1324 1324
                 $this->date_livraison = $this->db->jdate($obj->date_livraison);
1325 1325
                 $this->shipping_method_id = ($obj->fk_shipping_method > 0) ? $obj->fk_shipping_method : null;
@@ -1420,39 +1420,39 @@  discard block
 block discarded – undo
1420 1420
         // Check parameters
1421 1421
         // Put here code to add control on parameters values
1422 1422
         // Update request
1423
-        $sql = "UPDATE " . MAIN_DB_PREFIX . "propal SET";
1424
-
1425
-        $sql .= " ref=" . (isset($this->ref) ? "'" . $this->db->escape($this->ref) . "'" : "null") . ",";
1426
-        $sql .= " ref_client=" . (isset($this->ref_client) ? "'" . $this->db->escape($this->ref_client) . "'" : "null") . ",";
1427
-        $sql .= " ref_ext=" . (isset($this->ref_ext) ? "'" . $this->db->escape($this->ref_ext) . "'" : "null") . ",";
1428
-        $sql .= " fk_soc=" . (isset($this->socid) ? $this->socid : "null") . ",";
1429
-        $sql .= " datep=" . (strval($this->datep) != '' ? "'" . $this->db->idate($this->datep) . "'" : 'null') . ",";
1430
-        $sql .= " date_valid=" . (strval($this->date_validation) != '' ? "'" . $this->db->idate($this->date_validation) . "'" : 'null') . ",";
1431
-        $sql .= " tva=" . (isset($this->total_tva) ? $this->total_tva : "null") . ",";
1432
-        $sql .= " localtax1=" . (isset($this->total_localtax1) ? $this->total_localtax1 : "null") . ",";
1433
-        $sql .= " localtax2=" . (isset($this->total_localtax2) ? $this->total_localtax2 : "null") . ",";
1434
-        $sql .= " total_ht=" . (isset($this->total_ht) ? $this->total_ht : "null") . ",";
1435
-        $sql .= " total=" . (isset($this->total_ttc) ? $this->total_ttc : "null") . ",";
1436
-        $sql .= " fk_statut=" . (isset($this->statut) ? $this->statut : "null") . ",";
1437
-        $sql .= " fk_user_author=" . (isset($this->user_author_id) ? $this->user_author_id : "null") . ",";
1438
-        $sql .= " fk_user_valid=" . (isset($this->user_valid) ? $this->user_valid : "null") . ",";
1439
-        $sql .= " fk_projet=" . (isset($this->fk_project) ? $this->fk_project : "null") . ",";
1440
-        $sql .= " fk_cond_reglement=" . (isset($this->cond_reglement_id) ? $this->cond_reglement_id : "null") . ",";
1441
-        $sql .= " fk_mode_reglement=" . (isset($this->mode_reglement_id) ? $this->mode_reglement_id : "null") . ",";
1442
-        $sql .= " note_private=" . (isset($this->note_private) ? "'" . $this->db->escape($this->note_private) . "'" : "null") . ",";
1443
-        $sql .= " note_public=" . (isset($this->note_public) ? "'" . $this->db->escape($this->note_public) . "'" : "null") . ",";
1444
-        $sql .= " model_pdf=" . (isset($this->modelpdf) ? "'" . $this->db->escape($this->modelpdf) . "'" : "null") . ",";
1445
-        $sql .= " import_key=" . (isset($this->import_key) ? "'" . $this->db->escape($this->import_key) . "'" : "null") . "";
1446
-
1447
-        $sql .= " WHERE rowid=" . $this->id;
1423
+        $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET";
1424
+
1425
+        $sql .= " ref=".(isset($this->ref) ? "'".$this->db->escape($this->ref)."'" : "null").",";
1426
+        $sql .= " ref_client=".(isset($this->ref_client) ? "'".$this->db->escape($this->ref_client)."'" : "null").",";
1427
+        $sql .= " ref_ext=".(isset($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null").",";
1428
+        $sql .= " fk_soc=".(isset($this->socid) ? $this->socid : "null").",";
1429
+        $sql .= " datep=".(strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : 'null').",";
1430
+        $sql .= " date_valid=".(strval($this->date_validation) != '' ? "'".$this->db->idate($this->date_validation)."'" : 'null').",";
1431
+        $sql .= " tva=".(isset($this->total_tva) ? $this->total_tva : "null").",";
1432
+        $sql .= " localtax1=".(isset($this->total_localtax1) ? $this->total_localtax1 : "null").",";
1433
+        $sql .= " localtax2=".(isset($this->total_localtax2) ? $this->total_localtax2 : "null").",";
1434
+        $sql .= " total_ht=".(isset($this->total_ht) ? $this->total_ht : "null").",";
1435
+        $sql .= " total=".(isset($this->total_ttc) ? $this->total_ttc : "null").",";
1436
+        $sql .= " fk_statut=".(isset($this->statut) ? $this->statut : "null").",";
1437
+        $sql .= " fk_user_author=".(isset($this->user_author_id) ? $this->user_author_id : "null").",";
1438
+        $sql .= " fk_user_valid=".(isset($this->user_valid) ? $this->user_valid : "null").",";
1439
+        $sql .= " fk_projet=".(isset($this->fk_project) ? $this->fk_project : "null").",";
1440
+        $sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? $this->cond_reglement_id : "null").",";
1441
+        $sql .= " fk_mode_reglement=".(isset($this->mode_reglement_id) ? $this->mode_reglement_id : "null").",";
1442
+        $sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").",";
1443
+        $sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").",";
1444
+        $sql .= " model_pdf=".(isset($this->modelpdf) ? "'".$this->db->escape($this->modelpdf)."'" : "null").",";
1445
+        $sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null")."";
1446
+
1447
+        $sql .= " WHERE rowid=".$this->id;
1448 1448
 
1449 1449
         $this->db->begin();
1450 1450
 
1451
-        dol_syslog(get_class($this) . "::update", LOG_DEBUG);
1451
+        dol_syslog(get_class($this)."::update", LOG_DEBUG);
1452 1452
         $resql = $this->db->query($sql);
1453 1453
         if (!$resql) {
1454 1454
             $error++;
1455
-            $this->errors[] = "Error " . $this->db->lasterror();
1455
+            $this->errors[] = "Error ".$this->db->lasterror();
1456 1456
         }
1457 1457
 
1458 1458
         if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0) {
@@ -1473,8 +1473,8 @@  discard block
 block discarded – undo
1473 1473
         // Commit or rollback
1474 1474
         if ($error) {
1475 1475
             foreach ($this->errors as $errmsg) {
1476
-                dol_syslog(get_class($this) . "::update " . $errmsg, LOG_ERR);
1477
-                $this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
1476
+                dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
1477
+                $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
1478 1478
             }
1479 1479
             $this->db->rollback();
1480 1480
             return -1 * $error;
@@ -1503,17 +1503,17 @@  discard block
 block discarded – undo
1503 1503
         $sql .= ' p.weight, p.weight_units, p.volume, p.volume_units,';
1504 1504
         $sql .= ' d.date_start, d.date_end,';
1505 1505
         $sql .= ' d.fk_multicurrency, d.multicurrency_code, d.multicurrency_subprice, d.multicurrency_total_ht, d.multicurrency_total_tva, d.multicurrency_total_ttc';
1506
-        $sql .= ' FROM ' . MAIN_DB_PREFIX . 'propaldet as d';
1507
-        $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product as p ON (d.fk_product = p.rowid)';
1508
-        $sql .= ' WHERE d.fk_propal = ' . $this->id;
1506
+        $sql .= ' FROM '.MAIN_DB_PREFIX.'propaldet as d';
1507
+        $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (d.fk_product = p.rowid)';
1508
+        $sql .= ' WHERE d.fk_propal = '.$this->id;
1509 1509
         if ($only_product)
1510 1510
             $sql .= ' AND p.fk_product_type = 0';
1511 1511
         $sql .= ' ORDER by d.rang';
1512 1512
 
1513
-        dol_syslog(get_class($this) . "::fetch_lines", LOG_DEBUG);
1513
+        dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG);
1514 1514
         $result = $this->db->query($sql);
1515 1515
         if ($result) {
1516
-            require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
1516
+            require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
1517 1517
 
1518 1518
             $num = $this->db->num_rows($result);
1519 1519
 
@@ -1529,8 +1529,8 @@  discard block
 block discarded – undo
1529 1529
                 $line->fk_parent_line = $objp->fk_parent_line;
1530 1530
                 $line->product_type = $objp->product_type;
1531 1531
                 $line->label = $objp->custom_label;
1532
-                $line->desc = $objp->description;  // Description ligne
1533
-                $line->description = $objp->description;  // Description ligne
1532
+                $line->desc = $objp->description; // Description ligne
1533
+                $line->description = $objp->description; // Description ligne
1534 1534
                 $line->qty = $objp->qty;
1535 1535
                 $line->vat_src_code = $objp->vat_src_code;
1536 1536
                 $line->tva_tx = $objp->tva_tx;
@@ -1541,7 +1541,7 @@  discard block
 block discarded – undo
1541 1541
                 $line->subprice = $objp->subprice;
1542 1542
                 $line->fk_remise_except = $objp->fk_remise_except;
1543 1543
                 $line->remise_percent = $objp->remise_percent;
1544
-                $line->price = $objp->price;  // TODO deprecated
1544
+                $line->price = $objp->price; // TODO deprecated
1545 1545
 
1546 1546
                 $line->info_bits = $objp->info_bits;
1547 1547
                 $line->total_ht = $objp->total_ht;
@@ -1559,11 +1559,11 @@  discard block
 block discarded – undo
1559 1559
 
1560 1560
                 $line->fk_product = $objp->fk_product;
1561 1561
 
1562
-                $line->ref = $objp->product_ref;  // TODO deprecated
1562
+                $line->ref = $objp->product_ref; // TODO deprecated
1563 1563
                 $line->product_ref = $objp->product_ref;
1564
-                $line->libelle = $objp->product_label;  // TODO deprecated
1564
+                $line->libelle = $objp->product_label; // TODO deprecated
1565 1565
                 $line->product_label = $objp->product_label;
1566
-                $line->product_desc = $objp->product_desc;   // Description produit
1566
+                $line->product_desc = $objp->product_desc; // Description produit
1567 1567
                 $line->product_tobatch = $objp->product_tobatch;
1568 1568
                 $line->fk_product_type = $objp->fk_product_type; // TODO deprecated
1569 1569
                 $line->fk_unit = $objp->fk_unit;
@@ -1609,7 +1609,7 @@  discard block
 block discarded – undo
1609 1609
      */
1610 1610
     function valid($user, $notrigger = 0)
1611 1611
     {
1612
-        require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
1612
+        require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
1613 1613
 
1614 1614
         global $conf;
1615 1615
 
@@ -1617,13 +1617,13 @@  discard block
 block discarded – undo
1617 1617
 
1618 1618
         // Protection
1619 1619
         if ($this->statut == self::STATUS_VALIDATED) {
1620
-            dol_syslog(get_class($this) . "::valid action abandonned: already validated", LOG_WARNING);
1620
+            dol_syslog(get_class($this)."::valid action abandonned: already validated", LOG_WARNING);
1621 1621
             return 0;
1622 1622
         }
1623 1623
 
1624 1624
         if (!((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->validate)))) {
1625 1625
             $this->error = 'ErrorPermissionDenied';
1626
-            dol_syslog(get_class($this) . "::valid " . $this->error, LOG_ERR);
1626
+            dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR);
1627 1627
             return -1;
1628 1628
         }
1629 1629
 
@@ -1643,12 +1643,12 @@  discard block
 block discarded – undo
1643 1643
         }
1644 1644
         $this->newref = $num;
1645 1645
 
1646
-        $sql = "UPDATE " . MAIN_DB_PREFIX . "propal";
1647
-        $sql .= " SET ref = '" . $num . "',";
1648
-        $sql .= " fk_statut = " . self::STATUS_VALIDATED . ", date_valid='" . $this->db->idate($now) . "', fk_user_valid=" . $user->id;
1649
-        $sql .= " WHERE rowid = " . $this->id . " AND fk_statut = " . self::STATUS_DRAFT;
1646
+        $sql = "UPDATE ".MAIN_DB_PREFIX."propal";
1647
+        $sql .= " SET ref = '".$num."',";
1648
+        $sql .= " fk_statut = ".self::STATUS_VALIDATED.", date_valid='".$this->db->idate($now)."', fk_user_valid=".$user->id;
1649
+        $sql .= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
1650 1650
 
1651
-        dol_syslog(get_class($this) . "::valid", LOG_DEBUG);
1651
+        dol_syslog(get_class($this)."::valid", LOG_DEBUG);
1652 1652
         $resql = $this->db->query($sql);
1653 1653
         if (!$resql) {
1654 1654
             dol_print_error($this->db);
@@ -1674,20 +1674,20 @@  discard block
 block discarded – undo
1674 1674
                 // to  not lose the linked files
1675 1675
                 $oldref = dol_sanitizeFileName($this->ref);
1676 1676
                 $newref = dol_sanitizeFileName($num);
1677
-                $dirsource = $conf->propal->multidir_output[$this->entity] . '/' . $oldref;
1678
-                $dirdest = $conf->propal->multidir_output[$this->entity] . '/' . $newref;
1677
+                $dirsource = $conf->propal->multidir_output[$this->entity].'/'.$oldref;
1678
+                $dirdest = $conf->propal->multidir_output[$this->entity].'/'.$newref;
1679 1679
 
1680 1680
                 if (file_exists($dirsource)) {
1681
-                    dol_syslog(get_class($this) . "::validate rename dir " . $dirsource . " into " . $dirdest);
1681
+                    dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest);
1682 1682
                     if (@rename($dirsource, $dirdest)) {
1683 1683
                         dol_syslog("Rename ok");
1684 1684
                         // Rename docs starting with $oldref with $newref
1685
-                        $listoffiles = dol_dir_list($dirdest, 'files', 1, '^' . preg_quote($oldref, '/'));
1685
+                        $listoffiles = dol_dir_list($dirdest, 'files', 1, '^'.preg_quote($oldref, '/'));
1686 1686
                         foreach ($listoffiles as $fileentry) {
1687 1687
                             $dirsource = $fileentry['name'];
1688
-                            $dirdest = preg_replace('/^' . preg_quote($oldref, '/') . '/', $newref, $dirsource);
1689
-                            $dirsource = $fileentry['path'] . '/' . $dirsource;
1690
-                            $dirdest = $fileentry['path'] . '/' . $dirdest;
1688
+                            $dirdest = preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource);
1689
+                            $dirsource = $fileentry['path'].'/'.$dirsource;
1690
+                            $dirdest = $fileentry['path'].'/'.$dirdest;
1691 1691
                             @rename($dirsource, $dirdest);
1692 1692
                         }
1693 1693
                     }
@@ -1722,7 +1722,7 @@  discard block
 block discarded – undo
1722 1722
         // phpcs:enable
1723 1723
         if (empty($date)) {
1724 1724
             $this->error = 'ErrorBadParameter';
1725
-            dol_syslog(get_class($this) . "::set_date " . $this->error, LOG_ERR);
1725
+            dol_syslog(get_class($this)."::set_date ".$this->error, LOG_ERR);
1726 1726
             return -1;
1727 1727
         }
1728 1728
 
@@ -1731,8 +1731,8 @@  discard block
 block discarded – undo
1731 1731
 
1732 1732
             $this->db->begin();
1733 1733
 
1734
-            $sql = "UPDATE " . MAIN_DB_PREFIX . "propal SET datep = '" . $this->db->idate($date) . "'";
1735
-            $sql .= " WHERE rowid = " . $this->id . " AND fk_statut = " . self::STATUS_DRAFT;
1734
+            $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET datep = '".$this->db->idate($date)."'";
1735
+            $sql .= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
1736 1736
 
1737 1737
             dol_syslog(__METHOD__, LOG_DEBUG);
1738 1738
             $resql = $this->db->query($sql);
@@ -1744,7 +1744,7 @@  discard block
 block discarded – undo
1744 1744
             if (!$error) {
1745 1745
                 $this->oldcopy = clone $this;
1746 1746
                 $this->date = $date;
1747
-                $this->datep = $date;    // deprecated
1747
+                $this->datep = $date; // deprecated
1748 1748
             }
1749 1749
 
1750 1750
             if (!$notrigger && empty($error)) {
@@ -1760,8 +1760,8 @@  discard block
 block discarded – undo
1760 1760
                 return 1;
1761 1761
             } else {
1762 1762
                 foreach ($this->errors as $errmsg) {
1763
-                    dol_syslog(__METHOD__ . ' Error: ' . $errmsg, LOG_ERR);
1764
-                    $this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
1763
+                    dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
1764
+                    $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
1765 1765
                 }
1766 1766
                 $this->db->rollback();
1767 1767
                 return -1 * $error;
@@ -1786,8 +1786,8 @@  discard block
 block discarded – undo
1786 1786
 
1787 1787
             $this->db->begin();
1788 1788
 
1789
-            $sql = "UPDATE " . MAIN_DB_PREFIX . "propal SET fin_validite = " . ($date_fin_validite != '' ? "'" . $this->db->idate($date_fin_validite) . "'" : 'null');
1790
-            $sql .= " WHERE rowid = " . $this->id . " AND fk_statut = " . self::STATUS_DRAFT;
1789
+            $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fin_validite = ".($date_fin_validite != '' ? "'".$this->db->idate($date_fin_validite)."'" : 'null');
1790
+            $sql .= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
1791 1791
 
1792 1792
             dol_syslog(__METHOD__, LOG_DEBUG);
1793 1793
             $resql = $this->db->query($sql);
@@ -1815,8 +1815,8 @@  discard block
 block discarded – undo
1815 1815
                 return 1;
1816 1816
             } else {
1817 1817
                 foreach ($this->errors as $errmsg) {
1818
-                    dol_syslog(__METHOD__ . ' Error: ' . $errmsg, LOG_ERR);
1819
-                    $this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
1818
+                    dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
1819
+                    $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
1820 1820
                 }
1821 1821
                 $this->db->rollback();
1822 1822
                 return -1 * $error;
@@ -1841,9 +1841,9 @@  discard block
 block discarded – undo
1841 1841
 
1842 1842
             $this->db->begin();
1843 1843
 
1844
-            $sql = "UPDATE " . MAIN_DB_PREFIX . "propal ";
1845
-            $sql .= " SET date_livraison = " . ($date_livraison != '' ? "'" . $this->db->idate($date_livraison) . "'" : 'null');
1846
-            $sql .= " WHERE rowid = " . $this->id;
1844
+            $sql = "UPDATE ".MAIN_DB_PREFIX."propal ";
1845
+            $sql .= " SET date_livraison = ".($date_livraison != '' ? "'".$this->db->idate($date_livraison)."'" : 'null');
1846
+            $sql .= " WHERE rowid = ".$this->id;
1847 1847
 
1848 1848
             dol_syslog(__METHOD__, LOG_DEBUG);
1849 1849
             $resql = $this->db->query($sql);
@@ -1870,8 +1870,8 @@  discard block
 block discarded – undo
1870 1870
                 return 1;
1871 1871
             } else {
1872 1872
                 foreach ($this->errors as $errmsg) {
1873
-                    dol_syslog(__METHOD__ . ' Error: ' . $errmsg, LOG_ERR);
1874
-                    $this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
1873
+                    dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
1874
+                    $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
1875 1875
                 }
1876 1876
                 $this->db->rollback();
1877 1877
                 return -1 * $error;
@@ -1896,11 +1896,11 @@  discard block
 block discarded – undo
1896 1896
 
1897 1897
             $this->db->begin();
1898 1898
 
1899
-            $sql = "UPDATE " . MAIN_DB_PREFIX . "propal ";
1900
-            $sql .= " SET fk_availability = '" . $id . "'";
1901
-            $sql .= " WHERE rowid = " . $this->id;
1899
+            $sql = "UPDATE ".MAIN_DB_PREFIX."propal ";
1900
+            $sql .= " SET fk_availability = '".$id."'";
1901
+            $sql .= " WHERE rowid = ".$this->id;
1902 1902
 
1903
-            dol_syslog(__METHOD__ . ' availability(' . $id . ')', LOG_DEBUG);
1903
+            dol_syslog(__METHOD__.' availability('.$id.')', LOG_DEBUG);
1904 1904
             $resql = $this->db->query($sql);
1905 1905
             if (!$resql) {
1906 1906
                 $this->errors[] = $this->db->error();
@@ -1926,15 +1926,15 @@  discard block
 block discarded – undo
1926 1926
                 return 1;
1927 1927
             } else {
1928 1928
                 foreach ($this->errors as $errmsg) {
1929
-                    dol_syslog(__METHOD__ . ' Error: ' . $errmsg, LOG_ERR);
1930
-                    $this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
1929
+                    dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
1930
+                    $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
1931 1931
                 }
1932 1932
                 $this->db->rollback();
1933 1933
                 return -1 * $error;
1934 1934
             }
1935 1935
         } else {
1936
-            $error_str = 'Propal status do not meet requirement ' . $this->statut;
1937
-            dol_syslog(__METHOD__ . $error_str, LOG_ERR);
1936
+            $error_str = 'Propal status do not meet requirement '.$this->statut;
1937
+            dol_syslog(__METHOD__.$error_str, LOG_ERR);
1938 1938
             $this->error = $error_str;
1939 1939
             $this->errors[] = $this->error;
1940 1940
             return -2;
@@ -1958,9 +1958,9 @@  discard block
 block discarded – undo
1958 1958
 
1959 1959
             $this->db->begin();
1960 1960
 
1961
-            $sql = "UPDATE " . MAIN_DB_PREFIX . "propal ";
1962
-            $sql .= " SET fk_input_reason = " . $id;
1963
-            $sql .= " WHERE rowid = " . $this->id;
1961
+            $sql = "UPDATE ".MAIN_DB_PREFIX."propal ";
1962
+            $sql .= " SET fk_input_reason = ".$id;
1963
+            $sql .= " WHERE rowid = ".$this->id;
1964 1964
 
1965 1965
             dol_syslog(__METHOD__, LOG_DEBUG);
1966 1966
             $resql = $this->db->query($sql);
@@ -1990,15 +1990,15 @@  discard block
 block discarded – undo
1990 1990
                 return 1;
1991 1991
             } else {
1992 1992
                 foreach ($this->errors as $errmsg) {
1993
-                    dol_syslog(__METHOD__ . ' Error: ' . $errmsg, LOG_ERR);
1994
-                    $this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
1993
+                    dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
1994
+                    $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
1995 1995
                 }
1996 1996
                 $this->db->rollback();
1997 1997
                 return -1 * $error;
1998 1998
             }
1999 1999
         } else {
2000
-            $error_str = 'Propal status do not meet requirement ' . $this->statut;
2001
-            dol_syslog(__METHOD__ . $error_str, LOG_ERR);
2000
+            $error_str = 'Propal status do not meet requirement '.$this->statut;
2001
+            dol_syslog(__METHOD__.$error_str, LOG_ERR);
2002 2002
             $this->error = $error_str;
2003 2003
             $this->errors[] = $this->error;
2004 2004
             return -2;
@@ -2022,10 +2022,10 @@  discard block
 block discarded – undo
2022 2022
 
2023 2023
             $this->db->begin();
2024 2024
 
2025
-            $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'propal SET ref_client = ' . (empty($ref_client) ? 'NULL' : '\'' . $this->db->escape($ref_client) . '\'');
2026
-            $sql .= ' WHERE rowid = ' . $this->id;
2025
+            $sql = 'UPDATE '.MAIN_DB_PREFIX.'propal SET ref_client = '.(empty($ref_client) ? 'NULL' : '\''.$this->db->escape($ref_client).'\'');
2026
+            $sql .= ' WHERE rowid = '.$this->id;
2027 2027
 
2028
-            dol_syslog(__METHOD__ . ' $this->id=' . $this->id . ', ref_client=' . $ref_client, LOG_DEBUG);
2028
+            dol_syslog(__METHOD__.' $this->id='.$this->id.', ref_client='.$ref_client, LOG_DEBUG);
2029 2029
             $resql = $this->db->query($sql);
2030 2030
             if (!$resql) {
2031 2031
                 $this->errors[] = $this->db->error();
@@ -2050,8 +2050,8 @@  discard block
 block discarded – undo
2050 2050
                 return 1;
2051 2051
             } else {
2052 2052
                 foreach ($this->errors as $errmsg) {
2053
-                    dol_syslog(__METHOD__ . ' Error: ' . $errmsg, LOG_ERR);
2054
-                    $this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
2053
+                    dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
2054
+                    $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
2055 2055
                 }
2056 2056
                 $this->db->rollback();
2057 2057
                 return -1 * $error;
@@ -2082,8 +2082,8 @@  discard block
 block discarded – undo
2082 2082
 
2083 2083
             $this->db->begin();
2084 2084
 
2085
-            $sql = "UPDATE " . MAIN_DB_PREFIX . "propal SET remise_percent = " . $remise;
2086
-            $sql .= " WHERE rowid = " . $this->id . " AND fk_statut = " . self::STATUS_DRAFT;
2085
+            $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET remise_percent = ".$remise;
2086
+            $sql .= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
2087 2087
 
2088 2088
             dol_syslog(__METHOD__, LOG_DEBUG);
2089 2089
             $resql = $this->db->query($sql);
@@ -2111,8 +2111,8 @@  discard block
 block discarded – undo
2111 2111
                 return 1;
2112 2112
             } else {
2113 2113
                 foreach ($this->errors as $errmsg) {
2114
-                    dol_syslog(__METHOD__ . ' Error: ' . $errmsg, LOG_ERR);
2115
-                    $this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
2114
+                    dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
2115
+                    $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
2116 2116
                 }
2117 2117
                 $this->db->rollback();
2118 2118
                 return -1 * $error;
@@ -2141,9 +2141,9 @@  discard block
 block discarded – undo
2141 2141
 
2142 2142
             $this->db->begin();
2143 2143
 
2144
-            $sql = "UPDATE " . MAIN_DB_PREFIX . "propal ";
2145
-            $sql .= " SET remise_absolue = " . $remise;
2146
-            $sql .= " WHERE rowid = " . $this->id . " AND fk_statut = " . self::STATUS_DRAFT;
2144
+            $sql = "UPDATE ".MAIN_DB_PREFIX."propal ";
2145
+            $sql .= " SET remise_absolue = ".$remise;
2146
+            $sql .= " WHERE rowid = ".$this->id." AND fk_statut = ".self::STATUS_DRAFT;
2147 2147
 
2148 2148
             dol_syslog(__METHOD__, LOG_DEBUG);
2149 2149
             $resql = $this->db->query($sql);
@@ -2171,8 +2171,8 @@  discard block
 block discarded – undo
2171 2171
                 return 1;
2172 2172
             } else {
2173 2173
                 foreach ($this->errors as $errmsg) {
2174
-                    dol_syslog(__METHOD__ . ' Error: ' . $errmsg, LOG_ERR);
2175
-                    $this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
2174
+                    dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
2175
+                    $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
2176 2176
                 }
2177 2177
                 $this->db->rollback();
2178 2178
                 return -1 * $error;
@@ -2195,20 +2195,20 @@  discard block
 block discarded – undo
2195 2195
         $this->statut = $statut;
2196 2196
         $error = 0;
2197 2197
 
2198
-        $sql = "UPDATE " . MAIN_DB_PREFIX . "propal";
2199
-        $sql .= " SET fk_statut = " . $this->statut . ",";
2198
+        $sql = "UPDATE ".MAIN_DB_PREFIX."propal";
2199
+        $sql .= " SET fk_statut = ".$this->statut.",";
2200 2200
         if (!empty($note))
2201
-            $sql .= " note_private = '" . $this->db->escape($note) . "',";
2201
+            $sql .= " note_private = '".$this->db->escape($note)."',";
2202 2202
         $sql .= " date_cloture=NULL, fk_user_cloture=NULL";
2203
-        $sql .= " WHERE rowid = " . $this->id;
2203
+        $sql .= " WHERE rowid = ".$this->id;
2204 2204
 
2205 2205
         $this->db->begin();
2206 2206
 
2207
-        dol_syslog(get_class($this) . "::reopen", LOG_DEBUG);
2207
+        dol_syslog(get_class($this)."::reopen", LOG_DEBUG);
2208 2208
         $resql = $this->db->query($sql);
2209 2209
         if (!$resql) {
2210 2210
             $error++;
2211
-            $this->errors[] = "Error " . $this->db->lasterror();
2211
+            $this->errors[] = "Error ".$this->db->lasterror();
2212 2212
         }
2213 2213
         if (!$error) {
2214 2214
             if (!$notrigger) {
@@ -2225,8 +2225,8 @@  discard block
 block discarded – undo
2225 2225
         if ($error) {
2226 2226
             if (!empty($this->errors)) {
2227 2227
                 foreach ($this->errors as $errmsg) {
2228
-                    dol_syslog(get_class($this) . "::update " . $errmsg, LOG_ERR);
2229
-                    $this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
2228
+                    dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
2229
+                    $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
2230 2230
                 }
2231 2231
             }
2232 2232
             $this->db->rollback();
@@ -2257,9 +2257,9 @@  discard block
 block discarded – undo
2257 2257
 
2258 2258
         $newprivatenote = dol_concatdesc($this->note_private, $note);
2259 2259
 
2260
-        $sql = "UPDATE " . MAIN_DB_PREFIX . "propal";
2261
-        $sql .= " SET fk_statut = " . $statut . ", note_private = '" . $this->db->escape($newprivatenote) . "', date_cloture='" . $this->db->idate($now) . "', fk_user_cloture=" . $user->id;
2262
-        $sql .= " WHERE rowid = " . $this->id;
2260
+        $sql = "UPDATE ".MAIN_DB_PREFIX."propal";
2261
+        $sql .= " SET fk_statut = ".$statut.", note_private = '".$this->db->escape($newprivatenote)."', date_cloture='".$this->db->idate($now)."', fk_user_cloture=".$user->id;
2262
+        $sql .= " WHERE rowid = ".$this->id;
2263 2263
 
2264 2264
         $resql = $this->db->query($sql);
2265 2265
         if ($resql) {
@@ -2344,8 +2344,8 @@  discard block
 block discarded – undo
2344 2344
 
2345 2345
         $this->db->begin();
2346 2346
 
2347
-        $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'propal SET fk_statut = ' . self::STATUS_BILLED;
2348
-        $sql .= ' WHERE rowid = ' . $this->id . ' AND fk_statut > ' . self::STATUS_DRAFT;
2347
+        $sql = 'UPDATE '.MAIN_DB_PREFIX.'propal SET fk_statut = '.self::STATUS_BILLED;
2348
+        $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT;
2349 2349
 
2350 2350
         dol_syslog(__METHOD__, LOG_DEBUG);
2351 2351
         $resql = $this->db->query($sql);
@@ -2372,8 +2372,8 @@  discard block
 block discarded – undo
2372 2372
             return 1;
2373 2373
         } else {
2374 2374
             foreach ($this->errors as $errmsg) {
2375
-                dol_syslog(__METHOD__ . ' Error: ' . $errmsg, LOG_ERR);
2376
-                $this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
2375
+                dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
2376
+                $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
2377 2377
             }
2378 2378
             $this->db->rollback();
2379 2379
             return -1 * $error;
@@ -2395,8 +2395,8 @@  discard block
 block discarded – undo
2395 2395
 
2396 2396
         $this->db->begin();
2397 2397
 
2398
-        $sql = "UPDATE " . MAIN_DB_PREFIX . "propal SET fk_statut = " . self::STATUS_DRAFT;
2399
-        $sql .= " WHERE rowid = " . $this->id;
2398
+        $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET fk_statut = ".self::STATUS_DRAFT;
2399
+        $sql .= " WHERE rowid = ".$this->id;
2400 2400
 
2401 2401
         dol_syslog(__METHOD__, LOG_DEBUG);
2402 2402
         $resql = $this->db->query($sql);
@@ -2424,8 +2424,8 @@  discard block
 block discarded – undo
2424 2424
             return 1;
2425 2425
         } else {
2426 2426
             foreach ($this->errors as $errmsg) {
2427
-                dol_syslog(__METHOD__ . ' Error: ' . $errmsg, LOG_ERR);
2428
-                $this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
2427
+                dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
2428
+                $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
2429 2429
             }
2430 2430
             $this->db->rollback();
2431 2431
             return -1 * $error;
@@ -2458,21 +2458,21 @@  discard block
 block discarded – undo
2458 2458
         $sql .= " p.datep as dp, p.fin_validite as datelimite";
2459 2459
         if (!$user->rights->societe->client->voir && !$socid)
2460 2460
             $sql .= ", sc.fk_soc, sc.fk_user";
2461
-        $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "propal as p, " . MAIN_DB_PREFIX . "c_propalst as c";
2461
+        $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c";
2462 2462
         if (!$user->rights->societe->client->voir && !$socid)
2463
-            $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
2464
-        $sql .= " WHERE p.entity IN (" . getEntity('propal') . ")";
2463
+            $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
2464
+        $sql .= " WHERE p.entity IN (".getEntity('propal').")";
2465 2465
         $sql .= " AND p.fk_soc = s.rowid";
2466 2466
         $sql .= " AND p.fk_statut = c.id";
2467 2467
         if (!$user->rights->societe->client->voir && !$socid) { //restriction
2468
-            $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
2468
+            $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
2469 2469
         }
2470 2470
         if ($socid)
2471
-            $sql .= " AND s.rowid = " . $socid;
2471
+            $sql .= " AND s.rowid = ".$socid;
2472 2472
         if ($draft)
2473
-            $sql .= " AND p.fk_statut = " . self::STATUS_DRAFT;
2473
+            $sql .= " AND p.fk_statut = ".self::STATUS_DRAFT;
2474 2474
         if ($notcurrentuser > 0)
2475
-            $sql .= " AND p.fk_user_author <> " . $user->id;
2475
+            $sql .= " AND p.fk_user_author <> ".$user->id;
2476 2476
         $sql .= $this->db->order($sortfield, $sortorder);
2477 2477
         $sql .= $this->db->plimit($limit, $offset);
2478 2478
 
@@ -2487,7 +2487,7 @@  discard block
 block discarded – undo
2487 2487
                     if ($shortlist == 1) {
2488 2488
                         $ga[$obj->propalid] = $obj->ref;
2489 2489
                     } else if ($shortlist == 2) {
2490
-                        $ga[$obj->propalid] = $obj->ref . ' (' . $obj->name . ')';
2490
+                        $ga[$obj->propalid] = $obj->ref.' ('.$obj->name.')';
2491 2491
                     } else {
2492 2492
                         $ga[$i]['id'] = $obj->propalid;
2493 2493
                         $ga[$i]['ref'] = $obj->ref;
@@ -2552,10 +2552,10 @@  discard block
 block discarded – undo
2552 2552
 
2553 2553
         if (count($linkedInvoices) > 0) {
2554 2554
             $sql = "SELECT rowid as facid, ref, total, datef as df, fk_user_author, fk_statut, paye";
2555
-            $sql .= " FROM " . MAIN_DB_PREFIX . "facture";
2556
-            $sql .= " WHERE rowid IN (" . implode(',', $linkedInvoices) . ")";
2555
+            $sql .= " FROM ".MAIN_DB_PREFIX."facture";
2556
+            $sql .= " WHERE rowid IN (".implode(',', $linkedInvoices).")";
2557 2557
 
2558
-            dol_syslog(get_class($this) . "::InvoiceArrayList", LOG_DEBUG);
2558
+            dol_syslog(get_class($this)."::InvoiceArrayList", LOG_DEBUG);
2559 2559
             $resql = $this->db->query($sql);
2560 2560
 
2561 2561
             if ($resql) {
@@ -2597,7 +2597,7 @@  discard block
 block discarded – undo
2597 2597
     function delete($user, $notrigger = 0)
2598 2598
     {
2599 2599
         global $conf;
2600
-        require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
2600
+        require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
2601 2601
 
2602 2602
         $error = 0;
2603 2603
 
@@ -2613,9 +2613,9 @@  discard block
 block discarded – undo
2613 2613
         }
2614 2614
 
2615 2615
         if (!$error) {
2616
-            $sql = "DELETE FROM " . MAIN_DB_PREFIX . "propaldet WHERE fk_propal = " . $this->id;
2616
+            $sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE fk_propal = ".$this->id;
2617 2617
             if ($this->db->query($sql)) {
2618
-                $sql = "DELETE FROM " . MAIN_DB_PREFIX . "propal WHERE rowid = " . $this->id;
2618
+                $sql = "DELETE FROM ".MAIN_DB_PREFIX."propal WHERE rowid = ".$this->id;
2619 2619
                 if ($this->db->query($sql)) {
2620 2620
                     // Delete linked object
2621 2621
                     $res = $this->deleteObjectLinked();
@@ -2631,8 +2631,8 @@  discard block
 block discarded – undo
2631 2631
                         // We remove directory
2632 2632
                         $ref = dol_sanitizeFileName($this->ref);
2633 2633
                         if ($conf->propal->multidir_output[$this->entity] && !empty($this->ref)) {
2634
-                            $dir = $conf->propal->multidir_output[$this->entity] . "/" . $ref;
2635
-                            $file = $dir . "/" . $ref . ".pdf";
2634
+                            $dir = $conf->propal->multidir_output[$this->entity]."/".$ref;
2635
+                            $file = $dir."/".$ref.".pdf";
2636 2636
                             if (file_exists($file)) {
2637 2637
                                 dol_delete_preview($this);
2638 2638
 
@@ -2662,13 +2662,13 @@  discard block
 block discarded – undo
2662 2662
                             if ($result < 0) {
2663 2663
                                 $error++;
2664 2664
                                 $errorflag = -4;
2665
-                                dol_syslog(get_class($this) . "::delete erreur " . $errorflag . " " . $this->error, LOG_ERR);
2665
+                                dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
2666 2666
                             }
2667 2667
                         }
2668 2668
                     }
2669 2669
 
2670 2670
                     if (!$error) {
2671
-                        dol_syslog(get_class($this) . "::delete " . $this->id . " by " . $user->id, LOG_DEBUG);
2671
+                        dol_syslog(get_class($this)."::delete ".$this->id." by ".$user->id, LOG_DEBUG);
2672 2672
                         $this->db->commit();
2673 2673
                         return 1;
2674 2674
                     } else {
@@ -2709,11 +2709,11 @@  discard block
 block discarded – undo
2709 2709
 
2710 2710
             $this->db->begin();
2711 2711
 
2712
-            $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'propal';
2713
-            $sql .= ' SET fk_availability = ' . $availability_id;
2714
-            $sql .= ' WHERE rowid=' . $this->id;
2712
+            $sql = 'UPDATE '.MAIN_DB_PREFIX.'propal';
2713
+            $sql .= ' SET fk_availability = '.$availability_id;
2714
+            $sql .= ' WHERE rowid='.$this->id;
2715 2715
 
2716
-            dol_syslog(__METHOD__ . ' availability(' . $availability_id . ')', LOG_DEBUG);
2716
+            dol_syslog(__METHOD__.' availability('.$availability_id.')', LOG_DEBUG);
2717 2717
             $resql = $this->db->query($sql);
2718 2718
             if (!$resql) {
2719 2719
                 $this->errors[] = $this->db->error();
@@ -2738,15 +2738,15 @@  discard block
 block discarded – undo
2738 2738
                 return 1;
2739 2739
             } else {
2740 2740
                 foreach ($this->errors as $errmsg) {
2741
-                    dol_syslog(__METHOD__ . ' Error: ' . $errmsg, LOG_ERR);
2742
-                    $this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
2741
+                    dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
2742
+                    $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
2743 2743
                 }
2744 2744
                 $this->db->rollback();
2745 2745
                 return -1 * $error;
2746 2746
             }
2747 2747
         } else {
2748
-            $error_str = 'Propal status do not meet requirement ' . $this->statut;
2749
-            dol_syslog(__METHOD__ . $error_str, LOG_ERR);
2748
+            $error_str = 'Propal status do not meet requirement '.$this->statut;
2749
+            dol_syslog(__METHOD__.$error_str, LOG_ERR);
2750 2750
             $this->error = $error_str;
2751 2751
             $this->errors[] = $this->error;
2752 2752
             return -2;
@@ -2772,11 +2772,11 @@  discard block
 block discarded – undo
2772 2772
 
2773 2773
             $this->db->begin();
2774 2774
 
2775
-            $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'propal';
2776
-            $sql .= ' SET fk_input_reason = ' . $demand_reason_id;
2777
-            $sql .= ' WHERE rowid=' . $this->id;
2775
+            $sql = 'UPDATE '.MAIN_DB_PREFIX.'propal';
2776
+            $sql .= ' SET fk_input_reason = '.$demand_reason_id;
2777
+            $sql .= ' WHERE rowid='.$this->id;
2778 2778
 
2779
-            dol_syslog(__METHOD__ . ' demand_reason(' . $demand_reason_id . ')', LOG_DEBUG);
2779
+            dol_syslog(__METHOD__.' demand_reason('.$demand_reason_id.')', LOG_DEBUG);
2780 2780
             $resql = $this->db->query($sql);
2781 2781
             if (!$resql) {
2782 2782
                 $this->errors[] = $this->db->error();
@@ -2801,15 +2801,15 @@  discard block
 block discarded – undo
2801 2801
                 return 1;
2802 2802
             } else {
2803 2803
                 foreach ($this->errors as $errmsg) {
2804
-                    dol_syslog(__METHOD__ . ' Error: ' . $errmsg, LOG_ERR);
2805
-                    $this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
2804
+                    dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR);
2805
+                    $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
2806 2806
                 }
2807 2807
                 $this->db->rollback();
2808 2808
                 return -1 * $error;
2809 2809
             }
2810 2810
         } else {
2811
-            $error_str = 'Propal status do not meet requirement ' . $this->statut;
2812
-            dol_syslog(__METHOD__ . $error_str, LOG_ERR);
2811
+            $error_str = 'Propal status do not meet requirement '.$this->statut;
2812
+            dol_syslog(__METHOD__.$error_str, LOG_ERR);
2813 2813
             $this->error = $error_str;
2814 2814
             $this->errors[] = $this->error;
2815 2815
             return -2;
@@ -2827,8 +2827,8 @@  discard block
 block discarded – undo
2827 2827
         $sql = "SELECT c.rowid, ";
2828 2828
         $sql .= " c.datec, c.date_valid as datev, c.date_cloture as dateo,";
2829 2829
         $sql .= " c.fk_user_author, c.fk_user_valid, c.fk_user_cloture";
2830
-        $sql .= " FROM " . MAIN_DB_PREFIX . "propal as c";
2831
-        $sql .= " WHERE c.rowid = " . $id;
2830
+        $sql .= " FROM ".MAIN_DB_PREFIX."propal as c";
2831
+        $sql .= " WHERE c.rowid = ".$id;
2832 2832
 
2833 2833
         $result = $this->db->query($sql);
2834 2834
 
@@ -2921,15 +2921,15 @@  discard block
 block discarded – undo
2921 2921
         elseif ($mode == 1)
2922 2922
             return $this->labelstatut_short[$statut];
2923 2923
         elseif ($mode == 2)
2924
-            return img_picto($this->labelstatut_short[$statut], $statuttrans) . ' ' . $this->labelstatut_short[$statut];
2924
+            return img_picto($this->labelstatut_short[$statut], $statuttrans).' '.$this->labelstatut_short[$statut];
2925 2925
         elseif ($mode == 3)
2926 2926
             return img_picto($this->labelstatut[$statut], $statuttrans);
2927 2927
         elseif ($mode == 4)
2928
-            return img_picto($this->labelstatut[$statut], $statuttrans) . ' ' . $this->labelstatut[$statut];
2928
+            return img_picto($this->labelstatut[$statut], $statuttrans).' '.$this->labelstatut[$statut];
2929 2929
         elseif ($mode == 5)
2930
-            return '<span class="hideonsmartphone">' . $this->labelstatut_short[$statut] . ' </span>' . img_picto($this->labelstatut[$statut], $statuttrans);
2930
+            return '<span class="hideonsmartphone">'.$this->labelstatut_short[$statut].' </span>'.img_picto($this->labelstatut[$statut], $statuttrans);
2931 2931
         elseif ($mode == 6)
2932
-            return '<span class="hideonsmartphone">' . $this->labelstatut[$statut] . ' </span>' . img_picto($this->labelstatut[$statut], $statuttrans);
2932
+            return '<span class="hideonsmartphone">'.$this->labelstatut[$statut].' </span>'.img_picto($this->labelstatut[$statut], $statuttrans);
2933 2933
     }
2934 2934
 
2935 2935
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
@@ -2948,19 +2948,19 @@  discard block
 block discarded – undo
2948 2948
         $clause = " WHERE";
2949 2949
 
2950 2950
         $sql = "SELECT p.rowid, p.ref, p.datec as datec, p.fin_validite as datefin, p.total_ht";
2951
-        $sql .= " FROM " . MAIN_DB_PREFIX . "propal as p";
2951
+        $sql .= " FROM ".MAIN_DB_PREFIX."propal as p";
2952 2952
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
2953
-            $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON p.fk_soc = sc.fk_soc";
2954
-            $sql .= " WHERE sc.fk_user = " . $user->id;
2953
+            $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc";
2954
+            $sql .= " WHERE sc.fk_user = ".$user->id;
2955 2955
             $clause = " AND";
2956 2956
         }
2957
-        $sql .= $clause . " p.entity IN (" . getEntity('propal') . ")";
2957
+        $sql .= $clause." p.entity IN (".getEntity('propal').")";
2958 2958
         if ($mode == 'opened')
2959
-            $sql .= " AND p.fk_statut = " . self::STATUS_VALIDATED;
2959
+            $sql .= " AND p.fk_statut = ".self::STATUS_VALIDATED;
2960 2960
         if ($mode == 'signed')
2961
-            $sql .= " AND p.fk_statut = " . self::STATUS_SIGNED;
2961
+            $sql .= " AND p.fk_statut = ".self::STATUS_SIGNED;
2962 2962
         if ($user->societe_id)
2963
-            $sql .= " AND p.fk_soc = " . $user->societe_id;
2963
+            $sql .= " AND p.fk_soc = ".$user->societe_id;
2964 2964
 
2965 2965
         $resql = $this->db->query($sql);
2966 2966
         if ($resql) {
@@ -2978,14 +2978,14 @@  discard block
 block discarded – undo
2978 2978
             if ($mode == 'signed') {
2979 2979
                 $delay_warning = $conf->propal->facturation->warning_delay;
2980 2980
                 $statut = self::STATUS_SIGNED;
2981
-                $label = $langs->trans("PropalsToBill");         // We set here bill but may be billed or ordered
2981
+                $label = $langs->trans("PropalsToBill"); // We set here bill but may be billed or ordered
2982 2982
             }
2983 2983
 
2984 2984
             $response = new WorkboardResponse();
2985 2985
             $response->warning_delay = $delay_warning / 60 / 60 / 24;
2986 2986
             $response->label = $label;
2987
-            $response->url = DOL_URL_ROOT . '/comm/propal/list.php?viewstatut=' . $statut . '&mainmenu=commercial&leftmenu=propals';
2988
-            $response->url_late = DOL_URL_ROOT . '/comm/propal/list.php?viewstatut=' . $statut . '&mainmenu=commercial&leftmenu=propals&sortfield=p.datep&sortorder=asc';
2987
+            $response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut.'&mainmenu=commercial&leftmenu=propals';
2988
+            $response->url_late = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut.'&mainmenu=commercial&leftmenu=propals&sortfield=p.datep&sortorder=asc';
2989 2989
             $response->img = img_object('', "propal");
2990 2990
 
2991 2991
             // This assignment in condition is not a bug. It allows walking the results.
@@ -3025,8 +3025,8 @@  discard block
 block discarded – undo
3025 3025
         $num_prods = 0;
3026 3026
         $prodids = array();
3027 3027
         $sql = "SELECT rowid";
3028
-        $sql .= " FROM " . MAIN_DB_PREFIX . "product";
3029
-        $sql .= " WHERE entity IN (" . getEntity('product') . ")";
3028
+        $sql .= " FROM ".MAIN_DB_PREFIX."product";
3029
+        $sql .= " WHERE entity IN (".getEntity('product').")";
3030 3030
         $resql = $this->db->query($sql);
3031 3031
         if ($resql) {
3032 3032
             $num_prods = $this->db->num_rows($resql);
@@ -3061,7 +3061,7 @@  discard block
 block discarded – undo
3061 3061
         $xnbp = 0;
3062 3062
         while ($xnbp < $nbp) {
3063 3063
             $line = new PropaleLigne($this->db);
3064
-            $line->desc = $langs->trans("Description") . " " . $xnbp;
3064
+            $line->desc = $langs->trans("Description")." ".$xnbp;
3065 3065
             $line->qty = 1;
3066 3066
             $line->subprice = 100;
3067 3067
             $line->price = 100;
@@ -3111,14 +3111,14 @@  discard block
 block discarded – undo
3111 3111
         $clause = "WHERE";
3112 3112
 
3113 3113
         $sql = "SELECT count(p.rowid) as nb";
3114
-        $sql .= " FROM " . MAIN_DB_PREFIX . "propal as p";
3115
-        $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON p.fk_soc = s.rowid";
3114
+        $sql .= " FROM ".MAIN_DB_PREFIX."propal as p";
3115
+        $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid";
3116 3116
         if (!$user->rights->societe->client->voir && !$user->societe_id) {
3117
-            $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON s.rowid = sc.fk_soc";
3118
-            $sql .= " WHERE sc.fk_user = " . $user->id;
3117
+            $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
3118
+            $sql .= " WHERE sc.fk_user = ".$user->id;
3119 3119
             $clause = "AND";
3120 3120
         }
3121
-        $sql .= " " . $clause . " p.entity IN (" . getEntity('propal') . ")";
3121
+        $sql .= " ".$clause." p.entity IN (".getEntity('propal').")";
3122 3122
 
3123 3123
         $resql = $this->db->query($sql);
3124 3124
         if ($resql) {
@@ -3152,20 +3152,20 @@  discard block
 block discarded – undo
3152 3152
         if (!empty($classname)) {
3153 3153
             $mybool = false;
3154 3154
 
3155
-            $file = $classname . ".php";
3155
+            $file = $classname.".php";
3156 3156
 
3157 3157
             // Include file with class
3158 3158
             $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
3159 3159
             foreach ($dirmodels as $reldir) {
3160 3160
 
3161
-                $dir = dol_buildpath($reldir . "core/modules/propale/");
3161
+                $dir = dol_buildpath($reldir."core/modules/propale/");
3162 3162
 
3163 3163
                 // Load file with numbering class (if found)
3164
-                $mybool |= @include_once $dir . $file;
3164
+                $mybool |= @include_once $dir.$file;
3165 3165
             }
3166 3166
 
3167 3167
             if (!$mybool) {
3168
-                dol_print_error('', "Failed to include file " . $file);
3168
+                dol_print_error('', "Failed to include file ".$file);
3169 3169
                 return '';
3170 3170
             }
3171 3171
 
@@ -3182,7 +3182,7 @@  discard block
 block discarded – undo
3182 3182
             }
3183 3183
         } else {
3184 3184
             $langs->load("errors");
3185
-            print $langs->trans("Error") . " " . $langs->trans("ErrorModuleSetupNotComplete");
3185
+            print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete");
3186 3186
             return "";
3187 3187
         }
3188 3188
     }
@@ -3202,7 +3202,7 @@  discard block
 block discarded – undo
3202 3202
         global $langs, $conf, $user;
3203 3203
 
3204 3204
         if (!empty($conf->dol_no_mouse_hover)) {
3205
-            $notooltip = 1;   // Force disable tooltips
3205
+            $notooltip = 1; // Force disable tooltips
3206 3206
         }
3207 3207
 
3208 3208
         $result = '';
@@ -3210,37 +3210,37 @@  discard block
 block discarded – undo
3210 3210
         $url = '';
3211 3211
 
3212 3212
         if ($user->rights->propal->lire) {
3213
-            $label = '<u>' . $langs->trans("ShowPropal") . '</u>';
3213
+            $label = '<u>'.$langs->trans("ShowPropal").'</u>';
3214 3214
             if (!empty($this->ref)) {
3215
-                $label .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
3215
+                $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
3216 3216
             }
3217 3217
             if (!empty($this->ref_client)) {
3218
-                $label .= '<br><b>' . $langs->trans('RefCustomer') . ':</b> ' . $this->ref_client;
3218
+                $label .= '<br><b>'.$langs->trans('RefCustomer').':</b> '.$this->ref_client;
3219 3219
             }
3220 3220
             if (!empty($this->total_ht)) {
3221
-                $label .= '<br><b>' . $langs->trans('AmountHT') . ':</b> ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
3221
+                $label .= '<br><b>'.$langs->trans('AmountHT').':</b> '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
3222 3222
             }
3223 3223
             if (!empty($this->total_tva)) {
3224
-                $label .= '<br><b>' . $langs->trans('VAT') . ':</b> ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
3224
+                $label .= '<br><b>'.$langs->trans('VAT').':</b> '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
3225 3225
             }
3226 3226
             if (!empty($this->total_ttc)) {
3227
-                $label .= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
3227
+                $label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
3228 3228
             }
3229 3229
             if ($option == '') {
3230 3230
                 // $url = DOL_URL_ROOT . '/comm/propal/card.php?id=' . $this->id . $get_params;
3231
-                $url = BASE_URI . '?controller=comm/propal&method=card&id=' . $this->id . $get_params;
3231
+                $url = BASE_URI.'?controller=comm/propal&method=card&id='.$this->id.$get_params;
3232 3232
             }
3233 3233
             if ($option == 'compta') {  // deprecated
3234 3234
                 // $url = DOL_URL_ROOT . '/comm/propal/card.php?id=' . $this->id . $get_params;
3235
-                $url = BASE_URI . '?controller=comm/propal&method=card&id=' . $this->id . $get_params;
3235
+                $url = BASE_URI.'?controller=comm/propal&method=card&id='.$this->id.$get_params;
3236 3236
             }
3237 3237
             if ($option == 'expedition') {
3238 3238
                 // $url = DOL_URL_ROOT . '/expedition/propal.php?id=' . $this->id . $get_params;
3239
-                $url = BASE_URI . '?controller=expedition&method=propal&id=' . $this->id . $get_params;
3239
+                $url = BASE_URI.'?controller=expedition&method=propal&id='.$this->id.$get_params;
3240 3240
             }
3241 3241
             if ($option == 'document') {
3242 3242
                 // $url = DOL_URL_ROOT . '/comm/propal/document.php?id=' . $this->id . $get_params;
3243
-                $url = BASE_URI . '?controller=comm/propal&method=document&id=' . $this->id . $get_params;
3243
+                $url = BASE_URI.'?controller=comm/propal&method=document&id='.$this->id.$get_params;
3244 3244
             }
3245 3245
 
3246 3246
             if ($option != 'nolink') {
@@ -3259,19 +3259,19 @@  discard block
 block discarded – undo
3259 3259
         if (empty($notooltip) && $user->rights->propal->lire) {
3260 3260
             if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
3261 3261
                 $label = $langs->trans("ShowPropal");
3262
-                $linkclose .= ' alt="' . dol_escape_htmltag($label, 1) . '"';
3262
+                $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
3263 3263
             }
3264
-            $linkclose .= ' title="' . dol_escape_htmltag($label, 1) . '"';
3264
+            $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
3265 3265
             $linkclose .= ' class="classfortooltip"';
3266 3266
         }
3267 3267
 
3268
-        $linkstart = '<a href="' . $url . '"';
3269
-        $linkstart .= $linkclose . '>';
3268
+        $linkstart = '<a href="'.$url.'"';
3269
+        $linkstart .= $linkclose.'>';
3270 3270
         $linkend = '</a>';
3271 3271
 
3272 3272
         $result .= $linkstart;
3273 3273
         if ($withpicto)
3274
-            $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
3274
+            $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
3275 3275
         if ($withpicto != 2)
3276 3276
             $result .= $this->ref;
3277 3277
         $result .= $linkend;
@@ -3359,8 +3359,8 @@  discard block
 block discarded – undo
3359 3359
     // From llx_propaldet
3360 3360
     var $fk_propal;
3361 3361
     var $fk_parent_line;
3362
-    var $desc;           // Description ligne
3363
-    var $fk_product;  // Id produit predefini
3362
+    var $desc; // Description ligne
3363
+    var $fk_product; // Id produit predefini
3364 3364
     /**
3365 3365
      * @deprecated
3366 3366
      * @see product_type
@@ -3390,9 +3390,9 @@  discard block
 block discarded – undo
3390 3390
     var $info_bits = 0; // Liste d'options cumulables:
3391 3391
     // Bit 0: 	0 si TVA normal - 1 si TVA NPR
3392 3392
     // Bit 1:	0 ligne normale - 1 si ligne de remise fixe
3393
-    var $total_ht;   // Total HT  de la ligne toute quantite et incluant la remise ligne
3394
-    var $total_tva;   // Total TVA  de la ligne toute quantite et incluant la remise ligne
3395
-    var $total_ttc;   // Total TTC de la ligne toute quantite et incluant la remise ligne
3393
+    var $total_ht; // Total HT  de la ligne toute quantite et incluant la remise ligne
3394
+    var $total_tva; // Total TVA  de la ligne toute quantite et incluant la remise ligne
3395
+    var $total_ttc; // Total TTC de la ligne toute quantite et incluant la remise ligne
3396 3396
 
3397 3397
     /**
3398 3398
      * @deprecated
@@ -3435,11 +3435,11 @@  discard block
 block discarded – undo
3435 3435
      * @var string
3436 3436
      */
3437 3437
     public $product_desc;
3438
-    var $localtax1_tx;  // Local tax 1
3439
-    var $localtax2_tx;  // Local tax 2
3438
+    var $localtax1_tx; // Local tax 1
3439
+    var $localtax2_tx; // Local tax 2
3440 3440
     var $localtax1_type; // Local tax 1 type
3441 3441
     var $localtax2_type; // Local tax 2 type
3442
-    var $total_localtax1;   // Line total local tax 1
3442
+    var $total_localtax1; // Line total local tax 1
3443 3443
     var $total_localtax2; // Line total local tax 2
3444 3444
     var $date_start;
3445 3445
     var $date_end;
@@ -3478,9 +3478,9 @@  discard block
 block discarded – undo
3478 3478
         $sql .= ' pd.fk_multicurrency, pd.multicurrency_code, pd.multicurrency_subprice, pd.multicurrency_total_ht, pd.multicurrency_total_tva, pd.multicurrency_total_ttc,';
3479 3479
         $sql .= ' p.ref as product_ref, p.label as product_label, p.description as product_desc,';
3480 3480
         $sql .= ' pd.date_start, pd.date_end, pd.product_type';
3481
-        $sql .= ' FROM ' . MAIN_DB_PREFIX . 'propaldet as pd';
3482
-        $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product as p ON pd.fk_product = p.rowid';
3483
-        $sql .= ' WHERE pd.rowid = ' . $rowid;
3481
+        $sql .= ' FROM '.MAIN_DB_PREFIX.'propaldet as pd';
3482
+        $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pd.fk_product = p.rowid';
3483
+        $sql .= ' WHERE pd.rowid = '.$rowid;
3484 3484
 
3485 3485
         $result = $this->db->query($sql);
3486 3486
         if ($result) {
@@ -3488,17 +3488,17 @@  discard block
 block discarded – undo
3488 3488
 
3489 3489
             if ($objp) {
3490 3490
                 $this->id = $objp->rowid;
3491
-                $this->rowid = $objp->rowid;     // deprecated
3491
+                $this->rowid = $objp->rowid; // deprecated
3492 3492
                 $this->fk_propal = $objp->fk_propal;
3493 3493
                 $this->fk_parent_line = $objp->fk_parent_line;
3494 3494
                 $this->label = $objp->custom_label;
3495 3495
                 $this->desc = $objp->description;
3496 3496
                 $this->qty = $objp->qty;
3497
-                $this->price = $objp->price;  // deprecated
3497
+                $this->price = $objp->price; // deprecated
3498 3498
                 $this->subprice = $objp->subprice;
3499 3499
                 $this->vat_src_code = $objp->vat_src_code;
3500 3500
                 $this->tva_tx = $objp->tva_tx;
3501
-                $this->remise = $objp->remise;    // deprecated
3501
+                $this->remise = $objp->remise; // deprecated
3502 3502
                 $this->remise_percent = $objp->remise_percent;
3503 3503
                 $this->fk_remise_except = $objp->fk_remise_except;
3504 3504
                 $this->fk_product = $objp->fk_product;
@@ -3519,9 +3519,9 @@  discard block
 block discarded – undo
3519 3519
                 $this->product_type = $objp->product_type;
3520 3520
                 $this->rang = $objp->rang;
3521 3521
 
3522
-                $this->ref = $objp->product_ref;      // deprecated
3522
+                $this->ref = $objp->product_ref; // deprecated
3523 3523
                 $this->product_ref = $objp->product_ref;
3524
-                $this->libelle = $objp->product_label;  // deprecated
3524
+                $this->libelle = $objp->product_label; // deprecated
3525 3525
                 $this->product_label = $objp->product_label;
3526 3526
                 $this->product_desc = $objp->product_desc;
3527 3527
                 $this->fk_unit = $objp->fk_unit;
@@ -3562,7 +3562,7 @@  discard block
 block discarded – undo
3562 3562
 
3563 3563
         $error = 0;
3564 3564
 
3565
-        dol_syslog(get_class($this) . "::insert rang=" . $this->rang);
3565
+        dol_syslog(get_class($this)."::insert rang=".$this->rang);
3566 3566
 
3567 3567
         $pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'.
3568 3568
         // Clean parameters
@@ -3623,7 +3623,7 @@  discard block
 block discarded – undo
3623 3623
         $this->db->begin();
3624 3624
 
3625 3625
         // Insert line into database
3626
-        $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . 'propaldet';
3626
+        $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'propaldet';
3627 3627
         $sql .= ' (fk_propal, fk_parent_line, label, description, fk_product, product_type,';
3628 3628
         $sql .= ' fk_remise_except, qty, vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,';
3629 3629
         $sql .= ' subprice, remise_percent, ';
@@ -3632,47 +3632,47 @@  discard block
 block discarded – undo
3632 3632
         $sql .= ' fk_unit,';
3633 3633
         $sql .= ' date_start, date_end';
3634 3634
         $sql .= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc)';
3635
-        $sql .= " VALUES (" . $this->fk_propal . ",";
3636
-        $sql .= " " . ($this->fk_parent_line > 0 ? "'" . $this->db->escape($this->fk_parent_line) . "'" : "null") . ",";
3637
-        $sql .= " " . (!empty($this->label) ? "'" . $this->db->escape($this->label) . "'" : "null") . ",";
3638
-        $sql .= " '" . $this->db->escape($this->desc) . "',";
3639
-        $sql .= " " . ($this->fk_product ? "'" . $this->db->escape($this->fk_product) . "'" : "null") . ",";
3640
-        $sql .= " '" . $this->db->escape($this->product_type) . "',";
3641
-        $sql .= " " . ($this->fk_remise_except ? "'" . $this->db->escape($this->fk_remise_except) . "'" : "null") . ",";
3642
-        $sql .= " " . price2num($this->qty) . ",";
3643
-        $sql .= " " . (empty($this->vat_src_code) ? "''" : "'" . $this->db->escape($this->vat_src_code) . "'") . ",";
3644
-        $sql .= " " . price2num($this->tva_tx) . ",";
3645
-        $sql .= " " . price2num($this->localtax1_tx) . ",";
3646
-        $sql .= " " . price2num($this->localtax2_tx) . ",";
3647
-        $sql .= " '" . $this->db->escape($this->localtax1_type) . "',";
3648
-        $sql .= " '" . $this->db->escape($this->localtax2_type) . "',";
3649
-        $sql .= " " . (price2num($this->subprice) !== '' ? price2num($this->subprice) : "null") . ",";
3650
-        $sql .= " " . price2num($this->remise_percent) . ",";
3651
-        $sql .= " " . (isset($this->info_bits) ? "'" . $this->db->escape($this->info_bits) . "'" : "null") . ",";
3652
-        $sql .= " " . price2num($this->total_ht) . ",";
3653
-        $sql .= " " . price2num($this->total_tva) . ",";
3654
-        $sql .= " " . price2num($this->total_localtax1) . ",";
3655
-        $sql .= " " . price2num($this->total_localtax2) . ",";
3656
-        $sql .= " " . price2num($this->total_ttc) . ",";
3657
-        $sql .= " " . (!empty($this->fk_fournprice) ? "'" . $this->db->escape($this->fk_fournprice) . "'" : "null") . ",";
3658
-        $sql .= " " . (isset($this->pa_ht) ? "'" . price2num($this->pa_ht) . "'" : "null") . ",";
3659
-        $sql .= ' ' . $this->special_code . ',';
3660
-        $sql .= ' ' . $this->rang . ',';
3661
-        $sql .= ' ' . (!$this->fk_unit ? 'NULL' : $this->fk_unit) . ',';
3662
-        $sql .= " " . (!empty($this->date_start) ? "'" . $this->db->idate($this->date_start) . "'" : "null") . ',';
3663
-        $sql .= " " . (!empty($this->date_end) ? "'" . $this->db->idate($this->date_end) . "'" : "null");
3664
-        $sql .= ", " . ($this->fk_multicurrency > 0 ? $this->fk_multicurrency : 'null');
3665
-        $sql .= ", '" . $this->db->escape($this->multicurrency_code) . "'";
3666
-        $sql .= ", " . $this->multicurrency_subprice;
3667
-        $sql .= ", " . $this->multicurrency_total_ht;
3668
-        $sql .= ", " . $this->multicurrency_total_tva;
3669
-        $sql .= ", " . $this->multicurrency_total_ttc;
3635
+        $sql .= " VALUES (".$this->fk_propal.",";
3636
+        $sql .= " ".($this->fk_parent_line > 0 ? "'".$this->db->escape($this->fk_parent_line)."'" : "null").",";
3637
+        $sql .= " ".(!empty($this->label) ? "'".$this->db->escape($this->label)."'" : "null").",";
3638
+        $sql .= " '".$this->db->escape($this->desc)."',";
3639
+        $sql .= " ".($this->fk_product ? "'".$this->db->escape($this->fk_product)."'" : "null").",";
3640
+        $sql .= " '".$this->db->escape($this->product_type)."',";
3641
+        $sql .= " ".($this->fk_remise_except ? "'".$this->db->escape($this->fk_remise_except)."'" : "null").",";
3642
+        $sql .= " ".price2num($this->qty).",";
3643
+        $sql .= " ".(empty($this->vat_src_code) ? "''" : "'".$this->db->escape($this->vat_src_code)."'").",";
3644
+        $sql .= " ".price2num($this->tva_tx).",";
3645
+        $sql .= " ".price2num($this->localtax1_tx).",";
3646
+        $sql .= " ".price2num($this->localtax2_tx).",";
3647
+        $sql .= " '".$this->db->escape($this->localtax1_type)."',";
3648
+        $sql .= " '".$this->db->escape($this->localtax2_type)."',";
3649
+        $sql .= " ".(price2num($this->subprice) !== '' ? price2num($this->subprice) : "null").",";
3650
+        $sql .= " ".price2num($this->remise_percent).",";
3651
+        $sql .= " ".(isset($this->info_bits) ? "'".$this->db->escape($this->info_bits)."'" : "null").",";
3652
+        $sql .= " ".price2num($this->total_ht).",";
3653
+        $sql .= " ".price2num($this->total_tva).",";
3654
+        $sql .= " ".price2num($this->total_localtax1).",";
3655
+        $sql .= " ".price2num($this->total_localtax2).",";
3656
+        $sql .= " ".price2num($this->total_ttc).",";
3657
+        $sql .= " ".(!empty($this->fk_fournprice) ? "'".$this->db->escape($this->fk_fournprice)."'" : "null").",";
3658
+        $sql .= " ".(isset($this->pa_ht) ? "'".price2num($this->pa_ht)."'" : "null").",";
3659
+        $sql .= ' '.$this->special_code.',';
3660
+        $sql .= ' '.$this->rang.',';
3661
+        $sql .= ' '.(!$this->fk_unit ? 'NULL' : $this->fk_unit).',';
3662
+        $sql .= " ".(!empty($this->date_start) ? "'".$this->db->idate($this->date_start)."'" : "null").',';
3663
+        $sql .= " ".(!empty($this->date_end) ? "'".$this->db->idate($this->date_end)."'" : "null");
3664
+        $sql .= ", ".($this->fk_multicurrency > 0 ? $this->fk_multicurrency : 'null');
3665
+        $sql .= ", '".$this->db->escape($this->multicurrency_code)."'";
3666
+        $sql .= ", ".$this->multicurrency_subprice;
3667
+        $sql .= ", ".$this->multicurrency_total_ht;
3668
+        $sql .= ", ".$this->multicurrency_total_tva;
3669
+        $sql .= ", ".$this->multicurrency_total_ttc;
3670 3670
         $sql .= ')';
3671 3671
 
3672
-        dol_syslog(get_class($this) . '::insert', LOG_DEBUG);
3672
+        dol_syslog(get_class($this).'::insert', LOG_DEBUG);
3673 3673
         $resql = $this->db->query($sql);
3674 3674
         if ($resql) {
3675
-            $this->rowid = $this->db->last_insert_id(MAIN_DB_PREFIX . 'propaldet');
3675
+            $this->rowid = $this->db->last_insert_id(MAIN_DB_PREFIX.'propaldet');
3676 3676
 
3677 3677
             if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { // For avoid conflicts if trigger used
3678 3678
                 $this->id = $this->rowid;
@@ -3695,7 +3695,7 @@  discard block
 block discarded – undo
3695 3695
             $this->db->commit();
3696 3696
             return 1;
3697 3697
         } else {
3698
-            $this->error = $this->db->error() . " sql=" . $sql;
3698
+            $this->error = $this->db->error()." sql=".$sql;
3699 3699
             $this->db->rollback();
3700 3700
             return -1;
3701 3701
         }
@@ -3715,7 +3715,7 @@  discard block
 block discarded – undo
3715 3715
         $error = 0;
3716 3716
         $this->db->begin();
3717 3717
 
3718
-        $sql = "DELETE FROM " . MAIN_DB_PREFIX . "propaldet WHERE rowid = " . $this->rowid;
3718
+        $sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE rowid = ".$this->rowid;
3719 3719
         dol_syslog("PropaleLigne::delete", LOG_DEBUG);
3720 3720
         if ($this->db->query($sql)) {
3721 3721
 
@@ -3725,7 +3725,7 @@  discard block
 block discarded – undo
3725 3725
                 $result = $this->deleteExtraFields();
3726 3726
                 if ($result < 0) {
3727 3727
                     $error++;
3728
-                    dol_syslog(get_class($this) . "::delete error -4 " . $this->error, LOG_ERR);
3728
+                    dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
3729 3729
                 }
3730 3730
             }
3731 3731
 
@@ -3743,7 +3743,7 @@  discard block
 block discarded – undo
3743 3743
 
3744 3744
             return 1;
3745 3745
         } else {
3746
-            $this->error = $this->db->error() . " sql=" . $sql;
3746
+            $this->error = $this->db->error()." sql=".$sql;
3747 3747
             $this->db->rollback();
3748 3748
             return -1;
3749 3749
         }
@@ -3812,49 +3812,49 @@  discard block
 block discarded – undo
3812 3812
         $this->db->begin();
3813 3813
 
3814 3814
         // Mise a jour ligne en base
3815
-        $sql = "UPDATE " . MAIN_DB_PREFIX . "propaldet SET";
3816
-        $sql .= " description='" . $this->db->escape($this->desc) . "'";
3817
-        $sql .= ", label=" . (!empty($this->label) ? "'" . $this->db->escape($this->label) . "'" : "null");
3818
-        $sql .= ", product_type=" . $this->product_type;
3819
-        $sql .= ", vat_src_code = '" . (empty($this->vat_src_code) ? '' : $this->vat_src_code) . "'";
3820
-        $sql .= ", tva_tx='" . price2num($this->tva_tx) . "'";
3821
-        $sql .= ", localtax1_tx=" . price2num($this->localtax1_tx);
3822
-        $sql .= ", localtax2_tx=" . price2num($this->localtax2_tx);
3823
-        $sql .= ", localtax1_type='" . $this->db->escape($this->localtax1_type) . "'";
3824
-        $sql .= ", localtax2_type='" . $this->db->escape($this->localtax2_type) . "'";
3825
-        $sql .= ", qty='" . price2num($this->qty) . "'";
3826
-        $sql .= ", subprice=" . price2num($this->subprice) . "";
3827
-        $sql .= ", remise_percent=" . price2num($this->remise_percent) . "";
3828
-        $sql .= ", price=" . price2num($this->price) . "";     // TODO A virer
3829
-        $sql .= ", remise=" . price2num($this->remise) . "";    // TODO A virer
3830
-        $sql .= ", info_bits='" . $this->db->escape($this->info_bits) . "'";
3815
+        $sql = "UPDATE ".MAIN_DB_PREFIX."propaldet SET";
3816
+        $sql .= " description='".$this->db->escape($this->desc)."'";
3817
+        $sql .= ", label=".(!empty($this->label) ? "'".$this->db->escape($this->label)."'" : "null");
3818
+        $sql .= ", product_type=".$this->product_type;
3819
+        $sql .= ", vat_src_code = '".(empty($this->vat_src_code) ? '' : $this->vat_src_code)."'";
3820
+        $sql .= ", tva_tx='".price2num($this->tva_tx)."'";
3821
+        $sql .= ", localtax1_tx=".price2num($this->localtax1_tx);
3822
+        $sql .= ", localtax2_tx=".price2num($this->localtax2_tx);
3823
+        $sql .= ", localtax1_type='".$this->db->escape($this->localtax1_type)."'";
3824
+        $sql .= ", localtax2_type='".$this->db->escape($this->localtax2_type)."'";
3825
+        $sql .= ", qty='".price2num($this->qty)."'";
3826
+        $sql .= ", subprice=".price2num($this->subprice)."";
3827
+        $sql .= ", remise_percent=".price2num($this->remise_percent)."";
3828
+        $sql .= ", price=".price2num($this->price).""; // TODO A virer
3829
+        $sql .= ", remise=".price2num($this->remise).""; // TODO A virer
3830
+        $sql .= ", info_bits='".$this->db->escape($this->info_bits)."'";
3831 3831
         if (empty($this->skip_update_total)) {
3832
-            $sql .= ", total_ht=" . price2num($this->total_ht) . "";
3833
-            $sql .= ", total_tva=" . price2num($this->total_tva) . "";
3834
-            $sql .= ", total_ttc=" . price2num($this->total_ttc) . "";
3835
-            $sql .= ", total_localtax1=" . price2num($this->total_localtax1) . "";
3836
-            $sql .= ", total_localtax2=" . price2num($this->total_localtax2) . "";
3837
-        }
3838
-        $sql .= ", fk_product_fournisseur_price=" . (!empty($this->fk_fournprice) ? "'" . $this->db->escape($this->fk_fournprice) . "'" : "null");
3839
-        $sql .= ", buy_price_ht=" . price2num($this->pa_ht);
3832
+            $sql .= ", total_ht=".price2num($this->total_ht)."";
3833
+            $sql .= ", total_tva=".price2num($this->total_tva)."";
3834
+            $sql .= ", total_ttc=".price2num($this->total_ttc)."";
3835
+            $sql .= ", total_localtax1=".price2num($this->total_localtax1)."";
3836
+            $sql .= ", total_localtax2=".price2num($this->total_localtax2)."";
3837
+        }
3838
+        $sql .= ", fk_product_fournisseur_price=".(!empty($this->fk_fournprice) ? "'".$this->db->escape($this->fk_fournprice)."'" : "null");
3839
+        $sql .= ", buy_price_ht=".price2num($this->pa_ht);
3840 3840
         if (strlen($this->special_code))
3841
-            $sql .= ", special_code=" . $this->special_code;
3842
-        $sql .= ", fk_parent_line=" . ($this->fk_parent_line > 0 ? $this->fk_parent_line : "null");
3841
+            $sql .= ", special_code=".$this->special_code;
3842
+        $sql .= ", fk_parent_line=".($this->fk_parent_line > 0 ? $this->fk_parent_line : "null");
3843 3843
         if (!empty($this->rang))
3844
-            $sql .= ", rang=" . $this->rang;
3845
-        $sql .= ", date_start=" . (!empty($this->date_start) ? "'" . $this->db->idate($this->date_start) . "'" : "null");
3846
-        $sql .= ", date_end=" . (!empty($this->date_end) ? "'" . $this->db->idate($this->date_end) . "'" : "null");
3847
-        $sql .= ", fk_unit=" . (!$this->fk_unit ? 'NULL' : $this->fk_unit);
3844
+            $sql .= ", rang=".$this->rang;
3845
+        $sql .= ", date_start=".(!empty($this->date_start) ? "'".$this->db->idate($this->date_start)."'" : "null");
3846
+        $sql .= ", date_end=".(!empty($this->date_end) ? "'".$this->db->idate($this->date_end)."'" : "null");
3847
+        $sql .= ", fk_unit=".(!$this->fk_unit ? 'NULL' : $this->fk_unit);
3848 3848
 
3849 3849
         // Multicurrency
3850
-        $sql .= ", multicurrency_subprice=" . price2num($this->multicurrency_subprice) . "";
3851
-        $sql .= ", multicurrency_total_ht=" . price2num($this->multicurrency_total_ht) . "";
3852
-        $sql .= ", multicurrency_total_tva=" . price2num($this->multicurrency_total_tva) . "";
3853
-        $sql .= ", multicurrency_total_ttc=" . price2num($this->multicurrency_total_ttc) . "";
3850
+        $sql .= ", multicurrency_subprice=".price2num($this->multicurrency_subprice)."";
3851
+        $sql .= ", multicurrency_total_ht=".price2num($this->multicurrency_total_ht)."";
3852
+        $sql .= ", multicurrency_total_tva=".price2num($this->multicurrency_total_tva)."";
3853
+        $sql .= ", multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc)."";
3854 3854
 
3855
-        $sql .= " WHERE rowid = " . $this->rowid;
3855
+        $sql .= " WHERE rowid = ".$this->rowid;
3856 3856
 
3857
-        dol_syslog(get_class($this) . "::update", LOG_DEBUG);
3857
+        dol_syslog(get_class($this)."::update", LOG_DEBUG);
3858 3858
         $resql = $this->db->query($sql);
3859 3859
         if ($resql) {
3860 3860
             if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { // For avoid conflicts if trigger used
@@ -3897,11 +3897,11 @@  discard block
 block discarded – undo
3897 3897
         $this->db->begin();
3898 3898
 
3899 3899
         // Mise a jour ligne en base
3900
-        $sql = "UPDATE " . MAIN_DB_PREFIX . "propaldet SET";
3901
-        $sql .= " total_ht=" . price2num($this->total_ht, 'MT') . "";
3902
-        $sql .= ",total_tva=" . price2num($this->total_tva, 'MT') . "";
3903
-        $sql .= ",total_ttc=" . price2num($this->total_ttc, 'MT') . "";
3904
-        $sql .= " WHERE rowid = " . $this->rowid;
3900
+        $sql = "UPDATE ".MAIN_DB_PREFIX."propaldet SET";
3901
+        $sql .= " total_ht=".price2num($this->total_ht, 'MT')."";
3902
+        $sql .= ",total_tva=".price2num($this->total_tva, 'MT')."";
3903
+        $sql .= ",total_ttc=".price2num($this->total_ttc, 'MT')."";
3904
+        $sql .= " WHERE rowid = ".$this->rowid;
3905 3905
 
3906 3906
         dol_syslog("PropaleLigne::update_total", LOG_DEBUG);
3907 3907
 
Please login to merge, or discard this patch.
Braces   +349 added lines, -240 removed lines patch added patch discarded remove patch
@@ -269,8 +269,9 @@  discard block
 block discarded – undo
269 269
         // phpcs:enable
270 270
         global $conf, $mysoc;
271 271
 
272
-        if (!$qty)
273
-            $qty = 1;
272
+        if (!$qty) {
273
+                    $qty = 1;
274
+        }
274 275
 
275 276
         dol_syslog(get_class($this) . "::add_product $idproduct, $qty, $remise_percent");
276 277
         if ($idproduct > 0) {
@@ -281,8 +282,9 @@  discard block
 block discarded – undo
281 282
 
282 283
             $tva_tx = get_default_tva($mysoc, $this->thirdparty, $prod->id);
283 284
             $tva_npr = get_default_npr($mysoc, $this->thirdparty, $prod->id);
284
-            if (empty($tva_tx))
285
-                $tva_npr = 0;
285
+            if (empty($tva_tx)) {
286
+                            $tva_npr = 0;
287
+            }
286 288
             $vat_src_code = '';     // May be defined into tva_tx
287 289
 
288 290
             $localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $this->thirdparty, $tva_npr);
@@ -305,8 +307,9 @@  discard block
 block discarded – undo
305 307
             $line->vat_src_code = $vat_src_code;
306 308
             $line->tva_tx = $tva_tx;
307 309
             $line->fk_unit = $prod->fk_unit;
308
-            if ($tva_npr)
309
-                $line->info_bits = 1;
310
+            if ($tva_npr) {
311
+                            $line->info_bits = 1;
312
+            }
310 313
 
311 314
             $this->lines[] = $line;
312 315
         }
@@ -429,16 +432,21 @@  discard block
 block discarded – undo
429 432
             include_once DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php';
430 433
 
431 434
             // Clean parameters
432
-            if (empty($remise_percent))
433
-                $remise_percent = 0;
434
-            if (empty($qty))
435
-                $qty = 0;
436
-            if (empty($info_bits))
437
-                $info_bits = 0;
438
-            if (empty($rang))
439
-                $rang = 0;
440
-            if (empty($fk_parent_line) || $fk_parent_line < 0)
441
-                $fk_parent_line = 0;
435
+            if (empty($remise_percent)) {
436
+                            $remise_percent = 0;
437
+            }
438
+            if (empty($qty)) {
439
+                            $qty = 0;
440
+            }
441
+            if (empty($info_bits)) {
442
+                            $info_bits = 0;
443
+            }
444
+            if (empty($rang)) {
445
+                            $rang = 0;
446
+            }
447
+            if (empty($fk_parent_line) || $fk_parent_line < 0) {
448
+                            $fk_parent_line = 0;
449
+            }
442 450
 
443 451
             $remise_percent = price2num($remise_percent);
444 452
             $qty = price2num($qty);
@@ -458,8 +466,9 @@  discard block
 block discarded – undo
458 466
             }
459 467
 
460 468
             // Check parameters
461
-            if ($type < 0)
462
-                return -1;
469
+            if ($type < 0) {
470
+                            return -1;
471
+            }
463 472
 
464 473
             $this->db->begin();
465 474
 
@@ -574,8 +583,9 @@  discard block
 block discarded – undo
574 583
             $this->line->multicurrency_total_ttc = $multicurrency_total_ttc;
575 584
 
576 585
             // Mise en option de la ligne
577
-            if (empty($qty) && empty($special_code))
578
-                $this->line->special_code = 3;
586
+            if (empty($qty) && empty($special_code)) {
587
+                            $this->line->special_code = 3;
588
+            }
579 589
 
580 590
             // TODO deprecated
581 591
             $this->line->price = $price;
@@ -588,8 +598,9 @@  discard block
 block discarded – undo
588 598
             $result = $this->line->insert();
589 599
             if ($result > 0) {
590 600
                 // Reorder if child line
591
-                if (!empty($fk_parent_line))
592
-                    $this->line_order(true, 'DESC');
601
+                if (!empty($fk_parent_line)) {
602
+                                    $this->line_order(true, 'DESC');
603
+                }
593 604
 
594 605
                 // Mise a jour informations denormalisees au niveau de la propale meme
595 606
                 $result = $this->update_price(1, 'auto', 0, $mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
@@ -657,12 +668,17 @@  discard block
 block discarded – undo
657 668
         $txlocaltax1 = price2num($txlocaltax1);
658 669
         $txlocaltax2 = price2num($txlocaltax2);
659 670
         $pa_ht = price2num($pa_ht);
660
-        if (empty($qty) && empty($special_code))
661
-            $special_code = 3;    // Set option tag
662
-        if (!empty($qty) && $special_code == 3)
663
-            $special_code = 0;    // Remove option tag
664
-        if (empty($type))
665
-            $type = 0;
671
+        if (empty($qty) && empty($special_code)) {
672
+                    $special_code = 3;
673
+        }
674
+        // Set option tag
675
+        if (!empty($qty) && $special_code == 3) {
676
+                    $special_code = 0;
677
+        }
678
+        // Remove option tag
679
+        if (empty($type)) {
680
+                    $type = 0;
681
+        }
666 682
 
667 683
         if ($this->statut == self::STATUS_DRAFT) {
668 684
             $this->db->begin();
@@ -770,8 +786,9 @@  discard block
 block discarded – undo
770 786
             $result = $this->line->update($notrigger);
771 787
             if ($result > 0) {
772 788
                 // Reorder if child line
773
-                if (!empty($fk_parent_line))
774
-                    $this->line_order(true, 'DESC');
789
+                if (!empty($fk_parent_line)) {
790
+                                    $this->line_order(true, 'DESC');
791
+                }
775 792
 
776 793
                 $this->update_price(1);
777 794
 
@@ -780,8 +797,7 @@  discard block
 block discarded – undo
780 797
 
781 798
                 $this->db->commit();
782 799
                 return $result;
783
-            }
784
-            else {
800
+            } else {
785 801
                 $this->error = $this->line->error;
786 802
 
787 803
                 $this->db->rollback();
@@ -842,21 +858,26 @@  discard block
 block discarded – undo
842 858
         $now = dol_now();
843 859
 
844 860
         // Clean parameters
845
-        if (empty($this->entity))
846
-            $this->entity = $conf->entity;
847
-        if (empty($this->date))
848
-            $this->date = $this->datep;
861
+        if (empty($this->entity)) {
862
+                    $this->entity = $conf->entity;
863
+        }
864
+        if (empty($this->date)) {
865
+                    $this->date = $this->datep;
866
+        }
849 867
         $this->fin_validite = $this->date + ($this->duree_validite * 24 * 3600);
850
-        if (empty($this->availability_id))
851
-            $this->availability_id = 0;
852
-        if (empty($this->demand_reason_id))
853
-            $this->demand_reason_id = 0;
868
+        if (empty($this->availability_id)) {
869
+                    $this->availability_id = 0;
870
+        }
871
+        if (empty($this->demand_reason_id)) {
872
+                    $this->demand_reason_id = 0;
873
+        }
854 874
 
855 875
         // Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate)
856
-        if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx))
857
-            list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date);
858
-        else
859
-            $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
876
+        if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) {
877
+                    list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date);
878
+        } else {
879
+                    $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
880
+        }
860 881
         if (empty($this->fk_multicurrency)) {
861 882
             $this->multicurrency_code = $conf->currency;
862 883
             $this->fk_multicurrency = 0;
@@ -970,8 +991,9 @@  discard block
 block discarded – undo
970 991
 
971 992
                 dol_syslog(get_class($this) . "::create", LOG_DEBUG);
972 993
                 $resql = $this->db->query($sql);
973
-                if (!$resql)
974
-                    $error++;
994
+                if (!$resql) {
995
+                                    $error++;
996
+                }
975 997
 
976 998
                 if (!empty($this->linkedObjectsIds) && empty($this->linked_objects)) { // To use new linkedObjectsIds instead of old linked_objects
977 999
                     $this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds
@@ -1003,8 +1025,9 @@  discard block
 block discarded – undo
1003 1025
                 if (!$error && $this->origin && $this->origin_id) {
1004 1026
                     dol_syslog('Deprecated use of linked object, use ->linkedObjectsIds instead', LOG_WARNING);
1005 1027
                     $ret = $this->add_object_linked();
1006
-                    if (!$ret)
1007
-                        dol_print_error($this->db);
1028
+                    if (!$ret) {
1029
+                                            dol_print_error($this->db);
1030
+                    }
1008 1031
                 }
1009 1032
 
1010 1033
                 /*
@@ -1027,8 +1050,9 @@  discard block
 block discarded – undo
1027 1050
                         }
1028 1051
                         // Complete vat rate with code
1029 1052
                         $vatrate = $line->tva_tx;
1030
-                        if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate))
1031
-                            $vatrate .= ' (' . $line->vat_src_code . ')';
1053
+                        if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) {
1054
+                                                    $vatrate .= ' (' . $line->vat_src_code . ')';
1055
+                        }
1032 1056
 
1033 1057
                         $result = $this->addline(
1034 1058
                             $line->desc, $line->subprice, $line->qty, $vatrate, $line->localtax1_tx, $line->localtax2_tx, $line->fk_product, $line->remise_percent, 'HT', 0, $line->info_bits, $line->product_type, $line->rang, $line->special_code, $fk_parent_line, $line->fk_fournprice, $line->pa_ht, $line->label, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $this->element, $line->id
@@ -1143,8 +1167,9 @@  discard block
 block discarded – undo
1143 1167
         $this->db->begin();
1144 1168
 
1145 1169
         // get extrafields so they will be clone
1146
-        foreach ($this->lines as $line)
1147
-            $line->fetch_optionals();
1170
+        foreach ($this->lines as $line) {
1171
+                    $line->fetch_optionals();
1172
+        }
1148 1173
 
1149 1174
         // Load dest object
1150 1175
         $clonedObj = clone $this;
@@ -1190,22 +1215,25 @@  discard block
 block discarded – undo
1190 1215
         $clonedObj->date = $now;
1191 1216
         $clonedObj->datep = $now;    // deprecated
1192 1217
         $clonedObj->fin_validite = $clonedObj->date + ($clonedObj->duree_validite * 24 * 3600);
1193
-        if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING))
1194
-            $clonedObj->ref_client = '';
1218
+        if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) {
1219
+                    $clonedObj->ref_client = '';
1220
+        }
1195 1221
 
1196 1222
         // Create clone
1197 1223
         $result = $clonedObj->create($user);
1198
-        if ($result < 0)
1199
-            $error++;
1200
-        else {
1224
+        if ($result < 0) {
1225
+                    $error++;
1226
+        } else {
1201 1227
             // copy internal contacts
1202
-            if ($clonedObj->copy_linked_contact($this, 'internal') < 0)
1203
-                $error++;
1228
+            if ($clonedObj->copy_linked_contact($this, 'internal') < 0) {
1229
+                            $error++;
1230
+            }
1204 1231
 
1205 1232
             // copy external contacts if same company
1206 1233
             elseif ($this->socid == $clonedObj->socid) {
1207
-                if ($clonedObj->copy_linked_contact($this, 'external') < 0)
1208
-                    $error++;
1234
+                if ($clonedObj->copy_linked_contact($this, 'external') < 0) {
1235
+                                    $error++;
1236
+                }
1209 1237
             }
1210 1238
         }
1211 1239
 
@@ -1215,8 +1243,9 @@  discard block
 block discarded – undo
1215 1243
                 $parameters = array('objFrom' => $this, 'clonedObj' => $clonedObj);
1216 1244
                 $action = '';
1217 1245
                 $reshook = $hookmanager->executeHooks('createFrom', $parameters, $clonedObj, $action);    // Note that $action and $object may have been modified by some hooks
1218
-                if ($reshook < 0)
1219
-                    $error++;
1246
+                if ($reshook < 0) {
1247
+                                    $error++;
1248
+                }
1220 1249
             }
1221 1250
         }
1222 1251
 
@@ -1280,8 +1309,9 @@  discard block
 block discarded – undo
1280 1309
         if ($ref) {
1281 1310
             $sql .= " WHERE p.entity IN (" . getEntity('propal') . ")"; // Dont't use entity if you use rowid
1282 1311
             $sql .= " AND p.ref='" . $this->db->escape($ref) . "'";
1283
-        } else
1284
-            $sql .= " WHERE p.rowid=" . $rowid;
1312
+        } else {
1313
+                    $sql .= " WHERE p.rowid=" . $rowid;
1314
+        }
1285 1315
 
1286 1316
         dol_syslog(get_class($this) . "::fetch", LOG_DEBUG);
1287 1317
         $resql = $this->db->query($sql);
@@ -1404,18 +1434,24 @@  discard block
 block discarded – undo
1404 1434
         $error = 0;
1405 1435
 
1406 1436
         // Clean parameters
1407
-        if (isset($this->ref))
1408
-            $this->ref = trim($this->ref);
1409
-        if (isset($this->ref_client))
1410
-            $this->ref_client = trim($this->ref_client);
1411
-        if (isset($this->note) || isset($this->note_private))
1412
-            $this->note_private = (isset($this->note_private) ? trim($this->note_private) : trim($this->note));
1413
-        if (isset($this->note_public))
1414
-            $this->note_public = trim($this->note_public);
1415
-        if (isset($this->modelpdf))
1416
-            $this->modelpdf = trim($this->modelpdf);
1417
-        if (isset($this->import_key))
1418
-            $this->import_key = trim($this->import_key);
1437
+        if (isset($this->ref)) {
1438
+                    $this->ref = trim($this->ref);
1439
+        }
1440
+        if (isset($this->ref_client)) {
1441
+                    $this->ref_client = trim($this->ref_client);
1442
+        }
1443
+        if (isset($this->note) || isset($this->note_private)) {
1444
+                    $this->note_private = (isset($this->note_private) ? trim($this->note_private) : trim($this->note));
1445
+        }
1446
+        if (isset($this->note_public)) {
1447
+                    $this->note_public = trim($this->note_public);
1448
+        }
1449
+        if (isset($this->modelpdf)) {
1450
+                    $this->modelpdf = trim($this->modelpdf);
1451
+        }
1452
+        if (isset($this->import_key)) {
1453
+                    $this->import_key = trim($this->import_key);
1454
+        }
1419 1455
 
1420 1456
         // Check parameters
1421 1457
         // Put here code to add control on parameters values
@@ -1465,8 +1501,9 @@  discard block
 block discarded – undo
1465 1501
         if (!$error && !$notrigger) {
1466 1502
             // Call trigger
1467 1503
             $result = $this->call_trigger('PROPAL_MODIFY', $user);
1468
-            if ($result < 0)
1469
-                $error++;
1504
+            if ($result < 0) {
1505
+                            $error++;
1506
+            }
1470 1507
             // End call triggers
1471 1508
         }
1472 1509
 
@@ -1506,8 +1543,9 @@  discard block
 block discarded – undo
1506 1543
         $sql .= ' FROM ' . MAIN_DB_PREFIX . 'propaldet as d';
1507 1544
         $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product as p ON (d.fk_product = p.rowid)';
1508 1545
         $sql .= ' WHERE d.fk_propal = ' . $this->id;
1509
-        if ($only_product)
1510
-            $sql .= ' AND p.fk_product_type = 0';
1546
+        if ($only_product) {
1547
+                    $sql .= ' AND p.fk_product_type = 0';
1548
+        }
1511 1549
         $sql .= ' ORDER by d.rang';
1512 1550
 
1513 1551
         dol_syslog(get_class($this) . "::fetch_lines", LOG_DEBUG);
@@ -1750,8 +1788,9 @@  discard block
 block discarded – undo
1750 1788
             if (!$notrigger && empty($error)) {
1751 1789
                 // Call trigger
1752 1790
                 $result = $this->call_trigger('PROPAL_MODIFY', $user);
1753
-                if ($result < 0)
1754
-                    $error++;
1791
+                if ($result < 0) {
1792
+                                    $error++;
1793
+                }
1755 1794
                 // End call triggers
1756 1795
             }
1757 1796
 
@@ -1805,8 +1844,9 @@  discard block
 block discarded – undo
1805 1844
             if (!$notrigger && empty($error)) {
1806 1845
                 // Call trigger
1807 1846
                 $result = $this->call_trigger('PROPAL_MODIFY', $user);
1808
-                if ($result < 0)
1809
-                    $error++;
1847
+                if ($result < 0) {
1848
+                                    $error++;
1849
+                }
1810 1850
                 // End call triggers
1811 1851
             }
1812 1852
 
@@ -1860,8 +1900,9 @@  discard block
 block discarded – undo
1860 1900
             if (!$notrigger && empty($error)) {
1861 1901
                 // Call trigger
1862 1902
                 $result = $this->call_trigger('PROPAL_MODIFY', $user);
1863
-                if ($result < 0)
1864
-                    $error++;
1903
+                if ($result < 0) {
1904
+                                    $error++;
1905
+                }
1865 1906
                 // End call triggers
1866 1907
             }
1867 1908
 
@@ -1916,8 +1957,9 @@  discard block
 block discarded – undo
1916 1957
             if (!$notrigger && empty($error)) {
1917 1958
                 // Call trigger
1918 1959
                 $result = $this->call_trigger('PROPAL_MODIFY', $user);
1919
-                if ($result < 0)
1920
-                    $error++;
1960
+                if ($result < 0) {
1961
+                                    $error++;
1962
+                }
1921 1963
                 // End call triggers
1922 1964
             }
1923 1965
 
@@ -1980,8 +2022,9 @@  discard block
 block discarded – undo
1980 2022
             if (!$notrigger && empty($error)) {
1981 2023
                 // Call trigger
1982 2024
                 $result = $this->call_trigger('PROPAL_MODIFY', $user);
1983
-                if ($result < 0)
1984
-                    $error++;
2025
+                if ($result < 0) {
2026
+                                    $error++;
2027
+                }
1985 2028
                 // End call triggers
1986 2029
             }
1987 2030
 
@@ -2040,8 +2083,9 @@  discard block
 block discarded – undo
2040 2083
             if (!$notrigger && empty($error)) {
2041 2084
                 // Call trigger
2042 2085
                 $result = $this->call_trigger('PROPAL_MODIFY', $user);
2043
-                if ($result < 0)
2044
-                    $error++;
2086
+                if ($result < 0) {
2087
+                                    $error++;
2088
+                }
2045 2089
                 // End call triggers
2046 2090
             }
2047 2091
 
@@ -2101,8 +2145,9 @@  discard block
 block discarded – undo
2101 2145
             if (!$notrigger && empty($error)) {
2102 2146
                 // Call trigger
2103 2147
                 $result = $this->call_trigger('PROPAL_MODIFY', $user);
2104
-                if ($result < 0)
2105
-                    $error++;
2148
+                if ($result < 0) {
2149
+                                    $error++;
2150
+                }
2106 2151
                 // End call triggers
2107 2152
             }
2108 2153
 
@@ -2161,8 +2206,9 @@  discard block
 block discarded – undo
2161 2206
             if (!$notrigger && empty($error)) {
2162 2207
                 // Call trigger
2163 2208
                 $result = $this->call_trigger('PROPAL_MODIFY', $user);
2164
-                if ($result < 0)
2165
-                    $error++;
2209
+                if ($result < 0) {
2210
+                                    $error++;
2211
+                }
2166 2212
                 // End call triggers
2167 2213
             }
2168 2214
 
@@ -2197,8 +2243,9 @@  discard block
 block discarded – undo
2197 2243
 
2198 2244
         $sql = "UPDATE " . MAIN_DB_PREFIX . "propal";
2199 2245
         $sql .= " SET fk_statut = " . $this->statut . ",";
2200
-        if (!empty($note))
2201
-            $sql .= " note_private = '" . $this->db->escape($note) . "',";
2246
+        if (!empty($note)) {
2247
+                    $sql .= " note_private = '" . $this->db->escape($note) . "',";
2248
+        }
2202 2249
         $sql .= " date_cloture=NULL, fk_user_cloture=NULL";
2203 2250
         $sql .= " WHERE rowid = " . $this->id;
2204 2251
 
@@ -2362,8 +2409,9 @@  discard block
 block discarded – undo
2362 2409
         if (!$notrigger && empty($error)) {
2363 2410
             // Call trigger
2364 2411
             $result = $this->call_trigger('PROPAL_MODIFY', $user);
2365
-            if ($result < 0)
2366
-                $error++;
2412
+            if ($result < 0) {
2413
+                            $error++;
2414
+            }
2367 2415
             // End call triggers
2368 2416
         }
2369 2417
 
@@ -2414,8 +2462,9 @@  discard block
 block discarded – undo
2414 2462
         if (!$notrigger && empty($error)) {
2415 2463
             // Call trigger
2416 2464
             $result = $this->call_trigger('PROPAL_MODIFY', $user);
2417
-            if ($result < 0)
2418
-                $error++;
2465
+            if ($result < 0) {
2466
+                            $error++;
2467
+            }
2419 2468
             // End call triggers
2420 2469
         }
2421 2470
 
@@ -2456,23 +2505,28 @@  discard block
 block discarded – undo
2456 2505
         $sql = "SELECT s.rowid, s.nom as name, s.client,";
2457 2506
         $sql .= " p.rowid as propalid, p.fk_statut, p.total_ht, p.ref, p.remise, ";
2458 2507
         $sql .= " p.datep as dp, p.fin_validite as datelimite";
2459
-        if (!$user->rights->societe->client->voir && !$socid)
2460
-            $sql .= ", sc.fk_soc, sc.fk_user";
2508
+        if (!$user->rights->societe->client->voir && !$socid) {
2509
+                    $sql .= ", sc.fk_soc, sc.fk_user";
2510
+        }
2461 2511
         $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s, " . MAIN_DB_PREFIX . "propal as p, " . MAIN_DB_PREFIX . "c_propalst as c";
2462
-        if (!$user->rights->societe->client->voir && !$socid)
2463
-            $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
2512
+        if (!$user->rights->societe->client->voir && !$socid) {
2513
+                    $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
2514
+        }
2464 2515
         $sql .= " WHERE p.entity IN (" . getEntity('propal') . ")";
2465 2516
         $sql .= " AND p.fk_soc = s.rowid";
2466 2517
         $sql .= " AND p.fk_statut = c.id";
2467 2518
         if (!$user->rights->societe->client->voir && !$socid) { //restriction
2468 2519
             $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
2469 2520
         }
2470
-        if ($socid)
2471
-            $sql .= " AND s.rowid = " . $socid;
2472
-        if ($draft)
2473
-            $sql .= " AND p.fk_statut = " . self::STATUS_DRAFT;
2474
-        if ($notcurrentuser > 0)
2475
-            $sql .= " AND p.fk_user_author <> " . $user->id;
2521
+        if ($socid) {
2522
+                    $sql .= " AND s.rowid = " . $socid;
2523
+        }
2524
+        if ($draft) {
2525
+                    $sql .= " AND p.fk_statut = " . self::STATUS_DRAFT;
2526
+        }
2527
+        if ($notcurrentuser > 0) {
2528
+                    $sql .= " AND p.fk_user_author <> " . $user->id;
2529
+        }
2476 2530
         $sql .= $this->db->order($sortfield, $sortorder);
2477 2531
         $sql .= $this->db->plimit($limit, $offset);
2478 2532
 
@@ -2583,8 +2637,9 @@  discard block
 block discarded – undo
2583 2637
             } else {
2584 2638
                 return -1;
2585 2639
             }
2586
-        } else
2587
-            return $ga;
2640
+        } else {
2641
+                    return $ga;
2642
+        }
2588 2643
     }
2589 2644
 
2590 2645
     /**
@@ -2619,13 +2674,15 @@  discard block
 block discarded – undo
2619 2674
                 if ($this->db->query($sql)) {
2620 2675
                     // Delete linked object
2621 2676
                     $res = $this->deleteObjectLinked();
2622
-                    if ($res < 0)
2623
-                        $error++;
2677
+                    if ($res < 0) {
2678
+                                            $error++;
2679
+                    }
2624 2680
 
2625 2681
                     // Delete linked contacts
2626 2682
                     $res = $this->delete_linked_contact();
2627
-                    if ($res < 0)
2628
-                        $error++;
2683
+                    if ($res < 0) {
2684
+                                            $error++;
2685
+                    }
2629 2686
 
2630 2687
                     if (!$error) {
2631 2688
                         // We remove directory
@@ -2728,8 +2785,9 @@  discard block
 block discarded – undo
2728 2785
             if (!$notrigger && empty($error)) {
2729 2786
                 // Call trigger
2730 2787
                 $result = $this->call_trigger('PROPAL_MODIFY', $user);
2731
-                if ($result < 0)
2732
-                    $error++;
2788
+                if ($result < 0) {
2789
+                                    $error++;
2790
+                }
2733 2791
                 // End call triggers
2734 2792
             }
2735 2793
 
@@ -2791,8 +2849,9 @@  discard block
 block discarded – undo
2791 2849
             if (!$notrigger && empty($error)) {
2792 2850
                 // Call trigger
2793 2851
                 $result = $this->call_trigger('PROPAL_MODIFY', $user);
2794
-                if ($result < 0)
2795
-                    $error++;
2852
+                if ($result < 0) {
2853
+                                    $error++;
2854
+                }
2796 2855
                 // End call triggers
2797 2856
             }
2798 2857
 
@@ -2905,31 +2964,33 @@  discard block
 block discarded – undo
2905 2964
         }
2906 2965
 
2907 2966
         $statuttrans = '';
2908
-        if ($statut == self::STATUS_DRAFT)
2909
-            $statuttrans = 'statut0';
2910
-        elseif ($statut == self::STATUS_VALIDATED)
2911
-            $statuttrans = 'statut1';
2912
-        elseif ($statut == self::STATUS_SIGNED)
2913
-            $statuttrans = 'statut3';
2914
-        elseif ($statut == self::STATUS_NOTSIGNED)
2915
-            $statuttrans = 'statut5';
2916
-        elseif ($statut == self::STATUS_BILLED)
2917
-            $statuttrans = 'statut6';
2918
-
2919
-        if ($mode == 0)
2920
-            return $this->labelstatut[$statut];
2921
-        elseif ($mode == 1)
2922
-            return $this->labelstatut_short[$statut];
2923
-        elseif ($mode == 2)
2924
-            return img_picto($this->labelstatut_short[$statut], $statuttrans) . ' ' . $this->labelstatut_short[$statut];
2925
-        elseif ($mode == 3)
2926
-            return img_picto($this->labelstatut[$statut], $statuttrans);
2927
-        elseif ($mode == 4)
2928
-            return img_picto($this->labelstatut[$statut], $statuttrans) . ' ' . $this->labelstatut[$statut];
2929
-        elseif ($mode == 5)
2930
-            return '<span class="hideonsmartphone">' . $this->labelstatut_short[$statut] . ' </span>' . img_picto($this->labelstatut[$statut], $statuttrans);
2931
-        elseif ($mode == 6)
2932
-            return '<span class="hideonsmartphone">' . $this->labelstatut[$statut] . ' </span>' . img_picto($this->labelstatut[$statut], $statuttrans);
2967
+        if ($statut == self::STATUS_DRAFT) {
2968
+                    $statuttrans = 'statut0';
2969
+        } elseif ($statut == self::STATUS_VALIDATED) {
2970
+                    $statuttrans = 'statut1';
2971
+        } elseif ($statut == self::STATUS_SIGNED) {
2972
+                    $statuttrans = 'statut3';
2973
+        } elseif ($statut == self::STATUS_NOTSIGNED) {
2974
+                    $statuttrans = 'statut5';
2975
+        } elseif ($statut == self::STATUS_BILLED) {
2976
+                    $statuttrans = 'statut6';
2977
+        }
2978
+
2979
+        if ($mode == 0) {
2980
+                    return $this->labelstatut[$statut];
2981
+        } elseif ($mode == 1) {
2982
+                    return $this->labelstatut_short[$statut];
2983
+        } elseif ($mode == 2) {
2984
+                    return img_picto($this->labelstatut_short[$statut], $statuttrans) . ' ' . $this->labelstatut_short[$statut];
2985
+        } elseif ($mode == 3) {
2986
+                    return img_picto($this->labelstatut[$statut], $statuttrans);
2987
+        } elseif ($mode == 4) {
2988
+                    return img_picto($this->labelstatut[$statut], $statuttrans) . ' ' . $this->labelstatut[$statut];
2989
+        } elseif ($mode == 5) {
2990
+                    return '<span class="hideonsmartphone">' . $this->labelstatut_short[$statut] . ' </span>' . img_picto($this->labelstatut[$statut], $statuttrans);
2991
+        } elseif ($mode == 6) {
2992
+                    return '<span class="hideonsmartphone">' . $this->labelstatut[$statut] . ' </span>' . img_picto($this->labelstatut[$statut], $statuttrans);
2993
+        }
2933 2994
     }
2934 2995
 
2935 2996
     // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
@@ -2955,12 +3016,15 @@  discard block
 block discarded – undo
2955 3016
             $clause = " AND";
2956 3017
         }
2957 3018
         $sql .= $clause . " p.entity IN (" . getEntity('propal') . ")";
2958
-        if ($mode == 'opened')
2959
-            $sql .= " AND p.fk_statut = " . self::STATUS_VALIDATED;
2960
-        if ($mode == 'signed')
2961
-            $sql .= " AND p.fk_statut = " . self::STATUS_SIGNED;
2962
-        if ($user->societe_id)
2963
-            $sql .= " AND p.fk_soc = " . $user->societe_id;
3019
+        if ($mode == 'opened') {
3020
+                    $sql .= " AND p.fk_statut = " . self::STATUS_VALIDATED;
3021
+        }
3022
+        if ($mode == 'signed') {
3023
+                    $sql .= " AND p.fk_statut = " . self::STATUS_SIGNED;
3024
+        }
3025
+        if ($user->societe_id) {
3026
+                    $sql .= " AND p.fk_soc = " . $user->societe_id;
3027
+        }
2964 3028
 
2965 3029
         $resql = $this->db->query($sql);
2966 3030
         if ($resql) {
@@ -3270,10 +3334,12 @@  discard block
 block discarded – undo
3270 3334
         $linkend = '</a>';
3271 3335
 
3272 3336
         $result .= $linkstart;
3273
-        if ($withpicto)
3274
-            $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
3275
-        if ($withpicto != 2)
3276
-            $result .= $this->ref;
3337
+        if ($withpicto) {
3338
+                    $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
3339
+        }
3340
+        if ($withpicto != 2) {
3341
+                    $result .= $this->ref;
3342
+        }
3277 3343
         $result .= $linkend;
3278 3344
 
3279 3345
         return $result;
@@ -3566,46 +3632,66 @@  discard block
 block discarded – undo
3566 3632
 
3567 3633
         $pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'.
3568 3634
         // Clean parameters
3569
-        if (empty($this->tva_tx))
3570
-            $this->tva_tx = 0;
3571
-        if (empty($this->localtax1_tx))
3572
-            $this->localtax1_tx = 0;
3573
-        if (empty($this->localtax2_tx))
3574
-            $this->localtax2_tx = 0;
3575
-        if (empty($this->localtax1_type))
3576
-            $this->localtax1_type = 0;
3577
-        if (empty($this->localtax2_type))
3578
-            $this->localtax2_type = 0;
3579
-        if (empty($this->total_localtax1))
3580
-            $this->total_localtax1 = 0;
3581
-        if (empty($this->total_localtax2))
3582
-            $this->total_localtax2 = 0;
3583
-        if (empty($this->rang))
3584
-            $this->rang = 0;
3585
-        if (empty($this->remise))
3586
-            $this->remise = 0;
3587
-        if (empty($this->remise_percent) || !is_numeric($this->remise_percent))
3588
-            $this->remise_percent = 0;
3589
-        if (empty($this->info_bits))
3590
-            $this->info_bits = 0;
3591
-        if (empty($this->special_code))
3592
-            $this->special_code = 0;
3593
-        if (empty($this->fk_parent_line))
3594
-            $this->fk_parent_line = 0;
3595
-        if (empty($this->fk_fournprice))
3596
-            $this->fk_fournprice = 0;
3597
-        if (!is_numeric($this->qty))
3598
-            $this->qty = 0;
3599
-        if (empty($this->pa_ht))
3600
-            $this->pa_ht = 0;
3601
-        if (empty($this->multicurrency_subprice))
3602
-            $this->multicurrency_subprice = 0;
3603
-        if (empty($this->multicurrency_total_ht))
3604
-            $this->multicurrency_total_ht = 0;
3605
-        if (empty($this->multicurrency_total_tva))
3606
-            $this->multicurrency_total_tva = 0;
3607
-        if (empty($this->multicurrency_total_ttc))
3608
-            $this->multicurrency_total_ttc = 0;
3635
+        if (empty($this->tva_tx)) {
3636
+                    $this->tva_tx = 0;
3637
+        }
3638
+        if (empty($this->localtax1_tx)) {
3639
+                    $this->localtax1_tx = 0;
3640
+        }
3641
+        if (empty($this->localtax2_tx)) {
3642
+                    $this->localtax2_tx = 0;
3643
+        }
3644
+        if (empty($this->localtax1_type)) {
3645
+                    $this->localtax1_type = 0;
3646
+        }
3647
+        if (empty($this->localtax2_type)) {
3648
+                    $this->localtax2_type = 0;
3649
+        }
3650
+        if (empty($this->total_localtax1)) {
3651
+                    $this->total_localtax1 = 0;
3652
+        }
3653
+        if (empty($this->total_localtax2)) {
3654
+                    $this->total_localtax2 = 0;
3655
+        }
3656
+        if (empty($this->rang)) {
3657
+                    $this->rang = 0;
3658
+        }
3659
+        if (empty($this->remise)) {
3660
+                    $this->remise = 0;
3661
+        }
3662
+        if (empty($this->remise_percent) || !is_numeric($this->remise_percent)) {
3663
+                    $this->remise_percent = 0;
3664
+        }
3665
+        if (empty($this->info_bits)) {
3666
+                    $this->info_bits = 0;
3667
+        }
3668
+        if (empty($this->special_code)) {
3669
+                    $this->special_code = 0;
3670
+        }
3671
+        if (empty($this->fk_parent_line)) {
3672
+                    $this->fk_parent_line = 0;
3673
+        }
3674
+        if (empty($this->fk_fournprice)) {
3675
+                    $this->fk_fournprice = 0;
3676
+        }
3677
+        if (!is_numeric($this->qty)) {
3678
+                    $this->qty = 0;
3679
+        }
3680
+        if (empty($this->pa_ht)) {
3681
+                    $this->pa_ht = 0;
3682
+        }
3683
+        if (empty($this->multicurrency_subprice)) {
3684
+                    $this->multicurrency_subprice = 0;
3685
+        }
3686
+        if (empty($this->multicurrency_total_ht)) {
3687
+                    $this->multicurrency_total_ht = 0;
3688
+        }
3689
+        if (empty($this->multicurrency_total_tva)) {
3690
+                    $this->multicurrency_total_tva = 0;
3691
+        }
3692
+        if (empty($this->multicurrency_total_ttc)) {
3693
+                    $this->multicurrency_total_ttc = 0;
3694
+        }
3609 3695
 
3610 3696
         // if buy price not defined, define buyprice as configured in margin admin
3611 3697
         if ($this->pa_ht == 0 && $pa_ht_isemptystring) {
@@ -3617,8 +3703,9 @@  discard block
 block discarded – undo
3617 3703
         }
3618 3704
 
3619 3705
         // Check parameters
3620
-        if ($this->product_type < 0)
3621
-            return -1;
3706
+        if ($this->product_type < 0) {
3707
+                    return -1;
3708
+        }
3622 3709
 
3623 3710
         $this->db->begin();
3624 3711
 
@@ -3763,42 +3850,62 @@  discard block
 block discarded – undo
3763 3850
 
3764 3851
         $pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'.
3765 3852
         // Clean parameters
3766
-        if (empty($this->tva_tx))
3767
-            $this->tva_tx = 0;
3768
-        if (empty($this->localtax1_tx))
3769
-            $this->localtax1_tx = 0;
3770
-        if (empty($this->localtax2_tx))
3771
-            $this->localtax2_tx = 0;
3772
-        if (empty($this->total_localtax1))
3773
-            $this->total_localtax1 = 0;
3774
-        if (empty($this->total_localtax2))
3775
-            $this->total_localtax2 = 0;
3776
-        if (empty($this->localtax1_type))
3777
-            $this->localtax1_type = 0;
3778
-        if (empty($this->localtax2_type))
3779
-            $this->localtax2_type = 0;
3780
-        if (empty($this->marque_tx))
3781
-            $this->marque_tx = 0;
3782
-        if (empty($this->marge_tx))
3783
-            $this->marge_tx = 0;
3784
-        if (empty($this->price))
3785
-            $this->price = 0; // TODO A virer
3786
-        if (empty($this->remise))
3787
-            $this->remise = 0; // TODO A virer
3788
-        if (empty($this->remise_percent))
3789
-            $this->remise_percent = 0;
3790
-        if (empty($this->info_bits))
3791
-            $this->info_bits = 0;
3792
-        if (empty($this->special_code))
3793
-            $this->special_code = 0;
3794
-        if (empty($this->fk_parent_line))
3795
-            $this->fk_parent_line = 0;
3796
-        if (empty($this->fk_fournprice))
3797
-            $this->fk_fournprice = 0;
3798
-        if (empty($this->subprice))
3799
-            $this->subprice = 0;
3800
-        if (empty($this->pa_ht))
3801
-            $this->pa_ht = 0;
3853
+        if (empty($this->tva_tx)) {
3854
+                    $this->tva_tx = 0;
3855
+        }
3856
+        if (empty($this->localtax1_tx)) {
3857
+                    $this->localtax1_tx = 0;
3858
+        }
3859
+        if (empty($this->localtax2_tx)) {
3860
+                    $this->localtax2_tx = 0;
3861
+        }
3862
+        if (empty($this->total_localtax1)) {
3863
+                    $this->total_localtax1 = 0;
3864
+        }
3865
+        if (empty($this->total_localtax2)) {
3866
+                    $this->total_localtax2 = 0;
3867
+        }
3868
+        if (empty($this->localtax1_type)) {
3869
+                    $this->localtax1_type = 0;
3870
+        }
3871
+        if (empty($this->localtax2_type)) {
3872
+                    $this->localtax2_type = 0;
3873
+        }
3874
+        if (empty($this->marque_tx)) {
3875
+                    $this->marque_tx = 0;
3876
+        }
3877
+        if (empty($this->marge_tx)) {
3878
+                    $this->marge_tx = 0;
3879
+        }
3880
+        if (empty($this->price)) {
3881
+                    $this->price = 0;
3882
+        }
3883
+        // TODO A virer
3884
+        if (empty($this->remise)) {
3885
+                    $this->remise = 0;
3886
+        }
3887
+        // TODO A virer
3888
+        if (empty($this->remise_percent)) {
3889
+                    $this->remise_percent = 0;
3890
+        }
3891
+        if (empty($this->info_bits)) {
3892
+                    $this->info_bits = 0;
3893
+        }
3894
+        if (empty($this->special_code)) {
3895
+                    $this->special_code = 0;
3896
+        }
3897
+        if (empty($this->fk_parent_line)) {
3898
+                    $this->fk_parent_line = 0;
3899
+        }
3900
+        if (empty($this->fk_fournprice)) {
3901
+                    $this->fk_fournprice = 0;
3902
+        }
3903
+        if (empty($this->subprice)) {
3904
+                    $this->subprice = 0;
3905
+        }
3906
+        if (empty($this->pa_ht)) {
3907
+                    $this->pa_ht = 0;
3908
+        }
3802 3909
 
3803 3910
         // if buy price not defined, define buyprice as configured in margin admin
3804 3911
         if ($this->pa_ht == 0 && $pa_ht_isemptystring) {
@@ -3837,11 +3944,13 @@  discard block
 block discarded – undo
3837 3944
         }
3838 3945
         $sql .= ", fk_product_fournisseur_price=" . (!empty($this->fk_fournprice) ? "'" . $this->db->escape($this->fk_fournprice) . "'" : "null");
3839 3946
         $sql .= ", buy_price_ht=" . price2num($this->pa_ht);
3840
-        if (strlen($this->special_code))
3841
-            $sql .= ", special_code=" . $this->special_code;
3947
+        if (strlen($this->special_code)) {
3948
+                    $sql .= ", special_code=" . $this->special_code;
3949
+        }
3842 3950
         $sql .= ", fk_parent_line=" . ($this->fk_parent_line > 0 ? $this->fk_parent_line : "null");
3843
-        if (!empty($this->rang))
3844
-            $sql .= ", rang=" . $this->rang;
3951
+        if (!empty($this->rang)) {
3952
+                    $sql .= ", rang=" . $this->rang;
3953
+        }
3845 3954
         $sql .= ", date_start=" . (!empty($this->date_start) ? "'" . $this->db->idate($this->date_start) . "'" : "null");
3846 3955
         $sql .= ", date_end=" . (!empty($this->date_end) ? "'" . $this->db->idate($this->date_end) . "'" : "null");
3847 3956
         $sql .= ", fk_unit=" . (!$this->fk_unit ? 'NULL' : $this->fk_unit);
Please login to merge, or discard this patch.
dolibarr/htdocs/comm/propal/note.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -27,23 +27,23 @@  discard block
 block discarded – undo
27 27
  *	\ingroup    propal
28 28
  *	\brief      Fiche d'information sur une proposition commerciale
29 29
  */
30
-require DOL_BASE_PATH . '/main.inc.php';
30
+require DOL_BASE_PATH.'/main.inc.php';
31 31
 
32 32
 require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
33 33
 require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
34
-if (! empty($conf->projet->enabled)) {
35
-	require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
34
+if (!empty($conf->projet->enabled)) {
35
+	require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
36 36
 }
37 37
 
38 38
 // Load translation files required by the page
39 39
 $langs->loadLangs(array('propal', 'compta', 'bills', 'companies'));
40 40
 
41
-$id = GETPOST('id','int');
42
-$ref=GETPOST('ref','alpha');
43
-$action=GETPOST('action','alpha');
41
+$id = GETPOST('id', 'int');
42
+$ref = GETPOST('ref', 'alpha');
43
+$action = GETPOST('action', 'alpha');
44 44
 
45 45
 // Security check
46
-if ($user->societe_id) $socid=$user->societe_id;
46
+if ($user->societe_id) $socid = $user->societe_id;
47 47
 $result = restrictedArea($user, 'propale', $id, 'propal');
48 48
 
49 49
 $object = new Propal($db);
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
  * Actions
54 54
  */
55 55
 
56
-$permissionnote=$user->rights->propale->creer;	// Used by the include of actions_setnotes.inc.php
56
+$permissionnote = $user->rights->propale->creer; // Used by the include of actions_setnotes.inc.php
57 57
 
58
-include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php';	// Must be include, not includ_once
58
+include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
59 59
 
60 60
 
61 61
 
@@ -63,15 +63,15 @@  discard block
 block discarded – undo
63 63
  * View
64 64
  */
65 65
 
66
-llxHeader('',$langs->trans('Proposal'),'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos');
66
+llxHeader('', $langs->trans('Proposal'), 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos');
67 67
 
68 68
 $form = new Form($db);
69 69
 
70
-if ($id > 0 || ! empty($ref))
70
+if ($id > 0 || !empty($ref))
71 71
 {
72 72
 	if ($mesg) print $mesg;
73 73
 
74
-	$now=dol_now();
74
+	$now = dol_now();
75 75
 
76 76
 	if ($object->fetch($id, $ref) > 0)
77 77
 	{
@@ -80,63 +80,63 @@  discard block
 block discarded – undo
80 80
 		    $head = propal_prepare_head($object);
81 81
 			dol_fiche_head($head, 'note', $langs->trans('Proposal'), -1, 'propal');
82 82
 
83
-			$cssclass='titlefield';
83
+			$cssclass = 'titlefield';
84 84
 			//if ($action == 'editnote_public') $cssclass='titlefieldcreate';
85 85
 			//if ($action == 'editnote_private') $cssclass='titlefieldcreate';
86 86
 
87 87
 
88 88
 			// Proposal card
89 89
 
90
-			$linkback = '<a href="' . DOL_URL_ROOT . '/comm/propal/list.php?restore_lastsearch_values=1' . (! empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
90
+			$linkback = '<a href="'.DOL_URL_ROOT.'/comm/propal/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
91 91
 
92 92
 
93
-			$morehtmlref='<div class="refidno">';
93
+			$morehtmlref = '<div class="refidno">';
94 94
 			// Ref customer
95
-			$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
96
-			$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
95
+			$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
96
+			$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
97 97
 			// Thirdparty
98
-			$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
98
+			$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
99 99
 			// Project
100
-			if (! empty($conf->projet->enabled))
100
+			if (!empty($conf->projet->enabled))
101 101
 			{
102 102
 			    $langs->load("projects");
103
-			    $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
103
+			    $morehtmlref .= '<br>'.$langs->trans('Project').' ';
104 104
 			    if ($user->rights->propal->creer)
105 105
 			    {
106 106
 			        if ($action != 'classify')
107 107
 			            //$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a>';
108
-			            $morehtmlref.=' : ';
108
+			            $morehtmlref .= ' : ';
109 109
 			            if ($action == 'classify') {
110 110
 			                //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
111
-			                $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
112
-			                $morehtmlref.='<input type="hidden" name="action" value="classin">';
113
-			                $morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
114
-			                $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
115
-			                $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
116
-			                $morehtmlref.='</form>';
111
+			                $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
112
+			                $morehtmlref .= '<input type="hidden" name="action" value="classin">';
113
+			                $morehtmlref .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
114
+			                $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
115
+			                $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
116
+			                $morehtmlref .= '</form>';
117 117
 			            } else {
118
-			                $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
118
+			                $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
119 119
 			            }
120 120
 			    } else {
121
-			        if (! empty($object->fk_project)) {
121
+			        if (!empty($object->fk_project)) {
122 122
 			            $proj = new Project($db);
123 123
 			            $proj->fetch($object->fk_project);
124
-			            $morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
125
-			            $morehtmlref.=$proj->ref;
126
-			            $morehtmlref.='</a>';
124
+			            $morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
125
+			            $morehtmlref .= $proj->ref;
126
+			            $morehtmlref .= '</a>';
127 127
 			        } else {
128
-			            $morehtmlref.='';
128
+			            $morehtmlref .= '';
129 129
 			        }
130 130
 			    }
131 131
 			}
132
-			$morehtmlref.='</div>';
132
+			$morehtmlref .= '</div>';
133 133
 
134 134
 			dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
135 135
 
136 136
 			print '<div class="fichecenter">';
137 137
 			print '<div class="underbanner clearboth"></div>';
138 138
 
139
-			$cssclass="titlefield";
139
+			$cssclass = "titlefield";
140 140
 			include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
141 141
 
142 142
 			print '</div>';
Please login to merge, or discard this patch.
dolibarr/htdocs/comm/propal/list.php 2 patches
Spacing   +155 added lines, -155 removed lines patch added patch discarded remove patch
@@ -35,16 +35,16 @@  discard block
 block discarded – undo
35 35
  * 	\ingroup    	propal
36 36
  * 	\brief      	Page of commercial proposals card and list
37 37
  */
38
-require DOL_BASE_PATH . '/main.inc.php';
38
+require DOL_BASE_PATH.'/main.inc.php';
39 39
 
40
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
41
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
42
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formpropal.class.php';
43
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
44
-require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
45
-require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
46
-require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
47
-require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
40
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
41
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
42
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formpropal.class.php';
43
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
44
+require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
45
+require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
46
+require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
47
+require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
48 48
 
49 49
 // Load translation files required by the page
50 50
 $langs->loadLangs(array('companies', 'propal', 'compta', 'bills', 'orders', 'products', 'deliveries', 'categories'));
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 }
130 130
 $result = restrictedArea($user, $module, $objectid, $dbtable);
131 131
 
132
-$diroutputmassaction = $conf->propal->multidir_output[$conf->entity] . '/temp/massgeneration/' . $user->id;
132
+$diroutputmassaction = $conf->propal->multidir_output[$conf->entity].'/temp/massgeneration/'.$user->id;
133 133
 
134 134
 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
135 135
 $object = new Propal($db);
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) {
183 183
     foreach ($extrafields->attribute_label as $key => $val) {
184 184
         if (!empty($extrafields->attribute_list[$key])) {
185
-            $arrayfields["ef." . $key] = array('label' => $extrafields->attribute_label[$key], 'checked' => (($extrafields->attribute_list[$key] < 0) ? 0 : 1), 'position' => $extrafields->attribute_pos[$key], 'enabled' => (abs($extrafields->attribute_list[$key]) != 3 && $extrafields->attribute_perms[$key]));
185
+            $arrayfields["ef.".$key] = array('label' => $extrafields->attribute_label[$key], 'checked' => (($extrafields->attribute_list[$key] < 0) ? 0 : 1), 'position' => $extrafields->attribute_pos[$key], 'enabled' => (abs($extrafields->attribute_list[$key]) != 3 && $extrafields->attribute_perms[$key]));
186 186
         }
187 187
     }
188 188
 }
@@ -200,12 +200,12 @@  discard block
 block discarded – undo
200 200
 }
201 201
 
202 202
 $parameters = array('socid' => $socid);
203
-$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);    // Note that $action and $object may have been modified by some hooks
203
+$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
204 204
 if ($reshook < 0) {
205 205
     setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
206 206
 }
207 207
 
208
-include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php';
208
+include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
209 209
 
210 210
 // Do we click on purge search criteria ?
211 211
 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
     $permtodelete = $user->rights->propal->supprimer;
254 254
     $permtoclose = $user->rights->propal->cloturer;
255 255
     $uploaddir = $conf->propal->multidir_output[$conf->entity];
256
-    include DOL_DOCUMENT_ROOT . '/core/actions_massactions.inc.php';
256
+    include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
257 257
 }
258 258
 
259 259
 
@@ -296,45 +296,45 @@  discard block
 block discarded – undo
296 296
 
297 297
 // Add fields from extrafields
298 298
 foreach ($extrafields->attribute_label as $key => $val) {
299
-    $sql .= ($extrafields->attribute_type[$key] != 'separate' ? ",ef." . $key . ' as options_' . $key : '');
299
+    $sql .= ($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
300 300
 }
301 301
 // Add fields from hooks
302 302
 $parameters = array();
303
-$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters);    // Note that $action and $object may have been modified by hook
303
+$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
304 304
 $sql .= $hookmanager->resPrint;
305
-$sql .= ' FROM ' . MAIN_DB_PREFIX . 'societe as s';
306
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as country on (country.rowid = s.fk_pays)";
307
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_typent as typent on (typent.id = s.fk_typent)";
308
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_departements as state on (state.rowid = s.fk_departement)";
305
+$sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
306
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
307
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
308
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
309 309
 if (!empty($search_categ_cus)) {
310
-    $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . "categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
310
+    $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
311 311
 }
312 312
 
313
-$sql .= ', ' . MAIN_DB_PREFIX . 'propal as p';
313
+$sql .= ', '.MAIN_DB_PREFIX.'propal as p';
314 314
 if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) {
315
-    $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "propal_extrafields as ef on (p.rowid = ef.fk_object)";
315
+    $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."propal_extrafields as ef on (p.rowid = ef.fk_object)";
316 316
 }
317 317
 if ($sall || $search_product_category > 0) {
318
-    $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'propaldet as pd ON p.rowid=pd.fk_propal';
318
+    $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'propaldet as pd ON p.rowid=pd.fk_propal';
319 319
 }
320 320
 if ($search_product_category > 0) {
321
-    $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'categorie_product as cp ON cp.fk_product=pd.fk_product';
321
+    $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product';
322 322
 }
323
-$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'user as u ON p.fk_user_author = u.rowid';
324
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "projet as pr ON pr.rowid = p.fk_projet";
325
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_availability as ava on (ava.rowid = p.fk_availability)";
323
+$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON p.fk_user_author = u.rowid';
324
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as pr ON pr.rowid = p.fk_projet";
325
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_availability as ava on (ava.rowid = p.fk_availability)";
326 326
 // We'll need this table joined to the select in order to filter by sale
327 327
 if ($search_sale > 0 || (!$user->rights->societe->client->voir && !$socid)) {
328
-    $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
328
+    $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
329 329
 }
330 330
 if ($search_user > 0) {
331
-    $sql .= ", " . MAIN_DB_PREFIX . "element_contact as c";
332
-    $sql .= ", " . MAIN_DB_PREFIX . "c_type_contact as tc";
331
+    $sql .= ", ".MAIN_DB_PREFIX."element_contact as c";
332
+    $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
333 333
 }
334 334
 $sql .= ' WHERE p.fk_soc = s.rowid';
335
-$sql .= ' AND p.entity IN (' . getEntity('propal') . ')';
335
+$sql .= ' AND p.entity IN ('.getEntity('propal').')';
336 336
 if (!$user->rights->societe->client->voir && !$socid) { //restriction
337
-    $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
337
+    $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
338 338
 }
339 339
 if ($search_town) {
340 340
     $sql .= natural_search('s.town', $search_town);
@@ -346,10 +346,10 @@  discard block
 block discarded – undo
346 346
     $sql .= natural_search("state.nom", $search_state);
347 347
 }
348 348
 if ($search_country) {
349
-    $sql .= " AND s.fk_pays IN (" . $db->escape($search_country) . ')';
349
+    $sql .= " AND s.fk_pays IN (".$db->escape($search_country).')';
350 350
 }
351 351
 if ($search_type_thirdparty) {
352
-    $sql .= " AND s.fk_typent IN (" . $db->escape($search_type_thirdparty) . ')';
352
+    $sql .= " AND s.fk_typent IN (".$db->escape($search_type_thirdparty).')';
353 353
 }
354 354
 if ($search_ref) {
355 355
     $sql .= natural_search('p.ref', $search_ref);
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
     $sql .= natural_search('pr.ref', $search_refproject);
362 362
 }
363 363
 if ($search_availability) {
364
-    $sql .= " AND p.fk_availability IN (" . $db->escape($search_availability) . ')';
364
+    $sql .= " AND p.fk_availability IN (".$db->escape($search_availability).')';
365 365
 }
366 366
 
367 367
 if ($search_societe) {
@@ -383,36 +383,36 @@  discard block
 block discarded – undo
383 383
     $sql .= natural_search(array_keys($fieldstosearchall), $sall);
384 384
 }
385 385
 if ($search_categ_cus > 0) {
386
-    $sql .= " AND cc.fk_categorie = " . $db->escape($search_categ_cus);
386
+    $sql .= " AND cc.fk_categorie = ".$db->escape($search_categ_cus);
387 387
 }
388 388
 if ($search_categ_cus == -2) {
389 389
     $sql .= " AND cc.fk_categorie IS NULL";
390 390
 }
391 391
 
392 392
 if ($search_product_category > 0) {
393
-    $sql .= " AND cp.fk_categorie = " . $db->escape($search_product_category);
393
+    $sql .= " AND cp.fk_categorie = ".$db->escape($search_product_category);
394 394
 }
395 395
 if ($socid > 0) {
396
-    $sql .= ' AND s.rowid = ' . $socid;
396
+    $sql .= ' AND s.rowid = '.$socid;
397 397
 }
398 398
 if ($viewstatut != '' && $viewstatut != '-1') {
399
-    $sql .= ' AND p.fk_statut IN (' . $db->escape($viewstatut) . ')';
399
+    $sql .= ' AND p.fk_statut IN ('.$db->escape($viewstatut).')';
400 400
 }
401 401
 $sql .= dolSqlDateFilter("p.datep", $search_day, $search_month, $search_year);
402 402
 $sql .= dolSqlDateFilter("p.fin_validite", $search_dayfin, $search_month_end, $search_yearfin);
403 403
 $sql .= dolSqlDateFilter("p.date_livraison", $search_daydelivery, $search_monthdelivery, $search_yeardelivery);
404 404
 if ($search_sale > 0) {
405
-    $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $db->escape($search_sale);
405
+    $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$db->escape($search_sale);
406 406
 }
407 407
 if ($search_user > 0) {
408
-    $sql .= " AND c.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = " . $db->escape($search_user);
408
+    $sql .= " AND c.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".$db->escape($search_user);
409 409
 }
410 410
 // Add where from extra fields
411
-include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_sql.tpl.php';
411
+include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
412 412
 
413 413
 // Add where from hooks
414 414
 $parameters = array();
415
-$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters);    // Note that $action and $object may have been modified by hook
415
+$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
416 416
 $sql .= $hookmanager->resPrint;
417 417
 
418 418
 $sql .= $db->order($sortfield, $sortorder);
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
     if ($socid > 0) {
442 442
         $soc = new Societe($db);
443 443
         $soc->fetch($socid);
444
-        $title = $langs->trans('ListOfProposals') . ' - ' . $soc->name;
444
+        $title = $langs->trans('ListOfProposals').' - '.$soc->name;
445 445
         if (empty($search_societe))
446 446
             $search_societe = $soc->name;
447 447
     }
@@ -458,76 +458,76 @@  discard block
 block discarded – undo
458 458
 
459 459
         $id = $obj->rowid;
460 460
 
461
-        header("Location: " . DOL_URL_ROOT . '/comm/propal/card.php?id=' . $id);
461
+        header("Location: ".DOL_URL_ROOT.'/comm/propal/card.php?id='.$id);
462 462
         exit;
463 463
     }
464 464
 
465 465
     llxHeader('', $langs->trans('Proposal'), $help_url);
466 466
 
467
-    $param = '&viewstatut=' . urlencode($viewstatut);
467
+    $param = '&viewstatut='.urlencode($viewstatut);
468 468
     if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
469
-        $param .= '&contextpage=' . urlencode($contextpage);
469
+        $param .= '&contextpage='.urlencode($contextpage);
470 470
     }
471 471
     if ($limit > 0 && $limit != $conf->liste_limit) {
472
-        $param .= '&limit=' . urlencode($limit);
472
+        $param .= '&limit='.urlencode($limit);
473 473
     }
474 474
     if ($sall) {
475
-        $param .= '&sall=' . urlencode($sall);
475
+        $param .= '&sall='.urlencode($sall);
476 476
     }
477 477
     if ($search_day) {
478
-        $param .= '&search_day=' . urlencode($search_day);
478
+        $param .= '&search_day='.urlencode($search_day);
479 479
     }
480 480
     if ($search_month) {
481
-        $param .= '&search_month=' . urlencode($search_month);
481
+        $param .= '&search_month='.urlencode($search_month);
482 482
     }
483 483
     if ($search_year) {
484
-        $param .= '&search_year=' . urlencode($search_year);
484
+        $param .= '&search_year='.urlencode($search_year);
485 485
     }
486 486
     if ($search_ref) {
487
-        $param .= '&search_ref=' . urlencode($search_ref);
487
+        $param .= '&search_ref='.urlencode($search_ref);
488 488
     }
489 489
     if ($search_refcustomer) {
490
-        $param .= '&search_refcustomer=' . urlencode($search_refcustomer);
490
+        $param .= '&search_refcustomer='.urlencode($search_refcustomer);
491 491
     }
492 492
     if ($search_refproject) {
493
-        $param .= '&search_refproject=' . urlencode($search_refproject);
493
+        $param .= '&search_refproject='.urlencode($search_refproject);
494 494
     }
495 495
     if ($search_societe) {
496
-        $param .= '&search_societe=' . urlencode($search_societe);
496
+        $param .= '&search_societe='.urlencode($search_societe);
497 497
     }
498 498
     if ($search_user > 0) {
499
-        $param .= '&search_user=' . urlencode($search_user);
499
+        $param .= '&search_user='.urlencode($search_user);
500 500
     }
501 501
     if ($search_sale > 0) {
502
-        $param .= '&search_sale=' . urlencode($search_sale);
502
+        $param .= '&search_sale='.urlencode($search_sale);
503 503
     }
504 504
     if ($search_montant_ht) {
505
-        $param .= '&search_montant_ht=' . urlencode($search_montant_ht);
505
+        $param .= '&search_montant_ht='.urlencode($search_montant_ht);
506 506
     }
507 507
     if ($search_login) {
508
-        $param .= '&search_login=' . urlencode($search_login);
508
+        $param .= '&search_login='.urlencode($search_login);
509 509
     }
510 510
     if ($search_town) {
511
-        $param .= '&search_town=' . urlencode($search_town);
511
+        $param .= '&search_town='.urlencode($search_town);
512 512
     }
513 513
     if ($search_zip) {
514
-        $param .= '&search_zip=' . urlencode($search_zip);
514
+        $param .= '&search_zip='.urlencode($search_zip);
515 515
     }
516 516
     if ($socid > 0) {
517
-        $param .= '&socid=' . urlencode($socid);
517
+        $param .= '&socid='.urlencode($socid);
518 518
     }
519 519
     if ($optioncss != '') {
520
-        $param .= '&optioncss=' . urlencode($optioncss);
520
+        $param .= '&optioncss='.urlencode($optioncss);
521 521
     }
522 522
     if ($search_categ_cus > 0) {
523
-        $param .= '&search_categ_cus=' . urlencode($search_categ_cus);
523
+        $param .= '&search_categ_cus='.urlencode($search_categ_cus);
524 524
     }
525 525
     if ($search_product_category != '') {
526
-        $param .= '&search_product_category=' . $search_product_category;
526
+        $param .= '&search_product_category='.$search_product_category;
527 527
     }
528 528
 
529 529
     // Add $param from extra fields
530
-    include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_param.tpl.php';
530
+    include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
531 531
 
532 532
     // List of mass actions available
533 533
     $arrayofmassactions = array(
@@ -549,38 +549,38 @@  discard block
 block discarded – undo
549 549
     $newcardbutton = '';
550 550
     if ($user->rights->propal->creer) {
551 551
         // $newcardbutton = '<a class="butActionNew" href="' . DOL_URL_ROOT . '/comm/propal/card.php?action=create"><span class="valignmiddle">' . $langs->trans('NewPropal') . '</span>';
552
-        $newcardbutton = '<a class="butActionNew" href = "' . BASE_URI . '?controller=comm/propal&method=card&action=create"><span class="valignmiddle">' . $langs->trans('NewPropal') . '</span>';
552
+        $newcardbutton = '<a class="butActionNew" href = "'.BASE_URI.'?controller=comm/propal&method=card&action=create"><span class="valignmiddle">'.$langs->trans('NewPropal').'</span>';
553 553
         $newcardbutton .= '<span class="fa fa-plus-circle valignmiddle"></span>';
554 554
         $newcardbutton .= '</a>';
555 555
     }
556 556
 
557 557
     // Lignes des champs de filtre
558
-    print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
558
+    print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
559 559
     if ($optioncss != '') {
560
-        print '<input type="hidden" name="optioncss" value="' . $optioncss . '">';
560
+        print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
561 561
     }
562
-    print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
562
+    print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
563 563
     print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
564 564
     print '<input type="hidden" name="action" value="list">';
565
-    print '<input type="hidden" name="sortfield" value="' . $sortfield . '">';
566
-    print '<input type="hidden" name="sortorder" value="' . $sortorder . '">';
567
-    print '<input type="hidden" name="page" value="' . $page . '">';
568
-    print '<input type="hidden" name="contextpage" value="' . $contextpage . '">';
565
+    print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
566
+    print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
567
+    print '<input type="hidden" name="page" value="'.$page.'">';
568
+    print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
569 569
 
570 570
     print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, $newcardbutton, '', $limit);
571 571
 
572 572
     $topicmail = "SendPropalRef";
573 573
     $modelmail = "proposal_send";
574 574
     $objecttmp = new Propal($db);
575
-    $trackid = 'pro' . $object->id;
575
+    $trackid = 'pro'.$object->id;
576 576
 
577
-    include DOL_DOCUMENT_ROOT . '/core/tpl/massactions_pre.tpl.php';
577
+    include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
578 578
 
579 579
     if ($sall) {
580 580
         foreach ($fieldstosearchall as $key => $val) {
581 581
             $fieldstosearchall[$key] = $langs->trans($val);
582 582
         }
583
-        print '<div class="divsearchfieldfilter">' . $langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall) . '</div>';
583
+        print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
584 584
     }
585 585
 
586 586
     $i = 0;
@@ -591,35 +591,35 @@  discard block
 block discarded – undo
591 591
     if ($user->rights->societe->client->voir || $socid) {
592 592
         $langs->load("commercial");
593 593
         $moreforfilter .= '<div class="divsearchfield">';
594
-        $moreforfilter .= $langs->trans('ThirdPartiesOfSaleRepresentative') . ': ';
594
+        $moreforfilter .= $langs->trans('ThirdPartiesOfSaleRepresentative').': ';
595 595
         $moreforfilter .= $formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth200');
596 596
         $moreforfilter .= '</div>';
597 597
     }
598 598
     // If the user can view prospects other than his'
599 599
     if ($user->rights->societe->client->voir || $socid) {
600 600
         $moreforfilter .= '<div class="divsearchfield">';
601
-        $moreforfilter .= $langs->trans('LinkedToSpecificUsers') . ': ';
601
+        $moreforfilter .= $langs->trans('LinkedToSpecificUsers').': ';
602 602
         $moreforfilter .= $form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200');
603 603
         $moreforfilter .= '</div>';
604 604
     }
605 605
     // If the user can view products
606 606
     if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire)) {
607
-        include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
607
+        include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
608 608
         $moreforfilter .= '<div class="divsearchfield">';
609
-        $moreforfilter .= $langs->trans('IncludingProductWithTag') . ': ';
609
+        $moreforfilter .= $langs->trans('IncludingProductWithTag').': ';
610 610
         $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
611 611
         $moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
612 612
         $moreforfilter .= '</div>';
613 613
     }
614 614
     if (!empty($conf->categorie->enabled)) {
615
-        require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
615
+        require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
616 616
         $moreforfilter .= '<div class="divsearchfield">';
617
-        $moreforfilter .= $langs->trans('CustomersProspectsCategoriesShort') . ': ';
617
+        $moreforfilter .= $langs->trans('CustomersProspectsCategoriesShort').': ';
618 618
         $moreforfilter .= $formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1);
619 619
         $moreforfilter .= '</div>';
620 620
     }
621 621
     $parameters = array();
622
-    $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters);    // Note that $action and $object may have been modified by hook
622
+    $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
623 623
     if (empty($reshook)) {
624 624
         $moreforfilter .= $hookmanager->resPrint;
625 625
     } else {
@@ -637,37 +637,37 @@  discard block
 block discarded – undo
637 637
     $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
638 638
 
639 639
     print '<div class="div-table-responsive">';
640
-    print '<table class="tagtable liste' . ($moreforfilter ? " listwithfilterbefore" : "") . '">' . "\n";
640
+    print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
641 641
 
642 642
     print '<tr class="liste_titre_filter">';
643 643
     if (!empty($arrayfields['p.ref']['checked'])) {
644 644
         print '<td class="liste_titre">';
645
-        print '<input class="flat" size="6" type="text" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '">';
645
+        print '<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
646 646
         print '</td>';
647 647
     }
648 648
     if (!empty($arrayfields['p.ref_client']['checked'])) {
649 649
         print '<td class="liste_titre">';
650
-        print '<input class="flat" size="6" type="text" name="search_refcustomer" value="' . dol_escape_htmltag($search_refcustomer) . '">';
650
+        print '<input class="flat" size="6" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).'">';
651 651
         print '</td>';
652 652
     }
653 653
     if (!empty($arrayfields['pr.ref']['checked'])) {
654 654
         print '<td class="liste_titre">';
655
-        print '<input class="flat" size="6" type="text" name="search_refproject" value="' . dol_escape_htmltag($search_refproject) . '">';
655
+        print '<input class="flat" size="6" type="text" name="search_refproject" value="'.dol_escape_htmltag($search_refproject).'">';
656 656
         print '</td>';
657 657
     }
658 658
     if (!empty($arrayfields['s.nom']['checked'])) {
659 659
         print '<td class="liste_titre" align="left">';
660
-        print '<input class="flat" type="text" size="10" name="search_societe" value="' . dol_escape_htmltag($search_societe) . '">';
660
+        print '<input class="flat" type="text" size="10" name="search_societe" value="'.dol_escape_htmltag($search_societe).'">';
661 661
         print '</td>';
662 662
     }
663 663
     if (!empty($arrayfields['s.town']['checked']))
664
-        print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="' . $search_town . '"></td>';
664
+        print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
665 665
     if (!empty($arrayfields['s.zip']['checked']))
666
-        print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="' . $search_zip . '"></td>';
666
+        print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.$search_zip.'"></td>';
667 667
     // State
668 668
     if (!empty($arrayfields['state.nom']['checked'])) {
669 669
         print '<td class="liste_titre">';
670
-        print '<input class="flat" size="4" type="text" name="search_state" value="' . dol_escape_htmltag($search_state) . '">';
670
+        print '<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
671 671
         print '</td>';
672 672
     }
673 673
     // Country
@@ -688,8 +688,8 @@  discard block
 block discarded – undo
688 688
         print '<td class="liste_titre nowraponall" align="center">';
689 689
         //print $langs->trans('Month').': ';
690 690
         if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY))
691
-            print '<input class="flat width25" type="text" maxlength="2" name="search_day" value="' . dol_escape_htmltag($search_day) . '">';
692
-        print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_month" value="' . dol_escape_htmltag($search_month) . '">';
691
+            print '<input class="flat width25" type="text" maxlength="2" name="search_day" value="'.dol_escape_htmltag($search_day).'">';
692
+        print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_month" value="'.dol_escape_htmltag($search_month).'">';
693 693
         //print '&nbsp;'.$langs->trans('Year').': ';
694 694
         $formother->select_year($search_year, 'search_year', 1, 20, 5);
695 695
         print '</td>';
@@ -699,8 +699,8 @@  discard block
 block discarded – undo
699 699
         print '<td class="liste_titre nowraponall" align="center">';
700 700
         //print $langs->trans('Month').': ';
701 701
         if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY))
702
-            print '<input class="flat width25" type="text" maxlength="2" name="search_dayfin" value="' . dol_escape_htmltag($search_dayfin) . '">';
703
-        print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_month_end" value="' . dol_escape_htmltag($search_month_end) . '">';
702
+            print '<input class="flat width25" type="text" maxlength="2" name="search_dayfin" value="'.dol_escape_htmltag($search_dayfin).'">';
703
+        print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_month_end" value="'.dol_escape_htmltag($search_month_end).'">';
704 704
         //print '&nbsp;'.$langs->trans('Year').': ';
705 705
         $formother->select_year($search_yearfin, 'search_yearfin', 1, 20, 5);
706 706
         print '</td>';
@@ -710,8 +710,8 @@  discard block
 block discarded – undo
710 710
         print '<td class="liste_titre nowraponall" align="center">';
711 711
         //print $langs->trans('Month').': ';
712 712
         if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY))
713
-            print '<input class="flat width25" type="text" size="1" maxlength="2" name="search_daydelivery" value="' . dol_escape_htmltag($search_daydelivery) . '">';
714
-        print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_monthdelivery" value="' . dol_escape_htmltag($search_monthdelivery) . '">';
713
+            print '<input class="flat width25" type="text" size="1" maxlength="2" name="search_daydelivery" value="'.dol_escape_htmltag($search_daydelivery).'">';
714
+        print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_monthdelivery" value="'.dol_escape_htmltag($search_monthdelivery).'">';
715 715
         //print '&nbsp;'.$langs->trans('Year').': ';
716 716
         $formother->select_year($search_yeardelivery, 'search_yeardelivery', 1, 20, 5);
717 717
         print '</td>';
@@ -726,36 +726,36 @@  discard block
 block discarded – undo
726 726
     if (!empty($arrayfields['p.total_ht']['checked'])) {
727 727
         // Amount
728 728
         print '<td class="liste_titre" align="right">';
729
-        print '<input class="flat" type="text" size="5" name="search_montant_ht" value="' . dol_escape_htmltag($search_montant_ht) . '">';
729
+        print '<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).'">';
730 730
         print '</td>';
731 731
     }
732 732
     if (!empty($arrayfields['p.total_vat']['checked'])) {
733 733
         // Amount
734 734
         print '<td class="liste_titre" align="right">';
735
-        print '<input class="flat" type="text" size="5" name="search_montant_vat" value="' . dol_escape_htmltag($search_montant_vat) . '">';
735
+        print '<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).'">';
736 736
         print '</td>';
737 737
     }
738 738
     if (!empty($arrayfields['p.total_ttc']['checked'])) {
739 739
         // Amount
740 740
         print '<td class="liste_titre" align="right">';
741
-        print '<input class="flat" type="text" size="5" name="search_montant_ttc" value="' . dol_escape_htmltag($search_montant_ttc) . '">';
741
+        print '<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).'">';
742 742
         print '</td>';
743 743
     }
744 744
     if (!empty($arrayfields['u.login']['checked'])) {
745 745
         // Author
746 746
         print '<td class="liste_titre" align="center">';
747
-        print '<input class="flat" size="4" type="text" name="search_login" value="' . dol_escape_htmltag($search_login) . '">';
747
+        print '<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'">';
748 748
         print '</td>';
749 749
     }
750 750
     if (!empty($arrayfields['sale_representative']['checked'])) {
751 751
         print '<td class="liste_titre"></td>';
752 752
     }
753 753
     // Extra fields
754
-    include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_input.tpl.php';
754
+    include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
755 755
 
756 756
     // Fields from hook
757 757
     $parameters = array('arrayfields' => $arrayfields);
758
-    $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters);    // Note that $action and $object may have been modified by hook
758
+    $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
759 759
     print $hookmanager->resPrint;
760 760
     // Date creation
761 761
     if (!empty($arrayfields['p.datec']['checked'])) {
@@ -839,10 +839,10 @@  discard block
 block discarded – undo
839 839
         print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder);
840 840
     }
841 841
 // Extra fields
842
-    include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_title.tpl.php';
842
+    include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
843 843
     // Hook fields
844 844
     $parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
845
-    $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters);    // Note that $action and $object may have been modified by hook
845
+    $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
846 846
     print $hookmanager->resPrint;
847 847
     if (!empty($arrayfields['p.datec']['checked'])) {
848 848
         print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
         print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, 'align="right"', $sortfield, $sortorder);
855 855
     }
856 856
     print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
857
-    print '</tr>' . "\n";
857
+    print '</tr>'."\n";
858 858
 
859 859
     $now = dol_now();
860 860
     $i = 0;
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
             if (!empty($obj->note_private)) {
883 883
                 $warnornote .= ($warnornote ? ' ' : '');
884 884
                 $warnornote .= '<span class="note">';
885
-                $warnornote .= '<a href = "' . BASE_URI . '?controller=comm/propal&method=note&id=' . $obj->rowid . '">' . img_picto($langs->trans("ViewPrivateNote"), 'object_generic') . '</a>';
885
+                $warnornote .= '<a href = "'.BASE_URI.'?controller=comm/propal&method=note&id='.$obj->rowid.'">'.img_picto($langs->trans("ViewPrivateNote"), 'object_generic').'</a>';
886 886
                 $warnornote .= '</span>';
887 887
             }
888 888
             if ($warnornote) {
@@ -893,15 +893,15 @@  discard block
 block discarded – undo
893 893
             // Other picto tool
894 894
             print '<td width="16" align="right" class="nobordernopadding">';
895 895
             $filename = dol_sanitizeFileName($obj->ref);
896
-            $filedir = $conf->propal->multidir_output[$obj->entity] . '/' . dol_sanitizeFileName($obj->ref);
896
+            $filedir = $conf->propal->multidir_output[$obj->entity].'/'.dol_sanitizeFileName($obj->ref);
897 897
             // $urlsource = $_SERVER['PHP_SELF'] . '?id=' . $obj->rowid;
898
-            $urlsource = BASE_URI . '?controller=comm/propal&method=list&id=' . $obj->rowid;
898
+            $urlsource = BASE_URI.'?controller=comm/propal&method=list&id='.$obj->rowid;
899 899
             print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
900 900
             print '</td></tr></table>';
901 901
 
902 902
             print "</td>\n";
903 903
             if (!$i)
904
-                $totalarray['nbfield'] ++;
904
+                $totalarray['nbfield']++;
905 905
         }
906 906
 
907 907
         if (!empty($arrayfields['p.ref_client']['checked'])) {
@@ -910,7 +910,7 @@  discard block
 block discarded – undo
910 910
             print $obj->ref_client;
911 911
             print '</td>';
912 912
             if (!$i) {
913
-                $totalarray['nbfield'] ++;
913
+                $totalarray['nbfield']++;
914 914
             }
915 915
         }
916 916
 
@@ -923,7 +923,7 @@  discard block
 block discarded – undo
923 923
             }
924 924
             print '</td>';
925 925
             if (!$i) {
926
-                $totalarray['nbfield'] ++;
926
+                $totalarray['nbfield']++;
927 927
             }
928 928
         }
929 929
 
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
             print $companystatic->getNomUrl(1, 'customer');
940 940
             print '</td>';
941 941
             if (!$i) {
942
-                $totalarray['nbfield'] ++;
942
+                $totalarray['nbfield']++;
943 943
             }
944 944
         }
945 945
 
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
             print $obj->town;
950 950
             print '</td>';
951 951
             if (!$i) {
952
-                $totalarray['nbfield'] ++;
952
+                $totalarray['nbfield']++;
953 953
             }
954 954
         }
955 955
         // Zip
@@ -958,14 +958,14 @@  discard block
 block discarded – undo
958 958
             print $obj->zip;
959 959
             print '</td>';
960 960
             if (!$i) {
961
-                $totalarray['nbfield'] ++;
961
+                $totalarray['nbfield']++;
962 962
             }
963 963
         }
964 964
         // State
965 965
         if (!empty($arrayfields['state.nom']['checked'])) {
966
-            print "<td>" . $obj->state_name . "</td>\n";
966
+            print "<td>".$obj->state_name."</td>\n";
967 967
             if (!$i) {
968
-                $totalarray['nbfield'] ++;
968
+                $totalarray['nbfield']++;
969 969
             }
970 970
         }
971 971
         // Country
@@ -975,7 +975,7 @@  discard block
 block discarded – undo
975 975
             print $tmparray['label'];
976 976
             print '</td>';
977 977
             if (!$i) {
978
-                $totalarray['nbfield'] ++;
978
+                $totalarray['nbfield']++;
979 979
             }
980 980
         }
981 981
         // Type ent
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
             print $typenArray[$obj->typent_code];
988 988
             print '</td>';
989 989
             if (!$i) {
990
-                $totalarray['nbfield'] ++;
990
+                $totalarray['nbfield']++;
991 991
             }
992 992
         }
993 993
 
@@ -997,31 +997,31 @@  discard block
 block discarded – undo
997 997
             print dol_print_date($db->jdate($obj->dp), 'day');
998 998
             print "</td>\n";
999 999
             if (!$i) {
1000
-                $totalarray['nbfield'] ++;
1000
+                $totalarray['nbfield']++;
1001 1001
             }
1002 1002
         }
1003 1003
 
1004 1004
         // Date end validity
1005 1005
         if (!empty($arrayfields['p.fin_validite']['checked'])) {
1006 1006
             if ($obj->dfv) {
1007
-                print '<td align="center">' . dol_print_date($db->jdate($obj->dfv), 'day');
1007
+                print '<td align="center">'.dol_print_date($db->jdate($obj->dfv), 'day');
1008 1008
                 print '</td>';
1009 1009
             } else {
1010 1010
                 print '<td>&nbsp;</td>';
1011 1011
             }
1012 1012
             if (!$i)
1013
-                $totalarray['nbfield'] ++;
1013
+                $totalarray['nbfield']++;
1014 1014
         }
1015 1015
         // Date delivery
1016 1016
         if (!empty($arrayfields['p.date_livraison']['checked'])) {
1017 1017
             if ($obj->ddelivery) {
1018
-                print '<td align="center">' . dol_print_date($db->jdate($obj->ddelivery), 'day');
1018
+                print '<td align="center">'.dol_print_date($db->jdate($obj->ddelivery), 'day');
1019 1019
                 print '</td>';
1020 1020
             } else {
1021 1021
                 print '<td>&nbsp;</td>';
1022 1022
             }
1023 1023
             if (!$i) {
1024
-                $totalarray['nbfield'] ++;
1024
+                $totalarray['nbfield']++;
1025 1025
             }
1026 1026
         }
1027 1027
         // Availability
@@ -1030,15 +1030,15 @@  discard block
 block discarded – undo
1030 1030
             $form->form_availability('', $obj->availability, 'none', 1);
1031 1031
             print '</td>';
1032 1032
             if (!$i) {
1033
-                $totalarray['nbfield'] ++;
1033
+                $totalarray['nbfield']++;
1034 1034
             }
1035 1035
         }
1036 1036
 
1037 1037
         // Amount HT
1038 1038
         if (!empty($arrayfields['p.total_ht']['checked'])) {
1039
-            print '<td align="right">' . price($obj->total_ht) . "</td>\n";
1039
+            print '<td align="right">'.price($obj->total_ht)."</td>\n";
1040 1040
             if (!$i) {
1041
-                $totalarray['nbfield'] ++;
1041
+                $totalarray['nbfield']++;
1042 1042
             }
1043 1043
             if (!$i) {
1044 1044
                 $totalarray['totalhtfield'] = $totalarray['nbfield'];
@@ -1047,9 +1047,9 @@  discard block
 block discarded – undo
1047 1047
         }
1048 1048
         // Amount VAT
1049 1049
         if (!empty($arrayfields['p.total_vat']['checked'])) {
1050
-            print '<td align="right">' . price($obj->total_vat) . "</td>\n";
1050
+            print '<td align="right">'.price($obj->total_vat)."</td>\n";
1051 1051
             if (!$i) {
1052
-                $totalarray['nbfield'] ++;
1052
+                $totalarray['nbfield']++;
1053 1053
             }
1054 1054
             if (!$i) {
1055 1055
                 $totalarray['totalvatfield'] = $totalarray['nbfield'];
@@ -1058,9 +1058,9 @@  discard block
 block discarded – undo
1058 1058
         }
1059 1059
         // Amount TTC
1060 1060
         if (!empty($arrayfields['p.total_ttc']['checked'])) {
1061
-            print '<td align="right">' . price($obj->total_ttc) . "</td>\n";
1061
+            print '<td align="right">'.price($obj->total_ttc)."</td>\n";
1062 1062
             if (!$i) {
1063
-                $totalarray['nbfield'] ++;
1063
+                $totalarray['nbfield']++;
1064 1064
             }
1065 1065
             if (!$i) {
1066 1066
                 $totalarray['totalttcfield'] = $totalarray['nbfield'];
@@ -1081,7 +1081,7 @@  discard block
 block discarded – undo
1081 1081
             }
1082 1082
             print "</td>\n";
1083 1083
             if (!$i) {
1084
-                $totalarray['nbfield'] ++;
1084
+                $totalarray['nbfield']++;
1085 1085
             }
1086 1086
         }
1087 1087
 
@@ -1096,7 +1096,7 @@  discard block
 block discarded – undo
1096 1096
                 $nbofsalesrepresentative = count($listsalesrepresentatives);
1097 1097
                 if ($nbofsalesrepresentative > 3) {   // We print only number
1098 1098
                     // print '<a href="' . DOL_URL_ROOT . '/societe/commerciaux.php?socid=' . $companystatic->id . '">';
1099
-                    print '<a href = "' . BASE_URI . '?controller=societe&method=commerciaux&socid=' . $companystatic->id . '">';
1099
+                    print '<a href = "'.BASE_URI.'?controller=societe&method=commerciaux&socid='.$companystatic->id.'">';
1100 1100
                     print $nbofsalesrepresentative;
1101 1101
                     print '</a>';
1102 1102
                 } else if ($nbofsalesrepresentative > 0) {
@@ -1128,10 +1128,10 @@  discard block
 block discarded – undo
1128 1128
         }
1129 1129
 
1130 1130
         // Extra fields
1131
-        include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_print_fields.tpl.php';
1131
+        include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1132 1132
         // Fields from hook
1133 1133
         $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj);
1134
-        $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters);    // Note that $action and $object may have been modified by hook
1134
+        $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
1135 1135
         print $hookmanager->resPrint;
1136 1136
         // Date creation
1137 1137
         if (!empty($arrayfields['p.datec']['checked'])) {
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
             print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
1140 1140
             print '</td>';
1141 1141
             if (!$i) {
1142
-                $totalarray['nbfield'] ++;
1142
+                $totalarray['nbfield']++;
1143 1143
             }
1144 1144
         }
1145 1145
         // Date modification
@@ -1148,14 +1148,14 @@  discard block
 block discarded – undo
1148 1148
             print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
1149 1149
             print '</td>';
1150 1150
             if (!$i) {
1151
-                $totalarray['nbfield'] ++;
1151
+                $totalarray['nbfield']++;
1152 1152
             }
1153 1153
         }
1154 1154
         // Status
1155 1155
         if (!empty($arrayfields['p.fk_statut']['checked'])) {
1156
-            print '<td align="right" class="nowrap">' . $objectstatic->LibStatut($obj->fk_statut, 5) . '</td>';
1156
+            print '<td align="right" class="nowrap">'.$objectstatic->LibStatut($obj->fk_statut, 5).'</td>';
1157 1157
             if (!$i) {
1158
-                $totalarray['nbfield'] ++;
1158
+                $totalarray['nbfield']++;
1159 1159
             }
1160 1160
         }
1161 1161
         // Action column
@@ -1165,11 +1165,11 @@  discard block
 block discarded – undo
1165 1165
             if (in_array($obj->rowid, $arrayofselected)) {
1166 1166
                 $selected = 1;
1167 1167
             }
1168
-            print '<input id="cb' . $obj->rowid . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $obj->rowid . '"' . ($selected ? ' checked="checked"' : '') . '>';
1168
+            print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1169 1169
         }
1170 1170
         print '</td>';
1171 1171
         if (!$i) {
1172
-            $totalarray['nbfield'] ++;
1172
+            $totalarray['nbfield']++;
1173 1173
         }
1174 1174
 
1175 1175
         print "</tr>\n";
@@ -1186,21 +1186,21 @@  discard block
 block discarded – undo
1186 1186
             $i++;
1187 1187
             if ($i == 1) {
1188 1188
                 if ($num < $limit && empty($offset))
1189
-                    print '<td align="left">' . $langs->trans("Total") . '</td>';
1189
+                    print '<td align="left">'.$langs->trans("Total").'</td>';
1190 1190
                 else
1191
-                    print '<td align="left">' . $langs->trans("Totalforthispage") . '</td>';
1191
+                    print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
1192 1192
             }
1193 1193
             elseif ($totalarray['totalhtfield'] == $i)
1194
-                print '<td align="right">' . price($totalarray['totalht']) . '</td>';
1194
+                print '<td align="right">'.price($totalarray['totalht']).'</td>';
1195 1195
             elseif ($totalarray['totalvatfield'] == $i)
1196
-                print '<td align="right">' . price($totalarray['totalvat']) . '</td>';
1196
+                print '<td align="right">'.price($totalarray['totalvat']).'</td>';
1197 1197
             elseif ($totalarray['totalttcfield'] == $i)
1198
-                print '<td align="right">' . price($totalarray['totalttc']) . '</td>';
1198
+                print '<td align="right">'.price($totalarray['totalttc']).'</td>';
1199 1199
             elseif ($totalarray['totalizable']) {
1200 1200
                 $printed = false;
1201 1201
                 foreach ($totalarray['totalizable'] as $totalizable) {
1202 1202
                     if ($totalizable['pos'] == $i && !$printed) {
1203
-                        print '<td align="right">' . price($totalizable['total']) . '</td>';
1203
+                        print '<td align="right">'.price($totalizable['total']).'</td>';
1204 1204
                         $printed = true;
1205 1205
                     }
1206 1206
                 }
@@ -1216,20 +1216,20 @@  discard block
 block discarded – undo
1216 1216
     $db->free($resql);
1217 1217
 
1218 1218
     $parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
1219
-    $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters);    // Note that $action and $object may have been modified by hook
1219
+    $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
1220 1220
     print $hookmanager->resPrint;
1221 1221
 
1222
-    print '</table>' . "\n";
1223
-    print '</div>' . "\n";
1222
+    print '</table>'."\n";
1223
+    print '</div>'."\n";
1224 1224
 
1225
-    print '</form>' . "\n";
1225
+    print '</form>'."\n";
1226 1226
 
1227 1227
     $hidegeneratedfilelistifempty = 1;
1228 1228
     if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
1229 1229
         $hidegeneratedfilelistifempty = 0;
1230 1230
 
1231 1231
     // Show list of available documents
1232
-    $urlsource = $_SERVER['PHP_SELF'] . '?sortfield=' . $sortfield . '&sortorder=' . $sortorder;
1232
+    $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
1233 1233
     $urlsource .= str_replace('&amp;', '&', $param);
1234 1234
 
1235 1235
     $filedir = $diroutputmassaction;
Please login to merge, or discard this patch.
Braces   +49 added lines, -39 removed lines patch added patch discarded remove patch
@@ -243,8 +243,9 @@  discard block
 block discarded – undo
243 243
     $search_array_options = array();
244 244
     $search_categ_cus = 0;
245 245
 }
246
-if ($object_statut != '')
246
+if ($object_statut != '') {
247 247
     $viewstatut = $object_statut;
248
+}
248 249
 
249 250
 if (empty($reshook)) {
250 251
     $objectclass = 'Propal';
@@ -442,10 +443,10 @@  discard block
 block discarded – undo
442 443
         $soc = new Societe($db);
443 444
         $soc->fetch($socid);
444 445
         $title = $langs->trans('ListOfProposals') . ' - ' . $soc->name;
445
-        if (empty($search_societe))
446
-            $search_societe = $soc->name;
447
-    }
448
-    else {
446
+        if (empty($search_societe)) {
447
+                    $search_societe = $soc->name;
448
+        }
449
+    } else {
449 450
         $title = $langs->trans('ListOfProposals');
450 451
     }
451 452
 
@@ -660,10 +661,12 @@  discard block
 block discarded – undo
660 661
         print '<input class="flat" type="text" size="10" name="search_societe" value="' . dol_escape_htmltag($search_societe) . '">';
661 662
         print '</td>';
662 663
     }
663
-    if (!empty($arrayfields['s.town']['checked']))
664
-        print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="' . $search_town . '"></td>';
665
-    if (!empty($arrayfields['s.zip']['checked']))
666
-        print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="' . $search_zip . '"></td>';
664
+    if (!empty($arrayfields['s.town']['checked'])) {
665
+            print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="' . $search_town . '"></td>';
666
+    }
667
+    if (!empty($arrayfields['s.zip']['checked'])) {
668
+            print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="' . $search_zip . '"></td>';
669
+    }
667 670
     // State
668 671
     if (!empty($arrayfields['state.nom']['checked'])) {
669 672
         print '<td class="liste_titre">';
@@ -687,8 +690,9 @@  discard block
 block discarded – undo
687 690
     if (!empty($arrayfields['p.date']['checked'])) {
688 691
         print '<td class="liste_titre nowraponall" align="center">';
689 692
         //print $langs->trans('Month').': ';
690
-        if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY))
691
-            print '<input class="flat width25" type="text" maxlength="2" name="search_day" value="' . dol_escape_htmltag($search_day) . '">';
693
+        if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
694
+                    print '<input class="flat width25" type="text" maxlength="2" name="search_day" value="' . dol_escape_htmltag($search_day) . '">';
695
+        }
692 696
         print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_month" value="' . dol_escape_htmltag($search_month) . '">';
693 697
         //print '&nbsp;'.$langs->trans('Year').': ';
694 698
         $formother->select_year($search_year, 'search_year', 1, 20, 5);
@@ -698,8 +702,9 @@  discard block
 block discarded – undo
698 702
     if (!empty($arrayfields['p.fin_validite']['checked'])) {
699 703
         print '<td class="liste_titre nowraponall" align="center">';
700 704
         //print $langs->trans('Month').': ';
701
-        if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY))
702
-            print '<input class="flat width25" type="text" maxlength="2" name="search_dayfin" value="' . dol_escape_htmltag($search_dayfin) . '">';
705
+        if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
706
+                    print '<input class="flat width25" type="text" maxlength="2" name="search_dayfin" value="' . dol_escape_htmltag($search_dayfin) . '">';
707
+        }
703 708
         print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_month_end" value="' . dol_escape_htmltag($search_month_end) . '">';
704 709
         //print '&nbsp;'.$langs->trans('Year').': ';
705 710
         $formother->select_year($search_yearfin, 'search_yearfin', 1, 20, 5);
@@ -709,8 +714,9 @@  discard block
 block discarded – undo
709 714
     if (!empty($arrayfields['p.date_livraison']['checked'])) {
710 715
         print '<td class="liste_titre nowraponall" align="center">';
711 716
         //print $langs->trans('Month').': ';
712
-        if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY))
713
-            print '<input class="flat width25" type="text" size="1" maxlength="2" name="search_daydelivery" value="' . dol_escape_htmltag($search_daydelivery) . '">';
717
+        if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
718
+                    print '<input class="flat width25" type="text" size="1" maxlength="2" name="search_daydelivery" value="' . dol_escape_htmltag($search_daydelivery) . '">';
719
+        }
714 720
         print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_monthdelivery" value="' . dol_escape_htmltag($search_monthdelivery) . '">';
715 721
         //print '&nbsp;'.$langs->trans('Year').': ';
716 722
         $formother->select_year($search_yeardelivery, 'search_yeardelivery', 1, 20, 5);
@@ -877,8 +883,9 @@  discard block
 block discarded – undo
877 883
             print '</td>';
878 884
             // Warning
879 885
             $warnornote = '';
880
-            if ($obj->fk_statut == 1 && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay))
881
-                $warnornote .= img_warning($langs->trans("Late"));
886
+            if ($obj->fk_statut == 1 && $db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) {
887
+                            $warnornote .= img_warning($langs->trans("Late"));
888
+            }
882 889
             if (!empty($obj->note_private)) {
883 890
                 $warnornote .= ($warnornote ? ' ' : '');
884 891
                 $warnornote .= '<span class="note">';
@@ -900,8 +907,9 @@  discard block
 block discarded – undo
900 907
             print '</td></tr></table>';
901 908
 
902 909
             print "</td>\n";
903
-            if (!$i)
904
-                $totalarray['nbfield'] ++;
910
+            if (!$i) {
911
+                            $totalarray['nbfield'] ++;
912
+            }
905 913
         }
906 914
 
907 915
         if (!empty($arrayfields['p.ref_client']['checked'])) {
@@ -1009,8 +1017,9 @@  discard block
 block discarded – undo
1009 1017
             } else {
1010 1018
                 print '<td>&nbsp;</td>';
1011 1019
             }
1012
-            if (!$i)
1013
-                $totalarray['nbfield'] ++;
1020
+            if (!$i) {
1021
+                            $totalarray['nbfield'] ++;
1022
+            }
1014 1023
         }
1015 1024
         // Date delivery
1016 1025
         if (!empty($arrayfields['p.date_livraison']['checked'])) {
@@ -1185,18 +1194,18 @@  discard block
 block discarded – undo
1185 1194
         while ($i < $totalarray['nbfield']) {
1186 1195
             $i++;
1187 1196
             if ($i == 1) {
1188
-                if ($num < $limit && empty($offset))
1189
-                    print '<td align="left">' . $langs->trans("Total") . '</td>';
1190
-                else
1191
-                    print '<td align="left">' . $langs->trans("Totalforthispage") . '</td>';
1192
-            }
1193
-            elseif ($totalarray['totalhtfield'] == $i)
1194
-                print '<td align="right">' . price($totalarray['totalht']) . '</td>';
1195
-            elseif ($totalarray['totalvatfield'] == $i)
1196
-                print '<td align="right">' . price($totalarray['totalvat']) . '</td>';
1197
-            elseif ($totalarray['totalttcfield'] == $i)
1198
-                print '<td align="right">' . price($totalarray['totalttc']) . '</td>';
1199
-            elseif ($totalarray['totalizable']) {
1197
+                if ($num < $limit && empty($offset)) {
1198
+                                    print '<td align="left">' . $langs->trans("Total") . '</td>';
1199
+                } else {
1200
+                                    print '<td align="left">' . $langs->trans("Totalforthispage") . '</td>';
1201
+                }
1202
+            } elseif ($totalarray['totalhtfield'] == $i) {
1203
+                            print '<td align="right">' . price($totalarray['totalht']) . '</td>';
1204
+            } elseif ($totalarray['totalvatfield'] == $i) {
1205
+                            print '<td align="right">' . price($totalarray['totalvat']) . '</td>';
1206
+            } elseif ($totalarray['totalttcfield'] == $i) {
1207
+                            print '<td align="right">' . price($totalarray['totalttc']) . '</td>';
1208
+            } elseif ($totalarray['totalizable']) {
1200 1209
                 $printed = false;
1201 1210
                 foreach ($totalarray['totalizable'] as $totalizable) {
1202 1211
                     if ($totalizable['pos'] == $i && !$printed) {
@@ -1207,8 +1216,9 @@  discard block
 block discarded – undo
1207 1216
                 if (!$printed) {
1208 1217
                     print '<td></td>';
1209 1218
                 }
1210
-            } else
1211
-                print '<td></td>';
1219
+            } else {
1220
+                            print '<td></td>';
1221
+            }
1212 1222
         }
1213 1223
         print '</tr>';
1214 1224
     }
@@ -1225,8 +1235,9 @@  discard block
 block discarded – undo
1225 1235
     print '</form>' . "\n";
1226 1236
 
1227 1237
     $hidegeneratedfilelistifempty = 1;
1228
-    if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
1229
-        $hidegeneratedfilelistifempty = 0;
1238
+    if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
1239
+            $hidegeneratedfilelistifempty = 0;
1240
+    }
1230 1241
 
1231 1242
     // Show list of available documents
1232 1243
     $urlsource = $_SERVER['PHP_SELF'] . '?sortfield=' . $sortfield . '&sortorder=' . $sortorder;
@@ -1237,8 +1248,7 @@  discard block
 block discarded – undo
1237 1248
     $delallowed = $user->rights->propal->creer;
1238 1249
 
1239 1250
     print $formfile->showdocuments('massfilesarea_proposals', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
1240
-}
1241
-else {
1251
+} else {
1242 1252
     dol_print_error($db);
1243 1253
 }
1244 1254
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/propal.lib.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     $head = array();
41 41
 
42 42
     // $head[$h][0] = DOL_URL_ROOT.'/comm/propal/card.php?id='.$object->id;
43
-    $head[$h][0] = BASE_URI . '?controller=comm/propal&method=card&id=' . $object->id;
43
+    $head[$h][0] = BASE_URI.'?controller=comm/propal&method=card&id='.$object->id;
44 44
     $head[$h][1] = $langs->trans('ProposalCard');
45 45
     $head[$h][2] = 'comm';
46 46
     $h++;
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
         $langs->load("sendings");
50 50
         $text = '';
51 51
         // $head[$h][0] = DOL_URL_ROOT.'/expedition/propal.php?id='.$object->id;
52
-        $head[$h][0] = BASE_URI . '?controller=expedition&method=propal&id=' . $object->id;
52
+        $head[$h][0] = BASE_URI.'?controller=expedition&method=propal&id='.$object->id;
53 53
         if ($conf->expedition_bon->enabled)
54 54
             $text = $langs->trans("Shipment");
55 55
         if ($conf->livraison_bon->enabled)
56
-            $text .= '/' . $langs->trans("Receivings");
56
+            $text .= '/'.$langs->trans("Receivings");
57 57
         $head[$h][1] = $text;
58 58
         $head[$h][2] = 'shipping';
59 59
         $h++;
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
     if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
63 63
         $nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external'));
64 64
         // $head[$h][0] = DOL_URL_ROOT.'/comm/propal/contact.php?id='.$object->id;
65
-        $head[$h][0] = BASE_URI . '?controller=comm/propal&method=contact&id=' . $object->id;
65
+        $head[$h][0] = BASE_URI.'?controller=comm/propal&method=contact&id='.$object->id;
66 66
         $head[$h][1] = $langs->trans('ContactsAddresses');
67 67
         if ($nbContact > 0)
68
-            $head[$h][1] .= ' <span class="badge">' . $nbContact . '</span>';
68
+            $head[$h][1] .= ' <span class="badge">'.$nbContact.'</span>';
69 69
         $head[$h][2] = 'contact';
70 70
         $h++;
71 71
     }
@@ -83,29 +83,29 @@  discard block
 block discarded – undo
83 83
         if (!empty($object->note_public))
84 84
             $nbNote++;
85 85
         // $head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?id='.$object->id;
86
-        $head[$h][0] = BASE_URI . '?controller=comm/propal&method=note&id=' . $object->id;
86
+        $head[$h][0] = BASE_URI.'?controller=comm/propal&method=note&id='.$object->id;
87 87
         $head[$h][1] = $langs->trans('Notes');
88 88
         if ($nbNote > 0)
89
-            $head[$h][1] .= ' <span class="badge">' . $nbNote . '</span>';
89
+            $head[$h][1] .= ' <span class="badge">'.$nbNote.'</span>';
90 90
         $head[$h][2] = 'note';
91 91
         $h++;
92 92
     }
93 93
 
94
-    require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
95
-    require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
96
-    $upload_dir = $conf->propal->multidir_output[$object->entity] . "/" . dol_sanitizeFileName($object->ref);
94
+    require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
95
+    require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
96
+    $upload_dir = $conf->propal->multidir_output[$object->entity]."/".dol_sanitizeFileName($object->ref);
97 97
     $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
98 98
     $nbLinks = Link::count($db, $object->element, $object->id);
99 99
     // $head[$h][0] = DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id;
100
-    $head[$h][0] = BASE_URI . '?controller=comm/propal&method=document&id=' . $object->id;
100
+    $head[$h][0] = BASE_URI.'?controller=comm/propal&method=document&id='.$object->id;
101 101
     $head[$h][1] = $langs->trans('Documents');
102 102
     if (($nbFiles + $nbLinks) > 0)
103
-        $head[$h][1] .= ' <span class="badge">' . ($nbFiles + $nbLinks) . '</span>';
103
+        $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>';
104 104
     $head[$h][2] = 'document';
105 105
     $h++;
106 106
 
107 107
     // $head[$h][0] = DOL_URL_ROOT.'/comm/propal/info.php?id='.$object->id;
108
-    $head[$h][0] = BASE_URI . '?controller=comm/propal&method=info&id=' . $object->id;
108
+    $head[$h][0] = BASE_URI.'?controller=comm/propal&method=info&id='.$object->id;
109 109
     $head[$h][1] = $langs->trans('Info');
110 110
     $head[$h][2] = 'info';
111 111
     $h++;
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
     $head = array();
129 129
 
130 130
     // $head[$h][0] = DOL_URL_ROOT . '/admin/propal.php';
131
-    $head[$h][0] = BASE_URI . '?controller=admin&method=propal';
131
+    $head[$h][0] = BASE_URI.'?controller=admin&method=propal';
132 132
     $head[$h][1] = $langs->trans("Miscellaneous");
133 133
     $head[$h][2] = 'general';
134 134
     $h++;
@@ -140,13 +140,13 @@  discard block
 block discarded – undo
140 140
     complete_head_from_modules($conf, $langs, null, $head, $h, 'propal_admin');
141 141
 
142 142
     // $head[$h][0] = DOL_URL_ROOT . '/comm/admin/propal_extrafields.php';
143
-    $head[$h][0] = BASE_URI . '?controller=comm/admin&method=propal_extrafields';
143
+    $head[$h][0] = BASE_URI.'?controller=comm/admin&method=propal_extrafields';
144 144
     $head[$h][1] = $langs->trans("ExtraFields");
145 145
     $head[$h][2] = 'attributes';
146 146
     $h++;
147 147
 
148 148
     // $head[$h][0] = DOL_URL_ROOT . '/comm/admin/propaldet_extrafields.php';
149
-    $head[$h][0] = BASE_URI . '?controller=comm/admin&method=propaldet_extrafields';
149
+    $head[$h][0] = BASE_URI.'?controller=comm/admin&method=propaldet_extrafields';
150 150
     $head[$h][1] = $langs->trans("ExtraFieldsLines");
151 151
     $head[$h][2] = 'attributeslines';
152 152
     $h++;
Please login to merge, or discard this patch.
Braces   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -50,10 +50,12 @@  discard block
 block discarded – undo
50 50
         $text = '';
51 51
         // $head[$h][0] = DOL_URL_ROOT.'/expedition/propal.php?id='.$object->id;
52 52
         $head[$h][0] = BASE_URI . '?controller=expedition&method=propal&id=' . $object->id;
53
-        if ($conf->expedition_bon->enabled)
54
-            $text = $langs->trans("Shipment");
55
-        if ($conf->livraison_bon->enabled)
56
-            $text .= '/' . $langs->trans("Receivings");
53
+        if ($conf->expedition_bon->enabled) {
54
+                    $text = $langs->trans("Shipment");
55
+        }
56
+        if ($conf->livraison_bon->enabled) {
57
+                    $text .= '/' . $langs->trans("Receivings");
58
+        }
57 59
         $head[$h][1] = $text;
58 60
         $head[$h][2] = 'shipping';
59 61
         $h++;
@@ -64,8 +66,9 @@  discard block
 block discarded – undo
64 66
         // $head[$h][0] = DOL_URL_ROOT.'/comm/propal/contact.php?id='.$object->id;
65 67
         $head[$h][0] = BASE_URI . '?controller=comm/propal&method=contact&id=' . $object->id;
66 68
         $head[$h][1] = $langs->trans('ContactsAddresses');
67
-        if ($nbContact > 0)
68
-            $head[$h][1] .= ' <span class="badge">' . $nbContact . '</span>';
69
+        if ($nbContact > 0) {
70
+                    $head[$h][1] .= ' <span class="badge">' . $nbContact . '</span>';
71
+        }
69 72
         $head[$h][2] = 'contact';
70 73
         $h++;
71 74
     }
@@ -78,15 +81,18 @@  discard block
 block discarded – undo
78 81
 
79 82
     if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
80 83
         $nbNote = 0;
81
-        if (!empty($object->note_private))
82
-            $nbNote++;
83
-        if (!empty($object->note_public))
84
-            $nbNote++;
84
+        if (!empty($object->note_private)) {
85
+                    $nbNote++;
86
+        }
87
+        if (!empty($object->note_public)) {
88
+                    $nbNote++;
89
+        }
85 90
         // $head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?id='.$object->id;
86 91
         $head[$h][0] = BASE_URI . '?controller=comm/propal&method=note&id=' . $object->id;
87 92
         $head[$h][1] = $langs->trans('Notes');
88
-        if ($nbNote > 0)
89
-            $head[$h][1] .= ' <span class="badge">' . $nbNote . '</span>';
93
+        if ($nbNote > 0) {
94
+                    $head[$h][1] .= ' <span class="badge">' . $nbNote . '</span>';
95
+        }
90 96
         $head[$h][2] = 'note';
91 97
         $h++;
92 98
     }
@@ -99,8 +105,9 @@  discard block
 block discarded – undo
99 105
     // $head[$h][0] = DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id;
100 106
     $head[$h][0] = BASE_URI . '?controller=comm/propal&method=document&id=' . $object->id;
101 107
     $head[$h][1] = $langs->trans('Documents');
102
-    if (($nbFiles + $nbLinks) > 0)
103
-        $head[$h][1] .= ' <span class="badge">' . ($nbFiles + $nbLinks) . '</span>';
108
+    if (($nbFiles + $nbLinks) > 0) {
109
+            $head[$h][1] .= ' <span class="badge">' . ($nbFiles + $nbLinks) . '</span>';
110
+    }
104 111
     $head[$h][2] = 'document';
105 112
     $h++;
106 113
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/doleditor.lib.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -36,14 +36,14 @@  discard block
 block discarded – undo
36 36
     global $conf, $langs, $db;
37 37
     global $bc;
38 38
 
39
-    require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
39
+    require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
40 40
 
41 41
     $formother = new FormOther($db);
42 42
 
43 43
     $dirskins = array('/includes/ckeditor/ckeditor/skins');
44 44
     if (!empty($conf->modules_parts['theme'])) {  // Using this feature slow down application
45 45
         foreach ($conf->modules_parts['theme'] as $reldir) {
46
-            $dirskins = array_merge($dirskins, (array) ($reldir . 'theme'));
46
+            $dirskins = array_merge($dirskins, (array) ($reldir.'theme'));
47 47
         }
48 48
     }
49 49
     $dirskins = array_unique($dirskins);
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     $var = false;
66 66
 
67 67
     // Title
68
-    print '<tr class="liste_titre"><th width="35%">' . $langs->trans("DefaultSkin") . '</th>';
68
+    print '<tr class="liste_titre"><th width="35%">'.$langs->trans("DefaultSkin").'</th>';
69 69
     print '<th align="right">';
70 70
     $url = 'http://ckeditor.com/addons/skins/all';
71 71
     /* print '<a href="'.$url.'" target="_blank">';
@@ -74,16 +74,16 @@  discard block
 block discarded – undo
74 74
     print '</th></tr>';
75 75
 
76 76
     print '<tr class="oddeven">';
77
-    print '<td>' . $langs->trans("ThemeDir") . '</td>';
77
+    print '<td>'.$langs->trans("ThemeDir").'</td>';
78 78
     print '<td>';
79 79
     foreach ($dirskins as $dirskin) {
80
-        echo '"' . $dirskin . '" ';
80
+        echo '"'.$dirskin.'" ';
81 81
     }
82 82
     print '</td>';
83 83
     print '</tr>';
84 84
 
85 85
     //
86
-    print '<tr class="oddeven"><td colspan="' . $colspan . '">';
86
+    print '<tr class="oddeven"><td colspan="'.$colspan.'">';
87 87
 
88 88
     print '<table class="nobordernopadding" width="100%"><tr><td><div align="center">';
89 89
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             $handle = opendir($dirskin);
98 98
             if (is_resource($handle)) {
99 99
                 while (($subdir = readdir($handle)) !== false) {
100
-                    if (is_dir($dirskin . "/" . $subdir) && substr($subdir, 0, 1) <> '.' && substr($subdir, 0, 3) <> 'CVS' && !preg_match('/common|phones/i', $subdir)) {
100
+                    if (is_dir($dirskin."/".$subdir) && substr($subdir, 0, 1) <> '.' && substr($subdir, 0, 3) <> 'CVS' && !preg_match('/common|phones/i', $subdir)) {
101 101
                         // Disable not stable themes (dir ends with _exp or _dev)
102 102
                         if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i', $subdir))
103 103
                             continue;
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
 
107 107
                         print '<div class="inline-block" style="margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;">';
108 108
                         if ($subdir == $selected_theme) {
109
-                            print '<input ' . ($edit ? '' : 'disabled') . ' type="radio" ' . $bc[$var] . ' style="border: 0px;" checked name="fckeditor_skin" value="' . $subdir . '"> <b>' . $subdir . '</b>';
109
+                            print '<input '.($edit ? '' : 'disabled').' type="radio" '.$bc[$var].' style="border: 0px;" checked name="fckeditor_skin" value="'.$subdir.'"> <b>'.$subdir.'</b>';
110 110
                         } else {
111
-                            print '<input ' . ($edit ? '' : 'disabled') . ' type="radio" ' . $bc[$var] . ' style="border: 0px;" name="fckeditor_skin" value="' . $subdir . '"> ' . $subdir;
111
+                            print '<input '.($edit ? '' : 'disabled').' type="radio" '.$bc[$var].' style="border: 0px;" name="fckeditor_skin" value="'.$subdir.'"> '.$subdir;
112 112
                         }
113 113
                         print '</div>';
114 114
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -54,8 +54,9 @@  discard block
 block discarded – undo
54 54
         // $selected_theme = 'moono-lisa';
55 55
 
56 56
         $selected_theme = CKEDITOR_SKIN;
57
-    } else
58
-        $selected_theme = $conf->global->FCKEDITOR_SKIN;
57
+    } else {
58
+            $selected_theme = $conf->global->FCKEDITOR_SKIN;
59
+    }
59 60
 
60 61
     $colspan = 2;
61 62
 
@@ -99,10 +100,12 @@  discard block
 block discarded – undo
99 100
                 while (($subdir = readdir($handle)) !== false) {
100 101
                     if (is_dir($dirskin . "/" . $subdir) && substr($subdir, 0, 1) <> '.' && substr($subdir, 0, 3) <> 'CVS' && !preg_match('/common|phones/i', $subdir)) {
101 102
                         // Disable not stable themes (dir ends with _exp or _dev)
102
-                        if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i', $subdir))
103
-                            continue;
104
-                        if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/_exp$/i', $subdir))
105
-                            continue;
103
+                        if ($conf->global->MAIN_FEATURES_LEVEL < 2 && preg_match('/_dev$/i', $subdir)) {
104
+                                                    continue;
105
+                        }
106
+                        if ($conf->global->MAIN_FEATURES_LEVEL < 1 && preg_match('/_exp$/i', $subdir)) {
107
+                                                    continue;
108
+                        }
106 109
 
107 110
                         print '<div class="inline-block" style="margin-top: 10px; margin-bottom: 10px; margin-right: 20px; margin-left: 20px;">';
108 111
                         if ($subdir == $selected_theme) {
Please login to merge, or discard this patch.