dolibarr 24.0.0-beta
cincoterm.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2026 Alexandre Spangaro <alexandre@inovea-conseil.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
24// Put here all includes required by your class file
25require_once DOL_DOCUMENT_ROOT.'/core/class/commondict.class.php';
26
27
31class Cincoterm extends CommonDict
32{
37 public $code;
38
42 public $label = '';
43
47 public $description = '';
48
54 public $libelle = '';
55
61 public function __construct($db)
62 {
63 $this->db = $db;
64 }
65
66
74 public function fetch($id, $code = '')
75 {
76 $sql = "SELECT";
77 $sql .= " i.rowid,";
78 $sql .= " i.code,";
79 $sql .= " i.label,";
80 $sql .= " i.libelle as description";
81 $sql .= " FROM ".$this->db->prefix()."c_incoterms as i";
82 if ($id) {
83 $sql .= " WHERE i.rowid = ".((int) $id);
84 } elseif ($code) {
85 $sql .= " WHERE i.code = '".$this->db->escape($code)."'";
86 }
87
88 dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
89 $resql = $this->db->query($sql);
90 if ($resql) {
91 if ($this->db->num_rows($resql)) {
92 $obj = $this->db->fetch_object($resql);
93
94 $this->id = $obj->rowid;
95 $this->code = $obj->code;
96 $this->label = $obj->label;
97 $this->libelle = $obj->description; // deprecated
98 $this->description = $obj->description;
99 $this->active = $obj->active;
100 }
101 $this->db->free($resql);
102
103 return 1;
104 } else {
105 $this->error = "Error ".$this->db->lasterror();
106 return -1;
107 }
108 }
109}
Class to manage dictionary Incoterms (used by imports)
__construct($db)
Constructor.
fetch($id, $code='')
Load object in memory from database.
Parent class of all other dictionary classes.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
editval_textarea active