@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; |
| 99 | 99 | if ($cancel) { |
| 100 | 100 | if (!empty($backtopage)) { |
| 101 | - header("Location: " . $backtopage); |
|
| 101 | + header("Location: ".$backtopage); |
|
| 102 | 102 | exit; |
| 103 | 103 | } |
| 104 | 104 | $action = ''; |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | $result = $object->addLine($line_ref, $line_value); |
| 128 | 128 | if ($result > 0) { |
| 129 | 129 | setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); |
| 130 | - header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $object->id); |
|
| 130 | + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$object->id); |
|
| 131 | 131 | exit(); |
| 132 | 132 | } else { |
| 133 | 133 | setEventMessages($object->error, $object->errors, 'errors'); |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $result = $object->updateLine($lineid, $line_ref, $line_value); |
| 141 | 141 | if ($result > 0) { |
| 142 | 142 | setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); |
| 143 | - header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $object->id); |
|
| 143 | + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$object->id); |
|
| 144 | 144 | exit(); |
| 145 | 145 | } else { |
| 146 | 146 | setEventMessages($object->error, $object->errors, 'errors'); |
@@ -160,33 +160,33 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | // Part to create |
| 162 | 162 | if ($action == 'create') { |
| 163 | - print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("ProductAttribute")), '', 'object_' . $object->picto); |
|
| 163 | + print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("ProductAttribute")), '', 'object_'.$object->picto); |
|
| 164 | 164 | |
| 165 | - print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">'; |
|
| 166 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 165 | + print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; |
|
| 166 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 167 | 167 | print '<input type="hidden" name="action" value="add">'; |
| 168 | 168 | if ($backtopage) { |
| 169 | - print '<input type="hidden" name="backtopage" value="' . $backtopage . '">'; |
|
| 169 | + print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; |
|
| 170 | 170 | } |
| 171 | 171 | if ($backtopageforcancel) { |
| 172 | - print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">'; |
|
| 172 | + print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">'; |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | print dol_get_fiche_head(array(), ''); |
| 176 | 176 | |
| 177 | - print '<table class="border centpercent tableforfieldcreate">' . "\n"; |
|
| 177 | + print '<table class="border centpercent tableforfieldcreate">'."\n"; |
|
| 178 | 178 | |
| 179 | 179 | // Common attributes |
| 180 | - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php'; |
|
| 180 | + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php'; |
|
| 181 | 181 | |
| 182 | - print '</table>' . "\n"; |
|
| 182 | + print '</table>'."\n"; |
|
| 183 | 183 | |
| 184 | 184 | print dol_get_fiche_end(); |
| 185 | 185 | |
| 186 | 186 | print '<div class="center">'; |
| 187 | - print '<input type="submit" class="button" name="add" value="' . dol_escape_htmltag($langs->trans("Create")) . '">'; |
|
| 187 | + print '<input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans("Create")).'">'; |
|
| 188 | 188 | print ' '; |
| 189 | - print '<input type="' . ($backtopage ? "submit" : "button") . '" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag($langs->trans("Cancel")) . '"' . ($backtopage ? '' : ' onclick="history.go(-1)"') . '>'; // Cancel for create does not post form if we don't know the backtopage |
|
| 189 | + print '<input type="'.($backtopage ? "submit" : "button").'" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'"'.($backtopage ? '' : ' onclick="history.go(-1)"').'>'; // Cancel for create does not post form if we don't know the backtopage |
|
| 190 | 190 | print '</div>'; |
| 191 | 191 | |
| 192 | 192 | print '</form>'; |
@@ -194,25 +194,25 @@ discard block |
||
| 194 | 194 | dol_set_focus('input[name="ref"]'); |
| 195 | 195 | } elseif (($id || $ref) && $action == 'edit') { |
| 196 | 196 | // Part to edit record |
| 197 | - print load_fiche_titre($langs->trans("ProductAttribute"), '', 'object_' . $object->picto); |
|
| 197 | + print load_fiche_titre($langs->trans("ProductAttribute"), '', 'object_'.$object->picto); |
|
| 198 | 198 | |
| 199 | - print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">'; |
|
| 200 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 199 | + print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; |
|
| 200 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 201 | 201 | print '<input type="hidden" name="action" value="update">'; |
| 202 | - print '<input type="hidden" name="id" value="' . $object->id . '">'; |
|
| 202 | + print '<input type="hidden" name="id" value="'.$object->id.'">'; |
|
| 203 | 203 | if ($backtopage) { |
| 204 | - print '<input type="hidden" name="backtopage" value="' . $backtopage . '">'; |
|
| 204 | + print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; |
|
| 205 | 205 | } |
| 206 | 206 | if ($backtopageforcancel) { |
| 207 | - print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">'; |
|
| 207 | + print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">'; |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | print dol_get_fiche_head(); |
| 211 | 211 | |
| 212 | - print '<table class="border centpercent tableforfieldedit">' . "\n"; |
|
| 212 | + print '<table class="border centpercent tableforfieldedit">'."\n"; |
|
| 213 | 213 | |
| 214 | 214 | // Common attributes |
| 215 | - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php'; |
|
| 215 | + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; |
|
| 216 | 216 | |
| 217 | 217 | $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
| 218 | 218 | print $hookmanager->resPrint; |
@@ -221,8 +221,8 @@ discard block |
||
| 221 | 221 | |
| 222 | 222 | print dol_get_fiche_end(); |
| 223 | 223 | |
| 224 | - print '<div class="center"><input type="submit" class="button button-save" name="save" value="' . $langs->trans("Save") . '">'; |
|
| 225 | - print ' <input type="submit" class="button button-cancel" name="cancel" value="' . $langs->trans("Cancel") . '">'; |
|
| 224 | + print '<div class="center"><input type="submit" class="button button-save" name="save" value="'.$langs->trans("Save").'">'; |
|
| 225 | + print ' <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">'; |
|
| 226 | 226 | print '</div>'; |
| 227 | 227 | |
| 228 | 228 | print '</form>'; |
@@ -237,12 +237,12 @@ discard block |
||
| 237 | 237 | |
| 238 | 238 | // Confirmation to delete |
| 239 | 239 | if ($action == 'delete') { |
| 240 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteMyObject'), $langs->trans('ProductAttributeDeleteDialog'), 'confirm_delete', '', 0, 1); |
|
| 240 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteMyObject'), $langs->trans('ProductAttributeDeleteDialog'), 'confirm_delete', '', 0, 1); |
|
| 241 | 241 | } elseif ($action == 'ask_deleteline') { |
| 242 | 242 | // Confirmation to delete line |
| 243 | 243 | $object_value = new ProductAttributeValue($db); |
| 244 | 244 | if ($object_value->fetch($lineid) > 0) { |
| 245 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans('DeleteLine'), $langs->trans('ProductAttributeValueDeleteDialog', dol_htmlentities($object_value->value), dol_htmlentities($object_value->ref)), 'confirm_deleteline', '', 0, 1); |
|
| 245 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ProductAttributeValueDeleteDialog', dol_htmlentities($object_value->value), dol_htmlentities($object_value->ref)), 'confirm_deleteline', '', 0, 1); |
|
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | 248 | |
@@ -260,18 +260,18 @@ discard block |
||
| 260 | 260 | |
| 261 | 261 | // Object card |
| 262 | 262 | // ------------------------------------------------------------ |
| 263 | - $backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT . '/variants/list.php?leftmenu=?restore_lastsearch_values=1'); |
|
| 264 | - $linkback = '<a href="' . dol_sanitizeUrl($backtolist) . '">' . $langs->trans("BackToList") . '</a>'; |
|
| 263 | + $backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/variants/list.php?leftmenu=?restore_lastsearch_values=1'); |
|
| 264 | + $linkback = '<a href="'.dol_sanitizeUrl($backtolist).'">'.$langs->trans("BackToList").'</a>'; |
|
| 265 | 265 | |
| 266 | 266 | dol_banner_tab($object, 'id', $linkback); |
| 267 | 267 | |
| 268 | 268 | print '<div class="fichecenter">'; |
| 269 | 269 | print '<div class="fichehalfleft">'; |
| 270 | 270 | print '<div class="underbanner clearboth"></div>'; |
| 271 | - print '<table class="border centpercent tableforfield">' . "\n"; |
|
| 271 | + print '<table class="border centpercent tableforfield">'."\n"; |
|
| 272 | 272 | |
| 273 | 273 | // Common attributes |
| 274 | - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php'; |
|
| 274 | + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; |
|
| 275 | 275 | |
| 276 | 276 | print '</table>'; |
| 277 | 277 | print '</div>'; |
@@ -283,19 +283,19 @@ discard block |
||
| 283 | 283 | |
| 284 | 284 | // Buttons for actions |
| 285 | 285 | if ($action != 'editline') { |
| 286 | - print '<div class="tabsAction">' . "\n"; |
|
| 286 | + print '<div class="tabsAction">'."\n"; |
|
| 287 | 287 | $parameters = array(); |
| 288 | - $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
| 288 | + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
|
| 289 | 289 | if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
| 290 | 290 | |
| 291 | 291 | if (empty($reshook)) { |
| 292 | 292 | // Modify |
| 293 | - print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit', '', $permissiontoedit); |
|
| 293 | + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit', '', $permissiontoedit); |
|
| 294 | 294 | |
| 295 | 295 | // Delete (need delete permission, or if draft, just need create/modify permission) |
| 296 | - print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=delete', '', $permissiontodelete); |
|
| 296 | + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete', '', $permissiontodelete); |
|
| 297 | 297 | } |
| 298 | - print '</div>' . "\n"; |
|
| 298 | + print '</div>'."\n"; |
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | /* |
@@ -305,24 +305,24 @@ discard block |
||
| 305 | 305 | // Show object lines |
| 306 | 306 | $result = $object->getLinesArray(); |
| 307 | 307 | |
| 308 | - print load_fiche_titre($langs->trans("PossibleValues") . (!empty($object->lines) ? '<span class="opacitymedium colorblack paddingleft">(' . count($object->lines) . ')</span>' : '')); |
|
| 308 | + print load_fiche_titre($langs->trans("PossibleValues").(!empty($object->lines) ? '<span class="opacitymedium colorblack paddingleft">('.count($object->lines).')</span>' : '')); |
|
| 309 | 309 | |
| 310 | - print ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '' : '#line_' . GETPOST('lineid', 'int')) . '" method="POST"> |
|
| 311 | - <input type="hidden" name="token" value="' . newToken() . '"> |
|
| 312 | - <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '"> |
|
| 310 | + print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '' : '#line_'.GETPOST('lineid', 'int')).'" method="POST"> |
|
| 311 | + <input type="hidden" name="token" value="' . newToken().'"> |
|
| 312 | + <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'"> |
|
| 313 | 313 | <input type="hidden" name="mode" value=""> |
| 314 | 314 | <input type="hidden" name="page_y" value=""> |
| 315 | - <input type="hidden" name="id" value="' . $object->id . '"> |
|
| 315 | + <input type="hidden" name="id" value="' . $object->id.'"> |
|
| 316 | 316 | '; |
| 317 | 317 | if ($backtopage) { |
| 318 | - print '<input type="hidden" name="backtopage" value="' . $backtopage . '">'; |
|
| 318 | + print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; |
|
| 319 | 319 | } |
| 320 | 320 | if ($backtopageforcancel) { |
| 321 | - print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">'; |
|
| 321 | + print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">'; |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | if (!empty($conf->use_javascript_ajax)) { |
| 325 | - include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; |
|
| 325 | + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; |
|
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | print '<div class="div-table-responsive-no-min">'; |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | /** |
| 99 | 99 | * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. |
| 100 | 100 | */ |
| 101 | - public $fields=array( |
|
| 101 | + public $fields = array( |
|
| 102 | 102 | 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), |
| 103 | 103 | 'ref' => array('type'=>'varchar(255)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>'width200'), |
| 104 | 104 | 'ref_ext' => array('type' => 'varchar(255)', 'label' => 'ExternalRef', 'enabled' => 1, 'visible' => 0, 'position' => 20, 'searchall'=>1), |
@@ -224,32 +224,32 @@ discard block |
||
| 224 | 224 | $error++; |
| 225 | 225 | } |
| 226 | 226 | if ($error) { |
| 227 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
| 227 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
| 228 | 228 | return -1; |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | $this->db->begin(); |
| 232 | 232 | |
| 233 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . $this->table_element . " ("; |
|
| 233 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element." ("; |
|
| 234 | 234 | $sql .= " ref, ref_ext, label, entity, position"; |
| 235 | 235 | $sql .= ")"; |
| 236 | 236 | $sql .= " VALUES ("; |
| 237 | - $sql .= " '" . $this->db->escape($this->ref) . "'"; |
|
| 238 | - $sql .= ", '" . $this->db->escape($this->ref_ext) . "'"; |
|
| 239 | - $sql .= ", '" . $this->db->escape($this->label) . "'"; |
|
| 240 | - $sql .= ", " . ((int) $this->entity); |
|
| 241 | - $sql .= ", " . ((int) $this->position); |
|
| 237 | + $sql .= " '".$this->db->escape($this->ref)."'"; |
|
| 238 | + $sql .= ", '".$this->db->escape($this->ref_ext)."'"; |
|
| 239 | + $sql .= ", '".$this->db->escape($this->label)."'"; |
|
| 240 | + $sql .= ", ".((int) $this->entity); |
|
| 241 | + $sql .= ", ".((int) $this->position); |
|
| 242 | 242 | $sql .= ")"; |
| 243 | 243 | |
| 244 | 244 | dol_syslog(__METHOD__, LOG_DEBUG); |
| 245 | 245 | $resql = $this->db->query($sql); |
| 246 | 246 | if (!$resql) { |
| 247 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 247 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 248 | 248 | $error++; |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | if (!$error) { |
| 252 | - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); |
|
| 252 | + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | if (!$error && !$notrigger) { |
@@ -290,20 +290,20 @@ discard block |
||
| 290 | 290 | $error++; |
| 291 | 291 | } |
| 292 | 292 | if ($error) { |
| 293 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
| 293 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
| 294 | 294 | return -1; |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | $sql = "SELECT rowid, ref, ref_ext, label, position"; |
| 298 | - $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; |
|
| 299 | - $sql .= " WHERE rowid = " . ((int) $id); |
|
| 300 | - $sql .= " AND entity IN (" . getEntity('product') . ")"; |
|
| 298 | + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; |
|
| 299 | + $sql .= " WHERE rowid = ".((int) $id); |
|
| 300 | + $sql .= " AND entity IN (".getEntity('product').")"; |
|
| 301 | 301 | |
| 302 | 302 | dol_syslog(__METHOD__, LOG_DEBUG); |
| 303 | 303 | $resql = $this->db->query($sql); |
| 304 | 304 | if (!$resql) { |
| 305 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 306 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
| 305 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 306 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
| 307 | 307 | return -1; |
| 308 | 308 | } |
| 309 | 309 | |
@@ -333,14 +333,14 @@ discard block |
||
| 333 | 333 | $return = array(); |
| 334 | 334 | |
| 335 | 335 | $sql = "SELECT rowid, ref, ref_ext, label, position"; |
| 336 | - $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; |
|
| 337 | - $sql .= " WHERE entity IN (" . getEntity('product') . ")"; |
|
| 336 | + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; |
|
| 337 | + $sql .= " WHERE entity IN (".getEntity('product').")"; |
|
| 338 | 338 | $sql .= $this->db->order("position", "asc"); |
| 339 | 339 | |
| 340 | 340 | dol_syslog(__METHOD__, LOG_DEBUG); |
| 341 | 341 | $resql = $this->db->query($sql); |
| 342 | 342 | if (!$resql) { |
| 343 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 343 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 344 | 344 | dol_print_error($this->db); |
| 345 | 345 | return $return; |
| 346 | 346 | } |
@@ -392,25 +392,25 @@ discard block |
||
| 392 | 392 | $error++; |
| 393 | 393 | } |
| 394 | 394 | if ($error) { |
| 395 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
| 395 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
| 396 | 396 | return -1; |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | $this->db->begin(); |
| 400 | 400 | |
| 401 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET"; |
|
| 401 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET"; |
|
| 402 | 402 | |
| 403 | - $sql .= " ref = '" . $this->db->escape($this->ref) . "'"; |
|
| 404 | - $sql .= ", ref_ext = '" . $this->db->escape($this->ref_ext) . "'"; |
|
| 405 | - $sql .= ", label = '" . $this->db->escape($this->label) . "'"; |
|
| 406 | - $sql .= ", position = " . ((int) $this->position); |
|
| 403 | + $sql .= " ref = '".$this->db->escape($this->ref)."'"; |
|
| 404 | + $sql .= ", ref_ext = '".$this->db->escape($this->ref_ext)."'"; |
|
| 405 | + $sql .= ", label = '".$this->db->escape($this->label)."'"; |
|
| 406 | + $sql .= ", position = ".((int) $this->position); |
|
| 407 | 407 | |
| 408 | - $sql .= " WHERE rowid = " . ((int) $this->id); |
|
| 408 | + $sql .= " WHERE rowid = ".((int) $this->id); |
|
| 409 | 409 | |
| 410 | 410 | dol_syslog(__METHOD__, LOG_DEBUG); |
| 411 | 411 | $resql = $this->db->query($sql); |
| 412 | 412 | if (!$resql) { |
| 413 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 413 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 414 | 414 | $error++; |
| 415 | 415 | } |
| 416 | 416 | |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | $error++; |
| 454 | 454 | } |
| 455 | 455 | if ($error) { |
| 456 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
| 456 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
| 457 | 457 | return -1; |
| 458 | 458 | } |
| 459 | 459 | |
@@ -478,25 +478,25 @@ discard block |
||
| 478 | 478 | |
| 479 | 479 | if (!$error) { |
| 480 | 480 | // Delete values |
| 481 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . $this->table_element_line; |
|
| 482 | - $sql .= " WHERE " . $this->fk_element . " = " . ((int) $this->id); |
|
| 481 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element_line; |
|
| 482 | + $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
|
| 483 | 483 | |
| 484 | - dol_syslog(__METHOD__ . ' - Delete values', LOG_DEBUG); |
|
| 484 | + dol_syslog(__METHOD__.' - Delete values', LOG_DEBUG); |
|
| 485 | 485 | $resql = $this->db->query($sql); |
| 486 | 486 | if (!$resql) { |
| 487 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 487 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 488 | 488 | $error++; |
| 489 | 489 | } |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | if (!$error) { |
| 493 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . $this->table_element; |
|
| 494 | - $sql .= " WHERE rowid = " . ((int) $this->id); |
|
| 493 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element; |
|
| 494 | + $sql .= " WHERE rowid = ".((int) $this->id); |
|
| 495 | 495 | |
| 496 | - dol_syslog(__METHOD__ . ' - Delete attribute', LOG_DEBUG); |
|
| 496 | + dol_syslog(__METHOD__.' - Delete attribute', LOG_DEBUG); |
|
| 497 | 497 | $resql = $this->db->query($sql); |
| 498 | 498 | if (!$resql) { |
| 499 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 499 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 500 | 500 | $error++; |
| 501 | 501 | } |
| 502 | 502 | } |
@@ -535,15 +535,15 @@ discard block |
||
| 535 | 535 | $error++; |
| 536 | 536 | } |
| 537 | 537 | if ($error) { |
| 538 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
| 538 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
| 539 | 539 | return -1; |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | 542 | $sql = "SELECT td.rowid, td.fk_product_attribute, td.ref, td.value, td.position"; |
| 543 | - $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element_line . " AS td"; |
|
| 544 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $this->table_element . " AS t ON t.rowid = td." . $this->fk_element; |
|
| 545 | - $sql .= " WHERE t.rowid = " . ((int) $this->id); |
|
| 546 | - $sql .= " AND t.entity IN (" . getEntity('product') . ")"; |
|
| 543 | + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element_line." AS td"; |
|
| 544 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$this->table_element." AS t ON t.rowid = td.".$this->fk_element; |
|
| 545 | + $sql .= " WHERE t.rowid = ".((int) $this->id); |
|
| 546 | + $sql .= " AND t.entity IN (".getEntity('product').")"; |
|
| 547 | 547 | if ($filters) { |
| 548 | 548 | $sql .= $filters; |
| 549 | 549 | } |
@@ -552,8 +552,8 @@ discard block |
||
| 552 | 552 | dol_syslog(__METHOD__, LOG_DEBUG); |
| 553 | 553 | $resql = $this->db->query($sql); |
| 554 | 554 | if (!$resql) { |
| 555 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 556 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
| 555 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 556 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
| 557 | 557 | return -3; |
| 558 | 558 | } |
| 559 | 559 | |
@@ -607,7 +607,7 @@ discard block |
||
| 607 | 607 | public function addLine($ref, $value, $position = -1, $notrigger = 0) |
| 608 | 608 | { |
| 609 | 609 | global $langs, $user; |
| 610 | - dol_syslog(__METHOD__ . " id=".$this->id.", ref=".$ref.", value=".$value.", notrigger=".$notrigger); |
|
| 610 | + dol_syslog(__METHOD__." id=".$this->id.", ref=".$ref.", value=".$value.", notrigger=".$notrigger); |
|
| 611 | 611 | $error = 0; |
| 612 | 612 | |
| 613 | 613 | // Clean parameters |
@@ -619,7 +619,7 @@ discard block |
||
| 619 | 619 | $error++; |
| 620 | 620 | } |
| 621 | 621 | if ($error) { |
| 622 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
| 622 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
| 623 | 623 | return -1; |
| 624 | 624 | } |
| 625 | 625 | |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | { |
| 669 | 669 | global $user; |
| 670 | 670 | |
| 671 | - dol_syslog(__METHOD__ . " lineid=$lineid, ref=$ref, value=$value, notrigger=$notrigger"); |
|
| 671 | + dol_syslog(__METHOD__." lineid=$lineid, ref=$ref, value=$value, notrigger=$notrigger"); |
|
| 672 | 672 | |
| 673 | 673 | // Clean parameters |
| 674 | 674 | $lineid = $lineid > 0 ? $lineid : 0; |
@@ -709,7 +709,7 @@ discard block |
||
| 709 | 709 | */ |
| 710 | 710 | public function deleteLine(User $user, $lineid, $notrigger = 0) |
| 711 | 711 | { |
| 712 | - dol_syslog(__METHOD__ . " lineid=$lineid, notrigger=$notrigger"); |
|
| 712 | + dol_syslog(__METHOD__." lineid=$lineid, notrigger=$notrigger"); |
|
| 713 | 713 | |
| 714 | 714 | // Clean parameters |
| 715 | 715 | $lineid = $lineid > 0 ? $lineid : 0; |
@@ -756,19 +756,19 @@ discard block |
||
| 756 | 756 | $error++; |
| 757 | 757 | } |
| 758 | 758 | if ($error) { |
| 759 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
| 759 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
| 760 | 760 | return -1; |
| 761 | 761 | } |
| 762 | 762 | |
| 763 | 763 | $sql = "SELECT COUNT(*) AS count"; |
| 764 | - $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element_line; |
|
| 765 | - $sql .= " WHERE " . $this->fk_element . " = " . ((int) $this->id); |
|
| 764 | + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element_line; |
|
| 765 | + $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
|
| 766 | 766 | |
| 767 | 767 | dol_syslog(__METHOD__, LOG_DEBUG); |
| 768 | 768 | $resql = $this->db->query($sql); |
| 769 | 769 | if (!$resql) { |
| 770 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 771 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
| 770 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 771 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
| 772 | 772 | return -1; |
| 773 | 773 | } |
| 774 | 774 | |
@@ -799,21 +799,21 @@ discard block |
||
| 799 | 799 | $error++; |
| 800 | 800 | } |
| 801 | 801 | if ($error) { |
| 802 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
| 802 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
| 803 | 803 | return -1; |
| 804 | 804 | } |
| 805 | 805 | |
| 806 | 806 | $sql = "SELECT COUNT(*) AS count"; |
| 807 | - $sql .= " FROM " . MAIN_DB_PREFIX . "product_attribute_combination2val AS pac2v"; |
|
| 808 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_attribute_combination AS pac ON pac2v.fk_prod_combination = pac.rowid"; |
|
| 809 | - $sql .= " WHERE pac2v.fk_prod_attr = " . ((int) $this->id); |
|
| 810 | - $sql .= " AND pac.entity IN (" . getEntity('product') . ")"; |
|
| 807 | + $sql .= " FROM ".MAIN_DB_PREFIX."product_attribute_combination2val AS pac2v"; |
|
| 808 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination AS pac ON pac2v.fk_prod_combination = pac.rowid"; |
|
| 809 | + $sql .= " WHERE pac2v.fk_prod_attr = ".((int) $this->id); |
|
| 810 | + $sql .= " AND pac.entity IN (".getEntity('product').")"; |
|
| 811 | 811 | |
| 812 | 812 | dol_syslog(__METHOD__, LOG_DEBUG); |
| 813 | 813 | $resql = $this->db->query($sql); |
| 814 | 814 | if (!$resql) { |
| 815 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 816 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
| 815 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 816 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
| 817 | 817 | return -1; |
| 818 | 818 | } |
| 819 | 819 | |
@@ -843,16 +843,16 @@ discard block |
||
| 843 | 843 | $error++; |
| 844 | 844 | } |
| 845 | 845 | if ($error) { |
| 846 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
| 846 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
| 847 | 847 | return -1; |
| 848 | 848 | } |
| 849 | 849 | |
| 850 | - $sql = "SELECT COUNT(*) AS nb FROM " . MAIN_DB_PREFIX . "product_attribute_combination2val WHERE fk_prod_attr = " . ((int) $this->id); |
|
| 850 | + $sql = "SELECT COUNT(*) AS nb FROM ".MAIN_DB_PREFIX."product_attribute_combination2val WHERE fk_prod_attr = ".((int) $this->id); |
|
| 851 | 851 | |
| 852 | 852 | dol_syslog(__METHOD__, LOG_DEBUG); |
| 853 | 853 | $resql = $this->db->query($sql); |
| 854 | 854 | if (!$resql) { |
| 855 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
| 855 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
| 856 | 856 | return -1; |
| 857 | 857 | } |
| 858 | 858 | |
@@ -876,8 +876,8 @@ discard block |
||
| 876 | 876 | { |
| 877 | 877 | // Count number of attributes to reorder (according to choice $renum) |
| 878 | 878 | $nl = 0; |
| 879 | - $sql = "SELECT count(rowid) FROM " . MAIN_DB_PREFIX . $this->table_element; |
|
| 880 | - $sql .= " WHERE entity IN (" . getEntity('product') . ")"; |
|
| 879 | + $sql = "SELECT count(rowid) FROM ".MAIN_DB_PREFIX.$this->table_element; |
|
| 880 | + $sql .= " WHERE entity IN (".getEntity('product').")"; |
|
| 881 | 881 | if (!$renum) { |
| 882 | 882 | $sql .= " AND position = 0"; |
| 883 | 883 | } else { |
@@ -897,11 +897,11 @@ discard block |
||
| 897 | 897 | $rows = array(); |
| 898 | 898 | |
| 899 | 899 | // We first search all attributes |
| 900 | - $sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . $this->table_element; |
|
| 901 | - $sql .= " WHERE entity IN (" . getEntity('product') . ")"; |
|
| 902 | - $sql .= " ORDER BY position ASC, rowid " . $rowidorder; |
|
| 900 | + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$this->table_element; |
|
| 901 | + $sql .= " WHERE entity IN (".getEntity('product').")"; |
|
| 902 | + $sql .= " ORDER BY position ASC, rowid ".$rowidorder; |
|
| 903 | 903 | |
| 904 | - dol_syslog(__METHOD__ . " search all attributes", LOG_DEBUG); |
|
| 904 | + dol_syslog(__METHOD__." search all attributes", LOG_DEBUG); |
|
| 905 | 905 | $resql = $this->db->query($sql); |
| 906 | 906 | if ($resql) { |
| 907 | 907 | $i = 0; |
@@ -936,8 +936,8 @@ discard block |
||
| 936 | 936 | { |
| 937 | 937 | global $hookmanager; |
| 938 | 938 | |
| 939 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET position = " . ((int) $position); |
|
| 940 | - $sql .= " WHERE rowid = " . ((int) $rowid); |
|
| 939 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET position = ".((int) $position); |
|
| 940 | + $sql .= " WHERE rowid = ".((int) $rowid); |
|
| 941 | 941 | |
| 942 | 942 | dol_syslog(__METHOD__, LOG_DEBUG); |
| 943 | 943 | if (!$this->db->query($sql)) { |
@@ -959,8 +959,8 @@ discard block |
||
| 959 | 959 | */ |
| 960 | 960 | public function getPositionOfAttribute($rowid) |
| 961 | 961 | { |
| 962 | - $sql = "SELECT position FROM " . MAIN_DB_PREFIX . $this->table_element; |
|
| 963 | - $sql .= " WHERE entity IN (" . getEntity('product') . ")"; |
|
| 962 | + $sql = "SELECT position FROM ".MAIN_DB_PREFIX.$this->table_element; |
|
| 963 | + $sql .= " WHERE entity IN (".getEntity('product').")"; |
|
| 964 | 964 | |
| 965 | 965 | dol_syslog(__METHOD__, LOG_DEBUG); |
| 966 | 966 | $resql = $this->db->query($sql); |
@@ -1023,12 +1023,12 @@ discard block |
||
| 1023 | 1023 | public function updateAttributePositionUp($rowid, $position) |
| 1024 | 1024 | { |
| 1025 | 1025 | if ($position > 1) { |
| 1026 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET position = " . ((int) $position); |
|
| 1027 | - $sql .= " WHERE entity IN (" . getEntity('product') . ")"; |
|
| 1028 | - $sql .= " AND position = " . ((int) ($position - 1)); |
|
| 1026 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET position = ".((int) $position); |
|
| 1027 | + $sql .= " WHERE entity IN (".getEntity('product').")"; |
|
| 1028 | + $sql .= " AND position = ".((int) ($position - 1)); |
|
| 1029 | 1029 | if ($this->db->query($sql)) { |
| 1030 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET position = " . ((int) ($position - 1)); |
|
| 1031 | - $sql .= " WHERE rowid = " . ((int) $rowid); |
|
| 1030 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET position = ".((int) ($position - 1)); |
|
| 1031 | + $sql .= " WHERE rowid = ".((int) $rowid); |
|
| 1032 | 1032 | if (!$this->db->query($sql)) { |
| 1033 | 1033 | dol_print_error($this->db); |
| 1034 | 1034 | } |
@@ -1049,12 +1049,12 @@ discard block |
||
| 1049 | 1049 | public function updateAttributePositionDown($rowid, $position, $max) |
| 1050 | 1050 | { |
| 1051 | 1051 | if ($position < $max) { |
| 1052 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET position = " . ((int) $position); |
|
| 1053 | - $sql .= " WHERE entity IN (" . getEntity('product') . ")"; |
|
| 1054 | - $sql .= " AND position = " . ((int) ($position + 1)); |
|
| 1052 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET position = ".((int) $position); |
|
| 1053 | + $sql .= " WHERE entity IN (".getEntity('product').")"; |
|
| 1054 | + $sql .= " AND position = ".((int) ($position + 1)); |
|
| 1055 | 1055 | if ($this->db->query($sql)) { |
| 1056 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET position = " . ((int) ($position + 1)); |
|
| 1057 | - $sql .= " WHERE rowid = " . ((int) $rowid); |
|
| 1056 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET position = ".((int) ($position + 1)); |
|
| 1057 | + $sql .= " WHERE rowid = ".((int) $rowid); |
|
| 1058 | 1058 | if (!$this->db->query($sql)) { |
| 1059 | 1059 | dol_print_error($this->db); |
| 1060 | 1060 | } |
@@ -1072,8 +1072,8 @@ discard block |
||
| 1072 | 1072 | public function getMaxAttributesPosition() |
| 1073 | 1073 | { |
| 1074 | 1074 | // Search the last position of attributes |
| 1075 | - $sql = "SELECT max(position) FROM " . MAIN_DB_PREFIX . $this->table_element; |
|
| 1076 | - $sql .= " WHERE entity IN (" . getEntity('product') . ")"; |
|
| 1075 | + $sql = "SELECT max(position) FROM ".MAIN_DB_PREFIX.$this->table_element; |
|
| 1076 | + $sql .= " WHERE entity IN (".getEntity('product').")"; |
|
| 1077 | 1077 | |
| 1078 | 1078 | dol_syslog(__METHOD__, LOG_DEBUG); |
| 1079 | 1079 | $resql = $this->db->query($sql); |
@@ -1119,17 +1119,17 @@ discard block |
||
| 1119 | 1119 | |
| 1120 | 1120 | $result = ''; |
| 1121 | 1121 | |
| 1122 | - $label = img_picto('', $this->picto) . ' <u>' . $langs->trans("ProductAttribute") . '</u>'; |
|
| 1122 | + $label = img_picto('', $this->picto).' <u>'.$langs->trans("ProductAttribute").'</u>'; |
|
| 1123 | 1123 | if (isset($this->status)) { |
| 1124 | - $label .= ' ' . $this->getLibStatut(5); |
|
| 1124 | + $label .= ' '.$this->getLibStatut(5); |
|
| 1125 | 1125 | } |
| 1126 | 1126 | $label .= '<br>'; |
| 1127 | - $label .= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref; |
|
| 1127 | + $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref; |
|
| 1128 | 1128 | if (!empty($this->label)) { |
| 1129 | - $label .= '<br><b>' . $langs->trans('Label') . ':</b> ' . $this->label; |
|
| 1129 | + $label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label; |
|
| 1130 | 1130 | } |
| 1131 | 1131 | |
| 1132 | - $url = dol_buildpath('/variants/card.php', 1) . '?id=' . $this->id; |
|
| 1132 | + $url = dol_buildpath('/variants/card.php', 1).'?id='.$this->id; |
|
| 1133 | 1133 | |
| 1134 | 1134 | if ($option != 'nolink') { |
| 1135 | 1135 | // Add param to save lastsearch_values or not |
@@ -1146,20 +1146,20 @@ discard block |
||
| 1146 | 1146 | if (empty($notooltip)) { |
| 1147 | 1147 | if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { |
| 1148 | 1148 | $label = $langs->trans("ShowProductAttribute"); |
| 1149 | - $linkclose .= ' alt="' . dol_escape_htmltag($label, 1) . '"'; |
|
| 1149 | + $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; |
|
| 1150 | 1150 | } |
| 1151 | - $linkclose .= ' title="' . dol_escape_htmltag($label, 1) . '"'; |
|
| 1152 | - $linkclose .= ' class="classfortooltip' . ($morecss ? ' ' . $morecss : '') . '"'; |
|
| 1151 | + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; |
|
| 1152 | + $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; |
|
| 1153 | 1153 | } else { |
| 1154 | - $linkclose = ($morecss ? ' class="' . $morecss . '"' : ''); |
|
| 1154 | + $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); |
|
| 1155 | 1155 | } |
| 1156 | 1156 | |
| 1157 | 1157 | if ($option == 'nolink' || empty($url)) { |
| 1158 | 1158 | $linkstart = '<span'; |
| 1159 | 1159 | } else { |
| 1160 | - $linkstart = '<a href="' . $url . '"'; |
|
| 1160 | + $linkstart = '<a href="'.$url.'"'; |
|
| 1161 | 1161 | } |
| 1162 | - $linkstart .= $linkclose . '>'; |
|
| 1162 | + $linkstart .= $linkclose.'>'; |
|
| 1163 | 1163 | if ($option == 'nolink' || empty($url)) { |
| 1164 | 1164 | $linkend = '</span>'; |
| 1165 | 1165 | } else { |
@@ -1170,29 +1170,29 @@ discard block |
||
| 1170 | 1170 | |
| 1171 | 1171 | if (empty($this->showphoto_on_popup)) { |
| 1172 | 1172 | if ($withpicto) { |
| 1173 | - $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
| 1173 | + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
| 1174 | 1174 | } |
| 1175 | 1175 | } else { |
| 1176 | 1176 | if ($withpicto) { |
| 1177 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
| 1177 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
| 1178 | 1178 | |
| 1179 | 1179 | list($class, $module) = explode('@', $this->picto); |
| 1180 | - $upload_dir = $conf->$module->multidir_output[$conf->entity] . "/$class/" . dol_sanitizeFileName($this->ref); |
|
| 1180 | + $upload_dir = $conf->$module->multidir_output[$conf->entity]."/$class/".dol_sanitizeFileName($this->ref); |
|
| 1181 | 1181 | $filearray = dol_dir_list($upload_dir, "files"); |
| 1182 | 1182 | $filename = $filearray[0]['name']; |
| 1183 | 1183 | if (!empty($filename)) { |
| 1184 | 1184 | $pospoint = strpos($filearray[0]['name'], '.'); |
| 1185 | 1185 | |
| 1186 | - $pathtophoto = $class . '/' . $this->ref . '/thumbs/' . substr($filename, 0, $pospoint) . '_mini' . substr($filename, $pospoint); |
|
| 1187 | - if (!getDolGlobalString(strtoupper($module . '_' . $class) . '_FORMATLISTPHOTOSASUSERS')) { |
|
| 1188 | - $result .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo' . $module . '" alt="No photo" border="0" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $module . '&entity=' . $conf->entity . '&file=' . urlencode($pathtophoto) . '"></div></div>'; |
|
| 1186 | + $pathtophoto = $class.'/'.$this->ref.'/thumbs/'.substr($filename, 0, $pospoint).'_mini'.substr($filename, $pospoint); |
|
| 1187 | + if (!getDolGlobalString(strtoupper($module.'_'.$class).'_FORMATLISTPHOTOSASUSERS')) { |
|
| 1188 | + $result .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$module.'" alt="No photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$module.'&entity='.$conf->entity.'&file='.urlencode($pathtophoto).'"></div></div>'; |
|
| 1189 | 1189 | } else { |
| 1190 | - $result .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photouserphoto userphoto" alt="No photo" border="0" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $module . '&entity=' . $conf->entity . '&file=' . urlencode($pathtophoto) . '"></div>'; |
|
| 1190 | + $result .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photouserphoto userphoto" alt="No photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$module.'&entity='.$conf->entity.'&file='.urlencode($pathtophoto).'"></div>'; |
|
| 1191 | 1191 | } |
| 1192 | 1192 | |
| 1193 | 1193 | $result .= '</div>'; |
| 1194 | 1194 | } else { |
| 1195 | - $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
| 1195 | + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
| 1196 | 1196 | } |
| 1197 | 1197 | } |
| 1198 | 1198 | } |
@@ -1279,9 +1279,9 @@ discard block |
||
| 1279 | 1279 | $dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); |
| 1280 | 1280 | foreach ($dirtpls as $module => $reldir) { |
| 1281 | 1281 | if (!empty($module)) { |
| 1282 | - $tpl = dol_buildpath($reldir . '/productattributevalueline_create.tpl.php'); |
|
| 1282 | + $tpl = dol_buildpath($reldir.'/productattributevalueline_create.tpl.php'); |
|
| 1283 | 1283 | } else { |
| 1284 | - $tpl = DOL_DOCUMENT_ROOT . $reldir . '/productattributevalueline_create.tpl.php'; |
|
| 1284 | + $tpl = DOL_DOCUMENT_ROOT.$reldir.'/productattributevalueline_create.tpl.php'; |
|
| 1285 | 1285 | } |
| 1286 | 1286 | |
| 1287 | 1287 | if (empty($conf->file->strict_mode)) { |
@@ -1330,9 +1330,9 @@ discard block |
||
| 1330 | 1330 | $dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); |
| 1331 | 1331 | foreach ($dirtpls as $module => $reldir) { |
| 1332 | 1332 | if (!empty($module)) { |
| 1333 | - $tpl = dol_buildpath($reldir . '/productattributevalueline_title.tpl.php'); |
|
| 1333 | + $tpl = dol_buildpath($reldir.'/productattributevalueline_title.tpl.php'); |
|
| 1334 | 1334 | } else { |
| 1335 | - $tpl = DOL_DOCUMENT_ROOT . $reldir . '/productattributevalueline_title.tpl.php'; |
|
| 1335 | + $tpl = DOL_DOCUMENT_ROOT.$reldir.'/productattributevalueline_title.tpl.php'; |
|
| 1336 | 1336 | } |
| 1337 | 1337 | if (empty($conf->file->strict_mode)) { |
| 1338 | 1338 | $res = @include $tpl; |
@@ -1411,9 +1411,9 @@ discard block |
||
| 1411 | 1411 | $dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); |
| 1412 | 1412 | foreach ($dirtpls as $module => $reldir) { |
| 1413 | 1413 | if (!empty($module)) { |
| 1414 | - $tpl = dol_buildpath($reldir . '/productattributevalueline_view.tpl.php'); |
|
| 1414 | + $tpl = dol_buildpath($reldir.'/productattributevalueline_view.tpl.php'); |
|
| 1415 | 1415 | } else { |
| 1416 | - $tpl = DOL_DOCUMENT_ROOT . $reldir . '/productattributevalueline_view.tpl.php'; |
|
| 1416 | + $tpl = DOL_DOCUMENT_ROOT.$reldir.'/productattributevalueline_view.tpl.php'; |
|
| 1417 | 1417 | } |
| 1418 | 1418 | |
| 1419 | 1419 | if (empty($conf->file->strict_mode)) { |
@@ -1435,9 +1435,9 @@ discard block |
||
| 1435 | 1435 | $dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); |
| 1436 | 1436 | foreach ($dirtpls as $module => $reldir) { |
| 1437 | 1437 | if (!empty($module)) { |
| 1438 | - $tpl = dol_buildpath($reldir . '/productattributevalueline_edit.tpl.php'); |
|
| 1438 | + $tpl = dol_buildpath($reldir.'/productattributevalueline_edit.tpl.php'); |
|
| 1439 | 1439 | } else { |
| 1440 | - $tpl = DOL_DOCUMENT_ROOT . $reldir . '/productattributevalueline_edit.tpl.php'; |
|
| 1440 | + $tpl = DOL_DOCUMENT_ROOT.$reldir.'/productattributevalueline_edit.tpl.php'; |
|
| 1441 | 1441 | } |
| 1442 | 1442 | |
| 1443 | 1443 | if (empty($conf->file->strict_mode)) { |