27 require_once DOL_DOCUMENT_ROOT.
'/core/class/commondocgenerator.class.php';
54 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
82 public function info($langs)
84 $langs->load(
"bills");
85 return $langs->trans(
"NoDescription");
106 $langs->load(
"bills");
107 return $langs->trans(
"NoExample");
131 return $langs->trans(
"Function_getNextValue_InModuleNotWorking");
143 $langs->load(
"admin");
145 if ($this->version ==
'development') {
146 return $langs->trans(
"VersionDevelopment");
147 } elseif ($this->version ==
'experimental') {
148 return $langs->trans(
"VersionExperimental");
149 } elseif ($this->version ==
'dolibarr') {
151 } elseif ($this->version) {
152 return $this->version;
154 return $langs->trans(
"NotAvailable");
172 $resql = $dbs->query(
$sql);
174 $num = $dbs->num_rows($resql);
177 $row = $dbs->fetch_row($resql);
178 $list[$row[0]] = $row[1];
199 $langs->loadLangs(array(
"admin",
"companies"));
203 if (!empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && !empty($this->code_null)) {
204 $strikestart =
'<strike>';
205 $strikeend =
'</strike> '.yn(1, 1, 2).
' ('.$langs->trans(
"ForcedToByAModule", $langs->transnoentities(
"yes")).
')';
210 $s .= $langs->trans(
"Name").
': <b>'.$this->
getNom($langs).
'</b><br>';
211 } elseif ($type == -1) {
212 $s .= $langs->trans(
"Version").
': <b>'.$this->
getVersion().
'</b><br>';
213 } elseif ($type == 0) {
214 $s .= $langs->trans(
"CustomerCodeDesc").
'<br>';
215 } elseif ($type == 1) {
216 $s .= $langs->trans(
"SupplierCodeDesc").
'<br>';
219 $s .= $langs->trans(
"ValidityControledByModule").
': <b>'.$this->
getNom($langs).
'</b><br>';
222 $s .=
'<u>'.$langs->trans(
"ThisIsModuleRules").
':</u><br>';
224 $s .= $langs->trans(
"RequiredIfCustomer").
': '.$strikestart;
225 $s .=
yn(!$this->code_null, 1, 2).$strikeend;
227 } elseif ($type == 1) {
228 $s .= $langs->trans(
"RequiredIfSupplier").
': '.$strikestart;
229 $s .=
yn(!$this->code_null, 1, 2).$strikeend;
231 } elseif ($type == -1) {
232 $s .= $langs->trans(
"Required").
': '.$strikestart;
233 $s .=
yn(!$this->code_null, 1, 2).$strikeend;
236 $s .= $langs->trans(
"CanBeModifiedIfOk").
': ';
237 $s .=
yn($this->code_modifiable, 1, 2);
239 $s .= $langs->trans(
"CanBeModifiedIfKo").
': '.
yn($this->code_modifiable_invalide, 1, 2).
'<br>';
240 $s .= $langs->trans(
"AutomaticCode").
': '.
yn($this->code_auto, 1, 2).
'<br>';
242 if ($type == 0 || $type == -1) {
244 if (empty($nextval)) {
245 $nextval = $langs->trans(
"Undefined");
247 $s .= $langs->trans(
"NextValue").($type == -1 ?
' ('.$langs->trans(
"Customer").
')' :
'').
': <b>'.$nextval.
'</b><br>';
249 if ($type == 1 || $type == -1) {
251 if (empty($nextval)) {
252 $nextval = $langs->trans(
"Undefined");
254 $s .= $langs->trans(
"NextValue").($type == -1 ?
' ('.$langs->trans(
"Supplier").
')' :
'').
': <b>'.$nextval.
'</b>';
292 $langs->load(
"bills");
293 return $langs->trans(
"NoDescription");
306 $langs->load(
"bills");
307 return $langs->trans(
"NoExample");
329 $langs->load(
"admin");
331 if ($this->version ==
'development') {
332 return $langs->trans(
"VersionDevelopment");
333 } elseif ($this->version ==
'experimental') {
334 return $langs->trans(
"VersionExperimental");
335 } elseif ($this->version ==
'dolibarr') {
337 } elseif ($this->version) {
338 return $this->version;
340 return $langs->trans(
"NotAvailable");
356 $langs->load(
"admin");
360 $s .= $langs->trans(
"Name").
': <b>'.$this->
name.
'</b><br>';
361 $s .= $langs->trans(
"Version").
': <b>'.$this->
getVersion().
'</b><br>';
366 if ($type == 0 || $type == -1) {
367 $result = $this->
get_code($db, $soc,
'customer');
368 $nextval = $this->code;
369 if (empty($nextval)) {
370 $nextval = $langs->trans(
"Undefined");
372 $s .= $langs->trans(
"NextValue").($type == -1 ?
' ('.$langs->trans(
"Customer").
')' :
'').
': <b>'.$nextval.
'</b><br>';
374 if ($type == 1 || $type == -1) {
375 $result = $this->
get_code($db, $soc,
'supplier');
376 $nextval = $this->code;
377 if (empty($nextval)) {
378 $nextval = $langs->trans(
"Undefined");
380 $s .= $langs->trans(
"NextValue").($type == -1 ?
' ('.$langs->trans(
"Supplier").
')' :
'').
': <b>'.$nextval.
'</b>';
394 public function get_code($db, $societe, $type =
'')
399 return $langs->trans(
"NotAvailable");