@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | /** |
101 | 101 | * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. |
102 | 102 | */ |
103 | - public $fields=array( |
|
103 | + public $fields = array( |
|
104 | 104 | 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), |
105 | 105 | 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'validate'=>'1'), |
106 | 106 | 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'showoncombobox'=>'2', 'validate'=>'1',), |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | |
447 | 447 | // Protection |
448 | 448 | if ($this->status == self::STATUS_VALIDATED) { |
449 | - dol_syslog(get_class($this) . "::validate action abandonned: already validated", LOG_WARNING); |
|
449 | + dol_syslog(get_class($this)."::validate action abandonned: already validated", LOG_WARNING); |
|
450 | 450 | return 0; |
451 | 451 | } |
452 | 452 | |
@@ -455,17 +455,17 @@ discard block |
||
455 | 455 | $this->db->begin(); |
456 | 456 | |
457 | 457 | // Validate |
458 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element; |
|
459 | - $sql .= " SET status = " . self::STATUS_VALIDATED; |
|
458 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
|
459 | + $sql .= " SET status = ".self::STATUS_VALIDATED; |
|
460 | 460 | if (!empty($this->fields['date_validation'])) { |
461 | - $sql .= ", date_validation = '" . $this->db->idate($now) . "'"; |
|
461 | + $sql .= ", date_validation = '".$this->db->idate($now)."'"; |
|
462 | 462 | } |
463 | 463 | if (!empty($this->fields['fk_user_valid'])) { |
464 | - $sql .= ", fk_user_valid = " . ((int) $user->id); |
|
464 | + $sql .= ", fk_user_valid = ".((int) $user->id); |
|
465 | 465 | } |
466 | - $sql .= " WHERE rowid = " . ((int) $this->id); |
|
466 | + $sql .= " WHERE rowid = ".((int) $this->id); |
|
467 | 467 | |
468 | - dol_syslog(get_class($this) . "::validate()", LOG_DEBUG); |
|
468 | + dol_syslog(get_class($this)."::validate()", LOG_DEBUG); |
|
469 | 469 | $resql = $this->db->query($sql); |
470 | 470 | if (!$resql) { |
471 | 471 | dol_print_error($this->db); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | if (!is_object($formadmin)) { |
38 | - require_once DOL_DOCUMENT_ROOT . '/core/class/html.formadmin.class.php'; |
|
38 | + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; |
|
39 | 39 | $formadmin = new FormAdmin($db); |
40 | 40 | } |
41 | 41 | |
@@ -69,19 +69,19 @@ discard block |
||
69 | 69 | 'mode_key' => $info[0], |
70 | 70 | 'field_key' => $info[1], |
71 | 71 | 'value' => $info[2], |
72 | - 'target' => 'block_' . $mode_key, |
|
72 | + 'target' => 'block_'.$mode_key, |
|
73 | 73 | ); |
74 | 74 | } |
75 | 75 | |
76 | 76 | $assetdepreciationoptions->setInfosForMode($mode_key, $class_type, true); |
77 | - $prefix_html_name = $mode_key . '_'; |
|
77 | + $prefix_html_name = $mode_key.'_'; |
|
78 | 78 | |
79 | - print '<div id="block_' . $mode_key . '">'; |
|
79 | + print '<div id="block_'.$mode_key.'">'; |
|
80 | 80 | print load_fiche_titre($langs->trans($mode_info['label']), '', ''); |
81 | 81 | print '<div class="fichecenter">'; |
82 | 82 | print '<div class="fichehalfleft">'; |
83 | 83 | print '<div class="underbanner clearboth"></div>'; |
84 | - print '<table class="border centpercent tableforfield">' . "\n"; |
|
84 | + print '<table class="border centpercent tableforfield">'."\n"; |
|
85 | 85 | $mode_info['fields'] = dol_sort_array($mode_info['fields'], 'position'); |
86 | 86 | foreach ($mode_info['fields'] as $field_key => $field_info) { |
87 | 87 | // Discard if extrafield is a hidden field on form |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | print '<table class="border centpercent tableforfield">'; |
103 | 103 | } |
104 | 104 | |
105 | - $html_name = $prefix_html_name . $field_key; |
|
105 | + $html_name = $prefix_html_name.$field_key; |
|
106 | 106 | if (!empty($field_info['enabled_field'])) { |
107 | 107 | $info = explode(':', $field_info['enabled_field']); |
108 | 108 | $enabled_field_info[] = array( |
109 | 109 | 'mode_key' => $info[0], |
110 | 110 | 'field_key' => $info[1], |
111 | 111 | 'value' => $info[2], |
112 | - 'target' => 'field_' . $html_name, |
|
112 | + 'target' => 'field_'.$html_name, |
|
113 | 113 | ); |
114 | 114 | } |
115 | 115 | |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | $more_class .= ' tdtop'; |
122 | 122 | } |
123 | 123 | |
124 | - print '<tr class="field_' . $html_name . '" id="field_' . $html_name . '"><td'; |
|
125 | - print ' class="titlefieldcreate' . $more_class . '">'; |
|
124 | + print '<tr class="field_'.$html_name.'" id="field_'.$html_name.'"><td'; |
|
125 | + print ' class="titlefieldcreate'.$more_class.'">'; |
|
126 | 126 | if (!empty($field_info['help'])) { |
127 | 127 | print $form->textwithpicto($langs->trans($field_info['label']), $langs->trans($field_info['help'])); |
128 | 128 | } else { |
@@ -221,7 +221,7 @@ |
||
221 | 221 | } |
222 | 222 | }); |
223 | 223 | </script> |
224 | -SCRIPT; |
|
224 | +script; |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | ?> |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | print '<div class="fichecenter">'; |
68 | 68 | print '<div class="fichehalfleft">'; |
69 | 69 | print '<div class="underbanner clearboth"></div>'; |
70 | - print '<table class="border centpercent tableforfield">' . "\n"; |
|
70 | + print '<table class="border centpercent tableforfield">'."\n"; |
|
71 | 71 | $mode_info['fields'] = dol_sort_array($mode_info['fields'], 'position'); |
72 | 72 | foreach ($mode_info['fields'] as $field_key => $field_info) { |
73 | 73 | if (!empty($field_info['enabled_field'])) { |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | print '<table class="border centpercent tableforfield">'; |
95 | 95 | } |
96 | 96 | |
97 | - $key = $mode_key . '_' . $field_key; |
|
97 | + $key = $mode_key.'_'.$field_key; |
|
98 | 98 | $value = $assetdepreciationoptions->deprecation_options[$mode_key][$field_key]; |
99 | 99 | |
100 | - print '<tr class="field_' . $key . '"><td'; |
|
101 | - print ' class="' . (empty($field_info['tdcss']) ? 'titlefield' : $field_info['tdcss']) . ' fieldname_' . $key; |
|
100 | + print '<tr class="field_'.$key.'"><td'; |
|
101 | + print ' class="'.(empty($field_info['tdcss']) ? 'titlefield' : $field_info['tdcss']).' fieldname_'.$key; |
|
102 | 102 | if ($field_info['type'] == 'text' || $field_info['type'] == 'html') { |
103 | 103 | print ' tdtop'; |
104 | 104 | } |
@@ -113,12 +113,12 @@ discard block |
||
113 | 113 | } |
114 | 114 | } |
115 | 115 | print '</td>'; |
116 | - print '<td class="valuefield fieldname_' . $key; |
|
116 | + print '<td class="valuefield fieldname_'.$key; |
|
117 | 117 | if ($field_info['type'] == 'text') { |
118 | 118 | print ' wordbreak'; |
119 | 119 | } |
120 | 120 | if (!empty($field_info['cssview'])) { |
121 | - print ' ' . $field_info['cssview']; |
|
121 | + print ' '.$field_info['cssview']; |
|
122 | 122 | } |
123 | 123 | print '">'; |
124 | 124 | if (in_array($field_info['type'], array('text', 'html'))) { |
@@ -126,15 +126,15 @@ discard block |
||
126 | 126 | } |
127 | 127 | if ($field_key == 'lang') { |
128 | 128 | $langs->load("languages"); |
129 | - $labellang = ($value ? $langs->trans('Language_' . $value) : ''); |
|
129 | + $labellang = ($value ? $langs->trans('Language_'.$value) : ''); |
|
130 | 130 | print picto_from_langcode($value, 'class="paddingrightonly saturatemedium opacitylow"'); |
131 | 131 | print $labellang; |
132 | 132 | } else { |
133 | 133 | if (isset($field_info['copytoclipboard']) && $field_info['copytoclipboard'] == 2) { |
134 | - $out = $assetdepreciationoptions->showOutputField($field_info, $field_key, $value, '', '', $mode_key . '_', 0); |
|
134 | + $out = $assetdepreciationoptions->showOutputField($field_info, $field_key, $value, '', '', $mode_key.'_', 0); |
|
135 | 135 | print showValueWithClipboardCPButton($out, 0, $out); |
136 | 136 | } else { |
137 | - print $assetdepreciationoptions->showOutputField($field_info, $field_key, $value, '', '', $mode_key . '_', 0); |
|
137 | + print $assetdepreciationoptions->showOutputField($field_info, $field_key, $value, '', '', $mode_key.'_', 0); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | if (in_array($field_info['type'], array('text', 'html'))) { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | print '<div class="fichecenter">'; |
68 | 68 | print '<div class="fichehalfleft">'; |
69 | 69 | print '<div class="underbanner clearboth"></div>'; |
70 | - print '<table class="border centpercent tableforfield">' . "\n"; |
|
70 | + print '<table class="border centpercent tableforfield">'."\n"; |
|
71 | 71 | $mode_info['fields'] = dol_sort_array($mode_info['fields'], 'position'); |
72 | 72 | foreach ($mode_info['fields'] as $field_key => $field_info) { |
73 | 73 | if (!empty($field_info['enabled_field'])) { |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | print '<table class="border centpercent tableforfield">'; |
95 | 95 | } |
96 | 96 | |
97 | - $key = $mode_key . '_' . $field_key; |
|
97 | + $key = $mode_key.'_'.$field_key; |
|
98 | 98 | $value = $assetdepreciationoptions->deprecation_options[$mode_key][$field_key]; |
99 | 99 | |
100 | - print '<tr class="field_' . $key . '"><td'; |
|
101 | - print ' class="' . (empty($field_info['tdcss']) ? 'titlefield' : $field_info['tdcss']) . ' fieldname_' . $key; |
|
100 | + print '<tr class="field_'.$key.'"><td'; |
|
101 | + print ' class="'.(empty($field_info['tdcss']) ? 'titlefield' : $field_info['tdcss']).' fieldname_'.$key; |
|
102 | 102 | if ($field_info['type'] == 'text' || $field_info['type'] == 'html') { |
103 | 103 | print ' tdtop'; |
104 | 104 | } |
@@ -113,12 +113,12 @@ discard block |
||
113 | 113 | } |
114 | 114 | } |
115 | 115 | print '</td>'; |
116 | - print '<td class="valuefield fieldname_' . $key; |
|
116 | + print '<td class="valuefield fieldname_'.$key; |
|
117 | 117 | if ($field_info['type'] == 'text') { |
118 | 118 | print ' wordbreak'; |
119 | 119 | } |
120 | 120 | if (!empty($field_info['cssview'])) { |
121 | - print ' ' . $field_info['cssview']; |
|
121 | + print ' '.$field_info['cssview']; |
|
122 | 122 | } |
123 | 123 | print '">'; |
124 | 124 | if (in_array($field_info['type'], array('text', 'html'))) { |
@@ -126,15 +126,15 @@ discard block |
||
126 | 126 | } |
127 | 127 | if ($field_key == 'lang') { |
128 | 128 | $langs->load("languages"); |
129 | - $labellang = ($value ? $langs->trans('Language_' . $value) : ''); |
|
129 | + $labellang = ($value ? $langs->trans('Language_'.$value) : ''); |
|
130 | 130 | print picto_from_langcode($value, 'class="paddingrightonly saturatemedium opacitylow"'); |
131 | 131 | print $labellang; |
132 | 132 | } else { |
133 | 133 | if (isset($field_info['copytoclipboard']) && $field_info['copytoclipboard'] == 2) { |
134 | - $out = $assetdepreciationoptions->showOutputField($field_info, $field_key, $value, '', '', $mode_key . '_', 0); |
|
134 | + $out = $assetdepreciationoptions->showOutputField($field_info, $field_key, $value, '', '', $mode_key.'_', 0); |
|
135 | 135 | print showValueWithClipboardCPButton($out, 0, $out); |
136 | 136 | } else { |
137 | - print $assetdepreciationoptions->showOutputField($field_info, $field_key, $value, '', '', $mode_key . '_', 0); |
|
137 | + print $assetdepreciationoptions->showOutputField($field_info, $field_key, $value, '', '', $mode_key.'_', 0); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | if (in_array($field_info['type'], array('text', 'html'))) { |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $amount = $credit; |
107 | 107 | } |
108 | 108 | |
109 | - return "'" . $this->db->escape(abs($amount)) . "'"; |
|
109 | + return "'".$this->db->escape(abs($amount))."'"; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | return "''"; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $sens = 'C'; |
135 | 135 | } |
136 | 136 | |
137 | - return "'" . $this->db->escape($sens) . "'"; |
|
137 | + return "'".$this->db->escape($sens)."'"; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | return "''"; |
@@ -48,7 +48,7 @@ |
||
48 | 48 | case 'sellist': |
49 | 49 | $tmp = ''; |
50 | 50 | $tmpparam = jsonOrUnserialize($obj->param); // $tmp may be array 'options' => array 'c_currencies:code_iso:code_iso' => null |
51 | - if (is_array($tmpparam) && array_key_exists('options', $tmpparam) && $tmpparam['options'] && is_array($tmpparam['options'])) { |
|
51 | + if (is_array($tmpparam) && array_key_exists('options', $tmpparam) && $tmpparam['options'] && is_array($tmpparam['options'])) { |
|
52 | 52 | $tmpkeys = array_keys($tmpparam['options']); |
53 | 53 | $tmp = array_shift($tmpkeys); |
54 | 54 | } |
@@ -353,7 +353,7 @@ |
||
353 | 353 | 'b.montant'=>'rule-computeAmount', |
354 | 354 | 'b.sens'=>'rule-computeDirection' |
355 | 355 | ); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) |
356 | - $this->import_convertvalue_array[$r]=array( |
|
356 | + $this->import_convertvalue_array[$r] = array( |
|
357 | 357 | 'b.piece_num' => array('rule' => 'compute', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'cleanValue', 'element' => 'Accountancy'), |
358 | 358 | 'b.numero_compte'=>array('rule'=>'accountingaccount'), |
359 | 359 | 'b.subledger_account'=>array('rule'=>'accountingaccount'), |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | /** |
79 | 79 | * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. |
80 | 80 | */ |
81 | - public $fields=array( |
|
81 | + public $fields = array( |
|
82 | 82 | 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), |
83 | 83 | 'fk_product_attribute' => array('type'=>'integer:ProductAttribute:variants/class/ProductAttribute.class.php', 'label'=>'ProductAttribute', 'enabled'=>1, 'visible'=>0, 'position'=>10, 'notnull'=>1, 'index'=>1,), |
84 | 84 | 'ref' => array('type'=>'varchar(255)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>''), |
@@ -160,32 +160,32 @@ discard block |
||
160 | 160 | $error++; |
161 | 161 | } |
162 | 162 | if ($error) { |
163 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
163 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
164 | 164 | return -1; |
165 | 165 | } |
166 | 166 | |
167 | 167 | $this->db->begin(); |
168 | 168 | |
169 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . $this->table_element . " ("; |
|
169 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element." ("; |
|
170 | 170 | $sql .= " fk_product_attribute, ref, value, entity, position"; |
171 | 171 | $sql .= ")"; |
172 | 172 | $sql .= " VALUES ("; |
173 | - $sql .= " " . ((int) $this->fk_product_attribute); |
|
174 | - $sql .= ", '" . $this->db->escape($this->ref) . "'"; |
|
175 | - $sql .= ", '" . $this->db->escape($this->value) . "'"; |
|
176 | - $sql .= ", " . ((int) $this->entity); |
|
177 | - $sql .= ", " . ((int) $this->position); |
|
173 | + $sql .= " ".((int) $this->fk_product_attribute); |
|
174 | + $sql .= ", '".$this->db->escape($this->ref)."'"; |
|
175 | + $sql .= ", '".$this->db->escape($this->value)."'"; |
|
176 | + $sql .= ", ".((int) $this->entity); |
|
177 | + $sql .= ", ".((int) $this->position); |
|
178 | 178 | $sql .= ")"; |
179 | 179 | |
180 | 180 | dol_syslog(__METHOD__, LOG_DEBUG); |
181 | 181 | $resql = $this->db->query($sql); |
182 | 182 | if (!$resql) { |
183 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
183 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
184 | 184 | $error++; |
185 | 185 | } |
186 | 186 | |
187 | 187 | if (!$error) { |
188 | - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); |
|
188 | + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | if (!$error && !$notrigger) { |
@@ -226,20 +226,20 @@ discard block |
||
226 | 226 | $error++; |
227 | 227 | } |
228 | 228 | if ($error) { |
229 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
229 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
230 | 230 | return -1; |
231 | 231 | } |
232 | 232 | |
233 | 233 | $sql = "SELECT rowid, fk_product_attribute, ref, value"; |
234 | - $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; |
|
235 | - $sql .= " WHERE rowid = " . ((int) $id); |
|
236 | - $sql .= " AND entity IN (" . getEntity('product') . ")"; |
|
234 | + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; |
|
235 | + $sql .= " WHERE rowid = ".((int) $id); |
|
236 | + $sql .= " AND entity IN (".getEntity('product').")"; |
|
237 | 237 | |
238 | 238 | dol_syslog(__METHOD__, LOG_DEBUG); |
239 | 239 | $resql = $this->db->query($sql); |
240 | 240 | if (!$resql) { |
241 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
242 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
241 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
242 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
243 | 243 | return -1; |
244 | 244 | } |
245 | 245 | |
@@ -274,15 +274,15 @@ discard block |
||
274 | 274 | $sql .= "DISTINCT "; |
275 | 275 | } |
276 | 276 | |
277 | - $sql .= "v.fk_product_attribute, v.rowid, v.ref, v.value FROM " . MAIN_DB_PREFIX . "product_attribute_value v "; |
|
277 | + $sql .= "v.fk_product_attribute, v.rowid, v.ref, v.value FROM ".MAIN_DB_PREFIX."product_attribute_value v "; |
|
278 | 278 | |
279 | 279 | if ($only_used) { |
280 | - $sql .= "LEFT JOIN " . MAIN_DB_PREFIX . "product_attribute_combination2val c2v ON c2v.fk_prod_attr_val = v.rowid "; |
|
281 | - $sql .= "LEFT JOIN " . MAIN_DB_PREFIX . "product_attribute_combination c ON c.rowid = c2v.fk_prod_combination "; |
|
282 | - $sql .= "LEFT JOIN " . MAIN_DB_PREFIX . "product p ON p.rowid = c.fk_product_child "; |
|
280 | + $sql .= "LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination2val c2v ON c2v.fk_prod_attr_val = v.rowid "; |
|
281 | + $sql .= "LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination c ON c.rowid = c2v.fk_prod_combination "; |
|
282 | + $sql .= "LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = c.fk_product_child "; |
|
283 | 283 | } |
284 | 284 | |
285 | - $sql .= "WHERE v.fk_product_attribute = " . ((int) $prodattr_id); |
|
285 | + $sql .= "WHERE v.fk_product_attribute = ".((int) $prodattr_id); |
|
286 | 286 | |
287 | 287 | if ($only_used) { |
288 | 288 | $sql .= " AND c2v.rowid IS NOT NULL AND p.tosell = 1"; |
@@ -334,25 +334,25 @@ discard block |
||
334 | 334 | $error++; |
335 | 335 | } |
336 | 336 | if ($error) { |
337 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
337 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
338 | 338 | return -1; |
339 | 339 | } |
340 | 340 | |
341 | 341 | $this->db->begin(); |
342 | 342 | |
343 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET"; |
|
343 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET"; |
|
344 | 344 | |
345 | - $sql .= " fk_product_attribute = " . ((int) $this->fk_product_attribute); |
|
346 | - $sql .= ", ref = '" . $this->db->escape($this->ref) . "'"; |
|
347 | - $sql .= ", value = '" . $this->db->escape($this->value) . "'"; |
|
348 | - $sql .= ", position = " . ((int) $this->position); |
|
345 | + $sql .= " fk_product_attribute = ".((int) $this->fk_product_attribute); |
|
346 | + $sql .= ", ref = '".$this->db->escape($this->ref)."'"; |
|
347 | + $sql .= ", value = '".$this->db->escape($this->value)."'"; |
|
348 | + $sql .= ", position = ".((int) $this->position); |
|
349 | 349 | |
350 | - $sql .= " WHERE rowid = " . ((int) $this->id); |
|
350 | + $sql .= " WHERE rowid = ".((int) $this->id); |
|
351 | 351 | |
352 | 352 | dol_syslog(__METHOD__, LOG_DEBUG); |
353 | 353 | $resql = $this->db->query($sql); |
354 | 354 | if (!$resql) { |
355 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
355 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
356 | 356 | $error++; |
357 | 357 | } |
358 | 358 | |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | $error++; |
396 | 396 | } |
397 | 397 | if ($error) { |
398 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
398 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
399 | 399 | return -1; |
400 | 400 | } |
401 | 401 | |
@@ -419,12 +419,12 @@ discard block |
||
419 | 419 | } |
420 | 420 | |
421 | 421 | if (!$error) { |
422 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . $this->table_element . " WHERE rowid = " . ((int) $this->id); |
|
422 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element." WHERE rowid = ".((int) $this->id); |
|
423 | 423 | |
424 | 424 | dol_syslog(__METHOD__, LOG_DEBUG); |
425 | 425 | $resql = $this->db->query($sql); |
426 | 426 | if (!$resql) { |
427 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
427 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
428 | 428 | $error++; |
429 | 429 | } |
430 | 430 | } |
@@ -457,16 +457,16 @@ discard block |
||
457 | 457 | $error++; |
458 | 458 | } |
459 | 459 | if ($error) { |
460 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
460 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
461 | 461 | return -1; |
462 | 462 | } |
463 | 463 | |
464 | - $sql = "SELECT COUNT(*) AS nb FROM " . MAIN_DB_PREFIX . "product_attribute_combination2val WHERE fk_prod_attr_val = " . ((int) $this->id); |
|
464 | + $sql = "SELECT COUNT(*) AS nb FROM ".MAIN_DB_PREFIX."product_attribute_combination2val WHERE fk_prod_attr_val = ".((int) $this->id); |
|
465 | 465 | |
466 | 466 | dol_syslog(__METHOD__, LOG_DEBUG); |
467 | 467 | $resql = $this->db->query($sql); |
468 | 468 | if (!$resql) { |
469 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
469 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
470 | 470 | return -1; |
471 | 471 | } |
472 | 472 |
@@ -303,7 +303,7 @@ |
||
303 | 303 | $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'"; |
304 | 304 | } |
305 | 305 | if (preg_match('/_dtend$/', $key)) { |
306 | - $sql .= " AND t.".$db->escape($columnName)." <= '" . $db->idate($search[$key])."'"; |
|
306 | + $sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'"; |
|
307 | 307 | } |
308 | 308 | } |
309 | 309 | } |