| Total Complexity | 127 |
| Total Lines | 735 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
Complex classes like ReceptionLineBatch often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use ReceptionLineBatch, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 39 | class ReceptionLineBatch extends CommonObjectLine |
||
| 40 | { |
||
| 41 | /** |
||
| 42 | * @var DoliDB Database handler. |
||
| 43 | */ |
||
| 44 | public $db; |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @var string ID to identify managed object |
||
| 48 | */ |
||
| 49 | public $element = 'receptionlinebatch'; |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @var string Name of table without prefix where object is stored |
||
| 53 | */ |
||
| 54 | public $table_element = 'receptiondet_batch'; //!< Name of table without prefix where object is stored |
||
| 55 | public $lines = array(); |
||
| 56 | |||
| 57 | /** |
||
| 58 | * @var int ID |
||
| 59 | */ |
||
| 60 | public $id; |
||
| 61 | |||
| 62 | /** |
||
| 63 | * @var int ID of reception |
||
| 64 | */ |
||
| 65 | public $fk_reception; |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @var int ID Duplicate of origin_id (using origin_id is better) |
||
| 69 | */ |
||
| 70 | public $fk_element; |
||
| 71 | |||
| 72 | /** |
||
| 73 | * @var int ID Duplicate of fk_element |
||
| 74 | */ |
||
| 75 | public $origin_id; |
||
| 76 | |||
| 77 | /** |
||
| 78 | * @var int ID Duplicate of origin_line_id |
||
| 79 | */ |
||
| 80 | public $fk_elementdet; |
||
| 81 | |||
| 82 | /** |
||
| 83 | * @var int ID Duplicate of fk_elementdet |
||
| 84 | */ |
||
| 85 | public $origin_line_id; |
||
| 86 | |||
| 87 | /** |
||
| 88 | * @var string Type of object the fk_element refers to. Example: 'supplier_order'. |
||
| 89 | */ |
||
| 90 | public $element_type; |
||
| 91 | |||
| 92 | /** |
||
| 93 | * @var int ID |
||
| 94 | */ |
||
| 95 | public $fk_product; |
||
| 96 | |||
| 97 | /** |
||
| 98 | * @var float Quantity |
||
| 99 | */ |
||
| 100 | public $qty; |
||
| 101 | |||
| 102 | /** |
||
| 103 | * @var float Quantity asked |
||
| 104 | */ |
||
| 105 | public $qty_asked; |
||
| 106 | |||
| 107 | public $libelle; |
||
| 108 | public $label; |
||
| 109 | public $desc; |
||
| 110 | public $tva_tx; |
||
| 111 | public $vat_src_code; |
||
| 112 | public $ref_supplier; |
||
| 113 | |||
| 114 | /** |
||
| 115 | * @var int ID |
||
| 116 | */ |
||
| 117 | public $fk_entrepot; |
||
| 118 | |||
| 119 | /** |
||
| 120 | * @var int User ID |
||
| 121 | */ |
||
| 122 | public $fk_user; |
||
| 123 | |||
| 124 | public $datec = ''; |
||
| 125 | public $comment; |
||
| 126 | |||
| 127 | /** |
||
| 128 | * @var int Status |
||
| 129 | */ |
||
| 130 | public $status; |
||
| 131 | |||
| 132 | public $batch; |
||
| 133 | public $eatby = ''; |
||
| 134 | public $sellby = ''; |
||
| 135 | public $cost_price = 0; |
||
| 136 | |||
| 137 | |||
| 138 | |||
| 139 | |||
| 140 | /** |
||
| 141 | * Constructor |
||
| 142 | * |
||
| 143 | * @param DoliDB $db Database handler |
||
| 144 | */ |
||
| 145 | public function __construct($db) |
||
| 156 | } |
||
| 157 | |||
| 158 | |||
| 159 | /** |
||
| 160 | * Create object into database |
||
| 161 | * |
||
| 162 | * @param User $user User that creates |
||
| 163 | * @param int $notrigger 0=launch triggers after, 1=disable triggers |
||
| 164 | * @return int Return integer <0 if KO, Id of created object if OK |
||
| 165 | */ |
||
| 166 | public function create($user, $notrigger = 0) |
||
| 167 | { |
||
| 168 | $error = 0; |
||
| 169 | |||
| 170 | // Clean parameters |
||
| 171 | if (isset($this->fk_element)) { |
||
| 172 | $this->fk_element = (int) $this->fk_element; |
||
| 173 | } |
||
| 174 | if (isset($this->fk_product)) { |
||
| 175 | $this->fk_product = (int) $this->fk_product; |
||
| 176 | } |
||
| 177 | if (isset($this->fk_elementdet)) { |
||
| 178 | $this->fk_elementdet = (int) $this->fk_elementdet; |
||
| 179 | } |
||
| 180 | if (isset($this->qty)) { |
||
| 181 | $this->qty = (float) $this->qty; |
||
| 182 | } |
||
| 183 | if (isset($this->fk_entrepot)) { |
||
| 184 | $this->fk_entrepot = (int) $this->fk_entrepot; |
||
| 185 | } |
||
| 186 | if (isset($this->fk_user)) { |
||
| 187 | $this->fk_user = (int) $this->fk_user; |
||
| 188 | } |
||
| 189 | if (isset($this->comment)) { |
||
| 190 | $this->comment = trim($this->comment); |
||
| 191 | } |
||
| 192 | if (isset($this->status)) { |
||
| 193 | $this->status = (int) $this->status; |
||
| 194 | } |
||
| 195 | if (isset($this->batch)) { |
||
| 196 | $this->batch = trim($this->batch); |
||
| 197 | } |
||
| 198 | if (empty($this->datec)) { |
||
| 199 | $this->datec = dol_now(); |
||
| 200 | } |
||
| 201 | |||
| 202 | // Check parameters |
||
| 203 | if (empty($this->fk_product)) { |
||
| 204 | $this->error = 'Error, property ->fk_product must not be empty to create a line of reception'; |
||
| 205 | return -1; |
||
| 206 | } |
||
| 207 | if (empty($this->fk_reception)) { |
||
| 208 | $this->error = 'Error, property ->fk_reception must not be empty to create a line of reception'; |
||
| 209 | return -1; |
||
| 210 | } |
||
| 211 | |||
| 212 | // Insert request |
||
| 213 | $sql = "INSERT INTO " . MAIN_DB_PREFIX . $this->table_element . "("; |
||
| 214 | $sql .= "fk_product,"; |
||
| 215 | $sql .= "fk_element,"; |
||
| 216 | $sql .= "fk_elementdet,"; |
||
| 217 | $sql .= "element_type,"; |
||
| 218 | $sql .= "qty,"; |
||
| 219 | $sql .= "fk_entrepot,"; |
||
| 220 | $sql .= "fk_user,"; |
||
| 221 | $sql .= "datec,"; |
||
| 222 | $sql .= "comment,"; |
||
| 223 | $sql .= "status,"; |
||
| 224 | $sql .= "batch,"; |
||
| 225 | $sql .= "eatby,"; |
||
| 226 | $sql .= "sellby,"; |
||
| 227 | $sql .= "fk_reception,"; |
||
| 228 | $sql .= "cost_price"; |
||
| 229 | $sql .= ") VALUES ("; |
||
| 230 | $sql .= " " . (!isset($this->fk_product) ? 'NULL' : (int) $this->fk_product) . ","; |
||
| 231 | $sql .= " " . (!isset($this->fk_element) ? 'NULL' : (int) $this->fk_element) . ","; |
||
| 232 | $sql .= " " . (!isset($this->fk_elementdet) ? 'NULL' : (int) $this->fk_elementdet) . ","; |
||
| 233 | $sql .= " '" . (!isset($this->element_type) ? "supplier_order" : $this->db->escape($this->element_type)) . "',"; |
||
| 234 | $sql .= " " . (!isset($this->qty) ? 'NULL' : (float) $this->qty) . ","; |
||
| 235 | $sql .= " " . (!isset($this->fk_entrepot) ? 'NULL' : (int) $this->fk_entrepot) . ","; |
||
| 236 | $sql .= " " . (!isset($this->fk_user) ? 'NULL' : (int) $this->fk_user) . ","; |
||
| 237 | $sql .= " " . (!isset($this->datec) || dol_strlen($this->datec) == 0 ? 'NULL' : "'" . $this->db->idate($this->datec) . "'") . ","; |
||
| 238 | $sql .= " " . (!isset($this->comment) ? 'NULL' : "'" . $this->db->escape($this->comment) . "'") . ","; |
||
| 239 | $sql .= " " . (!isset($this->status) ? 'NULL' : (int) $this->status) . ","; |
||
| 240 | $sql .= " " . (!isset($this->batch) ? 'NULL' : "'" . $this->db->escape($this->batch) . "'") . ","; |
||
| 241 | $sql .= " " . (!isset($this->eatby) || dol_strlen($this->eatby) == 0 ? 'NULL' : "'" . $this->db->idate($this->eatby) . "'") . ","; |
||
| 242 | $sql .= " " . (!isset($this->sellby) || dol_strlen($this->sellby) == 0 ? 'NULL' : "'" . $this->db->idate($this->sellby) . "'") . ","; |
||
| 243 | $sql .= " " . ((int) $this->fk_reception) . ","; |
||
| 244 | $sql .= " " . (!isset($this->cost_price) ? '0' : (float) $this->cost_price); |
||
| 245 | $sql .= ")"; |
||
| 246 | |||
| 247 | $this->db->begin(); |
||
| 248 | |||
| 249 | dol_syslog(__METHOD__, LOG_DEBUG); |
||
| 250 | $resql = $this->db->query($sql); |
||
| 251 | if (!$resql) { |
||
| 252 | $error++; |
||
| 253 | $this->errors[] = "Error " . $this->db->lasterror(); |
||
| 254 | } |
||
| 255 | |||
| 256 | if (!$error) { |
||
| 257 | $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); |
||
| 258 | |||
| 259 | if (!$notrigger) { |
||
| 260 | // Call triggers |
||
| 261 | $result = $this->call_trigger('LINERECEPTION_CREATE', $user); |
||
| 262 | if ($result < 0) { |
||
| 263 | $error++; |
||
| 264 | } |
||
| 265 | // End call triggers |
||
| 266 | } |
||
| 267 | } |
||
| 268 | |||
| 269 | // Create extrafields |
||
| 270 | if (!$error) { |
||
| 271 | $result = $this->insertExtraFields(); |
||
| 272 | if ($result < 0) { |
||
| 273 | $error++; |
||
| 274 | } |
||
| 275 | } |
||
| 276 | |||
| 277 | // Commit or rollback |
||
| 278 | if ($error) { |
||
| 279 | foreach ($this->errors as $errmsg) { |
||
| 280 | dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR); |
||
| 281 | $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); |
||
| 282 | } |
||
| 283 | $this->db->rollback(); |
||
| 284 | return -1 * $error; |
||
| 285 | } else { |
||
| 286 | $this->db->commit(); |
||
| 287 | return $this->id; |
||
| 288 | } |
||
| 289 | } |
||
| 290 | |||
| 291 | |||
| 292 | /** |
||
| 293 | * Load object in memory from the database |
||
| 294 | * |
||
| 295 | * @param int $id Id object |
||
| 296 | * @param string $ref Ref |
||
| 297 | * @return int Return integer <0 if KO, >0 if OK |
||
| 298 | */ |
||
| 299 | public function fetch($id, $ref = '') |
||
| 300 | { |
||
| 301 | $sql = "SELECT"; |
||
| 302 | $sql .= " t.rowid,"; |
||
| 303 | $sql .= " t.fk_element,"; |
||
| 304 | $sql .= " t.fk_elementdet,"; |
||
| 305 | $sql .= " t.element_type,"; |
||
| 306 | $sql .= " t.fk_product,"; |
||
| 307 | $sql .= " t.qty,"; |
||
| 308 | $sql .= " t.fk_entrepot,"; |
||
| 309 | $sql .= " t.fk_user,"; |
||
| 310 | $sql .= " t.datec,"; |
||
| 311 | $sql .= " t.comment,"; |
||
| 312 | $sql .= " t.status,"; |
||
| 313 | $sql .= " t.tms,"; |
||
| 314 | $sql .= " t.batch,"; |
||
| 315 | $sql .= " t.eatby,"; |
||
| 316 | $sql .= " t.sellby,"; |
||
| 317 | $sql .= " t.fk_reception"; |
||
| 318 | $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element . " as t"; |
||
| 319 | if ($ref) { |
||
| 320 | $sql .= " WHERE t.ref = '" . $this->db->escape($ref) . "'"; |
||
| 321 | } else { |
||
| 322 | $sql .= " WHERE t.rowid = " . ((int) $id); |
||
| 323 | } |
||
| 324 | |||
| 325 | dol_syslog(get_only_class($this) . "::fetch"); |
||
| 326 | $resql = $this->db->query($sql); |
||
| 327 | if ($resql) { |
||
| 328 | if ($this->db->num_rows($resql)) { |
||
| 329 | $obj = $this->db->fetch_object($resql); |
||
| 330 | |||
| 331 | $this->id = $obj->rowid; |
||
| 332 | |||
| 333 | $this->fk_element = $obj->fk_element; |
||
| 334 | $this->origin_id = $obj->fk_element; |
||
| 335 | $this->fk_elementdet = $obj->fk_elementdet; |
||
| 336 | $this->origin_line_id = $obj->fk_elementdet; |
||
| 337 | $this->element_type = $obj->element_type; |
||
| 338 | $this->origin_type = $obj->element_type; |
||
| 339 | |||
| 340 | $this->fk_product = $obj->fk_product; |
||
| 341 | $this->qty = $obj->qty; |
||
| 342 | $this->fk_entrepot = $obj->fk_entrepot; |
||
| 343 | $this->fk_user = $obj->fk_user; |
||
| 344 | $this->datec = $this->db->jdate($obj->datec); |
||
| 345 | $this->comment = $obj->comment; |
||
| 346 | $this->status = $obj->status; |
||
| 347 | $this->tms = $this->db->jdate($obj->tms); |
||
| 348 | $this->batch = $obj->batch; |
||
| 349 | $this->eatby = $this->db->jdate($obj->eatby); |
||
| 350 | $this->sellby = $this->db->jdate($obj->sellby); |
||
| 351 | $this->fk_reception = $obj->fk_reception; |
||
| 352 | |||
| 353 | $this->fetch_optionals(); |
||
| 354 | } |
||
| 355 | $this->db->free($resql); |
||
| 356 | |||
| 357 | return 1; |
||
| 358 | } else { |
||
| 359 | $this->error = "Error " . $this->db->lasterror(); |
||
| 360 | return -1; |
||
| 361 | } |
||
| 362 | } |
||
| 363 | |||
| 364 | |||
| 365 | /** |
||
| 366 | * Update object into database |
||
| 367 | * |
||
| 368 | * @param User $user User that modifies |
||
| 369 | * @param int $notrigger 0=launch triggers after, 1=disable triggers |
||
| 370 | * @return int Return integer <0 if KO, >0 if OK |
||
| 371 | */ |
||
| 372 | public function update($user, $notrigger = 0) |
||
| 373 | { |
||
| 374 | $error = 0; |
||
| 375 | |||
| 376 | // Clean parameters |
||
| 377 | |||
| 378 | if (isset($this->fk_element)) { |
||
| 379 | $this->fk_element = (int) $this->fk_element; |
||
| 380 | } |
||
| 381 | if (isset($this->fk_product)) { |
||
| 382 | $this->fk_product = (int) $this->fk_product; |
||
| 383 | } |
||
| 384 | if (isset($this->fk_elementdet)) { |
||
| 385 | $this->fk_elementdet = (int) $this->fk_elementdet; |
||
| 386 | } |
||
| 387 | if (isset($this->qty)) { |
||
| 388 | $this->qty = (float) $this->qty; |
||
| 389 | } |
||
| 390 | if (isset($this->fk_entrepot)) { |
||
| 391 | $this->fk_entrepot = (int) $this->fk_entrepot; |
||
| 392 | } |
||
| 393 | if (isset($this->fk_user)) { |
||
| 394 | $this->fk_user = (int) $this->fk_user; |
||
| 395 | } |
||
| 396 | if (isset($this->comment)) { |
||
| 397 | $this->comment = trim($this->comment); |
||
| 398 | } |
||
| 399 | if (isset($this->status)) { |
||
| 400 | $this->status = (int) $this->status; |
||
| 401 | } |
||
| 402 | if (isset($this->batch)) { |
||
| 403 | $this->batch = trim($this->batch); |
||
| 404 | } |
||
| 405 | |||
| 406 | |||
| 407 | |||
| 408 | // Check parameters |
||
| 409 | // Put here code to add a control on parameters values |
||
| 410 | |||
| 411 | // Update request |
||
| 412 | $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET"; |
||
| 413 | $sql .= " fk_element=" . (isset($this->fk_element) ? $this->fk_element : "null") . ","; |
||
| 414 | $sql .= " fk_product=" . (isset($this->fk_product) ? $this->fk_product : "null") . ","; |
||
| 415 | $sql .= " fk_elementdet=" . (isset($this->fk_elementdet) ? $this->fk_elementdet : "null") . ","; |
||
| 416 | $sql .= " qty=" . (isset($this->qty) ? $this->qty : "null") . ","; |
||
| 417 | $sql .= " fk_entrepot=" . (isset($this->fk_entrepot) ? $this->fk_entrepot : "null") . ","; |
||
| 418 | $sql .= " fk_user=" . (isset($this->fk_user) ? $this->fk_user : "null") . ","; |
||
| 419 | $sql .= " datec=" . (dol_strlen($this->datec) != 0 ? "'" . $this->db->idate($this->datec) . "'" : 'null') . ","; |
||
| 420 | $sql .= " comment=" . (isset($this->comment) ? "'" . $this->db->escape($this->comment) . "'" : "null") . ","; |
||
| 421 | $sql .= " status=" . (isset($this->status) ? $this->status : "null") . ","; |
||
| 422 | $sql .= " tms=" . (dol_strlen($this->tms) != 0 ? "'" . $this->db->idate($this->tms) . "'" : 'null') . ","; |
||
| 423 | $sql .= " batch=" . (isset($this->batch) ? "'" . $this->db->escape($this->batch) . "'" : "null") . ","; |
||
| 424 | $sql .= " eatby=" . (dol_strlen($this->eatby) != 0 ? "'" . $this->db->idate($this->eatby) . "'" : 'null') . ","; |
||
| 425 | $sql .= " sellby=" . (dol_strlen($this->sellby) != 0 ? "'" . $this->db->idate($this->sellby) . "'" : 'null'); |
||
| 426 | $sql .= " WHERE rowid=" . ((int) $this->id); |
||
| 427 | |||
| 428 | $this->db->begin(); |
||
| 429 | |||
| 430 | dol_syslog(__METHOD__); |
||
| 431 | $resql = $this->db->query($sql); |
||
| 432 | if (!$resql) { |
||
| 433 | $error++; |
||
| 434 | $this->errors[] = "Error " . $this->db->lasterror(); |
||
| 435 | } |
||
| 436 | |||
| 437 | if (!$error) { |
||
| 438 | if (empty($this->id) && !empty($this->rowid)) { |
||
| 439 | $this->id = $this->rowid; |
||
| 440 | } |
||
| 441 | $result = $this->insertExtraFields(); |
||
| 442 | if ($result < 0) { |
||
| 443 | $error++; |
||
| 444 | } |
||
| 445 | |||
| 446 | if (!$notrigger) { |
||
| 447 | // Call triggers |
||
| 448 | $result = $this->call_trigger('LINERECEPTION_MODIFY', $user); |
||
| 449 | if ($result < 0) { |
||
| 450 | $error++; |
||
| 451 | } |
||
| 452 | // End call triggers |
||
| 453 | } |
||
| 454 | } |
||
| 455 | |||
| 456 | // Commit or rollback |
||
| 457 | if ($error) { |
||
| 458 | foreach ($this->errors as $errmsg) { |
||
| 459 | dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR); |
||
| 460 | $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); |
||
| 461 | } |
||
| 462 | $this->db->rollback(); |
||
| 463 | return -1 * $error; |
||
| 464 | } else { |
||
| 465 | $this->db->commit(); |
||
| 466 | return 1; |
||
| 467 | } |
||
| 468 | } |
||
| 469 | |||
| 470 | |||
| 471 | /** |
||
| 472 | * Delete object in database |
||
| 473 | * |
||
| 474 | * @param User $user User that deletes |
||
| 475 | * @param int $notrigger 0=launch triggers after, 1=disable triggers |
||
| 476 | * @return int Return integer <0 if KO, >0 if OK |
||
| 477 | */ |
||
| 478 | public function delete($user, $notrigger = 0) |
||
| 527 | } |
||
| 528 | } |
||
| 529 | |||
| 530 | |||
| 531 | /** |
||
| 532 | * Load an object from its id and create a new one in database |
||
| 533 | * |
||
| 534 | * @param User $user User making the clone |
||
| 535 | * @param int $fromid Id of object to clone |
||
| 536 | * @return int New id of clone |
||
| 537 | */ |
||
| 538 | public function createFromClone(User $user, $fromid) |
||
| 576 | } |
||
| 577 | } |
||
| 578 | |||
| 579 | |||
| 580 | |||
| 581 | /** |
||
| 582 | * Return label of the status of object |
||
| 583 | * |
||
| 584 | * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto |
||
| 585 | * @return string Label |
||
| 586 | */ |
||
| 587 | public function getLibStatut($mode = 0) |
||
| 588 | { |
||
| 589 | return $this->LibStatut($this->status, $mode); |
||
| 590 | } |
||
| 591 | |||
| 592 | // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
||
| 593 | /** |
||
| 594 | * Return label of a status |
||
| 595 | * |
||
| 596 | * @param int $status Id status |
||
| 597 | * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto |
||
| 598 | * @return string Label of status |
||
| 599 | */ |
||
| 600 | public function LibStatut($status, $mode = 0) |
||
| 601 | { |
||
| 602 | // phpcs:enable |
||
| 603 | global $langs; |
||
| 604 | $langs->load('orders'); |
||
| 605 | |||
| 606 | if ($mode == 0) { |
||
| 607 | return $langs->trans($this->labelStatus[$status]); |
||
| 608 | } elseif ($mode == 1) { |
||
| 609 | return $langs->trans($this->labelStatusShort[$status]); |
||
| 610 | } elseif ($mode == 2) { |
||
| 611 | return $langs->trans($this->labelStatus[$status]); |
||
| 612 | } elseif ($mode == 3) { |
||
| 613 | if ($status == 0) { |
||
| 614 | return img_picto($langs->trans($this->labelStatus[$status]), 'statut0'); |
||
| 615 | } elseif ($status == 1) { |
||
| 616 | return img_picto($langs->trans($this->labelStatus[$status]), 'statut4'); |
||
| 617 | } elseif ($status == 2) { |
||
| 618 | return img_picto($langs->trans($this->labelStatus[$status]), 'statut8'); |
||
| 619 | } |
||
| 620 | } elseif ($mode == 4) { |
||
| 621 | if ($status == 0) { |
||
| 622 | return img_picto($langs->trans($this->labelStatus[$status]), 'statut0') . ' ' . $langs->trans($this->labelStatus[$status]); |
||
| 623 | } elseif ($status == 1) { |
||
| 624 | return img_picto($langs->trans($this->labelStatus[$status]), 'statut4') . ' ' . $langs->trans($this->labelStatus[$status]); |
||
| 625 | } elseif ($status == 2) { |
||
| 626 | return img_picto($langs->trans($this->labelStatus[$status]), 'statut8') . ' ' . $langs->trans($this->labelStatus[$status]); |
||
| 627 | } |
||
| 628 | } elseif ($mode == 5) { |
||
| 629 | if ($status == 0) { |
||
| 630 | return '<span class="hideonsmartphone">' . $langs->trans($this->labelStatusShort[$status]) . ' </span>' . img_picto($langs->trans($this->labelStatus[$status]), 'statut0'); |
||
| 631 | } elseif ($status == 1) { |
||
| 632 | return '<span class="hideonsmartphone">' . $langs->trans($this->labelStatusShort[$status]) . ' </span>' . img_picto($langs->trans($this->labelStatus[$status]), 'statut4'); |
||
| 633 | } elseif ($status == 2) { |
||
| 634 | return '<span class="hideonsmartphone">' . $langs->trans($this->labelStatusShort[$status]) . ' </span>' . img_picto($langs->trans($this->labelStatus[$status]), 'statut8'); |
||
| 635 | } |
||
| 636 | } |
||
| 637 | return ""; |
||
| 638 | } |
||
| 639 | |||
| 640 | |||
| 641 | /** |
||
| 642 | * Initialise object with example values |
||
| 643 | * Id must be 0 if object instance is a specimen |
||
| 644 | * |
||
| 645 | * @return int |
||
| 646 | */ |
||
| 647 | public function initAsSpecimen() |
||
| 666 | } |
||
| 667 | |||
| 668 | /** |
||
| 669 | * Load object in memory from the database |
||
| 670 | * |
||
| 671 | * @param string $sortorder Sort Order |
||
| 672 | * @param string $sortfield Sort field |
||
| 673 | * @param int $limit limit |
||
| 674 | * @param int $offset offset limit |
||
| 675 | * @param string|array $filter filter array |
||
| 676 | * @param string $filtermode filter mode (AND or OR) |
||
| 677 | * @return int Return integer <0 if KO, >0 if OK |
||
| 678 | */ |
||
| 679 | public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND') |
||
| 774 | } |
||
| 775 | } |
||
| 776 | } |
||
| 777 |
This property has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.